geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From genspr...@apache.org
Subject svn commit: r916085 - in /geronimo/server/branches/2.2/plugins/openejb: geronimo-openejb-clustering-builder-wadi/src/main/java/org/apache/geronimo/openejb/deployment/cluster/ geronimo-openejb-clustering-builder-wadi/src/test/java/org/apache/geronimo/op...
Date Thu, 25 Feb 2010 02:07:07 GMT
Author: genspring
Date: Thu Feb 25 02:07:06 2010
New Revision: 916085

URL: http://svn.apache.org/viewvc?rev=916085&view=rev
Log:
GERONIMO-5059 unicast-based support failover for stateless session bean.

1, Added a clusterdStatelessContainer for SLSB failover.
2, Modified the openejb cluster wadi builder to handle the stateless bean.
3, Reorg the package for easier extensions.

Added:
    geronimo/server/branches/2.2/plugins/openejb/geronimo-openejb-clustering-builder-wadi/src/main/java/org/apache/geronimo/openejb/deployment/cluster/MapSessionBeanToContainerIDDeployer.java
      - copied, changed from r899548, geronimo/server/branches/2.2/plugins/openejb/geronimo-openejb-clustering-builder-wadi/src/main/java/org/apache/geronimo/openejb/deployment/cluster/MapSFSBToContainerIDDeployer.java
    geronimo/server/branches/2.2/plugins/openejb/geronimo-openejb-clustering-builder-wadi/src/test/java/org/apache/geronimo/openejb/deployment/cluster/MapSessionBeanToContainerIDDeployerTest.java
      - copied, changed from r899548, geronimo/server/branches/2.2/plugins/openejb/geronimo-openejb-clustering-builder-wadi/src/test/java/org/apache/geronimo/openejb/deployment/cluster/MapSFSBToContainerIDDeployerTest.java
    geronimo/server/branches/2.2/plugins/openejb/geronimo-openejb-clustering-wadi/src/main/java/org/apache/geronimo/openejb/cluster/container/
    geronimo/server/branches/2.2/plugins/openejb/geronimo-openejb-clustering-wadi/src/main/java/org/apache/geronimo/openejb/cluster/container/stateful/
    geronimo/server/branches/2.2/plugins/openejb/geronimo-openejb-clustering-wadi/src/main/java/org/apache/geronimo/openejb/cluster/container/stateful/ClusteredStatefulContainer.java
      - copied, changed from r899548, geronimo/server/branches/2.2/plugins/openejb/geronimo-openejb-clustering-wadi/src/main/java/org/apache/geronimo/openejb/cluster/stateful/container/ClusteredStatefulContainer.java
    geronimo/server/branches/2.2/plugins/openejb/geronimo-openejb-clustering-wadi/src/main/java/org/apache/geronimo/openejb/cluster/container/stateful/WadiCache.java
      - copied, changed from r899548, geronimo/server/branches/2.2/plugins/openejb/geronimo-openejb-clustering-wadi/src/main/java/org/apache/geronimo/openejb/cluster/stateful/container/WadiCache.java
    geronimo/server/branches/2.2/plugins/openejb/geronimo-openejb-clustering-wadi/src/test/java/org/apache/geronimo/openejb/cluster/container/
    geronimo/server/branches/2.2/plugins/openejb/geronimo-openejb-clustering-wadi/src/test/java/org/apache/geronimo/openejb/cluster/container/stateful/
      - copied from r899548, geronimo/server/branches/2.2/plugins/openejb/geronimo-openejb-clustering-wadi/src/test/java/org/apache/geronimo/openejb/cluster/stateful/container/
    geronimo/server/branches/2.2/plugins/openejb/geronimo-openejb-clustering-wadi/src/test/java/org/apache/geronimo/openejb/cluster/container/stateless/
    geronimo/server/branches/2.2/plugins/openejb/geronimo-openejb-clustering-wadi/src/test/java/org/apache/geronimo/openejb/cluster/container/stateless/ClusteredStatelessContainerTest.java
  (with props)
Removed:
    geronimo/server/branches/2.2/plugins/openejb/geronimo-openejb-clustering-builder-wadi/src/main/java/org/apache/geronimo/openejb/deployment/cluster/MapSFSBToContainerIDDeployer.java
    geronimo/server/branches/2.2/plugins/openejb/geronimo-openejb-clustering-builder-wadi/src/test/java/org/apache/geronimo/openejb/deployment/cluster/MapSFSBToContainerIDDeployerTest.java
    geronimo/server/branches/2.2/plugins/openejb/geronimo-openejb-clustering-wadi/src/main/java/org/apache/geronimo/openejb/cluster/stateful/container/
    geronimo/server/branches/2.2/plugins/openejb/geronimo-openejb-clustering-wadi/src/main/java/org/apache/geronimo/openejb/cluster/stateful/deployment/
    geronimo/server/branches/2.2/plugins/openejb/geronimo-openejb-clustering-wadi/src/test/java/org/apache/geronimo/openejb/cluster/stateful/container/
