Add stream base file uploading #338
Merged
pahansith
merged 2 commits from rajitha/device-mgt-core:stream-api
into master
8 months ago
Loading…
Reference in new issue
There is no content yet.
Delete Branch 'rajitha/device-mgt-core:stream-api'
Deleting a branch is permanent. It CANNOT be undone. Continue?
Purpose
7ee6ecfc71
to0a9e5a3d3f
9 months ago0a9e5a3d3f
tob3be13f0ae
9 months agoWIP: Add stream base file uploadingto Add stream base file uploading 9 months ago378ee295db
to938d604a30
9 months ago}
@SuppressWarnings("unchecked")
private <T> Application createApplicationBasedOnRemoteStatus(T app, boolean isPublished) throws ApplicationManagementException {
Add method level comment
List<?> releaseWrappers = ApplicationManagementUtil.deriveApplicationWithoutRelease(app);
Application createdApplication = triggerApplicationCreation(app, isPublished);
if (createdApplication == null) {
throw new ApplicationManagementException("Application creation request failed");
Improve error message
((CustomAppWrapper) app).setCustomAppReleaseWrappers((List<CustomAppReleaseWrapper>) releaseWrappers);
createApplicationReleaseBasedOnRemoteStatus(createdApplication.getId(),
((CustomAppWrapper) app).getCustomAppReleaseWrappers().get(0), isPublished);
}
Handle else part here
return triggerApplicationCreation(app, isPublished);
}
private <T> Application triggerApplicationCreation(T app, boolean isPublished) throws ApplicationManagementException {
Add method level comment
}
}
private <T> ApplicationRelease createApplicationReleaseBasedOnRemoteStatus(int appId, T releaseWrapper, boolean isPublished)
Add method level comment
if (ApplicationManagementUtil.getRemoteStatusFromWrapper(releaseWrapper)) {
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
String username = PrivilegedCarbonContext.getThreadLocalCarbonContext().getUsername();
new Thread(() -> {
Add into new method
if (releaseWrapper instanceof CustomAppReleaseWrapper) {
return triggerCustomAppRelease(appId, (CustomAppReleaseWrapper) releaseWrapper, isPublished);
}
Handle Else section
return new ApplicationRelease();
}
private ApplicationRelease triggerEntAppRelease(int appId, EntAppReleaseWrapper releaseWrapper, boolean isPublished)
Add method level comment
validateReleaseCreatingRequest(releaseWrapper, deviceType);
validateBinaryArtifact(releaseWrapper.getBinaryFile());
validateImageArtifacts(releaseWrapper.getIcon(), releaseWrapper.getScreenshots());
//validateBinaryArtifact(releaseWrapper.getBinaryFile());
Remove commented lines
}
return remoteFileDownloaderService;
} catch (FileTransferServiceException e) {
throw new FileDownloaderServiceException("Error encountered while acquiring file downloader service", e);
Log the error
}
}
private static class LocalFileDownloaderService implements FileDownloaderService {
Add method level comment
try {
return fileTransferService.resolve(downloadUrl);
} catch (FileTransferServiceException e) {
throw new FileDownloaderServiceException("Error encountered while downloading file pointing by " + downloadUrl, e);
Log the error
}
}
private static class RemoteFileDownloaderService implements FileDownloaderService {
Add method level comment
}
}
private FileMetaEntry getFileMetaEntry(URL downloadUrl) throws FileDownloaderServiceException {
Add method level comment
}
if (!Files.isDirectory(root)) {
throw new FileTransferServiceHelperUtilException(root.toAbsolutePath() + " is not a directory");
log the error
}
}
private static Path locateArtifactHolder(String artifactHolder) throws FileTransferServiceHelperUtilException, NotFoundException {
Add method level comments
}
if (!Objects.equals(System.getProperty("iot.gateway.host"), downloadUrl.getHost())) {
return null;
Add debug logs for these null returning points
938d604a30
to25aa1af786
8 months ago25aa1af786
to3798134011
8 months ago78dd491789
into master 8 months agoReviewers
78dd491789
.