[Jboss-cvs] JBossAS SVN: r56516 - in trunk/ejb3/src: main/org/jboss/annotation/ejb main/org/jboss/ejb3 main/org/jboss/ejb3/service main/org/jboss/ejb3/stateful main/org/jboss/ejb3/stateless test/org/jboss/ejb3/test/stateless
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Sep 1 20:34:35 EDT 2006
Author: bdecoste
Date: 2006-09-01 20:34:30 -0400 (Fri, 01 Sep 2006)
New Revision: 56516
Modified:
trunk/ejb3/src/main/org/jboss/annotation/ejb/RemoteBinding.java
trunk/ejb3/src/main/org/jboss/annotation/ejb/RemoteBindingImpl.java
trunk/ejb3/src/main/org/jboss/ejb3/ClientKernelAbstraction.java
trunk/ejb3/src/main/org/jboss/ejb3/JmxClientKernelAbstraction.java
trunk/ejb3/src/main/org/jboss/ejb3/KernelAbstraction.java
trunk/ejb3/src/main/org/jboss/ejb3/MCClientKernelAbstraction.java
trunk/ejb3/src/main/org/jboss/ejb3/ProxyFactoryHelper.java
trunk/ejb3/src/main/org/jboss/ejb3/service/ServiceRemoteProxyFactory.java
trunk/ejb3/src/main/org/jboss/ejb3/stateful/StatefulClusterProxyFactory.java
trunk/ejb3/src/main/org/jboss/ejb3/stateful/StatefulRemoteProxyFactory.java
trunk/ejb3/src/main/org/jboss/ejb3/stateless/StatelessClusterProxyFactory.java
trunk/ejb3/src/main/org/jboss/ejb3/stateless/StatelessRemoteProxyFactory.java
trunk/ejb3/src/test/org/jboss/ejb3/test/stateless/CheckedStatelessBean.java
Log:
clientBindUrl() now defaults to the default ejb3 connector value
Modified: trunk/ejb3/src/main/org/jboss/annotation/ejb/RemoteBinding.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/annotation/ejb/RemoteBinding.java 2006-09-02 00:27:27 UTC (rev 56515)
+++ trunk/ejb3/src/main/org/jboss/annotation/ejb/RemoteBinding.java 2006-09-02 00:34:30 UTC (rev 56516)
@@ -43,7 +43,7 @@
String interceptorStack() default "";
- String clientBindUrl() default "socket://0.0.0.0:3873";
+ String clientBindUrl() default "";
Class factory() default org.jboss.ejb3.remoting.RemoteProxyFactory.class;
}
Modified: trunk/ejb3/src/main/org/jboss/annotation/ejb/RemoteBindingImpl.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/annotation/ejb/RemoteBindingImpl.java 2006-09-02 00:27:27 UTC (rev 56515)
+++ trunk/ejb3/src/main/org/jboss/annotation/ejb/RemoteBindingImpl.java 2006-09-02 00:34:30 UTC (rev 56516)
@@ -46,7 +46,7 @@
{
jndi = "";
stack = "";
- bindUrl = "socket://0.0.0.0:3873";
+ bindUrl = "";
proxyFactory = org.jboss.ejb3.remoting.RemoteProxyFactory.class;
}
Modified: trunk/ejb3/src/main/org/jboss/ejb3/ClientKernelAbstraction.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/ClientKernelAbstraction.java 2006-09-02 00:27:27 UTC (rev 56515)
+++ trunk/ejb3/src/main/org/jboss/ejb3/ClientKernelAbstraction.java 2006-09-02 00:34:30 UTC (rev 56516)
@@ -31,4 +31,6 @@
public interface ClientKernelAbstraction
{
Object invoke(ObjectName name, String operationName, Object[] params, String[] signature) throws Exception;
+
+ public Object getAttribute(ObjectName name, String attribute) throws Exception;
}
Modified: trunk/ejb3/src/main/org/jboss/ejb3/JmxClientKernelAbstraction.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/JmxClientKernelAbstraction.java 2006-09-02 00:27:27 UTC (rev 56515)
+++ trunk/ejb3/src/main/org/jboss/ejb3/JmxClientKernelAbstraction.java 2006-09-02 00:34:30 UTC (rev 56516)
@@ -43,4 +43,9 @@
{
return server.invoke(name, operationName, params, signature);
}
+
+ public Object getAttribute(ObjectName name, String attribute) throws Exception
+ {
+ return server.getAttribute(name, attribute);
+ }
}
Modified: trunk/ejb3/src/main/org/jboss/ejb3/KernelAbstraction.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/KernelAbstraction.java 2006-09-02 00:27:27 UTC (rev 56515)
+++ trunk/ejb3/src/main/org/jboss/ejb3/KernelAbstraction.java 2006-09-02 00:34:30 UTC (rev 56516)
@@ -31,7 +31,7 @@
* @author <a href="mailto:bill at jboss.org">Bill Burke</a>
* @version $Revision$
*/
-public interface KernelAbstraction
+public interface KernelAbstraction extends ClientKernelAbstraction
{
public void install(String name, DependencyPolicy dependencies, Object service);
@@ -42,6 +42,4 @@
void uninstallMBean(ObjectName on);
void setMbeanServer(MBeanServer server);
-
- Object invoke(ObjectName name, String operationName, Object[] params, String[] signature) throws Exception;
}
Modified: trunk/ejb3/src/main/org/jboss/ejb3/MCClientKernelAbstraction.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/MCClientKernelAbstraction.java 2006-09-02 00:27:27 UTC (rev 56515)
+++ trunk/ejb3/src/main/org/jboss/ejb3/MCClientKernelAbstraction.java 2006-09-02 00:34:30 UTC (rev 56516)
@@ -21,6 +21,7 @@
*/
package org.jboss.ejb3;
+import java.lang.reflect.Field;
import java.lang.reflect.Method;
import javax.management.ObjectName;
@@ -71,4 +72,23 @@
}
return null;
}
+
+ public Object getAttribute(ObjectName objectName, String attribute) throws Exception
+ {
+ String name = objectName.getCanonicalName();
+ KernelRegistryEntry entry = kernel.getRegistry().getEntry(name);
+ if (entry != null)
+ {
+ Object target = entry.getTarget();
+ try
+ {
+ Field field = target.getClass().getField(attribute);
+ return field.get(target);
+ }
+ catch (NoSuchFieldException e)
+ {
+ }
+ }
+ return null;
+ }
}
Modified: trunk/ejb3/src/main/org/jboss/ejb3/ProxyFactoryHelper.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/ProxyFactoryHelper.java 2006-09-02 00:27:27 UTC (rev 56515)
+++ trunk/ejb3/src/main/org/jboss/ejb3/ProxyFactoryHelper.java 2006-09-02 00:34:30 UTC (rev 56516)
@@ -34,6 +34,7 @@
import javax.ejb.Remote;
import javax.ejb.RemoteHome;
import javax.jws.WebService;
+import javax.management.ObjectName;
import javax.naming.Context;
import javax.naming.NameNotFoundException;
import javax.naming.NamingException;
@@ -416,5 +417,17 @@
if (ear != null) return ear.getBaseName() + "/" + name;
return name;
}
-
+
+ public static String getClientBindUrl(RemoteBinding binding) throws Exception
+ {
+ String clientBindUrl = binding.clientBindUrl();
+ if (clientBindUrl.length() == 0)
+ {
+ ObjectName connectionON = new ObjectName("jboss.remoting:type=Connector,name=DefaultEjb3Connector,handler=ejb3");
+ KernelAbstraction kernelAbstraction = KernelAbstractionFactory.getInstance();
+ clientBindUrl = (String)kernelAbstraction.getAttribute(connectionON, "InvokerLocator");
+ }
+
+ return clientBindUrl;
+ }
}
Modified: trunk/ejb3/src/main/org/jboss/ejb3/service/ServiceRemoteProxyFactory.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/service/ServiceRemoteProxyFactory.java 2006-09-02 00:27:27 UTC (rev 56515)
+++ trunk/ejb3/src/main/org/jboss/ejb3/service/ServiceRemoteProxyFactory.java 2006-09-02 00:34:30 UTC (rev 56516)
@@ -62,7 +62,7 @@
public void start() throws Exception
{
- String clientBindUrl = binding.clientBindUrl();
+ String clientBindUrl = ProxyFactoryHelper.getClientBindUrl(binding);
locator = new InvokerLocator(clientBindUrl);
super.start();
}
Modified: trunk/ejb3/src/main/org/jboss/ejb3/stateful/StatefulClusterProxyFactory.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/stateful/StatefulClusterProxyFactory.java 2006-09-02 00:27:27 UTC (rev 56515)
+++ trunk/ejb3/src/main/org/jboss/ejb3/stateful/StatefulClusterProxyFactory.java 2006-09-02 00:34:30 UTC (rev 56516)
@@ -82,7 +82,7 @@
public void start() throws Exception
{
- String clientBindUrl = binding.clientBindUrl();
+ String clientBindUrl = ProxyFactoryHelper.getClientBindUrl(binding);
locator = new InvokerLocator(clientBindUrl);
Clustered clustered = (Clustered) advisor.resolveAnnotation(Clustered.class);
if (clustered == null) throw new RuntimeException("Could not find @Clustered annotation. Cannot deploy.");
@@ -103,7 +103,7 @@
wrapper = new FamilyWrapper(proxyFamilyName, hatarget.getReplicants());
super.start();
Class[] interfaces = {ProxyFactory.class};
- Object factoryProxy = Remoting.createPojiProxy(jndiName + PROXY_FACTORY_NAME, interfaces, binding.clientBindUrl());
+ Object factoryProxy = Remoting.createPojiProxy(jndiName + PROXY_FACTORY_NAME, interfaces, ProxyFactoryHelper.getClientBindUrl(binding));
try
{
Util.bind(container.getInitialContext(), jndiName + PROXY_FACTORY_NAME, factoryProxy);
Modified: trunk/ejb3/src/main/org/jboss/ejb3/stateful/StatefulRemoteProxyFactory.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/stateful/StatefulRemoteProxyFactory.java 2006-09-02 00:27:27 UTC (rev 56515)
+++ trunk/ejb3/src/main/org/jboss/ejb3/stateful/StatefulRemoteProxyFactory.java 2006-09-02 00:34:30 UTC (rev 56516)
@@ -77,7 +77,7 @@
public void init() throws Exception
{
super.init();
- String clientBindUrl = binding.clientBindUrl();
+ String clientBindUrl = ProxyFactoryHelper.getClientBindUrl(binding);
locator = new InvokerLocator(clientBindUrl);
}
@@ -87,7 +87,7 @@
super.start();
Class[] interfaces = {ProxyFactory.class};
- Object factoryProxy = Remoting.createPojiProxy(jndiName + PROXY_FACTORY_NAME, interfaces, binding.clientBindUrl());
+ Object factoryProxy = Remoting.createPojiProxy(jndiName + PROXY_FACTORY_NAME, interfaces, ProxyFactoryHelper.getClientBindUrl(binding));
try
{
Util.bind(container.getInitialContext(), jndiName + PROXY_FACTORY_NAME, factoryProxy);
Modified: trunk/ejb3/src/main/org/jboss/ejb3/stateless/StatelessClusterProxyFactory.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/stateless/StatelessClusterProxyFactory.java 2006-09-02 00:27:27 UTC (rev 56515)
+++ trunk/ejb3/src/main/org/jboss/ejb3/stateless/StatelessClusterProxyFactory.java 2006-09-02 00:34:30 UTC (rev 56516)
@@ -75,7 +75,7 @@
public void start() throws Exception
{
- String clientBindUrl = binding.clientBindUrl();
+ String clientBindUrl = ProxyFactoryHelper.getClientBindUrl(binding);
locator = new InvokerLocator(clientBindUrl);
Clustered clustered = (Clustered) advisor.resolveAnnotation(Clustered.class);
if (clustered == null) throw new RuntimeException("Could not find @Clustered annotation. Cannot deploy.");
Modified: trunk/ejb3/src/main/org/jboss/ejb3/stateless/StatelessRemoteProxyFactory.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/stateless/StatelessRemoteProxyFactory.java 2006-09-02 00:27:27 UTC (rev 56515)
+++ trunk/ejb3/src/main/org/jboss/ejb3/stateless/StatelessRemoteProxyFactory.java 2006-09-02 00:34:30 UTC (rev 56516)
@@ -21,7 +21,6 @@
*/
package org.jboss.ejb3.stateless;
-import java.lang.reflect.InvocationTargetException;
import javax.ejb.RemoteHome;
import javax.naming.NamingException;
import org.jboss.annotation.ejb.RemoteBinding;
@@ -76,7 +75,7 @@
public void init() throws Exception
{
super.init();
- String clientBindUrl = binding.clientBindUrl();
+ String clientBindUrl = ProxyFactoryHelper.getClientBindUrl(binding);
locator = new InvokerLocator(clientBindUrl);
}
Modified: trunk/ejb3/src/test/org/jboss/ejb3/test/stateless/CheckedStatelessBean.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/stateless/CheckedStatelessBean.java 2006-09-02 00:27:27 UTC (rev 56515)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/stateless/CheckedStatelessBean.java 2006-09-02 00:34:30 UTC (rev 56516)
@@ -28,6 +28,7 @@
import javax.ejb.Remote;
import javax.naming.NamingException;
import javax.annotation.security.RolesAllowed;
+import org.jboss.annotation.ejb.RemoteBinding;
import org.jboss.annotation.security.SecurityDomain;
import org.jboss.logging.Logger;
import org.jboss.annotation.security.SecurityDomain;
@@ -39,6 +40,7 @@
@Stateless
@SecurityDomain("other")
@Remote(CheckedStateless.class)
+ at RemoteBinding(jndiBinding="CheckedStatelessBean/remote")
public class CheckedStatelessBean implements CheckedStateless
{
private static final Logger log = Logger.getLogger(CheckedStatelessBean.class);
More information about the jboss-cvs-commits
mailing list