[jboss-cvs] JBossAS SVN: r61035 - in branches/Branch_4_2/ejb3/src/main/org/jboss: ejb3 and 5 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Mar 1 18:56:41 EST 2007
Author: bdecoste
Date: 2007-03-01 18:56:41 -0500 (Thu, 01 Mar 2007)
New Revision: 61035
Added:
branches/Branch_4_2/ejb3/src/main/org/jboss/annotation/ejb/LocalHomeBinding.java
branches/Branch_4_2/ejb3/src/main/org/jboss/annotation/ejb/LocalHomeBindingImpl.java
branches/Branch_4_2/ejb3/src/main/org/jboss/annotation/ejb/RemoteHomeBinding.java
branches/Branch_4_2/ejb3/src/main/org/jboss/annotation/ejb/RemoteHomeBindingImpl.java
Modified:
branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/Ejb3DescriptorHandler.java
branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/ProxyFactoryHelper.java
branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/iiop/IORFactory.java
branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/metamodel/EnterpriseBean.java
branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/metamodel/EnterpriseBeans.java
branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/metamodel/JBossDDObjectFactory.java
branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/session/BaseSessionProxyFactory.java
branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/stateful/StatefulContainer.java
branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/stateful/StatefulLocalProxyFactory.java
branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/stateful/StatefulRemoteProxyFactory.java
branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/stateless/StatelessContainer.java
branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/stateless/StatelessLocalProxyFactory.java
branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/stateless/StatelessRemoteProxyFactory.java
Log:
fix and tests for new home jndi binding default and annotations
Added: branches/Branch_4_2/ejb3/src/main/org/jboss/annotation/ejb/LocalHomeBinding.java
===================================================================
--- branches/Branch_4_2/ejb3/src/main/org/jboss/annotation/ejb/LocalHomeBinding.java (rev 0)
+++ branches/Branch_4_2/ejb3/src/main/org/jboss/annotation/ejb/LocalHomeBinding.java 2007-03-01 23:56:41 UTC (rev 61035)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.annotation.ejb;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Annotation for specifying the local home jndi binding for an EJB local interface
+ *
+ * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
+ */
+ at Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME)
+public @interface LocalHomeBinding
+{
+ String jndiBinding();
+}
Added: branches/Branch_4_2/ejb3/src/main/org/jboss/annotation/ejb/LocalHomeBindingImpl.java
===================================================================
--- branches/Branch_4_2/ejb3/src/main/org/jboss/annotation/ejb/LocalHomeBindingImpl.java (rev 0)
+++ branches/Branch_4_2/ejb3/src/main/org/jboss/annotation/ejb/LocalHomeBindingImpl.java 2007-03-01 23:56:41 UTC (rev 61035)
@@ -0,0 +1,49 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.annotation.ejb;
+
+import java.lang.annotation.Annotation;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
+ */
+public class LocalHomeBindingImpl implements LocalHomeBinding
+{
+ private String jndi;
+
+ public LocalHomeBindingImpl(String jndi)
+ {
+ this.jndi = jndi;
+ }
+
+ public String jndiBinding()
+ {
+ return jndi;
+ }
+
+ public Class<? extends Annotation> annotationType()
+ {
+ return null;
+ }
+}
Added: branches/Branch_4_2/ejb3/src/main/org/jboss/annotation/ejb/RemoteHomeBinding.java
===================================================================
--- branches/Branch_4_2/ejb3/src/main/org/jboss/annotation/ejb/RemoteHomeBinding.java (rev 0)
+++ branches/Branch_4_2/ejb3/src/main/org/jboss/annotation/ejb/RemoteHomeBinding.java 2007-03-01 23:56:41 UTC (rev 61035)
@@ -0,0 +1,39 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.annotation.ejb;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Annotation for specifying the remote home jndi binding for a bean
+ *
+ * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
+ */
+ at Target({ElementType.TYPE, ElementType.ANNOTATION_TYPE})
+ at Retention(RetentionPolicy.RUNTIME)
+public @interface RemoteHomeBinding
+{
+ String jndiBinding() default "";
+}
Added: branches/Branch_4_2/ejb3/src/main/org/jboss/annotation/ejb/RemoteHomeBindingImpl.java
===================================================================
--- branches/Branch_4_2/ejb3/src/main/org/jboss/annotation/ejb/RemoteHomeBindingImpl.java (rev 0)
+++ branches/Branch_4_2/ejb3/src/main/org/jboss/annotation/ejb/RemoteHomeBindingImpl.java 2007-03-01 23:56:41 UTC (rev 61035)
@@ -0,0 +1,74 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.annotation.ejb;
+
+import java.lang.annotation.Annotation;
+import java.util.ArrayList;
+
+import javax.ejb.ActivationConfigProperty;
+import javax.ejb.MessageDriven;
+
+import org.jboss.annotation.ejb.RemoteBinding;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
+ */
+public class RemoteHomeBindingImpl implements RemoteHomeBinding
+{
+ private String jndi;
+
+ public RemoteHomeBindingImpl()
+ {
+ jndi = "";
+ }
+
+ public RemoteHomeBindingImpl(String jndi)
+ {
+ this.jndi = jndi;
+ }
+
+ public void setJndiBinding(String jndi)
+ {
+ this.jndi = jndi;
+ }
+
+ public String jndiBinding()
+ {
+ return jndi;
+ }
+
+ public Class<? extends Annotation> annotationType()
+ {
+ return null;
+ }
+
+ public String toString()
+ {
+ StringBuffer sb = new StringBuffer(100);
+ sb.append("[RemoteHomeBindingImpl:");
+ sb.append(", jndi=" + jndi);
+ sb.append(']');
+ return sb.toString();
+ }
+}
Modified: branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/Ejb3DescriptorHandler.java
===================================================================
--- branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/Ejb3DescriptorHandler.java 2007-03-01 23:55:24 UTC (rev 61034)
+++ branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/Ejb3DescriptorHandler.java 2007-03-01 23:56:41 UTC (rev 61035)
@@ -41,6 +41,8 @@
import org.jboss.annotation.ejb.ExcludeDefaultInterceptorsImpl;
import org.jboss.annotation.ejb.LocalBinding;
import org.jboss.annotation.ejb.LocalBindingImpl;
+import org.jboss.annotation.ejb.LocalHomeBinding;
+import org.jboss.annotation.ejb.LocalHomeBindingImpl;
import org.jboss.annotation.ejb.LocalHomeImpl;
import org.jboss.annotation.ejb.Management;
import org.jboss.annotation.ejb.ManagementImpl;
@@ -51,6 +53,8 @@
import org.jboss.annotation.ejb.Producers;
import org.jboss.annotation.ejb.RemoteBinding;
import org.jboss.annotation.ejb.RemoteBindingImpl;
+import org.jboss.annotation.ejb.RemoteHomeBinding;
+import org.jboss.annotation.ejb.RemoteHomeBindingImpl;
import org.jboss.annotation.ejb.RemoteBindings;
import org.jboss.annotation.ejb.RemoteBindingsImpl;
import org.jboss.annotation.ejb.RemoteHomeImpl;
@@ -1423,11 +1427,25 @@
LocalBindingImpl localBinding = new LocalBindingImpl(localJndiName);
addClassAnnotation(container, LocalBinding.class, localBinding);
}
+
+ String localHomeJndiName = enterpriseBean.getLocalHomeJndiName();
+ if (localHomeJndiName != null)
+ {
+ LocalHomeBindingImpl localHomeBinding = new LocalHomeBindingImpl(localHomeJndiName);
+ addClassAnnotation(container, LocalHomeBinding.class, localHomeBinding);
+ }
}
private void addRemoteJndiAnnotations(EJBContainer container,
EnterpriseBean enterpriseBean) throws ClassNotFoundException
{
+ String homeJndiName = enterpriseBean.getHomeJndiName();
+ if (homeJndiName != null)
+ {
+ RemoteHomeBindingImpl homeBinding = new RemoteHomeBindingImpl(homeJndiName);
+ addClassAnnotation(container, RemoteHomeBinding.class, homeBinding);
+ }
+
List<org.jboss.ejb3.metamodel.RemoteBinding> bindingsList = enterpriseBean.getRemoteBindings();
if (bindingsList.size() == 0)
{
Modified: branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/ProxyFactoryHelper.java
===================================================================
--- branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/ProxyFactoryHelper.java 2007-03-01 23:55:24 UTC (rev 61034)
+++ branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/ProxyFactoryHelper.java 2007-03-01 23:56:41 UTC (rev 61035)
@@ -21,6 +21,8 @@
*/
package org.jboss.ejb3;
+import org.jboss.annotation.ejb.LocalHomeBinding;
+import org.jboss.annotation.ejb.RemoteHomeBinding;
import org.jboss.annotation.ejb.LocalBinding;
import org.jboss.annotation.ejb.RemoteBinding;
import org.jboss.annotation.ejb.RemoteBindings;
@@ -246,6 +248,26 @@
return false;
}
+
+ public static String getHomeJndiName(Container container)
+ {
+ Advisor advisor = (Advisor) container;
+ RemoteHomeBinding binding = (RemoteHomeBinding)advisor.resolveAnnotation(RemoteHomeBinding.class);
+ if (binding != null)
+ return binding.jndiBinding();
+
+ return container.getEjbName() + "/home";
+ }
+
+ public static String getLocalHomeJndiName(Container container)
+ {
+ Advisor advisor = (Advisor) container;
+ LocalHomeBinding binding = (LocalHomeBinding)advisor.resolveAnnotation(LocalHomeBinding.class);
+ if (binding != null)
+ return binding.jndiBinding();
+
+ return container.getEjbName() + "/localHome";
+ }
public static String getJndiName(Container container, Class businessInterface)
{
@@ -276,7 +298,7 @@
{
if (businessInterface.getName().equals(remoteHome.getName()))
{
- return getRemoteJndiName(container) + "Home";
+ return getHomeJndiName(container);
}
}
Class[] locals = getLocalInterfaces(container);
@@ -295,7 +317,7 @@
{
if (businessInterface.getName().equals(localHome.getName()))
{
- return getLocalJndiName(container) + "Home";
+ return getLocalHomeJndiName(container);
}
}
Modified: branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/iiop/IORFactory.java
===================================================================
--- branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/iiop/IORFactory.java 2007-03-01 23:55:24 UTC (rev 61034)
+++ branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/iiop/IORFactory.java 2007-03-01 23:56:41 UTC (rev 61035)
@@ -369,7 +369,7 @@
Object homeObject = createHomeProxy();
- rebind(ctx, getJndiName() + "Home", (org.omg.CORBA.Object) homeObject);
+ rebind(ctx, ProxyFactoryHelper.getHomeJndiName(container), (org.omg.CORBA.Object) homeObject);
}
// bind HandleDelegate stuff
@@ -382,7 +382,7 @@
{
if(homeReferenceFactory != null)
{
- unbind(getJndiName() + "Home");
+ unbind(ProxyFactoryHelper.getHomeJndiName(container));
unbindHomeServant();
}
unbind(getJndiName());
Modified: branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/metamodel/EnterpriseBean.java
===================================================================
--- branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/metamodel/EnterpriseBean.java 2007-03-01 23:55:24 UTC (rev 61034)
+++ branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/metamodel/EnterpriseBean.java 2007-03-01 23:56:41 UTC (rev 61035)
@@ -72,8 +72,10 @@
// jboss.xml
private String jndiName;
+ private String homeJndiName;
private String localJndiName;
+ private String localHomeJndiName;
private String securityDomain;
@@ -228,7 +230,17 @@
{
this.jndiName = jndiName;
}
+
+ public String getHomeJndiName()
+ {
+ return homeJndiName;
+ }
+ public void setHomeJndiName(String homeJndiName)
+ {
+ this.homeJndiName = homeJndiName;
+ }
+
public String getLocalJndiName()
{
return localJndiName;
@@ -238,7 +250,17 @@
{
this.localJndiName = localJndiName;
}
+
+ public String getLocalHomeJndiName()
+ {
+ return localHomeJndiName;
+ }
+ public void setLocalHomeJndiName(String localHomeJndiName)
+ {
+ this.localHomeJndiName = localHomeJndiName;
+ }
+
public TransactionManagementType getTransactionManagementType()
{
return tmType;
Modified: branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/metamodel/EnterpriseBeans.java
===================================================================
--- branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/metamodel/EnterpriseBeans.java 2007-03-01 23:55:24 UTC (rev 61034)
+++ branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/metamodel/EnterpriseBeans.java 2007-03-01 23:56:41 UTC (rev 61035)
@@ -208,6 +208,11 @@
{
currentEjb.setJndiName(jndiName);
}
+
+ public void setHomeJndiName(String homeJndiName)
+ {
+ currentEjb.setHomeJndiName(homeJndiName);
+ }
public void setSecurityDomain(String securityDomain)
{
@@ -218,6 +223,11 @@
{
currentEjb.setLocalJndiName(jndiName);
}
+
+ public void setLocalHomeJndiName(String homeJndiName)
+ {
+ currentEjb.setLocalHomeJndiName(homeJndiName);
+ }
public EnterpriseBean createEjbByEjbName(String ejbName, Class ejbClass)
{
Modified: branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/metamodel/JBossDDObjectFactory.java
===================================================================
--- branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/metamodel/JBossDDObjectFactory.java 2007-03-01 23:55:24 UTC (rev 61034)
+++ branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/metamodel/JBossDDObjectFactory.java 2007-03-01 23:56:41 UTC (rev 61035)
@@ -734,10 +734,18 @@
{
ejbs.setJndiName(getValue(localName, value));
}
+ else if (localName.equals("home-jndi-name"))
+ {
+ ejbs.setHomeJndiName(getValue(localName, value));
+ }
else if (localName.equals("local-jndi-name"))
{
ejbs.setLocalJndiName(getValue(localName, value));
}
+ else if (localName.equals("local-home-jndi-name"))
+ {
+ ejbs.setLocalHomeJndiName(getValue(localName, value));
+ }
else if (localName.equals("security-domain"))
{
ejbs.setSecurityDomain(getValue(localName, value));
Modified: branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/session/BaseSessionProxyFactory.java
===================================================================
--- branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/session/BaseSessionProxyFactory.java 2007-03-01 23:55:24 UTC (rev 61034)
+++ branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/session/BaseSessionProxyFactory.java 2007-03-01 23:56:41 UTC (rev 61035)
@@ -31,6 +31,7 @@
import org.jboss.ejb3.Container;
import org.jboss.ejb3.EJBContainer;
import org.jboss.ejb3.ProxyFactory;
+import org.jboss.ejb3.ProxyFactoryHelper;
import org.jboss.logging.Logger;
import org.jboss.util.StringPropertyReplacer;
import org.jboss.ejb3.proxy.EJBMetaDataImpl;
@@ -77,7 +78,7 @@
RemoteBinding remoteBindingAnnotation = (RemoteBinding)ejbContainer.resolveAnnotation(RemoteBinding.class);
if (remoteBindingAnnotation != null)
- homeHandle = new HomeHandleImpl(remoteBindingAnnotation.jndiBinding() + "Home");
+ homeHandle = new HomeHandleImpl(ProxyFactoryHelper.getHomeJndiName(container));
return homeHandle;
}
Modified: branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/stateful/StatefulContainer.java
===================================================================
--- branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/stateful/StatefulContainer.java 2007-03-01 23:55:24 UTC (rev 61034)
+++ branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/stateful/StatefulContainer.java 2007-03-01 23:56:41 UTC (rev 61035)
@@ -757,8 +757,7 @@
RemoteBinding remoteBindingAnnotation = (RemoteBinding) resolveAnnotation(RemoteBinding.class);
if (remoteBindingAnnotation != null)
- homeHandle = new HomeHandleImpl(remoteBindingAnnotation
- .jndiBinding() + "Home");
+ homeHandle = new HomeHandleImpl(ProxyFactoryHelper.getHomeJndiName(this));
EJBHome ejbHome = homeHandle.getEJBHome();
Modified: branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/stateful/StatefulLocalProxyFactory.java
===================================================================
--- branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/stateful/StatefulLocalProxyFactory.java 2007-03-01 23:55:24 UTC (rev 61034)
+++ branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/stateful/StatefulLocalProxyFactory.java 2007-03-01 23:56:41 UTC (rev 61035)
@@ -77,7 +77,7 @@
Class[] interfaces = {localHome.value()};
Object homeProxy = java.lang.reflect.Proxy.newProxyInstance(container.getBeanClass().getClassLoader(),
interfaces, new StatefulLocalHomeProxy(container));
- NonSerializableFactory.rebind(container.getInitialContext(), jndiName + "Home", homeProxy);
+ NonSerializableFactory.rebind(container.getInitialContext(), ProxyFactoryHelper.getLocalHomeJndiName(container), homeProxy);
}
}
@@ -88,7 +88,7 @@
LocalHome localHome = (LocalHome) ((EJBContainer) container).resolveAnnotation(LocalHome.class);
if (localHome != null)
{
- NonSerializableFactory.unbind(container.getInitialContext(), jndiName + "Home");
+ NonSerializableFactory.unbind(container.getInitialContext(), ProxyFactoryHelper.getLocalHomeJndiName(container));
}
}
Modified: branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/stateful/StatefulRemoteProxyFactory.java
===================================================================
--- branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/stateful/StatefulRemoteProxyFactory.java 2007-03-01 23:55:24 UTC (rev 61034)
+++ branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/stateful/StatefulRemoteProxyFactory.java 2007-03-01 23:56:41 UTC (rev 61035)
@@ -105,7 +105,7 @@
if (remoteHome != null)
{
Object homeProxy = createHomeProxy(remoteHome.value());
- Util.rebind(container.getInitialContext(), jndiName + "Home", homeProxy);
+ Util.rebind(container.getInitialContext(), ProxyFactoryHelper.getHomeJndiName(container), homeProxy);
}
}
@@ -118,7 +118,7 @@
RemoteHome remoteHome = (RemoteHome) statefulContainer.resolveAnnotation(RemoteHome.class);
if (remoteHome != null)
{
- Util.unbind(container.getInitialContext(), jndiName + "Home");
+ Util.unbind(container.getInitialContext(), ProxyFactoryHelper.getHomeJndiName(container));
}
}
Modified: branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/stateless/StatelessContainer.java
===================================================================
--- branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/stateless/StatelessContainer.java 2007-03-01 23:55:24 UTC (rev 61034)
+++ branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/stateless/StatelessContainer.java 2007-03-01 23:56:41 UTC (rev 61035)
@@ -328,7 +328,7 @@
RemoteBinding remoteBindingAnnotation = (RemoteBinding) resolveAnnotation(RemoteBinding.class);
if (remoteBindingAnnotation != null)
- homeHandle = new HomeHandleImpl(remoteBindingAnnotation.jndiBinding() + "Home");
+ homeHandle = new HomeHandleImpl(ProxyFactoryHelper.getHomeJndiName(this));
return homeHandle.getEJBHome();
}
Modified: branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/stateless/StatelessLocalProxyFactory.java
===================================================================
--- branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/stateless/StatelessLocalProxyFactory.java 2007-03-01 23:55:24 UTC (rev 61034)
+++ branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/stateless/StatelessLocalProxyFactory.java 2007-03-01 23:56:41 UTC (rev 61035)
@@ -69,7 +69,7 @@
Class[] interfaces = {localHome.value()};
Object homeProxy = java.lang.reflect.Proxy.newProxyInstance(container.getBeanClass().getClassLoader(),
interfaces, new StatelessLocalProxy(container));
- NonSerializableFactory.rebind(container.getInitialContext(), jndiName + "Home", homeProxy);
+ NonSerializableFactory.rebind(container.getInitialContext(), ProxyFactoryHelper.getLocalHomeJndiName(container), homeProxy);
}
}
@@ -81,7 +81,7 @@
LocalHome localHome = (LocalHome) statelessContainer.resolveAnnotation(LocalHome.class);
if (localHome != null)
{
- NonSerializableFactory.unbind(container.getInitialContext(), jndiName + "Home");
+ NonSerializableFactory.unbind(container.getInitialContext(), ProxyFactoryHelper.getLocalHomeJndiName(container));
}
}
Modified: branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/stateless/StatelessRemoteProxyFactory.java
===================================================================
--- branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/stateless/StatelessRemoteProxyFactory.java 2007-03-01 23:55:24 UTC (rev 61034)
+++ branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/stateless/StatelessRemoteProxyFactory.java 2007-03-01 23:56:41 UTC (rev 61035)
@@ -35,66 +35,67 @@
import org.jboss.remoting.InvokerLocator;
import org.jboss.naming.Util;
-
/**
* Comment
- *
+ *
* @author <a href="mailto:bill at jboss.org">Bill Burke</a>
* @version $Revision$
*/
-public class StatelessRemoteProxyFactory extends BaseStatelessProxyFactory implements RemoteProxyFactory
-{
- private static final Logger log = Logger.getLogger(StatelessRemoteProxyFactory.class);
+public class StatelessRemoteProxyFactory extends BaseStatelessProxyFactory
+ implements RemoteProxyFactory {
+ private static final Logger log = Logger
+ .getLogger(StatelessRemoteProxyFactory.class);
protected RemoteBinding binding;
+
protected InvokerLocator locator;
- public void setRemoteBinding(RemoteBinding binding)
- {
+ public void setRemoteBinding(RemoteBinding binding) {
this.binding = binding;
}
- protected Class[] getInterfaces()
- {
+ protected Class[] getInterfaces() {
Class[] interfaces;
- Class[] remoteInterfaces = ProxyFactoryHelper.getRemoteInterfaces(container);
+ Class[] remoteInterfaces = ProxyFactoryHelper
+ .getRemoteInterfaces(container);
interfaces = new Class[remoteInterfaces.length + 2];
- System.arraycopy(remoteInterfaces, 0, interfaces, 0, remoteInterfaces.length);
+ System.arraycopy(remoteInterfaces, 0, interfaces, 0,
+ remoteInterfaces.length);
interfaces[remoteInterfaces.length] = JBossProxy.class;
interfaces[remoteInterfaces.length + 1] = javax.ejb.EJBObject.class;
return interfaces;
}
- protected void initializeJndiName()
- {
+ protected void initializeJndiName() {
jndiName = ProxyFactoryHelper.getRemoteJndiName(container, binding);
}
- public void init() throws Exception
- {
+ public void init() throws Exception {
super.init();
String clientBindUrl = ProxyFactoryHelper.getClientBindUrl(binding);
locator = new InvokerLocator(clientBindUrl);
}
- public void start() throws Exception
- {
+ public void start() throws Exception {
super.start();
EJBContainer statelessContainer = (EJBContainer) container;
- RemoteHome remoteHome = (RemoteHome) statelessContainer.resolveAnnotation(RemoteHome.class);
- if (remoteHome != null)
- {
+ RemoteHome remoteHome = (RemoteHome) statelessContainer
+ .resolveAnnotation(RemoteHome.class);
+ if (remoteHome != null) {
Object homeProxy = createHomeProxy(remoteHome.value());
- try
- {
- Util.rebind(container.getInitialContext(), jndiName + "Home", homeProxy);
- }
- catch (NamingException e)
- {
- NamingException namingException = new NamingException("Could not bind stateless home proxy with ejb name " + container.getEjbName() + " into JNDI under jndiName: " + container.getInitialContext().getNameInNamespace() + "/" + jndiName + "Home");
+ try {
+ Util.rebind(container.getInitialContext(), ProxyFactoryHelper
+ .getHomeJndiName(container), homeProxy);
+ } catch (NamingException e) {
+ NamingException namingException = new NamingException(
+ "Could not bind stateless home proxy with ejb name "
+ + container.getEjbName()
+ + " into JNDI under jndiName: "
+ + container.getInitialContext().getNameInNamespace()
+ + "/" + ProxyFactoryHelper.getHomeJndiName(container));
namingException.setRootCause(e);
throw namingException;
}
@@ -102,88 +103,79 @@
}
}
- public void stop() throws Exception
- {
+ public void stop() throws Exception {
super.stop();
EJBContainer statelessContainer = (EJBContainer) container;
- RemoteHome remoteHome = (RemoteHome) statelessContainer.resolveAnnotation(RemoteHome.class);
- if (remoteHome != null)
- {
- Util.unbind(container.getInitialContext(), jndiName + "Home");
+ RemoteHome remoteHome = (RemoteHome) statelessContainer
+ .resolveAnnotation(RemoteHome.class);
+ if (remoteHome != null) {
+ Util.unbind(container.getInitialContext(), ProxyFactoryHelper
+ .getHomeJndiName(container));
}
}
- protected StatelessHandleImpl getHandle()
- {
+ protected StatelessHandleImpl getHandle() {
StatelessHandleImpl handle = new StatelessHandleImpl();
- RemoteBinding remoteBinding = (RemoteBinding) advisor.resolveAnnotation(RemoteBinding.class);
+ RemoteBinding remoteBinding = (RemoteBinding) advisor
+ .resolveAnnotation(RemoteBinding.class);
if (remoteBinding != null)
- handle.jndiName = remoteBinding.jndiBinding() ;
+ handle.jndiName = remoteBinding.jndiBinding();
return handle;
}
- public Object createHomeProxy(Class homeInterface)
- {
- try
- {
+ public Object createHomeProxy(Class homeInterface) {
+ try {
Object containerId = container.getObjectName().getCanonicalName();
;
String stackName = "StatelessSessionClientInterceptors";
- if (binding.interceptorStack() != null && !binding.interceptorStack().equals(""))
- {
+ if (binding.interceptorStack() != null
+ && !binding.interceptorStack().equals("")) {
stackName = binding.interceptorStack();
}
AdviceStack stack = AspectManager.instance().getAdviceStack(stackName);
- StatelessRemoteProxy proxy = new StatelessRemoteProxy(containerId, stack.createInterceptors((Advisor) container, null), locator);
+ StatelessRemoteProxy proxy = new StatelessRemoteProxy(containerId,
+ stack.createInterceptors((Advisor) container, null), locator);
setEjb21Objects(proxy);
- Class[] interfaces = {homeInterface};
- return java.lang.reflect.Proxy.newProxyInstance(container.getBeanClass().getClassLoader(), interfaces, proxy);
+ Class[] interfaces = { homeInterface };
+ return java.lang.reflect.Proxy.newProxyInstance(container
+ .getBeanClass().getClassLoader(), interfaces, proxy);
+ } catch (IllegalArgumentException e) {
+ throw new RuntimeException(e); // To change body of catch statement
+ // use Options | File Templates.
}
- catch (IllegalArgumentException e)
- {
- throw new RuntimeException(e); //To change body of catch statement use Options | File Templates.
- }
}
- public Object createProxy()
- {
-// try
+ public Object createProxy() {
+ // try
{
Object containerId = container.getObjectName().getCanonicalName();
;
String stackName = "StatelessSessionClientInterceptors";
- if (binding.interceptorStack() != null && !binding.interceptorStack().equals(""))
- {
+ if (binding.interceptorStack() != null
+ && !binding.interceptorStack().equals("")) {
stackName = binding.interceptorStack();
}
AdviceStack stack = AspectManager.instance().getAdviceStack(stackName);
- StatelessRemoteProxy proxy = new StatelessRemoteProxy(containerId, stack.createInterceptors((Advisor) container, null), locator);
+ StatelessRemoteProxy proxy = new StatelessRemoteProxy(containerId,
+ stack.createInterceptors((Advisor) container, null), locator);
setEjb21Objects(proxy);
/*
- Object[] args = {proxy};
- return proxyConstructor.newInstance(args);
- */
+ * Object[] args = {proxy}; return proxyConstructor.newInstance(args);
+ */
return constructProxy(proxy);
}
/*
- catch (InstantiationException e)
- {
- throw new RuntimeException(e); //To change body of catch statement use Options | File Templates.
- }
- catch (IllegalAccessException e)
- {
- throw new RuntimeException(e); //To change body of catch statement use Options | File Templates.
- }
- catch (IllegalArgumentException e)
- {
- throw new RuntimeException(e); //To change body of catch statement use Options | File Templates.
- }
- catch (InvocationTargetException e)
- {
- throw new RuntimeException(e.getTargetException()); //To change body of catch statement use Options | File Templates.
- }
- */
+ * catch (InstantiationException e) { throw new RuntimeException(e); //To
+ * change body of catch statement use Options | File Templates. } catch
+ * (IllegalAccessException e) { throw new RuntimeException(e); //To change
+ * body of catch statement use Options | File Templates. } catch
+ * (IllegalArgumentException e) { throw new RuntimeException(e); //To
+ * change body of catch statement use Options | File Templates. } catch
+ * (InvocationTargetException e) { throw new
+ * RuntimeException(e.getTargetException()); //To change body of catch
+ * statement use Options | File Templates. }
+ */
}
}
More information about the jboss-cvs-commits
mailing list