You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by gd...@apache.org on 2008/02/23 02:03:09 UTC

svn commit: r630370 [2/4] - in /geronimo/server/trunk: ./ assemblies/geronimo-jetty6-javaee5/ framework/modules/geronimo-kernel/src/test/java/org/apache/geronimo/kernel/config/ plugins/clustering/geronimo-clustering-wadi/src/main/java/org/apache/geroni...

Modified: geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbDeploymentBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbDeploymentBuilder.java?rev=630370&r1=630369&r2=630370&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbDeploymentBuilder.java (original)
+++ geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbDeploymentBuilder.java Fri Feb 22 17:02:57 2008
@@ -34,7 +34,6 @@
 import org.apache.geronimo.j2ee.deployment.EARContext;
 import org.apache.geronimo.j2ee.deployment.NamingBuilder;
 import org.apache.geronimo.j2ee.deployment.annotation.AnnotatedEjbJar;
-import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
 import org.apache.geronimo.kernel.GBeanAlreadyExistsException;
 import org.apache.geronimo.naming.deployment.AbstractNamingBuilder;
 import org.apache.geronimo.naming.deployment.GBeanResourceEnvironmentBuilder;
@@ -74,6 +73,7 @@
     private final EjbModule ejbModule;
     private final NamingBuilder namingBuilder;
     private final ResourceEnvironmentSetter resourceEnvironmentSetter;