Modified:
    geronimo/server/branches/2.2/plugins/openejb/geronimo-openejb-clustering-builder-wadi/src/main/java/org/apache/geronimo/openejb/deployment/cluster/WADIOpenEJBClusteringBuilder.java
    geronimo/server/branches/2.2/plugins/openejb/geronimo-openejb-clustering-wadi/src/main/resources/META-INF/org.apache.geronimo.openejb.cluster/service-jar.xml
    geronimo/server/branches/2.2/plugins/openejb/geronimo-openejb-clustering-wadi/src/test/java/org/apache/geronimo/openejb/cluster/container/stateful/ClusteredStatefulContainerTest.java
    geronimo/server/branches/2.2/plugins/openejb/geronimo-openejb-clustering-wadi/src/test/java/org/apache/geronimo/openejb/cluster/container/stateful/WadiCacheTest.java
    geronimo/server/branches/2.2/plugins/openejb/openejb-clustering-builder-wadi/src/main/plan/plan.xml
    geronimo/server/branches/2.2/plugins/openejb/openejb-clustering-wadi/src/main/plan/plan.xml

Copied: geronimo/server/branches/2.2/plugins/openejb/geronimo-openejb-clustering-builder-wadi/src/main/java/org/apache/geronimo/openejb/deployment/cluster/MapSessionBeanToContainerIDDeployer.java
(from r899548, geronimo/server/branches/2.2/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/branches/2.2/plugins/openejb/geronimo-openejb-clustering-builder-wadi/src/main/java/org/apache/geronimo/openejb/deployment/cluster/MapSessionBeanToContainerIDDeployer.java?p2=geronimo/server/branches/2.2/plugins/openejb/geronimo-openejb-clustering-builder-wadi/src/main/java/org/apache/geronimo/openejb/deployment/cluster/MapSessionBeanToContainerIDDeployer.java&p1=geronimo/server/branches/2.2/plugins/openejb/geronimo-openejb-clustering-builder-wadi/src/main/java/org/apache/geronimo/openejb/deployment/cluster/MapSFSBToContainerIDDeployer.java&r1=899548&r2=916085&rev=916085&view=diff
==============================================================================
--- geronimo/server/branches/2.2/plugins/openejb/geronimo-openejb-clustering-builder-wadi/src/main/java/org/apache/geronimo/openejb/deployment/cluster/MapSFSBToContainerIDDeployer.java
(original)
+++ geronimo/server/branches/2.2/plugins/openejb/geronimo-openejb-clustering-builder-wadi/src/main/java/org/apache/geronimo/openejb/deployment/cluster/MapSessionBeanToContainerIDDeployer.java
Thu Feb 25 02:07:06 2010
@@ -25,6 +25,7 @@
 import org.apache.openejb.jee.EjbJar;
 import org.apache.openejb.jee.EnterpriseBean;
 import org.apache.openejb.jee.SessionBean;
+import org.apache.openejb.jee.SessionType;
 import org.apache.openejb.jee.oejb3.EjbDeployment;
 import org.apache.openejb.jee.oejb3.OpenejbJar;
 
@@ -32,15 +33,17 @@
  *
  * @version $Rev:$ $Date:$
  */
-public class MapSFSBToContainerIDDeployer implements DynamicDeployer {
+public class MapSessionBeanToContainerIDDeployer implements DynamicDeployer {
 
     private final String containerId;
+    private final SessionType containerSessionType;
 
-    public MapSFSBToContainerIDDeployer(String containerId) {
+    public MapSessionBeanToContainerIDDeployer(String containerId,SessionType containerSessionType)
{
         if (null == containerId) {
             throw new IllegalArgumentException("containerId is required");
         }
         this.containerId = containerId;
+        this.containerSessionType=containerSessionType;
     }
 
     public AppModule deploy(AppModule appModule) throws OpenEJBException {
@@ -51,13 +54,24 @@
                 if (enterpriseBean instanceof SessionBean) {
                     SessionBean sessionBean = (SessionBean) enterpriseBean;
                     switch (sessionBean.getSessionType()) {
-                        case STATEFUL:
+                    case STATEFUL:
+                        if (this.containerSessionType == SessionType.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);
+                        }
+                    case STATELESS:
+                        if (this.containerSessionType == SessionType.STATELESS) {
+                            String ejbName = sessionBean.getEjbName();
+                            EjbDeployment ejbDeployment = openejbJar.getDeploymentsByEjbName().get(ejbName);
+                            if (null == ejbDeployment) {
+                                throw new OpenEJBException("No ejbDeployment for ejbName
[" + ejbName + "]");
+                            }
+                            ejbDeployment.setContainerId(containerId);
+                        }        
                     }
                 }
             }

Modified: geronimo/server/branches/2.2/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/branches/2.2/plugins/openejb/geronimo-openejb-clustering-builder-wadi/src/main/java/org/apache/geronimo/openejb/deployment/cluster/WADIOpenEJBClusteringBuilder.java?rev=916085&r1=916084&r2=916085&view=diff
==============================================================================
--- geronimo/server/branches/2.2/plugins/openejb/geronimo-openejb-clustering-builder-wadi/src/main/java/org/apache/geronimo/openejb/deployment/cluster/WADIOpenEJBClusteringBuilder.java
(original)
+++ geronimo/server/branches/2.2/plugins/openejb/geronimo-openejb-clustering-builder-wadi/src/main/java/org/apache/geronimo/openejb/deployment/cluster/WADIOpenEJBClusteringBuilder.java
Thu Feb 25 02:07:06 2010
@@ -43,6 +43,8 @@
 import org.apache.geronimo.gbean.GBeanData;
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.gbean.annotation.GBean;
+import org.apache.geronimo.gbean.annotation.ParamAttribute;
 import org.apache.geronimo.j2ee.deployment.EARContext;
 import org.apache.geronimo.j2ee.deployment.Module;
 import org.apache.geronimo.j2ee.deployment.ModuleBuilderExtension;
@@ -53,9 +55,9 @@
 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.deployment.ClusteredDeployment;
 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;
@@ -69,6 +71,7 @@
 import org.apache.openejb.jee.EjbJar;
 import org.apache.openejb.jee.EnterpriseBean;
 import org.apache.openejb.jee.SessionBean;
+import org.apache.openejb.jee.SessionType;
 import org.apache.openejb.jee.oejb2.GeronimoEjbJarType;
 import org.apache.xmlbeans.QNameSet;
 import org.apache.xmlbeans.XmlObject;
@@ -77,6 +80,7 @@
  *
  * @version $Rev:$ $Date:$
  */
+@GBean(j2eeType = NameFactory.MODULE_BUILDER)
 public class WADIOpenEJBClusteringBuilder implements ModuleBuilderExtension {
     private static final QName BASE_CLUSTERING_QNAME = GerClusteringDocument.type.getDocumentElementName();
     private static final QName CLUSTERING_WADI_QNAME = GerOpenejbClusteringWadiDocument.type.getDocumentElementName();
@@ -89,6 +93,8 @@
     }
 
     private final String defaultClusteredStatefulContainerId;
+    private final String defaultClusteredStatelessContainerId;
+    
     private final EjbDeploymentGBeanNameBuilder beanNameBuilder;
     private final int defaultSweepInterval;
     private final int defaultSessionTimeout;
@@ -97,17 +103,22 @@
     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) {
+    public WADIOpenEJBClusteringBuilder(
+            @ParamAttribute(name = "defaultClusteredStatefulContainerId") String defaultClusteredStatefulContainerId,
+            @ParamAttribute(name = "defaultClusteredStatelessContainerId") String defaultClusteredStatelessContainerId,
+            @ParamAttribute(name = "defaultSweepInterval") int defaultSweepInterval,
+            @ParamAttribute(name = "defaultSessionTimeout") int defaultSessionTimeout,
+            @ParamAttribute(name = "defaultNumPartitions") int defaultNumPartitions,
+            @ParamAttribute(name = "defaultBackingStrategyFactoryName") AbstractNameQuery
defaultBackingStrategyFactoryName, 
+            @ParamAttribute(name = "defaultClusterName") AbstractNameQuery defaultClusterName,
+            @ParamAttribute(name = "defaultNetworkConnectorName") AbstractNameQuery defaultNetworkConnectorName,
+            @ParamAttribute(name = "defaultEnvironment") Environment defaultEnvironment)
{
         if (null == defaultClusteredStatefulContainerId) {
             throw new IllegalArgumentException("defaultClusteredStatefulContainerId is required");
+        } else if (null == defaultClusteredStatelessContainerId) {
+            throw new IllegalArgumentException("defaultClusteredStatelessContainerId is required");
         } else if (defaultSweepInterval < 1) {
             throw new IllegalArgumentException("defaultSweepInterval is lower than 1");
         } else if (defaultSessionTimeout < 1) {
@@ -124,6 +135,7 @@
             throw new IllegalArgumentException("defaultNetworkConnectorName is required");
         }
         this.defaultClusteredStatefulContainerId = defaultClusteredStatefulContainerId;
+        this.defaultClusteredStatelessContainerId = defaultClusteredStatelessContainerId;
         this.defaultSweepInterval = defaultSweepInterval;
         this.defaultSessionTimeout = defaultSessionTimeout;
         this.defaultNumPartitions = defaultNumPartitions;
@@ -170,16 +182,13 @@
 
             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);
-                    }
+
+                    replaceByClusteredDeploymentGBean(earContext, ejbModule, sessionManagerName,
enterpriseBean);
+
                 }
+
             }
         }
     }
