User: sylvain 
  Date: 00/05/30 16:35:41

  Modified:    src/java/org/ejboss/container Container.java
  Log:
  Fixed the logIdentifier in InitMetaData. it was not consistent with the way 
Tracer.trace parsed it.
  In case the owner or the application name are unknow, they default to "defaultOwner" 
and "defaultApplication"
  
  Revision  Changes    Path
  1.55      +806 -801  ejboss/src/java/org/ejboss/container/Container.java
  
  Index: Container.java
  ===================================================================
  RCS file: /products/cvs/ejboss/ejboss/src/java/org/ejboss/container/Container.java,v
  retrieving revision 1.54
  retrieving revision 1.55
  diff -u -r1.54 -r1.55
  --- Container.java    2000/05/26 18:08:38     1.54
  +++ Container.java    2000/05/30 23:35:41     1.55
  @@ -99,58 +99,58 @@
   
   public class Container {
   
  -    /**
  -    * The EjbJar that holds the bean and the assembly descriptor
  -    *
  -    * @since EJBoss 0.9
  -    */
  -
  -    private EjbJar ejbJar;
  -
  -    /**
  -    * The wrapper manager for this container
  -    *
  -    * @since EJBoss 0.9
  -    */
  -    private EnterpriseBeanWrapperManager wrapperManager;
  -
  -
  -    /*
  -    * ContainerMetaData
  -    *
  -    * ContainerMetaData holds a copy of the information from the jar
  -    *
  -    * @since EJBoss 0.9
  -    */
  -    public ContainerMetaData metaData;
  -
  -    /*
  -    * ReusableByteArrayInputStreamManager
  -    *
  -    * The container keeps a reference to the manager for reusable bais.
  -    * It speeds up the deserializing from the clients
  -    *
  -    * @since EJBoss 0.9
  -    */
  -    private ReusableByteArrayInputStreamManager rbaisManager;
  -
  -    /*
  -    * Transaction Manager implementation
  -    *
  -    * The transaction manager is unique in this VM
  -    *
  -    * @since EJBoss 0.9
  -    */
  -    public Current transactionManager;
  -
  -    /*
  -    * Persistent storage implementation
  -    *
  -    * The transaction manager is unique in this VM
  -    *
  -    * @since EJBoss 0.9
  -    */
  -    public PersistentStorage persistentStorage;
  +     /**
  +     * The EjbJar that holds the bean and the assembly descriptor
  +     *
  +     * @since EJBoss 0.9
  +     */
  +
  +     private EjbJar ejbJar;
  +
  +     /**
  +     * The wrapper manager for this container
  +     *
  +     * @since EJBoss 0.9
  +     */
  +     private EnterpriseBeanWrapperManager wrapperManager;
  +
  +
  +     /*
  +     * ContainerMetaData
  +     *
  +     * ContainerMetaData holds a copy of the information from the jar
  +     *
  +     * @since EJBoss 0.9
  +     */
  +     public ContainerMetaData metaData;
  +
  +     /*
  +     * ReusableByteArrayInputStreamManager
  +     *
  +     * The container keeps a reference to the manager for reusable bais.
  +     * It speeds up the deserializing from the clients
  +     *
  +     * @since EJBoss 0.9
  +     */
  +     private ReusableByteArrayInputStreamManager rbaisManager;
  +
  +     /*
  +     * Transaction Manager implementation
  +     *
  +     * The transaction manager is unique in this VM
  +     *
  +     * @since EJBoss 0.9
  +     */
  +     public Current transactionManager;
  +
  +     /*
  +     * Persistent storage implementation
  +     *
  +     * The transaction manager is unique in this VM
  +     *
  +     * @since EJBoss 0.9
  +     */
  +     public PersistentStorage persistentStorage;
        
        /*
        * The User Owner of the container (system)
  @@ -170,302 +170,307 @@
   /******************************************************************************/
   /******************************************************************************/
   
  -    /**
  -     * Initialize the container.
  -     *
  -     * <p>
  -     *
  -     * It's quite possible that the container will be created with
  -     * <code>Class.newInstance()</code>, so we have to have a default
  -     * constructor that doesn't accept arguments. In this case, we'd have to
  -     * try to figure out the properties implicitly, which is cumbersome and
  -     * unreliable, so instead we <strong>require</strong> this method do be
  -     * called and throw the <code>IllegalStateException</code> if the
  -     * methods of an uninitialized container are called.
  -     *
  -     * <p>
  -     *
  -     * We pass the EnterpriseBean to be deployed as well as the full jar since
  -     * we need to store the assembly descriptor for this container.
  -     *
  -     * <p>
  -     * It is probable that this will be the place to configure the persistent
  -     * storage on a per bean basis.
  -     * <p>
  -     *
  -     * @param com.dreambean.ejx.ejb.EnterpriseBean
  -     *     The bean to deploy
  -     * @param com.dreambean.ejx.ejb.EjbJar
  -     *     The EjbJar from which it comes from
  -     */
  -    public void init(com.dreambean.ejx.ejb.EnterpriseBean bean,
  -                     EjbJar ejbJar) {
  +     /**
  +      * Initialize the container.
  +      *
  +      * <p>
  +      *
  +      * It's quite possible that the container will be created with
  +      * <code>Class.newInstance()</code>, so we have to have a default
  +      * constructor that doesn't accept arguments. In this case, we'd have to
  +      * try to figure out the properties implicitly, which is cumbersome and
  +      * unreliable, so instead we <strong>require</strong> this method do be
  +      * called and throw the <code>IllegalStateException</code> if the
  +      * methods of an uninitialized container are called.
  +      *
  +      * <p>
  +      *
  +      * We pass the EnterpriseBean to be deployed as well as the full jar since
  +      * we need to store the assembly descriptor for this container.
  +      *
  +      * <p>
  +      * It is probable that this will be the place to configure the persistent
  +      * storage on a per bean basis.
  +      * <p>
  +      *
  +      * @param com.dreambean.ejx.ejb.EnterpriseBean
  +      *     The bean to deploy
  +      * @param com.dreambean.ejx.ejb.EjbJar
  +      *     The EjbJar from which it comes from
  +      */
  +     public void init(com.dreambean.ejx.ejb.EnterpriseBean bean,
  +                                      EjbJar ejbJar) {
   
  -        this.ejbJar = ejbJar;
  +             this.ejbJar = ejbJar;
   
  -        boolean initOK= false;
  +             boolean initOK= false;
   
  -        try {
  +             try {
   
  -            // Initialize the local metaData
  +                     // Initialize the local metaData
   
  -            initOK = initMetaData(bean, ejbJar);
  +                     initOK = initMetaData(bean, ejbJar);
   
  -            // Start a EnterpriseBeanWrapperManager
  +                     // Start a EnterpriseBeanWrapperManager
   
  -            wrapperManager = new EnterpriseBeanWrapperManager(this);
  +                     wrapperManager = new EnterpriseBeanWrapperManager(this);
   
  -            // Start a ReusableByteArrayInputStreamManager
  +                     // Start a ReusableByteArrayInputStreamManager
   
  -            rbaisManager = new ReusableByteArrayInputStreamManager();
  +                     rbaisManager = new ReusableByteArrayInputStreamManager();
   
  -            // Get a reference to the transaction manager in this VM
  +                     // Get a reference to the transaction manager in this VM
   
  -            transactionManager = Current.getCurrent();
  +                     transactionManager = Current.getCurrent();
   
  -            if (metaData.isEntityCMP()) {
  +                     if (metaData.isEntityCMP()) {
   
   
  -                // Get a reference to the Persistence Manager
  -                try {
  +                             // Get a reference to the Persistence Manager
  +                             try {
   
  -                    persistentStorage = 
PersistentStorageManager.getPersistentStorage();
  +                                     persistentStorage = 
PersistentStorageManager.getPersistentStorage();
   
  -                } catch (Exception e) {
  +                             } catch (Exception e) {
   
  -                   // We can't get a persistentStorage from the server
  +                                // We can't get a persistentStorage from the server
   
  -                   Tracer.trace(TracerConstants.LOG_NOTICE, "container", "the bean 
is CMP but no persistent storage was found in the server");
  +                                Tracer.trace(TracerConstants.LOG_NOTICE, 
"container", "the bean is CMP but no persistent storage was found in the server");
   
  -                   initOK = false;
  +                                initOK = false;
   
  -                }
  +                             }
   
  -                try {
  +                             try {
   
  -                    // Initialize the persistent storage
  +                                     // Initialize the persistent storage
   
  -                    persistentStorage.initializeStorage(metaData);
  +                                     persistentStorage.initializeStorage(metaData);
   
  -                } catch (Exception e) {
  +                             } catch (Exception e) {
   
  -                    // Problem initializing the storage
  +                                     // Problem initializing the storage
   
  -                    Tracer.trace(e);
  +                                     Tracer.trace(e);
   
  -                    Tracer.trace(TracerConstants.LOG_ERR, "container", " problem 
initializing the storage");
  +                                     Tracer.trace(TracerConstants.LOG_ERR, 
"container", " problem initializing the storage");
   
  -                    initOK = false;
  -                }
  -            }
  -        }
  -        catch (Exception e ) {
  +                                     initOK = false;
  +                             }
  +                     }
  +             }
  +             catch (Exception e ) {
   
  -            // Something was not right with this bean
  +                     // Something was not right with this bean
   
  -            Tracer.trace(e);
  +                     Tracer.trace(e);
   
  -            // do not register
  +                     // do not register
   
  -            initOK = false;
  -        }
  -        finally {
  +                     initOK = false;
  +             }
  +             finally {
   
  -            if (initOK) {
  +                     if (initOK) {
   
  -                // We are done register with the main server
  +                             // We are done register with the main server
   
  -                registerContainer();
  -            }
  +                             registerContainer();
  +                     }
   
  -            else {
  +                     else {
   
  -                Tracer.trace(TracerConstants.LOG_NOTICE, "container", 
bean.getEjbName()+" was not deployed");
  -            }
  -        }
  -    }
  +                             Tracer.trace(TracerConstants.LOG_NOTICE, "container", 
bean.getEjbName()+" was not deployed");
  +                     }
  +             }
  +     }
   
  -    private boolean initMetaData(com.dreambean.ejx.ejb.EnterpriseBean bean,
  -                                 EjbJar ejbJar) throws DeploymentException {
  +     private boolean initMetaData(com.dreambean.ejx.ejb.EnterpriseBean bean,
  +                                                              EjbJar ejbJar) throws 
DeploymentException {
   
  -        // First the classical construction
  +             // First the classical construction
   
  -        metaData = new ContainerMetaData(bean, ejbJar);
  +             metaData = new ContainerMetaData(bean, ejbJar);
                
                // Log identifier is initialized if owner and application are known
                
  -             logIdentifier = bean.getEjbName()+"|"+owner+"|"+application;
  +             if( owner == null )
  +                     owner = "defaultOwner";
  +             if( application == null )
  +                     application = "defaultApplication";
  +                     
  +             logIdentifier = owner+"|"+application+"|"+bean.getEjbName();
   
  -        // Then the EJBHome construction
  +             // Then the EJBHome construction
   
  -        // Get a new PrimaryKey for EJBHome
  +             // Get a new PrimaryKey for EJBHome
   
  -        EjbossPrimaryKey pKey = new EjbossPrimaryKey(true, metaData.getJndiName());
  +             EjbossPrimaryKey pKey = new EjbossPrimaryKey(true, 
metaData.getJndiName());
   
  -        // Initialize the namespace for this container
  +             // Initialize the namespace for this container
   
  -        try {
  +             try {
   
  -            Context intialContext = new InitialContext();
  +                     Context intialContext = new InitialContext();
   
  -            // Get a local copy of the bean context
  +                     // Get a local copy of the bean context
   
  -            metaData.namingServer = new NamingServer();
  +                     metaData.namingServer = new NamingServer();
   
  -            // Set that root on the JNP package, useful for the creation of the 
subcontexts
  +                     // Set that root on the JNP package, useful for the creation 
of the subcontexts
   
  -            
org.jnp.interfaces.java.javaURLContextFactory.setRoot(metaData.namingServer);
  +                     
org.jnp.interfaces.java.javaURLContextFactory.setRoot(metaData.namingServer);
   
  -            // Create a ("comp/env") subcontext in our naming server
  +                     // Create a ("comp/env") subcontext in our naming server
   
  -            Context context = (Context) new InitialContext().lookup("java:/");
  +                     Context context = (Context) new 
InitialContext().lookup("java:/");
   
  -            context.createSubcontext("comp");
  -            context.createSubcontext("comp/env");
  -            context.createSubcontext("comp/env/jdbc");
  +                     context.createSubcontext("comp");
  +                     context.createSubcontext("comp/env");
  +                     context.createSubcontext("comp/env/jdbc");
   
  -        } catch (NamingException ne) {
  +             } catch (NamingException ne) {
   
  -            Tracer.trace(ne);
  +                     Tracer.trace(ne);
   
  -            throw new DeploymentException("Exception in init");
  +                     throw new DeploymentException("Exception in init");
   
   
  -        }
  -        // Initialize the datasources,
  +             }
  +             // Initialize the datasources,
   
  -        try{
  +             try{
   
  -            Iterator iterator = bean.getResourceReferences();
  +                     Iterator iterator = bean.getResourceReferences();
   
  -            while (iterator.hasNext()) {
  +                     while (iterator.hasNext()) {
   
  -                ResourceReference resourceReference = (ResourceReference) 
iterator.next();
  +                             ResourceReference resourceReference = 
(ResourceReference) iterator.next();
   
  -                // MF FIXME Only deal with the JDBC stuff for now
  +                             // MF FIXME Only deal with the JDBC stuff for now
   
  -                String type = resourceReference.getType();
  +                             String type = resourceReference.getType();
   
  -                // Declaring JDBC as java.sql.DataSource is mandatory per 14.4.1.3
  +                             // Declaring JDBC as java.sql.DataSource is mandatory 
per 14.4.1.3
   
  -                if (type.equalsIgnoreCase("javax.sql.DataSource")) {
  +                             if (type.equalsIgnoreCase("javax.sql.DataSource")) {
   
  -                    // Is the server jdbc enabled?
  +                                     // Is the server jdbc enabled?
   
  -                    try {
  +                                     try {
   
  -                        Object systemJDBCDataSource = (new 
InitialContext()).lookup("system/jdbcDataSource");
  +                                             Object systemJDBCDataSource = (new 
InitialContext()).lookup("system/jdbcDataSource");
   
  -                    } catch (NamingException e) {
  +                                     } catch (NamingException e) {
   
  -                        Tracer.trace(TracerConstants.LOG_WARNING, "container", 
bean.getEjbName()
  -                                     +" requires JDBC but didn't find a DataSource 
mapping");
  +                                             
Tracer.trace(TracerConstants.LOG_WARNING, "container", bean.getEjbName()
  +                                                                      +" requires 
JDBC but didn't find a DataSource mapping");
   
  -                        return false;
  -                    }
  +                                             return false;
  +                                     }
   
  -                    // Get the name the bean wants to see the reference under
  +                                     // Get the name the bean wants to see the 
reference under
   
  -                    String name = resourceReference.getName();
  +                                     String name = resourceReference.getName();
   
  -                    // Build a symbolic link to the Name of the dataSource
  +                                     // Build a symbolic link to the Name of the 
dataSource
   
  -                    LinkRef linkRef = new LinkRef("system/jdbcDataSource");
  +                                     LinkRef linkRef = new 
LinkRef("system/jdbcDataSource");
   
  -                    // create a sub context with jdbc
  +                                     // create a sub context with jdbc
   
  -                    Context context = (Context) new 
InitialContext().lookup("java:comp/env");
  +                                     Context context = (Context) new 
InitialContext().lookup("java:comp/env");
   
  -                    Context jdbcContext = (Context) context.lookup("jdbc");
  +                                     Context jdbcContext = (Context) 
context.lookup("jdbc");
   
  -                    // Store the symbolic is the jdbc namespace
  +                                     // Store the symbolic is the jdbc namespace
   
  -                    rebind(jdbcContext, name, linkRef);
  +                                     rebind(jdbcContext, name, linkRef);
   
  -                    // Store it in the straight namespace as well
  +                                     // Store it in the straight namespace as well
   
  -                    rebind(context, name, linkRef);
  +                                     rebind(context, name, linkRef);
   
  -                    /*
  -                    * MF
  -                    * The reason for the above construct is simple
  -                    * if somebody supplies a name that is
  -                    * "myDataSource" then it will appear under
  -                    *      java:comp/env/myDataSource
  -                    * and
  -                    *      java:comp/env/jdbc/myDataSource
  -                    *
  -                    * just so that we don't get a thousand support messages saying
  -                    * "where is my datasource"...
  -                    * There will probably be a dozen that say
  -                    * "How come my dataSource is under
  -                    *      java:comp/env/jdbc/jdbc/myDataSource"
  -                    *
  -                    * At least this way we know that
  -                    *     java:comp/env/jdbc/myDataSource
  -                    * will always yield a result.
  -                    *
  -                    */
  -                }
  +                                     /*
  +                                     * MF
  +                                     * The reason for the above construct is simple
  +                                     * if somebody supplies a name that is
  +                                     * "myDataSource" then it will appear under
  +                                     *      java:comp/env/myDataSource
  +                                     * and
  +                                     *      java:comp/env/jdbc/myDataSource
  +                                     *
  +                                     * just so that we don't get a thousand support 
messages saying
  +                                     * "where is my datasource"...
  +                                     * There will probably be a dozen that say
  +                                     * "How come my dataSource is under
  +                                     *      java:comp/env/jdbc/jdbc/myDataSource"
  +                                     *
  +                                     * At least this way we know that
  +                                     *     java:comp/env/jdbc/myDataSource
  +                                     * will always yield a result.
  +                                     *
  +                                     */
  +                             }
   
  -                else {
  +                             else {
   
  -                    if (!type.equals("")) {
  +                                     if (!type.equals("")) {
   
  -                        Tracer.trace(TracerConstants.LOG_WARNING, "container", 
"datasource of type "+
  -                             type+" is not deployed in this server");
  +                                             
Tracer.trace(TracerConstants.LOG_WARNING, "container", "datasource of type "+
  +                                                      type+" is not deployed in 
this server");
   
  -                        return false;
  -                    }
  -                }
  -            }
  -        } catch (NamingException e) {
  +                                             return false;
  +                                     }
  +                             }
  +                     }
  +             } catch (NamingException e) {
   
  -            Tracer.trace(e);
  +                     Tracer.trace(e);
   
  -            throw new DeploymentException("Exception in init");
  -        }
  +                     throw new DeploymentException("Exception in init");
  +             }
   
  -        // Initialize the Environment properties,
  +             // Initialize the Environment properties,
   
  -        Iterator iterator = bean.getEnvironmentEntries();
  +             Iterator iterator = bean.getEnvironmentEntries();
   
  -        while (iterator.hasNext()) {
  +             while (iterator.hasNext()) {
   
  -            EnvironmentEntry currentEntry = (EnvironmentEntry) iterator.next();
  +                     EnvironmentEntry currentEntry = (EnvironmentEntry) 
iterator.next();
   
  -            bindEnvironmentEntry(currentEntry);
  -        }
  +                     bindEnvironmentEntry(currentEntry);
  +             }
   
  -        // The ProxyContainer is our invocationHandler
  +             // The ProxyContainer is our invocationHandler
   
  -        InvocationHandler pContainer = new ProxyContainerForHome(
  -            //The key
  -            pKey,
  -            // The metaData
  -            metaData.getClientMetaData(),
  -            // An instance of the Invocation Handler
  -            Server.getServer().getInvocationHandler()
  -        );
  +             InvocationHandler pContainer = new ProxyContainerForHome(
  +                     //The key
  +                     pKey,
  +                     // The metaData
  +                     metaData.getClientMetaData(),
  +                     // An instance of the Invocation Handler
  +                     Server.getServer().getInvocationHandler()
  +             );
   
  -        // And now the actual object
  +             // And now the actual object
   
  -        EJBHome ejbHome = (EJBHome) Proxy.newProxyInstance(
  -            //The classLoader
  -            metaData.getHomeInterfaceClass().getClassLoader(),
  -            // All the interfaces we want this proxy to implement
  -            new Class[] {metaData.getEJBHomeClass(),
  -                         metaData.getHomeInterfaceClass()},
  -            // The invocation handler
  -            pContainer);
  +             EJBHome ejbHome = (EJBHome) Proxy.newProxyInstance(
  +                     //The classLoader
  +                     metaData.getHomeInterfaceClass().getClassLoader(),
  +                     // All the interfaces we want this proxy to implement
  +                     new Class[] {metaData.getEJBHomeClass(),
  +                                              metaData.getHomeInterfaceClass()},
  +                     // The invocation handler
  +                     pContainer);
   
  -        // Set the EJBHome on the metaData
  +             // Set the EJBHome on the metaData
   
  -        metaData.setEJBHome(ejbHome);
  +             metaData.setEJBHome(ejbHome);
   
  -        return true;
  +             return true;
   
  -    }
  +     }
   
   
   
  @@ -477,175 +482,175 @@
   /******************************************************************************/
   /******************************************************************************/
   
  -    public Name getJndiName() {
  +     public Name getJndiName() {
   
  -        return metaData.getBeanHomeName();
  -    }
  +             return metaData.getBeanHomeName();
  +     }
   
  -    /**
  -     * The lookup method on the EJBHome
  -     *
  -     * @since EJBoss 0.9
  -     */
  +     /**
  +      * The lookup method on the EJBHome
  +      *
  +      * @since EJBoss 0.9
  +      */
   
  -    public EJBHome getEJBHome(Principal userPrincipal) {
  +     public EJBHome getEJBHome(Principal userPrincipal) {
   
  -        // We can delegate to a SecurityManager
  -        // If ok then continue
  +             // We can delegate to a SecurityManager
  +             // If ok then continue
   
  -        // Return the metaData instance
  +             // Return the metaData instance
   
  -        return metaData.getEJBHome();
  -    }
  +             return metaData.getEJBHome();
  +     }
   
  -    public EJBHome getEJBHome() {
  +     public EJBHome getEJBHome() {
   
  -        return metaData.getEJBHome();
  -    }
  +             return metaData.getEJBHome();
  +     }
   
  -    /*
  -    * rebind (Context, String, Object)
  -    *
  -    * The purpose of this method is to create all the intermediary contexts if they 
don't exist.
  -    *
  -    * @since EJBoss1.0DR2
  -    */
  -    public static void rebind (Context context, String linkName, Object link)
  -        throws NamingException {
  +     /*
  +     * rebind (Context, String, Object)
  +     *
  +     * The purpose of this method is to create all the intermediary contexts if 
they don't exist.
  +     *
  +     * @since EJBoss1.0DR2
  +     */
  +     public static void rebind (Context context, String linkName, Object link)
  +             throws NamingException {
   
  -        Name name = context.getNameParser("").parse(linkName);
  +             Name name = context.getNameParser("").parse(linkName);
   
  -        while (name.size() > 1) {
  +             while (name.size() > 1) {
   
  -            String subContextName = name.get(0);
  +                     String subContextName = name.get(0);
   
  -            try {
  +                     try {
   
  -                // Lookup the first subContext in the current Context
  +                             // Lookup the first subContext in the current Context
   
  -                context = (Context) context.lookup(subContextName);
  -            }
  -            catch (NameNotFoundException e) {
  +                             context = (Context) context.lookup(subContextName);
  +                     }
  +                     catch (NameNotFoundException e) {
   
  -                // If not found create the subContext
  +                             // If not found create the subContext
   
  -                context = context.createSubcontext(subContextName);
  +                             context = context.createSubcontext(subContextName);
   
  -            }
  +                     }
   
  -            name = name.getSuffix(1);
  +                     name = name.getSuffix(1);
   
  -            //Tracer.trace(name.toString());
  -        }
  +                     //Tracer.trace(name.toString());
  +             }
   
  -        context.rebind(name.get(0), link);
  -    }
  +             context.rebind(name.get(0), link);
  +     }
   
  -    /*
  -    * bindEnvironmentEntry(entry)
  -    *
  -    * A small setter utility that works on the local Context Tree
  -    */
  +     /*
  +     * bindEnvironmentEntry(entry)
  +     *
  +     * A small setter utility that works on the local Context Tree
  +     */
   
  -    protected void bindEnvironmentEntry(EnvironmentEntry entry) throws 
DeploymentException {
  +     protected void bindEnvironmentEntry(EnvironmentEntry entry) throws 
DeploymentException {
   
  -        // What is the JNDI name for this entry
  +             // What is the JNDI name for this entry
   
  -        String name = entry.getName();
  +             String name = entry.getName();
   
  -        // Valid types are String, Boolean, Integer, Double and Float
  +             // Valid types are String, Boolean, Integer, Double and Float
   
  -        String type = entry.getType();
  +             String type = entry.getType();
   
  -        // The actual value
  +             // The actual value
   
  -        String value = entry.getValue();
  +             String value = entry.getValue();
   
  -        // Some times the environment entry will be empty
  +             // Some times the environment entry will be empty
   
  -        if (name.equals("")) {
  +             if (name.equals("")) {
   
  -            // It is not an exception, just an empty field
  -            return;
  -        }
  +                     // It is not an exception, just an empty field
  +                     return;
  +             }
   
  -        // if the value is not declared we do have a problem
  +             // if the value is not declared we do have a problem
   
  -        if (value.equals("")) {
  +             if (value.equals("")) {
   
  -            throw new DeploymentException("Declared entry "+name+" but no value 
found"); 
  -        }
  -        // Set stuff depending on the type
  +                     throw new DeploymentException("Declared entry "+name+" but no 
value found"); 
  +             }
  +             // Set stuff depending on the type
   
  -        Object valueObject;
  +             Object valueObject;
   
  -        if (type.equals("java.lang.String") ||
  -            type.equals("String")) {
  +             if (type.equals("java.lang.String") ||
  +                     type.equals("String")) {
   
  -            // Set as is
  +                     // Set as is
   
  -            valueObject = value;
  -        }
  +                     valueObject = value;
  +             }
   
  -        else if(type.equals("java.lang.Boolean") ||
  -                type.equals("Boolean")) {
  +             else if(type.equals("java.lang.Boolean") ||
  +                             type.equals("Boolean")) {
   
  -            // get a Boolean
  +                     // get a Boolean
   
  -            valueObject = new Boolean(value);
  +                     valueObject = new Boolean(value);
   
  -        }
  +             }
   
  -        else if(type.equals("java.lang.Integer") ||
  -                type.equals("Integer")) {
  +             else if(type.equals("java.lang.Integer") ||
  +                             type.equals("Integer")) {
   
  -            // get an Integer
  +                     // get an Integer
   
  -            valueObject = new Integer(value);
  +                     valueObject = new Integer(value);
   
  -        }
  +             }
   
  -        else if (type.equals("java.lang.Double") ||
  -                 type.equals("Double")) {
  +             else if (type.equals("java.lang.Double") ||
  +                              type.equals("Double")) {
   
  -            // get a Double
  +                     // get a Double
   
  -            valueObject = new Double(value);
  +                     valueObject = new Double(value);
   
  -        }
  +             }
   
  -        else if (type.equals("java.lang.Float") ||
  -                 type.equals("Float")) {
  +             else if (type.equals("java.lang.Float") ||
  +                              type.equals("Float")) {
   
  -            // Do a Float
  +                     // Do a Float
   
  -            valueObject = new Float(value);
  +                     valueObject = new Float(value);
   
  -        }
  +             }
   
  -        else {
  +             else {
   
  -            // The type is not one of the five defined... throw an exception
  +                     // The type is not one of the five defined... throw an 
exception
   
  -            throw new DeploymentException("Type "+type+ " is not a know java type");
  +                     throw new DeploymentException("Type "+type+ " is not a know 
java type");
   
  -        }
  +             }
   
  -        try {
  +             try {
   
  -            // bind under the bean context (already "comp/env" scoped)
  +                     // bind under the bean context (already "comp/env" scoped)
   
  -            Context beanContext = (Context) new 
InitialContext().lookup("java:comp/env/");
  +                     Context beanContext = (Context) new 
InitialContext().lookup("java:comp/env/");
   
  -            rebind(beanContext, name, valueObject);
  +                     rebind(beanContext, name, valueObject);
   
  -        } catch (NamingException ne) {
  +             } catch (NamingException ne) {
   
  -            Tracer.trace(ne);
  -            throw new DeploymentException("Problem rebinding");
  +                     Tracer.trace(ne);
  +                     throw new DeploymentException("Problem rebinding");
   
  -        }
  -    }
  +             }
  +     }
   
   /******************************************************************************/
   /******************************************************************************/
  @@ -654,182 +659,182 @@
   /*
   /******************************************************************************/
   /******************************************************************************/
  +
  +     /*
  +     * invoke()
  +     *
  +     * The invoke call was proxied by the invocation layer and is now being
  +     * routed to the container.  It is the containers job to find the target
  +     * instance and invoke the right target.
  +     *
  +     *
  +     * @since EJBoss 0.9
  +     */
  +     public Object invoke(EjbossPrimaryKey pKey, byte[] methodInvocationByte)
  +             throws Throwable {
  +
  +             // We are going to associate the class with a new one but need to save 
the previous one
  +
  +             ClassLoader currentClassLoader = 
Thread.currentThread().getContextClassLoader();
  +
  +             /*
  +             * Debug
  +             *
  +             */
  +
  +             try {
  +
  +             /*
  +             * Debug
  +             *
  +             */
   
  -    /*
  -    * invoke()
  -    *
  -    * The invoke call was proxied by the invocation layer and is now being
  -    * routed to the container.  It is the containers job to find the target
  -    * instance and invoke the right target.
  -    *
  -    *
  -    * @since EJBoss 0.9
  -    */
  -    public Object invoke(EjbossPrimaryKey pKey, byte[] methodInvocationByte)
  -        throws Throwable {
  -
  -        // We are going to associate the class with a new one but need to save the 
previous one
  -
  -        ClassLoader currentClassLoader = 
Thread.currentThread().getContextClassLoader();
  -
  -        /*
  -        * Debug
  -        *
  -        */
  -
  -        try {
  -
  -        /*
  -        * Debug
  -        *
  -        */
  -
  -        // First we rebuild the MethodInvocation object
  -
  -        // We reuse the ByteArrayInputStream (for memory)
  -        
  -        ReusableByteArrayInputStream bais = 
rbaisManager.getStream(methodInvocationByte);
  +             // First we rebuild the MethodInvocation object
   
  -        // Get the class loader associated with this container
  +             // We reuse the ByteArrayInputStream (for memory)
  +             
  +             ReusableByteArrayInputStream bais = 
rbaisManager.getStream(methodInvocationByte);
  +
  +             // Get the class loader associated with this container
   
  -        ClassLoader cl =  metaData.getHomeInterfaceClass().getClassLoader();
  +             ClassLoader cl =  metaData.getHomeInterfaceClass().getClassLoader();
   
  -        Thread.currentThread().setContextClassLoader( cl );
  +             Thread.currentThread().setContextClassLoader( cl );
                
                // Tracer identifier
                
                Thread.currentThread().setName(logIdentifier);
  -       
  -        ObjectInputStream ois = new ObjectInputStreamWithClassLoader(bais,cl);
  +        
  +             ObjectInputStream ois = new ObjectInputStreamWithClassLoader(bais,cl);
   
  -        MethodInvocation methodInvocation = (MethodInvocation) ois.readObject( );
  +             MethodInvocation methodInvocation = (MethodInvocation) ois.readObject( 
);
   
  -        // Return the ByteArrayInputStream
  +             // Return the ByteArrayInputStream
   
  -        rbaisManager.returnOneObject(bais);
  +             rbaisManager.returnOneObject(bais);
   
   
  -        /**********************************************************************/
  -        /**********************************************************************/
  -        /*   Security
  -        /**********************************************************************/
  -        /**********************************************************************/
  +             
/**********************************************************************/
  +             
/**********************************************************************/
  +             /*   Security
  +             
/**********************************************************************/
  +             
/**********************************************************************/
   
  -        if (! interposeOnSecurity(methodInvocation)) {
  +             if (! interposeOnSecurity(methodInvocation)) {
   
  -            Tracer.trace(TracerConstants.LOG_ALERT, "Container", "Operation not 
permitted");
  -            throw new Error("Security Exception, executing this method was denied");
  -        }
  +                     Tracer.trace(TracerConstants.LOG_ALERT, "Container", 
"Operation not permitted");
  +                     throw new Error("Security Exception, executing this method was 
denied");
  +             }
   
   
   
  -        /**********************************************************************/
  -        /**********************************************************************/
  -        /*    EJBHome methods
  -        /**********************************************************************/
  -        /**********************************************************************/
  +             
/**********************************************************************/
  +             
/**********************************************************************/
  +             /*    EJBHome methods
  +             
/**********************************************************************/
  +             
/**********************************************************************/
   
  -        if (pKey.isHome()) {
  +             if (pKey.isHome()) {
   
  -            /***********************************************/
  -            /* create
  -            /***********************************************/
  +                     /***********************************************/
  +                     /* create
  +                     /***********************************************/
   
  -            if (methodInvocation.getName().equals("create")) {
  +                     if (methodInvocation.getName().equals("create")) {
   
  -                // Let's create a PrimaryKey for the EJBObject
  -                return interposeOnHomeCreate(methodInvocation);
  -            }
  +                             // Let's create a PrimaryKey for the EJBObject
  +                             return interposeOnHomeCreate(methodInvocation);
  +                     }
   
  -            /***********************************************/
  -            /* remove
  -            /***********************************************/
  +                     /***********************************************/
  +                     /* remove
  +                     /***********************************************/
   
  -            /*
  -             * The remove on the EJBHome by a handle will appear on the object
  -             * no need to code remove(Handle) here in the container home methods
  -             * the only method is removeByPrimaryKey
  -             */
  -            if (methodInvocation.getName().equals("remove")) {
  +                     /*
  +                      * The remove on the EJBHome by a handle will appear on the 
object
  +                      * no need to code remove(Handle) here in the container home 
methods
  +                      * the only method is removeByPrimaryKey
  +                      */
  +                     if (methodInvocation.getName().equals("remove")) {
   
  -                return interposeOnHomeRemoveByPK(pKey, methodInvocation);
  -            }//</remove>
  +                             return interposeOnHomeRemoveByPK(pKey, 
methodInvocation);
  +                     }//</remove>
   
  -            /***********************************************/
  -            /* find
  -            /***********************************************/
  +                     /***********************************************/
  +                     /* find
  +                     /***********************************************/
   
  -            if (methodInvocation.getName().startsWith("find")) {
  +                     if (methodInvocation.getName().startsWith("find")) {
   
  -                return interposeOnHomeFind(pKey, methodInvocation);
  -            }
  -        }//</EJBHome Methods>
  +                             return interposeOnHomeFind(pKey, methodInvocation);
  +                     }
  +             }//</EJBHome Methods>
   
  -        /**********************************************************************/
  -        /**********************************************************************/
  -        /*    EJBObject methods
  -        /**********************************************************************/
  -        /**********************************************************************/
  +             
/**********************************************************************/
  +             
/**********************************************************************/
  +             /*    EJBObject methods
  +             
/**********************************************************************/
  +             
/**********************************************************************/
   
  -        // Get the bean wrapper for that Object
  +             // Get the bean wrapper for that Object
   
  -        EnterpriseBeanWrapper beanWrapper =
  -            wrapperManager.getEnterpriseBeanWrapper(pKey);
  +             EnterpriseBeanWrapper beanWrapper =
  +                     wrapperManager.getEnterpriseBeanWrapper(pKey);
   
   
  -        /***********************************************/
  -        /* remove
  -        /***********************************************/
  +             /***********************************************/
  +             /* remove
  +             /***********************************************/
   
  -        if (methodInvocation.getName().equals("remove")) {
  +             if (methodInvocation.getName().equals("remove")) {
   
  -            return interposeOnObjectRemove(beanWrapper, methodInvocation);
  -        }
  +                     return interposeOnObjectRemove(beanWrapper, methodInvocation);
  +             }
   
  -        /***********************************************/
  -        /* EJBObject business method
  -        /***********************************************/
  +             /***********************************************/
  +             /* EJBObject business method
  +             /***********************************************/
   
  -        return interposeOnDefaultObjectMethod(beanWrapper, methodInvocation);
  +             return interposeOnDefaultObjectMethod(beanWrapper, methodInvocation);
   
  -        }
  -        /*
  -        *debug
  -        */
  -        catch ( Exception e) {
  +             }
  +             /*
  +             *debug
  +             */
  +             catch ( Exception e) {
   
  -            if (e instanceof java.sql.SQLException) {
  -               Tracer.trace("Yup it's a SQL error");
  -            }
  +                     if (e instanceof java.sql.SQLException) {
  +                        Tracer.trace("Yup it's a SQL error");
  +                     }
   
  -            Tracer.trace(TracerConstants.LOG_DEBUG, "container", "the following 
might be a business Exception only report non-business exceptions");
  -            if (e.getMessage() != null) Tracer.trace(e.getMessage());
  +                     Tracer.trace(TracerConstants.LOG_DEBUG, "container", "the 
following might be a business Exception only report non-business exceptions");
  +                     if (e.getMessage() != null) Tracer.trace(e.getMessage());
   
  -            throw e;
  -        }
  +                     throw e;
  +             }
   
  -        finally {
  +             finally {
   
  -           Thread.currentThread().setContextClassLoader( currentClassLoader );
  +                Thread.currentThread().setContextClassLoader( currentClassLoader );
   
  -        }
  +             }
   
  -        /*
  -        *debug
  -        */
  -    }
  +             /*
  +             *debug
  +             */
  +     }
   
  -    /*
  -     * RegisterContainer
  -     *
  -     * Utility method, its purpose is to call the server and register itself
  -     *
  -     * @since EJBoss 0.9
  -     */
  -    public void registerContainer() {
  +     /*
  +      * RegisterContainer
  +      *
  +      * Utility method, its purpose is to call the server and register itself
  +      *
  +      * @since EJBoss 0.9
  +      */
  +     public void registerContainer() {
   
  -        Server.getServer().registerContainer(this);
  -    }
  +             Server.getServer().registerContainer(this);
  +     }
   
   
   /******************************************************************************/
  @@ -839,20 +844,20 @@
   /*
   /******************************************************************************/
   /******************************************************************************/
  +
  +     /*
  +     * The different methods behave differently given a type of bean.
  +     * We define the methods that need extending as abstract in the base Container
  +     */
   
  -    /*
  -    * The different methods behave differently given a type of bean.
  -    * We define the methods that need extending as abstract in the base Container
  -    */
  -
  -    /*
  -    * FIXME
  -    * For the development phase, we put all the methods in one place.
  -    * The reason is for code readability, we will move the objects when we
  -    * need too.  In other words, the IF statements are superflous to test for the
  -    * type since we will move to extensions once the development of these classes
  -    * is stabilized
  -    */
  +     /*
  +     * FIXME
  +     * For the development phase, we put all the methods in one place.
  +     * The reason is for code readability, we will move the objects when we
  +     * need too.  In other words, the IF statements are superflous to test for the
  +     * type since we will move to extensions once the development of these classes
  +     * is stabilized
  +     */
   
   /**********************************************************************/
   /**********************************************************************/
  @@ -861,302 +866,302 @@
   /**********************************************************************/
   
   
  -    /***********************************************/
  -    /* create
  -    /***********************************************/
  +     /***********************************************/
  +     /* create
  +     /***********************************************/
   
  -    public Object interposeOnHomeCreate(MethodInvocation methodInvocation)
  -        throws Throwable {
  +     public Object interposeOnHomeCreate(MethodInvocation methodInvocation)
  +             throws Throwable {
   
  -        EjbossPrimaryKey primaryKey = new EjbossPrimaryKey(metaData.getJndiName());
  +             EjbossPrimaryKey primaryKey = new 
EjbossPrimaryKey(metaData.getJndiName());
   
  -        InvocationHandler pContainer = new ProxyContainerForObject(
  -            //The key
  -            primaryKey,
  -            // The metaData
  -            metaData.getClientMetaData(),
  -            // An instance of the Invocation Handler
  -            Server.getServer().getInvocationHandler()
  -        );
  +             InvocationHandler pContainer = new ProxyContainerForObject(
  +                     //The key
  +                     primaryKey,
  +                     // The metaData
  +                     metaData.getClientMetaData(),
  +                     // An instance of the Invocation Handler
  +                     Server.getServer().getInvocationHandler()
  +             );
   
  -        // And now the actual EJB object
  +             // And now the actual EJB object
   
  -        EJBObject ejbObject = (EJBObject) Proxy.newProxyInstance(
  -            //The classLoader
  -            metaData.getRemoteInterfaceClass().getClassLoader(),
  -            // All the interfaces we want this proxy to implement
  -            new Class[] {metaData.getEJBObjectClass(),
  -                         metaData.getRemoteInterfaceClass()},
  -            // The invocation handler
  -            pContainer
  -        );
  +             EJBObject ejbObject = (EJBObject) Proxy.newProxyInstance(
  +                     //The classLoader
  +                     metaData.getRemoteInterfaceClass().getClassLoader(),
  +                     // All the interfaces we want this proxy to implement
  +                     new Class[] {metaData.getEJBObjectClass(),
  +                                              metaData.getRemoteInterfaceClass()},
  +                     // The invocation handler
  +                     pContainer
  +             );
   
  -        // We need a bean wrapper on that one
  -        // Create a new Bean Wrapper
  +             // We need a bean wrapper on that one
  +             // Create a new Bean Wrapper
   
  -        EnterpriseBeanWrapper newWrapper =
  -            wrapperManager.createBeanWrapper(primaryKey);
  +             EnterpriseBeanWrapper newWrapper =
  +                     wrapperManager.createBeanWrapper(primaryKey);
   
  -        // The home
  +             // The home
   
  -        newWrapper.getBeanContext().setEJBHome(
  -            metaData.getEJBHome());
  +             newWrapper.getBeanContext().setEJBHome(
  +                     metaData.getEJBHome());
   
  -        // Replace the method name by the one to be called
  -        // The parameters are unchanged so the right method will be called
  -        // Stateless session do not call the ejbCreate on the target
  +             // Replace the method name by the one to be called
  +             // The parameters are unchanged so the right method will be called
  +             // Stateless session do not call the ejbCreate on the target
   
   
  -        if (!metaData.isStatelessSession()) {
  +             if (!metaData.isStatelessSession()) {
   
  -            methodInvocation.setMethodName("ejbCreate");
  +                     methodInvocation.setMethodName("ejbCreate");
   
  -            // Stateful session case
  +                     // Stateful session case
   
  -            if (metaData.isStatefulSession()) {
  +                     if (metaData.isStatefulSession()) {
   
  -                newWrapper.invoke(methodInvocation);
  +                             newWrapper.invoke(methodInvocation);
   
  -            }
  +                     }
   
  -            // Entities is more complex
  +                     // Entities is more complex
   
  -            else if (metaData.isEntity()) {
  +                     else if (metaData.isEntity()) {
   
  -                // MF FIXED: ejbCreate and ejbPostCreate now execute in the
  -                // same transaction context
  +                             // MF FIXED: ejbCreate and ejbPostCreate now execute 
in the
  +                             // same transaction context
   
  -                // Call it
  +                             // Call it
   
  -                newWrapper.invoke(methodInvocation);
  +                             newWrapper.invoke(methodInvocation);
   
  -                // The wrapper detects the "create" and does what's needed
  -                // extracts the database PK sets it on the wrapper and registers
  -                // with the wrapperManager
  +                             // The wrapper detects the "create" and does what's 
needed
  +                             // extracts the database PK sets it on the wrapper and 
registers
  +                             // with the wrapperManager
   
  -            }//</entity>
  +                     }//</entity>
   
  -            // Now set the EJBObject on the context
  +                     // Now set the EJBObject on the context
   
  -            newWrapper.getBeanContext().setEJBObject(ejbObject);
  +                     newWrapper.getBeanContext().setEJBObject(ejbObject);
   
  -        } //</!isStatelessSession>
  +             } //</!isStatelessSession>
   
  -        // Entities have post processing to do
  +             // Entities have post processing to do
   
  -        if (metaData.isEntity()) {
  +             if (metaData.isEntity()) {
   
  -            // Prepare the same method (recycle it since arguments don't change)
  +                     // Prepare the same method (recycle it since arguments don't 
change)
   
  -            methodInvocation.setMethodName("ejbPostCreate");
  +                     methodInvocation.setMethodName("ejbPostCreate");
   
  -            // Call it
  +                     // Call it
   
  -            newWrapper.invoke(methodInvocation);
  +                     newWrapper.invoke(methodInvocation);
   
  -        }
  +             }
   
  -        // Set the object on the pContainer
  +             // Set the object on the pContainer
   
  -        ((ProxyContainerForObject) pContainer).setEJBObject(ejbObject);
  +             ((ProxyContainerForObject) pContainer).setEJBObject(ejbObject);
   
  -        // Return the ejbObject
  +             // Return the ejbObject
   
  -        return ejbObject;
  -    }
  +             return ejbObject;
  +     }
   
   
  -    /***********************************************/
  -    /* remove
  -    /***********************************************/
  +     /***********************************************/
  +     /* remove
  +     /***********************************************/
   
  -    /*
  -    * The remove on the EJBHome by a handle will appear on the object
  -    * no need to code remove(Handle) here in the container home methods
  -    */
  -    public Object interposeOnHomeRemoveByPK(EjbossPrimaryKey primaryKey, 
MethodInvocation methodInvocation)
  -        throws Throwable {
  +     /*
  +     * The remove on the EJBHome by a handle will appear on the object
  +     * no need to code remove(Handle) here in the container home methods
  +     */
  +     public Object interposeOnHomeRemoveByPK(EjbossPrimaryKey primaryKey, 
MethodInvocation methodInvocation)
  +             throws Throwable {
   
  -        // First find it
  +             // First find it
   
  -        // The method is remove(Object primaryKey), we call findByPrimaryKey(Object 
primaryKey)
  +             // The method is remove(Object primaryKey), we call 
findByPrimaryKey(Object primaryKey)
   
  -        methodInvocation.setMethodName("findByPrimaryKey");
  +             methodInvocation.setMethodName("findByPrimaryKey");
   
  -        // The return is an EJBobject, note that the argument is the same primaryKey
  +             // The return is an EJBobject, note that the argument is the same 
primaryKey
   
  -        EJBObject ejbObject = (EJBObject) interposeOnHomeFind(primaryKey, 
methodInvocation);
  +             EJBObject ejbObject = (EJBObject) interposeOnHomeFind(primaryKey, 
methodInvocation);
   
  -        // remove it
  +             // remove it
   
  -        ejbObject.remove();
  +             ejbObject.remove();
   
  -        // It doesn't matter what I return
  -        
  -        return Void.TYPE;
  +             // It doesn't matter what I return
  +             
  +             return Void.TYPE;
   
  -    }//</remove>
  +     }//</remove>
   
  -    /***********************************************/
  -    /* find
  -    /***********************************************/
  +     /***********************************************/
  +     /* find
  +     /***********************************************/
   
  -    public Object interposeOnHomeFind(EjbossPrimaryKey primaryKey, MethodInvocation 
methodInvocation)
  -        throws Throwable {
  +     public Object interposeOnHomeFind(EjbossPrimaryKey primaryKey, 
MethodInvocation methodInvocation)
  +             throws Throwable {
   
  -        // Get a wrapper and bean to service the calls
  +             // Get a wrapper and bean to service the calls
   
  -        EnterpriseBeanWrapper aWrapper =
  -            wrapperManager.createBeanWrapper(primaryKey);
  -            
  -        String findMethodName = methodInvocation.getName();
  +             EnterpriseBeanWrapper aWrapper =
  +                     wrapperManager.createBeanWrapper(primaryKey);
  +                     
  +             String findMethodName = methodInvocation.getName();
   
  -        // manufacture the new find method name by adding "ejbFind" and removing 
"find"
  +             // manufacture the new find method name by adding "ejbFind" and 
removing "find"
   
  -        findMethodName = "ejbFind"+findMethodName.substring(4);
  +             findMethodName = "ejbFind"+findMethodName.substring(4);
   
  -        methodInvocation.setMethodName(findMethodName);
  +             methodInvocation.setMethodName(findMethodName);
   
  -        // and execute it
  +             // and execute it
   
  -        /*Tracer.trace("Checkpoint 10 methodInvocationName is "+
  -           methodInvocation.getName());
  -         */
  -        Object finderResponse = null;
  +             /*Tracer.trace("Checkpoint 10 methodInvocationName is "+
  +                methodInvocation.getName());
  +              */
  +             Object finderResponse = null;
   
  -        // If we are BMP the bean will find instances
  +             // If we are BMP the bean will find instances
   
  -        if (metaData.isEntityBMP()) {
  +             if (metaData.isEntityBMP()) {
   
  -            finderResponse = aWrapper.invoke(methodInvocation);
  -        }
  +                     finderResponse = aWrapper.invoke(methodInvocation);
  +             }
   
  -        // If we are CMP we must resolve it ourselves
  +             // If we are CMP we must resolve it ourselves
   
  -        if (metaData.isEntityCMP()) {
  -            // S. Laurent note : CMP only supports findByPrimaryKey at the moment
  -            // The first argument of the findByPrimaryKey is the key
  +             if (metaData.isEntityCMP()) {
  +                     // S. Laurent note : CMP only supports findByPrimaryKey at the 
moment
  +                     // The first argument of the findByPrimaryKey is the key
   
  -            Object[] arguments = methodInvocation.getArguments();
  +                     Object[] arguments = methodInvocation.getArguments();
   
  -            finderResponse = arguments[0];
  +                     finderResponse = arguments[0];
   
  -            // Set it on this primaryKey
  +                     // Set it on this primaryKey
   
  -            System.out.println("Setting the primaryKey");
  -            primaryKey.setDataBasePrimaryKey(finderResponse);
  +                     System.out.println("Setting the primaryKey");
  +                     primaryKey.setDataBasePrimaryKey(finderResponse);
   
  -            // And see if we find the stuff
  +                     // And see if we find the stuff
   
  -            persistentStorage.findByPrimaryKey(aWrapper);
  -        }
  +                     persistentStorage.findByPrimaryKey(aWrapper);
  +             }
   
  -        // Is the return a primaryKey or a Collection?
  +             // Is the return a primaryKey or a Collection?
   
  -        String returnTypeClassName = methodInvocation.getReturnTypeClassName();
  +             String returnTypeClassName = methodInvocation.getReturnTypeClassName();
   
  -        if (returnTypeClassName.equals("java.util.Collection") ){
  -            //we have a Collection of PKs returned by the finder method
  +             if (returnTypeClassName.equals("java.util.Collection") ){
  +                     //we have a Collection of PKs returned by the finder method
   
  -            Iterator pkIterator = ((Collection) finderResponse).iterator();
  +                     Iterator pkIterator = ((Collection) finderResponse).iterator();
   
  -            // The return Collection is a HashSet
  +                     // The return Collection is a HashSet
   
  -            Collection ejbObjects = new Vector();
  +                     Collection ejbObjects = new Vector();
   
  -            EnterpriseBeanWrapper beanWrapper = null;
  +                     EnterpriseBeanWrapper beanWrapper = null;
   
  -            Object currentPK = null;
  +                     Object currentPK = null;
   
  -            while (pkIterator.hasNext()) {
  +                     while (pkIterator.hasNext()) {
   
  -                currentPK = pkIterator.next();
  -                beanWrapper = 
wrapperManager.getEnterpriseBeanWrapperByDBKey(currentPK);
  +                             currentPK = pkIterator.next();
  +                             beanWrapper = 
wrapperManager.getEnterpriseBeanWrapperByDBKey(currentPK);
   
  -                if (beanWrapper != null) {
  +                             if (beanWrapper != null) {
   
  -                    // We already have a wrapper manufacture the EJBobject around it
  +                                     // We already have a wrapper manufacture the 
EJBobject around it
   
  -                    ejbObjects.add(manufactureEntityFromWrapper(beanWrapper));
  -                }
  +                                     
ejbObjects.add(manufactureEntityFromWrapper(beanWrapper));
  +                             }
   
  -                else {
  +                             else {
   
  -                    // We need to manufacture from the ground up (includes wrapper)
  +                                     // We need to manufacture from the ground up 
(includes wrapper)
   
  -                    ejbObjects.add(manufactureEntityFromDatabaseKey(currentPK));
  -                }
  -            }
  +                                     
ejbObjects.add(manufactureEntityFromDatabaseKey(currentPK));
  +                             }
  +                     }
   
  -            return ejbObjects;
  -        }
  -        else if( returnTypeClassName.equals("java.util.Enumeration")) {
  +                     return ejbObjects;
  +             }
  +             else if( returnTypeClassName.equals("java.util.Enumeration")) {
   
  -            //we have an Enumeration of PKs returned by the finder method
  +                     //we have an Enumeration of PKs returned by the finder method
   
  -            Enumeration pkEnumeration = (Enumeration) finderResponse;
  +                     Enumeration pkEnumeration = (Enumeration) finderResponse;
   
  -            // The return Collection is a HashSet
  +                     // The return Collection is a HashSet
   
  -            Collection ejbObjects = new Vector();
  +                     Collection ejbObjects = new Vector();
   
  -            EnterpriseBeanWrapper beanWrapper = null;
  +                     EnterpriseBeanWrapper beanWrapper = null;
   
  -            Object currentPK = null;
  +                     Object currentPK = null;
   
  -            while (pkEnumeration.hasMoreElements()) {
  +                     while (pkEnumeration.hasMoreElements()) {
   
  -                currentPK = pkEnumeration.nextElement();
  +                             currentPK = pkEnumeration.nextElement();
   
  -                beanWrapper = 
wrapperManager.getEnterpriseBeanWrapperByDBKey(currentPK);
  +                             beanWrapper = 
wrapperManager.getEnterpriseBeanWrapperByDBKey(currentPK);
   
  -                if (beanWrapper != null) {
  +                             if (beanWrapper != null) {
   
  -                    // We already have a wrapper manufacture the EJBobject around it
  +                                     // We already have a wrapper manufacture the 
EJBobject around it
   
  -                    ejbObjects.add(manufactureEntityFromWrapper(beanWrapper));
  -                }
  +                                     
ejbObjects.add(manufactureEntityFromWrapper(beanWrapper));
  +                             }
   
  -                else {
  +                             else {
   
  -                    // We need to manufacture from the ground up (includes wrapper)
  +                                     // We need to manufacture from the ground up 
(includes wrapper)
   
  -                    ejbObjects.add(manufactureEntityFromDatabaseKey(currentPK));
  -                }
  -            }
  +                                     
ejbObjects.add(manufactureEntityFromDatabaseKey(currentPK));
  +                             }
  +                     }
   
  -            return new SerializableEnumeration(ejbObjects);
  -        }
  -        else { //finderResponse is a PK
  +                     return new SerializableEnumeration(ejbObjects);
  +             }
  +             else { //finderResponse is a PK
   
  -            //Tracer.trace("Checkpoint 11");
  +                     //Tracer.trace("Checkpoint 11");
   
  -            // try to find it in the maps
  +                     // try to find it in the maps
   
  -            EnterpriseBeanWrapper beanWrapper =
  -                wrapperManager.getEnterpriseBeanWrapperByDBKey(finderResponse);
  +                     EnterpriseBeanWrapper beanWrapper =
  +                             
wrapperManager.getEnterpriseBeanWrapperByDBKey(finderResponse);
   
  -            if (beanWrapper != null) {
  +                     if (beanWrapper != null) {
   
  -                //Tracer.trace("Checkpoint 12 beanWrapper exists");
  +                             //Tracer.trace("Checkpoint 12 beanWrapper exists");
   
  -                // We already have a wrapper manufacture the EJBobject around it
  +                             // We already have a wrapper manufacture the EJBobject 
around it
   
  -                return manufactureEntityFromWrapper(beanWrapper);
  +                             return manufactureEntityFromWrapper(beanWrapper);
   
  -            }
  +                     }
   
  -            else {
  +                     else {
   
  -                //Tracer.trace("Checkpoint 13 we manufacture");
  +                             //Tracer.trace("Checkpoint 13 we manufacture");
   
  -                // We need to manufacture from the ground up (includes wrapper)
  +                             // We need to manufacture from the ground up (includes 
wrapper)
   
  -                return manufactureEntityFromDatabaseKey(finderResponse);
  -            }
  -        }
  +                             return 
manufactureEntityFromDatabaseKey(finderResponse);
  +                     }
  +             }
   
  -    }
  +     }
   
   /**********************************************************************/
   /**********************************************************************/
  @@ -1164,161 +1169,161 @@
   /**********************************************************************/
   /**********************************************************************/
   
  -    /***********************************************/
  -    /* remove
  -    /***********************************************/
  +     /***********************************************/
  +     /* remove
  +     /***********************************************/
   
  -    public Object interposeOnObjectRemove(EnterpriseBeanWrapper beanWrapper,
  -                                          MethodInvocation methodInvocation)
  -        throws Throwable {
  +     public Object interposeOnObjectRemove(EnterpriseBeanWrapper beanWrapper,
  +                                                                               
MethodInvocation methodInvocation)
  +             throws Throwable {
   
  -        // First call ejbRemove on the targetBean
  +             // First call ejbRemove on the targetBean
   
  -        methodInvocation.setMethodName("ejbRemove");
  +             methodInvocation.setMethodName("ejbRemove");
   
  -        try {
  +             try {
   
  -            if (beanWrapper.metaData.isEntity())  {
  +                     if (beanWrapper.metaData.isEntity())  {
   
  -                
Tracer.trace(beanWrapper.getPrimaryKey().getDataBasePrimaryKey().toString());
  -            }
  +                             
Tracer.trace(beanWrapper.getPrimaryKey().getDataBasePrimaryKey().toString());
  +                     }
   
  -            // Call it
  +                     // Call it
   
  -            Object object = beanWrapper.invoke(methodInvocation);
  +                     Object object = beanWrapper.invoke(methodInvocation);
   
  -            return object;
  -        }
  -        catch (Throwable e) {
  +                     return object;
  +             }
  +             catch (Throwable e) {
   
  -            throw e;
  -        }
  +                     throw e;
  +             }
   
  -        finally {
  +             finally {
   
  -            beanWrapper.recycle();
  +                     beanWrapper.recycle();
   
  -        }
  -    }
  +             }
  +     }
   
  -    /***********************************************/
  -    /* Default
  -    /***********************************************/
  +     /***********************************************/
  +     /* Default
  +     /***********************************************/
   
  -    public Object interposeOnDefaultObjectMethod(EnterpriseBeanWrapper beanWrapper,
  -                                                 MethodInvocation methodInvocation)
  -        throws Throwable {
  +     public Object interposeOnDefaultObjectMethod(EnterpriseBeanWrapper beanWrapper,
  +                                                                                    
          MethodInvocation methodInvocation)
  +             throws Throwable {
   
  -        /*
  -        * Now we are going to call the method invocation.
  -        * In the case of Stateless beans we need to return the wrapper after.
  -        * This is why we need to catch the exception thrown (if any) so we can
  -        * still return the instance.
  -        *
  -        * MF FIXME: I believe the try, catch and the condition make this
  -        * pretty slow.  Try extending the container for specific bean type 
behaviour.
  -        *
  -        */
  +             /*
  +             * Now we are going to call the method invocation.
  +             * In the case of Stateless beans we need to return the wrapper after.
  +             * This is why we need to catch the exception thrown (if any) so we can
  +             * still return the instance.
  +             *
  +             * MF FIXME: I believe the try, catch and the condition make this
  +             * pretty slow.  Try extending the container for specific bean type 
behaviour.
  +             *
  +             */
   
  -        try {
  +             try {
   
  -            // Delegate
  -            Object answer = beanWrapper.invoke(methodInvocation);
  +                     // Delegate
  +                     Object answer = beanWrapper.invoke(methodInvocation);
   
  -            // If it went well return the wrapper
  +                     // If it went well return the wrapper
   
  -            if (metaData.isStatelessSession()) {
  +                     if (metaData.isStatelessSession()) {
   
  -                beanWrapper.recycle();
  -            }
  +                             beanWrapper.recycle();
  +                     }
   
  -            return answer;
  -        }
  +                     return answer;
  +             }
   
  -        catch (Throwable e) {
  +             catch (Throwable e) {
   
  -            Tracer.trace("beanWrapper.invoke(methodInvocation) throwed an 
exception");
  +                     Tracer.trace("beanWrapper.invoke(methodInvocation) throwed an 
exception");
   
  -            // We still need to return the stuff
  +                     // We still need to return the stuff
   
  -            if (metaData.isStatelessSession()) {
  +                     if (metaData.isStatelessSession()) {
   
  -                beanWrapper.recycle();
  -            }
  +                             beanWrapper.recycle();
  +                     }
   
  -            throw e;
  -        }
  -    }
  +                     throw e;
  +             }
  +     }
   
   
  -    /*
  -    *  A utility
  -    *
  -    * given a EjbossPrimaryKey it manufactures a wrapper and send the EJBObject back
  -    *
  -    */
  +     /*
  +     *  A utility
  +     *
  +     * given a EjbossPrimaryKey it manufactures a wrapper and send the EJBObject 
back
  +     *
  +     */
   
   
  -    public EJBObject manufactureEntityFromDatabaseKey(Object databasePrimaryKey) {
  +     public EJBObject manufactureEntityFromDatabaseKey(Object databasePrimaryKey) {
   
  -         EjbossPrimaryKey primaryKey = new EjbossPrimaryKey(metaData.getJndiName());
  +              EjbossPrimaryKey primaryKey = new 
EjbossPrimaryKey(metaData.getJndiName());
   
  -         // Create a new Bean Wrapper
  +              // Create a new Bean Wrapper
   
  -         EnterpriseBeanWrapper newWrapper =
  -            wrapperManager.createBeanWrapper(primaryKey);
  +              EnterpriseBeanWrapper newWrapper =
  +                     wrapperManager.createBeanWrapper(primaryKey);
   
  -         // Set the DB primary Key
  +              // Set the DB primary Key
   
  -        newWrapper.getPrimaryKey().setDataBasePrimaryKey(databasePrimaryKey);
  +             newWrapper.getPrimaryKey().setDataBasePrimaryKey(databasePrimaryKey);
   
  -        // Make sure we are registered
  +             // Make sure we are registered
   
  -        wrapperManager.registerWrapperInDBMap(newWrapper);
  +             wrapperManager.registerWrapperInDBMap(newWrapper);
   
  -        return manufactureEntityFromWrapper(newWrapper);
  +             return manufactureEntityFromWrapper(newWrapper);
   
  -    }
  +     }
   
   
  -    public EJBObject manufactureEntityFromWrapper(EnterpriseBeanWrapper 
beanWrapper) {
  +     public EJBObject manufactureEntityFromWrapper(EnterpriseBeanWrapper 
beanWrapper) {
   
  -       InvocationHandler pContainer = new ProxyContainerForObject(
  -            //The key
  -            beanWrapper.getPrimaryKey(),
  -            // The metaData
  -            metaData.getClientMetaData(),
  -            // An instance of the Invocation Handler
  -            Server.getServer().getInvocationHandler()
  -        );
  +        InvocationHandler pContainer = new ProxyContainerForObject(
  +                     //The key
  +                     beanWrapper.getPrimaryKey(),
  +                     // The metaData
  +                     metaData.getClientMetaData(),
  +                     // An instance of the Invocation Handler
  +                     Server.getServer().getInvocationHandler()
  +             );
   
  -        // And now the actual EJB object
  +             // And now the actual EJB object
   
  -        EJBObject ejbObject = (EJBObject) Proxy.newProxyInstance(
  -            //The classLoader
  -            metaData.getRemoteInterfaceClass().getClassLoader(),
  -            // All the interfaces we want this proxy to implement
  -            new Class[] {metaData.getEJBObjectClass(),
  -                         metaData.getRemoteInterfaceClass()},
  -            // The invocation handler
  -            pContainer
  -        );
  +             EJBObject ejbObject = (EJBObject) Proxy.newProxyInstance(
  +                     //The classLoader
  +                     metaData.getRemoteInterfaceClass().getClassLoader(),
  +                     // All the interfaces we want this proxy to implement
  +                     new Class[] {metaData.getEJBObjectClass(),
  +                                              metaData.getRemoteInterfaceClass()},
  +                     // The invocation handler
  +                     pContainer
  +             );
   
  -        // The home
  +             // The home
   
  -        beanWrapper.getBeanContext().setEJBHome(
  -            metaData.getEJBHome());
  +             beanWrapper.getBeanContext().setEJBHome(
  +                     metaData.getEJBHome());
   
  -        beanWrapper.getBeanContext().setEJBObject(ejbObject);
  +             beanWrapper.getBeanContext().setEJBObject(ejbObject);
   
  -        // Set the object on the pContainer
  +             // Set the object on the pContainer
   
  -        ((ProxyContainerForObject) pContainer).setEJBObject(ejbObject);
  +             ((ProxyContainerForObject) pContainer).setEJBObject(ejbObject);
   
  -        // Return the ejbObject
  +             // Return the ejbObject
   
  -        return ejbObject;
  -    }
  +             return ejbObject;
  +     }
   
   
   /**********************************************************************/
  @@ -1327,12 +1332,12 @@
   /**********************************************************************/
   /**********************************************************************/
   
  -    public boolean interposeOnSecurity(MethodInvocation methodInvocation) {
  +     public boolean interposeOnSecurity(MethodInvocation methodInvocation) {
   
  -        // FIXME.  All the information is in the MethodInvocation.
  +             // FIXME.  All the information is in the MethodInvocation.
   
  -        return true;
  -    }
  +             return true;
  +     }
   
   
   /******************************************************************************/
  @@ -1343,55 +1348,55 @@
   /******************************************************************************/
   /******************************************************************************/
   
  -    public class ReusableByteArrayInputStreamManager extends PoolManager {
  +     public class ReusableByteArrayInputStreamManager extends PoolManager {
   
  -        public ReusableByteArrayInputStreamManager() {
  +             public ReusableByteArrayInputStreamManager() {
   
  -            // we won't use the actual class
  +                     // we won't use the actual class
   
  -            super(null);
  -        }
  +                     super(null);
  +             }
   
  -        public synchronized ReusableByteArrayInputStream getStream(byte[] bytes) {
  +             public synchronized ReusableByteArrayInputStream getStream(byte[] 
bytes) {
   
  -            ReusableByteArrayInputStream chosenOne = null;
  +                     ReusableByteArrayInputStream chosenOne = null;
   
  -              // anybody available?
  +                       // anybody available?
   
  -              if (availableInstances.isEmpty()) {
  +                       if (availableInstances.isEmpty()) {
   
  -                  chosenOne = new ReusableByteArrayInputStream(bytes);
  +                               chosenOne = new ReusableByteArrayInputStream(bytes);
   
  -              } else {
  +                       } else {
   
  -                  chosenOne = (ReusableByteArrayInputStream) ((PooledWorker) 
availableInstances.removeFirst()).worker;
  +                               chosenOne = (ReusableByteArrayInputStream) 
((PooledWorker) availableInstances.removeFirst()).worker;
   
  -                chosenOne.reload(bytes);
  -            }
  +                             chosenOne.reload(bytes);
  +                     }
   
  -            return chosenOne;
  -        }
  -    }
  +                     return chosenOne;
  +             }
  +     }
   
   
  -    public class ReusableByteArrayInputStream extends ByteArrayInputStream{
  +     public class ReusableByteArrayInputStream extends ByteArrayInputStream{
   
  -        public ReusableByteArrayInputStream(byte[] bytes){
  +             public ReusableByteArrayInputStream(byte[] bytes){
   
  -            super(bytes);
  -        }
  +                     super(bytes);
  +             }
   
  -        public void reload(byte [] bytes){
  +             public void reload(byte [] bytes){
   
  -            buf = bytes;
  +                     buf = bytes;
   
  -            count = bytes.length;
  +                     count = bytes.length;
   
  -            pos = 0;
  +                     pos = 0;
   
  -            mark = 0;
  -        }
  -    }
  +                     mark = 0;
  +             }
  +     }
   }
   
   
  
  
  

Reply via email to