Example usage for org.apache.commons.chain.config ConfigParser ConfigParser

List of usage examples for org.apache.commons.chain.config ConfigParser ConfigParser

Introduction

In this page you can find the example usage for org.apache.commons.chain.config ConfigParser ConfigParser.

Prototype

ConfigParser

Source Link

Usage

From source file:bridge.toolkit.Controller.java

/**
* Constructor
*/
public Controller() {
    parser = new ConfigParser();
}

From source file:com.netsteadfast.greenstep.base.chain.SimpleChain.java

public Catalog getCatalog(String resourceConfig, String catalogName) throws Exception {
    ConfigParser parser = new ConfigParser();
    parser.parse(this.getClass().getResource(resourceConfig));
    Catalog catalog = CatalogFactoryBase.getInstance().getCatalog(catalogName);
    return catalog;
}

From source file:bridge.toolkit.ControllerJFrame.java

/** Creates new form NewJFrame */
public ControllerJFrame() {
    DateFormat dateFormat = new SimpleDateFormat("yyyyMMdd-HHmmss");
    Date date = new Date();

    currentTime = dateFormat.format(date);

    parser = new ConfigParser();
    Controller loader = new Controller();
    sampleCatalog = loader.createCatalog();

    ctx = new ContextBase();
    initComponents();//from   www .j a  v  a 2 s  . c  o  m
    System.setOut(aPrintStream); // catches System.out messages
    System.setErr(aPrintStream); // catches error messages

}

From source file:org.ambiance.chain.CatalogAmbianceChain.java

public void initialize() throws InitializationException {
    ConfigParser parser = new ConfigParser();
    try {// ww w. j av a2  s  . c  o m
        parser.parse(this.getClass().getResource(catalogFileName));
        catalog = CatalogFactoryBase.getInstance().getCatalog();
    } catch (Exception e) {
        throw new InitializationException("Unable to load rules catalog", e);
    }

}

From source file:org.apache.struts.action.ActionServlet.java

/**
 * <p>Parse the configuration documents specified by the
 * <code>chainConfig</code> init-param to configure the default {@link
 * org.apache.commons.chain.Catalog} that is registered in the {@link
 * CatalogFactory} instance for this application.</p>
 *
 * @throws ServletException if an error occurs.
 *///from   ww  w. j  a v a  2  s.c  om
protected void initChain() throws ServletException {
    // Parse the configuration file specified by path or resource
    try {
        String value;

        value = getServletConfig().getInitParameter("chainConfig");

        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);
    }
}

From source file:org.apache.struts.chain.legacy.CatalogConfiguratorPlugIn.java

/**
 * <p>Parse the configuration documents specified by the <code>path</code>
 * or <code>resource</code> property to configure the default
 * {@link Catalog} that is registered in the {@link CatalogFactory}
 * instance for this application.</p>
 *//*from w  w  w .  ja v  a2s  . c o  m*/
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);
    }

}

From source file:org.exoplatform.services.command.impl.CommandService.java

public CommandService() {
    this.catalogFactory = CatalogFactoryBase.getInstance();

    final ConfigParser parser = new ConfigParser();
    this.digester = SecurityHelper.doPrivilegedAction(new PrivilegedAction<Digester>() {
        public Digester run() {
            return parser.getDigester();
        }//w ww  . j  a  v a  2  s .com
    });
}

From source file:org.exoplatform.services.command.impl.CommonsXMLConfigurationPlugin.java

public CommonsXMLConfigurationPlugin(InitParams params, ConfigurationManager configurationManager)
        throws Exception {
    ValueParam confFile = params.getValueParam("config-file");
    if (confFile != null) {
        final String path = confFile.getValue();
        final ConfigParser parser = new ConfigParser();
        // may work for StandaloneContainer

        URL res = SecurityHelper.doPrivilegedAction(new PrivilegedAction<URL>() {
            public URL run() {
                return Thread.currentThread().getContextClassLoader().getResource(path);
            }/*from  w w  w  .j  ava2s.  c  om*/
        });

        // 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);

        final URL fRes = res;
        SecurityHelper.doPrivilegedExceptionAction(new PrivilegedExceptionAction<Void>() {
            public Void run() throws Exception {
                parser.parse(fRes);
                return null;
            }
        });
    }

}

From source file:org.seasar.struts.hotdeploy.impl.ChainConfigLoaderImpl.java

protected void initChain() throws ServletException {
    // Parse the configuration file specified by path or resource
    try {//from   ww w .java 2s.co  m
        String value;

        value = getServletConfig().getInitParameter("chainConfig");

        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);
    }
}