Search in sources :

Example 6 with TenantProcessStore

use of org.wso2.carbon.bpel.core.ode.integration.store.TenantProcessStore 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);
    }
}
Also used : DeploymentException(org.apache.axis2.deployment.DeploymentException) BPELServer(org.wso2.carbon.bpel.core.ode.integration.BPELServer) File(java.io.File) RegistryException(org.wso2.carbon.registry.core.exceptions.RegistryException) RegistryException(org.wso2.carbon.registry.core.exceptions.RegistryException) DeploymentException(org.apache.axis2.deployment.DeploymentException)

Example 7 with TenantProcessStore

use of org.wso2.carbon.bpel.core.ode.integration.store.TenantProcessStore in project carbon-business-process by wso2.

the class Axis2ConfigurationContextObserverImpl method terminatingConfigurationContext.

public void terminatingConfigurationContext(ConfigurationContext configurationContext) {
    Integer tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
    log.info("Removing data publishers for this tenant " + tenantId + ".");
    TenantProcessStore tenantsProcessStore = bpelServer.getMultiTenantProcessStore().getTenantsProcessStore(tenantId);
    if (tenantsProcessStore != null) {
        Map dataPublisherMap = tenantsProcessStore.getDataPublisherMap();
        if (dataPublisherMap != null) {
            Collection<DataPublisher> dataPublisherCollection = dataPublisherMap.values();
            Iterator<DataPublisher> iterator = dataPublisherCollection.iterator();
            while (iterator.hasNext()) {
                DataPublisher dataPublisher = iterator.next();
                try {
                    dataPublisher.shutdown();
                } catch (DataEndpointException e) {
                    String errMsg = "Error while shutting down tenant Data Publisher";
                    log.error(errMsg, e);
                }
            }
            dataPublisherCollection.clear();
        }
    }
}
Also used : DataPublisher(org.wso2.carbon.databridge.agent.DataPublisher) DataEndpointException(org.wso2.carbon.databridge.agent.exception.DataEndpointException) TenantProcessStore(org.wso2.carbon.bpel.core.ode.integration.store.TenantProcessStore) Map(java.util.Map)

Example 8 with TenantProcessStore

use of org.wso2.carbon.bpel.core.ode.integration.store.TenantProcessStore in project carbon-business-process by wso2.

the class AnalyticsPublisherExtensionOperation method getDataPublisher.

private DataPublisher getDataPublisher(ExtensionContext context, int tenantId, String analyticsServerProfileName) throws FaultException {
    DataPublisher dataPublisher = null;
    TenantProcessStore tenantsProcessStore = AnalyticsPublisherServiceComponent.getBPELServer().getMultiTenantProcessStore().getTenantsProcessStore(tenantId);
    String processName = context.getProcessModel().getName().toString();
    dataPublisher = (DataPublisher) tenantsProcessStore.getDataPublisher(processName);
    // Create new DataPublisher if not created already.
    if (dataPublisher == null) {
        AnalyticsServerProfile analyticsServerProfile = getAnalyticsServerProfile(tenantId, analyticsServerProfileName);
        try {
            dataPublisher = new DataPublisher(analyticsServerProfile.getType(), analyticsServerProfile.getReceiverURLSet(), analyticsServerProfile.getAuthURLSet(), analyticsServerProfile.getUserName(), analyticsServerProfile.getPassword());
        } catch (TransportException e) {
            String errorMsg = "Transport layer problem.";
            handleException(errorMsg, e);
        } catch (DataEndpointAuthenticationException e) {
            String errorMsg = "Data endpoint authentication problem.";
            handleException(errorMsg, e);
        } catch (DataEndpointAgentConfigurationException e) {
            String errorMsg = "Data endpoint agent configuration problem.";
            handleException(errorMsg, e);
        } catch (DataEndpointException e) {
            String errorMsg = "Data endpoint problem.";
            handleException(errorMsg, e);
        } catch (DataEndpointConfigurationException e) {
            String errorMsg = "Data endpoint configuration problem.";
            handleException(errorMsg, e);
        }
        if (log.isDebugEnabled()) {
            log.debug("Data Publisher Created : " + analyticsServerProfile.toString());
        }
        if (dataPublisher != null) {
            tenantsProcessStore.addDataPublisher(processName, dataPublisher);
        }
    }
    return dataPublisher;
}
Also used : DataEndpointAuthenticationException(org.wso2.carbon.databridge.agent.exception.DataEndpointAuthenticationException) DataPublisher(org.wso2.carbon.databridge.agent.DataPublisher) DataEndpointAgentConfigurationException(org.wso2.carbon.databridge.agent.exception.DataEndpointAgentConfigurationException) DataEndpointException(org.wso2.carbon.databridge.agent.exception.DataEndpointException) TenantProcessStore(org.wso2.carbon.bpel.core.ode.integration.store.TenantProcessStore) AnalyticsServerProfile(org.wso2.carbon.bpel.core.ode.integration.config.analytics.AnalyticsServerProfile) DataEndpointConfigurationException(org.wso2.carbon.databridge.agent.exception.DataEndpointConfigurationException)

