hammant 2003/02/02 06:10:07 Modified: altrmi/src/java/org/apache/excalibur/altrmi/client ClientInvocationHandler.java altrmi/src/java/org/apache/excalibur/altrmi/client/impl/callback/stream CallbackEnabledClientCustomStreamReadWriter.java altrmi/src/java/org/apache/excalibur/altrmi/client/impl/direct DirectHostContext.java DirectInvocationHandler.java DirectMarshalledHostContext.java DirectMarshalledInvocationHandler.java altrmi/src/java/org/apache/excalibur/altrmi/server MethodInvocationHandler.java Server.java altrmi/src/java/org/apache/excalibur/altrmi/server/impl AbstractServer.java DefaultMethodInvocationHandler.java ServerStreamReadWriter.java StreamServerConnection.java altrmi/src/java/org/apache/excalibur/altrmi/server/impl/adapters InvocationHandlerAdapter.java MarshalledInvocationHandlerAdapter.java altrmi/src/java/org/apache/excalibur/altrmi/server/impl/callback CallbackServerClassFactory.java altrmi/src/java/org/apache/excalibur/altrmi/server/impl/direct DirectMarshalledServer.java DirectServer.java altrmi/src/java/org/apache/excalibur/altrmi/server/impl/http CustomHttpServer.java altrmi/src/java/org/apache/excalibur/altrmi/server/impl/piped AbstractPipedServer.java altrmi/src/java/org/apache/excalibur/altrmi/server/impl/rmi RmiInovcationAdapter.java altrmi/src/java/org/apache/excalibur/altrmi/server/impl/socket AbstractCompleteSocketStreamServer.java AbstractPartialSocketStreamServer.java altrmi/src/test/org/apache/excalibur/altrmi/client/impl/naming DefaultContextTestCase.java altrmi/src/test/org/apache/excalibur/altrmi/test DummyInvocationHandler.java altrmi/src/test/org/apache/excalibur/altrmi/test/generator TestInvocationHandler.java Added: altrmi/src/java/org/apache/excalibur/altrmi/client ClientMarshalledInvocationHandler.java altrmi/src/java/org/apache/excalibur/altrmi/server MethodInvocationMonitor.java ServerInvocationHandler.java ServerMarshalledInvocationHandler.java altrmi/src/java/org/apache/excalibur/altrmi/server/impl NullMethodInvocationMonitor.java Removed: altrmi/src/java/org/apache/excalibur/altrmi/common InvocationHandler.java MarshalledInvocationHandler.java Log: Invocation handler moved from common to client and server sides, and given connections details on server side Revision Changes Path 1.7 +15 -3 jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/ClientInvocationHandler.java Index: ClientInvocationHandler.java =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/ClientInvocationHandler.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- ClientInvocationHandler.java 29 Jan 2003 08:01:12 -0000 1.6 +++ ClientInvocationHandler.java 2 Feb 2003 14:10:05 -0000 1.7 @@ -7,10 +7,11 @@ */ package org.apache.excalibur.altrmi.client; -import org.apache.excalibur.altrmi.common.InvocationHandler; import org.apache.excalibur.altrmi.common.ConnectionException; import org.apache.excalibur.altrmi.common.CallbackException; import org.apache.excalibur.altrmi.common.ThreadContextProviderAware; +import org.apache.excalibur.altrmi.common.Reply; +import org.apache.excalibur.altrmi.common.Request; /** * Interface ClientInvocationHandler @@ -19,8 +20,19 @@ * @author Paul Hammant * @version * $Revision$ */ -public interface ClientInvocationHandler extends InvocationHandler, ThreadContextProviderAware +public interface ClientInvocationHandler extends ThreadContextProviderAware { + + /** + * Handle a method invocation + * + * + * @param request The request to handle + * + * @return the reply that is a consequence of the request + * + */ + Reply handleInvocation( Request request ); /** * Method setConnectionListener 1.1 jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/ClientMarshalledInvocationHandler.java Index: ClientMarshalledInvocationHandler.java =================================================================== /* * Copyright (C) The Apache Software Foundation. All rights reserved. * * This software is published under the terms of the Apache Software License * version 1.1, a copy of which has been included with this distribution in * the LICENSE.txt file. */ package org.apache.excalibur.altrmi.client; /** * Interface MarshalledInvocationHandler * * * @author Paul Hammant <a href="mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED]</a> * @version * $Revision: 1.1 $ */ public interface ClientMarshalledInvocationHandler { /** * Handle a method Invocation using byte array representations of the request and reply * * * @param request a byte array representing a request * * @return a byte array representing the reply * */ byte[] handleInvocation( byte[] request ); } 1.13 +2 -2 jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/callback/stream/CallbackEnabledClientCustomStreamReadWriter.java Index: CallbackEnabledClientCustomStreamReadWriter.java =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/callback/stream/CallbackEnabledClientCustomStreamReadWriter.java,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- CallbackEnabledClientCustomStreamReadWriter.java 29 Jan 2003 08:01:13 -0000 1.12 +++ CallbackEnabledClientCustomStreamReadWriter.java 2 Feb 2003 14:10:05 -0000 1.13 @@ -119,7 +119,7 @@ } else if( obj instanceof Request ) { - Reply altrmiReply = m_clientServerHostingExposedObjects.handleInvocation( (Request)obj ); + Reply altrmiReply = m_clientServerHostingExposedObjects.handleInvocation( (Request)obj, "callback" ); postReply( altrmiReply ); } else 1.5 +4 -4 jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/direct/DirectHostContext.java Index: DirectHostContext.java =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/direct/DirectHostContext.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- DirectHostContext.java 5 Jan 2003 23:24:09 -0000 1.4 +++ DirectHostContext.java 2 Feb 2003 14:10:05 -0000 1.5 @@ -9,13 +9,13 @@ import org.apache.excalibur.altrmi.client.impl.AbstractHostContext; import org.apache.excalibur.altrmi.common.ConnectionException; -import org.apache.excalibur.altrmi.common.InvocationHandler; +import org.apache.excalibur.altrmi.server.ServerInvocationHandler; /** * Class DirectHostContext * * - * @author Paul Hammant <a href="mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED]</a> + * @author Paul Hammant * @version $Revision$ */ public class DirectHostContext extends AbstractHostContext @@ -30,7 +30,7 @@ * @throws ConnectionException * */ - public DirectHostContext( InvocationHandler altrmiInvocationHandler ) + public DirectHostContext( ServerInvocationHandler altrmiInvocationHandler ) throws ConnectionException { super( new DirectInvocationHandler( altrmiInvocationHandler ) ); 1.8 +5 -5 jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/direct/DirectInvocationHandler.java Index: DirectInvocationHandler.java =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/direct/DirectInvocationHandler.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- DirectInvocationHandler.java 5 Jan 2003 23:24:09 -0000 1.7 +++ DirectInvocationHandler.java 2 Feb 2003 14:10:05 -0000 1.8 @@ -9,9 +9,9 @@ import java.io.IOException; import org.apache.excalibur.altrmi.common.ConnectionException; -import org.apache.excalibur.altrmi.common.InvocationHandler; import org.apache.excalibur.altrmi.common.Reply; import org.apache.excalibur.altrmi.common.Request; +import org.apache.excalibur.altrmi.server.ServerInvocationHandler; /** * Class DirectInvocationHandler @@ -23,7 +23,7 @@ public final class DirectInvocationHandler extends AbstractDirectInvocationHandler { - private InvocationHandler m_altrmiInvocationHandler; + private ServerInvocationHandler m_altrmiInvocationHandler; /** * Constructor DirectInvocationHandler @@ -34,7 +34,7 @@ * @throws ConnectionException * */ - public DirectInvocationHandler( InvocationHandler altrmiInvocationHandler ) + public DirectInvocationHandler( ServerInvocationHandler altrmiInvocationHandler ) throws ConnectionException { m_altrmiInvocationHandler = altrmiInvocationHandler; @@ -42,7 +42,7 @@ protected Reply performInvocation( Request request ) throws IOException { - return m_altrmiInvocationHandler.handleInvocation( request ); + return m_altrmiInvocationHandler.handleInvocation( request, "" ); } } 1.4 +5 -4 jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/direct/DirectMarshalledHostContext.java Index: DirectMarshalledHostContext.java =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/direct/DirectMarshalledHostContext.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- DirectMarshalledHostContext.java 5 Jan 2003 23:24:09 -0000 1.3 +++ DirectMarshalledHostContext.java 2 Feb 2003 14:10:05 -0000 1.4 @@ -9,7 +9,8 @@ import org.apache.excalibur.altrmi.client.impl.AbstractHostContext; import org.apache.excalibur.altrmi.common.ConnectionException; -import org.apache.excalibur.altrmi.common.MarshalledInvocationHandler; +import org.apache.excalibur.altrmi.server.ServerMarshalledInvocationHandler; + /** * Class DirectHostContext @@ -30,7 +31,7 @@ * @throws ConnectionException * */ - public DirectMarshalledHostContext( MarshalledInvocationHandler altrmiInvocationHandler ) + public DirectMarshalledHostContext( ServerMarshalledInvocationHandler altrmiInvocationHandler ) throws ConnectionException { this( altrmiInvocationHandler, DirectMarshalledHostContext.class.getClassLoader() ); @@ -47,7 +48,7 @@ * */ public DirectMarshalledHostContext( - MarshalledInvocationHandler altrmiInvocationHandler, ClassLoader classLoader ) + ServerMarshalledInvocationHandler altrmiInvocationHandler, ClassLoader classLoader ) throws ConnectionException { super( new DirectMarshalledInvocationHandler( altrmiInvocationHandler, classLoader ) ); 1.8 +6 -6 jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/direct/DirectMarshalledInvocationHandler.java Index: DirectMarshalledInvocationHandler.java =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/direct/DirectMarshalledInvocationHandler.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- DirectMarshalledInvocationHandler.java 5 Jan 2003 23:24:09 -0000 1.7 +++ DirectMarshalledInvocationHandler.java 2 Feb 2003 14:10:05 -0000 1.8 @@ -9,11 +9,11 @@ import java.io.IOException; import org.apache.excalibur.altrmi.common.ConnectionException; -import org.apache.excalibur.altrmi.common.MarshalledInvocationHandler; import org.apache.excalibur.altrmi.common.Reply; import org.apache.excalibur.altrmi.common.Request; import org.apache.excalibur.altrmi.common.RequestFailedReply; import org.apache.excalibur.altrmi.common.SerializationHelper; +import org.apache.excalibur.altrmi.server.ServerMarshalledInvocationHandler; /** * Class DirectInvocationHandler @@ -25,7 +25,7 @@ public final class DirectMarshalledInvocationHandler extends AbstractDirectInvocationHandler { - private MarshalledInvocationHandler m_altrmiInvocationHandler; + private ServerMarshalledInvocationHandler m_altrmiInvocationHandler; private ClassLoader m_interfacesClassLoader; /** @@ -38,7 +38,7 @@ * */ public DirectMarshalledInvocationHandler( - MarshalledInvocationHandler altrmiInvocationHandler ) + ServerMarshalledInvocationHandler altrmiInvocationHandler ) throws ConnectionException { m_altrmiInvocationHandler = altrmiInvocationHandler; @@ -56,7 +56,7 @@ * */ public DirectMarshalledInvocationHandler( - MarshalledInvocationHandler altrmiInvocationHandler, ClassLoader classLoader ) + ServerMarshalledInvocationHandler altrmiInvocationHandler, ClassLoader classLoader ) throws ConnectionException { m_altrmiInvocationHandler = altrmiInvocationHandler; @@ -69,7 +69,7 @@ try { byte[] serRequest = SerializationHelper.getBytesFromInstance( request ); - byte[] serReply = m_altrmiInvocationHandler.handleInvocation( serRequest ); + byte[] serReply = m_altrmiInvocationHandler.handleInvocation( serRequest, null ); return (Reply)SerializationHelper.getInstanceFromBytes( serReply, m_interfacesClassLoader ); 1.6 +6 -2 jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/MethodInvocationHandler.java Index: MethodInvocationHandler.java =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/MethodInvocationHandler.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- MethodInvocationHandler.java 5 Jan 2003 23:24:44 -0000 1.5 +++ MethodInvocationHandler.java 2 Feb 2003 14:10:05 -0000 1.6 @@ -29,7 +29,7 @@ * @return the reply for the request. * */ - Reply handleMethodInvocation( MethodRequest request ); + Reply handleMethodInvocation( MethodRequest request, Object connectionDetails ); /** * Add an implementation bean @@ -69,5 +69,9 @@ * */ Class getMostDerivedType( Object beanImpl ); + + + void setMethodInvocationMonitor(MethodInvocationMonitor monitor); + } 1.2 +2 -3 jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/Server.java Index: Server.java =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/Server.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- Server.java 6 Jan 2003 23:42:11 -0000 1.1 +++ Server.java 2 Feb 2003 14:10:05 -0000 1.2 @@ -7,7 +7,6 @@ */ package org.apache.excalibur.altrmi.server; -import org.apache.excalibur.altrmi.common.InvocationHandler; /** * Interface Server @@ -16,7 +15,7 @@ * @author Paul Hammant <a href="mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED]</a> * @version * $Revision$ */ -public interface Server extends Publisher, InvocationHandler +public interface Server extends Publisher, ServerInvocationHandler { /** 1.1 jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/MethodInvocationMonitor.java Index: MethodInvocationMonitor.java =================================================================== /* * Copyright (C) The Apache Software Foundation. All rights reserved. * * This software is published under the terms of the Apache Software License * version 1.1, a copy of which has been included with this distribution in * the LICENSE.txt file. */ package org.apache.excalibur.altrmi.server; import java.lang.reflect.InvocationTargetException; import java.text.MessageFormat; /** * MethodInvocationMonitor * * * @author Paul Hammant * @version $Revision: 1.1 $ */ public interface MethodInvocationMonitor { void methodInvoked(Class clazz, String methodSignature, Object connectionDetails); void invalidReference(String methodSignature, Object connectionDetails); void missingMethod(String methodSignature, Object connectionDetails); void invocationTargetException(Class clazz, String methodSignature, InvocationTargetException ite, Object connectionDetails); void invocationException(Class clazz, String methodSignature, Throwable t, Object connectionDetails); } 1.1 jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/ServerInvocationHandler.java Index: ServerInvocationHandler.java =================================================================== /* * Copyright (C) The Apache Software Foundation. All rights reserved. * * This software is published under the terms of the Apache Software License * version 1.1, a copy of which has been included with this distribution in * the LICENSE.txt file. */ package org.apache.excalibur.altrmi.server; import org.apache.excalibur.altrmi.common.Reply; import org.apache.excalibur.altrmi.common.Request; /** * Interface InvocationHandler * * * @author Paul Hammant <a href="mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED]</a> * @version * $Revision: 1.1 $ */ public interface ServerInvocationHandler { /** * Handle a method invocation * * * @param request The request to handle * @param connectionDetails Some details of the connection. * * @return the reply that is a consequence of the request * */ Reply handleInvocation( Request request, Object connectionDetails ); } 1.1 jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/ServerMarshalledInvocationHandler.java Index: ServerMarshalledInvocationHandler.java =================================================================== /* * Copyright (C) The Apache Software Foundation. All rights reserved. * * This software is published under the terms of the Apache Software License * version 1.1, a copy of which has been included with this distribution in * the LICENSE.txt file. */ package org.apache.excalibur.altrmi.server; /** * Interface MarshalledInvocationHandler * * * @author Paul Hammant <a href="mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED]</a> * @version * $Revision: 1.1 $ */ public interface ServerMarshalledInvocationHandler { /** * Handle a method Invocation using byte array representations of the request and reply * * * @param request a byte array representing a request * * @return a byte array representing the reply * */ byte[] handleInvocation( byte[] request, Object connectionDetails ); } 1.15 +3 -3 jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/AbstractServer.java Index: AbstractServer.java =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/AbstractServer.java,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- AbstractServer.java 29 Jan 2003 08:01:13 -0000 1.14 +++ AbstractServer.java 2 Feb 2003 14:10:05 -0000 1.15 @@ -132,9 +132,9 @@ * @return An suitable reply. * */ - public Reply handleInvocation( Request request ) + public Reply handleInvocation( Request request, Object connectionDetails ) { - return m_invocationHandlerAdapter.handleInvocation( request ); + return m_invocationHandlerAdapter.handleInvocation( request, connectionDetails ); } /** 1.15 +23 -8 jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/DefaultMethodInvocationHandler.java Index: DefaultMethodInvocationHandler.java =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/DefaultMethodInvocationHandler.java,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- DefaultMethodInvocationHandler.java 1 Feb 2003 15:29:56 -0000 1.14 +++ DefaultMethodInvocationHandler.java 2 Feb 2003 14:10:05 -0000 1.15 @@ -13,7 +13,7 @@ import java.lang.reflect.Method; import java.util.HashMap; import java.util.WeakHashMap; -import java.util.Iterator; +import java.text.MessageFormat; import org.apache.excalibur.altrmi.common.InvocationException; import org.apache.excalibur.altrmi.common.Reply; @@ -25,6 +25,7 @@ import org.apache.excalibur.altrmi.server.Publisher; import org.apache.excalibur.altrmi.server.MethodInvocationHandler; import org.apache.excalibur.altrmi.server.PublicationDescription; +import org.apache.excalibur.altrmi.server.MethodInvocationMonitor; /** * Class DefaultMethodInvocationHandler @@ -37,6 +38,8 @@ public class DefaultMethodInvocationHandler implements MethodInvocationHandler { + private MessageFormat messageFormat = new MessageFormat(""); + /** * Beans for references */ @@ -76,6 +79,7 @@ * The publication description. */ private final PublicationDescription m_publicationDescription; + private MethodInvocationMonitor m_methodInvocationMonitor = new NullMethodInvocationMonitor(); /** * Constructor DefaultMethodInvocationHandler @@ -184,7 +188,7 @@ * @return The reply. * */ - public Reply handleMethodInvocation( MethodRequest request ) + public Reply handleMethodInvocation( MethodRequest request, Object connectionDetails ) { String methodSignature = request.getMethodSignature(); @@ -192,38 +196,45 @@ if( !m_methodMap.containsKey( methodSignature ) ) { + m_methodInvocationMonitor.missingMethod(methodSignature, connectionDetails); return new ExceptionReply( new InvocationException( "Method '"+ methodSignature +"' not present in impl" ) ); } Method method = (Method) m_methodMap.get( methodSignature ); + Object beanImpl = null; + try { WeakReference wr = (WeakReference) m_refBeans.get( request.getReferenceID() ); if( wr == null ) { + m_methodInvocationMonitor.invalidReference(methodSignature, connectionDetails); return new NoSuchReferenceReply( request.getReferenceID() ); } - Object beanImpl = wr.get(); + beanImpl = wr.get(); if( beanImpl == null ) { + m_methodInvocationMonitor.invalidReference(methodSignature, connectionDetails); return new NoSuchReferenceReply( request.getReferenceID() ); } Object[] args = request.getArgs(); correctArgs( request, args ); - + m_methodInvocationMonitor.methodInvoked(beanImpl.getClass(), methodSignature, connectionDetails); return new MethodReply( method.invoke( beanImpl, request.getArgs() ) ); } catch( InvocationTargetException ite ) { Throwable t = ite.getTargetException(); + m_methodInvocationMonitor.invocationTargetException(beanImpl.getClass(), methodSignature, ite, + connectionDetails); if( t instanceof Serializable ) { @@ -239,9 +250,8 @@ } catch( Throwable t ) { - System.out.flush(); - t.printStackTrace(); - + m_methodInvocationMonitor.invocationException(beanImpl == null ? null : beanImpl.getClass(), + methodSignature, t, connectionDetails); return new ExceptionReply( new InvocationException( "Some ServerSide exception problem :" + t.getMessage() ) ); @@ -319,6 +329,11 @@ { // approve everything and set session identifier. return new Long((++ c_nextReference << 16) + ((long) (Math.random() * 65536))); + } + + public void setMethodInvocationMonitor(MethodInvocationMonitor monitor) + { + m_methodInvocationMonitor = monitor; } } 1.12 +10 -2 jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/ServerStreamReadWriter.java Index: ServerStreamReadWriter.java =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/ServerStreamReadWriter.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- ServerStreamReadWriter.java 29 Jan 2003 08:01:13 -0000 1.11 +++ ServerStreamReadWriter.java 2 Feb 2003 14:10:05 -0000 1.12 @@ -41,6 +41,7 @@ private ServerMonitor m_serverMonitor; private ThreadContextProvider m_threadContextProvider; + private Object m_connectionDetails; private void setServerMonitor(ServerMonitor serverMonitor) { m_serverMonitor = serverMonitor; @@ -64,11 +65,18 @@ * @param outputStream the outpur stream * */ - public final void setStreams( InputStream inputStream, OutputStream outputStream ) + public final void setStreams( InputStream inputStream, OutputStream outputStream, Object connectionDetails ) { m_inputStream = inputStream; m_outputStream = outputStream; + m_connectionDetails = connectionDetails; } + + public Object getConnectionDetails() + { + return m_connectionDetails; + } + /** * Initialize the Read Writer. 1.15 +2 -2 jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/StreamServerConnection.java Index: StreamServerConnection.java =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/StreamServerConnection.java,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- StreamServerConnection.java 27 Jan 2003 22:18:54 -0000 1.14 +++ StreamServerConnection.java 2 Feb 2003 14:10:06 -0000 1.15 @@ -100,7 +100,7 @@ { if (request != null) { - reply = m_abstractServer.handleInvocation(request); + reply = m_abstractServer.handleInvocation(request, m_readWriter.getConnectionDetails()); } request = m_readWriter.writeReplyAndGetRequest(reply); 1.1 jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/NullMethodInvocationMonitor.java Index: NullMethodInvocationMonitor.java =================================================================== /* * Copyright (C) The Apache Software Foundation. All rights reserved. * * This software is published under the terms of the Apache Software License * version 1.1, a copy of which has been included with this distribution in * the LICENSE.txt file. */ package org.apache.excalibur.altrmi.server.impl; import org.apache.excalibur.altrmi.server.MethodInvocationMonitor; import java.text.MessageFormat; import java.lang.reflect.InvocationTargetException; /** * Class NullMethodInvocationMonitor * * * @author Paul Hammant * @version $Revision: 1.1 $ */ public class NullMethodInvocationMonitor implements MethodInvocationMonitor { public void methodInvoked(Class clazz, String methodSignature, Object connectionDetails) { } public void invalidReference(String methodSignature, Object connectionDetails) { } public void missingMethod(String methodSignature, Object connectionDetails) { } public void invocationTargetException(Class clazz, String methodSignature, InvocationTargetException ite, Object connectionDetails) { } public void invocationException(Class clazz, String methodSignature, Throwable t, Object connectionDetails) { } } 1.22 +14 -13 jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/adapters/InvocationHandlerAdapter.java Index: InvocationHandlerAdapter.java =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/adapters/InvocationHandlerAdapter.java,v retrieving revision 1.21 retrieving revision 1.22 diff -u -r1.21 -r1.22 --- InvocationHandlerAdapter.java 2 Feb 2003 08:50:14 -0000 1.21 +++ InvocationHandlerAdapter.java 2 Feb 2003 14:10:06 -0000 1.22 @@ -14,7 +14,6 @@ import org.apache.excalibur.altrmi.common.AuthenticationException; import org.apache.excalibur.altrmi.common.InvocationException; -import org.apache.excalibur.altrmi.common.InvocationHandler; import org.apache.excalibur.altrmi.common.Reply; import org.apache.excalibur.altrmi.common.ReplyConstants; import org.apache.excalibur.altrmi.common.Request; @@ -50,6 +49,7 @@ import org.apache.excalibur.altrmi.server.ClassRetrievalException; import org.apache.excalibur.altrmi.server.ClassRetriever; import org.apache.excalibur.altrmi.server.MethodInvocationHandler; +import org.apache.excalibur.altrmi.server.ServerInvocationHandler; import org.apache.excalibur.altrmi.server.impl.Session; import org.apache.excalibur.altrmi.server.impl.DefaultAuthenticator; import org.apache.excalibur.altrmi.server.impl.DefaultMethodInvocationHandler; @@ -63,7 +63,7 @@ * @version $Revision$ */ public class InvocationHandlerAdapter extends PublicationAdapter - implements InvocationHandler + implements ServerInvocationHandler { private static long c_session = 0; @@ -107,7 +107,7 @@ * @return The reply. * */ - public Reply handleInvocation( Request request ) + public Reply handleInvocation( Request request, Object connectionDetails ) { try @@ -122,17 +122,17 @@ if( request.getRequestCode() == RequestConstants.METHODREQUEST ) { - return doMethodRequest( request ); + return doMethodRequest( request, connectionDetails ); } else if( request.getRequestCode() == RequestConstants.METHODFACADEREQUEST ) { - return doMethodFacadeRequest( request ); + return doMethodFacadeRequest( request, connectionDetails ); } else if( request.getRequestCode() == RequestConstants.METHODASYNCREQUEST ) { - return doMethodAsyncRequest( (MethodAsyncRequest) request ); + return doMethodAsyncRequest( (MethodAsyncRequest) request, connectionDetails ); } else if( request.getRequestCode() == RequestConstants.GCREQUEST ) @@ -190,7 +190,7 @@ * @param request the request * @return The reply */ - private Reply doMethodFacadeRequest( Request request ) + private Reply doMethodFacadeRequest( Request request, Object connectionDetails ) { MethodFacadeRequest facadeRequest = (MethodFacadeRequest)request; @@ -215,7 +215,7 @@ MethodInvocationHandler methodInvocationHandler = getMethodInvocationHandler( publishedThing ); - Reply ar = methodInvocationHandler.handleMethodInvocation( facadeRequest ); + Reply ar = methodInvocationHandler.handleMethodInvocation( facadeRequest, connectionDetails ); if( ar.getReplyCode() == ReplyConstants.EXCEPTIONREPLY ) { @@ -358,7 +358,7 @@ * @param request The request * @return The reply */ - private Reply doMethodRequest( Request request ) + private Reply doMethodRequest( Request request, Object connectionDetails ) { MethodRequest methodRequest = (MethodRequest) request; @@ -377,10 +377,10 @@ MethodInvocationHandler methodInvocationHandler = getMethodInvocationHandler( publishedThing ); - return methodInvocationHandler.handleMethodInvocation( methodRequest ); + return methodInvocationHandler.handleMethodInvocation( methodRequest, connectionDetails ); } - private Reply doMethodAsyncRequest(MethodAsyncRequest methodRequest) + private Reply doMethodAsyncRequest(MethodAsyncRequest methodRequest, Object connectionDetails) { if (!sessionExists(methodRequest.getSession())) @@ -410,7 +410,8 @@ rawRequest.getMethodSignature(), rawRequest.getArgs(), methodRequest.getReferenceID(), - methodRequest.getSession()) + methodRequest.getSession()), + connectionDetails ); } 1.6 +9 -9 jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/adapters/MarshalledInvocationHandlerAdapter.java Index: MarshalledInvocationHandlerAdapter.java =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/adapters/MarshalledInvocationHandlerAdapter.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- MarshalledInvocationHandlerAdapter.java 5 Jan 2003 23:24:45 -0000 1.5 +++ MarshalledInvocationHandlerAdapter.java 2 Feb 2003 14:10:06 -0000 1.6 @@ -8,11 +8,11 @@ package org.apache.excalibur.altrmi.server.impl.adapters; import java.io.IOException; -import org.apache.excalibur.altrmi.common.InvocationHandler; -import org.apache.excalibur.altrmi.common.MarshalledInvocationHandler; import org.apache.excalibur.altrmi.common.Reply; import org.apache.excalibur.altrmi.common.Request; import org.apache.excalibur.altrmi.common.SerializationHelper; +import org.apache.excalibur.altrmi.server.ServerInvocationHandler; +import org.apache.excalibur.altrmi.server.ServerMarshalledInvocationHandler; import javax.swing.*; @@ -23,13 +23,13 @@ * @author Paul Hammant <a href="mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED]</a> * @version $Revision$ */ -public class MarshalledInvocationHandlerAdapter implements MarshalledInvocationHandler +public class MarshalledInvocationHandlerAdapter implements ServerMarshalledInvocationHandler { /** * The invocation hamdeler */ - private InvocationHandler m_altrmiInvocationHandler; + private ServerInvocationHandler m_altrmiInvocationHandler; /** * The class loader. */ @@ -42,7 +42,7 @@ * @param altrmiInvocationHandler The invocation handler * */ - public MarshalledInvocationHandlerAdapter( InvocationHandler altrmiInvocationHandler ) + public MarshalledInvocationHandlerAdapter( ServerInvocationHandler altrmiInvocationHandler ) { m_altrmiInvocationHandler = altrmiInvocationHandler; m_classLoader = getClass().getClassLoader(); @@ -56,7 +56,7 @@ * @param classLoader The classloader * */ - public MarshalledInvocationHandlerAdapter( InvocationHandler altrmiInvocationHandler, + public MarshalledInvocationHandlerAdapter( ServerInvocationHandler altrmiInvocationHandler, ClassLoader classLoader ) { m_altrmiInvocationHandler = altrmiInvocationHandler; @@ -72,7 +72,7 @@ * @return The reply * */ - public byte[] handleInvocation( byte[] request ) + public byte[] handleInvocation( byte[] request, Object connectionDetails ) { try @@ -80,7 +80,7 @@ Request ar = (Request) SerializationHelper.getInstanceFromBytes( request, m_classLoader ); - Reply reply = m_altrmiInvocationHandler.handleInvocation( ar ); + Reply reply = m_altrmiInvocationHandler.handleInvocation( ar, connectionDetails ); return SerializationHelper.getBytesFromInstance( reply ); } 1.4 +2 -2 jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/callback/CallbackServerClassFactory.java Index: CallbackServerClassFactory.java =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/callback/CallbackServerClassFactory.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- CallbackServerClassFactory.java 1 Feb 2003 17:46:06 -0000 1.3 +++ CallbackServerClassFactory.java 2 Feb 2003 14:10:06 -0000 1.4 @@ -87,7 +87,7 @@ if (m_session == null) { OpenConnectionReply reply = (OpenConnectionReply) m_hostContext.getClientInvocationHandler() - .handleInvocation( new OpenConnectionRequest()); + .handleInvocation( new OpenConnectionRequest() ); m_session= reply.getSession(); } 1.7 +7 -7 jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/direct/DirectMarshalledServer.java Index: DirectMarshalledServer.java =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/direct/DirectMarshalledServer.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- DirectMarshalledServer.java 11 Jan 2003 16:10:08 -0000 1.6 +++ DirectMarshalledServer.java 2 Feb 2003 14:10:06 -0000 1.7 @@ -8,12 +8,12 @@ package org.apache.excalibur.altrmi.server.impl.direct; import org.apache.excalibur.altrmi.common.InvocationException; -import org.apache.excalibur.altrmi.common.MarshalledInvocationHandler; import org.apache.excalibur.altrmi.common.Reply; import org.apache.excalibur.altrmi.common.Request; import org.apache.excalibur.altrmi.server.impl.AbstractServer; import org.apache.excalibur.altrmi.server.impl.adapters.InvocationHandlerAdapter; import org.apache.excalibur.altrmi.server.impl.adapters.MarshalledInvocationHandlerAdapter; +import org.apache.excalibur.altrmi.server.ServerMarshalledInvocationHandler; /** * Class DirectServer @@ -23,7 +23,7 @@ * @version $Revision$ */ public class DirectMarshalledServer extends AbstractServer - implements MarshalledInvocationHandler + implements ServerMarshalledInvocationHandler { MarshalledInvocationHandlerAdapter m_marshalledInovcationHandlerAdapter; @@ -101,9 +101,9 @@ * @return * */ - public byte[] handleInvocation( byte[] request ) + public byte[] handleInvocation( byte[] request, Object connectionDetails ) { - return m_marshalledInovcationHandlerAdapter.handleInvocation( request ); + return m_marshalledInovcationHandlerAdapter.handleInvocation( request, connectionDetails ); } /** @@ -115,12 +115,12 @@ * @return * */ - public Reply handleInvocation( Request request ) + public Reply handleInvocation( Request request, Object connectionDetails ) { if( getState() == STARTED ) { - return super.handleInvocation( request ); + return super.handleInvocation( request, connectionDetails ); } else { 1.6 +2 -2 jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/direct/DirectServer.java Index: DirectServer.java =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/direct/DirectServer.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- DirectServer.java 11 Jan 2003 16:10:08 -0000 1.5 +++ DirectServer.java 2 Feb 2003 14:10:06 -0000 1.6 @@ -82,7 +82,7 @@ if( getState() == STARTED ) { - return super.handleInvocation( request ); + return super.handleInvocation( request, "" ); } else { 1.7 +2 -2 jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/http/CustomHttpServer.java Index: CustomHttpServer.java =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/http/CustomHttpServer.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- CustomHttpServer.java 29 Jan 2003 08:01:13 -0000 1.6 +++ CustomHttpServer.java 2 Feb 2003 14:10:06 -0000 1.7 @@ -93,7 +93,7 @@ { ServerStreamReadWriter ssrw = new ServerCustomStreamReadWriter(); - ssrw.setStreams(in, out); + ssrw.setStreams(in, out, "TODO"); HttpCustomServerConnection hcsc = new HttpCustomServerConnection(this, ssrw); 1.10 +2 -2 jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/piped/AbstractPipedServer.java Index: AbstractPipedServer.java =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/piped/AbstractPipedServer.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- AbstractPipedServer.java 29 Jan 2003 08:01:13 -0000 1.9 +++ AbstractPipedServer.java 2 Feb 2003 14:10:06 -0000 1.10 @@ -77,7 +77,7 @@ ServerStreamReadWriter ssrw = createServerStreamReadWriter(); - ssrw.setStreams( pIS, pOS ); + ssrw.setStreams( pIS, pOS, "piped"); PipedStreamServerConnection pssc = new PipedStreamServerConnection( this, pIS, pOS, ssrw ); 1.6 +3 -3 jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/rmi/RmiInovcationAdapter.java Index: RmiInovcationAdapter.java =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/rmi/RmiInovcationAdapter.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- RmiInovcationAdapter.java 9 Jan 2003 22:55:12 -0000 1.5 +++ RmiInovcationAdapter.java 2 Feb 2003 14:10:06 -0000 1.6 @@ -17,7 +17,7 @@ * Class RmiInovcationAdapter for AltRMI over RMI invocation adaptation. * * - * @author Paul Hammant <a href="mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED]</a> + * @author Paul Hammant * @version $Revision$ */ public class RmiInovcationAdapter implements RmiInvocationHandler @@ -52,6 +52,6 @@ */ public Reply handleInvocation( Request request ) throws RemoteException { - return m_abstractServer.handleInvocation( request ); + return m_abstractServer.handleInvocation( request, "RMI-TODO"); } } 1.14 +2 -2 jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/socket/AbstractCompleteSocketStreamServer.java Index: AbstractCompleteSocketStreamServer.java =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/socket/AbstractCompleteSocketStreamServer.java,v retrieving revision 1.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- AbstractCompleteSocketStreamServer.java 29 Jan 2003 08:01:13 -0000 1.13 +++ AbstractCompleteSocketStreamServer.java 2 Feb 2003 14:10:06 -0000 1.14 @@ -103,7 +103,7 @@ ServerStreamReadWriter ssrw = createServerStreamReadWriter(); - ssrw.setStreams( sock.getInputStream(), sock.getOutputStream() ); + ssrw.setStreams( sock.getInputStream(), sock.getOutputStream(), sock ); SocketStreamServerConnection sssc = new SocketStreamServerConnection( this, sock, ssrw ); 1.8 +2 -2 jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/socket/AbstractPartialSocketStreamServer.java Index: AbstractPartialSocketStreamServer.java =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/socket/AbstractPartialSocketStreamServer.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- AbstractPartialSocketStreamServer.java 19 Jan 2003 11:10:01 -0000 1.7 +++ AbstractPartialSocketStreamServer.java 2 Feb 2003 14:10:06 -0000 1.8 @@ -57,7 +57,7 @@ { ServerStreamReadWriter ssrw = createServerStreamReadWriter(); - ssrw.setStreams( socket.getInputStream(), socket.getOutputStream() ); + ssrw.setStreams( socket.getInputStream(), socket.getOutputStream(), socket ); SocketStreamServerConnection sssc = new SocketStreamServerConnection( this, socket, ssrw ); 1.2 +5 -12 jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/client/impl/naming/DefaultContextTestCase.java Index: DefaultContextTestCase.java =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/client/impl/naming/DefaultContextTestCase.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- DefaultContextTestCase.java 2 Feb 2003 08:50:14 -0000 1.1 +++ DefaultContextTestCase.java 2 Feb 2003 14:10:07 -0000 1.2 @@ -59,19 +59,12 @@ DefaultContext dc = new DefaultContext("127.0.0.1", "12121", "SocketCustomStream", ht); NamingEnumeration ne = null; - try - { - ne = dc.list("Hello"); - fail("Should have had a naming exception"); - } - catch (NamingException e) - { - } - finally - { - svr.stop(); - } + ne = dc.list("anything"); + assertNotNull(ne); + assertNotNull(ne.next()); + + svr.stop(); } 1.5 +8 -1 jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/test/DummyInvocationHandler.java Index: DummyInvocationHandler.java =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/test/DummyInvocationHandler.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- DummyInvocationHandler.java 2 Feb 2003 08:50:14 -0000 1.4 +++ DummyInvocationHandler.java 2 Feb 2003 14:10:07 -0000 1.5 @@ -17,6 +17,14 @@ import org.apache.excalibur.altrmi.client.ConnectionPinger; +/** + * Class DummyInvocationHandler + * + * + * @author Paul Hammant + * @version $Revision$ + */ + public class DummyInvocationHandler implements ClientInvocationHandler { @@ -42,7 +50,6 @@ public void ping() { - System.out.println("pinged!"); pinged = true; } 1.8 +10 -5 jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/test/generator/TestInvocationHandler.java Index: TestInvocationHandler.java =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/test/generator/TestInvocationHandler.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- TestInvocationHandler.java 5 Jan 2003 23:24:54 -0000 1.7 +++ TestInvocationHandler.java 2 Feb 2003 14:10:07 -0000 1.8 @@ -18,18 +18,23 @@ import org.apache.excalibur.altrmi.common.MethodRequest; import org.apache.excalibur.altrmi.common.OpenConnectionReply; import org.apache.excalibur.altrmi.common.OpenConnectionRequest; +import org.apache.excalibur.altrmi.server.ServerInvocationHandler; /** * TestInvocationHandler * @version 1.0 * @author <a href="mailto:[EMAIL PROTECTED]">Vinay Chandran</a> */ -public class TestInvocationHandler extends AbstractClientInvocationHandler{ +public class TestInvocationHandler extends AbstractClientInvocationHandler implements ServerInvocationHandler{ - /* - * @see InvocationHandler#handleInvocation(Request) - */ - public Reply handleInvocation(Request request) { + + public Reply handleInvocation(Request request) + { + return handleInvocation(request, "test"); + } + + public Reply handleInvocation(Request request, Object connectionDetails) + { if(request instanceof OpenConnectionRequest) { return new OpenConnectionReply();
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]