You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by da...@apache.org on 2007/01/17 21:03:29 UTC

svn commit: r497146 [1/5] - in /geronimo/server/trunk: ./ assemblies/geronimo-jetty6-jee5/ assemblies/geronimo-jetty6-jee5/src/main/var/config/ assemblies/geronimo-tomcat6-jee5/ assemblies/geronimo-tomcat6-jee5/src/main/var/config/ configs/ configs/jee...

Author: dain
Date: Wed Jan 17 12:03:23 2007
New Revision: 497146

URL: http://svn.apache.org/viewvc?view=rev&rev=497146
Log:
Initial openejb3 integration

Added:
    geronimo/server/trunk/modules/geronimo-openejb/   (with props)
    geronimo/server/trunk/modules/geronimo-openejb-builder/   (with props)
    geronimo/server/trunk/modules/geronimo-openejb-builder/LICENSE.txt
    geronimo/server/trunk/modules/geronimo-openejb-builder/NOTICE.txt
    geronimo/server/trunk/modules/geronimo-openejb-builder/pom.xml
    geronimo/server/trunk/modules/geronimo-openejb-builder/src/
    geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/
    geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/
    geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/
    geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/
    geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/
    geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/
    geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/
    geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbDeploymentBuilder.java
    geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbInterface.java
    geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbModule.java
    geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbModuleBuilder.java
    geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/SecurityBuilder.java
    geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/XmlUtil.java
    geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/ejbref/
    geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/ejbref/AbstractEjbRefBuilder.java
    geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/ejbref/ClientEjbRefBuilder.java
    geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/ejbref/LocalEjbRefBuilder.java
    geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/ejbref/RemoteEjbRefBuilder.java
    geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/schema/
    geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/schema/geronimo-openejb-2.0.xsd
    geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/schema/xmlconfig.xml
    geronimo/server/trunk/modules/geronimo-openejb-builder/src/test/
    geronimo/server/trunk/modules/geronimo-openejb-builder/src/test/java/
    geronimo/server/trunk/modules/geronimo-openejb-builder/src/test/java/org/
    geronimo/server/trunk/modules/geronimo-openejb-builder/src/test/java/org/apache/
    geronimo/server/trunk/modules/geronimo-openejb-builder/src/test/java/org/apache/geronimo/
    geronimo/server/trunk/modules/geronimo-openejb-builder/src/test/java/org/apache/geronimo/openejb/
    geronimo/server/trunk/modules/geronimo-openejb-builder/src/test/java/org/apache/geronimo/openejb/deployment/
    geronimo/server/trunk/modules/geronimo-openejb-builder/src/test/java/org/apache/geronimo/openejb/deployment/SchemaConversionTest.java
    geronimo/server/trunk/modules/geronimo-openejb-builder/src/test/java/org/apache/geronimo/openejb/deployment/XmlUtilTest.java
    geronimo/server/trunk/modules/geronimo-openejb-builder/src/test/resources/
    geronimo/server/trunk/modules/geronimo-openejb-builder/src/test/resources/j2ee_1_2dtd/
    geronimo/server/trunk/modules/geronimo-openejb-builder/src/test/resources/j2ee_1_2dtd/ejb-1-11.xml
    geronimo/server/trunk/modules/geronimo-openejb-builder/src/test/resources/j2ee_1_2dtd/ejb-1-21.xml
    geronimo/server/trunk/modules/geronimo-openejb-builder/src/test/resources/j2ee_1_3dtd/
    geronimo/server/trunk/modules/geronimo-openejb-builder/src/test/resources/j2ee_1_3dtd/ejb-jar-21.xml
    geronimo/server/trunk/modules/geronimo-openejb-builder/src/test/resources/j2ee_1_3dtd/ejb-jar.xml
    geronimo/server/trunk/modules/geronimo-openejb-builder/src/test/resources/j2ee_1_3dtd/mdb-ejb-jar-20-GERONIMO-1649.xml
    geronimo/server/trunk/modules/geronimo-openejb-builder/src/test/resources/j2ee_1_3dtd/mdb-ejb-jar-20.xml
    geronimo/server/trunk/modules/geronimo-openejb-builder/src/test/resources/j2ee_1_3dtd/mdb-ejb-jar-21-GERONIMO-1649.xml
    geronimo/server/trunk/modules/geronimo-openejb-builder/src/test/resources/j2ee_1_3dtd/mdb-ejb-jar-21.xml
    geronimo/server/trunk/modules/geronimo-openejb-builder/src/test/resources/j2ee_1_4schema/
    geronimo/server/trunk/modules/geronimo-openejb-builder/src/test/resources/j2ee_1_4schema/ejb-jar.xml
    geronimo/server/trunk/modules/geronimo-openejb-builder/src/test/resources/jee_5schema/
    geronimo/server/trunk/modules/geronimo-openejb-builder/src/test/resources/jee_5schema/ejb-jar.xml
    geronimo/server/trunk/modules/geronimo-openejb-builder/src/test/resources/plans/
    geronimo/server/trunk/modules/geronimo-openejb-builder/src/test/resources/plans/geronimo-openejb.xml
    geronimo/server/trunk/modules/geronimo-openejb-builder/src/test/resources/plans/plan1.xml
    geronimo/server/trunk/modules/geronimo-openejb/LICENSE.txt
    geronimo/server/trunk/modules/geronimo-openejb/NOTICE.txt
    geronimo/server/trunk/modules/geronimo-openejb/pom.xml
    geronimo/server/trunk/modules/geronimo-openejb/src/
    geronimo/server/trunk/modules/geronimo-openejb/src/main/
    geronimo/server/trunk/modules/geronimo-openejb/src/main/java/
    geronimo/server/trunk/modules/geronimo-openejb/src/main/java/org/
    geronimo/server/trunk/modules/geronimo-openejb/src/main/java/org/apache/
    geronimo/server/trunk/modules/geronimo-openejb/src/main/java/org/apache/geronimo/
    geronimo/server/trunk/modules/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/
    geronimo/server/trunk/modules/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/ClientEjbReference.java
    geronimo/server/trunk/modules/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/EjbDeployment.java
    geronimo/server/trunk/modules/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/EjbDeploymentGBean.java
    geronimo/server/trunk/modules/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/EjbModuleImpl.java
    geronimo/server/trunk/modules/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/EjbModuleImplGBean.java
    geronimo/server/trunk/modules/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/EjbReference.java
    geronimo/server/trunk/modules/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/EntityDeploymentGBean.java
    geronimo/server/trunk/modules/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/GeronimoThreadContextListener.java
    geronimo/server/trunk/modules/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/MessageDrivenDeploymentGBean.java
    geronimo/server/trunk/modules/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/OpenEjbSystem.java
    geronimo/server/trunk/modules/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/OpenEjbSystemGBean.java
    geronimo/server/trunk/modules/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/StatefulDeploymentGBean.java
    geronimo/server/trunk/modules/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/StatelessDeploymentGBean.java
    geronimo/server/trunk/modules/geronimo-openejb/src/main/resources/
    geronimo/server/trunk/modules/geronimo-openejb/src/main/resources/META-INF/
    geronimo/server/trunk/modules/geronimo-openejb/src/main/resources/META-INF/geronimo-dependency.xml
    geronimo/server/trunk/modules/geronimo-openejb/src/test/
    geronimo/server/trunk/modules/geronimo-openejb/src/test/java/
    geronimo/server/trunk/modules/geronimo-openejb/src/test/java/org/
    geronimo/server/trunk/modules/geronimo-openejb/src/test/java/org/apache/
    geronimo/server/trunk/modules/geronimo-openejb/src/test/java/org/apache/geronimo/
    geronimo/server/trunk/modules/geronimo-openejb/src/test/java/org/apache/geronimo/openejb/
    geronimo/server/trunk/modules/geronimo-openejb/src/test/java/org/apache/geronimo/openejb/GBeanTest.java
Modified:
    geronimo/server/trunk/assemblies/geronimo-jetty6-jee5/pom.xml
    geronimo/server/trunk/assemblies/geronimo-jetty6-jee5/src/main/var/config/config.xml
    geronimo/server/trunk/assemblies/geronimo-tomcat6-jee5/pom.xml
    geronimo/server/trunk/assemblies/geronimo-tomcat6-jee5/src/main/var/config/config.xml
    geronimo/server/trunk/configs/jee-specs/pom.xml
    geronimo/server/trunk/configs/openejb-deployer/pom.xml
    geronimo/server/trunk/configs/openejb-deployer/src/plan/plan.xml
    geronimo/server/trunk/configs/openejb/pom.xml
    geronimo/server/trunk/configs/openejb/src/plan/plan.xml
    geronimo/server/trunk/configs/pom.xml
    geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/repository/DefaultArtifactResolver.java
    geronimo/server/trunk/modules/pom.xml
    geronimo/server/trunk/pom.xml

Modified: geronimo/server/trunk/assemblies/geronimo-jetty6-jee5/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/assemblies/geronimo-jetty6-jee5/pom.xml?view=diff&rev=497146&r1=497145&r2=497146
==============================================================================
--- geronimo/server/trunk/assemblies/geronimo-jetty6-jee5/pom.xml (original)
+++ geronimo/server/trunk/assemblies/geronimo-jetty6-jee5/pom.xml Wed Jan 17 12:03:23 2007
@@ -107,12 +107,12 @@
             <type>car</type>
         </dependency>
 
-        <dependency>
+        <!--dependency>
             <groupId>org.apache.geronimo.configs</groupId>
             <artifactId>j2ee-corba-yoko</artifactId>
             <version>${version}</version>
             <type>car</type>
-        </dependency>
+        </dependency-->
 
         <dependency>
             <groupId>org.apache.geronimo.configs</groupId>
@@ -191,12 +191,12 @@
             <type>car</type>
         </dependency>
 
-        <dependency>
+        <!--dependency>
             <groupId>org.apache.geronimo.configs</groupId>
             <artifactId>client-corba-yoko</artifactId>
             <version>${version}</version>
             <type>car</type>
-        </dependency>
+        </dependency-->
 
         <dependency>
             <groupId>org.apache.geronimo.configs</groupId>
@@ -226,12 +226,12 @@
             <type>car</type>
         </dependency>
 
-        <dependency>
+        <!--dependency>
             <groupId>org.apache.geronimo.configs</groupId>
             <artifactId>openejb-corba-deployer</artifactId>
             <version>${version}</version>
             <type>car</type>
-        </dependency>
+        </dependency-->
 
         <dependency>
             <groupId>org.apache.geronimo.configs</groupId>

Modified: geronimo/server/trunk/assemblies/geronimo-jetty6-jee5/src/main/var/config/config.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/assemblies/geronimo-jetty6-jee5/src/main/var/config/config.xml?view=diff&rev=497146&r1=497145&r2=497146
==============================================================================
--- geronimo/server/trunk/assemblies/geronimo-jetty6-jee5/src/main/var/config/config.xml (original)
+++ geronimo/server/trunk/assemblies/geronimo-jetty6-jee5/src/main/var/config/config.xml Wed Jan 17 12:03:23 2007
@@ -62,10 +62,6 @@
     <module name="org.apache.geronimo.configs/cxf/${version}/car" load="false"/>
 
     <module name="org.apache.geronimo.configs/openejb/${version}/car">
-        <gbean name="EJBNetworkService">
-            <attribute name="host">${PlanServerHostname}</attribute>
-            <attribute name="port">${PlanOpenEJBPort}</attribute>
-        </gbean>
     </module>
 
     <module name="org.apache.geronimo.configs/j2ee-corba-yoko/${version}/car" load="false">
@@ -145,7 +141,6 @@
 
     <module name="org.apache.geronimo.configs/openejb-deployer/${version}/car">
         <gbean name="EJBBuilder">
-            <attribute name="listener">?name=JettyWebContainer</attribute>
             <reference name="ServiceBuilders">
                 <pattern>
                     <name>GBeanBuilder</name>

Modified: geronimo/server/trunk/assemblies/geronimo-tomcat6-jee5/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/assemblies/geronimo-tomcat6-jee5/pom.xml?view=diff&rev=497146&r1=497145&r2=497146
==============================================================================
--- geronimo/server/trunk/assemblies/geronimo-tomcat6-jee5/pom.xml (original)
+++ geronimo/server/trunk/assemblies/geronimo-tomcat6-jee5/pom.xml Wed Jan 17 12:03:23 2007
@@ -107,12 +107,12 @@
             <type>car</type>
         </dependency>
 
-        <dependency>
+        <!--dependency>
             <groupId>org.apache.geronimo.configs</groupId>
             <artifactId>j2ee-corba-yoko</artifactId>
             <version>${version}</version>
             <type>car</type>
-        </dependency>
+        </dependency-->
 
         <dependency>
             <groupId>org.apache.geronimo.configs</groupId>
@@ -177,12 +177,12 @@
             <type>car</type>
         </dependency>
 
-        <dependency>
+        <!--dependency>
             <groupId>org.apache.geronimo.configs</groupId>
             <artifactId>client-corba-yoko</artifactId>
             <version>${version}</version>
             <type>car</type>
-        </dependency>
+        </dependency-->
 
         <dependency>
             <groupId>org.apache.geronimo.configs</groupId>
@@ -212,12 +212,12 @@
             <type>car</type>
         </dependency>
 
-        <dependency>
+        <!--dependency>
             <groupId>org.apache.geronimo.configs</groupId>
             <artifactId>openejb-corba-deployer</artifactId>
             <version>${version}</version>
             <type>car</type>
-        </dependency>
+        </dependency-->
 
         <dependency>
             <groupId>org.apache.geronimo.configs</groupId>

Modified: geronimo/server/trunk/assemblies/geronimo-tomcat6-jee5/src/main/var/config/config.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/assemblies/geronimo-tomcat6-jee5/src/main/var/config/config.xml?view=diff&rev=497146&r1=497145&r2=497146
==============================================================================
--- geronimo/server/trunk/assemblies/geronimo-tomcat6-jee5/src/main/var/config/config.xml (original)
+++ geronimo/server/trunk/assemblies/geronimo-tomcat6-jee5/src/main/var/config/config.xml Wed Jan 17 12:03:23 2007
@@ -62,10 +62,6 @@
     <module name="org.apache.geronimo.configs/cxf/${version}/car" load="false"/>
 
     <module name="org.apache.geronimo.configs/openejb/${version}/car">
-        <gbean name="EJBNetworkService">
-            <attribute name="host">${PlanServerHostname}</attribute>
-            <attribute name="port">${PlanOpenEJBPort}</attribute>
-        </gbean>
     </module>
 
     <module name="org.apache.geronimo.configs/j2ee-corba-yoko/${version}/car" load="false">
@@ -152,7 +148,6 @@
 
     <module name="org.apache.geronimo.configs/openejb-deployer/${version}/car">
         <gbean name="EJBBuilder">
-            <attribute name="listener">?name=TomcatWebContainer</attribute>
             <reference name="ServiceBuilders">
                 <pattern>
                     <name>GBeanBuilder</name>

Modified: geronimo/server/trunk/configs/jee-specs/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/configs/jee-specs/pom.xml?view=diff&rev=497146&r1=497145&r2=497146
==============================================================================
--- geronimo/server/trunk/configs/jee-specs/pom.xml (original)
+++ geronimo/server/trunk/configs/jee-specs/pom.xml Wed Jan 17 12:03:23 2007
@@ -121,7 +121,11 @@
             <groupId>javax.xml.bind</groupId>
             <artifactId>jaxb-api</artifactId>
         </dependency>
-
+        <dependency>
+          <groupId>com.sun.xml.bind</groupId>
+          <artifactId>jaxb-impl</artifactId>
+        </dependency>
+        
         <!-- build order hint -->
         <dependency>
             <groupId>org.apache.geronimo.configs</groupId>

Modified: geronimo/server/trunk/configs/openejb-deployer/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/configs/openejb-deployer/pom.xml?view=diff&rev=497146&r1=497145&r2=497146
==============================================================================
--- geronimo/server/trunk/configs/openejb-deployer/pom.xml (original)
+++ geronimo/server/trunk/configs/openejb-deployer/pom.xml Wed Jan 17 12:03:23 2007
@@ -52,7 +52,7 @@
             <artifactId>openejb</artifactId>
             <version>${version}</version>
             <type>car</type>
-            <scope>runtime</scope>
+            <!--<scope>runtime</scope>-->
         </dependency>
 
         <dependency>
@@ -62,19 +62,20 @@
         </dependency>
         
         <dependency>
-            <groupId>org.apache.openejb</groupId>
-            <artifactId>openejb-builder</artifactId>
+            <groupId>org.apache.geronimo.modules</groupId>
+            <artifactId>geronimo-openejb-builder</artifactId>
+            <version>${version}</version>
         </dependency>
         
-        <dependency>
+        <!--dependency>
             <groupId>org.apache.openejb</groupId>
             <artifactId>openejb-axis</artifactId>
-        </dependency>
+        </dependency-->
         
-        <dependency>
+        <!--dependency>
             <groupId>org.apache.openejb</groupId>
             <artifactId>openejb-pkgen-builder</artifactId>
-        </dependency>
+        </dependency-->
         
     </dependencies>
     

Modified: geronimo/server/trunk/configs/openejb-deployer/src/plan/plan.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/configs/openejb-deployer/src/plan/plan.xml?view=diff&rev=497146&r1=497145&r2=497146
==============================================================================
--- geronimo/server/trunk/configs/openejb-deployer/src/plan/plan.xml (original)
+++ geronimo/server/trunk/configs/openejb-deployer/src/plan/plan.xml Wed Jan 17 12:03:23 2007
@@ -20,21 +20,9 @@
 
 <module xmlns="http://geronimo.apache.org/xml/ns/deployment-${geronimoSchemaVersion}">
 
-    <gbean name="EJBBuilder" class="org.apache.openejb.deployment.OpenEjbModuleBuilder">
-        <attribute name="listener">?name=WebContainer</attribute>
-        <attribute name="defaultStatelessEjbContainer">StatelessEjbContainer</attribute>
-        <attribute name="defaultStatefulEjbContainer">StatefulEjbContainer</attribute>
-        <attribute name="defaultBmpEjbContainer">BmpEjbContainer</attribute>
-        <attribute name="defaultCmpEjbContainer">CmpEjbContainer</attribute>
-        <attribute name="defaultMdbEjbContainer">MdbEjbContainer</attribute>
-        <reference name="WebServiceLinkTemplate">
-            <name>WebServiceEJBLinkTemplate</name>
-        </reference>
-        <reference name="SecurityBuilders">
-            <name>SecurityBuilder</name>
-        </reference>
-        <reference name="ServiceBuilders">
-            <name>GBeanBuilder</name>
+    <gbean name="EJBBuilder" class="org.apache.geronimo.openejb.deployment.EjbModuleBuilder">
+        <reference name="OpenEjbSystem">
+            <name>OpenEjbSystem</name>
         </reference>
         <references name="WebServiceBuilder">
             <pattern>
@@ -44,15 +32,18 @@
                 <name>UnavailableWebServiceBuilder</name>
             </pattern>
         </references>
+        <reference name="SecurityBuilders">
+            <name>SecurityBuilder</name>
+        </reference>
+        <reference name="ServiceBuilders">
+            <name>GBeanBuilder</name>
+        </reference>
         <reference name="NamingBuilders">
             <name>NamingBuilders</name>
         </reference>
         <reference name="ResourceEnvironmentSetter">
             <name>ResourceRefBuilder</name>
         </reference>
-        <reference name="ActivationSpecInfoLocator">
-            <name>ConnectorBuilder</name>
-        </reference>
         <xml-attribute name="defaultEnvironment">
             <environment xmlns="http://geronimo.apache.org/xml/ns/deployment-${geronimoSchemaVersion}">
                 <dependencies>
@@ -72,10 +63,7 @@
     </gbean>
 
 
-    <!--<gbean name="CSSAttributeBuilder" class="org.apache.openejb.corba.security.config.css.CSSConfigEditor"/>-->
-    <!--<gbean name="TSSAttributeBuilder" class="org.apache.openejb.corba.security.config.tss.TSSConfigEditor"/>-->
-
-    <gbean name="OpenEjbRemoteRefBuilder" class="org.apache.openejb.deployment.OpenEjbRemoteRefBuilder">
+    <gbean name="OpenEjbRemoteRefBuilder" class="org.apache.geronimo.openejb.deployment.ejbref.RemoteEjbRefBuilder">
         <attribute name="eeNamespaces">http://java.sun.com/xml/ns/j2ee</attribute>
         <xml-attribute name="defaultEnvironment">
             <environment xmlns="http://geronimo.apache.org/xml/ns/deployment-${geronimoSchemaVersion}">
@@ -90,7 +78,7 @@
         </xml-attribute>
     </gbean>
 
-    <gbean name="OpenEjbClientRemoteRefBuilder" class="org.apache.openejb.deployment.OpenEjbClientRemoteRefBuilder">
+    <gbean name="OpenEjbClientRemoteRefBuilder" class="org.apache.geronimo.openejb.deployment.ejbref.ClientEjbRefBuilder">
         <attribute name="eeNamespaces">http://java.sun.com/xml/ns/j2ee</attribute>
         <attribute name="host">${PlanClientAddresses}</attribute>
         <attribute name="port">${PlanOpenEJBPort}</attribute>
@@ -107,12 +95,8 @@
         </xml-attribute>
     </gbean>
 
-    <gbean name="OpenEjbLocalRefBuilder" class="org.apache.openejb.deployment.OpenEjbLocalRefBuilder">
+    <gbean name="OpenEjbLocalRefBuilder" class="org.apache.geronimo.openejb.deployment.ejbref.LocalEjbRefBuilder">
         <attribute name="eeNamespaces">http://java.sun.com/xml/ns/j2ee</attribute>
     </gbean>
-
-    <gbean name="WebServiceEJBLinkTemplate" class="org.apache.openejb.server.axis.WSContainerGBean"/>
-
-    <gbean name="EJBConfigurer" class="org.apache.openejb.deployment.EjbConfigurer"/>
 
 </module>

Modified: geronimo/server/trunk/configs/openejb/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/configs/openejb/pom.xml?view=diff&rev=497146&r1=497145&r2=497146
==============================================================================
--- geronimo/server/trunk/configs/openejb/pom.xml (original)
+++ geronimo/server/trunk/configs/openejb/pom.xml Wed Jan 17 12:03:23 2007
@@ -49,16 +49,9 @@
             <type>car</type>
         </dependency>
 
-        <!--<dependency>-->
-            <!--<groupId>org.apache.geronimo.configs</groupId>-->
-            <!--<artifactId>transaction-jta11</artifactId>-->
-            <!--<version>${version}</version>-->
-            <!--<type>car</type>-->
-        <!--</dependency>-->
-
         <dependency>
             <groupId>org.apache.geronimo.configs</groupId>
-            <artifactId>axis</artifactId>
+            <artifactId>transaction-jta11</artifactId>
             <version>${version}</version>
             <type>car</type>
         </dependency>
@@ -76,19 +69,15 @@
         </dependency>
 
         <dependency>
-            <groupId>org.apache.openejb</groupId>
-            <artifactId>openejb-axis</artifactId>
+            <groupId>org.apache.geronimo.modules</groupId>
+            <artifactId>geronimo-openejb</artifactId>
+            <version>${version}</version>
         </dependency>
 
         <dependency>
             <groupId>org.apache.yoko</groupId>
             <artifactId>yoko-spec-corba</artifactId>
         </dependency>
-
-        <!--<dependency>-->
-            <!--<groupId>concurrent</groupId>-->
-            <!--<artifactId>concurrent</artifactId>-->
-        <!--</dependency>-->
 
         <dependency>
             <groupId>org.apache.geronimo.configs</groupId>

Modified: geronimo/server/trunk/configs/openejb/src/plan/plan.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/configs/openejb/src/plan/plan.xml?view=diff&rev=497146&r1=497145&r2=497146
==============================================================================
--- geronimo/server/trunk/configs/openejb/src/plan/plan.xml (original)
+++ geronimo/server/trunk/configs/openejb/src/plan/plan.xml Wed Jan 17 12:03:23 2007
@@ -20,6 +20,9 @@
 
 <module xmlns="http://geronimo.apache.org/xml/ns/deployment-${geronimoSchemaVersion}">
 
+    <gbean name="OpenEjbSystem" class="org.apache.geronimo.openejb.OpenEjbSystemGBean"/>
+
+<!--
     <gbean name="StatelessEjbContainer" class="org.apache.openejb.slsb.DefaultStatelessEjbContainerGBean">
         <reference name="TransactionManager">
             <name>TransactionManager</name>
@@ -101,13 +104,13 @@
         </reference>
         <attribute name="doAsCurrentCaller">true</attribute>
     </gbean>
-    
+
     <gbean name="DefaultThreadPoolExecutorAdapter" class="org.apache.openejb.util.BackportExecutorAdapter">
         <reference name="TargetExecutor">
             <name>DefaultThreadPool</name>
         </reference>
     </gbean>
-    
+
     <gbean name="EJBNetworkService" class="org.activeio.xnet.StandardServiceStackGBean">
         <attribute name="name">EJB</attribute>
         <attribute name="port">${PlanOpenEJBPort}</attribute>
@@ -132,7 +135,6 @@
         </reference>
     </gbean>
 
-    <!-- pattern domain name must match the domain of the j2eeServer attribute of the EAR builder in the deployer plan -->
     <gbean name="DeploymentIndex" class="org.apache.openejb.DeploymentIndexGBean">
         <references name="EjbDeployments">
             <pattern>
@@ -152,5 +154,6 @@
             <name>MBeanServerReference</name>
         </reference>
     </gbean>
+-->
     
 </module>

Modified: geronimo/server/trunk/configs/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/configs/pom.xml?view=diff&rev=497146&r1=497145&r2=497146
==============================================================================
--- geronimo/server/trunk/configs/pom.xml (original)
+++ geronimo/server/trunk/configs/pom.xml Wed Jan 17 12:03:23 2007
@@ -43,7 +43,7 @@
         <clientDeployer>org.apache.geronimo.configs/client-deployer/${version}/car</clientDeployer>
         <connectorDeployer>org.apache.geronimo.configs/connector-deployer/${version}/car</connectorDeployer>
         <openejbDeployer>org.apache.geronimo.configs/openejb-deployer/${version}/car</openejbDeployer>
-        <openejbcorbaDeployer>org.apache.geronimo.configs/openejb-corba-deployer/${version}/car</openejbcorbaDeployer>
+        <!--openejbcorbaDeployer>org.apache.geronimo.configs/openejb-corba-deployer/${version}/car</openejbcorbaDeployer-->
         <axisDeployer>org.apache.geronimo.configs/axis-deployer/${version}/car</axisDeployer>
         <cxfDeployer>org.apache.geronimo.configs/cxf-deployer/${version}/car</cxfDeployer>
         <tomcatDeployer>org.apache.geronimo.configs/tomcat6-deployer/${version}/car</tomcatDeployer>
@@ -109,7 +109,7 @@
         <module>axis</module>
         <module>axis-deployer</module>
         <module>client</module>
-        <module>client-corba-yoko</module>
+        <!--module>client-corba-yoko</module-->
         <module>client-deployer</module>
         <module>client-security</module>
         <module>client-system</module>
@@ -120,7 +120,7 @@
         <module>geronimo-gbean-deployer</module>
         <module>hot-deployer</module>
         <module>jee-specs</module>
-        <module>j2ee-corba-yoko</module>
+        <!--module>j2ee-corba-yoko</module-->
         <module>j2ee-deployer</module>
         <module>j2ee-security</module>
         <module>j2ee-server</module>
@@ -134,7 +134,7 @@
         <module>online-deployer</module>
         <module>openejb</module>
         <module>openejb-deployer</module>
-        <module>openejb-corba-deployer</module>
+        <!--module>openejb-corba-deployer</module-->
         <module>remote-deploy-jetty</module>
         <module>remote-deploy-tomcat</module>
         <module>rmi-naming</module>

Modified: geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/repository/DefaultArtifactResolver.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/repository/DefaultArtifactResolver.java?view=diff&rev=497146&r1=497145&r2=497146
==============================================================================
--- geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/repository/DefaultArtifactResolver.java (original)
+++ geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/repository/DefaultArtifactResolver.java Wed Jan 17 12:03:23 2007
@@ -154,7 +154,11 @@
             }
 
             if (list.isEmpty()) {
-                return null;
+                if ("xbean-naming".equals(working.getArtifactId())) {
+                    return new Artifact("org.apache.xbean", "xbean-naming", "2.8", "jar");
+                } else {
+                    return null;
+                }
             }
             return (Artifact) list.last();
         }

Propchange: geronimo/server/trunk/modules/geronimo-openejb/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Jan 17 12:03:23 2007
@@ -0,0 +1,9 @@
+*.iws
+*.ipr
+*.iml
+.project
+.classpath
+.settings
+target
+*.log
+junit*.properties

Propchange: geronimo/server/trunk/modules/geronimo-openejb-builder/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Jan 17 12:03:23 2007
@@ -0,0 +1,9 @@
+*.iws
+*.ipr
+*.iml
+.project
+.classpath
+.settings
+target
+*.log
+junit*.properties

Added: geronimo/server/trunk/modules/geronimo-openejb-builder/LICENSE.txt
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-openejb-builder/LICENSE.txt?view=auto&rev=497146
==============================================================================
--- geronimo/server/trunk/modules/geronimo-openejb-builder/LICENSE.txt (added)
+++ geronimo/server/trunk/modules/geronimo-openejb-builder/LICENSE.txt Wed Jan 17 12:03:23 2007
@@ -0,0 +1,202 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.

Added: geronimo/server/trunk/modules/geronimo-openejb-builder/NOTICE.txt
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-openejb-builder/NOTICE.txt?view=auto&rev=497146
==============================================================================
--- geronimo/server/trunk/modules/geronimo-openejb-builder/NOTICE.txt (added)
+++ geronimo/server/trunk/modules/geronimo-openejb-builder/NOTICE.txt Wed Jan 17 12:03:23 2007
@@ -0,0 +1,11 @@
+   =========================================================================
+   ==  NOTICE file corresponding to the section 4 d of                    ==
+   ==  the Apache License, Version 2.0,                                   ==
+   ==  in this case for the Apache OpenEJB distribution.                  ==
+   =========================================================================
+
+   Apache OpenEJB Project
+   Copyright 1999-2006 The Apache Software Foundation
+
+   This product includes software developed by
+   The Apache Software Foundation (http://www.apache.org/).

Added: geronimo/server/trunk/modules/geronimo-openejb-builder/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-openejb-builder/pom.xml?view=auto&rev=497146
==============================================================================
--- geronimo/server/trunk/modules/geronimo-openejb-builder/pom.xml (added)
+++ geronimo/server/trunk/modules/geronimo-openejb-builder/pom.xml Wed Jan 17 12:03:23 2007
@@ -0,0 +1,89 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+<!-- $Revision: 492002 $ $Date: 2007-01-02 17:36:31 -0800 (Tue, 02 Jan 2007) $ -->
+
+<project>
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.geronimo.modules</groupId>
+        <artifactId>modules</artifactId>
+        <version>2.0-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+
+    <artifactId>geronimo-openejb-builder</artifactId>
+    <name>Geronimo :: OpenEJB :: Builder</name>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.geronimo.modules</groupId>
+            <artifactId>geronimo-openejb</artifactId>
+            <version>${pom.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.geronimo.modules</groupId>
+            <artifactId>geronimo-webservices-builder</artifactId>
+            <version>${pom.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.geronimo.modules</groupId>
+            <artifactId>geronimo-connector-builder</artifactId>
+            <version>${pom.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.geronimo.modules</groupId>
+            <artifactId>geronimo-security-builder</artifactId>
+            <version>${pom.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.geronimo.modules</groupId>
+            <artifactId>geronimo-service-builder</artifactId>
+            <version>${pom.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.geronimo.modules</groupId>
+            <artifactId>geronimo-naming-builder</artifactId>
+            <version>${pom.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.geronimo.testsupport</groupId>
+            <artifactId>testsupport-common</artifactId>
+            <version>${pom.version}</version>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>xmlbeans-maven-plugin</artifactId>
+                <configuration>
+                    <sourceSchemas>geronimo-openejb-2.0.xsd</sourceSchemas>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+</project>

Added: geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbDeploymentBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbDeploymentBuilder.java?view=auto&rev=497146
==============================================================================
--- geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbDeploymentBuilder.java (added)
+++ geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbDeploymentBuilder.java Wed Jan 17 12:03:23 2007
@@ -0,0 +1,291 @@
+/**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.geronimo.openejb.deployment;
+
+import java.security.Permissions;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.TreeMap;
+import java.util.Collections;
+import javax.security.auth.Subject;
+
+import org.apache.geronimo.common.DeploymentException;
+import org.apache.geronimo.gbean.AbstractName;
+import org.apache.geronimo.gbean.GBeanData;
+import org.apache.geronimo.gbean.AbstractNameQuery;
+import org.apache.geronimo.j2ee.deployment.EARContext;
+import org.apache.geronimo.j2ee.deployment.NamingBuilder;
+import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
+import org.apache.geronimo.kernel.GBeanAlreadyExistsException;
+import org.apache.geronimo.naming.deployment.GBeanResourceEnvironmentBuilder;
+import org.apache.geronimo.naming.deployment.ResourceEnvironmentSetter;
+import org.apache.geronimo.openejb.xbeans.ejbjar.OpenejbGeronimoEjbJarType;
+import org.apache.geronimo.security.deployment.SecurityConfiguration;
+import org.apache.geronimo.security.jacc.ComponentPermissions;
+import org.apache.geronimo.xbeans.geronimo.naming.GerResourceRefType;
+import org.apache.geronimo.xbeans.javaee.EjbJarType;
+import org.apache.geronimo.xbeans.javaee.EnterpriseBeansType;
+import org.apache.geronimo.xbeans.javaee.EntityBeanType;
+import org.apache.geronimo.xbeans.javaee.MessageDrivenBeanType;
+import org.apache.geronimo.xbeans.javaee.ResourceRefType;
+import org.apache.geronimo.xbeans.javaee.SessionBeanType;
+import org.apache.openejb.jee.EnterpriseBean;
+import org.apache.openejb.jee.RemoteBean;
+import org.apache.openejb.jee.SecurityIdentity;
+import org.apache.openejb.jee.StatefulBean;
+import org.apache.openejb.jee.StatelessBean;
+import org.apache.openejb.jee.MessageDrivenBean;
+import org.apache.openejb.jee.EntityBean;
+import org.apache.openejb.spi.ContainerSystem;
+import org.apache.openejb.alt.config.ejb.EjbDeployment;
+import org.apache.geronimo.openejb.deployment.ejbref.LocalEjbRefBuilder;
+import org.apache.geronimo.openejb.deployment.ejbref.RemoteEjbRefBuilder;
+import org.apache.geronimo.openejb.StatelessDeploymentGBean;
+import org.apache.geronimo.openejb.StatefulDeploymentGBean;
+import org.apache.geronimo.openejb.EntityDeploymentGBean;
+import org.apache.geronimo.openejb.MessageDrivenDeploymentGBean;
+import org.apache.geronimo.connector.outbound.connectiontracking.TrackedConnectionAssociator;
+import org.apache.xmlbeans.XmlObject;
+
+/**
+ * Handles building ejb deployment gbeans.
+ */
+public class EjbDeploymentBuilder {
+    private final EARContext earContext;
+    private final EjbModule ejbModule;
+    private final NamingBuilder namingBuilder;
+    private final ResourceEnvironmentSetter resourceEnvironmentSetter;
+    private final Map<String,GBeanData> gbeans = new TreeMap<String,GBeanData>();
+
+    public EjbDeploymentBuilder(EARContext earContext, EjbModule ejbModule, NamingBuilder namingBuilder, ResourceEnvironmentSetter resourceEnvironmentSetter) {
+        this.earContext = earContext;
+        this.ejbModule = ejbModule;
+        this.namingBuilder = namingBuilder;
+        this.resourceEnvironmentSetter = resourceEnvironmentSetter;
+    }
+
+    public void initContext() throws DeploymentException {
+        for (EnterpriseBean enterpriseBean : ejbModule.getEjbJar().getEnterpriseBeans()) {
+            AbstractName abstractName = createEjbName(enterpriseBean);
+            GBeanData gbean;
+            if (enterpriseBean instanceof StatelessBean) {
+                gbean = new GBeanData(abstractName, StatelessDeploymentGBean.GBEAN_INFO);
+            } else if (enterpriseBean instanceof StatefulBean) {
+                gbean = new GBeanData(abstractName, StatefulDeploymentGBean.GBEAN_INFO);
+            } else if (enterpriseBean instanceof EntityBean) {
+                gbean = new GBeanData(abstractName, EntityDeploymentGBean.GBEAN_INFO);
+            } else if (enterpriseBean instanceof MessageDrivenBean) {
+                gbean = new GBeanData(abstractName, MessageDrivenDeploymentGBean.GBEAN_INFO);
+            } else {
+                throw new DeploymentException("Unknown enterprise bean type " + enterpriseBean.getClass().getTypeParameters());
+            }
+
+            String ejbName = enterpriseBean.getEjbName();
+
+            EjbDeployment ejbDeployment = ejbModule.getOpenejbJar().getDeploymentsByEjbName().get(ejbName);
+            if (ejbDeployment == null) {
+                throw new DeploymentException("OpenEJB configuration not found for ejb " + ejbName);
+            }
+            gbean.setAttribute("deploymentId", ejbDeployment.getDeploymentId());
+            gbean.setAttribute("ejbName", ejbName);
+
+            // set interface class names
+            if (enterpriseBean instanceof RemoteBean) {
+                RemoteBean remoteBean = (RemoteBean) enterpriseBean;
+
+                // Remote
+                if (remoteBean.getRemote() != null) {
+                    String remoteInterfaceName = remoteBean.getRemote();
+                    RemoteEjbRefBuilder.assureEJBObjectInterface(remoteInterfaceName, ejbModule.getClassLoader());
+                    gbean.setAttribute(EjbInterface.REMOTE.getAttributeName(), remoteInterfaceName);
+
+                    String homeInterfaceName = remoteBean.getHome();
+                    RemoteEjbRefBuilder.assureEJBHomeInterface(homeInterfaceName, ejbModule.getClassLoader());
+                    gbean.setAttribute(EjbInterface.HOME.getAttributeName(), homeInterfaceName);
+                }
+
+                // Local
+                if (remoteBean.getLocal() != null) {
+                    String localInterfaceName = remoteBean.getLocal();
+                    LocalEjbRefBuilder.assureEJBLocalObjectInterface(localInterfaceName, ejbModule.getClassLoader());
+                    gbean.setAttribute(EjbInterface.LOCAL.getAttributeName(), localInterfaceName);
+
+                    String localHomeInterfaceName = remoteBean.getLocalHome();
+                    LocalEjbRefBuilder.assureEJBLocalHomeInterface(localHomeInterfaceName, ejbModule.getClassLoader());
+                    gbean.setAttribute(EjbInterface.LOCAL_HOME.getAttributeName(), localHomeInterfaceName);
+                }
+
+                if (enterpriseBean instanceof StatelessBean) {
+                    StatelessBean statelessBean = (StatelessBean) enterpriseBean;
+                    gbean.setAttribute(EjbInterface.SERVICE_ENDPOINT.getAttributeName(), statelessBean.getServiceEndpoint());
+                }
+            }
+
+            // set reference patterns
+            gbean.setReferencePattern("TrackedConnectionAssociator", new AbstractNameQuery(null, Collections.EMPTY_MAP, TrackedConnectionAssociator.class.getName()));
+            gbean.setReferencePattern("ContainerSystem", new AbstractNameQuery(null, Collections.EMPTY_MAP, ContainerSystem.class.getName()));
+
+            try {
+                earContext.addGBean(gbean);
+            } catch (GBeanAlreadyExistsException e) {
+                throw new DeploymentException("Could not add entity bean to context", e);
+            }
+            gbeans.put(ejbName, gbean);
+        }
+    }
+
+
+    public ComponentPermissions buildComponentPermissions() throws DeploymentException {
+        ComponentPermissions componentPermissions = new ComponentPermissions(new Permissions(), new Permissions(), new HashMap());
+        for (EnterpriseBean enterpriseBean : ejbModule.getEjbJar().getEnterpriseBeans()) {
+            addSecurityData(enterpriseBean, componentPermissions);
+        }
+        return componentPermissions;
+    }
+
+    private void addSecurityData(EnterpriseBean enterpriseBean, ComponentPermissions componentPermissions) throws DeploymentException {
+        GBeanData gbean = getEjbGBean(enterpriseBean.getEjbName());
+        if (enterpriseBean instanceof RemoteBean) {
+            RemoteBean remoteBean = (RemoteBean) enterpriseBean;
+
+            SecurityBuilder xmlBeansSecurityBuilder = new SecurityBuilder();
+            Permissions permissions = new Permissions();
+
+            SecurityConfiguration securityConfiguration = (SecurityConfiguration) earContext.getSecurityConfiguration();
+            if (securityConfiguration != null) {
+                for (EjbInterface ejbInterface : EjbInterface.values()) {
+                    String interfaceName = (String) gbean.getAttribute(ejbInterface.getAttributeName());
+                    xmlBeansSecurityBuilder.addToPermissions(permissions,
+                            enterpriseBean.getEjbName(),
+                            ejbInterface.getJaccInterfaceName(),
+                            interfaceName,
+                            ejbModule.getClassLoader());
+                }
+
+                String defaultRole = securityConfiguration.getDefaultRole();
+                xmlBeansSecurityBuilder.addComponentPermissions(defaultRole,
+                        permissions,
+                        ejbModule.getEjbJar().getAssemblyDescriptor(),
+                        enterpriseBean.getEjbName(),
+                        remoteBean.getSecurityRoleRef(),
+                        componentPermissions);
+
+                // RunAs subject
+                SecurityIdentity securityIdentity = remoteBean.getSecurityIdentity();
+                if (securityIdentity != null) {
+                    String runAsName = securityIdentity.getRunAs().getRoleName();
+                    if (runAsName != null) {
+                        Subject runAsSubject = (Subject) securityConfiguration.getRoleDesignates().get(runAsName);
+                        if (runAsSubject == null) {
+                            throw new DeploymentException("No role designate found for run-as name: " + runAsName);
+                        }
+                        gbean.setAttribute("runAs", runAsSubject);
+                    }
+                }
+
+                // Default principal
+                gbean.setAttribute("defaultPrincipal", securityConfiguration.getDefaultPrincipal());
+            }
+        }
+    }
+
+    public void buildEnc() throws DeploymentException {
+        //
+        // XMLBeans types must be use because Geronimo naming building is coupled via XMLBeans objects
+        //
+        EjbJarType ejbJarType = (EjbJarType) ejbModule.getVendorDD();
+        EnterpriseBeansType enterpriseBeans = ejbJarType.getEnterpriseBeans();
+        if (enterpriseBeans != null) {
+            for (SessionBeanType xmlbeansEjb : enterpriseBeans.getSessionArray()) {
+                String ejbName = xmlbeansEjb.getEjbName().getStringValue().trim();
+                GBeanData gbean = getEjbGBean(ejbName);
+                ResourceRefType[] resourceRefs = xmlbeansEjb.getResourceRefArray();
+                addEnc(gbean, xmlbeansEjb, resourceRefs);
+            }
+            for (MessageDrivenBeanType xmlbeansEjb : enterpriseBeans.getMessageDrivenArray()) {
+                String ejbName = xmlbeansEjb.getEjbName().getStringValue().trim();
+                GBeanData gbean = getEjbGBean(ejbName);
+                ResourceRefType[] resourceRefs = xmlbeansEjb.getResourceRefArray();
+                addEnc(gbean, xmlbeansEjb, resourceRefs);
+            }
+            for (EntityBeanType xmlbeansEjb : enterpriseBeans.getEntityArray()) {
+                String ejbName = xmlbeansEjb.getEjbName().getStringValue().trim();
+                GBeanData gbean = getEjbGBean(ejbName);
+                ResourceRefType[] resourceRefs = xmlbeansEjb.getResourceRefArray();
+                addEnc(gbean, xmlbeansEjb, resourceRefs);
+            }
+
+        }
+    }
+
+    private void addEnc(GBeanData gbean, XmlObject xmlbeansEjb, ResourceRefType[] resourceRefs) throws DeploymentException {
+        OpenejbGeronimoEjbJarType geronimoOpenejb = (OpenejbGeronimoEjbJarType) ejbModule.getVendorDD();
+
+        //
+        // Build ENC
+        //
+
+        // Geronimo uses a map to pass data to the naming build and for the results data
+        Map<Object,Object> buildingContext = new HashMap<Object,Object>();
+        buildingContext.put(NamingBuilder.JNDI_KEY, new HashMap());
+        buildingContext.put(NamingBuilder.GBEAN_NAME_KEY, gbean.getAbstractName());
+
+        namingBuilder.buildNaming(xmlbeansEjb,
+                geronimoOpenejb,
+                ejbModule.getEarContext().getConfiguration(),
+                earContext.getConfiguration(),
+                ejbModule, buildingContext);
+
+        Map compContext = (Map) buildingContext.get(NamingBuilder.JNDI_KEY);
+        gbean.setAttribute("componentContext", compContext);
+
+        //
+        // Process resource refs
+        //
+        GerResourceRefType[] gerResourceRefs = null;
+
+        if (geronimoOpenejb != null) {
+            gerResourceRefs = geronimoOpenejb.getResourceRefArray();
+        }
+
+        GBeanResourceEnvironmentBuilder refBuilder = new GBeanResourceEnvironmentBuilder(gbean);
+        resourceEnvironmentSetter.setResourceEnvironment(refBuilder, resourceRefs, gerResourceRefs);
+    }
+
+    private GBeanData getEjbGBean(String ejbName) throws DeploymentException {
+        GBeanData gbean = gbeans.get(ejbName);
+        if (gbean == null) throw new DeploymentException("EJB not gbean not found " + ejbName);
+        return gbean;
+    }
+
+    private AbstractName createEjbName(EnterpriseBean enterpriseBean) {
+        String ejbName = enterpriseBean.getEjbName();
+        String type = null;
+        if (enterpriseBean instanceof StatelessBean) {
+            type = NameFactory.STATELESS_SESSION_BEAN;
+        } else if (enterpriseBean instanceof StatefulBean) {
+            type = NameFactory.STATEFUL_SESSION_BEAN;
+        } else if (enterpriseBean instanceof EntityBean) {
+            type = NameFactory.ENTITY_BEAN;
+        } else if (enterpriseBean instanceof MessageDrivenBean) {
+            type = NameFactory.MESSAGE_DRIVEN_BEAN;
+        }
+        return earContext.getNaming().createChildName(ejbModule.getModuleName(), ejbName, type);
+    }
+
+}

Added: geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbInterface.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbInterface.java?view=auto&rev=497146
==============================================================================
--- geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbInterface.java (added)
+++ geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbInterface.java Wed Jan 17 12:03:23 2007
@@ -0,0 +1,42 @@
+/**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.geronimo.openejb.deployment;
+
+public enum EjbInterface {
+    HOME("homeInterfaceName", "Home"),
+    REMOTE("remoteInterfaceName", "Remote"),
+    LOCAL_HOME("localHomeInterfaceName", "LocalHome"),
+    LOCAL("localInterfaceName", "Local"),
+    SERVICE_ENDPOINT("serviceEndpointInterfaceName", "ServiceEndpoint");
+
+    private final String attributeName;
+    private final String jaccInterfaceName;
+
+    EjbInterface(String attributeName, String jaccInterfaceName) {
+        this.attributeName = attributeName;
+        this.jaccInterfaceName = jaccInterfaceName;
+    }
+
+    public String getAttributeName() {
+        return attributeName;
+    }
+
+    public String getJaccInterfaceName() {
+        return jaccInterfaceName;
+    }
+}

Added: geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbModule.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbModule.java?view=auto&rev=497146
==============================================================================
--- geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbModule.java (added)
+++ geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbModule.java Wed Jan 17 12:03:23 2007
@@ -0,0 +1,103 @@
+/**
+ *
+ * Copyright 2006 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.geronimo.openejb.deployment;
+
+import org.apache.geronimo.j2ee.deployment.EJBModule;
+import org.apache.geronimo.gbean.AbstractName;
+import org.apache.geronimo.kernel.repository.Environment;
+import org.apache.geronimo.openejb.xbeans.ejbjar.OpenejbGeronimoEjbJarType;
+import org.apache.openejb.jee.EjbJar;
+import org.apache.openejb.alt.config.ejb.OpenejbJar;
+import org.apache.openejb.assembler.classic.EjbJarInfo;
+import org.apache.xmlbeans.XmlObject;
+
+import java.util.jar.JarFile;
+import java.util.Map;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class EjbModule extends EJBModule {
+    private String originalSpecDD;
+    private XmlObject specDD;
+    private ClassLoader classLoader;
+    private final EjbJar ejbJar;
+    private final OpenejbJar openejbJar;
+    private EjbJarInfo ejbJarInfo;
+    private EjbDeploymentBuilder ejbDeploymentBuilder;
+
+    public EjbModule(boolean standAlone, AbstractName moduleName, Environment environment, JarFile moduleFile, String targetPath, EjbJar ejbJar, OpenejbJar openejbJar, OpenejbGeronimoEjbJarType geronimoOpenejb, String ejbJarXml, Map sharedContext) {
+        super(standAlone, moduleName, environment, moduleFile, targetPath, null, geronimoOpenejb, ejbJarXml, sharedContext);
+        this.ejbJar = ejbJar;
+        this.openejbJar = openejbJar;
+
+    }
+
+    @Override
+    public String getOriginalSpecDD() {
+        return originalSpecDD;
+    }
+
+    public void setOriginalSpecDD(String originalSpecDD) {
+        this.originalSpecDD = originalSpecDD;
+    }
+
+    @Override
+    public XmlObject getSpecDD() {
+        return specDD;
+    }
+
+    public void setSpecDD(XmlObject specDD) {
+        this.specDD = specDD;
+    }
+
+    public org.apache.openejb.alt.config.EjbModule getEjbModule() {
+        return new org.apache.openejb.alt.config.EjbModule(classLoader, getModuleFile().getName(), ejbJar,  openejbJar);
+    }
+
+    public EjbJarInfo getEjbJarInfo() {
+        return ejbJarInfo;
+    }
+
+    public void setEjbJarInfo(EjbJarInfo ejbJarInfo) {
+        this.ejbJarInfo = ejbJarInfo;
+    }
+
+    public EjbDeploymentBuilder getEjbBuilder() {
+        return ejbDeploymentBuilder;
+    }
+
+    public void setEjbBuilder(EjbDeploymentBuilder ejbDeploymentBuilder) {
+        this.ejbDeploymentBuilder = ejbDeploymentBuilder;
+    }
+
+    public EjbJar getEjbJar() {
+        return ejbJar;
+    }
+
+    public OpenejbJar getOpenejbJar() {
+        return openejbJar;
+    }
+
+    public ClassLoader getClassLoader() {
+        return classLoader;
+    }
+
+    public void setClassLoader(ClassLoader classLoader) {
+        this.classLoader = classLoader;
+    }
+}

Added: geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbModuleBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbModuleBuilder.java?view=auto&rev=497146
==============================================================================
--- geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbModuleBuilder.java (added)
+++ geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbModuleBuilder.java Wed Jan 17 12:03:23 2007
@@ -0,0 +1,329 @@
+/**
+ *
+ * Copyright 2006 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.geronimo.openejb.deployment;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URI;
+import java.net.URL;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.jar.JarFile;
+
+import org.apache.geronimo.common.DeploymentException;
+import org.apache.geronimo.deployment.ModuleIDBuilder;
+import org.apache.geronimo.deployment.NamespaceDrivenBuilder;
+import org.apache.geronimo.deployment.NamespaceDrivenBuilderCollection;
+import org.apache.geronimo.deployment.service.EnvironmentBuilder;
+import org.apache.geronimo.deployment.service.GBeanBuilder;
+import org.apache.geronimo.deployment.xbeans.EnvironmentType;
+import org.apache.geronimo.gbean.AbstractName;
+import org.apache.geronimo.gbean.AbstractNameQuery;
+import org.apache.geronimo.gbean.GBeanData;
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.gbean.ReferencePatterns;
+import org.apache.geronimo.j2ee.deployment.EARContext;
+import org.apache.geronimo.j2ee.deployment.Module;
+import org.apache.geronimo.j2ee.deployment.ModuleBuilder;
+import org.apache.geronimo.j2ee.deployment.NamingBuilder;
+import org.apache.geronimo.j2ee.deployment.WebServiceBuilder;
+import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
+import org.apache.geronimo.kernel.Naming;
+import org.apache.geronimo.kernel.config.ConfigurationStore;
+import org.apache.geronimo.kernel.repository.Environment;
+import org.apache.geronimo.naming.deployment.ResourceEnvironmentSetter;
+import org.apache.geronimo.openejb.xbeans.ejbjar.OpenejbGeronimoEjbJarType;
+import org.apache.geronimo.openejb.EjbModuleImplGBean;
+import org.apache.geronimo.openejb.OpenEjbSystem;
+import org.apache.geronimo.security.jacc.ComponentPermissions;
+import org.apache.geronimo.xbeans.geronimo.j2ee.GerSecurityDocument;
+import org.apache.geronimo.xbeans.javaee.AssemblyDescriptorType;
+import org.apache.geronimo.xbeans.javaee.EjbJarType;
+import org.apache.openejb.EjbDeployment;
+import org.apache.openejb.OpenEJBException;
+import org.apache.openejb.alt.config.ejb.OpenejbJar;
+import org.apache.openejb.assembler.classic.EjbJarInfo;
+import org.apache.openejb.jee.EjbJar;
+import org.apache.xmlbeans.XmlCursor;
+import org.apache.xmlbeans.XmlObject;
+
+/**
+ * Master builder for processing EJB JAR deployments and creating the
+ * correspinding runtime objects (GBeans, etc.).
+ *
+ * @version $Revision: 479481 $ $Date: 2006-11-26 16:52:20 -0800 (Sun, 26 Nov 2006) $
+ */
+public class EjbModuleBuilder implements ModuleBuilder {
+    private static final String OPENEJBJAR_NAMESPACE = XmlUtil.OPENEJBJAR_QNAME.getNamespaceURI();
+
+    private final Environment defaultEnvironment;
+    private final Collection webServiceBuilders;
+    private final NamespaceDrivenBuilderCollection securityBuilders;
+    private final NamespaceDrivenBuilderCollection serviceBuilders;
+    private final NamingBuilder namingBuilder;
+    private final ResourceEnvironmentSetter resourceEnvironmentSetter;
+    private final OpenEjbSystem openEjbSystem;
+
+    public EjbModuleBuilder(Environment defaultEnvironment,
+            OpenEjbSystem openEjbSystem,
+            Collection webServiceBuilder,
+            Collection securityBuilders,
+            Collection serviceBuilders,
+            NamingBuilder namingBuilders,
+            ResourceEnvironmentSetter resourceEnvironmentSetter) {
+
+        this.openEjbSystem = openEjbSystem;
+        this.defaultEnvironment = defaultEnvironment;
+        this.webServiceBuilders = webServiceBuilder;
+        this.securityBuilders = new NamespaceDrivenBuilderCollection(securityBuilders, GerSecurityDocument.type.getDocumentElementName());
+        this.serviceBuilders = new NamespaceDrivenBuilderCollection(serviceBuilders, GBeanBuilder.SERVICE_QNAME);
+        this.namingBuilder = namingBuilders;
+        this.resourceEnvironmentSetter = resourceEnvironmentSetter;
+    }
+
+    public String getSchemaNamespace() {
+        return EjbModuleBuilder.OPENEJBJAR_NAMESPACE;
+    }
+
+    public Module createModule(File plan, JarFile moduleFile, Naming naming, ModuleIDBuilder idBuilder) throws DeploymentException {
+        return createModule(plan, moduleFile, "ejb", null, null, null, naming, idBuilder);
+    }
+
+    public Module createModule(Object plan, JarFile moduleFile, String targetPath, URL specDDUrl, Environment environment, Object moduleContextInfo, AbstractName earName, Naming naming, ModuleIDBuilder idBuilder) throws DeploymentException {
+        return createModule(plan, moduleFile, targetPath, specDDUrl, environment, earName, naming, idBuilder);
+    }
+
+    private Module createModule(Object plan, JarFile moduleFile, String targetPath, URL specDDUrl, Environment earEnvironment, AbstractName earName, Naming naming, ModuleIDBuilder idBuilder) throws DeploymentException {
+        if (moduleFile == null) throw new NullPointerException("moduleFile is null");
+        if (targetPath == null) throw new NullPointerException("targetPath is null");
+        if (targetPath.endsWith("/")) throw new IllegalArgumentException("targetPath must not end with a '/'");
+
+        // load the ejb-jar.xml
+        String ejbJarXml = XmlUtil.loadEjbJarXml(specDDUrl, moduleFile);
+        if (ejbJarXml == null) {
+            // this is not an ejb module
+            return null;
+        }
+        EjbJar ejbJar = XmlUtil.unmarshal(EjbJar.class, ejbJarXml);
+
+        // load the geronimo-openejb.xml
+        boolean standAlone = earEnvironment == null;
+        OpenejbGeronimoEjbJarType geronimoOpenejb = XmlUtil.loadGeronimOpenejbJar(plan, moduleFile, standAlone, targetPath, ejbJar);
+        if (geronimoOpenejb == null) {
+            // Avoid NPE GERONIMO-1220; todo: remove this if we can work around the requirement for a plan
+            throw new DeploymentException("Currently a Geronimo deployment plan is required for an EJB module.  Please provide a plan as a deployer argument or packaged in the EJB JAR at META-INF/openejb-jar.xml");
+        }
+
+        // load the openejb-jar.xml
+        XmlObject object = null;
+        if (geronimoOpenejb.isSetOpenejbJar()) {
+            XmlCursor xmlCursor = geronimoOpenejb.getOpenejbJar().newCursor();
+            xmlCursor.toFirstChild();
+            object = xmlCursor.getObject();
+        }
+        String openejbJarXml = XmlUtil.loadOpenejbJarXml(object, moduleFile);
+        OpenejbJar openejbJar = XmlUtil.unmarshal(OpenejbJar.class, openejbJarXml);
+
+        // initialize the geronimo environment
+        EnvironmentType environmentType = geronimoOpenejb.getEnvironment();
+        Environment environment = EnvironmentBuilder.buildEnvironment(environmentType, defaultEnvironment);
+        if (earEnvironment != null) {
+            EnvironmentBuilder.mergeEnvironments(earEnvironment, environment);
+            environment = earEnvironment;
+            if (!environment.getConfigId().isResolved()) {
+                throw new IllegalStateException("EJB module ID should be fully resolved (not " + environment.getConfigId() + ")");
+            }
+        } else {
+            idBuilder.resolve(environment, new File(moduleFile.getName()).getName(), "jar");
+        }
+
+        // create a xmlbeans version of the ejb-jar.xml file, because the jndi code is coupled based on xmlbeans objects
+        EjbJarType ejbJarType = XmlUtil.convertToXmlbeans(ejbJar);
+
+
+        // todo THIS WILL NOT WORK WITH ANNOTATIONS... move this to initContext when naming is fixed
+        // since assembly descriptor will only be valid once metadata complete
+        // which is only available once a class loader has been constructed in the init phase
+        if (ejbJar.getAssemblyDescriptor() != null) {
+            AssemblyDescriptorType assemblyDescriptor = ejbJarType.getAssemblyDescriptor();
+            namingBuilder.buildEnvironment(assemblyDescriptor, geronimoOpenejb, environment);
+        }
+
+        //overridden web service locations
+        Map correctedPortLocations = new HashMap();
+
+        // todo
+//        OpenejbSessionBeanType[] openejbSessionBeans = openejbJar.getEnterpriseBeans().getSessionArray();
+//        for (int i = 0; i < openejbSessionBeans.length; i++) {
+//            OpenejbSessionBeanType sessionBean = openejbSessionBeans[i];
+//                if (sessionBean.isSetWebServiceAddress()) {
+//                    String location = sessionBean.getWebServiceAddress().trim();
+//                    correctedPortLocations.put(sessionBean.getEjbName(), location);
+//                }
+//        }
+        Map sharedContext = new HashMap();
+        for (Iterator iterator = webServiceBuilders.iterator(); iterator.hasNext();) {
+            WebServiceBuilder serviceBuilder = (WebServiceBuilder) iterator.next();
+            serviceBuilder.findWebServices(moduleFile, true, correctedPortLocations, environment, sharedContext);
+        }
+
+        AbstractName moduleName;
+        if (earName == null) {
+            earName = naming.createRootName(environment.getConfigId(), NameFactory.NULL, NameFactory.J2EE_APPLICATION);
+            moduleName = naming.createChildName(earName, environment.getConfigId().toString(), NameFactory.EJB_MODULE);
+        } else {
+            moduleName = naming.createChildName(earName, targetPath, NameFactory.EJB_MODULE);
+        }
+
+        return new EjbModule(standAlone, moduleName, environment, moduleFile, targetPath, ejbJar, openejbJar, geronimoOpenejb, ejbJarXml, sharedContext);
+    }
+
+    public void installModule(JarFile earFile, EARContext earContext, Module module, Collection configurationStores, ConfigurationStore targetConfigurationStore, Collection repository) throws DeploymentException {
+        installModule(module, earContext);
+    }
+
+    private void installModule(Module module, EARContext earContext) throws DeploymentException {
+        JarFile moduleFile = module.getModuleFile();
+        try {
+            // extract the ejbJar file into a standalone packed jar file and add the contents to the output
+            earContext.addIncludeAsPackedJar(URI.create(module.getTargetPath()), moduleFile);
+        } catch (IOException e) {
+            throw new DeploymentException("Unable to copy ejb module jar into configuration: " + moduleFile.getName());
+        }
+    }
+
+    public void initContext(EARContext earContext, Module module, ClassLoader classLoader) throws DeploymentException {
+        EjbModule ejbModule = (EjbModule) module;
+        ejbModule.setClassLoader(classLoader);
+        ejbModule.setEarContext(earContext);
+        ejbModule.setRootEarContext(earContext);
+
+        // build the config info tree
+        // this method fills in the ejbJar jaxb tree based on the annotations
+        // (metadata complete) and it run the openejb verifier
+        try {
+            EjbJarInfo ejbJarInfo = openEjbSystem.configureApplication(ejbModule.getEjbModule());
+            ejbModule.setEjbJarInfo(ejbJarInfo);
+        } catch (OpenEJBException e) {
+            throw new DeploymentException(e);
+        }
+
+        // update the original spec dd with the metadata complete dd
+        EjbJar ejbJar = ejbModule.getEjbJar();
+        ejbModule.setOriginalSpecDD(XmlUtil.marshal(ejbModule.getEjbJar()));
+
+        // create a xmlbeans version of the ejb-jar.xml file, because the jndi code is coupled based on xmlbeans objects
+        EjbJarType ejbJarType = XmlUtil.convertToXmlbeans(ejbJar);
+        ejbModule.setSpecDD(ejbJarType);
+
+
+        // todo move namingBuilders.buildEnvironment() here when geronimo naming supports it
+
+        // initialize the naming builders
+        OpenejbGeronimoEjbJarType geronimoOpenejb = (OpenejbGeronimoEjbJarType) ejbModule.getVendorDD();
+        if (ejbJarType.getAssemblyDescriptor() != null) {
+            namingBuilder.initContext(ejbJarType.getAssemblyDescriptor(),
+                    geronimoOpenejb,
+                    ejbModule.getEarContext().getConfiguration(),
+                    earContext.getConfiguration(),
+                    ejbModule);
+        }
+
+        EjbDeploymentBuilder ejbDeploymentBuilder = new EjbDeploymentBuilder(earContext, ejbModule, namingBuilder, resourceEnvironmentSetter);
+        ejbModule.setEjbBuilder(ejbDeploymentBuilder);
+        ejbDeploymentBuilder.initContext();
+
+        // Build the security configuration.  Attempt to auto generate role mappings.
+        securityBuilders.build(geronimoOpenejb, earContext, ejbModule.isStandAlone() ? ejbModule.getEarContext() : null);
+
+        // Add extra gbean declared in the geronimo-openejb.xml file
+        serviceBuilders.build(geronimoOpenejb, earContext, ejbModule.getEarContext());
+    }
+
+    /**
+     * Does the meaty work of processing the deployment information and
+     * creating GBeans for all the EJBs in the JAR, etc.
+     */
+    public void addGBeans(EARContext earContext, Module module, ClassLoader cl, Collection repositories) throws DeploymentException {
+        EjbModule ejbModule = (EjbModule) module;
+
+        // Add JSR77 EJBModule GBean
+        GBeanData ejbModuleGBeanData = new GBeanData(ejbModule.getModuleName(), EjbModuleImplGBean.GBEAN_INFO);
+        try {
+            ejbModuleGBeanData.setReferencePattern("J2EEServer", earContext.getServerName());
+            if (!ejbModule.isStandAlone()) {
+                ejbModuleGBeanData.setReferencePattern("J2EEApplication", earContext.getModuleName());
+            }
+
+            ejbModuleGBeanData.setAttribute("deploymentDescriptor", ejbModule.getOriginalSpecDD());
+
+            ejbModuleGBeanData.setReferencePatterns("EJBCollection",
+                    new ReferencePatterns(new AbstractNameQuery(null,
+                            Collections.singletonMap(NameFactory.EJB_MODULE, ejbModule.getModuleName().getNameProperty(NameFactory.J2EE_NAME)),
+                            EjbDeployment.class.getName())));
+
+            ejbModuleGBeanData.setReferencePattern("OpenEjbSystem", new AbstractNameQuery(null, Collections.EMPTY_MAP, OpenEjbSystem.class.getName()));
+            ejbModuleGBeanData.setAttribute("ejbJarInfo", ejbModule.getEjbJarInfo());
+
+            earContext.addGBean(ejbModuleGBeanData);
+        } catch (Exception e) {
+            throw new DeploymentException("Unable to initialize EJBModule GBean " + ejbModuleGBeanData.getAbstractName(), e);
+        }
+
+        // add enc
+        EjbDeploymentBuilder ejbDeploymentBuilder = ejbModule.getEjbBuilder();
+        ejbDeploymentBuilder.buildEnc();
+
+        // add the Jacc permissions to the ear
+        ComponentPermissions componentPermissions = ejbDeploymentBuilder.buildComponentPermissions();
+        earContext.addSecurityContext(ejbModule.getEjbJarInfo().moduleId, componentPermissions);
+
+    }
+
+
+    public static final GBeanInfo GBEAN_INFO;
+
+    static {
+        GBeanInfoBuilder infoBuilder = GBeanInfoBuilder.createStatic(EjbModuleBuilder.class, NameFactory.MODULE_BUILDER);
+        infoBuilder.addAttribute("defaultEnvironment", Environment.class, true);
+        infoBuilder.addReference("OpenEjbSystem", OpenEjbSystem.class);
+        infoBuilder.addReference("WebServiceBuilder", WebServiceBuilder.class, NameFactory.MODULE_BUILDER);
+        infoBuilder.addReference("SecurityBuilders", NamespaceDrivenBuilder.class, NameFactory.MODULE_BUILDER);
+        infoBuilder.addReference("ServiceBuilders", NamespaceDrivenBuilder.class, NameFactory.MODULE_BUILDER);
+        infoBuilder.addReference("NamingBuilders", NamingBuilder.class, NameFactory.MODULE_BUILDER);
+        infoBuilder.addReference("ResourceEnvironmentSetter", ResourceEnvironmentSetter.class, NameFactory.MODULE_BUILDER);
+
+        infoBuilder.setConstructor(new String[]{
+                "defaultEnvironment",
+                "OpenEjbSystem",
+                "WebServiceBuilder",
+                "SecurityBuilders",
+                "ServiceBuilders",
+                "NamingBuilders",
+                "ResourceEnvironmentSetter"});
+        GBEAN_INFO = infoBuilder.getBeanInfo();
+    }
+
+    public static GBeanInfo getGBeanInfo() {
+        return GBEAN_INFO;
+    }
+
+}