Example 9 with TenantProcessStore

use of org.wso2.carbon.bpel.core.ode.integration.store.TenantProcessStore in project carbon-business-process by wso2.

the class ProcessManagementServiceSkeleton method getProcessDeploymentInfo.

/* The methods gets data from ProcessConfigurationImpl and display the details
    *  @param  pid
    *  @return processDeployDetailsList
    *
    */
public ProcessDeployDetailsList_type0 getProcessDeploymentInfo(QName pid) {
    /* Configuring process basic information*/
    ProcessDeployDetailsList processDeployDetailsList = new ProcessDeployDetailsList();
    ProcessDeployDetailsList_type0 processDeployDetailsListType = new ProcessDeployDetailsList_type0();
    TenantProcessStoreImpl tenantProcessStore = AdminServiceUtils.getTenantProcessStore();
    ProcessConf processConf = tenantProcessStore.getProcessConfiguration(pid);
    ProcessConfigurationImpl processConfiguration = (ProcessConfigurationImpl) processConf;
    QName processId = processConfiguration.getProcessId();
    processDeployDetailsListType.setProcessName(processId);
    ProcessStatus processStatus = ProcessStatus.Factory.fromValue(processConfiguration.getState().name());
    processDeployDetailsListType.setProcessState(processStatus);
    processDeployDetailsListType.setIsInMemory(processConfiguration.isTransient());
    /* Configuring invoked services by the process*/
    List<TInvoke> invokeList = processConfiguration.getInvokedServices();
    if (invokeList != null) {
        InvokeServiceListType ist = new InvokeServiceListType();
        for (TInvoke invoke : invokeList) {
            InvokedServiceType invokedServiceType = new InvokedServiceType();
            Service_type1 service = new Service_type1();
            service.setName(invoke.getService().getName());
            service.setPort(invoke.getService().getPort());
            invokedServiceType.setService(service);
            invokedServiceType.setPartnerLink(invoke.getPartnerLink());
            ist.addInvokedService(invokedServiceType);
            processDeployDetailsListType.setInvokeServiceList(ist);
        }
    }
    /* Configuring providing services by the process*/
    List<TProvide> provideList = processConfiguration.getProvidedServices();
    if (provideList != null) {
        ProvideServiceListType pst = new ProvideServiceListType();
        for (TProvide provide : provideList) {
            ProvidedServiceType providedServiceType = new ProvidedServiceType();
            Service_type0 service = new Service_type0();
            service.setName(provide.getService().getName());
            service.setPort(provide.getService().getPort());
            providedServiceType.setService(service);
            providedServiceType.setPartnerLink(provide.getPartnerLink());
            pst.addProvidedService(providedServiceType);
        }
        processDeployDetailsListType.setProvideServiceList(pst);
    }
    /* Configuring message exchange interceptors of the process*/
    MexInterpreterListType mxt = new MexInterpreterListType();
    List<String> mexInterceptor = processConfiguration.getMexInterceptors();
    if (mexInterceptor != null) {
        for (String mexInt : mexInterceptor) {
            mxt.addMexinterpreter(mexInt);
        }
    }
    processDeployDetailsListType.setMexInterperterList(mxt);
    /* Configuring process level and scope level enabled events of process*/
    Map<String, Set<BpelEvent.TYPE>> eventsMap = processConfiguration.getEvents();
    ProcessEventsListType processEventsListType = new ProcessEventsListType();
    EnableEventListType enableEventListType = new EnableEventListType();
    ScopeEventListType scopeEventListType = new ScopeEventListType();
    for (Map.Entry<String, Set<BpelEvent.TYPE>> eventEntry : eventsMap.entrySet()) {
        if (eventEntry.getKey() != null) {
            ScopeEventType scopeEvent = new ScopeEventType();
            String scopeName = eventEntry.getKey();
            EnableEventListType enableEventList = new EnableEventListType();
            Set<BpelEvent.TYPE> typeSetforScope = eventEntry.getValue();
            for (BpelEvent.TYPE type : typeSetforScope) {
                enableEventList.addEnableEvent(type.toString());
            }
            scopeEvent.setScope(scopeName);
            scopeEvent.setEnabledEventList(enableEventList);
            scopeEventListType.addScopeEvent(scopeEvent);
        } else {
            Set<BpelEvent.TYPE> typeSet = eventEntry.getValue();
            for (BpelEvent.TYPE aTypeSet : typeSet) {
                enableEventListType.addEnableEvent(aTypeSet.toString());
            }
        }
    }
    TProcessEvents.Generate.Enum genEnum = processConfiguration.getGenerateType();
    if (genEnum != null) {
        Generate_type1 generate = Generate_type1.Factory.fromValue(genEnum.toString());
        processEventsListType.setGenerate(generate);
    }
    processEventsListType.setEnableEventsList(enableEventListType);
    processEventsListType.setScopeEventsList(scopeEventListType);
    processDeployDetailsListType.setProcessEventsList(processEventsListType);
    // end of process events
    /* configuring properties defined in the process */
    PropertyListType propertyListType = new PropertyListType();
    Map<QName, Node> propertiesMap = processConfiguration.getProcessProperties();
    Set<Map.Entry<QName, Node>> entries = propertiesMap.entrySet();
    for (Map.Entry entry : entries) {
        ProcessProperty_type0 property = new ProcessProperty_type0();
        property.setName((QName) entry.getKey());
        Node node = (Node) entry.getValue();
        property.setValue(DOMUtils.domToStringLevel2(node));
        propertyListType.addProcessProperty(property);
    }
    processDeployDetailsListType.setPropertyList(propertyListType);
    CleanUpListType cleanUpList = new CleanUpListType();
    Set<ProcessConf.CLEANUP_CATEGORY> sucessTypeCleanups = processConfiguration.getCleanupCategories(true);
    Set<ProcessConf.CLEANUP_CATEGORY> failureTypeCleanups = processConfiguration.getCleanupCategories(false);
    if (sucessTypeCleanups != null) {
        CleanUpType cleanUp = new CleanUpType();
        On_type1 onType = On_type1.success;
        cleanUp.setOn(onType);
        CategoryListType categoryListType = new CategoryListType();
        for (ProcessConf.CLEANUP_CATEGORY sCategory : sucessTypeCleanups) {
            Category_type1 categoryType1 = Category_type1.Factory.fromValue(sCategory.name().toLowerCase());
            categoryListType.addCategory(categoryType1);
        }
        cleanUp.setCategoryList(categoryListType);
        cleanUpList.addCleanUp(cleanUp);
    }
    if (failureTypeCleanups != null) {
        CleanUpType cleanUp = new CleanUpType();
        On_type1 onType = On_type1.failure;
        cleanUp.setOn(onType);
        CategoryListType categoryListType = new CategoryListType();
        for (ProcessConf.CLEANUP_CATEGORY fCategory : failureTypeCleanups) {
            Category_type1 categoryType1 = Category_type1.Factory.fromValue(fCategory.name().toLowerCase());
            categoryListType.addCategory(categoryType1);
        }
        cleanUp.setCategoryList(categoryListType);
        cleanUpList.addCleanUp(cleanUp);
    }
    processDeployDetailsListType.setCleanUpList(cleanUpList);
    processDeployDetailsList.setProcessDeployDetailsList(processDeployDetailsListType);
    return processDeployDetailsListType;
}
Also used : ProcessEventsListType(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.ProcessEventsListType) Node(org.w3c.dom.Node) CleanUpType(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.CleanUpType) TInvoke(org.apache.ode.bpel.dd.TInvoke) ScopeEventListType(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.ScopeEventListType) CleanUpListType(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.CleanUpListType) InvokedServiceType(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.InvokedServiceType) TProvide(org.apache.ode.bpel.dd.TProvide) EnableEventListType(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.EnableEventListType) Category_type1(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.Category_type1) InvokeServiceListType(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.InvokeServiceListType) MexInterpreterListType(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.MexInterpreterListType) Map(java.util.Map) Set(java.util.Set) ProcessStatus(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.ProcessStatus) ProvidedServiceType(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.ProvidedServiceType) BpelEvent(org.apache.ode.bpel.evt.BpelEvent) ProcessConfigurationImpl(org.wso2.carbon.bpel.core.ode.integration.store.ProcessConfigurationImpl) ScopeEventType(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.ScopeEventType) On_type1(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.On_type1) QName(javax.xml.namespace.QName) ProcessConf(org.apache.ode.bpel.iapi.ProcessConf) PropertyListType(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.PropertyListType) ProcessDeployDetailsList(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.ProcessDeployDetailsList) TenantProcessStoreImpl(org.wso2.carbon.bpel.core.ode.integration.store.TenantProcessStoreImpl) ProvideServiceListType(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.ProvideServiceListType) Generate_type1(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.Generate_type1) CategoryListType(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.CategoryListType) ProcessDeployDetailsList_type0(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.ProcessDeployDetailsList_type0) Service_type0(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.Service_type0) Service_type1(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.Service_type1) ProcessProperty_type0(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.ProcessProperty_type0)

