portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tay...@apache.org
Subject cvs commit: jakarta-jetspeed/src/java/org/apache/jetspeed/services/registry DatabaseRegistryService.java TestRegistryPersistence.java
Date Mon, 01 Apr 2002 23:16:54 GMT
taylor      02/04/01 15:16:54

  Modified:    src/java/org/apache/jetspeed/om/registry RegistryEntry.java
               src/java/org/apache/jetspeed/om/registry/base
                        BaseMediaTypeEntry.java BaseMetaInfo.java
                        BaseRegistryEntry.java BaseSecurity.java
  Added:       src/java/org/apache/jetspeed/om/registry/base
                        DatabaseRegistry.java
               src/java/org/apache/jetspeed/services JetspeedDatabase.java
               src/java/org/apache/jetspeed/services/db
                        JetspeedDatabaseService.java
                        ObjectBridgeDatabaseService.java
               src/java/org/apache/jetspeed/services/db/conf OJB.properties
                        repository.dtd repository.xml
               src/java/org/apache/jetspeed/services/registry
                        DatabaseRegistryService.java
                        TestRegistryPersistence.java
  Log:
  - Phase One of Registry-in-database feature implemented with OJB. still have a few registries left to implement.
    I am going to put this on hold for a week or two. Still need to write registry browsers and form editors in order
    to use this feature. Thus far, it looks like OJB is capable of fully modeling the registry in a database.
  
  Revision  Changes    Path
  1.7       +7 -2      jakarta-jetspeed/src/java/org/apache/jetspeed/om/registry/RegistryEntry.java
  
  Index: RegistryEntry.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/om/registry/RegistryEntry.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- RegistryEntry.java	26 Mar 2002 09:06:53 -0000	1.6
  +++ RegistryEntry.java	1 Apr 2002 23:16:53 -0000	1.7
  @@ -62,11 +62,16 @@
    * 
    * @author <a href="mailto:raphael@apache.org">RaphaŽl Luta</a>
    * @author <a href="mailto:burton@apache.org">Kevin A. Burton</a>
  - * @version $Id: RegistryEntry.java,v 1.6 2002/03/26 09:06:53 taylor Exp $
  + * @version $Id: RegistryEntry.java,v 1.7 2002/04/01 23:16:53 taylor Exp $
    */
   public interface RegistryEntry
   {
  -    
  +    /**
  +     * @return the id of this entry. This value should be unique within its
  +     * registry class.
  +     */
  +    public long getId();
  +        
       /**
        * @return the name of this entry. This value should be unique within its
        * registry class.
  
  
  
  1.2       +21 -2     jakarta-jetspeed/src/java/org/apache/jetspeed/om/registry/base/BaseMediaTypeEntry.java
  
  Index: BaseMediaTypeEntry.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/om/registry/base/BaseMediaTypeEntry.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- BaseMediaTypeEntry.java	29 Jul 2001 13:41:54 -0000	1.1
  +++ BaseMediaTypeEntry.java	1 Apr 2002 23:16:53 -0000	1.2
  @@ -61,14 +61,33 @@
    * suitable for serializing with Castor
    * 
    * @author <a href="mailto:raphael@apache.org">RaphaŽl Luta</a>
  - * @version $Id: BaseMediaTypeEntry.java,v 1.1 2001/07/29 13:41:54 raphael Exp $
  + * @version $Id: BaseMediaTypeEntry.java,v 1.2 2002/04/01 23:16:53 taylor Exp $
    */
   public class BaseMediaTypeEntry extends BaseRegistryEntry
       implements MediaTypeEntry
   {
   
  -    private String mimeType;
  +    protected String mimeType;
       
  +    public BaseMediaTypeEntry()
  +    {}
  +
  +    public BaseMediaTypeEntry(long id, 
  +                              String name, 
  +                              int _hidden, 
  +                              String mimeType,
  +                              String title,
  +                              String description,
  +                              String image,
  +                               String role)
  +    {
  +        super(id, name, _hidden, title, description, image, role);
  +
  +        this.mimeType = mimeType;
  +    }
  +
  +
  +
       /** @return the mime type associated with this MediaType */
       public String getMimeType()
       {
  
  
  
  1.2       +11 -1     jakarta-jetspeed/src/java/org/apache/jetspeed/om/registry/base/BaseMetaInfo.java
  
  Index: BaseMetaInfo.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/om/registry/base/BaseMetaInfo.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- BaseMetaInfo.java	29 Jul 2001 13:41:54 -0000	1.1
  +++ BaseMetaInfo.java	1 Apr 2002 23:16:53 -0000	1.2
  @@ -62,7 +62,7 @@
    * 
    * @see org.apache.jetspeed.om.registry.MetaInfo
    * @author <a href="mailto:raphael@apache.org">RaphaŽl Luta</a>
  - * @version $Id: BaseMetaInfo.java,v 1.1 2001/07/29 13:41:54 raphael Exp $
  + * @version $Id: BaseMetaInfo.java,v 1.2 2002/04/01 23:16:53 taylor Exp $
    */
   public class BaseMetaInfo implements MetaInfo, java.io.Serializable
   {     
  @@ -71,6 +71,16 @@
       private String description;
            
       private String image;
  +
  +    public BaseMetaInfo()
  +    {}
  +
  +    public BaseMetaInfo(String title, String description, String image)
  +    {
  +        this.title = title;
  +        this.description = description;
  +        this.image = image;
  +    }
   
       /** @return the title for this entry */         
       public String getTitle()
  
  
  
  1.4       +53 -5     jakarta-jetspeed/src/java/org/apache/jetspeed/om/registry/base/BaseRegistryEntry.java
  
  Index: BaseRegistryEntry.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/om/registry/base/BaseRegistryEntry.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- BaseRegistryEntry.java	26 Mar 2002 09:06:53 -0000	1.3
  +++ BaseRegistryEntry.java	1 Apr 2002 23:16:53 -0000	1.4
  @@ -63,18 +63,48 @@
    * suitable for Castor XML serialization.
    * 
    * @author <a href="mailto:raphael@apache.org">RaphaŽl Luta</a>
  - * @version $Id: BaseRegistryEntry.java,v 1.3 2002/03/26 09:06:53 taylor Exp $
  + * @version $Id: BaseRegistryEntry.java,v 1.4 2002/04/01 23:16:53 taylor Exp $
    */
   public abstract class BaseRegistryEntry implements RegistryEntry, java.io.Serializable
   {
  +    protected long id = 0;
   
  -    private String name;
  +    protected String name;
       
  -    private MetaInfo metaInfo = null;
  +    protected MetaInfo metaInfo = null;
        
  -    private Security security = null;
  +    protected Security security = null;
        
  -    private boolean hidden;    
  +    protected boolean hidden;    
  +
  +    protected int _hidden;
  +
  +    public BaseRegistryEntry()
  +    {}
  +
  +    public BaseRegistryEntry(long id, 
  +                             String name, 
  +                             int _hidden, 
  +                             String title,
  +                             String description,
  +                             String image,
  +                             String role)
  +    {
  +        this.id = id;
  +        this.name = name;
  +        this._hidden = _hidden;
  +        this.hidden = (_hidden == 1);
  +        BaseMetaInfo meta = new BaseMetaInfo(title, description, image);
  +        this.setMetaInfo(meta);
  +        BaseSecurity security = new BaseSecurity(role);
  +        this.setSecurity(security);        
  +    }
  +
  +    /** @see RegistryEntry#getName */
  +    public long getId()
  +    {
  +        return this.id;
  +    }
       
       /** @see RegistryEntry#getName */
       public String getName()
  @@ -112,6 +142,7 @@
           }
           
           this.metaInfo.setTitle(title);
  +        this.description = description;
       }
   
       /** @see RegistryEntry#getDescription */
  @@ -136,6 +167,7 @@
           }
           
           this.metaInfo.setDescription(description);
  +        this.description = description;
       }
   
       /** @see RegistryEntry#getSecurity */
  @@ -148,6 +180,7 @@
       public void setSecurity( Security security )
       {
           this.security = security;
  +        this.role = this.security.getRole();
       }
   
       /** @see RegistryEntry#isHidden */
  @@ -160,6 +193,7 @@
       public void setHidden( boolean hidden )
       {
           this.hidden = hidden;
  +        this._hidden = (hidden) ? 1 : 0;
       }
       
       // Castor serialization methods
  @@ -186,6 +220,7 @@
       public void setBaseSecurity( BaseSecurity security )
       {
           this.security = security;
  +        this.role = this.security.getRole();
       }
   
       public MetaInfo getMetaInfo()
  @@ -199,6 +234,9 @@
       public void setMetaInfo( MetaInfo metaInfo )
       {
           this.metaInfo = metaInfo;
  +        this.title = metaInfo.getTitle();
  +        this.description = metaInfo.getDescription();
  +        this.image = metaInfo.getImage();
       }
   
       /** Required by Castor 0.8.11 XML serialization for retrieving the metainfo
  @@ -214,5 +252,15 @@
       public void setBaseMetaInfo( BaseMetaInfo metaInfo )
       {
           this.metaInfo = metaInfo;
  +        this.title = metaInfo.getTitle();
  +        this.description = metaInfo.getDescription();
  +        this.image = metaInfo.getImage();
       }
  +
  +
  +    // OJB - can't seem to get embedded objects to work without this hack
  +    String title;
  +    String description;
  +    String image;
  +    String role;
   }
  
  
  
  1.2       +10 -2     jakarta-jetspeed/src/java/org/apache/jetspeed/om/registry/base/BaseSecurity.java
  
  Index: BaseSecurity.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/om/registry/base/BaseSecurity.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- BaseSecurity.java	29 Jul 2001 13:41:55 -0000	1.1
  +++ BaseSecurity.java	1 Apr 2002 23:16:53 -0000	1.2
  @@ -62,13 +62,21 @@
    * 
    * @see org.apache.jetspeed.om.registry.Security
    * @author <a href="mailto:raphael@apache.org">RaphaŽl Luta</a>
  - * @version $Id: BaseSecurity.java,v 1.1 2001/07/29 13:41:55 raphael Exp $
  + * @version $Id: BaseSecurity.java,v 1.2 2002/04/01 23:16:53 taylor Exp $
    */
   public class BaseSecurity implements Security,java.io.Serializable
   {
   
       private String role;
  -    
  +            
  +    public BaseSecurity()
  +    {}
  +
  +    public BaseSecurity(String role)
  +    {
  +        this.role = role;
  +    }
  +
       /** @return the role name that is required for accessing this entry */
       public String getRole()
       {
  
  
  
  1.1                  jakarta-jetspeed/src/java/org/apache/jetspeed/om/registry/base/DatabaseRegistry.java
  
  Index: DatabaseRegistry.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.registry.base;
  
  import org.apache.jetspeed.om.registry.RegistryEntry;
  import org.apache.jetspeed.om.registry.Registry;
  import org.apache.jetspeed.om.registry.InvalidEntryException;
  
  /**
   * Provides base functionality within a Database Registry.
   *
   * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
   * @version $Id: DatabaseRegistry.java,v 1.1 2002/04/01 23:16:53 taylor Exp $
   */
  public class DatabaseRegistry extends BaseRegistry implements Registry
  {
                  
      /**
      @see Registry#setEntry
      */
      public void setEntry( RegistryEntry entry ) throws InvalidEntryException
      {
          // TODO: save it to the database here
  
          super.setEntry(entry);
  
          // TODO: notify other servers via jcs
      }
  
      /**
      @see Registry#addEntry
      */
      public void addEntry( RegistryEntry entry ) throws InvalidEntryException
      {
          // TODO: add it to the database here        
  
          super.addEntry(entry);
  
          // TODO: notify other servers via jcs
      }
     
      /**
      @see Registry#removeEntry
      */
      public void removeEntry( String name )
      {
          // TODO: add it to the database here        
  
          super.removeEntry(name);
  
          // TODO: notify other servers via jcs
      }
  
      /**
      @see Registry#removeEntry
      */
  
      public void removeEntry( RegistryEntry entry )
      {
          // TODO: add it to the database here        
  
          super.removeEntry(entry);
  
          // TODO: notify other servers via jcs
      }
  
  }
  
  
  1.1                  jakarta-jetspeed/src/java/org/apache/jetspeed/services/JetspeedDatabase.java
  
  Index: JetspeedDatabase.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.services;
  
  import org.apache.turbine.services.TurbineServices;
  import org.apache.jetspeed.services.db.*;
  
  /**
   * <P>This is a commodity static accessor class around the 
   * <code>JetspeedSecurityService</code></P>
   * 
   * @see org.apache.jetspeed.services.db.JetspeedDatabaseService
   * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
   * @version $Id: JetspeedDatabase.java,v 1.1 2002/04/01 23:16:53 taylor Exp $
   */
  
  abstract public class JetspeedDatabase 
  {
      /** 
       * Commodity method for getting a reference to the service
       * singleton
       */
      private static JetspeedDatabaseService getService()
      {
          return (JetspeedDatabaseService)TurbineServices
                  .getInstance()
                  .getService(JetspeedDatabaseService.SERVICE_NAME);
      }
  
      /**
       *  Returns a PersistenceManager for the default database service.
       *  When JDO implementations are available, this method should return a JDO PersistenceManager interface.
       *
       * @return A PersistenceManager instance.
       */
      public static Object getPersistenceManager()  // TODO: this should eventually be a JDO PersistenceManager, not an Object
      {
         return ((JetspeedDatabaseService)getService()).getPersistenceManager();
      }
  
  }
  
  
  1.1                  jakarta-jetspeed/src/java/org/apache/jetspeed/services/db/JetspeedDatabaseService.java
  
  Index: JetspeedDatabaseService.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.services.db;
  
  import org.apache.turbine.services.Service;
  
  /**
   * <P>This interface is a facade for all Jetspeed-DB related operations</P>
   * 
   * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
   * @version $Id: JetspeedDatabaseService.java,v 1.1 2002/04/01 23:16:53 taylor Exp $
   */
  
  public interface JetspeedDatabaseService extends Service
  {
   
      /** The name of this service */
      public String SERVICE_NAME = "JetspeedDatabase";
  
      /**
       *  Returns a PersistenceManager for the the configured database service.
       *  When JDO implementations are available, this method should return a JDO PersistenceManager interface.
       *
       * @return A PersistenceManager instance.
       */
      public Object getPersistenceManager();  // TODO: this should eventually be a JDO PersistenceManager, not an Object
  
  }
  
  
  1.1                  jakarta-jetspeed/src/java/org/apache/jetspeed/services/db/ObjectBridgeDatabaseService.java
  
  Index: ObjectBridgeDatabaseService.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.services.db;
  
  
  import javax.servlet.ServletConfig;
  
  // OJB
  import ojb.broker.PersistenceBroker;
  import ojb.broker.PersistenceBrokerFactory;
  
  
  // turbine.services
  import org.apache.turbine.services.Service;
  import org.apache.turbine.services.TurbineBaseService;
  import org.apache.turbine.services.TurbineServices;
  import org.apache.turbine.services.InitializationException;
  import org.apache.turbine.util.Log;
  
  
  /**
   * <p>This is an implementation of the <code>JetspeedDatabase</code> interface.
   *
   *
   * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
   * @version $Id: ObjectBridgeDatabaseService.java,v 1.1 2002/04/01 23:16:53 taylor Exp $
   */
  
  public class ObjectBridgeDatabaseService  extends TurbineBaseService
      implements JetspeedDatabaseService
  {
      PersistenceBroker pm = null;
  
      /**
       * This is the early initialization method called by the 
       * Turbine <code>Service</code> framework
       * @param conf The <code>ServletConfig</code>
       * @exception throws a <code>InitializationException</code> if the service
       * fails to initialize
       */
      public synchronized void init(ServletConfig conf) throws InitializationException {
  
          // already initialized
          if (getInit()) return;
  
          try
          {
              System.setProperty("OJB.properties", "org/apache/jetspeed/services/db/conf/OJB.properties");
              pm = PersistenceBrokerFactory.createPersistenceBroker("org/apache/jetspeed/services/db/conf/repository.xml");
          }
          catch (Exception e)
          {
              Log.error( "Failed to load ObjectBridge Manager: " + e.toString() );        
              throw new InitializationException(e.toString());
          }
          // initialization done
          setInit(true);
  
       }
  
  
      public Object getPersistenceManager()
      {
          return pm;
      }
  
      /**
       * This is the lateinitialization method called by the 
       * Turbine <code>Service</code> framework
       *
       * @exception throws a <code>InitializationException</code> if the service
       * fails to initialize
       */
      public void init() throws InitializationException {
          Log.info( "Late init for ObjectBridgeDatabaseService called" );        
      }
  
      /**
       * This is the shutdown method called by the 
       * Turbine <code>Service</code> framework
       */
      public void shutdown() 
      {
      }
  
  }
  
  
  1.1                  jakarta-jetspeed/src/java/org/apache/jetspeed/services/db/conf/OJB.properties
  
  Index: OJB.properties
  ===================================================================
  # OJB.properties -- configuration of the OJB runtime environment
  # (c) 2001, Th. Mahler
  #
  ###
  #
  # The repositoryFile entry tells OJB to use this fileas its standard mapping
  # repository. If no path is specified the file is looked up in the working
  # directory from that OJB was started.
  #
  repositoryFile=repository.xml
  #
  ###
  #
  # The useServer entry determines if OJB runs in single VM or in client/server
  # mode. The default value "false" launches single VM mode
  #
  useServer=false
  #useServer=true
  #
  ###
  #
  # The ConnectionFactoryClass entry determines which kind of ConnectionFactory
  # is to be used within OJB. A ConnectionFactory is responsible for creating
  # JDBC Connections. The default implementation supports two ways of obtaining
  # Connections:
  # 1. java.sql.DriverManager based construction
  # 2. Datasources lookup up from the JNDI initial context.
  # the proper way of obtaining a connection is configured in 
  # JDBCConnectionDescriptor entries in the repository.xml file.
  #
  ConnectionFactoryClass=ojb.broker.accesslayer.ConnectionFactoryDefaultImpl
  #
  ###
  #
  # The SequenceManagerClass entry determines the SequenceManager to be used
  # The default implementation is not very elaborated. Implement a better
  # version and tell OJB to use it here:
  #
  #SequenceManagerClass=ojb.broker.util.SequenceManagerDefaultImpl
  # this is Rainers HighLow SequenceManager:
  SequenceManagerClass=ojb.broker.util.SequenceManagerHighLowImpl
  #
  ###
  #
  # The SequenceManagerGrabSize entry determines the number IDs allocated
  # within each sequence. This parameter is useful only if you use the
  # ojb.broker.util.SequenceManagerHighLowImpl.
  #
  SequenceManagerGrabSize=10
  #
  ###
  #
  # The ObjectCacheClass entry tells OJB which concrete Cache implementation
  # is to be used.
  #
  ObjectCacheClass=ojb.broker.cache.ObjectCacheDefaultImpl
  #
  ###
  #
  # The LockManagerClass entry tells OJB which concrete LockManager
  # implementation is to be used.
  #
  LockManagerClass=ojb.odmg.locking.LockManagerDefaultImpl
  #
  ###
  #
  # The LockMapClass entry tells OJB which concrete LockMap
  # implementation is to be used.
  # If OJB is running in servermode it is recommended to use the
  # PersistentLockMapImpl. It guarantees to provide Lockamanagement across
  # multiple client JVMs.
  # If not running in OJB server mode (e.g. in desktop apps, or in a servlet
  # engine) it is save to use the InMemoryLockMapImpl. Using it will result
  # in a large performance gain.
  #
  # LockMapClass=ojb.odmg.locking.PersistentLockMapImpl
  LockMapClass=ojb.odmg.locking.InMemoryLockMapImpl
  #
  ###
  #
  # The LoggerClass entry tells OJB which concrete Logger
  # implementation is to be used.
  #
  LoggerClass=ojb.broker.util.PoorMansLoggerImpl
  
  # Bertrand implemented a log4j based logger:
  #LoggerClass=ojb.broker.util.Log4jLoggerImpl
  LoggerConfigFile=log4j.properties
  #
  ###
  #
  # The LogLevel entries tells OJB which LogLevels are active
  # for the different loggers used within OJB
  # Loglevels: DEBUG < INFO < WARN < ERROR < FATAL
  # That is loglevel WARN won't log DEBUG and INFO messages, 
  # but will log WARN, ERROR, and FATAL messages
  #
  # The Default Logger
  DEFAULT.LogLevel=WARN
  # Logger for PersistenceBrokerImpl class
  ojb.broker.singlevm.PersistenceBrokerImpl.LogLevel=WARN
  # Logger for PersistenceBrokerFactory class
  ojb.broker.PersistenceBrokerFactory.LogLevel=WARN
  # Logger for PersistenceBrokerClient
  ojb.broker.server.PersistenceBrokerClient.LogLevel=WARN
  # Logger for Serverside RequestProcessor
  ojb.broker.server.RequestProcessor.LogLevel=WARN
  # Logger for BrokerPool
  ojb.broker.server.BrokerPool.LogLevel=WARN
  # Logger for RepositoryXmlHandler, useful for debugging parsing of repository.xml!
  ojb.broker.metadata.RepositoryXmlHandler.LogLevel=WARN
  # Logger for JdbcAccess, useful for debugging JDBC related problems
  ojb.broker.accesslayer.JdbcAccess.LogLevel=WARN
  # Logger for RsIterator, useful for debugging problems with Object materialization
  ojb.broker.accesslayer.RsIterator.LogLevel=WARN
  # Logger for StatementsForClass, useful for debugging JDBC Connection related problems
  ojb.broker.accesslayer.StatementsForClass.LogLevel=WARN
  # Loger for SqlGenerator, useful for debugging generation of SQL
  ojb.broker.accesslayer.SqlGenerator.LogLevel=WARN
  # Logger for the ODMG Implementation
  ODMG.LogLevel=WARN
  # Logger for the performance tests
  performance.LogLevel=INFO
  # Logger for the soda api
  soda.LogLevel=WARN
  
  #
  ###
  #
  # The LockTimeout entry defines the maximum time in milliseconds
  # that a lock may be hold. Defaults to 60000 = 1 minute
  #
  LockTimeout=60000
  #
  ###
  #
  # The LockAssociations entry defines the behaviour for the OJB
  # implicit locking feature. If set to WRITE (default) acquiring a write-
  # lock on a given object x implies write locks on all objects associated
  # to x. If set to READ implicit read-locks are acquired.
  # Acquiring a read-lock on x thus allways results in implicit read-locks
  # on all associated objects.
  #
  LockAssociations=WRITE
  # LockAssociations=READ
  #
  #
  ###
  #
  # The OqlCollectionClass entry defines the collection type returned
  # from OQL queries. By default this value is set to DListImpl.
  # This will be good for most situations as DList allows maximum flexibility
  # in a ODMG environment.
  # Using DLists for large resultsets may be bad for application performance.
  # For these scenarios you can use ArrayLists or Vectors.
  # Important note: the collections class to be used MUST implement the
  # interface ojb.broker.ManageableCollection.
  #
  OqlCollectionClass=ojb.odmg.collections.DListImpl
  # OqlCollectionClass=ojb.broker.util.ManageableArrayList
  # OqlCollectionClass=ojb.broker.util.ManageableVector
  #
  #
  ###
  #
  # The BokerServers entry is only evaluated if useServer=true.
  # it declares a list of servers with their respective ports
  # on that OJB PersistenceBrokerServer processes are running.
  # The entries must be separated by commas.
  #
  BrokerServers=localhost\:2001
  # BrokerServers=stella\:2001,luna\:2001
  #
  ###
  #
  # The ServerThreadCount entry tells the PersistenceBrokerServer
  # how many worker threads have to be started initially.
  #
  ServerThreadCount=10
  #
  ###
  #
  # The BrokerPoolSize entry defines the number of PersistenceBrokers
  # that reside in the BrokerPool of the PersistenceBrokerServer
  #
  BrokerPoolSize=10
  #
  ###
  #
  # The ignoreAutoCommitExceptions entry defines if exceptions during
  # Connection.setAutoCommit(...) are ignored or not
  # The default is false. Setting this value to true will help you
  # using the JdbcOdbcBridge eg. for MS ACCESS.
  # ignoreAutoCommitExceptions=false
  ignoreAutoCommitExceptions=true
  #
  ###
  #
  # End of OJB.properties file
  
  
  
  
  
  
  
  
  
  
  
  1.1                  jakarta-jetspeed/src/java/org/apache/jetspeed/services/db/conf/repository.dtd
  
  Index: repository.dtd
  ===================================================================
  <!--
  	ObJectRelationalBridge - Bridging Java objects and relational dabatases
  
  	This DTD describes the grammar of the Descriptor repository
  
  	Author: Thomas Mahler, (c) 2000, 2001, 2002
  
  -->
  <!ELEMENT MappingRepository (JdbcConnectionDescriptor, ClassDescriptor+)>
  <!ELEMENT JdbcConnectionDescriptor (dbms.name, jdbc.level?, ((driver.name, url.protocol, url.subprotocol, url.dbalias) | datasource.name), user.name?, user.passwd?)>
  <!ELEMENT ClassDescriptor (ExtentDescriptor|(JdbcConnectionDescriptor?,  class.name, class.proxy?, class.extent*, schema.name?, table.name, orderby?, conversionStrategy?, rowReader?, FieldDescriptor+, ReferenceDescriptor*, CollectionDescriptor*))>
  <!ELEMENT FieldDescriptor (field.name, column.name, jdbc_type, PrimaryKey?, autoincrement?, locking?)>
  <!ELEMENT ReferenceDescriptor (rdfield.name, referenced.class, fk_descriptor_ids, auto.retrieve?, auto.update?, auto.delete?, refreshReference? )>
  <!ELEMENT CollectionDescriptor (cdfield.name, items.class, inverse_fk_descriptor_ids, collection.class?, proxy?, auto.retrieve?, auto.update?, auto.delete?, indirection_table?, fks_pointing_to_this_class?, fks_pointing_to_items_class?, orderby?, refreshCollection?)>
  <!ELEMENT ExtentDescriptor (class.name, class.extent+)>
  <!ELEMENT dbms.name (#PCDATA)>
  <!ELEMENT jdbc.level (#PCDATA)>
  <!ELEMENT driver.name (#PCDATA)>
  <!ELEMENT url.protocol (#PCDATA)>
  <!ELEMENT url.subprotocol (#PCDATA)>
  <!ELEMENT url.dbalias (#PCDATA)>
  <!ELEMENT datasource.name (#PCDATA)>
  <!ELEMENT schema.name (#PCDATA)>
  <!ELEMENT user.name (#PCDATA)>
  <!ELEMENT user.passwd (#PCDATA)>
  <!ELEMENT class.name (#PCDATA)>
  <!ELEMENT class.proxy (#PCDATA)>
  <!ELEMENT table.name (#PCDATA)>
  <!ELEMENT field.name (#PCDATA)>
  <!ELEMENT column.name (#PCDATA)>
  <!ELEMENT jdbc_type (#PCDATA)>
  <!ELEMENT PrimaryKey (#PCDATA)>
  <!ELEMENT autoincrement (#PCDATA)>
  <!ELEMENT locking (#PCDATA)>
  <!ELEMENT rdfield.name (#PCDATA)>
  <!ELEMENT referenced.class (#PCDATA)>
  <!ELEMENT fk_descriptor_ids (#PCDATA)>
  <!ELEMENT inverse_fk_descriptor_ids (#PCDATA)>
  <!ELEMENT proxy (#PCDATA)>
  <!ELEMENT auto.retrieve (#PCDATA)>
  <!ELEMENT auto.update (#PCDATA)>
  <!ELEMENT auto.delete (#PCDATA)>
  <!ELEMENT cdfield.name (#PCDATA)>
  <!ELEMENT items.class (#PCDATA)>
  <!ELEMENT collection.class (#PCDATA)>
  <!ELEMENT indirection_table (#PCDATA)>
  <!ELEMENT fks_pointing_to_this_class (#PCDATA)>
  <!ELEMENT fks_pointing_to_items_class (#PCDATA)>
  <!ELEMENT class.extent (#PCDATA)>
  <!ELEMENT orderby (#PCDATA)>
  <!ELEMENT conversionStrategy (#PCDATA)>
  <!ELEMENT rowReader (#PCDATA)>
  <!ELEMENT refreshCollection (#PCDATA)>
  <!ELEMENT refreshReference (#PCDATA)>
  
  <!ATTLIST JdbcConnectionDescriptor id CDATA #IMPLIED>
  <!ATTLIST ClassDescriptor
  	id CDATA #IMPLIED
  	isolation CDATA #IMPLIED
  >
  <!ATTLIST FieldDescriptor id CDATA #IMPLIED>
  <!ATTLIST ReferenceDescriptor id CDATA #IMPLIED>
  <!ATTLIST CollectionDescriptor id CDATA #IMPLIED>
  
  <!ATTLIST orderby sort CDATA #IMPLIED>
  
  
  
  1.1                  jakarta-jetspeed/src/java/org/apache/jetspeed/services/db/conf/repository.xml
  
  Index: repository.xml
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  <!DOCTYPE MappingRepository SYSTEM "repository.dtd">
  
  <MappingRepository>
  <!-- The Default JDBC Connection. If a Class does not specify its own JDBC Connection,
       the Connection specified here will be used. -->
  
     <JdbcConnectionDescriptor id="default">
        <dbms.name>Oracle8i</dbms.name>
        <driver.name>oracle.jdbc.driver.OracleDriver</driver.name>
        <url.protocol>jdbc</url.protocol>
        <url.subprotocol>oracle:thin</url.subprotocol>
        <url.dbalias>jdbc:oracle:thin:@nirvana:1521:bluesun3</url.dbalias>
        <user.name>jetspeed</user.name>
        <user.passwd>jetspeed</user.passwd>
     </JdbcConnectionDescriptor>
     
     <!--JdbcConnectionDescriptor id="default">
        <dbms.name>JNDI Sample Entry</dbms.name>
        <datasource.name>jndi_lookup_name</datasource.name>
        <user.name>sa</user.name>
        <user.passwd></user.passwd>
     </JdbcConnectionDescriptor-->
  
     <!--JdbcConnectionDescriptor id="default">
        <dbms.name>InstantDB</dbms.name>
        <driver.name>com.lutris.instantdb.jdbc.idbDriver</driver.name>
        <url.protocol>jdbc</url.protocol>
        <url.subprotocol>idb</url.subprotocol>
        <url.dbalias>..\\setup\\demo.prp</url.dbalias>
     </JdbcConnectionDescriptor-->
  
     <!--JdbcConnectionDescriptor id="default">
        <dbms.name>Db2</dbms.name>
        <driver.name>COM.ibm.db2.jdbc.app.DB2Driver</driver.name>
        <url.protocol>jdbc</url.protocol>
        <url.subprotocol>db2</url.subprotocol>
        <url.dbalias>dbwte001</url.dbalias>
        <user.name>db2admin</user.name>
        <user.passwd>db2</user.passwd>
     </JdbcConnectionDescriptor-->
  
     <!--JdbcConnectionDescriptor id="default">
        <dbms.name>Oracle</dbms.name>
        <driver.name>oracle.jdbc.driver.OracleDriver</driver.name>
        <url.protocol>jdbc</url.protocol>
        <url.subprotocol>oracle:oci8</url.subprotocol>
        <url.dbalias>@(description=(address=(host=127.0.0.1)(protocol=tcp)(port=1521))(connect_data=(sid=orcl)))</url.dbalias>
        <user.name>scott</user.name>
        <user.passwd>tiger</user.passwd>
     </JdbcConnectionDescriptor-->
  
     <!--JdbcConnectionDescriptor id="default">
         <dbms.name>PostgreSQL</dbms.name>
         <driver.name>org.postgresql.Driver</driver.name>
         <url.protocol>jdbc</url.protocol>
         <url.subprotocol>postgresql</url.subprotocol>
         <url.dbalias>ojbdemodb</url.dbalias>
         <user.name>username</user.name>
         <user.passwd>passwd</user.passwd>
      </JdbcConnectionDescriptor-->
  
  
      <!--JdbcConnectionDescriptor id="default">
          <dbms.name>MySQL</dbms.name>
          <driver.name>org.gjt.mm.mysql.Driver</driver.name>
          <url.protocol>jdbc</url.protocol>
          <url.subprotocol>mysql</url.subprotocol>
          <url.dbalias>//localhost:3306/test</url.dbalias>
          <user.name>foo</user.name>
          <user.passwd>bar</user.passwd>
      </JdbcConnectionDescriptor-->
  
      <!--JdbcConnectionDescriptor id="default">
          <dbms.name>MsAccess</dbms.name>
          <jdbc.level>1.0</jdbc.level>
          <driver.name>sun.jdbc.odbc.JdbcOdbcDriver</driver.name>
          <url.protocol>jdbc</url.protocol>
          <url.subprotocol>odbc</url.subprotocol>
          <url.dbalias>OJB</url.dbalias>
      </JdbcConnectionDescriptor-->
  
      <!--JdbcConnectionDescriptor id="default">
          <dbms.name>Informix</dbms.name>
          <jdbc.level>1.0</jdbc.level>
          <driver.name>com.informix.XXX</driver.name>
          <url.protocol>jdbc</url.protocol>
          <url.subprotocol>XXX</url.subprotocol>
          <url.dbalias>XXX</url.dbalias>
      </JdbcConnectionDescriptor-->
  
  <!-- Definitions for org.apache.jetspeed.services.registry.base.BaseMediaTypeEntry -->
     <ClassDescriptor id="1">
        <class.name>org.apache.jetspeed.om.registry.base.BaseMediaTypeEntry</class.name>
        <table.name>MEDIATYPE</table.name>
        <FieldDescriptor id="1">
           <field.name>id</field.name>
           <column.name>id</column.name>
           <jdbc_type>BIGINT</jdbc_type>
           <PrimaryKey>true</PrimaryKey>
           <autoincrement>true</autoincrement>
        </FieldDescriptor>
        <FieldDescriptor id="2">
           <field.name>name</field.name>
           <column.name>name</column.name>
           <jdbc_type>VARCHAR</jdbc_type>
        </FieldDescriptor>
        <FieldDescriptor id="3">
           <field.name>_hidden</field.name>
           <column.name>hidden</column.name>
           <jdbc_type>INTEGER</jdbc_type>
        </FieldDescriptor>
        <FieldDescriptor id="4">
           <field.name>mimeType</field.name>
           <column.name>mimetype</column.name>
           <jdbc_type>VARCHAR</jdbc_type>
        </FieldDescriptor>
        <FieldDescriptor id="5">
           <field.name>title</field.name>
           <column.name>title</column.name>
           <jdbc_type>VARCHAR</jdbc_type>
        </FieldDescriptor>
        <FieldDescriptor id="6">
           <field.name>description</field.name>
           <column.name>description</column.name>
           <jdbc_type>VARCHAR</jdbc_type>
        </FieldDescriptor>
        <FieldDescriptor id="7">
           <field.name>image</field.name>
           <column.name>image</column.name>
           <jdbc_type>VARCHAR</jdbc_type>
        </FieldDescriptor>
        <FieldDescriptor id="8">
           <field.name>role</field.name>
           <column.name>role</column.name>
           <jdbc_type>VARCHAR</jdbc_type>
        </FieldDescriptor>
     </ClassDescriptor>
  
  <!-- Definitions for org.apache.jetspeed.services.registry.base.BaseSkinEntry -->
     <ClassDescriptor id="2">
        <class.name>org.apache.jetspeed.om.registry.base.BaseSkinEntry</class.name>
        <table.name>SKIN</table.name>
        <FieldDescriptor id="1">
           <field.name>id</field.name>
           <column.name>id</column.name>
           <jdbc_type>BIGINT</jdbc_type>
           <PrimaryKey>true</PrimaryKey>
           <autoincrement>true</autoincrement>
        </FieldDescriptor>
        <FieldDescriptor id="2">
           <field.name>name</field.name>
           <column.name>name</column.name>
           <jdbc_type>VARCHAR</jdbc_type>
        </FieldDescriptor>
        <FieldDescriptor id="3">
           <field.name>_hidden</field.name>
           <column.name>hidden</column.name>
           <jdbc_type>INTEGER</jdbc_type>
        </FieldDescriptor>
        <FieldDescriptor id="4">
           <field.name>title</field.name>
           <column.name>title</column.name>
           <jdbc_type>VARCHAR</jdbc_type>
        </FieldDescriptor>
        <FieldDescriptor id="5">
           <field.name>description</field.name>
           <column.name>description</column.name>
           <jdbc_type>VARCHAR</jdbc_type>
        </FieldDescriptor>
        <FieldDescriptor id="6">
           <field.name>image</field.name>
           <column.name>image</column.name>
           <jdbc_type>VARCHAR</jdbc_type>
        </FieldDescriptor>
        <FieldDescriptor id="7">
           <field.name>role</field.name>
           <column.name>role</column.name>
           <jdbc_type>VARCHAR</jdbc_type>
        </FieldDescriptor>
     </ClassDescriptor>
  
  
  <!-- OJB INTERNAL MAPPINGS START HERE, DO NOT EDIT -->
  
  <!-- The OJB SequenceManagerTable -->
     <ClassDescriptor id="1027">
        <class.name>ojb.broker.util.SequenceEntry</class.name>
        <table.name>OJB_SEQ</table.name>
        <FieldDescriptor id="1">
           <field.name>classname</field.name>
           <column.name>CLASSNAME</column.name>
           <jdbc_type>VARCHAR</jdbc_type>
           <PrimaryKey>true</PrimaryKey>
        </FieldDescriptor>
        <FieldDescriptor id="2">
           <field.name>fieldname</field.name>
           <column.name>FIELDNAME</column.name>
           <jdbc_type>VARCHAR</jdbc_type>
           <PrimaryKey>true</PrimaryKey>
        </FieldDescriptor>
        <FieldDescriptor id="3">
           <field.name>current</field.name>
           <column.name>LAST_NUM</column.name>
           <jdbc_type>INTEGER</jdbc_type>
        </FieldDescriptor>
     </ClassDescriptor>
  
  <!-- The OJB HIGH/LOW SequenceManagerTable -->
     <ClassDescriptor id="1099">
        <class.name>ojb.broker.util.HighLowSequence</class.name>
        <table.name>OJB_HL_SEQ</table.name>
        <FieldDescriptor id="1">
           <field.name>className</field.name>
           <column.name>CLASSNAME</column.name>
           <jdbc_type>VARCHAR</jdbc_type>
           <PrimaryKey>true</PrimaryKey>
        </FieldDescriptor>
        <FieldDescriptor id="2">
           <field.name>fieldName</field.name>
           <column.name>FIELDNAME</column.name>
           <jdbc_type>VARCHAR</jdbc_type>
           <PrimaryKey>true</PrimaryKey>
        </FieldDescriptor>
        <FieldDescriptor id="3">
           <field.name>maxKey</field.name>
           <column.name>MAX_KEY</column.name>
           <jdbc_type>INTEGER</jdbc_type>
        </FieldDescriptor>
        <FieldDescriptor id="4">
           <field.name>grabSize</field.name>
           <column.name>GRAB_SIZE</column.name>
           <jdbc_type>INTEGER</jdbc_type>
        </FieldDescriptor>
     </ClassDescriptor>
  
  
  
  <!-- The OJB Lock Table -->
     <ClassDescriptor id="1100">
        <class.name>ojb.odmg.locking.LockEntry</class.name>
        <table.name>OJB_LOCKENTRY</table.name>
        <FieldDescriptor id="1">
           <field.name>oidString</field.name>
           <column.name>OID_</column.name>
           <jdbc_type>VARCHAR</jdbc_type>
           <PrimaryKey>true</PrimaryKey>
        </FieldDescriptor>
        <FieldDescriptor id="2">
           <field.name>transactionId</field.name>
           <column.name>TX_ID</column.name>
           <jdbc_type>VARCHAR</jdbc_type>
           <PrimaryKey>true</PrimaryKey>
        </FieldDescriptor>
        <FieldDescriptor id="3">
           <field.name>timestamp</field.name>
           <column.name>TIMESTAMP_</column.name>
           <jdbc_type>BIGINT</jdbc_type>
        </FieldDescriptor>
        <FieldDescriptor id="4">
           <field.name>isolationLevel</field.name>
           <column.name>ISOLATIONLEVEL</column.name>
           <jdbc_type>INTEGER</jdbc_type>
        </FieldDescriptor>
        <FieldDescriptor id="5">
           <field.name>lockType</field.name>
           <column.name>LOCKTYPE</column.name>
           <jdbc_type>INTEGER</jdbc_type>
        </FieldDescriptor>
     </ClassDescriptor>
  
  
  <!-- THIS IS THE OJB NAMED ROOTS TABLE, DO NOT EDIT-->
     <ClassDescriptor id="1024">
        <class.name>ojb.odmg.NamedRootsEntry</class.name>
        <table.name>OJB_NRM</table.name>
        <FieldDescriptor id="1">
           <field.name>name</field.name>
           <column.name>NAME</column.name>
           <jdbc_type>VARCHAR</jdbc_type>
           <PrimaryKey>true</PrimaryKey>
        </FieldDescriptor>
        <FieldDescriptor id="2">
           <field.name>oid</field.name>
           <column.name>OID_</column.name>
           <jdbc_type>LONGVARBINARY</jdbc_type>
        </FieldDescriptor>
     </ClassDescriptor>
  
  <!-- THIS IS THE OJB DLIST IMPLEMENTATION, DO NOT EDIT-->
     <ClassDescriptor id="1025">
        <class.name>ojb.odmg.collections.DListImpl</class.name>
        <table.name>OJB_DLIST</table.name>
        <FieldDescriptor id="1">
           <field.name>id</field.name>
           <column.name>ID</column.name>
           <jdbc_type>INTEGER</jdbc_type>
           <PrimaryKey>true</PrimaryKey>
        </FieldDescriptor>
        <FieldDescriptor id="2">
           <field.name>size</field.name>
           <column.name>SIZE_</column.name>
           <jdbc_type>INTEGER</jdbc_type>
        </FieldDescriptor>
        <CollectionDescriptor id="1">
           <cdfield.name>elements</cdfield.name>
           <items.class>ojb.odmg.collections.DListEntry</items.class>
           <inverse_fk_descriptor_ids>2</inverse_fk_descriptor_ids>
           <auto.retrieve>true</auto.retrieve>
           <auto.update>false</auto.update>
           <auto.delete>false</auto.delete>
        </CollectionDescriptor>
     </ClassDescriptor>
  
  <!-- THIS IS THE OJB DLIST ENTRY IMPLEMENTATION, DO NOT EDIT-->
     <ClassDescriptor id="1026">
        <class.name>ojb.odmg.collections.DListEntry</class.name>
        <table.name>OJB_DLIST_ENTRIES</table.name>
        <orderby sort="ASC">position</orderby>
        <FieldDescriptor id="1">
           <field.name>id</field.name>
           <column.name>ID</column.name>
           <jdbc_type>INTEGER</jdbc_type>
           <PrimaryKey>true</PrimaryKey>
        </FieldDescriptor>
        <FieldDescriptor id="2">
           <field.name>dlistId</field.name>
           <column.name>DLIST_ID</column.name>
           <jdbc_type>INTEGER</jdbc_type>
        </FieldDescriptor>
        <FieldDescriptor id="3">
           <field.name>position</field.name>
           <column.name>POSITION_</column.name>
           <jdbc_type>INTEGER</jdbc_type>
        </FieldDescriptor>
        <FieldDescriptor id="4">
           <field.name>serializedOID</field.name>
           <column.name>OID_</column.name>
           <jdbc_type>LONGVARBINARY</jdbc_type>
        </FieldDescriptor>
     </ClassDescriptor>
  
     <!-- THIS IS THE OJB DBAG IMPLEMENTATION, DO NOT EDIT-->
     <ClassDescriptor id="1028">
        <class.name>ojb.odmg.collections.DBagImpl</class.name>
        <table.name>OJB_DLIST</table.name>
        <FieldDescriptor id="1">
           <field.name>id</field.name>
           <column.name>ID</column.name>
           <jdbc_type>INTEGER</jdbc_type>
           <PrimaryKey>true</PrimaryKey>
        </FieldDescriptor>
        <FieldDescriptor id="2">
           <field.name>size</field.name>
           <column.name>SIZE_</column.name>
           <jdbc_type>INTEGER</jdbc_type>
        </FieldDescriptor>
        <CollectionDescriptor id="1">
           <cdfield.name>elements</cdfield.name>
           <items.class>ojb.odmg.collections.DListEntry</items.class>
           <inverse_fk_descriptor_ids>2</inverse_fk_descriptor_ids>
           <auto.retrieve>true</auto.retrieve>
           <auto.update>false</auto.update>
           <auto.delete>false</auto.delete>
        </CollectionDescriptor>
     </ClassDescriptor>
  
  <!-- THIS IS THE OJB DSET IMPLEMENTATION, DO NOT EDIT-->
     <ClassDescriptor id="1029">
        <class.name>ojb.odmg.collections.DSetImpl</class.name>
        <table.name>OJB_DSET</table.name>
        <FieldDescriptor id="1">
           <field.name>id</field.name>
           <column.name>ID</column.name>
           <jdbc_type>INTEGER</jdbc_type>
           <PrimaryKey>true</PrimaryKey>
        </FieldDescriptor>
        <FieldDescriptor id="2">
           <field.name>size</field.name>
           <column.name>SIZE_</column.name>
           <jdbc_type>INTEGER</jdbc_type>
        </FieldDescriptor>
        <CollectionDescriptor id="1">
           <cdfield.name>elements</cdfield.name>
           <items.class>ojb.odmg.collections.DSetEntry</items.class>
           <inverse_fk_descriptor_ids>2</inverse_fk_descriptor_ids>
           <auto.retrieve>true</auto.retrieve>
           <auto.update>false</auto.update>
           <auto.delete>false</auto.delete>
        </CollectionDescriptor>
     </ClassDescriptor>
  
  <!-- THIS IS THE OJB DSET ENTRY IMPLEMENTATION, DO NOT EDIT-->
     <ClassDescriptor id="1030">
        <class.name>ojb.odmg.collections.DSetEntry</class.name>
        <table.name>OJB_DSET_ENTRIES</table.name>
        <orderby sort="ASC">position</orderby>
        <FieldDescriptor id="1">
           <field.name>id</field.name>
           <column.name>ID</column.name>
           <jdbc_type>INTEGER</jdbc_type>
           <PrimaryKey>true</PrimaryKey>
        </FieldDescriptor>
        <FieldDescriptor id="2">
           <field.name>dlistId</field.name>
           <column.name>DLIST_ID</column.name>
           <jdbc_type>INTEGER</jdbc_type>
        </FieldDescriptor>
        <FieldDescriptor id="3">
           <field.name>position</field.name>
           <column.name>POSITION_</column.name>
           <jdbc_type>INTEGER</jdbc_type>
        </FieldDescriptor>
        <FieldDescriptor id="4">
           <field.name>serializedOID</field.name>
           <column.name>OID_</column.name>
           <jdbc_type>LONGVARBINARY</jdbc_type>
        </FieldDescriptor>
     </ClassDescriptor>
  
  <!-- THIS IS THE OJB DMAP IMPLEMENTATION, DO NOT EDIT-->
     <ClassDescriptor id="1031">
        <class.name>ojb.odmg.collections.DMapImpl</class.name>
        <table.name>OJB_DMAP</table.name>
        <FieldDescriptor id="1">
           <field.name>id</field.name>
           <column.name>ID</column.name>
           <jdbc_type>INTEGER</jdbc_type>
           <PrimaryKey>true</PrimaryKey>
        </FieldDescriptor>
        <FieldDescriptor id="2">
           <field.name>size</field.name>
           <column.name>SIZE_</column.name>
           <jdbc_type>INTEGER</jdbc_type>
        </FieldDescriptor>
        <CollectionDescriptor id="1">
           <cdfield.name>entries</cdfield.name>
           <items.class>ojb.odmg.collections.DMapEntry</items.class>
           <inverse_fk_descriptor_ids>2</inverse_fk_descriptor_ids>
           <collection.class>ojb.broker.util.ManageableHashSet</collection.class>
           <auto.retrieve>true</auto.retrieve>
           <auto.update>false</auto.update>
           <auto.delete>false</auto.delete>
        </CollectionDescriptor>
     </ClassDescriptor>
  
  <!-- THIS IS THE OJB DMAP ENTRY IMPLEMENTATION, DO NOT EDIT-->
     <ClassDescriptor id="1032">
        <class.name>ojb.odmg.collections.DMapEntry</class.name>
        <table.name>OJB_DMAP_ENTRIES</table.name>
        <FieldDescriptor id="1">
           <field.name>id</field.name>
           <column.name>ID</column.name>
           <jdbc_type>INTEGER</jdbc_type>
           <PrimaryKey>true</PrimaryKey>
        </FieldDescriptor>
        <FieldDescriptor id="2">
           <field.name>dMapId</field.name>
           <column.name>DMAP_ID</column.name>
           <jdbc_type>INTEGER</jdbc_type>
        </FieldDescriptor>
        <FieldDescriptor id="3">
           <field.name>keySerializedOID</field.name>
           <column.name>KEY_OID</column.name>
           <jdbc_type>LONGVARBINARY</jdbc_type>
        </FieldDescriptor>
        <FieldDescriptor id="4">
           <field.name>valueSerializedOID</field.name>
           <column.name>VALUE_OID</column.name>
           <jdbc_type>LONGVARBINARY</jdbc_type>
        </FieldDescriptor>
     </ClassDescriptor>
  
  
     <!-- END OF OJB INTERNAL MAPPINGS-->
  </MappingRepository>
  
  
  1.1                  jakarta-jetspeed/src/java/org/apache/jetspeed/services/registry/DatabaseRegistryService.java
  
  Index: DatabaseRegistryService.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.services.registry;
  
  import java.util.Hashtable;
  import java.util.Enumeration;
  import org.apache.jetspeed.om.registry.*;
  import org.apache.jetspeed.om.registry.base.*;
  import javax.servlet.ServletConfig;
  
  //turbine stuff
  import org.apache.turbine.util.Log;
  import org.apache.turbine.services.*;
  import org.apache.turbine.services.servlet.TurbineServlet;
  import org.apache.turbine.services.resources.ResourceService;
  
  /**
   * <p>This is an implementation of the <code>RegistryService</code>
   * based on the Jetspeed Database Persistence Manager</p>
   *
   * <p>This service expects the following properties to be set for correct operation:
   * <dl>
   *    <dt>none</dt><dd></dd>
   *    
   * </dl>
   * </p>
   *
   * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
   * @version $Id: DatabaseRegistryService.java,v 1.1 2002/04/01 23:16:53 taylor Exp $
   */
  public class DatabaseRegistryService
          extends TurbineBaseService
          implements RegistryService 
  {
  
      /** regsitry type keyed list of entries */
      private Hashtable registries = new Hashtable();
                 
      
      /**
       * Returns a Registry object for further manipulation
       *
       * @param regName the name of the registry to fetch
       * @return a Registry object if found by the manager or null
       */
      public Registry get( String regName ) {
          return (Registry)registries.get( regName );       
      }
  
      /**
       *  List all the registry currently available to this service
       * 
       * @return an Enumeration of registry names.
       */
      public Enumeration getNames() {
          return registries.keys();
      }
      
      /**
       * Returns a RegistryEntry from the named Registry.
       * This is a convenience wrapper around {@link 
       * org.apache.jetspeed.om.registry.Registry#getEntry }
       *
       * @param regName the name of the registry
       * @param entryName the name of the entry to retrieve from the 
       *                  registry
       * @return a RegistryEntry object if the key is found or null
       */
      public RegistryEntry getEntry( String regName, String entryName ) {
          try {   
              return ((Registry)registries.get( regName )).getEntry( entryName );
          } catch ( RegistryException e ) {
              Log.info("Failed to retrieve "+entryName+" from "+regName);
          } catch ( NullPointerException e ) {
              Log.error(regName + " registry is not known ");
              Log.error( e );
          }
              
          return null;
      }
      
      /**
       * Add a new RegistryEntry in the named Registry.
       * This is a convenience wrapper around {@link 
       * org.apache.jetspeed.om.registry.Registry#addEntry }
       *
       * @param regName the name of the registry
       * @param entry the Registry entry to add
       * @exception Sends a RegistryException if the manager can't add
       *            the provided entry
       */
      public void addEntry(String regName, RegistryEntry entry) throws RegistryException
      {
          if (entry == null) 
          {
              return;
          }
          
          Registry registry = (Registry)registries.get( regName );
          
          if (registry!=null)
          {
              if (this.getEntry(regName, entry.getName())!=null)
              {
                  registry.setEntry(entry);
              }
              else
              {
                  registry.addEntry(entry);
              }
          }
      }
      
      /**
       * Deletes a RegistryEntry from the named Registry
       * This is a convenience wrapper around {@link 
       * org.apache.jetspeed.om.registry.Registry#removeEntry }
       *
       * @param regName the name of the registry
       * @param entryName the name of the entry to remove
       */
      public void removeEntry( String regName, String entryName )
      {
          if (entryName==null)
          {
              return;
          }
          
          Registry registry = (Registry)registries.get( regName );
          
          if (registry!=null)
          {           
              // the entry is physically removed, remove the dangling reference
              registry.removeEntry( entryName );
          }        
      }
          
      /**
       * This is the early initialization method called by the 
       * Turbine <code>Service</code> framework
       */
      public void init( ServletConfig conf ) throws InitializationException
      {
  
          ResourceService serviceConf = ((TurbineServices)TurbineServices.getInstance())
                                                       .getResources(RegistryService.SERVICE_NAME);
          
          // read the configuration keys
          try
          {
  
          }
          catch ( Throwable t )
          {
              throw new InitializationException( "Unable to initialize DatabaseRegistryService, missing config keys");
          }
                      
          //Mark that we are done
          setInit(true);
  
          // load the registries
          // TODO: write this
      }
  
  
      /** Late init method from Turbine Service model */
      public void init( ) throws InitializationException
      {
          Log.debug( "Late init for Registry called" );
          while( !getInit() )
          {
              //Not yet...
              try
              {
                  Thread.sleep( 500 );
                  Log.debug( "Waiting for init of Registry..." );
              }
              catch (InterruptedException ie )
              {
                  Log.error( ie );
              }
          }
          Log.debug( "We are done! (Registry)" );
      }
  
      
      /**
       * This is the shutdown method called by the 
       * Turbine <code>Service</code> framework
       */
      public void shutdown()
      {
      }
  
      
  }
  
  
  
  1.1                  jakarta-jetspeed/src/java/org/apache/jetspeed/services/registry/TestRegistryPersistence.java
  
  Index: TestRegistryPersistence.java
  ===================================================================
  package org.apache.jetspeed.services.registry;
  
  import java.util.Collection;
  import java.io.BufferedReader;
  import java.io.InputStreamReader;
  import java.util.Vector;
  
  // Junit imports
  import junit.framework.Test;
  import junit.framework.TestSuite;
  import junit.framework.TestCase;
  
  import org.apache.jetspeed.om.registry.*;
  import org.apache.jetspeed.om.registry.base.*;
  
  import ojb.broker.PersistenceBroker;
  import ojb.broker.PersistenceBrokerFactory;
  import ojb.broker.query.Query;
  import ojb.broker.query.QueryByCriteria;
  import ojb.broker.query.Criteria;
  
  import org.apache.stratum.configuration.Configuration;
  import org.apache.turbine.util.TurbineConfig;
  import org.apache.turbine.util.StringUtils;
  
  import org.apache.jetspeed.services.JetspeedDatabase;
  
  /**
   * TestRegistryPersistence
   *
   * @author <a href="taylor@apache.org">David Sean Taylor</a>
   * @version $Id: TestRegistryPersistence.java,v 1.1 2002/04/01 23:16:53 taylor Exp $
   */
  
  public class TestRegistryPersistence extends TestCase {    
  
      /**
       * Defines the testcase name for JUnit.
       *
       * @param name the testcase's name.
       */
      public TestRegistryPersistence( String name ) {
          super( name );
      }
      
      /**
       * Start the tests.
       *
       * @param args the arguments. Not used
       */
      public static void main(String args[]) {
          junit.awtui.TestRunner.main( new String[] { TestRegistryPersistence.class.getName() } );
      }
   
      public void setup() {
          System.out.println("Setup: Testing ObjectBridge");
       }
      /**
       * Creates the test suite.
       *
       * @return a test suite (<code>TestSuite</code>) that includes all methods
       *         starting with "test"
       */
      public static Test suite() {
          // All methods starting with "test" will be executed in the test suite.
          return new TestSuite( TestRegistryPersistence.class );
      }
  
      /**
       * 
       *
       * @throws Exception
       */
  
      public void testInsertUpdateDelete() throws Exception 
      {
          PersistenceBroker pm = null;
          try
          {
              pm = (PersistenceBroker) JetspeedDatabase.getPersistenceManager();
  
              MediaTypeTest(pm);
              SkinTest(pm);  
          }
          catch (Throwable t)
          {
              t.printStackTrace();
          }
      }
  
      void MediaTypeTest(PersistenceBroker pm) throws Exception
      {
          // test insert
          BaseMediaTypeEntry newEntry = new BaseMediaTypeEntry(0, "XHTML9", 0, "text.xhtml.9", 
                                                               "Some Title", "Some Description", "Some Image", "SU");
  
          pm.beginTransaction();
          pm.store(newEntry);
          pm.commitTransaction();
  
          // test update
          Criteria criteria = new Criteria();
          criteria.addEqualTo("name", "XHTML9");
          Query query = new QueryByCriteria(BaseMediaTypeEntry.class, criteria);
          BaseMediaTypeEntry entry  = (BaseMediaTypeEntry)pm.getObjectByQuery(query);
          assertTrue(entry.getName().equals("XHTML9"));           
          System.out.println("id = " + entry.getId());
          assertTrue(entry.getHidden() == false);           
          assertTrue(entry.getMimeType().equals("text.xhtml.9"));           
          assertTrue(entry.getMetaInfo().getTitle().equals("Some Title"));           
          assertTrue(entry.getDescription().equals("Some Description"));           
          assertTrue(entry.getMetaInfo().getImage().equals("Some Image"));           
          assertTrue(entry.getSecurity().getRole().equals("SU"));                     
  
          entry.setHidden(true);
          entry.setMimeType("text.xhtml.9.1");
          entry.getMetaInfo().setTitle("New Title");
          entry.setDescription("New Description");
          entry.getSecurity().setRole("Dumb");
  
          pm.beginTransaction();
          pm.store(entry);
          pm.commitTransaction();
  
          // delete
          pm.beginTransaction();
          BaseMediaTypeEntry entry2  = (BaseMediaTypeEntry)pm.getObjectByQuery(query);
          assertTrue(entry2.getHidden() == true);           
          assertTrue(entry2.getMimeType().equals("text.xhtml.9.1"));           
          assertTrue(entry2.getMetaInfo().getTitle().equals("New Title"));           
          assertTrue(entry2.getMetaInfo().getDescription().equals("New Description"));           
          assertTrue(entry2.getSecurity().getRole().equals("Dumb"));                     
  
          pm.delete(entry2);
          pm.commitTransaction();
  
      }
  
      void SkinTest(PersistenceBroker pm) throws Exception
      {
          // DST: left off here
      }
  
     /*
        Configuration object to run Turbine outside a servlet container
        ( uses turbine.properties )
      */
      private static TurbineConfig config = null;
      
      /*    
        Sets up TurbineConfig using the system property:
        <pre>turbine.properties</pre>
      */
      static
      {
          try
          {
             config = new TurbineConfig( "../webapp", "/WEB-INF/conf/TurbineResources.properties");
             config.init();
          }
          catch (Exception e)
          {
              //fail(StringUtils.stackTrace(e));
              System.out.println(StringUtils.stackTrace(e));
          }
      }
  }
  
  

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


Mime
View raw message