geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dblev...@apache.org
Subject svn commit: r378162 - in /geronimo/trunk/modules: core/src/java/org/apache/geronimo/core/service/ core/src/java/org/apache/geronimo/proxy/ security/src/java/org/apache/geronimo/security/remoting/jmx/
Date Thu, 16 Feb 2006 05:07:53 GMT
Author: dblevins
Date: Wed Feb 15 21:07:50 2006
New Revision: 378162

URL: http://svn.apache.org/viewcvs?rev=378162&view=rev
Log:
Cleaned tons of unused code.  Most of it existed around ProxyContainer, and only 5 lines of
it was needed.

Added:
    geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/remoting/jmx/MarshalledMethod.java
  (contents, props changed)
      - copied, changed from r377923, geronimo/trunk/modules/core/src/java/org/apache/geronimo/proxy/MarshalledMethod.java
    geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/remoting/jmx/ReflexiveInterceptor.java
  (contents, props changed)
      - copied, changed from r377923, geronimo/trunk/modules/core/src/java/org/apache/geronimo/proxy/ReflexiveInterceptor.java
    geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/remoting/jmx/SerializableInvocation.java
  (contents, props changed)
      - copied, changed from r377923, geronimo/trunk/modules/core/src/java/org/apache/geronimo/proxy/ProxyInvocation.java
Removed:
    geronimo/trunk/modules/core/src/java/org/apache/geronimo/core/service/Component.java
    geronimo/trunk/modules/core/src/java/org/apache/geronimo/core/service/Container.java
    geronimo/trunk/modules/core/src/java/org/apache/geronimo/core/service/InvocationType.java
    geronimo/trunk/modules/core/src/java/org/apache/geronimo/core/service/RPCContainer.java
    geronimo/trunk/modules/core/src/java/org/apache/geronimo/core/service/SimpleInvocation.java
    geronimo/trunk/modules/core/src/java/org/apache/geronimo/core/service/StackThreadLocal.java
    geronimo/trunk/modules/core/src/java/org/apache/geronimo/core/service/StringInvocationKey.java
    geronimo/trunk/modules/core/src/java/org/apache/geronimo/proxy/
Modified:
    geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/remoting/jmx/JaasLoginServiceRemotingClient.java
    geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/remoting/jmx/JaasLoginServiceRemotingServer.java
    geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/remoting/jmx/RequestChannelInterceptor.java

Modified: geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/remoting/jmx/JaasLoginServiceRemotingClient.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/remoting/jmx/JaasLoginServiceRemotingClient.java?rev=378162&r1=378161&r2=378162&view=diff
==============================================================================
--- geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/remoting/jmx/JaasLoginServiceRemotingClient.java
(original)
+++ geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/remoting/jmx/JaasLoginServiceRemotingClient.java
Wed Feb 15 21:07:50 2006
@@ -20,8 +20,8 @@
 import java.io.IOException;
 import java.net.URI;
 import java.net.URISyntaxException;
+import java.lang.reflect.Proxy;
 
-import org.apache.geronimo.proxy.ProxyContainer;
 import org.apache.geronimo.security.jaas.server.JaasLoginServiceMBean;
 
 
@@ -49,9 +49,8 @@
 
         // Setup the client side container..
         RequestChannelInterceptor remoteInterceptor = new RequestChannelInterceptor(target,
cl);
-        ProxyContainer clientContainer = new ProxyContainer(remoteInterceptor);
-        return (JaasLoginServiceMBean) clientContainer.createProxy(cl , new Class[]{JaasLoginServiceMBean.class});
-
+        Class[] interfaces = new Class[]{JaasLoginServiceMBean.class};
+        return (JaasLoginServiceMBean) Proxy.newProxyInstance(cl, interfaces, remoteInterceptor);
     }
 
 }

Modified: geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/remoting/jmx/JaasLoginServiceRemotingServer.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/remoting/jmx/JaasLoginServiceRemotingServer.java?rev=378162&r1=378161&r2=378162&view=diff
==============================================================================
--- geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/remoting/jmx/JaasLoginServiceRemotingServer.java
(original)
+++ geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/remoting/jmx/JaasLoginServiceRemotingServer.java
Wed Feb 15 21:07:50 2006
@@ -43,7 +43,6 @@
 import org.apache.geronimo.gbean.GBeanLifecycle;
 import org.apache.geronimo.kernel.jmx.JMXUtil;
 import org.apache.geronimo.management.geronimo.NetworkConnector;
-import org.apache.geronimo.proxy.ReflexiveInterceptor;
 import org.apache.geronimo.security.jaas.server.JaasLoginServiceMBean;
 
 

Copied: geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/remoting/jmx/MarshalledMethod.java
(from r377923, geronimo/trunk/modules/core/src/java/org/apache/geronimo/proxy/MarshalledMethod.java)
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/remoting/jmx/MarshalledMethod.java?p2=geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/remoting/jmx/MarshalledMethod.java&p1=geronimo/trunk/modules/core/src/java/org/apache/geronimo/proxy/MarshalledMethod.java&r1=377923&r2=378162&rev=378162&view=diff
==============================================================================
--- geronimo/trunk/modules/core/src/java/org/apache/geronimo/proxy/MarshalledMethod.java (original)
+++ geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/remoting/jmx/MarshalledMethod.java
Wed Feb 15 21:07:50 2006
@@ -15,7 +15,7 @@
  *  limitations under the License.
  */
 
