geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From genspr...@apache.org
Subject svn commit: r916086 - in /geronimo/server/branches/2.2/plugins/openejb/geronimo-openejb-clustering-wadi/src/main/java/org/apache/geronimo/openejb/cluster: container/stateless/ deployment/
Date Thu, 25 Feb 2010 02:12:59 GMT
Author: genspring
Date: Thu Feb 25 02:12:59 2010
New Revision: 916086

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

Added:
    geronimo/server/branches/2.2/plugins/openejb/geronimo-openejb-clustering-wadi/src/main/java/org/apache/geronimo/openejb/cluster/container/stateless/
    geronimo/server/branches/2.2/plugins/openejb/geronimo-openejb-clustering-wadi/src/main/java/org/apache/geronimo/openejb/cluster/container/stateless/ClusteredStatelessContainer.java
  (with props)
    geronimo/server/branches/2.2/plugins/openejb/geronimo-openejb-clustering-wadi/src/main/java/org/apache/geronimo/openejb/cluster/deployment/
    geronimo/server/branches/2.2/plugins/openejb/geronimo-openejb-clustering-wadi/src/main/java/org/apache/geronimo/openejb/cluster/deployment/ClusteredDeployment.java
  (with props)

Added: geronimo/server/branches/2.2/plugins/openejb/geronimo-openejb-clustering-wadi/src/main/java/org/apache/geronimo/openejb/cluster/container/stateless/ClusteredStatelessContainer.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/stateless/ClusteredStatelessContainer.java?rev=916086&view=auto
==============================================================================
--- geronimo/server/branches/2.2/plugins/openejb/geronimo-openejb-clustering-wadi/src/main/java/org/apache/geronimo/openejb/cluster/container/stateless/ClusteredStatelessContainer.java
(added)
+++ geronimo/server/branches/2.2/plugins/openejb/geronimo-openejb-clustering-wadi/src/main/java/org/apache/geronimo/openejb/cluster/container/stateless/ClusteredStatelessContainer.java
Thu Feb 25 02:12:59 2010
@@ -0,0 +1,107 @@
+/*
+ * 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.Map;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.apache.geronimo.clustering.SessionManager;
+import org.apache.geronimo.clustering.wadi.WADISessionManager;
+import org.apache.geronimo.openejb.cluster.infra.NetworkConnectorTracker;
+import org.apache.geronimo.openejb.cluster.infra.NetworkConnectorTrackerException;
+import org.apache.geronimo.openejb.cluster.infra.SessionManagerTracker;
+import org.apache.openejb.ClusteredRPCContainer;
+import org.apache.openejb.DeploymentInfo;
+import org.apache.openejb.OpenEJBException;
+import org.apache.openejb.core.stateless.StatelessContainer;
+import org.apache.openejb.spi.SecurityService;
+import org.codehaus.wadi.core.manager.Manager;
+import org.codehaus.wadi.servicespace.ServiceRegistry;
+import org.codehaus.wadi.servicespace.ServiceSpace;
+
+/**
+ *
+ * @version $Rev:$ $Date:$
+ */
+// todo Consider replacing this class with an RpcContainerWrapper subclass
+public class ClusteredStatelessContainer extends StatelessContainer implements SessionManagerTracker,
ClusteredRPCContainer {
+    private final Map<Object, Manager> deploymentIdToManager;
+    private final Map<Object, NetworkConnectorTracker> deploymentIdToNetworkConnectorTracker;
+
+    public ClusteredStatelessContainer(Object id, SecurityService securityService, int timeOut,
int poolSize, boolean strictPooling) throws OpenEJBException {
+        super(id, securityService, timeOut, poolSize, strictPooling);
+
+        deploymentIdToManager = new ConcurrentHashMap<Object, Manager>();
+        deploymentIdToNetworkConnectorTracker = new ConcurrentHashMap<Object, NetworkConnectorTracker>();
+    }
+
+    public void addSessionManager(Object deploymentId, SessionManager sessionManager) {
+      
+        
+        WADISessionManager wadiSessionManager = (WADISessionManager) sessionManager;
+        
+        Manager manager = wadiSessionManager.getManager();
+
+        deploymentIdToManager.put(deploymentId, manager);
+  
+
+        ServiceSpace serviceSpace = wadiSessionManager.getServiceSpace();
+        ServiceRegistry serviceRegistry = serviceSpace.getServiceRegistry();
+        NetworkConnectorTracker networkConnectorTracker;
+        try {
+            networkConnectorTracker = (NetworkConnectorTracker) serviceRegistry.getStartedService(NetworkConnectorTracker.NAME);
+        } catch (Exception e) {
+            throw new IllegalStateException("Should never occur" ,e);
+        }
+
+        deploymentIdToNetworkConnectorTracker.put(deploymentId, networkConnectorTracker);
  
+
+    }
+
+    public void removeSessionManager(Object deploymentId, SessionManager sessionManager)
{
+              
+        deploymentIdToManager.remove(deploymentId);
+
+        deploymentIdToNetworkConnectorTracker.remove(deploymentId);
+
+    }
+    
+    public URI[] getLocations(DeploymentInfo deploymentInfo) {
+        Object deploymentID = deploymentInfo.getDeploymentID();
+        NetworkConnectorTracker networkConnectorTracker;
+
+        networkConnectorTracker = deploymentIdToNetworkConnectorTracker.get(deploymentID);
+
+        if (null == networkConnectorTracker) {
+            return null;
+        }
+
+        Set<URI> connectorURIs;
+        try {
+            connectorURIs = networkConnectorTracker.getConnectorURIs(deploymentID);
+        } catch (NetworkConnectorTrackerException e) {
+            return null;
+        }
+        return connectorURIs.toArray(new URI[connectorURIs.size()]);
+    }
+
+}

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

