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-cornerstone/apps/db/src/java/org/apache/avalon/db/transport/cmdstream/client CommandConnection.java
Date Mon, 19 Nov 2001 12:11:54 GMT
hammant     01/11/19 04:11:54

  Modified:    apps/db/src/java/org/apache/avalon/db/basic/handlers/lxsql
                        BasicLXSQLHandler.java
               apps/db/src/java/org/apache/avalon/db/persistence/inmemory
                        NoPersistence.java
               apps/db/src/java/org/apache/avalon/db/server
                        AbstractDatabaseManager.java AbstractParser.java
                        AbstractRequestHandler.java DBRequestContext.java
               apps/db/src/java/org/apache/avalon/db/server/stdhandlers
                        CatalogHandler.java PingHandler.java
               apps/db/src/java/org/apache/avalon/db/services
                        DatabaseManager.java DatabasePersistor.java
               apps/db/src/java/org/apache/avalon/db/transport Reply.java
                        Request.java
               apps/db/src/java/org/apache/avalon/db/transport/cmdstream/client
                        CommandConnection.java
  Added:       apps/db/src/java/org/apache/avalon/db/data/impl
                        DefaultUser.java
               apps/db/src/java/org/apache/avalon/db/server
                        DefaultDBRequestContext.java
               apps/db/src/java/org/apache/avalon/db/transport
                        EstablishConnectionReply.java
                        EstablishConnectionRequest.java
  Log:
  Pass RequestContext over wire
  
  Revision  Changes    Path
  1.3       +2 -3      jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/basic/handlers/lxsql/BasicLXSQLHandler.java
  
  Index: BasicLXSQLHandler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/basic/handlers/lxsql/BasicLXSQLHandler.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- BasicLXSQLHandler.java	2001/11/16 06:14:59	1.2
  +++ BasicLXSQLHandler.java	2001/11/19 12:11:53	1.3
  @@ -20,12 +20,11 @@
    *
    *
    * @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 BasicLXSQLHandler extends AbstractRequestHandler {
   
       protected final BasicLXSQLParser mParser;
  -    protected final DatabasePersistor mDatabasePersistor;
   
       /**
        * Constructor BasicLXSQLHandler
  @@ -36,7 +35,7 @@
        *
        */
       public BasicLXSQLHandler(BasicLXSQLParser parser, DatabasePersistor databasePersistor)
{
  +        super(databasePersistor);
           mParser = parser;
  -        mDatabasePersistor = databasePersistor;
       }
   }
  
  
  
  1.1                  jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/data/impl/DefaultUser.java
  
  Index: DefaultUser.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 file.
   */
  package org.apache.avalon.db.data.impl;
  
  import org.apache.avalon.db.data.User;
  
  /**
   * Class DefaultUser
   *
   *
   * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
   * @version $Revision: 1.1 $
   */
  public class DefaultUser extends AbstractNameable implements User {
  
      private String mId;
  
      /**
       * Constructor DefaultUser
       *
       *
       * @param name
       *
       */
      public DefaultUser(String name, String id) {
          super(name);
          mId = id;
  
      }
  
      public String getID() {
          return mId;
      }
  }
  
  
  
  1.11      +12 -2     jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/persistence/inmemory/NoPersistence.java
  
  Index: NoPersistence.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/persistence/inmemory/NoPersistence.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- NoPersistence.java	2001/11/19 08:39:17	1.10
  +++ NoPersistence.java	2001/11/19 12:11:54	1.11
  @@ -16,6 +16,9 @@
   import org.apache.avalon.db.data.View;
   import org.apache.avalon.db.data.Index;
   import org.apache.avalon.db.data.Queryable;
  +import org.apache.avalon.db.data.impl.DefaultUser;
  +import org.apache.avalon.db.server.DBRequestContext;
  +import org.apache.avalon.db.server.DefaultDBRequestContext;
   import org.apache.avalon.framework.logger.AbstractLogEnabled;
   import org.apache.avalon.framework.context.Contextualizable;
   import org.apache.avalon.framework.context.Context;
  @@ -37,13 +40,14 @@
    *
    *
    * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
  - * @version $Revision: 1.10 $
  + * @version $Revision: 1.11 $
    */
   public class NoPersistence extends AbstractLogEnabled
           implements DatabasePersistor, Block, Contextualizable, Composable, Configurable,
                      Initializable {
   
       private HashMap mAddressableObjects = new HashMap();
  +    private DefaultDBRequestContext mDefaultDBRequestContext;
   
       /**
        * Method contextualize
  @@ -85,7 +89,9 @@
        * @throws Exception
        *
        */
  -    public void initialize() throws Exception {}
  +    public void initialize() throws Exception {
  +        mDefaultDBRequestContext = new DefaultDBRequestContext(this,new DefaultUser("Hello
Ho Are You?", "hello"));
  +    }
   
       /**
        * Method queryableExists
  @@ -110,5 +116,9 @@
   
       public void removeQueryable(String queryableName) {
           mAddressableObjects.remove(queryableName);
  +    }
  +
  +    public DBRequestContext getDBRequestContext(String requestContextID) {
  +        return mDefaultDBRequestContext;
       }
   }
  
  
  
  1.23      +10 -29    jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/server/AbstractDatabaseManager.java
  
  Index: AbstractDatabaseManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/server/AbstractDatabaseManager.java,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- AbstractDatabaseManager.java	2001/11/19 09:03:02	1.22
  +++ AbstractDatabaseManager.java	2001/11/19 12:11:54	1.23
  @@ -8,37 +8,18 @@
    */
   package org.apache.avalon.db.server;
   
  -
  -
  -import org.apache.avalon.db.services.DatabaseManager;
  +import org.apache.avalon.framework.logger.AbstractLogEnabled;
  +import org.apache.avalon.framework.component.Composable;
  +import org.apache.avalon.framework.component.ComponentException;
  +import org.apache.avalon.framework.component.ComponentManager;
  +import org.apache.avalon.framework.activity.Initializable;
   import org.apache.avalon.db.services.SQLParser;
   import org.apache.avalon.db.services.SQLOptimizer;
  -import org.apache.avalon.db.services.DatabasePersistor;
  -
  -import org.apache.avalon.db.actions.Select;
  -import org.apache.avalon.db.actions.ActionException;
  -import org.apache.avalon.db.actions.CreateTable;
  -import org.apache.avalon.db.actions.InsertRows;
  -import org.apache.avalon.db.actions.CreateView;
  -import org.apache.avalon.db.actions.DeleteRows;
  -import org.apache.avalon.db.transport.Request;
   import org.apache.avalon.db.transport.Reply;
  -import org.apache.avalon.db.transport.SelectReply;
  -import org.apache.avalon.db.transport.SelectRequest;
  -import org.apache.avalon.db.transport.CreateTableRequest;
  -import org.apache.avalon.db.transport.ExceptionReply;
  +import org.apache.avalon.db.transport.Request;
   import org.apache.avalon.db.transport.UnknownRequestReply;
  -import org.apache.avalon.db.transport.UpdateReply;
  -import org.apache.avalon.db.transport.ResultSetReply;
  -import org.apache.avalon.db.transport.InsertRowsRequest;
  -import org.apache.avalon.db.transport.CreateViewRequest;
  -import org.apache.avalon.db.transport.PingReply;
  -import org.apache.avalon.db.transport.DeleteRowsRequest;
  -import org.apache.avalon.framework.logger.AbstractLogEnabled;
  -import org.apache.avalon.framework.component.ComponentManager;
  -import org.apache.avalon.framework.component.ComponentException;
  -import org.apache.avalon.framework.component.Composable;
  -import org.apache.avalon.framework.activity.Initializable;
  +import org.apache.avalon.db.transport.ExceptionReply;
  +import org.apache.avalon.db.actions.ActionException;
   
   
   /**
  @@ -46,7 +27,7 @@
    *
    *
    * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
  - * @version $Revision: 1.22 $
  + * @version $Revision: 1.23 $
    */
   public abstract class AbstractDatabaseManager extends AbstractLogEnabled
           implements Composable, Initializable {
  @@ -92,7 +73,7 @@
               if (arh == null ) {
                   return new UnknownRequestReply();
               } else {
  -                return arh.handleRequest(null, request);
  +                return arh.handleRequest(request);
               }
           } catch (ActionException ae) {
               getLogger().error("processRequest(): ActionException",ae);
  
  
  
  1.5       +3 -3      jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/server/AbstractParser.java
  
  Index: AbstractParser.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/server/AbstractParser.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- AbstractParser.java	2001/11/19 11:13:41	1.4
  +++ AbstractParser.java	2001/11/19 12:11:54	1.5
  @@ -92,9 +92,9 @@
   
           AbstractRequestHandler[] handlers = new AbstractRequestHandler[1000];
           // standard
  -        handlers[Request.PING] = new PingHandler();
  -        handlers[Request.SETCATALOG] = new CatalogHandler();
  -        handlers[Request.CATALOGREQUEST] = new CatalogHandler();
  +        handlers[Request.PING] = new PingHandler(mDatabasePersistor);
  +        handlers[Request.SETCATALOG] = new CatalogHandler(mDatabasePersistor);
  +        handlers[Request.CATALOGREQUEST] = new CatalogHandler(mDatabasePersistor);
   
           // decorate them with logging capability.
           for (int i = 0; i < handlers.length; i++) {
  
  
  
  1.4       +17 -3     jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/server/AbstractRequestHandler.java
  
  Index: AbstractRequestHandler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/server/AbstractRequestHandler.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- AbstractRequestHandler.java	2001/11/19 09:03:02	1.3
  +++ AbstractRequestHandler.java	2001/11/19 12:11:54	1.4
  @@ -8,14 +8,28 @@
    */
   package org.apache.avalon.db.server;
   
  -import org.apache.avalon.db.transport.Request;
  +import org.apache.avalon.framework.logger.AbstractLogEnabled;
   import org.apache.avalon.db.transport.Reply;
  -import org.apache.avalon.db.actions.Action;
  +import org.apache.avalon.db.transport.Request;
   import org.apache.avalon.db.actions.ActionException;
  -import org.apache.avalon.framework.logger.AbstractLogEnabled;
  +import org.apache.avalon.db.services.DatabasePersistor;
  +import org.apache.avalon.db.basic.parser.BasicLXSQLParser;
   
   public abstract class AbstractRequestHandler extends AbstractLogEnabled  {
   
  +    protected final DatabasePersistor mDatabasePersistor;
  +
  +    public AbstractRequestHandler(DatabasePersistor databasePersistor) {
  +        mDatabasePersistor = databasePersistor;
  +    }
  +
  +    public final Reply handleRequest(Request request) throws ActionException {
  +
  +        String requestContextID = request.getRequestContextID();
  +
  +        return handleRequest(null,request);
  +
  +    }
       public abstract Reply handleRequest(DBRequestContext context, Request request) throws
ActionException;
   
   }
  
  
  
  1.4       +1 -0      jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/server/DBRequestContext.java
  
  Index: DBRequestContext.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/server/DBRequestContext.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- DBRequestContext.java	2001/11/19 11:13:41	1.3
  +++ DBRequestContext.java	2001/11/19 12:11:54	1.4
  @@ -16,5 +16,6 @@
       User getUser();
       Catalog getCurrentCatalog();
       void setCurrentCatalog(String catalogName);
  +    String getRequestContextID();
   
   }
  
  
  
  1.1                  jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/server/DefaultDBRequestContext.java
  
  Index: DefaultDBRequestContext.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 file.
   */
  package org.apache.avalon.db.server;
  
  import org.apache.avalon.db.data.User;
  import org.apache.avalon.db.data.Catalog;
  import org.apache.avalon.db.services.DatabasePersistor;
  
  public class DefaultDBRequestContext implements DBRequestContext {
  
      private Catalog mCatalog;
      private User mUser;
      private DatabasePersistor mDatabasePersistor;
      private static int IDSEQ;
      private String mRequestContextID;
  
      public DefaultDBRequestContext(DatabasePersistor databasePersistor, User user) {
          mUser = user;
          mDatabasePersistor = databasePersistor;
          mRequestContextID = "RID:" + IDSEQ++ + ":" + Math.random();
      }
  
      public User getUser() {
          return mUser;
      }
  
      public Catalog getCurrentCatalog() {
          return mCatalog;
      }
  
      public void setCurrentCatalog(String catalogName) {
          // TODO
      }
  
      public String getRequestContextID() {
          return mRequestContextID;
      }
  
  
  }
  
  
  
  1.2       +4 -0      jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/server/stdhandlers/CatalogHandler.java
  
  Index: CatalogHandler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/server/stdhandlers/CatalogHandler.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- CatalogHandler.java	2001/11/19 11:13:41	1.1
  +++ CatalogHandler.java	2001/11/19 12:11:54	1.2
  @@ -21,6 +21,10 @@
   
   public class CatalogHandler extends AbstractRequestHandler {
   
  +    public CatalogHandler(DatabasePersistor databasePersistor) {
  +        super(databasePersistor);
  +    }
  +
       public Reply handleRequest(DBRequestContext context, Request request) throws ActionException
{
           CatalogRequest cr = (CatalogRequest) request;
           if (request.getRequestCode() == Request.CATALOGREQUEST) {
  
  
  
  1.3       +5 -0      jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/server/stdhandlers/PingHandler.java
  
  Index: PingHandler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/server/stdhandlers/PingHandler.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- PingHandler.java	2001/11/19 09:03:02	1.2
  +++ PingHandler.java	2001/11/19 12:11:54	1.3
  @@ -15,8 +15,13 @@
   import org.apache.avalon.db.transport.Request;
   import org.apache.avalon.db.transport.PingReply;
   import org.apache.avalon.db.actions.ActionException;
  +import org.apache.avalon.db.services.DatabasePersistor;
   
   public class PingHandler extends AbstractRequestHandler {
  +
  +    public PingHandler(DatabasePersistor databasePersistor) {
  +        super(databasePersistor);
  +    }
   
       public Reply handleRequest(DBRequestContext context, Request request) throws ActionException
{
           return new PingReply();
  
  
  
  1.5       +1 -0      jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/services/DatabaseManager.java
  
  Index: DatabaseManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/services/DatabaseManager.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- DatabaseManager.java	2001/11/15 14:29:57	1.4
  +++ DatabaseManager.java	2001/11/19 12:11:54	1.5
  @@ -13,6 +13,7 @@
   import org.apache.avalon.db.transport.SelectRequest;
   import org.apache.avalon.db.transport.CreateTableRequest;
   import org.apache.avalon.db.actions.ActionException;
  +import org.apache.avalon.db.server.DBRequestContext;
   
   
   /**
  
  
  
  1.9       +4 -1      jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/services/DatabasePersistor.java
  
  Index: DatabasePersistor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/services/DatabasePersistor.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- DatabasePersistor.java	2001/11/19 08:39:17	1.8
  +++ DatabasePersistor.java	2001/11/19 12:11:54	1.9
  @@ -14,6 +14,7 @@
   import org.apache.avalon.db.data.View;
   import org.apache.avalon.db.data.Index;
   import org.apache.avalon.db.data.Queryable;
  +import org.apache.avalon.db.server.DBRequestContext;
   
   
   /**
  @@ -21,7 +22,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 interface DatabasePersistor {
   
  @@ -32,5 +33,7 @@
       void addQueryable(String queryableName, Queryable queryable);
   
       void removeQueryable(String queryableName);
  +
  +    DBRequestContext getDBRequestContext(String requestContextID);
   
   }
  
  
  
  1.10      +2 -1      jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/transport/Reply.java
  
  Index: Reply.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/transport/Reply.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- Reply.java	2001/11/14 03:06:59	1.9
  +++ Reply.java	2001/11/19 12:11:54	1.10
  @@ -17,7 +17,7 @@
    *
    *
    * @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 Reply implements Serializable {
   
  @@ -33,6 +33,7 @@
       public static final int SELECTREPLY = 19;
       public static final int TODOREPLY = 20;
       public static final int PINGREPLY = 21;
  +    public static final int ESTABLISHCONNECTIONREPLY = 22;
   
   
       private int mReplyCode;
  
  
  
  1.13      +11 -1     jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/transport/Request.java
  
  Index: Request.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/transport/Request.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- Request.java	2001/11/19 08:39:17	1.12
  +++ Request.java	2001/11/19 12:11:54	1.13
  @@ -18,7 +18,7 @@
    *
    *
    * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
  - * @version $Revision: 1.12 $
  + * @version $Revision: 1.13 $
    */
   public abstract class Request implements Serializable {
   
  @@ -48,8 +48,10 @@
       public static final int DROPTABLE = 133;
       public static final int DROPVIEW = 134;
       public static final int DROPINDEX = 135;
  +    public static final int ESTABLISHCONNECTION = 136;
   
       private int mRequestCode;
  +    private String mRequestContextID;
   
       protected Request(int requestCode) {
           this.mRequestCode = requestCode;
  @@ -64,5 +66,13 @@
        */
       public int getRequestCode() {
           return mRequestCode;
  +    }
  +
  +    public String getRequestContextID() {
  +        return mRequestContextID;
  +    }
  +
  +    public void setRequestContextID(String requestContextID) {
  +        this.mRequestContextID = mRequestContextID;
       }
   }
  
  
  
  1.1                  jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/transport/EstablishConnectionReply.java
  
  Index: EstablishConnectionReply.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 file.
   */
  package org.apache.avalon.db.transport;
  
  /**
   * Class EstablishConnectionReply
   *
   *
   * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
   * @version $Revision: 1.1 $
   */
  public class EstablishConnectionReply extends Reply {
  
      private String mRequestContextID;
  
  
      /**
       * Constructor EstablishConnectionReply
       *
       *
       */
      public EstablishConnectionReply(String requestContextID) {
          super(ESTABLISHCONNECTIONREPLY);
          mRequestContextID = requestContextID;
      }
  
      public String getRequestContextID() {
          return mRequestContextID;
      }
  }
  
  
  
  1.1                  jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/transport/EstablishConnectionRequest.java
  
  Index: EstablishConnectionRequest.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 file.
   */
  package org.apache.avalon.db.transport;
  
  
  
  /**
   * Class EstablishConnectionRequest
   *
   *
   * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
   * @version $Revision: 1.1 $
   */
  public class EstablishConnectionRequest extends Request {
  
      private String mUrl;
  
      /**
       * Constructor PingRequest
       *
       *
       */
      public EstablishConnectionRequest(String url) {
          super(ESTABLISHCONNECTION);
          mUrl = url;
      }
  
      public String getURL() {
          return mUrl;
      }
  
  }
  
  
  
  1.10      +10 -1     jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/transport/cmdstream/client/CommandConnection.java
  
  Index: CommandConnection.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/transport/cmdstream/client/CommandConnection.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- CommandConnection.java	2001/11/14 03:26:06	1.9
  +++ CommandConnection.java	2001/11/19 12:11:54	1.10
  @@ -12,6 +12,8 @@
   
   import org.apache.avalon.db.transport.Request;
   import org.apache.avalon.db.transport.Reply;
  +import org.apache.avalon.db.transport.EstablishConnectionRequest;
  +import org.apache.avalon.db.transport.EstablishConnectionReply;
   import org.apache.avalon.db.common.AvalonDBSQLException;
   import org.apache.avalon.db.driver.AvalonDBConnection;
   
  @@ -32,7 +34,7 @@
    *
    *
    * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
  - * @version $Revision: 1.9 $
  + * @version $Revision: 1.10 $
    */
   public class CommandConnection extends AvalonDBConnection {
   
  @@ -41,6 +43,7 @@
       private String[] mOptions;
       private ObjectOutputStream mObjectOutputStream;
       private ObjectInputStream mObjectInputStream;
  +    private String mRequestContextID;
   
       protected void initialize(String host, int port, String url, String[] options) throws
SQLException {
           mHost = host;
  @@ -54,6 +57,10 @@
   
               mObjectOutputStream = new ObjectOutputStream(socket.getOutputStream());
               mObjectInputStream = new ObjectInputStream(socket.getInputStream());
  +
  +            EstablishConnectionReply rep = (EstablishConnectionReply) this.sendRequest(new
EstablishConnectionRequest(url));
  +            mRequestContextID = rep.getRequestContextID();
  +
           } catch (UnknownHostException uhe) {
               throw new AvalonDBSQLException("Unknown host/port " + mHost + "/" + mPort
                                              + " during connection creation", uhe);
  @@ -92,6 +99,8 @@
        *
        */
       public Reply sendRequest(Request request) throws SQLException {
  +
  +        request.setRequestContextID(mRequestContextID);
   
           try {
               mObjectOutputStream.writeObject(request);
  
  
  

--
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