-package org.apache.geronimo.proxy;
+package org.apache.geronimo.security.remoting.jmx;
 
 import java.io.Serializable;
 import java.lang.reflect.Method;

Propchange: geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/remoting/jmx/MarshalledMethod.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/remoting/jmx/MarshalledMethod.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/remoting/jmx/MarshalledMethod.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Copied: geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/remoting/jmx/ReflexiveInterceptor.java
(from r377923, geronimo/trunk/modules/core/src/java/org/apache/geronimo/proxy/ReflexiveInterceptor.java)
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/remoting/jmx/ReflexiveInterceptor.java?p2=geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/remoting/jmx/ReflexiveInterceptor.java&p1=geronimo/trunk/modules/core/src/java/org/apache/geronimo/proxy/ReflexiveInterceptor.java&r1=377923&r2=378162&rev=378162&view=diff
==============================================================================
--- geronimo/trunk/modules/core/src/java/org/apache/geronimo/proxy/ReflexiveInterceptor.java
(original)
+++ geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/remoting/jmx/ReflexiveInterceptor.java
Wed Feb 15 21:07:50 2006
@@ -15,7 +15,7 @@
  *  limitations under the License.
  */
 
-package org.apache.geronimo.proxy;
+package org.apache.geronimo.security.remoting.jmx;
 
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
@@ -38,9 +38,9 @@
 
     public InvocationResult invoke(Invocation invocation) throws Throwable {
         try {
-
-            Method m = ProxyInvocation.getMethod(invocation);
-            Object args[] = ProxyInvocation.getArguments(invocation);
+            SerializableInvocation proxyInvocation = (SerializableInvocation) invocation;
+            Method m = proxyInvocation.getMethod();
+            Object args[] = proxyInvocation.getArgs();
             Object rc = m.invoke(target, args);
             return new SimpleInvocationResult(true, rc);
 

Propchange: geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/remoting/jmx/ReflexiveInterceptor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/remoting/jmx/ReflexiveInterceptor.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/remoting/jmx/ReflexiveInterceptor.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/remoting/jmx/RequestChannelInterceptor.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/remoting/jmx/RequestChannelInterceptor.java?rev=378162&r1=378161&r2=378162&view=diff
==============================================================================
--- geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/remoting/jmx/RequestChannelInterceptor.java
(original)
+++ geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/remoting/jmx/RequestChannelInterceptor.java
Wed Feb 15 21:07:50 2006
@@ -22,6 +22,8 @@
 import java.io.ObjectOutputStream;
 import java.net.URI;
 import java.net.URISyntaxException;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
 
 import org.activeio.Packet;
 import org.activeio.RequestChannel;
@@ -42,7 +44,7 @@
 /**
  * @version $Rev$ $Date$
  */
-public class RequestChannelInterceptor implements Interceptor {
+public class RequestChannelInterceptor implements Interceptor, InvocationHandler {
 
     private final ClassLoader cl;
     private final URI target;
@@ -52,6 +54,16 @@
         this.cl = cl;
     }
 
+
+    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
+        Invocation invocation = new SerializableInvocation(method, args, proxy);
+        InvocationResult result = invoke(invocation);
+        if( result.isException() ) {
+            throw result.getException();
+        }
+        return result.getResult();
+    }
+
     public InvocationResult invoke(Invocation invocation) throws Throwable {
 
         ClassLoader originalLoader = Thread.currentThread().getContextClassLoader();
@@ -59,18 +71,18 @@
 
             RequestChannel channel = createRequestChannel(target);
             Packet response;
-            try { 
+            try {
                 channel.start();
                 Packet request = serialize(invocation);
                 response = channel.request(request, Service.WAIT_FOREVER_TIMEOUT);
             } finally {
-                channel.dispose();                
+                channel.dispose();
             }
-            
+
             Object obj;
-            try {            
+            try {
                 obj =  deserialize(response, cl);
-            } catch ( ClassNotFoundException e ) { 
+            } catch ( ClassNotFoundException e ) {
                 // Weird.
                 Thread.currentThread().setContextClassLoader(RequestChannelInterceptor.class.getClassLoader());
                 response.clear();
@@ -82,20 +94,20 @@
                 throw ((RequestChannelInterceptorInvoker.ThrowableWrapper) obj).exception;
             }
             return (InvocationResult)obj;
-            
+
         } finally {
             Thread.currentThread().setContextClassLoader(originalLoader);
         }
     }
-    
+
     private static RequestChannel createRequestChannel(URI target) throws IOException, URISyntaxException
{
         SocketSyncChannelFactory factory = new SocketSyncChannelFactory();
         SyncChannel channel = factory.openSyncChannel(target);
         SocketMetadata socket = (SocketMetadata) channel.narrow(SocketMetadata.class);
         socket.setTcpNoDelay(true);
         return new AsyncChannelToClientRequestChannel(
-	               new PacketAggregatingSyncChannel(
-                       channel));        
+                   new PacketAggregatingSyncChannel(
+                       channel));
     }
 
     /**

Copied: geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/remoting/jmx/SerializableInvocation.java
(from r377923, geronimo/trunk/modules/core/src/java/org/apache/geronimo/proxy/ProxyInvocation.java)
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/remoting/jmx/SerializableInvocation.java?p2=geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/remoting/jmx/SerializableInvocation.java&p1=geronimo/trunk/modules/core/src/java/org/apache/geronimo/proxy/ProxyInvocation.java&r1=377923&r2=378162&rev=378162&view=diff
==============================================================================
--- geronimo/trunk/modules/core/src/java/org/apache/geronimo/proxy/ProxyInvocation.java (original)
+++ geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/remoting/jmx/SerializableInvocation.java
Wed Feb 15 21:07:50 2006
@@ -15,63 +15,93 @@
  *  limitations under the License.
  */
 
-package org.apache.geronimo.proxy;
+package org.apache.geronimo.security.remoting.jmx;
 
 import java.io.IOException;
 import java.io.ObjectInput;
 import java.io.ObjectOutput;
+import java.io.Externalizable;
 import java.lang.reflect.Method;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Iterator;
 
 import org.apache.geronimo.core.service.Invocation;
-import org.apache.geronimo.core.service.SimpleInvocation;
+import org.apache.geronimo.core.service.InvocationKey;
 
 /**
  * @version $Rev$ $Date$
  */
-final public class ProxyInvocation extends SimpleInvocation {
+final public class SerializableInvocation implements Invocation, Externalizable {
 
-    Method method;
-    Object args[];
-    Object proxy;
-
-    /* (non-Javadoc)
-     * @see org.apache.geronimo.core.service.SimpleInvocation#writeExternal(java.io.ObjectOutput)
-     */
-    public void writeExternal(ObjectOutput out) throws IOException {
-        super.writeExternal(out);
-        out.writeObject(args);
-        out.writeObject(new MarshalledMethod(method));
+    private Map data;
+    private Method method;
+    private Object args[];
+    private Object proxy;
+
+    public SerializableInvocation() {
+        super();
     }
 
-    /**
-     * @see org.apache.geronimo.core.service.SimpleInvocation#readExternal(java.io.ObjectInput)
-     */
-    public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
-        super.readExternal(in);
-        args = (Object[]) in.readObject();
-        method = ((MarshalledMethod) in.readObject()).getMethod();
+    public SerializableInvocation(Method method, Object[] args, Object proxy) {
+        super();
+        this.method = method;
+        this.args = args;
+        this.proxy = proxy;
     }
 
-    public static Method getMethod(Invocation invocation) {
-        return (Method) ((ProxyInvocation) invocation).method;
+    public Object get(InvocationKey key) {
+        if(data==null) {
+            return null;
+        }
+        return data.get(key);
     }
-    public static void putMethod(Invocation invocation, Method method) {
-        ((ProxyInvocation) invocation).method = method;
+
+    public void put(InvocationKey key, Object value) {
+        if(data==null)
+            data = new HashMap();
+        data.put(key, value);
     }
 
-    public static Object getProxy(Invocation invocation) {
-        return ((ProxyInvocation) invocation).proxy;
+    public void writeExternal(ObjectOutput out) throws IOException {
+        if( data !=null ) {
+            Iterator iterator = data.keySet().iterator();
+            while(iterator.hasNext()) {
+                InvocationKey key = (InvocationKey) iterator.next();
+                if( key.isTransient() )
+                    continue; // don't serialize this item.
+                Object value = data.get(key);
+                out.writeObject(key);
+                out.writeObject(value);
+            }
+        }
+        // write end of list terminator.
+        out.writeObject(null);
+        out.writeObject(args);
+        out.writeObject(new MarshalledMethod(method));
     }
-    public static void putProxy(Invocation invocation, Object proxy) {
-        ((ProxyInvocation) invocation).proxy = proxy;
+
+    public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+
+        if( data!=null )
+            data.clear();
+
+        InvocationKey key = (InvocationKey) in.readObject();
+        while( key!=null ) {
+            Object value = in.readObject();
+            put(key,value);
+            key = (InvocationKey) in.readObject();
+        }
+        args = (Object[]) in.readObject();
+        method = ((MarshalledMethod) in.readObject()).getMethod();
     }
 
-    public static Object[] getArguments(Invocation invocation) {
-        return ((ProxyInvocation) invocation).args;
+    public Method getMethod() {
+        return method;
     }
 
-    public static void putArguments(Invocation invocation, Object[] arguments) {
-        ((ProxyInvocation) invocation).args = arguments;
+    public Object[] getArgs() {
+        return args;
     }
 
 }

Propchange: geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/remoting/jmx/SerializableInvocation.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/remoting/jmx/SerializableInvocation.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/remoting/jmx/SerializableInvocation.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message