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);
}
}
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);
}
}
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.");
}
}
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);
}
}
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;
}
Aggregations