commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hamm...@apache.org
Subject cvs commit: jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/server/impl AbstractServer.java DefaultAuthenticator.java
Date Mon, 21 Jan 2002 20:10:34 GMT
hammant     02/01/21 12:10:34

  Modified:    altrmi/src/java/org/apache/commons/altrmi/client
                        AltrmiClientInvocationHandler.java
               altrmi/src/java/org/apache/commons/altrmi/client/impl
                        AbstractAltrmiFactory.java
                        AbstractClientInvocationHandler.java
                        ClientClassAltrmiFactory.java
                        DefaultConnectionPinger.java
                        ServerClassAltrmiFactory.java
               altrmi/src/java/org/apache/commons/altrmi/client/impl/stream
                        StreamInvocationHandler.java
               altrmi/src/java/org/apache/commons/altrmi/common
                        LookupReply.java LookupRequest.java
                        OpenConnectionReply.java
               altrmi/src/java/org/apache/commons/altrmi/server
                        AltrmiAuthenticator.java
               altrmi/src/java/org/apache/commons/altrmi/server/impl
                        AbstractServer.java DefaultAuthenticator.java
  Added:       altrmi/src/java/org/apache/commons/altrmi/common
                        AltrmiConnectionClosedException.java
  Log:
  Session generation moves to open connection.  Pinger can now handle closure of connection.
  
  Revision  Changes    Path
  1.3       +2 -0      jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/client/AltrmiClientInvocationHandler.java
  
  Index: AltrmiClientInvocationHandler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/client/AltrmiClientInvocationHandler.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- AltrmiClientInvocationHandler.java	19 Jan 2002 15:06:58 -0000	1.2
  +++ AltrmiClientInvocationHandler.java	21 Jan 2002 20:10:34 -0000	1.3
  @@ -36,6 +36,8 @@
   
       long getLastRealRequest();
   
  +    void ping();
  +
   }
   
   
  
  
  
  1.9       +4 -2      jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/client/impl/AbstractAltrmiFactory.java
  
  Index: AbstractAltrmiFactory.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/client/impl/AbstractAltrmiFactory.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- AbstractAltrmiFactory.java	21 Jan 2002 15:38:20 -0000	1.8
  +++ AbstractAltrmiFactory.java	21 Jan 2002 20:10:34 -0000	1.9
  @@ -29,7 +29,7 @@
    *
    *
    * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
  - * @version $Revision: 1.8 $
  + * @version $Revision: 1.9 $
    */
   public abstract class AbstractAltrmiFactory implements AltrmiFactory {
   
  @@ -37,7 +37,8 @@
       protected final HashMap mObjRefs = new HashMap();
       protected final HashMap mRefObjs = new HashMap();
       private final boolean mBeanOnly;
  -    private String mTextToSign;
  +    private transient String mTextToSign;
  +    protected Long mSession;
   
       /**
        * Constructor AbstractAltrmiFactory
  @@ -83,6 +84,7 @@
   
           if (ar instanceof OpenConnectionReply) {
               mTextToSign = ((OpenConnectionReply) ar).getTextToSign();
  +            mSession = ((OpenConnectionReply) ar).getSession();
           } else {
   
               //TODO
  
  
  
  1.2       +14 -1     jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/client/impl/AbstractClientInvocationHandler.java
  
  Index: AbstractClientInvocationHandler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/client/impl/AbstractClientInvocationHandler.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- AbstractClientInvocationHandler.java	21 Jan 2002 15:38:20 -0000	1.1
  +++ AbstractClientInvocationHandler.java	21 Jan 2002 20:10:34 -0000	1.2
  @@ -11,9 +11,12 @@
   
   
   import org.apache.commons.altrmi.common.AltrmiInvocationHandler;
  +import org.apache.commons.altrmi.common.AltrmiReply;
  +import org.apache.commons.altrmi.common.PingRequest;
   import org.apache.commons.altrmi.client.AltrmiConnectionListener;
   import org.apache.commons.altrmi.client.AltrmiConnectionPinger;
   import org.apache.commons.altrmi.client.AltrmiClientInvocationHandler;
  +import org.apache.commons.altrmi.common.AltrmiConnectionClosedException;
   
   import java.io.IOException;
   
  @@ -23,13 +26,14 @@
    *
    *
    * @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 AbstractClientInvocationHandler implements AltrmiInvocationHandler,
AltrmiClientInvocationHandler {
   
       protected AltrmiConnectionPinger mConnectionPinger;
       protected AltrmiConnectionListener mAltrmiConnectionListener =
           new DefaultConnectionListener();
  +    protected boolean mStopped =false;
   
       /**
        * Method setAltrmiConnectionListener
  @@ -54,7 +58,16 @@
   
       public void close() {
           mConnectionPinger.stop();
  +        mStopped = true;
       }
  +
  +    public void ping() {
  +        if (mStopped) {
  +            throw new AltrmiConnectionClosedException("Connection closed");
  +        }
  +        AltrmiReply ar = handleInvocation(new PingRequest());
  +    }
  +
   
       protected abstract boolean tryReconnect();
   
  
  
  
  1.7       +3 -3      jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/client/impl/ClientClassAltrmiFactory.java
  
  Index: ClientClassAltrmiFactory.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/client/impl/ClientClassAltrmiFactory.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ClientClassAltrmiFactory.java	19 Jan 2002 13:30:19 -0000	1.6
  +++ ClientClassAltrmiFactory.java	21 Jan 2002 20:10:34 -0000	1.7
  @@ -29,7 +29,7 @@
    *
    *
    * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
  - * @version $Revision: 1.6 $
  + * @version $Revision: 1.7 $
    */
   public class ClientClassAltrmiFactory extends AbstractAltrmiFactory {
   
  @@ -61,7 +61,7 @@
   
           AltrmiReply ar =
               mHostContext.getInvocationHandler()
  -                .handleInvocation(new LookupRequest(publishedServiceName, altrmiAuthentication));
  +                .handleInvocation(new LookupRequest(publishedServiceName, altrmiAuthentication,
mSession));
   
           if (ar.getReplyCode() >= AltrmiReply.PROBLEMREPLY) {
               if (ar instanceof NotPublishedReply) {
  @@ -80,7 +80,7 @@
           BaseServedObject baseObj = new BaseServedObject(this,
                                                           mHostContext.getInvocationHandler(),
                                                           publishedServiceName, "Main",
  -                                                        lr.getReferenceID(), lr.getSession());
  +                                                        lr.getReferenceID(), mSession);
           Object retVal = getInstance(publishedServiceName, "Main", baseObj, isBeanOnly());
   
           baseObj.registerImplObject(retVal);
  
  
  
  1.2       +4 -1      jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/client/impl/DefaultConnectionPinger.java
  
  Index: DefaultConnectionPinger.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/client/impl/DefaultConnectionPinger.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DefaultConnectionPinger.java	19 Jan 2002 15:06:58 -0000	1.1
  +++ DefaultConnectionPinger.java	21 Jan 2002 20:10:34 -0000	1.2
  @@ -14,6 +14,7 @@
   import org.apache.commons.altrmi.client.AltrmiClientInvocationHandler;
   import org.apache.commons.altrmi.common.AltrmiReply;
   import org.apache.commons.altrmi.common.PingRequest;
  +import org.apache.commons.altrmi.common.AltrmiConnectionClosedException;
   
   
   /**
  @@ -21,7 +22,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 DefaultConnectionPinger implements AltrmiConnectionPinger, Runnable {
   
  @@ -64,12 +65,14 @@
               while (mContinue) {
                   Thread.sleep(10 * 1000);
                   if ( mAltrmiInvocationHandler.getLastRealRequest() > (System.currentTimeMillis()
- (100 * 1000))) {
  -                    AltrmiReply ar = mAltrmiInvocationHandler.handleInvocation(new PingRequest());
  +                    mAltrmiInvocationHandler.ping();
                   } else {
                       // if more than 100 seconds since last request, stop pinging
                       // Let the server do a disconnect according to its rules.
                   }
               }
  +        } catch (AltrmiConnectionClosedException cce) {
  +            // no need to ping anymore.
           } catch (InterruptedException e) {
   
               // do nothing.
  
  
  
  1.7       +3 -3      jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/client/impl/ServerClassAltrmiFactory.java
  
  Index: ServerClassAltrmiFactory.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/client/impl/ServerClassAltrmiFactory.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ServerClassAltrmiFactory.java	19 Jan 2002 13:30:19 -0000	1.6
  +++ ServerClassAltrmiFactory.java	21 Jan 2002 20:10:34 -0000	1.7
  @@ -35,7 +35,7 @@
    *
    *
    * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
  - * @version $Revision: 1.6 $
  + * @version $Revision: 1.7 $
    */
   public class ServerClassAltrmiFactory extends AbstractAltrmiFactory {
   
  @@ -69,7 +69,7 @@
   
           AltrmiReply ar =
               mHostContext.getInvocationHandler()
  -                .handleInvocation(new LookupRequest(publishedServiceName, altrmiAuthentication));
  +                .handleInvocation(new LookupRequest(publishedServiceName, altrmiAuthentication,
mSession));
   
           if (ar.getReplyCode() >= AltrmiReply.PROBLEMREPLY) {
               if (ar instanceof NotPublishedReply) {
  @@ -88,7 +88,7 @@
           BaseServedObject baseObj = new BaseServedObject(this,
                                                           mHostContext.getInvocationHandler(),
                                                           publishedServiceName, "Main",
  -                                                        lr.getReferenceID(), lr.getSession());
  +                                                        lr.getReferenceID(), mSession);
           Object retVal = getInstance(publishedServiceName, "Main", baseObj, isBeanOnly());
   
           baseObj.registerImplObject(retVal);
  
  
  
  1.3       +5 -2      jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/client/impl/stream/StreamInvocationHandler.java
  
  Index: StreamInvocationHandler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/client/impl/stream/StreamInvocationHandler.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- StreamInvocationHandler.java	21 Jan 2002 15:38:21 -0000	1.2
  +++ StreamInvocationHandler.java	21 Jan 2002 20:10:34 -0000	1.3
  @@ -37,7 +37,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 abstract class StreamInvocationHandler extends AbstractClientInvocationHandler {
   
  @@ -121,7 +121,10 @@
                               }
                           }
                       } catch (IOException ioe) {
  -                        if (ioe instanceof SocketException | ioe instanceof EOFException)
{
  +                        if (ioe instanceof SocketException
  +                                | ioe instanceof EOFException
  +                                | ioe.getMessage().equals("Read end dead")
  +                                ) {
                               int retryConnectTries = 0;
   
                               while (!tryReconnect()) {
  
  
  
  1.4       +2 -17     jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/common/LookupReply.java
  
  Index: LookupReply.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/common/LookupReply.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- LookupReply.java	18 Jan 2002 11:03:20 -0000	1.3
  +++ LookupReply.java	21 Jan 2002 20:10:34 -0000	1.4
  @@ -20,12 +20,11 @@
    *
    *
    * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
  - * @version $Revision: 1.3 $
  + * @version $Revision: 1.4 $
    */
   public final class LookupReply extends AltrmiReply {
   
       private Long mReferenceID;
  -    private Long mSession;
   
       /**
        * Constructor LookupReply
  @@ -35,9 +34,8 @@
        * @param session
        *
        */
  -    public LookupReply(Long referenceID, Long session) {
  +    public LookupReply(Long referenceID) {
           mReferenceID = referenceID;
  -        mSession = session;
       }
   
       /**
  @@ -70,17 +68,6 @@
       }
   
       /**
  -     * Method getSession
  -     *
  -     *
  -     * @return
  -     *
  -     */
  -    public Long getSession() {
  -        return mSession;
  -    }
  -
  -    /**
        * The object implements the writeExternal method to save its contents
        * by calling the methods of DataOutput for its primitive values or
        * calling the writeObject method of ObjectOutput for objects, strings,
  @@ -97,7 +84,6 @@
        */
       public void writeExternal(ObjectOutput out) throws IOException {
           out.writeObject(mReferenceID);
  -        out.writeObject(mSession);
       }
   
       /**
  @@ -114,6 +100,5 @@
        */
       public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
{
           mReferenceID = (Long) in.readObject();
  -        mSession = (Long) in.readObject();
       }
   }
  
  
  
  1.4       +18 -2     jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/common/LookupRequest.java
  
  Index: LookupRequest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/common/LookupRequest.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- LookupRequest.java	18 Jan 2002 11:03:20 -0000	1.3
  +++ LookupRequest.java	21 Jan 2002 20:10:34 -0000	1.4
  @@ -20,11 +20,12 @@
    *
    *
    * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
  - * @version $Revision: 1.3 $
  + * @version $Revision: 1.4 $
    */
   public final class LookupRequest extends PublishedNameRequest {
   
       private AltrmiAuthentication mAltrmiAuthentication;
  +    private Long mSession;
   
       /**
        * Constructor LookupRequest
  @@ -34,11 +35,12 @@
        * @param altrmiAuthentication
        *
        */
  -    public LookupRequest(String publishedServiceName, AltrmiAuthentication altrmiAuthentication)
{
  +    public LookupRequest(String publishedServiceName, AltrmiAuthentication altrmiAuthentication,
Long session) {
   
           super(publishedServiceName, "Main");
   
           mAltrmiAuthentication = altrmiAuthentication;
  +        mSession = session;
       }
   
       /**
  @@ -71,6 +73,18 @@
       }
   
       /**
  +     * Method getSession
  +     *
  +     *
  +     * @return
  +     *
  +     */
  +    public Long getSession() {
  +        return mSession;
  +    }
  +
  +
  +    /**
        * The object implements the writeExternal method to save its contents
        * by calling the methods of DataOutput for its primitive values or
        * calling the writeObject method of ObjectOutput for objects, strings,
  @@ -88,6 +102,7 @@
       public void writeExternal(ObjectOutput out) throws IOException {
           super.writeExternal(out);
           out.writeObject(mAltrmiAuthentication);
  +        out.writeObject(mSession);
       }
   
       /**
  @@ -107,5 +122,6 @@
           super.readExternal(in);
   
           mAltrmiAuthentication = (AltrmiAuthentication) in.readObject();
  +        mSession = (Long) in.readObject();
       }
   }
  
  
  
  1.3       +18 -2     jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/common/OpenConnectionReply.java
  
  Index: OpenConnectionReply.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/common/OpenConnectionReply.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- OpenConnectionReply.java	18 Jan 2002 11:03:20 -0000	1.2
  +++ OpenConnectionReply.java	21 Jan 2002 20:10:34 -0000	1.3
  @@ -20,11 +20,12 @@
    *
    *
    * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
  - * @version $Revision: 1.2 $
  + * @version $Revision: 1.3 $
    */
   public final class OpenConnectionReply extends AltrmiReply {
   
       private String mTextToSign;
  +    private Long mSession;
   
       /**
        * Constructor OpenConnectionReply
  @@ -34,8 +35,9 @@
        * @param textToSign
        *
        */
  -    public OpenConnectionReply(String textToSign) {
  +    public OpenConnectionReply(String textToSign, Long session) {
           mTextToSign = textToSign;
  +        mSession = session;
       }
   
       /**
  @@ -68,6 +70,18 @@
       }
   
       /**
  +     * Method getSession
  +     *
  +     *
  +     * @return
  +     *
  +     */
  +    public Long getSession() {
  +        return mSession;
  +    }
  +
  +
  +    /**
        * The object implements the writeExternal method to save its contents
        * by calling the methods of DataOutput for its primitive values or
        * calling the writeObject method of ObjectOutput for objects, strings,
  @@ -84,6 +98,7 @@
        */
       public void writeExternal(ObjectOutput out) throws IOException {
           out.writeObject(mTextToSign);
  +        out.writeObject(mSession);
       }
   
       /**
  @@ -100,5 +115,6 @@
        */
       public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
{
           mTextToSign = (String) in.readObject();
  +        mSession = (Long) in.readObject();
       }
   }
  
  
  
  1.1                  jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/common/AltrmiConnectionClosedException.java
  
  Index: AltrmiConnectionClosedException.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.commons.altrmi.common;
  
  
  
  import java.io.Serializable;
  
  
  /**
   * Class AltrmiConnectionClosedException
   *
   *
   * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
   * @version $Revision: 1.1 $
   */
  public class AltrmiConnectionClosedException extends RuntimeException {
  
      /**
       * Constructor AltrmiConnectionClosedException
       *
       *
       * @param s
       *
       */
      public AltrmiConnectionClosedException(String s) {
          super(s);
      }
  }
  
  
  
  1.3       +2 -2      jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/server/AltrmiAuthenticator.java
  
  Index: AltrmiAuthenticator.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/server/AltrmiAuthenticator.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- AltrmiAuthenticator.java	15 Jan 2002 01:15:24 -0000	1.2
  +++ AltrmiAuthenticator.java	21 Jan 2002 20:10:34 -0000	1.3
  @@ -19,7 +19,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 interface AltrmiAuthenticator {
   
  @@ -35,7 +35,7 @@
        * @throws AltrmiAuthenticationException
        *
        */
  -    Long checkAuthority(AltrmiAuthentication auth, String publishedService)
  +    void checkAuthority(AltrmiAuthentication auth, String publishedService)
           throws AltrmiAuthenticationException;
   
       /**
  
  
  
  1.10      +16 -6     jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/server/impl/AbstractServer.java
  
  Index: AbstractServer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/server/impl/AbstractServer.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- AbstractServer.java	21 Jan 2002 15:38:21 -0000	1.9
  +++ AbstractServer.java	21 Jan 2002 20:10:34 -0000	1.10
  @@ -54,10 +54,12 @@
    *
    *
    * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
  - * @version $Revision: 1.9 $
  + * @version $Revision: 1.10 $
    */
   public abstract class AbstractServer extends AbstractMethodHandler implements AltrmiServer
{
   
  +    private static int SESSION = 0;
  +
       private HashMap mPublishedObjects = new HashMap();
       private Vector mSessions = new Vector();
       private Long mLastSession = new Long(0);
  @@ -338,19 +340,19 @@
               return new MethodFacadeReply(newRef);
           } else if (request.getRequestCode() == AltrmiRequest.LOOKUPREQUEST) {
               LookupRequest lr = (LookupRequest) request;
  -            Long session;
  +
   
               try {
  -                session = mAltrmiAuthenticator.checkAuthority(lr.getAltrmiAuthentication(),
  +                mAltrmiAuthenticator.checkAuthority(lr.getAltrmiAuthentication(),
                                                                 lr.getPublishedServiceName());
   
  -                mSessions.add(session);
  +
               } catch (AltrmiAuthenticationException aae) {
                   return new ExceptionReply(aae);
               }
   
               //TODO a decent ref number for main?
  -            return new LookupReply(new Long(0), session);
  +            return new LookupReply(new Long(0));
           } else if (request.getRequestCode() == AltrmiRequest.CLASSREQUEST) {
               try {
                   ClassRequest cr = (ClassRequest) request;
  @@ -363,7 +365,9 @@
                   return new RequestFailedReply(e.getMessage());
               }
           } else if (request.getRequestCode() == AltrmiRequest.OPENCONNECTIONREQUEST) {
  -            return new OpenConnectionReply(mAltrmiAuthenticator.getTextToSign());
  +            Long session = getNewSession();
  +            mSessions.add(session);
  +            return new OpenConnectionReply(mAltrmiAuthenticator.getTextToSign(), session);
           } else if (request.getRequestCode() == AltrmiRequest.PINGREQUEST) {
               // we could communicate back useful state info in this transaction.
               return new PingReply();
  @@ -447,4 +451,10 @@
           return (ServerInvocationHandler) mPublishedObjects.get(mr.getPublishedServiceName()
                                                                        + "_" + objectName);
       }
  +
  +    protected Long getNewSession() {
  +        // approve everything and set session identifier.
  +        return new Long((long) ((long) SESSION++ << 32) + (long) Math.round(Math.random()));
  +    }
  +
   }
  
  
  
  1.5       +2 -7      jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/server/impl/DefaultAuthenticator.java
  
  Index: DefaultAuthenticator.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/server/impl/DefaultAuthenticator.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- DefaultAuthenticator.java	17 Jan 2002 12:14:29 -0000	1.4
  +++ DefaultAuthenticator.java	21 Jan 2002 20:10:34 -0000	1.5
  @@ -20,12 +20,10 @@
    *
    *
    * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
  - * @version $Revision: 1.4 $
  + * @version $Revision: 1.5 $
    */
   public class DefaultAuthenticator implements AltrmiAuthenticator {
   
  -    private static int SESSION = 0;
  -
       /**
        * Method checkAuthority
        *
  @@ -38,11 +36,8 @@
        * @throws AltrmiAuthenticationException
        *
        */
  -    public Long checkAuthority(AltrmiAuthentication auth, String publishedService)
  +    public void checkAuthority(AltrmiAuthentication auth, String publishedService)
               throws AltrmiAuthenticationException {
  -
  -        // approve everything and set session identifier.
  -        return new Long((long) ((long) SESSION++ << 32) + (long) Math.round(Math.random()));
       }
   
       /**
  
  
  

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


Mime
View raw message