costin      01/12/31 11:03:53

  Added:       jk/java/org/apache/jk/core Channel.java Endpoint.java
                        Handler.java Msg.java Webapp.java Worker.java
                        WorkerEnv.java package.html
  Log:
  The 'interafaces', coresponding to jk2/include ( on the C side ).
  
  I tried to keep everything as simple as possible, most are abstract
  classes. In common we'll have the different implementations.
  
  Revision  Changes    Path
  1.1                  
jakarta-tomcat-connectors/jk/java/org/apache/jk/core/Channel.java
  
  Index: Channel.java
  ===================================================================
  /*
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    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 [EMAIL PROTECTED]
   *
   * 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 Group.
   *
   * 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
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * [Additional notices, if required by prior licensing conditions]
   *
   */
  package org.apache.jk.core;
  
  import java.io.IOException;
  import java.io.UnsupportedEncodingException;
  import java.io.InputStream;
  import java.io.OutputStream;
  import java.net.Socket;
  import java.util.Enumeration;
  import java.security.*;
  
  import org.apache.tomcat.util.http.MimeHeaders;
  import org.apache.tomcat.util.buf.MessageBytes;
  import org.apache.tomcat.util.http.HttpMessages;
  import org.apache.tomcat.util.buf.HexUtils;
  
  
  /**
   * A communication channel - socket, pipes, doors, jni, etc.
   *
   * @author Henri Gomez [[EMAIL PROTECTED]]
   * @author Dan Milstein [[EMAIL PROTECTED]]
   * @author Keith Wannamaker [[EMAIL PROTECTED]]
   * @author Kevin Seguin
   * @author Costin Manolache
   */
  public abstract class Channel {
      protected WorkerEnv we;
  
      public void setWorkerEnv( WorkerEnv we ) {
          this.we=we;
      }
      
      public void init() throws IOException {
      }
              
      
      public void write( Endpoint ep, byte[] b, int offset, int len) throws 
IOException {
      }
  
      public int read( Endpoint ep, byte[] b, int offset, int len) throws IOException {
          return -1;
      }
  }
  
  
  
  1.1                  
jakarta-tomcat-connectors/jk/java/org/apache/jk/core/Endpoint.java
  
  Index: Endpoint.java
  ===================================================================
  /*
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    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 [EMAIL PROTECTED]
   *
   * 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 Group.
   *
   * 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
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * [Additional notices, if required by prior licensing conditions]
   *
   */
  package org.apache.jk.core;
  
  import java.io.IOException;
  import java.io.UnsupportedEncodingException;
  import java.io.InputStream;
  import java.io.OutputStream;
  import java.net.Socket;
  import java.util.Enumeration;
  import java.security.*;
  
  import org.apache.tomcat.util.http.MimeHeaders;
  import org.apache.tomcat.util.buf.MessageBytes;
  import org.apache.tomcat.util.http.HttpMessages;
  import org.apache.tomcat.util.buf.HexUtils;
  
  
  /**
   * The endpoint represents a connection instance, used to send/receive messages.
   *
   * @author Henri Gomez [[EMAIL PROTECTED]]
   * @author Dan Milstein [[EMAIL PROTECTED]]
   * @author Keith Wannamaker [[EMAIL PROTECTED]]
   * @author Kevin Seguin
   * @author Costin Manolache
   */
  public class Endpoint {
      private Object notes[]=new Object[8];
  
      public final Object getNote( int id ) {
          return notes[id];
      }
  
      public final void setNote( int id, Object o ) {
          notes[id]=o;
      }
      
  }
  
  
  
  1.1                  
