Package org.zkoss.util.resource

Examples of org.zkoss.util.resource.ClassLocator


            if(file.exists()){
              url = file.toURI().toURL();
            }
          }
          if(url==null){//try to load from class loader
            url = new ClassLocator().getResource(_src);
          }
          if(url==null){//try to load from file
            File f = new File(_src);
            if(f.exists()){
              url = f.toURI().toURL();
View Full Code Here


      log.info("Loading system default");
    else if (config == null)
      return; //nothing to do

    try {
      final ClassLocator locator = new ClassLocator();
      final List xmls = locator.getDependentXMLResources(
        "metainfo/zk/config.xml", "config-name", "depends");
      for (Iterator it = xmls.iterator(); it.hasNext();) {
        final ClassLocator.Resource res = (ClassLocator.Resource)it.next();
        if (log.debugable()) log.debug("Loading "+res.url);
        try {
View Full Code Here

  synchronized static final void load() {
    if (_loaded)
      return;

    try {
      final ClassLocator loc = new ClassLocator();
      for (Enumeration en = loc.getResources("metainfo/xel/config.xml");
      en.hasMoreElements();) {
        final URL url = (URL)en.nextElement();
        if (log.debugable()) log.debug("Loading "+url);
        try {
          final Document doc = new SAXBuilder(false, false, true).build(url);
View Full Code Here

      log.error("Unable to load metainfo/zk/config.xml", ex);
    }

    //load metainfo/zk/zk.xml
    try {
      final ClassLocator loc = new ClassLocator();
      for (Enumeration en = loc.getResources("metainfo/zk/zk.xml");
      en.hasMoreElements();) {
        final URL cfgUrl = (URL)en.nextElement();
        try {
          parser.parse(cfgUrl, config, loc);
        } catch (Throwable ex) {
View Full Code Here

        }
      }
    }
  }
  private static void load0() throws java.io.IOException {
    final ClassLocator locator = new ClassLocator();

    //1. parse config.xml
    final ConfigParser parser = new ConfigParser();
    parser.parseConfigXml(null); //only system default configs

    //2. process lang.xml (no particular dependency)
    for (Enumeration en = locator.getResources("metainfo/zk/lang.xml");
    en.hasMoreElements();) {
      final URL url = (URL)en.nextElement();
      if (log.debugable()) log.debug("Loading "+url);
      try {
        final Document doc = new SAXBuilder(true, false, true).build(url);
        if (ConfigParser.checkVersion(url, doc, true))
          parseLang(doc, locator, url, false);
      } catch (Exception ex) {
        log.error("Failed to load "+url, ex);
        throw UiException.Aide.wrap(ex, "Failed to load "+url);
          //abort since it is hardly to work then
      }
    }

    //3. process lang-addon.xml (with dependency)
    final List xmls = locator.getDependentXMLResources(
      "metainfo/zk/lang-addon.xml", "addon-name", "depends");
    for (Iterator it = xmls.iterator(); it.hasNext();) {
      final ClassLocator.Resource res = (ClassLocator.Resource)it.next();
      try {
        if (ConfigParser.checkVersion(res.url, res.document, true))
View Full Code Here

      if (_defURLs != null)
        return _defURLs;

      final Map urls = new HashMap();
      try {
        final ClassLocator loc = new ClassLocator();
        for (Enumeration en = loc.getResources("metainfo/tld/config.xml");
        en.hasMoreElements();) {
          final URL url = (URL)en.nextElement();
          if (log.debugable()) log.debug("Loading "+url);
          try {
            final Document doc = new SAXBuilder(false, false, true).build(url);
View Full Code Here

      //get the class name
      log.info("Loading labels for "+locale);
      final Map labels = new HashMap(512);

      //1. load from modules
      final ClassLocator locator = new ClassLocator();
      for (Enumeration en = locator.getResources(
        locale == null ? "metainfo/i3-label.properties":
        "metainfo/i3-label_" + locale + ".properties");
      en.hasMoreElements();) {
        final URL url = (URL)en.nextElement();
        load(labels, url, _jarcharset);
View Full Code Here

 
  private XelContext getXelContext() {
    Taglib taglib = new Taglib("", "/web/WEB-INF/tld/zss/function.tld");
    List taglibs = new ArrayList(1);
    taglibs.add(taglib);
    FunctionMapper mapper = Taglibs.getFunctionMapper(taglibs, new ClassLocator());
    return new SimpleXelContext(null, mapper);
  }
View Full Code Here

    _mappers = new LinkedHashSet(4);
   
    //prepare the default Spread Sheet function mapper.
    final List taglibs = new ArrayList(1);
    taglibs.add(SSTAGLIB);
    FunctionMapper mapper = Taglibs.getFunctionMapper(taglibs, new ClassLocator());
    addFunctionMapper(mapper);
  }
View Full Code Here

                url = file.toURI().toURL();
            } else
              url = wapp.getResource(_src);
          }
          if (url == null) {// try to load from class loader
            url = new ClassLocator().getResource(_src);
          }
          if (url == null) {// try to load from file
            File f = new File(_src);
            if (f.exists()) {
              url = f.toURI().toURL();
View Full Code Here

TOP

Related Classes of org.zkoss.util.resource.ClassLocator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.