jlaskowski    2004/07/05 11:47:45

  Modified:    modules/core/src/java/org/openejb/alt/assembler/classic
                        Assembler.java AssemblerTool.java
  Log:

  Further enhancements to make OpenEJB instances to not interfere with each other when 
embedded in separate webapps
  
  Revision  Changes    Path
  1.2       +1 -2      
openejb1/modules/core/src/java/org/openejb/alt/assembler/classic/Assembler.java
  
  Index: Assembler.java
  ===================================================================
  RCS file: 
/home/projects/openejb/scm/openejb1/modules/core/src/java/org/openejb/alt/assembler/classic/Assembler.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Assembler.java    26 Mar 2004 21:41:23 -0000      1.1
  +++ Assembler.java    5 Jul 2004 15:47:45 -0000       1.2
  @@ -105,7 +105,6 @@
       }
   
       protected SafeToolkit toolkit = SafeToolkit.getToolkit("Assembler");
  -    protected Properties props;
       protected OpenEjbConfiguration config;
   
   
  
  
  
  1.2       +18 -8     
openejb1/modules/core/src/java/org/openejb/alt/assembler/classic/AssemblerTool.java
  
  Index: AssemblerTool.java
  ===================================================================
  RCS file: 
/home/projects/openejb/scm/openejb1/modules/core/src/java/org/openejb/alt/assembler/classic/AssemblerTool.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- AssemblerTool.java        26 Mar 2004 21:41:25 -0000      1.1
  +++ AssemblerTool.java        5 Jul 2004 15:47:45 -0000       1.2
  @@ -106,6 +106,8 @@
       protected static SafeToolkit toolkit = SafeToolkit.getToolkit("AssemblerTool");
       protected static HashMap codebases = new HashMap();
       
  +    protected Properties props;
  +
       static{
           ClassLoader cl = ClassLoader.getSystemClassLoader();
           codebases.put("CLASSPATH", cl );
  @@ -219,7 +221,9 @@
               }
           }
           try{
  -            container.init(containerInfo.containerName, deployments, 
containerInfo.properties);                    
  +            Properties clonedProps = (Properties)(this.props.clone());
  +            clonedProps.putAll(containerInfo.properties);
  +            container.init(containerInfo.containerName, deployments, clonedProps);  
                  
           } catch (OpenEJBException e){
               throw new OpenEJBException( messages.format( "as0003", 
containerInfo.containerName, e.getMessage() ) );
           }
  @@ -414,15 +418,18 @@
            which is not very specific. Only a very specific OpenEJBException should 
be 
            thrown.
            */
  -        Class managerClass = toolkit.loadClass(cmInfo.className, cmInfo.codebase);
  +        Class managerClass = SafeToolkit.loadClass(cmInfo.className, 
cmInfo.codebase);
           
           checkImplementation(CONNECTION_MANAGER, managerClass, 
"ConnectionManager",cmInfo.connectionManagerId);
           
           ConnectionManager connectionManager = 
(ConnectionManager)toolkit.newInstance(managerClass);
           
           // a container manager has either properties or configuration information 
or nothing at all
  -        if(cmInfo.properties !=null)
  -            applyProperties(connectionManager, cmInfo.properties);
  +        if(cmInfo.properties !=null) {
  +            Properties clonedProps = (Properties)(this.props.clone());
  +            clonedProps.putAll(cmInfo.properties);
  +            applyProperties(connectionManager, clonedProps);
  +        }
               
           return connectionManager;
       }
  @@ -438,7 +445,7 @@
           
           ManagedConnectionFactory managedConnectionFactory = null;
           try{
  -            Class factoryClass = toolkit.loadClass(mngedConFactInfo.className, 
mngedConFactInfo.codebase);
  +            Class factoryClass = SafeToolkit.loadClass(mngedConFactInfo.className, 
mngedConFactInfo.codebase);
               checkImplementation(CONNECTOR, factoryClass, "Connector", 
mngedConFactInfo.id);
               
               managedConnectionFactory = 
(ManagedConnectionFactory)toolkit.newInstance(factoryClass);
  @@ -449,8 +456,11 @@
               
           try{
               // a ManagedConnectionFactory has either properties or configuration 
information or nothing at all
  -            if(mngedConFactInfo.properties !=null)
  -                applyProperties(managedConnectionFactory, 
mngedConFactInfo.properties);
  +            if(mngedConFactInfo.properties !=null) {
  +                Properties clonedProps = (Properties)(this.props.clone());
  +                clonedProps.putAll(mngedConFactInfo.properties);
  +                applyProperties(managedConnectionFactory, clonedProps);
  +            }
           } catch (java.lang.reflect.InvocationTargetException ite){
               throw new OpenEJBException("Could not initialize Connector 
'"+mngedConFactInfo.id+"'.",ite.getTargetException());
           } catch (Exception e){
  
  
  

Reply via email to