Search in sources :

Example 1 with UploadedFileItem

use of org.wso2.carbon.bpel.deployer.services.types.UploadedFileItem in project carbon-business-process by wso2.

the class HIUploaderClient method addUploadedFileItem.

public void addUploadedFileItem(DataHandler dataHandler, String fileName, String fileType) {
    UploadedFileItem uploadedFileItem = new UploadedFileItem();
    uploadedFileItem.setDataHandler(dataHandler);
    uploadedFileItem.setFileName(fileName);
    uploadedFileItem.setFileType(fileType);
    uploadServiceTypeList.add(uploadedFileItem);
}
Also used : UploadedFileItem(org.wso2.carbon.humantask.stub.upload.types.UploadedFileItem)

Example 2 with UploadedFileItem

use of org.wso2.carbon.bpel.deployer.services.types.UploadedFileItem in project carbon-business-process by wso2.

the class BPELUploaderClient method addUploadedFileItem.

public void addUploadedFileItem(DataHandler dataHandler, String fileName, String fileType) {
    UploadedFileItem uploadedFileItem = new UploadedFileItem();
    uploadedFileItem.setDataHandler(dataHandler);
    uploadedFileItem.setFileName(fileName);
    uploadedFileItem.setFileType(fileType);
    uploadServiceTypeList.add(uploadedFileItem);
}
Also used : UploadedFileItem(org.wso2.carbon.bpel.stub.upload.types.UploadedFileItem)

Example 3 with UploadedFileItem

use of org.wso2.carbon.bpel.deployer.services.types.UploadedFileItem in project carbon-business-process by wso2.

the class BPELUploader method uploadService.

public void uploadService(UploadedFileItem[] fileItems) throws AxisFault {
    // First lets filter for jar resources
    ConfigurationContext configurationContext = getConfigContext();
    String repo = configurationContext.getAxisConfiguration().getRepository().getPath();
    if (CarbonUtils.isURL(repo)) {
        throw new AxisFault("URL Repositories are not supported: " + repo);
    }
    // Writting the artifacts to the proper location
    String bpelDirectory = repo + File.separator + BPELConstants.BPEL_REPO_DIRECTORY;
    String bpelTemp = CarbonUtils.getCarbonHome() + BPELConstants.BPEL_PACKAGE_TEMP_DIRECTORY;
    File bpelTempDir = new File(bpelTemp);
    if (!bpelTempDir.exists() && !bpelTempDir.mkdirs()) {
        throw new AxisFault("Fail to create the directory: " + bpelTempDir.getAbsolutePath());
    }
    File bpelDir = new File(bpelDirectory);
    if (!bpelDir.exists() && !bpelDir.mkdirs()) {
        throw new AxisFault("Fail to create the directory: " + bpelDir.getAbsolutePath());
    }
    for (UploadedFileItem uploadedFile : fileItems) {
        String fileName = uploadedFile.getFileName();
        if (fileName == null || fileName.equals("")) {
            throw new AxisFault("Invalid file name. File name is not available");
        }
        if (uploadedFile.getFileType().equals(BPELConstants.BPEL_PACKAGE_EXTENSION)) {
            try {
                writeResource(uploadedFile.getDataHandler(), bpelTemp, fileName, bpelDir);
            } catch (IOException e) {
                throw new AxisFault("IOError: Writing resource failed.", e);
            }
        } else {
            throw new AxisFault("Invalid file type : " + uploadedFile.getFileType() + " ." + BPELConstants.BPEL_PACKAGE_EXTENSION + " file type is expected");
        }
    }
}
Also used : AxisFault(org.apache.axis2.AxisFault) ConfigurationContext(org.apache.axis2.context.ConfigurationContext) UploadedFileItem(org.wso2.carbon.bpel.deployer.services.types.UploadedFileItem) IOException(java.io.IOException) File(java.io.File)

Example 4 with UploadedFileItem

