dain 2004/01/21 22:39:24
Modified: modules/remoting project.xml
modules/remoting/src/java/org/apache/geronimo/remoting/jmx
MBeanServerStub.java
modules/remoting/src/java/org/apache/geronimo/remoting/router
AbstractInterceptorRouter.java
InterceptorRegistryRouter.java JMXRouter.java
SubsystemRouter.java
modules/remoting/src/java/org/apache/geronimo/remoting/transport
TransportLoader.java
Added: modules/remoting/src/test/org/apache/geronimo/remoting
StartupTest.java
Removed: modules/remoting/src/java/org/apache/geronimo/remoting/jmx
MBeanServerStub.xml
modules/remoting/src/java/org/apache/geronimo/remoting/router
InterceptorRegistryRouter.xml JMXRouter.xml
SubsystemRouter.xml
modules/remoting/src/java/org/apache/geronimo/remoting/transport
TransportLoader.xml
Log:
Added getGBeanInfo and a test to make sure remoting will start
Revision Changes Path
1.3 +9 -1 incubator-geronimo/modules/remoting/project.xml
Index: project.xml
===================================================================
RCS file: /home/cvs/incubator-geronimo/modules/remoting/project.xml,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- project.xml 16 Nov 2003 06:36:02 -0000 1.2
+++ project.xml 22 Jan 2004 06:39:23 -0000 1.3
@@ -92,6 +92,14 @@
</properties>
</dependency>
+ <dependency>
+ <id>cglib</id>
+ <version>HEAD-20031111</version>
+ <url>http://cglib.sf.net/</url>
+ <properties>
+ <runtime>true</runtime>
+ </properties>
+ </dependency>
</dependencies>
1.7 +19 -1
incubator-geronimo/modules/remoting/src/java/org/apache/geronimo/remoting/jmx/MBeanServerStub.java
Index: MBeanServerStub.java
===================================================================
RCS file:
/home/cvs/incubator-geronimo/modules/remoting/src/java/org/apache/geronimo/remoting/jmx/MBeanServerStub.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- MBeanServerStub.java 22 Jan 2004 03:53:32 -0000 1.6
+++ MBeanServerStub.java 22 Jan 2004 06:39:23 -0000 1.7
@@ -55,14 +55,20 @@
*/
package org.apache.geronimo.remoting.jmx;
+import java.util.Set;
+import java.util.HashSet;
+
import org.apache.geronimo.core.service.Interceptor;
import org.apache.geronimo.gbean.GBean;
import org.apache.geronimo.gbean.GBeanContext;
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GOperationInfo;
import org.apache.geronimo.gbean.jmx.GBeanMBeanContext;
import org.apache.geronimo.proxy.ProxyContainer;
import org.apache.geronimo.proxy.ReflexiveInterceptor;
import org.apache.geronimo.remoting.DeMarshalingInterceptor;
import org.apache.geronimo.remoting.router.JMXTarget;
+import org.apache.geronimo.remoting.router.AbstractInterceptorRouter;
/**
* @version $Revision$ $Date$
@@ -96,5 +102,17 @@
public void doFail() {
serverContainer = null;
demarshaller = null;
+ }
+
+ public static final GBeanInfo GBEAN_INFO;
+
+ static {
+ Set operations = new HashSet();
+ operations.add(new GOperationInfo("getRemotingEndpointInterceptor"));
+ GBEAN_INFO = new GBeanInfo(MBeanServerStub.class.getName(), null,
null, operations, null, null);
+ }
+
+ public static GBeanInfo getGBeanInfo() {
+ return GBEAN_INFO;
}
}
1.4 +19 -1
incubator-geronimo/modules/remoting/src/java/org/apache/geronimo/remoting/router/AbstractInterceptorRouter.java
Index: AbstractInterceptorRouter.java
===================================================================
RCS file:
/home/cvs/incubator-geronimo/modules/remoting/src/java/org/apache/geronimo/remoting/router/AbstractInterceptorRouter.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- AbstractInterceptorRouter.java 22 Jan 2004 03:53:32 -0000 1.3
+++ AbstractInterceptorRouter.java 22 Jan 2004 06:39:23 -0000 1.4
@@ -56,12 +56,17 @@
package org.apache.geronimo.remoting.router;
import java.net.URI;
+import java.util.Set;
+import java.util.HashSet;
import org.apache.geronimo.core.service.Interceptor;
import org.apache.geronimo.core.service.InvocationResult;
import org.apache.geronimo.core.service.SimpleInvocation;
import org.apache.geronimo.gbean.GBean;
import org.apache.geronimo.gbean.GBeanContext;
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GEndpointInfo;
+import org.apache.geronimo.gbean.GOperationInfo;
import org.apache.geronimo.gbean.jmx.GBeanMBeanContext;
import org.apache.geronimo.remoting.InvocationSupport;
import org.apache.geronimo.remoting.MarshalledObject;
@@ -152,5 +157,18 @@
public void doFail() {
// @todo do your best to clean up after a failure
+ }
+
+ public static final GBeanInfo GBEAN_INFO;
+
+ static {
+ Set operations = new HashSet();
+ operations.add(new GOperationInfo("sendRequest", new
String[]{"java.net.URI", "org.apache.geronimo.remoting.transport.Msg"}));
+ operations.add(new GOperationInfo("sendDatagram", new
String[]{"java.net.URI", "org.apache.geronimo.remoting.transport.Msg"}));
+ GBEAN_INFO = new
GBeanInfo(AbstractInterceptorRouter.class.getName(), null, null, operations,
null, null);
+ }
+
+ public static GBeanInfo getGBeanInfo() {
+ return GBEAN_INFO;
}
}
1.3 +24 -25
incubator-geronimo/modules/remoting/src/java/org/apache/geronimo/remoting/router/InterceptorRegistryRouter.java
Index: InterceptorRegistryRouter.java
===================================================================
RCS file:
/home/cvs/incubator-geronimo/modules/remoting/src/java/org/apache/geronimo/remoting/router/InterceptorRegistryRouter.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- InterceptorRegistryRouter.java 19 Nov 2003 11:30:51 -0000 1.2
+++ InterceptorRegistryRouter.java 22 Jan 2004 06:39:23 -0000 1.3
@@ -58,54 +58,53 @@
import java.net.URI;
import org.apache.geronimo.core.service.Interceptor;
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GBeanInfoFactory;
+import org.apache.geronimo.gbean.GEndpointInfo;
import org.apache.geronimo.remoting.InterceptorRegistry;
/**
* @version $Revision$ $Date$
*/
public class InterceptorRegistryRouter extends AbstractInterceptorRouter
implements Router {
+ private SubsystemRouter subsystemRouter;
- SubsystemRouter subsystemRouter;
-
- /**
- * @return Returns the subsystemRouter.
- */
public SubsystemRouter getSubsystemRouter() {
return subsystemRouter;
}
- /**
- * @param subsystemRouter The subsystemRouter to set.
- */
public void setSubsystemRouter(SubsystemRouter subsystemRouter) {
this.subsystemRouter = subsystemRouter;
}
- /**
- * @see
org.apache.geronimo.remoting.router.AbstractInterceptorRouter#lookupInterceptorFrom(java.net.URI)
- */
protected Interceptor lookupInterceptorFrom(URI to) throws Throwable {
- Long x = new Long(to.getFragment());
- return InterceptorRegistry.instance.lookup(x);
+ Long identifier = new Long(to.getFragment());
+ return InterceptorRegistry.instance.lookup(identifier);
}
-
- /**
- * @see
org.apache.geronimo.remoting.router.AbstractInterceptorRouter#doStart()
- */
+
public void doStart() {
- if(subsystemRouter!=null)
+ if (subsystemRouter != null) {
subsystemRouter.addRoute("/Remoting", this);
+ }
super.doStart();
}
-
- /**
- * @see
org.apache.geronimo.remoting.router.AbstractInterceptorRouter#doStop()
- */
+
public void doStop() {
super.doStop();
- if(subsystemRouter!=null)
+ if (subsystemRouter != null) {
subsystemRouter.removeRoute("/Remoting");
+ }
+ }
+
+ public static final GBeanInfo GBEAN_INFO;
+
+ static {
+ GBeanInfoFactory infoFactory = new
GBeanInfoFactory(InterceptorRegistryRouter.class.getName(),
AbstractInterceptorRouter.GBEAN_INFO);
+ infoFactory.addEndpoint(new GEndpointInfo("SubsystemRouter",
SubsystemRouter.class.getName()));
+ GBEAN_INFO = infoFactory.getBeanInfo();
}
-
+ public static GBeanInfo getGBeanInfo() {
+ return GBEAN_INFO;
+ }
}
1.5 +22 -9
incubator-geronimo/modules/remoting/src/java/org/apache/geronimo/remoting/router/JMXRouter.java
Index: JMXRouter.java
===================================================================
RCS file:
/home/cvs/incubator-geronimo/modules/remoting/src/java/org/apache/geronimo/remoting/router/JMXRouter.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- JMXRouter.java 22 Jan 2004 03:53:32 -0000 1.4
+++ JMXRouter.java 22 Jan 2004 06:39:23 -0000 1.5
@@ -56,27 +56,29 @@
package org.apache.geronimo.remoting.router;
import java.net.URI;
-
import javax.management.MalformedObjectNameException;
import javax.management.ObjectName;
import org.apache.geronimo.core.service.Interceptor;
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GBeanInfoFactory;
+import org.apache.geronimo.gbean.GEndpointInfo;
import org.apache.geronimo.kernel.jmx.MBeanProxyFactory;
/**
- * Uses JMX Object names to route the request to a JMX object that
implements the
+ * Uses JMX Object names to route the request to a JMX object that
implements the
* JMXTargetMBean interface.
- *
+ *
* This allows you to route invocations to MBeans using URIs like:
* async://localhost:3434/JMX#geronimo.jmx:target=MBeanServerStub
- *
+ *
* The MBean that will receive invocations must implement the JMXTarget
interface.
*
* @version $Revision$ $Date$
*/
public class JMXRouter extends AbstractInterceptorRouter {
private SubsystemRouter subsystemRouter;
-
+
public SubsystemRouter getSubsystemRouter() {
return subsystemRouter;
}
@@ -90,15 +92,26 @@
JMXTarget bean = (JMXTarget)
MBeanProxyFactory.getProxy(JMXTarget.class, context.getServer(), on);
return bean.getRemotingEndpointInterceptor();
}
-
+
public void doStart() {
subsystemRouter.addRoute("/JMX", this);
super.doStart();
}
-
+
public void doStop() {
super.doStop();
subsystemRouter.removeRoute("/JMX");
}
-
+
+ public static final GBeanInfo GBEAN_INFO;
+
+ static {
+ GBeanInfoFactory infoFactory = new
GBeanInfoFactory(JMXRouter.class.getName(),
AbstractInterceptorRouter.GBEAN_INFO);
+ infoFactory.addEndpoint(new GEndpointInfo("SubsystemRouter",
SubsystemRouter.class.getName()));
+ GBEAN_INFO = infoFactory.getBeanInfo();
+ }
+
+ public static GBeanInfo getGBeanInfo() {
+ return GBEAN_INFO;
+ }
}
1.3 +18 -1
incubator-geronimo/modules/remoting/src/java/org/apache/geronimo/remoting/router/SubsystemRouter.java
Index: SubsystemRouter.java
===================================================================
RCS file:
/home/cvs/incubator-geronimo/modules/remoting/src/java/org/apache/geronimo/remoting/router/SubsystemRouter.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- SubsystemRouter.java 22 Jan 2004 03:53:32 -0000 1.2
+++ SubsystemRouter.java 22 Jan 2004 06:39:23 -0000 1.3
@@ -62,6 +62,9 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GBeanInfoFactory;
+import org.apache.geronimo.gbean.GOperationInfo;
/**
* @version $Revision$ $Date$
@@ -90,5 +93,19 @@
public Router getRouter() {
return this;
+ }
+
+
+ public static final GBeanInfo GBEAN_INFO;
+
+ static {
+ GBeanInfoFactory infoFactory = new
GBeanInfoFactory(SubsystemRouter.class.getName(),
AbstractInterceptorRouter.GBEAN_INFO);
+ infoFactory.addOperation(new GOperationInfo("addRoute", new
String[]{"java.lang.String", "org.apache.geronimo.remoting.router.Router"}));
+ infoFactory.addOperation(new GOperationInfo("removeRoute", new
String[]{"java.lang.String"}));
+ GBEAN_INFO = infoFactory.getBeanInfo();
+ }
+
+ public static GBeanInfo getGBeanInfo() {
+ return GBEAN_INFO;
}
}
1.4 +21 -1
incubator-geronimo/modules/remoting/src/java/org/apache/geronimo/remoting/transport/TransportLoader.java
Index: TransportLoader.java
===================================================================
RCS file:
/home/cvs/incubator-geronimo/modules/remoting/src/java/org/apache/geronimo/remoting/transport/TransportLoader.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- TransportLoader.java 22 Jan 2004 03:53:32 -0000 1.3
+++ TransportLoader.java 22 Jan 2004 06:39:24 -0000 1.4
@@ -56,9 +56,14 @@
package org.apache.geronimo.remoting.transport;
import java.net.URI;
+import java.util.HashSet;
+import java.util.Set;
+import org.apache.geronimo.gbean.GAttributeInfo;
import org.apache.geronimo.gbean.GBean;
import org.apache.geronimo.gbean.GBeanContext;
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GEndpointInfo;
import org.apache.geronimo.remoting.router.Router;
/**
@@ -112,5 +117,20 @@
public void doFail() {
// @todo do your best to clean up after a failure
+ }
+
+ public static final GBeanInfo GBEAN_INFO;
+
+ static {
+ Set attributes = new HashSet();
+ attributes.add(new GAttributeInfo("ClientConnectURI"));
+ attributes.add(new GAttributeInfo("BindURI", true));
+ Set endpoints = new HashSet();
+ endpoints.add(new GEndpointInfo("Router",
"org.apache.geronimo.remoting.router.Router"));
+ GBEAN_INFO = new GBeanInfo(TransportLoader.class.getName(),
attributes, null, null, endpoints, null);
+ }
+
+ public static GBeanInfo getGBeanInfo() {
+ return GBEAN_INFO;
}
}
1.1
incubator-geronimo/modules/remoting/src/test/org/apache/geronimo/remoting/StartupTest.java
Index: StartupTest.java
===================================================================
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Geronimo" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache",
* "Apache Geronimo", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
* ====================================================================
*/
package org.apache.geronimo.remoting;
import java.net.URI;
import java.util.Collections;
import javax.management.ObjectName;
import org.apache.geronimo.gbean.jmx.GBeanMBean;
import org.apache.geronimo.kernel.Kernel;
import org.apache.geronimo.kernel.management.State;
import junit.framework.TestCase;
/**
*
*
* @version $Revision: 1.1 $ $Date: 2004/01/22 06:39:24 $
*/
public class StartupTest extends TestCase {
private Kernel kernel;
public void testLoad() throws Exception {
GBeanMBean gbean;
// Create all the parts
gbean = new
GBeanMBean("org.apache.geronimo.remoting.router.SubsystemRouter");
ObjectName subsystemRouter = new
ObjectName("geronimo.remoting:router=SubsystemRouter");
kernel.loadGBean(subsystemRouter, gbean);
gbean = new
GBeanMBean("org.apache.geronimo.remoting.transport.TransportLoader");
gbean.setAttribute("BindURI", new URI("async://0.0.0.0:3434"));
gbean.setEndpointPatterns("Router",
Collections.singleton(subsystemRouter));
ObjectName asyncTransport = new
ObjectName("geronimo.remoting:transport=async");
kernel.loadGBean(asyncTransport, gbean);
gbean = new
GBeanMBean("org.apache.geronimo.remoting.router.JMXRouter");
gbean.setEndpointPatterns("SubsystemRouter",
Collections.singleton(subsystemRouter));
ObjectName jmxRouter = new
ObjectName("geronimo.remoting:router=JMXRouter");
kernel.loadGBean(jmxRouter, gbean);
gbean = new
GBeanMBean("org.apache.geronimo.remoting.router.InterceptorRegistryRouter");
gbean.setEndpointPatterns("SubsystemRouter",
Collections.singleton(subsystemRouter));
ObjectName registeryRouter = new
ObjectName("geronimo.remoting:router=InterceptorRegistryRouter");
kernel.loadGBean(registeryRouter, gbean);
gbean = new
GBeanMBean("org.apache.geronimo.remoting.jmx.MBeanServerStub");
ObjectName serverStub = new
ObjectName("geronimo.remoting:target=MBeanServerStub");
kernel.loadGBean(serverStub, gbean);
// Start all the parts
kernel.startGBean(subsystemRouter);
kernel.startGBean(asyncTransport);
kernel.startGBean(jmxRouter);
kernel.startGBean(registeryRouter);
kernel.startGBean(serverStub);
// They should all be started now
assertEquals(new Integer(State.RUNNING_INDEX),
kernel.getMBeanServer().getAttribute(subsystemRouter, "state"));
assertEquals(new Integer(State.RUNNING_INDEX),
kernel.getMBeanServer().getAttribute(asyncTransport, "state"));
assertEquals(new Integer(State.RUNNING_INDEX),
kernel.getMBeanServer().getAttribute(jmxRouter, "state"));
assertEquals(new Integer(State.RUNNING_INDEX),
kernel.getMBeanServer().getAttribute(registeryRouter, "state"));
assertEquals(new Integer(State.RUNNING_INDEX),
kernel.getMBeanServer().getAttribute(serverStub, "state"));
kernel.stopGBean(subsystemRouter);
kernel.stopGBean(asyncTransport);
kernel.stopGBean(jmxRouter);
kernel.stopGBean(registeryRouter);
kernel.stopGBean(serverStub);
kernel.unloadGBean(subsystemRouter);
kernel.unloadGBean(asyncTransport);
kernel.unloadGBean(jmxRouter);
kernel.unloadGBean(registeryRouter);
kernel.unloadGBean(serverStub);
}
protected void setUp() throws Exception {
kernel = new Kernel("test");
kernel.boot();
}
protected void tearDown() throws Exception {
kernel.shutdown();
}
}