Search in sources :

Example 11 with QFactory

use of org.jpos.q2.QFactory in project jPOS by jpos.

the class DirPollAdaptor method initService.

protected void initService() throws Exception {
    QFactory factory = getServer().getFactory();
    dirPoll = createDirPoll();
    dirPoll.setPath(getPath());
    dirPoll.setThreadPool(new ThreadPool(1, poolSize));
    dirPoll.setPollInterval(pollInterval);
    if (priorities != null)
        dirPoll.setPriorities(priorities);
    dirPoll.setLogger(getLog().getLogger(), getLog().getRealm());
    Configuration cfg = factory.getConfiguration(getPersist());
    dirPoll.setConfiguration(cfg);
    dirPoll.createDirs();
    Object dpp = factory.newInstance(getProcessor());
    if (dpp instanceof LogSource) {
        ((LogSource) dpp).setLogger(getLog().getLogger(), getLog().getRealm());
    }
    if (dpp instanceof Configurable) {
        ((Configurable) dpp).setConfiguration(cfg);
    }
    dirPoll.setProcessor(dpp);
}
Also used : Configuration(org.jpos.core.Configuration) LogSource(org.jpos.util.LogSource) ThreadPool(org.jpos.util.ThreadPool) QFactory(org.jpos.q2.QFactory) Configurable(org.jpos.core.Configurable)

Example 12 with QFactory

use of org.jpos.q2.QFactory in project jPOS by jpos.

the class QServer method addServerSocketFactory.

private void addServerSocketFactory() throws ConfigurationException {
    QFactory factory = getFactory();
    Element persist = getPersist();
    Element serverSocketFactoryElement = persist.getChild("server-socket-factory");
    if (serverSocketFactoryElement != null) {
        ISOServerSocketFactory serverSocketFactory = (ISOServerSocketFactory) factory.newInstance(serverSocketFactoryElement.getAttributeValue("class"));
        factory.setLogger(serverSocketFactory, serverSocketFactoryElement);
        factory.setConfiguration(serverSocketFactory, serverSocketFactoryElement);
        server.setSocketFactory(serverSocketFactory);
    }
}
Also used : ISOServerSocketFactory(org.jpos.iso.ISOServerSocketFactory) Element(org.jdom2.Element) QFactory(org.jpos.q2.QFactory)

Example 13 with QFactory

use of org.jpos.q2.QFactory in project jPOS by jpos.

the class TaskAdaptor method initService.

protected void initService() throws Exception {
    QFactory factory = getServer().getFactory();
    Element e = getPersist();
    task = factory.newInstance(e.getChildTextTrim("class"));
    factory.setLogger(task, e);
}
Also used : Element(org.jdom2.Element) QFactory(org.jpos.q2.QFactory)

Example 14 with QFactory

use of org.jpos.q2.QFactory in project jPOS by jpos.

the class KeyStoreAdaptor method initService.

protected void initService() throws Exception {
    Element e = getPersist();
    QFactory factory = getServer().getFactory();
    ks = (SecureKeyStore) factory.newInstance(getImpl());
    factory.setLogger(ks, e);
    factory.setConfiguration(ks, e);
    NameRegistrar.register(getName(), ks);
}
Also used : Element(org.jdom2.Element) QFactory(org.jpos.q2.QFactory)

Example 15 with QFactory

use of org.jpos.q2.QFactory in project jPOS by jpos.

the class SMAdaptor method initService.

protected void initService() throws Exception {
    Element e = getPersist();
    QFactory factory = getServer().getFactory();
    sm = (SMAdapter) factory.newInstance(getImpl());
    factory.setLogger(sm, e);
    factory.setConfiguration(sm, e);
}
Also used : Element(org.jdom2.Element) QFactory(org.jpos.q2.QFactory)

Aggregations

QFactory (org.jpos.q2.QFactory)14 Element (org.jdom2.Element)11 Configurable (org.jpos.core.Configurable)4 Iterator (java.util.Iterator)2 Hashtable (java.util.Hashtable)1 ObjectName (javax.management.ObjectName)1 Configuration (org.jpos.core.Configuration)1 ConfigurationException (org.jpos.core.ConfigurationException)1 ISORequestListener (org.jpos.iso.ISORequestListener)1 ISOServerEventListener (org.jpos.iso.ISOServerEventListener)1 ISOServerSocketFactory (org.jpos.iso.ISOServerSocketFactory)1 ChannelAdaptor (org.jpos.q2.iso.ChannelAdaptor)1 LogListener (org.jpos.util.LogListener)1 LogSource (org.jpos.util.LogSource)1 ThreadPool (org.jpos.util.ThreadPool)1 Test (org.junit.Test)1