You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by ta...@apache.org on 2004/05/18 19:58:20 UTC

cvs commit: jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/engine JetspeedEngine.java

taylor      2004/05/18 10:58:20

  Modified:    portal/src/java/org/apache/jetspeed/pipeline Pipeline.java
                        JetspeedPipeline.java
               portal/src/java/org/apache/jetspeed/engine
                        JetspeedEngine.java
  Added:       portal/src/java/org/apache/jetspeed/pipeline/descriptor
                        ValveDescriptor.java BaseDescriptor.java
                        XmlReader.java PipelineDescriptor.java
  Removed:     portal/src/java/org/apache/jetspeed/descriptor
                        XmlReader.java ValveDescriptor.java
                        PipelineDescriptor.java BaseDescriptor.java
  Log:
  moved o.a.j.descriptor to o.a.j.pipeline.descriptor
  part of clean-up, see 
  
  http://nagoya.apache.org/jira/browse/JS2-29
  
  PR:
  Obtained from:
  Submitted by:	
  Reviewed by:	
  CVS: ----------------------------------------------------------------------
  CVS: PR:
  CVS:   If this change addresses a PR in the problem report tracking
  CVS:   database, then enter the PR number(s) here.
  CVS: Obtained from:
  CVS:   If this change has been taken from another system, such as NCSA,
  CVS:   then name the system in this line, otherwise delete it.
  CVS: Submitted by:
  CVS:   If this code has been contributed to Apache by someone else; i.e.,
  CVS:   they sent us a patch or a new module, then include their name/email
  CVS:   address here. If this is your work then delete this line.
  CVS: Reviewed by:
  CVS:   If we are doing pre-commit code reviews and someone else has
  CVS:   reviewed your changes, include their name(s) here.
  CVS:   If you have not had it reviewed then delete this line.
  
  Revision  Changes    Path
  1.1                  jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/pipeline/descriptor/ValveDescriptor.java
  
  Index: ValveDescriptor.java
  ===================================================================
  /*
   * Copyright 2000-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.jetspeed.pipeline.descriptor;
  
  /**
   * This descriptor bean represents the configuration used to create a
   * Summit <code>Valve</code>.
   *
   * @author <a href="mailto:john@zenplex.com">John Thorhauer</a>
   * @author <a href="mailto:jason@zenplex.com">Jason van Zyl</a>
   * @version $Id: ValveDescriptor.java,v 1.1 2004/05/18 17:58:20 taylor Exp $
   */
  public class ValveDescriptor
      extends BaseDescriptor
  {
      /** Class name of the valve. */
      private String className;
  
      /**
       * Default contructor
       */
      public ValveDescriptor()
      {
      }
  
      /**
       * This is the full package/class name of the
       * class used for the valve.
       *
       * @param s the full package/class name used for the valve
       */
      public void setClassName(String className)
      {
          this.className = className;
      }
  
      /**
       * @return the full package/class name used for the valve
       */
      public String getClassName()
      {
          return className;
      }
  }
  
  
  
  1.1                  jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/pipeline/descriptor/BaseDescriptor.java
  
  Index: BaseDescriptor.java
  ===================================================================
  /*
   * Copyright 2000-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.jetspeed.pipeline.descriptor;
  
  /**
   * The base class from which all descriptor beans are derived.
   *
   * Summit's XML configuration files are parse into descriptor beans
   * and the descriptor beans are processed to configure Summit.
   *
   * @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
   * @version $Id: BaseDescriptor.java,v 1.1 2004/05/18 17:58:20 taylor Exp $
   */
  public class BaseDescriptor
  {
      /**
       * Display name to use for this descriptor.
       */
      private String name;
  
      /**
       * Id to use for this descriptor.
       */
      private String id;
      
      /**
       * Give object that have not been given an explicit unique id
       * one that will keep betwixt happy.
       */
      private static int uniqueId;
      
      /**
       * Sets the name attribute
       *
       * @param name the new name value
       */
      public void setName(String name)
      {
          this.name = name;
      }
  
      /**
       * Gets the name attribute
       *
       * @return the name attribute 
       */
      public String getName()
      {
          return name;
      }
  
      /**
       * Sets the id attribute of the BaseDescriptor object
       *
       * @param id the new id value
       */
      public void setId(String id)
      {
          this.id = id;
      }
  
      /**
       * Gets the id attribute
       *
       * @return the id attribute
       */
      public String getId()
      {
          if (id == null)
          {
              id = Integer.toString(uniqueId++);
          }
          
          return id;
      }
      
      /**
       * Return a string suitable for display/debugging
       *
       * @return the name attribute as a default
       */
      public String toString()
      {
          return name;
      }
  
      /**
       * Whether the passed object is the same as this one. In this case
       * the id is the unique qualifier. So two objects are equal
       * if they have equal id's
       * @param o any object
       * @return true if o is the same as this object, false otherwise
       */
      public boolean equals(Object o)
      {
          if (o == null)
          {
              return false;
          }
          
          if (getClass() != o.getClass())
          {
              return false;
          }
          
          if (getId() != null)
          {
              return getId().equals(((BaseDescriptor) o).getId());
          }
          else
          {
              return ((BaseDescriptor) o).getId() == null;
          }
      }
      
      /**
       * Provides the hashCode of this object, which is determined by simply
       * delegating the responsibility to the name property
       * @return the hashCode of the name if not null, otherwise delegate to the
       * parent class
       */
      public int hashCode()
      {
          if (getId() != null)
          {
              return getId().hashCode();
          }
          else
          {
              return super.hashCode();
          }
      }
  }
  
  
  
  1.1                  jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/pipeline/descriptor/XmlReader.java
  
  Index: XmlReader.java
  ===================================================================
  /*
   * Copyright 2000-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.jetspeed.pipeline.descriptor;
  
  import java.io.InputStream;
  import org.apache.commons.betwixt.io.BeanReader;
  import org.apache.commons.betwixt.XMLIntrospector;
  import org.apache.commons.betwixt.strategy.DecapitalizeNameMapper;
  import org.apache.commons.betwixt.strategy.DefaultPluralStemmer;
  
  /**
   * @author <a href="mailto:jason@zenplex.com">Jason van Zyl</a>
   * @version $Id: XmlReader.java,v 1.1 2004/05/18 17:58:20 taylor Exp $
   */
  public class XmlReader
  {
      /** Betwixt BeanReader. */
      private BeanReader beanReader;
      
      /** Class type we are reading. */
      private Class clazz;
      
      /**
       * Constructor
       */
      public XmlReader(Class clazz)
      {
          this.clazz = clazz;
      }
      
      /**
       * Parse the given InputStream into an Object.
       *
       * @param is InputSteam to parse.
       * @return Object
       */
      public Object parse(InputStream is)
          throws Exception
      {
          if (beanReader == null)
          {
              beanReader = createBeanReader(clazz);
          }
          
          return beanReader.parse(is);
      }
      
      /**
       * Create the Betwixt BeanReader for processing this class.
       *
       * @param clazz Type of Class to parse.
       * @return BeanReader capable of parsing the type of clazz.
       */
      private BeanReader createBeanReader(Class clazz)
          throws Exception
      {
          BeanReader reader = new BeanReader();
          reader.setXMLIntrospector(createXMLIntrospector());
          reader.registerBeanClass(clazz);
          return reader;
      }
  
      /**
       * Create Betwixt XMLIntrospector.
       *
       * @return XMLIntrospector.
       */
      private XMLIntrospector createXMLIntrospector()
      {
          XMLIntrospector introspector = new XMLIntrospector();
  
          introspector.setAttributesForPrimitives(false);
          introspector.setNameMapper(new DecapitalizeNameMapper());
          introspector.setPluralStemmer(new DefaultPluralStemmer());
  
          return introspector;
      }
  }
  
  
  
  1.1                  jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/pipeline/descriptor/PipelineDescriptor.java
  
  Index: PipelineDescriptor.java
  ===================================================================
  /*
   * Copyright 2000-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.jetspeed.pipeline.descriptor;
  
  import java.util.ArrayList;
  import java.util.List;
  
  /**
   * This descriptor bean represents the configuration used to create a
   * Summit <code>Pipeline</code>.
   *
   * @author <a href="mailto:john@zenplex.com">John Thorhauer</a>
   * @author <a href="mailto:jason@zenplex.com">Jason van Zyl</a>
   * @version $Id: PipelineDescriptor.java,v 1.1 2004/05/18 17:58:20 taylor Exp $
   */
  public class PipelineDescriptor
      extends BaseDescriptor
  {
      /**
       * List of valve descriptors
       */
      private List valveDescriptors;
  
      /**
       * Default contructor
       */
      public PipelineDescriptor()
      {
          valveDescriptors = new ArrayList();
      }
  
      /**
       * Add a ValveDescriptor to the Pipeline
       * descriptor
       *
       * @param ValveDescriptor
       */
      public void addValveDescriptor(ValveDescriptor valveDescriptor)
      {
          valveDescriptors.add(valveDescriptor);
      }
  
      /**
       * Return a list of ValveDesccriptors
       *
       * @return List of ValveDesccriptors
       */
      public List getValveDescriptors()
      {
          return this.valveDescriptors;
      }
  }
  
  
  
  1.3       +2 -2      jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/pipeline/Pipeline.java
  
  Index: Pipeline.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/pipeline/Pipeline.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Pipeline.java	8 Mar 2004 00:30:44 -0000	1.2
  +++ Pipeline.java	18 May 2004 17:58:20 -0000	1.3
  @@ -16,7 +16,7 @@
   package org.apache.jetspeed.pipeline;
   
   import org.apache.jetspeed.request.RequestContext;
  -import org.apache.jetspeed.descriptor.PipelineDescriptor;
  +import org.apache.jetspeed.pipeline.descriptor.PipelineDescriptor;
   import org.apache.jetspeed.pipeline.valve.Valve;
   
   /**
  
  
  
  1.3       +3 -3      jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/pipeline/JetspeedPipeline.java
  
  Index: JetspeedPipeline.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/pipeline/JetspeedPipeline.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- JetspeedPipeline.java	8 Mar 2004 00:30:44 -0000	1.2
  +++ JetspeedPipeline.java	18 May 2004 17:58:20 -0000	1.3
  @@ -19,8 +19,8 @@
   
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
  -import org.apache.jetspeed.descriptor.PipelineDescriptor;
  -import org.apache.jetspeed.descriptor.ValveDescriptor;
  +import org.apache.jetspeed.pipeline.descriptor.PipelineDescriptor;
  +import org.apache.jetspeed.pipeline.descriptor.ValveDescriptor;
   import org.apache.jetspeed.pipeline.valve.Valve;
   import org.apache.jetspeed.pipeline.valve.ValveContext;
   import org.apache.jetspeed.request.RequestContext;
  
  
  
  1.22      +3 -3      jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/engine/JetspeedEngine.java
  
  Index: JetspeedEngine.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/engine/JetspeedEngine.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- JetspeedEngine.java	31 Mar 2004 06:19:08 -0000	1.21
  +++ JetspeedEngine.java	18 May 2004 17:58:20 -0000	1.22
  @@ -36,10 +36,10 @@
   import org.apache.jetspeed.cps.CPSInitializationException;
   import org.apache.jetspeed.cps.CommonPortletServices;
   import org.apache.jetspeed.cps.jndi.JNDIService;
  -import org.apache.jetspeed.descriptor.PipelineDescriptor;
  -import org.apache.jetspeed.descriptor.XmlReader;
   import org.apache.jetspeed.exception.JetspeedException;
   import org.apache.jetspeed.pipeline.Pipeline;
  +import org.apache.jetspeed.pipeline.descriptor.PipelineDescriptor;
  +import org.apache.jetspeed.pipeline.descriptor.XmlReader;
   import org.apache.jetspeed.request.RequestContext;
   import org.apache.jetspeed.services.factory.FactoryManager;
   import org.apache.jetspeed.services.information.InformationProviderManager;
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org