avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hamm...@apache.org
Subject cvs commit: jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/socket CallbackEnabledCustomSocketStreamServer.java
Date Wed, 10 Apr 2002 23:36:58 GMT
hammant     02/04/10 16:36:58

  Modified:    altrmi/src/java/org/apache/excalibur/altrmi/client
                        AltrmiProxy.java
               altrmi/src/java/org/apache/excalibur/altrmi/client/impl
                        AbstractAltrmiFactory.java
                        ClientClassAltrmiFactory.java
                        ServerClassAltrmiFactory.java
               altrmi/src/java/org/apache/excalibur/altrmi/client/impl/socket
                        CallbackEnabledCustomSocketStreamHostContext.java
                        CallbackEnabledCustomSocketStreamInvocationHandler.java
               altrmi/src/java/org/apache/excalibur/altrmi/generator
                        ProxyGeneratorImpl.java
               altrmi/src/java/org/apache/excalibur/altrmi/server/impl
                        AbstractServer.java
                        CallbackEnabledCustomSocketStreamReadWriter.java
               altrmi/src/java/org/apache/excalibur/altrmi/server/impl/socket
                        CallbackEnabledCustomSocketStreamServer.java
  Added:       altrmi/src/java/org/apache/excalibur/altrmi/client
                        ProxyHelper.java
               altrmi/src/java/org/apache/excalibur/altrmi/client/impl
                        DefaultProxyHelper.java
  Removed:     altrmi/src/java/org/apache/excalibur/altrmi/client/impl
                        BaseServedObject.java
  Log:
  Split of BaseServedObject into interface/impl with new name (ProxyHelper)
  
  Revision  Changes    Path
  1.2       +2 -4      jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/AltrmiProxy.java
  
  Index: AltrmiProxy.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/AltrmiProxy.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- AltrmiProxy.java	3 Apr 2002 11:29:49 -0000	1.1
  +++ AltrmiProxy.java	10 Apr 2002 23:36:57 -0000	1.2
  @@ -10,7 +10,7 @@
   
   
   
  -import org.apache.excalibur.altrmi.client.impl.BaseServedObject;
  +import org.apache.excalibur.altrmi.client.impl.DefaultProxyHelper;
   
   
   /**
  @@ -18,12 +18,10 @@
    *
    *
    * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
  - * @version $Revision: 1.1 $
  + * @version $Revision: 1.2 $
    */
   public interface AltrmiProxy
   {
  -
  -    //BaseServedObject altrmiGetBaseServedObject();
   
       /**
        * Method altrmiGetReferenceID
  
  
  
  1.1                  jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/ProxyHelper.java
  
  Index: ProxyHelper.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 ProxyHelper
   *
   *
   * @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.1 $
   */
  public interface ProxyHelper
  {
  
      /**
       * Method processObjectRequestGettingFacade
       *
       *
       * @param methodSignature
       * @param args
       * @param objectName
       *
       * @return
       *
       * @throws Throwable
       *
       */
      Object processObjectRequestGettingFacade(
          String methodSignature, Object[] args, String objectName) throws Throwable;
  
      /**
       * Method processObjectRequest
       *
       *
       * @param methodSignature
       * @param args
       *
       * @return
       *
       * @throws Throwable
       *
       */
      Object processObjectRequest(String methodSignature, Object[] args) throws Throwable;
  
      /**
       * Method processVoidRequest
       *
       *
       * @param methodSignature
       * @param args
       *
       * @throws Throwable
       *
       */
      void processVoidRequest(String methodSignature, Object[] args) throws Throwable;
  
      /**
       * Method processVoidRequestWithRedirect
       *
       *
       * @param methodSignature
       * @param args
       *
       * @throws Throwable
       *
       */
      void processVoidRequestWithRedirect(String methodSignature, Object[] args) throws Throwable;
  
      /**
       * Method getReferenceID
       *
       *
       * @param factory
       *
       * @return
       *
       */
      Long getReferenceID(Object factory);
  }
  
  
  
  1.2       +2 -2      jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/AbstractAltrmiFactory.java
  
  Index: AbstractAltrmiFactory.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/AbstractAltrmiFactory.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- AbstractAltrmiFactory.java	3 Apr 2002 11:29:49 -0000	1.1
  +++ AbstractAltrmiFactory.java	10 Apr 2002 23:36:58 -0000	1.2
  @@ -34,7 +34,7 @@
    *
    *
    * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
  - * @version $Revision: 1.1 $
  + * @version $Revision: 1.2 $
    */
   public abstract class AbstractAltrmiFactory implements AltrmiFactory {
   
  @@ -100,7 +100,7 @@
       protected abstract Class getFacadeClass(String publishedServiceName, String objectName,
boolean beanOnly) throws AltrmiConnectionException, ClassNotFoundException;
   
       protected abstract Object getInstance(
  -        String publishedServiceName, String objectName, BaseServedObject baseServedObject,
  +        String publishedServiceName, String objectName, DefaultProxyHelper proxyHelper,
               boolean beanOnly) throws AltrmiConnectionException;
   
       /**
  
  
  
  1.2       +4 -4      jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/ClientClassAltrmiFactory.java
  
  Index: ClientClassAltrmiFactory.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/ClientClassAltrmiFactory.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ClientClassAltrmiFactory.java	3 Apr 2002 11:29:50 -0000	1.1
  +++ ClientClassAltrmiFactory.java	10 Apr 2002 23:36:58 -0000	1.2
  @@ -29,7 +29,7 @@
    *
    *
    * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
  - * @version $Revision: 1.1 $
  + * @version $Revision: 1.2 $
    */
   public class ClientClassAltrmiFactory extends AbstractAltrmiFactory {
   
  @@ -81,7 +81,7 @@
           }
   
           LookupReply lr = (LookupReply) ar;
  -        BaseServedObject baseObj = new BaseServedObject(this,
  +        DefaultProxyHelper baseObj = new DefaultProxyHelper(this,
                                                           mHostContext.getInvocationHandler(),
                                                           publishedServiceName, "Main",
                                                           lr.getReferenceID(), mSession);
  @@ -116,7 +116,7 @@
        *
        */
       protected Object getInstance(
  -            String publishedServiceName, String objectName, BaseServedObject baseServedObject,
  +            String publishedServiceName, String objectName, DefaultProxyHelper proxyHelper,
               boolean beanOnly)
                   throws AltrmiConnectionException {
   
  @@ -125,7 +125,7 @@
           try {
               Class clazz = getFacadeClass(publishedServiceName, objectName, beanOnly);
               Constructor[] constructors = clazz.getConstructors();
  -            Object retVal = constructors[0].newInstance(new Object[]{ baseServedObject
});
  +            Object retVal = constructors[0].newInstance(new Object[]{ proxyHelper });
   
               return retVal;
           } catch (InvocationTargetException ite) {
  
  
  
  1.3       +4 -4      jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/ServerClassAltrmiFactory.java
  
  Index: ServerClassAltrmiFactory.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/ServerClassAltrmiFactory.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ServerClassAltrmiFactory.java	10 Apr 2002 22:33:10 -0000	1.2
  +++ ServerClassAltrmiFactory.java	10 Apr 2002 23:36:58 -0000	1.3
  @@ -36,7 +36,7 @@
    *
    *
    * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
  - * @version $Revision: 1.2 $
  + * @version $Revision: 1.3 $
    */
   public class ServerClassAltrmiFactory extends AbstractAltrmiFactory {
   
  @@ -89,7 +89,7 @@
           }
   
           LookupReply lr = (LookupReply) ar;
  -        BaseServedObject baseObj = new BaseServedObject(this,
  +        DefaultProxyHelper baseObj = new DefaultProxyHelper(this,
                                                           mHostContext.getInvocationHandler(),
                                                           publishedServiceName, "Main",
                                                           lr.getReferenceID(), mSession);
  @@ -162,7 +162,7 @@
       }
   
       protected Object getInstance(
  -            String publishedServiceName, String objectName, BaseServedObject baseServedObject,
boolean beanOnly)
  +            String publishedServiceName, String objectName, DefaultProxyHelper proxyHelper,
boolean beanOnly)
                   throws AltrmiConnectionException {
   
           String code = "2";
  @@ -174,7 +174,7 @@
           try {
               Class clazz = getFacadeClass(publishedServiceName, objectName, beanOnly);
               Constructor[] constructors = clazz.getConstructors();
  -            Object retVal = constructors[0].newInstance(new Object[]{ baseServedObject
});
  +            Object retVal = constructors[0].newInstance(new Object[]{ proxyHelper });
   
               return retVal;
           } catch (InvocationTargetException ite) {
  
  
  
  1.1                  jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/DefaultProxyHelper.java
  
  Index: DefaultProxyHelper.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;
  
  
  
  import org.apache.excalibur.altrmi.common.AltrmiInvocationHandler;
  import org.apache.excalibur.altrmi.common.AltrmiReply;
  import org.apache.excalibur.altrmi.common.AltrmiRequest;
  import org.apache.excalibur.altrmi.common.MethodReply;
  import org.apache.excalibur.altrmi.common.MethodRequest;
  import org.apache.excalibur.altrmi.common.ExceptionReply;
  import org.apache.excalibur.altrmi.common.AltrmiInvocationException;
  import org.apache.excalibur.altrmi.common.MethodFacadeReply;
  import org.apache.excalibur.altrmi.common.MethodFacadeRequest;
  import org.apache.excalibur.altrmi.common.FacadeRefHolder;
  import org.apache.excalibur.altrmi.common.MethodFacadeArrayReply;
  import org.apache.excalibur.altrmi.common.GarbageCollectionRequest;
  import org.apache.excalibur.altrmi.common.GarbageCollectionReply;
  import org.apache.excalibur.altrmi.client.AltrmiProxy;
  import org.apache.excalibur.altrmi.client.ProxyHelper;
  
  import java.lang.reflect.Array;
  
  //callback
  import org.apache.excalibur.altrmi.common.ExposedObjectProxy;
  import org.apache.excalibur.altrmi.client.impl.socket.CallbackEnabledCustomSocketStreamInvocationHandler;
  import java.util.StringTokenizer;
  import org.apache.excalibur.altrmi.common.AltrmiCallbackException;
  
  /**
   * Class DefaultProxyHelper
   *
   *
   * @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.1 $
   */
  public final class DefaultProxyHelper implements ProxyHelper {
  
      private final transient AbstractAltrmiFactory mAltrmiFactory;
      private final transient AltrmiInvocationHandler mInvocationHandler;
      private final transient String mPublishedServiceName;
      private final transient String mObjectName;
      private final transient Long mReferenceID;
      private final transient Long mSession;
  	//<callback related>
  	private boolean mbIsCallbackAware=false;
  	private CallbackEnabledCustomSocketStreamInvocationHandler mCallbackEnabledCustomSocketStreamInvocationHandler=null;
  	//</callback related>
      /**
       * Constructor DefaultProxyHelper
       *
       *
       * @param altrmiFactory
       * @param invocationHandler
       * @param pubishedServiceName
       * @param objectName
       * @param referenceID
       * @param session
       *
       */
      public DefaultProxyHelper(AbstractAltrmiFactory altrmiFactory,
                              AltrmiInvocationHandler invocationHandler,
                              String pubishedServiceName, String objectName, Long referenceID,
                              Long session) {
  
          mAltrmiFactory = altrmiFactory;
          mInvocationHandler = invocationHandler;
          mPublishedServiceName = pubishedServiceName;
          mObjectName = objectName;
          mReferenceID = referenceID;
          mSession = session;
          //<callback related>
          if(mInvocationHandler instanceof CallbackEnabledCustomSocketStreamInvocationHandler)
  		{
  
  			mCallbackEnabledCustomSocketStreamInvocationHandler	=
  				(CallbackEnabledCustomSocketStreamInvocationHandler)mInvocationHandler;
  			mbIsCallbackAware=true;
  		}
          //</callback related>
      }
  
      /**
       * Method registerImplObject
       *
       *
       * @param implBean
       *
       */
      public void registerImplObject(Object implBean) {
          mAltrmiFactory.registerReferenceObject(implBean, mReferenceID);
      }
  
      /**
       * Method processObjectRequestGettingFacade
       *
       *
       * @param methodSignature
       * @param args
       * @param objectName
       *
       * @return
       *
       * @throws Throwable
       *
       */
      public Object processObjectRequestGettingFacade(
              String methodSignature, Object[] args, String objectName) throws Throwable {
  
          boolean arrayRetVal = objectName.endsWith("[]");
          String objNameWithoutArray = objectName.substring(0, objectName.length() - 2);
          MethodFacadeRequest request;
  
          if (arrayRetVal) {
              request = new MethodFacadeRequest(mPublishedServiceName, mObjectName,
                                                methodSignature, args, mReferenceID,
                                                objNameWithoutArray, mSession);
          } else {
              request = new MethodFacadeRequest(mPublishedServiceName, mObjectName,
                                                methodSignature, args, mReferenceID, objectName,
                                                mSession);
          }
  
          AltrmiReply reply = mInvocationHandler.handleInvocation(request);
  
          if (reply.getReplyCode() == AltrmiReply.METHODFACADEREPLY) {
              MethodFacadeReply mfr = (MethodFacadeReply) reply;
              Long ref = mfr.getReferenceID();
  
              // it might be that the return value was intended to be null.
              if (ref == null) {
                  return null;
              }
  
              Object implBean = mAltrmiFactory.getImplObj(ref);
  
              if (implBean == null) {
                  DefaultProxyHelper bo2 = new DefaultProxyHelper(mAltrmiFactory, mInvocationHandler,
                                                              mPublishedServiceName, objectName,
                                                              ref, mSession);
                  Object retFacade = mAltrmiFactory.getInstance(mPublishedServiceName, objectName,
                                                                bo2, mAltrmiFactory.isBeanOnly());
  
                  bo2.registerImplObject(retFacade);
  
                  return retFacade;
              } else {
                  return implBean;
              }
          } else if (reply.getReplyCode() == AltrmiReply.METHODFACADEARRAYREPLY) {
              MethodFacadeArrayReply mfar = (MethodFacadeArrayReply) reply;
              Class clazz = mAltrmiFactory.getFacadeClass(mPublishedServiceName,
                                                          objNameWithoutArray,
                                                          mAltrmiFactory.isBeanOnly());
              Long[] refs = mfar.getReferenceIDs();
              Object[] implBeans = (Object[]) Array.newInstance(clazz, refs.length);
  
              for (int i = 0; i < refs.length; i++) {
                  Long ref = refs[i];
  
                  if (ref == null) {
                      implBeans[i] = null;
                  } else {
                      implBeans[i] = mAltrmiFactory.getImplObj(ref);
  
                      if (implBeans[i] == null) {
                          DefaultProxyHelper bo2 = new DefaultProxyHelper(mAltrmiFactory,
                                                                      mInvocationHandler,
                                                                      mPublishedServiceName,
                                                                      objNameWithoutArray,
refs[i],
                                                                      mSession);
                          Object retFacade = null;
  
                          try {
                              retFacade = mAltrmiFactory.getInstance(mPublishedServiceName,
                                                                     objNameWithoutArray,
bo2,
                                                                     mAltrmiFactory.isBeanOnly());
                          } catch (Exception e) {
                              System.out.println("objNameWithoutArray=" + objNameWithoutArray);
                              System.out.flush();
                              e.printStackTrace();
                          }
  
                          bo2.registerImplObject(retFacade);
  
                          implBeans[i] = retFacade;
                      }
                  }
              }
  
              return implBeans;
          } else if (reply.getReplyCode() == AltrmiReply.EXCEPTIONREPLY) {
              ExceptionReply er = (ExceptionReply) reply;
  
              throw er.getReplyException();
          } else {
              throw new AltrmiInvocationException("Internal Error : Unknown reply type :"
                                                  + reply.getClass().getName());
          }
      }
  
      /**
       * Method processObjectRequest
       *
       *
       * @param methodSignature
       * @param args
       *
       * @return
       *
       * @throws Throwable
       *
       */
      public Object processObjectRequest(String methodSignature, Object[] args) throws Throwable
{
  
          marshallCorrection(methodSignature,args);
  
          MethodRequest request = new MethodRequest(mPublishedServiceName, mObjectName,
                                                    methodSignature, args, mReferenceID, mSession);
          AltrmiReply reply = mInvocationHandler.handleInvocation(request);
  
          if (reply.getReplyCode() == AltrmiReply.METHODREPLY) {
              MethodReply or = (MethodReply) reply;
  
              return or.getReplyObject();
          } else if (reply.getReplyCode() == AltrmiReply.EXCEPTIONREPLY) {
              ExceptionReply er = (ExceptionReply) reply;
  
              throw er.getReplyException();
          } else {
              throw new AltrmiInvocationException("Internal Error : Unknown reply type :"
                                                  + reply.getClass().getName());
          }
      }
  
      /**
       * Method processVoidRequest
       *
       *
       * @param methodSignature
       * @param args
       *
       * @throws Throwable
       *
       */
      public void processVoidRequest(String methodSignature, Object[] args) throws Throwable
{
  
          MethodRequest request = new MethodRequest(mPublishedServiceName, mObjectName,
                                                    methodSignature, args, mReferenceID, mSession);
  
          //debug(args);
          AltrmiReply reply = mInvocationHandler.handleInvocation(request);
  
          if (reply.getReplyCode() == AltrmiReply.METHODREPLY) {
              MethodReply or = (MethodReply) reply;
  
              return;
          } else if (reply.getReplyCode() == AltrmiReply.EXCEPTIONREPLY) {
              ExceptionReply er = (ExceptionReply) reply;
  
              throw er.getReplyException();
          } else {
              throw new AltrmiInvocationException("Internal Error : Unknown reply type :"
                                                  + reply.getClass().getName());
          }
      }
  
      /**
       * Method processVoidRequestWithRedirect
       *
       *
       * @param methodSignature
       * @param args
       *
       * @throws Throwable
       *
       */
      public void processVoidRequestWithRedirect(String methodSignature, Object[] args)
              throws Throwable {
  
          Object[] newArgs = new Object[args.length];
  
          for (int i = 0; i < args.length; i++) {
              if (args[i] instanceof AltrmiProxy) {
  
                  //TODO somehow get the reference details and put a redirect place holder
here
              } else {
                  newArgs[i] = args[i];
              }
          }
  
          processVoidRequest(methodSignature, newArgs);
      }
  
      /**
       * Method makeFacadeRefHolder
       *
       *
       * @param obj
       * @param objectName
       *
       * @return
       *
       */
      public FacadeRefHolder makeFacadeRefHolder(AltrmiProxy obj, String objectName) {
  
          Long refID = mAltrmiFactory.getReferenceID(obj);
  
          return new FacadeRefHolder(refID, objectName);
      }
  
      private void debug(Object[] args) {
  
          for (int i = 0; i < args.length; i++) {
              Object arg = args[i];
  
              System.out.println("i = " + i + " class= " + args[i].getClass().getName() +
" "
                                 + args[i].toString());
          }
      }
  
      private void marshallCorrection(String methodSignature , Object[] args) {
  
  		String _methodArgumentClasses = methodSignature.substring(methodSignature.indexOf("(")+1,methodSignature.lastIndexOf(")"));
  		StringTokenizer _methodArgumentClassTokens = new StringTokenizer(_methodArgumentClasses,",");
  
          for (int i = 0; i < args.length; i++) {
  
  			String _sArgClass=_methodArgumentClassTokens.nextToken();
  			Class _cArgClass=null;
  			try
  			{
  
  				_cArgClass=Class.forName(_sArgClass);
  			}
  			catch(ClassNotFoundException cnfe)
  			{
  				System.err.println("Class "+_sArgClass +" Not Found");
  			}
  
              //check whether its one of those remote ref that we got from the server
              //TODO : todo
              if (args[i] instanceof AltrmiProxy) {
                  AltrmiProxy proxy = (AltrmiProxy) args[i];
  
                  if (mAltrmiFactory.getReferenceID(proxy) != null) {
                      String objName = args[i].getClass().getName().substring(16);
  
                      args[i] = makeFacadeRefHolder(proxy, objName);
                  }
              }
              else if(mbIsCallbackAware)
  			{
  				String publishedName = mCallbackEnabledCustomSocketStreamInvocationHandler.getPublishedName(args[i]);
  				if(publishedName!=null) //already published
  				{
  					ExposedObjectProxy exposedObjectProxy =  new ExposedObjectProxy(publishedName);
  					args[i]=exposedObjectProxy;
  				}
  				else //check whether its Publish'able
  				{
  					if(!_cArgClass.isInterface()) //Hey do we handle only interfaces?
  						continue;
  					if(_cArgClass.isAssignableFrom(args[i].getClass()))
  					{
  						try
  						{
  							mCallbackEnabledCustomSocketStreamInvocationHandler.exposeObject(args[i],_cArgClass);
  						}
  						catch(AltrmiCallbackException ace)
  						{
  							ace.printStackTrace();
  						}
  						publishedName = mCallbackEnabledCustomSocketStreamInvocationHandler.getPublishedName(args[i]);
  						ExposedObjectProxy exposedObjectProxy =  new ExposedObjectProxy(publishedName);
  						args[i]=exposedObjectProxy;
  
  					}
  
  				}
  			}
          }
      }
  
      /**
       * Method getReferenceID
       *
       *
       * @param factory
       *
       * @return
       *
       */
      public Long getReferenceID(Object factory) {
  
          // this checks the factory because reference IDs should not be
          // given out to any requester.  It should be privileged information.
  
          if (factory == mAltrmiFactory) {
              return mReferenceID;
          } else {
              return null;
          }
      }
  
      protected void finalize() throws Throwable {
          synchronized(mAltrmiFactory) {
              GarbageCollectionReply gcr = (GarbageCollectionReply) mInvocationHandler.handleInvocation(new
GarbageCollectionRequest(mPublishedServiceName, mObjectName, mSession, mReferenceID));
              //System.out.println("BO finalizing");
          }
          super.finalize();
      }
  }
  
  
  
  1.2       +1 -2      jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/socket/CallbackEnabledCustomSocketStreamHostContext.java
  
  Index: CallbackEnabledCustomSocketStreamHostContext.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/socket/CallbackEnabledCustomSocketStreamHostContext.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- CallbackEnabledCustomSocketStreamHostContext.java	10 Apr 2002 22:46:18 -0000	1.1
  +++ CallbackEnabledCustomSocketStreamHostContext.java	10 Apr 2002 23:36:58 -0000	1.2
  @@ -11,14 +11,13 @@
   
   import org.apache.excalibur.altrmi.client.impl.AbstractHostContext;
   import org.apache.excalibur.altrmi.common.AltrmiConnectionException;
  -import org.apache.excalibur.altrmi.common.*;
   import org.apache.excalibur.altrmi.common.AltrmiCallbackException;
   
   import java.net.Socket;
   /**
    * Class CallbackEnabledCustomSocketStreamHostContext
    * @author <a href="mailto:vinayc77@yahoo.com">Vinay Chandran</a>
  - * @version $Revision: 1.1 $
  + * @version $Revision: 1.2 $
    */
   public class CallbackEnabledCustomSocketStreamHostContext extends AbstractHostContext {
   
  
  
  
  1.2       +1 -3      jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/socket/CallbackEnabledCustomSocketStreamInvocationHandler.java
  
  Index: CallbackEnabledCustomSocketStreamInvocationHandler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/socket/CallbackEnabledCustomSocketStreamInvocationHandler.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- CallbackEnabledCustomSocketStreamInvocationHandler.java	10 Apr 2002 22:46:18 -0000	1.1
  +++ CallbackEnabledCustomSocketStreamInvocationHandler.java	10 Apr 2002 23:36:58 -0000	1.2
  @@ -14,10 +14,8 @@
   import java.io.OutputStream;
   
   import org.apache.excalibur.altrmi.client.impl.stream.ClientStreamReadWriter;
  -import org.apache.excalibur.altrmi.common.*;
   import org.apache.excalibur.altrmi.common.AltrmiConnectionException;
   import org.apache.excalibur.altrmi.common.AltrmiCallbackException;
  -import org.apache.excalibur.altrmi.client.impl.stream.*;
   import org.apache.excalibur.altrmi.client.impl.stream.CallbackEnabledClientCustomStreamReadWriter;
   
   
  @@ -25,7 +23,7 @@
    * Class CallbackEnabledCustomSocketStreamInvocationHandler
    *
    * @author <a href="mailto:vinayc77@yahoo.com">Vinay Chandran</a>
  - * @version $Revision: 1.1 $
  + * @version $Revision: 1.2 $
    */
   public final class CallbackEnabledCustomSocketStreamInvocationHandler
           extends AbstractSocketStreamInvocationHandler {
  
  
  
  1.3       +11 -11    jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/generator/ProxyGeneratorImpl.java
  
  Index: ProxyGeneratorImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/generator/ProxyGeneratorImpl.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ProxyGeneratorImpl.java	9 Apr 2002 22:42:01 -0000	1.2
  +++ ProxyGeneratorImpl.java	10 Apr 2002 23:36:58 -0000	1.3
  @@ -32,7 +32,7 @@
    *
    * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
    * @author Mike Miller of www.gac.com
  - * @version $Revision: 1.2 $
  + * @version $Revision: 1.3 $
    */
   public class ProxyGeneratorImpl extends AbstractMethodHandler implements ProxyGenerator
   {
  @@ -245,13 +245,13 @@
           mClassSource.print("public class AltrmiGenerated" + mGenName + "_" + name);
           mClassSource.println(" implements org.apache.excalibur.altrmi.client.AltrmiProxy{
");
           mClassSource.println(
  -            "  private transient org.apache.excalibur.altrmi.client.impl.BaseServedObject
mBaseServedObject;");
  +                "  private transient org.apache.excalibur.altrmi.client.ProxyHelper mProxyHelper;");
   
           // Generate Constructor
           mClassSource.println(
               "  public AltrmiGenerated" + mGenName + "_" + name
  -            + " (org.apache.excalibur.altrmi.client.impl.BaseServedObject baseServedObject)
{");
  -        mClassSource.println("      mBaseServedObject = baseServedObject;");
  +            + " (org.apache.excalibur.altrmi.client.ProxyHelper proxyHelper) {");
  +        mClassSource.println("      mProxyHelper = proxyHelper;");
           mClassSource.println("  }");
   
           // helper method for the factory.
  @@ -259,10 +259,10 @@
           mClassSource
               .println("    public Long altrmiGetReferenceID(Object factoryThatIsAsking)
{");
           mClassSource
  -            .println("        return mBaseServedObject.getReferenceID(factoryThatIsAsking);");
  +            .println("        return mProxyHelper.getReferenceID(factoryThatIsAsking);");
           mClassSource.println("    }");
   
  -        // TODO BaseServedObject altrmiGetBaseServedObject();
  +        // TODO DefaultProxyHelper altrmiGetProxyHelper();
           for (int x = 0; x < interfacesToExpose.length; x++)
           {
               Class clazz = interfacesToExpose[x];
  @@ -340,7 +340,7 @@
   
                       if (rClass.equals("void"))
                       {
  -                        mClassSource.println("      mBaseServedObject.processVoidRequest(\""
  +                        mClassSource.println("      mProxyHelper.processVoidRequest(\""
                                                + methodSignature.toString() + "\",args);");
                       }
                       else
  @@ -350,7 +350,7 @@
                           if (isFacadeRetVal)
                           {
                               mClassSource.println(
  -                                "      Object retVal = mBaseServedObject.processObjectRequestGettingFacade(\""
  +                                "      Object retVal = mProxyHelper.processObjectRequestGettingFacade(\""
                                   + methodSignature.toString() + "\",args,\""
                                   + encodeClassName(getClassType(rClass)) + "\");");
                               mClassSource.println("      return (" + getClassType(rClass)
  @@ -359,7 +359,7 @@
                           else
                           {
                               mClassSource.println(
  -                                "      Object retVal = mBaseServedObject.processObjectRequest(\""
  +                                "      Object retVal = mProxyHelper.processObjectRequest(\""
                                   + methodSignature.toString() + "\",args);");
                               generateReturnLine(rClass);
                           }
  @@ -422,8 +422,8 @@
               class2Source.println(" { ");
               class2Source.println(
                   "  public AltrmiGenerated2" + mGenName + "_" + name
  -                + " (org.apache.excalibur.altrmi.client.impl.BaseServedObject baseServedObject)
{");
  -            class2Source.println("      super(baseServedObject);");
  +                + " (org.apache.excalibur.altrmi.client.ProxyHelper proxyHelper) {");
  +            class2Source.println("      super(proxyHelper);");
               class2Source.println("  }");
               class2Source.println("}");
               class2Source.close();
  
  
  
  1.2       +8 -2      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.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- AbstractServer.java	3 Apr 2002 11:29:55 -0000	1.1
  +++ AbstractServer.java	10 Apr 2002 23:36:58 -0000	1.2
  @@ -14,8 +14,14 @@
   import org.apache.excalibur.altrmi.common.AltrmiReply;
   import org.apache.excalibur.altrmi.common.AltrmiRequest;
   import org.apache.excalibur.altrmi.common.MethodRequest;
  -import org.apache.excalibur.altrmi.server.*;
   import org.apache.excalibur.altrmi.server.impl.adapters.InvocationHandlerAdapter;
  +import org.apache.excalibur.altrmi.server.AltrmiServer;
  +import org.apache.excalibur.altrmi.server.ClassRetriever;
  +import org.apache.excalibur.altrmi.server.AltrmiAuthenticator;
  +import org.apache.excalibur.altrmi.server.AltrmiServerConnection;
  +import org.apache.excalibur.altrmi.server.PublicationException;
  +import org.apache.excalibur.altrmi.server.PublicationDescription;
  +import org.apache.excalibur.altrmi.server.MethodInvocationHandler;
   import org.apache.avalon.framework.logger.Logger;
   import org.apache.avalon.framework.logger.LogEnabled;
   import org.apache.avalon.framework.logger.ConsoleLogger;
  @@ -30,7 +36,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.1 $
  + * @version $Revision: 1.2 $
    */
   public abstract class AbstractServer extends AbstractMethodHandler
           implements AltrmiServer, LogEnabled {
  
  
  
  1.2       +7 -7      jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/CallbackEnabledCustomSocketStreamReadWriter.java
  
  Index: CallbackEnabledCustomSocketStreamReadWriter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/CallbackEnabledCustomSocketStreamReadWriter.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- CallbackEnabledCustomSocketStreamReadWriter.java	10 Apr 2002 22:46:18 -0000	1.1
  +++ CallbackEnabledCustomSocketStreamReadWriter.java	10 Apr 2002 23:36:58 -0000	1.2
  @@ -22,7 +22,7 @@
   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.BaseServedObject;
  +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;
  @@ -47,7 +47,7 @@
    * 	there are no extra network connections needed to enable callbacks.
    *
    * @author <a href="mailto:vinayc77@yahoo.com">Vinay Chandran</a>
  - * @version $Revision: 1.1 $
  + * @version $Revision: 1.2 $
    */
   public class CallbackEnabledCustomSocketStreamReadWriter extends ServerStreamReadWriter
implements Runnable 
   {
  @@ -331,7 +331,7 @@
   	 * Class CallbackHostContext wraps a StreamInvocationHandler 
   	 *
   	 * @author <a href="mailto:vinayc77@yahoo.com">Vinay Chandran</a>
  -	 * @version $Revision: 1.1 $
  +	 * @version $Revision: 1.2 $
   	 */
   	private class CallbackHostContext extends  AbstractHostContext
   	{
  @@ -352,7 +352,7 @@
   	 * 	provides public access to the setObjectReadWriter function
   	 *
   	 * @author <a href="mailto:vinayc77@yahoo.com">Vinay Chandran</a>
  -	 * @version $Revision: 1.1 $
  +	 * @version $Revision: 1.2 $
   	 */
   	
   	private class CallbackStreamInvocationHandler extends StreamInvocationHandler
  @@ -386,7 +386,7 @@
   	 *  CallbackEnabledSocketStreamReadWriter
   	 *
   	 * @author <a href="mailto:vinayc77@yahoo.com">Vinay Chandran</a>
  -	 * @version $Revision: 1.1 $
  +	 * @version $Revision: 1.2 $
   	 */
   
   	private class CallbackServerClientReadWriter extends ClientStreamReadWriter
  @@ -412,7 +412,7 @@
   	 * 	PublishedName during this part of the protocol.
   	 *
   	 * @author <a href="mailto:vinayc77@yahoo.com">Vinay Chandran</a>
  -	 * @version $Revision: 1.1 $
  +	 * @version $Revision: 1.2 $
   	 */
   
   	private class CallbackServerClassAltrmiFactory extends ServerClassAltrmiFactory
  @@ -463,7 +463,7 @@
   	        }
   	
   	        LookupReply lr = (LookupReply) ar;
  -	        BaseServedObject baseObj = new BaseServedObject(this,
  +	        DefaultProxyHelper baseObj = new DefaultProxyHelper(this,
   	                                                        mHostContext.getInvocationHandler(),
   	                                                        publishedServiceName, "Main",
   	                                                        lr.getReferenceID(), mSession);
  
  
  
  1.2       +1 -2      jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/socket/CallbackEnabledCustomSocketStreamServer.java
  
  Index: CallbackEnabledCustomSocketStreamServer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/socket/CallbackEnabledCustomSocketStreamServer.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- CallbackEnabledCustomSocketStreamServer.java	10 Apr 2002 22:46:18 -0000	1.1
  +++ CallbackEnabledCustomSocketStreamServer.java	10 Apr 2002 23:36:58 -0000	1.2
  @@ -15,7 +15,6 @@
   import org.apache.excalibur.altrmi.server.impl.AbstractServer;
   import org.apache.excalibur.altrmi.server.impl.ServerStreamReadWriter;
   import org.apache.excalibur.altrmi.server.impl.adapters.InvocationHandlerAdapter;
  -import org.apache.excalibur.altrmi.server.impl.*;
   import org.apache.excalibur.altrmi.server.impl.CallbackEnabledCustomSocketStreamReadWriter;
   import org.apache.excalibur.altrmi.common.AltrmiRequest;
   import org.apache.excalibur.altrmi.common.AltrmiReply;
  @@ -30,7 +29,7 @@
    * Class CallbackEnabledCustomSocketStreamServer
    *
    *@author <a href="mailto:vinayc77@yahoo.com">Vinay Chandran</a>
  - * @version $Revision: 1.1 $
  + * @version $Revision: 1.2 $
    */
   public class CallbackEnabledCustomSocketStreamServer extends AbstractCompleteSocketStreamServer
{
   
  
  
  

--
To unsubscribe, e-mail:   <mailto:avalon-cvs-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-cvs-help@jakarta.apache.org>


Mime
View raw message