[jboss-cvs] JBossAS SVN: r65392 - in trunk/profileservice/src: main/org/jboss/profileservice/remoting and 1 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Sep 14 01:24:06 EDT 2007
Author: scott.stark at jboss.org
Date: 2007-09-14 01:24:06 -0400 (Fri, 14 Sep 2007)
New Revision: 65392
Modified:
trunk/profileservice/src/main/org/jboss/profileservice/management/ManagementViewImpl.java
trunk/profileservice/src/main/org/jboss/profileservice/remoting/ProfileServiceInvocationHandler.java
trunk/profileservice/src/resources/profileservice-beans.xml
Log:
Route the ManagedOperation calls to the mgtview impl
Modified: trunk/profileservice/src/main/org/jboss/profileservice/management/ManagementViewImpl.java
===================================================================
--- trunk/profileservice/src/main/org/jboss/profileservice/management/ManagementViewImpl.java 2007-09-14 02:17:10 UTC (rev 65391)
+++ trunk/profileservice/src/main/org/jboss/profileservice/management/ManagementViewImpl.java 2007-09-14 05:24:06 UTC (rev 65392)
@@ -34,11 +34,10 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import javax.naming.InitialContext;
-
import org.jboss.aop.Dispatcher;
import org.jboss.aop.advice.Interceptor;
-import org.jboss.aop.proxy.Proxy;
+import org.jboss.aop.joinpoint.Invocation;
+import org.jboss.aop.joinpoint.InvocationResponse;
import org.jboss.aspects.remoting.InvokeRemoteInterceptor;
import org.jboss.aspects.remoting.MergeMetaDataInterceptor;
import org.jboss.aspects.remoting.Remoting;
@@ -77,7 +76,6 @@
import org.jboss.profileservice.spi.ProfileKey;
import org.jboss.profileservice.spi.ProfileService;
import org.jboss.remoting.InvokerLocator;
-import org.jboss.util.naming.Util;
import org.jboss.virtual.VirtualFile;
/**
@@ -127,6 +125,8 @@
* matching ManagedObject.
*/
private Map<String, ManagedObject> runtimeMOs = new HashMap<String, ManagedObject>();
+ /** A map of the ManagedOperation to runtime component */
+ private Map<ManagedOperation, Object> opMap = new HashMap<ManagedOperation, Object>();
public ManagementViewImpl()
{
@@ -641,6 +641,30 @@
}
}
+ /**
+ * Handle ManagedOperation invocations
+ *
+ * @param inv - the remoting invocation information
+ * @return
+ * @throws Throwable
+ */
+ public InvocationResponse invoke(Invocation inv)
+ throws Throwable
+ {
+ Object oid = inv.getMetaData(Dispatcher.DISPATCHER, Dispatcher.OID);
+ log.debug("Invocation for: "+oid);
+ ManagedOperation op = (ManagedOperation) Dispatcher.singleton.getRegistered(oid);
+ if (op == null)
+ throw new IllegalStateException("No ManagedOperation found for: "+oid);
+ // TODO: Get the runtime component
+ Object target = opMap.get(op);
+ if (target == null)
+ throw new IllegalStateException("No target found for op: "+op);
+ // Dispatch the operation...
+ InvocationResponse response = new InvocationResponse();
+ return response;
+ }
+
protected void checkForReferences(String key, ManagedObject mo)
{
Set<ManagedProperty> referers = unresolvedRefs.get(key);
@@ -711,6 +735,8 @@
ManagedOperation opProxy = (ManagedOperation) Remoting.createRemoteProxy(dispatchName,
loader, ifaces, locator, interceptors, "ProfileService");
opProxies.add(opProxy);
+ // TODO: Need a map from the op to the runtime component
+ opMap.put(op, null);
}
return opProxies;
}
Modified: trunk/profileservice/src/main/org/jboss/profileservice/remoting/ProfileServiceInvocationHandler.java
===================================================================
--- trunk/profileservice/src/main/org/jboss/profileservice/remoting/ProfileServiceInvocationHandler.java 2007-09-14 02:17:10 UTC (rev 65391)
+++ trunk/profileservice/src/main/org/jboss/profileservice/remoting/ProfileServiceInvocationHandler.java 2007-09-14 05:24:06 UTC (rev 65392)
@@ -27,6 +27,8 @@
import org.jboss.aspects.remoting.AOPRemotingInvocationHandler;
import org.jboss.deployers.spi.management.ManagementView;
import org.jboss.logging.Logger;
+import org.jboss.managed.api.ManagedOperation;
+import org.jboss.profileservice.management.ManagementViewImpl;
import org.jboss.remoting.InvocationRequest;
import org.jboss.remoting.ServerInvocationHandler;
@@ -43,25 +45,39 @@
implements ServerInvocationHandler
{
private static final Logger log = Logger.getLogger(ProfileServiceInvocationHandler.class);
- private Proxy mgtViewProxy;
+ private ManagementView mgtViewProxy;
+ private ManagementViewImpl mgtView;
- public Proxy getManagementViewProxy()
+ public ManagementView getManagementViewProxy()
{
return mgtViewProxy;
}
- public void setManagementViewProxy(Proxy mgtViewProxy)
+ public void setManagementViewProxy(ManagementView mgtViewProxy)
{
this.mgtViewProxy = mgtViewProxy;
}
+ public ManagementViewImpl getViewManager()
+ {
+ return mgtView;
+ }
+ public void setViewManager(ManagementViewImpl mgtView)
+ {
+ this.mgtView = mgtView;
+ }
+
public Object invoke(InvocationRequest invocation)
throws Throwable
{
org.jboss.aop.joinpoint.Invocation inv =(org.jboss.aop.joinpoint.Invocation)invocation.getParameter();
Object oid = inv.getMetaData(Dispatcher.DISPATCHER, Dispatcher.OID);
- log.debug("Invocation for: "+oid);
- InvocationResponse value = (InvocationResponse) super.invoke(invocation);
+ InvocationResponse value = null;
+ if (oid.toString().startsWith("ProfileService.ManagedOperation@"))
+ value = mgtView.invoke(inv);
+ else
+ value = (InvocationResponse) super.invoke(invocation);
+
if( value.getResponse() instanceof ManagementView )
{
// Replace the ManagementView with its proxy
Modified: trunk/profileservice/src/resources/profileservice-beans.xml
===================================================================
--- trunk/profileservice/src/resources/profileservice-beans.xml 2007-09-14 02:17:10 UTC (rev 65391)
+++ trunk/profileservice/src/resources/profileservice-beans.xml 2007-09-14 05:24:06 UTC (rev 65392)
@@ -30,6 +30,7 @@
<parameter>ProfileService</parameter>
</uninstall>
<property name="managementViewProxy"><inject bean="ProfileServiceProxyFactory" property="managementViewProxy"/></property>
+ <property name="viewManager"><inject bean="ManagementView"/></property>
</bean>
<!-- The ManagementView plugin -->
More information about the jboss-cvs-commits
mailing list