Search in sources :

Example 1 with MIMPProcessor

use of org.compiere.model.MIMPProcessor in project adempiere by adempiere.

the class AdempiereServerMgr method startServers.

//	startEnvironment
/**
	 * 	Start Environment
	 *	@return true if started
	 */
private boolean startServers() {
    log.info("");
    int noServers = 0;
    //	Accounting
    MAcctProcessor[] acctModels = MAcctProcessor.getActive(m_ctx);
    for (int i = 0; i < acctModels.length; i++) {
        MAcctProcessor pModel = acctModels[i];
        AdempiereServer server = AdempiereServer.create(pModel);
        server.start();
        server.setPriority(Thread.NORM_PRIORITY - 2);
        m_servers.add(server);
    }
    //	Request
    MRequestProcessor[] requestModels = MRequestProcessor.getActive(m_ctx);
    for (int i = 0; i < requestModels.length; i++) {
        MRequestProcessor pModel = requestModels[i];
        AdempiereServer server = AdempiereServer.create(pModel);
        server.start();
        server.setPriority(Thread.NORM_PRIORITY - 2);
        m_servers.add(server);
    }
    //	Workflow
    MWorkflowProcessor[] workflowModels = MWorkflowProcessor.getActive(m_ctx);
    for (int i = 0; i < workflowModels.length; i++) {
        MWorkflowProcessor pModel = workflowModels[i];
        AdempiereServer server = AdempiereServer.create(pModel);
        server.start();
        server.setPriority(Thread.NORM_PRIORITY - 2);
        m_servers.add(server);
    }
    //	Alert
    MAlertProcessor[] alertModels = MAlertProcessor.getActive(m_ctx);
    for (int i = 0; i < alertModels.length; i++) {
        MAlertProcessor pModel = alertModels[i];
        AdempiereServer server = AdempiereServer.create(pModel);
        server.start();
        server.setPriority(Thread.NORM_PRIORITY - 2);
        m_servers.add(server);
    }
    //	Scheduler
    MScheduler[] schedulerModels = MScheduler.getActive(m_ctx);
    for (int i = 0; i < schedulerModels.length; i++) {
        MScheduler pModel = schedulerModels[i];
        AdempiereServer server = AdempiereServer.create(pModel);
        server.start();
        server.setPriority(Thread.NORM_PRIORITY - 2);
        m_servers.add(server);
    }
    //	LDAP
    MLdapProcessor[] ldapModels = MLdapProcessor.getActive(m_ctx);
    for (int i = 0; i < ldapModels.length; i++) {
        MLdapProcessor lp = ldapModels[i];
        AdempiereServer server = AdempiereServer.create(lp);
        server.start();
        server.setPriority(Thread.NORM_PRIORITY - 1);
        m_servers.add(server);
    }
    //	ImportProcessor - @Trifon
    MIMPProcessor[] importModels = MIMPProcessor.getActive(m_ctx);
    for (int i = 0; i < importModels.length; i++) {
        MIMPProcessor lp = importModels[i];
        AdempiereServer server = AdempiereServer.create(lp);
        server.start();
        server.setPriority(Thread.NORM_PRIORITY - 1);
        m_servers.add(server);
    }
    log.fine("#" + noServers);
    return startAll();
}
Also used : MRequestProcessor(org.compiere.model.MRequestProcessor) MLdapProcessor(org.compiere.model.MLdapProcessor) MAcctProcessor(org.compiere.model.MAcctProcessor) MIMPProcessor(org.compiere.model.MIMPProcessor) MWorkflowProcessor(org.compiere.wf.MWorkflowProcessor) MScheduler(org.compiere.model.MScheduler) MAlertProcessor(org.compiere.model.MAlertProcessor)

Example 2 with MIMPProcessor

use of org.compiere.model.MIMPProcessor in project adempiere by adempiere.

the class FileImportProcessor method process.

public void process(Properties ctx, ReplicationProcessor replicationProcessor, String trxName) throws Exception {
    MIMPProcessor impProcessor = replicationProcessor.getMImportProcessor();
    X_IMP_ProcessorParameter[] processorParameters = impProcessor.getIMP_ProcessorParameters(trxName);
    String fileName = null;
    String folder = "";
    if (processorParameters != null && processorParameters.length > 0) {
        for (int i = 0; i < processorParameters.length; i++) {
            log.info("ProcesParameter          Value = " + processorParameters[i].getValue());
            log.info("ProcesParameter ParameterValue = " + processorParameters[i].getParameterValue());
            if (processorParameters[i].getValue().equals("fileName")) {
                fileName = processorParameters[i].getParameterValue();
            } else if (processorParameters[i].getValue().equals("folder")) {
                folder = processorParameters[i].getParameterValue();
            }
        }
    }
    if (fileName == null || fileName.length() == 0) {
        throw new Exception("Missing IMP_ProcessorParameter with key 'fileName'!");
    }
    Document documentToBeImported = XMLHelper.createDocumentFromFile(folder + fileName);
    StringBuffer result = new StringBuffer();
    ImportHelper impHelper = new ImportHelper(ctx);
    impHelper.importXMLDocument(result, documentToBeImported, trxName);
//		addLog(0, null, null, Msg.getMsg(ctx, "ImportModelProcessResult") + "\n" + result.toString());
}
Also used : MIMPProcessor(org.compiere.model.MIMPProcessor) Document(org.w3c.dom.Document) X_IMP_ProcessorParameter(org.compiere.model.X_IMP_ProcessorParameter) ImportHelper(org.adempiere.process.rpl.imp.ImportHelper)