Example 10 with TenantProcessStore

use of org.wso2.carbon.bpel.core.ode.integration.store.TenantProcessStore in project carbon-business-process by wso2.

the class ProcessManagementServiceSkeleton method getProcessInfo.

public ProcessInfoType getProcessInfo(QName pid) throws ProcessManagementException {
    ProcessInfoType processInfoType = new ProcessInfoType();
    TenantProcessStoreImpl tenantProcessStore = AdminServiceUtils.getTenantProcessStore();
    ProcessConf processConf = tenantProcessStore.getProcessConfiguration(pid);
    fillProcessInfo(processInfoType, processConf, ProcessInfoCustomizer.ALL, tenantProcessStore);
    return processInfoType;
}
Also used : ProcessInfoType(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.ProcessInfoType) ProcessConf(org.apache.ode.bpel.iapi.ProcessConf) TenantProcessStoreImpl(org.wso2.carbon.bpel.core.ode.integration.store.TenantProcessStoreImpl)

Aggregations

TenantProcessStoreImpl (org.wso2.carbon.bpel.core.ode.integration.store.TenantProcessStoreImpl)14 Collection (java.util.Collection)4 QName (javax.xml.namespace.QName)4 InstanceFilter (org.apache.ode.bpel.common.InstanceFilter)4 BpelDAOConnection (org.apache.ode.bpel.dao.BpelDAOConnection)4 ProcessInstanceDAO (org.apache.ode.bpel.dao.ProcessInstanceDAO)4 BpelDatabase (org.apache.ode.bpel.engine.BpelDatabase)4 ProcessConf (org.apache.ode.bpel.iapi.ProcessConf)4 BPELUIException (org.wso2.carbon.bpel.core.ode.integration.store.BPELUIException)4 BPELPackageRepository (org.wso2.carbon.bpel.core.ode.integration.store.repository.BPELPackageRepository)4 InstanceManagementException (org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.InstanceManagementException)4 PackageManagementException (org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.PackageManagementException)4 Map (java.util.Map)3 ProcessNotFoundException (org.apache.ode.bpel.pmapi.ProcessNotFoundException)3 ProcessingException (org.apache.ode.bpel.pmapi.ProcessingException)3 TenantProcessStore (org.wso2.carbon.bpel.core.ode.integration.store.TenantProcessStore)3 ArrayList (java.util.ArrayList)2 Set (java.util.Set)2 Node (org.w3c.dom.Node)2 ProcessConfigurationImpl (org.wso2.carbon.bpel.core.ode.integration.store.ProcessConfigurationImpl)2