db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t...@apache.org
Subject cvs commit: db-ojb/src/java/org/apache/ojb/broker/server PersistenceBrokerClient.java RequestProcessor.java PersistenceBrokerBean.java
Date Sun, 09 Mar 2003 09:25:28 GMT
thma        2003/03/09 01:25:28

  Modified:    src/test/org/apache/ojb/quick-db OJB.script OJB.properties
               src/java/org/apache/ojb/broker/util IdentityHashMap.java
               src/jdori/org/apache/ojb/tutorial5 UCDeleteProduct.java
                        UCEditProduct.java
               src/java/org/apache/ojb/broker PersistenceBroker.java
               src/java/org/apache/ojb/broker/singlevm
                        DelegatingPersistenceBroker.java
               src/java/org/apache/ojb/otm OTMKit.java
               src/java/org/apache/ojb/broker/server
                        PersistenceBrokerClient.java RequestProcessor.java
                        PersistenceBrokerBean.java
  Log:
  eliminate deprecated calls
  
  Revision  Changes    Path
  1.14      +4 -1      db-ojb/src/test/org/apache/ojb/quick-db/OJB.script
  
  Index: OJB.script
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/quick-db/OJB.script,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- OJB.script	3 Mar 2003 12:26:41 -0000	1.13
  +++ OJB.script	9 Mar 2003 09:25:28 -0000	1.14
  @@ -60,9 +60,12 @@
   CREATE TABLE EJB_CATEGORY(CATEGORY_ID INTEGER NOT NULL PRIMARY KEY,CATEGORY_NAME VARCHAR(80),DESCRIPTION
VARCHAR(255))
   CREATE TABLE EJB_ARTICLE(ARTICLE_ID INTEGER NOT NULL PRIMARY KEY,NAME VARCHAR(80),PRICE
DECIMAL,DESCRIPTION VARCHAR(255),CATEGORY_ID INTEGER)
   CREATE TABLE EJB_PERSON(PERSON_ID INTEGER NOT NULL PRIMARY KEY,FIRST_NAME VARCHAR(80),LAST_NAME
VARCHAR(80),GRADE VARCHAR(80))
  -CREATE TABLE FIELD_CONVERSION_NODE(NODE_ID DECIMAL NOT NULL,NODE_STATE INTEGER NOT NULL,PARENT_UID
DECIMAL,CONSTRAINT SYS_PK_FIELD_CONVERSION_NODE PRIMARY KEY(NODE_ID,NODE_STATE))
  +CREATE TABLE FIELD_CONVERSION_NODE(NODE_ID DECIMAL(15) NOT NULL,NODE_STATE INTEGER NOT
NULL,PARENT_UID DECIMAL(15),CONSTRAINT SYS_PK_FIELD_CONVERSION_NODE PRIMARY KEY(NODE_ID,NODE_STATE))
   CREATE TABLE CONVERSION_VO(PK_WITH_AUTO INTEGER NOT NULL,PK_WITHOUT_AUTO INTEGER NOT NULL,NORMAL_WITH_AUTO
INTEGER,NORMAL_WITHOUT_AUTO INTEGER,CONSTRAINT SYS_PK_CONVERSION_VO PRIMARY KEY(PK_WITH_AUTO,PK_WITHOUT_AUTO))
   CREATE TABLE PERF_ARTICLE(ARTICLE_ID DECIMAL NOT NULL PRIMARY KEY,ARTICLE_NAME VARCHAR(150),MINIMUM_STOCK
INTEGER,PRICE DECIMAL,UNIT VARCHAR(20),STOCK INTEGER,SUPPLIER_ID INTEGER,PRODUCT_GROUP_ID
INTEGER)
  +CREATE TABLE CACHE_TEST(OBJ_ID INTEGER NOT NULL PRIMARY KEY,NAME VARCHAR(100))
  +CREATE TABLE REF_REPOSITORY(REP_ID INTEGER NOT NULL PRIMARY KEY,REF_FK INTEGER,REFA_FK
INTEGER,REFB_FK INTEGER,NAME VARCHAR(100))
  +CREATE TABLE REF_REFERENCE(REF_ID INTEGER NOT NULL PRIMARY KEY,NAME VARCHAR(100),REF_NAME_A
VARCHAR(100),REF_NAME_B VARCHAR(100))
   CREATE TABLE OJB_HL_SEQ(TABLENAME VARCHAR(175) NOT NULL,FIELDNAME VARCHAR(70) NOT NULL,MAX_KEY
INTEGER,GRAB_SIZE INTEGER,CONSTRAINT SYS_PK_OJB_HL_SEQ PRIMARY KEY(TABLENAME,FIELDNAME))
   CREATE TABLE OJB_LOCKENTRY(OID_ VARCHAR(250) NOT NULL,TX_ID VARCHAR(50) NOT NULL,TIMESTAMP_
TIMESTAMP,ISOLATIONLEVEL INTEGER,LOCKTYPE INTEGER,CONSTRAINT SYS_PK_OJB_LOCKENTRY PRIMARY
KEY(OID_,TX_ID))
   CREATE TABLE OJB_NRM(NAME VARCHAR(250) NOT NULL PRIMARY KEY,OID_ LONGVARBINARY)
  
  
  
  1.13      +1 -1      db-ojb/src/test/org/apache/ojb/quick-db/OJB.properties
  
  Index: OJB.properties
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/quick-db/OJB.properties,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- OJB.properties	3 Mar 2003 12:26:42 -0000	1.12
  +++ OJB.properties	9 Mar 2003 09:25:28 -0000	1.13
  @@ -1,5 +1,5 @@
   #HSQL database
  -#Mon Mar 03 11:23:11 CET 2003
  +#Sat Mar 08 20:45:09 CET 2003
   sql.strict_fk=true
   readonly=false
   sql.strong_fk=true
  
  
  
  1.3       +103 -96   db-ojb/src/java/org/apache/ojb/broker/util/IdentityHashMap.java
  
  Index: IdentityHashMap.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/util/IdentityHashMap.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- IdentityHashMap.java	17 Jun 2002 19:34:24 -0000	1.2
  +++ IdentityHashMap.java	9 Mar 2003 09:25:28 -0000	1.3
  @@ -1,4 +1,4 @@
  -package org.apache.ojb.broker.util;
  +package org.apache.ojb.broker.util;
   
   /* ====================================================================
    * The Apache Software License, Version 1.1
  @@ -53,98 +53,105 @@
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
    */
  -
  -import java.util.HashMap;
  -import java.util.Map;
  -
  -import org.apache.ojb.broker.Identity;
  -
  -/**
  - * @author thma
  - * @version $Id$
  - */
  -public class IdentityHashMap extends HashMap
  -{
  -
  -    /**
  -     * Constructor for IdentityHashMap.
  -     * @param initialCapacity
  -     * @param loadFactor
  -     */
  -    public IdentityHashMap(int initialCapacity, float loadFactor)
  -    {
  -        super(initialCapacity, loadFactor);
  -    }
  -
  -    /**
  -     * Constructor for IdentityHashMap.
  -     * @param initialCapacity
  -     */
  -    public IdentityHashMap(int initialCapacity)
  -    {
  -        super(initialCapacity);
  -    }
  -
  -    /**
  -     * Constructor for IdentityHashMap.
  -     */
  -    public IdentityHashMap()
  -    {
  -        super();
  -    }
  -
  -    /**
  -     * Constructor for IdentityHashMap.
  -     * @param t
  -     */
  -    public IdentityHashMap(Map t)
  -    {
  -        super(t);
  -    }
  -
  -    /**
  -     * @see Map#get(Object)
  -     */
  -    public Object get(Object key)
  -    {
  -        return super.get(new Identity(key).toString());
  -    }
  -
  -    /**
  -     * @see Map#put(Object, Object)
  -     */
  -    public Object put(Object key, Object value)
  -    {
  -        return super.put(new Identity(key).toString(), value);
  -    }
  -
  -    /**
  -     * adds an object to the Map. new Identity(obj) is used as key
  -     */
  -    public Object add(Object value)
  -    {
  -        String oidString = new Identity(value).toString();
  -        if (! super.containsKey(oidString))
  -        {
  -            return super.put(oidString, value);
  -        }
  -        else return null;
  -
  -    }
  -
  -    /**
  -     * @see Map#remove(Object)
  -     */
  -    public Object remove(Object key)
  -    {
  -        return super.remove(new Identity(key).toString());
  -    }
  -
  -    /**
  -     * @see Map#containsKey(Object)
  -     */
  -    public boolean containsKey(Object key)
  -    {
  -        return super.containsKey(new Identity(key).toString());
  -    }
  -}
  +
  +import java.util.HashMap;
  +import java.util.Map;
  +
  +import org.apache.ojb.broker.Identity;
  +import org.apache.ojb.broker.PersistenceBroker;
  +import org.apache.ojb.broker.singlevm.PersistenceBrokerThreadMapping;
  +
  +/**
  + * @author thma
  + * @version $Id$
  + */
  +public class IdentityHashMap extends HashMap
  +{
  +
  +    /**
  +     * Constructor for IdentityHashMap.
  +     * @param initialCapacity
  +     * @param loadFactor
  +     */
  +    public IdentityHashMap(int initialCapacity, float loadFactor)
  +    {
  +        super(initialCapacity, loadFactor);
  +    }
  +
  +    /**
  +     * Constructor for IdentityHashMap.
  +     * @param initialCapacity
  +     */
  +    public IdentityHashMap(int initialCapacity)
  +    {
  +        super(initialCapacity);
  +    }
  +
  +    /**
  +     * Constructor for IdentityHashMap.
  +     */
  +    public IdentityHashMap()
  +    {
  +        super();
  +    }
  +
  +    /**
  +     * Constructor for IdentityHashMap.
  +     * @param t
  +     */
  +    public IdentityHashMap(Map t)
  +    {
  +        super(t);
  +    }
  +
  +    /**
  +     * @see Map#get(Object)
  +     */
  +    public Object get(Object key)
  +    {
  +    	PersistenceBroker broker = PersistenceBrokerThreadMapping.currentDefaultPersistenceBroker();
  +        return super.get(new Identity(key, broker).toString());
  +    }
  +
  +    /**
  +     * @see Map#put(Object, Object)
  +     */
  +    public Object put(Object key, Object value)
  +    {
  +    	PersistenceBroker broker = PersistenceBrokerThreadMapping.currentDefaultPersistenceBroker();
  +        return super.put(new Identity(key, broker).toString(), value);
  +    }
  +
  +    /**
  +     * adds an object to the Map. new Identity(obj) is used as key
  +     */
  +    public Object add(Object value)
  +    {
  +    	PersistenceBroker broker = PersistenceBrokerThreadMapping.currentDefaultPersistenceBroker();
  +        String oidString = new Identity(value, broker).toString();
  +        if (! super.containsKey(oidString))
  +        {
  +            return super.put(oidString, value);
  +        }
  +        else return null;
  +
  +    }
  +
  +    /**
  +     * @see Map#remove(Object)
  +     */
  +    public Object remove(Object key)
  +    {
  +    	PersistenceBroker broker = PersistenceBrokerThreadMapping.currentDefaultPersistenceBroker();
  +        return super.remove(new Identity(key, broker).toString());
  +    }
  +
  +    /**
  +     * @see Map#containsKey(Object)
  +     */
  +    public boolean containsKey(Object key)
  +    {
  +    	PersistenceBroker broker = PersistenceBrokerThreadMapping.currentDefaultPersistenceBroker();
  +        return super.containsKey(new Identity(key, broker).toString());
  +    }
  +}
  
  
  
  1.2       +4 -1      db-ojb/src/jdori/org/apache/ojb/tutorial5/UCDeleteProduct.java
  
  Index: UCDeleteProduct.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/jdori/org/apache/ojb/tutorial5/UCDeleteProduct.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- UCDeleteProduct.java	28 Nov 2002 07:24:02 -0000	1.1
  +++ UCDeleteProduct.java	9 Mar 2003 09:25:28 -0000	1.2
  @@ -5,6 +5,8 @@
   import javax.jdo.Transaction;
   
   import org.apache.ojb.broker.Identity;
  +import org.apache.ojb.broker.PersistenceBroker;
  +import org.apache.ojb.broker.singlevm.PersistenceBrokerThreadMapping;
   
   /**
    * Insert the type's description here.
  @@ -37,7 +39,8 @@
           // 1. build an example object with matching primary key values:
           Product example = new Product();
           example.setId(id);
  -        Identity oid = new Identity(example);
  +        PersistenceBroker broker = PersistenceBrokerThreadMapping.currentDefaultPersistenceBroker();
  +        Identity oid = new Identity(example, broker);
           try
           {
           	manager = factory.getPersistenceManager();
  
  
  
  1.4       +4 -1      db-ojb/src/jdori/org/apache/ojb/tutorial5/UCEditProduct.java
  
  Index: UCEditProduct.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/jdori/org/apache/ojb/tutorial5/UCEditProduct.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- UCEditProduct.java	17 Dec 2002 20:48:43 -0000	1.3
  +++ UCEditProduct.java	9 Mar 2003 09:25:28 -0000	1.4
  @@ -3,6 +3,8 @@
   import javax.jdo.PersistenceManager;
   
   import org.apache.ojb.broker.Identity;
  +import org.apache.ojb.broker.PersistenceBroker;
  +import org.apache.ojb.broker.singlevm.PersistenceBrokerThreadMapping;
   
   /**
    *
  @@ -40,7 +42,8 @@
               //Query query = manager.newQuery(Product.class, "id == " + id);
               Product example = new Product();
               example.setId(id);
  -            Identity oid = new Identity(example);
  +            PersistenceBroker broker = PersistenceBrokerThreadMapping.currentDefaultPersistenceBroker();
  +            Identity oid = new Identity(example, broker);
               
               manager.currentTransaction().begin();
               toBeEdited = (Product) manager.getObjectById(oid, false);
  
  
  
  1.20      +1 -11     db-ojb/src/java/org/apache/ojb/broker/PersistenceBroker.java
  
  Index: PersistenceBroker.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/PersistenceBroker.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- PersistenceBroker.java	26 Feb 2003 00:35:03 -0000	1.19
  +++ PersistenceBroker.java	9 Mar 2003 09:25:28 -0000	1.20
  @@ -285,16 +285,6 @@
        */
       public boolean hasClassDescriptor(Class clazz);
   
  -    /**
  -     * Returns the top level (extent) class to which the given class belongs.
  -     * This may be a (abstract) base-class, an interface or the given class itself, if
  -     * no extent is defined.
  -     * @throws PersistenceBrokerException if clazz is not persistence capable,
  -     * i.e. if clazz is not defined in the DescriptorRepository.
  -     *
  -     * @deprecated use {@link #getTopLevelClass} instead
  -     */
  -    public Class getExtentClass(Class clazz) throws PersistenceBrokerException;
   
       /**
        * Returns the top level (extent) class to which the given class belongs.
  
  
  
  1.10      +0 -5      db-ojb/src/java/org/apache/ojb/broker/singlevm/DelegatingPersistenceBroker.java
  
  Index: DelegatingPersistenceBroker.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/singlevm/DelegatingPersistenceBroker.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- DelegatingPersistenceBroker.java	19 Feb 2003 22:10:16 -0000	1.9
  +++ DelegatingPersistenceBroker.java	9 Mar 2003 09:25:28 -0000	1.10
  @@ -248,11 +248,6 @@
           getBroker().fireBrokerEvent(instance, eventId);
       }
   
  -    public Class getExtentClass(Class clazz) throws PersistenceBrokerException
  -    {
  -        return getBroker().getExtentClass(clazz);
  -    }
  -
       public Class getTopLevelClass(Class clazz) throws PersistenceBrokerException
       {
           return getBroker().getTopLevelClass(clazz);
  
  
  
  1.2       +4 -1      db-ojb/src/java/org/apache/ojb/otm/OTMKit.java
  
  Index: OTMKit.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/otm/OTMKit.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- OTMKit.java	1 Feb 2003 18:39:57 -0000	1.1
  +++ OTMKit.java	9 Mar 2003 09:25:28 -0000	1.2
  @@ -56,7 +56,9 @@
   
   import org.apache.ojb.broker.Identity;
   import org.apache.ojb.broker.PBKey;
  +import org.apache.ojb.broker.PersistenceBroker;
   import org.apache.ojb.broker.metadata.ClassDescriptor;
  +import org.apache.ojb.broker.singlevm.PersistenceBrokerThreadMapping;
   import org.apache.ojb.otm.cache.store.ObjectStore;
   import org.apache.ojb.otm.copy.ObjectCopyStrategy;
   import org.apache.ojb.otm.core.OTMGenericException;
  @@ -98,7 +100,8 @@
       
       public Identity getIdentity (Object object)
       {
  -        return new Identity(object);
  +    	PersistenceBroker broker = PersistenceBrokerThreadMapping.currentDefaultPersistenceBroker();
  +        return new Identity(object, broker);
       }
       
       
  
  
  
  1.23      +6 -16     db-ojb/src/java/org/apache/ojb/broker/server/PersistenceBrokerClient.java
  
  Index: PersistenceBrokerClient.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/server/PersistenceBrokerClient.java,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- PersistenceBrokerClient.java	19 Feb 2003 22:10:17 -0000	1.22
  +++ PersistenceBrokerClient.java	9 Mar 2003 09:25:28 -0000	1.23
  @@ -72,6 +72,7 @@
   import org.apache.ojb.broker.metadata.ObjectReferenceDescriptor;
   import org.apache.ojb.broker.metadata.fieldaccess.PersistentField;
   import org.apache.ojb.broker.query.Query;
  +import org.apache.ojb.broker.singlevm.PersistenceBrokerThreadMapping;
   import org.apache.ojb.broker.util.ObjectModification;
   import org.apache.ojb.broker.util.BrokerHelper;
   import org.apache.ojb.broker.util.sequence.SequenceManager;
  @@ -544,7 +545,8 @@
   
           if (needNewIdentity)
           {
  -            new Identity(obj);
  +        	//PersistenceBroker broker = PersistenceBrokerThreadMapping.currentDefaultPersistenceBroker();
  +            new Identity(obj, broker);
           }
   
           Vector referenceDescriptors = classDescriptor.getObjectReferenceDescriptors();
  @@ -868,15 +870,9 @@
               throw new PersistenceBrokerException(((Throwable) result).getMessage());
       }
   
  -    /**
  -     * returns the Extent to which the class clazz belongs.
  -     * This may be a baseclass,an interface or clazz itself, if no Extent
  -     * is defined.
  -     * throws a PersistenceBrokerException if clazz is not persistence capable,
  -     * i.e. if clazz is not defined in the DescriptorRepository.
  -     */
  -    public Class getExtentClass(Class clazz) throws PersistenceBrokerException
  +    public Class getTopLevelClass(Class clazz) throws PersistenceBrokerException
       {
  +        /*@todo implementation of this method */
           Object result = callServer(PBMethodIndex.GET_EXTENT_CLASS, clazz);
           if (result instanceof Class)
               return (Class) result;
  @@ -884,12 +880,6 @@
               throw (PersistenceBrokerException) result;
           else
               throw new PersistenceBrokerException(((Throwable) result).getMessage());
  -    }
  -
  -    public Class getTopLevelClass(Class clazz) throws PersistenceBrokerException
  -    {
  -        /*@todo implementation of this method */
  -        return getExtentClass(clazz);
       }
   
       /**
  
  
  
  1.16      +1 -1      db-ojb/src/java/org/apache/ojb/broker/server/RequestProcessor.java
  
  Index: RequestProcessor.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/server/RequestProcessor.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- RequestProcessor.java	8 Mar 2003 19:22:56 -0000	1.15
  +++ RequestProcessor.java	9 Mar 2003 09:25:28 -0000	1.16
  @@ -197,7 +197,7 @@
           String repositoryFile = null;
           if (repository != null)
           {
  -            repositoryFile = request.getRepository().getRepositoryFile();
  +            repositoryFile = request.getRepository().getAlias();
           }
           Object arg1 = request.getArg1();
           Object arg2 = request.getArg2();
  
  
  
  1.11      +0 -9      db-ojb/src/java/org/apache/ojb/broker/server/PersistenceBrokerBean.java
  
  Index: PersistenceBrokerBean.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/server/PersistenceBrokerBean.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- PersistenceBrokerBean.java	19 Feb 2003 22:10:17 -0000	1.10
  +++ PersistenceBrokerBean.java	9 Mar 2003 09:25:28 -0000	1.11
  @@ -379,15 +379,6 @@
   
   
   
  -    /**
  -     * @ejb:interface-method
  -     * @see org.apache.ojb.broker.PersistenceBroker#getExtentClass(Class)
  -     */
  -    public Class getExtentClass(Class clazz)
  -            throws PersistenceBrokerException
  -    {
  -        return getBroker().getTopLevelClass(clazz);
  -    }
   
       /**
        * @ejb:interface-method
  
  
  

Mime
View raw message