Search in sources :

Example 1 with Deployer

use of org.apache.axis2.deployment.Deployer in project wso2-synapse by wso2.

the class Axis2SynapseController method deployMediationLibraryArtifacts.

/**
 * The mediation library deployer will handling the process of deploying the
 * libararyArtifacts, this is required since the library specific artifacts
 * has to be initialized priorly for the cases like connectors
 */
private void deployMediationLibraryArtifacts() {
    if (configurationContext == null || synapseConfiguration == null) {
        return;
    }
    DeploymentEngine deploymentEngine = (DeploymentEngine) configurationContext.getAxisConfiguration().getConfigurator();
    String libsPath = deploymentEngine.getRepositoryDir().getPath() + File.separator + "synapse-libs";
    deploymentEngine.addDeployer(new LibraryArtifactDeployer(), libsPath, "zip");
}
Also used : LibraryArtifactDeployer(org.apache.synapse.deployers.LibraryArtifactDeployer) DeploymentEngine(org.apache.axis2.deployment.DeploymentEngine)

Example 2 with Deployer

use of org.apache.axis2.deployment.Deployer in project carbon-business-process by wso2.

the class BPMNAppDeployer method undeployArtifacts.

/**
 * Check the artifact type and if it is a BPMN, delete the file from the BPMN
 * deployment hot folder
 *
 * @param carbonApp  - CarbonApplication instance to check for BPMN 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 (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("A BPMN 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());
            }
        }
    }
}
Also used : DeploymentException(org.apache.axis2.deployment.DeploymentException) Artifact(org.wso2.carbon.application.deployer.config.Artifact) Deployer(org.apache.axis2.deployment.Deployer) CappFile(org.wso2.carbon.application.deployer.config.CappFile)

Example 3 with Deployer

use of org.apache.axis2.deployment.Deployer in project carbon-business-process by wso2.

the class HumanTaskAppDeployer method deployArtifacts.

/**
 * Check the artifact type and if it is a HumanTask artifact, copy it to the HumanTask deployment hot folder
 *
 * @param carbonApp  - CarbonApplication instance to check for HumanTask 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 (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("HumanTask 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;
            }
        }
    }
}
Also used : DeploymentFileData(org.apache.axis2.deployment.repository.util.DeploymentFileData) DeploymentException(org.apache.axis2.deployment.DeploymentException) File(java.io.File) CappFile(org.wso2.carbon.application.deployer.config.CappFile) Artifact(org.wso2.carbon.application.deployer.config.Artifact) Deployer(org.apache.axis2.deployment.Deployer) CappFile(org.wso2.carbon.application.deployer.config.CappFile)

Example 4 with Deployer

use of org.apache.axis2.deployment.Deployer 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());
            }
        }
    }
}
Also used : DeploymentException(org.apache.axis2.deployment.DeploymentException) Artifact(org.wso2.carbon.application.deployer.config.Artifact) Deployer(org.apache.axis2.deployment.Deployer) CappFile(org.wso2.carbon.application.deployer.config.CappFile)

Example 5 with Deployer

use of org.apache.axis2.deployment.Deployer 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);
    }
}
Also used : HumanTaskServer(org.wso2.carbon.humantask.core.HumanTaskServer) DeploymentException(org.apache.axis2.deployment.DeploymentException) RegistryException(org.wso2.carbon.registry.core.exceptions.RegistryException)

Aggregations

DeploymentException (org.apache.axis2.deployment.DeploymentException)9 File (java.io.File)6 Deployer (org.apache.axis2.deployment.Deployer)6 Artifact (org.wso2.carbon.application.deployer.config.Artifact)6 CappFile (org.wso2.carbon.application.deployer.config.CappFile)6 DeploymentFileData (org.apache.axis2.deployment.repository.util.DeploymentFileData)3 RegistryException (org.wso2.carbon.registry.core.exceptions.RegistryException)2 Operation (javax.wsdl.Operation)1 ExtensibilityElement (javax.wsdl.extensions.ExtensibilityElement)1 HTTPBinding (javax.wsdl.extensions.http.HTTPBinding)1 AxisFault (org.apache.axis2.AxisFault)1 MessageContext (org.apache.axis2.context.MessageContext)1 DeploymentEngine (org.apache.axis2.deployment.DeploymentEngine)1 AxisService (org.apache.axis2.description.AxisService)1 TransportOutDescription (org.apache.axis2.description.TransportOutDescription)1 AxisConfiguration (org.apache.axis2.engine.AxisConfiguration)1 MutableEndpoint (org.apache.ode.bpel.epr.MutableEndpoint)1 LibraryArtifactDeployer (org.apache.synapse.deployers.LibraryArtifactDeployer)1 BPELServer (org.wso2.carbon.bpel.core.ode.integration.BPELServer)1 BPSFault (org.wso2.carbon.bpmn.core.BPSFault)1