org.apache.catalina.connector.warp
Class WarpConnection

java.lang.Object
  |
  +--org.apache.catalina.connector.warp.WarpConnection
All Implemented Interfaces:
Lifecycle, java.lang.Runnable

public class WarpConnection
extends java.lang.Object
implements Lifecycle, java.lang.Runnable

Version:
CVS $Id: WarpConnection.java,v 1.7 2001/01/24 23:10:42 pier Exp $
Author:
Pier Fumagalli, Copyright © 1999, 2000 The Apache Software Foundation.

Fields inherited from interface org.apache.catalina.Lifecycle
START_EVENT, STOP_EVENT
 
Constructor Summary
WarpConnection()
          Create a new WarpConnection instance.
 
Method Summary
 void addLifecycleListener(LifecycleListener listener)
          Add a lifecycle event listener to this component.
protected  WarpConnector getConnector()
          Return the socket associated with this connection.
protected  java.net.Socket getSocket()
          Return the socket associated with this connection.
 void log(java.lang.Exception exc)
          Dump information for an Exception.
 void log(java.lang.String msg)
          Dump a log message.
protected  boolean registerHandler(WarpHandler han, int rid)
          Add a WarpHandler to this connection.
protected  WarpHandler removeHandler(int rid)
          Remove a WarpHandler from this connection.
 void removeLifecycleListener(LifecycleListener listener)
          Remove a lifecycle event listener from this component.
 void run()
          Run the thread waiting on the socket, reading packets from the client and dispatching them to the appropriate handler.
 void send(int rid, int type, byte[] buffer, int offset, int len)
          Send a WARP packet.
protected  void setConnector(WarpConnector connector)
          Set the socket used by this connection.
protected  void setSocket(java.net.Socket socket)
          Set the socket used by this connection.
 void start()
          Initialize this connection.
 void stop()
          Close this connection.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WarpConnection

public WarpConnection()
Create a new WarpConnection instance.
Method Detail

run

public void run()
Run the thread waiting on the socket, reading packets from the client and dispatching them to the appropriate handler.
Specified by:
run in interface java.lang.Runnable

start

public void start()
           throws LifecycleException
Initialize this connection.
Specified by:
start in interface Lifecycle
Parameters:
sock - The socket used by this connection to transfer data.

send

public void send(int rid,
                 int type,
                 byte[] buffer,
                 int offset,
                 int len)
          throws java.io.IOException
Send a WARP packet.

stop

public void stop()
          throws LifecycleException
Close this connection.
Specified by:
stop in interface Lifecycle
Following copied from interface: org.apache.catalina.Lifecycle
Throws:
IllegalStateException - if this component has not been started
LifecycleException - if this component detects a fatal error that needs to be reported

registerHandler

protected boolean registerHandler(WarpHandler han,
                                  int rid)
Add a WarpHandler to this connection.
Parameters:
han - The WarpHandler add to this connection.
rid - The RID number associated with the WarpHandler.
Returns:
If another WarpHandler is associated with this RID return false, otherwise return true.

removeHandler

protected WarpHandler removeHandler(int rid)
Remove a WarpHandler from this connection.
Parameters:
rid - The RID number associated with the WarpHandler to remove.
Returns:
The old WarpHandler associated with the specified RID or null.

getConnector

protected WarpConnector getConnector()
Return the socket associated with this connection.

setConnector

protected void setConnector(WarpConnector connector)
Set the socket used by this connection.

getSocket

protected java.net.Socket getSocket()
Return the socket associated with this connection.

setSocket

protected void setSocket(java.net.Socket socket)
Set the socket used by this connection.

addLifecycleListener

public void addLifecycleListener(LifecycleListener listener)
Add a lifecycle event listener to this component.
Specified by:
addLifecycleListener in interface Lifecycle
Following copied from interface: org.apache.catalina.Lifecycle
Parameters:
listener - The listener to add

removeLifecycleListener

public void removeLifecycleListener(LifecycleListener listener)
Remove a lifecycle event listener from this component.
Specified by:
removeLifecycleListener in interface Lifecycle
Following copied from interface: org.apache.catalina.Lifecycle
Parameters:
listener - The listener to remove

log

public void log(java.lang.String msg)
Dump a log message.

log

public void log(java.lang.Exception exc)
Dump information for an Exception.


Copyright ? 2000 Apache Software Foundation. All Rights Reserved.