You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by ha...@apache.org on 2002/04/20 19:39:44 UTC

cvs commit: jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/callback/socket CallbackEnabledSocketCustomStreamHostContext.java CallbackEnabledSocketCustomStreamInvocationHandler.java CallbackEnabledCustomSocketStreamHostContext.java CallbackEnabledCustomSocketStreamInvocationHandler.java

hammant     02/04/20 10:39:44

  Modified:    altrmi   socketa.xml
               altrmi/src/java/org/apache/excalibur/altrmi/client/impl
                        DefaultProxyHelper.java
               altrmi/src/java/org/apache/excalibur/altrmi/server/impl/callback/socket
                        CallbackServerClientReadWriter.java
  Added:       altrmi/src/java/org/apache/excalibur/altrmi/server/impl/callback/socket
                        CallbackEnabledSocketCustomStreamReadWriter.java
                        CallbackEnabledSocketCustomStreamServer.java
                        PartialCallbackEnabledSocketCustomStreamServer.java
               altrmi/src/java/org/apache/excalibur/altrmi/client/impl/callback/socket
                        CallbackEnabledSocketCustomStreamHostContext.java
                        CallbackEnabledSocketCustomStreamInvocationHandler.java
  Removed:     altrmi/src/java/org/apache/excalibur/altrmi/server/impl/callback/socket
                        CallbackEnabledCustomSocketStreamReadWriter.java
                        CallbackEnabledCustomSocketStreamServer.java
                        PartialCallbackEnabledCustomSocketStreamServer.java
               altrmi/src/java/org/apache/excalibur/altrmi/client/impl/callback/socket
                        CallbackEnabledCustomSocketStreamHostContext.java
                        CallbackEnabledCustomSocketStreamInvocationHandler.java
  Log:
  Sensible renames of callback classes
  
  Revision  Changes    Path
  1.2       +3 -5      jakarta-avalon-excalibur/altrmi/socketa.xml
  
  Index: socketa.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/socketa.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- socketa.xml	3 Apr 2002 22:26:53 -0000	1.1
  +++ socketa.xml	20 Apr 2002 17:39:44 -0000	1.2
  @@ -22,6 +22,7 @@
     <path id="test.classpath">
       <pathelement location="${build.home}/classes"/>
       <pathelement location="${build.home}/genclasses"/>
  +    <pathelement location="${build.home}/testclasses"/>    
       <pathelement location="lib/JSX0.9.8.1.jar"/>
       <pathelement location="${avalon-framework.jar}"/>
     </path>    
  @@ -33,16 +34,14 @@
       <echo>
         Usage: Run this in two shells.  
         One with target server, the other with target client.
  -      ${avalon-framework.jar}
       </echo>
     </target>
   
   
     <target name="server" description="Socket Server (ObjectStream, client side classes)">
  -    <java classname="org.apache.excalibur.altrmi.test.SocketServerTest" fork="true">
  +    <java classname="org.apache.excalibur.altrmi.test.socket.ObjectStreamSocketServerTest" fork="true">
         <classpath refid="test.classpath"/>
         <arg value="C"/>
  -      <arg value="ObjectStream"/>      
       </java>      
     </target>
     
  @@ -50,10 +49,9 @@
     
       <ant antfile="base.xml" target="generate"/>
     
  -    <java classname="org.apache.excalibur.altrmi.test.SocketClientTest" fork="true">
  +    <java classname="org.apache.excalibur.altrmi.test.socket.ObjectStreamSocketClientTest" fork="true">
         <classpath refid="test.classpath"/>
         <arg value="C"/>
  -      <arg value="ObjectStream"/>
       </java>      
     </target>
   
  
  
  
  1.4       +9 -9      jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/DefaultProxyHelper.java
  
  Index: DefaultProxyHelper.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/DefaultProxyHelper.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- DefaultProxyHelper.java	20 Apr 2002 13:24:27 -0000	1.3
  +++ DefaultProxyHelper.java	20 Apr 2002 17:39:44 -0000	1.4
  @@ -25,12 +25,12 @@
   import org.apache.excalibur.altrmi.common.GarbageCollectionReply;
   import org.apache.excalibur.altrmi.client.AltrmiProxy;
   import org.apache.excalibur.altrmi.client.ProxyHelper;
  +import org.apache.excalibur.altrmi.client.impl.callback.socket.CallbackEnabledSocketCustomStreamInvocationHandler;
   
   import java.lang.reflect.Array;
   
   //callback
   import org.apache.excalibur.altrmi.common.ExposedObjectProxy;
  -import org.apache.excalibur.altrmi.client.impl.callback.socket.CallbackEnabledCustomSocketStreamInvocationHandler;
   import java.util.StringTokenizer;
   import org.apache.excalibur.altrmi.common.AltrmiCallbackException;
   
  @@ -40,7 +40,7 @@
    *
    * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
    * @author Vinay Chandrasekharan <a href="mailto:vinay_chandran@users.sourceforge.net">vinay_chandran@users.sourceforge.net</a>
  - * @version $Revision: 1.3 $
  + * @version $Revision: 1.4 $
    */
   public final class DefaultProxyHelper implements ProxyHelper {
   
  @@ -52,7 +52,7 @@
       private final transient Long mSession;
   	//<callback related>
   	private boolean mbIsCallbackAware=false;
  -	private CallbackEnabledCustomSocketStreamInvocationHandler mCallbackEnabledCustomSocketStreamInvocationHandler=null;
  +	private CallbackEnabledSocketCustomStreamInvocationHandler mCallbackEnabledSocketCustomStreamInvocationHandler=null;
   	//</callback related>
       /**
        * Constructor DefaultProxyHelper
  @@ -78,11 +78,11 @@
           mReferenceID = referenceID;
           mSession = session;
           //<callback related>
  -        if(mInvocationHandler instanceof CallbackEnabledCustomSocketStreamInvocationHandler)
  +        if(mInvocationHandler instanceof CallbackEnabledSocketCustomStreamInvocationHandler)
   		{
   
  -			mCallbackEnabledCustomSocketStreamInvocationHandler	=
  -				(CallbackEnabledCustomSocketStreamInvocationHandler)mInvocationHandler;
  +			mCallbackEnabledSocketCustomStreamInvocationHandler	=
  +				(CallbackEnabledSocketCustomStreamInvocationHandler)mInvocationHandler;
   			mbIsCallbackAware=true;
   		}
           //</callback related>
  @@ -359,7 +359,7 @@
               }
               else if(mbIsCallbackAware)
   			{
  -				String publishedName = mCallbackEnabledCustomSocketStreamInvocationHandler.getPublishedName(args[i]);
  +				String publishedName = mCallbackEnabledSocketCustomStreamInvocationHandler.getPublishedName(args[i]);
   				if(publishedName!=null) //already published
   				{
   					ExposedObjectProxy exposedObjectProxy =  new ExposedObjectProxy(publishedName);
  @@ -373,13 +373,13 @@
   					{
   						try
   						{
  -							mCallbackEnabledCustomSocketStreamInvocationHandler.exposeObject(args[i],_cArgClass);
  +							mCallbackEnabledSocketCustomStreamInvocationHandler.exposeObject(args[i],_cArgClass);
   						}
   						catch(AltrmiCallbackException ace)
   						{
   							ace.printStackTrace();
   						}
  -						publishedName = mCallbackEnabledCustomSocketStreamInvocationHandler.getPublishedName(args[i]);
  +						publishedName = mCallbackEnabledSocketCustomStreamInvocationHandler.getPublishedName(args[i]);
   						ExposedObjectProxy exposedObjectProxy =  new ExposedObjectProxy(publishedName);
   						args[i]=exposedObjectProxy;
   
  
  
  
  1.2       +3 -3      jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/callback/socket/CallbackServerClientReadWriter.java
  
  Index: CallbackServerClientReadWriter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/callback/socket/CallbackServerClientReadWriter.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- CallbackServerClientReadWriter.java	20 Apr 2002 13:24:27 -0000	1.1
  +++ CallbackServerClientReadWriter.java	20 Apr 2002 17:39:44 -0000	1.2
  @@ -24,12 +24,12 @@
    *  CallbackEnabledSocketStreamReadWriter
    *
    * @author <a href="mailto:vinayc77@yahoo.com">Vinay Chandran</a>
  - * @version $Revision: 1.1 $
  + * @version $Revision: 1.2 $
    */
   public class CallbackServerClientReadWriter extends ClientStreamReadWriter
   {
   
  -    private CallbackEnabledCustomSocketStreamReadWriter mCallbackEnabledCustomSocketStreamReadWriter;
  +    private CallbackEnabledSocketCustomStreamReadWriter mCallbackEnabledCustomSocketStreamReadWriter;
   
       /**
        * Constructor CallbackServerClientReadWriter
  @@ -39,7 +39,7 @@
        *
        */
       CallbackServerClientReadWriter(
  -            CallbackEnabledCustomSocketStreamReadWriter callbackEnabledCustomSocketStreamReadWriter)
  +            CallbackEnabledSocketCustomStreamReadWriter callbackEnabledCustomSocketStreamReadWriter)
       {
           this.mCallbackEnabledCustomSocketStreamReadWriter =
               callbackEnabledCustomSocketStreamReadWriter;
  
  
  
  1.1                  jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/callback/socket/CallbackEnabledSocketCustomStreamReadWriter.java
  
  Index: CallbackEnabledSocketCustomStreamReadWriter.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.callback.socket;
  
  
  
  import org.apache.excalibur.altrmi.common.AltrmiRequest;
  import org.apache.excalibur.altrmi.common.MethodRequest;
  import org.apache.excalibur.altrmi.common.AltrmiReply;
  import org.apache.excalibur.altrmi.client.AltrmiHostContext;
  import org.apache.excalibur.altrmi.client.impl.AbstractHostContext;
  import org.apache.excalibur.altrmi.client.AltrmiClientInvocationHandler;
  import org.apache.excalibur.altrmi.common.ExposedObjectProxy;
  import org.apache.excalibur.altrmi.common.SerializationHelper;
  import org.apache.excalibur.altrmi.client.impl.stream.StreamInvocationHandler;
  import org.apache.excalibur.altrmi.client.impl.stream.ClientStreamReadWriter;
  import org.apache.excalibur.altrmi.client.AltrmiFactory;
  import org.apache.excalibur.altrmi.client.impl.ServerClassAltrmiFactory;
  import org.apache.excalibur.altrmi.client.impl.DefaultProxyHelper;
  import org.apache.excalibur.altrmi.common.AltrmiConnectionException;
  import org.apache.excalibur.altrmi.common.AltrmiConnectionClosedException;
  import org.apache.excalibur.altrmi.common.ExceptionReply;
  import org.apache.excalibur.altrmi.common.LookupRequest;
  import org.apache.excalibur.altrmi.common.LookupReply;
  import org.apache.excalibur.altrmi.common.NotPublishedReply;
  import org.apache.excalibur.altrmi.common.AltrmiAuthentication;
  import org.apache.excalibur.altrmi.server.impl.ServerStreamReadWriter;
  import org.apache.excalibur.altrmi.server.impl.callback.stream.CallbackStreamInvocationHandler;
  import org.apache.excalibur.altrmi.server.impl.callback.CallbackHostContext;
  import org.apache.excalibur.altrmi.server.impl.callback.CallbackServerClassAltrmiFactory;
  
  import java.io.DataInputStream;
  import java.io.DataOutputStream;
  import java.io.IOException;
  import java.io.BufferedOutputStream;
  
  
  /**
   * CallbackEnabledSocketCustomStreamReadWriter
   *  This StreamReadWriter is responsible for unmarshalling
   * 	exposedClient objects too and devliering it to the Remote Object.
   *  The calls made for the exposed Client Object is also marshalled
   * 	out here with the aid of the internal InvocationHandler.
   *  The callbacks are multiplexed over the same connection and thus
   * 	there are no extra network connections needed to enable callbacks.
   *
   * @author <a href="mailto:vinayc77@yahoo.com">Vinay Chandran</a>
   * @version $Revision: 1.1 $
   */
  public class CallbackEnabledSocketCustomStreamReadWriter extends ServerStreamReadWriter implements Runnable
  {
  
      private DataInputStream mDataInputStream;
      private DataOutputStream mDataOutputStream;
  	private Thread mMessageLoopThread =null;
  	private boolean mIsStopped=false;
  	private Object mRequestLock= new Object();
  	private Object mReplyLock= new Object();
      private AltrmiRequest mRequest=null;
      private AltrmiReply mReply=null;
  	private CallbackServerClientReadWriter mCallbackServerClientReadWriter;
  	private CallbackStreamInvocationHandler mCallbackStreamInvocationHandler;
  	private CallbackHostContext mCallbackHostContext;
  	private CallbackServerClassAltrmiFactory  mAltrmiFactory;
  
  
  	/*
  	 * @see ServerStreamReadWriter#initialize()
  	 */
      protected void initialize() throws IOException {
          mDataInputStream = new DataInputStream(mInputStream);
          mDataOutputStream = new DataOutputStream(new BufferedOutputStream(mOutputStream));
  		//start the receiving message loop
  		mMessageLoopThread =  new Thread(this);
  		mMessageLoopThread.start();
  	
      }
  
  	/**
  	 * Message Loop . 
  	 * Notifies the Reply or Request monitor depending upon the type of message.
  	 * @see Runnable#run()
  	 */
  	public void run()
  	{
  		mCallbackServerClientReadWriter  = new CallbackServerClientReadWriter(this);
  		mCallbackStreamInvocationHandler =  new CallbackStreamInvocationHandler(this.getClass().getClassLoader());
  		mCallbackStreamInvocationHandler.setObjectReadWriter(mCallbackServerClientReadWriter);
  		mCallbackHostContext	=  new CallbackHostContext(mCallbackStreamInvocationHandler);
  		mAltrmiFactory	= new CallbackServerClassAltrmiFactory(false);
  		mAltrmiFactory.setInitializedHostContext(mCallbackHostContext);
  
  		while(!mIsStopped)
  		{
  	        try 
  	        {
  				//recv packets from the client
  	        	int byteArraySize = (int) mDataInputStream.readInt();
  			    byte[] byteArray = new byte[byteArraySize];
  			    mDataInputStream.read(byteArray);
  			    Object obj=SerializationHelper.getInstanceFromBytes(byteArray);
  				
  				//interpret it as a request or reply & notify the corresponding listeners
  				// SHLD we need a queue here to hold the arriving packets
  				// TODO:WORKAROUND: Dont receive until the data is handled some way
  				if(obj instanceof AltrmiRequest)
  				{
  				    mRequest=(AltrmiRequest)obj;
  					synchronized(mRequestLock)
  					{
  						mRequestLock.notify();
  					}
  				}
  				else if(obj instanceof AltrmiReply)
  				{
  				    mReply=(AltrmiReply)obj;
  					synchronized(mReplyLock)
  					{
  						mReplyLock.notify();
  					}
  				}
  				else
  				{
  					//SHLD never occur
  				}
  
  			}
  			catch(java.net.SocketException se) 
  			{
  				mIsStopped=true;
  				synchronized(mRequestLock)
  				{
  					mRequestLock.notify();
  				}
  				synchronized(mReplyLock)
  				{
  					mReplyLock.notify();
  				}
  				return;
  			} 
  			catch(IOException e) 
  			{
  				e.printStackTrace();
  				mIsStopped=true;
  				return;
  			} 
  			catch(ClassNotFoundException ce) 
  			{
  				ce.printStackTrace();
  				mIsStopped=true;
  				return;
  			}
  		}
  		
  	}
  
  	
  
  	/**
  	 * Method getRequestFromMessageLoop.
  	 * @return AltrmiRequest
  	 */
  	private AltrmiRequest getRequestFromMessageLoop()
  	{
  		//if(_replyQueue.size()==0)
  		if(mRequest==null)
  		{
  			synchronized(mRequestLock)
  			{
  				try 
  				{
  					mRequestLock.wait();
  				} 
  				catch(InterruptedException e) 
  				{
  					e.printStackTrace();
  				}
  			}
  		}
  		return mRequest;
  	}
  
  	/**
  	 * Method getReplyFromMessageLoop.
  	 * @return AltrmiReply
  	 */
  	private AltrmiReply getReplyFromMessageLoop()
  	{
  
  		//if(_replyQueue.size()==0)
  		if(mReply==null)
  		{
  
  			synchronized(mReplyLock)
  			{
  				try 
  				{
  					mReplyLock.wait();
  				} 
  				catch(InterruptedException e) 
  				{
  					e.printStackTrace();
  				}
  			}
  		}
  		return mReply;
  	}
  
  	/*
  	 * @see ServerStreamReadWriter#writeReplyAndGetRequest(AltrmiReply)
  	 */
      protected  AltrmiRequest writeReplyAndGetRequest(AltrmiReply altrmiReply)
              throws IOException, ClassNotFoundException {
  
          if (altrmiReply != null) {
              writeReply(altrmiReply);
          }
  		AltrmiRequest req= readRequest();
  		mRequest=null;
          return req;
      }
  
  	/**
  	 * Method writeReply.
  	 * @param altrmiReply
  	 * @throws IOException
  	 */
      private void writeReply(AltrmiReply altrmiReply) throws IOException {
  
          byte[] aBytes = SerializationHelper.getBytesFromInstance(altrmiReply);
  
          mDataOutputStream.writeInt(aBytes.length);
          mDataOutputStream.write(aBytes);
          mDataOutputStream.flush();
      }
  
  	/**
  	 * Method readRequest.
  	 * @return AltrmiRequest
  	 * @throws IOException
  	 * @throws ClassNotFoundException
  	 */
      private AltrmiRequest readRequest() throws IOException, ClassNotFoundException {
  
  		AltrmiRequest altrmiRequest=getRequestFromMessageLoop();
  		if(altrmiRequest instanceof MethodRequest)
  			correctArgs(((MethodRequest)altrmiRequest).getArgs());
          return altrmiRequest;
      }
  
  //client side    
  	/**
  	 * Method postRequest.
  	 * @param altrmiRequest
  	 * @return AltrmiReply
  	 * @throws IOException
  	 * @throws ClassNotFoundException
  	 */
  	protected  AltrmiReply postRequest(AltrmiRequest altrmiRequest)
              throws IOException, ClassNotFoundException {
  
  		if(mIsStopped)
  			throw new AltrmiConnectionClosedException("Client Closed Connection");
  		writeRequest(altrmiRequest);
          AltrmiReply r = readReply();
  		if(r==null)
  			throw new java.io.InterruptedIOException("Client Connection Closed");
  
          mReply=null;
          return r;
      }
  
  	/**
  	 * Method writeRequest.
  	 * @param altrmiRequest
  	 * @throws IOException
  	 */
      private void writeRequest(AltrmiRequest altrmiRequest) throws IOException {
  
          byte[] aBytes = SerializationHelper.getBytesFromInstance(altrmiRequest);
  
          mDataOutputStream.writeInt(aBytes.length);
          mDataOutputStream.write(aBytes);
          mDataOutputStream.flush();
  
      }
  
  	/**
  	 * Method readReply.
  	 * @return AltrmiReply
  	 * @throws IOException
  	 * @throws ClassNotFoundException
  	 */
      private AltrmiReply readReply() throws IOException, ClassNotFoundException {
  		
  		return getReplyFromMessageLoop();
      }
  
  	
  	/**
  	 * Method correctArgs.
  	 * 	UnMarshall the arguments .
  	 * @param args
  	 */
  	public void correctArgs(Object[] args)
  	{
  		for (int i = 0; i < args.length; i++) 
  		{
  			if(args[i] instanceof ExposedObjectProxy)
  			{
  				ExposedObjectProxy exposedObjectProxy =(ExposedObjectProxy)args[i];
  
  				try
  				{
  					//lookup the client-side exported object.
  					Object obj = mAltrmiFactory.lookup(exposedObjectProxy.getPublishedName());
  					args[i]=obj;
  
  				}
  				catch(Exception altrmiConnectionException)
  				{
  					altrmiConnectionException.printStackTrace();
  				}
  			}
  		}
  	}
  }
  
  
  
  1.1                  jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/callback/socket/CallbackEnabledSocketCustomStreamServer.java
  
  Index: CallbackEnabledSocketCustomStreamServer.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.callback.socket;
  
  
  
  import org.apache.excalibur.altrmi.server.AltrmiServer;
  import org.apache.excalibur.altrmi.server.AltrmiServerException;
  import org.apache.excalibur.altrmi.server.impl.AbstractServer;
  import org.apache.excalibur.altrmi.server.impl.ServerStreamReadWriter;
  import org.apache.excalibur.altrmi.server.impl.socket.AbstractCompleteSocketStreamServer;
  import org.apache.excalibur.altrmi.server.impl.adapters.InvocationHandlerAdapter;
  import org.apache.excalibur.altrmi.common.AltrmiRequest;
  import org.apache.excalibur.altrmi.common.AltrmiReply;
  
  import java.net.ServerSocket;
  import java.net.Socket;
  
  import java.io.IOException;
  
  
  /**
   * Class CallbackEnabledSocketCustomStreamServer
   *
   *@author <a href="mailto:vinayc77@yahoo.com">Vinay Chandran</a>
   * @version $Revision: 1.1 $
   */
  public class CallbackEnabledSocketCustomStreamServer extends AbstractCompleteSocketStreamServer {
  
  
  	/*
  	 * @see AbstractCompleteSocketStreamServer#AbstractCompleteSocketStreamServer(int)
  	 */
      public CallbackEnabledSocketCustomStreamServer(int port) throws AltrmiServerException {
          super(port);
      }
  
  	/*
  	 * @see AbstractCompleteSocketStreamServer#AbstractCompleteSocketStreamServer(InvocationHandlerAdapter, int)
  	 */
      public CallbackEnabledSocketCustomStreamServer(InvocationHandlerAdapter invocationHandlerAdapter, int port) throws AltrmiServerException {
          super(invocationHandlerAdapter, port);
      }
  
  
  
  	/*
  	 * @see AbstractCompleteSocketStreamServer#createServerStreamReadWriter()
  	 */
      protected ServerStreamReadWriter createServerStreamReadWriter() {
          return new CallbackEnabledSocketCustomStreamReadWriter();
      }
  
  }
  
  
  
  1.1                  jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/callback/socket/PartialCallbackEnabledSocketCustomStreamServer.java
  
  Index: PartialCallbackEnabledSocketCustomStreamServer.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.callback.socket;
  
  
  
  import org.apache.excalibur.altrmi.server.impl.ServerStreamReadWriter;
  import org.apache.excalibur.altrmi.server.impl.socket.AbstractPartialSocketStreamServer;
  import org.apache.excalibur.altrmi.server.impl.adapters.InvocationHandlerAdapter;
  
  /**
   * Class CallbackEnabledSocketCustomStreamServer
   *
   * @author <a href="mailto:vinayc77@yahoo.com">Vinay Chandran</a>
   * @author Peter Royal
   * @version $Revision: 1.1 $
   */
  public class PartialCallbackEnabledSocketCustomStreamServer extends AbstractPartialSocketStreamServer {
      public PartialCallbackEnabledSocketCustomStreamServer()
      {
      }
  
      public PartialCallbackEnabledSocketCustomStreamServer(InvocationHandlerAdapter inovcationHandlerAdapter)
      {
          super(inovcationHandlerAdapter);
      }
  
      /*
  	 * @see AbstractPartialSocketStreamServer#createServerStreamReadWriter()
  	 */
      protected ServerStreamReadWriter createServerStreamReadWriter() {
          return new CallbackEnabledSocketCustomStreamReadWriter();
      }
  
  }
  
  
  
  1.1                  jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/callback/socket/CallbackEnabledSocketCustomStreamHostContext.java
  
  Index: CallbackEnabledSocketCustomStreamHostContext.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.impl.callback.socket;
  
  
  
  import org.apache.excalibur.altrmi.client.impl.AbstractHostContext;
  import org.apache.excalibur.altrmi.client.impl.socket.SocketCustomStreamHostContext;
  import org.apache.excalibur.altrmi.common.AltrmiConnectionException;
  import org.apache.excalibur.altrmi.common.AltrmiCallbackException;
  
  import java.net.Socket;
  /**
   * Class CallbackEnabledSocketCustomStreamHostContext
   * @author <a href="mailto:vinayc77@yahoo.com">Vinay Chandran</a>
   * @version $Revision: 1.1 $
   */
  public class CallbackEnabledSocketCustomStreamHostContext extends AbstractHostContext {
  
      public CallbackEnabledSocketCustomStreamHostContext(String host, int port) throws AltrmiConnectionException {
          super(new CallbackEnabledSocketCustomStreamInvocationHandler(host, port, SocketCustomStreamHostContext.class.getClassLoader()));
      }
  
      public CallbackEnabledSocketCustomStreamHostContext(String host, int port, ClassLoader classLoader) throws AltrmiConnectionException {
          super(new CallbackEnabledSocketCustomStreamInvocationHandler(host, port, classLoader));
      }
  	
  	public boolean exposeObject(Object tobeExposedObject,Class tobeExposedInterface) throws AltrmiCallbackException
  	{
  		return ((CallbackEnabledSocketCustomStreamInvocationHandler)getInvocationHandler()).exposeObject(tobeExposedObject,tobeExposedInterface);
  	}
  
  }
  
  
  
  1.1                  jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/callback/socket/CallbackEnabledSocketCustomStreamInvocationHandler.java
  
  Index: CallbackEnabledSocketCustomStreamInvocationHandler.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.impl.callback.socket;
  
  
  
  import java.io.IOException;
  import java.io.InputStream;
  import java.io.OutputStream;
  
  import org.apache.excalibur.altrmi.client.impl.stream.ClientStreamReadWriter;
  import org.apache.excalibur.altrmi.common.AltrmiConnectionException;
  import org.apache.excalibur.altrmi.common.AltrmiCallbackException;
  import org.apache.excalibur.altrmi.client.impl.callback.stream.CallbackEnabledClientCustomStreamReadWriter;
  import org.apache.excalibur.altrmi.client.impl.socket.AbstractSocketStreamInvocationHandler;
  
  
  /**
   * Class CallbackEnabledSocketCustomStreamInvocationHandler
   *
   * @author <a href="mailto:vinayc77@yahoo.com">Vinay Chandran</a>
   * @version $Revision: 1.1 $
   */
  public final class CallbackEnabledSocketCustomStreamInvocationHandler
          extends AbstractSocketStreamInvocationHandler {
  
  	private CallbackEnabledClientCustomStreamReadWriter mCallbackEnabledClientCustomStreamReadWriter;
  	/*
  	 * @see AbstractSocketStreamInvocationHandler#AbstractSocketStreamInvocationHandler(String, int, ClassLoader)
  	 */
      public CallbackEnabledSocketCustomStreamInvocationHandler(String host, int port, ClassLoader classLoader)
              throws AltrmiConnectionException {
          super(host, port, classLoader);
      }
  
  	/* 
  	 * @see AbstractSocketStreamInvocationHandler#createClientStreamReadWriter(InputStream, OutputStream)
  	 */
      protected ClientStreamReadWriter createClientStreamReadWriter(
              InputStream in, OutputStream out) throws IOException {
  		if(mCallbackEnabledClientCustomStreamReadWriter==null)
  		{
  			mCallbackEnabledClientCustomStreamReadWriter = new CallbackEnabledClientCustomStreamReadWriter(in, out, mInterfacesClassLoader);
  		}
          return mCallbackEnabledClientCustomStreamReadWriter;
      }
  
  	
  	public boolean exposeObject(Object tobeExposedObject,Class tobeExposedInterface) throws AltrmiCallbackException
  	{
  		return mCallbackEnabledClientCustomStreamReadWriter.exposeObject(tobeExposedObject,tobeExposedInterface);
  	}
  	public String  getPublishedName(Object tobeExposedObject)
  	{
  		return mCallbackEnabledClientCustomStreamReadWriter.getPublishedName(tobeExposedObject);
  	}
  }
  
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>