03-04-2014 07:23 AM
protected void autoDeployResources(ProcessEngine processEngine) {
if (deploymentResources!=null && deploymentResources.length>0) {
RepositoryService repositoryService = processEngine.getRepositoryService();
DeploymentBuilder deploymentBuilder = repositoryService
.createDeployment()
.enableDuplicateFiltering()
.name(deploymentName);
for (Resource resource : deploymentResources) {
String resourceName = null;
if (resource instanceof ContextResource) {
resourceName = ((ContextResource) resource).getPathWithinContext();
} else if (resource instanceof ByteArrayResource) {
resourceName = resource.getDescription();
} else {
try {
resourceName = resource.getFile().getAbsolutePath();
} catch (IOException e) {
resourceName = resource.getFilename();
}
}
try {
if ( resourceName.endsWith(".bar")
|| resourceName.endsWith(".zip")
|| resourceName.endsWith(".jar") ) {
deploymentBuilder.addZipInputStream(new ZipInputStream(resource.getInputStream()));
} else {
deploymentBuilder.addInputStream(resourceName, resource.getInputStream());
}
} catch (IOException e) {
throw new ActivitiException("couldn't auto deploy resource '"+resource+"': "+e.getMessage(), e);
}
}
deploymentBuilder.deploy();
}
}
protected void autoDeployResources(ProcessEngine processEngine) {
if (deploymentResources!=null && deploymentResources.length>0) {
RepositoryService repositoryService = processEngine.getRepositoryService();
for (Resource resource : deploymentResources) {
String resourceName = null;
if (resource instanceof ContextResource) {
resourceName = ((ContextResource) resource).getPathWithinContext();
} else if (resource instanceof ByteArrayResource) {
resourceName = resource.getDescription();
} else {
try {
resourceName = resource.getFile().getAbsolutePath();
} catch (IOException e) {
resourceName = resource.getFilename();
}
}
try {
DeploymentBuilder deploymentBuilder = repositoryService
.createDeployment()
.enableDuplicateFiltering()
.name(resourceName);
if ( resourceName.endsWith(".bar")
|| resourceName.endsWith(".zip")
|| resourceName.endsWith(".jar") ) {
deploymentBuilder.addZipInputStream(new ZipInputStream(resource.getInputStream()));
} else {
deploymentBuilder.addInputStream(resourceName, resource.getInputStream());
}
deploymentBuilder.deploy();
} catch (IOException e) {
throw new ActivitiException("couldn't auto deploy resource '"+resource+"': "+e.getMessage(), e);
}
}
}
}
03-10-2014 06:56 AM
03-11-2014 06:53 AM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.