⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 objectfactory.java

📁 一个类似于openJMS分布在ObjectWeb之下的JMS消息中间件。
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
      String host = (String) ref.get("cFactory.host").getContent();      String port = (String) ref.get("cFactory.port").getContent();      TopicConnectionFactory cnxFact =        new TopicTcpConnectionFactory(host, (new Integer(port)).intValue());      String reliableClass = (String) ref.get("reliableClass").getContent();      cnxFact.setReliableClass(reliableClass);      cnxFact.getParameters().fromReference(ref);      return cnxFact;    } else if (ref.getClassName().equals(tcpXACF)) {      String host = (String) ref.get("cFactory.host").getContent();      String port = (String) ref.get("cFactory.port").getContent();      XAConnectionFactory cnxFact =        new XATcpConnectionFactory(host, (new Integer(port)).intValue());      String reliableClass = (String) ref.get("reliableClass").getContent();      cnxFact.setReliableClass(reliableClass);      cnxFact.getParameters().fromReference(ref);      return cnxFact;    } else if (ref.getClassName().equals(tcpXAQCF)) {      String host = (String) ref.get("cFactory.host").getContent();      String port = (String) ref.get("cFactory.port").getContent();      XAQueueConnectionFactory cnxFact =        new XAQueueTcpConnectionFactory(host, (new Integer(port)).intValue());      String reliableClass = (String) ref.get("reliableClass").getContent();      cnxFact.setReliableClass(reliableClass);      cnxFact.getParameters().fromReference(ref);      return cnxFact;    } else if (ref.getClassName().equals(tcpXATCF)) {      String host = (String) ref.get("cFactory.host").getContent();      String port = (String) ref.get("cFactory.port").getContent();      XATopicConnectionFactory cnxFact =        new XATopicTcpConnectionFactory(host, (new Integer(port)).intValue());      String reliableClass = (String) ref.get("reliableClass").getContent();      cnxFact.setReliableClass(reliableClass);      cnxFact.getParameters().fromReference(ref);      return cnxFact;    } else if (ref.getClassName().equals(haTcpCF)) {      String url = (String) ref.get("cFactory.url").getContent();      ConnectionFactory cnxFact =        new HATcpConnectionFactory(url);      String reliableClass = (String) ref.get("reliableClass").getContent();      cnxFact.setReliableClass(reliableClass);      cnxFact.getParameters().fromReference(ref);      return cnxFact;    } else if (ref.getClassName().equals(haTcpQCF)) {      String url = (String) ref.get("cFactory.url").getContent();        QueueConnectionFactory cnxFact =                                                                           new QueueHATcpConnectionFactory(url);      String reliableClass = (String) ref.get("reliableClass").getContent();      cnxFact.setReliableClass(reliableClass);      cnxFact.getParameters().fromReference(ref);      return cnxFact;    } else if (ref.getClassName().equals(haTcpTCF)) {      String url = (String) ref.get("cFactory.url").getContent();        TopicConnectionFactory cnxFact =                                                                           new TopicHATcpConnectionFactory(url);      String reliableClass = (String) ref.get("reliableClass").getContent();      cnxFact.setReliableClass(reliableClass);      cnxFact.getParameters().fromReference(ref);      return cnxFact;    } else if (ref.getClassName().equals(haTcpXACF)) {      String url = (String) ref.get("cFactory.url").getContent();        XAConnectionFactory cnxFact =                                                                           new XAHATcpConnectionFactory(url);      String reliableClass = (String) ref.get("reliableClass").getContent();      cnxFact.setReliableClass(reliableClass);      cnxFact.getParameters().fromReference(ref);      return cnxFact;    } else if (ref.getClassName().equals(haTcpXAQCF)) {      String url = (String) ref.get("cFactory.url").getContent();        XAQueueConnectionFactory cnxFact =                                                                           new XAQueueHATcpConnectionFactory(url);      String reliableClass = (String) ref.get("reliableClass").getContent();      cnxFact.setReliableClass(reliableClass);      cnxFact.getParameters().fromReference(ref);      return cnxFact;    } else if (ref.getClassName().equals(haTcpXATCF)) {      String url = (String) ref.get("cFactory.url").getContent();        XATopicConnectionFactory cnxFact =                                                                           new XATopicHATcpConnectionFactory(url);      String reliableClass = (String) ref.get("reliableClass").getContent();      cnxFact.setReliableClass(reliableClass);      cnxFact.getParameters().fromReference(ref);      return cnxFact;    } else if (ref.getClassName().equals(localCF)) {      return new LocalConnectionFactory();    } else if (ref.getClassName().equals(localQCF)) {      return new QueueLocalConnectionFactory();    } else if (ref.getClassName().equals(localTCF)) {      return new TopicLocalConnectionFactory();    } else if (ref.getClassName().equals(localXACF)) {      return new XALocalConnectionFactory();    } else if (ref.getClassName().equals(localXAQCF)) {      return new XAQueueLocalConnectionFactory();    } else if (ref.getClassName().equals(localXATCF)) {      return new XATopicLocalConnectionFactory();    } else if (ref.getClassName().equals(haLocalCF)) {      return new HALocalConnectionFactory();    } else if (ref.getClassName().equals(haLocalQCF)) {      return new QueueHALocalConnectionFactory();    } else if (ref.getClassName().equals(haLocalTCF)) {      return new TopicHALocalConnectionFactory();    } else if (ref.getClassName().equals(haLocalXACF)) {      return new XAHALocalConnectionFactory();    } else if (ref.getClassName().equals(haLocalXAQCF)) {      return new XAQueueHALocalConnectionFactory();    } else if (ref.getClassName().equals(haLocalXATCF)) {      return new XATopicHALocalConnectionFactory();    } else if (ref.getClassName().equals(soapCF)) {      String host = (String) ref.get("cFactory.host").getContent();      String port = (String) ref.get("cFactory.port").getContent();      ConnectionFactory cnxFact =        new SoapConnectionFactory(host,                                  (new Integer(port)).intValue(),                                  -1);      cnxFact.getParameters().fromReference(ref);      return cnxFact;    } else if (ref.getClassName().equals(soapQCF)) {      String host = (String) ref.get("cFactory.host").getContent();      String port = (String) ref.get("cFactory.port").getContent();      ConnectionFactory cnxFact =        new QueueSoapConnectionFactory(host,                                       (new Integer(port)).intValue(),                                       -1);      cnxFact.getParameters().fromReference(ref);      return cnxFact;    } else if (ref.getClassName().equals(soapTCF)) {      String host = (String) ref.get("cFactory.host").getContent();      String port = (String) ref.get("cFactory.port").getContent();      ConnectionFactory cnxFact =        new TopicSoapConnectionFactory(host,                                       (new Integer(port)).intValue(),                                       -1);      cnxFact.getParameters().fromReference(ref);      return cnxFact;    } else if (ref.getClassName().equals(queue)) {      String destName = (String) ref.get("dest.name").getContent();      return new Queue(destName);    } else if (ref.getClassName().equals(topic)) {      String destName = (String) ref.get("dest.name").getContent();      return new Topic(destName);    } else if (ref.getClassName().equals(tempQueue)) {      String destName = (String) ref.get("dest.name").getContent();      return new TemporaryQueue(destName, null);    } else if (ref.getClassName().equals(tempTopic)) {      String destName = (String) ref.get("dest.name").getContent();      return new TemporaryTopic(destName, null);    } else if (ref.getClassName().equals(deadMQueue)) {      String destName = (String) ref.get("dest.name").getContent();      return new DeadMQueue(destName);    } else if (ref.getClassName().equals(user)) {      String userName = (String) ref.get("user.name").getContent();      String userId = (String) ref.get("user.id").getContent();      return new User(userName, userId);    } else {      String clazz = ref.getClassName();      try {        if ((clazz != null) && (clazz.length() > 0)) {          Destination dest = (Destination) Class.forName(clazz).newInstance();          if (dest instanceof ClusterDestination) {            Hashtable h = new Hashtable();            int i = 0;            if (dest.isQueue()) {              while (true) {                if (ref.get("cluster.key"+i) == null) break;                h.put((String) ref.get("cluster.key"+i).getContent(),                      new Queue((String) ref.get("cluster.destName"+i).getContent()));                i++;              }            } else {              while (true) {                if (ref.get("cluster.key"+i) == null) break;                h.put((String) ref.get("cluster.key"+i).getContent(),                      new Topic((String) ref.get("cluster.destName"+i).getContent()));                i++;              }            }            ((ClusterDestination) dest).setCluster(h);            return dest;          }        }      } catch (Exception exc) {        if (JoramTracing.dbgClient.isLoggable(BasicLevel.ERROR))          JoramTracing.dbgClient.log(            BasicLevel.ERROR, "", exc);      }    }    return null;  }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -