Search in sources :

Example 81 with Server

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());
    }
}
Also used : ProcessTerminationListener(org.wso2.carbon.bpmn.analytics.publisher.listeners.ProcessTerminationListener) ProcessDefinitionEntity(org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity) ExecutionListener(org.activiti.engine.delegate.ExecutionListener)

Example 82 with Server

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());
    }
}
Also used : TaskCompletionListener(org.wso2.carbon.bpmn.analytics.publisher.listeners.TaskCompletionListener) TaskDefinition(org.activiti.engine.impl.task.TaskDefinition) TaskListener(org.activiti.engine.delegate.TaskListener)

Example 83 with Server

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;
}
Also used : ConfigurationContext(org.apache.axis2.context.ConfigurationContext) OperationClient(org.apache.axis2.client.OperationClient) Options(org.apache.axis2.client.Options) HttpTransportProperties(org.apache.axis2.transport.http.HttpTransportProperties) HumanTaskServerConfiguration(org.wso2.carbon.humantask.core.configuration.HumanTaskServerConfiguration) MessageContext(org.apache.axis2.context.MessageContext) EndpointReference(org.apache.axis2.addressing.EndpointReference)

Example 84 with Server

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;
}
Also used : SimpleQueryCriteria(org.wso2.carbon.humantask.core.dao.SimpleQueryCriteria)

Example 85 with Server

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();
    }
}
Also used : HumanTaskServerConfiguration(org.wso2.carbon.humantask.core.configuration.HumanTaskServerConfiguration) File(java.io.File)

Aggregations

APIManagementException (org.wso2.carbon.apimgt.api.APIManagementException)28 IOException (java.io.IOException)19 ArrayList (java.util.ArrayList)14 HashMap (java.util.HashMap)14 APIManagementException (org.wso2.carbon.apimgt.core.exception.APIManagementException)10 File (java.io.File)8 JSONObject (org.json.simple.JSONObject)7 MalformedURLException (java.net.MalformedURLException)6 URL (java.net.URL)6 OMElement (org.apache.axiom.om.OMElement)6 JSONObject (org.json.JSONObject)6 URI (java.net.URI)5 URISyntaxException (java.net.URISyntaxException)5 Test (org.testng.annotations.Test)5 KeyManager (org.wso2.carbon.apimgt.api.model.KeyManager)5 APIMgtAdminService (org.wso2.carbon.apimgt.core.api.APIMgtAdminService)5 BadRequestException (org.wso2.charon3.core.exceptions.BadRequestException)5 Connection (java.sql.Connection)4 SQLException (java.sql.SQLException)4 APIProvider (org.wso2.carbon.apimgt.api.APIProvider)4