use of org.apache.axis2.deployment.DeploymentException in project carbon-business-process by wso2.
the class HumanTaskAppDeployer method undeployArtifacts.
/**
* Check the artifact type and if it is a HumanTask, delete the file from the HumanTask
* deployment hot folder
*
* @param carbonApp - CarbonApplication instance to check for HumanTask artifacts
* @param axisConfig - - axisConfig of the current tenant
*/
public void undeployArtifacts(CarbonApplication carbonApp, AxisConfiguration axisConfig) {
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 (HUMANTASK_TYPE.equals(artifact.getType())) {
deployer = AppDeployerUtils.getArtifactDeployer(axisConfig, HUMANTASK_DIR, "zip");
} else {
continue;
}
List<CappFile> files = artifact.getFiles();
if (files.size() != 1) {
log.error("A HumanTask artifact must have a single file. But " + files.size() + " files found.");
continue;
}
if (deployer != null && AppDeployerConstants.DEPLOYMENT_STATUS_DEPLOYED.equals(artifact.getDeploymentStatus())) {
String fileName = artifact.getFiles().get(0).getName();
String artifactPath = artifact.getExtractedPath() + File.separator + fileName;
try {
deployer.undeploy(artifactPath);
artifact.setDeploymentStatus(AppDeployerConstants.DEPLOYMENT_STATUS_PENDING);
} catch (DeploymentException e) {
artifact.setDeploymentStatus(AppDeployerConstants.DEPLOYMENT_STATUS_FAILED);
log.error("Error occured while trying to un deploy : " + artifact.getName());
}
}
}
}
use of org.apache.axis2.deployment.DeploymentException in project carbon-business-process by wso2.
the class HumanTaskDeployer method init.
public void init(ConfigurationContext configurationContext) {
int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
log.info("Initializing HumanTask Deployer for tenant " + tenantId + ".");
try {
HumanTaskDeployerServiceComponent.getTenantRegistryLoader().loadTenantRegistry(tenantId);
createHumanTaskRepository(configurationContext);
HumanTaskServer humantaskServer = HumanTaskDeployerServiceComponent.getHumanTaskServer();
humanTaskStore = humantaskServer.getTaskStoreManager().createHumanTaskStoreForTenant(tenantId, configurationContext);
} catch (DeploymentException e) {
log.warn(String.format("Human Task Repository creation failed for tenant id [%d]", tenantId), e);
} catch (RegistryException e) {
log.warn("Initializing HumanTask Deployer failed for tenant " + tenantId, e);
}
}
use of org.apache.axis2.deployment.DeploymentException in project carbon-business-process by wso2.
the class BPELDeployer method createBPELRepository.
private File createBPELRepository(ConfigurationContext configCtx) throws DeploymentException {
String axisRepoPath = configCtx.getAxisConfiguration().getRepository().getPath();
if (CarbonUtils.isURL(axisRepoPath)) {
throw new DeploymentException("URL Repositories are not supported: " + axisRepoPath);
}
File tenantsRepository = new File(axisRepoPath);
File bpelRepo = new File(tenantsRepository, BPELConstants.BPEL_REPO_DIRECTORY);
if (!bpelRepo.exists()) {
boolean status = bpelRepo.mkdir();
if (!status) {
throw new DeploymentException("Failed to create BPEL repository directory " + bpelRepo.getAbsolutePath() + ".");
}
}
return bpelRepo;
}
use of org.apache.axis2.deployment.DeploymentException in project carbon-business-process by wso2.
the class BPELDeployer method init.
public void init(ConfigurationContext configurationContext) {
Integer tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
log.info("Initializing BPEL Deployer for tenant " + tenantId + ".");
File bpelRepo = null;
try {
BPELDeployerServiceComponent.getTenantRegistryLoader().loadTenantRegistry(tenantId);
bpelRepo = createBPELRepository(configurationContext);
} catch (DeploymentException e) {
log.warn("BPEL repository creation failed.", e);
} catch (RegistryException e) {
log.warn("Initialization of tenant process store failed for tenant: " + tenantId + " This can cause issues in deployment of BPEL packages.", e);
}
BPELServer bpsServer = BPELDeployerServiceComponent.getBPELServer();
tenantProcessStore = bpsServer.getMultiTenantProcessStore().createProcessStoreForTenant(configurationContext);
tenantProcessStore.setBpelArchiveRepo(bpelRepo);
configurationContext.setProperty(HTTPConstants.MULTITHREAD_HTTP_CONNECTION_MANAGER, bpsServer.getHttpConnectionManager());
try {
tenantProcessStore.init();
} catch (Exception re) {
log.warn("Initialization of tenant process store failed for tenant: " + tenantId + " This can cause issues in deployment of BPEL packages.", re);
}
}
use of org.apache.axis2.deployment.DeploymentException in project carbon-business-process by wso2.
the class BPMNDeployer method deploy.
/**
* Deploys a given bpmn package in acitiviti bpmn engine.
* @param deploymentFileData Provide information about the deployment file
* @throws DeploymentException On failure , deployment exception is thrown
*/
public void deploy(DeploymentFileData deploymentFileData) throws DeploymentException {
// Worker nodes cannot deploy BPMN packages, hence return
if (isWorkerNode()) {
return;
}
Integer tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
log.info("Deploying BPMN archive " + deploymentFileData.getFile().getName() + " for tenant: " + tenantId);
try {
BPMNDeploymentContext deploymentContext = new BPMNDeploymentContext(tenantId);
deploymentContext.setBpmnArchive(deploymentFileData.getFile());
tenantRepository.deploy(deploymentContext);
// log.info( "Deployment Status " + deploymentFileData.getFile() + " deployed = " + deployed );
} catch (DeploymentException e) {
String errorMessage = "Failed to deploy the archive: " + deploymentFileData.getAbsolutePath();
throw new DeploymentException(errorMessage, e);
}
}
Aggregations