jakarta-tomcat-connectors/jk/java/org/apache/jk/core/Handler.java
  
  Index: Handler.java
  ===================================================================
  /*
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    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 [EMAIL PROTECTED]
   *
   * 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 Group.
   *
   * 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
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * [Additional notices, if required by prior licensing conditions]
   *
   */
  package org.apache.jk.core;
  
  import java.io.*;
  import java.util.*;
  import java.security.*;
  
  /**
   *
   * @author Costin Manolache
   */
  public class Handler {
      public static final int OK=0;
      public static final int LAST=1;
      public static final int ERROR=2;
      
      
      public void init( WorkerEnv we ) {
      }
  
      public int callback(int type, Channel ch, Endpoint ep, Msg in) throws 
IOException { 
          return OK;
      }
      
  }
  
  
  
  1.1                  jakarta-tomcat-connectors/jk/java/org/apache/jk/core/Msg.java
  
  Index: Msg.java
  ===================================================================
  /*
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    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 [EMAIL PROTECTED]
   *
   * 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 Group.
   *
   * 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
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * [Additional notices, if required by prior licensing conditions]
   *
   */
  package org.apache.jk.core;
  
  import java.io.IOException;
  import java.io.UnsupportedEncodingException;
  import java.io.InputStream;
  import java.io.OutputStream;
  import java.net.Socket;
  import java.util.Enumeration;
  import java.security.*;
  
  import org.apache.tomcat.util.http.MimeHeaders;
  import org.apache.tomcat.util.buf.MessageBytes;
  import org.apache.tomcat.util.http.HttpMessages;
  import org.apache.tomcat.util.buf.HexUtils;
  
  
  /**
   * A single packet for communication between the web server and the
   * container.
   *
   * @author Henri Gomez [[EMAIL PROTECTED]]
   * @author Dan Milstein [[EMAIL PROTECTED]]
   * @author Keith Wannamaker [[EMAIL PROTECTED]]
   * @author Kevin Seguin
   * @author Costin Manolache
   */
  public abstract class Msg {
  
      /**
       * Prepare this packet for accumulating a message from the container to
       * the web server.  Set the write position to just after the header
       * (but leave the length unwritten, because it is as yet unknown).
       */
      public abstract void reset();
  
      /**
       * For a packet to be sent to the web server, finish the process of
       * accumulating data and write the length of the data payload into
       * the header.  
       */
      public abstract void end();
  
      public abstract  void appendInt( int val );
  
      public abstract void appendByte( int val );
        
      public abstract void appendLongInt( int val );
  
      /**
       * Write a String out at the current write position.  Strings are
       * encoded with the length in two bytes first, then the string, and
       * then a terminating \0 (which is <B>not</B> included in the
       * encoded length).  The terminator is for the convenience of the C
       * code, where it saves a round of copying.  A null string is
       * encoded as a string with length 0.  
       */
      public abstract void appendBytes(MessageBytes mb) throws IOException;
  
      /** 
       * Copy a chunk of bytes into the packet, starting at the current
       * write position.  The chunk of bytes is encoded with the length
       * in two bytes first, then the data itself, and finally a
       * terminating \0 (which is <B>not</B> included in the encoded
       * length).
       *
       * @param b The array from which to copy bytes.
       * @param off The offset into the array at which to start copying
       * @param len The number of bytes to copy.  
       */
      public abstract void appendBytes( byte b[], int off, int numBytes );
  
      /**
       * Read an integer from packet, and advance the read position past
       * it.  Integers are encoded as two unsigned bytes with the
       * high-order byte first, and, as far as I can tell, in
       * little-endian order within each byte.  
       */
      public abstract int getInt();
  
      public abstract int peekInt();
  
      public abstract byte getByte();
  
      public abstract void getBytes(MessageBytes mb);
      
      /**
       * Copy a chunk of bytes from the packet into an array and advance
       * the read position past the chunk.  See appendBytes() for details
       * on the encoding.
       *
       * @return The number of bytes copied.
       */
      public abstract int getBytes(byte dest[]);
  
      /**
       * Read a 32 bits integer from packet, and advance the read position past
       * it.  Integers are encoded as four unsigned bytes with the
       * high-order byte first, and, as far as I can tell, in
       * little-endian order within each byte.
       */
      public abstract int getLongInt();
  
      /**
       * Send a packet to the web server.  Works for any type of message.
       *
       * @param msg A packet with accumulated data to send to the server --
       * this method will write out the length in the header.  
       */
      public abstract void send(Channel ch, Endpoint ep) throws IOException;
  
      public abstract int receive(Channel ch, Endpoint ep) throws IOException;
  
      
      public abstract void dump(String msg);
      
  }
  
  
  
  1.1                  jakarta-tomcat-connectors/jk/java/org/apache/jk/core/Webapp.java
  
  Index: Webapp.java
  ===================================================================
  /*
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    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 [EMAIL PROTECTED]
   *
   * 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 Group.
   *
   * 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
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * [Additional notices, if required by prior licensing conditions]
   *
   */
  package org.apache.jk.core;
  
  import java.io.*;
  import java.net.*;
  import java.util.*;
  import java.security.*;
  
  
  /**
   * The webapp represents a web application ( Context ) and all the
   * properties we care about.
   *
   * jk_webapp_t on the C side.
   *
   * @author Gal Shachor
   * @author Henri Gomez [[EMAIL PROTECTED]]
   * @author Dan Milstein [[EMAIL PROTECTED]]
   * @author Keith Wannamaker [[EMAIL PROTECTED]]
   * @author Kevin Seguin
   * @author Costin Manolache
   */
  public class Webapp {
  
      WorkerEnv workerEnv;
      Hashtable properties;
  
      /* Virtual host where it belongs */
      String virtual;
      int virtualPort;
  
      String virtualAliases[];
  
      /* Context path where it's mounted */
      String context;
      /* Id for fast access */
      int contextId;
  
      String docbase;
  
      int status;
  
      int logLevel;
  
      /* Server env variables we want to receive
       */
      String envvars[];
  
      public void setProperty( String name, String v) {
  
      }
  
      public String getProperty( String name ) {
          return null;
      }
  
      
  }
  
  
  
  1.1                  jakarta-tomcat-connectors/jk/java/org/apache/jk/core/Worker.java
  
  Index: Worker.java
  ===================================================================
  /*
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    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 [EMAIL PROTECTED]
   *
   * 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 Group.
   *
   * 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
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * [Additional notices, if required by prior licensing conditions]
   *
   */
  package org.apache.jk.core;
  
  import java.io.*;
  import java.net.*;
  import java.util.*;
  
  import org.apache.jk.core.*;
  
  import org.apache.tomcat.util.net.*;
  import org.apache.tomcat.util.buf.*;
  import org.apache.tomcat.util.log.*;
  import org.apache.tomcat.util.http.*;
  import org.apache.tomcat.util.threads.*;
  
  /**
   *
   */
  public class Worker
  {
      protected WorkerEnv we;
      
      public Worker()
      {
      }
  
      public void setWorkerEnv( WorkerEnv we ) {
          this.we=we;
      }
  
      public WorkerEnv getWorkerEnv() {
          return we;
      }
      
      /* ==================== Start/stop ==================== */
  
      /** Configuration. We'll extract and check the settings.
       *  XXX We should be able to get info from the same
       *  properties file as the C side, so port, etc could be
       *  configured in only one place
       */
      public void validate(  Properties p ) 
      {
      }
      
      /** Initialize the worker. After this call the worker will be
       *  ready to accept new requests.
       */
      public void init(WorkerEnv we) throws IOException {
          // Run a thread that will accept connections.
          
          
      }
  
      /** Clean up and stop the worker
       */
      public void destroy() throws IOException {
      }
  
      public void service( BaseRequest req, Channel ch, Endpoint ep )
          throws IOException
      {
      }
  
  }
  
  
  
  1.1                  
