Package org.apache.commons.chain

Examples of org.apache.commons.chain.CatalogFactory


     *
     * @param context The Context we are processing
     * @return The Command to process for this Context
     */
    protected Command getCommand(Context context) {
        CatalogFactory catalogFactory = CatalogFactory.getInstance();
        String catalogName = getCatalogName();
        Catalog catalog;

        if (catalogName == null) {
            catalog = catalogFactory.getCatalog();
            catalogName = "{default}"; // for debugging purposes
        } else {
            catalog = catalogFactory.getCatalog(catalogName);
        }

        if (catalog == null) {
            throw new IllegalArgumentException("Cannot find catalog '"
                + catalogName + "'");
View Full Code Here


    public void begin(String namespace, String name, Attributes attributes)
        throws Exception {

        // Retrieve any current Catalog with the specified name
        Catalog catalog = null;
        CatalogFactory factory = CatalogFactory.getInstance();
        String nameValue = attributes.getValue(nameAttribute);
        if (nameValue == null) {
            catalog = factory.getCatalog();
        } else {
            catalog = factory.getCatalog(nameValue);
        }

        // Create and register a new Catalog instance if necessary
        if (catalog == null) {
            Class clazz = digester.getClassLoader().loadClass(catalogClass);
            catalog = (Catalog) clazz.newInstance();
            if (nameValue == null) {
                factory.setCatalog(catalog);
            } else {
                factory.addCatalog(nameValue, catalog);
            }
        }

        // Push this Catalog onto the top of the stack
        digester.push(catalog);
View Full Code Here

     *  can be found and the <code>optional</code> property is set
     *  to <code>false</code>
     */
    private Command getCommand(Context context) {

        CatalogFactory catalogFactory = CatalogFactory.getInstance();
        String catalogName = getCatalogName();
        Catalog catalog = null;
        if (catalogName == null) {
            // use default catalog
            catalog = catalogFactory.getCatalog();
        } else {
            catalog = catalogFactory.getCatalog(catalogName);
        }
        if (catalog == null) {
            if (catalogName == null) {
                throw new IllegalArgumentException
                    ("Cannot find default catalog");
View Full Code Here

     */
    public void service(HttpServletRequest request,
                        HttpServletResponse response)
        throws IOException, ServletException {
       
        CatalogFactory factory = CatalogFactory.getInstance();
        Catalog catalog = factory.getCatalog(servletName);
        if (catalog == null) {
            catalog = factory.getCatalog();
        }

        ServletWebContext context =
            new ServletWebContext(getServletContext(), request, response);
        Command command = catalog.getCommand("COMMAND_MAPPER");
View Full Code Here

     *  can be found
     *
     * @since Chain 1.2
     */
    protected Catalog getCatalog(Context context) {
        CatalogFactory lookupFactory = this.catalogFactory;
        if (lookupFactory == null) {
            lookupFactory = CatalogFactory.getInstance();
        }

        String catalogName = getCatalogName();
        Catalog catalog = null;
        if (catalogName == null) {
            // use default catalog
            catalog = lookupFactory.getCatalog();
        } else {
            catalog = lookupFactory.getCatalog(catalogName);
        }
        if (catalog == null) {
            if (catalogName == null) {
                throw new IllegalArgumentException
                    ("Cannot find default catalog");
View Full Code Here

    public void begin(String namespace, String name, Attributes attributes)
        throws Exception {

        // Retrieve any current Catalog with the specified name
        Catalog catalog = null;
        CatalogFactory factory = CatalogFactory.getInstance();
        String nameValue = attributes.getValue(nameAttribute);
        if (nameValue == null) {
            catalog = factory.getCatalog();
        } else {
            catalog = factory.getCatalog(nameValue);
        }

        // Create and register a new Catalog instance if necessary
        if (catalog == null) {
            Class clazz = digester.getClassLoader().loadClass(catalogClass);
            catalog = (Catalog) clazz.newInstance();
            if (nameValue == null) {
                factory.setCatalog(catalog);
            } else {
                factory.addCatalog(nameValue, catalog);
            }
        }

        // Push this Catalog onto the top of the stack
        digester.push(catalog);
View Full Code Here

    public void begin(String namespace, String name, Attributes attributes)
        throws Exception {

        // Retrieve any current Catalog with the specified name
        Catalog catalog = null;
        CatalogFactory factory = CatalogFactory.getInstance();
        String nameValue = attributes.getValue(nameAttribute);
        if (nameValue == null) {
            catalog = factory.getCatalog();
        } else {
            catalog = factory.getCatalog(nameValue);
        }

        // Create and register a new Catalog instance if necessary
        if (catalog == null) {
            Class clazz = digester.getClassLoader().loadClass(catalogClass);
            catalog = (Catalog) clazz.newInstance();
            if (nameValue == null) {
                factory.setCatalog(catalog);
            } else {
                factory.addCatalog(nameValue, catalog);
            }
        }

        // Push this Catalog onto the top of the stack
        digester.push(catalog);
View Full Code Here

     * @exception IllegalArgumentException if no such {@link Command}
     *  can be found and the <code>optional</code> property is set
     *  to <code>false</code>
     */
    protected Command getCommand(Context context) {
        CatalogFactory lookupFactory = this.catalogFactory;
        if (lookupFactory == null) {
            lookupFactory = CatalogFactory.getInstance();
        }

        String catalogName = getCatalogName();
        Catalog catalog = null;
        if (catalogName == null) {
            // use default catalog
            catalog = lookupFactory.getCatalog();
        } else {
            catalog = lookupFactory.getCatalog(catalogName);
        }
        if (catalog == null) {
            if (catalogName == null) {
                throw new IllegalArgumentException
                    ("Cannot find default catalog");
View Full Code Here

   * @param context
   *            The Context we are processing
   * @return The Command to process for this Context
   */
  protected Command getCommand(Context context) {
    CatalogFactory catalogFactory = CatalogFactory.getInstance();
    String catalogName = getCatalogName();
    Catalog catalog;

    if (catalogName == null) {
      catalog = catalogFactory.getCatalog();
      catalogName = "{default}"; // for debugging purposes
    } else {
      catalog = catalogFactory.getCatalog(catalogName);
    }

    if (catalog == null) {
      throw new IllegalArgumentException("Cannot find catalog '" + catalogName + "'");
    }
View Full Code Here

    private boolean catalogExists() {
        String catalogName = getCatalogName();
        if (catalogName == null) {
            return false;
        }
        CatalogFactory catalogFactory = CatalogFactory.getInstance();

        return (catalogFactory.getCatalog(catalogName) != null);
    }
View Full Code Here

TOP

Related Classes of org.apache.commons.chain.CatalogFactory

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.