Class w3c.www.protocol.http.icp.ICPFilter
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class w3c.www.protocol.http.icp.ICPFilter

java.lang.Object
   |
   +----w3c.www.protocol.http.icp.ICPFilter

public class ICPFilter
extends Object
implements PropRequestFilter, PropertyMonitoring

Variable Index

 o CONFIG_P
Properties - Our configuration file.
 o debug
Our we in debug mode ?
 o DEBUG_P
Properties - Our debug flag.
 o friends
Our senders, indexed by InetAddress.
 o icp
Our ICP engine.
 o PORT_P
Properties - Our own UDP port number.
 o props
The properties we are initialized from.
 o TIMEOUT_P
Properties - Our default timeout value.
 o timeoutValue
Our default timeout value for waiting for replies (in ms).

Constructor Index

 o ICPFilter()

Method Index

 o createICPSender(String, int, String)
 o exceptionFilter(Request, HttpException)
This filter doesn't handle exceptions.
 o getSender(InetAddress, int)
Get the sender object for the given InetAddress instance.
 o getSocket()
 o ingoingFilter(Request)
Our ingoingFilter method.
 o initialize(HttpManager)
Initialize the ICP filter.
 o locateProxy(ICPReply)
Locate the HTTP service of the proxy that has emitted that reply.
 o outgoingFilter(Request, Reply)
Our outgoingFilter does nothing (at all).
 o parseConfiguration()
Parse the configuration file.
 o propertyChanged(String)
 o runQuery(ICPQuery)
Run the ICP query, and return the proxy we should go to.
 o sendQuery(ICPQuery)
Send the given query to all our neighbors.
 o sync()
This filter doesn't maintain dynamic state.

Variables

 o DEBUG_P
  public final static String DEBUG_P
Properties - Our debug flag.
 o CONFIG_P
  public final static String CONFIG_P
Properties - Our configuration file.
 o PORT_P
  public final static String PORT_P
Properties - Our own UDP port number.
 o TIMEOUT_P
  public final static String TIMEOUT_P
Properties - Our default timeout value.
 o props
  protected ObservableProperties props
The properties we are initialized from.
 o icp
  protected ICPReceiver icp
Our ICP engine.
 o friends
  protected Hashtable friends
Our senders, indexed by InetAddress.
 o timeoutValue
  protected long timeoutValue
Our default timeout value for waiting for replies (in ms).
 o debug
  protected boolean debug
Our we in debug mode ?

Constructors

 o ICPFilter
  public ICPFilter()

Methods

 o propertyChanged
  public boolean propertyChanged(String name)
 o getSocket
  protected DatagramSocket getSocket()
 o createICPSender
  protected void createICPSender(String host,
                                 int dstport,
                                 String http) throws UnknownHostException, MalformedURLException, SocketException
 o parseConfiguration
  protected void parseConfiguration()
Parse the configuration file.
 o getSender
  public ICPSender getSender(InetAddress addr,
                             int port)
Get the sender object for the given InetAddress instance.
Parameters:
addr - The InetAddress of the sender.
Returns:
An ICPSender instance, if available, null otherwise.
 o locateProxy
  protected URL locateProxy(ICPReply reply)
Locate the HTTP service of the proxy that has emitted that reply.
Parameters:
reply - The reply emitted by the host that alos host the HTTP service we are looking for.
Returns:
The URL of the proxy, or null if no matching proxy was found.
 o sendQuery
  protected int sendQuery(ICPQuery query)
Send the given query to all our neighbors.
Returns:
The number of times we emitted the query.
 o runQuery
  protected URL runQuery(ICPQuery query)
Run the ICP query, and return the proxy we should go to.
Parameters:
url - The URL we are looking for.
Returns:
The URL of the proxy we should go to for that URL, or null if none was found.
 o exceptionFilter
  public boolean exceptionFilter(Request request,
                                 HttpException ex)
This filter doesn't handle exceptions.
Parameters:
request - The request that triggered the exception.
ex - The triggered exception.
Returns:
Always false.
 o ingoingFilter
  public Reply ingoingFilter(Request request)
Our ingoingFilter method. This method emits (only for GET requestst currently) an ICP query to all our neighbors, and wait for either one of them to reply with a hit, or, our timeout value to expire.

If a hit reply is received, we then use the corresponding proxy to fullfill the request.

Parameters:
request - The request that is about to be emitted.
Returns:
Always null.
 o outgoingFilter
  public Reply outgoingFilter(Request request,
                              Reply reply)
Our outgoingFilter does nothing (at all).
Parameters:
request - The request that has been processed.
reply - The original reply (from origin server)
Returns:
Always null.
 o sync
  public void sync()
This filter doesn't maintain dynamic state.
 o initialize
  public void initialize(HttpManager manager) throws PropRequestFilterException
Initialize the ICP filter. This is where we parse the configuration file in order to know about our neighbors. We then register ourself to the HTTP manager.
Parameters:
manager - The HTTP manager.
Throws: FilterInitException
If the filter cannot launch its server part (listening for incomming ICP requests)

All Packages  Class Hierarchy  This Package  Previous  Next  Index