taylor      2003/08/08 23:06:33

  Modified:    portal/src/java/org/apache/jetspeed/om/registry
                        ClientEntry.java MediaTypeEntry.java
               portal/src/sql/hsql create-db.sql drop-db.sql
               portal/src/webapp/WEB-INF/conf/ojb repository_jetspeed.xml
  Added:       portal/src/java/org/apache/jetspeed/om/registry
                        Capability.java MimeType.java
               portal/src/java/org/apache/jetspeed/om/registry/impl
                        CapabilityImpl.java ClientEntryImpl.java
                        MediaTypeEntryImpl.java MimeTypeImpl.java
  Removed:     portal/src/java/org/apache/jetspeed/capability
                        BaseCapabilityMap.java CapabilityMapFactory.java
               portal/src/java/org/apache/jetspeed/om/registry/base
                        BaseCapabilityMap.java BaseClientEntry.java
                        BaseMediaTypeEntry.java
  Log:
  Patch from Roger Ruttimann
  First phase of database-registry implementation of Media, Client, and Capability 
registries
  Includes OJB mapping for these registry classes
  The services will be committed in the next phase
  
  Revision  Changes    Path
  1.2       +24 -2     
jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/om/registry/ClientEntry.java
  
  Index: ClientEntry.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/om/registry/ClientEntry.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ClientEntry.java  28 Jul 2003 23:47:42 -0000      1.1
  +++ ClientEntry.java  9 Aug 2003 06:06:32 -0000       1.2
  @@ -53,6 +53,8 @@
    */
   package org.apache.jetspeed.om.registry;
   
  +import java.util.Vector;
  +
   /**
    * <P>
    * The <CODE>ClientEntry</CODE> interface represents one client inside
  @@ -66,6 +68,19 @@
   public interface ClientEntry extends RegistryEntry
   {
       /**
  +    * Set Client ID -- Assigns the Client ID
  +    * @param id
  +    */
  +    public void setClientId(int id);
  + 
  +    
  +       /**
  +    * Get Client ID
  +    * @return Client ID
  +    */
  +    public int getClientId();
  +       
  +    /**
        * Returns the pattern parameter of this client. The pattern is used
        * to match a client to the user agent used to access the portal. If
        * the pattern matches the user agent string, this client is recognized
  @@ -133,7 +148,13 @@
        * @return the MimeTypeMap
        * @see MimeTypeMap
        */
  -    public MimetypeMap getMimetypeMap();
  +    public Vector getMimetypes();
  +    
  +    /**
  +     * Set MimeTypes
  +     * @param mimetypes
  +     */
  +    public void setMimetypes(Vector mimetypes);
   
       /**
        * Returns all supported capablities as <CODE>CapabilityMap</CODE>.
  @@ -143,6 +164,7 @@
        * @return the CapabilityMap
        * @see CapabilityMap
        */
  -    public CapabilityMap getCapabilityMap();
  +    public Vector getCapabilities();
  +    public void setCapabilities(Vector capabilities);
   
   }
  
  
  
  1.2       +53 -11    
jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/om/registry/MediaTypeEntry.java
  
  Index: MediaTypeEntry.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/om/registry/MediaTypeEntry.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- MediaTypeEntry.java       28 Jul 2003 23:47:42 -0000      1.1
  +++ MediaTypeEntry.java       9 Aug 2003 06:06:32 -0000       1.2
  @@ -53,6 +53,8 @@
    */
   package org.apache.jetspeed.om.registry;
   
  +import java.util.Vector;
  +
   /**
    * This entry describes all the properties that should be present in
    * a RegistryEntry describing a MediaType
  @@ -65,15 +67,18 @@
    */
   public interface MediaTypeEntry extends RegistryEntry
   {
  -
  -    /** @return the mime type associated with this MediaType */
  -    public String getMimeType();
  -
  -    /** Sets the MimeType associated with this MediaType
  -     *  @param mimeType the MIME type to associate
  +    /**
  +     * Set MediaType ID -- Assigns ID
  +     * @param id
        */
  -    public void setMimeType( String mimeType );
  +    public void setMediatypeId(int id);
   
  +    /**
  +     * Get MediaType ID -- Return ID
  +     * @return MediaTypeID
  +     */
  +    public int getMediatypeId();
  +    
       /** @return the character set associated with this MediaType */
       public String getCharacterSet();
   
  @@ -85,8 +90,45 @@
        * The <CODE>CapabilityMap</CODE> contains all capabilities in arbitrary
        * order.
        *
  -     * @return the CapabilityMap
  -     * @see CapabilityMap
  +     * @return a vector of capabilities
  +     * 
  +     */
  +    public Vector getCapabilities();
  +    
  +    /**
  +     * Set the capabilities
  +     * @param vector of capabilities
        */
  -    public CapabilityMap getCapabilityMap();
  +    public void setCapabilities(Vector capabilities);
  +    
  +   /**
  +   * Returns all supported mimetypes as <CODE>MimeTypeMap</CODE>.
  +   * The <CODE>MimeTypeMap</CODE> contains all mimetypes in decreasing
  +   * order of importance.
  +   *
  +   * @return the MimeTypeMap
  +   * @see MimeTypeMap
  +   */
  +  public Vector getMimetypes();
  +  
  +  /**
  +   * Set mime types
  +   * @param mimetypes
  +   */
  +  public void setMimetypes(Vector mimetypes);
  +  
  +  /**
  +   *    removes the MimeType to the MimeType map 
  +   * @param name
  +   */
  +  
  +  public void removeMimetype(String name);
  +  
  +  /**
  +   * removes the MimeType to the MimeType map 
  +   * @param name
  +   */
  +  public void addMimetype(String name);
  +
  +    
   }
  
  
  
  1.1                  
jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/om/registry/Capability.java
  
  Index: Capability.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2000-2003 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 [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *    "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.registry;
  
  /**
   * Capability class.
   *
   * @author <a href="mailto:[EMAIL PROTECTED]">Roger Ruttimann</a>
   * @version $Id: Capability.java,v 1.1 2003/08/09 06:06:32 taylor Exp $
   */
  public interface Capability
  {
      /**
       * Set CapabilityId
       * 
       * @param id
       */
      public void setCapabilityId(int id);
      
      /**
       * Get CapabilityId
       * 
       * @return capabilityId
       */
      public int getCapabilityId();
      
      /**
       * Set Capability name
       * 
       * @param name
       */
      public void setName(String name);
      
      /**
       * Get CapabilityId
       * 
       * @return capability string
       */
      public String getName();
  
  }
  
  
  
  1.1                  
jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/om/registry/MimeType.java
  
  Index: MimeType.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2000-2003 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 [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *    "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.registry;
  
  /**
   * Mimetype class.
   *
   * @author <a href="mailto:[EMAIL PROTECTED]">Roger Ruttimann</a>
   * @version $Id: MimeType.java,v 1.1 2003/08/09 06:06:32 taylor Exp $
   */
  public interface MimeType
  {
      /**
       * Set MimetypeId
       * 
       * @param id
       */
      public void setMimetypeId(int id);
      
      /**
       * Get CapabilityId
       * 
       * @return capabilityId
       */
      public int getMimetypeId();
      
      /**
       * Set Capability name
       * 
       * @param name
       */
      public void setName(String name);
      
      /**
       * Get CapabilityId
       * 
       * @return capability string
       */
      public String getName();
  
  }
  
  
  1.1                  
jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/om/registry/impl/CapabilityImpl.java
  
  Index: CapabilityImpl.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2000-2003 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 [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *    "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.registry.impl;
  
  import org.apache.jetspeed.om.registry.Capability;
  
  /**
   * Capability implementation class.
   *
   * @author <a href="mailto:[EMAIL PROTECTED]">Roger Ruttimann</a>
   * @version $Id: CapabilityImpl.java,v 1.1 2003/08/09 06:06:33 taylor Exp $
   */
  
  public class CapabilityImpl implements Capability
  {
      private int capabilityId;
      private String name;
  
      /* (non-Javadoc)
       * @see org.apache.jetspeed.om.registry.Capability#setCapabilityId(int)
       */
      public void setCapabilityId(int id)
      {
          this.capabilityId = id;
      }
  
      /* (non-Javadoc)
       * @see org.apache.jetspeed.om.registry.Capability#getCapabilityId()
       */
      public int getCapabilityId()
      {
          return this.capabilityId;
      }
  
      /* (non-Javadoc)
       * @see org.apache.jetspeed.om.registry.Capability#setName(java.lang.String)
       */
      public void setName(String name)
      {
          this.name = name;
      }
  
      /* (non-Javadoc)
       * @see org.apache.jetspeed.om.registry.Capability#getName()
       */
      public String getName()
      {
          return this.name;
      }
  
  }
  
  
  
  1.1                  
jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/om/registry/impl/ClientEntryImpl.java
  
  Index: ClientEntryImpl.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2000-2003 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 [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *    "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.registry.impl;
  
  import org.apache.jetspeed.om.registry.ClientEntry;
  import org.apache.jetspeed.om.registry.base.BaseRegistryEntry;
  import java.util.Vector;
  
  /**
   * Simple implementation of the ClientRegistry interface.
   *
   * @author <a href="[EMAIL PROTECTED]">Stephan Hesmer</a>
   * @author <a href="mailto:[EMAIL PROTECTED]">Rapha�l Luta</a>
   * @author <a href="mailto:[EMAIL PROTECTED]">Roger Ruttimann</a>
   * @version $Id: ClientEntryImpl.java,v 1.1 2003/08/09 06:06:33 taylor Exp $
   */
  public class ClientEntryImpl extends BaseRegistryEntry
      implements ClientEntry, java.io.Serializable
  {
      private String useragentpattern = "";
      private String manufacturer = "";
      private String model = "";
      private String version = "";
      private Vector mimetypes;
      private Vector capabilities;
      
      private int clientId;
  
      public ClientEntryImpl()
      {
      }
  
      
      /**
       * Implements the equals operation so that 2 elements are equal if
       * all their member values are equal.
       */
      public boolean equals(Object object)
      {
          if (object==null)
          {
              return false;
          }
  
          ClientEntryImpl obj = (ClientEntryImpl)object;
  
          if (useragentpattern!=null)
          {
              if (!useragentpattern.equals(obj.useragentpattern))
              {
                  return false;
              }
          }
          else
          {
              if (obj.useragentpattern!=null)
              {
                  return false;
              }
          }
  
          if (manufacturer!=null)
          {
              if (!manufacturer.equals(obj.manufacturer))
              {
                  return false;
              }
          }
          else
          {
              if (obj.manufacturer!=null)
              {
                  return false;
              }
          }
  
          if (model!=null)
          {
              if (!model.equals(obj.model))
              {
                  return false;
              }
          }
          else
          {
              if (obj.model!=null)
              {
                  return false;
              }
          }
  
          if (version!=null)
          {
              if (!version.equals(obj.version))
              {
                  return false;
              }
          }
          else
          {
              if (obj.version!=null)
              {
                  return false;
              }
          }
  
          if (!mimetypes.contains(obj.mimetypes))
          {
              return false;
          }
  
          if (!capabilities.contains(obj.capabilities))
          {
              return false;
          }
  
          return super.equals(object);
      }
  
      public String getUseragentpattern()
      {
          return useragentpattern;
      }
  
      public void setUseragentpattern(String useragentpattern)
      {
          this.useragentpattern = useragentpattern;
      }
  
      public String getManufacturer()
      {
          return manufacturer;
      }
  
      public void setManufacturer(String name)
      {
          manufacturer = name;
      }
  
      public String getModel()
      {
          return model;
      }
  
      public void setModel(String name)
      {
          model = name;
      }
  
      public String getVersion()
      {
          return version;
      }
  
      public void setVersion(String name)
      {
          version = name;
      }
  
  
      public Vector getMimetypes()
      {
          return mimetypes;
      }
  
      public void setMimetypes(Vector mimetypes)
      {
          this.mimetypes = mimetypes;
      }
  
      public Vector getCapabilities()
      {
          return capabilities;
      }
  
      public void setCapabilities(Vector capabilities)
      {
          this.capabilities = capabilities;
      }
      
      /**
       * Set Client ID -- Assigns the Client ID
       * @param id
       */
      public void setClientId(int id)
      {
          this.clientId = id;
      }
      
      /**
       * Get Client ID
       * @return Client ID
       */
      public int getClientId()
      {
          return this.clientId;
      }
  }
  
  
  
  1.1                  
jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/om/registry/impl/MediaTypeEntryImpl.java
  
  Index: MediaTypeEntryImpl.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2000-2003 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 [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *    "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.registry.impl;
  
  import org.apache.jetspeed.om.registry.MediaTypeEntry;
  import org.apache.jetspeed.om.registry.base.BaseRegistryEntry;
  import java.util.Vector;
  
  /**
   * Default bean like implementation of MediaTypeEntry interface
   * suitable for serializing with Castor
   *
   * @author <a href="mailto:[EMAIL PROTECTED]">Rapha�l Luta</a>
   * @version $Id: MediaTypeEntryImpl.java,v 1.1 2003/08/09 06:06:33 taylor Exp $
   */
  public class MediaTypeEntryImpl extends BaseRegistryEntry
      implements MediaTypeEntry
  {
      protected String characterSet;
      private Vector capabilities;
      private Vector mimetypes;
      private int mediatypeId;
  
      public MediaTypeEntryImpl()
      {}
  
      public MediaTypeEntryImpl(long id,
                                String name,
                                int _hidden,
                                String mimeType,
                                String title,
                                String description,
                                String image,
                                 String role)
      {
           this.mimetypes.add(mimeType);
      }
  
      /**
       * Implements the equals operation so that 2 elements are equal if
       * all their member values are equal.
       */
      public boolean equals(Object object)
      {
          if (object==null)
          {
              return false;
          }
  
          MediaTypeEntryImpl obj = (MediaTypeEntryImpl)object;
  
          if (mimetypes.isEmpty()!= true)
          {
              if ( !mimetypes.contains(obj.getMimetypes().firstElement()) )
              {
                  return false;
              }
          }
          else
          {
              if (obj.getMimetypes().isEmpty() == false)
              {
                  return false;
              }
          }
  
          if (characterSet!=null)
          {
              if (!characterSet.equals(obj.characterSet))
              {
                  return false;
              }
          }
          else
          {
              if (obj.characterSet!=null)
              {
                  return false;
              }
          }
  
          if (!capabilities.equals(obj.capabilities))
          {
              return false;
          }
  
          return super.equals(object);
      }
      
   
      /** @return the character set associated with this MediaType */
      public String getCharacterSet()
      {
          return this.characterSet;
      }
  
      /** Sets the character set associated with this MediaType */
      public void setCharacterSet( String charSet)
      {
          this.characterSet = charSet;
      }
  
      
      public Vector getCapabilities()
      {
          return this.capabilities;
      }
  
      public void setCapabilities(Vector capabilities)
      {
          this.capabilities = capabilities;
      }
      
      public Vector getMimetypes()
      {
          return this.mimetypes;
      }
      
      public void setMimetypes(Vector mimetypes)
      {
          this.mimetypes = mimetypes;
      }
      
      public void addMimetype(String name)
      {
          if (!mimetypes.contains(name))
          {
              mimetypes.add(name);
          }
      }
  
      public void removeMimetype(String name)
      {
          mimetypes.remove(name);
      }
      
      /**
       * Set MediaType ID -- Assigns ID
       * @param id
       */
      public void setMediatypeId(int id)
      {
          this.mediatypeId = id;
      }
  
      /**
       * Get MediaType ID -- Return ID
       * @return MediaTypeID
       */
      public int getMediatypeId()
      {
          return this.mediatypeId;
      }
  
  }
  
  
  
  1.1                  
jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/om/registry/impl/MimeTypeImpl.java
  
  Index: MimeTypeImpl.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2000-2003 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 [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *    "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.registry.impl;
  
  import org.apache.jetspeed.om.registry.MimeType;
  
  
  /**
   * Mimetype implementation class.
   *
   * @author <a href="mailto:[EMAIL PROTECTED]">Roger Ruttimann</a>
   * @version $Id: MimeTypeImpl.java,v 1.1 2003/08/09 06:06:33 taylor Exp $
   */
  
  public class MimeTypeImpl implements MimeType
  {
      private int mimeTypeId;
      private String name;
  
      /* (non-Javadoc)
       * @see org.apache.jetspeed.om.registry.MimeType#setMimetypeId(int)
       */
      public void setMimetypeId(int id)
      {
        this.mimeTypeId = id;
      }
  
      /* (non-Javadoc)
       * @see org.apache.jetspeed.om.registry.MimeType#getMimetypeId()
       */
      public int getMimetypeId()
      {
          return this.mimeTypeId;
      }
  
      /* (non-Javadoc)
       * @see org.apache.jetspeed.om.registry.MimeType#setName(java.lang.String)
       */
      public void setName(String name)
      {
          this.name = name;
      }
  
      /* (non-Javadoc)
       * @see org.apache.jetspeed.om.registry.MimeType#getName()
       */
      public String getName()
      {
          return this.name;
      }
  
  }
  
  
  
  1.6       +77 -0     jakarta-jetspeed-2/portal/src/sql/hsql/create-db.sql
  
  Index: create-db.sql
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/sql/hsql/create-db.sql,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- create-db.sql     8 Aug 2003 21:59:53 -0000       1.5
  +++ create-db.sql     9 Aug 2003 06:06:33 -0000       1.6
  @@ -145,4 +145,81 @@
       LOCALE_STRING VARCHAR(50) NOT NULL
   );
   
  +------------------------------------------------------------------------------
  +-- Tables for Capability mapping
  +------------------------------------------------------------------------------
  +
  +-----------------------------------------------------------------------------
  +-- Media Type
  +------------------------------------------------------------------------------
  +
  +CREATE TABLE MEDIA_TYPE(
  +     MEDIATYPE_ID INTEGER NOT NULL PRIMARY KEY,
  +     NAME VARCHAR(80) NOT NULL,
  +     CHARACTER_SET VARCHAR(40),
  +     TITLE VARCHAR(80),
  +     DESCRIPTION LONGVARCHAR
  +);
  +
  +------------------------------------------------------------------------------
  +-- Client
  +------------------------------------------------------------------------------
  +
  +CREATE TABLE CLIENT(
  +     CLIENT_ID INTEGER NOT NULL PRIMARY KEY,
  +     NAME VARCHAR(80) NOT NULL,
  +     USER_AGENT_PATTERN VARCHAR (128),
  +     MANUFACTURER VARCHAR (80),
  +     MODEL VARCHAR(80),
  +     VERSION VARCHAR(40)
  +);
  +
  +------------------------------------------------------------------------------
  +-- Mimetype
  +------------------------------------------------------------------------------
  +
  +CREATE TABLE MIMETYPE(
  +     MIMETYPE_ID INTEGER NOT NULL PRIMARY KEY,
  +     NAME VARCHAR(80) NOT NULL
  +);
  +
  +------------------------------------------------------------------------------
  +-- Capability
  +------------------------------------------------------------------------------
  +
  +CREATE TABLE  CAPABILITY(
  +     CAPABILITY_ID INTEGER NOT NULL PRIMARY KEY,
  +     CAPABILITY VARCHAR(80) NOT NULL
  +);
  +
  +------------------------------------------------------
  +-- Client association
  +------------------------------------------------------
  +CREATE TABLE  CLIENT_TO_CAPABILITY(
  +
  +     CLIENT_ID INTEGER NOT NULL,
  +     CAPABILITY_ID INTEGER NOT NULL
  +);
  +
  +
  +CREATE TABLE  CLIENT_TO_MIMETYPE(
  +     CLIENT_ID INTEGER NOT NULL,
  +     MIMETYPE_ID INTEGER NOT NULL
  +);
  +
  +----------------------------------------------------
  +-- Media Type association
  +----------------------------------------------------
  +CREATE TABLE  MEDIATYPE_TO_CAPABILITY(
  +
  +     MEDIATYPE_ID INTEGER NOT NULL,
  +     CAPABILITY_ID INTEGER NOT NULL
  +);
  +
  +
  +CREATE TABLE  MEDIATYPE_TO_MIMETYPE(
  +     MEDIATYPE_ID INTEGER NOT NULL,
  +     MIMETYPE_ID INTEGER NOT NULL
  +);
  +
   
  
  
  
  1.4       +11 -1     jakarta-jetspeed-2/portal/src/sql/hsql/drop-db.sql
  
  Index: drop-db.sql
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/sql/hsql/drop-db.sql,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- drop-db.sql       1 Aug 2003 20:14:46 -0000       1.3
  +++ drop-db.sql       9 Aug 2003 06:06:33 -0000       1.4
  @@ -27,7 +27,17 @@
   DROP TABLE OJB_DSET IF EXISTS 
   DROP TABLE OJB_DSET_ENTRIES IF EXISTS 
   DROP TABLE OJB_DMAP IF EXISTS 
  -DROP TABLE OJB_DMAP_ENTRIES IF EXISTS 
  +DROP TABLE OJB_DMAP_ENTRIES IF EXISTS
  +
  +DROP TABLE CAPABILITY IF EXISTS
  +DROP TABLE MIMETYPE IF EXISTS
  +DROP TABLE CLIENT IF EXISTS
  +DROP TABLE MEDIA_TYPE IF EXISTS
  +
  +DROP TABLE CLIENT_TO_CAPABILITY IF EXISTS
  +DROP TABLE CLIENT_TO_MIMETYPE IF EXISTS
  +DROP TABLE MEDIATYPE_TO_CAPABILITY IF EXISTS
  +DROP TABLE MEDIATYPE_TO_MIMETYPE IF EXISTS
   
   
   
  
  
  
  1.7       +180 -2    
jakarta-jetspeed-2/portal/src/webapp/WEB-INF/conf/ojb/repository_jetspeed.xml
  
  Index: repository_jetspeed.xml
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed-2/portal/src/webapp/WEB-INF/conf/ojb/repository_jetspeed.xml,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- repository_jetspeed.xml   8 Aug 2003 14:21:53 -0000       1.6
  +++ repository_jetspeed.xml   9 Aug 2003 06:06:33 -0000       1.7
  @@ -716,7 +716,185 @@
         
     
       </class-descriptor>
  -
  -   
       
  +    
  +<!--
  +   - C A P A B I L I T Y  M A P P I N G
  +-->  
   
  +<!--
  +   - M E D I A T Y P E
  +  -->
  +    <class-descriptor
  +       class="org.apache.jetspeed.om.registry.impl.MediaTypeEntryImpl"
  +       table="MEDIA_TYPE"
  +   >
  +      
  +        <field-descriptor
  +         name="MediatypeId"
  +         column="MEDIATYPE_ID"
  +         jdbc-type="INTEGER"
  +         primarykey="true"
  +         autoincrement="true"            
  +      />
  +      
  +      <field-descriptor
  +         name="Name"
  +         column="NAME"
  +         jdbc-type="VARCHAR"     
  +      />
  +           
  +      <field-descriptor
  +         name="CharacterSet"
  +         column="CHARACTER_SET"
  +         jdbc-type="VARCHAR"
  +      />   
  +      
  +      <field-descriptor
  +         name="Title"
  +         column="TITLE"
  +         jdbc-type="VARCHAR"
  +      />  
  +      
  +      <field-descriptor
  +         name="Description"
  +         column="DESCRIPTION"
  +         jdbc-type="VARCHAR"
  +      /> 
  +      
  +      <collection-descriptor
  +          name="Capabilities"
  +          element-class-ref="org.apache.jetspeed.om.registry.impl.CapabilityImpl"
  + 
  +          indirection-table="MEDIATYPE_TO_CAPABILITY"
  +       >
  +          <fk-pointing-to-this-class column="MEDIATYPE_ID"/>
  +          <fk-pointing-to-element-class column="CAPABILITY_ID"/>
  +       </collection-descriptor>
  +       
  +       <collection-descriptor
  +          name="Mimetypes"
  +          element-class-ref="org.apache.jetspeed.om.registry.impl.MimeTypeImpl"
  + 
  +          indirection-table="MEDIATYPE_TO_MIMETYPE"
  +       >
  +          <fk-pointing-to-this-class column="MEDIATYPE_ID"/>
  +          <fk-pointing-to-element-class column="MIMETYPE_ID"/>
  +       </collection-descriptor>
  +      
  +      </class-descriptor>
  +             
  +  <!--
  +   - C L I E N T
  +  -->
  +    <class-descriptor
  +       class="org.apache.jetspeed.om.registry.impl.ClientEntryImpl"
  +       table="CLIENT"
  +   >
  +        <field-descriptor
  +         name="ClientId"
  +         column="CLIENT_ID"
  +         jdbc-type="INTEGER"
  +         primarykey="true"
  +         autoincrement="true"         
  +       />
  +      
  +        <field-descriptor
  +         name="Name"
  +         column="NAME"
  +         jdbc-type="VARCHAR"     
  +      />
  +      
  +      <field-descriptor
  +         name="Useragentpattern"
  +         column="USER_AGENT_PATTERN"
  +         jdbc-type="VARCHAR"     
  +      />
  +      
  +      <field-descriptor
  +         name="Manufacturer"
  +         column="MANUFACTURER"
  +         jdbc-type="VARCHAR"     
  +      />
  +      
  +      <field-descriptor
  +         name="Model"
  +         column="MODEL"
  +         jdbc-type="VARCHAR"     
  +      />
  +      
  +      <field-descriptor
  +         name="Version"
  +         column="VERSION"
  +         jdbc-type="VARCHAR"     
  +      />
  +      
  +      <collection-descriptor
  +          name="Capabilities"
  +          element-class-ref="org.apache.jetspeed.om.registry.impl.CapabilityImpl"
  + 
  +          indirection-table="MEDIATYPE_TO_CAPABILITY"
  +       >
  +          <fk-pointing-to-this-class column="MEDIATYPE_ID"/>
  +          <fk-pointing-to-element-class column="CAPABILITY_ID"/>
  +       </collection-descriptor>
  +       
  +       <collection-descriptor
  +          name="Mimetypes"
  +          element-class-ref="org.apache.jetspeed.om.registry.impl.MimeTypeImpl"
  + 
  +          indirection-table="MEDIATYPE_TO_MIMETYPE"
  +       >
  +          <fk-pointing-to-this-class column="MEDIATYPE_ID"/>
  +          <fk-pointing-to-element-class column="MIMETYPE_ID"/>
  +       </collection-descriptor>
  +      
  +    </class-descriptor>
  +
  +<!--
  +   - M I M E T Y P E 
  +  -->
  +    <class-descriptor
  +       class="org.apache.jetspeed.om.registry.impl.MimeTypeImpl"
  +       table="MIMETYPE"
  +   >
  +        <field-descriptor
  +         name="MimetypeId"
  +         column="MIMETYPE_ID"
  +         jdbc-type="INTEGER"
  +         primarykey="true"
  +         autoincrement="true"         
  +      />
  +      
  +      
  +      <field-descriptor
  +         name="name"
  +         column="NAME"
  +         jdbc-type="VARCHAR"
  +      />  
  +    </class-descriptor>
  +    
  +<!--
  +   - C A P A B I L I T Y
  +  -->
  +    <class-descriptor
  +       class="org.apache.jetspeed.om.registry.impl.CapabilityImpl"
  +       table="CAPABILITY"
  +   >
  +        <field-descriptor
  +         name="CapabilityId"
  +         column="CAPABILITY_ID"
  +         jdbc-type="INTEGER"
  +         primarykey="true"
  +         autoincrement="true"         
  +      />
  +      
  +       <field-descriptor
  +         name="Name"
  +         column="CAPABILITY"
  +         jdbc-type="VARCHAR"     
  +      />
  +      
  +    </class-descriptor>
  +   
  +  
  \ No newline at end of file
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to