You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by cz...@apache.org on 2003/05/23 17:04:05 UTC

cvs commit: cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/coplet/adapter/impl AbstractCopletAdapter.java URICopletAdapter.java

cziegeler    2003/05/23 08:04:04

  Modified:    src/blocks/authentication-fw/java/org/apache/cocoon/webapps/authentication/user
                        UserHandler.java
               src/blocks/portal/java/org/apache/cocoon/portal/coplet/adapter/impl
                        URICopletAdapter.java
  Added:       src/blocks/portal/java/org/apache/cocoon/portal/coplet/adapter/impl
                        AbstractCopletAdapter.java
  Log:
  Creating abstract base class
  
  Revision  Changes    Path
  1.7       +2 -1      cocoon-2.1/src/blocks/authentication-fw/java/org/apache/cocoon/webapps/authentication/user/UserHandler.java
  
  Index: UserHandler.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/authentication-fw/java/org/apache/cocoon/webapps/authentication/user/UserHandler.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- UserHandler.java	4 May 2003 20:43:23 -0000	1.6
  +++ UserHandler.java	23 May 2003 15:04:04 -0000	1.7
  @@ -124,6 +124,7 @@
       /**
        * Create Application Context.
        * This context is destroyed when the user logs out of the handler
  +     * FIXME - this should be moved into the Manager
        */
       public synchronized SessionContext createApplicationContext(String name,
                                                                     String loadURI,
  
  
  
  1.5       +7 -20     cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/coplet/adapter/impl/URICopletAdapter.java
  
  Index: URICopletAdapter.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/coplet/adapter/impl/URICopletAdapter.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- URICopletAdapter.java	22 May 2003 15:19:48 -0000	1.4
  +++ URICopletAdapter.java	23 May 2003 15:04:04 -0000	1.5
  @@ -56,15 +56,11 @@
   import org.apache.avalon.framework.activity.Disposable;
   import org.apache.avalon.framework.component.ComponentException;
   import org.apache.avalon.framework.component.ComponentManager;
  -import org.apache.avalon.framework.component.Composable;
  -import org.apache.avalon.framework.logger.AbstractLogEnabled;
  -import org.apache.avalon.framework.thread.ThreadSafe;
   import org.apache.cocoon.ProcessingException;
   import org.apache.cocoon.components.source.SourceUtil;
  -import org.apache.cocoon.portal.PortalService;
   import org.apache.cocoon.portal.Constants;
  +import org.apache.cocoon.portal.PortalService;
   import org.apache.cocoon.portal.coplet.CopletInstanceData;
  -import org.apache.cocoon.portal.coplet.adapter.CopletAdapter;
   import org.apache.excalibur.source.Source;
   import org.apache.excalibur.source.SourceResolver;
   import org.xml.sax.ContentHandler;
  @@ -79,12 +75,9 @@
    * @version CVS $Id$
    */
   public class URICopletAdapter 
  -    extends AbstractLogEnabled
  -    implements CopletAdapter, ThreadSafe, Composable, Disposable {
  +    extends AbstractCopletAdapter
  +    implements Disposable {
   	
  -    /** The component manager */
  -    protected ComponentManager manager;
  -
       /** The source resolver */
       protected SourceResolver resolver;
       
  @@ -92,13 +85,13 @@
        * @see org.apache.avalon.framework.component.Composable#compose(ComponentManager)
        */
       public void compose(ComponentManager componentManager)
  -        throws ComponentException {
  -        this.manager = componentManager;
  +    throws ComponentException {
  +        super.compose( componentManager );
           this.resolver = (SourceResolver)this.manager.lookup(SourceResolver.ROLE);
       }
   
       
  -    public void toSAX(CopletInstanceData coplet, ContentHandler contentHandler)
  +    public void streamContent(CopletInstanceData coplet, ContentHandler contentHandler)
       throws SAXException {
   		String uri = (String)coplet.getCopletData().getAttribute("uri");
   		Source copletSource = null;
  @@ -125,12 +118,6 @@
   			this.resolver.release(copletSource);
   			this.manager.release(portalService);
   		}
  -    }
  -    
  -    public void init(CopletInstanceData coplet) {
  -    }
  -    
  -    public void destroy(CopletInstanceData coplet) {
       }
       
       /* (non-Javadoc)
  
  
  
  1.1                  cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/coplet/adapter/impl/AbstractCopletAdapter.java
  
  Index: AbstractCopletAdapter.java
  ===================================================================
  /*
  
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
  
   Copyright (C) 1999-2002 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.
  
   This software  consists of voluntary contributions made  by many individuals
   on  behalf of the Apache Software  Foundation and was  originally created by
   Stefano Mazzocchi  <st...@apache.org>. For more  information on the Apache
   Software Foundation, please see <http://www.apache.org/>.
  
  */
  package org.apache.cocoon.portal.coplet.adapter.impl;
  
  import org.apache.avalon.framework.component.ComponentException;
  import org.apache.avalon.framework.component.ComponentManager;
  import org.apache.avalon.framework.component.Composable;
  import org.apache.avalon.framework.logger.AbstractLogEnabled;
  import org.apache.avalon.framework.thread.ThreadSafe;
  import org.apache.cocoon.portal.coplet.CopletInstanceData;
  import org.apache.cocoon.portal.coplet.adapter.CopletAdapter;
  import org.xml.sax.ContentHandler;
  import org.xml.sax.SAXException;
  
  /**
   * This is the adapter to use pipelines as coplets
   *
   * @author <a href="mailto:cziegeler@s-und-n.de">Carsten Ziegeler</a>
   * @author <a href="mailto:volker.schmitt@basf-it-services.com">Volker Schmitt</a>
   * 
   * @version CVS $Id: AbstractCopletAdapter.java,v 1.1 2003/05/23 15:04:04 cziegeler Exp $
   */
  public abstract class AbstractCopletAdapter 
      extends AbstractLogEnabled
      implements CopletAdapter, ThreadSafe, Composable {
  	
      /** The component manager */
      protected ComponentManager manager;
  
      /**
       * @see org.apache.avalon.framework.component.Composable#compose(ComponentManager)
       */
      public void compose(ComponentManager componentManager)
          throws ComponentException {
          this.manager = componentManager;
      }
  
      
      public abstract void streamContent(CopletInstanceData coplet, 
                                           ContentHandler contentHandler)
      throws SAXException; 
      
      
      public void toSAX(CopletInstanceData coplet, ContentHandler contentHandler)
      throws SAXException {
          this.streamContent( coplet, contentHandler );
      }
      
      public void init(CopletInstanceData coplet) {
      }
      
      public void destroy(CopletInstanceData coplet) {
      }
      
  }