Bugzilla is not setup for Jetspeed-2 and for this reason I send patches for
the stuff I'm working on to the dev list.

The following patches includes the classes and the schema updates for
storing the Media Types (Capabilities/MimeType) in the database using OJB.

I had some troubles to create patches for new directories & files. I had to
include them as zipped files.

ZIP files:
om-registry-impl.zip contains files that go into new folder
jetspeed.om.registry.impl
Interfaces.zip            contains two new interfaces Capability and
MimeType

Patches:
om-registry.txt        patches the registry files
sql-hsql.txt                patch for schema update
WEB_INF-OJB.txt    patches for mapping file update

Important: The following two files need to be deleted from the
jetspeed.capability directory:
                BaseCapabilityMap.java
                CapabilityMapFactory.java

Seems like a lot of manual steps but I couldn't find a "less-painful" way.

Roger
Index: hsql/create-db.sql
===================================================================
RCS file: /home/cvspublic/jakarta-jetspeed-2/portal/src/sql/hsql/create-db.sql,v
retrieving revision 1.5
diff -u -r1.5 create-db.sql
--- hsql/create-db.sql  8 Aug 2003 21:59:53 -0000       1.5
+++ hsql/create-db.sql  9 Aug 2003 00:24:39 -0000
@@ -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
+);
+
 
Index: hsql/drop-db.sql
===================================================================
RCS file: /home/cvspublic/jakarta-jetspeed-2/portal/src/sql/hsql/drop-db.sql,v
retrieving revision 1.3
diff -u -r1.3 drop-db.sql
--- hsql/drop-db.sql    1 Aug 2003 20:14:46 -0000       1.3
+++ hsql/drop-db.sql    9 Aug 2003 00:24:39 -0000
@@ -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
 
 
 
? registry/Capability.java
? registry/MimeType.java
? registry/impl
Index: registry/ClientEntry.java
===================================================================
RCS file: 
/home/cvspublic/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/om/registry/ClientEntry.java,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 ClientEntry.java
--- registry/ClientEntry.java   28 Jul 2003 23:47:42 -0000      1.1.1.1
+++ registry/ClientEntry.java   9 Aug 2003 04:43:49 -0000
@@ -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);
 
 }
Index: registry/MediaTypeEntry.java
===================================================================
RCS file: 
/home/cvspublic/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/om/registry/MediaTypeEntry.java,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 MediaTypeEntry.java
--- registry/MediaTypeEntry.java        28 Jul 2003 23:47:42 -0000      1.1.1.1
+++ registry/MediaTypeEntry.java        9 Aug 2003 04:43:50 -0000
@@ -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);
+
+    
 }

Attachment: om-registry-impl.zip
Description: Zip compressed data

Attachment: Interfaces.zip
Description: Zip compressed data

Index: ojb/repository_jetspeed.xml
===================================================================
RCS file: 
/home/cvspublic/jakarta-jetspeed-2/portal/src/webapp/WEB-INF/conf/ojb/repository_jetspeed.xml,v
retrieving revision 1.6
diff -u -r1.6 repository_jetspeed.xml
--- ojb/repository_jetspeed.xml 8 Aug 2003 14:21:53 -0000       1.6
+++ ojb/repository_jetspeed.xml 9 Aug 2003 05:01:29 -0000
@@ -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