portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From raph...@apache.org
Subject cvs commit: jakarta-jetspeed/src/java/org/apache/jetspeed/om/newregistry/base BaseMediaType.java BasePortletInfoEntry.java
Date Tue, 08 May 2001 14:21:52 GMT
raphael     01/05/08 07:21:51

  Modified:    src/java/org/apache/jetspeed/om/newregistry
                        PortletControllerEntry.java PortletInfoEntry.java
               src/java/org/apache/jetspeed/om/newregistry/base
                        BasePortletInfoEntry.java
  Added:       src/java/org/apache/jetspeed/om/newregistry/base
                        BaseMediaType.java
  Log:
  add complete support for media types references in registry
  
  Revision  Changes    Path
  1.2       +1 -3      jakarta-jetspeed/src/java/org/apache/jetspeed/om/newregistry/PortletControllerEntry.java
  
  Index: PortletControllerEntry.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/om/newregistry/PortletControllerEntry.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- PortletControllerEntry.java	2001/05/02 10:46:15	1.1
  +++ PortletControllerEntry.java	2001/05/08 14:21:31	1.2
  @@ -54,14 +54,12 @@
   
   package org.apache.jetspeed.om.newregistry;
   
  -import java.util.Vector;
  -
   /**
    * This entry describes all the properties that should be present in
    * a RegistryEntry describing a PortletController
    * 
    * @author <a href="mailto:raphael@apache.org">RaphaŽl Luta</a>
  - * @version $Id: PortletControllerEntry.java,v 1.1 2001/05/02 10:46:15 raphael Exp $
  + * @version $Id: PortletControllerEntry.java,v 1.2 2001/05/08 14:21:31 raphael Exp $
    */
   public interface PortletControllerEntry extends PortletInfoEntry
   {   
  
  
  
  1.5       +30 -1     jakarta-jetspeed/src/java/org/apache/jetspeed/om/newregistry/PortletInfoEntry.java
  
  Index: PortletInfoEntry.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/om/newregistry/PortletInfoEntry.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- PortletInfoEntry.java	2001/05/07 20:48:07	1.4
  +++ PortletInfoEntry.java	2001/05/08 14:21:34	1.5
  @@ -62,7 +62,7 @@
    * for all the portlet related entries.
    * 
    * @author <a href="mailto:raphael@apache.org">RaphaŽl Luta</a>
  - * @version $Id: PortletInfoEntry.java,v 1.4 2001/05/07 20:48:07 raphael Exp $
  + * @version $Id: PortletInfoEntry.java,v 1.5 2001/05/08 14:21:34 raphael Exp $
    */
   public interface PortletInfoEntry extends RegistryEntry
   {
  @@ -111,5 +111,34 @@
        * @param name the parameter name to remove
        */
       public void removeParameter( String name );
  +    
  +    /** 
  +     * Returns a list of the supported media type names
  +     *
  +     * @return an iterator on the supported media type names
  +     */
  +    public Iterator listMediaTypes();
   
  +    /** 
  +     * Test if a given media type is supported by this entry.
  +     *
  +     * @param name the media type name to test for. 
  +     * @return true is the media type is supported, false otherwise
  +     */
  +    public boolean hasMediaType(String name);
  +    
  +    /** 
  +     * Add a new supported media type
  +     *
  +     * @param name the media type name to add. 
  +     */
  +    public void addMediaType(String name);
  +    
  +    /** 
  +     * Remove support for a given media type
  +     *
  +     * @param name the media type name to remove. 
  +     */
  +    public void removeMediaType(String name);
  +    
   }
  
  
  
  1.6       +87 -10    jakarta-jetspeed/src/java/org/apache/jetspeed/om/newregistry/base/BasePortletInfoEntry.java
  
  Index: BasePortletInfoEntry.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/om/newregistry/base/BasePortletInfoEntry.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- BasePortletInfoEntry.java	2001/05/08 10:00:13	1.5
  +++ BasePortletInfoEntry.java	2001/05/08 14:21:46	1.6
  @@ -64,7 +64,7 @@
    * 
    * @see org.apache.jetspeed.om.newregistry.PortletInfoEntry
    * @author <a href="mailto:raphael@apache.org">RaphaŽl Luta</a>
  - * @version $Id: BasePortletInfoEntry.java,v 1.5 2001/05/08 10:00:13 raphael Exp $
  + * @version $Id: BasePortletInfoEntry.java,v 1.6 2001/05/08 14:21:46 raphael Exp $
    */
   public abstract class BasePortletInfoEntry extends BaseRegistryEntry
   {
  @@ -214,6 +214,67 @@
           }
       }
       
  +    /** 
  +     * Returns a list of the supported media type names
  +     *
  +     * @return an iterator on the supported media type names
  +     */
  +    public Iterator listMediaTypes()
  +    {
  +        return mediaTypes.iterator();
  +    }
  +    
  +    /** 
  +     * Test if a given media type is supported by this entry.
  +     * The test is done by a case sensitive name comparison
  +     *
  +     * @param name the media type name to test for. 
  +     * @return true is the media type is supported false otherwise
  +     */
  +    public boolean hasMediaType(String name)
  +    {
  +        boolean hasMedia = false;
  +        
  +        Iterator i = mediaTypes.iterator();
  +        while ((!hasMedia)&&i.hasNext())
  +        {
  +            hasMedia=i.next().equals(name);
  +        }
  +        
  +        return hasMedia;
  +    }
  +    
  +    /** 
  +     * Add a new supported media type
  +     *
  +     * @param name the media type name to add. 
  +     */
  +    public void addMediaType(String name)
  +    {
  +        if (name!=null)
  +        {
  +            this.mediaTypes.add(name);
  +        }
  +    }
  +    
  +    /** 
  +     * Remove support for a given media type
  +     *
  +     * @param name the media type name to remove. 
  +     */
  +    public void removeMediaType(String name)
  +    {
  +        Iterator i = mediaTypes.iterator();
  +        while (i.hasNext())
  +        {
  +            if (i.next().equals(name))
  +            {
  +                i.remove();
  +                return;
  +            }
  +        }
  +    }
  +    
       // Castor serialization accessor methods
       
       /** Needed for Castor 0.8.11 XML serialization for retrieving the 
  @@ -227,14 +288,10 @@
       /** Needed for Castor 0.8.11 XML serialization for setting the 
        *  parameters objects associated to this object
        */
  -    public void setParameters(Vector params)
  +    public synchronized void setParameters(Vector params)
       {
  -        synchronized (parameter)
  -        {
  -            this.parameter = params;
  -            buildNameIndex();
  -        }
  -
  +        this.parameter = params;
  +        buildNameIndex();
       }
   
       /** Needed for Castor 0.8.11 XML serialization for retrieving the 
  @@ -242,7 +299,18 @@
        */
       public Vector getMediaTypes()
       {
  -        return mediaTypes;
  +        Vector medias = new Vector();
  +        Iterator i = mediaTypes.iterator();
  +
  +        while(i.hasNext())
  +        {
  +            String name = (String)i.next();
  +            BaseMediaType media = new BaseMediaType();
  +            media.setRef(name);
  +            medias.add(media);
  +        }
  +        
  +        return medias;
       }
   
       /** Needed for Castor 0.8.11 XML serialization for setting the 
  @@ -250,7 +318,16 @@
        */
       public void setMediaTypes(Vector medias)
       {
  -        this.mediaTypes = mediaTypes;
  +        // clear all the media types stored
  +        this.mediaTypes.clear();
  +        
  +        //store only the media types name
  +        Iterator i = medias.iterator();
  +        while(i.hasNext())
  +        {
  +            BaseMediaType media = (BaseMediaType)i.next();
  +            this.mediaTypes.add( media.getRef() );
  +        }
       }
   
       /** This method recreates the paramter name index for quick retrieval
  
  
  
  1.1                  jakarta-jetspeed/src/java/org/apache/jetspeed/om/newregistry/base/BaseMediaType.java
  
  Index: BaseMediaType.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2000-2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, 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" and "Apache Software Foundation" and
   *     "Apache Jetspeed" 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" or
   *    "Apache Jetspeed", 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 (INCLUDING, 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.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  package org.apache.jetspeed.om.newregistry.base;
  
  /**
   * Utility object for serializing with Castor a MediaTypeEntry reference
   * 
   * @author <a href="mailto:raphael@apache.org">RaphaŽl Luta</a>
   * @version $Id: BaseMediaType.java,v 1.1 2001/05/08 14:21:46 raphael Exp $
   */
  public class BaseMediaType implements java.io.Serializable
  {
  
      private String name;
      
      /** @return the media type name that is referenced */
      public String getRef()
      {
          return this.name;
      }
                                  
      /** Sets the media type name referenced by this object
       * @param name the required media type name
       */
      public void setRef( String name )
      {
          this.name = name;
      }
  
  }
  
  
  

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


Mime
View raw message