Search in sources :

Example 1 with UploadProgress

use of com.thinkbiganalytics.feedmgr.rest.model.UploadProgress in project kylo by Teradata.

the class UploadProgressService method addUploadStatus.

public UploadProgressMessage addUploadStatus(String uploadKey, String message, boolean complete, boolean success) {
    UploadProgress uploadProgress = getUploadStatus(uploadKey);
    if (uploadProgress != null) {
        UploadProgressMessage uploadProgressMessage = new UploadProgressMessage(message);
        if (complete) {
            uploadProgressMessage.complete(success);
        }
        uploadProgress.getMessages().add(uploadProgressMessage);
        return uploadProgressMessage;
    }
    return null;
}
Also used : UploadProgressMessage(com.thinkbiganalytics.feedmgr.rest.model.UploadProgressMessage) UploadProgress(com.thinkbiganalytics.feedmgr.rest.model.UploadProgress)

Example 2 with UploadProgress

use of com.thinkbiganalytics.feedmgr.rest.model.UploadProgress in project kylo by Teradata.

the class UploadProgressService method updateUploadStatus.

public UploadProgressMessage updateUploadStatus(String uploadKey, String messageKey, String message, boolean complete) {
    UploadProgress uploadProgress = getUploadStatus(uploadKey);
    if (uploadProgress != null) {
        UploadProgressMessage uploadProgressMessage = uploadProgress.getMessage(messageKey);
        if (uploadProgressMessage == null) {
            uploadProgressMessage = new UploadProgressMessage();
            uploadProgressMessage.setMessageKey(messageKey);
        }
        uploadProgressMessage.setMessage(message);
        uploadProgressMessage.setDateTime(DateTime.now());
        uploadProgressMessage.setComplete(complete);
        uploadProgress.getMessages().add(new UploadProgressMessage(message));
        return uploadProgressMessage;
    }
    return null;
}
Also used : UploadProgressMessage(com.thinkbiganalytics.feedmgr.rest.model.UploadProgressMessage) UploadProgress(com.thinkbiganalytics.feedmgr.rest.model.UploadProgress)

Example 3 with UploadProgress

use of com.thinkbiganalytics.feedmgr.rest.model.UploadProgress in project kylo by Teradata.

the class FeedImporter method validateAndImport.

public ImportFeed validateAndImport() {
    UploadProgress progress = uploadProgressService.getUploadStatus(importFeedOptions.getUploadKey());
    progress.setSections(ImportSection.sectionsForImportAsString(ImportType.FEED));
    validate();
    if (this.importFeed.isValid()) {
        try {
            importFeed();
        } catch (Exception e) {
            // rollback
            log.error("Error importing feed {}", fileName, e);
        }
    }
    return importFeed;
}
Also used : UploadProgress(com.thinkbiganalytics.feedmgr.rest.model.UploadProgress) ImportFeedException(com.thinkbiganalytics.feedmgr.service.feed.ImportFeedException) IOException(java.io.IOException) ImportException(com.thinkbiganalytics.feedmgr.service.template.importing.ImportException)

Example 4 with UploadProgress

use of com.thinkbiganalytics.feedmgr.rest.model.UploadProgress in project kylo by Teradata.

the class UploadProgressService method completeSection.

public void completeSection(ImportOptions options, ImportSection.Section section) {
    UploadProgress progress = getUploadStatus(options.getUploadKey());
    progress.completeSection(section.name());
}
Also used : UploadProgress(com.thinkbiganalytics.feedmgr.rest.model.UploadProgress)

Example 5 with UploadProgress

use of com.thinkbiganalytics.feedmgr.rest.model.UploadProgress in project kylo by Teradata.

the class TemplateImporter method initializeImportTemplateArchive.

private void initializeImportTemplateArchive() throws ImportException {
    try {
        UploadProgress progress = uploadProgressService.getUploadStatus(importOptions.getUploadKey());
        progress.setSections(ImportSection.sectionsForImportAsString(ImportType.TEMPLATE));
        InputStream inputStream = new ByteArrayInputStream(file);
        this.importTemplate = ImportUtil.openZip(fileName, inputStream);
        this.importTemplate.setValid(true);
        Set<ImportComponentOption> componentOptions = ImportUtil.inspectZipComponents(file, ImportType.TEMPLATE);
        importTemplateOptions.addOptionsIfNotExists(componentOptions);
        importTemplateOptions.findImportComponentOption(ImportComponent.TEMPLATE_CONNECTION_INFORMATION).addConnectionInfo(importTemplate.getReusableTemplateConnections());
        importTemplateOptions.findImportComponentOption(ImportComponent.REMOTE_INPUT_PORT).addRemoteProcessGroupInputPorts(importTemplate.getRemoteProcessGroupInputPortNames());
        importTemplate.setImportOptions(this.importTemplateOptions);
    } catch (Exception e) {
        throw new ImportException("Unable to open template archive " + fileName + " for import. ", e);
    }
}
Also used : ByteArrayInputStream(java.io.ByteArrayInputStream) ByteArrayInputStream(java.io.ByteArrayInputStream) InputStream(java.io.InputStream) ImportComponentOption(com.thinkbiganalytics.feedmgr.rest.model.ImportComponentOption) UploadProgress(com.thinkbiganalytics.feedmgr.rest.model.UploadProgress) IOException(java.io.IOException)

Aggregations

UploadProgress (com.thinkbiganalytics.feedmgr.rest.model.UploadProgress)6 IOException (java.io.IOException)3 UploadProgressMessage (com.thinkbiganalytics.feedmgr.rest.model.UploadProgressMessage)2 ByteArrayInputStream (java.io.ByteArrayInputStream)2 InputStream (java.io.InputStream)2 ImportComponentOption (com.thinkbiganalytics.feedmgr.rest.model.ImportComponentOption)1 ImportFeedException (com.thinkbiganalytics.feedmgr.service.feed.ImportFeedException)1 ImportException (com.thinkbiganalytics.feedmgr.service.template.importing.ImportException)1