Package org.apache.commons.chain

Examples of org.apache.commons.chain.Command


            pathInfo = request.getPathInfo();
        }

        // Map to the Command specified by the extra path info
        Catalog catalog = (Catalog) context.get(getCatalogKey());
        Command command = catalog.getCommand(pathInfo);
        return (command.execute(context));

    }
View Full Code Here


            theCatalog = factory.getCatalog();
        }
        if (attribute == null) {
            request.setAttribute(CATALOG_DEFAULT, theCatalog);
        }
        Command command = theCatalog.getCommand(this.command);
        try {
            command.execute(context);
        } catch (Exception e) {
            throw new ServletException(e);
        }

    }
View Full Code Here

        HttpServletRequest request = swcontext.getRequest();
        String value = request.getParameter(getParameter());

        // Map to the Command specified by the extra path info
        Catalog catalog = (Catalog) context.get(getCatalogKey());
        Command command = catalog.getCommand(value);
        return (command.execute(context));

    }
View Full Code Here

     *  can be found and the <code>optional</code> property is set
     *  to <code>false</code>
     */
    public boolean execute(Context context) throws Exception {

        Command command = getCommand(context);
        if (command != null) {
            return (command.execute(context));
        } else {
            return (false);
        }

    }
View Full Code Here

     *
     * @exception Exception if thrown by the <code>postprocess()</code> method
     */
    public boolean postprocess(Context context, Exception exception) {

        Command command = getCommand(context);
        if (command != null) {
            if (command instanceof Filter) {
                return (((Filter) command).postprocess(context, exception));
            }
        }
View Full Code Here

                throw new IllegalArgumentException
                    ("Cannot find catalog '" + catalogName + "'");
            }
        }

        Command command = null;
        String name = getName();
        if (name == null) {
            name = (String) context.get(getNameKey());
        }
        if (name != null) {
View Full Code Here

   }

   public void testSetProperty() throws Exception
   {

      Command c = cservice.getCatalog().getCommand("setProperty");
      ctx.put("currentNode", "/test");
      ctx.put("name", "testProperty");
      ctx.put("propertyType", PropertyType.TYPENAME_STRING);
      ctx.put("values", "testValue");
      ctx.put("multiValued", Boolean.FALSE);

      c.execute(ctx);

      System.out.println("> set property>> " + ctx.get("result"));

      Command save = cservice.getCatalog().getCommand("save");
      save.execute(ctx);

   }
View Full Code Here

   }

   public void testGetNodes() throws Exception
   {

      Command c = cservice.getCatalog().getCommand("getNodes");
      ctx.put("currentNode", "/");
      c.execute(ctx);

      assertTrue(ctx.get("result") instanceof NodeIterator);
      NodeIterator nodes = (NodeIterator)ctx.get("result");

      // System.out.println("> getNodes >> "+nodes.getSize());
View Full Code Here

   }

   public void testAddResourceFile() throws Exception
   {

      Command c = cservice.getCatalog().getCommand("addResourceFile");
      ctx.put("currentNode", "/");
      ctx.put("path", "resource");
      ctx.put("data", "Node data");
      ctx.put("mimeType", "text/html");

      c.execute(ctx);

      System.out.println(">>> Resource >>> " + ctx.get("result"));

      Command save = cservice.getCatalog().getCommand("save");
      ctx.put("path", "/");
      save.execute(ctx);

   }
View Full Code Here

   }

   public void testGetNodeChain() throws Exception
   {
      Command cmd = cservice.getCatalog().getCommand("retrieveNodeCommand");
      ctx.put("currentNode", "/");
      ctx.put("path", "test");
      cmd.execute(ctx);

      System.out.println("RESULT >>>>>> " + ctx.get("result"));

   }
View Full Code Here

TOP

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

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.