org.jpos.q2.QFactory.setLogger()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(10.4k)|赞(0)|评价(0)|浏览(65)

本文整理了Java中org.jpos.q2.QFactory.setLogger方法的一些代码示例,展示了QFactory.setLogger的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。QFactory.setLogger方法的具体详情如下:
包路径:org.jpos.q2.QFactory
类名称:QFactory
方法名:setLogger

QFactory.setLogger介绍

暂无

代码示例

代码示例来源:origin: jpos/jPOS-EE

private Collection<ISORequestListener> getListeners(QServer server) throws ConfigurationException {
  QFactory factory = server.getFactory();
  @SuppressWarnings("rawtypes")
  Iterator iter = server.getPersist().getChildren("request-listener").iterator();
  Collection<ISORequestListener> listeners = new ArrayList<ISORequestListener>();
  while (iter.hasNext()) {
    Element l = (Element) iter.next();
    ISORequestListener listener = (ISORequestListener) factory.newInstance(l.getAttributeValue("class"));
    factory.setLogger(listener, l);
    factory.setConfiguration(listener, l);
    listeners.add(listener);
  }
  return listeners;
}

代码示例来源:origin: jpos/jPOS

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);
  if (participant instanceof Destroyable) {
    destroyables.add((Destroyable) participant);
  }
  return participant;
}

代码示例来源:origin: jpos/jPOS

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

代码示例来源:origin: jpos/jPOS

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