@@ -197,14 +206,15 @@
             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);
+        clusteredDeploymentGBean.setGBeanInfo(ClusteredDeployment.GBEAN_INFO);
+        clusteredDeploymentGBean.setReferencePattern(ClusteredDeployment.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,
@@ -226,7 +236,8 @@
 
         EnvironmentBuilder.mergeEnvironments(environment, defaultEnvironment);
 
-        ejbModule.getPreAutoConfigDeployer().add(new MapSFSBToContainerIDDeployer(defaultClusteredStatefulContainerId));
+        ejbModule.getPreAutoConfigDeployer().add(new MapSessionBeanToContainerIDDeployer(defaultClusteredStatefulContainerId,SessionType.STATEFUL));
+        ejbModule.getPreAutoConfigDeployer().add(new MapSessionBeanToContainerIDDeployer(defaultClusteredStatelessContainerId,SessionType.STATELESS));
     }
 
     public void initContext(EARContext earContext, Module module, ClassLoader cl) throws
DeploymentException {
@@ -275,7 +286,7 @@
         networkConnectorMonitor.setReferencePattern(NetworkConnectorMonitor.GBEAN_REF_NETWORK_CONNECTORS,
             defaultNetworkConnectorName);
         networkConnectorMonitor.setReferencePattern(NetworkConnectorMonitor.GBEAN_REF_EJB_DEP_ID_ACCESSOR,
-            new AbstractNameQuery(ClusteredStatefulDeployment.class.getName()));
+            new AbstractNameQuery(ClusteredDeployment.class.getName()));
         networkConnectorMonitor.setReferencePattern(NetworkConnectorMonitor.GBEAN_REF_WADI_SESSION_MANAGER,
             sessionManagerName);
         
