Package org.apache.cocoon.components.flow

Examples of org.apache.cocoon.components.flow.Interpreter


        if (flow == null)
            throw new ConfigurationException("This sitemap contains no control flows defined, cannot call at " + node.getLocation() + ". Define a control flow using <map:flow>, with embedded <map:script> elements.");

        // Get the Interpreter instance and set it up in the
        // CallFunctionNode function
        Interpreter interpreter = flow.getInterpreter();
        ((CallFunctionNode)node).setInterpreter(interpreter);
      }
    }
View Full Code Here


        // continuation object? Use the default language for now, but it
        // should be fixed ASAP.
        String language = selector.getDefaultLanguage();

        // Obtain the Interpreter instance for this language
        Interpreter interpreter = (Interpreter)selector.select(language);

        // Obtain the redirector
        // Redirector redirector = PipelinesNode.getRedirector(env);

        try {
            interpreter.handleContinuation(contId, params, env /*, redirector*/);
        } finally {
            selector.release((Component)interpreter);
        }

        return true;
View Full Code Here

                    + ". Define a control flow using <map:flow>, with embedded <map:script> elements.");
            }

            // Get the Interpreter instance and set it up in the
            // CallFunctionNode function
            Interpreter interpreter = flow.getInterpreter();
            ((CallFunctionNode) node).setInterpreter(interpreter);
        }
    }
View Full Code Here

                }

                // Get the actual interpreter
                FlowNode flowNode = (FlowNode)treeBuilder.getRegisteredNode("flow");
                if ( flowNode != null ) {
                    final Interpreter interpreter = flowNode.getInterpreter();
                    newProcessor.setAttribute(Interpreter.ROLE, interpreter);
                }
               
            } finally {
                this.manager.release(treeBuilder);
View Full Code Here

     * flow interpreter.
     */
    public void linkNode()
    throws Exception {
        FlowNode flowNode = (FlowNode)this.treeBuilder.getRegisteredNode("flow");
        Interpreter interpreter = flowNode.getInterpreter();

        this.node.registerScriptWithInterpreter(interpreter);
    }
View Full Code Here

    public String callFunction(String type, String source, String function, Map params) throws Exception {
       
        redirector.reset();
       
        ServiceSelector selector = null;
        Interpreter interpreter = null;
        SourceResolver resolver = null;

        try {
            selector = (ServiceSelector) this.lookup(Interpreter.ROLE);
            assertNotNull("Test lookup of interpreter selector", selector);

            resolver = (SourceResolver) this.lookup(SourceResolver.ROLE);
            assertNotNull("Test lookup of source resolver", resolver);

            assertNotNull("Test if interpreter name is not null", type);
            interpreter = (Interpreter) selector.select(type);
            assertNotNull("Test lookup of interpreter", interpreter);
           
            ((AbstractInterpreter)interpreter).register(source);
           
            ArrayList parameters = new ArrayList();
            for (Iterator i = params.entrySet().iterator(); i.hasNext();) {
                Map.Entry me = (Map.Entry)i.next();
                String name = (String)me.getKey();
                String value = (String)me.getValue();
                parameters.add(new Interpreter.Argument(name, value));
            }
            interpreter.callFunction(function, parameters, getRedirector());
           
        } catch (ServiceException ce) {
            getLogger().error("Could not retrieve interpeter", ce);
            fail("Could not retrieve interpreter: " + ce.toString());
        } finally {
View Full Code Here

    public String callContinuation(String type, String source, String id, Map params) throws Exception {
       
        redirector.reset();
       
        ServiceSelector selector = null;
        Interpreter interpreter = null;
        SourceResolver resolver = null;

        try {
            selector = (ServiceSelector) this.lookup(Interpreter.ROLE);
            assertNotNull("Test lookup of interpreter selector", selector);

            resolver = (SourceResolver) this.lookup(SourceResolver.ROLE);
            assertNotNull("Test lookup of source resolver", resolver);

            assertNotNull("Test if interpreter name is not null", type);
            interpreter = (Interpreter) selector.select(type);
            assertNotNull("Test lookup of interpreter", interpreter);

            ((AbstractInterpreter)interpreter).register(source);
           
            ArrayList parameters = new ArrayList();
            for (Iterator i = params.entrySet().iterator(); i.hasNext();) {
                Map.Entry me = (Map.Entry)i.next();
                String name = (String)me.getKey();
                String value = (String)me.getValue();
                parameters.add(new Interpreter.Argument(name, value));
            }
            interpreter.handleContinuation(id, parameters, getRedirector());

        } catch (ServiceException ce) {
            getLogger().error("Could not retrieve interpreter", ce);
            fail("Could not retrieve interpreter: " + ce.toString());
        } finally {
View Full Code Here

   */
  public void linkNode()
    throws Exception
  {
    FlowNode flowNode = (FlowNode)this.treeBuilder.getRegisteredNode("flow");
    Interpreter interpreter = flowNode.getInterpreter();

    this.node.registerScriptWithInterpreter(interpreter);
  }
View Full Code Here

    try {
      ComponentSelector selector
        = (ComponentSelector)manager.lookup(Interpreter.ROLE);
      // Obtain the Interpreter instance for this language
      Interpreter interpreter = (Interpreter)selector.select(language);
      if (interpreter instanceof AbstractInterpreter)
        ((AbstractInterpreter)interpreter).register(source);
      // else FIXME: what to do if interpreter doesn't inherit from
      // AbstractInterpreter
    }
View Full Code Here

    // continuation object? Use the default language for now, but it
    // should be fixed ASAP.
    String language = selector.getDefaultLanguage();

    // Obtain the Interpreter instance for this language
    Interpreter interpreter = (Interpreter)selector.select(language);

    try {
      interpreter.handleContinuation(contId, env, context);
    }
    finally {
      selector.release((Component)interpreter);
    }
View Full Code Here

TOP

Related Classes of org.apache.cocoon.components.flow.Interpreter

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.