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);
}
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);
}
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");
}
}
}
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);
}
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");
}
}
}
Aggregations