@@ -390,45 +401,5 @@
         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;
-    }
-
+   
 }

Copied: geronimo/server/branches/2.2/plugins/openejb/geronimo-openejb-clustering-builder-wadi/src/test/java/org/apache/geronimo/openejb/deployment/cluster/MapSessionBeanToContainerIDDeployerTest.java
(from r899548, geronimo/server/branches/2.2/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/branches/2.2/plugins/openejb/geronimo-openejb-clustering-builder-wadi/src/test/java/org/apache/geronimo/openejb/deployment/cluster/MapSessionBeanToContainerIDDeployerTest.java?p2=geronimo/server/branches/2.2/plugins/openejb/geronimo-openejb-clustering-builder-wadi/src/test/java/org/apache/geronimo/openejb/deployment/cluster/MapSessionBeanToContainerIDDeployerTest.java&p1=geronimo/server/branches/2.2/plugins/openejb/geronimo-openejb-clustering-builder-wadi/src/test/java/org/apache/geronimo/openejb/deployment/cluster/MapSFSBToContainerIDDeployerTest.java&r1=899548&r2=916085&rev=916085&view=diff
==============================================================================
--- geronimo/server/branches/2.2/plugins/openejb/geronimo-openejb-clustering-builder-wadi/src/test/java/org/apache/geronimo/openejb/deployment/cluster/MapSFSBToContainerIDDeployerTest.java
(original)
+++ geronimo/server/branches/2.2/plugins/openejb/geronimo-openejb-clustering-builder-wadi/src/test/java/org/apache/geronimo/openejb/deployment/cluster/MapSessionBeanToContainerIDDeployerTest.java
Thu Feb 25 02:07:06 2010
@@ -28,6 +28,7 @@
 import org.apache.openejb.jee.EjbJar;
 import org.apache.openejb.jee.EntityBean;
 import org.apache.openejb.jee.MessageDrivenBean;
+import org.apache.openejb.jee.SessionType;
 import org.apache.openejb.jee.StatefulBean;
 import org.apache.openejb.jee.StatelessBean;
 import org.apache.openejb.jee.oejb3.EjbDeployment;
@@ -37,7 +38,7 @@
  *
  * @version $Rev:$ $Date:$
  */
-public class MapSFSBToContainerIDDeployerTest extends TestCase {
+public class MapSessionBeanToContainerIDDeployerTest extends TestCase {
 
     public void testContainerIdAreSetForSFSB() throws Exception {
         AppModule appModule = new AppModule(getClass().getClassLoader(), "dummy.jar");
@@ -75,7 +76,7 @@
         ejbModules.add(ejbModule);
         
         String targetContainerId = "targetContainerId";
-        MapSFSBToContainerIDDeployer deployer = new MapSFSBToContainerIDDeployer(targetContainerId);
+        MapSessionBeanToContainerIDDeployer deployer = new MapSessionBeanToContainerIDDeployer(targetContainerId,SessionType.STATEFUL);
         deployer.deploy(appModule);
         
         assertEquals(targetContainerId, sfsbDeployment.getContainerId());

Copied: geronimo/server/branches/2.2/plugins/openejb/geronimo-openejb-clustering-wadi/src/main/java/org/apache/geronimo/openejb/cluster/container/stateful/ClusteredStatefulContainer.java
(from r899548, geronimo/server/branches/2.2/plugins/openejb/geronimo-openejb-clustering-wadi/src/main/java/org/apache/geronimo/openejb/cluster/stateful/container/ClusteredStatefulContainer.java)
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.2/plugins/openejb/geronimo-openejb-clustering-wadi/src/main/java/org/apache/geronimo/openejb/cluster/container/stateful/ClusteredStatefulContainer.java?p2=geronimo/server/branches/2.2/plugins/openejb/geronimo-openejb-clustering-wadi/src/main/java/org/apache/geronimo/openejb/cluster/container/stateful/ClusteredStatefulContainer.java&p1=geronimo/server/branches/2.2/plugins/openejb/geronimo-openejb-clustering-wadi/src/main/java/org/apache/geronimo/openejb/cluster/stateful/container/ClusteredStatefulContainer.java&r1=899548&r2=916085&rev=916085&view=diff
==============================================================================
--- geronimo/server/branches/2.2/plugins/openejb/geronimo-openejb-clustering-wadi/src/main/java/org/apache/geronimo/openejb/cluster/stateful/container/ClusteredStatefulContainer.java
(original)
+++ geronimo/server/branches/2.2/plugins/openejb/geronimo-openejb-clustering-wadi/src/main/java/org/apache/geronimo/openejb/cluster/container/stateful/ClusteredStatefulContainer.java
Thu Feb 25 02:07:06 2010
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-package org.apache.geronimo.openejb.cluster.stateful.container;
+package org.apache.geronimo.openejb.cluster.container.stateful;
 
 import java.net.URI;
 import java.util.HashMap;

Copied: geronimo/server/branches/2.2/plugins/openejb/geronimo-openejb-clustering-wadi/src/main/java/org/apache/geronimo/openejb/cluster/container/stateful/WadiCache.java
(from r899548, geronimo/server/branches/2.2/plugins/openejb/geronimo-openejb-clustering-wadi/src/main/java/org/apache/geronimo/openejb/cluster/stateful/container/WadiCache.java)
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.2/plugins/openejb/geronimo-openejb-clustering-wadi/src/main/java/org/apache/geronimo/openejb/cluster/container/stateful/WadiCache.java?p2=geronimo/server/branches/2.2/plugins/openejb/geronimo-openejb-clustering-wadi/src/main/java/org/apache/geronimo/openejb/cluster/container/stateful/WadiCache.java&p1=geronimo/server/branches/2.2/plugins/openejb/geronimo-openejb-clustering-wadi/src/main/java/org/apache/geronimo/openejb/cluster/stateful/container/WadiCache.java&r1=899548&r2=916085&rev=916085&view=diff
==============================================================================
--- geronimo/server/branches/2.2/plugins/openejb/geronimo-openejb-clustering-wadi/src/main/java/org/apache/geronimo/openejb/cluster/stateful/container/WadiCache.java
(original)
+++ geronimo/server/branches/2.2/plugins/openejb/geronimo-openejb-clustering-wadi/src/main/java/org/apache/geronimo/openejb/cluster/container/stateful/WadiCache.java
Thu Feb 25 02:07:06 2010
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-package org.apache.geronimo.openejb.cluster.stateful.container;
+package org.apache.geronimo.openejb.cluster.container.stateful;
 
 import java.rmi.dgc.VMID;
 import java.util.Iterator;
@@ -122,6 +122,11 @@
             }
 
             wadiInstance.lock.lock();
+            
+            if(wadiInstance.getState()==null){
+                wadiInstance.setState(WadiInstanceState.AVAILABLE);
+            }
+            
             try {
                 // verfiy state
                 switch (wadiInstance.getState()) {
@@ -161,6 +166,11 @@
         }
 
         wadiInstance.lock.lock();
+        
+        if(wadiInstance.getState()==null){
+            wadiInstance.setState(WadiInstanceState.CHECKED_OUT);
+        }
+        
         try {
             // verfiy state
             switch (wadiInstance.getState()) {

Modified: geronimo/server/branches/2.2/plugins/openejb/geronimo-openejb-clustering-wadi/src/main/resources/META-INF/org.apache.geronimo.openejb.cluster/service-jar.xml
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.2/plugins/openejb/geronimo-openejb-clustering-wadi/src/main/resources/META-INF/org.apache.geronimo.openejb.cluster/service-jar.xml?rev=916085&r1=916084&r2=916085&view=diff
==============================================================================
--- geronimo/server/branches/2.2/plugins/openejb/geronimo-openejb-clustering-wadi/src/main/resources/META-INF/org.apache.geronimo.openejb.cluster/service-jar.xml
(original)
+++ geronimo/server/branches/2.2/plugins/openejb/geronimo-openejb-clustering-wadi/src/main/resources/META-INF/org.apache.geronimo.openejb.cluster/service-jar.xml
Thu Feb 25 02:07:06 2010
@@ -31,7 +31,48 @@
           service="Container"
           types="STATEFUL"
           constructor="id, securityService"
-          class-name="org.apache.geronimo.openejb.cluster.stateful.container.ClusteredStatefulContainer">
+          class-name="org.apache.geronimo.openejb.cluster.container.stateful.ClusteredStatefulContainer">
+
+  </ServiceProvider>
+  
+  <!--
+  # ==========================================================
+  # Default Clustered Stateless Container
+  # ==========================================================
+  -->
+  <ServiceProvider
+          id="Default Clustered Stateless Container"
+          service="Container"
+          types="STATELESS"
+          constructor="id, securityService, TimeOut, PoolSize, StrictPooling"
+          class-name="org.apache.geronimo.openejb.cluster.container.stateless.ClusteredStatelessContainer">
+
+    # Specifies the time to wait between invocations. This
+    # value is measured in milliseconds. A value of 5 would
+    # result in a time-out of 5 milliseconds between invocations.
+    # A value of zero would mean no timeout.
+
+    TimeOut 0
+
+    # Specifies the size of the bean pools for this
+    # stateless SessionBean container.
+
+    PoolSize 10
+
+    # StrictPooling tells the container what to do when the pool
+    # reaches it's maximum size and there are incoming requests
+    # that need instances.
+    #
+    # With strict pooling, requests will have to wait for instances
+    # to become available. The pool size will never grow beyond the
+    # the set PoolSize value.
+    #
+    # Without strict pooling, the container will create temporary
+    # instances to meet demand. The instances will last for just one
+    # method invocation and then are removed.
+
+    StrictPooling true
+
 
   </ServiceProvider>
 

Modified: geronimo/server/branches/2.2/plugins/openejb/geronimo-openejb-clustering-wadi/src/test/java/org/apache/geronimo/openejb/cluster/container/stateful/ClusteredStatefulContainerTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.2/plugins/openejb/geronimo-openejb-clustering-wadi/src/test/java/org/apache/geronimo/openejb/cluster/container/stateful/ClusteredStatefulContainerTest.java?rev=916085&r1=899548&r2=916085&view=diff
==============================================================================
--- geronimo/server/branches/2.2/plugins/openejb/geronimo-openejb-clustering-wadi/src/test/java/org/apache/geronimo/openejb/cluster/container/stateful/ClusteredStatefulContainerTest.java
(original)
+++ geronimo/server/branches/2.2/plugins/openejb/geronimo-openejb-clustering-wadi/src/test/java/org/apache/geronimo/openejb/cluster/container/stateful/ClusteredStatefulContainerTest.java
Thu Feb 25 02:07:06 2010
@@ -16,12 +16,13 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.geronimo.openejb.cluster.stateful.container;
+package org.apache.geronimo.openejb.cluster.container.stateful;
 
 import java.net.URI;
 import java.util.Collections;
 
 import org.apache.geronimo.clustering.wadi.WADISessionManager;
+import org.apache.geronimo.openejb.cluster.container.stateful.ClusteredStatefulContainer;
 import org.apache.geronimo.openejb.cluster.infra.NetworkConnectorTracker;
 import org.apache.openejb.core.CoreDeploymentInfo;
 import org.apache.openejb.core.DeploymentContext;

Modified: geronimo/server/branches/2.2/plugins/openejb/geronimo-openejb-clustering-wadi/src/test/java/org/apache/geronimo/openejb/cluster/container/stateful/WadiCacheTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.2/plugins/openejb/geronimo-openejb-clustering-wadi/src/test/java/org/apache/geronimo/openejb/cluster/container/stateful/WadiCacheTest.java?rev=916085&r1=899548&r2=916085&view=diff
==============================================================================
--- geronimo/server/branches/2.2/plugins/openejb/geronimo-openejb-clustering-wadi/src/test/java/org/apache/geronimo/openejb/cluster/container/stateful/WadiCacheTest.java
(original)
+++ geronimo/server/branches/2.2/plugins/openejb/geronimo-openejb-clustering-wadi/src/test/java/org/apache/geronimo/openejb/cluster/container/stateful/WadiCacheTest.java
Thu Feb 25 02:07:06 2010
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.geronimo.openejb.cluster.stateful.container;
+package org.apache.geronimo.openejb.cluster.container.stateful;
 
 import java.io.IOException;
 import java.rmi.dgc.VMID;
@@ -34,7 +34,8 @@
 import org.apache.geronimo.clustering.Session;
 import org.apache.geronimo.clustering.SessionListener;
 import org.apache.geronimo.clustering.wadi.WADISessionManager;
-import org.apache.geronimo.openejb.cluster.stateful.container.ClusteredStatefulContainerTest.SFSB;
+import org.apache.geronimo.openejb.cluster.container.stateful.WadiCache;
+import org.apache.geronimo.openejb.cluster.container.stateful.ClusteredStatefulContainerTest.SFSB;
 import org.apache.openejb.core.CoreDeploymentInfo;
 import org.apache.openejb.core.DeploymentContext;
 import org.apache.openejb.core.ThreadContext;

Added: geronimo/server/branches/2.2/plugins/openejb/geronimo-openejb-clustering-wadi/src/test/java/org/apache/geronimo/openejb/cluster/container/stateless/ClusteredStatelessContainerTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.2/plugins/openejb/geronimo-openejb-clustering-wadi/src/test/java/org/apache/geronimo/openejb/cluster/container/stateless/ClusteredStatelessContainerTest.java?rev=916085&view=auto
==============================================================================
--- geronimo/server/branches/2.2/plugins/openejb/geronimo-openejb-clustering-wadi/src/test/java/org/apache/geronimo/openejb/cluster/container/stateless/ClusteredStatelessContainerTest.java
(added)
+++ geronimo/server/branches/2.2/plugins/openejb/geronimo-openejb-clustering-wadi/src/test/java/org/apache/geronimo/openejb/cluster/container/stateless/ClusteredStatelessContainerTest.java
Thu Feb 25 02:07:06 2010
@@ -0,0 +1,111 @@
+/*
+ * 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.cluster.container.stateless;
+
+import java.net.URI;
+import java.util.Collections;
+
+import org.apache.geronimo.clustering.wadi.WADISessionManager;
+import org.apache.geronimo.openejb.cluster.infra.NetworkConnectorTracker;
+import org.apache.openejb.core.CoreDeploymentInfo;
+import org.apache.openejb.core.DeploymentContext;
+import org.apache.openejb.spi.SecurityService;
+import org.codehaus.wadi.servicespace.ServiceRegistry;
+import org.codehaus.wadi.servicespace.ServiceSpace;
+
+import com.agical.rmock.extension.junit.RMockTestCase;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ClusteredStatelessContainerTest extends RMockTestCase {
+
+    private WADISessionManager sessionManager;
+    private ClusteredStatelessContainer container;
+    private CoreDeploymentInfo deploymentInfo;
+    private String deploymentId;
+    private NetworkConnectorTracker tracker;
+
+    @Override
+    protected void setUp() throws Exception {
+        sessionManager = (WADISessionManager) mock(WADISessionManager.class);
+        sessionManager.getManager();
+        modify().multiplicity(expect.from(0));
+        
+        sessionManager.registerListener(null);
+        modify().multiplicity(expect.from(0)).args(is.NOT_NULL);
+        
+        ServiceSpace serviceSpace = sessionManager.getServiceSpace();
+        modify().multiplicity(expect.from(0));
+        ServiceRegistry serviceRegistry = serviceSpace.getServiceRegistry();
+        modify().multiplicity(expect.from(0));
+        serviceRegistry.getStartedService(NetworkConnectorTracker.NAME);
+        modify().multiplicity(expect.from(0));
+        tracker = (NetworkConnectorTracker) mock(NetworkConnectorTracker.class);
+        modify().returnValue(tracker);
+
+        SecurityService securityService = (SecurityService) mock(SecurityService.class);
+        container = (ClusteredStatelessContainer) intercept(ClusteredStatelessContainer.class,
new Object[] {"id",
+                securityService,500,10,true});
+        deploymentId = "deploymentId";
+        deploymentInfo = new CoreDeploymentInfo(new DeploymentContext(deploymentId, null,
null),
+            SFSB.class,
+            null,
+            null,
+            null,
+            null,
+            null,
+            null,
+            null,
+            null,
+            null) {
+            @Override
+            public Object getDeploymentID() {
+                return deploymentId;
+            }
+        };
+    }
+    
+    
+    public void testGetLocationsRetunsNullWhenDeploymentIsNotRegistered() throws Exception
{
+        startVerification();
+        
+        assertNull(container.getLocations(deploymentInfo));
+    }
+    
+    public void testGetLocationsOK() throws Exception {
+        tracker.getConnectorURIs(deploymentId);
+        URI location = new URI("ejbd://host:1");
+        modify().returnValue(Collections.singleton(location));
+        
+        startVerification();
+        
+        container.addSessionManager(deploymentId, sessionManager);
+        
+        URI[] actualLocations = container.getLocations(deploymentInfo);
+        assertEquals(1, actualLocations.length);
+        assertSame(location, actualLocations[0]);
+    }
+    
+    public static class SFSB implements Runnable {
+        public void run() {
+        }
+    }
+    
+}

Propchange: geronimo/server/branches/2.2/plugins/openejb/geronimo-openejb-clustering-wadi/src/test/java/org/apache/geronimo/openejb/cluster/container/stateless/ClusteredStatelessContainerTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: geronimo/server/branches/2.2/plugins/openejb/openejb-clustering-builder-wadi/src/main/plan/plan.xml
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.2/plugins/openejb/openejb-clustering-builder-wadi/src/main/plan/plan.xml?rev=916085&r1=916084&r2=916085&view=diff
==============================================================================
--- geronimo/server/branches/2.2/plugins/openejb/openejb-clustering-builder-wadi/src/main/plan/plan.xml
(original)
+++ geronimo/server/branches/2.2/plugins/openejb/openejb-clustering-builder-wadi/src/main/plan/plan.xml
Thu Feb 25 02:07:06 2010
@@ -22,6 +22,7 @@
 
     <gbean name="OpenEJBClusteringBuilder" class="org.apache.geronimo.openejb.deployment.cluster.WADIOpenEJBClusteringBuilder">
         <attribute name="defaultClusteredStatefulContainerId">DefaultClusteredStatefulContainer</attribute>
+        <attribute name="defaultClusteredStatelessContainerId">DefaultClusteredStatelessContainer</attribute>
         <attribute name="defaultSweepInterval">10</attribute>
         <attribute name="defaultSessionTimeout">3600</attribute>
         <attribute name="defaultNumPartitions">24</attribute>

Modified: geronimo/server/branches/2.2/plugins/openejb/openejb-clustering-wadi/src/main/plan/plan.xml
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.2/plugins/openejb/openejb-clustering-wadi/src/main/plan/plan.xml?rev=916085&r1=916084&r2=916085&view=diff
==============================================================================
--- geronimo/server/branches/2.2/plugins/openejb/openejb-clustering-wadi/src/main/plan/plan.xml
(original)
+++ geronimo/server/branches/2.2/plugins/openejb/openejb-clustering-wadi/src/main/plan/plan.xml
Thu Feb 25 02:07:06 2010
@@ -26,5 +26,12 @@
             <name>OpenEjbSystem</name>
         </reference>
     </gbean>
+    
+    <gbean name="DefaultClusteredStatelessContainer" class="org.apache.geronimo.openejb.StatelessContainerGBean">
+        <attribute name="provider">org.apache.geronimo.openejb.cluster:Default Clustered
Stateless Container</attribute>
+        <reference name="OpenEjbSystem">
+            <name>OpenEjbSystem</name>
+        </reference>
+    </gbean>
 
 </module>



Mime
View raw message