dblevins    2005/08/07 20:48:07

  Modified:    modules/core/src/java/org/openejb/core DeploymentInfo.java
  Added:       modules/core/src/java/org/openejb/core
                        DeploymentContext.java
  Log:

  Introduce DeploymentContext concept.
  
  Revision  Changes    Path
  1.4       +11 -31    
openejb1/modules/core/src/java/org/openejb/core/DeploymentInfo.java
  
  Index: DeploymentInfo.java
  ===================================================================
  RCS file: 
/home/projects/openejb/scm/openejb1/modules/core/src/java/org/openejb/core/DeploymentInfo.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- DeploymentInfo.java       19 Jun 2005 22:40:31 -0000      1.3
  +++ DeploymentInfo.java       8 Aug 2005 00:48:07 -0000       1.4
  @@ -96,7 +96,6 @@
    */
   public class DeploymentInfo implements org.openejb.DeploymentInfo{
   
  -    private Object    deploymentId;
       private Class     homeInterface;
       private Class     remoteInterface;
       private Class     localHomeInterface;
  @@ -109,10 +108,9 @@
       private Container container;
       
       private EJBHome   ejbHomeRef;
  -    
  -    private Context   jndiContextRoot;
  -    
  -    
  +
  +    private final DeploymentContext context;
  +
       /**
        * Stateless session beans only have one create method. The 
getCreateMethod is
        * used by instance manager of the core.stateless.StatelessContainer as 
a 
  @@ -140,12 +138,6 @@
       private HashMap securityRoleReferenceMap     = new HashMap();
       private HashSet methodsWithRemoteReturnTypes = null;
        private EJBLocalHome ejbLocalHomeRef;
  -    
  -    /**
  -     * Creates an empty DeploymentInfo instance.
  -     */
  -    public DeploymentInfo( ){}
  -
   
       /**
        * Constructs a DeploymentInfo object to represent the specified bean's 
  @@ -166,12 +158,11 @@
        * @see org.openejb.DeploymentInfo#BMP_ENTITY
        * @see org.openejb.DeploymentInfo#CMP_ENTITY
        */
  -    public DeploymentInfo(Object did, Class homeClass, Class remoteClass, 
Class localHomeClass, Class localClass, Class beanClass, Class pkClass, byte 
componentType)
  +    public DeploymentInfo(DeploymentContext context, Class homeClass, Class 
remoteClass, Class localHomeClass, Class localClass, Class beanClass, Class 
pkClass, byte componentType)
       throws org.openejb.SystemException{
  +        this.context = context;
           this.pkClass = pkClass;
   
  -        deploymentId = did;
  -
           this.homeInterface = homeClass;
           this.remoteInterface = remoteClass;
           this.localInterface = localClass;
  @@ -317,7 +308,7 @@
        * @return the id of of this bean deployment
        */
       public Object getDeploymentID( ){
  -        return deploymentId;
  +        return context.getId();
       }
   
       /**
  @@ -404,7 +395,7 @@
        */
       public EJBHome getEJBHome() {
        if (getHomeInterface() == null) {
  -             throw new IllegalStateException("This component has no home 
interface: "+this.deploymentId);
  +             throw new IllegalStateException("This component has no home 
interface: "+getDeploymentID());
        }
           if(ejbHomeRef == null){
                ejbHomeRef = createEJBHomeRef();
  @@ -414,7 +405,7 @@
       
       public EJBLocalHome getEJBLocalHome() {
        if (getLocalHomeInterface() == null) {
  -             throw new IllegalStateException("This component has no local 
home interface: "+this.deploymentId);
  +             throw new IllegalStateException("This component has no local 
home interface: "+getDeploymentID());
        }
           if(ejbLocalHomeRef == null) {
                ejbLocalHomeRef = createEJBLocalHomeRef();
  @@ -433,17 +424,6 @@
       }
   
       /**
  -     * Sets the JNDI namespace for the bean's environment.  This will be the 
ony
  -     * namespace that the bean will be able to access using the java: URL in 
the JNDI.
  -     *
  -     * @param ctx the Context of the bean's JNDI environment
  -     * @see javax.naming.Context
  -     */
  -    public void setJndiEnc(Context ctx){
  -        jndiContextRoot = ctx;
  -    }
  -
  -    /**
        * Gets the JNDI namespace for the bean's environment.  This will be the 
ony
        * namespace that the bean will be able to access using the java: URL in 
the JNDI.
        *
  @@ -452,7 +432,7 @@
        * @see javax.naming.Context
        */
       public javax.naming.Context getJndiEnc( ){
  -        return jndiContextRoot;
  +        return context.getJndiContext();
       }
   
       /**
  
  
  
  1.1                  
openejb1/modules/core/src/java/org/openejb/core/DeploymentContext.java
  
  Index: DeploymentContext.java
  ===================================================================
  /**
   * Redistribution and use of this software and associated documentation
   * ("Software"), with or without modification, are permitted provided
   * that the following conditions are met:
   *
   * 1. Redistributions of source code must retain copyright
   *    statements and notices.  Redistributions must also contain a
   *    copy of this document.
   *
   * 2. Redistributions in binary form must reproduce the
   *    above copyright notice, this list of conditions and the
   *    following disclaimer in the documentation and/or other
   *    materials provided with the distribution.
   *
   * 3. The name "OpenEJB" must not be used to endorse or promote
   *    products derived from this Software without prior written
   *    permission of The OpenEJB Group.  For written permission,
   *    please contact [EMAIL PROTECTED]
   *
   * 4. Products derived from this Software may not be called "OpenEJB"
   *    nor may "OpenEJB" appear in their names without prior written
   *    permission of The OpenEJB Group. OpenEJB is a registered
   *    trademark of The OpenEJB Group.
   *
   * 5. Due credit should be given to the OpenEJB Project
   *    (http://openejb.org/).
   *
   * THIS SOFTWARE IS PROVIDED BY THE OPENEJB GROUP AND CONTRIBUTORS
   * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
   * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
   * THE OPENEJB GROUP OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
   * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
   * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
   * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
   * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
   * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
   * OF THE POSSIBILITY OF SUCH DAMAGE.
   *
   * Copyright 2005 (C) The OpenEJB Group. All Rights Reserved.
   *
   * $Id: DeploymentContext.java,v 1.1 2005/08/08 00:48:07 dblevins Exp $
   */
  
  package org.openejb.core;
  
  import javax.naming.Context;
  
  /**
   * @version $Revision: 1.1 $ $Date: 2005/08/08 00:48:07 $
   */
  public class DeploymentContext {
      private final ClassLoader classLoader;
      private final Object id;
      private final Context jndiContext;
  
      public DeploymentContext(Object id, ClassLoader classLoader, Context 
jndiContext) {
          this.classLoader = classLoader;
          this.id = id;
          this.jndiContext = jndiContext;
      }
  
      public ClassLoader getClassLoader() {
          return classLoader;
      }
  
      public Object getId() {
          return id;
      }
  
      public Context getJndiContext() {
          return jndiContext;
      }
  }
  
  
  

Reply via email to