Author: julien(a)jboss.com
Date: 2007-08-22 16:01:52 -0400 (Wed, 22 Aug 2007)
New Revision: 8040
Added:
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/impl/jboss/jmx/
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/impl/jboss/jmx/MBeanServerFactory.java
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/impl/jboss/jmx/RemoteMBeanProxy.java
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/impl/jboss/jmx/RemoteMBeanServerAdapter.java
Removed:
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/jmx/
Modified:
modules/test/trunk/test/src/resources/jboss/portal-test-jar/org/jboss/portal/test/framework/container/http-runner-beans.xml
modules/test/trunk/test/src/resources/jboss/portal-test-jar/org/jboss/portal/test/framework/container/web-runner-beans.xml
Log:
moved the jboss as dependent classes to the impl/jboss package
Copied:
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/impl/jboss/jmx/MBeanServerFactory.java
(from rev 8025,
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/jmx/MBeanServerFactory.java)
===================================================================
---
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/impl/jboss/jmx/MBeanServerFactory.java
(rev 0)
+++
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/impl/jboss/jmx/MBeanServerFactory.java 2007-08-22
20:01:52 UTC (rev 8040)
@@ -0,0 +1,131 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt 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.portal.test.framework.impl.jboss.jmx;
+
+import javax.management.MBeanServer;
+import javax.management.MBeanServerConnection;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.util.Properties;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 5498 $
+ */
+public class MBeanServerFactory
+{
+
+ /** . */
+ private MBeanServer server;
+
+ /** . */
+ private Properties env;
+
+ public Properties getEnv()
+ {
+ return env;
+ }
+
+ public void setEnv(Properties env)
+ {
+ this.env = env;
+ }
+
+ public void create()
+ {
+ }
+
+ public void start() throws Exception
+ {
+ LazyMBeanServer lms = new LazyMBeanServer(env);
+ server = lms.getProxy();
+ }
+
+ public void stop()
+ {
+ server = null;
+ }
+
+ public void destroy()
+ {
+ }
+
+ public MBeanServer getServer() throws Exception
+ {
+ return server;
+ }
+
+ private static class LazyMBeanServer implements InvocationHandler
+ {
+
+ private Properties env;
+ private MBeanServerConnection remoteServer;
+ private MBeanServer proxy;
+
+ public LazyMBeanServer(Properties env)
+ {
+ this.env = env;
+ this.proxy =
(MBeanServer)Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), new
Class[]{MBeanServer.class}, this);
+ }
+
+ public MBeanServer getProxy()
+ {
+ return proxy;
+ }
+
+ public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
+ {
+ if (remoteServer == null)
+ {
+ InitialContext ctx = null;
+ try
+ {
+ ctx = new InitialContext(env);
+ MBeanServerConnection adaptor =
(MBeanServerConnection)ctx.lookup("jmx/invoker/RMIAdaptor");
+ remoteServer = new RemoteMBeanServerAdapter(adaptor).getServer();
+ }
+ finally
+ {
+ if (ctx != null)
+ {
+ try
+ {
+ ctx.close();
+ }
+ catch (NamingException ignore)
+ {
+ }
+ }
+ }
+ }
+ Method adaptedMethod = MBeanServerConnection.class.getMethod(method.getName(),
method.getParameterTypes());
+ return adaptedMethod.invoke(remoteServer, args);
+ }
+ }
+
+
+}
Property changes on:
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/impl/jboss/jmx/MBeanServerFactory.java
___________________________________________________________________
Name: svn:executable
+
Copied:
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/impl/jboss/jmx/RemoteMBeanProxy.java
(from rev 8025,
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/jmx/RemoteMBeanProxy.java)
===================================================================
---
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/impl/jboss/jmx/RemoteMBeanProxy.java
(rev 0)
+++
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/impl/jboss/jmx/RemoteMBeanProxy.java 2007-08-22
20:01:52 UTC (rev 8040)
@@ -0,0 +1,43 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt 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.portal.test.framework.impl.jboss.jmx;
+
+import org.jboss.mx.util.MBeanProxy;
+
+import javax.management.MBeanServer;
+import javax.management.MBeanServerConnection;
+import javax.management.ObjectName;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 5498 $
+ */
+public class RemoteMBeanProxy
+{
+ public static Object get(Class itf, ObjectName name, MBeanServerConnection
remoteServer) throws Exception
+ {
+ MBeanServer server = new RemoteMBeanServerAdapter(remoteServer).getServer();
+ return MBeanProxy.get(itf, name, server);
+ }
+}
Property changes on:
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/impl/jboss/jmx/RemoteMBeanProxy.java
___________________________________________________________________
Name: svn:executable
+
Copied:
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/impl/jboss/jmx/RemoteMBeanServerAdapter.java
(from rev 8025,
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/jmx/RemoteMBeanServerAdapter.java)
===================================================================
---
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/impl/jboss/jmx/RemoteMBeanServerAdapter.java
(rev 0)
+++
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/impl/jboss/jmx/RemoteMBeanServerAdapter.java 2007-08-22
20:01:52 UTC (rev 8040)
@@ -0,0 +1,58 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt 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.portal.test.framework.impl.jboss.jmx;
+
+import javax.management.MBeanServer;
+import javax.management.MBeanServerConnection;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 5498 $
+ */
+public class RemoteMBeanServerAdapter implements InvocationHandler
+{
+
+ private MBeanServerConnection remoteServer;
+ private MBeanServer adaptedServer;
+
+ public RemoteMBeanServerAdapter(MBeanServerConnection remoteServer)
+ {
+ this.remoteServer = remoteServer;
+ this.adaptedServer =
(MBeanServer)Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), new
Class[]{MBeanServer.class}, this);
+ }
+
+ public MBeanServer getServer()
+ {
+ return adaptedServer;
+ }
+
+ public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
+ {
+ Method adaptedMethod = MBeanServerConnection.class.getMethod(method.getName(),
method.getParameterTypes());
+ return adaptedMethod.invoke(remoteServer, args);
+ }
+}
Property changes on:
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/impl/jboss/jmx/RemoteMBeanServerAdapter.java
___________________________________________________________________
Name: svn:executable
+
Modified:
modules/test/trunk/test/src/resources/jboss/portal-test-jar/org/jboss/portal/test/framework/container/http-runner-beans.xml
===================================================================
---
modules/test/trunk/test/src/resources/jboss/portal-test-jar/org/jboss/portal/test/framework/container/http-runner-beans.xml 2007-08-22
20:00:59 UTC (rev 8039)
+++
modules/test/trunk/test/src/resources/jboss/portal-test-jar/org/jboss/portal/test/framework/container/http-runner-beans.xml 2007-08-22
20:01:52 UTC (rev 8040)
@@ -27,7 +27,7 @@
xsi:schemaLocation="urn:jboss:bean-deployer bean-deployer_1_0.xsd"
xmlns="urn:jboss:bean-deployer">
- <bean name="MBeanServerFactory0"
class="org.jboss.portal.test.framework.jmx.MBeanServerFactory">
+ <bean name="MBeanServerFactory0"
class="org.jboss.portal.test.framework.impl.jboss.jmx.MBeanServerFactory">
<property name="env">
<map class="java.util.Properties"
keyClass="java.lang.String" valueClass="java.lang.String">
<entry>
@@ -62,7 +62,7 @@
</constructor>
</bean>
- <bean name="MBeanServerFactory1"
class="org.jboss.portal.test.framework.jmx.MBeanServerFactory">
+ <bean name="MBeanServerFactory1"
class="org.jboss.portal.test.framework.impl.jboss.jmx.MBeanServerFactory">
<property name="env">
<map class="java.util.Properties"
keyClass="java.lang.String" valueClass="java.lang.String">
<entry>
@@ -97,7 +97,7 @@
</constructor>
</bean>
- <bean name="MBeanServerFactory2"
class="org.jboss.portal.test.framework.jmx.MBeanServerFactory">
+ <bean name="MBeanServerFactory2"
class="org.jboss.portal.test.framework.impl.jboss.jmx.MBeanServerFactory">
<property name="env">
<map class="java.util.Properties"
keyClass="java.lang.String" valueClass="java.lang.String">
<entry>
Modified:
modules/test/trunk/test/src/resources/jboss/portal-test-jar/org/jboss/portal/test/framework/container/web-runner-beans.xml
===================================================================
---
modules/test/trunk/test/src/resources/jboss/portal-test-jar/org/jboss/portal/test/framework/container/web-runner-beans.xml 2007-08-22
20:00:59 UTC (rev 8039)
+++
modules/test/trunk/test/src/resources/jboss/portal-test-jar/org/jboss/portal/test/framework/container/web-runner-beans.xml 2007-08-22
20:01:52 UTC (rev 8040)
@@ -27,7 +27,7 @@
xsi:schemaLocation="urn:jboss:bean-deployer bean-deployer_1_0.xsd"
xmlns="urn:jboss:bean-deployer">
- <bean name="MBeanServerFactory0"
class="org.jboss.portal.test.framework.jmx.MBeanServerFactory">
+ <bean name="MBeanServerFactory0"
class="org.jboss.portal.test.framework.impl.jboss.jmx.MBeanServerFactory">
<property name="env">
<map class="java.util.Properties"
keyClass="java.lang.String" valueClass="java.lang.String">
<entry>
@@ -62,7 +62,7 @@
</constructor>
</bean>
- <bean name="MBeanServerFactory1"
class="org.jboss.portal.test.framework.jmx.MBeanServerFactory">
+ <bean name="MBeanServerFactory1"
class="org.jboss.portal.test.framework.impl.jboss.jmx.MBeanServerFactory">
<property name="env">
<map class="java.util.Properties"
keyClass="java.lang.String" valueClass="java.lang.String">
<entry>
@@ -97,7 +97,7 @@
</constructor>
</bean>
- <bean name="MBeanServerFactory2"
class="org.jboss.portal.test.framework.jmx.MBeanServerFactory">
+ <bean name="MBeanServerFactory2"
class="org.jboss.portal.test.framework.impl.jboss.jmx.MBeanServerFactory">
<property name="env">
<map class="java.util.Properties"
keyClass="java.lang.String" valueClass="java.lang.String">
<entry>