Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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

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

All Implemented Interfaces:
  PropertyMonitoring, PropRequestFilter, RequestFilter

public class ICPFilter
extends java.lang.Object
implements PropRequestFilter, PropertyMonitoring

Field Summary
`static java.lang.String` | `CONFIG_P` Properties - Our configuration file.
`protected boolean` | `debug` Our we in debug mode ?
`static java.lang.String` | `DEBUG_P` Properties - Our debug flag.
`static java.lang.String` | `DISABLE_CACHE_P` Properties - disable caching when fetching from a neighbour proxy.
`protected boolean` | `disableCache` Should we disablecaching when fetching through a proxy ?
`protected java.util.Hashtable` | `friends` Our senders, indexed by InetAddress.
`protected org.w3c.www.protocol.http.icp.ICPReceiver` | `icp` Our ICP engine.
`static java.lang.String` | `PORT_P` Properties - Our own UDP port number.
`protected ObservableProperties` | `props` The properties we are initialized from.
`static java.lang.String` | `TIMEOUT_P` Properties - Our default timeout value.
`protected long` | `timeoutValue` Our default timeout value for waiting for replies (in ms).

Constructor Summary
`ICPFilter()`

Method Summary
`protected void` | `createICPSender(java.lang.String host, int dstport, java.lang.String http)`
`boolean` | `exceptionFilter(Request request, HttpException ex)` This filter doesn't handle exceptions.
`org.w3c.www.protocol.http.icp.ICPSender` | `getSender(java.net.InetAddress addr, int port)` Get the sender object for the given InetAddress instance.
`protected java.net.DatagramSocket` | `getSocket()`
`Reply` | `ingoingFilter(Request request)` Our ingoingFilter method.
`void` | `initialize(HttpManager manager)` Initialize the ICP filter.
`protected java.net.URL` | `locateProxy(org.w3c.www.protocol.http.icp.ICPReply reply)` Locate the HTTP service of the proxy that has emitted that reply.
`Reply` | `outgoingFilter(Request request, Reply reply)` Our outgoingFilter does nothing (at all).
`protected void` | `parseConfiguration()` Parse the configuration file.
`boolean` | `propertyChanged(java.lang.String name)` The callback method, invoked when any property change occurs.
`protected java.net.URL` | `runQuery(org.w3c.www.protocol.http.icp.ICPQuery query)` Run the ICP query, and return the proxy we should go to.
`protected int` | `sendQuery(org.w3c.www.protocol.http.icp.ICPQuery query)` Send the given query to all our neighbors.
`void` | `sync()` This filter doesn't maintain dynamic state.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### DEBUG_P

    public static final java.lang.String DEBUG_P

  Properties - Our debug flag.

  See Also:
    Constant Field Values

### CONFIG_P

    public static final java.lang.String CONFIG_P

  Properties - Our configuration file.

  See Also:
    Constant Field Values

### PORT_P

    public static final java.lang.String PORT_P

  Properties - Our own UDP port number.

  See Also:
    Constant Field Values

### TIMEOUT_P

    public static final java.lang.String TIMEOUT_P

  Properties - Our default timeout value.

  See Also:
    Constant Field Values

### DISABLE_CACHE_P

    public static final java.lang.String DISABLE_CACHE_P

  Properties - disable caching when fetching from a neighbour proxy.

  See Also:
    Constant Field Values

### props

    protected ObservableProperties props

  The properties we are initialized from.

### icp

    protected org.w3c.www.protocol.http.icp.ICPReceiver icp

  Our ICP engine.

### friends

    protected java.util.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 ?

Constructor Detail

### ICPFilter

    public ICPFilter()

Method Detail

### propertyChanged

    public boolean propertyChanged(java.lang.String name)

  Description copied from interface: `PropertyMonitoring`
  The callback method, invoked when any property change occurs.

  Specified by:
    `propertyChanged` in interface `PropertyMonitoring`
  Parameters:
    `name` - The name of the property that changed.
  Returns:
    A boolean, if true, accept the new property value, otherwise, reject it and reset the property to its old value.

### getSocket

    protected java.net.DatagramSocket getSocket()

### createICPSender

    protected void createICPSender(java.lang.String host,
                                   int dstport,
                                   java.lang.String http)
                            throws java.net.UnknownHostException,
                                   java.net.MalformedURLException,
                                   java.net.SocketException

    `java.net.UnknownHostException`
    `java.net.MalformedURLException`
    `java.net.SocketException`

### parseConfiguration

    protected void parseConfiguration()

  Parse the configuration file.

### getSender

    public org.w3c.www.protocol.http.icp.ICPSender getSender(java.net.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 java.net.URL locateProxy(org.w3c.www.protocol.http.icp.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(org.w3c.www.protocol.http.icp.ICPQuery query)

  Send the given query to all our neighbors.

  Returns:
    The number of times we emitted the query.

### runQuery

    protected java.net.URL runQuery(org.w3c.www.protocol.http.icp.ICPQuery query)

  Run the ICP query, and return the proxy we should go to.

  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.

  Specified by:
    `exceptionFilter` in interface `RequestFilter`
  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.

  Specified by:
    `ingoingFilter` in interface `RequestFilter`
  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).

  Specified by:
    `outgoingFilter` in interface `RequestFilter`
  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.

  Specified by:
    `sync` in interface `RequestFilter`

### 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.

  Specified by:
    `initialize` in interface `PropRequestFilter`
  Parameters:
    `manager` - The HTTP manager.
  Throws:
    `PropRequestFilterException` - If the filter cannot launch its server part (listening for incomming ICP requests)

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD