Exemplo n.º 1
0
 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);
 }
Exemplo n.º 2
0
  private KeepAliveHandler newKeepAliveHandler() throws ConfigurationException {
    QFactory f = getFactory();
    Element e = getPersist().getChild("keep-alive-handler");
    if (e != null) {
      String handlerName = e.getAttributeValue("class");

      KeepAliveHandler handler = (KeepAliveHandler) f.newInstance(handlerName);
      f.setConfiguration(handler, e);
      return handler;
    }
    return null;
  }
Exemplo n.º 3
0
 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);
   }
 }
Exemplo n.º 4
0
 @SuppressWarnings({"WhileLoopReplaceableByForEach"})
 private void addListeners() throws ConfigurationException {
   requestListeners = new ArrayList<ISORequestListener>();
   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);
     requestListeners.add(listener);
   }
 }
Exemplo n.º 5
0
  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);
    }
  }
Exemplo n.º 6
0
  private void newCodecFactory() throws ConfigurationException {
    QFactory factory = getFactory();
    Element persist = getPersist();

    handler = newProtocolHandler();
    if (handler == null) {
      throw new ConfigurationException("Protocol handler is null");
    }

    keepAliveHandler = newKeepAliveHandler();

    Element codecFactoryElem = persist.getChild("codec-factory");
    if (codecFactoryElem != null) {
      codecFactory =
          (ISOMsgCodecFactory) factory.newInstance(codecFactoryElem.getAttributeValue("class"));
    }
    if (codecFactory == null) {
      throw new ConfigurationException("Codec Factory is null");
    }
    codecFactory.init(handler);
  }
Exemplo n.º 7
0
  private ProtocolHandler newProtocolHandler() throws ConfigurationException {
    QFactory f = getFactory();
    Element e = getPersist().getChild("protocol-handler");
    if (e == null) {
      throw new ConfigurationException("protocol-handler element is required.");
    }

    String handlerName = e.getAttributeValue("class");
    String packagerName = e.getAttributeValue("packager");

    ProtocolHandler handler = (ProtocolHandler) f.newInstance(handlerName);
    f.setLogger(handler, e);
    f.setConfiguration(handler, e);

    ISOPackager packager = (ISOPackager) f.newInstance(packagerName);
    handler.setPackager(packager);
    f.setConfiguration(packager, e);

    QFactory.invoke(handler, "setHeader", e.getAttributeValue("header"));
    return handler;
  }