use of org.apache.axis2.deployment.Deployer in project carbon-business-process by wso2.
the class BPELBindingContextImpl method removeBPELProcessProxyAndAxisService.
private void removeBPELProcessProxyAndAxisService(String processDeployer, QName serviceName, String portName) {
if (log.isDebugEnabled()) {
log.debug("Removing service " + serviceName.toString() + " port " + portName);
}
BPELProcessProxy processProxy = (BPELProcessProxy) services.remove(processDeployer, serviceName, portName);
if (processProxy != null) {
try {
String axisServiceName = processProxy.getAxisService().getName();
AxisConfiguration axisConfig = processProxy.getAxisService().getAxisConfiguration();
// /////////////////////////////////////////////////////////////////////////////////////////////////////
// There is a issue in this code due to tenant unloading and loading. When we unload a tenant we don't
// undeploy the process. So BPELBindingContextImpl#deactivateMyRoleEndpoint will not get invoked and
// BPELProcessProxy instance will be there in the BPELBindingContextImpl#services map. So at the
// time we load the tenant again, axisService returned from axisConfig will be null even though we
// have a BPELProcessProxy instance in service map. This is because teant unloading logic cleans the
// axis configuration. So if the axisService is null, we ignore the other steps after this.
// /////////////////////////////////////////////////////////////////////////////////////////////////////
AxisService axisService = axisConfig.getService(axisServiceName);
if (axisService != null) {
// first, de-allocate its schemas
axisService.releaseSchemaList();
// then, de-allocate its parameters
// the service's wsdl object model is stored as one of its parameters!
// can't stress strongly enough how important it is to clean this up.
// ArrayList<Parameter> parameters = (ArrayList<Parameter>) axisService.getParameters();
// for (Parameter parameter : parameters) {
// if (!parameter.getName().equals(CarbonConstants.PRESERVE_SERVICE_HISTORY_PARAM) &&
// !BPELProcessStoreImpl.isUndeploying) {
// axisService.removeParameter(parameter);
// }
// }
//
// if (RegistryBasedProcessStoreImpl.isUndeploying) {
// BPSServerImpl.getAxisConfig().getServiceGroup(axisServiceName).removeParameter(
// new Parameter(CarbonConstants.PRESERVE_SERVICE_HISTORY_PARAM, "true"));
// }
//
// if (RegistryBasedProcessStoreImpl.isUpdatingBPELPackage) {
// axisService.addParameter(new Parameter(CarbonConstants.PRESERVE_SERVICE_HISTORY_PARAM, "true"));
// axisService.getAxisServiceGroup().addParameter(new Parameter(CarbonConstants
// .PRESERVE_SERVICE_HISTORY_PARAM, "true"));
// }
// now, stop the service
axisConfig.stopService(axisServiceName);
// calling removeServiceGroup() is workaround to AXIS2-4314.
// It happens that Axis2 creates one group per service you add with AxisConfiguration.addService().
// See this.createService()
// Once this issue is fixed (hopully in Axis2-1.5), we can use removeService() again.
axisConfig.removeServiceGroup(axisServiceName);
// This must not done. This will cause axis configuration to cleanup deployment schedular
// and it'll throw exception when it tries to reschedule deployer after undeplying.
// _server._axisConfig.cleanup();
}
} catch (AxisFault axisFault) {
log.error("Couldn't remove service " + serviceName);
}
} else {
if (log.isDebugEnabled()) {
log.debug("Couldn't find service " + serviceName + " port " + portName + " to remove.");
}
}
}
use of org.apache.axis2.deployment.Deployer 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