代码示例来源:origin: jpos/jPOS

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);
  }
}
public void addISORequestListener(ISORequestListener l) {

代码示例来源:origin: jpos/jPOS

protected void initService () throws Exception {
  QFactory factory = getServer().getFactory();
  Element e = getPersist ();
  task = (Runnable) factory.newInstance (e.getChildTextTrim ("class"));
  factory.setLogger (task, e);
}
protected void startService () throws Exception {

代码示例来源:origin: jpos/jPOS

protected void initService () throws Exception {
  QFactory factory = getServer().getFactory();
  Element e = getPersist ();
  task = factory.newInstance (e.getChildTextTrim ("class"));
  factory.setLogger (task, e);
}
protected void startService () throws Exception {

代码示例来源:origin: jpos/jPOS

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

代码示例来源:origin: jpos/jPOS

protected void addFilters (FilteredChannel channel, Element e, QFactory fact)
  throws ConfigurationException
{
  for (Object o : e.getChildren("filter")) {
    Element f = (Element) o;
    String clazz = f.getAttributeValue("class");
    ISOFilter filter = (ISOFilter) fact.newInstance(clazz);
    fact.setLogger(filter, f);
    fact.setConfiguration(filter, f);
    String direction = f.getAttributeValue("direction");
    if (direction == null)
      channel.addFilter(filter);
    else if ("incoming".equalsIgnoreCase(direction))
      channel.addIncomingFilter(filter);
    else if ("outgoing".equalsIgnoreCase(direction))
      channel.addOutgoingFilter(filter);
    else if ("both".equalsIgnoreCase(direction)) {
      channel.addIncomingFilter(filter);
      channel.addOutgoingFilter(filter);
    }
  }
}

代码示例来源:origin: jpos/jPOS

private void addFilters (FilteredChannel channel, Element e, QFactory fact) 
  throws ConfigurationException
{
  for (Object o : e.getChildren("filter")) {
    Element f = (Element) o;
    String clazz = f.getAttributeValue("class");
    ISOFilter filter = (ISOFilter) fact.newInstance(clazz);
    fact.setLogger(filter, f);
    fact.setConfiguration(filter, f);
    String direction = f.getAttributeValue("direction");
    if (direction == null)
      channel.addFilter(filter);
    else if ("incoming".equalsIgnoreCase(direction))
      channel.addIncomingFilter(filter);
    else if ("outgoing".equalsIgnoreCase(direction))
      channel.addOutgoingFilter(filter);
    else if ("both".equalsIgnoreCase(direction)) {
      channel.addIncomingFilter(filter);
      channel.addOutgoingFilter(filter);
    }
  }
}

代码示例来源:origin: jpos/jPOS-EE

factory.setLogger(adaptor, e);
factory.setConfiguration(adaptor, e);
JobDataMap jobData = new JobDataMap();

代码示例来源:origin: jpos/jPOS

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

代码示例来源:origin: jpos/jPOS

private void addFilters(FilteredChannel channel, Element e, QFactory fact)
    throws ConfigurationException
{
  for (Object o : e.getChildren("filter"))
  {
    Element f = (Element) o;
    String clazz = f.getAttributeValue("class");
    ISOFilter filter = (ISOFilter) fact.newInstance(clazz);
    fact.setLogger(filter, f);
    fact.setConfiguration(filter, f);
    String direction = f.getAttributeValue("direction");
    if (direction == null)
    {
      channel.addFilter(filter);
    }
    else if ("incoming".equalsIgnoreCase(direction))
    {
      channel.addIncomingFilter(filter);
    }
    else if ("outgoing".equalsIgnoreCase(direction))
    {
      channel.addOutgoingFilter(filter);
    }
    else if ("both".equalsIgnoreCase(direction))
    {
      channel.addIncomingFilter(filter);
      channel.addOutgoingFilter(filter);
    }
  }
}

代码示例来源:origin: jpos/jPOS

@Test
public void testSetLogger() throws Throwable {
  String[] args = new String[0];
  Element e = new Element("testQFactoryName");
  new QFactory(new ObjectName(""), new Q2(args)).setLogger(new Object(), e);
  assertEquals("e.getName()", "testQFactoryName", e.getName());
}

代码示例来源:origin: jpos/jPOS

default void addExceptionHandlers(ExceptionHandlerAware receiver, Element elem, QFactory fact)
      throws ConfigurationException
  {
    for (Element o : elem.getChildren("exception-handler")) {
      String clazz = o.getAttributeValue("class");
      ExceptionHandler handler = (ExceptionHandler) fact.newInstance(clazz);
      fact.setLogger(handler, o);
      fact.setConfiguration(handler, o);
      String exception = o.getAttributeValue("exception");
      if (exception == null) {
        receiver.addHandler(handler);
      } else {
        Class<? extends Exception> exceptionClass;
        try {
          exceptionClass = (Class<? extends Exception>) Class.forName(exception);
        } catch (Exception e) {
          throw new ConfigurationException(exception, e);
        }
        receiver.addHandler(handler, exceptionClass);
      }
    }
  }
}

代码示例来源:origin: jpos/jPOS

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

代码示例来源:origin: jpos/jPOS-EE

private void registerTask (Element e) 
  throws ConfigurationException
{
  QFactory qf = getServer().getFactory();
  Object obj  = qf.newInstance (e.getChildTextTrim ("class"));
  if (!(obj instanceof MonitorTask)) {
    throw new ConfigurationException (
      obj.toString() + " is not an instance of MonitorTask"
    );
  }
  qf.setLogger (obj, e);
  qf.setConfiguration (obj, e);
  timer.schedule (
    new MonitorTimerTask (
      e.getAttributeValue("id"),
      (MonitorTask) obj), 
      getLong (e.getAttributeValue ("delay")),
      getLong (e.getAttributeValue ("period"))
  );
}
private long getLong (String l)

代码示例来源:origin: jpos/jPOS

private ISOChannel newChannel (Element e, QFactory f) 
  throws ConfigurationException
{
  String channelName  = e.getAttributeValue ("class");
  if (channelName == null)
    throw new ConfigurationException ("class attribute missing from channel element.");
  
  String packagerName = e.getAttributeValue ("packager");
  ISOChannel channel   = (ISOChannel) f.newInstance (channelName);
  ISOPackager packager;
  if (packagerName != null) {
    packager = (ISOPackager) f.newInstance (packagerName);
    channel.setPackager (packager);
    f.setConfiguration (packager, e);
  }
  QFactory.invoke (channel, "setHeader", e.getAttributeValue ("header"));
  f.setLogger        (channel, e);
  f.setConfiguration (channel, e);
  if (channel instanceof FilteredChannel) {
    addFilters ((FilteredChannel) channel, e, f);
  }
  if (getName () != null)
    channel.setName (getName ()+id);
  return channel;
}

代码示例来源:origin: jpos/jPOS

public ISOChannel newChannel (Element e, QFactory f) 
  throws ConfigurationException
{
  String channelName  = e.getAttributeValue ("class");
  String packagerName = e.getAttributeValue ("packager");
  ISOChannel channel   = (ISOChannel) f.newInstance (channelName);
  ISOPackager packager;
  if (packagerName != null) {
    packager = (ISOPackager) f.newInstance (packagerName);
    channel.setPackager (packager);
    f.setConfiguration (packager, e);
  }
  QFactory.invoke (channel, "setHeader", e.getAttributeValue ("header"));
  f.setLogger        (channel, e);
  f.setConfiguration (channel, e);
  if (channel instanceof FilteredChannel) {
    addFilters ((FilteredChannel) channel, e, f);
  }
  if (channel instanceof ExceptionHandlerAware) {
    addExceptionHandlers((ExceptionHandlerAware) channel, e, f);
  }
  if (getName () != null)
    channel.setName (getName ());
  return channel;
}

代码示例来源:origin: jpos/jPOS

f.setLogger(channel, e);
f.setConfiguration(channel, e);

相关文章