db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arm...@apache.org
Subject cvs commit: jakarta-ojb/src/java/org/apache/ojb/broker/server PersistenceBrokerBean.java PersistenceBrokerClient.java RequestProcessor.java
Date Tue, 24 Dec 2002 13:19:18 GMT
arminw      2002/12/24 05:19:18

  Modified:    src/java/org/apache/ojb/broker/server
                        PersistenceBrokerBean.java
                        PersistenceBrokerClient.java RequestProcessor.java
  Log:
  NOTE: here are some things to do!
  I'm not close with the C/S code.
  
  improve metadata handling:
  separate the object stuff (class descriptor, field descriptor, ...)
  from the connection stuff (jdbc descriptor).
  DescriptorRepository now handles only object
  specific properties.
  
  Do some performance improvements
  
  Revision  Changes    Path
  1.5       +144 -132  jakarta-ojb/src/java/org/apache/ojb/broker/server/PersistenceBrokerBean.java
  
  Index: PersistenceBrokerBean.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ojb/src/java/org/apache/ojb/broker/server/PersistenceBrokerBean.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- PersistenceBrokerBean.java	1 Dec 2002 11:48:38 -0000	1.4
  +++ PersistenceBrokerBean.java	24 Dec 2002 13:19:18 -0000	1.5
  @@ -54,11 +54,6 @@
    * <http://www.apache.org/>.
    */
   
  -import java.util.Collection;
  -import java.util.Enumeration;
  -import java.util.Iterator;
  -import java.rmi.RemoteException;
  -
   import org.apache.ojb.broker.Identity;
   import org.apache.ojb.broker.ManageableCollection;
   import org.apache.ojb.broker.PBKey;
  @@ -68,26 +63,33 @@
   import org.apache.ojb.broker.TransactionAbortedException;
   import org.apache.ojb.broker.TransactionInProgressException;
   import org.apache.ojb.broker.TransactionNotInProgressException;
  -import org.apache.ojb.broker.ta.PBFactoryIF;
  -import org.apache.ojb.broker.ta.PersistenceBrokerFactoryIF;
   import org.apache.ojb.broker.accesslayer.ConnectionManagerIF;
   import org.apache.ojb.broker.accesslayer.StatementManagerIF;
  +import org.apache.ojb.broker.accesslayer.sql.SqlGenerator;
   import org.apache.ojb.broker.metadata.ClassDescriptor;
   import org.apache.ojb.broker.metadata.DescriptorRepository;
   import org.apache.ojb.broker.metadata.FieldDescriptor;
   import org.apache.ojb.broker.query.Query;
  +import org.apache.ojb.broker.ta.PBFactoryIF;
  +import org.apache.ojb.broker.ta.PersistenceBrokerFactoryIF;
   import org.apache.ojb.broker.util.ObjectModification;
  -import org.apache.ojb.broker.util.logging.Logger;
  -import org.apache.ojb.broker.util.logging.LoggerFactory;
  +import org.apache.ojb.broker.util.BrokerHelper;
  +import org.apache.ojb.broker.util.sequence.SequenceManager;
   import org.apache.ojb.broker.util.configuration.Configuration;
   import org.apache.ojb.broker.util.configuration.ConfigurationException;
  +import org.apache.ojb.broker.util.logging.Logger;
  +import org.apache.ojb.broker.util.logging.LoggerFactory;
   
  -import javax.ejb.SessionBean;
   import javax.ejb.EJBException;
  +import javax.ejb.SessionBean;
   import javax.ejb.SessionContext;
   import javax.naming.Context;
   import javax.naming.InitialContext;
   import javax.naming.NamingException;
  +import java.rmi.RemoteException;
  +import java.util.Collection;
  +import java.util.Enumeration;
  +import java.util.Iterator;
   
   /**
    * @author <a href="mailto:mattbaird@yahoo.com">Matthew Baird</a>
  @@ -161,15 +163,6 @@
   
       /**
        * @ejb:interface-method
  -     * @see org.apache.ojb.broker.PersistenceBroker#setPBKey(PBKey)
  -     */
  -    public void setPBKey(PBKey key)
  -    {
  -        getBroker().setPBKey(key);
  -    }
  -
  -    /**
  -     * @ejb:interface-method
        * @see org.apache.ojb.broker.PersistenceBroker#delete(Object)
        */
       public void delete(Object obj) throws PersistenceBrokerException
  @@ -257,19 +250,9 @@
        */
       public boolean isInTransaction() throws PersistenceBrokerException
       {
  -       return getBroker().isInTransaction();
  +        return getBroker().isInTransaction();
       }
   
  -//    /**
  -//     * @ejb:interface-method
  -//     * @see org.apache.ojb.broker.PersistenceBroker#open(String, String, String)
  -//     */
  -//    public boolean open(String repository, String user, String passwd)
  -//            throws PersistenceBrokerException
  -//    {
  -//        return getBroker().open(repository, user, passwd);
  -//    }
  -
       /**
        * @ejb:interface-method
        * @see org.apache.ojb.broker.PersistenceBroker#close()
  @@ -307,7 +290,7 @@
               Query query)
               throws PersistenceBrokerException
       {
  -        return getBroker().getCollectionByQuery(collectionClass,query);
  +        return getBroker().getCollectionByQuery(collectionClass, query);
       }
   
       /**
  @@ -372,149 +355,78 @@
           getBroker().store(obj, modification);
       }
   
  -    /**
  -     * @ejb:interface-method
  -     * @see org.apache.ojb.broker.PersistenceBroker#getUniqueId(Class, String)
  -     */
  -    public int getUniqueId(Class extent, String attribute)
  -            throws PersistenceBrokerException
  -    {
  -    	ClassDescriptor cld = getBroker().getClassDescriptor(extent);
  -        FieldDescriptor fld = cld.getFieldDescriptorByName(attribute);
  -        return getBroker().getUniqueId(fld);
  -    }
  -
  -    /**
  -     * @ejb:interface-method
  -     * @see org.apache.ojb.broker.PersistenceBroker#getUniqueLong(Class, String)
  -     */
  -    public long getUniqueLong(Class extent, String attribute)
  -            throws PersistenceBrokerException
  -    {
  -    	ClassDescriptor cld = getBroker().getClassDescriptor(extent);
  -    	FieldDescriptor fld = cld.getFieldDescriptorByName(attribute);
  -        return getBroker().getUniqueLong(fld);
  -    }
  -
  -    /**
  -     * @ejb:interface-method
  -     * @see org.apache.ojb.broker.PersistenceBroker#getUniqueString(Class, String)
  -     */
  -    public String getUniqueString(Class extent, String attribute)
  -            throws PersistenceBrokerException
  -    {
  -    	ClassDescriptor cld = getBroker().getClassDescriptor(extent);
  -    	FieldDescriptor fld = cld.getFieldDescriptorByName(attribute);
  -        return getBroker().getUniqueString(fld);
  -    }
   
       /**
        * @ejb:interface-method
  -     * @see org.apache.ojb.broker.PersistenceBroker#getUniqueObject(Class, String)
  +     * @see org.apache.ojb.broker.PersistenceBroker#getClassDescriptor(Class)
        */
  -    public Object getUniqueObject(Class extent, String attribute)
  +    public ClassDescriptor getClassDescriptor(Class clazz)
               throws PersistenceBrokerException
       {
  -    	ClassDescriptor cld = getBroker().getClassDescriptor(extent);
  -    	FieldDescriptor fld = cld.getFieldDescriptorByName(attribute);
  -        return getBroker().getUniqueObject(fld);
  +        return getBroker().getClassDescriptor(clazz);
       }
   
       /**
        * @ejb:interface-method
  -     * @see org.apache.ojb.broker.PersistenceBroker#getUniqueId(FieldDescriptor field)
  +     * @see org.apache.ojb.broker.PersistenceBroker#hasClassDescriptor(Class)
        */
  -    public int getUniqueId(FieldDescriptor field)
  -            throws PersistenceBrokerException
  +    public boolean hasClassDescriptor(Class clazz)
       {
  -        return getBroker().getUniqueId(field);
  +        return getBroker().hasClassDescriptor(clazz);
       }
   
  -    /**
  -     * @ejb:interface-method
  -     * @see org.apache.ojb.broker.PersistenceBroker#getUniqueLong(FieldDescriptor field)
  -     */
  -    public long getUniqueLong(FieldDescriptor field)
  -            throws PersistenceBrokerException
  -    {
  -        return getBroker().getUniqueLong(field);
  -    }
   
  -    /**
  -     * @ejb:interface-method
  -     * @see org.apache.ojb.broker.PersistenceBroker#getUniqueString(FieldDescriptor field)
  -     */
  -    public String getUniqueString(FieldDescriptor field)
  -            throws PersistenceBrokerException
  -    {
  -        return getBroker().getUniqueString(field);
  -    }
   
       /**
        * @ejb:interface-method
  -     * @see org.apache.ojb.broker.PersistenceBroker#getUniqueObject(FieldDescriptor)
  +     * @see org.apache.ojb.broker.PersistenceBroker#getExtentClass(Class)
        */
  -    public Object getUniqueObject(FieldDescriptor field)
  +    public Class getExtentClass(Class clazz)
               throws PersistenceBrokerException
       {
  -        return getBroker().getUniqueObject(field);
  +        return getBroker().getExtentClass(clazz);
       }
   
       /**
        * @ejb:interface-method
  -     * @see org.apache.ojb.broker.PersistenceBroker#getClassDescriptor(Class)
  +     * @see org.apache.ojb.broker.PersistenceBroker#getStatementManager()
        */
  -    public ClassDescriptor getClassDescriptor(Class clazz)
  -            throws PersistenceBrokerException
  +    public StatementManagerIF serviceStatementManager()
       {
  -        return getBroker().getClassDescriptor(clazz);
  +        return getBroker().serviceStatementManager();
       }
   
       /**
        * @ejb:interface-method
  -     * @see org.apache.ojb.broker.PersistenceBroker#hasClassDescriptor(Class)
  +     * @see org.apache.ojb.broker.PersistenceBroker#getConnectionManager()
        */
  -    public boolean hasClassDescriptor(Class clazz)
  +    public ConnectionManagerIF serviceConnectionManager()
       {
  -        return getBroker().hasClassDescriptor(clazz);
  +        return getBroker().serviceConnectionManager();
       }
   
       /**
        * @ejb:interface-method
  -     * @see org.apache.ojb.broker.PersistenceBroker#setClassDescriptor(ClassDescriptor)
  +     * @see org.apache.ojb.broker.PersistenceBroker#getSqlGenerator()
        */
  -    public void setClassDescriptor(ClassDescriptor modifiedOrNewDescriptor)
  -            throws PersistenceBrokerException
  +    public SqlGenerator serviceSqlGenerator()
       {
  -        getBroker().setClassDescriptor(modifiedOrNewDescriptor);
  +        return getBroker().serviceSqlGenerator();
       }
   
  -    /**
  -     * @ejb:interface-method
  -     * @see org.apache.ojb.broker.PersistenceBroker#getExtentClass(Class)
  -     */
  -    public Class getExtentClass(Class clazz)
  -            throws PersistenceBrokerException
  +    public SequenceManager serviceSequenceManager()
       {
  -        return getBroker().getExtentClass(clazz);
  +        return getBroker().serviceSequenceManager();
       }
   
  -    /**
  -     * @ejb:interface-method
  -     * @see org.apache.ojb.broker.PersistenceBroker#getStatementManager()
  -     */
  -    public StatementManagerIF getStatementManager()
  +    public BrokerHelper serviceBrokerHelper()
       {
  -        return getBroker().getStatementManager();
  +        return getBroker().serviceBrokerHelper();
       }
   
  -    /**
  -     * @ejb:interface-method
  -     * @see org.apache.ojb.broker.PersistenceBroker#getConnectionManager()
  -     */
  -    public ConnectionManagerIF getConnectionManager()
  +    public void fireBrokerEvent(Object instance, int eventId)
       {
  -        return getBroker().getConnectionManager();
  +        getBroker().fireBrokerEvent(instance, eventId);
       }
   
       /**
  @@ -585,11 +497,11 @@
           return getBroker().query();
       }
   
  -     private void ojbPrepare()
  +    private void ojbPrepare()
       {
           if (m_log.isDebugEnabled()) m_log.info("PersistenceBrokerBean: ejbActivate was called");
           Context context = null;
  -		// Lookup if a environment entry for repository exists
  +        // Lookup if a environment entry for repository exists
           String ojbRepository = null;
           try
           {
  @@ -602,11 +514,11 @@
           }
           // no repository found in environment, use default one
           if (ojbRepository == null || ojbRepository.equals(""))
  -		{
  -			m_log.info("No enviroment entry was found, use default repository");
  +        {
  +            m_log.info("No enviroment entry was found, use default repository");
               ojbRepository = "repository.xml";
  -		}
  -        m_log.info("Use OJB repository file: "+ojbRepository);
  +        }
  +        m_log.info("Use OJB repository file: " + ojbRepository);
           m_pbKey = new PBKey(ojbRepository);
   
           // Lookup the PBF implementation
  @@ -648,4 +560,104 @@
       {
           return m_pbf.createPersistenceBroker(m_pbKey);
       }
  +
  +//    /**
  +//     * @ejb:interface-method
  +//     * @see org.apache.ojb.broker.PersistenceBroker#setClassDescriptor(ClassDescriptor)
  +//     */
  +//    public void setClassDescriptor(ClassDescriptor modifiedOrNewDescriptor)
  +//            throws PersistenceBrokerException
  +//    {
  +//        getBroker().servicesetClassDescriptor(modifiedOrNewDescriptor);
  +//    }
  +
  +
  +//    /**
  +//     * @ejb:interface-method
  +//     * @see org.apache.ojb.broker.PersistenceBroker#getUniqueId(Class, String)
  +//     */
  +//    public int getUniqueId(Class extent, String attribute)
  +//            throws PersistenceBrokerException
  +//    {
  +//        ClassDescriptor cld = getBroker().getClassDescriptor(extent);
  +//        FieldDescriptor fld = cld.getFieldDescriptorByName(attribute);
  +//        return getBroker().getUniqueId(fld);
  +//    }
  +//
  +//    /**
  +//     * @ejb:interface-method
  +//     * @see org.apache.ojb.broker.PersistenceBroker#getUniqueLong(Class, String)
  +//     */
  +//    public long getUniqueLong(Class extent, String attribute)
  +//            throws PersistenceBrokerException
  +//    {
  +//        ClassDescriptor cld = getBroker().getClassDescriptor(extent);
  +//        FieldDescriptor fld = cld.getFieldDescriptorByName(attribute);
  +//        return getBroker().getUniqueLong(fld);
  +//    }
  +//
  +//    /**
  +//     * @ejb:interface-method
  +//     * @see org.apache.ojb.broker.PersistenceBroker#getUniqueString(Class, String)
  +//     */
  +//    public String getUniqueString(Class extent, String attribute)
  +//            throws PersistenceBrokerException
  +//    {
  +//        ClassDescriptor cld = getBroker().getClassDescriptor(extent);
  +//        FieldDescriptor fld = cld.getFieldDescriptorByName(attribute);
  +//        return getBroker().getUniqueString(fld);
  +//    }
  +//
  +//    /**
  +//     * @ejb:interface-method
  +//     * @see org.apache.ojb.broker.PersistenceBroker#getUniqueObject(Class, String)
  +//     */
  +//    public Object getUniqueObject(Class extent, String attribute)
  +//            throws PersistenceBrokerException
  +//    {
  +//        ClassDescriptor cld = getBroker().getClassDescriptor(extent);
  +//        FieldDescriptor fld = cld.getFieldDescriptorByName(attribute);
  +//        return getBroker().getUniqueObject(fld);
  +//    }
  +//
  +//    /**
  +//     * @ejb:interface-method
  +//     * @see org.apache.ojb.broker.PersistenceBroker#getUniqueId(FieldDescriptor field)
  +//     */
  +//    public int getUniqueId(FieldDescriptor field)
  +//            throws PersistenceBrokerException
  +//    {
  +//        return getBroker().getUniqueId(field);
  +//    }
  +//
  +//    /**
  +//     * @ejb:interface-method
  +//     * @see org.apache.ojb.broker.PersistenceBroker#getUniqueLong(FieldDescriptor field)
  +//     */
  +//    public long getUniqueLong(FieldDescriptor field)
  +//            throws PersistenceBrokerException
  +//    {
  +//        return getBroker().getUniqueLong(field);
  +//    }
  +//
  +//    /**
  +//     * @ejb:interface-method
  +//     * @see org.apache.ojb.broker.PersistenceBroker#getUniqueString(FieldDescriptor field)
  +//     */
  +//    public String getUniqueString(FieldDescriptor field)
  +//            throws PersistenceBrokerException
  +//    {
  +//        return getBroker().getUniqueString(field);
  +//    }
  +//
  +//    /**
  +//     * @ejb:interface-method
  +//     * @see org.apache.ojb.broker.PersistenceBroker#getUniqueObject(FieldDescriptor)
  +//     */
  +//    public Object getUniqueObject(FieldDescriptor field)
  +//            throws PersistenceBrokerException
  +//    {
  +//        return getBroker().getUniqueObject(field);
  +//    }
  +
   }
  
  
  
  1.18      +238 -229  jakarta-ojb/src/java/org/apache/ojb/broker/server/PersistenceBrokerClient.java
  
  Index: PersistenceBrokerClient.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ojb/src/java/org/apache/ojb/broker/server/PersistenceBrokerClient.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- PersistenceBrokerClient.java	21 Nov 2002 22:25:50 -0000	1.17
  +++ PersistenceBrokerClient.java	24 Dec 2002 13:19:18 -0000	1.18
  @@ -53,22 +53,6 @@
    */
   package org.apache.ojb.broker.server;
   
  -import java.io.IOException;
  -import java.io.InputStream;
  -import java.io.ObjectInputStream;
  -import java.io.ObjectOutputStream;
  -import java.io.OutputStream;
  -import java.io.Serializable;
  -import java.util.Collection;
  -import java.util.Enumeration;
  -import java.util.HashMap;
  -import java.util.Hashtable;
  -import java.util.Iterator;
  -import java.util.Map;
  -import java.util.Vector;
  -import java.util.zip.GZIPInputStream;
  -import java.util.zip.GZIPOutputStream;
  -
   import org.apache.ojb.broker.Identity;
   import org.apache.ojb.broker.ManageableCollection;
   import org.apache.ojb.broker.PBKey;
  @@ -78,6 +62,7 @@
   import org.apache.ojb.broker.PersistenceBrokerListener;
   import org.apache.ojb.broker.accesslayer.ConnectionManagerIF;
   import org.apache.ojb.broker.accesslayer.StatementManagerIF;
  +import org.apache.ojb.broker.accesslayer.sql.SqlGenerator;
   import org.apache.ojb.broker.metadata.ClassDescriptor;
   import org.apache.ojb.broker.metadata.CollectionDescriptor;
   import org.apache.ojb.broker.metadata.DescriptorRepository;
  @@ -86,6 +71,8 @@
   import org.apache.ojb.broker.metadata.fieldaccess.PersistentField;
   import org.apache.ojb.broker.query.Query;
   import org.apache.ojb.broker.util.ObjectModification;
  +import org.apache.ojb.broker.util.BrokerHelper;
  +import org.apache.ojb.broker.util.sequence.SequenceManager;
   import org.apache.ojb.broker.util.configuration.Configuration;
   import org.apache.ojb.broker.util.configuration.ConfigurationException;
   import org.apache.ojb.broker.util.logging.Logger;
  @@ -94,13 +81,29 @@
   import org.odmg.TransactionInProgressException;
   import org.odmg.TransactionNotInProgressException;
   
  +import java.io.IOException;
  +import java.io.InputStream;
  +import java.io.ObjectInputStream;
  +import java.io.ObjectOutputStream;
  +import java.io.OutputStream;
  +import java.io.Serializable;
  +import java.util.Collection;
  +import java.util.Enumeration;
  +import java.util.HashMap;
  +import java.util.Hashtable;
  +import java.util.Iterator;
  +import java.util.Map;
  +import java.util.Vector;
  +import java.util.zip.GZIPInputStream;
  +import java.util.zip.GZIPOutputStream;
  +
   /**
    * This class implements the Client side of the Client/Server-Mode of OJB.
    *
    * @version $Id$
    */
   public class PersistenceBrokerClient
  -    implements PersistenceBroker, Serializable, ServerAdministration
  +        implements PersistenceBroker, Serializable, ServerAdministration
   {
   
       private static final int INVALID_ID = -1;
  @@ -113,9 +116,9 @@
       private Map processedObjects;
   
       /**
  -     * The repository for the this client.
  +     * The PBKey for the this client.
        */
  -    private PBKey repository;
  +    private PBKey pbKey;
   
       /**
        * The pool of available server.
  @@ -135,7 +138,6 @@
       private int brokerId = INVALID_ID;
   
   
  -
       private Logger logger;
   
       private boolean useCompression = false;
  @@ -155,10 +157,10 @@
        * @param serverpool the pool from which the servers are to be selected.
        * @param repository the repository to use
        */
  -    public PersistenceBrokerClient(ServerPool serverpool, PBKey repository)
  +    public PersistenceBrokerClient(ServerPool serverpool, PBKey pbKey)
       {
           servers = serverpool;
  -        this.repository = repository;
  +        this.pbKey = pbKey;
           doRoundRobin();
           logger = LoggerFactory.getLogger(this.getClass());
       }
  @@ -167,10 +169,10 @@
        * Creates a new PersistenceBrokerClient that uses only a single server.
        * @param server the server to connect to.
        */
  -    public PersistenceBrokerClient(ServerEntry server, PBKey repository)
  +    public PersistenceBrokerClient(ServerEntry server, PBKey pbKey)
       {
           servers = null;
  -        this.repository = repository;
  +        this.pbKey = pbKey;
           currentServer = server;
           logger = LoggerFactory.getLogger(this.getClass());
       }
  @@ -259,7 +261,7 @@
       private Object callServer(int methodIndex, int brokerid, Object arg1, Object arg2, Object arg3)
       {
           logger.debug("callServer(" + methodIndex + ", " + brokerId + ", " + arg1
  -                     + ", " + arg2 + ", " + arg3 + ")");
  +                + ", " + arg2 + ", " + arg3 + ")");
           ServerConnection connection = null;
           GZIPOutputStream gzipos = null;
           ObjectOutputStream oos = null;
  @@ -272,30 +274,33 @@
               OutputStream os = connection.getOutputStream();
               if (useCompression)
               {
  -            	gzipos = new GZIPOutputStream(os);
  -            	oos = new ObjectOutputStream(gzipos);
  +                gzipos = new GZIPOutputStream(os);
  +                oos = new ObjectOutputStream(gzipos);
               }
               else
               {
  -            	oos = new ObjectOutputStream(os);
  +                oos = new ObjectOutputStream(os);
               }
   
               // this is our simple protocol:
               Request request = null;
  -            if (brokerId != INVALID_ID) {
  +            if (brokerId != INVALID_ID)
  +            {
                   logger.debug("callServer(" + methodIndex + ", " + brokerId + ", " + arg1 + ", " + arg2 + ", " + arg3 + ")");
                   request = new Request(methodIndex, brokerid, arg1, arg2, arg3);
  -            } else {
  -                logger.debug("callServer(" + methodIndex + ", " + brokerId + ", " + repository + ", " + arg1 + ", " + arg2 + ", " + arg3 + ")");
  -                request = new Request(methodIndex, brokerid, repository, arg1, arg2, arg3);
  +            }
  +            else
  +            {
  +                logger.debug("callServer(" + methodIndex + ", " + brokerId + ", " + pbKey + ", " + arg1 + ", " + arg2 + ", " + arg3 + ")");
  +                request = new Request(methodIndex, brokerid, pbKey, arg1, arg2, arg3);
   
               }
               oos.writeObject(request);
               oos.flush();
               if (useCompression)
               {
  -            	gzipos.finish();
  -            	gzipos.flush();
  +                gzipos.finish();
  +                gzipos.flush();
               }
               os.flush();
   
  @@ -303,19 +308,19 @@
               InputStream is = connection.getInputStream();
               if (useCompression)
               {
  -            	gzipis = new GZIPInputStream(is);
  -            	ois = new BetterObjectInputStream(gzipis);
  +                gzipis = new GZIPInputStream(is);
  +                ois = new BetterObjectInputStream(gzipis);
               }
               else
               {
  -            	ois = new BetterObjectInputStream(is);
  +                ois = new BetterObjectInputStream(is);
               }
               Object result = ois.readObject();
   
               ois.close();
               if (useCompression)
               {
  -            	gzipis.close();
  +                gzipis.close();
               }
               is.close();
               connection.close();
  @@ -356,7 +361,7 @@
       private void postServer(int methodIndex, int brokerid, Object arg1, Object arg2, Object arg3)
       {
           logger.debug(
  -            "postServer("
  +                "postServer("
                   + methodIndex
                   + ", "
                   + brokerId
  @@ -401,6 +406,47 @@
           }
       }
   
  +    public synchronized DescriptorRepository getDescriptorRepository()
  +    {
  +        /* @todo implementation of this Method */
  +        throw new UnsupportedOperationException("Not implemented method");
  +    }
  +
  +    public SqlGenerator serviceSqlGenerator()
  +    {
  +        /*@todo implementation*/
  +        throw new UnsupportedOperationException("Not implemented!!");
  +    }
  +
  +    public StatementManagerIF serviceStatementManager()
  +    {
  +        /*@todo implementation*/
  +        throw new UnsupportedOperationException("Not implemented!!");
  +    }
  +
  +    public ConnectionManagerIF serviceConnectionManager()
  +    {
  +        /*@todo implementation*/
  +        throw new UnsupportedOperationException("Not implemented!!");
  +    }
  +
  +    public SequenceManager serviceSequenceManager()
  +    {
  +        /*@todo implementation*/
  +        throw new UnsupportedOperationException("Not implemented!!");
  +    }
  +
  +    public BrokerHelper serviceBrokerHelper()
  +    {
  +        /*@todo implementation*/
  +        throw new UnsupportedOperationException("Not implemented!!");
  +    }
  +
  +    public void fireBrokerEvent(Object instance, int eventId)
  +    {
  +        /*@todo implementation*/
  +        throw new UnsupportedOperationException("Not implemented!!");
  +    }
   
       public void delete(Object obj) throws PersistenceBrokerException
       {
  @@ -491,7 +537,7 @@
           for (int i = 0; i < referenceDescriptors.size(); i++)
           {
               ObjectReferenceDescriptor referenceDescriptor =
  -                (ObjectReferenceDescriptor) referenceDescriptors.elementAt(i);
  +                    (ObjectReferenceDescriptor) referenceDescriptors.elementAt(i);
               if (referenceDescriptor.getCascadeStore())
               {
                   PersistentField field = referenceDescriptor.getPersistentField();
  @@ -603,7 +649,7 @@
               throws PersistenceBrokerException
       {
           Object result =
  -            callServer(PBMethodIndex.GET_COLLECTION_BY_QUERY_WITH_CLASS, collectionClass, query);
  +                callServer(PBMethodIndex.GET_COLLECTION_BY_QUERY_WITH_CLASS, collectionClass, query);
           if (result == null)
               return null;
           if (result instanceof ManageableCollection)
  @@ -652,10 +698,10 @@
       }
   
       public Enumeration getPKEnumerationByQuery(Class primaryKeyClass, Query query)
  -        throws PersistenceBrokerException
  +            throws PersistenceBrokerException
       {
           Object result =
  -            callServer(PBMethodIndex.GET_PK_ENUMERATION_BY_QUERY, primaryKeyClass, query);
  +                callServer(PBMethodIndex.GET_PK_ENUMERATION_BY_QUERY, primaryKeyClass, query);
           if (result == null)
               return null;
           if (result instanceof Enumeration)
  @@ -668,7 +714,7 @@
       }
   
       public void store(Object obj, ObjectModification modification)
  -        throws PersistenceBrokerException
  +            throws PersistenceBrokerException
       {
           Object result = callServer(PBMethodIndex.STORE_WITH_MODIFICATION, obj, modification);
           if (result == null)
  @@ -738,85 +784,6 @@
   
       }
   
  -    public int getUniqueId(FieldDescriptor field) throws PersistenceBrokerException
  -    {
  -        /*@todo implementation*/
  -        throw new UnsupportedOperationException("Not implemented!!");
  -    }
  -
  -    public long getUniqueLong(FieldDescriptor field) throws PersistenceBrokerException
  -    {
  -        /*@todo implementation*/
  -        throw new UnsupportedOperationException("Not implemented!!");
  -    }
  -
  -    public String getUniqueString(FieldDescriptor field) throws PersistenceBrokerException
  -    {
  -        /*@todo implementation*/
  -        throw new UnsupportedOperationException("Not implemented!!");
  -    }
  -
  -    public Object getUniqueObject(FieldDescriptor field) throws PersistenceBrokerException
  -    {
  -        /*@todo implementation*/
  -        throw new UnsupportedOperationException("Not implemented!!");
  -    }
  -
  -    public int getUniqueId(Class extent, String attribute) throws PersistenceBrokerException
  -    {
  -        Object result = callServer(PBMethodIndex.GET_UNIQUE_ID, extent, attribute);
  -        if (result instanceof Integer)
  -            return ((Integer) result).intValue();
  -        else if (result instanceof PersistenceBrokerException)
  -            throw (PersistenceBrokerException) result;
  -        else
  -            throw new PersistenceBrokerException(((Throwable) result).getMessage());
  -    }
  -
  -    public String getUniqueString(Class extent, String attribute) throws PersistenceBrokerException
  -    {
  -        Object result = callServer(PBMethodIndex.GET_UNIQUE_STRING, extent, attribute);
  -        if (result instanceof String)
  -            return (String) result;
  -        else if (result instanceof PersistenceBrokerException)
  -            throw (PersistenceBrokerException) result;
  -        else
  -            throw new PersistenceBrokerException(((Throwable) result).getMessage());
  -    }
  -
  -    /**
  -     * returns a unique Object for class extent and field attribute.
  -     * the returned Object is unique accross all tables in the extent of class extent.
  -     */
  -    public Object getUniqueObject(Class extent, String attribute) throws PersistenceBrokerException
  -    {
  -        Object result = callServer(PBMethodIndex.GET_UNIQUE_OBJECT, extent, attribute);
  -        if (result == null)
  -            return null;
  -        if (result instanceof PersistenceBrokerException)
  -            throw (PersistenceBrokerException) result;
  -        else if (result instanceof Throwable)
  -            throw new PersistenceBrokerException(((Throwable) result).getMessage());
  -        else
  -            return result;
  -
  -    }
  -
  -    /**
  -     * returns a unique long for class extent and field attribute.
  -     * the returned number is unique accross all tables in the extent of class extent.
  -     */
  -    public long getUniqueLong(Class extent, String attribute) throws PersistenceBrokerException
  -    {
  -        Object result = callServer(PBMethodIndex.GET_UNIQUE_LONG, extent, attribute);
  -        if (result instanceof Long)
  -            return ((Long) result).longValue();
  -        else if (result instanceof PersistenceBrokerException)
  -            throw (PersistenceBrokerException) result;
  -        else
  -            throw new PersistenceBrokerException(((Throwable) result).getMessage());
  -
  -    }
   
       /**
        * returns a ClassDescriptor for the persistence capable class clazz.
  @@ -825,7 +792,7 @@
   
        */
       public synchronized ClassDescriptor getClassDescriptor(Class clazz)
  -        throws PersistenceBrokerException
  +            throws PersistenceBrokerException
       {
           ClassDescriptor cachedCLD = (ClassDescriptor) cachedMetaData.get(clazz.getName());
           if (cachedCLD != null)
  @@ -849,40 +816,9 @@
           }
       }
   
  -    public synchronized DescriptorRepository getDescriptorRepository()
  -    {
  -//        DescriptorRepository cachedDR = (DescriptorRepository) cachedMetaData.get(DescriptorRepository.class.getName());
  -//        if (cachedDR != null)
  -//        {
  -//            return cachedDR;
  -//        }
  -//        else
  -//        {
  -//            logger.debug("look up " + DescriptorRepository.class.getName());
  -//            Object result = callServer(PBMethodIndex.GET_CLASS_DESCRIPTOR);
  -//            if (result instanceof DescriptorRepository)
  -//            {
  -//                cachedDR = (DescriptorRepository) result;
  -//                cachedMetaData.put(DescriptorRepository.class.getName(), cachedDR);
  -//                return cachedDR;
  -//            }
  -//            else if (result instanceof PersistenceBrokerException)
  -//                throw (PersistenceBrokerException) result;
  -//            else
  -//                throw new PersistenceBrokerException(((Throwable) result).getMessage());
  -//        }
  -        /* @todo implementation of this Method */
  -        throw new UnsupportedOperationException("Not implemented method");
  -    }
  -
       public PBKey getPBKey()
       {
  -        return repository;
  -    }
  -
  -    public void setPBKey(PBKey key)
  -    {
  -        this.repository = repository;
  +        return pbKey;
       }
   
       public synchronized boolean hasClassDescriptor(Class clazz)
  @@ -919,34 +855,6 @@
       }
   
       /**
  -     * adds a new or replaces an existing ClassDescriptor to the DescriptorRepository.
  -     */
  -    public synchronized void setClassDescriptor(ClassDescriptor modifiedOrNewDescriptor)
  -        throws PersistenceBrokerException
  -    {
  -        Object result = callServer(PBMethodIndex.SET_CLASS_DESCRIPTOR, modifiedOrNewDescriptor);
  -        if (result == null)
  -        {
  -            String classname = modifiedOrNewDescriptor.getClassOfObject().getName();
  -            ClassDescriptor cachedCLD = (ClassDescriptor) cachedMetaData.get(classname);
  -            if (cachedCLD != null)
  -            {
  -                cachedMetaData.put(classname, modifiedOrNewDescriptor);
  -            }
  -        }
  -
  -        else if (result instanceof PersistenceBrokerException)
  -        {
  -            throw (PersistenceBrokerException) result;
  -        }
  -        else
  -        {
  -            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.
  @@ -1060,16 +968,6 @@
       {
       }
   
  -    public StatementManagerIF getStatementManager()
  -    {
  -        return null;
  -    }
  -
  -    public ConnectionManagerIF getConnectionManager()
  -    {
  -        return null;
  -    }
  -
       /*
        * @see ObjectContainer#query()
        */
  @@ -1083,13 +981,14 @@
           else
               throw new PersistenceBrokerException(((Throwable) result).getMessage());
       }
  +
       /**
        * @see org.apache.ojb.broker.server.ServerAdministration#reboot()
        */
       public void reboot()
       {
  -   		Object result = callServer(PBMethodIndex.SERVER_RESTART);
  -   		System.out.println(result);
  +        Object result = callServer(PBMethodIndex.SERVER_RESTART);
  +        System.out.println(result);
       }
   
       /**
  @@ -1097,10 +996,10 @@
        */
       public void stop()
       {
  -    	// stop must be called asynchronously, as server can't
  -    	// reply when it is stopped :-)
  -   		postServer(PBMethodIndex.SERVER_STOP,brokerId, null, null, null);
  -   		System.out.println("issued server stop command...");
  +        // stop must be called asynchronously, as server can't
  +        // reply when it is stopped :-)
  +        postServer(PBMethodIndex.SERVER_STOP, brokerId, null, null, null);
  +        System.out.println("issued server stop command...");
       }
   
       /**
  @@ -1108,19 +1007,19 @@
        */
       public void statistics()
       {
  -   		Object result = callServer(PBMethodIndex.SERVER_STATISTICS);
  -   		System.out.println(result);
  +        Object result = callServer(PBMethodIndex.SERVER_STATISTICS);
  +        System.out.println(result);
       }
   
  -	/**
  -	 * @see org.apache.ojb.broker.PersistenceBroker#retrieveAllReferences(Object)
  -	 */
  -	public void retrieveAllReferences(Object pInstance) throws PersistenceBrokerException
  -	{
  -		Object result = callServer(PBMethodIndex.RETRIEVE_ALL_REFERENCES, pInstance);
  +    /**
  +     * @see org.apache.ojb.broker.PersistenceBroker#retrieveAllReferences(Object)
  +     */
  +    public void retrieveAllReferences(Object pInstance) throws PersistenceBrokerException
  +    {
  +        Object result = callServer(PBMethodIndex.RETRIEVE_ALL_REFERENCES, pInstance);
           if (result == null)
           {
  -        	return;
  +            return;
           }
           else if (result instanceof PersistenceBrokerException)
           {
  @@ -1130,18 +1029,18 @@
           {
               throw new PersistenceBrokerException(((Throwable) result).getMessage());
           }
  -	}
  +    }
   
  -	/**
  -	 * @see org.apache.ojb.broker.PersistenceBroker#retrieveReference(Object, String)
  -	 */
  -	public void retrieveReference(Object pInstance, String pAttributeName)
  -		throws PersistenceBrokerException
  -	{
  -		Object result = callServer(PBMethodIndex.RETRIEVE_REFERENCE, pInstance, pAttributeName);
  +    /**
  +     * @see org.apache.ojb.broker.PersistenceBroker#retrieveReference(Object, String)
  +     */
  +    public void retrieveReference(Object pInstance, String pAttributeName)
  +            throws PersistenceBrokerException
  +    {
  +        Object result = callServer(PBMethodIndex.RETRIEVE_REFERENCE, pInstance, pAttributeName);
           if (result == null)
           {
  -        	return;
  +            return;
           }
           else if (result instanceof PersistenceBrokerException)
           {
  @@ -1152,7 +1051,7 @@
               throw new PersistenceBrokerException(((Throwable) result).getMessage());
           }
   
  -	}
  +    }
   
       /**
        * Adds a listener to the PersistenceBroker
  @@ -1168,7 +1067,7 @@
        * @param listener
        */
       public void removeListener(PersistenceBrokerListener listener)
  -        throws PersistenceBrokerException
  +            throws PersistenceBrokerException
       {
           throw new PersistenceBrokerException("Not Implemented On Client");
       }
  @@ -1180,15 +1079,16 @@
       {
           throw new PersistenceBrokerException("Not Implemented On Client");
       }
  -	/**
  -	 * @see org.apache.ojb.broker.PersistenceBroker#deleteByQuery(Query)
  -	 */
  -	public void deleteByQuery(Query query) throws PersistenceBrokerException
  -	{
  -		Object result = callServer(PBMethodIndex.DELETE_BY_QUERY, query);
  +
  +    /**
  +     * @see org.apache.ojb.broker.PersistenceBroker#deleteByQuery(Query)
  +     */
  +    public void deleteByQuery(Query query) throws PersistenceBrokerException
  +    {
  +        Object result = callServer(PBMethodIndex.DELETE_BY_QUERY, query);
           if (result == null)
           {
  -        	return;
  +            return;
           }
           else if (result instanceof PersistenceBrokerException)
           {
  @@ -1199,6 +1099,115 @@
               throw new PersistenceBrokerException(((Throwable) result).getMessage());
           }
   
  -	}
  +    }
  +
  +//    /**
  +//     * adds a new or replaces an existing ClassDescriptor to the DescriptorRepository.
  +//     */
  +//    public synchronized void setClassDescriptor(ClassDescriptor modifiedOrNewDescriptor)
  +//            throws PersistenceBrokerException
  +//    {
  +//        Object result = callServer(PBMethodIndex.SET_CLASS_DESCRIPTOR, modifiedOrNewDescriptor);
  +//        if (result == null)
  +//        {
  +//            String classname = modifiedOrNewDescriptor.getClassOfObject().getName();
  +//            ClassDescriptor cachedCLD = (ClassDescriptor) cachedMetaData.get(classname);
  +//            if (cachedCLD != null)
  +//            {
  +//                cachedMetaData.put(classname, modifiedOrNewDescriptor);
  +//            }
  +//        }
  +//
  +//        else if (result instanceof PersistenceBrokerException)
  +//        {
  +//            throw (PersistenceBrokerException) result;
  +//        }
  +//        else
  +//        {
  +//            throw new PersistenceBrokerException(((Throwable) result).getMessage());
  +//        }
  +//    }
  +
  +
  +//    public int getUniqueId(FieldDescriptor field) throws PersistenceBrokerException
  +//    {
  +//        /*@todo implementation*/
  +//        throw new UnsupportedOperationException("Not implemented!!");
  +//    }
  +//
  +//    public long getUniqueLong(FieldDescriptor field) throws PersistenceBrokerException
  +//    {
  +//        /*@todo implementation*/
  +//        throw new UnsupportedOperationException("Not implemented!!");
  +//    }
  +//
  +//    public String getUniqueString(FieldDescriptor field) throws PersistenceBrokerException
  +//    {
  +//        /*@todo implementation*/
  +//        throw new UnsupportedOperationException("Not implemented!!");
  +//    }
  +//
  +//    public Object getUniqueObject(FieldDescriptor field) throws PersistenceBrokerException
  +//    {
  +//        /*@todo implementation*/
  +//        throw new UnsupportedOperationException("Not implemented!!");
  +//    }
  +//
  +//    public int getUniqueId(Class extent, String attribute) throws PersistenceBrokerException
  +//    {
  +//        Object result = callServer(PBMethodIndex.GET_UNIQUE_ID, extent, attribute);
  +//        if (result instanceof Integer)
  +//            return ((Integer) result).intValue();
  +//        else if (result instanceof PersistenceBrokerException)
  +//            throw (PersistenceBrokerException) result;
  +//        else
  +//            throw new PersistenceBrokerException(((Throwable) result).getMessage());
  +//    }
  +//
  +//    public String getUniqueString(Class extent, String attribute) throws PersistenceBrokerException
  +//    {
  +//        Object result = callServer(PBMethodIndex.GET_UNIQUE_STRING, extent, attribute);
  +//        if (result instanceof String)
  +//            return (String) result;
  +//        else if (result instanceof PersistenceBrokerException)
  +//            throw (PersistenceBrokerException) result;
  +//        else
  +//            throw new PersistenceBrokerException(((Throwable) result).getMessage());
  +//    }
  +//
  +//    /**
  +//     * returns a unique Object for class extent and field attribute.
  +//     * the returned Object is unique accross all tables in the extent of class extent.
  +//     */
  +//    public Object getUniqueObject(Class extent, String attribute) throws PersistenceBrokerException
  +//    {
  +//        Object result = callServer(PBMethodIndex.GET_UNIQUE_OBJECT, extent, attribute);
  +//        if (result == null)
  +//            return null;
  +//        if (result instanceof PersistenceBrokerException)
  +//            throw (PersistenceBrokerException) result;
  +//        else if (result instanceof Throwable)
  +//            throw new PersistenceBrokerException(((Throwable) result).getMessage());
  +//        else
  +//            return result;
  +//
  +//    }
  +//
  +//    /**
  +//     * returns a unique long for class extent and field attribute.
  +//     * the returned number is unique accross all tables in the extent of class extent.
  +//     */
  +//    public long getUniqueLong(Class extent, String attribute) throws PersistenceBrokerException
  +//    {
  +//        Object result = callServer(PBMethodIndex.GET_UNIQUE_LONG, extent, attribute);
  +//        if (result instanceof Long)
  +//            return ((Long) result).longValue();
  +//        else if (result instanceof PersistenceBrokerException)
  +//            throw (PersistenceBrokerException) result;
  +//        else
  +//            throw new PersistenceBrokerException(((Throwable) result).getMessage());
  +//
  +//    }
  +
   
   }
  
  
  
  1.12      +122 -100  jakarta-ojb/src/java/org/apache/ojb/broker/server/RequestProcessor.java
  
  Index: RequestProcessor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ojb/src/java/org/apache/ojb/broker/server/RequestProcessor.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- RequestProcessor.java	1 Dec 2002 11:48:38 -0000	1.11
  +++ RequestProcessor.java	24 Dec 2002 13:19:18 -0000	1.12
  @@ -54,11 +54,11 @@
   package org.apache.ojb.broker.server;
   
   
  -import java.net.InetAddress;
  -import java.net.UnknownHostException;
  -import java.util.*;
  -
  -import org.apache.ojb.broker.*;
  +import org.apache.ojb.broker.Identity;
  +import org.apache.ojb.broker.PBKey;
  +import org.apache.ojb.broker.PersistenceBroker;
  +import org.apache.ojb.broker.PersistenceBrokerException;
  +import org.apache.ojb.broker.PersistenceBrokerFactory;
   import org.apache.ojb.broker.accesslayer.PkIterator;
   import org.apache.ojb.broker.accesslayer.RsIterator;
   import org.apache.ojb.broker.metadata.ClassDescriptor;
  @@ -66,6 +66,7 @@
   import org.apache.ojb.broker.query.Query;
   import org.apache.ojb.broker.singlevm.PersistenceBrokerConfiguration;
   import org.apache.ojb.broker.util.ObjectModification;
  +import org.apache.ojb.broker.util.sequence.SequenceManagerException;
   import org.apache.ojb.broker.util.configuration.Configurable;
   import org.apache.ojb.broker.util.configuration.Configuration;
   import org.apache.ojb.broker.util.configuration.ConfigurationException;
  @@ -74,14 +75,25 @@
   import org.odmg.ODMGRuntimeException;
   import org.odmg.TransactionInProgressException;
   
  +import java.net.InetAddress;
  +import java.net.UnknownHostException;
  +import java.util.Collection;
  +import java.util.Date;
  +import java.util.Enumeration;
  +import java.util.HashMap;
  +import java.util.Hashtable;
  +import java.util.Iterator;
  +import java.util.Map;
  +import java.util.NoSuchElementException;
  +
   /**
    * This class does the real processing of a Request object.
    */
   public class RequestProcessor implements PBMethodIndex, Configurable
   {
  -	/**
  -	 * the table of RsIterators
  -	 */
  +    /**
  +     * the table of RsIterators
  +     */
       private static RsIteratorTable iterators = new RsIteratorTable();
   
       /**
  @@ -109,25 +121,24 @@
        * the Broker themselves.
        */
       private static int[] noBrokerMethods =
  -            { NEXT, HAS_NEXT, RELEASE_DB_RESOURCES, SERVER_PING,
  -              SERVER_STOP, SERVER_RESTART, SERVER_STATISTICS};
  +            {NEXT, HAS_NEXT, RELEASE_DB_RESOURCES, SERVER_PING,
  +             SERVER_STOP, SERVER_RESTART, SERVER_STATISTICS};
       private Map brokerpools;
       private BrokerPool brokerpool;
       private ServerPool serverpool;
       private Logger logger;
   
  -    private synchronized void  incRequests()
  +    private synchronized void incRequests()
       {
  -    	requests++;
  +        requests++;
       }
   
  -    private synchronized void  addRequestTime(long delta)
  +    private synchronized void addRequestTime(long delta)
       {
  -    	requestTime += delta;
  +        requestTime += delta;
       }
   
   
  -
       /**
        * Creates a new RequestProcessor.
        * @param brokerpool the BrokerPool to select the PersistenceBrokers from.
  @@ -146,7 +157,8 @@
       public RequestProcessor(BrokerPool[] pools)
       {
           brokerpools = new HashMap();
  -        for (int i = 0; i < pools.length; i++) {
  +        for (int i = 0; i < pools.length; i++)
  +        {
               BrokerPool brokerpool = pools[i];
               brokerpools.put(brokerpool.getRepositoryFile(), brokerpool);
           }
  @@ -155,17 +167,17 @@
   
       protected void logMethod(int methodIndex)
       {
  -    	Integer key = new Integer(methodIndex);
  -    	Long value = (Long) methods.get(key);
  -    	if (value == null)
  -    	{
  -    		value = new Long(1);
  -    	}
  -    	else
  -    	{
  -    		value = new Long(value.longValue() + 1);
  -    	}
  -    	methods.put(key,value);
  +        Integer key = new Integer(methodIndex);
  +        Long value = (Long) methods.get(key);
  +        if (value == null)
  +        {
  +            value = new Long(1);
  +        }
  +        else
  +        {
  +            value = new Long(value.longValue() + 1);
  +        }
  +        methods.put(key, value);
       }
   
       /**
  @@ -176,24 +188,28 @@
        */
       public Object execute(Request request)
       {
  -    	incRequests();
  -    	long startTime= System.currentTimeMillis();
  +        incRequests();
  +        long startTime = System.currentTimeMillis();
           int methodIndex = request.getMethodIndex();
           logMethod(methodIndex);
           int brokerId = request.getBrokerId();
           PBKey repository = request.getRepository();
           String repositoryFile = null;
  -        if (repository != null) {
  +        if (repository != null)
  +        {
               repositoryFile = request.getRepository().getRepositoryFile();
           }
           Object arg1 = request.getArg1();
           Object arg2 = request.getArg2();
           Object arg3 = request.getArg3();
   
  -        if (brokerId != -1) {
  +        if (brokerId != -1)
  +        {
               logger.debug(
                       "dispatching [" + methodIndex + "," + brokerId + "," + arg1 + "," + arg2 + "," + arg3 + "]");
  -        } else {
  +        }
  +        else
  +        {
               logger.debug(
                       "dispatching [" + methodIndex + "," + brokerId + "," + repositoryFile + "," + arg1 + "," + arg2 + "," + arg3 + "]");
           }
  @@ -214,10 +230,11 @@
           {
               // If this is the first call, choose the BrokerPool instance
               // containing brokers for this repository
  -            if (brokerId == -1) {
  +            if (brokerId == -1)
  +            {
                   logger.debug("looking up BrokerPool for " + repositoryFile);
                   logger.debug("in map: " + brokerpools);
  -                brokerpool = (BrokerPool)brokerpools.get(repositoryFile);
  +                brokerpool = (BrokerPool) brokerpools.get(repositoryFile);
                   brokerId = brokerpool.getFreeBrokerId();
               }
               broker = brokerpool.getBrokerById(brokerId);
  @@ -259,7 +276,7 @@
                   case DELETE_BY_QUERY:
                       {
                           //has no result
  -                        broker.deleteByQuery((Query)arg1);
  +                        broker.deleteByQuery((Query) arg1);
                           break;
                       }
   
  @@ -315,9 +332,9 @@
   
                   case GET_UNIQUE_ID:
                       {
  -                    	ClassDescriptor cld = broker.getClassDescriptor((Class) arg1);
  -    					FieldDescriptor fld = cld.getFieldDescriptorByName((String) arg2);
  -                        int uid = broker.getUniqueId(fld);
  +                        ClassDescriptor cld = broker.getClassDescriptor((Class) arg1);
  +                        FieldDescriptor fld = cld.getFieldDescriptorByName((String) arg2);
  +                        int uid = broker.serviceSequenceManager().getUniqueId(fld);
                           result = new Integer(uid);
                           logger.debug("UID: " + uid);
                           break;
  @@ -325,27 +342,27 @@
   
                   case GET_UNIQUE_LONG:
                       {
  -                    	ClassDescriptor cld = broker.getClassDescriptor((Class) arg1);
  -    					FieldDescriptor fld = cld.getFieldDescriptorByName((String) arg2);
  -                        result = new Long(broker.getUniqueLong(fld));
  +                        ClassDescriptor cld = broker.getClassDescriptor((Class) arg1);
  +                        FieldDescriptor fld = cld.getFieldDescriptorByName((String) arg2);
  +                        result = new Long(broker.serviceSequenceManager().getUniqueLong(fld));
                           logger.debug("UID: " + result);
                           break;
                       }
   
                   case GET_UNIQUE_STRING:
                       {
  -                    	ClassDescriptor cld = broker.getClassDescriptor((Class) arg1);
  -    					FieldDescriptor fld = cld.getFieldDescriptorByName((String) arg2);
  -                        result = broker.getUniqueString(fld);
  +                        ClassDescriptor cld = broker.getClassDescriptor((Class) arg1);
  +                        FieldDescriptor fld = cld.getFieldDescriptorByName((String) arg2);
  +                        result = broker.serviceSequenceManager().getUniqueString(fld);
                           logger.debug("UID: " + result);
                           break;
                       }
   
                   case GET_UNIQUE_OBJECT:
                       {
  -                    	ClassDescriptor cld = broker.getClassDescriptor((Class) arg1);
  -    					FieldDescriptor fld = cld.getFieldDescriptorByName((String) arg2);
  -                        result = broker.getUniqueObject(fld);
  +                        ClassDescriptor cld = broker.getClassDescriptor((Class) arg1);
  +                        FieldDescriptor fld = cld.getFieldDescriptorByName((String) arg2);
  +                        result = broker.serviceSequenceManager().getUniqueObject(fld);
                           logger.debug("UID: " + result);
                           break;
                       }
  @@ -404,7 +421,8 @@
                   case SET_CLASS_DESCRIPTOR:
                       {
                           //has no result
  -                        broker.setClassDescriptor((ClassDescriptor) arg1);
  +                        ClassDescriptor cld = (ClassDescriptor) arg1;
  +                        broker.getDescriptorRepository().put(cld.getClassOfObject(), cld);
                           break;
                       }
   
  @@ -438,28 +456,28 @@
                       }
                   case RETRIEVE_ALL_REFERENCES:
                       {
  -                    	try
  -                    	{
  -                    		broker.retrieveAllReferences(arg1);
  -                    		result = null;
  -                    	}
  -                    	catch (Throwable t)
  -                    	{
  -                    		result = t;
  -                    	}
  +                        try
  +                        {
  +                            broker.retrieveAllReferences(arg1);
  +                            result = null;
  +                        }
  +                        catch (Throwable t)
  +                        {
  +                            result = t;
  +                        }
                           break;
                       }
                   case RETRIEVE_REFERENCE:
                       {
  -                    	try
  -                    	{
  -                    		broker.retrieveReference(arg1, (String) arg2);
  -                    		result = null;
  -                    	}
  -                    	catch (Throwable t)
  -                    	{
  -                    		result = t;
  -                    	}
  +                        try
  +                        {
  +                            broker.retrieveReference(arg1, (String) arg2);
  +                            result = null;
  +                        }
  +                        catch (Throwable t)
  +                        {
  +                            result = t;
  +                        }
                           break;
                       }
   
  @@ -501,12 +519,16 @@
           {
               result = e;
           }
  +        catch(SequenceManagerException e)
  +        {
  +            result = e;
  +        }
           finally
           {
  -        	// collect statistics:
  -        	long stopTime = System.currentTimeMillis();
  -        	long delta = stopTime - startTime;
  -        	addRequestTime(delta);
  +            // collect statistics:
  +            long stopTime = System.currentTimeMillis();
  +            long delta = stopTime - startTime;
  +            addRequestTime(delta);
   
   
               //release the broker, when it is not a permanently assigned one (e.g. one running a transaction).
  @@ -539,45 +561,45 @@
   
       private Object srvStop()
       {
  -    	PersistenceBrokerFactory.releaseAllInstances();
  -    	System.exit(0);
  -    	return new String("shutting down server...");
  +        PersistenceBrokerFactory.releaseAllInstances();
  +        System.exit(0);
  +        return new String("shutting down server...");
       }
   
       private Object srvRestart()
       {
  -    	PersistenceBrokerFactory.releaseAllInstances();
  -    	return new String("restarting server...");
  +        PersistenceBrokerFactory.releaseAllInstances();
  +        return new String("restarting server...");
       }
   
       private Object srvStatistics()
       {
  -    	long avgTime = 0;
  -    	if (requests != 0)
  -    	{
  -    		avgTime = requestTime / requests;
  -    	}
  -
  -    	// Requestprofil erzeugen
  -    	String calls = "calls per method (see PBMethodIndex for method ids):\n";
  -    	Collection entries = methods.entrySet();
  -    	Iterator iter = entries.iterator();
  -    	while (iter.hasNext())
  -    	{
  -    		Map.Entry entry = (Map.Entry) iter.next();
  -    		calls += (entry.getKey().toString() + "\t");
  -    		calls += (entry.getValue().toString() + "\n");
  -    	}
  -
  -    	String result =
  -    		"OJB server statistics:\n"
  -    	  + "server is up since: " + upSince.toString() + "\n"
  -    	  +	"served requests:    " + requests + "\n"
  -    	  + "total time:         " + requestTime + "\n"
  -    	  + "avg per request:    " + avgTime + "\n"
  -    	  + calls;
  +        long avgTime = 0;
  +        if (requests != 0)
  +        {
  +            avgTime = requestTime / requests;
  +        }
   
  -    	return result;
  +        // Requestprofil erzeugen
  +        String calls = "calls per method (see PBMethodIndex for method ids):\n";
  +        Collection entries = methods.entrySet();
  +        Iterator iter = entries.iterator();
  +        while (iter.hasNext())
  +        {
  +            Map.Entry entry = (Map.Entry) iter.next();
  +            calls += (entry.getKey().toString() + "\t");
  +            calls += (entry.getValue().toString() + "\n");
  +        }
  +
  +        String result =
  +                "OJB server statistics:\n"
  +                + "server is up since: " + upSince.toString() + "\n"
  +                + "served requests:    " + requests + "\n"
  +                + "total time:         " + requestTime + "\n"
  +                + "avg per request:    " + avgTime + "\n"
  +                + calls;
  +
  +        return result;
       }
   
   
  
  
  

Mime
View raw message