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

📄 componentcontroller.java

📁 java开源的企业总线.xmlBlaster
💻 JAVA
字号:
/*------------------------------------------------------------------------------Name:      ComponentController.javaProject:   xmlBlaster.orgCopyright: xmlBlaster.org, see xmlBlaster-LICENSE file------------------------------------------------------------------------------*/package org.xmlBlaster.jmxgui;import org.w3c.dom.Document;import org.w3c.dom.DOMException;import org.w3c.dom.Node;import org.w3c.dom.NodeList;import org.w3c.dom.NamedNodeMap;import org.xml.sax.*;import java.util.Hashtable;import java.util.logging.Logger;import java.util.logging.Level;import org.xmlBlaster.util.Global;import org.xmlBlaster.jmxgui.util.XmlUtil;/** * Class that loads the basic configuration and wraps the classes that can be * obtained from the GUI within a Hashtable */public class ComponentController {  private XmlUtil xmlUtil = null;   private static Logger log = Logger.getLogger(ComponentController.class.getName());  private Global glob = null;  private Hashtable hObjects;  private static String ME = "ComponentController";  public ComponentController(Global glob) {    if (glob == null) glob = Global.instance();    xmlUtil = new XmlUtil();    hObjects = new Hashtable();    Document doc = xmlUtil.loadConfig();    buildDOM(doc);  }  private void buildDOM(Document doc) throws DOMException {    NodeList nl = doc.getElementsByTagName("component");    for (int i=0; i<nl.getLength(); i++) {      Node n = nl.item(i);      NamedNodeMap nn = n.getAttributes();      String className = nn.getNamedItem("class").getNodeValue();      String key = nn.getNamedItem("name").getNodeValue();      log.info(" name of the class to load: " + className);      log.info("class will be stored with key " + key+ " in hashtable");      try {        Class cl = java.lang.Class.forName(className);        if (cl!=null){          hObjects.put(key, cl);        }      }      catch (ClassNotFoundException ex) {        log.warning("class "+ className+ " not found in classpath!");      }    }  }/** * Returns classes that are defined within configfile */  public Hashtable getClasses() {    return this.hObjects;  }}

⌨️ 快捷键说明

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