use of org.wso2.carbon.bpel.deployer.services.types.UploadedFileItem in project carbon-business-process by wso2.

the class BPMNUploaderClient method addUploadedFileItem.

public void addUploadedFileItem(DataHandler dataHandler, String fileName, String fileType) {
    UploadedFileItem uploadedFileItem = new UploadedFileItem();
    uploadedFileItem.setDataHandler(dataHandler);
    uploadedFileItem.setFileName(fileName);
    uploadedFileItem.setFileType(fileType);
    uploadServiceTypeList.add(uploadedFileItem);
}
Also used : UploadedFileItem(org.wso2.carbon.bpmn.core.mgt.model.xsd.UploadedFileItem)

Example 5 with UploadedFileItem

use of org.wso2.carbon.bpel.deployer.services.types.UploadedFileItem in project carbon-business-process by wso2.

the class HumanTaskUploader method uploadHumanTask.

public void uploadHumanTask(UploadedFileItem[] fileItems) throws AxisFault {
    // First lets filter for jar resources
    ConfigurationContext configurationContext = getConfigContext();
    String repo = configurationContext.getAxisConfiguration().getRepository().getPath();
    if (CarbonUtils.isURL(repo)) {
        throw new AxisFault("URL Repositories are not supported: " + repo);
    }
    // Writting the artifacts to the proper location
    String humantaskDirectory = getHumanTaskLocation(repo);
    String humantaskTemp = CarbonUtils.getCarbonHome() + File.separator + HumanTaskConstants.HUMANTASK_PACKAGE_TEMP_DIRECTORY;
    File humantaskTempDir = new File(humantaskTemp);
    if (!humantaskTempDir.exists() && !humantaskTempDir.mkdirs()) {
        throw new AxisFault("Fail to create the directory: " + humantaskTempDir.getAbsolutePath());
    }
    File humantaskDir = new File(humantaskDirectory);
    if (!humantaskDir.exists() && !humantaskDir.mkdirs()) {
        throw new AxisFault("Fail to create the directory: " + humantaskDir.getAbsolutePath());
    }
    for (UploadedFileItem uploadedFile : fileItems) {
        String fileName = uploadedFile.getFileName();
        if (fileName == null || fileName.equals("")) {
            throw new AxisFault("Invalid file name. File name is not available");
        }
        if (HumanTaskConstants.HUMANTASK_PACKAGE_EXTENSION.equals(uploadedFile.getFileType())) {
            try {
                writeResource(uploadedFile.getDataHandler(), humantaskTemp, fileName, humantaskDir);
            } catch (IOException e) {
                throw new AxisFault("IOError: Writing resource failed.", e);
            }
        } else {
            throw new AxisFault("Invalid file type : " + uploadedFile.getFileType() + " ." + HumanTaskConstants.HUMANTASK_PACKAGE_EXTENSION + " file type is expected");
        }
    }
}
Also used : AxisFault(org.apache.axis2.AxisFault) ConfigurationContext(org.apache.axis2.context.ConfigurationContext) UploadedFileItem(org.wso2.carbon.core.common.UploadedFileItem)

Aggregations

AxisFault (org.apache.axis2.AxisFault)3 ConfigurationContext (org.apache.axis2.context.ConfigurationContext)3 File (java.io.File)2 IOException (java.io.IOException)2 UploadedFileItem (org.wso2.carbon.bpel.deployer.services.types.UploadedFileItem)1 UploadedFileItem (org.wso2.carbon.bpel.stub.upload.types.UploadedFileItem)1 UploadedFileItem (org.wso2.carbon.bpmn.core.mgt.model.UploadedFileItem)1 UploadedFileItem (org.wso2.carbon.bpmn.core.mgt.model.xsd.UploadedFileItem)1 UploadedFileItem (org.wso2.carbon.core.common.UploadedFileItem)1 UploadedFileItem (org.wso2.carbon.humantask.stub.upload.types.UploadedFileItem)1