jakarta-tomcat-connectors/jk/java/org/apache/jk/core/WorkerEnv.java
  
  Index: WorkerEnv.java
  ===================================================================
  /*
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    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 [EMAIL PROTECTED]
   *
   * 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 Group.
   *
   * 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
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * [Additional notices, if required by prior licensing conditions]
   *
   */
  package org.apache.jk.core;
  
  import java.io.*;
  import java.util.*;
  import java.security.*;
  
  import org.apache.jk.common.*;
  
  /**
   * The controller object. It manages all other jk objects, acting as the root of
   * the jk object model.
   *
   * @author Gal Shachor
   * @author Henri Gomez [[EMAIL PROTECTED]]
   * @author Dan Milstein [[EMAIL PROTECTED]]
   * @author Keith Wannamaker [[EMAIL PROTECTED]]
   * @author Kevin Seguin
   * @author Costin Manolache
   */
  public class WorkerEnv {
  
      Hashtable properties;
  
      Webapp webapps[]=new Webapp[20];
      int webappCnt=0;
  
      public static final int ENDPOINT_NOTE=0;
      int noteId[]=new int[4];
      String noteName[][]=new String[4][];
  
      static final int MAX_HANDLERS=32;
      static final int RESERVED=16;  // reserved names, backward compat
  
      // Note that we don't make distinction between in and out
      // messages ( i.e. one id is used only in one direction )
      Handler handlers[]=new Handler[MAX_HANDLERS];
      String handlerNames[]=new String[MAX_HANDLERS];
      int currentId=RESERVED;
  
      Vector workers=new Vector();
      Vector channels=new Vector();
  
      public WorkerEnv() {
          for( int i=0; i<noteId.length; i++ ) {
              noteId[i]=7;
              noteName[i]=new String[20];
          }
      }
      
      public int addWebapp( Webapp wa ) {
          if( webappCnt >= webapps.length ) {
              Webapp newWebapps[]=new Webapp[ webapps.length + 20 ];
              System.arraycopy( webapps, 0, newWebapps, 0, webapps.length);
              webapps=newWebapps;
          }
          webapps[webappCnt]=wa;
          return webappCnt++;
      }
  
      public Webapp getWebapp( int i ) {
          return webapps[i];
      }
  
      public int getWebappCount() {
          return webappCnt;
      }
  
      public void addHandler( Handler h ) {
          h.init( this );
      }
  
      public int getNoteId( int type, String name ) {
          int id=noteId[type]++;
          noteName[type][id]=name;
          return id;
      }
  
      public int registerMessageType( int id, String name, Handler h,
                                    String sig[] )
      {
        if( id < 0 ) {
            // try to find it by name
            for( int i=0; i< handlerNames.length; i++ )
                if( name.equals( handlerNames[i] ) ) return i;
            handlerNames[currentId]=name;
            handlers[currentId]=h;
            currentId++;
            return currentId;
        }
        // fixed id
        handlerNames[id]=name;
        handlers[id]=h;
        return id;
      }
  
      public int processCallbacks( Channel ch, Endpoint ep, Msg hBuf )
          throws IOException
      {
          int type=hBuf.getByte();
          
          if( type > handlers.length ||
              handlers[type]==null ) {
            d( "Invalid handler " + type );
            return 500;
        }
  
          if( dL > 0 )
              d( "Received " + type + " " + handlerNames[type]);
          
        Handler handler=handlers[type];
  
          return handler.callback( type, ch, ep, hBuf );
      }
  
      public void addWorker( Worker w ) {
          w.setWorkerEnv( this );
          workers.addElement( w );
      }
  
      public void addChannel( Channel c ) {
          c.setWorkerEnv( this );
          channels.addElement( c );
      }
  
      public void start() throws IOException {
  
          for( int i=0; i< workers.size(); i++ ) {
              Worker w=(Worker)workers.elementAt(i);
              w.init(this);
          }
  
          for( int i=0; i< channels.size(); i++ ) {
              Channel ch=(Channel)channels.elementAt(i);
              ch.init();
          }
      }
      
  
      private static final int dL=10;
      private static void d(String s ) {
          System.err.println( "WorkerEnv: " + s );
      }
  
      
  }
  
  
  
  1.1                  
jakarta-tomcat-connectors/jk/java/org/apache/jk/core/package.html
  
  Index: package.html
  ===================================================================
  <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  <html>
  <head>
    <title></title>
  </head>
  <body>
  <h2>Jk2 interfaces</h2>
  <p>Core interfaces for jk2, similar with the interfaces defined in the C
  side ( jk2/include ).<br>
  </p>
  <p>The implementations are in common/ and server/.<br>
  </p>
  <p><br>
  </p>
  </body>
  </html>
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to