tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From p...@locus.apache.org
Subject cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/warp WarpTable.java WarpRequest.java WarpHost.java WarpHandlerTable.java WarpEngineMapper.java WarpEngine.java WarpDebug.java WarpConnector.java WarpConnection.java WarpEngineValve.java
Date Thu, 07 Dec 2000 21:13:07 GMT
pier        00/12/07 13:13:07

  Modified:    catalina/src/share/org/apache/catalina/connector/warp
                        WarpHandlerTable.java WarpEngineMapper.java
                        WarpEngine.java WarpDebug.java WarpConnector.java
                        WarpConnection.java
  Added:       catalina/src/share/org/apache/catalina/connector/warp
                        WarpTable.java WarpRequest.java WarpHost.java
  Removed:     catalina/src/share/org/apache/catalina/connector/warp
                        WarpEngineValve.java
  Log:
  Warp Catalina Connector Stage 2.
  
  Revision  Changes    Path
  1.3       +135 -234  jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/warp/WarpHandlerTable.java
  
  Index: WarpHandlerTable.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/warp/WarpHandlerTable.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- WarpHandlerTable.java	2000/12/07 17:38:12	1.2
  +++ WarpHandlerTable.java	2000/12/07 21:12:56	1.3
  @@ -1,234 +1,135 @@
  -/* ========================================================================= *
  - *                                                                           *
  - *                 The Apache Software License,  Version 1.1                 *
  - *                                                                           *
  - *         Copyright (c) 1999, 2000  The Apache Software Foundation.         *
  - *                           All rights reserved.                            *
  - *                                                                           *
  - * ========================================================================= *
  - *                                                                           *
  - * Redistribution and use in source and binary forms,  with or without modi- *
  - * fication, are permitted provided that the following conditions are met:   *
  - *                                                                           *
  - * 1. Redistributions of source code  must retain the above copyright notice *
  - *    notice, this list of conditions and the following disclaimer.          *
  - *                                                                           *
  - * 2. Redistributions  in binary  form  must  reproduce the  above copyright *
  - *    notice,  this list of conditions  and the following  disclaimer in the *
  - *    documentation and/or other materials provided with the distribution.   *
  - *                                                                           *
  - * 3. The end-user documentation  included with the redistribution,  if any, *
  - *    must include the following acknowlegement:                             *
  - *                                                                           *
  - *       "This product includes  software developed  by the Apache  Software *
  - *        Foundation <http://www.apache.org/>."                              *
  - *                                                                           *
  - *    Alternately, this acknowlegement may appear in the software itself, if *
  - *    and wherever such third-party acknowlegements normally appear.         *
  - *                                                                           *
  - * 4. The names  "The  Jakarta  Project",  "Tomcat",  and  "Apache  Software *
  - *    Foundation"  must not be used  to endorse or promote  products derived *
  - *    from this  software without  prior  written  permission.  For  written *
  - *    permission, please contact <apache@apache.org>.                        *
  - *                                                                           *
  - * 5. Products derived from this software may not be called "Apache" nor may *
  - *    "Apache" appear in their names without prior written permission of the *
  - *    Apache Software Foundation.                                            *
  - *                                                                           *
  - * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES *
  - * INCLUDING, BUT NOT LIMITED TO,  THE IMPLIED WARRANTIES OF MERCHANTABILITY *
  - * AND FITNESS FOR  A PARTICULAR PURPOSE  ARE DISCLAIMED.  IN NO EVENT SHALL *
  - * THE APACHE  SOFTWARE  FOUNDATION OR  ITS CONTRIBUTORS  BE LIABLE  FOR ANY *
  - * DIRECT,  INDIRECT,   INCIDENTAL,  SPECIAL,  EXEMPLARY,  OR  CONSEQUENTIAL *
  - * DAMAGES (INCLUDING,  BUT NOT LIMITED TO,  PROCUREMENT OF SUBSTITUTE GOODS *
  - * OR SERVICES;  LOSS OF USE,  DATA,  OR PROFITS;  OR BUSINESS INTERRUPTION) *
  - * HOWEVER CAUSED AND  ON ANY  THEORY  OF  LIABILITY,  WHETHER IN  CONTRACT, *
  - * STRICT LIABILITY, OR TORT  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN *
  - * ANY  WAY  OUT OF  THE  USE OF  THIS  SOFTWARE,  EVEN  IF  ADVISED  OF THE *
  - * POSSIBILITY OF SUCH DAMAGE.                                               *
  - *                                                                           *
  - * ========================================================================= *
  - *                                                                           *
  - * This software  consists of voluntary  contributions made  by many indivi- *
  - * duals on behalf of the  Apache Software Foundation.  For more information *
  - * on the Apache Software Foundation, please see <http://www.apache.org/>.   *
  - *                                                                           *
  - * ========================================================================= */
  -package org.apache.catalina.connector.warp;
  -
  -/**
  - *
  - *
  - * @author <a href="mailto:pier.fumagalli@eng.sun.com">Pier Fumagalli</a>
  - * @author Copyright &copy; 1999, 2000 <a href="http://www.apache.org">The
  - *         Apache Software Foundation.
  - * @version CVS $Id: WarpHandlerTable.java,v 1.2 2000/12/07 17:38:12 pier Exp $
  - */
  -public class WarpHandlerTable {
  -
  -    /** The default size of our tables. */
  -    private static int defaultsize=32;
  -
  -    /** The current size of our arrays. */
  -    private int size;
  -
  -    /** The number of elements present in our arrays. */
  -    private int num;
  -
  -    /** The array of handlers. */
  -    private WarpHandler handlers[];
  -
  -    /** The array of rids. */
  -    private int rids[];
  -
  -    /**
  -     * Construct a new WarpHandlerTable instance with the default size.
  -     */
  -    public WarpHandlerTable() {
  -        this(defaultsize);
  -    }
  -
  -    /**
  -     * Construct a new WarpHandlerTable instance with a specified size.
  -     *
  -     * @param size The initial size of the table.
  -     */
  -    public WarpHandlerTable(int size) {
  -        super();
  -        // Paranoid, it's pointless to build a smaller than minimum size.
  -        if (size<defaultsize) size=defaultsize;
  -
  -        // Set the current and default sizes (in Hashtable terms the load
  -        // factor is always 1.0)
  -        this.defaultsize=size;
  -        this.size=size;
  -
  -        // Set the initial values.
  -        this.num=0;
  -        this.rids=new int[size];
  -        this.handlers=new WarpHandler[size];
  -    }
  -
  -    /**
  -     * Get the WarpHandler associated with a specific RID.
  -     *
  -     * @param rid The RID number.
  -     * @return The WarpHandler or null if the RID was not associated with the
  -     *         specified RID.
  -     */
  -    public WarpHandler get(int rid) {
  -        // Iterate thru the array of rids
  -        for (int x=0; x<this.num; x++) {
  -
  -            // We got our rid, return the handler at the same position
  -            if (this.rids[x]==rid) return(this.handlers[x]);
  -        }
  -
  -        // Not found.
  -        return(null);
  -    }
  -
  -    /**
  -     * Associate a WarpHandler with a specified RID.
  -     *
  -     * @param handler The WarpHandler to put in the table.
  -     * @param rid The RID number associated with the WarpHandler.
  -     * @return If another WarpHandler is associated with this RID return
  -     *         false, otherwise return true.
  -     */
  -    public boolean add(WarpHandler handler, int rid)
  -    throws NullPointerException {
  -        // Check if we were given a valid handler
  -        if (handler==null) throw new NullPointerException("Null Handler");
  -
  -        // Check if another handler was registered for the specified rid.
  -        if (this.get(rid)!=null) return(false);
  -
  -        // Check if we reached the capacity limit
  -        if(this.size==this.num) {
  -
  -            // Allocate some space for the new arrays
  -            int newsize=this.size+defaultsize;
  -            WarpHandler newhandlers[]=new WarpHandler[newsize];
  -            int newrids[]=new int[newsize];
  -            // Copy the original arrays into the new arrays
  -            System.arraycopy(this.handlers,0,newhandlers,0,this.num);
  -            System.arraycopy(this.rids,0,newrids,0,this.num);
  -            // Update our variables
  -            this.size=newsize;
  -            this.handlers=newhandlers;
  -            this.rids=newrids;
  -        }
  -
  -        // Add the handler and its rid to the arrays
  -        this.handlers[this.num]=handler;
  -        this.rids[this.num]=rid;
  -        this.num++;
  -
  -        // Whohoo!
  -        return(true);
  -    }
  -
  -    /**
  -     * Remove the WarpHandler associated with a specified RID.
  -     *
  -     * @param rid The RID number of the WarpHandler to remove.
  -     * @return The old WarpHandler associated with the specified RID or null.
  -     */
  -    public WarpHandler remove(int rid) {
  -        // Iterate thru the array of rids
  -        for (int x=0; x<this.num; x++) {
  -
  -            // We got our rid, and we need to get "rid" of its handler :)
  -            if (this.rids[x]==rid) {
  -                WarpHandler oldhandler=this.handlers[x];
  -                // Decrease the number of handlers stored in this table
  -                this.num--;
  -                // Move the last record in our arrays in the current position
  -                // (dirty way to compact a table)
  -                this.handlers[x]=this.handlers[this.num];
  -                this.rids[x]=this.rids[this.num];
  -
  -                // Now we want to see if we need to shrink our arrays (we don't
  -                // want them to grow indefinitely in case of peak data storage)
  -                // We check the number of available positions against the value
  -                // of defaultsize*2, so that our free positions are always
  -                // between 0 and defaultsize*2 (this will reduce the number of
  -                // System.arraycopy() calls. Even after the shrinking is done
  -                // we still have defaultsize positions available.
  -                if ((this.size-this.num)>(this.defaultsize<<1)) {
  -
  -                    // Allocate some space for the new arrays
  -                    int newsize=this.size-defaultsize;
  -                    WarpHandler newhandlers[]=new WarpHandler[newsize];
  -                    int newrids[]=new int[newsize];
  -                    // Copy the original arrays into the new arrays
  -                    System.arraycopy(this.handlers,0,newhandlers,0,this.num);
  -                    System.arraycopy(this.rids,0,newrids,0,this.num);
  -                    // Update our variables
  -                    this.size=newsize;
  -                    this.handlers=newhandlers;
  -                    this.rids=newrids;
  -                }
  -
  -                // The handler and its rid were removed, and if necessary the
  -                // arrays were shrunk. We just need to return the old handler.
  -                return(oldhandler);
  -            }
  -        }
  -
  -        // Not found.
  -        return(null);
  -    }
  -
  -    /**
  -     * Return the array of WarpHandler objects present in this table.
  -     *
  -     * @return An array (maybe empty) of WarpHandler objects.
  -     */
  -    public WarpHandler[] handlers() {
  -        WarpHandler buff[]=new WarpHandler[this.num];
  -        if (this.num>0) System.arraycopy(this.handlers,0,buff,0,this.num);
  -        return(buff);
  -    }
  -}
  +/* ========================================================================= *
  + *                                                                           *
  + *                 The Apache Software License,  Version 1.1                 *
  + *                                                                           *
  + *         Copyright (c) 1999, 2000  The Apache Software Foundation.         *
  + *                           All rights reserved.                            *
  + *                                                                           *
  + * ========================================================================= *
  + *                                                                           *
  + * Redistribution and use in source and binary forms,  with or without modi- *
  + * fication, are permitted provided that the following conditions are met:   *
  + *                                                                           *
  + * 1. Redistributions of source code  must retain the above copyright notice *
  + *    notice, this list of conditions and the following disclaimer.          *
  + *                                                                           *
  + * 2. Redistributions  in binary  form  must  reproduce the  above copyright *
  + *    notice,  this list of conditions  and the following  disclaimer in the *
  + *    documentation and/or other materials provided with the distribution.   *
  + *                                                                           *
  + * 3. The end-user documentation  included with the redistribution,  if any, *
  + *    must include the following acknowlegement:                             *
  + *                                                                           *
  + *       "This product includes  software developed  by the Apache  Software *
  + *        Foundation <http://www.apache.org/>."                              *
  + *                                                                           *
  + *    Alternately, this acknowlegement may appear in the software itself, if *
  + *    and wherever such third-party acknowlegements normally appear.         *
  + *                                                                           *
  + * 4. The names  "The  Jakarta  Project",  "Tomcat",  and  "Apache  Software *
  + *    Foundation"  must not be used  to endorse or promote  products derived *
  + *    from this  software without  prior  written  permission.  For  written *
  + *    permission, please contact <apache@apache.org>.                        *
  + *                                                                           *
  + * 5. Products derived from this software may not be called "Apache" nor may *
  + *    "Apache" appear in their names without prior written permission of the *
  + *    Apache Software Foundation.                                            *
  + *                                                                           *
  + * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES *
  + * INCLUDING, BUT NOT LIMITED TO,  THE IMPLIED WARRANTIES OF MERCHANTABILITY *
  + * AND FITNESS FOR  A PARTICULAR PURPOSE  ARE DISCLAIMED.  IN NO EVENT SHALL *
  + * THE APACHE  SOFTWARE  FOUNDATION OR  ITS CONTRIBUTORS  BE LIABLE  FOR ANY *
  + * DIRECT,  INDIRECT,   INCIDENTAL,  SPECIAL,  EXEMPLARY,  OR  CONSEQUENTIAL *
  + * DAMAGES (INCLUDING,  BUT NOT LIMITED TO,  PROCUREMENT OF SUBSTITUTE GOODS *
  + * OR SERVICES;  LOSS OF USE,  DATA,  OR PROFITS;  OR BUSINESS INTERRUPTION) *
  + * HOWEVER CAUSED AND  ON ANY  THEORY  OF  LIABILITY,  WHETHER IN  CONTRACT, *
  + * STRICT LIABILITY, OR TORT  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN *
  + * ANY  WAY  OUT OF  THE  USE OF  THIS  SOFTWARE,  EVEN  IF  ADVISED  OF THE *
  + * POSSIBILITY OF SUCH DAMAGE.                                               *
  + *                                                                           *
  + * ========================================================================= *
  + *                                                                           *
  + * This software  consists of voluntary  contributions made  by many indivi- *
  + * duals on behalf of the  Apache Software Foundation.  For more information *
  + * on the Apache Software Foundation, please see <http://www.apache.org/>.   *
  + *                                                                           *
  + * ========================================================================= */
  +package org.apache.catalina.connector.warp;
  +
  +/**
  + *
  + *
  + * @author <a href="mailto:pier.fumagalli@eng.sun.com">Pier Fumagalli</a>
  + * @author Copyright &copy; 1999, 2000 <a href="http://www.apache.org">The
  + *         Apache Software Foundation.
  + * @version CVS $Id: WarpHandlerTable.java,v 1.3 2000/12/07 21:12:56 pier Exp $
  + */
  +public class WarpHandlerTable {
  +
  +    /** The table used by this implementation. */
  +    private WarpTable table=null;
  +
  +    /**
  +     * Construct a new WarpHandlerTable instance with the default size.
  +     */
  +    public WarpHandlerTable() {
  +        super();
  +        this.table=new WarpTable();
  +    }
  +
  +    /**
  +     * Construct a new WarpHandlerTable instance with a specified size.
  +     *
  +     * @param size The initial size of the table.
  +     */
  +    public WarpHandlerTable(int size) {
  +        super();
  +        this.table=new WarpTable(size);
  +    }
  +
  +    /**
  +     * Get the WarpHandler associated with a specific RID.
  +     *
  +     * @param rid The RID number.
  +     * @return The WarpHandler or null if the RID was not associated with the
  +     *         specified RID.
  +     */
  +    public WarpHandler get(int rid) {
  +        return((WarpHandler)this.table.get(rid));
  +    }
  +
  +    /**
  +     * Associate a WarpHandler with a specified RID.
  +     *
  +     * @param handler The WarpHandler to put in the table.
  +     * @param rid The RID number associated with the WarpHandler.
  +     * @return If another WarpHandler is associated with this RID return
  +     *         false, otherwise return true.
  +     */
  +    public boolean add(WarpHandler handler, int rid)
  +    throws NullPointerException {
  +        return(this.table.add(handler,rid));
  +    }
  +
  +    /**
  +     * Remove the WarpHandler associated with a specified RID.
  +     *
  +     * @param rid The RID number of the WarpHandler to remove.
  +     * @return The old WarpHandler associated with the specified RID or null.
  +     */
  +    public WarpHandler remove(int rid) {
  +        return((WarpHandler)this.table.remove(rid));
  +    }
  +
  +    /**
  +     * Return the array of WarpHandler objects present in this table.
  +     *
  +     * @return An array (maybe empty) of WarpHandler objects.
  +     */
  +    public WarpHandler[] handlers() {
  +        int num=this.table.count();
  +        WarpHandler buff[]=new WarpHandler[num];
  +        if (num>0) System.arraycopy(this.table.objects,0,buff,0,num);
  +        return(buff);
  +    }
  +}
  
  
  
  1.3       +15 -48    jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/warp/WarpEngineMapper.java
  
  Index: WarpEngineMapper.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/warp/WarpEngineMapper.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- WarpEngineMapper.java	2000/12/07 17:38:12	1.2
  +++ WarpEngineMapper.java	2000/12/07 21:12:57	1.3
  @@ -61,29 +61,22 @@
   import org.apache.catalina.Host;
   import org.apache.catalina.Mapper;
   import org.apache.catalina.Request;
  +import org.apache.catalina.core.StandardHostMapper;
   
   /**
    *
  - *
    * @author <a href="mailto:pier.fumagalli@eng.sun.com">Pier Fumagalli</a>
    * @author Copyright &copy; 1999, 2000 <a href="http://www.apache.org">The
    *         Apache Software Foundation.
  - * @version CVS $Id: WarpEngineMapper.java,v 1.2 2000/12/07 17:38:12 pier Exp $
  + * @version CVS $Id: WarpEngineMapper.java,v 1.3 2000/12/07 21:12:57 pier Exp $
    */
  -public class WarpEngineMapper implements Mapper {
  +public class WarpEngineMapper extends StandardHostMapper {
   
       // -------------------------------------------------------------- CONSTANTS
   
       /** Our debug flag status (Used to compile out debugging information). */
       private static final boolean DEBUG=WarpDebug.DEBUG;
   
  -    // -------------------------------------------------------- BEAN PROPERTIES
  -
  -    /** The Container with which this Mapper is associated. */
  -    private WarpEngine engine = null;
  -    /** The protocol with which this Mapper is associated. */
  -    private String protocol = null;
  -
       // ------------------------------------------------------------ CONSTRUCTOR
   
       /**
  @@ -106,49 +99,23 @@
        */
       public Container map(Request request, boolean update) {
           if (DEBUG) this.debug("Trying to map request to host");
  -
  -        return(null);
  -    }
   
  -    // ----------------------------------------------------------- BEAN METHODS
  +        if (request instanceof WarpRequest) {
  +            WarpRequest r=(WarpRequest)request;
   
  -    /**
  -     * Return the Container with which this Mapper is associated.
  -     */
  -    public Container getContainer() {
  -        return (this.engine);
  -    }
  +            Container engine=super.getContainer();
  +    	    Container children[]=engine.findChildren();
   
  -    /**
  -     * Set the Container with which this Mapper is associated.
  -     */
  -    public void setContainer(Container container) {
  -        if (DEBUG) {
  -            if (container==null) {
  -                this.debug("Setting null container");
  -            } else {
  -                String info=container.getInfo();
  -                this.debug("Setting container "+info);
  +    	    for (int x=0; x<children.length; x++) {
  +    	        if (children[x] instanceof WarpHost) {
  +    	            WarpHost host=(WarpHost)children[x];
  +    	            if (r.getRequestedHostID()==host.getHostID()) {
  +    	                return(children[x]);
  +    	            }
  +                }
               }
           }
  -        this.engine=(WarpEngine)container;
  -    }
  -
  -    /**
  -     * Return the protocol for which this Mapper is responsible.
  -     */
  -    public String getProtocol() {
  -        return (this.protocol);
  -    }
  -
  -    /**
  -     * Set the protocol for which this Mapper is responsible.
  -     *
  -     * @param protocol The newly associated protocol
  -     */
  -    public void setProtocol(String protocol) {
  -        if (DEBUG) this.debug("Setting protocol "+protocol);
  -        this.protocol = protocol;
  +        return(super.map(request,update));
       }
   
       // ------------------------------------------------------ DEBUGGING METHODS
  
  
  
  1.3       +3 -43     jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/warp/WarpEngine.java
  
  Index: WarpEngine.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/warp/WarpEngine.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- WarpEngine.java	2000/12/07 17:38:11	1.2
  +++ WarpEngine.java	2000/12/07 21:12:58	1.3
  @@ -67,7 +67,7 @@
   import org.apache.catalina.LifecycleException;
   import org.apache.catalina.Request;
   import org.apache.catalina.Response;
  -import org.apache.catalina.core.ContainerBase;
  +import org.apache.catalina.core.StandardEngine;
   
   /**
    *
  @@ -75,9 +75,9 @@
    * @author <a href="mailto:pier.fumagalli@eng.sun.com">Pier Fumagalli</a>
    * @author Copyright &copy; 1999, 2000 <a href="http://www.apache.org">The
    *         Apache Software Foundation.
  - * @version CVS $Id: WarpEngine.java,v 1.2 2000/12/07 17:38:11 pier Exp $
  + * @version CVS $Id: WarpEngine.java,v 1.3 2000/12/07 21:12:58 pier Exp $
    */
  -public class WarpEngine extends ContainerBase implements Engine {
  +public class WarpEngine extends StandardEngine implements Engine {
   
       // -------------------------------------------------------------- CONSTANTS
   
  @@ -98,56 +98,16 @@
        */
       public WarpEngine() {
           super();
  -        super.setBasic(new WarpEngineValve());
           if (DEBUG) this.debug("New instance created");
       }
   
       // --------------------------------------------------------- PUBLIC METHODS
   
       /**
  -     * Add a child Container, only if the proposed child is an implementation
  -     * of Host.
  -     */
  -    public void addChild(Container child) {
  -        if (DEBUG) this.debug("Adding child "+child.getInfo());
  -
  -        if (!(child instanceof Host))
  -            throw new IllegalArgumentException("Child of Engine is not Host");
  -
  -        super.addChild(child);
  -    }
  -
  -    /**
        * Return descriptive information about this implementation.
        */
       public String getInfo() {
           return(this.info);
  -    }
  -
  -    /**
  -     * Disallow any attempt to set a parent for this Container, since an
  -     * Engine is supposed to be at the top of the Container hierarchy.
  -     */
  -    public void setParent(Container container) {
  -        throw new IllegalArgumentException("Engine cannot have a parent");
  -    }
  -
  -    /**
  -     * Start this Engine component.
  -     */
  -    public void start() throws LifecycleException {
  -        if (DEBUG) this.debug("Starting");
  -        // Standard container startup
  -        super.start();
  -    }
  -
  -    /**
  -     * Start this Engine component.
  -     */
  -    public void stop() throws LifecycleException {
  -        if (DEBUG) this.debug("Stopping");
  -        // Standard container startup
  -        super.stop();
       }
   
       /**
  
  
  
  1.4       +3 -1      jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/warp/WarpDebug.java
  
  Index: WarpDebug.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/warp/WarpDebug.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- WarpDebug.java	2000/12/07 17:38:11	1.3
  +++ WarpDebug.java	2000/12/07 21:12:58	1.4
  @@ -61,7 +61,7 @@
    * @author <a href="mailto:pier.fumagalli@eng.sun.com">Pier Fumagalli</a>
    * @author Copyright &copy; 1999, 2000 <a href="http://www.apache.org">The
    *         Apache Software Foundation.
  - * @version CVS $Id: WarpDebug.java,v 1.3 2000/12/07 17:38:11 pier Exp $
  + * @version CVS $Id: WarpDebug.java,v 1.4 2000/12/07 21:12:58 pier Exp $
    */
   public class WarpDebug {
   
  @@ -101,6 +101,7 @@
               System.err.println("["+c+"]");
               if (msg==null) return;
               System.err.println("    "+msg);
  +            System.err.flush();
           }
       }
   
  @@ -122,6 +123,7 @@
                   System.err.print("    ");
                   exc.printStackTrace(System.err);
               }
  +            System.err.flush();
           }
       }
   }
  
  
  
  1.3       +2 -2      jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/warp/WarpConnector.java
  
  Index: WarpConnector.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/warp/WarpConnector.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- WarpConnector.java	2000/12/07 17:38:10	1.2
  +++ WarpConnector.java	2000/12/07 21:12:59	1.3
  @@ -78,7 +78,7 @@
    * @author <a href="mailto:pier.fumagalli@eng.sun.com">Pier Fumagalli</a>
    * @author Copyright &copy; 1999, 2000 <a href="http://www.apache.org">The
    *         Apache Software Foundation.
  - * @version CVS $Id: WarpConnector.java,v 1.2 2000/12/07 17:38:10 pier Exp $
  + * @version CVS $Id: WarpConnector.java,v 1.3 2000/12/07 21:12:59 pier Exp $
    */
   public class WarpConnector implements Connector, Lifecycle, Runnable {
   
  @@ -158,7 +158,7 @@
        * of a Request from the responsible Container.
        */
       public Request createRequest() {
  -        HttpRequestBase request = new HttpRequestBase();
  +        WarpRequest request = new WarpRequest();
           request.setConnector(this);
           return (request);
       }
  
  
  
  1.5       +381 -376  jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/warp/WarpConnection.java
  
  Index: WarpConnection.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/warp/WarpConnection.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- WarpConnection.java	2000/12/07 17:38:10	1.4
  +++ WarpConnection.java	2000/12/07 21:12:59	1.5
  @@ -1,376 +1,381 @@
  -/* ========================================================================= *
  - *                                                                           *
  - *                 The Apache Software License,  Version 1.1                 *
  - *                                                                           *
  - *         Copyright (c) 1999, 2000  The Apache Software Foundation.         *
  - *                           All rights reserved.                            *
  - *                                                                           *
  - * ========================================================================= *
  - *                                                                           *
  - * Redistribution and use in source and binary forms,  with or without modi- *
  - * fication, are permitted provided that the following conditions are met:   *
  - *                                                                           *
  - * 1. Redistributions of source code  must retain the above copyright notice *
  - *    notice, this list of conditions and the following disclaimer.          *
  - *                                                                           *
  - * 2. Redistributions  in binary  form  must  reproduce the  above copyright *
  - *    notice,  this list of conditions  and the following  disclaimer in the *
  - *    documentation and/or other materials provided with the distribution.   *
  - *                                                                           *
  - * 3. The end-user documentation  included with the redistribution,  if any, *
  - *    must include the following acknowlegement:                             *
  - *                                                                           *
  - *       "This product includes  software developed  by the Apache  Software *
  - *        Foundation <http://www.apache.org/>."                              *
  - *                                                                           *
  - *    Alternately, this acknowlegement may appear in the software itself, if *
  - *    and wherever such third-party acknowlegements normally appear.         *
  - *                                                                           *
  - * 4. The names  "The  Jakarta  Project",  "Tomcat",  and  "Apache  Software *
  - *    Foundation"  must not be used  to endorse or promote  products derived *
  - *    from this  software without  prior  written  permission.  For  written *
  - *    permission, please contact <apache@apache.org>.                        *
  - *                                                                           *
  - * 5. Products derived from this software may not be called "Apache" nor may *
  - *    "Apache" appear in their names without prior written permission of the *
  - *    Apache Software Foundation.                                            *
  - *                                                                           *
  - * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES *
  - * INCLUDING, BUT NOT LIMITED TO,  THE IMPLIED WARRANTIES OF MERCHANTABILITY *
  - * AND FITNESS FOR  A PARTICULAR PURPOSE  ARE DISCLAIMED.  IN NO EVENT SHALL *
  - * THE APACHE  SOFTWARE  FOUNDATION OR  ITS CONTRIBUTORS  BE LIABLE  FOR ANY *
  - * DIRECT,  INDIRECT,   INCIDENTAL,  SPECIAL,  EXEMPLARY,  OR  CONSEQUENTIAL *
  - * DAMAGES (INCLUDING,  BUT NOT LIMITED TO,  PROCUREMENT OF SUBSTITUTE GOODS *
  - * OR SERVICES;  LOSS OF USE,  DATA,  OR PROFITS;  OR BUSINESS INTERRUPTION) *
  - * HOWEVER CAUSED AND  ON ANY  THEORY  OF  LIABILITY,  WHETHER IN  CONTRACT, *
  - * STRICT LIABILITY, OR TORT  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN *
  - * ANY  WAY  OUT OF  THE  USE OF  THIS  SOFTWARE,  EVEN  IF  ADVISED  OF THE *
  - * POSSIBILITY OF SUCH DAMAGE.                                               *
  - *                                                                           *
  - * ========================================================================= *
  - *                                                                           *
  - * This software  consists of voluntary  contributions made  by many indivi- *
  - * duals on behalf of the  Apache Software Foundation.  For more information *
  - * on the Apache Software Foundation, please see <http://www.apache.org/>.   *
  - *                                                                           *
  - * ========================================================================= */
  -package org.apache.catalina.connector.warp;
  -
  -import java.io.*;
  -import java.net.*;
  -import org.apache.catalina.Lifecycle;
  -import org.apache.catalina.LifecycleEvent;
  -import org.apache.catalina.LifecycleException;
  -import org.apache.catalina.LifecycleListener;
  -import org.apache.catalina.util.LifecycleSupport;
  -
  -/**
  - *
  - * @author <a href="mailto:pier.fumagalli@eng.sun.com">Pier Fumagalli</a>
  - * @author Copyright &copy; 1999, 2000 <a href="http://www.apache.org">The
  - *         Apache Software Foundation.
  - * @version CVS $Id: WarpConnection.java,v 1.4 2000/12/07 17:38:10 pier Exp $
  - */
  -public class WarpConnection implements Lifecycle, Runnable {
  -
  -    // -------------------------------------------------------------- CONSTANTS
  -
  -    /** Our debug flag status (Used to compile out debugging information). */
  -    private static final boolean DEBUG=WarpDebug.DEBUG;
  -
  -    // -------------------------------------------------------- LOCAL VARIABLES
  -
  -    /** The lifecycle event support for this component. */
  -    private LifecycleSupport lifecycle=null;
  -    /** The WarpHandlerTable contains the list of all current handlers. */
  -    private WarpHandlerTable table=null;
  -    /** The name of this connection. */
  -    private String name=null;
  -    /** Wether we started or not. */
  -    private boolean started=false;
  -
  -    // -------------------------------------------------------- BEAN PROPERTIES
  -
  -    /** The socket used in this connection. */
  -    private Socket socket=null;
  -    /** The connector wich created this connection. */
  -    private WarpConnector connector=null;
  -
  -    // ------------------------------------------------------------ CONSTRUCTOR
  -
  -    /**
  -     * Create a new WarpConnection instance.
  -     */
  -    public WarpConnection() {
  -        super();
  -        this.lifecycle=new LifecycleSupport(this);
  -        this.table=new WarpHandlerTable();
  -        if (DEBUG) this.debug("New instance created");
  -    }
  -
  -    // --------------------------------------------------------- PUBLIC METHODS
  -
  -    /**
  -     * Run the thread waiting on the socket, reading packets from the client
  -     * and dispatching them to the appropriate handler.
  -     */
  -    public void run() {
  -        WarpHandler han=null;
  -        InputStream in=null;
  -        int rid=0;
  -        int typ=0;
  -        int len=0;
  -        int ret=0;
  -        int b1=0;
  -        int b2=0;
  -        byte buf[]=null;
  -
  -        // Log the connection opening
  -        if (DEBUG) this.debug("Connection started");
  -
  -        try {
  -            // Open the socket InputStream
  -            in=this.socket.getInputStream();
  -
  -            // Read packets
  -            while(this.started) {
  -                // RID number
  -                b1=in.read();
  -                b2=in.read();
  -                if ((b1 | b2)==-1) {
  -                    this.log("Premature RID end");
  -                    break;
  -                }
  -                rid=(((b1 & 0x0ff) << 8) | (b2 & 0x0ff));
  -                // Packet type
  -                b1=in.read();
  -                b2=in.read();
  -                if ((b1 | b2)==-1) {
  -                    this.log("Premature TYPE end");
  -                    break;
  -                }
  -                typ=(((b1 & 0x0ff) << 8) | (b2 & 0x0ff));
  -                // Packet payload length
  -                b1=in.read();
  -                b2=in.read();
  -                if ((b1 | b2)==-1) {
  -                    this.log("Premature LEN end");
  -                    break;
  -                }
  -                len=(((b1 & 0x0ff) << 8) | (b2 & 0x0ff));
  -                // Packet payload
  -                buf=new byte[len];
  -                if ((ret=in.read(buf,0,len))!=len) {
  -                    this.log("Premature packet end"+" ("+ret+" of "+len+")");
  -                    break;
  -                }
  -
  -                if (DEBUG) this.debug("Received packet RID="+rid+" TYP="+typ);
  -
  -                // Check if we have the special RID 0x0ffff (disconnect)
  -                if (rid==0x0ffff) {
  -                    this.log("Connection closing ("+new String(buf)+")");
  -                    break;
  -                }
  -
  -                // Dispatch packet
  -                synchronized (this) { han=this.table.get(rid); }
  -                if (han==null) {
  -                    this.log("Handler for RID "+rid+" not found");
  -                    break;
  -                }
  -                han.processData(typ,buf);
  -            }
  -        } catch (IOException e) {
  -            if (this.started) e.printStackTrace(System.err);
  -        }
  -
  -        // Close this connection before terminating the thread
  -        try {
  -            this.stop();
  -        } catch (LifecycleException e) {
  -            this.log(e);
  -        }
  -        if (DEBUG) this.debug("Thread exited");
  -    }
  -
  -    /**
  -     * Initialize this connection.
  -     *
  -     * @param sock The socket used by this connection to transfer data.
  -     */
  -    public void start()
  -    throws LifecycleException {
  -        // Paranoia checks.
  -        if (this.socket==null)
  -            throw new LifecycleException("Null socket");
  -        if (this.connector==null)
  -            throw new LifecycleException("Null connector");
  -
  -        // Register the WarpConnectionHandler for RID=0 (connection)
  -        WarpHandler h=new WarpConnectionHandler();
  -        h.setConnection(this);
  -        h.setRequestID(0);
  -        h.start();
  -        // Paranoia check
  -        if(this.registerHandler(h,0)!=true) {
  -            this.stop();
  -            throw new LifecycleException("Cannot register connection handler");
  -        }
  -        // Set the thread and connection name and start the thread
  -        this.name=this.socket.getInetAddress().getHostAddress();
  -        this.name=this.name+":"+this.socket.getPort();
  -        new Thread(this,name).start();
  -    }
  -
  -    /**
  -     * Send a WARP packet.
  -     */
  -    public void send(int rid, int type, byte buffer[], int offset, int len)
  -    throws IOException {
  -        if (this.socket==null) throw new IOException("Connection closed "+type);
  -        OutputStream out=this.socket.getOutputStream();
  -        byte hdr[]=new byte[6];
  -        // Set the RID number
  -        hdr[0]=(byte)((rid>>8)&0x0ff);
  -        hdr[1]=(byte)(rid&0x0ff);
  -        // Set the TYPE
  -        hdr[2]=(byte)((type>>8)&0x0ff);
  -        hdr[3]=(byte)(type&0x0ff);
  -        // Set the payload length
  -        hdr[4]=(byte)((len>>8)&0x0ff);
  -        hdr[5]=(byte)(len&0x0ff);
  -        // Send the header and payload
  -        synchronized(this) {
  -            out.write(hdr,0,6);
  -            out.write(buffer,offset,len);
  -            out.flush();
  -        }
  -        if (DEBUG) this.debug("Sending packet RID="+rid+" TYP="+type);
  -    }
  -
  -    /**
  -     * Close this connection.
  -     */
  -    public void stop()
  -    throws LifecycleException {
  -        this.started=false;
  -        // Stop all handlers
  -        WarpHandler handlers[]=this.table.handlers();
  -        for (int x=0; x<handlers.length; x++) handlers[x].stop();
  -        // Close the socket (this will make the thread exit)
  -        if (this.socket!=null) try {
  -            this.socket.close();
  -        } catch (IOException e) {
  -            this.log(e);
  -            throw new LifecycleException("Closing connection "+this.name,e);
  -        }
  -
  -        this.socket=null;
  -        // Log this step
  -        this.log("Connection closed");
  -    }
  -
  -    /**
  -     * Add a WarpHandler to this connection.
  -     *
  -     * @param han The WarpHandler add to this connection.
  -     * @param rid The RID number associated with the WarpHandler.
  -     * @return If another WarpHandler is associated with this RID return
  -     *         false, otherwise return true.
  -     */
  -    protected synchronized boolean registerHandler(WarpHandler han, int rid) {
  -        if (DEBUG) this.debug("Registering handler for RID "+rid);
  -        return(this.table.add(han, rid));
  -    }
  -
  -    /**
  -     * Remove a WarpHandler from this connection.
  -     *
  -     * @param rid The RID number associated with the WarpHandler to remove.
  -     * @return The old WarpHandler associated with the specified RID or null.
  -     */
  -    protected synchronized WarpHandler removeHandler(int rid) {
  -        return(this.table.remove(rid));
  -    }
  -
  -    // ----------------------------------------------------------- BEAN METHODS
  -
  -    /**
  -     * Return the socket associated with this connection.
  -     */
  -    protected WarpConnector getConnector() {
  -        return(this.connector);
  -    }
  -
  -    /**
  -     * Set the socket used by this connection.
  -     */
  -    protected void setConnector(WarpConnector connector) {
  -        if (DEBUG) this.debug("Setting connector");
  -        this.connector=connector;
  -    }
  -
  -    /**
  -     * Return the socket associated with this connection.
  -     */
  -    protected Socket getSocket() {
  -        return(this.socket);
  -    }
  -
  -    /**
  -     * Set the socket used by this connection.
  -     */
  -    protected void setSocket(Socket socket) {
  -        if (DEBUG) this.debug("Setting socket");
  -        this.socket=socket;
  -    }
  -
  -    // ------------------------------------------------------ LIFECYCLE METHODS
  -
  -    /**
  -     * Add a lifecycle event listener to this component.
  -     */
  -    public void addLifecycleListener(LifecycleListener listener) {
  -        this.lifecycle.addLifecycleListener(listener);
  -    }
  -
  -    /**
  -     * Remove a lifecycle event listener from this component.
  -     */
  -    public void removeLifecycleListener(LifecycleListener listener) {
  -        lifecycle.removeLifecycleListener(listener);
  -    }
  -
  -    // ------------------------------------------ LOGGING AND DEBUGGING METHODS
  -
  -    /**
  -     * Dump a log message.
  -     */
  -    public void log(String msg) {
  -        if (this.connector!=null) this.connector.log(msg);
  -        else WarpDebug.debug(this,msg);
  -    }
  -
  -    /**
  -     * Dump information for an Exception.
  -     */
  -    public void log(Exception exc) {
  -        if (this.connector!=null) this.connector.log(exc);
  -        else WarpDebug.debug(this,exc);
  -    }
  -
  -    /**
  -     * Dump a debug message.
  -     */
  -    private void debug(String msg) {
  -        if (DEBUG) WarpDebug.debug(this,msg);
  -    }
  -
  -    /**
  -     * Dump information for an Exception.
  -     */
  -    private void debug(Exception exc) {
  -        if (DEBUG) WarpDebug.debug(this,exc);
  -    }
  -}
  +/* ========================================================================= *
  + *                                                                           *
  + *                 The Apache Software License,  Version 1.1                 *
  + *                                                                           *
  + *         Copyright (c) 1999, 2000  The Apache Software Foundation.         *
  + *                           All rights reserved.                            *
  + *                                                                           *
  + * ========================================================================= *
  + *                                                                           *
  + * Redistribution and use in source and binary forms,  with or without modi- *
  + * fication, are permitted provided that the following conditions are met:   *
  + *                                                                           *
  + * 1. Redistributions of source code  must retain the above copyright notice *
  + *    notice, this list of conditions and the following disclaimer.          *
  + *                                                                           *
  + * 2. Redistributions  in binary  form  must  reproduce the  above copyright *
  + *    notice,  this list of conditions  and the following  disclaimer in the *
  + *    documentation and/or other materials provided with the distribution.   *
  + *                                                                           *
  + * 3. The end-user documentation  included with the redistribution,  if any, *
  + *    must include the following acknowlegement:                             *
  + *                                                                           *
  + *       "This product includes  software developed  by the Apache  Software *
  + *        Foundation <http://www.apache.org/>."                              *
  + *                                                                           *
  + *    Alternately, this acknowlegement may appear in the software itself, if *
  + *    and wherever such third-party acknowlegements normally appear.         *
  + *                                                                           *
  + * 4. The names  "The  Jakarta  Project",  "Tomcat",  and  "Apache  Software *
  + *    Foundation"  must not be used  to endorse or promote  products derived *
  + *    from this  software without  prior  written  permission.  For  written *
  + *    permission, please contact <apache@apache.org>.                        *
  + *                                                                           *
  + * 5. Products derived from this software may not be called "Apache" nor may *
  + *    "Apache" appear in their names without prior written permission of the *
  + *    Apache Software Foundation.                                            *
  + *                                                                           *
  + * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES *
  + * INCLUDING, BUT NOT LIMITED TO,  THE IMPLIED WARRANTIES OF MERCHANTABILITY *
  + * AND FITNESS FOR  A PARTICULAR PURPOSE  ARE DISCLAIMED.  IN NO EVENT SHALL *
  + * THE APACHE  SOFTWARE  FOUNDATION OR  ITS CONTRIBUTORS  BE LIABLE  FOR ANY *
  + * DIRECT,  INDIRECT,   INCIDENTAL,  SPECIAL,  EXEMPLARY,  OR  CONSEQUENTIAL *
  + * DAMAGES (INCLUDING,  BUT NOT LIMITED TO,  PROCUREMENT OF SUBSTITUTE GOODS *
  + * OR SERVICES;  LOSS OF USE,  DATA,  OR PROFITS;  OR BUSINESS INTERRUPTION) *
  + * HOWEVER CAUSED AND  ON ANY  THEORY  OF  LIABILITY,  WHETHER IN  CONTRACT, *
  + * STRICT LIABILITY, OR TORT  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN *
  + * ANY  WAY  OUT OF  THE  USE OF  THIS  SOFTWARE,  EVEN  IF  ADVISED  OF THE *
  + * POSSIBILITY OF SUCH DAMAGE.                                               *
  + *                                                                           *
  + * ========================================================================= *
  + *                                                                           *
  + * This software  consists of voluntary  contributions made  by many indivi- *
  + * duals on behalf of the  Apache Software Foundation.  For more information *
  + * on the Apache Software Foundation, please see <http://www.apache.org/>.   *
  + *                                                                           *
  + * ========================================================================= */
  +package org.apache.catalina.connector.warp;
  +
  +import java.io.*;
  +import java.net.*;
  +import org.apache.catalina.Lifecycle;
  +import org.apache.catalina.LifecycleEvent;
  +import org.apache.catalina.LifecycleException;
  +import org.apache.catalina.LifecycleListener;
  +import org.apache.catalina.util.LifecycleSupport;
  +
  +/**
  + *
  + * @author <a href="mailto:pier.fumagalli@eng.sun.com">Pier Fumagalli</a>
  + * @author Copyright &copy; 1999, 2000 <a href="http://www.apache.org">The
  + *         Apache Software Foundation.
  + * @version CVS $Id: WarpConnection.java,v 1.5 2000/12/07 21:12:59 pier Exp $
  + */
  +public class WarpConnection implements Lifecycle, Runnable {
  +
  +    // -------------------------------------------------------------- CONSTANTS
  +
  +    /** Our debug flag status (Used to compile out debugging information). */
  +    private static final boolean DEBUG=WarpDebug.DEBUG;
  +
  +    // -------------------------------------------------------- LOCAL VARIABLES
  +
  +    /** The lifecycle event support for this component. */
  +    private LifecycleSupport lifecycle=null;
  +    /** The WarpHandlerTable contains the list of all current handlers. */
  +    private WarpHandlerTable table=null;
  +    /** The name of this connection. */
  +    private String name=null;
  +    /** Wether we started or not. */
  +    private boolean started=false;
  +    /** The number of active connections. */
  +    private static int num=0;
  +
  +    // -------------------------------------------------------- BEAN PROPERTIES
  +
  +    /** The socket used in this connection. */
  +    private Socket socket=null;
  +    /** The connector wich created this connection. */
  +    private WarpConnector connector=null;
  +
  +    // ------------------------------------------------------------ CONSTRUCTOR
  +
  +    /**
  +     * Create a new WarpConnection instance.
  +     */
  +    public WarpConnection() {
  +        super();
  +        this.lifecycle=new LifecycleSupport(this);
  +        this.table=new WarpHandlerTable();
  +        if (DEBUG) this.debug("New instance created");
  +    }
  +
  +    // --------------------------------------------------------- PUBLIC METHODS
  +
  +    /**
  +     * Run the thread waiting on the socket, reading packets from the client
  +     * and dispatching them to the appropriate handler.
  +     */
  +    public void run() {
  +        WarpHandler han=null;
  +        InputStream in=null;
  +        int rid=0;
  +        int typ=0;
  +        int len=0;
  +        int ret=0;
  +        int b1=0;
  +        int b2=0;
  +        byte buf[]=null;
  +
  +        // Log the connection opening
  +        num++;
  +        if (DEBUG) this.debug("Connection started (num="+num+") "+this.name);
  +
  +        try {
  +            // Open the socket InputStream
  +            in=this.socket.getInputStream();
  +
  +            // Read packets
  +            while(this.started) {
  +                // RID number
  +                b1=in.read();
  +                b2=in.read();
  +                if ((b1 | b2)==-1) {
  +                    this.log("Premature RID end");
  +                    break;
  +                }
  +                rid=(((b1 & 0x0ff) << 8) | (b2 & 0x0ff));
  +                // Packet type
  +                b1=in.read();
  +                b2=in.read();
  +                if ((b1 | b2)==-1) {
  +                    this.log("Premature TYPE end");
  +                    break;
  +                }
  +                typ=(((b1 & 0x0ff) << 8) | (b2 & 0x0ff));
  +                // Packet payload length
  +                b1=in.read();
  +                b2=in.read();
  +                if ((b1 | b2)==-1) {
  +                    this.log("Premature LEN end");
  +                    break;
  +                }
  +                len=(((b1 & 0x0ff) << 8) | (b2 & 0x0ff));
  +                // Packet payload
  +                buf=new byte[len];
  +                if ((ret=in.read(buf,0,len))!=len) {
  +                    this.log("Premature packet end"+" ("+ret+" of "+len+")");
  +                    break;
  +                }
  +
  +                if (DEBUG) this.debug("Received packet RID="+rid+" TYP="+typ);
  +
  +                // Check if we have the special RID 0x0ffff (disconnect)
  +                if (rid==0x0ffff) {
  +                    this.log("Connection closing ("+new String(buf)+")");
  +                    break;
  +                }
  +
  +                // Dispatch packet
  +                synchronized (this) { han=this.table.get(rid); }
  +                if (han==null) {
  +                    this.log("Handler for RID "+rid+" not found");
  +                    break;
  +                }
  +                han.processData(typ,buf);
  +            }
  +        } catch (IOException e) {
  +            if (this.started) e.printStackTrace(System.err);
  +        }
  +
  +        // Close this connection before terminating the thread
  +        try {
  +            this.stop();
  +        } catch (LifecycleException e) {
  +            this.log(e);
  +        }
  +        num--;
  +        if (DEBUG) this.debug("Connection ended (num="+num+") "+this.name);
  +    }
  +
  +    /**
  +     * Initialize this connection.
  +     *
  +     * @param sock The socket used by this connection to transfer data.
  +     */
  +    public void start()
  +    throws LifecycleException {
  +        // Paranoia checks.
  +        if (this.socket==null)
  +            throw new LifecycleException("Null socket");
  +        if (this.connector==null)
  +            throw new LifecycleException("Null connector");
  +
  +        // Register the WarpConnectionHandler for RID=0 (connection)
  +        this.started=true;
  +        WarpHandler h=new WarpConnectionHandler();
  +        h.setConnection(this);
  +        h.setRequestID(0);
  +        h.start();
  +        // Paranoia check
  +        if(this.registerHandler(h,0)!=true) {
  +            this.stop();
  +            throw new LifecycleException("Cannot register connection handler");
  +        }
  +        // Set the thread and connection name and start the thread
  +        this.name=this.socket.getInetAddress().getHostAddress();
  +        this.name=this.name+":"+this.socket.getPort();
  +        new Thread(this,name).start();
  +    }
  +
  +    /**
  +     * Send a WARP packet.
  +     */
  +    public void send(int rid, int type, byte buffer[], int offset, int len)
  +    throws IOException {
  +        if (this.socket==null) throw new IOException("Connection closed "+type);
  +        OutputStream out=this.socket.getOutputStream();
  +        byte hdr[]=new byte[6];
  +        // Set the RID number
  +        hdr[0]=(byte)((rid>>8)&0x0ff);
  +        hdr[1]=(byte)(rid&0x0ff);
  +        // Set the TYPE
  +        hdr[2]=(byte)((type>>8)&0x0ff);
  +        hdr[3]=(byte)(type&0x0ff);
  +        // Set the payload length
  +        hdr[4]=(byte)((len>>8)&0x0ff);
  +        hdr[5]=(byte)(len&0x0ff);
  +        // Send the header and payload
  +        synchronized(this) {
  +            out.write(hdr,0,6);
  +            out.write(buffer,offset,len);
  +            out.flush();
  +        }
  +        if (DEBUG) this.debug("Sending packet RID="+rid+" TYP="+type);
  +    }
  +
  +    /**
  +     * Close this connection.
  +     */
  +    public void stop()
  +    throws LifecycleException {
  +        this.started=false;
  +        // Stop all handlers
  +        WarpHandler handlers[]=this.table.handlers();
  +        for (int x=0; x<handlers.length; x++) handlers[x].stop();
  +        // Close the socket (this will make the thread exit)
  +        if (this.socket!=null) try {
  +            this.socket.close();
  +        } catch (IOException e) {
  +            this.log(e);
  +            throw new LifecycleException("Closing connection "+this.name,e);
  +        }
  +
  +        this.socket=null;
  +        // Log this step
  +        this.log("Connection closed");
  +    }
  +
  +    /**
  +     * Add a WarpHandler to this connection.
  +     *
  +     * @param han The WarpHandler add to this connection.
  +     * @param rid The RID number associated with the WarpHandler.
  +     * @return If another WarpHandler is associated with this RID return
  +     *         false, otherwise return true.
  +     */
  +    protected synchronized boolean registerHandler(WarpHandler han, int rid) {
  +        if (DEBUG) this.debug("Registering handler for RID "+rid);
  +        return(this.table.add(han, rid));
  +    }
  +
  +    /**
  +     * Remove a WarpHandler from this connection.
  +     *
  +     * @param rid The RID number associated with the WarpHandler to remove.
  +     * @return The old WarpHandler associated with the specified RID or null.
  +     */
  +    protected synchronized WarpHandler removeHandler(int rid) {
  +        return(this.table.remove(rid));
  +    }
  +
  +    // ----------------------------------------------------------- BEAN METHODS
  +
  +    /**
  +     * Return the socket associated with this connection.
  +     */
  +    protected WarpConnector getConnector() {
  +        return(this.connector);
  +    }
  +
  +    /**
  +     * Set the socket used by this connection.
  +     */
  +    protected void setConnector(WarpConnector connector) {
  +        if (DEBUG) this.debug("Setting connector");
  +        this.connector=connector;
  +    }
  +
  +    /**
  +     * Return the socket associated with this connection.
  +     */
  +    protected Socket getSocket() {
  +        return(this.socket);
  +    }
  +
  +    /**
  +     * Set the socket used by this connection.
  +     */
  +    protected void setSocket(Socket socket) {
  +        if (DEBUG) this.debug("Setting socket");
  +        this.socket=socket;
  +    }
  +
  +    // ------------------------------------------------------ LIFECYCLE METHODS
  +
  +    /**
  +     * Add a lifecycle event listener to this component.
  +     */
  +    public void addLifecycleListener(LifecycleListener listener) {
  +        this.lifecycle.addLifecycleListener(listener);
  +    }
  +
  +    /**
  +     * Remove a lifecycle event listener from this component.
  +     */
  +    public void removeLifecycleListener(LifecycleListener listener) {
  +        lifecycle.removeLifecycleListener(listener);
  +    }
  +
  +    // ------------------------------------------ LOGGING AND DEBUGGING METHODS
  +
  +    /**
  +     * Dump a log message.
  +     */
  +    public void log(String msg) {
  +        if (this.connector!=null) this.connector.log(msg);
  +        else WarpDebug.debug(this,msg);
  +    }
  +
  +    /**
  +     * Dump information for an Exception.
  +     */
  +    public void log(Exception exc) {
  +        if (this.connector!=null) this.connector.log(exc);
  +        else WarpDebug.debug(this,exc);
  +    }
  +
  +    /**
  +     * Dump a debug message.
  +     */
  +    private void debug(String msg) {
  +        if (DEBUG) WarpDebug.debug(this,msg);
  +    }
  +
  +    /**
  +     * Dump information for an Exception.
  +     */
  +    private void debug(Exception exc) {
  +        if (DEBUG) WarpDebug.debug(this,exc);
  +    }
  +}
  
  
  
  1.1                  jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/warp/WarpTable.java
  
  Index: WarpTable.java
  ===================================================================
  /* ========================================================================= *
   *                                                                           *
   *                 The Apache Software License,  Version 1.1                 *
   *                                                                           *
   *         Copyright (c) 1999, 2000  The Apache Software Foundation.         *
   *                           All rights reserved.                            *
   *                                                                           *
   * ========================================================================= *
   *                                                                           *
   * Redistribution and use in source and binary forms,  with or without modi- *
   * fication, are permitted provided that the following conditions are met:   *
   *                                                                           *
   * 1. Redistributions of source code  must retain the above copyright notice *
   *    notice, this list of conditions and the following disclaimer.          *
   *                                                                           *
   * 2. Redistributions  in binary  form  must  reproduce the  above copyright *
   *    notice,  this list of conditions  and the following  disclaimer in the *
   *    documentation and/or other materials provided with the distribution.   *
   *                                                                           *
   * 3. The end-user documentation  included with the redistribution,  if any, *
   *    must include the following acknowlegement:                             *
   *                                                                           *
   *       "This product includes  software developed  by the Apache  Software *
   *        Foundation <http://www.apache.org/>."                              *
   *                                                                           *
   *    Alternately, this acknowlegement may appear in the software itself, if *
   *    and wherever such third-party acknowlegements normally appear.         *
   *                                                                           *
   * 4. The names  "The  Jakarta  Project",  "Tomcat",  and  "Apache  Software *
   *    Foundation"  must not be used  to endorse or promote  products derived *
   *    from this  software without  prior  written  permission.  For  written *
   *    permission, please contact <apache@apache.org>.                        *
   *                                                                           *
   * 5. Products derived from this software may not be called "Apache" nor may *
   *    "Apache" appear in their names without prior written permission of the *
   *    Apache Software Foundation.                                            *
   *                                                                           *
   * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES *
   * INCLUDING, BUT NOT LIMITED TO,  THE IMPLIED WARRANTIES OF MERCHANTABILITY *
   * AND FITNESS FOR  A PARTICULAR PURPOSE  ARE DISCLAIMED.  IN NO EVENT SHALL *
   * THE APACHE  SOFTWARE  FOUNDATION OR  ITS CONTRIBUTORS  BE LIABLE  FOR ANY *
   * DIRECT,  INDIRECT,   INCIDENTAL,  SPECIAL,  EXEMPLARY,  OR  CONSEQUENTIAL *
   * DAMAGES (INCLUDING,  BUT NOT LIMITED TO,  PROCUREMENT OF SUBSTITUTE GOODS *
   * OR SERVICES;  LOSS OF USE,  DATA,  OR PROFITS;  OR BUSINESS INTERRUPTION) *
   * HOWEVER CAUSED AND  ON ANY  THEORY  OF  LIABILITY,  WHETHER IN  CONTRACT, *
   * STRICT LIABILITY, OR TORT  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN *
   * ANY  WAY  OUT OF  THE  USE OF  THIS  SOFTWARE,  EVEN  IF  ADVISED  OF THE *
   * POSSIBILITY OF SUCH DAMAGE.                                               *
   *                                                                           *
   * ========================================================================= *
   *                                                                           *
   * This software  consists of voluntary  contributions made  by many indivi- *
   * duals on behalf of the  Apache Software Foundation.  For more information *
   * on the Apache Software Foundation, please see <http://www.apache.org/>.   *
   *                                                                           *
   * ========================================================================= */
  package org.apache.catalina.connector.warp;
  
  /**
   *
   * @author <a href="mailto:pier.fumagalli@eng.sun.com">Pier Fumagalli</a>
   * @author Copyright &copy; 1999, 2000 <a href="http://www.apache.org">The
   *         Apache Software Foundation.
   * @version CVS $Id: WarpTable.java,v 1.1 2000/12/07 21:12:54 pier Exp $
   */
  public class WarpTable {
  
      /** The default size of our tables. */
      private static int defaultsize=32;
  
      /** The current size of our arrays. */
      private int size;
  
      /** The number of elements present in our arrays. */
      private int num;
  
      /** The array of objects. */
      protected Object objects[];
  
      /** The array of ids. */
      protected int ids[];
  
      /**
       * Construct a new WarpTable instance with the default size.
       */
      public WarpTable() {
          this(defaultsize);
      }
  
      /**
       * Construct a new WarpTable instance with a specified size.
       *
       * @param size The initial size of the table.
       */
      public WarpTable(int size) {
          super();
          // Paranoid, it's pointless to build a smaller than minimum size.
          if (size<defaultsize) size=defaultsize;
  
          // Set the current and default sizes (in Hashtable terms the load
          // factor is always 1.0)
          this.defaultsize=size;
          this.size=size;
  
          // Set the initial values.
          this.num=0;
          this.ids=new int[size];
          this.objects=new Object[size];
      }
  
      /**
       * Get the Object associated with a specific ID.
       *
       * @param id The ID number.
       * @return The Object or null if the ID was not associated with the
       *         specified ID.
       */
      public Object get(int id) {
          // Iterate thru the array of ids
          for (int x=0; x<this.num; x++) {
  
              // We got our id, return the object at the same position
              if (this.ids[x]==id) return(this.objects[x]);
          }
  
          // Not found.
          return(null);
      }
  
      /**
       * Associate a Object with a specified ID.
       *
       * @param object The Object to put in the table.
       * @param id The ID number associated with the Object.
       * @return If another Object is associated with this ID return
       *         false, otherwise return true.
       */
      public boolean add(Object object, int id)
      throws NullPointerException {
          // Check if we were given a valid object
          if (object==null) throw new NullPointerException("Null Handler");
  
          // Check if another object was registered for the specified id.
          if (this.get(id)!=null) return(false);
  
          // Check if we reached the capacity limit
          if(this.size==this.num) {
  
              // Allocate some space for the new arrays
              int newsize=this.size+defaultsize;
              Object newobjects[]=new Object[newsize];
              int newids[]=new int[newsize];
              // Copy the original arrays into the new arrays
              System.arraycopy(this.objects,0,newobjects,0,this.num);
              System.arraycopy(this.ids,0,newids,0,this.num);
              // Update our variables
              this.size=newsize;
              this.objects=newobjects;
              this.ids=newids;
          }
  
          // Add the object and its id to the arrays
          this.objects[this.num]=object;
          this.ids[this.num]=id;
          this.num++;
  
          // Whohoo!
          return(true);
      }
  
      /**
       * Remove the Object associated with a specified ID.
       *
       * @param id The ID number of the Object to remove.
       * @return The old Object associated with the specified ID or null.
       */
      public Object remove(int id) {
          // Iterate thru the array of ids
          for (int x=0; x<this.num; x++) {
  
              // We got our id, and we need to get rid of its object
              if (this.ids[x]==id) {
                  Object oldobject=this.objects[x];
                  // Decrease the number of objects stored in this table
                  this.num--;
                  // Move the last record in our arrays in the current position
                  // (dirty way to compact a table)
                  this.objects[x]=this.objects[this.num];
                  this.ids[x]=this.ids[this.num];
  
                  // Now we want to see if we need to shrink our arrays (we don't
                  // want them to grow indefinitely in case of peak data storage)
                  // We check the number of available positions against the value
                  // of defaultsize*2, so that our free positions are always
                  // between 0 and defaultsize*2 (this will reduce the number of
                  // System.arraycopy() calls. Even after the shrinking is done
                  // we still have defaultsize positions available.
                  if ((this.size-this.num)>(this.defaultsize<<1)) {
  
                      // Allocate some space for the new arrays
                      int newsize=this.size-defaultsize;
                      Object newobjects[]=new Object[newsize];
                      int newids[]=new int[newsize];
                      // Copy the original arrays into the new arrays
                      System.arraycopy(this.objects,0,newobjects,0,this.num);
                      System.arraycopy(this.ids,0,newids,0,this.num);
                      // Update our variables
                      this.size=newsize;
                      this.objects=newobjects;
                      this.ids=newids;
                  }
  
                  // The object and its id were removed, and if necessary the
                  // arrays were shrunk. We just need to return the old object.
                  return(oldobject);
              }
          }
  
          // Not found.
          return(null);
      }
  
      /**
       * Return the number of objects present in this table.
       *
       * @return The number of objects present in this table.
       */
      public int count() {
          return(this.num);
      }
  }
  
  
  
  1.1                  jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/warp/WarpRequest.java
  
  Index: WarpRequest.java
  ===================================================================
  /* ========================================================================= *
   *                                                                           *
   *                 The Apache Software License,  Version 1.1                 *
   *                                                                           *
   *         Copyright (c) 1999, 2000  The Apache Software Foundation.         *
   *                           All rights reserved.                            *
   *                                                                           *
   * ========================================================================= *
   *                                                                           *
   * Redistribution and use in source and binary forms,  with or without modi- *
   * fication, are permitted provided that the following conditions are met:   *
   *                                                                           *
   * 1. Redistributions of source code  must retain the above copyright notice *
   *    notice, this list of conditions and the following disclaimer.          *
   *                                                                           *
   * 2. Redistributions  in binary  form  must  reproduce the  above copyright *
   *    notice,  this list of conditions  and the following  disclaimer in the *
   *    documentation and/or other materials provided with the distribution.   *
   *                                                                           *
   * 3. The end-user documentation  included with the redistribution,  if any, *
   *    must include the following acknowlegement:                             *
   *                                                                           *
   *       "This product includes  software developed  by the Apache  Software *
   *        Foundation <http://www.apache.org/>."                              *
   *                                                                           *
   *    Alternately, this acknowlegement may appear in the software itself, if *
   *    and wherever such third-party acknowlegements normally appear.         *
   *                                                                           *
   * 4. The names  "The  Jakarta  Project",  "Tomcat",  and  "Apache  Software *
   *    Foundation"  must not be used  to endorse or promote  products derived *
   *    from this  software without  prior  written  permission.  For  written *
   *    permission, please contact <apache@apache.org>.                        *
   *                                                                           *
   * 5. Products derived from this software may not be called "Apache" nor may *
   *    "Apache" appear in their names without prior written permission of the *
   *    Apache Software Foundation.                                            *
   *                                                                           *
   * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES *
   * INCLUDING, BUT NOT LIMITED TO,  THE IMPLIED WARRANTIES OF MERCHANTABILITY *
   * AND FITNESS FOR  A PARTICULAR PURPOSE  ARE DISCLAIMED.  IN NO EVENT SHALL *
   * THE APACHE  SOFTWARE  FOUNDATION OR  ITS CONTRIBUTORS  BE LIABLE  FOR ANY *
   * DIRECT,  INDIRECT,   INCIDENTAL,  SPECIAL,  EXEMPLARY,  OR  CONSEQUENTIAL *
   * DAMAGES (INCLUDING,  BUT NOT LIMITED TO,  PROCUREMENT OF SUBSTITUTE GOODS *
   * OR SERVICES;  LOSS OF USE,  DATA,  OR PROFITS;  OR BUSINESS INTERRUPTION) *
   * HOWEVER CAUSED AND  ON ANY  THEORY  OF  LIABILITY,  WHETHER IN  CONTRACT, *
   * STRICT LIABILITY, OR TORT  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN *
   * ANY  WAY  OUT OF  THE  USE OF  THIS  SOFTWARE,  EVEN  IF  ADVISED  OF THE *
   * POSSIBILITY OF SUCH DAMAGE.                                               *
   *                                                                           *
   * ========================================================================= *
   *                                                                           *
   * This software  consists of voluntary  contributions made  by many indivi- *
   * duals on behalf of the  Apache Software Foundation.  For more information *
   * on the Apache Software Foundation, please see <http://www.apache.org/>.   *
   *                                                                           *
   * ========================================================================= */
  package org.apache.catalina.connector.warp;
  
  import org.apache.catalina.connector.HttpRequestBase;
  
  /**
   *
   *
   * @author <a href="mailto:pier.fumagalli@eng.sun.com">Pier Fumagalli</a>
   * @author Copyright &copy; 1999, 2000 <a href="http://www.apache.org">The
   *         Apache Software Foundation.
   * @version CVS $Id: WarpRequest.java,v 1.1 2000/12/07 21:12:55 pier Exp $
   */
  public class WarpRequest extends HttpRequestBase {
  
      // -------------------------------------------------------------- CONSTANTS
  
      /** Our debug flag status (Used to compile out debugging information). */
      private static final boolean DEBUG=WarpDebug.DEBUG;
  
      // -------------------------------------------------------- LOCAL VARIABLES
  
      /** The Warp Host ID of this Host. */
      private int hostid=-1;
  
      // ----------------------------------------------------------- BEAN METHODS
  
      /**
       * Return the Host ID associated with this WarpRequest instance.
       */
      protected int getRequestedHostID() {
          return(this.hostid);
      }
  
      /**
       * Set the Host ID associated with this WarpRequest instance.
       */
      protected void setRequestedHostID(int id) {
          if (DEBUG) this.debug("Setting request HostID to "+id);
          this.hostid=id;
      }
  
      // ------------------------------------------------------ DEBUGGING METHODS
  
      /**
       * Dump a debug message.
       */
      private void debug(String msg) {
          if (DEBUG) WarpDebug.debug(this,msg);
      }
  
      /**
       * Dump information for an Exception.
       */
      private void debug(Exception exc) {
          if (DEBUG) WarpDebug.debug(this,exc);
      }
  }
  
  
  
  1.1                  jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/warp/WarpHost.java
  
  Index: WarpHost.java
  ===================================================================
  /* ========================================================================= *
   *                                                                           *
   *                 The Apache Software License,  Version 1.1                 *
   *                                                                           *
   *         Copyright (c) 1999, 2000  The Apache Software Foundation.         *
   *                           All rights reserved.                            *
   *                                                                           *
   * ========================================================================= *
   *                                                                           *
   * Redistribution and use in source and binary forms,  with or without modi- *
   * fication, are permitted provided that the following conditions are met:   *
   *                                                                           *
   * 1. Redistributions of source code  must retain the above copyright notice *
   *    notice, this list of conditions and the following disclaimer.          *
   *                                                                           *
   * 2. Redistributions  in binary  form  must  reproduce the  above copyright *
   *    notice,  this list of conditions  and the following  disclaimer in the *
   *    documentation and/or other materials provided with the distribution.   *
   *                                                                           *
   * 3. The end-user documentation  included with the redistribution,  if any, *
   *    must include the following acknowlegement:                             *
   *                                                                           *
   *       "This product includes  software developed  by the Apache  Software *
   *        Foundation <http://www.apache.org/>."                              *
   *                                                                           *
   *    Alternately, this acknowlegement may appear in the software itself, if *
   *    and wherever such third-party acknowlegements normally appear.         *
   *                                                                           *
   * 4. The names  "The  Jakarta  Project",  "Tomcat",  and  "Apache  Software *
   *    Foundation"  must not be used  to endorse or promote  products derived *
   *    from this  software without  prior  written  permission.  For  written *
   *    permission, please contact <apache@apache.org>.                        *
   *                                                                           *
   * 5. Products derived from this software may not be called "Apache" nor may *
   *    "Apache" appear in their names without prior written permission of the *
   *    Apache Software Foundation.                                            *
   *                                                                           *
   * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES *
   * INCLUDING, BUT NOT LIMITED TO,  THE IMPLIED WARRANTIES OF MERCHANTABILITY *
   * AND FITNESS FOR  A PARTICULAR PURPOSE  ARE DISCLAIMED.  IN NO EVENT SHALL *
   * THE APACHE  SOFTWARE  FOUNDATION OR  ITS CONTRIBUTORS  BE LIABLE  FOR ANY *
   * DIRECT,  INDIRECT,   INCIDENTAL,  SPECIAL,  EXEMPLARY,  OR  CONSEQUENTIAL *
   * DAMAGES (INCLUDING,  BUT NOT LIMITED TO,  PROCUREMENT OF SUBSTITUTE GOODS *
   * OR SERVICES;  LOSS OF USE,  DATA,  OR PROFITS;  OR BUSINESS INTERRUPTION) *
   * HOWEVER CAUSED AND  ON ANY  THEORY  OF  LIABILITY,  WHETHER IN  CONTRACT, *
   * STRICT LIABILITY, OR TORT  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN *
   * ANY  WAY  OUT OF  THE  USE OF  THIS  SOFTWARE,  EVEN  IF  ADVISED  OF THE *
   * POSSIBILITY OF SUCH DAMAGE.                                               *
   *                                                                           *
   * ========================================================================= *
   *                                                                           *
   * This software  consists of voluntary  contributions made  by many indivi- *
   * duals on behalf of the  Apache Software Foundation.  For more information *
   * on the Apache Software Foundation, please see <http://www.apache.org/>.   *
   *                                                                           *
   * ========================================================================= */
  package org.apache.catalina.connector.warp;
  
  import java.io.IOException;
  import org.apache.catalina.core.StandardHost;
  
  /**
   *
   *
   * @author <a href="mailto:pier.fumagalli@eng.sun.com">Pier Fumagalli</a>
   * @author Copyright &copy; 1999, 2000 <a href="http://www.apache.org">The
   *         Apache Software Foundation.
   * @version CVS $Id: WarpHost.java,v 1.1 2000/12/07 21:12:56 pier Exp $
   */
  public class WarpHost extends StandardHost {
  
      // -------------------------------------------------------------- CONSTANTS
  
      /** Our debug flag status (Used to compile out debugging information). */
      private static final boolean DEBUG=WarpDebug.DEBUG;
  
      // -------------------------------------------------------- LOCAL VARIABLES
  
      /** The Warp Host ID of this Host. */
      private int id=-1;
  
      // ----------------------------------------------------------- BEAN METHODS
  
      /**
       * Return the Host ID associated with this WarpHost instance.
       */
      protected int getHostID() {
          return(this.id);
      }
  
      /**
       * Set the Host ID associated with this WarpHost instance.
       */
      protected void setHostID(int id) {
          if (DEBUG) this.debug("Setting HostID for "+super.getName()+" to "+id);
          this.id=id;
      }
  
      // ------------------------------------------------------ DEBUGGING METHODS
  
      /**
       * Dump a debug message.
       */
      private void debug(String msg) {
          if (DEBUG) WarpDebug.debug(this,msg);
      }
  
      /**
       * Dump information for an Exception.
       */
      private void debug(Exception exc) {
          if (DEBUG) WarpDebug.debug(this,exc);
      }
  }
  
  
  

Mime
View raw message