You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by db...@apache.org on 2007/12/06 06:12:16 UTC

svn commit: r601615 - in /openejb/trunk/openejb3/container: openejb-core/src/main/java/org/apache/openejb/config/ openejb-jee/src/main/java/org/apache/openejb/jee/oejb2/ openejb-jee/src/test/resources/

Author: dblevins
Date: Wed Dec  5 21:12:15 2007
New Revision: 601615

URL: http://svn.apache.org/viewvc?rev=601615&view=rev
Log:
Support for conversion of openejb-jar v2 jndi-name and local-jndi-name elements as well as new 'jndi' element

Added:
    openejb/trunk/openejb3/container/openejb-jee/src/main/java/org/apache/openejb/jee/oejb2/Jndi.java
Modified:
    openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/OpenEjb2Conversion.java
    openejb/trunk/openejb3/container/openejb-jee/src/main/java/org/apache/openejb/jee/oejb2/EnterpriseBean.java
    openejb/trunk/openejb3/container/openejb-jee/src/main/java/org/apache/openejb/jee/oejb2/EntityBeanType.java
    openejb/trunk/openejb3/container/openejb-jee/src/main/java/org/apache/openejb/jee/oejb2/MessageDrivenBeanType.java
    openejb/trunk/openejb3/container/openejb-jee/src/main/java/org/apache/openejb/jee/oejb2/SessionBeanType.java
    openejb/trunk/openejb3/container/openejb-jee/src/test/resources/openejb-jar-2-full.xml
    openejb/trunk/openejb3/container/openejb-jee/src/test/resources/openejb-jar-2-invalid.xml

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/OpenEjb2Conversion.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/OpenEjb2Conversion.java?rev=601615&r1=601614&r2=601615&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/OpenEjb2Conversion.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/OpenEjb2Conversion.java Wed Dec  5 21:12:15 2007
@@ -54,6 +54,7 @@
 import org.apache.openejb.jee.oejb2.EjbRefType;
 import org.apache.openejb.jee.oejb2.PatternType;
 import org.apache.openejb.jee.oejb2.EjbLocalRefType;
+import org.apache.openejb.jee.oejb2.Jndi;
 import org.apache.openejb.jee.oejb3.OpenejbJar;
 import org.apache.openejb.jee.oejb3.EjbDeployment;
 import org.apache.openejb.jee.oejb3.EjbLink;
@@ -118,6 +119,18 @@
             if (deployment == null) {
                 // todo warn no such ejb in the ejb-jar.xml
                 continue;
+            }
+
+            for (String name : enterpriseBean.getLocalJndiName()) {
+                deployment.getJndi().add(new org.apache.openejb.jee.oejb3.Jndi(name, "LocalHome"));
+            }
+
+            for (String name : enterpriseBean.getJndiName()) {
+                deployment.getJndi().add(new org.apache.openejb.jee.oejb3.Jndi(name, "RemoteHome"));
+            }
+
+            for (Jndi jndi : enterpriseBean.getJndi()) {
+                deployment.getJndi().add(new org.apache.openejb.jee.oejb3.Jndi(jndi.getName(), jndi.getInterface()));
             }
 
             Set<String> ejbLinks =  new TreeSet<String>();

Modified: openejb/trunk/openejb3/container/openejb-jee/src/main/java/org/apache/openejb/jee/oejb2/EnterpriseBean.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-jee/src/main/java/org/apache/openejb/jee/oejb2/EnterpriseBean.java?rev=601615&r1=601614&r2=601615&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-jee/src/main/java/org/apache/openejb/jee/oejb2/EnterpriseBean.java (original)
+++ openejb/trunk/openejb3/container/openejb-jee/src/main/java/org/apache/openejb/jee/oejb2/EnterpriseBean.java Wed Dec  5 21:12:15 2007
@@ -17,10 +17,8 @@
 package org.apache.openejb.jee.oejb2;
 
 import javax.xml.bind.JAXBElement;
-import javax.xml.bind.annotation.XmlElement;
 import java.lang.*;
 import java.util.List;
-import java.util.ArrayList;
 
 /**
  * @version $Rev$ $Date$
@@ -34,6 +32,8 @@
 
     List<String> getLocalJndiName();
 
+    List<Jndi> getJndi();
+
     List<JAXBElement<? extends AbstractNamingEntryType>> getAbstractNamingEntry();
 
     List<PersistenceContextRefType> getPersistenceContextRef();
@@ -49,4 +49,7 @@
     List<ResourceRefType> getResourceRef();
 
     List<ResourceEnvRefType> getResourceEnvRef();
+
+
+
 }

Modified: openejb/trunk/openejb3/container/openejb-jee/src/main/java/org/apache/openejb/jee/oejb2/EntityBeanType.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-jee/src/main/java/org/apache/openejb/jee/oejb2/EntityBeanType.java?rev=601615&r1=601614&r2=601615&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-jee/src/main/java/org/apache/openejb/jee/oejb2/EntityBeanType.java (original)
+++ openejb/trunk/openejb3/container/openejb-jee/src/main/java/org/apache/openejb/jee/oejb2/EntityBeanType.java Wed Dec  5 21:12:15 2007
@@ -117,6 +117,7 @@
     "ejbName",
     "jndiName",
     "localJndiName",
+    "jndi",
     "tssLink",
     "tss",
     "tableName",
@@ -148,6 +149,9 @@
     @XmlElement(name = "local-jndi-name")
     protected List<String> localJndiName;
 
+    @XmlElement(name = "jndi")
+    protected List<Jndi> jndi;
+
     @XmlElement(name = "tss-link")
     protected String tssLink;
 
@@ -290,6 +294,13 @@
             localJndiName = new ArrayList<String>();
         }
         return this.localJndiName;
+    }
+
+    public List<Jndi> getJndi() {
+        if (jndi == null) {
+            jndi = new ArrayList<Jndi>();
+        }
+        return this.jndi;
     }
 
     /**

Added: openejb/trunk/openejb3/container/openejb-jee/src/main/java/org/apache/openejb/jee/oejb2/Jndi.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-jee/src/main/java/org/apache/openejb/jee/oejb2/Jndi.java?rev=601615&view=auto
==============================================================================
--- openejb/trunk/openejb3/container/openejb-jee/src/main/java/org/apache/openejb/jee/oejb2/Jndi.java (added)
+++ openejb/trunk/openejb3/container/openejb-jee/src/main/java/org/apache/openejb/jee/oejb2/Jndi.java Wed Dec  5 21:12:15 2007
@@ -0,0 +1,63 @@
+/**
+ * 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.openejb.jee.oejb2;
+
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlAttribute;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "")
+@XmlRootElement(name = "jndi")
+public class Jndi {
+
+    @XmlAttribute(name = "name")
+    protected String name;
+
+    @XmlAttribute(name = "interface")
+    protected String intrface;
+
+    public Jndi() {
+    }
+
+    public Jndi(String name, String intrface) {
+        this.name = name;
+        this.intrface = intrface;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String value) {
+        this.name = value;
+    }
+
+    public String getInterface() {
+        return intrface;
+    }
+
+    public void setInterface(String value) {
+        this.intrface = value;
+    }
+
+}

Modified: openejb/trunk/openejb3/container/openejb-jee/src/main/java/org/apache/openejb/jee/oejb2/MessageDrivenBeanType.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-jee/src/main/java/org/apache/openejb/jee/oejb2/MessageDrivenBeanType.java?rev=601615&r1=601614&r2=601615&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-jee/src/main/java/org/apache/openejb/jee/oejb2/MessageDrivenBeanType.java (original)
+++ openejb/trunk/openejb3/container/openejb-jee/src/main/java/org/apache/openejb/jee/oejb2/MessageDrivenBeanType.java Wed Dec  5 21:12:15 2007
@@ -19,6 +19,7 @@
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Collections;
 import java.lang.*;
 import javax.xml.bind.JAXBElement;
 import javax.xml.bind.annotation.XmlAccessType;
@@ -112,12 +113,16 @@
 
     @XmlTransient
     public List<String> getJndiName() {
-        return null;
+        return Collections.EMPTY_LIST;
     }
 
     @XmlTransient
     public List<String> getLocalJndiName() {
-        return null;
+        return Collections.EMPTY_LIST;
+    }
+
+    public List<Jndi> getJndi() {
+        return Collections.EMPTY_LIST;
     }
 
     /**

Modified: openejb/trunk/openejb3/container/openejb-jee/src/main/java/org/apache/openejb/jee/oejb2/SessionBeanType.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-jee/src/main/java/org/apache/openejb/jee/oejb2/SessionBeanType.java?rev=601615&r1=601614&r2=601615&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-jee/src/main/java/org/apache/openejb/jee/oejb2/SessionBeanType.java (original)
+++ openejb/trunk/openejb3/container/openejb-jee/src/main/java/org/apache/openejb/jee/oejb2/SessionBeanType.java Wed Dec  5 21:12:15 2007
@@ -64,6 +64,7 @@
     "ejbName",
     "jndiName",
     "localJndiName",
+    "jndi",
     "cacheSize",
     "tssLink",
     "tss",
@@ -87,6 +88,8 @@
     protected List<String> jndiName;
     @XmlElement(name = "local-jndi-name")
     protected List<String> localJndiName;
+    @XmlElement(name = "jndi")
+    protected List<Jndi> jndi;
     @XmlElement(name = "cache-size")
     protected Integer cacheSize;
     @XmlElement(name = "tss-link")
@@ -212,6 +215,13 @@
             localJndiName = new ArrayList<String>();
         }
         return this.localJndiName;
+    }
+
+    public List<Jndi> getJndi() {
+        if (jndi == null) {
+            jndi = new ArrayList<Jndi>();
+        }
+        return this.jndi;
     }
 
     /**

Modified: openejb/trunk/openejb3/container/openejb-jee/src/test/resources/openejb-jar-2-full.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-jee/src/test/resources/openejb-jar-2-full.xml?rev=601615&r1=601614&r2=601615&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-jee/src/test/resources/openejb-jar-2-full.xml (original)
+++ openejb/trunk/openejb3/container/openejb-jee/src/test/resources/openejb-jar-2-full.xml Wed Dec  5 21:12:15 2007
@@ -1,24 +1,24 @@
 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<!--
-
-    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.
--->
-
-<!-- $Rev: 600180 $ $Date: 2007-12-01 19:52:39 +0100 (Sat, 01 Dec 2007) $ -->
-
+<!--
+
+    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.
+-->
+
+<!-- $Rev: 600180 $ $Date: 2007-12-01 19:52:39 +0100 (Sat, 01 Dec 2007) $ -->
+
 <ns3:openejb-jar xmlns="http://geronimo.apache.org/xml/ns/deployment-1.2" xmlns:ns2="http://geronimo.apache.org/xml/ns/naming-1.2" xmlns:ns3="http://openejb.apache.org/xml/ns/openejb-jar-2.2" xmlns:ns4="http://openejb.apache.org/xml/ns/pkgen-2.1" xmlns:ns5="http://geronimo.apache.org/xml/ns/j2ee/application-1.2" xmlns:ns6="http://geronimo.apache.org/xml/ns/security-2.0" xmlns:ns7="http://java.sun.com/xml/ns/persistence" xmlns:ns8="http://geronimo.apache.org/xml/ns/j2ee/ejb/openejb-2.0">
     <environment>
         <moduleId>
@@ -73,6 +73,8 @@
             <ns3:jndi-name>jndiTwoString</ns3:jndi-name>
             <ns3:local-jndi-name>String</ns3:local-jndi-name>
             <ns3:local-jndi-name>String</ns3:local-jndi-name>
+            <ns3:jndi name="one" interface="two"/>
+            <ns3:jndi name="three" interface="four"/>
             <ns3:cache-size>0</ns3:cache-size>
             <ns3:tss-link>tssLinkString</ns3:tss-link>
             <ns2:persistence-context-ref>

Modified: openejb/trunk/openejb3/container/openejb-jee/src/test/resources/openejb-jar-2-invalid.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-jee/src/test/resources/openejb-jar-2-invalid.xml?rev=601615&r1=601614&r2=601615&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-jee/src/test/resources/openejb-jar-2-invalid.xml (original)
+++ openejb/trunk/openejb3/container/openejb-jee/src/test/resources/openejb-jar-2-invalid.xml Wed Dec  5 21:12:15 2007
@@ -1,24 +1,24 @@
 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<!--
-
-    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.
--->
-
-<!-- $Rev: 600180 $ $Date: 2007-12-01 19:52:39 +0100 (Sat, 01 Dec 2007) $ -->
-
+<!--
+
+    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.
+-->
+
+<!-- $Rev: 600180 $ $Date: 2007-12-01 19:52:39 +0100 (Sat, 01 Dec 2007) $ -->
+
 <openejb-jar xmlns="http://openejb.apache.org/xml/ns/openejb-jar-2.2"
   xmlns:pkgen="http://openejb.apache.org/xml/ns/pkgen-2.1"
   xmlns:naming="http://geronimo.apache.org/xml/ns/naming-1.2"
@@ -76,6 +76,8 @@
             <jndi-name>jndiTwoString</jndi-name>
             <local-jndi-name>String</local-jndi-name>
             <local-jndi-name>String</local-jndi-name>
+            <jndi name="one" interface="two"/>
+            <jndi name="three" interface="four"/>
             <cache-size>0</cache-size>
             <tss-link>tssLinkString</tss-link>
             <persistence-context-ref>