Added: geronimo/server/branches/2.2/plugins/openejb/geronimo-openejb-clustering-wadi/src/main/java/org/apache/geronimo/openejb/cluster/deployment/ClusteredDeployment.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/deployment/ClusteredDeployment.java?rev=916086&view=auto
==============================================================================
--- geronimo/server/branches/2.2/plugins/openejb/geronimo-openejb-clustering-wadi/src/main/java/org/apache/geronimo/openejb/cluster/deployment/ClusteredDeployment.java
(added)
+++ geronimo/server/branches/2.2/plugins/openejb/geronimo-openejb-clustering-wadi/src/main/java/org/apache/geronimo/openejb/cluster/deployment/ClusteredDeployment.java
Thu Feb 25 02:12:59 2010
@@ -0,0 +1,229 @@
+/*
+ * 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.deployment;
+
+import java.util.Map;
+import java.util.Set;
+
+import javax.naming.Context;
+import javax.security.auth.login.LoginException;
+
+import org.apache.geronimo.clustering.SessionManager;
+import org.apache.geronimo.connector.outbound.connectiontracking.TrackedConnectionAssociator;
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
+import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.naming.enc.EnterpriseNamingContext;
+import org.apache.geronimo.openejb.EjbDeployment;
+import org.apache.geronimo.openejb.EjbDeploymentGBean;
+import org.apache.geronimo.openejb.OpenEjbSystem;
+import org.apache.geronimo.openejb.cluster.infra.SessionManagerTracker;
+import org.apache.geronimo.security.jacc.RunAsSource;
+import org.apache.geronimo.transaction.manager.GeronimoTransactionManager;
+import org.apache.openejb.Container;
+import org.apache.openejb.core.CoreDeploymentInfo;
+
+/**
+ *
+ * @version $Rev:$ $Date:$
+ */
+public class ClusteredDeployment extends EjbDeployment {
+
+    private final SessionManager sessionManager;
+
+    public ClusteredDeployment() throws LoginException {
+        sessionManager = null;
+    }
+
+    public ClusteredDeployment(String objectName,
+        String deploymentId,
+        String ejbName,
+        String homeInterfaceName,
+        String remoteInterfaceName,
+        String localHomeInterfaceName,
+        String localInterfaceName,
+        String serviceEndpointInterfaceName,
+        String beanClassName,
+        ClassLoader classLoader,
+        boolean securityEnabled,
+        String defaultRole,
+        String runAsRole,
+        RunAsSource runAsSource,
+        Map componentContext,
+        Set unshareableResources,
+        Set applicationManagedSecurityResources,
+        TrackedConnectionAssociator trackedConnectionAssociator,
+        GeronimoTransactionManager transactionManager,
+        OpenEjbSystem openEjbSystem,
+        SessionManager sessionManager,
+        Kernel kernel) throws Exception {
+        this(objectName,
+            deploymentId,
+            ejbName,
+            homeInterfaceName,
+            remoteInterfaceName,
+            localHomeInterfaceName,
+            localInterfaceName,
+            serviceEndpointInterfaceName,
+            beanClassName,
+            classLoader,
+            securityEnabled,
+            defaultRole,
+            runAsRole,
+            runAsSource,
+            EnterpriseNamingContext.createEnterpriseNamingContext(componentContext,
+                transactionManager,
+                kernel,
+                classLoader),
+            unshareableResources,
+            applicationManagedSecurityResources,
+            trackedConnectionAssociator,
+            openEjbSystem,
+            sessionManager);
+    }
+    
+    public ClusteredDeployment(String objectName,
+        String deploymentId,
+        String ejbName,
+        String homeInterfaceName,
+        String remoteInterfaceName,
+        String localHomeInterfaceName,
+        String localInterfaceName,
+        String serviceEndpointInterfaceName,
+        String beanClassName,
+        ClassLoader classLoader,
+        boolean securityEnabled,
+        String defaultRole,
+        String runAsRole,
+        RunAsSource runAsSource,
+        Context componentContext,
+        Set unshareableResources,
+        Set applicationManagedSecurityResources,
+        TrackedConnectionAssociator trackedConnectionAssociator,
+        OpenEjbSystem openEjbSystem,
+        SessionManager sessionManager) throws LoginException {
+        super(objectName,
+            deploymentId,
+            ejbName,
+            homeInterfaceName,
+            remoteInterfaceName,
+            localHomeInterfaceName,
+            localInterfaceName,
+            serviceEndpointInterfaceName,
+            beanClassName,
+            classLoader,
+            securityEnabled,
+            defaultRole,
+            runAsRole,
+            runAsSource,
+            componentContext,
+            unshareableResources,
+            applicationManagedSecurityResources,
+            trackedConnectionAssociator,
+            openEjbSystem);
+        if (null == sessionManager) {
+            throw new IllegalArgumentException("sessionManager is required");
+        }
+        this.sessionManager = sessionManager;
+    }
+
+    @Override
+    protected EjbDeployment initialize(CoreDeploymentInfo deploymentInfo) {
+        super.initialize(deploymentInfo);
+
+        Container container = deploymentInfo.getContainer();
+        if (null == container) {
+            throw new IllegalStateException("Container not assigned to deployment " + deploymentId);
+        }
+        if (!(container instanceof SessionManagerTracker)) {
+            throw new IllegalStateException("Container for deployment [" + deploymentId +
"] is not a ["
+                    + SessionManagerTracker.class.getName() + "]. It is a [" + container.getClass().getName()
+ "]");
+        }
+        SessionManagerTracker sessionManagerTracker = (SessionManagerTracker) container;
+        sessionManagerTracker.addSessionManager(deploymentId, sessionManager);
+
+        return this;
+    }
+
+    @Override
+    protected void destroy() {
+        CoreDeploymentInfo info = deploymentInfo.get();
+        if (null != info) {
+            Container container = info.getContainer();
+            if (null != container) {
+                SessionManagerTracker sessionManagerTracker = (SessionManagerTracker) container;
+                sessionManagerTracker.removeSessionManager(deploymentId, sessionManager);
+            }
+        }
+
+        super.destroy();
+    }
+
+    public static final GBeanInfo GBEAN_INFO;
+
+    public static final String GBEAN_REF_SESSION_MANAGER = "SessionManager";
+
+    static {
+        GBeanInfoBuilder builder = GBeanInfoBuilder.createStatic(ClusteredDeployment.class,
+            ClusteredDeployment.class,
+            EjbDeploymentGBean.GBEAN_INFO,
+            NameFactory.STATEFUL_SESSION_BEAN);
+        
+        builder.addReference(GBEAN_REF_SESSION_MANAGER, SessionManager.class, GBeanInfoBuilder.DEFAULT_J2EE_TYPE);
+        
+        builder.setConstructor(new String[] { "objectName",
+            "deploymentId",
+            "ejbName",
+
+            "homeInterfaceName",
+            "remoteInterfaceName",
+            "localHomeInterfaceName",
+            "localInterfaceName",
+            "serviceEndpointInterfaceName",
+            "beanClassName",
+            "classLoader",
+
+            "securityEnabled",
+            "defaultRole",
+            "runAsRole",
+            "RunAsSource",
+
+            "componentContextMap",
+
+            "unshareableResources",
+            "applicationManagedSecurityResources",
+            "TrackedConnectionAssociator",
+            "TransactionManager",
+
+            "OpenEjbSystem",
+            GBEAN_REF_SESSION_MANAGER,
+
+            "kernel"
+        });
+        
+        GBEAN_INFO = builder.getBeanInfo();
+    }
+
+    public static GBeanInfo getGBeanInfo() {
+        return GBEAN_INFO;
+    }
+
+}

Propchange: geronimo/server/branches/2.2/plugins/openejb/geronimo-openejb-clustering-wadi/src/main/java/org/apache/geronimo/openejb/cluster/deployment/ClusteredDeployment.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message