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); }
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; }
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; }
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); } }
@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); } }
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); } }