You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by br...@apache.org on 2003/08/04 10:38:56 UTC

cvs commit: cocoon-2.1/src/blocks/apples/java/org/apache/cocoon/components/flow/apples AppleController.java AppleHelper.java AppleRequest.java AppleResponse.java ApplesProcessor.java DefaultAppleRequest.java DefaultAppleResponse.java

bruno       2003/08/04 01:38:56

  Added:       src/blocks/apples/java/org/apache/cocoon/components/flow/apples
                        AppleController.java AppleHelper.java
                        AppleRequest.java AppleResponse.java
                        ApplesProcessor.java DefaultAppleRequest.java
                        DefaultAppleResponse.java
  Log:
  initial commit of apples block, contributed by Marc Portier
  see bugzilla 21900
  
  Revision  Changes    Path
  1.1                  cocoon-2.1/src/blocks/apples/java/org/apache/cocoon/components/flow/apples/AppleController.java
  
  Index: AppleController.java
  ===================================================================
  /*
  
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
  
   Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
  
   Redistribution and use in source and binary forms, with or without modifica-
   tion, are permitted provided that the following conditions are met:
  
   1. Redistributions of  source code must  retain the above copyright  notice,
      this list of conditions and the following disclaimer.
  
   2. Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
  
   3. The end-user documentation included with the redistribution, if any, must
      include  the following  acknowledgment:  "This product includes  software
      developed  by the  Apache Software Foundation  (http://www.apache.org/)."
      Alternately, this  acknowledgment may  appear in the software itself,  if
      and wherever such third-party acknowledgments normally appear.
  
   4. The names "Apache Cocoon" and  "Apache Software Foundation" must  not  be
      used to  endorse or promote  products derived from  this software without
      prior written permission. For written permission, please contact
      apache@apache.org.
  
   5. Products  derived from this software may not  be called "Apache", nor may
      "Apache" appear  in their name,  without prior written permission  of the
      Apache Software Foundation.
  
   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
   APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
   INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
   DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
   OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
   ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
   (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  
  */
  package org.apache.cocoon.components.flow.apples;
  
  import org.apache.cocoon.ProcessingException;
  
  
  /**
   * AppleController declares the main processing interfaces for the stateful 
   * controller objects.
   * <p>
   * Implementations are advised to implement Avalon lifecycle interfaces.
   */
  public interface AppleController {
  
      /**
       * Allows the AppleController implementation to make some business decissions 
       * in a given web application flow. 
       * <p>
       * Typically those decissions will be based upon what it can find inside the 
       * passed {@link AppleRequest} and result into setting specific aspects of the
       * {@link AppleResponse}
       */
      void process(AppleRequest req, AppleResponse res) throws ProcessingException;
      
  
  }
  
  
  
  1.1                  cocoon-2.1/src/blocks/apples/java/org/apache/cocoon/components/flow/apples/AppleHelper.java
  
  Index: AppleHelper.java
  ===================================================================
  /*
  
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
  
   Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
  
   Redistribution and use in source and binary forms, with or without modifica-
   tion, are permitted provided that the following conditions are met:
  
   1. Redistributions of  source code must  retain the above copyright  notice,
      this list of conditions and the following disclaimer.
  
   2. Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
  
   3. The end-user documentation included with the redistribution, if any, must
      include  the following  acknowledgment:  "This product includes  software
      developed  by the  Apache Software Foundation  (http://www.apache.org/)."
      Alternately, this  acknowledgment may  appear in the software itself,  if
      and wherever such third-party acknowledgments normally appear.
  
   4. The names "Apache Cocoon" and  "Apache Software Foundation" must  not  be
      used to  endorse or promote  products derived from  this software without
      prior written permission. For written permission, please contact
      apache@apache.org.
  
   5. Products  derived from this software may not  be called "Apache", nor may
      "Apache" appear  in their name,  without prior written permission  of the
      Apache Software Foundation.
  
   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
   APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
   INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
   DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
   OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
   ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
   (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  
  */
  package org.apache.cocoon.components.flow.apples;
  
  import java.util.HashMap;
  import java.util.Iterator;
  import java.util.List;
  import java.util.Map;
  
  import org.apache.cocoon.components.flow.Interpreter.Argument;
  
  /**
   * AppleHelper holds some static utility classes used in the Apples flow
   * implementation.
   */
  public class AppleHelper {
  
      /** 
       * Translates a List of Interpreter.Argument objects into a classic 
       * {@link java.util.Map}
       */
      public static Map makeMapFromArguments(List params) {
          Map retMap = new HashMap();
          for (Iterator iter = params.iterator(); iter.hasNext();) {
              Argument element = (Argument) iter.next();
              retMap.put(element.name, element.value);
          }
          return retMap;
      }
  }
  
  
  
  1.1                  cocoon-2.1/src/blocks/apples/java/org/apache/cocoon/components/flow/apples/AppleRequest.java
  
  Index: AppleRequest.java
  ===================================================================
  /*
  
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
  
   Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
  
   Redistribution and use in source and binary forms, with or without modifica-
   tion, are permitted provided that the following conditions are met:
  
   1. Redistributions of  source code must  retain the above copyright  notice,
      this list of conditions and the following disclaimer.
  
   2. Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
  
   3. The end-user documentation included with the redistribution, if any, must
      include  the following  acknowledgment:  "This product includes  software
      developed  by the  Apache Software Foundation  (http://www.apache.org/)."
      Alternately, this  acknowledgment may  appear in the software itself,  if
      and wherever such third-party acknowledgments normally appear.
  
   4. The names "Apache Cocoon" and  "Apache Software Foundation" must  not  be
      used to  endorse or promote  products derived from  this software without
      prior written permission. For written permission, please contact
      apache@apache.org.
  
   5. Products  derived from this software may not  be called "Apache", nor may
      "Apache" appear  in their name,  without prior written permission  of the
      Apache Software Foundation.
  
   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
   APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
   INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
   DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
   OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
   ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
   (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  
  */
  package org.apache.cocoon.components.flow.apples;
  
  import java.util.Set;
  
  import org.apache.cocoon.environment.Request;
  
  /**
   * AppleRequest defines the services an AppleController can collect
   * from the current request.
   */
  public interface AppleRequest {
  
      /**
       * @return the wrapped cocoon environment Request
       */
      public Request getCocoonRequest();
      
      
      /**
       * @return Set of String's listing all available sitemap-parameters passed.
       */
      public Set getSitemapParameterNames();
      
      /**
       * Finds a named parameter in the request.
       * @param key of parameter to lookup
       * @return the parameter-value
       */
      public String getSitemapParameter(String key);
  
      /**
       * Finds a named parameter in the request using the overloaded method
       * {@link #getSitemapParamater(String)} but lets the returned value
       * default to the second argument in case the delegation resulted into
       * <code>null</code>
       * @param key of parameter to lookup
       * @param defaultValue return-value in case the lookup returned <code>null</code>
       * @return the parameter-value or if that was null: the defaultValue passed. 
       */    
      public String getSitemapParameter(String key, String defaultValue);    
  }
  
  
  
  1.1                  cocoon-2.1/src/blocks/apples/java/org/apache/cocoon/components/flow/apples/AppleResponse.java
  
  Index: AppleResponse.java
  ===================================================================
  /*
   * File AppleResponse.java 
   * created by mpo
   * on Jul 21, 2003 | 10:52:10 AM
   * 
   * (c) 2003 - Outerthought BVBA
   */
  package org.apache.cocoon.components.flow.apples;
  
  
  
  /**
   * AppleResponse defines the parts of the 'response' an AppleController can set.
   */
  public interface AppleResponse {
      
  
      /**
       * Sets the uri of the selected cocoon pipeline for publication of the result.
       * @param uri the uri that selects an (internal) publication pipe. 
       * @see ApplesProcessor#forwardTo
       */
      public void setURI(String uri);
      
      /**
       * Sets the 'bizdata' object to be sent as the flow's 'context-object' through 
       * the selected publication pipe.
       * @param data the 'bizdata' object
       */
      public void setData(Object data);
  
  }
  
  
  
  1.1                  cocoon-2.1/src/blocks/apples/java/org/apache/cocoon/components/flow/apples/ApplesProcessor.java
  
  Index: ApplesProcessor.java
  ===================================================================
  /*
  
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
  
   Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
  
   Redistribution and use in source and binary forms, with or without modifica-
   tion, are permitted provided that the following conditions are met:
  
   1. Redistributions of  source code must  retain the above copyright  notice,
      this list of conditions and the following disclaimer.
  
   2. Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
  
   3. The end-user documentation included with the redistribution, if any, must
      include  the following  acknowledgment:  "This product includes  software
      developed  by the  Apache Software Foundation  (http://www.apache.org/)."
      Alternately, this  acknowledgment may  appear in the software itself,  if
      and wherever such third-party acknowledgments normally appear.
  
   4. The names "Apache Cocoon" and  "Apache Software Foundation" must  not  be
      used to  endorse or promote  products derived from  this software without
      prior written permission. For written permission, please contact
      apache@apache.org.
  
   5. Products  derived from this software may not  be called "Apache", nor may
      "Apache" appear  in their name,  without prior written permission  of the
      Apache Software Foundation.
  
   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
   APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
   INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
   DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
   OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
   ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
   (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  
  */
  package org.apache.cocoon.components.flow.apples;
  
  import java.util.List;
  
  import org.apache.avalon.framework.service.ServiceException;
  import org.apache.avalon.framework.service.ServiceManager;
  import org.apache.avalon.framework.service.Serviceable;
  import org.apache.cocoon.components.LifecycleHelper;
  import org.apache.cocoon.components.flow.AbstractInterpreter;
  import org.apache.cocoon.components.flow.InvalidContinuationException;
  import org.apache.cocoon.components.flow.WebContinuation;
  import org.apache.cocoon.environment.Environment;
  import org.apache.cocoon.environment.ObjectModelHelper;
  import org.apache.cocoon.environment.Request;
  import org.apache.excalibur.source.SourceUtil;
  
  /**
   * ApplesProcessor is the core Cocoon component that provides the 'Apples' 
   * flow implementation. 
   */
  public class ApplesProcessor extends AbstractInterpreter implements Serviceable {
  
      //TODO make this a configuration setting
      public static final int TIMETOLIVE = 1800; // 30 minutes
  
  
      private ServiceManager serviceManager;
  
  
      public void callFunction(
          String className,
          List params,
          Environment env)
          throws Exception {
              
          AppleController app = instantiateController(className);
          
          getLogger().debug("Pulling fresh apple through the lifecycle...");
          LifecycleHelper.setupComponent(app, getLogger(), null, this.serviceManager, null, null, null);
          
          WebContinuation wk = this.continuationsMgr.createWebContinuation(app, null, TIMETOLIVE);
          
          processApple(params, env, app, wk);
      }
  
  
  
      public void handleContinuation(
          String continuationId,
          List params,
          Environment env)
          throws Exception {
  
          WebContinuation wk =
              this.continuationsMgr.lookupWebContinuation(continuationId);
          if (wk == null) {
              // Throw an InvalidContinuationException to be handled inside the
              // <map:handle-errors> sitemap element.                       
              throw new InvalidContinuationException(
                  "The continuation ID " + continuationId + " is invalid.");
          }
  
          AppleController app =
              (AppleController) wk.getContinuation();
               
          getLogger().debug("found apple from continuation: " + app);
          
          // TODO access control checks? exception to be thrown for illegal access?
          processApple(params, env, app, wk);
   
      }
  
  
      private AppleController instantiateController(String className)
          throws Exception {
              
          // TODO think about dynamic reloading of these beasts in future
          // classloading stuf et al.
  
          Class clazz = Class.forName(className);
          Object o = clazz.newInstance();
          return (AppleController) o;
      }
      
  
  
      private void processApple(
          List params,
          Environment env,
          AppleController app,
          WebContinuation wk)
          throws Exception {
          
          Request cocoonRequest = ObjectModelHelper.getRequest(env.getObjectModel());    
          AppleRequest req = new DefaultAppleRequest(params, cocoonRequest);
          DefaultAppleResponse res = new DefaultAppleResponse();
          app.process(req, res);
          
          String uri = res.getURI();
          if (SourceUtil.indexOfSchemeColon(uri) == -1) {
              uri = "cocoon:/" + uri;
          }
          
          getLogger().debug("Apple forwards to " + uri + " with bizdata= " + res.getData());
                             
          this.forwardTo(uri, res.getData(), wk, env);
          
          //TODO allow for AppleResponse to set some boolean saying the use case
          // is completed and the continuation can be invalidated ?
      }
  
  
      public void service(ServiceManager serviceManager) throws ServiceException {
          this.serviceManager = serviceManager;
      }
  
  }
  
  
  
  1.1                  cocoon-2.1/src/blocks/apples/java/org/apache/cocoon/components/flow/apples/DefaultAppleRequest.java
  
  Index: DefaultAppleRequest.java
  ===================================================================
  /*
  
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
  
   Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
  
   Redistribution and use in source and binary forms, with or without modifica-
   tion, are permitted provided that the following conditions are met:
  
   1. Redistributions of  source code must  retain the above copyright  notice,
      this list of conditions and the following disclaimer.
  
   2. Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
  
   3. The end-user documentation included with the redistribution, if any, must
      include  the following  acknowledgment:  "This product includes  software
      developed  by the  Apache Software Foundation  (http://www.apache.org/)."
      Alternately, this  acknowledgment may  appear in the software itself,  if
      and wherever such third-party acknowledgments normally appear.
  
   4. The names "Apache Cocoon" and  "Apache Software Foundation" must  not  be
      used to  endorse or promote  products derived from  this software without
      prior written permission. For written permission, please contact
      apache@apache.org.
  
   5. Products  derived from this software may not  be called "Apache", nor may
      "Apache" appear  in their name,  without prior written permission  of the
      Apache Software Foundation.
  
   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
   APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
   INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
   DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
   OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
   ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
   (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  
  */
  package org.apache.cocoon.components.flow.apples;
  
  import java.util.List;
  import java.util.Map;
  import java.util.Set;
  
  import org.apache.cocoon.environment.Request;
  
  /**
   * DefaultAppleRequest wraps the nested &lt;map:paramater&gt; 's and the 
   * active Cocoon Environment Request to implement the service of the 
   * {@link AppleRequest} interface. 
   */
  public class DefaultAppleRequest implements AppleRequest {
  
      private final Map params;
      private final Request cocoonRequest;
  
      /**
       * Constructs DefaultAppleRequest
       * @param params the nested <code>&lt;map:parameter&gt;</code>'s from the sitemap 
       * @param env the active cocoon environment 
       */
      public DefaultAppleRequest(List params, Request request) {
          this.params = AppleHelper.makeMapFromArguments(params);
          this.cocoonRequest = request;
      }
      
  
      public Request getCocoonRequest() {
          return cocoonRequest;
      }
      
  
      public Set getSitemapParameterNames() {
          return this.params.keySet();
      }
  
  
      public String getSitemapParameter(String key, String defaultValue) {
          String value = getSitemapParameter(key);
          if (value == null) {
              value = defaultValue;
          }        
          return value;
      }
  
  
      public String getSitemapParameter(String key) {
          return (String)this.params.get(key);
      }
  
  
  }
  
  
  
  1.1                  cocoon-2.1/src/blocks/apples/java/org/apache/cocoon/components/flow/apples/DefaultAppleResponse.java
  
  Index: DefaultAppleResponse.java
  ===================================================================
  /*
  
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
  
   Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
  
   Redistribution and use in source and binary forms, with or without modifica-
   tion, are permitted provided that the following conditions are met:
  
   1. Redistributions of  source code must  retain the above copyright  notice,
      this list of conditions and the following disclaimer.
  
   2. Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
  
   3. The end-user documentation included with the redistribution, if any, must
      include  the following  acknowledgment:  "This product includes  software
      developed  by the  Apache Software Foundation  (http://www.apache.org/)."
      Alternately, this  acknowledgment may  appear in the software itself,  if
      and wherever such third-party acknowledgments normally appear.
  
   4. The names "Apache Cocoon" and  "Apache Software Foundation" must  not  be
      used to  endorse or promote  products derived from  this software without
      prior written permission. For written permission, please contact
      apache@apache.org.
  
   5. Products  derived from this software may not  be called "Apache", nor may
      "Apache" appear  in their name,  without prior written permission  of the
      Apache Software Foundation.
  
   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
   APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
   INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
   DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
   OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
   ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
   (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  
  */
  package org.apache.cocoon.components.flow.apples;
  
  
  /**
   * DefaultAppleResponse provides a default implementation for the 
   * {@link AppleResponse}.
   */
  public class DefaultAppleResponse implements AppleResponse {
  
      private String uri;
      private Object data;
      
      /**
       * Gets the 'bizdata' that was prepared in this response by the AppleController.
       * This will be passed as the flow's so called 'context-object' through the
       * selected cocoon pipeline.
       */
      Object getData() {
          return data;
      }
  
      /**
       * Gets the 'uri' of the pipeline that was selected and set in this response 
       * by the AppleController.
       * This will be use to select the publication pipeline.
       */
      String getURI() {
          return uri;
      }
  
  
      public void setData(Object object) {
          data = object;
      }
  
  
      public void setURI(String string) {
          uri = string;
      }
  
  }