    All Packages  Class Hierarchy  This Package  Previous  Next  Index

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

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

public class ICPFilter
extends Object
implements PropRequestFilter, PropertyMonitoring

##

CONFIG_P
  Properties - Our configuration file.
debug
  Our we in debug mode ?
DEBUG_P
  Properties - Our debug flag.
DISABLE_CACHE_P
  Properties - disable caching when fetching from a neighbour proxy.
disableCache
  Should we disablecaching when fetching through a proxy ?
friends
  Our senders, indexed by InetAddress.
icp
  Our ICP engine.
PORT_P
  Properties - Our own UDP port number.
props
  The properties we are initialized from.
TIMEOUT_P
  Properties - Our default timeout value.
timeoutValue
  Our default timeout value for waiting for replies (in ms).

##

ICPFilter()

##

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

##

DEBUG_P

     public static final String DEBUG_P

  Properties - Our debug flag.

CONFIG_P

     public static final String CONFIG_P

  Properties - Our configuration file.

PORT_P

     public static final String PORT_P

  Properties - Our own UDP port number.

TIMEOUT_P

     public static final String TIMEOUT_P

  Properties - Our default timeout value.

DISABLE_CACHE_P

     public static final String DISABLE_CACHE_P

  Properties - disable caching when fetching from a neighbour proxy.

props

     protected ObservableProperties props

  The properties we are initialized from.

icp

     protected ICPReceiver icp

  Our ICP engine.

friends

     protected Hashtable friends

  Our senders, indexed by InetAddress.

timeoutValue

     protected long timeoutValue

  Our default timeout value for waiting for replies (in ms).

debug

     protected boolean debug

  Our we in debug mode ?

disableCache

     protected boolean disableCache

  Should we disablecaching when fetching through a proxy ?

##

ICPFilter

     public ICPFilter()

##

propertyChanged

     public boolean propertyChanged(String name)

getSocket

     protected DatagramSocket getSocket()

createICPSender

     protected void createICPSender(String host,
                                    int dstport,
                                    String http) throws UnknownHostException, MalformedURLException, SocketException

parseConfiguration

     protected void parseConfiguration()

  Parse the configuration file.

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.

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.

sendQuery

     protected int sendQuery(ICPQuery query)

  Send the given query to all our neighbors.

  Returns:
    The number of times we emitted the query.

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.

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.

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.

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.

sync

     public void sync()

  This filter doesn't maintain dynamic state.

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: PropRequestFilterException
    If the filter cannot launch its server part (listening for incomming ICP requests)

    All Packages  Class Hierarchy  This Package  Previous  Next  Index