Package org.apache.commons.chain

Examples of org.apache.commons.chain.Catalog


   }

   public void testStringConf() throws Exception
   {
      CommandService cservice = (CommandService)container.getComponentInstanceOfType(CommandService.class);
      Catalog c = cservice.getCatalog();

      assertNull(c.getCommand("StrCommand"));
      cservice.putCatalog(new ByteArrayInputStream(IS.getBytes()));
      Catalog c1 = cservice.getCatalog();
      assertNotNull(c1.getCommand("StrCommand"));

   }
View Full Code Here


   public void testInitWithFile() throws Exception
   {
      CommandService cservice = (CommandService)container.getComponentInstanceOfType(CommandService.class);
      cservice.putCatalog(getClass().getResourceAsStream("/conf/test-commands3.xml"));
      assertTrue(cservice.getCatalogNames().hasNext());
      Catalog c1 = cservice.getCatalog("catalog1");
      assertNotNull(c1.getCommand("Command2"));

   }
View Full Code Here

      CommandService cservice = (CommandService)container.getComponentInstanceOfType(CommandService.class);
      Command c1 = cservice.getCatalog().getCommand("Execute2");
      Command c2 = cservice.getCatalog().getCommand("Command1");

      Catalog c = cservice.getCatalog();

      Context ctx = new ContextBase();
      ctx.put("test", Integer.valueOf(0));
      c1.execute(ctx);
      c2.execute(ctx);
View Full Code Here

                        + mapCommand(context, resourceId) + "'");
        }

        // Identify the Commons Chain catalog we will be using
        String catalogName = mapCatalog(context, resourceId);
        Catalog catalog = CatalogFactory.getInstance().getCatalog(catalogName);
        if (catalog == null) {
            if (log().isErrorEnabled()) {
                log().error("Cannot find catalog '" + catalogName + "' for resource '"
                            + resourceId + "'");
            }
            sendNotFound(context, resourceId);
            context.responseComplete();
            return;
        }

        // Identify the Commons Chain chain or command we will be executing
        String commandName = mapCommand(context, resourceId);
        Command command = catalog.getCommand(commandName);
        if (command == null) {
            if (log().isErrorEnabled()) {
                log().error("Cannot find command '" + commandName + "' in catalog '"
                            + catalogName + "' for resource '" + resourceId + "'");
            }
View Full Code Here

     * @exception Exception loading catalog
     */
    protected Catalog getCatalog() throws Exception {

        // 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(
View Full Code Here

        AbstractCommand.realizeSymbols(clayContext);

        clayContext.setRootElement(getDisplayElementRoot());
        clayContext.setParent(this);

        Catalog catalog = null;
        try {
            catalog = getCatalog();
        } catch (Exception e) {
            log.error(e);
        }
        Command command = catalog
                 .getCommand(Globals.ADD_COMPONENT_COMMAND_NAME);

        try {
            command.execute(clayContext);
        } catch (Exception e) {
View Full Code Here

     * @return commons chains catalog
     * @exception Exception finding catalog
     */
    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) {
View Full Code Here

    public static Builder getRenderer(Node node) {

        BuilderRuleContext context = new BuilderRuleContext();
        context.setNode(node);
        try {
            Catalog catalog = getCatalog();

            Command command = null;
            if (node.getQname() == null) {
                command = catalog.getCommand(Globals.FIND_DEFAULT_BUILDER_COMMAND_NAME);
            } else {
                String prefix = node.getQname();
                String uri = node.getNamespaceURI(prefix);
                if (uri != null) {
                    command = catalog.getCommand(uri);
                    if (command == null) {
                        FacesContext facesContext = FacesContext.getCurrentInstance();
                        if (facesContext != null) {
                            facesContext.getExternalContext().getRequestMap()
                            .put(Globals.CLAY_CUSTOM_BUILDER_XMLNS, uri);
                        }

                        command = catalog.getCommand(Globals.FIND_UNKNOWN_BUILDER_COMMAND_NAME);
                    }
                } else {
                    command = catalog.getCommand(Globals.FIND_UNKNOWN_BUILDER_COMMAND_NAME);
                }

            }

            command.execute(context);
View Full Code Here

                    ClayContext subContext = (ClayContext) clayContext.clone();
                    subContext.setDisplayElement(valueChangeListener);
                    subContext.setParent(child);

                    Catalog catalog = getCatalog();
                    Command command = catalog
                            .getCommand(Globals.ADD_VALUE_CHANGE_LISTENER_COMMAND_NAME);
                    command.execute(subContext);

                }
            } else {
View Full Code Here

     * @return commons chains catalog
     * @exception Exception finding catalog
     */
    protected Catalog getCatalog() throws Exception {

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

            ConfigParser parser = new ConfigParser();
            URL url = this.getClass().getClassLoader().getResource(
View Full Code Here

TOP

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

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.