Search in sources :

Example 71 with PACKAGE

use of org.wso2.ballerinalang.compiler.codegen.CodeGenerator.VariableIndex.Kind.PACKAGE in project carbon-business-process by wso2.

the class BPELPackageManagementServiceSkeleton method getLatestVersionInPackage.

/**
 * This method will return the latest version of the BPEL package
 * @param packageName BPEL package name
 * @return Latest package version
 * @throws PackageManagementException
 */
public String getLatestVersionInPackage(String packageName) throws PackageManagementException {
    TenantProcessStoreImpl tenantProcessStore = getTenantProcessStore();
    BPELPackageRepository packageRepo = tenantProcessStore.getBPELPackageRepository();
    try {
        return packageRepo.getBPELPackageInfoForPackage(packageName).getLatestVersion();
    } catch (Exception e) {
        String errMsg = "BPEL package: " + packageName + " failed to get latest version.";
        log.error(errMsg, e);
        throw new PackageManagementException(errMsg, e);
    }
}
Also used : BPELPackageRepository(org.wso2.carbon.bpel.core.ode.integration.store.repository.BPELPackageRepository) PackageManagementException(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.PackageManagementException) TenantProcessStoreImpl(org.wso2.carbon.bpel.core.ode.integration.store.TenantProcessStoreImpl) PackageManagementException(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.PackageManagementException) BPELUIException(org.wso2.carbon.bpel.core.ode.integration.store.BPELUIException)

Example 72 with PACKAGE

use of org.wso2.ballerinalang.compiler.codegen.CodeGenerator.VariableIndex.Kind.PACKAGE 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;
}
Also used : WSDL11Endpoint(org.apache.ode.bpel.epr.WSDL11Endpoint) AxisFault(org.apache.axis2.AxisFault) ConfigurationContext(org.apache.axis2.context.ConfigurationContext) AxisService(org.apache.axis2.description.AxisService) ArrayList(java.util.ArrayList) DeploymentException(org.apache.axis2.deployment.DeploymentException) EndpointConfiguration(org.wso2.carbon.bpel.common.config.EndpointConfiguration) ProcessConfigurationImpl(org.wso2.carbon.bpel.core.ode.integration.store.ProcessConfigurationImpl)

Example 73 with PACKAGE

use of org.wso2.ballerinalang.compiler.codegen.CodeGenerator.VariableIndex.Kind.PACKAGE in project carbon-business-process by wso2.

the class BPMNDeploymentService method getDeploymentsByName.

/**
 * Get the deployments for given package name , order by deploymentID
 *
 * @param deploymentName
 * @return
 */
public BPMNDeployment[] getDeploymentsByName(String deploymentName) {
    List<BPMNDeployment> bpmnDeploymentList = new ArrayList<>();
    Integer tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
    DeploymentQuery query = BPMNServerHolder.getInstance().getEngine().getRepositoryService().createDeploymentQuery();
    // Set deployment name and order by ID
    query = query.deploymentTenantId(tenantId.toString()).deploymentName(deploymentName).orderByDeploymentId().desc();
    List<Deployment> deployments = query.list();
    for (Deployment deployment : deployments) {
        BPMNDeployment bpmnDeployment = new BPMNDeployment();
        bpmnDeployment.setDeploymentId(deployment.getId());
        bpmnDeployment.setDeploymentName(deployment.getName());
        bpmnDeployment.setDeploymentTime(deployment.getDeploymentTime());
        bpmnDeploymentList.add(bpmnDeployment);
    }
    return bpmnDeploymentList.toArray(new BPMNDeployment[bpmnDeploymentList.size()]);
}
Also used : DeploymentQuery(org.activiti.engine.repository.DeploymentQuery) ArrayList(java.util.ArrayList) BPMNDeployment(org.wso2.carbon.bpmn.core.mgt.model.BPMNDeployment) Deployment(org.activiti.engine.repository.Deployment) BPMNDeployment(org.wso2.carbon.bpmn.core.mgt.model.BPMNDeployment)

Example 74 with PACKAGE

use of org.wso2.ballerinalang.compiler.codegen.CodeGenerator.VariableIndex.Kind.PACKAGE 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);
        }
    }
}
Also used : BPSFault(org.wso2.carbon.bpmn.core.BPSFault) DeploymentException(org.apache.axis2.deployment.DeploymentException) File(java.io.File)

Example 75 with PACKAGE

use of org.wso2.ballerinalang.compiler.codegen.CodeGenerator.VariableIndex.Kind.PACKAGE in project carbon-business-process by wso2.

the class ActivitiDAO method selectTenantAwareDeploymentModel.

/**
 * invokes the DeploymentMapper.selectMetaData for a given tenant id and package name
 *
 * @param tenantID        tenant id
 * @param bpmnPackageName package name
 * @return                DeploymentMetaDataModel object
 */
public DeploymentMetaDataModel selectTenantAwareDeploymentModel(final String tenantID, final String bpmnPackageName) {
    CustomSqlExecution<DeploymentMapper, DeploymentMetaDataModel> customSqlExecution = new AbstractCustomSqlExecution<DeploymentMapper, DeploymentMetaDataModel>(DeploymentMapper.class) {

        public DeploymentMetaDataModel execute(DeploymentMapper deploymentMapper) {
            return deploymentMapper.selectMetaData(tenantID, bpmnPackageName);
        }
    };
    DeploymentMetaDataModel deploymentMetaDataModel = managementService.executeCustomSql(customSqlExecution);
    if (log.isDebugEnabled()) {
        if (deploymentMetaDataModel != null) {
            log.debug("DeploymentDataModel exists when selecting models=" + deploymentMetaDataModel.getId());
        } else {
            log.debug("DeploymentDataModel null when selecting models");
        }
    }
    return deploymentMetaDataModel;
}
Also used : DeploymentMapper(org.wso2.carbon.bpmn.core.internal.mapper.DeploymentMapper) AbstractCustomSqlExecution(org.activiti.engine.impl.cmd.AbstractCustomSqlExecution) DeploymentMetaDataModel(org.wso2.carbon.bpmn.core.mgt.model.DeploymentMetaDataModel)

Aggregations

BLangPackage (org.wso2.ballerinalang.compiler.tree.BLangPackage)49 ArrayList (java.util.ArrayList)34 Test (org.testng.annotations.Test)29 Page (org.ballerinalang.docgen.model.Page)18 File (java.io.File)16 CompilerContext (org.wso2.ballerinalang.compiler.util.CompilerContext)16 IOException (java.io.IOException)15 Path (java.nio.file.Path)13 List (java.util.List)13 BLangStruct (org.wso2.ballerinalang.compiler.tree.BLangStruct)11 PackageID (org.ballerinalang.model.elements.PackageID)10 Compiler (org.wso2.ballerinalang.compiler.Compiler)10 BLangFunction (org.wso2.ballerinalang.compiler.tree.BLangFunction)10 CompilerOptions (org.wso2.ballerinalang.compiler.util.CompilerOptions)10 Collectors (java.util.stream.Collectors)9 Arrays (java.util.Arrays)8 CompilerPhase (org.ballerinalang.compiler.CompilerPhase)7 BInvokableSymbol (org.wso2.ballerinalang.compiler.semantics.model.symbols.BInvokableSymbol)6 BPackageSymbol (org.wso2.ballerinalang.compiler.semantics.model.symbols.BPackageSymbol)6 BLangNode (org.wso2.ballerinalang.compiler.tree.BLangNode)6