[jboss-cvs] JBossAS SVN: r104722 - in trunk: build and 24 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed May 12 08:57:12 EDT 2010
Author: smarlow at redhat.com
Date: 2010-05-12 08:57:10 -0400 (Wed, 12 May 2010)
New Revision: 104722
Added:
trunk/server/src/assembly/jmx-adaptor-plugin.xml
trunk/server/src/assembly/jmx-invoker-adaptor-client.xml
trunk/server/src/main/java/org/jboss/jmx/
trunk/server/src/main/java/org/jboss/jmx/adaptor/
trunk/server/src/main/java/org/jboss/jmx/adaptor/rmi/
trunk/server/src/main/java/org/jboss/jmx/adaptor/rmi/NotificationListenerDelegate.java
trunk/server/src/main/java/org/jboss/jmx/adaptor/rmi/RMIAdaptor.java
trunk/server/src/main/java/org/jboss/jmx/adaptor/rmi/RMIAdaptorExt.java
trunk/server/src/main/java/org/jboss/jmx/adaptor/rmi/RMINotificationListener.java
trunk/server/src/main/java/org/jboss/jmx/adaptor/rmi/RMIRemoteMBeanProxy.java
trunk/server/src/main/java/org/jboss/jmx/connector/
trunk/server/src/main/java/org/jboss/jmx/connector/invoker/
trunk/server/src/main/java/org/jboss/jmx/connector/invoker/AuthenticationInterceptor.java
trunk/server/src/main/java/org/jboss/jmx/connector/invoker/AuthorizationInterceptor.java
trunk/server/src/main/java/org/jboss/jmx/connector/invoker/ExternalizableRolesAuthorization.java
trunk/server/src/main/java/org/jboss/jmx/connector/invoker/InvokerAdaptorService.java
trunk/server/src/main/java/org/jboss/jmx/connector/invoker/InvokerAdaptorServiceMBean.java
trunk/server/src/main/java/org/jboss/jmx/connector/invoker/MBeanProxyRemote.java
trunk/server/src/main/java/org/jboss/jmx/connector/invoker/MBeanProxyRemoteMBean.java
trunk/server/src/main/java/org/jboss/jmx/connector/invoker/RolesAuthorization.java
trunk/server/src/main/java/org/jboss/jmx/connector/invoker/SecurityActions.java
trunk/server/src/main/java/org/jboss/jmx/connector/invoker/SerializableInterceptor.java
trunk/server/src/main/java/org/jboss/jmx/connector/invoker/SerializablePolicy.java
trunk/server/src/main/java/org/jboss/jmx/connector/invoker/client/
trunk/server/src/main/java/org/jboss/jmx/connector/invoker/client/InvokerAdaptorClientInterceptor.java
trunk/server/src/main/java/org/jboss/jmx/connector/invoker/client/InvokerAdaptorException.java
trunk/server/src/main/java/org/jboss/jmx/connector/invoker/serializablepolicy/
trunk/server/src/main/java/org/jboss/jmx/connector/invoker/serializablepolicy/StripModelMBeanInfoPolicy.java
trunk/server/src/main/java/org/jboss/jmx/package.html
trunk/server/src/resources/jmx-invoker-adaptor/
trunk/server/src/resources/jmx-invoker-adaptor/META-INF/
trunk/server/src/resources/jmx-invoker-adaptor/META-INF/jboss-service.xml
Modified:
trunk/build/build.xml
trunk/client/pom.xml
trunk/depchain/pom.xml
trunk/pom.xml
trunk/server/pom.xml
trunk/testsuite/src/resources/hello/META-INF/jboss.xml
trunk/testsuite/src/resources/jmx/interceptors/jboss-service.xml
trunk/testsuite/src/resources/jmx/invokerproxy/META-INF/jboss-service.xml
trunk/testsuite/src/resources/jmx/jmxadaptor/authorization-jmx-invoker-service.xml
trunk/testsuite/src/resources/jmx/jmxadaptor/securejmx-invoker-service.xml
trunk/testsuite/src/resources/jrmp/META-INF/jboss.xml
trunk/testsuite/src/resources/naming/services/jboss-service.xml
trunk/testsuite/src/resources/profileservice/override/profileservice-remove-ds.xml
trunk/testsuite/src/resources/profileservice/persistence/testbindings-jboss-beans.xml
trunk/varia/src/resources/deployment/resources/standardwl.xml
Log:
JBAS-7563 Remove JRMPInvoker and JRMPInvokerHA. Bring interceptor stack back in. switch from jrmp to unified. fix unit test regressions
Modified: trunk/build/build.xml
===================================================================
--- trunk/build/build.xml 2010-05-12 12:55:16 UTC (rev 104721)
+++ trunk/build/build.xml 2010-05-12 12:57:10 UTC (rev 104722)
@@ -891,12 +891,18 @@
<copy file="${server.module.output}/jboss-as-server-jboss.jar"
tofile="${install.common.lib}/jboss.jar" filtering="no"/>
+ <copy file="${server.module.output}/jboss-as-server-jmx-adaptor-plugin.jar"
+ tofile="${install.common.lib}/jmx-adaptor-plugin.jar" filtering="no"/>
+
<!-- Copy the generated client libraries -->
<mkdir dir="${install.client}"/>
<copy file="${server.module.output}/jboss-as-server-client.jar"
tofile="${install.client}/jboss-client.jar" filtering="no"/>
+ <copy file="${server.module.output}/jboss-as-server-jmx-invoker-adaptor-client.jar"
+ tofile="${install.client}/jmx-invoker-adaptor-client.jar" filtering="no"/>
+
<!-- Copy the generated scripts & runnable jars -->
<mkdir dir="${install.bin}"/>
<copy todir="${install.bin}" filtering="no">
Modified: trunk/client/pom.xml
===================================================================
--- trunk/client/pom.xml 2010-05-12 12:55:16 UTC (rev 104721)
+++ trunk/client/pom.xml 2010-05-12 12:57:10 UTC (rev 104722)
@@ -412,8 +412,15 @@
</dependency>
<!-- jmx-client.jar -->
-
+
<dependency>
+ <groupId>org.jboss.jbossas</groupId>
+ <artifactId>jboss-as-server</artifactId>
+ <classifier>jmx-invoker-adaptor-client</classifier>
+ </dependency>
+
+
+ <dependency>
<groupId>org.jboss.naming</groupId>
<artifactId>jnp-client</artifactId>
</dependency>
Modified: trunk/depchain/pom.xml
===================================================================
--- trunk/depchain/pom.xml 2010-05-12 12:55:16 UTC (rev 104721)
+++ trunk/depchain/pom.xml 2010-05-12 12:57:10 UTC (rev 104722)
@@ -209,6 +209,12 @@
</dependency>
<dependency>
<groupId>org.jboss.jbossas</groupId>
+ <artifactId>jboss-as-server</artifactId>
+ <classifier>jmx-adaptor-plugin</classifier>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.jbossas</groupId>
<artifactId>jboss-as-system</artifactId>
<version>${project.version}</version>
</dependency>
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2010-05-12 12:55:16 UTC (rev 104721)
+++ trunk/pom.xml 2010-05-12 12:57:10 UTC (rev 104722)
@@ -410,6 +410,18 @@
</dependency>
<dependency>
<groupId>org.jboss.jbossas</groupId>
+ <artifactId>jboss-as-server</artifactId>
+ <version>${project.version}</version>
+ <classifier>jmx-adaptor-plugin</classifier>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.jbossas</groupId>
+ <artifactId>jboss-as-server</artifactId>
+ <version>${project.version}</version>
+ <classifier>jmx-invoker-adaptor-client</classifier>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.jbossas</groupId>
<artifactId>jboss-as-system</artifactId>
<version>${project.version}</version>
</dependency>
Modified: trunk/server/pom.xml
===================================================================
--- trunk/server/pom.xml 2010-05-12 12:55:16 UTC (rev 104721)
+++ trunk/server/pom.xml 2010-05-12 12:57:10 UTC (rev 104722)
@@ -92,6 +92,8 @@
<descriptor>src/assembly/client.xml</descriptor>
<descriptor>src/assembly/jboss.xml</descriptor>
<descriptor>src/assembly/jboss-minimal.xml</descriptor>
+ <descriptor>src/assembly/jmx-adaptor-plugin.xml</descriptor>
+ <descriptor>src/assembly/jmx-invoker-adaptor-client.xml</descriptor>
</descriptors>
</configuration>
</execution>
Added: trunk/server/src/assembly/jmx-adaptor-plugin.xml
===================================================================
--- trunk/server/src/assembly/jmx-adaptor-plugin.xml (rev 0)
+++ trunk/server/src/assembly/jmx-adaptor-plugin.xml 2010-05-12 12:57:10 UTC (rev 104722)
@@ -0,0 +1,16 @@
+<assembly>
+ <id>jmx-adaptor-plugin</id>
+ <formats>
+ <format>jar</format>
+ </formats>
+ <includeBaseDirectory>false</includeBaseDirectory>
+ <fileSets>
+ <fileSet>
+ <directory>target/classes</directory>
+ <outputDirectory>/</outputDirectory>
+ <includes>
+ <include>org/jboss/jmx/**</include>
+ </includes>
+ </fileSet>
+ </fileSets>
+</assembly>
Added: trunk/server/src/assembly/jmx-invoker-adaptor-client.xml
===================================================================
--- trunk/server/src/assembly/jmx-invoker-adaptor-client.xml (rev 0)
+++ trunk/server/src/assembly/jmx-invoker-adaptor-client.xml 2010-05-12 12:57:10 UTC (rev 104722)
@@ -0,0 +1,19 @@
+<assembly>
+ <id>jmx-invoker-adaptor-client</id>
+ <formats>
+ <format>jar</format>
+ </formats>
+ <includeBaseDirectory>false</includeBaseDirectory>
+ <fileSets>
+ <fileSet>
+ <directory>target/classes</directory>
+ <outputDirectory>/</outputDirectory>
+ <includes>
+ <include>org/jboss/jmx/adaptor/rmi/RMIAdaptor*</include>
+ <include>org/jboss/jmx/adaptor/rmi/RMINotificationListener*</include>
+ <include>org/jboss/jmx/connector/invoker/client/**</include>
+ </includes>
+ </fileSet>
+ </fileSets>
+</assembly>
+
Added: trunk/server/src/main/java/org/jboss/jmx/adaptor/rmi/NotificationListenerDelegate.java
===================================================================
--- trunk/server/src/main/java/org/jboss/jmx/adaptor/rmi/NotificationListenerDelegate.java (rev 0)
+++ trunk/server/src/main/java/org/jboss/jmx/adaptor/rmi/NotificationListenerDelegate.java 2010-05-12 12:57:10 UTC (rev 104722)
@@ -0,0 +1,57 @@
+/*
+ * 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.jmx.adaptor.rmi;
+
+import javax.management.Notification;
+import javax.management.NotificationListener;
+import org.jboss.logging.Logger;
+
+/**
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public class NotificationListenerDelegate
+ implements NotificationListener
+{
+ private static Logger log = Logger.getLogger(NotificationListenerDelegate.class);
+ /** */
+ private RMINotificationListener client;
+
+ public NotificationListenerDelegate(RMINotificationListener client)
+ {
+ this.client = client;
+ }
+
+ public void handleNotification(Notification notification,
+ Object handback)
+ {
+ try
+ {
+ log.info("Sending notification to client, event:"+notification);
+ client.handleNotification(notification, handback);
+ }
+ catch(Throwable t)
+ {
+ log.warn("Failed to notify client", t);
+ }
+ }
+}
Added: trunk/server/src/main/java/org/jboss/jmx/adaptor/rmi/RMIAdaptor.java
===================================================================
--- trunk/server/src/main/java/org/jboss/jmx/adaptor/rmi/RMIAdaptor.java (rev 0)
+++ trunk/server/src/main/java/org/jboss/jmx/adaptor/rmi/RMIAdaptor.java 2010-05-12 12:57:10 UTC (rev 104722)
@@ -0,0 +1,74 @@
+/*
+ * 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.jmx.adaptor.rmi;
+
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+
+import javax.management.ObjectName;
+import javax.management.NotificationFilter;
+import javax.management.InstanceNotFoundException;
+import javax.management.ListenerNotFoundException;
+import javax.management.MBeanServerConnection;
+
+/**
+ * RMI Interface for the server side Connector which
+ * is nearly the same as the MBeanServer Interface but
+ * has an additional RemoteException.
+ *
+ * @version <tt>$Revision$</tt>
+ * @author <a href="mailto:rickard.oberg at telkel.com">Rickard Oberg</a>
+ * @author <A href="mailto:andreas at jboss.org">Andreas Schaefer</A>
+ * @author <a href="mailto:jason at planet57.com">Jason Dillon</a>
+ */
+public interface RMIAdaptor
+ extends Remote, MBeanServerConnection
+{
+ /**
+ *
+ * @param name
+ * @param listener
+ * @param filter
+ * @param handback
+ * @throws InstanceNotFoundException
+ * @throws RemoteException
+ */
+ void addNotificationListener(ObjectName name,
+ RMINotificationListener listener,
+ NotificationFilter filter,
+ Object handback)
+ throws InstanceNotFoundException,
+ RemoteException;
+
+ /**
+ *
+ * @param name
+ * @param listener
+ * @throws InstanceNotFoundException
+ * @throws ListenerNotFoundException
+ * @throws RemoteException
+ */
+ void removeNotificationListener(ObjectName name, RMINotificationListener listener)
+ throws InstanceNotFoundException,
+ ListenerNotFoundException,
+ RemoteException;
+}
Added: trunk/server/src/main/java/org/jboss/jmx/adaptor/rmi/RMIAdaptorExt.java
===================================================================
--- trunk/server/src/main/java/org/jboss/jmx/adaptor/rmi/RMIAdaptorExt.java (rev 0)
+++ trunk/server/src/main/java/org/jboss/jmx/adaptor/rmi/RMIAdaptorExt.java 2010-05-12 12:57:10 UTC (rev 104722)
@@ -0,0 +1,70 @@
+/*
+ * 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.jmx.adaptor.rmi;
+
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+import javax.management.ObjectName;
+import javax.management.NotificationFilter;
+import javax.management.InstanceNotFoundException;
+import javax.management.ListenerNotFoundException;
+import javax.management.MBeanServerConnection;
+
+/** An RMI interface extension of the standard MBeanServerConnection
+ *
+ * @see javax.management.MBeanServerConnection
+ *
+ * @version $Revision$
+ * @author Scott.Stark at jboss.org
+ */
+public interface RMIAdaptorExt
+ extends Remote, MBeanServerConnection
+{
+ /**
+ *
+ * @param name
+ * @param listener
+ * @param filter
+ * @param handback
+ * @throws InstanceNotFoundException
+ * @throws RemoteException
+ */
+ void addNotificationListener(ObjectName name,
+ RMINotificationListener listener,
+ NotificationFilter filter,
+ Object handback)
+ throws InstanceNotFoundException,
+ RemoteException;
+
+ /**
+ *
+ * @param name
+ * @param listener
+ * @throws InstanceNotFoundException
+ * @throws ListenerNotFoundException
+ * @throws RemoteException
+ */
+ void removeNotificationListener(ObjectName name, RMINotificationListener listener)
+ throws InstanceNotFoundException,
+ ListenerNotFoundException,
+ RemoteException;
+}
Added: trunk/server/src/main/java/org/jboss/jmx/adaptor/rmi/RMINotificationListener.java
===================================================================
--- trunk/server/src/main/java/org/jboss/jmx/adaptor/rmi/RMINotificationListener.java (rev 0)
+++ trunk/server/src/main/java/org/jboss/jmx/adaptor/rmi/RMINotificationListener.java 2010-05-12 12:57:10 UTC (rev 104722)
@@ -0,0 +1,37 @@
+/*
+ * 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.jmx.adaptor.rmi;
+
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+import javax.management.Notification;
+
+/** An RMIfied version of the javax.management.NotificationListener.
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public interface RMINotificationListener extends Remote
+{
+ public void handleNotification(Notification notification, Object handback)
+ throws RemoteException;
+}
Added: trunk/server/src/main/java/org/jboss/jmx/adaptor/rmi/RMIRemoteMBeanProxy.java
===================================================================
--- trunk/server/src/main/java/org/jboss/jmx/adaptor/rmi/RMIRemoteMBeanProxy.java (rev 0)
+++ trunk/server/src/main/java/org/jboss/jmx/adaptor/rmi/RMIRemoteMBeanProxy.java 2010-05-12 12:57:10 UTC (rev 104722)
@@ -0,0 +1,158 @@
+/*
+ * 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.jmx.adaptor.rmi;
+
+import java.io.Serializable;
+import java.lang.reflect.InvocationHandler;
+import javax.management.ObjectName;
+import javax.naming.InitialContext;
+
+
+/**
+ * A factory for producing MBean proxies that run on a distant node and access
+ * the server through RMI. Most of the code comes from MBeanProxy.
+ *
+ * @version <tt>$Revision$</tt>
+ * @author <a href="mailto:sacha.labourey at cogito-info.ch">Sacha Labourey</a>.
+ */
+public class RMIRemoteMBeanProxy
+ implements Serializable, InvocationHandler
+{
+ /** The server to proxy invoke calls to. */
+ private final RMIAdaptor remoteServer;
+
+ /** The name of the object to invoke. */
+ private final ObjectName name;
+
+ /**
+ * Construct a MBeanProxy.
+ */
+
+ RMIRemoteMBeanProxy (final ObjectName name, final javax.management.MBeanServer server) throws Exception
+ {
+ this.name = name;
+ this.remoteServer = getRmiAdaptor ();
+ }
+
+ /** Used when args is null. */
+ private static final Object EMPTY_ARGS[] = {};
+
+ /**
+ * Invoke the configured MBean via the target MBeanServer and decode
+ * any resulting JMX exceptions that are thrown.
+ */
+ public Object invoke (final Object proxy, final java.lang.reflect.Method method, final Object[] args) throws Throwable
+ {
+ String methodName = method.getName();
+
+ // Get attribute
+ if (methodName.startsWith("get") && args == null)
+ {
+ String attrName = methodName.substring(3);
+ return remoteServer.getAttribute(name, attrName);
+ }
+
+ // Is attribute
+ else if (methodName.startsWith("is") && args == null)
+ {
+ String attrName = methodName.substring(2);
+ return remoteServer.getAttribute(name, attrName);
+ }
+
+ // Set attribute
+ else if (methodName.startsWith("set") && args != null && args.length == 1)
+ {
+ String attrName = methodName.substring(3);
+ remoteServer.setAttribute(name, new javax.management.Attribute(attrName, args[0]));
+ return null;
+ }
+
+ // Operation
+
+ // convert the parameter types to strings for JMX
+ Class[] types = method.getParameterTypes();
+ String[] sig = new String[types.length];
+ for (int i = 0; i < types.length; i++) {
+ sig[i] = types[i].getName();
+ }
+
+ // invoke the server and decode JMX exceptions
+ return remoteServer.invoke(name, methodName, args == null ? EMPTY_ARGS : args, sig);
+ }
+
+ protected RMIAdaptor getRmiAdaptor () throws Exception
+ {
+ InitialContext ctx = new InitialContext();
+ return (RMIAdaptor) ctx.lookup("jmx/invoker/RMIAdaptor");
+ }
+
+
+ ///////////////////////////////////////////////////////////////////////////
+ // MBeanProxyInstance //
+ ///////////////////////////////////////////////////////////////////////////
+
+ public final ObjectName getMBeanProxyObjectName()
+ {
+ return name;
+ }
+
+ public final RMIAdaptor getMBeanProxyRMIAdaptor()
+ {
+ return remoteServer;
+ }
+
+
+ ///////////////////////////////////////////////////////////////////////////
+ // Factory Methods //
+ ///////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Create an MBean proxy.
+ *
+ * @param intf The interface which the proxy will implement.
+ * @param name A string used to construct the ObjectName of the
+ * MBean to proxy to.
+ * @param server The MBeanServer that contains the MBean to proxy to.
+ * @return A MBean proxy.
+ *
+ * @throws Exception Invalid object name.
+ */
+ public static Object create (final Class intf, final String name, final javax.management.MBeanServer server) throws Exception
+ {
+ return create(intf, new ObjectName(name), server);
+ }
+
+ /**
+ * Create an MBean proxy.
+ *
+ * @param intf The interface which the proxy will implement.
+ * @param name The name of the MBean to proxy invocations to.
+ * @param server The MBeanServer that contains the MBean to proxy to.
+ * @return A MBean proxy.
+ */
+ public static Object create (final Class intf, final ObjectName name, final javax.management.MBeanServer server) throws Exception
+ {
+ return java.lang.reflect.Proxy.newProxyInstance(Thread.currentThread ().getContextClassLoader (),
+ new Class[] { intf },
+ new RMIRemoteMBeanProxy(name, server));
+ }
+}
Added: trunk/server/src/main/java/org/jboss/jmx/connector/invoker/AuthenticationInterceptor.java
===================================================================
--- trunk/server/src/main/java/org/jboss/jmx/connector/invoker/AuthenticationInterceptor.java (rev 0)
+++ trunk/server/src/main/java/org/jboss/jmx/connector/invoker/AuthenticationInterceptor.java 2010-05-12 12:57:10 UTC (rev 104722)
@@ -0,0 +1,133 @@
+/*
+ * 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.jmx.connector.invoker;
+
+import java.security.Principal;
+
+import javax.naming.InitialContext;
+import javax.security.auth.Subject;
+
+import org.jboss.mx.interceptor.AbstractInterceptor;
+import org.jboss.mx.interceptor.Interceptor;
+import org.jboss.mx.server.Invocation;
+import org.jboss.security.SecurityConstants;
+import org.jboss.security.SecurityContext;
+import org.jboss.security.SubjectSecurityManager;
+
+/** A security interceptor that requires an authorized user for invoke(Invocation)
+ * operation calls when the SecurityDomain and SecurityMgr attributes are
+ * specified. Access to attributes and the MBeanInfo are not intercepted.
+ *
+ * @see Interceptor
+ *
+ * @author <a href="mailto:juha at jboss.org">Juha Lindfors</a>.
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ *
+ */
+public final class AuthenticationInterceptor extends AbstractInterceptor
+{
+ private SubjectSecurityManager securityMgr;
+
+ private String securityDomain;
+
+ private boolean initialized = false;
+
+ public void setSecurityDomain(String securityDomain) throws Exception
+ {
+ this.securityDomain = securityDomain;
+ }
+
+ /**
+ *
+ * @param invocation
+ * @return
+ * @throws Throwable
+ */
+ public Object invoke(Invocation invocation) throws Throwable
+ {
+ SecurityContext previousSC = null;
+ String type = invocation.getType();
+ Subject subject = null;
+ if (!initialized)
+ initialize();
+ if (type == Invocation.OP_INVOKE && securityMgr != null)
+ {
+ String opName = invocation.getName();
+ if (opName.equals("invoke"))
+ {
+ Object[] args = invocation.getArgs();
+ org.jboss.invocation.Invocation inv = (org.jboss.invocation.Invocation) args[0];
+ // Authenticate the caller based on the security association
+ Principal caller = inv.getPrincipal();
+ Object credential = inv.getCredential();
+ subject = new Subject();
+ boolean isValid = securityMgr.isValid(caller, credential, subject);
+ if (isValid == false)
+ {
+ String msg = "Failed to authenticate principal=" + caller + ", securityDomain="
+ + securityMgr.getSecurityDomain();
+ throw new SecurityException(msg);
+
+ }
+ String securityDomain = SecurityConstants.DEFAULT_APPLICATION_POLICY;
+ if (securityMgr != null)
+ securityDomain = securityMgr.getSecurityDomain();
+ // store current security context
+ previousSC = SecurityActions.getSecurityContext();
+ SecurityContext sc = SecurityActions.createSecurityContext(securityDomain);
+ SecurityActions.setSecurityContext(sc);
+ // Push the caller security context
+ SecurityActions.pushSubjectContext(caller, credential, subject);
+ }
+ }
+
+ try
+ {
+ Interceptor i = invocation.nextInterceptor();
+ return i.invoke(invocation);
+ }
+ finally
+ {
+ // restore previous security context
+ if (subject != null)
+ SecurityActions.setSecurityContext(previousSC);
+ }
+ }
+
+ private void initialize()
+ {
+ try
+ {
+ InitialContext ctx = new InitialContext();
+ securityMgr = (SubjectSecurityManager) ctx.lookup(securityDomain);
+ }
+ catch (Exception e)
+ {
+
+ }
+ if (securityMgr == null)
+ log.warn("Unable to locate security domain " + securityDomain
+ + ". The AuthenticationInterceptor will have no effect");
+ initialized = true;
+ }
+}
Added: trunk/server/src/main/java/org/jboss/jmx/connector/invoker/AuthorizationInterceptor.java
===================================================================
--- trunk/server/src/main/java/org/jboss/jmx/connector/invoker/AuthorizationInterceptor.java (rev 0)
+++ trunk/server/src/main/java/org/jboss/jmx/connector/invoker/AuthorizationInterceptor.java 2010-05-12 12:57:10 UTC (rev 104722)
@@ -0,0 +1,167 @@
+/*
+ * 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.jmx.connector.invoker;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.UndeclaredThrowableException;
+import java.security.Principal;
+import javax.management.ObjectName;
+import javax.security.auth.Subject;
+
+import org.jboss.mx.interceptor.AbstractInterceptor;
+import org.jboss.mx.interceptor.Interceptor;
+import org.jboss.mx.server.Invocation;
+
+/**
+ * An Interceptor that aids in providing Authorization to JMX Invocations
+ * at an MBean Operations level. This must be placed after the
+ * AuthenticationInterceptor to ensure a valid caller context exists
+ *
+ * String msg = "Define your own class which has a method authorize with signature";
+ msg += "public void authorize( Principal caller, Subject subject,
+ String objectname,String opname)";
+ msg += ". And replace " + azclassname + " its name";
+
+ * @see AuthenticationInterceptor
+ *
+ * @author <mailto:Anil.Saldhana at jboss.org>Anil Saldhana
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public class AuthorizationInterceptor extends AbstractInterceptor
+{
+ private Object authenticator = null;
+ private Method authorize;
+
+ public AuthorizationInterceptor()
+ {
+ super();
+ // Install the default
+ try
+ {
+ setAuthorizingClass(RolesAuthorization.class);
+ }
+ catch(Exception e)
+ {
+ // Can't happen
+ }
+ }
+
+ /**
+ * The Authorizing class must have a method called
+ * public Boolean authorize( Principal caller, String mbean,String opname )
+ *
+ * @param clazz
+ */
+ public void setAuthorizingClass(Class clazz)
+ throws Exception
+ {
+ authenticator = clazz.newInstance();
+ log.debug("Loaded authenticator: "+authenticator);
+ Class[] sig = {Principal.class, Subject.class, String.class, String.class};
+ authorize = clazz.getMethod("authorize", sig);
+ log.debug("Found authorize(Principal, Subject, String, String)");
+ }
+
+ /**
+ * Intercept the invoke(Invocation) operations
+ * @param invocation
+ * @return
+ * @throws Throwable
+ */
+ public Object invoke(Invocation invocation) throws Throwable
+ {
+ String type = invocation.getType();
+ if (type == Invocation.OP_INVOKE)
+ {
+ String opName = invocation.getName();
+ if (opName.equals("invoke"))
+ {
+ Object[] args = invocation.getArgs();
+ org.jboss.invocation.Invocation inv = (org.jboss.invocation.Invocation) args[0];
+ // Authenticate the caller based on the security association
+ Principal caller = inv.getPrincipal();
+ //Get the Method Name
+ Object[] obj = inv.getArguments();
+ //Ignore calls like MBeanCount or getMBeanInfo
+ if(obj != null && obj.length > 1)
+ {
+ ObjectName objname = (ObjectName) obj[0];
+ String opname = (String) obj[1];
+
+ try
+ {
+ checkAuthorization(caller, objname.getCanonicalName(), opname);
+ }
+ catch(SecurityException e)
+ {
+ throw e;
+ }
+ catch(Exception e)
+ {
+ String msg = "Failed to authorize principal=" + caller
+ + ",MBean=" + objname + ", Operation=" + opname;
+ SecurityException ex = new SecurityException(msg);
+ ex.initCause(e);
+ throw ex;
+ }
+ }
+ }
+ }
+
+ Interceptor i = invocation.nextInterceptor();
+ return i.invoke(invocation);
+ }
+
+ /**
+ * Method that delegates authorization to the custom class
+ *
+ * @param caller
+ * @param objname
+ * @param opname
+ * @throws Exception - A SecurityException on authorization failure
+ */
+ private void checkAuthorization(Principal caller, String objname, String opname)
+ throws Exception
+ {
+ // Get the active Subject
+ Subject subject = SecurityActions.getActiveSubject();
+ if( subject == null )
+ throw new SecurityException("No active Subject found, add th AuthenticationInterceptor");
+
+ //We will try to use the authorizing class
+ try
+ {
+ Object[] args = {caller, subject, objname, opname};
+ authorize.invoke(authenticator, args);
+ }
+ catch(InvocationTargetException e)
+ {
+ Throwable t = e.getTargetException();
+ if( t instanceof Exception )
+ throw (Exception) t;
+ else
+ throw new UndeclaredThrowableException(t);
+ }
+ }
+}
Added: trunk/server/src/main/java/org/jboss/jmx/connector/invoker/ExternalizableRolesAuthorization.java
===================================================================
--- trunk/server/src/main/java/org/jboss/jmx/connector/invoker/ExternalizableRolesAuthorization.java (rev 0)
+++ trunk/server/src/main/java/org/jboss/jmx/connector/invoker/ExternalizableRolesAuthorization.java 2010-05-12 12:57:10 UTC (rev 104722)
@@ -0,0 +1,88 @@
+/*
+ * 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.jmx.connector.invoker;
+
+import java.util.HashSet;
+import java.util.Properties;
+import java.util.StringTokenizer;
+
+import org.jboss.logging.Logger;
+import org.jboss.security.SimplePrincipal;
+
+//$Id$
+
+/**
+ * JBAS-3203: Delegate for Authorization Interceptor for RMIAdaptor should have roles configurable
+ * Authorization Delegate used by the AuthorizationInterceptor
+ * that gets its predefined roles from a properties file
+ * @see org.jboss.jmx.connector.invoker.AuthorizationInterceptor
+ * @author <a href="mailto:Anil.Saldhana at jboss.org">Anil Saldhana</a>
+ * @since May 10, 2006
+ * @version $Revision$
+ */
+public class ExternalizableRolesAuthorization extends RolesAuthorization
+{
+ private static Logger log = Logger.getLogger(ExternalizableRolesAuthorization.class);
+ private boolean trace = log.isTraceEnabled();
+
+ public ExternalizableRolesAuthorization()
+ {
+ //Load the roles from a properties file
+ Properties props = new Properties();
+ try
+ {
+ props.load(getTCL().getResourceAsStream("jmxinvoker-roles.properties"));
+ this.setRequiredRoles(getSetOfRoles(props.getProperty("roles")));
+ }
+ catch (Exception e)
+ {
+ log.error("Error reading roles from jmxinvoker-roles.properties:",e);
+ }
+ }
+
+ /**
+ * Get a HashSet of roles as SimplePrincipal
+ *
+ * @param assignedRoles a comma seperated list of roles
+ * @return
+ */
+ private HashSet getSetOfRoles(String assignedRoles)
+ {
+ if(trace)
+ log.trace("AssignedRolesString="+assignedRoles);
+ HashSet set = new HashSet();
+ StringTokenizer st = new StringTokenizer(assignedRoles,",");
+ while(st.hasMoreTokens())
+ {
+ String aRole = st.nextToken();
+ set.add(new SimplePrincipal(aRole));
+ }
+ if(trace)
+ log.trace("roles set="+set);
+ return set;
+ }
+
+ private ClassLoader getTCL()
+ {
+ return Thread.currentThread().getContextClassLoader();
+ }
+}
Added: trunk/server/src/main/java/org/jboss/jmx/connector/invoker/InvokerAdaptorService.java
===================================================================
--- trunk/server/src/main/java/org/jboss/jmx/connector/invoker/InvokerAdaptorService.java (rev 0)
+++ trunk/server/src/main/java/org/jboss/jmx/connector/invoker/InvokerAdaptorService.java 2010-05-12 12:57:10 UTC (rev 104722)
@@ -0,0 +1,365 @@
+/*
+ * 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.jmx.connector.invoker;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.UndeclaredThrowableException;
+import java.rmi.RemoteException;
+import java.security.Principal;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+
+import javax.management.InstanceNotFoundException;
+import javax.management.ListenerNotFoundException;
+import javax.management.MBeanServer;
+import javax.management.Notification;
+import javax.management.NotificationFilter;
+import javax.management.NotificationListener;
+import javax.management.ObjectName;
+
+import org.jboss.invocation.Invocation;
+import org.jboss.invocation.MarshalledInvocation;
+import org.jboss.jmx.adaptor.rmi.RMINotificationListener;
+import org.jboss.jmx.connector.invoker.client.InvokerAdaptorException;
+import org.jboss.security.SecurityConstants;
+import org.jboss.security.SecurityContext;
+import org.jboss.system.Registry;
+import org.jboss.system.ServiceMBeanSupport;
+
+/**
+ * A JBoss service exposes an invoke(Invocation) operation that maps
+ * calls to the ExposedInterface onto the MBeanServer this service
+ * is registered with. It is used in conjunction with a proxy factory
+ * to expose the MBeanServer to remote clients through arbitrary
+ * protocols.<p>
+ *
+ * It sets up the correct classloader before unmarshalling the
+ * arguments, this relies on the ObjectName being seperate from
+ * from the other method arguments to avoid unmarshalling them
+ * before the classloader is determined from the ObjectName.<p>
+ *
+ * The interface is configurable, it must be similar to MBeanServer,
+ * though not necessarily derived from it<p>
+ *
+ * The invoker is configurable and must be specified
+ *
+ * @author <a href="mailto:Adrian.Brock at HappeningTimes.com">Adrian Brock</a>
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ *
+ * @jmx:mbean name="jboss.jmx:type=adaptor,protocol=INVOKER"
+ * extends="org.jboss.system.ServiceMBean"
+ **/
+public class InvokerAdaptorService
+ extends ServiceMBeanSupport
+ implements InvokerAdaptorServiceMBean
+{
+ /** */
+ private Map marshalledInvocationMapping = new HashMap();
+ /** */
+ private Class[] exportedInterfaces;
+ /** A HashSet<Method> addNotificationListener methods */
+ private HashSet addNotificationListeners = new HashSet();
+ /** A HashSet<Method> removeNotificationListener methods */
+ private HashSet removeNotificationListeners = new HashSet();
+ /** A HashSet<RMINotificationListener, NotificationListenerDelegate> for the
+ registered listeners */
+ protected HashMap remoteListeners = new HashMap();
+
+ public InvokerAdaptorService()
+ {
+ }
+
+ /**
+ * @jmx:managed-attribute
+ */
+ public Class[] getExportedInterfaces()
+ {
+ return exportedInterfaces;
+ }
+ /**
+ * @jmx:managed-attribute
+ */
+ public void setExportedInterfaces(Class[] exportedInterfaces)
+ {
+ this.exportedInterfaces = exportedInterfaces;
+ }
+
+ protected void startService()
+ throws Exception
+ {
+ // Build the interface method map
+ HashMap tmpMap = new HashMap(61);
+ for(int n = 0; n < exportedInterfaces.length; n ++)
+ {
+ Class iface = exportedInterfaces[n];
+ Method[] methods = iface.getMethods();
+ for(int m = 0; m < methods.length; m ++)
+ {
+ Method method = methods[m];
+ Long hash = new Long(MarshalledInvocation.calculateHash(method));
+ tmpMap.put(hash, method);
+ }
+ /* Look for a void addNotificationListener(ObjectName name,
+ RMINotificationListener listener, NotificationFilter filter,
+ Object handback)
+ */
+ try
+ {
+ Class[] sig = {ObjectName.class, RMINotificationListener.class,
+ NotificationFilter.class, Object.class};
+ Method addNotificationListener = iface.getMethod(
+ "addNotificationListener", sig);
+ addNotificationListeners.add(addNotificationListener);
+ }
+ catch(Exception e)
+ {
+ log.debug(iface+"No addNotificationListener(ObjectName, RMINotificationListener)");
+ }
+
+ /* Look for a void removeNotificationListener(ObjectName,
+ RMINotificationListener)
+ */
+ try
+ {
+ Class[] sig = {ObjectName.class, RMINotificationListener.class};
+ Method removeNotificationListener = iface.getMethod(
+ "removeNotificationListener", sig);
+ removeNotificationListeners.add(removeNotificationListener);
+ }
+ catch(Exception e)
+ {
+ log.debug(iface+"No removeNotificationListener(ObjectName, RMINotificationListener)");
+ }
+ }
+ marshalledInvocationMapping = Collections.unmodifiableMap(tmpMap);
+
+ // Place our ObjectName hash into the Registry so invokers can resolve it
+ Registry.bind(new Integer(serviceName.hashCode()), serviceName);
+ }
+
+ protected void stopService()
+ throws Exception
+ {
+ // Remove the method hashses
+ if( exportedInterfaces != null )
+ {
+ for(int n = 0; n < exportedInterfaces.length; n ++)
+ MarshalledInvocation.removeHashes(exportedInterfaces[n]);
+ }
+ marshalledInvocationMapping = null;
+ remoteListeners.clear();
+ Registry.unbind(new Integer(serviceName.hashCode()));
+ }
+
+ /**
+ * Expose the service interface mapping as a read-only attribute
+ *
+ * @jmx:managed-attribute
+ *
+ * @return A Map<Long hash, Method> of the MBeanServer
+ */
+ public Map getMethodMap()
+ {
+ return marshalledInvocationMapping;
+ }
+
+ /**
+ * Expose the MBeanServer service via JMX to invokers.
+ *
+ * @jmx:managed-operation
+ *
+ * @param invocation A pointer to the invocation object
+ * @return Return value of method invocation.
+ *
+ * @throws Exception Failed to invoke method.
+ */
+ public Object invoke(Invocation invocation)
+ throws Exception
+ {
+ try
+ {
+ // Make sure we have the correct classloader before unmarshalling
+ ClassLoader oldCL = SecurityActions.getContextClassLoader();
+
+ ClassLoader newCL = null;
+ // Get the MBean this operation applies to
+ ObjectName objectName = (ObjectName) invocation.getValue("JMX_OBJECT_NAME");
+ if (objectName != null)
+ {
+ newCL = server.getClassLoaderFor(objectName);
+ }
+
+ if (newCL != null && newCL != oldCL)
+ SecurityActions.setContextClassLoader(newCL);
+
+ //JBAS-6449: Cache the incoming security context to be retained on exit
+ SecurityContext previousSecurityContext = SecurityActions.getSecurityContext();
+
+ try
+ {
+ // Set the method hash to Method mapping
+ if (invocation instanceof MarshalledInvocation)
+ {
+ MarshalledInvocation mi = (MarshalledInvocation) invocation;
+ mi.setMethodMap(marshalledInvocationMapping);
+ }
+ // Invoke the MBeanServer method via reflection
+ Method method = invocation.getMethod();
+ Object[] args = invocation.getArguments();
+ Principal principal = invocation.getPrincipal();
+ Object credential = invocation.getCredential();
+ Object value = null;
+ SecurityContext sc = SecurityActions.createSecurityContext(SecurityConstants.DEFAULT_APPLICATION_POLICY);
+ SecurityActions.setSecurityContext(sc);
+ // Associate the method
+ SecurityActions.pushSubjectContext(principal, credential, null);
+
+ try
+ {
+ if( addNotificationListeners.contains(method) )
+ {
+ ObjectName name = (ObjectName) args[0];
+ RMINotificationListener listener = (RMINotificationListener)
+ args[1];
+ NotificationFilter filter = (NotificationFilter) args[2];
+ Object handback = args[3];
+ addNotificationListener(name, listener, filter, handback);
+ }
+ else if( removeNotificationListeners.contains(method) )
+ {
+ ObjectName name = (ObjectName) args[0];
+ RMINotificationListener listener = (RMINotificationListener)
+ args[1];
+ removeNotificationListener(name, listener);
+ }
+ else
+ {
+ String name = method.getName();
+ Class[] paramTypes = method.getParameterTypes();
+ Method mbeanServerMethod = MBeanServer.class.getMethod(name,
+ paramTypes);
+ value = mbeanServerMethod.invoke(server, args);
+ }
+ }
+ catch(InvocationTargetException e)
+ {
+ Throwable t = e.getTargetException();
+ if( t instanceof Exception )
+ throw (Exception) t;
+ else
+ throw new UndeclaredThrowableException(t, method.toString());
+ }
+
+ return value;
+ }
+ finally
+ {
+ // Restore the input security context
+ SecurityActions.popSubjectContext();
+ if(previousSecurityContext != null)
+ SecurityActions.setSecurityContext(previousSecurityContext);
+ else
+ SecurityActions.clearSecurityContext();
+ // Restore the input class loader
+ if (newCL != null && newCL != oldCL)
+ SecurityActions.setContextClassLoader(oldCL);
+ }
+ }
+ catch (Throwable t)
+ {
+ throw new InvokerAdaptorException(t);
+ }
+ }
+
+ public void addNotificationListener(ObjectName name,
+ RMINotificationListener listener, NotificationFilter filter,
+ Object handback)
+ throws InstanceNotFoundException, RemoteException
+ {
+ if( log.isTraceEnabled() )
+ log.trace("addNotificationListener, name="+name+", listener="+listener);
+ NotificationListenerDelegate delegate =
+ new NotificationListenerDelegate(listener, name);
+ remoteListeners.put(listener, delegate);
+ getServer().addNotificationListener(name, delegate, filter, handback);
+ }
+
+ public void removeNotificationListener(ObjectName name,
+ RMINotificationListener listener)
+ throws InstanceNotFoundException, ListenerNotFoundException,
+ RemoteException
+ {
+ if( log.isTraceEnabled() )
+ log.trace("removeNotificationListener, name="+name+", listener="+listener);
+ NotificationListenerDelegate delegate = (NotificationListenerDelegate)
+ remoteListeners.remove(listener);
+ if( delegate == null )
+ throw new ListenerNotFoundException("No listener matches: "+listener);
+ getServer().removeNotificationListener(name, delegate);
+ }
+
+ private class NotificationListenerDelegate
+ implements NotificationListener
+ {
+ /** The remote client */
+ private RMINotificationListener client;
+ /** The mbean the client is monitoring */
+ private ObjectName targetName;
+
+ public NotificationListenerDelegate(RMINotificationListener client,
+ ObjectName targetName)
+ {
+ this.client = client;
+ this.targetName = targetName;
+ }
+
+ public void handleNotification(Notification notification,
+ Object handback)
+ {
+ try
+ {
+ if( log.isTraceEnabled() )
+ {
+ log.trace("Sending notification to client, event:"+notification);
+ }
+ client.handleNotification(notification, handback);
+ }
+ catch(Throwable t)
+ {
+ log.debug("Failed to notify client, unregistering listener", t);
+ try
+ {
+ removeNotificationListener(targetName, client);
+ }
+ catch(Exception e)
+ {
+ log.debug("Failed to unregister listener", e);
+ }
+ }
+ }
+ }
+
+}
Added: trunk/server/src/main/java/org/jboss/jmx/connector/invoker/InvokerAdaptorServiceMBean.java
===================================================================
--- trunk/server/src/main/java/org/jboss/jmx/connector/invoker/InvokerAdaptorServiceMBean.java (rev 0)
+++ trunk/server/src/main/java/org/jboss/jmx/connector/invoker/InvokerAdaptorServiceMBean.java 2010-05-12 12:57:10 UTC (rev 104722)
@@ -0,0 +1,48 @@
+/*
+ * 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.jmx.connector.invoker;
+
+/**
+ * MBean interface.
+ */
+public interface InvokerAdaptorServiceMBean extends org.jboss.system.ServiceMBean {
+
+ //default object name
+ public static final javax.management.ObjectName OBJECT_NAME = org.jboss.mx.util.ObjectNameFactory.create("jboss.jmx:type=adaptor,protocol=INVOKER");
+
+ java.lang.Class[] getExportedInterfaces() ;
+
+ void setExportedInterfaces(java.lang.Class[] exportedInterfaces) ;
+
+ /**
+ * Expose the service interface mapping as a read-only attribute
+ * @return A Map<Long hash, Method> of the MBeanServer */
+ java.util.Map getMethodMap() ;
+
+ /**
+ * Expose the MBeanServer service via JMX to invokers.
+ * @param invocation A pointer to the invocation object
+ * @return Return value of method invocation.
+ * @throws Exception Failed to invoke method. */
+ java.lang.Object invoke(org.jboss.invocation.Invocation invocation) throws java.lang.Exception;
+
+}
Added: trunk/server/src/main/java/org/jboss/jmx/connector/invoker/MBeanProxyRemote.java
===================================================================
--- trunk/server/src/main/java/org/jboss/jmx/connector/invoker/MBeanProxyRemote.java (rev 0)
+++ trunk/server/src/main/java/org/jboss/jmx/connector/invoker/MBeanProxyRemote.java 2010-05-12 12:57:10 UTC (rev 104722)
@@ -0,0 +1,77 @@
+/*
+ * 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.jmx.connector.invoker;
+
+import javax.management.MBeanServerConnection;
+import javax.management.ObjectName;
+
+import org.jboss.deployment.DeploymentException;
+import org.jboss.mx.util.MBeanProxyExt;
+import org.jboss.system.ServiceMBeanSupport;
+
+/**
+ * MBeanProxyRemote.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision$
+ */
+public class MBeanProxyRemote extends ServiceMBeanSupport implements MBeanProxyRemoteMBean
+{
+ /** The mbeanServer connection */
+ private ObjectName mbeanServerConnection;
+
+ /**
+ * Get the mbeanServerConnection.
+ *
+ * @return the mbeanServerConnection.
+ */
+ public ObjectName getMBeanServerConnection()
+ {
+ return mbeanServerConnection;
+ }
+
+ /**
+ * Set the mbeanServerConnection.
+ *
+ * @param mbeanServerConnection the mbeanServerConnection.
+ */
+ public void setMBeanServerConnection(ObjectName mbeanServerConnection)
+ {
+ this.mbeanServerConnection = mbeanServerConnection;
+ }
+
+ protected void startService() throws Exception
+ {
+ if (MBeanProxyExt.remote != null)
+ throw new IllegalStateException("Remote MBeanServerConnection is already set " + MBeanProxyExt.remote);
+
+ Object o = server.getAttribute(mbeanServerConnection, "Proxy");
+ if (o instanceof MBeanServerConnection == false)
+ throw new DeploymentException(mbeanServerConnection + " does not define an MBeanServerConnection");
+ MBeanProxyExt.remote = (MBeanServerConnection) o;
+ }
+
+ protected void stopService() throws Exception
+ {
+ MBeanProxyExt.remote = null;
+ }
+}
Added: trunk/server/src/main/java/org/jboss/jmx/connector/invoker/MBeanProxyRemoteMBean.java
===================================================================
--- trunk/server/src/main/java/org/jboss/jmx/connector/invoker/MBeanProxyRemoteMBean.java (rev 0)
+++ trunk/server/src/main/java/org/jboss/jmx/connector/invoker/MBeanProxyRemoteMBean.java 2010-05-12 12:57:10 UTC (rev 104722)
@@ -0,0 +1,49 @@
+/*
+ * 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.jmx.connector.invoker;
+
+import javax.management.ObjectName;
+
+import org.jboss.system.ServiceMBean;
+
+/**
+ * MBeanProxyRemoteMBean.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision$
+ */
+public interface MBeanProxyRemoteMBean extends ServiceMBean
+{
+ /**
+ * Get the mbeanServerConnection.
+ *
+ * @return the mbeanServerConnection.
+ */
+ ObjectName getMBeanServerConnection();
+
+ /**
+ * Set the mbeanServerConnection.
+ *
+ * @param mbeanServerConnection the mbeanServerConnection.
+ */
+ void setMBeanServerConnection(ObjectName mbeanServerConnection);
+}
Added: trunk/server/src/main/java/org/jboss/jmx/connector/invoker/RolesAuthorization.java
===================================================================
--- trunk/server/src/main/java/org/jboss/jmx/connector/invoker/RolesAuthorization.java (rev 0)
+++ trunk/server/src/main/java/org/jboss/jmx/connector/invoker/RolesAuthorization.java 2010-05-12 12:57:10 UTC (rev 104722)
@@ -0,0 +1,85 @@
+/*
+ * 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.jmx.connector.invoker;
+
+import java.util.HashSet;
+import java.util.Set;
+import java.util.Iterator;
+import java.security.Principal;
+import java.security.acl.Group;
+
+import javax.security.auth.Subject;
+
+import org.jboss.security.SimplePrincipal;
+
+/** A default authorization delegate used by the AuthorizationInterceptor. This
+ * looks for a hard coded JBossAdmin role in the current authenticated Subject.
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public class RolesAuthorization
+{
+ private HashSet requiredRoles = new HashSet();
+
+ public RolesAuthorization()
+ {
+ requiredRoles.add(new SimplePrincipal("JBossAdmin"));
+ }
+ public void setRequiredRoles(HashSet requiredRoles)
+ {
+ this.requiredRoles = requiredRoles;
+ }
+ public void authorize(Principal caller, Subject subject,
+ String objectname, String opname)
+ {
+ Set groups = subject.getPrincipals(Group.class);
+ Group roles = null;
+ Iterator iter = groups.iterator();
+ while( iter.hasNext() )
+ {
+ Group grp = (Group) iter.next();
+ if( grp.getName().equals("Roles") )
+ {
+ roles = grp;
+ break;
+ }
+ }
+ if( roles == null )
+ {
+ throw new SecurityException("Subject has no Roles");
+ }
+
+ iter = requiredRoles.iterator();
+ boolean hasRole = false;
+ while( iter.hasNext() && hasRole == false )
+ {
+ Principal p = (Principal) iter.next();
+ hasRole = roles.isMember(p);
+ }
+ if( hasRole == false )
+ {
+ throw new SecurityException("Authorization failure, requiredRoles="+requiredRoles
+ +", callerRoles="+roles);
+ }
+ }
+}
Added: trunk/server/src/main/java/org/jboss/jmx/connector/invoker/SecurityActions.java
===================================================================
--- trunk/server/src/main/java/org/jboss/jmx/connector/invoker/SecurityActions.java (rev 0)
+++ trunk/server/src/main/java/org/jboss/jmx/connector/invoker/SecurityActions.java 2010-05-12 12:57:10 UTC (rev 104722)
@@ -0,0 +1,234 @@
+/*
+ * 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.jmx.connector.invoker;
+
+import java.security.AccessController;
+import java.security.Principal;
+import java.security.PrivilegedAction;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
+
+import javax.security.auth.Subject;
+
+import org.jboss.security.SecurityAssociation;
+import org.jboss.security.SecurityContext;
+import org.jboss.security.SecurityContextFactory;
+import org.jboss.security.SecurityContextAssociation;
+
+/** Common PrivilegedAction used by classes in this package.
+ *
+ * @author Scott.Stark at jboss.org
+ * @author Anil.Saldhana at redhat.com
+ * @version $Revison:$
+ */
+class SecurityActions
+{
+ private static class GetSubjectAction implements PrivilegedAction
+ {
+ static PrivilegedAction ACTION = new GetSubjectAction();
+ public Object run()
+ {
+ Subject subject = SecurityAssociation.getSubject();
+ return subject;
+ }
+ }
+ private static class GetTCLAction implements PrivilegedAction
+ {
+ static PrivilegedAction ACTION = new GetTCLAction();
+ public Object run()
+ {
+ ClassLoader loader = Thread.currentThread().getContextClassLoader();
+ return loader;
+ }
+ }
+ private static class SetTCLAction implements PrivilegedAction
+ {
+ ClassLoader loader;
+ SetTCLAction(ClassLoader loader)
+ {
+ this.loader = loader;
+ }
+ public Object run()
+ {
+ Thread.currentThread().setContextClassLoader(loader);
+ loader = null;
+ return null;
+ }
+ }
+ interface PrincipalInfoAction
+ {
+ PrincipalInfoAction PRIVILEGED = new PrincipalInfoAction()
+ {
+ public void push(final Principal principal, final Object credential,
+ final Subject subject)
+ {
+ AccessController.doPrivileged(
+ new PrivilegedAction()
+ {
+ public Object run()
+ {
+ //SecurityAssociation.pushSubjectContext(subject, principal, credential);
+ getSecurityContext().getUtil().createSubjectInfo(principal, credential, subject);
+ return null;
+ }
+ }
+ );
+ }
+ public void pop()
+ {
+ AccessController.doPrivileged(
+ new PrivilegedAction()
+ {
+ public Object run()
+ {
+ //SecurityAssociation.popSubjectContext();
+ SecurityContext sc = getSecurityContext();
+ if(sc != null)
+ {
+ sc.getUtil().createSubjectInfo(null, null, null);
+ }
+ return null;
+ }
+ }
+ );
+ }
+ };
+
+ PrincipalInfoAction NON_PRIVILEGED = new PrincipalInfoAction()
+ {
+ public void push(Principal principal, Object credential, Subject subject)
+ {
+ //SecurityAssociation.pushSubjectContext(subject, principal, credential);
+ getSecurityContext().getUtil().createSubjectInfo(principal, credential, subject);
+ }
+ public void pop()
+ {
+ //SecurityAssociation.popSubjectContext();
+ SecurityContext sc = getSecurityContext();
+ if(sc != null)
+ {
+ sc.getUtil().createSubjectInfo(null, null, null);
+ }
+ }
+ };
+
+ void push(Principal principal, Object credential, Subject subject);
+ void pop();
+ }
+
+ static class SetSecurityContextAction implements PrivilegedAction
+ {
+ private SecurityContext securityContext;
+
+ SetSecurityContextAction(SecurityContext sc)
+ {
+ this.securityContext = sc;
+ }
+
+ public Object run()
+ {
+ SecurityContextAssociation.setSecurityContext(securityContext);
+ return null;
+ }
+ }
+
+ static Subject getActiveSubject()
+ {
+ Subject subject = (Subject) AccessController.doPrivileged(GetSubjectAction.ACTION);
+ return subject;
+ }
+ static ClassLoader getContextClassLoader()
+ {
+ ClassLoader loader = (ClassLoader) AccessController.doPrivileged(GetTCLAction.ACTION);
+ return loader;
+ }
+ static void setContextClassLoader(ClassLoader loader)
+ {
+ PrivilegedAction action = new SetTCLAction(loader);
+ AccessController.doPrivileged(action);
+ }
+
+ static void pushSubjectContext(Principal principal, Object credential,
+ Subject subject)
+ {
+ if(System.getSecurityManager() == null)
+ {
+ PrincipalInfoAction.NON_PRIVILEGED.push(principal, credential, subject);
+ }
+ else
+ {
+ PrincipalInfoAction.PRIVILEGED.push(principal, credential, subject);
+ }
+ }
+ static void popSubjectContext()
+ {
+ if(System.getSecurityManager() == null)
+ {
+ PrincipalInfoAction.NON_PRIVILEGED.pop();
+ }
+ else
+ {
+ PrincipalInfoAction.PRIVILEGED.pop();
+ }
+ }
+
+ static SecurityContext createSecurityContext(final String domain)
+ throws PrivilegedActionException
+ {
+ return (SecurityContext)AccessController.doPrivileged( new PrivilegedExceptionAction()
+ {
+
+ public Object run() throws Exception
+ {
+ return SecurityContextFactory.createSecurityContext(domain);
+ }});
+ }
+
+ static SecurityContext getSecurityContext()
+ {
+ return (SecurityContext)AccessController.doPrivileged( new PrivilegedAction()
+ {
+
+ public Object run()
+ {
+ return SecurityContextAssociation.getSecurityContext();
+ }});
+ }
+
+
+ static void clearSecurityContext()
+ {
+ AccessController.doPrivileged(new PrivilegedAction(){
+
+ public Object run()
+ {
+ SecurityContextAssociation.clearSecurityContext();
+ return null;
+ }});
+ }
+
+ static void setSecurityContext(SecurityContext sc)
+ {
+ SetSecurityContextAction action = new SetSecurityContextAction(sc);
+ AccessController.doPrivileged(action);
+ }
+}
Added: trunk/server/src/main/java/org/jboss/jmx/connector/invoker/SerializableInterceptor.java
===================================================================
--- trunk/server/src/main/java/org/jboss/jmx/connector/invoker/SerializableInterceptor.java (rev 0)
+++ trunk/server/src/main/java/org/jboss/jmx/connector/invoker/SerializableInterceptor.java 2010-05-12 12:57:10 UTC (rev 104722)
@@ -0,0 +1,100 @@
+/*
+ * 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.jmx.connector.invoker;
+
+import org.jboss.invocation.MarshalledInvocation;
+import org.jboss.mx.interceptor.AbstractInterceptor;
+import org.jboss.mx.server.Invocation;
+
+/**
+ * An interceptor that validates the Serializability of responses,
+ * using plugable policies.
+ *
+ * @author <a href="mailto:dimitris at jboss.org">Dimitris Andreadis</a>
+ * @author <a href="mailto:fabcipriano at yahoo.com.br">Fabiano C. de Oliveira</a>
+ * @version $Revision$
+ */
+public class SerializableInterceptor extends AbstractInterceptor
+{
+ /** The plugable policy to use */
+ private SerializablePolicy policy = new NoopPolicy();
+
+ /**
+ * Configure a SerializablePolicy class
+ */
+ public void setPolicyClass(String policyClass) throws Exception
+ {
+ try
+ {
+ // try to load the policy Class
+ Class clazz = Thread.currentThread().getContextClassLoader().loadClass(policyClass);
+ policy = (SerializablePolicy)clazz.newInstance();
+ }
+ catch (Exception e) // ClassNotFoundException, IllegalAccessException, InstantiationException
+ {
+ // policy class not found. Make a second try using
+ // the 'org.jboss.jmx.connector.invoker.serializablepolicy.' package prefix
+ // for the "standard" reponse policies provided with jboss.
+ // If that fails, too, rethrow the original exception.
+ try
+ {
+ policyClass = "org.jboss.jmx.connector.invoker.serializablepolicy." + policyClass;
+ Class clazz = Thread.currentThread().getContextClassLoader().loadClass(policyClass);
+ policy = (SerializablePolicy)clazz.newInstance();
+ }
+ catch (Exception inner)
+ {
+ throw e;
+ }
+ }
+ }
+
+ public Object invoke(Invocation invocation) throws Throwable
+ {
+ // Invoke the next in the sequence
+ Object result = invocation.nextInterceptor().invoke(invocation);
+
+ // If the invocation was an 'invoke(MarshalledInvocation)'
+ // filter the result using the plugable policy
+ if ("invoke".equals(invocation.getName()))
+ {
+ Object[] args = invocation.getArgs();
+ if ((args.length == 1) && (args[0] instanceof MarshalledInvocation))
+ {
+ MarshalledInvocation mi = (MarshalledInvocation) args[0];
+ result = policy.filter(mi, result);
+ }
+ }
+ return result;
+ }
+
+ /**
+ * A noop serializable policy
+ */
+ public class NoopPolicy implements SerializablePolicy
+ {
+ public Object filter(MarshalledInvocation input, Object result) throws Throwable
+ {
+ return result;
+ }
+ }
+}
Added: trunk/server/src/main/java/org/jboss/jmx/connector/invoker/SerializablePolicy.java
===================================================================
--- trunk/server/src/main/java/org/jboss/jmx/connector/invoker/SerializablePolicy.java (rev 0)
+++ trunk/server/src/main/java/org/jboss/jmx/connector/invoker/SerializablePolicy.java 2010-05-12 12:57:10 UTC (rev 104722)
@@ -0,0 +1,36 @@
+/*
+ * 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.jmx.connector.invoker;
+
+import org.jboss.invocation.MarshalledInvocation;
+
+/**
+ * A serializable policy that filters results to avoid Serialization problems.
+ *
+ * @author <a href="mailto:dimitris at jboss.org">Dimitris Andreadis</a>
+ * @author <a href="mailto:fabcipriano at yahoo.com.br">Fabiano C. de Oliveira</a>
+ * @version $Revision$
+ */
+public interface SerializablePolicy
+{
+ public Object filter(MarshalledInvocation input, Object result) throws Throwable;
+}
Added: trunk/server/src/main/java/org/jboss/jmx/connector/invoker/client/InvokerAdaptorClientInterceptor.java
===================================================================
--- trunk/server/src/main/java/org/jboss/jmx/connector/invoker/client/InvokerAdaptorClientInterceptor.java (rev 0)
+++ trunk/server/src/main/java/org/jboss/jmx/connector/invoker/client/InvokerAdaptorClientInterceptor.java 2010-05-12 12:57:10 UTC (rev 104722)
@@ -0,0 +1,100 @@
+/*
+ * 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.jmx.connector.invoker.client;
+
+import org.jboss.invocation.Invocation;
+import org.jboss.invocation.PayloadKey;
+import org.jboss.proxy.Interceptor;
+
+import javax.management.ObjectName;
+
+/**
+* An Interceptor that plucks the object name out of the arguments
+* into an unmarshalled part of the payload.
+*
+* @author <a href="mailto:adrian.brock at happeningtimes.com">Adrian Brock</a>
+* @version $Revision$
+*/
+public class InvokerAdaptorClientInterceptor
+ extends Interceptor
+{
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ public InvokerAdaptorClientInterceptor()
+ {
+ // For externalization to work
+ }
+
+ // Public --------------------------------------------------------
+
+ /**
+ * Invoke using the invoker for remote invocations
+ */
+ public Object invoke(Invocation invocation)
+ throws Throwable
+ {
+ // Retrieve any relevent object name for this invocation
+ ObjectName objectName = getObjectNameFromArguments(invocation);
+ if (objectName != null)
+ invocation.setValue("JMX_OBJECT_NAME", objectName, PayloadKey.AS_IS);
+
+ try
+ {
+ return getNext().invoke(invocation);
+ }
+ catch (InvokerAdaptorException e)
+ {
+ throw e.getWrapped();
+ }
+ }
+
+ /**
+ * Return any target object name relevent for this invocation.<p>
+ *
+ * Methods that don't pass arguments that could be custom classes are ignored.<p>
+ *
+ * Classloading and registerMBean are ignored,
+ * they shouldn't be available remotely
+ */
+ public ObjectName getObjectNameFromArguments(Invocation invocation)
+ {
+ String method = invocation.getMethod().getName();
+ if (method.equals("invoke") ||
+ method.equals("setAttribute") ||
+ method.equals("setAttributes") ||
+ method.equals("addNotificationListener") ||
+ method.equals("removeNotificationListener"))
+ {
+ return (ObjectName) invocation.getArguments()[0];
+ }
+
+ return null;
+ }
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+}
Added: trunk/server/src/main/java/org/jboss/jmx/connector/invoker/client/InvokerAdaptorException.java
===================================================================
--- trunk/server/src/main/java/org/jboss/jmx/connector/invoker/client/InvokerAdaptorException.java (rev 0)
+++ trunk/server/src/main/java/org/jboss/jmx/connector/invoker/client/InvokerAdaptorException.java 2010-05-12 12:57:10 UTC (rev 104722)
@@ -0,0 +1,66 @@
+/*
+ * 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.jmx.connector.invoker.client;
+
+import java.io.Serializable;
+
+/**
+ * An exception for holding jmx exception so the invokers
+ * don't unwrap them.
+ *
+ * @author <a href="mailto:adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision$
+ */
+public class InvokerAdaptorException extends Exception implements Serializable
+{
+ // Constants -----------------------------------------------------
+
+ private static final long serialVersionUID = 24842201105890823L;
+
+ // Attributes ----------------------------------------------------
+
+ /** The wrapped exception */
+ private Throwable wrapped;
+
+ // Constructors --------------------------------------------------
+
+ public InvokerAdaptorException()
+ {
+ // For serialization
+ }
+
+ public InvokerAdaptorException(Throwable wrapped)
+ {
+ this.wrapped = wrapped;
+ }
+
+ // Public --------------------------------------------------------
+
+ public Throwable getWrapped()
+ {
+ return wrapped;
+ }
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+}
Added: trunk/server/src/main/java/org/jboss/jmx/connector/invoker/serializablepolicy/StripModelMBeanInfoPolicy.java
===================================================================
--- trunk/server/src/main/java/org/jboss/jmx/connector/invoker/serializablepolicy/StripModelMBeanInfoPolicy.java (rev 0)
+++ trunk/server/src/main/java/org/jboss/jmx/connector/invoker/serializablepolicy/StripModelMBeanInfoPolicy.java 2010-05-12 12:57:10 UTC (rev 104722)
@@ -0,0 +1,73 @@
+/*
+ * 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.jmx.connector.invoker.serializablepolicy;
+
+import javax.management.MBeanAttributeInfo;
+import javax.management.MBeanInfo;
+import javax.management.modelmbean.ModelMBeanInfo;
+
+import org.jboss.invocation.MarshalledInvocation;
+import org.jboss.jmx.connector.invoker.SerializablePolicy;
+
+/**
+ * A policy that converts ModelMBeanInfo to MBeanInfo.
+ *
+ * @author <a href="mailto:dimitris at jboss.org">Dimitris Andreadis</a>
+ * @author <a href="mailto:fabcipriano at yahoo.com.br">Fabiano C. de Oliveira</a>
+ * @version $Revision$
+ */
+public class StripModelMBeanInfoPolicy implements SerializablePolicy
+{
+ public Object filter(MarshalledInvocation input, Object result) throws Throwable
+ {
+ if ("getMBeanInfo".equals(input.getMethod().getName()) && (result instanceof ModelMBeanInfo))
+ {
+ MBeanInfo info = (MBeanInfo)result;
+
+ result = new MBeanInfo(
+ info.getClassName(),
+ info.getDescription(),
+ deepCopy(info.getAttributes()), // Strip the Descriptors
+ info.getConstructors(),
+ info.getOperations(),
+ info.getNotifications());
+ }
+ return result;
+ }
+
+ private MBeanAttributeInfo[] deepCopy(MBeanAttributeInfo[] attrs)
+ {
+ MBeanAttributeInfo[] copy = new MBeanAttributeInfo[attrs.length];
+ for (int i = 0; i < attrs.length; i++)
+ {
+ MBeanAttributeInfo attr = attrs[i];
+ copy[i] = new MBeanAttributeInfo(
+ attr.getName(),
+ attr.getType(),
+ attr.getDescription(),
+ attr.isReadable(),
+ attr.isWritable(),
+ attr.isIs());
+ }
+ return copy;
+ }
+}
Added: trunk/server/src/main/java/org/jboss/jmx/package.html
===================================================================
--- trunk/server/src/main/java/org/jboss/jmx/package.html (rev 0)
+++ trunk/server/src/main/java/org/jboss/jmx/package.html 2010-05-12 12:57:10 UTC (rev 104722)
@@ -0,0 +1,44 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+ <head>
+ <!--
+
+ JBoss, the OpenSource J2EE webOS
+
+ This library 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 of the License, or
+ (at your option) any later version.
+
+ This library 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.
+
+ -->
+ <!-- $Id$ -->
+ </head>
+
+ <body bgcolor="white">
+ <p><em>Package description goes here</em>.
+
+ <h2>Package Specification</h2>
+ <ul>
+ <li><a href="javascript: alert('not available')">Not Available</a>
+ </ul>
+
+ <h2>Related Documentation</h2>
+ <ul>
+ <li><a href="javascript: alert('not available')">Not Available</a>
+ </ul>
+
+ <h2>Package Status</h2>
+ <ul>
+ <li><font color="green"><b>STABLE</b></font>
+ </ul>
+
+ <!-- Put @see and @since tags down here. -->
+
+ </body>
+</html>
+
Added: trunk/server/src/resources/jmx-invoker-adaptor/META-INF/jboss-service.xml
===================================================================
--- trunk/server/src/resources/jmx-invoker-adaptor/META-INF/jboss-service.xml (rev 0)
+++ trunk/server/src/resources/jmx-invoker-adaptor/META-INF/jboss-service.xml 2010-05-12 12:57:10 UTC (rev 104722)
@@ -0,0 +1,131 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- $Id: jboss-service.xml 59451 2007-01-09 19:13:25Z dimitris at jboss.org $ -->
+<server>
+
+ <!-- The JRMP invoker proxy configuration for the InvokerAdaptorService -->
+ <mbean code="org.jboss.invocation.jrmp.server.JRMPProxyFactory"
+ name="jboss.jmx:type=adaptor,name=Invoker,protocol=unified,service=proxyFactory">
+ <!-- Use the standard JRMPInvoker from conf/jboss-service.xxml -->
+ <depends optional-attribute-name="InvokerName">jboss:service=invoker,type=unified</depends>
+ <!-- The target MBean is the InvokerAdaptorService configured below -->
+ <depends optional-attribute-name="TargetName">jboss.jmx:type=adaptor,name=Invoker</depends>
+ <!-- Where to bind the RMIAdaptor proxy -->
+ <attribute name="JndiName">jmx/invoker/RMIAdaptor</attribute>
+ <!-- The RMI compabitle MBeanServer interface -->
+ <attribute name="ExportedInterfaces">org.jboss.jmx.adaptor.rmi.RMIAdaptor,
+ org.jboss.jmx.adaptor.rmi.RMIAdaptorExt
+ </attribute>
+ <attribute name="ClientInterceptors">
+ <interceptors>
+ <interceptor>org.jboss.proxy.ClientMethodInterceptor</interceptor>
+ <interceptor>org.jboss.proxy.SecurityInterceptor</interceptor>
+ <interceptor>org.jboss.jmx.connector.invoker.client.InvokerAdaptorClientInterceptor</interceptor>
+ <interceptor>org.jboss.invocation.InvokerInterceptor</interceptor>
+ </interceptors>
+ </attribute>
+ <depends>jboss:service=Naming</depends>
+ </mbean>
+
+ <!--
+ Choose the remote proxy to expose mbean proxies over
+ -->
+ <mbean code="org.jboss.jmx.connector.invoker.MBeanProxyRemote"
+ name="jboss.jmx:type=adaptor,name=MBeanProxyRemote,protocol=unified">
+ <depends optional-attribute-name="MBeanServerConnection">jboss.jmx:type=adaptor,name=Invoker,protocol=unified,service=proxyFactory</depends>
+ </mbean>
+
+ <!-- Create a mapping from the legacy jmx-rmi-adaptor.sar binding to the
+ jmx-invoker-adaptor-server.sar JndiName specified above for backwards
+ portability.
+ -->
+ <mbean code="org.jboss.naming.NamingAlias" name="jboss.jmx:alias=jmx/rmi/RMIAdaptor">
+ <attribute name="FromName">jmx/rmi/RMIAdaptor</attribute>
+ <attribute name="ToName">jmx/invoker/RMIAdaptor</attribute>
+ <depends>jboss:service=Naming</depends>
+ </mbean>
+
+ <!-- This is the service that handles the RMIAdaptor invocations by routing
+ them to the MBeanServer the service is deployed under. -->
+ <mbean code="org.jboss.jmx.connector.invoker.InvokerAdaptorService"
+ name="jboss.jmx:type=adaptor,name=Invoker"
+ xmbean-dd="">
+ <xmbean>
+ <description>The JMX Detached Invoker Service</description>
+ <class>org.jboss.jmx.connector.invoker.InvokerAdaptorService</class>
+
+ <!-- Attributes -->
+ <attribute access="read-only" getMethod="getName">
+ <description>The class name of the MBean</description>
+ <name>Name</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute access="read-only" getMethod="getState">
+ <description>The status of the MBean</description>
+ <name>State</name>
+ <type>int</type>
+ </attribute>
+ <attribute access="read-only" getMethod="getStateString">
+ <description>The status of the MBean in text form</description>
+ <name>StateString</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute access="read-write" getMethod="getExportedInterfaces" setMethod="setExportedInterfaces">
+ <description>The interfaces the invoker proxy supports</description>
+ <name>ExportedInterfaces</name>
+ <type>[Ljava.lang.Class;</type>
+ </attribute>
+ <attribute access="read-only" getMethod="getMethodMap">
+ <description>Map(Long hash, Method) of the proxy interface methods</description>
+ <name>MethodMap</name>
+ <type>java.util.Map</type>
+ </attribute>
+ <!-- Operations -->
+ <operation>
+ <description>The start lifecycle operation</description>
+ <name>start</name>
+ </operation>
+ <operation>
+ <description>The stop lifecycle operation</description>
+ <name>stop</name>
+ </operation>
+ <operation>
+ <description>The detyped lifecycle operation (for internal use only)</description>
+ <name>jbossInternalLifecycle</name>
+ <parameter>
+ <description>The lifecycle operation</description>
+ <name>method</name>
+ <type>java.lang.String</type>
+ </parameter>
+ <return-type>void</return-type>
+ </operation>
+
+ <operation>
+ <description>The detached invoker entry point</description>
+ <name>invoke</name>
+ <parameter>
+ <description>The method invocation context</description>
+ <name>invocation</name>
+ <type>org.jboss.invocation.Invocation</type>
+ </parameter>
+ <return-type>java.lang.Object</return-type>
+ <descriptors>
+ <interceptors>
+ <!-- Uncomment to require authenticated users
+ <interceptor code="org.jboss.jmx.connector.invoker.AuthenticationInterceptor"
+ securityDomain="java:/jaas/jmx-console"/>
+ -->
+ <!-- Interceptor that deals with non-serializable results -->
+ <interceptor code="org.jboss.jmx.connector.invoker.SerializableInterceptor"
+ policyClass="StripModelMBeanInfoPolicy"/>
+ </interceptors>
+ </descriptors>
+ </operation>
+ </xmbean>
+
+ <attribute name="ExportedInterfaces">org.jboss.jmx.adaptor.rmi.RMIAdaptor,
+ org.jboss.jmx.adaptor.rmi.RMIAdaptorExt
+ </attribute>
+ </mbean>
+
+</server>
Modified: trunk/testsuite/src/resources/hello/META-INF/jboss.xml
===================================================================
--- trunk/testsuite/src/resources/hello/META-INF/jboss.xml 2010-05-12 12:55:16 UTC (rev 104721)
+++ trunk/testsuite/src/resources/hello/META-INF/jboss.xml 2010-05-12 12:57:10 UTC (rev 104722)
@@ -43,7 +43,7 @@
<!-- A custom proxy for RMI that caches the bean proxy in the home -->
<invoker-proxy-binding>
<name>stateless-cached-rmi-invoker</name>
- <invoker-mbean>jboss:service=invoker,type=jrmp</invoker-mbean>
+ <invoker-mbean>jboss:service=invoker,type=unified</invoker-mbean>
<proxy-factory>org.jboss.proxy.ejb.ProxyFactory</proxy-factory>
<proxy-factory-config>
<client-interceptors>
Modified: trunk/testsuite/src/resources/jmx/interceptors/jboss-service.xml
===================================================================
--- trunk/testsuite/src/resources/jmx/interceptors/jboss-service.xml 2010-05-12 12:55:16 UTC (rev 104721)
+++ trunk/testsuite/src/resources/jmx/interceptors/jboss-service.xml 2010-05-12 12:57:10 UTC (rev 104722)
@@ -19,7 +19,7 @@
<mbean code="org.jboss.invocation.jrmp.server.JRMPProxyFactory"
name="jboss.test:service=proxyFactory,type=jrmp,target=Naming">
<!-- Use the standard JRMPInvoker from conf/jboss-service.xxml -->
- <attribute name="InvokerName">jboss:service=invoker,type=jrmp</attribute>
+ <attribute name="InvokerName">jboss:service=invoker,type=unified</attribute>
<attribute name="TargetName">jboss.test:service=Naming,secured=true,persistent=true</attribute>
<attribute name="JndiName">secure/Naming</attribute>
<attribute name="ExportedInterface">org.jnp.interfaces.Naming</attribute>
@@ -30,7 +30,7 @@
<interceptor>org.jboss.invocation.InvokerInterceptor</interceptor>
</interceptors>
</attribute>
- <depends>jboss:service=invoker,type=jrmp</depends>
+ <depends>jboss:service=invoker,type=unified</depends>
</mbean>
<!-- A custom deployment of the JBoss JNDI naming service -->
Modified: trunk/testsuite/src/resources/jmx/invokerproxy/META-INF/jboss-service.xml
===================================================================
--- trunk/testsuite/src/resources/jmx/invokerproxy/META-INF/jboss-service.xml 2010-05-12 12:55:16 UTC (rev 104721)
+++ trunk/testsuite/src/resources/jmx/invokerproxy/META-INF/jboss-service.xml 2010-05-12 12:57:10 UTC (rev 104722)
@@ -5,9 +5,9 @@
<!-- Proxy factory for MyService that will call invoke(Invocation mi) on the target service -->
<mbean code="org.jboss.invocation.jrmp.server.JRMPProxyFactory"
- name="jboss.jmx:type=adaptor,name=MyService,protocol=jrmp,service=proxyFactory">
+ name="jboss.jmx:type=adaptor,name=MyService,protocol=unified,service=proxyFactory">
<!-- Use the standard JRMPInvoker from conf/jboss-service.xxml -->
- <depends optional-attribute-name="InvokerName">jboss:service=invoker,type=jrmp</depends>
+ <depends optional-attribute-name="InvokerName">jboss:service=invoker,type=unified</depends>
<!-- The target MBean -->
<depends optional-attribute-name="TargetName">mine:service=MyService</depends>
<!-- Where to bind the proxy factory -->
@@ -26,9 +26,9 @@
<!-- Proxy factory for MyService that will call target method on the target service -->
<mbean code="org.jboss.invocation.jrmp.server.JRMPProxyFactory"
- name="jboss.jmx:type=adaptor,name=MyServiceInvokeTarget,protocol=jrmp,service=proxyFactory">
+ name="jboss.jmx:type=adaptor,name=MyServiceInvokeTarget,protocol=unified,service=proxyFactory">
<!-- Use the standard JRMPInvoker from conf/jboss-service.xxml -->
- <depends optional-attribute-name="InvokerName">jboss:service=invoker,type=jrmp</depends>
+ <depends optional-attribute-name="InvokerName">jboss:service=invoker,type=unified</depends>
<!-- The target MBean -->
<depends optional-attribute-name="TargetName">mine:service=MyService</depends>
<!-- Where to bind the proxy factory -->
@@ -48,7 +48,7 @@
</mbean>
<mbean code="org.jboss.test.jmx.invokerproxy.ProgramaticProxySetup"
- name="jboss.jmx:type=adaptor,name=MyServiceInvokeTarget,protocol=jrmp,service=ProgramaticProxySetup"
+ name="jboss.jmx:type=adaptor,name=MyServiceInvokeTarget,protocol=unified,service=ProgramaticProxySetup"
xmbean-dd="">
<xmbean>
<descriptors>
@@ -91,6 +91,6 @@
</operation>
</xmbean>
<attribute name="JndiName">IProxy</attribute>
- <depends optional-attribute-name="InvokerName">jboss:service=invoker,type=jrmp</depends>
+ <depends optional-attribute-name="InvokerName">jboss:service=invoker,type=unified</depends>
</mbean>
</server>
Modified: trunk/testsuite/src/resources/jmx/jmxadaptor/authorization-jmx-invoker-service.xml
===================================================================
--- trunk/testsuite/src/resources/jmx/jmxadaptor/authorization-jmx-invoker-service.xml 2010-05-12 12:55:16 UTC (rev 104721)
+++ trunk/testsuite/src/resources/jmx/jmxadaptor/authorization-jmx-invoker-service.xml 2010-05-12 12:57:10 UTC (rev 104722)
@@ -101,4 +101,4 @@
</attribute>
</mbean>
-</server>
\ No newline at end of file
+</server>
Modified: trunk/testsuite/src/resources/jmx/jmxadaptor/securejmx-invoker-service.xml
===================================================================
--- trunk/testsuite/src/resources/jmx/jmxadaptor/securejmx-invoker-service.xml 2010-05-12 12:55:16 UTC (rev 104721)
+++ trunk/testsuite/src/resources/jmx/jmxadaptor/securejmx-invoker-service.xml 2010-05-12 12:57:10 UTC (rev 104722)
@@ -198,4 +198,4 @@
</attribute>
</mbean>
-</server>
\ No newline at end of file
+</server>
Modified: trunk/testsuite/src/resources/jrmp/META-INF/jboss.xml
===================================================================
--- trunk/testsuite/src/resources/jrmp/META-INF/jboss.xml 2010-05-12 12:55:16 UTC (rev 104721)
+++ trunk/testsuite/src/resources/jrmp/META-INF/jboss.xml 2010-05-12 12:57:10 UTC (rev 104722)
@@ -25,7 +25,7 @@
<invoker-proxy-bindings>
<invoker-proxy-binding>
<name>stateless-compression-invoker</name>
- <invoker-mbean>jboss:service=invoker,type=jrmp,socketType=CompressionSocketFactory</invoker-mbean>
+ <invoker-mbean>jboss:service=invoker,type=unified</invoker-mbean>
<proxy-factory>org.jboss.proxy.ejb.ProxyFactory</proxy-factory>
<proxy-factory-config>
<client-interceptors>
Modified: trunk/testsuite/src/resources/naming/services/jboss-service.xml
===================================================================
--- trunk/testsuite/src/resources/naming/services/jboss-service.xml 2010-05-12 12:55:16 UTC (rev 104721)
+++ trunk/testsuite/src/resources/naming/services/jboss-service.xml 2010-05-12 12:57:10 UTC (rev 104722)
@@ -11,9 +11,9 @@
filter.
-->
<mbean code="org.jboss.invocation.jrmp.server.JRMPProxyFactory"
- name="jboss.test:service=proxyFactory,type=jrmp,target=Naming">
+ name="jboss.test:service=proxyFactory,type=unified,target=Naming">
<!-- Use the standard JRMPInvoker from conf/jboss-service.xxml -->
- <attribute name="InvokerName">jboss:service=invoker,type=jrmp</attribute>
+ <attribute name="InvokerName">jboss:service=invoker,type=unified</attribute>
<attribute name="TargetName">jboss.test:service=Naming,test=readonly</attribute>
<attribute name="JndiName">naming/Naming</attribute>
<attribute name="ExportedInterface">org.jnp.interfaces.Naming</attribute>
@@ -25,7 +25,7 @@
<interceptor>org.jboss.invocation.InvokerInterceptor</interceptor>
</interceptors>
</attribute>
- <depends>jboss:service=invoker,type=jrmp</depends>
+ <depends>jboss:service=invoker,type=unified</depends>
</mbean>
<!-- Expose the Naming service interface via HTTP with a readonly context
Modified: trunk/testsuite/src/resources/profileservice/override/profileservice-remove-ds.xml
===================================================================
--- trunk/testsuite/src/resources/profileservice/override/profileservice-remove-ds.xml 2010-05-12 12:55:16 UTC (rev 104721)
+++ trunk/testsuite/src/resources/profileservice/override/profileservice-remove-ds.xml 2010-05-12 12:57:10 UTC (rev 104722)
@@ -53,7 +53,7 @@
<rar-name>jboss-local-jdbc.rar</rar-name>
<use-java-context>true</use-java-context>
<connection-definition>javax.sql.DataSource</connection-definition>
- <jmx-invoker-name>jboss:service=invoker,type=jrmp</jmx-invoker-name>
+ <jmx-invoker-name>jboss:service=invoker,type=unified</jmx-invoker-name>
<min-pool-size>0</min-pool-size>
<max-pool-size>10</max-pool-size>
<blocking-timeout-millis>30000</blocking-timeout-millis>
@@ -83,4 +83,4 @@
<connection-url>jdbc:oracle:oci:@youroracle-tns-name</connection-url>
</local-tx-datasource>
-</datasources>
\ No newline at end of file
+</datasources>
Modified: trunk/testsuite/src/resources/profileservice/persistence/testbindings-jboss-beans.xml
===================================================================
--- trunk/testsuite/src/resources/profileservice/persistence/testbindings-jboss-beans.xml 2010-05-12 12:55:16 UTC (rev 104721)
+++ trunk/testsuite/src/resources/profileservice/persistence/testbindings-jboss-beans.xml 2010-05-12 12:57:10 UTC (rev 104722)
@@ -154,7 +154,7 @@
<!-- RMI/JRMP invoker -->
<bean class="org.jboss.services.binding.ServiceBindingMetadata">
- <property name="serviceName">jboss:service=invoker,type=jrmp</property>
+ <property name="serviceName">jboss:service=invoker,type=unified</property>
<property name="port">4444</property>
<property name="description">Socket for the legacy RMI/JRMP invoker</property>
</bean>
@@ -208,7 +208,7 @@
<!-- HA RMI/JRMP invoker -->
<bean class="org.jboss.services.binding.ServiceBindingMetadata">
- <property name="serviceName">jboss:service=invoker,type=jrmpha</property>
+ <property name="serviceName">jboss:service=invoker,type=unifiedha</property>
<property name="port">4447</property>
<property name="description">Socket for high availability version of the legacy RMI/JRMP invoker</property>
</bean>
Modified: trunk/varia/src/resources/deployment/resources/standardwl.xml
===================================================================
--- trunk/varia/src/resources/deployment/resources/standardwl.xml 2010-05-12 12:55:16 UTC (rev 104721)
+++ trunk/varia/src/resources/deployment/resources/standardwl.xml 2010-05-12 12:57:10 UTC (rev 104722)
@@ -14,7 +14,7 @@
<invoker-proxy-bindings>
<invoker-proxy-binding>
<name>entity-rmi-invoker</name>
- <invoker-mbean>jboss:service=invoker,type=jrmp</invoker-mbean>
+ <invoker-mbean>jboss:service=invoker,type=unified</invoker-mbean>
<proxy-factory>org.jboss.proxy.ejb.ProxyFactory</proxy-factory>
<proxy-factory-config>
<client-interceptors>
@@ -41,7 +41,7 @@
</invoker-proxy-binding>
<invoker-proxy-binding>
<name>clustered-entity-rmi-invoker</name>
- <invoker-mbean>jboss:service=invoker,type=jrmpha</invoker-mbean>
+ <invoker-mbean>jboss:service=invoker,type=unifiedha</invoker-mbean>
<proxy-factory>org.jboss.proxy.ejb.ProxyFactoryHA</proxy-factory>
<proxy-factory-config>
<client-interceptors>
@@ -68,7 +68,7 @@
</invoker-proxy-binding>
<invoker-proxy-binding>
<name>stateless-rmi-invoker</name>
- <invoker-mbean>jboss:service=invoker,type=jrmp</invoker-mbean>
+ <invoker-mbean>jboss:service=invoker,type=unified</invoker-mbean>
<proxy-factory>org.jboss.proxy.ejb.ProxyFactory</proxy-factory>
<proxy-factory-config>
<client-interceptors>
@@ -89,7 +89,7 @@
</invoker-proxy-binding>
<invoker-proxy-binding>
<name>clustered-stateless-rmi-invoker</name>
- <invoker-mbean>jboss:service=invoker,type=jrmpha</invoker-mbean>
+ <invoker-mbean>jboss:service=invoker,type=unifiedha</invoker-mbean>
<proxy-factory>org.jboss.proxy.ejb.ProxyFactoryHA</proxy-factory>
<proxy-factory-config>
<client-interceptors>
@@ -110,7 +110,7 @@
</invoker-proxy-binding>
<invoker-proxy-binding>
<name>stateful-rmi-invoker</name>
- <invoker-mbean>jboss:service=invoker,type=jrmp</invoker-mbean>
+ <invoker-mbean>jboss:service=invoker,type=unified</invoker-mbean>
<proxy-factory>org.jboss.proxy.ejb.ProxyFactory</proxy-factory>
<proxy-factory-config>
<client-interceptors>
@@ -131,7 +131,7 @@
</invoker-proxy-binding>
<invoker-proxy-binding>
<name>clustered-stateful-rmi-invoker</name>
- <invoker-mbean>jboss:service=invoker,type=jrmpha</invoker-mbean>
+ <invoker-mbean>jboss:service=invoker,type=unifiedha</invoker-mbean>
<proxy-factory>org.jboss.proxy.ejb.ProxyFactoryHA</proxy-factory>
<proxy-factory-config>
<client-interceptors>
More information about the jboss-cvs-commits
mailing list