Package org.apache.commons.chain.config

Examples of org.apache.commons.chain.config.ConfigParser


                catalog = new CatalogBase();
            }
        }

        // Construct the configuration resource parser we will use
        ConfigParser parser = new ConfigParser();
        if (ruleSet != null) {
            try {
                ClassLoader loader =
                    Thread.currentThread().getContextClassLoader();
                if (loader == null) {
                    loader = this.getClass().getClassLoader();
                }
                Class clazz = loader.loadClass(ruleSet);
                parser.setRuleSet((RuleSet) clazz.newInstance());
            } catch (Exception e) {
                throw new RuntimeException("Exception initalizing RuleSet '"
                                           + ruleSet + "' instance: "
                                           + e.getMessage());
            }
View Full Code Here


            if (value != null) {
                chainConfig = value;
            }

            ConfigParser parser = new ConfigParser();
            List urls = splitAndResolvePaths(chainConfig);
            URL resource;

            for (Iterator i = urls.iterator(); i.hasNext();) {
                resource = (URL) i.next();
                log.info("Loading chain catalog from " + resource);
                parser.parse(resource);
            }
        } catch (Exception e) {
            log.error("Exception loading resources", e);
            throw new ServletException(e);
        }
View Full Code Here

   {
      ValueParam confFile = params.getValueParam("config-file");
      if (confFile != null)
      {
         String path = confFile.getValue();
         ConfigParser parser = new ConfigParser();
         // may work for StandaloneContainer
         ClassLoader cl = Thread.currentThread().getContextClassLoader();
         URL res = cl.getResource(path);
         // for PortalContainer
         if (res == null)
            res = configurationManager.getResource(path);
         if (res == null)
            throw new Exception("Resource not found " + path);
         log.info("Catalog configuration found at " + res);
         parser.parse(res);
      }

   }
View Full Code Here

                catalog = new CatalogBase();
            }
        }

        // Construct the configuration resource parser we will use
        ConfigParser parser = new ConfigParser();
        if (ruleSet != null) {
            try {
                ClassLoader loader =
                    Thread.currentThread().getContextClassLoader();
                if (loader == null) {
                    loader = this.getClass().getClassLoader();
                }
                Class clazz = loader.loadClass(ruleSet);
                parser.setRuleSet((RuleSet) clazz.newInstance());
            } catch (Exception e) {
                throw new ServletException("Exception initalizing RuleSet '"
                                           + ruleSet + "' instance", e);
            }
        }
View Full Code Here

                catalog = new CatalogBase();
            }
        }

        // Construct the configuration resource parser we will use
        ConfigParser parser = new ConfigParser();
        if (ruleSet != null) {
            try {
                ClassLoader loader =
                    Thread.currentThread().getContextClassLoader();
                if (loader == null) {
                    loader = this.getClass().getClassLoader();
                }
                Class clazz = loader.loadClass(ruleSet);
                parser.setRuleSet((RuleSet) clazz.newInstance());
            } catch (Exception e) {
                throw new RuntimeException("Exception initalizing RuleSet '"
                                           + ruleSet + "' instance: "
                                           + e.getMessage());
            }
View Full Code Here

                                                     catalog);
        }

        // Add or replace chain definitions from the specified resource
        try {
            ConfigParser parser = new ConfigParser();
            URL configResource = null;
            if (path != null) {
                log.info("Loading context relative resources from '" +
                         path + "'");
                configResource =
                    servlet.getServletContext().getResource(path);
            } else if (resource != null) {
                log.info("Loading classloader resources from '" +
                         resource + "'");
                ClassLoader loader =
                    Thread.currentThread().getContextClassLoader();
                if (loader == null) {
                    loader = this.getClass().getClassLoader();
                }
                configResource = loader.getResource(resource);
            }
            parser.parse(catalog, configResource);
        } catch (Exception e) {
            log.error("Exception loading resources", e);
            throw new ServletException(e);
        }
View Full Code Here

    public void init(ActionServlet servlet, ModuleConfig config)
        throws ServletException {

        // Parse the configuration file specified by path or resource
        try {
            ConfigParser parser = new ConfigParser();
            URL configResource = null;
            if (path != null) {
                log.info("Loading context relative resources from '" +
                         path + "'");
                configResource =
                    servlet.getServletContext().getResource(path);
            } else if (resource != null) {
                log.info("Loading classloader resources from '" +
                         resource + "'");
                ClassLoader loader =
                    Thread.currentThread().getContextClassLoader();
                if (loader == null) {
                    loader = this.getClass().getClassLoader();
                }
                configResource = loader.getResource(resource);
            }
            parser.parse(configResource);
        } catch (Exception e) {
            log.error("Exception loading resources", e);
            throw new ServletException(e);
        }
View Full Code Here

      if (value != null) {
        chainConfig = value;
      }

      ConfigParser parser = new ConfigParser();
      List urls = splitAndResolvePaths(chainConfig);
      URL resource;

      for (Iterator i = urls.iterator(); i.hasNext();) {
        resource = (URL) i.next();
        log.info("Loading chain catalog from " + resource);
        parser.parse(resource);
      }
    } catch (Exception e) {
      log.error("Exception loading resources", e);
      throw new ServletException(e);
    }
View Full Code Here

        // Look up the "shale" catalog, creating one if necessary
        Catalog catalog = CatalogFactory.getInstance().getCatalog(
                Globals.CLAY_CATALOG_NAME);
        if (catalog == null) {

            ConfigParser parser = new ConfigParser();
            URL url = this.getClass().getClassLoader().getResource(
                    Globals.CLAY_RESOURCE_NAME);
            if (url == null) {
                throw new IllegalArgumentException(Globals.CLAY_RESOURCE_NAME);
            }
            parser.parse(url);

            catalog = CatalogFactory.getInstance().getCatalog(
                    Globals.CLAY_CATALOG_NAME);

        }
View Full Code Here

    protected static Catalog getCatalog() throws Exception {

        Catalog catalog = CatalogFactory.getInstance().getCatalog(Globals.BUILDER_CATALOG_NAME);
        if (catalog == null) {

            ConfigParser parser = new ConfigParser();
            URL url = parser.getClass().getClassLoader().getResource(Globals.BUILDER_RESOURCE_NAME);
            if (url == null) {
                throw new IllegalArgumentException(Globals.BUILDER_RESOURCE_NAME);
            }
            parser.parse(url);

            catalog = CatalogFactory.getInstance().getCatalog(Globals.BUILDER_CATALOG_NAME);

        }
View Full Code Here

TOP

Related Classes of org.apache.commons.chain.config.ConfigParser

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.