+    private final EjbDeploymentGBeanNameBuilder beanNameBuilder;
     private final Map<String, GBeanData> gbeans = new TreeMap<String, GBeanData>();
 
     public EjbDeploymentBuilder(EARContext earContext, EjbModule ejbModule, NamingBuilder namingBuilder, ResourceEnvironmentSetter resourceEnvironmentSetter) {
@@ -81,11 +81,13 @@
         this.ejbModule = ejbModule;
         this.namingBuilder = namingBuilder;
         this.resourceEnvironmentSetter = resourceEnvironmentSetter;
+        
+        beanNameBuilder = new BasicEjbDeploymentGBeanNameBuilder();
     }
 
     public void initContext() throws DeploymentException {
         for (EnterpriseBean enterpriseBean : ejbModule.getEjbJar().getEnterpriseBeans()) {
-            AbstractName abstractName = createEjbName(enterpriseBean);
+            AbstractName abstractName = beanNameBuilder.createEjbName(earContext, ejbModule, enterpriseBean);
             GBeanData gbean = null;
             if (enterpriseBean instanceof SessionBean) {
                 SessionBean sessionBean = (SessionBean) enterpriseBean;
@@ -363,30 +365,6 @@
         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 SessionBean) {
-            SessionBean sessionBean = (SessionBean) enterpriseBean;
-            switch (sessionBean.getSessionType()) {
-                case STATELESS:
-                    type = NameFactory.STATELESS_SESSION_BEAN;
-                    break;
-                case STATEFUL:
-                    type = NameFactory.STATEFUL_SESSION_BEAN;
-                    break;
-            }
-        } else if (enterpriseBean instanceof EntityBean) {
-            type = NameFactory.ENTITY_BEAN;
-        } else if (enterpriseBean instanceof MessageDrivenBean) {
-            type = NameFactory.MESSAGE_DRIVEN_BEAN;
-        }
-        if (type == null) {
-            throw new IllegalArgumentException("Unknown enterprise bean type XXX " + enterpriseBean.getClass().getName());
-        }
-        return earContext.getNaming().createChildName(ejbModule.getModuleName(), ejbName, type);
     }
 
     private static Class assureEJBObjectInterface(String remote, ClassLoader cl) throws DeploymentException {

Added: geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbDeploymentGBeanNameBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbDeploymentGBeanNameBuilder.java?rev=630370&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbDeploymentGBeanNameBuilder.java (added)
+++ geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbDeploymentGBeanNameBuilder.java Fri Feb 22 17:02:57 2008
@@ -0,0 +1,32 @@
+/*
+ * 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 org.apache.geronimo.gbean.AbstractName;
+import org.apache.geronimo.j2ee.deployment.EARContext;
+import org.apache.openejb.jee.EnterpriseBean;
+
+/**
+ *
+ * @version $Rev:$ $Date:$
+ */
+public interface EjbDeploymentGBeanNameBuilder {
+    AbstractName createEjbName(EARContext earContext, EjbModule ejbModule, EnterpriseBean enterpriseBean);
+}

Modified: geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbModule.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbModule.java?rev=630370&r1=630369&r2=630370&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbModule.java (original)
+++ geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbModule.java Fri Feb 22 17:02:57 2008
@@ -19,13 +19,14 @@
 import java.util.jar.JarFile;
 
 import org.apache.geronimo.gbean.AbstractName;
-import org.apache.geronimo.j2ee.deployment.annotation.AnnotatedApp;
 import org.apache.geronimo.j2ee.deployment.EJBModule;
+import org.apache.geronimo.j2ee.deployment.annotation.AnnotatedApp;
 import org.apache.geronimo.kernel.repository.Environment;
 import org.apache.geronimo.openejb.xbeans.ejbjar.OpenejbGeronimoEjbJarType;
-import org.apache.openejb.jee.oejb3.OpenejbJar;
 import org.apache.openejb.assembler.classic.EjbJarInfo;
+import org.apache.openejb.config.ConfigurationFactory;
 import org.apache.openejb.jee.EjbJar;
+import org.apache.openejb.jee.oejb3.OpenejbJar;
 import org.apache.xmlbeans.XmlObject;
 
 /**
@@ -38,10 +39,13 @@
     private EjbDeploymentBuilder ejbDeploymentBuilder;
     private OpenejbGeronimoEjbJarType vendorDD;
     private final org.apache.openejb.config.EjbModule ejbModule;
+    private final ConfigurationFactory.Chain preAutoConfigDeployer;
 
     public EjbModule(org.apache.openejb.config.EjbModule ejbModule, boolean standAlone, AbstractName moduleName, Environment environment, JarFile moduleFile, String targetPath, String ejbJarXml, AnnotatedApp annoatedApp) {
         super(standAlone, moduleName, environment, moduleFile, targetPath, null, null, ejbJarXml, annoatedApp);
         this.ejbModule = ejbModule;
+        
+        preAutoConfigDeployer = new ConfigurationFactory.Chain();
     }
 
     @Override
@@ -105,5 +109,9 @@
 
     public void setClassLoader(ClassLoader classLoader) {
         ejbModule.setClassLoader(classLoader);
+    }
+
+    public ConfigurationFactory.Chain getPreAutoConfigDeployer() {
+        return preAutoConfigDeployer;
     }
 }

Modified: geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbModuleBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbModuleBuilder.java?rev=630370&r1=630369&r2=630370&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbModuleBuilder.java (original)
+++ geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbModuleBuilder.java Fri Feb 22 17:02:57 2008
@@ -108,6 +108,7 @@
 import org.apache.openejb.config.ValidationError;
 import org.apache.openejb.config.ValidationFailedException;
 import org.apache.openejb.config.ValidationFailure;
+import org.apache.openejb.config.ConfigurationFactory.Chain;
 import org.apache.openejb.jee.EjbJar;
 import org.apache.openejb.jee.EjbRef;
 import org.apache.openejb.jee.EnterpriseBean;
@@ -160,14 +161,13 @@
     private final Collection<ModuleBuilderExtension> moduleBuilderExtensions;
 
     public EjbModuleBuilder(Environment defaultEnvironment,
-
-                            String defaultCmpJTADataSource, String defaultCmpNonJTADataSource,
-                            Collection<ModuleBuilderExtension> moduleBuilderExtensions,
-                            Collection securityBuilders,
-                            Collection serviceBuilders,
-                            NamingBuilder namingBuilders,
-                            ResourceEnvironmentSetter resourceEnvironmentSetter) {
-
+        String defaultCmpJTADataSource,
+        String defaultCmpNonJTADataSource,
+        Collection<ModuleBuilderExtension> moduleBuilderExtensions,
+        Collection securityBuilders,
+        Collection serviceBuilders,
+        NamingBuilder namingBuilders,
+        ResourceEnvironmentSetter resourceEnvironmentSetter) {
         this.defaultEnvironment = defaultEnvironment;
         this.defaultCmpJTADataSource = defaultCmpJTADataSource;
         this.defaultCmpNonJTADataSource = defaultCmpNonJTADataSource;
@@ -572,7 +572,7 @@
             // (metadata complete) and it run the openejb verifier
             AppInfo appInfo;
             try {
-                appInfo = configureApplication(appModule, earContext.getConfiguration());
+                appInfo = configureApplication(appModule, ejbModule, earContext.getConfiguration());
             } catch (ValidationFailedException set) {
                 StringBuilder sb = new StringBuilder();
                 sb.append("Jar failed validation: ").append(appModule.getModuleId());
@@ -622,12 +622,16 @@
         return ejbJarInfo;
     }
 
-    private AppInfo configureApplication(AppModule appModule, Configuration configuration) throws OpenEJBException {
+    private AppInfo configureApplication(AppModule appModule, EjbModule ejbModule, Configuration configuration)
+            throws OpenEJBException {
         OpenEjbConfiguration openEjbConfiguration = new OpenEjbConfiguration();
         openEjbConfiguration.containerSystem = new ContainerSystemInfo();
         openEjbConfiguration.facilities = new FacilitiesInfo();
         boolean offline = true;
-        ConfigurationFactory configurationFactory = new ConfigurationFactory(offline, openEjbConfiguration);
+        
+        ConfigurationFactory configurationFactory = new ConfigurationFactory(offline,
+            ejbModule.getPreAutoConfigDeployer(),
+            openEjbConfiguration);
         ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
         Thread.currentThread().setContextClassLoader(appModule.getClassLoader());
         try {

Modified: geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/xsd/geronimo-openejb-2.0.xsd
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/xsd/geronimo-openejb-2.0.xsd?rev=630370&r1=630369&r2=630370&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/xsd/geronimo-openejb-2.0.xsd (original)
+++ geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/xsd/geronimo-openejb-2.0.xsd Fri Feb 22 17:02:57 2008
@@ -43,6 +43,15 @@
         <xs:sequence>
             <xs:element ref="sys:environment" minOccurs="0"/>
 
+            <xs:element ref="app:clustering" minOccurs="0">
+                <xs:annotation>
+                    <xs:documentation>
+                        Reference to abstract clustering element defined in
+                        imported "geronimo-application-2.0.xsd"
+                    </xs:documentation>
+                </xs:annotation>
+            </xs:element>
+
             <xs:element name="openejb-jar" type="openejb:openejb-jarType" minOccurs="0"/>
 
             <!-- Naming -->

Added: geronimo/server/trunk/plugins/openejb/geronimo-openejb-clustering-builder-wadi/LICENSE.txt
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/openejb/geronimo-openejb-clustering-builder-wadi/LICENSE.txt?rev=630370&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/openejb/geronimo-openejb-clustering-builder-wadi/LICENSE.txt (added)
+++ geronimo/server/trunk/plugins/openejb/geronimo-openejb-clustering-builder-wadi/LICENSE.txt Fri Feb 22 17:02:57 2008
@@ -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/plugins/openejb/geronimo-openejb-clustering-builder-wadi/NOTICE.txt
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/openejb/geronimo-openejb-clustering-builder-wadi/NOTICE.txt?rev=630370&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/openejb/geronimo-openejb-clustering-builder-wadi/NOTICE.txt (added)
+++ geronimo/server/trunk/plugins/openejb/geronimo-openejb-clustering-builder-wadi/NOTICE.txt Fri Feb 22 17:02:57 2008
@@ -0,0 +1,14 @@
+   =========================================================================
+   ==  NOTICE file corresponding to the section 4 d of                    ==
+   ==  the Apache License, Version 2.0,                                   ==
+   ==  in this case for the Apache OpenEJB distribution.                  ==
+   =========================================================================
+
+   Apache Geronimo 
+   Copyright 2003-2007 The Apache Software Foundation
+
+   Apache OpenEJB Project
+   Copyright 1999-2007 The Apache Software Foundation
+
+   This product includes software developed by
+   The Apache Software Foundation (http://www.apache.org/).

Added: geronimo/server/trunk/plugins/openejb/geronimo-openejb-clustering-builder-wadi/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/openejb/geronimo-openejb-clustering-builder-wadi/pom.xml?rev=630370&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/openejb/geronimo-openejb-clustering-builder-wadi/pom.xml (added)
+++ geronimo/server/trunk/plugins/openejb/geronimo-openejb-clustering-builder-wadi/pom.xml Fri Feb 22 17:02:57 2008
@@ -0,0 +1,71 @@
+<?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: 590482 $ $Date: 2007-10-31 08:51:54 +1100 (Wed, 31 Oct 2007) $ -->
+
+<project>
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.geronimo.plugins</groupId>
+        <artifactId>openejb</artifactId>
+        <version>2.2-SNAPSHOT</version>
+    </parent>
+
+    <groupId>org.apache.geronimo.modules</groupId>
+    <artifactId>geronimo-openejb-clustering-builder-wadi</artifactId>
+    <name>Geronimo Plugins, OpenEJB :: Clustering Builder for WADI</name>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.geronimo.modules</groupId>
+            <artifactId>geronimo-openejb-builder</artifactId>
+            <version>${version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.geronimo.modules</groupId>
+            <artifactId>geronimo-openejb-clustering-wadi</artifactId>
+            <version>${version}</version>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>xmlbeans-maven-plugin</artifactId>
+            </plugin>
+            
+            <!--
+            HACK: Copy XmlBeans generated schemas.
+            -->
+            <plugin>
+                <groupId>org.apache.geronimo.buildsupport</groupId>
+                <artifactId>buildsupport-maven-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>copy-xmlbeans-schemas</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>

Added: geronimo/server/trunk/plugins/openejb/geronimo-openejb-clustering-builder-wadi/src/main/java/org/apache/geronimo/openejb/deployment/cluster/MapSFSBToContainerIDDeployer.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/openejb/geronimo-openejb-clustering-builder-wadi/src/main/java/org/apache/geronimo/openejb/deployment/cluster/MapSFSBToContainerIDDeployer.java?rev=630370&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/openejb/geronimo-openejb-clustering-builder-wadi/src/main/java/org/apache/geronimo/openejb/deployment/cluster/MapSFSBToContainerIDDeployer.java (added)
+++ geronimo/server/trunk/plugins/openejb/geronimo-openejb-clustering-builder-wadi/src/main/java/org/apache/geronimo/openejb/deployment/cluster/MapSFSBToContainerIDDeployer.java Fri Feb 22 17:02:57 2008
@@ -0,0 +1,67 @@
+/*
+ * 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.cluster;
+
+import org.apache.openejb.OpenEJBException;
+import org.apache.openejb.config.AppModule;
+import org.apache.openejb.config.DynamicDeployer;
+import org.apache.openejb.jee.EjbJar;
+import org.apache.openejb.jee.EnterpriseBean;
+import org.apache.openejb.jee.SessionBean;
+import org.apache.openejb.jee.oejb3.EjbDeployment;
+import org.apache.openejb.jee.oejb3.OpenejbJar;
+
+/**
+ *
+ * @version $Rev:$ $Date:$
+ */
+public class MapSFSBToContainerIDDeployer implements DynamicDeployer {
+
+    private final String containerId;
+
+    public MapSFSBToContainerIDDeployer(String containerId) {
+        if (null == containerId) {
+            throw new IllegalArgumentException("containerId is required");
+        }
+        this.containerId = containerId;
+    }
+
+    public AppModule deploy(AppModule appModule) throws OpenEJBException {
+        for (org.apache.openejb.config.EjbModule ejbModule : appModule.getEjbModules()) {
+            OpenejbJar openejbJar = ejbModule.getOpenejbJar();
+            EjbJar ejbJar = ejbModule.getEjbJar();
+            for (EnterpriseBean enterpriseBean : ejbJar.getEnterpriseBeans()) {
+                if (enterpriseBean instanceof SessionBean) {
+                    SessionBean sessionBean = (SessionBean) enterpriseBean;
+                    switch (sessionBean.getSessionType()) {
+                        case STATEFUL:
+                            String ejbName = sessionBean.getEjbName();
+                            EjbDeployment ejbDeployment = openejbJar.getDeploymentsByEjbName().get(ejbName);
+                            if (null == ejbDeployment) {
+                                throw new OpenEJBException("No ejbDeployment for ejbName [" + ejbName + "]");
+                            }
+                            ejbDeployment.setContainerId(containerId);
+                    }
+                }
+            }
+        }
+        return appModule;
+    }
+}
\ No newline at end of file

Added: geronimo/server/trunk/plugins/openejb/geronimo-openejb-clustering-builder-wadi/src/main/java/org/apache/geronimo/openejb/deployment/cluster/OpenEJBClusteringWADIConverter.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/openejb/geronimo-openejb-clustering-builder-wadi/src/main/java/org/apache/geronimo/openejb/deployment/cluster/OpenEJBClusteringWADIConverter.java?rev=630370&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/openejb/geronimo-openejb-clustering-builder-wadi/src/main/java/org/apache/geronimo/openejb/deployment/cluster/OpenEJBClusteringWADIConverter.java (added)
+++ geronimo/server/trunk/plugins/openejb/geronimo-openejb-clustering-builder-wadi/src/main/java/org/apache/geronimo/openejb/deployment/cluster/OpenEJBClusteringWADIConverter.java Fri Feb 22 17:02:57 2008
@@ -0,0 +1,84 @@
+/*
+ * 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.cluster;
+
+import javax.xml.namespace.QName;
+
+import org.apache.geronimo.schema.ElementConverter;
+import org.apache.geronimo.xbeans.geronimo.GerOpenejbClusteringWadiDocument;
+import org.apache.geronimo.xbeans.geronimo.naming.GerPatternType;
+import org.apache.xmlbeans.XmlCursor;
+
+/**
+ *
+ * @version $Rev:$ $Date:$
+ */
+public class OpenEJBClusteringWADIConverter implements ElementConverter {
+    private static final String CLUSTERING_WADI_NS = GerOpenejbClusteringWadiDocument.type.getDocumentElementName().getNamespaceURI();
+    private static final String NAMING_NS = GerPatternType.type.getName().getNamespaceURI();
+    private static final String CLUSTER_ELEMENT_NAME = "cluster";
+    private static final String BACKING_STRATEGY_FACTORY_ELEMENT_NAME = "backing-strategy-factory";
+
+    public void convertElement(XmlCursor cursor, XmlCursor end) {
+        end.toCursor(cursor);
+        end.toEndToken();
+
+        while (cursor.hasNextToken() && cursor.isLeftOf(end)) {
+            if (cursor.isStart()) {
+                String localPart = cursor.getName().getLocalPart();
+                cursor.setName(new QName(CLUSTERING_WADI_NS, localPart));
+                if (localPart.equals(CLUSTER_ELEMENT_NAME) || localPart.equals(BACKING_STRATEGY_FACTORY_ELEMENT_NAME)) {
+                    convertChildrenToNamingNS(cursor);
+                    cursor.toEndToken();
+                }
+            }
+            cursor.toNextToken();
+        }
+    }
+
+    protected void convertChildrenToNamingNS(XmlCursor cursor) {
+        XmlCursor namingCursor = cursor.newCursor();
+        try {
+            if (namingCursor.toFirstChild()) {
+                XmlCursor endNamingCursor = namingCursor.newCursor();
+                try {
+                    convertToNamingNS(namingCursor, endNamingCursor);
+                } finally {
+                    endNamingCursor.dispose();
+                }
+            }
+        } finally {
+            namingCursor.dispose();
+        }
+    }
+
+    protected void convertToNamingNS(XmlCursor cursor, XmlCursor end) {
+        end.toCursor(cursor);
+        end.toEndToken();
+        while (cursor.hasNextToken() && cursor.isLeftOf(end)) {
+            if (cursor.isStart()) {
+                String localPart = cursor.getName().getLocalPart();
+                cursor.setName(new QName(NAMING_NS, localPart));
+            }
+            cursor.toNextToken();
+        }
+    }
+
+}

Added: geronimo/server/trunk/plugins/openejb/geronimo-openejb-clustering-builder-wadi/src/main/java/org/apache/geronimo/openejb/deployment/cluster/WADIOpenEJBClusteringBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/openejb/geronimo-openejb-clustering-builder-wadi/src/main/java/org/apache/geronimo/openejb/deployment/cluster/WADIOpenEJBClusteringBuilder.java?rev=630370&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/openejb/geronimo-openejb-clustering-builder-wadi/src/main/java/org/apache/geronimo/openejb/deployment/cluster/WADIOpenEJBClusteringBuilder.java (added)
+++ geronimo/server/trunk/plugins/openejb/geronimo-openejb-clustering-builder-wadi/src/main/java/org/apache/geronimo/openejb/deployment/cluster/WADIOpenEJBClusteringBuilder.java Fri Feb 22 17:02:57 2008
@@ -0,0 +1,426 @@
+/*
+ * 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.cluster;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.jar.JarFile;
+
+import javax.xml.namespace.QName;
+
+import org.apache.geronimo.clustering.wadi.BasicWADISessionManager;
+import org.apache.geronimo.clustering.wadi.WADISessionManagerConfigInfo;
+import org.apache.geronimo.common.DeploymentException;
+import org.apache.geronimo.deployment.DeploymentContext;
+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.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.j2ee.deployment.EARContext;
+import org.apache.geronimo.j2ee.deployment.Module;
+import org.apache.geronimo.j2ee.deployment.ModuleBuilderExtension;
+import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
+import org.apache.geronimo.kernel.GBeanAlreadyExistsException;
+import org.apache.geronimo.kernel.GBeanNotFoundException;
+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.ENCConfigBuilder;
+import org.apache.geronimo.openejb.cluster.infra.BasicNetworkConnectorTrackerServiceHolder;
+import org.apache.geronimo.openejb.cluster.infra.NetworkConnectorMonitor;
+import org.apache.geronimo.openejb.cluster.stateful.deployment.ClusteredStatefulDeployment;
+import org.apache.geronimo.openejb.deployment.BasicEjbDeploymentGBeanNameBuilder;
+import org.apache.geronimo.openejb.deployment.EjbDeploymentGBeanNameBuilder;
+import org.apache.geronimo.openejb.deployment.EjbModule;
+import org.apache.geronimo.openejb.deployment.XmlUtil;
+import org.apache.geronimo.openejb.xbeans.ejbjar.OpenejbGeronimoEjbJarType;
+import org.apache.geronimo.schema.SchemaConversionUtils;
+import org.apache.geronimo.xbeans.geronimo.GerOpenejbClusteringWadiDocument;
+import org.apache.geronimo.xbeans.geronimo.GerOpenejbClusteringWadiType;
+import org.apache.geronimo.xbeans.geronimo.j2ee.GerClusteringDocument;
+import org.apache.geronimo.xbeans.geronimo.naming.GerPatternType;
+import org.apache.openejb.jee.EjbJar;
+import org.apache.openejb.jee.EnterpriseBean;
+import org.apache.openejb.jee.SessionBean;
+import org.apache.openejb.jee.oejb2.GeronimoEjbJarType;
+import org.apache.xmlbeans.QNameSet;
+import org.apache.xmlbeans.XmlObject;
+
+/**
+ *
+ * @version $Rev:$ $Date:$
+ */
+public class WADIOpenEJBClusteringBuilder implements ModuleBuilderExtension {
+    private static final QName CLUSTERING_WADI_QNAME = GerOpenejbClusteringWadiDocument.type.getDocumentElementName();
+    private static final QNameSet CLUSTERING_WADI_QNAME_SET = QNameSet.singleton(CLUSTERING_WADI_QNAME);
+    
+    static {
+        SchemaConversionUtils.registerNamespaceConversions(
+            Collections.singletonMap(CLUSTERING_WADI_QNAME.getLocalPart(),
+            new OpenEJBClusteringWADIConverter()));
+    }
+
+    private final String defaultClusteredStatefulContainerId;
+    private final EjbDeploymentGBeanNameBuilder beanNameBuilder;
+    private final int defaultSweepInterval;
+    private final int defaultSessionTimeout;
+    private final int defaultNumPartitions;
+    private final AbstractNameQuery defaultBackingStrategyFactoryName;
+    private final AbstractNameQuery defaultClusterName;
+    private final AbstractNameQuery defaultNetworkConnectorName;
+    private final Environment defaultEnvironment;
+
+    public WADIOpenEJBClusteringBuilder(String defaultClusteredStatefulContainerId,
+        int defaultSweepInterval,
+        int defaultSessionTimeout,
+        int defaultNumPartitions,
+        AbstractNameQuery defaultBackingStrategyFactoryName,
+        AbstractNameQuery defaultClusterName,
+        AbstractNameQuery defaultNetworkConnectorName,        
+        Environment defaultEnvironment) {
+        if (null == defaultClusteredStatefulContainerId) {
+            throw new IllegalArgumentException("defaultClusteredStatefulContainerId is required");
+        } else if (defaultSweepInterval < 1) {
+            throw new IllegalArgumentException("defaultSweepInterval is lower than 1");
+        } else if (defaultSessionTimeout < 1) {
+            throw new IllegalArgumentException("defaultSessionTimeout is lower than 1");
+        } else if (defaultNumPartitions < 1) {
+            throw new IllegalArgumentException("defaultNumPartitions is lower than 1");
+        } else if (null == defaultBackingStrategyFactoryName) {
+            throw new IllegalArgumentException("defaultBackingStrategyFactoryName is required");
+        } else if (null == defaultClusterName) {
+            throw new IllegalArgumentException("defaultClusterName is required");
+        } else if (null == defaultEnvironment) {
+            throw new IllegalArgumentException("defaultEnvironment is required");
+        } else if (null == defaultNetworkConnectorName) {
+            throw new IllegalArgumentException("defaultNetworkConnectorName is required");
+        }
+        this.defaultClusteredStatefulContainerId = defaultClusteredStatefulContainerId;
+        this.defaultSweepInterval = defaultSweepInterval;
+        this.defaultSessionTimeout = defaultSessionTimeout;
+        this.defaultNumPartitions = defaultNumPartitions;
+        this.defaultBackingStrategyFactoryName = defaultBackingStrategyFactoryName;
+        this.defaultClusterName = defaultClusterName;
+        this.defaultNetworkConnectorName = defaultNetworkConnectorName;
+        this.defaultEnvironment = defaultEnvironment;
+        
+        beanNameBuilder = new BasicEjbDeploymentGBeanNameBuilder();
+        
+        new NamespaceDrivenBuilderCollection(Collections.singleton(new NamespaceDrivenBuilder() {
+            public void build(XmlObject container, DeploymentContext applicationContext, DeploymentContext moduleContext)
+                    throws DeploymentException {
+            }
+
+            public void buildEnvironment(XmlObject container, Environment environment) throws DeploymentException {
+            }
+
+            public QNameSet getPlanQNameSet() {
+                return CLUSTERING_WADI_QNAME_SET;
+            }
+
+            public QNameSet getSpecQNameSet() {
+                return QNameSet.EMPTY;
+            }
+        }), GerClusteringDocument.type.getDocumentElementName());
+    }
+    
+    public void addGBeans(EARContext earContext, Module module, ClassLoader cl, Collection repository)
+            throws DeploymentException {
+        EjbModule ejbModule = (EjbModule) module;
+        
+        OpenejbGeronimoEjbJarType geronimoEjbJarType = ejbModule.getVendorDD();
+        GerOpenejbClusteringWadiType clusteringWadiType = getWadiClusterConfig(geronimoEjbJarType);
+        AbstractName sessionManagerName = addSessionManager(clusteringWadiType, ejbModule, earContext);
+
+        addNetworkConnectorMonitor(earContext, sessionManagerName);
+
+        EjbJar ejbJar = ejbModule.getEjbJar();
+        for (EnterpriseBean enterpriseBean : ejbJar.getEnterpriseBeans()) {
+            if (enterpriseBean instanceof SessionBean) {
+                SessionBean sessionBean = (SessionBean) enterpriseBean;
+                switch (sessionBean.getSessionType()) {
+                    case STATEFUL:
+                        replaceByClusteredDeploymentGBean(earContext,
+                            ejbModule,
+                            sessionManagerName,
+                            enterpriseBean);
+                }
+            }
+        }
+    }
+
+    protected void replaceByClusteredDeploymentGBean(EARContext earContext,
+        EjbModule ejbModule,
+        AbstractName sessionManagerName,
+        EnterpriseBean enterpriseBean) throws DeploymentException {
+        AbstractName name = beanNameBuilder.createEjbName(earContext, ejbModule, enterpriseBean);
+        GBeanData beanInstance;
+        try {
+            beanInstance = earContext.getGBeanInstance(name);
+            earContext.removeGBean(name);
+        } catch (GBeanNotFoundException e) {
+            throw new DeploymentException("No GBean [" + name + "]", e);
+        }
+        GBeanData clusteredDeploymentGBean = new GBeanData(beanInstance);
+        clusteredDeploymentGBean.setGBeanInfo(ClusteredStatefulDeployment.GBEAN_INFO);
+        clusteredDeploymentGBean.setReferencePattern(ClusteredStatefulDeployment.GBEAN_REF_SESSION_MANAGER, sessionManagerName);
+        try {
+            earContext.addGBean(clusteredDeploymentGBean);
+        } catch (GBeanAlreadyExistsException e) {
+            throw new DeploymentException("See nested", e);
+        }
+    }
+
+    public void createModule(Module module,
+        Object plan,
+        JarFile moduleFile,
+        String targetPath,
+        URL specDDUrl,
+        Environment environment,
+        Object moduleContextInfo,
+        AbstractName earName,
+        Naming naming,
+        ModuleIDBuilder idBuilder) throws DeploymentException {
+        EjbModule ejbModule = (EjbModule) module;
+        GeronimoEjbJarType tmpGeronimoEjbJarType = (GeronimoEjbJarType) ejbModule.getEjbModule().getAltDDs().get("geronimo-openejb.xml");
+        OpenejbGeronimoEjbJarType geronimoEjbJarType = XmlUtil.convertToXmlbeans(tmpGeronimoEjbJarType);
+        GerOpenejbClusteringWadiType clusteringWadiType = getWadiClusterConfig(geronimoEjbJarType);
+        if (null == clusteringWadiType) {
+            return;
+        }
+
+        EnvironmentBuilder.mergeEnvironments(environment, defaultEnvironment);
+
+        ejbModule.getPreAutoConfigDeployer().add(new MapSFSBToContainerIDDeployer(defaultClusteredStatefulContainerId));
+    }
+
+    public void initContext(EARContext earContext, Module module, ClassLoader cl) throws DeploymentException {
+    }
+    
+    public void installModule(JarFile earFile,
+        EARContext earContext,
+        Module module,
+        Collection configurationStores,
+        ConfigurationStore targetConfigurationStore,
+        Collection repository) throws DeploymentException {
+    }
+
+    protected AbstractName addSessionManager(GerOpenejbClusteringWadiType clustering,
+        EjbModule ejbModule,
+        DeploymentContext moduleContext) throws DeploymentException {
+        AbstractName name = newGBeanName(moduleContext, "WADISessionManager");
+
+        GBeanData beanData = new GBeanData(name, BasicWADISessionManager.GBEAN_INFO);
+
+        setConfigInfo(clustering, ejbModule, beanData);
+        setCluster(clustering, beanData);
+        setBackingStrategyFactory(clustering, beanData);
+        setClusteredServiceHolders(moduleContext, beanData);
+
+        addGBean(moduleContext, beanData);
+
+        return name;
+    }
+    
+    protected void setClusteredServiceHolders(DeploymentContext moduleContext, GBeanData beanData)
+            throws DeploymentException {
+        AbstractName name = newGBeanName(moduleContext, "NetworkConnectorTrackerHolder");
+
+        GBeanData serviceHolder = new GBeanData(name, BasicNetworkConnectorTrackerServiceHolder.GBEAN_INFO);
+        addGBean(moduleContext, serviceHolder);
+        
+        beanData.setReferencePattern(BasicWADISessionManager.GBEAN_REF_SERVICE_HOLDERS, name);
+    }
+
+    protected void addNetworkConnectorMonitor(DeploymentContext moduleContext, AbstractName sessionManagerName)
+            throws DeploymentException {
+        AbstractName name = newGBeanName(moduleContext, "NetworkConnectorMonitor");
+
+        GBeanData networkConnectorMonitor = new GBeanData(name, NetworkConnectorMonitor.GBEAN_INFO);
+        networkConnectorMonitor.setReferencePattern(NetworkConnectorMonitor.GBEAN_REF_NETWORK_CONNECTORS,
+            defaultNetworkConnectorName);
+        networkConnectorMonitor.setReferencePattern(NetworkConnectorMonitor.GBEAN_REF_EJB_DEP_ID_ACCESSOR,
+            new AbstractNameQuery(ClusteredStatefulDeployment.class.getName()));
+        networkConnectorMonitor.setReferencePattern(NetworkConnectorMonitor.GBEAN_REF_WADI_SESSION_MANAGER,
+            sessionManagerName);
+        
+        addGBean(moduleContext, networkConnectorMonitor);
+    }
+
+    protected AbstractName newGBeanName(DeploymentContext moduleContext, String name) {
+        return moduleContext.getNaming().createChildName(moduleContext.getModuleName(),
+                name,
+                NameFactory.GERONIMO_SERVICE);
+    }
+
+    protected void addGBean(DeploymentContext moduleContext, GBeanData beanData) throws DeploymentException {
+        try {
+            moduleContext.addGBean(beanData);
+        } catch (GBeanAlreadyExistsException e) {
+            throw new DeploymentException(e);
+        }
+    }
+
+    protected void setCluster(GerOpenejbClusteringWadiType clustering, GBeanData beanData) {
+        Set<AbstractNameQuery> patterns = new HashSet<AbstractNameQuery>();
+        if (clustering.isSetCluster()) {
+            addAbstractNameQueries(patterns, clustering.getCluster());
+        } else {
+            patterns.add(defaultClusterName);
+        }
+        beanData.setReferencePatterns(BasicWADISessionManager.GBEAN_REF_CLUSTER, patterns);
+    }
+
+    protected void setBackingStrategyFactory(GerOpenejbClusteringWadiType clustering, GBeanData beanData) {
+        Set<AbstractNameQuery> patterns = new HashSet<AbstractNameQuery>();
+        if (clustering.isSetBackingStrategyFactory()) {
+            addAbstractNameQueries(patterns, clustering.getBackingStrategyFactory());
+        } else {
+            patterns.add(defaultBackingStrategyFactoryName);
+        }
+        beanData.setReferencePatterns(BasicWADISessionManager.GBEAN_REF_BACKING_STRATEGY_FACTORY, patterns);
+    }
+
+    protected void addAbstractNameQueries(Set<AbstractNameQuery> patterns, GerPatternType patternType) {
+        AbstractNameQuery query = ENCConfigBuilder.buildAbstractNameQuery(patternType, null, null, null);
+        patterns.add(query);
+    }
+
+    protected void setConfigInfo(GerOpenejbClusteringWadiType clustering, EjbModule ejbModule, GBeanData beanData) {
+        int sweepInterval = getSweepInterval(clustering);
+        int numPartitions = getNumberOfPartitions(clustering);
+        Integer sessionTimeout = getSessionTimeout();
+        boolean disableReplication = isDisableReplication(clustering);
+        boolean deltaReplication = isDeltaReplication(clustering);
+        
+        String ejbModuleName = (String) ejbModule.getName();
+        URI serviceSpaceName;
+        try {
+            serviceSpaceName = new URI(ejbModuleName);
+        } catch (URISyntaxException e) {
+            AssertionError error = new AssertionError("contextPath [" + ejbModuleName + "] cannot be parsed as an URI.");
+            throw (AssertionError) error.initCause(e);
+        }
+        
+        WADISessionManagerConfigInfo configInfo = new WADISessionManagerConfigInfo(serviceSpaceName,
+                sweepInterval,
+                numPartitions,
+                sessionTimeout.intValue(),
+                disableReplication,
+                deltaReplication);
+        beanData.setAttribute(BasicWADISessionManager.GBEAN_ATTR_WADI_CONFIG_INFO, configInfo);
+    }
+
+    protected Integer getSessionTimeout() throws AssertionError {
+        return defaultSessionTimeout;
+    }
+
+    protected int getSweepInterval(GerOpenejbClusteringWadiType clustering) {
+        if (clustering.isSetSweepInterval()) {
+            return clustering.getSweepInterval().intValue();
+        }
+        return defaultSweepInterval;
+    }
+
+    protected boolean isDeltaReplication(GerOpenejbClusteringWadiType clustering) {
+        if (clustering.isSetDeltaReplication()) {
+            return clustering.getDeltaReplication();
+        }
+        return false;
+    }
+
+    protected boolean isDisableReplication(GerOpenejbClusteringWadiType clustering) {
+        if (clustering.isSetDisableReplication()) {
+            return clustering.getDisableReplication();
+        }
+        return false;
+    }
+
+    protected int getNumberOfPartitions(GerOpenejbClusteringWadiType clustering) {
+        if (clustering.isSetNumPartitions()) {
+            return clustering.getNumPartitions().intValue();
+        }
+        return defaultNumPartitions;
+    }
+    
+    protected GerOpenejbClusteringWadiType getWadiClusterConfig(XmlObject container) throws DeploymentException {
+        XmlObject[] items = container.selectChildren(CLUSTERING_WADI_QNAME_SET);
+        if (items.length > 1) {
+            throw new DeploymentException("Unexpected count of clustering elements in geronimo plan " + items.length
+                    + " qnameset: " + CLUSTERING_WADI_QNAME_SET);
+        }
+        if (items.length == 1) {
+            return (GerOpenejbClusteringWadiType) items[0].copy().changeType(GerOpenejbClusteringWadiType.type);
+        }
+        return null;
+    }
+
+    public static final GBeanInfo GBEAN_INFO;
+
+    public static final String GBEAN_ATTR_DFT_CLUSTERED_SFSB_CONT_ID = "defaultClusteredStatefulContainerId";
+    public static final String GBEAN_ATTR_DFT_SWEEP_INTERVAL = "defaultSweepInterval";
+    public static final String GBEAN_ATTR_DFT_SESSION_TIMEOUT = "defaultSessionTimeout";
+    public static final String GBEAN_ATTR_DFT_NUM_PARTITIONS = "defaultNumPartitions";
+    public static final String GBEAN_ATTR_DFT_BACKING_STRATEGY_FACTORY_NAME = "defaultBackingStrategyFactoryName";
+    public static final String GBEAN_ATTR_DFT_CLUSTER_NAME = "defaultClusterName";
+    public static final String GBEAN_ATTR_DFT_NETWORK_CONNECTOR_NAME = "defaultNetworkConnectorName";
+    public static final String GBEAN_ATTR_DFT_ENVIRONMENT = "defaultEnvironment";
+
+    static {
+        GBeanInfoBuilder infoBuilder = GBeanInfoBuilder.createStatic("WADI OpenEJB Clusteting Builder",
+                WADIOpenEJBClusteringBuilder.class,
+                NameFactory.MODULE_BUILDER);
+
+        infoBuilder.addAttribute(GBEAN_ATTR_DFT_CLUSTERED_SFSB_CONT_ID, String.class, true);
+        infoBuilder.addAttribute(GBEAN_ATTR_DFT_SWEEP_INTERVAL, int.class, true);
+        infoBuilder.addAttribute(GBEAN_ATTR_DFT_SESSION_TIMEOUT, int.class, true);
+        infoBuilder.addAttribute(GBEAN_ATTR_DFT_NUM_PARTITIONS, int.class, true);
+        infoBuilder.addAttribute(GBEAN_ATTR_DFT_BACKING_STRATEGY_FACTORY_NAME, AbstractNameQuery.class, true);
+        infoBuilder.addAttribute(GBEAN_ATTR_DFT_CLUSTER_NAME, AbstractNameQuery.class, true);
+        infoBuilder.addAttribute(GBEAN_ATTR_DFT_NETWORK_CONNECTOR_NAME, AbstractNameQuery.class, true);
+        infoBuilder.addAttribute(GBEAN_ATTR_DFT_ENVIRONMENT, Environment.class, true);
+
+        infoBuilder.setConstructor(new String[] { GBEAN_ATTR_DFT_CLUSTERED_SFSB_CONT_ID,
+            GBEAN_ATTR_DFT_SWEEP_INTERVAL,
+            GBEAN_ATTR_DFT_SESSION_TIMEOUT,
+            GBEAN_ATTR_DFT_NUM_PARTITIONS,
+            GBEAN_ATTR_DFT_BACKING_STRATEGY_FACTORY_NAME,
+            GBEAN_ATTR_DFT_CLUSTER_NAME,
+            GBEAN_ATTR_DFT_NETWORK_CONNECTOR_NAME,
+            GBEAN_ATTR_DFT_ENVIRONMENT });
+
+        GBEAN_INFO = infoBuilder.getBeanInfo();
+    }
+
+    public static GBeanInfo getGBeanInfo() {
+        return GBEAN_INFO;
+    }
+
+}

Added: geronimo/server/trunk/plugins/openejb/geronimo-openejb-clustering-builder-wadi/src/main/xsd/geronimo-openejb-clustering-wadi-1.2.xsd
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/openejb/geronimo-openejb-clustering-builder-wadi/src/main/xsd/geronimo-openejb-clustering-wadi-1.2.xsd?rev=630370&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/openejb/geronimo-openejb-clustering-builder-wadi/src/main/xsd/geronimo-openejb-clustering-wadi-1.2.xsd (added)
+++ geronimo/server/trunk/plugins/openejb/geronimo-openejb-clustering-builder-wadi/src/main/xsd/geronimo-openejb-clustering-wadi-1.2.xsd Fri Feb 22 17:02:57 2008
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    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.
+-->
+
+<xs:schema xmlns="http://www.w3.org/2001/XMLSchema"
+    targetNamespace="http://geronimo.apache.org/xml/ns/openejb-clustering-wadi-1.2"
+    xmlns:clust-wadi="http://geronimo.apache.org/xml/ns/openejb-clustering-wadi-1.2"
+    xmlns:naming="http://geronimo.apache.org/xml/ns/naming-1.2"
+    xmlns:app="http://geronimo.apache.org/xml/ns/j2ee/application-2.0"
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    elementFormDefault="qualified"
+    attributeFormDefault="unqualified">
+
+    <xs:import namespace="http://geronimo.apache.org/xml/ns/naming-1.2" schemaLocation="geronimo-naming-1.2.xsd"/>
+    <xs:import namespace="http://geronimo.apache.org/xml/ns/j2ee/application-2.0" schemaLocation="geronimo-application-2.0.xsd"/>
+
+    <xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="http://www.w3.org/2001/xml.xsd"/>
+
+    <xs:element name="openejb-clustering-wadi" type="clust-wadi:openejb-clustering-wadiType" substitutionGroup="app:clustering"/>
+
+    <xs:complexType name="openejb-clustering-wadiType">
+        <xs:complexContent>
+            <xs:extension base="app:abstract-clusteringType">
+                <xs:sequence>
+                    <xs:element name="sweepInterval" type="xs:integer" minOccurs="0"/>
+                    <xs:element name="numPartitions" type="xs:integer" minOccurs="0"/>
+                    <xs:element name="cluster" type="naming:patternType" minOccurs="0"/>
+                    <xs:element name="disableReplication" type="xs:boolean" minOccurs="0"/>
+                    <xs:element name="deltaReplication" type="xs:boolean" minOccurs="0"/>
+                    <xs:element name="backing-strategy-factory" type="naming:patternType" minOccurs="0"/>
+                </xs:sequence>
+            </xs:extension>
+        </xs:complexContent>
+    </xs:complexType>
+
+</xs:schema>
+

Added: geronimo/server/trunk/plugins/openejb/geronimo-openejb-clustering-builder-wadi/src/main/xsdconfig/xmlconfig.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/openejb/geronimo-openejb-clustering-builder-wadi/src/main/xsdconfig/xmlconfig.xml?rev=630370&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/openejb/geronimo-openejb-clustering-builder-wadi/src/main/xsdconfig/xmlconfig.xml (added)
+++ geronimo/server/trunk/plugins/openejb/geronimo-openejb-clustering-builder-wadi/src/main/xsdconfig/xmlconfig.xml Fri Feb 22 17:02:57 2008
@@ -0,0 +1,25 @@
+<!--
+  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.
+-->
+<xb:config xmlns:xb="http://www.bea.com/2002/09/xbean/config"
+    >
+
+    <xb:namespace uri="http://geronimo.apache.org/xml/ns/openejb-clustering-wadi-1.2">
+        <xb:package>org.apache.geronimo.xbeans.geronimo</xb:package>
+        <xb:prefix>Ger</xb:prefix>
+    </xb:namespace>
+
+</xb:config>

Added: geronimo/server/trunk/plugins/openejb/geronimo-openejb-clustering-builder-wadi/src/test/java/org/apache/geronimo/openejb/deployment/cluster/MapSFSBToContainerIDDeployerTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/openejb/geronimo-openejb-clustering-builder-wadi/src/test/java/org/apache/geronimo/openejb/deployment/cluster/MapSFSBToContainerIDDeployerTest.java?rev=630370&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/openejb/geronimo-openejb-clustering-builder-wadi/src/test/java/org/apache/geronimo/openejb/deployment/cluster/MapSFSBToContainerIDDeployerTest.java (added)
+++ geronimo/server/trunk/plugins/openejb/geronimo-openejb-clustering-builder-wadi/src/test/java/org/apache/geronimo/openejb/deployment/cluster/MapSFSBToContainerIDDeployerTest.java Fri Feb 22 17:02:57 2008
@@ -0,0 +1,84 @@
+/*
+ * 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.cluster;
+
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import org.apache.openejb.config.AppModule;
+import org.apache.openejb.config.EjbModule;
+import org.apache.openejb.jee.EjbJar;
+import org.apache.openejb.jee.EntityBean;
+import org.apache.openejb.jee.MessageDrivenBean;
+import org.apache.openejb.jee.StatefulBean;
+import org.apache.openejb.jee.StatelessBean;
+import org.apache.openejb.jee.oejb3.EjbDeployment;
+import org.apache.openejb.jee.oejb3.OpenejbJar;
+
+/**
+ *
+ * @version $Rev:$ $Date:$
+ */
+public class MapSFSBToContainerIDDeployerTest extends TestCase {
+
+    public void testContainerIdAreSetForSFSB() throws Exception {
+        AppModule appModule = new AppModule(getClass().getClassLoader(), "dummy.jar");
+        List<EjbModule> ejbModules = appModule.getEjbModules();
+
+        EjbJar ejbJar = new EjbJar();
+        
+        StatefulBean sfsb = new StatefulBean();
+        String sfsbName = "SFSB";
+        sfsb.setEjbName(sfsbName);
+        ejbJar.addEnterpriseBean(sfsb);
+        
+        StatelessBean slsb = new StatelessBean();
+        String slsbName = "SLSB";
+        slsb.setEjbName(slsbName);
+        ejbJar.addEnterpriseBean(slsb);
+        
+        EntityBean entity = new EntityBean();
+        entity.setEjbName("entity");
+        ejbJar.addEnterpriseBean(entity);
+        
+        MessageDrivenBean mdb = new MessageDrivenBean();
+        mdb.setEjbName("mdb");
+        ejbJar.addEnterpriseBean(mdb);
+        
+        EjbModule ejbModule = new EjbModule(ejbJar);
+
+        OpenejbJar openejbJar = new OpenejbJar();
+        EjbDeployment sfsbDeployment = new EjbDeployment();
+        sfsbDeployment.setEjbName(sfsbName);
+        openejbJar.addEjbDeployment(sfsbDeployment);
+        
+        ejbModule.setOpenejbJar(openejbJar);
+
+        ejbModules.add(ejbModule);
+        
+        String targetContainerId = "targetContainerId";
+        MapSFSBToContainerIDDeployer deployer = new MapSFSBToContainerIDDeployer(targetContainerId);
+        deployer.deploy(appModule);
+        
+        assertEquals(targetContainerId, sfsbDeployment.getContainerId());
+    }
+    
+}

Added: geronimo/server/trunk/plugins/openejb/geronimo-openejb-clustering-wadi/LICENSE.txt
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/openejb/geronimo-openejb-clustering-wadi/LICENSE.txt?rev=630370&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/openejb/geronimo-openejb-clustering-wadi/LICENSE.txt (added)
+++ geronimo/server/trunk/plugins/openejb/geronimo-openejb-clustering-wadi/LICENSE.txt Fri Feb 22 17:02:57 2008
@@ -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/plugins/openejb/geronimo-openejb-clustering-wadi/NOTICE.txt
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/openejb/geronimo-openejb-clustering-wadi/NOTICE.txt?rev=630370&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/openejb/geronimo-openejb-clustering-wadi/NOTICE.txt (added)
+++ geronimo/server/trunk/plugins/openejb/geronimo-openejb-clustering-wadi/NOTICE.txt Fri Feb 22 17:02:57 2008
@@ -0,0 +1,14 @@
+   =========================================================================
+   ==  NOTICE file corresponding to the section 4 d of                    ==
+   ==  the Apache License, Version 2.0,                                   ==
+   ==  in this case for the Apache OpenEJB distribution.                  ==
+   =========================================================================
+
+   Apache Geronimo 
+   Copyright 2003-2007 The Apache Software Foundation
+
+   Apache OpenEJB Project
+   Copyright 1999-2007 The Apache Software Foundation
+
+   This product includes software developed by
+   The Apache Software Foundation (http://www.apache.org/).

Added: geronimo/server/trunk/plugins/openejb/geronimo-openejb-clustering-wadi/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/openejb/geronimo-openejb-clustering-wadi/pom.xml?rev=630370&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/openejb/geronimo-openejb-clustering-wadi/pom.xml (added)
+++ geronimo/server/trunk/plugins/openejb/geronimo-openejb-clustering-wadi/pom.xml Fri Feb 22 17:02:57 2008
@@ -0,0 +1,53 @@
+<?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: 590482 $ $Date: 2007-10-31 08:51:54 +1100 (Wed, 31 Oct 2007) $ -->
+
+<project>
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.geronimo.plugins</groupId>
+        <artifactId>openejb</artifactId>
+        <version>2.2-SNAPSHOT</version>
+    </parent>
+
+    <groupId>org.apache.geronimo.modules</groupId>
+    <artifactId>geronimo-openejb-clustering-wadi</artifactId>
+    <name>Geronimo Plugins, OpenEJB :: Clustering over WADI</name>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.geronimo.modules</groupId>
+            <artifactId>geronimo-clustering-wadi</artifactId>
+            <version>${version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.geronimo.modules</groupId>
+            <artifactId>geronimo-openejb</artifactId>
+            <version>${version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.geronimo.specs</groupId>
+            <artifactId>geronimo-interceptor_3.0_spec</artifactId>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
+</project>

Added: geronimo/server/trunk/plugins/openejb/geronimo-openejb-clustering-wadi/src/Launcher.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/openejb/geronimo-openejb-clustering-wadi/src/Launcher.java?rev=630370&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/openejb/geronimo-openejb-clustering-wadi/src/Launcher.java (added)
+++ geronimo/server/trunk/plugins/openejb/geronimo-openejb-clustering-wadi/src/Launcher.java Fri Feb 22 17:02:57 2008
@@ -0,0 +1,22 @@
+import java.util.Properties;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+
+import org.superbiz.counter.CounterRemote;
+
+
+public class Launcher {
+
+    public static void main(String[] args) throws Exception {
+        Properties properties = new Properties();
+        properties.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.client.RemoteInitialContextFactory");
+        properties.setProperty(Context.PROVIDER_URL, "ejbd://localhost:4201");
+        InitialContext remoteContext = new InitialContext(properties);
+        
+        CounterRemote counterRemote = (CounterRemote) remoteContext.lookup("CounterImplRemote");
+        counterRemote.increment();
+        counterRemote.reset();
+    }
+    
+}