use of org.wso2.broker.amqp.Server in project carbon-business-process by wso2.
the class ProcessParseHandler method executeParse.
@Override
protected void executeParse(BpmnParse bpmnParse, BaseElement baseElement) {
ProcessDefinitionEntity processDefinitionEntity = bpmnParse.getCurrentProcessDefinition();
// We have to check if the data publishing listener has already been associated at server startup.
ExecutionListener processTerminationListener = null;
List<ExecutionListener> endListeners = processDefinitionEntity.getExecutionListeners(PvmEvent.EVENTNAME_END);
if (endListeners != null) {
for (ExecutionListener listener : endListeners) {
if (listener instanceof ProcessTerminationListener) {
processTerminationListener = listener;
break;
}
}
}
if (processTerminationListener == null) {
if (log.isDebugEnabled()) {
log.debug("Enabling data publishing for process: " + processDefinitionEntity.getName());
}
processDefinitionEntity.addExecutionListener(PvmEvent.EVENTNAME_END, new ProcessTerminationListener());
}
}
use of org.wso2.broker.amqp.Server in project carbon-business-process by wso2.
the class TaskParseHandler method executeParse.
@Override
protected void executeParse(BpmnParse bpmnParse, BaseElement element) {
TaskDefinition taskDefinition = (TaskDefinition) bpmnParse.getCurrentActivity().getProperty(UserTaskParseHandler.PROPERTY_TASK_DEFINITION);
// We have to check if data publishing listener has already been associated at server startup
TaskListener taskCompletionListener = null;
List<TaskListener> completionListeners = taskDefinition.getTaskListener(TaskListener.EVENTNAME_COMPLETE);
if (completionListeners != null) {
for (TaskListener listener : completionListeners) {
if (listener instanceof TaskCompletionListener) {
taskCompletionListener = listener;
break;
}
}
}
if (taskCompletionListener == null) {
if (log.isDebugEnabled()) {
log.debug("Adding data publishing listener to task: " + taskDefinition.getKey());
}
taskDefinition.addTaskListener(TaskListener.EVENTNAME_COMPLETE, new TaskCompletionListener());
}
}
use of org.wso2.broker.amqp.Server in project carbon-business-process by wso2.
the class ServiceUtils method invokeRegistrationService.
public static MessageContext invokeRegistrationService(MessageContext mctx, String registrationService) throws AxisFault {
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
ConfigurationContext configurationContext = HTCoordinationModuleContentHolder.getInstance().getHtServer().getTaskStoreManager().getHumanTaskStore(tenantId).getConfigContext();
OperationClient opClient = getOperationClient(mctx, configurationContext);
mctx.getOptions().setParent(opClient.getOptions());
opClient.addMessageContext(mctx);
Options operationOptions = opClient.getOptions();
operationOptions.setTo(new EndpointReference(registrationService));
operationOptions.setAction(Constants.WS_COOR_REGISTERATION_ACTION);
// operationOptions.setTransportInProtocol(org.apache.axis2.Constants.TRANSPORT_HTTPS);
// Setting basic auth headers. Reading those information using HT server config.
HumanTaskServerConfiguration serverConfig = HTCoordinationModuleContentHolder.getInstance().getHtServer().getServerConfig();
// String tenantDomain = MultitenantUtils.getTenantDomainFromUrl(registrationService);
// if (registrationService.equals(tenantDomain)) {
// //this is a Super tenant registration service
// if (log.isDebugEnabled()) {
// log.debug("Sending Username" + serverConfig.getRegistrationServiceAuthUsername() + " - " + serverConfig.getRegistrationServiceAuthPassword()); //TODO REMOVE this
// }
// setBasicAccessSecurityHeaders(serverConfig.getRegistrationServiceAuthUsername(), serverConfig.getRegistrationServiceAuthPassword(), true, operationOptions);
// } else {
// if (log.isDebugEnabled()) {
// log.debug("Sending ws-coor Registration request to tenant domain: " + tenantDomain);
// }
// // Tenant's registration service
//
// String username = serverConfig.getRegistrationServiceAuthUsername() + "@" + tenantDomain;
// String pass = serverConfig.getRegistrationServiceAuthPassword();
// if (log.isDebugEnabled()) {
// log.debug("Sending Username" + username + " - " + pass); //TODO REMOVE this
// }
// setBasicAccessSecurityHeaders(username,pass,true,operationOptions);
// }
HttpTransportProperties.Authenticator basicAuthentication = new HttpTransportProperties.Authenticator();
basicAuthentication.setPreemptiveAuthentication(true);
basicAuthentication.setUsername(serverConfig.getRegistrationServiceAuthUsername());
basicAuthentication.setPassword(serverConfig.getRegistrationServiceAuthPassword());
operationOptions.setProperty(org.apache.axis2.transport.http.HTTPConstants.AUTHENTICATE, basicAuthentication);
if (log.isDebugEnabled()) {
log.debug("Invoking Registration service");
}
opClient.execute(true);
MessageContext responseMessageContext = opClient.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
return responseMessageContext;
}
use of org.wso2.broker.amqp.Server in project carbon-business-process by wso2.
the class RemovableTaskCleanupJob method createQueryCriteria.
/**
* Create task removal query criteria.
*
* @param serverConfiguration : The server config.
* @return : The SimpleQueryCriteria.
*/
private SimpleQueryCriteria createQueryCriteria(HumanTaskServerConfiguration serverConfiguration) {
SimpleQueryCriteria queryCriteria = new SimpleQueryCriteria();
queryCriteria.setSimpleQueryType(SimpleQueryCriteria.QueryType.REMOVE_TASKS);
queryCriteria.setStatuses(serverConfiguration.getRemovableTaskStatuses());
return queryCriteria;
}
use of org.wso2.broker.amqp.Server in project carbon-business-process by wso2.
the class HumanTaskServer method loadHumanTaskServerConfiguration.
/**
* Read the human task configuration file and load it to memory. If configuration file is not there default
* configuration will be created.
*/
private void loadHumanTaskServerConfiguration() {
if (log.isDebugEnabled()) {
log.debug("Loading Human Task Server Configuration...");
}
if (isHumanTaskConfigurationFileAvailable()) {
File htServerConfigFile = new File(calculateHumanTaskServerConfigurationFilePath());
serverConfig = new HumanTaskServerConfiguration(htServerConfigFile);
} else {
log.info("Humantask configuration file: " + HumanTaskConstants.HUMANTASK_CONFIG_FILE + " not found. Loading default configurations.");
serverConfig = new HumanTaskServerConfiguration();
}
}
Aggregations