IDEMPIERE-1139 Can't replace or extend Server for AdempiereProcessor using plugin.
This commit is contained in:
parent
c7c0f5f8bb
commit
df47fc59e4
|
@ -9,14 +9,13 @@ import java.util.Properties;
|
||||||
|
|
||||||
import org.adempiere.server.IServerFactory;
|
import org.adempiere.server.IServerFactory;
|
||||||
import org.compiere.model.MIMPProcessor;
|
import org.compiere.model.MIMPProcessor;
|
||||||
import org.compiere.server.AdempiereServer;
|
|
||||||
import org.compiere.server.ReplicationProcessor;
|
import org.compiere.server.ReplicationProcessor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author hengsin
|
* @author hengsin
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class ReplicationServerFactory implements IServerFactory {
|
public class ReplicationServerFactory implements IServerFactory<ReplicationProcessor, MIMPProcessor> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* default constructor
|
* default constructor
|
||||||
|
@ -28,17 +27,21 @@ public class ReplicationServerFactory implements IServerFactory {
|
||||||
* @see org.adempiere.server.IServerFactory#create()
|
* @see org.adempiere.server.IServerFactory#create()
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public AdempiereServer[] create(Properties ctx) {
|
public ReplicationProcessor[] create(Properties ctx) {
|
||||||
List<AdempiereServer> list = new ArrayList<AdempiereServer>();
|
List<ReplicationProcessor> list = new ArrayList<ReplicationProcessor>();
|
||||||
MIMPProcessor[] importModels = MIMPProcessor.getActive(ctx);
|
MIMPProcessor[] importModels = MIMPProcessor.getActive(ctx);
|
||||||
for (int i = 0; i < importModels.length; i++)
|
for (MIMPProcessor lp : importModels)
|
||||||
{
|
{
|
||||||
MIMPProcessor lp = importModels[i];
|
ReplicationProcessor server = new ReplicationProcessor(lp);
|
||||||
AdempiereServer server = new ReplicationProcessor(lp);
|
|
||||||
list.add(server);
|
list.add(server);
|
||||||
}
|
}
|
||||||
AdempiereServer[] servers = list.toArray(new AdempiereServer[0]);
|
ReplicationProcessor[] servers = list.toArray(new ReplicationProcessor[0]);
|
||||||
return servers;
|
return servers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Class<MIMPProcessor> getProcessorClass() {
|
||||||
|
return MIMPProcessor.class;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,18 +48,17 @@ import org.compiere.model.MIMPProcessorLog;
|
||||||
public class ReplicationProcessor extends AdempiereServer {
|
public class ReplicationProcessor extends AdempiereServer {
|
||||||
|
|
||||||
/** Last Summary */
|
/** Last Summary */
|
||||||
private StringBuffer m_summary = new StringBuffer();
|
protected StringBuffer m_summary = new StringBuffer();
|
||||||
|
|
||||||
/** Client info */
|
/** Client info */
|
||||||
@SuppressWarnings("unused")
|
protected MClient m_client = null;
|
||||||
private MClient m_client = null;
|
|
||||||
|
|
||||||
private MIMPProcessor mImportProcessor = null;
|
protected MIMPProcessor mImportProcessor = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* flag showing if process is working!
|
* flag showing if process is working!
|
||||||
*/
|
*/
|
||||||
private boolean isProcessRunning = false;
|
protected boolean isProcessRunning = false;
|
||||||
|
|
||||||
|
|
||||||
/*protected ReplicationProcessor(MIMPProcessor model, int initialNap) {
|
/*protected ReplicationProcessor(MIMPProcessor model, int initialNap) {
|
||||||
|
@ -75,10 +74,10 @@ public class ReplicationProcessor extends AdempiereServer {
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
public ReplicationProcessor(AdempiereProcessor model, int initialNap) {
|
public ReplicationProcessor(AdempiereProcessor model, int initialNap) {
|
||||||
super (model, initialNap);
|
super (model, initialNap);
|
||||||
mImportProcessor = (MIMPProcessor)model;
|
mImportProcessor = (MIMPProcessor)model;
|
||||||
m_client = MClient.get(mImportProcessor.getCtx(), mImportProcessor.getAD_Client_ID());
|
m_client = MClient.get(mImportProcessor.getCtx(), mImportProcessor.getAD_Client_ID());
|
||||||
}
|
}
|
||||||
public ReplicationProcessor(AdempiereProcessor model) {
|
public ReplicationProcessor(AdempiereProcessor model) {
|
||||||
super (model, 30);
|
super (model, 30);
|
||||||
mImportProcessor =(MIMPProcessor)model;
|
mImportProcessor =(MIMPProcessor)model;
|
||||||
|
|
|
@ -20,6 +20,11 @@
|
||||||
<arguments>
|
<arguments>
|
||||||
</arguments>
|
</arguments>
|
||||||
</buildCommand>
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.pde.ds.core.builder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
</buildSpec>
|
</buildSpec>
|
||||||
<natures>
|
<natures>
|
||||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||||
|
|
|
@ -32,4 +32,8 @@ Import-Package: javax.jms;version="1.1.0",
|
||||||
org.restlet.service,
|
org.restlet.service,
|
||||||
org.restlet.util
|
org.restlet.util
|
||||||
Export-Package: org.adempiere.server,
|
Export-Package: org.adempiere.server,
|
||||||
org.compiere.server
|
org.compiere.ldap,
|
||||||
|
org.compiere.server,
|
||||||
|
org.idempiere.server.factory
|
||||||
|
Bundle-ActivationPolicy: lazy
|
||||||
|
Service-Component: OSGI-INF/acctprocessorfactory.xml, OSGI-INF/alertprocessorfactory.xml, OSGI-INF/ldapprocessorfactory.xml, OSGI-INF/requestprocessorfactory.xml, OSGI-INF/schedulerfactory.xml, OSGI-INF/workflowprocessorfactory.xml
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.idempiere.server.factory.defaultacctprocessor">
|
||||||
|
<implementation class="org.idempiere.server.factory.DefaultAcctProcessorFactory"/>
|
||||||
|
<property name="service.ranking" type="Integer" value="0"/>
|
||||||
|
<service>
|
||||||
|
<provide interface="org.adempiere.server.IServerFactory"/>
|
||||||
|
</service>
|
||||||
|
</scr:component>
|
|
@ -0,0 +1,8 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.idempiere.server.factory.defaultalertprocessor">
|
||||||
|
<implementation class="org.idempiere.server.factory.DefaultAlertProcessorFactory"/>
|
||||||
|
<property name="service.ranking" type="Integer" value="0"/>
|
||||||
|
<service>
|
||||||
|
<provide interface="org.adempiere.server.IServerFactory"/>
|
||||||
|
</service>
|
||||||
|
</scr:component>
|
|
@ -0,0 +1,8 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.idempiere.server.factory.defaultldapprocessor">
|
||||||
|
<implementation class="org.idempiere.server.factory.DefaultLDAPProcessorFactory"/>
|
||||||
|
<property name="service.ranking" type="Integer" value="0"/>
|
||||||
|
<service>
|
||||||
|
<provide interface="org.adempiere.server.IServerFactory"/>
|
||||||
|
</service>
|
||||||
|
</scr:component>
|
|
@ -0,0 +1,8 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.idempiere.server.factory.defaultrequestprocessor">
|
||||||
|
<implementation class="org.idempiere.server.factory.DefaultRequestProcessorFactory"/>
|
||||||
|
<property name="service.ranking" type="Integer" value="0"/>
|
||||||
|
<service>
|
||||||
|
<provide interface="org.adempiere.server.IServerFactory"/>
|
||||||
|
</service>
|
||||||
|
</scr:component>
|
|
@ -0,0 +1,8 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.idempiere.server.factory.defaultscheduler">
|
||||||
|
<implementation class="org.idempiere.server.factory.DefaultSchedulerFactory"/>
|
||||||
|
<property name="service.ranking" type="Integer" value="0"/>
|
||||||
|
<service>
|
||||||
|
<provide interface="org.adempiere.server.IServerFactory"/>
|
||||||
|
</service>
|
||||||
|
</scr:component>
|
|
@ -0,0 +1,8 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.idempiere.server.factory.defaultworkflowprocessor">
|
||||||
|
<implementation class="org.idempiere.server.factory.DefaultWorkflowProcessorFactory"/>
|
||||||
|
<property name="service.ranking" type="Integer" value="0"/>
|
||||||
|
<service>
|
||||||
|
<provide interface="org.adempiere.server.IServerFactory"/>
|
||||||
|
</service>
|
||||||
|
</scr:component>
|
|
@ -20,12 +20,19 @@ bin.includes = META-INF/,\
|
||||||
standard.css,\
|
standard.css,\
|
||||||
webstart.jpg,\
|
webstart.jpg,\
|
||||||
zip.gif,\
|
zip.gif,\
|
||||||
plugin.xml
|
plugin.xml,\
|
||||||
bin.excludes = src/**,\
|
OSGI-INF/acctprocessorfactory.xml,\
|
||||||
.settings/**,\
|
OSGI-INF/alertprocessorfactory.xml,\
|
||||||
.classpath,\
|
OSGI-INF/ldapprocessorfactory.xml,\
|
||||||
.project,\
|
OSGI-INF/requestprocessorfactory.xml,\
|
||||||
build.properties
|
OSGI-INF/schedulerfactory.xml,\
|
||||||
|
OSGI-INF/workflowprocessorfactory.xml,\
|
||||||
|
OSGI-INF/
|
||||||
|
output.. = build/classes/
|
||||||
source.. = src/main/server/,\
|
source.. = src/main/server/,\
|
||||||
src/main/servlet/
|
src/main/servlet/
|
||||||
output.. = build/classes/
|
bin.excludes = src/**,\
|
||||||
|
.settings/**,\
|
||||||
|
.classpath,\
|
||||||
|
.project,\
|
||||||
|
build.properties
|
||||||
|
|
|
@ -15,6 +15,7 @@ package org.adempiere.server;
|
||||||
|
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import org.compiere.model.AdempiereProcessor;
|
||||||
import org.compiere.server.AdempiereServer;
|
import org.compiere.server.AdempiereServer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -22,8 +23,18 @@ import org.compiere.server.AdempiereServer;
|
||||||
* @author hengsin
|
* @author hengsin
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public interface IServerFactory {
|
public interface IServerFactory<S extends AdempiereServer, M extends AdempiereProcessor> {
|
||||||
|
|
||||||
// Class implementing this method must take into account if the server can be ran on this IP
|
/**
|
||||||
public AdempiereServer[] create (Properties ctx);
|
* @param ctx
|
||||||
|
* @return list of AdempiereServer
|
||||||
|
*/
|
||||||
|
public S[] create (Properties ctx);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Adempiere Server Manager will used this to avoid running duplicate server for the same
|
||||||
|
* AdempiereProcessor model.
|
||||||
|
* @return Fully qualified AdempiereProcessor model class name
|
||||||
|
*/
|
||||||
|
public Class<M> getProcessorClass();
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,13 +46,13 @@ public class LdapProcessor extends AdempiereServer
|
||||||
} // LdapProcessor
|
} // LdapProcessor
|
||||||
|
|
||||||
/** The Concrete Model */
|
/** The Concrete Model */
|
||||||
private MLdapProcessor m_model = null;
|
protected MLdapProcessor m_model = null;
|
||||||
/** Last Summary */
|
/** Last Summary */
|
||||||
private StringBuffer m_summary = new StringBuffer();
|
protected StringBuffer m_summary = new StringBuffer();
|
||||||
/** Server Socket */
|
/** Server Socket */
|
||||||
private ServerSocket m_serverSocket = null;
|
protected ServerSocket m_serverSocket = null;
|
||||||
/** Counter */
|
/** Counter */
|
||||||
private int m_counter = 0;
|
protected int m_counter = 0;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -56,13 +56,13 @@ public class AcctProcessor extends AdempiereServer
|
||||||
} // AcctProcessor
|
} // AcctProcessor
|
||||||
|
|
||||||
/** The Concrete Model */
|
/** The Concrete Model */
|
||||||
private MAcctProcessor m_model = null;
|
protected MAcctProcessor m_model = null;
|
||||||
/** Last Summary */
|
/** Last Summary */
|
||||||
private StringBuffer m_summary = new StringBuffer();
|
protected StringBuffer m_summary = new StringBuffer();
|
||||||
/** Client onfo */
|
/** Client onfo */
|
||||||
private MClient m_client = null;
|
protected MClient m_client = null;
|
||||||
/** Accounting Schemata */
|
/** Accounting Schemata */
|
||||||
private MAcctSchema[] m_ass = null;
|
protected MAcctSchema[] m_ass = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Work
|
* Work
|
||||||
|
|
|
@ -20,22 +20,15 @@ import java.sql.Timestamp;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
import org.compiere.ldap.LdapProcessor;
|
|
||||||
import org.compiere.model.AdempiereProcessor;
|
import org.compiere.model.AdempiereProcessor;
|
||||||
import org.compiere.model.AdempiereProcessor2;
|
import org.compiere.model.AdempiereProcessor2;
|
||||||
import org.compiere.model.AdempiereProcessorLog;
|
import org.compiere.model.AdempiereProcessorLog;
|
||||||
import org.compiere.model.MAcctProcessor;
|
|
||||||
import org.compiere.model.MAlertProcessor;
|
|
||||||
import org.compiere.model.MClient;
|
import org.compiere.model.MClient;
|
||||||
import org.compiere.model.MLdapProcessor;
|
|
||||||
import org.compiere.model.MRequestProcessor;
|
|
||||||
import org.compiere.model.MSchedule;
|
import org.compiere.model.MSchedule;
|
||||||
import org.compiere.model.MScheduler;
|
|
||||||
import org.compiere.model.MSystem;
|
import org.compiere.model.MSystem;
|
||||||
import org.compiere.util.CLogger;
|
import org.compiere.util.CLogger;
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
import org.compiere.util.TimeUtil;
|
import org.compiere.util.TimeUtil;
|
||||||
import org.compiere.wf.MWorkflowProcessor;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adempiere Server Base
|
* Adempiere Server Base
|
||||||
|
@ -45,31 +38,6 @@ import org.compiere.wf.MWorkflowProcessor;
|
||||||
*/
|
*/
|
||||||
public abstract class AdempiereServer implements Runnable
|
public abstract class AdempiereServer implements Runnable
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* Create New Server Thead
|
|
||||||
* @param model model
|
|
||||||
* @return server tread or null
|
|
||||||
*/
|
|
||||||
public static AdempiereServer create (AdempiereProcessor model)
|
|
||||||
{
|
|
||||||
if (! isOKtoRunOnIP(model))
|
|
||||||
return null;
|
|
||||||
if (model instanceof MRequestProcessor)
|
|
||||||
return new RequestProcessor ((MRequestProcessor)model);
|
|
||||||
if (model instanceof MWorkflowProcessor)
|
|
||||||
return new WorkflowProcessor ((MWorkflowProcessor)model);
|
|
||||||
if (model instanceof MAcctProcessor)
|
|
||||||
return new AcctProcessor ((MAcctProcessor)model);
|
|
||||||
if (model instanceof MAlertProcessor)
|
|
||||||
return new AlertProcessor ((MAlertProcessor)model);
|
|
||||||
if (model instanceof MScheduler)
|
|
||||||
return new Scheduler ((MScheduler)model);
|
|
||||||
if (model instanceof MLdapProcessor)
|
|
||||||
return new LdapProcessor((MLdapProcessor)model);
|
|
||||||
//
|
|
||||||
throw new IllegalArgumentException("Unknown Processor");
|
|
||||||
} // create
|
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
* Server Base Class
|
* Server Base Class
|
||||||
|
|
|
@ -27,15 +27,10 @@ import java.util.logging.Level;
|
||||||
import org.adempiere.base.Service;
|
import org.adempiere.base.Service;
|
||||||
import org.adempiere.server.IServerFactory;
|
import org.adempiere.server.IServerFactory;
|
||||||
import org.compiere.Adempiere;
|
import org.compiere.Adempiere;
|
||||||
import org.compiere.model.MAcctProcessor;
|
import org.compiere.model.AdempiereProcessor;
|
||||||
import org.compiere.model.MAlertProcessor;
|
|
||||||
import org.compiere.model.MLdapProcessor;
|
|
||||||
import org.compiere.model.MRequestProcessor;
|
|
||||||
import org.compiere.model.MScheduler;
|
|
||||||
import org.compiere.model.MSession;
|
import org.compiere.model.MSession;
|
||||||
import org.compiere.util.CLogger;
|
import org.compiere.util.CLogger;
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
import org.compiere.wf.MWorkflowProcessor;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adempiere Server Manager
|
* Adempiere Server Manager
|
||||||
|
@ -105,100 +100,36 @@ public class AdempiereServerMgr
|
||||||
* Start Environment
|
* Start Environment
|
||||||
* @return true if started
|
* @return true if started
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("rawtypes")
|
||||||
public boolean startServers()
|
public boolean startServers()
|
||||||
{
|
{
|
||||||
log.info("");
|
log.info("");
|
||||||
int noServers = 0;
|
int noServers = 0;
|
||||||
m_servers=new ArrayList<ServerWrapper>();
|
m_servers=new ArrayList<ServerWrapper>();
|
||||||
// Accounting
|
|
||||||
MAcctProcessor[] acctModels = MAcctProcessor.getActive(m_ctx);
|
|
||||||
for (int i = 0; i < acctModels.length; i++)
|
|
||||||
{
|
|
||||||
MAcctProcessor pModel = acctModels[i];
|
|
||||||
AdempiereServer server = AdempiereServer.create(pModel);
|
|
||||||
if (server != null) {
|
|
||||||
// server.start();
|
|
||||||
// server.setPriority(Thread.NORM_PRIORITY-2);
|
|
||||||
m_servers.add(new ServerWrapper(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);
|
|
||||||
if (server != null) {
|
|
||||||
// server.start();
|
|
||||||
// server.setPriority(Thread.NORM_PRIORITY-2);
|
|
||||||
m_servers.add(new ServerWrapper(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);
|
|
||||||
if (server != null) {
|
|
||||||
// server.start();
|
|
||||||
// server.setPriority(Thread.NORM_PRIORITY-2);
|
|
||||||
m_servers.add(new ServerWrapper(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);
|
|
||||||
if (server != null) {
|
|
||||||
// server.start();
|
|
||||||
// server.setPriority(Thread.NORM_PRIORITY-2);
|
|
||||||
m_servers.add(new ServerWrapper(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);
|
|
||||||
if (server != null) {
|
|
||||||
// server.start();
|
|
||||||
// server.setPriority(Thread.NORM_PRIORITY-2);
|
|
||||||
m_servers.add(new ServerWrapper(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);
|
|
||||||
if (server != null) {
|
|
||||||
// server.start();
|
|
||||||
// server.setPriority(Thread.NORM_PRIORITY-1);
|
|
||||||
m_servers.add(new ServerWrapper(server));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//osgi server
|
//osgi server
|
||||||
List<IServerFactory> serverFactoryList = Service.locator().list(IServerFactory.class).getServices();
|
List<IServerFactory> serverFactoryList = Service.locator().list(IServerFactory.class).getServices();
|
||||||
if (serverFactoryList != null && !serverFactoryList.isEmpty())
|
if (serverFactoryList != null && !serverFactoryList.isEmpty())
|
||||||
{
|
{
|
||||||
|
List<String> processed = new ArrayList<String>();
|
||||||
for(IServerFactory factory : serverFactoryList )
|
for(IServerFactory factory : serverFactoryList )
|
||||||
{
|
{
|
||||||
AdempiereServer[] servers = factory.create(m_ctx);
|
String name = factory.getProcessorClass().getName();
|
||||||
if (servers != null && servers.length > 0)
|
if (!processed.contains(name))
|
||||||
{
|
{
|
||||||
for (AdempiereServer server : servers)
|
processed.add(name);
|
||||||
|
AdempiereServer[] servers = factory.create(m_ctx);
|
||||||
|
if (servers != null && servers.length > 0)
|
||||||
{
|
{
|
||||||
// server.start();
|
for (AdempiereServer server : servers)
|
||||||
// server.setPriority(Thread.NORM_PRIORITY-1);
|
{
|
||||||
m_servers.add(new ServerWrapper(server));
|
AdempiereProcessor model = server.getModel();
|
||||||
}
|
if (AdempiereServer.isOKtoRunOnIP(model)) {
|
||||||
}
|
m_servers.add(new ServerWrapper(server));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -72,13 +72,13 @@ public class AlertProcessor extends AdempiereServer
|
||||||
} // AlertProcessor
|
} // AlertProcessor
|
||||||
|
|
||||||
/** The Concrete Model */
|
/** The Concrete Model */
|
||||||
private MAlertProcessor m_model = null;
|
protected MAlertProcessor m_model = null;
|
||||||
/** Last Summary */
|
/** Last Summary */
|
||||||
private StringBuffer m_summary = new StringBuffer();
|
protected StringBuffer m_summary = new StringBuffer();
|
||||||
/** Last Error Msg */
|
/** Last Error Msg */
|
||||||
private StringBuffer m_errors = new StringBuffer();
|
protected StringBuffer m_errors = new StringBuffer();
|
||||||
/** Client info */
|
/** Client info */
|
||||||
private MClient m_client = null;
|
protected MClient m_client = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Work
|
* Work
|
||||||
|
@ -119,7 +119,7 @@ public class AlertProcessor extends AdempiereServer
|
||||||
* @param alert alert
|
* @param alert alert
|
||||||
* @return true if processed
|
* @return true if processed
|
||||||
*/
|
*/
|
||||||
private boolean processAlert (MAlert alert)
|
protected boolean processAlert (MAlert alert)
|
||||||
{
|
{
|
||||||
if (!alert.isValid())
|
if (!alert.isValid())
|
||||||
return false;
|
return false;
|
||||||
|
@ -240,7 +240,7 @@ public class AlertProcessor extends AdempiereServer
|
||||||
* @param attachments
|
* @param attachments
|
||||||
* @return how many email were sent
|
* @return how many email were sent
|
||||||
*/
|
*/
|
||||||
private int notifyUsers(Collection<Integer> users, String subject, String message, Collection<File> attachments)
|
protected int notifyUsers(Collection<Integer> users, String subject, String message, Collection<File> attachments)
|
||||||
{
|
{
|
||||||
int countMail = 0;
|
int countMail = 0;
|
||||||
for (int user_id : users) {
|
for (int user_id : users) {
|
||||||
|
@ -289,7 +289,7 @@ public class AlertProcessor extends AdempiereServer
|
||||||
* @return data
|
* @return data
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
private ArrayList<ArrayList<Object>> getData (String sql, String trxName) throws Exception
|
protected ArrayList<ArrayList<Object>> getData (String sql, String trxName) throws Exception
|
||||||
{
|
{
|
||||||
ArrayList<ArrayList<Object>> data = new ArrayList<ArrayList<Object>>();
|
ArrayList<ArrayList<Object>> data = new ArrayList<ArrayList<Object>>();
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
@ -351,7 +351,7 @@ public class AlertProcessor extends AdempiereServer
|
||||||
* @return list of rows & values
|
* @return list of rows & values
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
private String getPlainTextReport(MAlertRule rule, String sql, String trxName, Collection<File> attachments)
|
protected String getPlainTextReport(MAlertRule rule, String sql, String trxName, Collection<File> attachments)
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
StringBuilder result = new StringBuilder();
|
StringBuilder result = new StringBuilder();
|
||||||
|
@ -407,7 +407,7 @@ public class AlertProcessor extends AdempiereServer
|
||||||
* @return summary message to be added into mail content
|
* @return summary message to be added into mail content
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
private String getExcelReport(MAlertRule rule, String sql, String trxName, Collection<File> attachments)
|
protected String getExcelReport(MAlertRule rule, String sql, String trxName, Collection<File> attachments)
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
ArrayList<ArrayList<Object>> data = getData(sql, trxName);
|
ArrayList<ArrayList<Object>> data = getData(sql, trxName);
|
||||||
|
|
|
@ -69,30 +69,30 @@ public class EMailProcessor
|
||||||
} // EMail
|
} // EMail
|
||||||
|
|
||||||
/** EMail Host Parameter */
|
/** EMail Host Parameter */
|
||||||
private String m_host = null;
|
protected String m_host = null;
|
||||||
/** EMail User Parameter */
|
/** EMail User Parameter */
|
||||||
private String m_user = null;
|
protected String m_user = null;
|
||||||
/** Password Parameter */
|
/** Password Parameter */
|
||||||
private String m_pass = null;
|
protected String m_pass = null;
|
||||||
|
|
||||||
/** Session */
|
/** Session */
|
||||||
private Session m_session = null;
|
protected Session m_session = null;
|
||||||
/** Store */
|
/** Store */
|
||||||
private Store m_store = null;
|
protected Store m_store = null;
|
||||||
|
|
||||||
|
|
||||||
/** Logger */
|
/** Logger */
|
||||||
protected CLogger log = CLogger.getCLogger(getClass());
|
protected CLogger log = CLogger.getCLogger(getClass());
|
||||||
|
|
||||||
/** Process Error */
|
/** Process Error */
|
||||||
private static final int ERROR = 0;
|
protected static final int ERROR = 0;
|
||||||
/** Process Request */
|
/** Process Request */
|
||||||
private static final int REQUEST = 1;
|
protected static final int REQUEST = 1;
|
||||||
/** Process Workflow */
|
/** Process Workflow */
|
||||||
private static final int WORKFLOW = 2;
|
protected static final int WORKFLOW = 2;
|
||||||
|
|
||||||
/** Process Delivery Confirm */
|
/** Process Delivery Confirm */
|
||||||
private static final int DELIVERY = 9;
|
protected static final int DELIVERY = 9;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Process Messages in InBox
|
* Process Messages in InBox
|
||||||
|
@ -130,7 +130,7 @@ public class EMailProcessor
|
||||||
* @return Session
|
* @return Session
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
private Session getSession() throws Exception
|
protected Session getSession() throws Exception
|
||||||
{
|
{
|
||||||
if (m_session != null)
|
if (m_session != null)
|
||||||
return m_session;
|
return m_session;
|
||||||
|
@ -155,7 +155,7 @@ public class EMailProcessor
|
||||||
* @return Store
|
* @return Store
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
private Store getStore() throws Exception
|
protected Store getStore() throws Exception
|
||||||
{
|
{
|
||||||
if (m_store != null)
|
if (m_store != null)
|
||||||
return m_store;
|
return m_store;
|
||||||
|
@ -177,7 +177,7 @@ public class EMailProcessor
|
||||||
* @return number of processed
|
* @return number of processed
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
private int processInBox() throws Exception
|
protected int processInBox() throws Exception
|
||||||
{
|
{
|
||||||
// Folder
|
// Folder
|
||||||
Folder folder;
|
Folder folder;
|
||||||
|
@ -276,7 +276,7 @@ public class EMailProcessor
|
||||||
* @return Type of Message
|
* @return Type of Message
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
private int processMessage (Message msg) throws Exception
|
protected int processMessage (Message msg) throws Exception
|
||||||
{
|
{
|
||||||
dumpEnvelope (msg);
|
dumpEnvelope (msg);
|
||||||
dumpBody (msg);
|
dumpBody (msg);
|
||||||
|
@ -301,7 +301,7 @@ public class EMailProcessor
|
||||||
* @param msg message
|
* @param msg message
|
||||||
* @return subject or ""
|
* @return subject or ""
|
||||||
*/
|
*/
|
||||||
private String getSubject (Message msg)
|
protected String getSubject (Message msg)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -321,7 +321,7 @@ public class EMailProcessor
|
||||||
* @param msg Message
|
* @param msg Message
|
||||||
* @return message or ""
|
* @return message or ""
|
||||||
*/
|
*/
|
||||||
private String getMessage (Part msg)
|
protected String getMessage (Part msg)
|
||||||
{
|
{
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
try
|
try
|
||||||
|
@ -406,7 +406,7 @@ public class EMailProcessor
|
||||||
* @param msg message
|
* @param msg message
|
||||||
* @return delivery info or null
|
* @return delivery info or null
|
||||||
*/
|
*/
|
||||||
private String getDeliveryReport (Part msg)
|
protected String getDeliveryReport (Part msg)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -451,7 +451,7 @@ public class EMailProcessor
|
||||||
* @return info or null
|
* @return info or null
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
private String getDeliveredReportDetail (Part part) throws Exception
|
protected String getDeliveredReportDetail (Part part) throws Exception
|
||||||
{
|
{
|
||||||
Object content = part.getContent();
|
Object content = part.getContent();
|
||||||
if (content == null)
|
if (content == null)
|
||||||
|
@ -504,7 +504,7 @@ public class EMailProcessor
|
||||||
* @param m message
|
* @param m message
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
private void dumpEnvelope(Message m) throws Exception
|
protected void dumpEnvelope(Message m) throws Exception
|
||||||
{
|
{
|
||||||
printOut("-----------------------------------------------------------------");
|
printOut("-----------------------------------------------------------------");
|
||||||
Address[] a;
|
Address[] a;
|
||||||
|
@ -613,7 +613,7 @@ public class EMailProcessor
|
||||||
* @param p
|
* @param p
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
private void dumpBody (Part p) throws Exception
|
protected void dumpBody (Part p) throws Exception
|
||||||
{
|
{
|
||||||
// http://www.iana.org/assignments/media-types/
|
// http://www.iana.org/assignments/media-types/
|
||||||
printOut("=================================================================");
|
printOut("=================================================================");
|
||||||
|
@ -688,7 +688,7 @@ public class EMailProcessor
|
||||||
* Print
|
* Print
|
||||||
* @param s string
|
* @param s string
|
||||||
*/
|
*/
|
||||||
private static void printOut(String s)
|
protected static void printOut(String s)
|
||||||
{
|
{
|
||||||
// System.out.print(indentStr.substring(0, level * 2));
|
// System.out.print(indentStr.substring(0, level * 2));
|
||||||
System.out.println(s);
|
System.out.println(s);
|
||||||
|
|
|
@ -57,11 +57,11 @@ public class RequestProcessor extends AdempiereServer
|
||||||
} // RequestProcessor
|
} // RequestProcessor
|
||||||
|
|
||||||
/** The Concrete Model */
|
/** The Concrete Model */
|
||||||
private MRequestProcessor m_model = null;
|
protected MRequestProcessor m_model = null;
|
||||||
/** Last Summary */
|
/** Last Summary */
|
||||||
private StringBuffer m_summary = new StringBuffer();
|
protected StringBuffer m_summary = new StringBuffer();
|
||||||
/** Client onfo */
|
/** Client onfo */
|
||||||
private MClient m_client = null;
|
protected MClient m_client = null;
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
* Do the actual Work
|
* Do the actual Work
|
||||||
|
@ -90,7 +90,7 @@ public class RequestProcessor extends AdempiereServer
|
||||||
* Process requests.
|
* Process requests.
|
||||||
* Scheduled - are they due?
|
* Scheduled - are they due?
|
||||||
*/
|
*/
|
||||||
private void processRequests ()
|
protected void processRequests ()
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Due Requests
|
* Due Requests
|
||||||
|
@ -368,7 +368,7 @@ public class RequestProcessor extends AdempiereServer
|
||||||
* @param AD_Message message
|
* @param AD_Message message
|
||||||
* @return true if sent
|
* @return true if sent
|
||||||
*/
|
*/
|
||||||
private boolean sendEmail (MRequest request, String AD_Message)
|
protected boolean sendEmail (MRequest request, String AD_Message)
|
||||||
{
|
{
|
||||||
// Alert: Request {0} overdue
|
// Alert: Request {0} overdue
|
||||||
String subject = Msg.getMsg(m_client.getAD_Language(), AD_Message,
|
String subject = Msg.getMsg(m_client.getAD_Language(), AD_Message,
|
||||||
|
@ -382,7 +382,7 @@ public class RequestProcessor extends AdempiereServer
|
||||||
* @param request request
|
* @param request request
|
||||||
* @return true if saved
|
* @return true if saved
|
||||||
*/
|
*/
|
||||||
private boolean escalate (MRequest request)
|
protected boolean escalate (MRequest request)
|
||||||
{
|
{
|
||||||
// Get Supervisor
|
// Get Supervisor
|
||||||
MUser supervisor = request.getSalesRep(); // self
|
MUser supervisor = request.getSalesRep(); // self
|
||||||
|
@ -424,7 +424,7 @@ public class RequestProcessor extends AdempiereServer
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
* Process Request Status
|
* Process Request Status
|
||||||
*/
|
*/
|
||||||
private void processStatus()
|
protected void processStatus()
|
||||||
{
|
{
|
||||||
int count = 0;
|
int count = 0;
|
||||||
// Requests with status with after timeout
|
// Requests with status with after timeout
|
||||||
|
@ -482,7 +482,7 @@ public class RequestProcessor extends AdempiereServer
|
||||||
/**
|
/**
|
||||||
* Create ECR
|
* Create ECR
|
||||||
*/
|
*/
|
||||||
private void processECR()
|
protected void processECR()
|
||||||
{
|
{
|
||||||
// Get Requests with Request Type-AutoChangeRequest and Group with info
|
// Get Requests with Request Type-AutoChangeRequest and Group with info
|
||||||
String sql = "SELECT * FROM R_Request r "
|
String sql = "SELECT * FROM R_Request r "
|
||||||
|
@ -543,7 +543,7 @@ public class RequestProcessor extends AdempiereServer
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
* Create Reauest / Updates from EMail
|
* Create Reauest / Updates from EMail
|
||||||
*/
|
*/
|
||||||
private void processEMail ()
|
protected void processEMail ()
|
||||||
{
|
{
|
||||||
// m_summary.append("Mail #").append(count)
|
// m_summary.append("Mail #").append(count)
|
||||||
// .append(" - ");
|
// .append(" - ");
|
||||||
|
@ -553,7 +553,7 @@ public class RequestProcessor extends AdempiereServer
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
* Allocate Sales Rep
|
* Allocate Sales Rep
|
||||||
*/
|
*/
|
||||||
private void findSalesRep ()
|
protected void findSalesRep ()
|
||||||
{
|
{
|
||||||
int changed = 0;
|
int changed = 0;
|
||||||
int notFound = 0;
|
int notFound = 0;
|
||||||
|
@ -614,7 +614,7 @@ public class RequestProcessor extends AdempiereServer
|
||||||
* @param request request
|
* @param request request
|
||||||
* @return SalesRep_ID user
|
* @return SalesRep_ID user
|
||||||
*/
|
*/
|
||||||
private int findSalesRep (MRequest request)
|
protected int findSalesRep (MRequest request)
|
||||||
{
|
{
|
||||||
String QText = request.getSummary();
|
String QText = request.getSummary();
|
||||||
if (QText == null)
|
if (QText == null)
|
||||||
|
|
|
@ -69,14 +69,14 @@ public class Scheduler extends AdempiereServer
|
||||||
} // Scheduler
|
} // Scheduler
|
||||||
|
|
||||||
/** The Concrete Model */
|
/** The Concrete Model */
|
||||||
private MScheduler m_model = null;
|
protected MScheduler m_model = null;
|
||||||
/** Last Summary */
|
/** Last Summary */
|
||||||
private StringBuffer m_summary = new StringBuffer();
|
protected StringBuffer m_summary = new StringBuffer();
|
||||||
/** Transaction */
|
/** Transaction */
|
||||||
private Trx m_trx = null;
|
protected Trx m_trx = null;
|
||||||
|
|
||||||
// ctx for the report/process
|
// ctx for the report/process
|
||||||
Properties m_schedulerctx = new Properties();
|
protected Properties m_schedulerctx = new Properties();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Work
|
* Work
|
||||||
|
@ -148,7 +148,7 @@ public class Scheduler extends AdempiereServer
|
||||||
* @return summary
|
* @return summary
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
private String runProcess(MProcess process) throws Exception
|
protected String runProcess(MProcess process) throws Exception
|
||||||
{
|
{
|
||||||
if (log.isLoggable(Level.INFO)) log.info(process.toString());
|
if (log.isLoggable(Level.INFO)) log.info(process.toString());
|
||||||
|
|
||||||
|
@ -278,7 +278,7 @@ public class Scheduler extends AdempiereServer
|
||||||
return pi.getSummary();
|
return pi.getSummary();
|
||||||
} // runProcess
|
} // runProcess
|
||||||
|
|
||||||
private int getAD_User_ID() {
|
protected int getAD_User_ID() {
|
||||||
int AD_User_ID;
|
int AD_User_ID;
|
||||||
if (m_model.getSupervisor_ID() > 0)
|
if (m_model.getSupervisor_ID() > 0)
|
||||||
AD_User_ID = m_model.getSupervisor_ID();
|
AD_User_ID = m_model.getSupervisor_ID();
|
||||||
|
@ -295,7 +295,7 @@ public class Scheduler extends AdempiereServer
|
||||||
* Fill Parameter
|
* Fill Parameter
|
||||||
* @param pInstance process instance
|
* @param pInstance process instance
|
||||||
*/
|
*/
|
||||||
private void fillParameter(MPInstance pInstance)
|
protected void fillParameter(MPInstance pInstance)
|
||||||
{
|
{
|
||||||
MSchedulerPara[] sParams = m_model.getParameters (false);
|
MSchedulerPara[] sParams = m_model.getParameters (false);
|
||||||
MPInstancePara[] iParams = pInstance.getParameters();
|
MPInstancePara[] iParams = pInstance.getParameters();
|
||||||
|
|
|
@ -61,11 +61,11 @@ public class WorkflowProcessor extends AdempiereServer
|
||||||
} // WorkflowProcessor
|
} // WorkflowProcessor
|
||||||
|
|
||||||
/** The Concrete Model */
|
/** The Concrete Model */
|
||||||
private MWorkflowProcessor m_model = null;
|
protected MWorkflowProcessor m_model = null;
|
||||||
/** Last Summary */
|
/** Last Summary */
|
||||||
private StringBuffer m_summary = new StringBuffer();
|
protected StringBuffer m_summary = new StringBuffer();
|
||||||
/** Client onfo */
|
/** Client onfo */
|
||||||
private MClient m_client = null;
|
protected MClient m_client = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Work
|
* Work
|
||||||
|
@ -90,7 +90,7 @@ public class WorkflowProcessor extends AdempiereServer
|
||||||
/**
|
/**
|
||||||
* Continue Workflow After Sleep
|
* Continue Workflow After Sleep
|
||||||
*/
|
*/
|
||||||
private void wakeup()
|
protected void wakeup()
|
||||||
{
|
{
|
||||||
String sql = "SELECT * "
|
String sql = "SELECT * "
|
||||||
+ "FROM AD_WF_Activity a "
|
+ "FROM AD_WF_Activity a "
|
||||||
|
@ -135,7 +135,7 @@ public class WorkflowProcessor extends AdempiereServer
|
||||||
/**
|
/**
|
||||||
* Set/Increase Priority dynamically
|
* Set/Increase Priority dynamically
|
||||||
*/
|
*/
|
||||||
private void dynamicPriority()
|
protected void dynamicPriority()
|
||||||
{
|
{
|
||||||
// suspened activities with dynamic priority node
|
// suspened activities with dynamic priority node
|
||||||
String sql = "SELECT * "
|
String sql = "SELECT * "
|
||||||
|
@ -184,7 +184,7 @@ public class WorkflowProcessor extends AdempiereServer
|
||||||
/**
|
/**
|
||||||
* Send Alerts
|
* Send Alerts
|
||||||
*/
|
*/
|
||||||
private void sendAlerts()
|
protected void sendAlerts()
|
||||||
{
|
{
|
||||||
// Alert over Priority
|
// Alert over Priority
|
||||||
if (m_model.getAlertOverPriority() > 0)
|
if (m_model.getAlertOverPriority() > 0)
|
||||||
|
@ -350,7 +350,7 @@ public class WorkflowProcessor extends AdempiereServer
|
||||||
* @param toSupervisor true if to Supervisor
|
* @param toSupervisor true if to Supervisor
|
||||||
* @return number of mails sent
|
* @return number of mails sent
|
||||||
*/
|
*/
|
||||||
private int sendEmail (MWFActivity activity, String AD_Message,
|
protected int sendEmail (MWFActivity activity, String AD_Message,
|
||||||
boolean toProcess, boolean toSupervisor)
|
boolean toProcess, boolean toSupervisor)
|
||||||
{
|
{
|
||||||
if (m_client == null || m_client.getAD_Client_ID() != activity.getAD_Client_ID())
|
if (m_client == null || m_client.getAD_Client_ID() != activity.getAD_Client_ID())
|
||||||
|
@ -429,7 +429,7 @@ public class WorkflowProcessor extends AdempiereServer
|
||||||
* @param pdf optional pdf
|
* @param pdf optional pdf
|
||||||
* @return number of mail sent
|
* @return number of mail sent
|
||||||
*/
|
*/
|
||||||
private int sendAlertToResponsible (MWFResponsible responsible,
|
protected int sendAlertToResponsible (MWFResponsible responsible,
|
||||||
ArrayList<Integer> list, MWFProcess process,
|
ArrayList<Integer> list, MWFProcess process,
|
||||||
String subject, String message, File pdf)
|
String subject, String message, File pdf)
|
||||||
{
|
{
|
||||||
|
|
|
@ -0,0 +1,56 @@
|
||||||
|
/******************************************************************************
|
||||||
|
* Copyright (C) 2013 Heng Sin Low *
|
||||||
|
* Copyright (C) 2013 Trek Global *
|
||||||
|
* This program is free software; you can redistribute it and/or modify it *
|
||||||
|
* under the terms version 2 of the GNU General Public License as published *
|
||||||
|
* by the Free Software Foundation. This program is distributed in the hope *
|
||||||
|
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
|
||||||
|
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||||
|
* See the GNU General Public License for more details. *
|
||||||
|
* You should have received a copy of the GNU General Public License along *
|
||||||
|
* with this program; if not, write to the Free Software Foundation, Inc., *
|
||||||
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
||||||
|
*****************************************************************************/
|
||||||
|
package org.idempiere.server.factory;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import org.adempiere.server.IServerFactory;
|
||||||
|
import org.compiere.model.MAcctProcessor;
|
||||||
|
import org.compiere.server.AcctProcessor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author hengsin
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class DefaultAcctProcessorFactory implements IServerFactory<AcctProcessor, MAcctProcessor> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* default constructor
|
||||||
|
*/
|
||||||
|
public DefaultAcctProcessorFactory() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.adempiere.server.IServerFactory#create(java.util.Properties)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public AcctProcessor[] create(Properties ctx) {
|
||||||
|
MAcctProcessor[] acctModels = MAcctProcessor.getActive(ctx);
|
||||||
|
List<AcctProcessor> list = new ArrayList<AcctProcessor>();
|
||||||
|
for (MAcctProcessor pModel : acctModels)
|
||||||
|
{
|
||||||
|
AcctProcessor processor = new AcctProcessor(pModel);
|
||||||
|
list.add(processor);
|
||||||
|
}
|
||||||
|
return list.toArray(new AcctProcessor[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Class<MAcctProcessor> getProcessorClass() {
|
||||||
|
return MAcctProcessor.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,53 @@
|
||||||
|
/******************************************************************************
|
||||||
|
* Copyright (C) 2013 Heng Sin Low *
|
||||||
|
* Copyright (C) 2013 Trek Global *
|
||||||
|
* This program is free software; you can redistribute it and/or modify it *
|
||||||
|
* under the terms version 2 of the GNU General Public License as published *
|
||||||
|
* by the Free Software Foundation. This program is distributed in the hope *
|
||||||
|
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
|
||||||
|
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||||
|
* See the GNU General Public License for more details. *
|
||||||
|
* You should have received a copy of the GNU General Public License along *
|
||||||
|
* with this program; if not, write to the Free Software Foundation, Inc., *
|
||||||
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
||||||
|
*****************************************************************************/
|
||||||
|
package org.idempiere.server.factory;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import org.adempiere.server.IServerFactory;
|
||||||
|
import org.compiere.model.MAlertProcessor;
|
||||||
|
import org.compiere.server.AlertProcessor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author hengsin
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class DefaultAlertProcessorFactory implements IServerFactory<AlertProcessor, MAlertProcessor> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public DefaultAlertProcessorFactory() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AlertProcessor[] create(Properties ctx) {
|
||||||
|
MAlertProcessor[] alertModels = MAlertProcessor.getActive(ctx);
|
||||||
|
List<AlertProcessor> list = new ArrayList<AlertProcessor>();
|
||||||
|
for (MAlertProcessor pModel : alertModels)
|
||||||
|
{
|
||||||
|
AlertProcessor server = new AlertProcessor(pModel);
|
||||||
|
list.add(server);
|
||||||
|
}
|
||||||
|
return list.toArray(new AlertProcessor[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Class<MAlertProcessor> getProcessorClass() {
|
||||||
|
return MAlertProcessor.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,52 @@
|
||||||
|
/******************************************************************************
|
||||||
|
* Copyright (C) 2013 Heng Sin Low *
|
||||||
|
* Copyright (C) 2013 Trek Global *
|
||||||
|
* This program is free software; you can redistribute it and/or modify it *
|
||||||
|
* under the terms version 2 of the GNU General Public License as published *
|
||||||
|
* by the Free Software Foundation. This program is distributed in the hope *
|
||||||
|
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
|
||||||
|
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||||
|
* See the GNU General Public License for more details. *
|
||||||
|
* You should have received a copy of the GNU General Public License along *
|
||||||
|
* with this program; if not, write to the Free Software Foundation, Inc., *
|
||||||
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
||||||
|
*****************************************************************************/
|
||||||
|
package org.idempiere.server.factory;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import org.adempiere.server.IServerFactory;
|
||||||
|
import org.compiere.ldap.LdapProcessor;
|
||||||
|
import org.compiere.model.MLdapProcessor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author hengsin
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class DefaultLDAPProcessorFactory implements IServerFactory<LdapProcessor, MLdapProcessor> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* default constructor
|
||||||
|
*/
|
||||||
|
public DefaultLDAPProcessorFactory() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public LdapProcessor[] create(Properties ctx) {
|
||||||
|
MLdapProcessor[] ldapModels = MLdapProcessor.getActive(ctx);
|
||||||
|
List<LdapProcessor> list = new ArrayList<LdapProcessor>();
|
||||||
|
for (MLdapProcessor lp : ldapModels)
|
||||||
|
{
|
||||||
|
LdapProcessor server = new LdapProcessor(lp);
|
||||||
|
list.add(server);
|
||||||
|
}
|
||||||
|
return list.toArray(new LdapProcessor[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Class<MLdapProcessor> getProcessorClass() {
|
||||||
|
return MLdapProcessor.class;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,55 @@
|
||||||
|
/******************************************************************************
|
||||||
|
* Copyright (C) 2013 Heng Sin Low *
|
||||||
|
* Copyright (C) 2013 Trek Global *
|
||||||
|
* This program is free software; you can redistribute it and/or modify it *
|
||||||
|
* under the terms version 2 of the GNU General Public License as published *
|
||||||
|
* by the Free Software Foundation. This program is distributed in the hope *
|
||||||
|
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
|
||||||
|
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||||
|
* See the GNU General Public License for more details. *
|
||||||
|
* You should have received a copy of the GNU General Public License along *
|
||||||
|
* with this program; if not, write to the Free Software Foundation, Inc., *
|
||||||
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
||||||
|
*****************************************************************************/
|
||||||
|
package org.idempiere.server.factory;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import org.adempiere.server.IServerFactory;
|
||||||
|
import org.compiere.model.MRequestProcessor;
|
||||||
|
import org.compiere.server.RequestProcessor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author hengsin
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class DefaultRequestProcessorFactory implements IServerFactory<RequestProcessor, MRequestProcessor> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public DefaultRequestProcessorFactory() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.adempiere.server.IServerFactory#create(java.util.Properties)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public RequestProcessor[] create(Properties ctx) {
|
||||||
|
MRequestProcessor[] requestModels = MRequestProcessor.getActive(ctx);
|
||||||
|
List<RequestProcessor> list = new ArrayList<RequestProcessor>();
|
||||||
|
for (MRequestProcessor pModel : requestModels)
|
||||||
|
{
|
||||||
|
RequestProcessor processor = new RequestProcessor(pModel);
|
||||||
|
list.add(processor);
|
||||||
|
}
|
||||||
|
return list.toArray(new RequestProcessor[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Class<MRequestProcessor> getProcessorClass() {
|
||||||
|
return MRequestProcessor.class;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,53 @@
|
||||||
|
/******************************************************************************
|
||||||
|
* Copyright (C) 2013 Heng Sin Low *
|
||||||
|
* Copyright (C) 2013 Trek Global *
|
||||||
|
* This program is free software; you can redistribute it and/or modify it *
|
||||||
|
* under the terms version 2 of the GNU General Public License as published *
|
||||||
|
* by the Free Software Foundation. This program is distributed in the hope *
|
||||||
|
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
|
||||||
|
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||||
|
* See the GNU General Public License for more details. *
|
||||||
|
* You should have received a copy of the GNU General Public License along *
|
||||||
|
* with this program; if not, write to the Free Software Foundation, Inc., *
|
||||||
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
||||||
|
*****************************************************************************/
|
||||||
|
package org.idempiere.server.factory;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import org.adempiere.server.IServerFactory;
|
||||||
|
import org.compiere.model.MScheduler;
|
||||||
|
import org.compiere.server.Scheduler;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author hengsin
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class DefaultSchedulerFactory implements IServerFactory<Scheduler, MScheduler> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* default constructor
|
||||||
|
*/
|
||||||
|
public DefaultSchedulerFactory() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Scheduler[] create(Properties ctx) {
|
||||||
|
MScheduler[] schedulerModels = MScheduler.getActive(ctx);
|
||||||
|
List<Scheduler> list = new ArrayList<Scheduler>();
|
||||||
|
for (MScheduler pModel : schedulerModels)
|
||||||
|
{
|
||||||
|
Scheduler server = new Scheduler(pModel);
|
||||||
|
list.add(server);
|
||||||
|
}
|
||||||
|
return list.toArray(new Scheduler[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Class<MScheduler> getProcessorClass() {
|
||||||
|
return MScheduler.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,58 @@
|
||||||
|
/******************************************************************************
|
||||||
|
* Copyright (C) 2013 Heng Sin Low *
|
||||||
|
* Copyright (C) 2013 Trek Global *
|
||||||
|
* This program is free software; you can redistribute it and/or modify it *
|
||||||
|
* under the terms version 2 of the GNU General Public License as published *
|
||||||
|
* by the Free Software Foundation. This program is distributed in the hope *
|
||||||
|
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
|
||||||
|
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||||
|
* See the GNU General Public License for more details. *
|
||||||
|
* You should have received a copy of the GNU General Public License along *
|
||||||
|
* with this program; if not, write to the Free Software Foundation, Inc., *
|
||||||
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
||||||
|
*****************************************************************************/
|
||||||
|
package org.idempiere.server.factory;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import org.adempiere.server.IServerFactory;
|
||||||
|
import org.compiere.server.WorkflowProcessor;
|
||||||
|
import org.compiere.wf.MWorkflowProcessor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author hengsin
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class DefaultWorkflowProcessorFactory implements IServerFactory<WorkflowProcessor, MWorkflowProcessor> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public DefaultWorkflowProcessorFactory() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.adempiere.server.IServerFactory#create(java.util.Properties)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public WorkflowProcessor[] create(Properties ctx) {
|
||||||
|
MWorkflowProcessor[] workflowModels = MWorkflowProcessor.getActive(ctx);
|
||||||
|
List<WorkflowProcessor> list = new ArrayList<WorkflowProcessor>();
|
||||||
|
for (MWorkflowProcessor pModel : workflowModels)
|
||||||
|
{
|
||||||
|
WorkflowProcessor server = new WorkflowProcessor(pModel);
|
||||||
|
list.add(server);
|
||||||
|
}
|
||||||
|
return list.toArray(new WorkflowProcessor[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.adempiere.server.IServerFactory#getServerModelClass()
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Class<MWorkflowProcessor> getProcessorClass() {
|
||||||
|
return MWorkflowProcessor.class;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue