Search in sources :

Example 6 with QFactory

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

the class LoggerAdaptor method addListener.

private void addListener(Element e) throws ConfigurationException {
    QFactory factory = getServer().getFactory();
    String clazz = e.getAttributeValue("class");
    LogListener listener = (LogListener) factory.newInstance(clazz);
    if (listener instanceof Configurable) {
        try {
            ((Configurable) listener).setConfiguration(factory.getConfiguration(e));
        } catch (ConfigurationException ex) {
            throw new ConfigurationException(ex);
        }
    }
    logger.addListener(listener);
}
Also used : LogListener(org.jpos.util.LogListener) ConfigurationException(org.jpos.core.ConfigurationException) QFactory(org.jpos.q2.QFactory) Configurable(org.jpos.core.Configurable)

Example 7 with QFactory

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

the class CardAgentAdaptor method startService.

protected void startService() throws Exception {
    Object obj = getObject();
    if (obj instanceof Configurable) {
        QFactory factory = getServer().getFactory();
        Element e = getPersist();
        ((Configurable) obj).setConfiguration(factory.getConfiguration(e));
    }
    CardAgentLookup.add((CardAgent) getObject());
}
Also used : Element(org.jdom2.Element) Configurable(org.jpos.core.Configurable) QFactory(org.jpos.q2.QFactory)

Example 8 with QFactory

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

the class TransactionManager method initStatusListeners.

protected void initStatusListeners(Element config) throws ConfigurationException {
    final Iterator iter = config.getChildren("status-listener").iterator();
    while (iter.hasNext()) {
        final Element e = (Element) iter.next();
        final QFactory factory = getFactory();
        final TransactionStatusListener listener = (TransactionStatusListener) factory.newInstance(e.getAttributeValue("class"));
        factory.setConfiguration(listener, config);
        addListener(listener);
    }
}
Also used : Element(org.jdom2.Element) QFactory(org.jpos.q2.QFactory)

Example 9 with QFactory

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

the class DailyTaskAdaptor method startService.

protected void startService() throws Exception {
    if (task instanceof Configurable) {
        Element e = getPersist();
        QFactory factory = getServer().getFactory();
        ((Configurable) task).setConfiguration(factory.getConfiguration(e));
    }
    (thisThread = new Thread(this)).start();
}
Also used : Element(org.jdom2.Element) Configurable(org.jpos.core.Configurable) QFactory(org.jpos.q2.QFactory)

Example 10 with QFactory

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

the class DailyTaskAdaptor method initService.

protected void initService() throws Exception {
    QFactory factory = getServer().getFactory();
    Element e = getPersist();
    task = (Runnable) factory.newInstance(e.getChildTextTrim("class"));
    factory.setLogger(task, 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