use of org.apache.axis2.deployment.DeploymentException in project carbon-business-process by wso2.
the class BPELAppDeployer method deployArtifacts.
/**
* Check the artifact type and if it is a BPEL, copy it to the BPEL deployment hot folder
*
* @param carbonApp - CarbonApplication instance to check for BPEL artifacts
* @param axisConfig - AxisConfiguration of the current tenant
*/
public void deployArtifacts(CarbonApplication carbonApp, AxisConfiguration axisConfig) throws DeploymentException {
List<Artifact.Dependency> artifacts = carbonApp.getAppConfig().getApplicationArtifact().getDependencies();
// loop through all artifacts
for (Artifact.Dependency dep : artifacts) {
Deployer deployer;
Artifact artifact = dep.getArtifact();
if (artifact == null) {
continue;
}
if (!isAccepted(artifact.getType())) {
log.warn("Can't deploy artifact : " + artifact.getName() + " of type : " + artifact.getType() + ". Required features are not installed in the system");
continue;
}
if (BPEL_TYPE.equals(artifact.getType())) {
deployer = AppDeployerUtils.getArtifactDeployer(axisConfig, BPEL_DIR, "zip");
} else {
continue;
}
List<CappFile> files = artifact.getFiles();
if (files.size() != 1) {
log.error("BPEL workflows must have a single file to " + "be deployed. But " + files.size() + " files found.");
continue;
}
if (deployer != null) {
String fileName = artifact.getFiles().get(0).getName();
String artifactPath = artifact.getExtractedPath() + File.separator + fileName;
try {
deployer.deploy(new DeploymentFileData(new File(artifactPath), deployer));
artifact.setDeploymentStatus(AppDeployerConstants.DEPLOYMENT_STATUS_DEPLOYED);
} catch (DeploymentException e) {
artifact.setDeploymentStatus(AppDeployerConstants.DEPLOYMENT_STATUS_FAILED);
throw e;
}
}
}
}
use of org.apache.axis2.deployment.DeploymentException in project carbon-business-process by wso2.
the class BPMNAppDeployer method deployArtifacts.
/**
* Check the artifact type and if it is a BPMN artifact, copy it to the BPMN deployment hot folder
*
* @param carbonApp - CarbonApplication instance to check for BPMN artifacts
* @param axisConfig - AxisConfiguration of the current tenant
*/
public void deployArtifacts(CarbonApplication carbonApp, AxisConfiguration axisConfig) throws DeploymentException {
List<Artifact.Dependency> artifacts = carbonApp.getAppConfig().getApplicationArtifact().getDependencies();
// loop through all dependencies
for (Artifact.Dependency dep : artifacts) {
Deployer deployer;
Artifact artifact = dep.getArtifact();
if (artifact == null) {
continue;
}
if (!isAccepted(artifact.getType())) {
log.warn("Can't deploy artifact : " + artifact.getName() + " of type : " + artifact.getType() + ". Required features are not installed in the system");
continue;
}
if (BPMN_TYPE.equals(artifact.getType())) {
deployer = AppDeployerUtils.getArtifactDeployer(axisConfig, BPMN_DIR, "bar");
} else {
continue;
}
List<CappFile> files = artifact.getFiles();
if (files.size() != 1) {
log.error("BPMN artifacts must have a single file to " + "be deployed. But " + files.size() + " files found.");
continue;
}
if (deployer != null) {
String fileName = artifact.getFiles().get(0).getName();
String artifactPath = artifact.getExtractedPath() + File.separator + fileName;
try {
deployer.deploy(new DeploymentFileData(new File(artifactPath), deployer));
artifact.setDeploymentStatus(AppDeployerConstants.DEPLOYMENT_STATUS_DEPLOYED);
File artifactFile = new File(artifactPath);
if (artifactFile.exists() && !artifactFile.delete()) {
log.warn("Couldn't delete App artifact file : " + artifactPath);
}
} catch (DeploymentException e) {
artifact.setDeploymentStatus(AppDeployerConstants.DEPLOYMENT_STATUS_FAILED);
throw e;
}
}
}
}
use of org.apache.axis2.deployment.DeploymentException in project carbon-business-process by wso2.
the class BPELDeployer method undeploy.
public void undeploy(String bpelArchivePath) throws DeploymentException {
File bpelArchiveFile = new File(bpelArchivePath);
if (bpelArchiveFile.exists()) {
if (log.isTraceEnabled()) {
log.trace("Assumption: this as an update of the bpel package: " + bpelArchivePath + ", Therefore no need to do undeploy");
}
// here
return;
}
log.info("Undeploying BPEL archive " + bpelArchivePath);
try {
String archiveName = bpelArchivePath.substring(bpelArchivePath.lastIndexOf(File.separator) + 1);
String bpelPackageName = archiveName.substring(0, archiveName.lastIndexOf("." + BPELConstants.BPEL_PACKAGE_EXTENSION));
tenantProcessStore.undeploy(bpelPackageName);
} catch (Exception e) {
String errMsg = "BPEL Package: " + bpelArchivePath + " undeployment failed.";
log.error(errMsg, e);
throw new DeploymentException(errMsg, e);
}
}
use of org.apache.axis2.deployment.DeploymentException in project carbon-business-process by wso2.
the class BPELBindingContextImpl method publishAxisService.
private BPELProcessProxy publishAxisService(ProcessConf processConfiguration, QName serviceName, String portName) throws AxisFault {
// TODO: Need to fix this to suite multi-tenant environment
// TODO: There is a problem in this, in this manner we can't have two axis services with
// same QName
BPELProcessProxy processProxy = new BPELProcessProxy(processConfiguration, bpelServer, serviceName, portName);
ConfigurationContext tenantConfigCtx = getConfigurationContextFromProcessConfiguration(processConfiguration);
AxisService axisService;
try {
axisService = AxisServiceUtils.createAxisService(tenantConfigCtx.getAxisConfiguration(), processProxy);
EndpointConfiguration endpointConfig = ((ProcessConfigurationImpl) processConfiguration).getEndpointConfiguration(new WSDL11Endpoint(serviceName, portName));
ServiceConfigurationUtil.configureService(axisService, endpointConfig, tenantConfigCtx);
} catch (AxisFault e) {
log.error("Error occurred creating the axis service " + serviceName.toString());
throw new DeploymentException("BPEL Package deployment failed.", e);
}
processProxy.setAxisService(axisService);
removeBPELProcessProxyAndAxisService(processConfiguration.getDeployer(), serviceName, portName);
services.put(processConfiguration.getDeployer(), serviceName, portName, processProxy);
ArrayList<AxisService> serviceList = new ArrayList<AxisService>();
serviceList.add(axisService);
DeploymentEngine.addServiceGroup(createServiceGroupForService(axisService), serviceList, null, null, tenantConfigCtx.getAxisConfiguration());
//
if (log.isDebugEnabled()) {
log.debug("BPELProcessProxy created for process " + processConfiguration.getProcessId());
log.debug("AxisService " + serviceName + " created for BPEL process " + processConfiguration.getProcessId());
}
return processProxy;
}
use of org.apache.axis2.deployment.DeploymentException in project carbon-business-process by wso2.
the class BPMNDeployer method undeploy.
/**
* Undeployment operation for Bpmn Deployer
*
* @param bpmnArchivePath archivePatch
* @throws DeploymentException Deployment failure will result in this exception
*/
public void undeploy(String bpmnArchivePath) throws DeploymentException {
if (isWorkerNode()) {
return;
}
if (System.getProperty(BPMNConstants.RESOLVE_DEPLOYMENT_SYS_PROP) != null && Boolean.parseBoolean(System.getProperty(BPMNConstants.RESOLVE_DEPLOYMENT_SYS_PROP)) || System.getProperty(BPMNConstants.RESOLVE_DEPLOYMENT_SYS_PROP) == null) {
File bpmnArchiveFile = new File(bpmnArchivePath);
if (bpmnArchiveFile.exists()) {
if (log.isTraceEnabled()) {
log.trace("BPMN package: " + bpmnArchivePath + " exists in the deployment folder. " + "Therefore, this can be an update of the package and the undeployment will be aborted.");
}
return;
}
Integer tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
log.info("Undeploying BPMN archive " + bpmnArchivePath + " for tenant: " + tenantId);
String deploymentName = FilenameUtils.getBaseName(bpmnArchivePath);
try {
tenantRepository.undeploy(deploymentName, true);
} catch (BPSFault be) {
String errorMsg = "Error un deploying BPMN Package " + deploymentName;
throw new DeploymentException(errorMsg, be);
}
}
}
Aggregations