[jboss-cvs] JBossAS SVN: r73660 - in projects/ejb3/trunk/proxy/src: main/java/org/jboss/ejb3/proxy/handler and 14 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Sat May 24 18:33:03 EDT 2008
Author: ALRubinger
Date: 2008-05-24 18:33:03 -0400 (Sat, 24 May 2008)
New Revision: 73660
Added:
projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/objectfactory/Ejb3RegistrarProxyObjectFactory.java
projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/objectstore/
projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/objectstore/ObjectStoreBindings.java
Removed:
projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/hack/
projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/mc/
projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/objectfactory/McProxyObjectFactory.java
projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/objectstore/MicrocontainerBindings.java
Modified:
projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/handler/ProxyInvocationHandler.java
projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/handler/session/stateful/StatefulProxyInvocationHandler.java
projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/handler/session/stateless/StatelessProxyInvocationHandler.java
projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/intf/SessionProxy.java
projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/jndiregistrar/JndiRegistrar.java
projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/objectfactory/session/SessionProxyObjectFactory.java
projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/objectfactory/session/stateful/StatefulSessionProxyObjectFactory.java
projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/plugin/jndi/registry/JndiProxyFactoryRegistry.java
projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/spi/registry/ProxyFactoryRegistry.java
projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/common/container/SessionContainer.java
projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/common/container/StatefulContainer.java
projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/common/container/StatelessContainer.java
projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/common/registry/ProxyFactoryRegistryUnitTestCaseBase.java
projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/session/unit/ProxySessionTestCase.java
projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/spec_3_4_5/ProxyEqualityTestCaseBase.java
Log:
[EJBTHREE-1379] Abstract MC from EJB3 proxy, now using Object Store of ne EJB3Registrar
Modified: projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/handler/ProxyInvocationHandler.java
===================================================================
--- projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/handler/ProxyInvocationHandler.java 2008-05-24 22:26:13 UTC (rev 73659)
+++ projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/handler/ProxyInvocationHandler.java 2008-05-24 22:33:03 UTC (rev 73660)
@@ -33,17 +33,18 @@
* Invocation Handler
*
* @author <a href="mailto:kabir.khan at jboss.org">Kabir Khan</a>
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
* @version $Revision$
*/
public interface ProxyInvocationHandler extends InvocationHandler
{
+ Object getAsynchronousProxy(Object proxy);
+
/**
- * For use in hashCode, toString() and equals() *
+ * Obtain the method invoked upon the proxy
+ *
+ * @return
*/
- String toString();
-
- Object getAsynchronousProxy(Object proxy);
-
SerializableMethod getInvokedMethod();
/**
Modified: projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/handler/session/stateful/StatefulProxyInvocationHandler.java
===================================================================
--- projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/handler/session/stateful/StatefulProxyInvocationHandler.java 2008-05-24 22:26:13 UTC (rev 73659)
+++ projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/handler/session/stateful/StatefulProxyInvocationHandler.java 2008-05-24 22:33:03 UTC (rev 73660)
@@ -27,13 +27,14 @@
import java.util.ArrayList;
import java.util.List;
+import org.jboss.ejb3.common.registrar.spi.Ejb3RegistrarLocator;
import org.jboss.ejb3.common.string.StringUtils;
import org.jboss.ejb3.proxy.container.InvokableContext;
-import org.jboss.ejb3.proxy.hack.Hack;
import org.jboss.ejb3.proxy.handler.NotEligibleForDirectInvocationException;
import org.jboss.ejb3.proxy.handler.session.SessionSpecProxyInvocationHandlerBase;
import org.jboss.ejb3.proxy.intf.StatefulSessionProxy;
import org.jboss.ejb3.proxy.lang.SerializableMethod;
+import org.jboss.kernel.Kernel;
import org.jboss.kernel.spi.registry.KernelBus;
import org.jboss.logging.Logger;
import org.jboss.util.NotImplementedException;
@@ -120,7 +121,9 @@
// Obtain the correct container from MC
//TODO This won't fly for remote, MC would be on another Process
- KernelBus bus = Hack.BOOTSTRAP.getKernel().getBus();
+ //TODO This breaks contract, so provide mechanism to invoke over commons Ejb3Registry
+ Kernel kernel = (Kernel)Ejb3RegistrarLocator.locateRegistrar().getProvider();
+ KernelBus bus = kernel.getBus();
// Obtain container name
String containerName = StringUtils.adjustWhitespaceStringToNull(this.getContainerName());
Modified: projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/handler/session/stateless/StatelessProxyInvocationHandler.java
===================================================================
--- projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/handler/session/stateless/StatelessProxyInvocationHandler.java 2008-05-24 22:26:13 UTC (rev 73659)
+++ projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/handler/session/stateless/StatelessProxyInvocationHandler.java 2008-05-24 22:33:03 UTC (rev 73660)
@@ -27,12 +27,13 @@
import java.util.ArrayList;
import java.util.List;
+import org.jboss.ejb3.common.registrar.spi.Ejb3RegistrarLocator;
import org.jboss.ejb3.common.string.StringUtils;
import org.jboss.ejb3.proxy.container.InvokableContext;
-import org.jboss.ejb3.proxy.hack.Hack;
import org.jboss.ejb3.proxy.handler.NotEligibleForDirectInvocationException;
import org.jboss.ejb3.proxy.handler.session.SessionSpecProxyInvocationHandlerBase;
import org.jboss.ejb3.proxy.lang.SerializableMethod;
+import org.jboss.kernel.Kernel;
import org.jboss.kernel.spi.registry.KernelBus;
import org.jboss.logging.Logger;
import org.jboss.util.NotImplementedException;
@@ -102,7 +103,9 @@
// Obtain the correct container from MC
//TODO This won't fly for remote, MC would be on another Process
- KernelBus bus = Hack.BOOTSTRAP.getKernel().getBus();
+ //TODO This breaks contract, so provide mechanism to invoke over commons Ejb3Registry
+ Kernel kernel = (Kernel)Ejb3RegistrarLocator.locateRegistrar().getProvider();
+ KernelBus bus = kernel.getBus();
// Obtain container name
String containerName = StringUtils.adjustWhitespaceStringToNull(this.getContainerName());
Modified: projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/intf/SessionProxy.java
===================================================================
--- projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/intf/SessionProxy.java 2008-05-24 22:26:13 UTC (rev 73659)
+++ projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/intf/SessionProxy.java 2008-05-24 22:33:03 UTC (rev 73660)
@@ -30,7 +30,7 @@
* @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
* @version $Revision: $
*/
-public interface SessionProxy
+public interface SessionProxy extends EjbProxy
{
}
Modified: projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/jndiregistrar/JndiRegistrar.java
===================================================================
--- projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/jndiregistrar/JndiRegistrar.java 2008-05-24 22:26:13 UTC (rev 73659)
+++ projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/jndiregistrar/JndiRegistrar.java 2008-05-24 22:33:03 UTC (rev 73660)
@@ -445,12 +445,14 @@
/**
* Binds the specified Reference into JNDI at the specified address, adding
- * the requisite key for the ProxyFactory within the Registry
+ * the requisite key for the ProxyFactory within the Registry and the requisite
+ * target EJB Container Name as ReferenceAddresses
*
* @param ref
* @param address
* @param proxyFactoryRegistryKey The key under which the proxy factory
* for this reference is stored in the proxy factory registry
+ * @param containerName The target container to be used in invocations from Proxies obtained from this address
*/
protected void bind(Reference ref, String address, String proxyFactoryRegistryKey, String containerName)
{
Copied: projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/objectfactory/Ejb3RegistrarProxyObjectFactory.java (from rev 73651, projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/objectfactory/McProxyObjectFactory.java)
===================================================================
--- projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/objectfactory/Ejb3RegistrarProxyObjectFactory.java (rev 0)
+++ projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/objectfactory/Ejb3RegistrarProxyObjectFactory.java 2008-05-24 22:33:03 UTC (rev 73660)
@@ -0,0 +1,99 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.proxy.objectfactory;
+
+import java.io.Serializable;
+
+import javax.naming.spi.ObjectFactory;
+
+import org.jboss.ejb3.common.registrar.spi.Ejb3RegistrarLocator;
+import org.jboss.ejb3.common.registrar.spi.NotBoundException;
+import org.jboss.ejb3.proxy.objectstore.ObjectStoreBindings;
+import org.jboss.ejb3.proxy.spi.registry.ProxyFactoryRegistry;
+import org.jboss.logging.Logger;
+
+/**
+ * Ejb3RegistrarProxyObjectFactory
+ *
+ * A Proxy Object Factory using an underlying
+ * Proxy Factory Registry intended to be obtained
+ * as a managed object from the Object Store
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+public abstract class Ejb3RegistrarProxyObjectFactory extends ProxyObjectFactory implements ObjectFactory, Serializable
+{
+ // --------------------------------------------------------------------------------||
+ // Class Members ------------------------------------------------------------------||
+ // --------------------------------------------------------------------------------||
+
+ private static final long serialVersionUID = 1L;
+
+ private static final Logger log = Logger.getLogger(Ejb3RegistrarProxyObjectFactory.class);
+
+ // --------------------------------------------------------------------------------||
+ // Instance Members ---------------------------------------------------------------||
+ // --------------------------------------------------------------------------------||
+
+ //TODO
+ // Inject via IoC, must be configurable
+ private ProxyFactoryRegistry proxyFactoryRegistry;
+
+ // --------------------------------------------------------------------------------||
+ // Constructor --------------------------------------------------------------------||
+ // --------------------------------------------------------------------------------||
+
+ public Ejb3RegistrarProxyObjectFactory()
+ {
+ // Set the ProxyFactoryRegistry as obtained from the EJB3 Registrar
+ //TODO ProxyFactoryRegistry will be replaced by IoC itself
+ ProxyFactoryRegistry registry = null;
+ try
+ {
+ registry = (ProxyFactoryRegistry) Ejb3RegistrarLocator.locateRegistrar().lookup(
+ ObjectStoreBindings.OBJECTSTORE_BEAN_NAME_PROXY_FACTORY_REGISTRY);
+ }
+ catch (NotBoundException e)
+ {
+ throw new RuntimeException(ProxyFactoryRegistry.class.getSimpleName()
+ + " is required to be bound in the Object Store, but was not", e);
+ }
+ this.setProxyFactoryRegistry(registry);
+ }
+
+ // --------------------------------------------------------------------------------||
+ // Accessors / Mutators -----------------------------------------------------------||
+ // --------------------------------------------------------------------------------||
+
+ @Override
+ protected ProxyFactoryRegistry getProxyFactoryRegistry()
+ {
+ return this.proxyFactoryRegistry;
+ }
+
+ public void setProxyFactoryRegistry(ProxyFactoryRegistry proxyFactoryRegistry)
+ {
+ this.proxyFactoryRegistry = proxyFactoryRegistry;
+ }
+
+}
Deleted: projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/objectfactory/McProxyObjectFactory.java
===================================================================
--- projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/objectfactory/McProxyObjectFactory.java 2008-05-24 22:26:13 UTC (rev 73659)
+++ projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/objectfactory/McProxyObjectFactory.java 2008-05-24 22:33:03 UTC (rev 73660)
@@ -1,89 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ejb3.proxy.objectfactory;
-
-import java.io.Serializable;
-
-import javax.naming.spi.ObjectFactory;
-
-import org.jboss.ejb3.proxy.hack.Hack;
-import org.jboss.ejb3.proxy.mc.MicrocontainerBindings;
-import org.jboss.ejb3.proxy.spi.registry.ProxyFactoryRegistry;
-import org.jboss.logging.Logger;
-
-/**
- * McProxyObjectFactory
- *
- * A Proxy Object Factory using an underlying
- * Proxy Factory Registry intended to be obtained
- * as a managed object from the MicroContainer
- *
- * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
- * @version $Revision: $
- */
-public abstract class McProxyObjectFactory extends ProxyObjectFactory implements ObjectFactory, Serializable
-{
- // --------------------------------------------------------------------------------||
- // Class Members ------------------------------------------------------------------||
- // --------------------------------------------------------------------------------||
-
- private static final long serialVersionUID = 1L;
-
- private static final Logger log = Logger.getLogger(McProxyObjectFactory.class);
-
- // --------------------------------------------------------------------------------||
- // Instance Members ---------------------------------------------------------------||
- // --------------------------------------------------------------------------------||
-
- //TODO
- // Inject from MC, must be configurable
- private ProxyFactoryRegistry proxyFactoryRegistry;
-
- // --------------------------------------------------------------------------------||
- // Constructor --------------------------------------------------------------------||
- // --------------------------------------------------------------------------------||
-
- public McProxyObjectFactory()
- {
- // Set the ProxyFactoryRegistry as obtained from MC
- //TODO ProxyFactoryRegistry will be replaced by MC itself
- //TODO This hack will be replaced when we have some way of getting at MC Kernel
- this.setProxyFactoryRegistry((ProxyFactoryRegistry) Hack.BOOTSTRAP.getKernel().getController()
- .getInstalledContext(MicrocontainerBindings.MC_BEAN_NAME_PROXY_FACTORY_REGISTRY).getTarget());
- }
-
- // --------------------------------------------------------------------------------||
- // Accessors / Mutators -----------------------------------------------------------||
- // --------------------------------------------------------------------------------||
-
- @Override
- protected ProxyFactoryRegistry getProxyFactoryRegistry()
- {
- return this.proxyFactoryRegistry;
- }
-
- public void setProxyFactoryRegistry(ProxyFactoryRegistry proxyFactoryRegistry)
- {
- this.proxyFactoryRegistry = proxyFactoryRegistry;
- }
-
-}
Modified: projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/objectfactory/session/SessionProxyObjectFactory.java
===================================================================
--- projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/objectfactory/session/SessionProxyObjectFactory.java 2008-05-24 22:26:13 UTC (rev 73659)
+++ projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/objectfactory/session/SessionProxyObjectFactory.java 2008-05-24 22:33:03 UTC (rev 73660)
@@ -31,7 +31,7 @@
import org.jboss.ejb3.proxy.factory.ProxyFactory;
import org.jboss.ejb3.proxy.factory.session.SessionProxyFactory;
import org.jboss.ejb3.proxy.handler.session.SessionProxyInvocationHandler;
-import org.jboss.ejb3.proxy.objectfactory.McProxyObjectFactory;
+import org.jboss.ejb3.proxy.objectfactory.Ejb3RegistrarProxyObjectFactory;
import org.jboss.ejb3.proxy.objectfactory.ProxyFactoryReferenceAddressTypes;
import org.jboss.logging.Logger;
@@ -45,7 +45,7 @@
* @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
* @version $Revision: $
*/
-public abstract class SessionProxyObjectFactory extends McProxyObjectFactory
+public abstract class SessionProxyObjectFactory extends Ejb3RegistrarProxyObjectFactory
{
// --------------------------------------------------------------------------------||
Modified: projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/objectfactory/session/stateful/StatefulSessionProxyObjectFactory.java
===================================================================
--- projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/objectfactory/session/stateful/StatefulSessionProxyObjectFactory.java 2008-05-24 22:26:13 UTC (rev 73659)
+++ projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/objectfactory/session/stateful/StatefulSessionProxyObjectFactory.java 2008-05-24 22:33:03 UTC (rev 73660)
@@ -25,15 +25,13 @@
import java.util.Map;
import javax.naming.Name;
-import javax.naming.RefAddr;
-import org.jboss.dependency.spi.ControllerContext;
+import org.jboss.ejb3.common.registrar.spi.Ejb3RegistrarLocator;
+import org.jboss.ejb3.common.registrar.spi.NotBoundException;
import org.jboss.ejb3.proxy.container.StatefulSessionInvokableContext;
import org.jboss.ejb3.proxy.factory.ProxyFactory;
-import org.jboss.ejb3.proxy.hack.Hack;
import org.jboss.ejb3.proxy.intf.StatefulSessionProxy;
import org.jboss.ejb3.proxy.objectfactory.session.SessionProxyObjectFactory;
-import org.jboss.kernel.Kernel;
/**
* StatefulSessionProxyObjectFactory
@@ -74,12 +72,16 @@
String containerName = this.getContainerName(name, referenceAddresses);
// Get the Container
- Kernel kernel = Hack.BOOTSTRAP.getKernel();
- ControllerContext context = kernel.getController().getInstalledContext(containerName);
- assert context != null && context.getTarget() != null : "EJB Container could not be found at " + containerName
- + "; perhaps it has not been properly registered or the " + RefAddr.class.getSimpleName()
- + " is incorrect?";
- Object obj = context.getTarget();
+ Object obj = null;
+ try
+ {
+ obj = Ejb3RegistrarLocator.locateRegistrar().lookup(containerName);
+ }
+ catch (NotBoundException e)
+ {
+ throw new RuntimeException("Found reference to EJB Container with name " + containerName
+ + " but it could not be found in the object store", e);
+ }
assert obj instanceof StatefulSessionInvokableContext : "Object found registered under name " + containerName
+ " must be of type " + StatefulSessionInvokableContext.class.getName() + " but was instead " + obj;
StatefulSessionInvokableContext<?> container = (StatefulSessionInvokableContext<?>) obj;
Copied: projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/objectstore (from rev 73651, projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/mc)
Deleted: projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/objectstore/MicrocontainerBindings.java
===================================================================
--- projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/mc/MicrocontainerBindings.java 2008-05-24 09:51:19 UTC (rev 73651)
+++ projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/objectstore/MicrocontainerBindings.java 2008-05-24 22:33:03 UTC (rev 73660)
@@ -1,82 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ejb3.proxy.mc;
-
-/**
- * MicrocontainerBindings
- *
- * Defines constants used in binding POJOs to
- * Microcontainer
- *
- * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
- * @version $Revision: $
- */
-public interface MicrocontainerBindings
-{
- // --------------------------------------------------------------------------------||
- // Constants ----------------------------------------------------------------------||
- // --------------------------------------------------------------------------------||
-
- /*
- * The following are Namespaces used by EJB3
- */
-
- /**
- * Namespace for all MC Beans for EJB3
- */
- String MC_NAMESPACE_EJB3 = "org.jboss.ejb3.";
-
- /**
- * Namespace of all EJB Containers, should not be used directly but
- * instead precedes namespaces for SLSB, SFSB, MDB, and @Service
- */
- String MC_NAMESPACE_EJBCONTAINER = MicrocontainerBindings.MC_NAMESPACE_EJB3 + "EJBContainer.";
-
- /**
- * Namespace for SFSB Containers
- */
- String MC_NAMESPACE_EJBCONTAINER_STATEFUL = MicrocontainerBindings.MC_NAMESPACE_EJBCONTAINER + "StatefulSession.";
-
- /**
- * Namespace for SLSB Containers
- */
- String MC_NAMESPACE_EJBCONTAINER_STATELESS = MicrocontainerBindings.MC_NAMESPACE_EJBCONTAINER + "StatelessSession.";
-
- /**
- * Namespace for @Service Containers
- */
- String MC_NAMESPACE_EJBCONTAINER_SERVICE = MicrocontainerBindings.MC_NAMESPACE_EJBCONTAINER + "Service.";
-
- /**
- * Namespace for MDB Containers
- */
- String MC_NAMESPACE_EJBCONTAINER_MDB = MicrocontainerBindings.MC_NAMESPACE_EJBCONTAINER + "MDB.";
-
- /*
- * The following are Bindings used as MC Bean Names
- */
-
- String MC_BEAN_NAME_PROXY_FACTORY_REGISTRY = MicrocontainerBindings.MC_NAMESPACE_EJB3 + "ProxyFactoryRegistry";
-
- String MC_BEAN_NAME_JNDI_REGISTRAR = MicrocontainerBindings.MC_NAMESPACE_EJB3 + "JndiRegistrar";
-
-}
Copied: projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/objectstore/ObjectStoreBindings.java (from rev 73651, projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/mc/MicrocontainerBindings.java)
===================================================================
--- projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/objectstore/ObjectStoreBindings.java (rev 0)
+++ projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/objectstore/ObjectStoreBindings.java 2008-05-24 22:33:03 UTC (rev 73660)
@@ -0,0 +1,86 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.proxy.objectstore;
+
+/**
+ * ObjectStoreBindings
+ *
+ * Defines constants used in binding POJOs to
+ * the Object Store
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+public interface ObjectStoreBindings
+{
+ // --------------------------------------------------------------------------------||
+ // Constants ----------------------------------------------------------------------||
+ // --------------------------------------------------------------------------------||
+
+ /*
+ * The following are Namespaces used by EJB3
+ */
+
+ /**
+ * Namespace for all Beans for EJB3
+ */
+ String OBJECTSTORE_NAMESPACE_EJB3 = "org.jboss.ejb3.";
+
+ /**
+ * Namespace of all EJB Containers, should not be used directly but
+ * instead precedes namespaces for SLSB, SFSB, MDB, and @Service
+ */
+ String OBJECTSTORE_NAMESPACE_EJBCONTAINER = ObjectStoreBindings.OBJECTSTORE_NAMESPACE_EJB3 + "EJBContainer.";
+
+ /**
+ * Namespace for SFSB Containers
+ */
+ String OBJECTSTORE_NAMESPACE_EJBCONTAINER_STATEFUL = ObjectStoreBindings.OBJECTSTORE_NAMESPACE_EJBCONTAINER
+ + "StatefulSession.";
+
+ /**
+ * Namespace for SLSB Containers
+ */
+ String OBJECTSTORE_NAMESPACE_EJBCONTAINER_STATELESS = ObjectStoreBindings.OBJECTSTORE_NAMESPACE_EJBCONTAINER
+ + "StatelessSession.";
+
+ /**
+ * Namespace for @Service Containers
+ */
+ String OBJECTSTORE_NAMESPACE_EJBCONTAINER_SERVICE = ObjectStoreBindings.OBJECTSTORE_NAMESPACE_EJBCONTAINER
+ + "Service.";
+
+ /**
+ * Namespace for MDB Containers
+ */
+ String OBJECTSTORE_NAMESPACE_EJBCONTAINER_MDB = ObjectStoreBindings.OBJECTSTORE_NAMESPACE_EJBCONTAINER + "MDB.";
+
+ /*
+ * The following are Bindings used as Object Store Bean Names
+ */
+
+ String OBJECTSTORE_BEAN_NAME_PROXY_FACTORY_REGISTRY = ObjectStoreBindings.OBJECTSTORE_NAMESPACE_EJB3
+ + "ProxyFactoryRegistry";
+
+ String OBJECTSTORE_BEAN_NAME_JNDI_REGISTRAR = ObjectStoreBindings.OBJECTSTORE_NAMESPACE_EJB3 + "JndiRegistrar";
+
+}
Modified: projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/plugin/jndi/registry/JndiProxyFactoryRegistry.java
===================================================================
--- projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/plugin/jndi/registry/JndiProxyFactoryRegistry.java 2008-05-24 22:26:13 UTC (rev 73659)
+++ projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/plugin/jndi/registry/JndiProxyFactoryRegistry.java 2008-05-24 22:33:03 UTC (rev 73660)
@@ -60,7 +60,7 @@
// Instance Members ---------------------------------------------------------------||
// --------------------------------------------------------------------------------||
- //TODO Inject from MC
+ //TODO Inject from Ioc
private Context context;
// --------------------------------------------------------------------------------||
Modified: projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/spi/registry/ProxyFactoryRegistry.java
===================================================================
--- projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/spi/registry/ProxyFactoryRegistry.java 2008-05-24 22:26:13 UTC (rev 73659)
+++ projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/spi/registry/ProxyFactoryRegistry.java 2008-05-24 22:33:03 UTC (rev 73660)
@@ -32,7 +32,7 @@
*
* @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
* @version $Revision: $
- * @deprecated To be replaced by using the MC itself as the ProxyFactoryRegistry
+ * @deprecated To be replaced by using the Object Store (Ejb3Registrar) itself as the ProxyFactoryRegistry
*/
@Deprecated
public interface ProxyFactoryRegistry
Modified: projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/common/container/SessionContainer.java
===================================================================
--- projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/common/container/SessionContainer.java 2008-05-24 22:26:13 UTC (rev 73659)
+++ projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/common/container/SessionContainer.java 2008-05-24 22:33:03 UTC (rev 73660)
@@ -27,11 +27,11 @@
import org.jboss.beans.metadata.api.annotations.Start;
import org.jboss.beans.metadata.api.annotations.Stop;
-import org.jboss.dependency.spi.ControllerContext;
-import org.jboss.ejb3.proxy.hack.Hack;
+import org.jboss.ejb3.common.registrar.spi.Ejb3RegistrarLocator;
+import org.jboss.ejb3.common.registrar.spi.NotBoundException;
import org.jboss.ejb3.proxy.jndiregistrar.JndiRegistrar;
import org.jboss.ejb3.proxy.lang.SerializableMethod;
-import org.jboss.ejb3.proxy.mc.MicrocontainerBindings;
+import org.jboss.ejb3.proxy.objectstore.ObjectStoreBindings;
import org.jboss.logging.Logger;
import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
@@ -92,7 +92,7 @@
// Set CL
this.setClassLoader(classLoader);
-
+
// Set name
this.setName(this.createContainerName());
@@ -194,19 +194,23 @@
protected JndiRegistrar getJndiRegistrar()
{
// Lookup
- ControllerContext context = Hack.BOOTSTRAP.getKernel().getController().getInstalledContext(
- MicrocontainerBindings.MC_BEAN_NAME_JNDI_REGISTRAR);
+ Object obj = null;
- // If not installed, warn and continue
- if (context == null)
+ try
{
+ obj = Ejb3RegistrarLocator.locateRegistrar().lookup(ObjectStoreBindings.OBJECTSTORE_BEAN_NAME_JNDI_REGISTRAR);
+ }
+ // If not installed, warn and return null
+ catch (NotBoundException e)
+ {
log.warn("No " + JndiRegistrar.class.getName() + " was found installed in MC at "
- + MicrocontainerBindings.MC_BEAN_NAME_JNDI_REGISTRAR);
+ + ObjectStoreBindings.OBJECTSTORE_BEAN_NAME_JNDI_REGISTRAR);
return null;
+
}
// Cast
- JndiRegistrar registrar = (JndiRegistrar) context.getTarget();
+ JndiRegistrar registrar = (JndiRegistrar) obj;
// Return
return registrar;
Modified: projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/common/container/StatefulContainer.java
===================================================================
--- projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/common/container/StatefulContainer.java 2008-05-24 22:26:13 UTC (rev 73659)
+++ projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/common/container/StatefulContainer.java 2008-05-24 22:33:03 UTC (rev 73660)
@@ -25,7 +25,7 @@
import org.jboss.ejb3.proxy.container.StatefulSessionInvokableContext;
import org.jboss.ejb3.proxy.invocation.StatefulSessionContainerMethodInvocation;
-import org.jboss.ejb3.proxy.mc.MicrocontainerBindings;
+import org.jboss.ejb3.proxy.objectstore.ObjectStoreBindings;
import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
/**
@@ -79,7 +79,7 @@
*/
protected final String createContainerName()
{
- return MicrocontainerBindings.MC_NAMESPACE_EJBCONTAINER_STATEFUL + this.getMetaData().getEjbName() + "/"
+ return ObjectStoreBindings.OBJECTSTORE_NAMESPACE_EJBCONTAINER_STATEFUL + this.getMetaData().getEjbName() + "/"
+ UUID.randomUUID();
}
Modified: projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/common/container/StatelessContainer.java
===================================================================
--- projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/common/container/StatelessContainer.java 2008-05-24 22:26:13 UTC (rev 73659)
+++ projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/common/container/StatelessContainer.java 2008-05-24 22:33:03 UTC (rev 73660)
@@ -25,7 +25,7 @@
import org.jboss.ejb3.interceptors.container.ContainerMethodInvocation;
import org.jboss.ejb3.proxy.container.InvokableContext;
-import org.jboss.ejb3.proxy.mc.MicrocontainerBindings;
+import org.jboss.ejb3.proxy.objectstore.ObjectStoreBindings;
import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
/**
@@ -48,7 +48,7 @@
*/
protected final String createContainerName()
{
- return MicrocontainerBindings.MC_NAMESPACE_EJBCONTAINER_STATELESS + this.getMetaData().getEjbName() + "/"
+ return ObjectStoreBindings.OBJECTSTORE_NAMESPACE_EJBCONTAINER_STATELESS + this.getMetaData().getEjbName() + "/"
+ UUID.randomUUID();
}
}
Modified: projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/common/registry/ProxyFactoryRegistryUnitTestCaseBase.java
===================================================================
--- projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/common/registry/ProxyFactoryRegistryUnitTestCaseBase.java 2008-05-24 22:26:13 UTC (rev 73659)
+++ projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/common/registry/ProxyFactoryRegistryUnitTestCaseBase.java 2008-05-24 22:33:03 UTC (rev 73660)
@@ -26,12 +26,12 @@
import junit.framework.TestCase;
import org.jboss.ejb3.proxy.factory.ProxyFactory;
-import org.jboss.ejb3.proxy.mc.MicrocontainerBindings;
+import org.jboss.ejb3.proxy.objectstore.ObjectStoreBindings;
import org.jboss.ejb3.proxy.spi.registry.ProxyFactoryAlreadyRegisteredException;
import org.jboss.ejb3.proxy.spi.registry.ProxyFactoryNotRegisteredException;
import org.jboss.ejb3.proxy.spi.registry.ProxyFactoryRegistry;
+import org.jboss.ejb3.test.mc.bootstrap.EmbeddedTestMcBootstrap;
import org.jboss.logging.Logger;
-import org.jboss.test.mc.bootstrap.EmbeddedTestMcBootstrap;
import org.junit.After;
import org.junit.Before;
import org.junit.BeforeClass;
@@ -386,7 +386,7 @@
private ProxyFactoryRegistry getProxyFactoryRegistry() throws Throwable
{
ProxyFactoryRegistry registry = ProxyFactoryRegistryUnitTestCaseBase.getBootstrap().lookup(
- MicrocontainerBindings.MC_BEAN_NAME_PROXY_FACTORY_REGISTRY, ProxyFactoryRegistry.class);
+ ObjectStoreBindings.OBJECTSTORE_BEAN_NAME_PROXY_FACTORY_REGISTRY, ProxyFactoryRegistry.class);
return registry;
}
Modified: projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/session/unit/ProxySessionTestCase.java
===================================================================
--- projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/session/unit/ProxySessionTestCase.java 2008-05-24 22:26:13 UTC (rev 73659)
+++ projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/session/unit/ProxySessionTestCase.java 2008-05-24 22:33:03 UTC (rev 73660)
@@ -26,7 +26,9 @@
import javax.naming.InitialContext;
-import org.jboss.ejb3.proxy.hack.Hack;
+import org.jboss.ejb3.common.registrar.plugin.mc.Ejb3McRegistrar;
+import org.jboss.ejb3.common.registrar.spi.Ejb3RegistrarLocator;
+import org.jboss.ejb3.test.mc.bootstrap.EmbeddedTestMcBootstrap;
import org.jboss.ejb3.test.proxy.common.Utils;
import org.jboss.ejb3.test.proxy.common.container.StatelessContainer;
import org.jboss.ejb3.test.proxy.common.ejb.slsb.MyStatelessBean;
@@ -35,7 +37,6 @@
import org.jboss.ejb3.test.proxy.common.ejb.slsb.MyStatelessRemote;
import org.jboss.ejb3.test.proxy.common.ejb.slsb.MyStatelessRemoteHome;
import org.jboss.logging.Logger;
-import org.jboss.test.mc.bootstrap.EmbeddedTestMcBootstrap;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -59,8 +60,8 @@
bootstrap = new EmbeddedTestMcBootstrap();
bootstrap.run();
- //TODO Remove Hack
- Hack.BOOTSTRAP = bootstrap;
+ // Bind the Registrar
+ Ejb3RegistrarLocator.bindRegistrar(new Ejb3McRegistrar(bootstrap.getKernel()));
bootstrap.deploy(ProxySessionTestCase.class);
Modified: projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/spec_3_4_5/ProxyEqualityTestCaseBase.java
===================================================================
--- projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/spec_3_4_5/ProxyEqualityTestCaseBase.java 2008-05-24 22:26:13 UTC (rev 73659)
+++ projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/spec_3_4_5/ProxyEqualityTestCaseBase.java 2008-05-24 22:33:03 UTC (rev 73660)
@@ -25,12 +25,13 @@
import junit.framework.TestCase;
+import org.jboss.ejb3.common.registrar.plugin.mc.Ejb3McRegistrar;
+import org.jboss.ejb3.common.registrar.spi.Ejb3RegistrarLocator;
import org.jboss.ejb3.proxy.factory.session.SessionProxyFactory;
-import org.jboss.ejb3.proxy.hack.Hack;
import org.jboss.ejb3.proxy.handler.ProxyInvocationHandler;
+import org.jboss.ejb3.test.mc.bootstrap.EmbeddedTestMcBootstrap;
import org.jboss.ejb3.test.proxy.common.container.SessionContainer;
import org.jboss.logging.Logger;
-import org.jboss.test.mc.bootstrap.EmbeddedTestMcBootstrap;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -78,7 +79,7 @@
// Create Proxy
Object proxy = this.createProxyDefault(factory);
-
+
// Manually set the target container
this.setContainerNameOnProxy(proxy);
@@ -102,7 +103,7 @@
// Create Proxy
Object proxy = this.createProxyDefault(factory);
-
+
// Manually set the target container
this.setContainerNameOnProxy(proxy);
@@ -123,8 +124,8 @@
// Create and set a new MC Bootstrap
ProxyEqualityTestCaseBase.setBootstrap(EmbeddedTestMcBootstrap.createEmbeddedMcBootstrap());
- //TODO Remove Hack
- Hack.BOOTSTRAP = bootstrap;
+ // Bind the Ejb3Registrar
+ Ejb3RegistrarLocator.bindRegistrar(new Ejb3McRegistrar(bootstrap.getKernel()));
}
@AfterClass
@@ -135,7 +136,6 @@
// Set Bootstrap to null
ProxyEqualityTestCaseBase.setBootstrap(null);
- Hack.BOOTSTRAP = null;
}
// --------------------------------------------------------------------------------||
More information about the jboss-cvs-commits
mailing list