Example 3 with MIMPProcessor

use of org.compiere.model.MIMPProcessor in project adempiere by adempiere.

the class TopicImportProcessor method process.

public void process(Properties ctx, ReplicationProcessor replicationProcessor, String trxName) throws Exception {
    log.info("replicationProcessor = " + replicationProcessor);
    log.info("replicationProcessor.getMImportProcessor() = " + replicationProcessor.getMImportProcessor());
    MIMPProcessor impProcessor = replicationProcessor.getMImportProcessor();
    X_IMP_ProcessorParameter[] processorParameters = impProcessor.getIMP_ProcessorParameters(trxName);
    String host = impProcessor.getHost();
    int port = impProcessor.getPort();
    String account = impProcessor.getAccount();
    String password = impProcessor.getPasswordInfo();
    // mandatory parameters!
    String topicName = null;
    String protocol = null;
    boolean isDurableSubscription = true;
    String subscriptionName = null;
    String options = null;
    String clientID = null;
    if (processorParameters != null && processorParameters.length > 0) {
        for (int i = 0; i < processorParameters.length; i++) {
            log.info("ProcesParameter          Value = " + processorParameters[i].getValue());
            log.info("ProcesParameter ParameterValue = " + processorParameters[i].getParameterValue());
            if (processorParameters[i].getValue().equals("topicName")) {
                topicName = processorParameters[i].getParameterValue();
            } else if (processorParameters[i].getValue().equals("protocol")) {
                protocol = processorParameters[i].getParameterValue();
            } else if (processorParameters[i].getValue().equals("isDurableSubscription")) {
                isDurableSubscription = Boolean.parseBoolean(processorParameters[i].getParameterValue());
            } else if (processorParameters[i].getValue().equals("subscriptionName")) {
                subscriptionName = processorParameters[i].getParameterValue();
            } else if (processorParameters[i].getValue().equals("clientID")) {
                clientID = processorParameters[i].getParameterValue();
            } else {
            // Some other mandatory parameter here
            }
        }
    }
    if (topicName == null || topicName.length() == 0) {
        throw new Exception("Missing " + X_IMP_ProcessorParameter.Table_Name + " with key 'topicName'!");
    }
    if (protocol == null || protocol.length() == 0) {
        throw new Exception("Missing " + X_IMP_ProcessorParameter.Table_Name + " with key 'protocol'!");
    }
    if (isDurableSubscription && subscriptionName == null || subscriptionName.length() == 0) {
        throw new Exception("Missing " + X_IMP_ProcessorParameter.Table_Name + " with key 'subscriptionName'!");
    }
    if (clientID == null || clientID.length() == 0) {
        throw new Exception("Missing " + X_IMP_ProcessorParameter.Table_Name + " with key 'clientID'!");
    }
    topicListener = new TopicListener(ctx, replicationProcessor, protocol, host, port, isDurableSubscription, subscriptionName, topicName, clientID, account, password, options, trxName);
    topicListener.run();
    log.info("Started topicListener = " + topicListener);
}
Also used : MIMPProcessor(org.compiere.model.MIMPProcessor) X_IMP_ProcessorParameter(org.compiere.model.X_IMP_ProcessorParameter)

Aggregations

MIMPProcessor (org.compiere.model.MIMPProcessor)3 X_IMP_ProcessorParameter (org.compiere.model.X_IMP_ProcessorParameter)2 ImportHelper (org.adempiere.process.rpl.imp.ImportHelper)1 MAcctProcessor (org.compiere.model.MAcctProcessor)1 MAlertProcessor (org.compiere.model.MAlertProcessor)1 MLdapProcessor (org.compiere.model.MLdapProcessor)1 MRequestProcessor (org.compiere.model.MRequestProcessor)1 MScheduler (org.compiere.model.MScheduler)1 MWorkflowProcessor (org.compiere.wf.MWorkflowProcessor)1 Document (org.w3c.dom.Document)1