Improve APPM logic

feature/appm-store/pbac
lasanthaDLPDS 6 years ago
parent b82717790d
commit a372e42443

@ -88,5 +88,5 @@ public interface ApplicationStorageManager {
* @return {@link InputStream} * @return {@link InputStream}
* @throws ApplicationStorageManagementException throws if an error occurs when accessing the file. * @throws ApplicationStorageManagementException throws if an error occurs when accessing the file.
*/ */
InputStream getFileSttream(String path) throws ApplicationStorageManagementException; InputStream getFileStream(String path) throws ApplicationStorageManagementException;
} }

@ -583,12 +583,14 @@ public class ApplicationManagerImpl implements ApplicationManager {
log.error(msg); log.error(msg);
throw new ApplicationManagementException(msg, e); throw new ApplicationManagementException(msg, e);
} catch (UserStoreException e) { } catch (UserStoreException e) {
throw new ApplicationManagementException( String msg = "User-store exception while checking whether the user " + userName + " of tenant " + tenantId
"User-store exception while checking whether the user " + userName + " of tenant " + tenantId + " has the publisher permission";
+ " has the publisher permission", e); log.error(msg);
throw new ApplicationManagementException(msg, e);
} catch (ApplicationManagementDAOException e) { } catch (ApplicationManagementDAOException e) {
throw new ApplicationManagementException( String msg = "DAO exception while getting applications for the user " + userName + " of tenant " + tenantId;
"DAO exception while getting applications for the user " + userName + " of tenant " + tenantId, e); log.error(msg);
throw new ApplicationManagementException(msg, e);
} finally { } finally {
ConnectionManagerUtil.closeDBConnection(); ConnectionManagerUtil.closeDBConnection();
} }
@ -792,23 +794,26 @@ public class ApplicationManagerImpl implements ApplicationManager {
ConnectionManagerUtil.commitDBTransaction(); ConnectionManagerUtil.commitDBTransaction();
return applicationRelease; return applicationRelease;
} catch (TransactionManagementException e) { } catch (TransactionManagementException e) {
throw new ApplicationManagementException( String msg = "Error occurred while staring application release creating transaction for application Id: "
"Error occurred while staring application release creating transaction for application Id: " + applicationId;
+ applicationId, e); log.error(msg);
throw new ApplicationManagementException(msg, e);
} catch (DBConnectionException e) { } catch (DBConnectionException e) {
throw new ApplicationManagementException( String msg = "Error occurred while adding application release into IoTS app management ApplicationDTO id of"
"Error occurred while adding application release into IoTS app management ApplicationDTO id of the " + " the application release: " + applicationId;
+ "application release: " + applicationId, e); log.error(msg);
throw new ApplicationManagementException(msg, e);
} catch (LifeCycleManagementDAOException e) { } catch (LifeCycleManagementDAOException e) {
ConnectionManagerUtil.rollbackDBTransaction(); ConnectionManagerUtil.rollbackDBTransaction();
throw new ApplicationManagementException( String msg = "Error occurred while adding new application release lifecycle state to the application"
"Error occurred while adding new application release lifecycle state to the application release: " + " release: " + applicationId;
+ applicationId, e); log.error(msg);
throw new ApplicationManagementException(msg, e);
} catch (ApplicationManagementDAOException e) { } catch (ApplicationManagementDAOException e) {
ConnectionManagerUtil.rollbackDBTransaction(); ConnectionManagerUtil.rollbackDBTransaction();
throw new ApplicationManagementException( String msg = "Error occurred while adding new application release for application " + applicationId;
"Error occurred while adding new application release for application " + applicationId, e); log.error(msg);
throw new ApplicationManagementException(msg, e);
} finally { } finally {
ConnectionManagerUtil.closeDBConnection(); ConnectionManagerUtil.closeDBConnection();
} }

@ -212,7 +212,7 @@ public class ApplicationStorageManagerImpl implements ApplicationStorageManager
} }
@Override @Override
public InputStream getFileSttream (String path) throws ApplicationStorageManagementException { public InputStream getFileStream(String path) throws ApplicationStorageManagementException {
String filePath = storagePath + path; String filePath = storagePath + path;
try { try {
return StorageManagementUtil.getInputStream(filePath); return StorageManagementUtil.getInputStream(filePath);

@ -80,7 +80,7 @@ public class AppmDataHandlerImpl implements AppmDataHandler {
throw new NotFoundException(msg); throw new NotFoundException(msg);
} }
artifactPath = appReleaseHashValue + Constants.FORWARD_SLASH + artifactName; artifactPath = appReleaseHashValue + Constants.FORWARD_SLASH + artifactName;
InputStream inputStream = applicationStorageManager.getFileSttream(artifactPath); InputStream inputStream = applicationStorageManager.getFileStream(artifactPath);
if (inputStream == null) { if (inputStream == null) {
String msg = "Couldn't file the file in the file system. File path: " + artifactPath; String msg = "Couldn't file the file in the file system. File path: " + artifactPath;
log.error(msg); log.error(msg);

Loading…
Cancel
Save