Search in sources :

Example 1 with QFactory

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

the class TransactionManager method createParticipant.

public TransactionParticipant createParticipant(Element e) throws ConfigurationException {
    QFactory factory = getFactory();
    TransactionParticipant participant = (TransactionParticipant) factory.newInstance(e.getAttributeValue("class"));
    factory.setLogger(participant, e);
    QFactory.invoke(participant, "setTransactionManager", this, TransactionManager.class);
    factory.setConfiguration(participant, e);
    String realm = e.getAttributeValue("realm");
    if (realm != null && realm.trim().length() > 0)
        realm = ":" + realm;
    else
        realm = "";
    names.put(participant, Caller.shortClassName(participant.getClass().getName()) + realm);
    return participant;
}
Also used : QFactory(org.jpos.q2.QFactory)

Example 2 with QFactory

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

the class QFactory2Test method testDestroyQBeanThrowsNullPointerException1.

@Test
public void testDestroyQBeanThrowsNullPointerException1() throws Throwable {
    String[] args = new String[0];
    Hashtable<String, String> hashtable = new Hashtable<String, String>(100, 100.0F);
    hashtable.put("testString", "testString");
    try {
        new QFactory(ObjectName.getInstance("testQFactoryParam1", hashtable), null).destroyQBean(new Q2(args), new ObjectName("testQFactoryParam1", "testQFactoryParam2", "testQFactoryParam3"), new ChannelAdaptor());
        fail("Expected NullPointerException to be thrown");
    } catch (NullPointerException ex) {
        assertNull("ex.getMessage()", ex.getMessage());
    }
}
Also used : Hashtable(java.util.Hashtable) ObjectName(javax.management.ObjectName) ChannelAdaptor(org.jpos.q2.iso.ChannelAdaptor) Test(org.junit.Test)

Example 3 with QFactory

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

the class QMUX method addListeners.

private void addListeners() throws ConfigurationException {
    QFactory factory = getFactory();
    Iterator iter = getPersist().getChildren("request-listener").iterator();
    while (iter.hasNext()) {
        Element l = (Element) iter.next();
        ISORequestListener listener = (ISORequestListener) factory.newInstance(l.getAttributeValue("class"));
        factory.setLogger(listener, l);
        factory.setConfiguration(listener, l);
        addISORequestListener(listener);
    }
}
Also used : Element(org.jdom2.Element) QFactory(org.jpos.q2.QFactory)

Example 4 with QFactory

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

the class QServer method addListeners.

private void addListeners() throws ConfigurationException {
    QFactory factory = getFactory();
    Iterator iter = getPersist().getChildren("request-listener").iterator();
    while (iter.hasNext()) {
        Element l = (Element) iter.next();
        ISORequestListener listener = (ISORequestListener) factory.newInstance(l.getAttributeValue("class"));
        factory.setLogger(listener, l);
        factory.setConfiguration(listener, l);
        server.addISORequestListener(listener);
    }
}
Also used : Element(org.jdom2.Element) Iterator(java.util.Iterator) QFactory(org.jpos.q2.QFactory) ISORequestListener(org.jpos.iso.ISORequestListener)

Example 5 with QFactory

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

the class QServer method addISOServerConnectionListeners.

private void addISOServerConnectionListeners() throws ConfigurationException {
    QFactory factory = getFactory();
    Iterator iter = getPersist().getChildren("connection-listener").iterator();
    while (iter.hasNext()) {
        Element l = (Element) iter.next();
        ISOServerEventListener listener = (ISOServerEventListener) factory.newInstance(l.getAttributeValue("class"));
        factory.setLogger(listener, l);
        factory.setConfiguration(listener, l);
        server.addServerEventListener(listener);
    }
}
Also used : ISOServerEventListener(org.jpos.iso.ISOServerEventListener) Element(org.jdom2.Element) Iterator(java.util.Iterator) 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