cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From p...@apache.org
Subject cvs commit: cocoon-2.2/src/kernel/org/apache/cocoon/kernel/composition ComponentComposer.java Component.java Wire.java
Date Tue, 04 May 2004 17:41:05 GMT
pier        2004/05/04 10:41:05

  Modified:    src/kernel/org/apache/cocoon/kernel/composition
                        Component.java Wire.java
  Added:       src/kernel/org/apache/cocoon/kernel/composition
                        ComponentComposer.java
  Log:
  Simplifying the Wire and Component interfaces.
  
  Revision  Changes    Path
  1.4       +14 -8     cocoon-2.2/src/kernel/org/apache/cocoon/kernel/composition/Component.java
  
  Index: Component.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.2/src/kernel/org/apache/cocoon/kernel/composition/Component.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Component.java	31 Mar 2004 13:01:38 -0000	1.3
  +++ Component.java	4 May 2004 17:41:05 -0000	1.4
  @@ -17,14 +17,16 @@
   
   import java.net.URL;
   
  +import org.apache.cocoon.kernel.resolution.Resolver;
  +
   /**
    * <p>The {@link Component} interface identifies a component aware of its
    * deployment in a block-enabled environment.</p>
    *
    * <p>Any component implementing this interface <b>must be aware</b>
that
  - * the {@link Wire} they will be given will resolve {@link URL}s in the context
  - * of the <b>calling</b> block and not in the context of the block they are
  - * defined in.</p>
  + * the {@link Resolver} they will be given will resolve {@link URL}s in the
  + * context of the <b>calling</b> block and not in the context of the block
they
  + * are defined in.</p>
    *
    * <p>This is done because resource management is decoupled entirely from
    * component management, and because in block-enabled environments, it will
  @@ -61,10 +63,14 @@
   public interface Component {
   
       /**
  -     * <p>Contextualize this {@link Component} component instance with the
  -     * {@link Wire} through which its caller is accessing it.</p>
  +     * <p>Contextualize this {@link Component} instance.</p>
        *
  -     * @param wire the {@link Wire} instance associated with this instance.
  +     * @param wire the {@link Wire} instance through which the block requesting
  +     *             this instance is accessing it.
  +     * @param wirings the {@link Wirings} instance associated with the block
  +     *                instance in which this {@link Component} is defined.
  +     * @param resolver the {@link Resolver} instance resolving resources in the
  +     *                 calling block instance.
        */
  -    public void contextualize(Wire wire);
  +    public void contextualize(Wire wire, Wirings wirings, Resolver resolver);
   }
  
  
  
  1.4       +2 -50     cocoon-2.2/src/kernel/org/apache/cocoon/kernel/composition/Wire.java
  
  Index: Wire.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.2/src/kernel/org/apache/cocoon/kernel/composition/Wire.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Wire.java	31 Mar 2004 13:01:38 -0000	1.3
  +++ Wire.java	4 May 2004 17:41:05 -0000	1.4
  @@ -15,9 +15,6 @@
    */
   package org.apache.cocoon.kernel.composition;
   
  -import org.apache.cocoon.kernel.resolution.Resolver;
  -import org.apache.cocoon.kernel.resolution.Resource;
  -
   /**
    * <p>The {@link Wire} interface defines a component as returned by a
    * {@link Wirings} instance.</p>
  @@ -61,52 +58,7 @@
    * @author <a href="mailto:pier@apache.org">Pier Fumagalli</a>
    * @version 1.0 (CVS $Revision$)
    */
  -public interface Wire extends Resolver {
  -
  -    /**
  -     * <p>Resolve a resource visible from a {@link Component} into a
  -     * {@link Resource}.</p>
  -     *
  -     * <p>This method will resolve resources local to the block requesting
  -     * this wire.</p>
  -     *
  -     * <p>If the specified {@link String} assumes a format like
  -     * <code>wiring:/resource/path</code> where <code>wiring</code>
is the
  -     * wiring name as required in the block's deployment descriptor, the
  -     * resolution of the {@link Resource} will be performed relative to the
  -     * block target of the wiring.</p>
  -     *
  -     * <p>{@link Component}s using a {@link Wire} for resource resolution
  -     * <b>must</b> be aware that resolution will happen in the context of the
  -     * requesting block, rather than in the context of the block composing the
  -     * {@link Component}.</p>
  -     *
  -     * <p>This is done because resource management is decoupled entirely from
  -     * component management, and because in block-enabled environments, it will
  -     * be possible to have components provided by wired blocks to operate on
  -     * resources available from other wired blocks.</p>
  -     * 
  -     * <p>Let's examine a simple example based (for example) on Apache Cocoon:
  -     * the <i>ForrestPipeline</i> block (a block providing a <code>Pipeline</code>
  -     * component for Apache Forrest) is wired to two other blocks: the first is
  -     * the <i>XSLTransformer</i> block (providing <code>Transformer</code>
  -     * component instances) and the second one is an instance of the
  -     * <i>ForrestSkin</i> block (a block providing XSLT stylesheets to be used
  -     * while processing the forrest pipeline).</p>
  -     *
  -     * <p>Being an implementation of {@link Component}, the <code>Transformer</code>
  -     * component instantiated by the <i>ForrestPipeline</i> block will have
direct
  -     * access (and will be able to resolve) a resource in the form of
  -     * <code>skin:/document2xhtml.xsl</code>, which represents a resource provided
  -     * by any <i>ForrestSkin</i> implementation, wired to the <i>ForrestPipeline</i>
  -     * block, but completely separated from the original<i>XSLTransformer</i>
block
  -     * which provides the <code>Transformer</code> instance.</p>
  -     * 
  -     * @param name the local (or wired) resource name.
  -     * @return a {@link Resource} instance, or <b>null</b> if the resource
was
  -     *         not found or was not accessible.
  -     */
  -    public Resource resolve(String name);
  +public interface Wire {
   
       /**
        * <p>Check wether the wire between this {@link Wirings} instance and the
  
  
  
  1.1                  cocoon-2.2/src/kernel/org/apache/cocoon/kernel/composition/ComponentComposer.java
  
  Index: ComponentComposer.java
  ===================================================================
  /*
   * Copyright 1999-2004 The Apache Software Foundation.
   * 
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   * 
   *      http://www.apache.org/licenses/LICENSE-2.0
   * 
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  package org.apache.cocoon.kernel.composition;
  
  import org.apache.cocoon.kernel.configuration.ConfigurationException;
  import org.apache.cocoon.kernel.configuration.Parameters;
  
  
  /**
   * <p>The {@link ComponentComposer} class represents a simple {@link Composer}
   * returning its own instance in the {@link #acquire()} method.</p> 
   *
   * @author <a href="mailto:pier@apache.org">Pier Fumagalli</a>
   * @version 1.0 (CVS $Revision: 1.1 $)
   */
  public abstract class ComponentComposer implements Composer {
  
      /** <p>The contextualized {@link Wirings} instance.</p> */
      protected Wirings wirings = null;
  
      /** <p>The configured {@link Parameters} instance.</p> */
      protected Parameters parameters = null;
  
      /**
       * <p>Create a new {@link ComponentComposer} instance.</p>
       */
      protected ComponentComposer() {
          super();
      }
  
      /**
       * <p>Acquire this {@link ComponentComposer} instance.</p>
       *
       * @return this {@link ComponentComposer} instance.
       */
      public Object acquire()
      throws Throwable {
          return(this);
      }
  
      /**
       * <p>Release a previously acquired {@link ComponentComposer} instance.</p>
       * 
       * <p>This method does not do anything.</p>
       *
       * @return this {@link ComponentComposer} instance.
       */
      public void release(Object object) {
          /* Nothing to do here */
      }
  
      /**
       * <p>Dispose a previously acquired {@link ComponentComposer} instance.</p>
       * 
       * <p>This method simply invokes the {@link #release()} method.</p>
       *
       * @return this {@link ComponentComposer} instance.
       */
      public void dispose(Object object) {
          this.release(object);
      }
  
      /**
       * <p>Contextualize this {@link ComponentComposer} with the {@link Wirings}
       * associated to the block where it resides.</p>
       *
       * @param wirings the {@link Wirings} instance associated with the block in
       *                which this {@link ComponentComposer} was deployed.
       * @throws WiringException if there was an error performing operations
       *                         on the supplied {@link Wirings} instance.
       */
      public void contextualize(Wirings wirings)
      throws WiringException {
          this.wirings = wirings;
       }
  
      /**
       * <p>Configure this {@link ComponentComposer} instance with the specified
       * {@link Parameters}.</p>
       *
       * @param parameters the {@link Parameters} configuring the instance.
       * @throws ConfigurationException if this instance could not be configured.
       */
      public void configure(Parameters parameters)
      throws ConfigurationException {
          this.parameters = parameters;
      }
  }
  
  
  

Mime
View raw message