📄 joramsaxwrapper.java
字号:
try { className = atts.getValue(ATT_CLASSNAME); if (!isSet(className)) className = "org.objectweb.joram.client.jms.tcp.TcpConnectionFactory"; } catch (Exception exc) { throw new SAXException(exc.getMessage(), exc); } } else if (rawName.equals(ELT_TCP)) { try { try { host = atts.getValue(ATT_HOST); if (!isSet(host)) host = "localhost"; String value = atts.getValue(ATT_PORT); if (value == null) port = 16010; else port = Integer.parseInt(value); reliableClass = atts.getValue(ATT_RELIABLECLASS); } catch (NumberFormatException exc) { throw new Exception("bad value for port: " + atts.getValue(ATT_PORT)); } } catch (Exception exc) { throw new SAXException(exc.getMessage(), exc); } } else if (rawName.equals(ELT_LOCAL)) { } else if (rawName.equals(ELT_HATCP)) { try { url = atts.getValue(ATT_URL); reliableClass = atts.getValue(ATT_RELIABLECLASS); } catch (Exception exc) { throw new SAXException(exc.getMessage(), exc); } } else if (rawName.equals(ELT_HALOCAL)) { } else if (rawName.equals(ELT_SOAP)) { try { try { host = atts.getValue(ATT_HOST); if (!isSet(host)) host = "localhost"; String value = atts.getValue(ATT_PORT); if (value == null) port = 16010; else port = Integer.parseInt(value); value = atts.getValue(ATT_TIMEOUT); if (value == null) timeout = 60; else timeout = Integer.parseInt(value); } catch (NumberFormatException exc) { throw new Exception("bad value for port: " + atts.getValue(ATT_PORT)); } } catch (Exception exc) { throw new SAXException(exc.getMessage(), exc); } } else if (rawName.equals(ELT_JNDI)) { try { jndiName = atts.getValue(ATT_NAME); } catch (Exception exc) { throw new SAXException(exc.getMessage(), exc); } } else if (rawName.equals(ELT_USER)) { try { try { name = atts.getValue(ATT_NAME); password = atts.getValue(ATT_PASSWORD); String value = atts.getValue(ATT_SERVERID); if (value == null) serverId = AdminModule.getLocalServerId(); else serverId = Integer.parseInt(value); dmq = atts.getValue(ATT_DMQ); value = atts.getValue(ATT_THRESHOLD); if (value == null) threshold = -1; else threshold = Integer.parseInt(value); } catch (NumberFormatException exc) { throw new Exception("bad value for serverId: " + atts.getValue(ATT_SERVERID)); } } catch (Exception exc) { throw new SAXException(exc.getMessage(), exc); } } else if (rawName.equals(ELT_DESTINATION)) { try { try { type = atts.getValue(ATT_TYPE); name = atts.getValue(ATT_NAME); String value = atts.getValue(ATT_SERVERID); if (value == null) serverId = AdminModule.getLocalServerId(); else serverId = Integer.parseInt(value); className = atts.getValue(ATT_CLASSNAME); dmq = atts.getValue(ATT_DMQ); } catch (NumberFormatException exc) { throw new Exception("bad value for serverId: " + atts.getValue(ATT_SERVERID)); } } catch (Exception exc) { throw new SAXException(exc.getMessage(), exc); } } else if (rawName.equals(ELT_QUEUE)) { try { try { name = atts.getValue(ATT_NAME); String value = atts.getValue(ATT_SERVERID); if (value == null) serverId = AdminModule.getLocalServerId(); else serverId = Integer.parseInt(value); className = atts.getValue(ATT_CLASSNAME); dmq = atts.getValue(ATT_DMQ); value = atts.getValue(ATT_THRESHOLD); if (value == null) threshold = -1; else threshold = Integer.parseInt(value); value = atts.getValue(ATT_NBMAXMSG); if (value == null) nbMaxMsg = -1; else nbMaxMsg = Integer.parseInt(value); } catch (NumberFormatException exc) { throw new Exception("bad value for serverId: " + atts.getValue(ATT_SERVERID)); } } catch (Exception exc) { throw new SAXException(exc.getMessage(), exc); } } else if (rawName.equals(ELT_TOPIC)) { try { try { name = atts.getValue(ATT_NAME); String value = atts.getValue(ATT_SERVERID); if (value == null) serverId = AdminModule.getLocalServerId(); else serverId = Integer.parseInt(value); className = atts.getValue(ATT_CLASSNAME); dmq = atts.getValue(ATT_DMQ); parent = atts.getValue(ATT_PARENT); } catch (NumberFormatException exc) { throw new Exception("bad value for serverId: " + atts.getValue(ATT_SERVERID)); } } catch (Exception exc) { throw new SAXException(exc.getMessage(), exc); } } else if (rawName.equals(ELT_DMQUEUE)) { try { try { name = atts.getValue(ATT_NAME); String value = atts.getValue(ATT_SERVERID); if (value == null) serverId = AdminModule.getLocalServerId(); else serverId = Integer.parseInt(value); } catch (NumberFormatException exc) { throw new Exception("bad value for serverId: " + atts.getValue(ATT_SERVERID)); } } catch (Exception exc) { throw new SAXException(exc.getMessage(), exc); } } else if (rawName.equals(ELT_PROPERTY)) { try { if (properties == null) properties = new Properties(); properties.put(atts.getValue(ATT_NAME), atts.getValue(ATT_VALUE)); } catch (Exception exc) { throw new SAXException(exc.getMessage(), exc); } } else if (rawName.equals(ELT_READER)) { try { user = atts.getValue(ATT_USER); } catch (Exception exc) { throw new SAXException(exc.getMessage(), exc); } } else if (rawName.equals(ELT_WRITER)) { try { user = atts.getValue(ATT_USER); } catch (Exception exc) { throw new SAXException(exc.getMessage(), exc); } } else if (rawName.equals(ELT_FREEREADER)) { freeReading = true; } else if (rawName.equals(ELT_FREEWRITER)) { freeWriting = true; } else if (rawName.equals(ELT_INITIALCONTEXT)) { } else if (rawName.equals(ELT_CLUSTER)) { cluster = new Vector(); } else { throw new SAXException("unknown element \"" + rawName + "\""); } } } /** * Receive notification of the end of an element. * * @param uri The Namespace URI * @param localName The local name * @param rawName The qualified name * @param atts The attributes attached to the element. * * @exception SAXException * unspecialized error */ public void endElement(String uri, String localName, String rawName) throws SAXException { if (JoramTracing.dbgAdmin.isLoggable(BasicLevel.DEBUG)) JoramTracing.dbgAdmin.log(BasicLevel.DEBUG, "endElement: " + rawName); if (rawName.equals(ELT_JORAMADMIN)) { conf = null; } else if (joramAdmName.equals(conf)) { try { if (rawName.equals(ELT_ADMINMODULE)) { } else if (rawName.equals(ELT_CONNECT)) { if (JoramTracing.dbgAdmin.isLoggable(BasicLevel.DEBUG)) JoramTracing.dbgAdmin.log(BasicLevel.DEBUG, "AdminModule.connect(" + host + "," + port + "," + name + "," + password + "," + cnxTimer + "," + reliableClass + ")"); AdminModule.connect(host,port,name,password,cnxTimer,reliableClass); } else if (rawName.equals(ELT_COLLOCATEDCONNECT)) { if (JoramTracing.dbgAdmin.isLoggable(BasicLevel.DEBUG)) JoramTracing.dbgAdmin.log(BasicLevel.DEBUG, "AdminModule.collocatedConnect(" + name + "," + password + ")"); AdminModule.collocatedConnect(name,password); } else if (rawName.equals(ELT_CONNECTIONFACTORY)) { if (JoramTracing.dbgAdmin.isLoggable(BasicLevel.DEBUG)) JoramTracing.dbgAdmin.log(BasicLevel.DEBUG, "cf = " + obj); if (jndi) toBind.put(jndiName,obj); className = null; obj = null; jndi = false; } else if (rawName.equals(ELT_TCP)) { Class clazz = Class.forName(className); Class [] classParams = {new String().getClass(), Integer.TYPE, new String().getClass()}; Method methode = clazz.getMethod("create", classParams); Object[] objParams = {host, new Integer(port), reliableClass}; obj = methode.invoke(null, objParams); } else if (rawName.equals(ELT_LOCAL)) { Class clazz = Class.forName(className); Method methode = clazz.getMethod("create", new Class[0]); obj = methode.invoke(null, new Object[0]); } else if (rawName.equals(ELT_HATCP)) { Class clazz = Class.forName(className); Class [] classParams = {new String().getClass(), new String().getClass()}; Method methode = clazz.getMethod("create",classParams); Object[] objParams = {url,reliableClass}; obj = methode.invoke(null,objParams); } else if (rawName.equals(ELT_HALOCAL)) { Class clazz = Class.forName(className); Method methode = clazz.getMethod("create", new Class[0]); obj = methode.invoke(null, new Object[0]); } else if (rawName.equals(ELT_SOAP)) { Class clazz = Class.forName(className); Class [] classParams = {new String().getClass(), Integer.TYPE, Integer.TYPE}; Method methode = clazz.getMethod("create", classParams); Object[] objParams = {host, new Integer(port), new Integer(timeout)}; obj = methode.invoke(null, objParams); } else if (rawName.equals(ELT_JNDI)) { jndi = true; } else if (rawName.equals(ELT_USER)) { if (JoramTracing.dbgAdmin.isLoggable(BasicLevel.DEBUG)) JoramTracing.dbgAdmin.log(BasicLevel.DEBUG, "User.create(" + name + "," + password + "," + serverId + ")"); User u = User.create(name, password, serverId); users.put(name, u); if (threshold > 0) u.setThreshold(threshold); if (dmq != null && dmq.length() >0 && destinations.containsKey(dmq)) { u.setDMQ((DeadMQueue) destinations.get(dmq)); } } else if (rawName.equals(ELT_DESTINATION)) { Destination dest = null; if (JoramTracing.dbgAdmin.isLoggable(BasicLevel.DEBUG)) JoramTracing.dbgAdmin.log(BasicLevel.DEBUG, "dest type =" + type); if (type.equals("queue")) { if (className == null) className = "org.objectweb.joram.mom.dest.Queue"; if (JoramTracing.dbgAdmin.isLoggable(BasicLevel.DEBUG)) JoramTracing.dbgAdmin.log(BasicLevel.DEBUG, "Queue.create(" + serverId + "," + name + "," + className + "," + properties + ")"); dest = Queue.create(serverId, name, className, properties);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -