Search in sources :

Example 1 with Activate

use of org.wso2.carbon.humantask.core.engine.commands.Activate in project carbon-apimgt by wso2.

the class BundleActivator method start.

@Activate
protected void start(BundleContext bundleContext) {
    try {
        // Set default timestamp to UTC
        java.util.TimeZone.setDefault(java.util.TimeZone.getTimeZone("Etc/UTC"));
        Context ctx = jndiContextManager.newInitialContext();
        DataSource dataSourceAMDB = new DataSourceImpl((HikariDataSource) ctx.lookup("java:comp/env/jdbc/WSO2AMDB"));
        DAOUtil.initialize(dataSourceAMDB);
        boolean isAnalyticsEnabled = ServiceReferenceHolder.getInstance().getAPIMConfiguration().getAnalyticsConfigurations().isEnabled();
        if (isAnalyticsEnabled) {
            DataSource dataSourceStatDB = new DataSourceImpl((HikariDataSource) ctx.lookup("java:comp/env/jdbc/WSO2AMSTATSDB"));
            DAOUtil.initializeAnalyticsDataSource(dataSourceStatDB);
        }
        WorkflowExtensionsConfigBuilder.build(configProvider);
        ServiceDiscoveryConfigBuilder.build(configProvider);
        ContainerBasedGatewayConfigBuilder.build(configProvider);
        BrokerManager.start();
        Broker broker = new BrokerImpl();
        BrokerUtil.initialize(broker);
    } catch (NamingException e) {
        log.error("Error occurred while jndi lookup", e);
    }
    // deploying default policies
    try {
        ThrottlerUtil.addDefaultAdvancedThrottlePolicies();
        if (log.isDebugEnabled()) {
            log.debug("Checked default throttle policies successfully");
        }
    } catch (APIManagementException e) {
        log.error("Error occurred while deploying default policies", e);
    }
    // securing files
    try {
        boolean fileEncryptionEnabled = ServiceReferenceHolder.getInstance().getAPIMConfiguration().getFileEncryptionConfigurations().isEnabled();
        if (fileEncryptionEnabled) {
            FileEncryptionUtility fileEncryptionUtility = FileEncryptionUtility.getInstance();
            fileEncryptionUtility.init();
            fileEncryptionUtility.encryptFiles();
        }
    } catch (APIManagementException e) {
        log.error("Error occurred while encrypting files", e);
    }
}
Also used : Context(javax.naming.Context) BundleContext(org.osgi.framework.BundleContext) BrokerImpl(org.wso2.carbon.apimgt.core.impl.BrokerImpl) Broker(org.wso2.carbon.apimgt.core.api.Broker) APIManagementException(org.wso2.carbon.apimgt.core.exception.APIManagementException) FileEncryptionUtility(org.wso2.carbon.apimgt.core.impl.FileEncryptionUtility) DataSourceImpl(org.wso2.carbon.apimgt.core.dao.impl.DataSourceImpl) NamingException(javax.naming.NamingException) DataSource(org.wso2.carbon.apimgt.core.dao.impl.DataSource) HikariDataSource(com.zaxxer.hikari.HikariDataSource) Activate(org.osgi.service.component.annotations.Activate)

Example 2 with Activate

use of org.wso2.carbon.humantask.core.engine.commands.Activate in project carbon-business-process by wso2.

the class BPELAppDeployerDSComponent method activate.

protected void activate(ComponentContext ctxt) {
    try {
        // register bpel deployer as an OSGi Service
        BPELAppDeployer bpelDeployer = new BPELAppDeployer();
        appHandlerRegistration = ctxt.getBundleContext().registerService(AppDeploymentHandler.class.getName(), bpelDeployer, null);
        // read required-features.xml
        URL reqFeaturesResource = ctxt.getBundleContext().getBundle().getResource(AppDeployerConstants.REQ_FEATURES_XML);
        if (reqFeaturesResource != null) {
            InputStream xmlStream = reqFeaturesResource.openStream();
            requiredFeatures = AppDeployerUtils.readRequiredFeaturs(new StAXOMBuilder(xmlStream).getDocumentElement());
        }
    } catch (Throwable e) {
        log.error("Failed to activate BPEL Application Deployer", e);
    }
}
Also used : InputStream(java.io.InputStream) StAXOMBuilder(org.apache.axiom.om.impl.builder.StAXOMBuilder) BPELAppDeployer(org.wso2.carbon.application.deployer.bpel.BPELAppDeployer) URL(java.net.URL)

Example 3 with Activate

use of org.wso2.carbon.humantask.core.engine.commands.Activate in project carbon-business-process by wso2.

the class BPELServiceComponent method activate.

protected void activate(ComponentContext ctxt) {
    try {
        this.bundleContext = ctxt.getBundleContext();
        if (dataSourceServiceProvided) {
            initializeBPELServer();
            registerAxis2ConfigurationContextObserver();
            registerBPELServerService();
        }
        bundleContext.registerService(ServerStartupObserver.class.getName(), new BPELSchedulerInitializer(), null);
        // registering service to shutdown ode scheduler, before server shutdown
        bundleContext.registerService(WaitBeforeShutdownObserver.class.getName(), new BPELSchedulerShutdown(), null);
    } catch (Throwable t) {
        log.error("Failed to activate BPEL Core bundle", t);
    }
    if (log.isDebugEnabled()) {
        log.debug("BPEL Core bundle is activated.");
    }
}
Also used : ServerStartupObserver(org.wso2.carbon.core.ServerStartupObserver) BPELSchedulerShutdown(org.wso2.carbon.bpel.core.ode.integration.BPELSchedulerShutdown) WaitBeforeShutdownObserver(org.wso2.carbon.utils.WaitBeforeShutdownObserver) BPELSchedulerInitializer(org.wso2.carbon.bpel.core.ode.integration.BPELSchedulerInitializer)

Example 4 with Activate

use of org.wso2.carbon.humantask.core.engine.commands.Activate in project carbon-business-process by wso2.

the class BPMNAnalyticsServiceComponent method activate.

/**
 * Activate BPMN analytics component.
 *
 * @param ctxt ComponentContext
 */
protected void activate(ComponentContext ctxt) {
    try {
        BPMNAnalyticsHolder bpmnAnalyticsHolder = BPMNAnalyticsHolder.getInstance();
        initAnalyticsServer(bpmnAnalyticsHolder);
        BPSAnalyticsService bpsAnalyticsService = new BPSAnalyticsService();
        bpsAnalyticsService.setBPSAnalyticsServer(bpmnAnalyticsHolder.getBPSAnalyticsServer());
        // Register BPS analytics Service OSGI Service
        ctxt.getBundleContext().registerService(BPSAnalyticsService.class.getName(), bpsAnalyticsService, null);
        BPMNDataPublisher BPMNDataPublisher = new BPMNDataPublisher();
        BPMNAnalyticsHolder.getInstance().setBpmnDataPublisher(BPMNDataPublisher);
        BPMNDataPublisher.configure();
        log.info("Initializing the BPMN Analytics Service component...");
    } catch (Throwable e) {
        log.error("Failed to initialize the BPMN Analytics Service component.", e);
    }
}
Also used : BPSAnalyticsService(org.wso2.carbon.bpmn.analytics.publisher.BPSAnalyticsService) BPMNDataPublisher(org.wso2.carbon.bpmn.analytics.publisher.BPMNDataPublisher)

Example 5 with Activate

use of org.wso2.carbon.humantask.core.engine.commands.Activate in project carbon-business-process by wso2.

the class Instance method getInstanceInfoFromInstanceId.

@Override
public String[] getInstanceInfoFromInstanceId() {
    StringBuffer buffer = new StringBuffer();
    PaginatedInstanceList paginatedInstanceList;
    String[] instanceInfoArray = null;
    int arrayCount = 0;
    try {
        paginatedInstanceList = getPaginatedInstanceList(" ", "-last-active", 200, 0);
        LimitedInstanceInfoType[] instanceArray = paginatedInstanceList.getInstance();
        instanceInfoArray = new String[instanceArray.length];
        for (LimitedInstanceInfoType instance : instanceArray) {
            buffer.append("Instance id=" + instance.getIid());
            buffer.append("  ");
            buffer.append("Process id=" + instance.getPid());
            buffer.append(" ");
            buffer.append("Status =" + instance.getStatus());
            buffer.append(" ");
            buffer.append("Started Date=" + instance.getDateStarted().get(5));
            buffer.append("-" + instance.getDateStarted().get(2));
            buffer.append("-" + instance.getDateStarted().get(1));
            buffer.append("  ");
            buffer.append(instance.getDateStarted().get(11));
            buffer.append(":" + instance.getDateStarted().get(12));
            buffer.append(":" + instance.getDateStarted().get(13));
            buffer.append("  ");
            buffer.append("Date Last Activate=" + instance.getDateLastActive().get(5));
            buffer.append("-" + instance.getDateLastActive().get(2));
            buffer.append("-" + instance.getDateLastActive().get(1));
            buffer.append("  ");
            buffer.append(instance.getDateLastActive().get(11));
            buffer.append(":" + instance.getDateLastActive().get(12));
            buffer.append(":" + instance.getDateLastActive().get(13));
            buffer.append("  ");
            instanceInfoArray[arrayCount] = buffer.toString();
            arrayCount++;
            buffer.delete(0, buffer.length());
        }
    } catch (InstanceManagementException e) {
        String errMsg = "failed to get instance information from instance id";
        log.error(errMsg, e);
    }
    return instanceInfoArray;
}
Also used : InstanceManagementException(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.InstanceManagementException) LimitedInstanceInfoType(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.LimitedInstanceInfoType) PaginatedInstanceList(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.PaginatedInstanceList)

Aggregations

BundleContext (org.osgi.framework.BundleContext)4 InputStream (java.io.InputStream)3 URL (java.net.URL)3 StAXOMBuilder (org.apache.axiom.om.impl.builder.StAXOMBuilder)3 ServerStartupObserver (org.wso2.carbon.core.ServerStartupObserver)2 HikariDataSource (com.zaxxer.hikari.HikariDataSource)1 Hashtable (java.util.Hashtable)1 Context (javax.naming.Context)1 NamingException (javax.naming.NamingException)1 RuntimeService (org.activiti.engine.RuntimeService)1 HistoricProcessInstance (org.activiti.engine.history.HistoricProcessInstance)1 ProcessInstance (org.activiti.engine.runtime.ProcessInstance)1 AxisFault (org.apache.axis2.AxisFault)1 ContextException (org.apache.ode.bpel.iapi.ContextException)1 ProcessConf (org.apache.ode.bpel.iapi.ProcessConf)1 ProcessStore (org.apache.ode.bpel.iapi.ProcessStore)1 Activate (org.osgi.service.component.annotations.Activate)1 Broker (org.wso2.carbon.apimgt.core.api.Broker)1 DataSource (org.wso2.carbon.apimgt.core.dao.impl.DataSource)1 DataSourceImpl (org.wso2.carbon.apimgt.core.dao.impl.DataSourceImpl)1