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

## org.w3c.www.protocol.http.cache.push
Class Client

    java.lang.Object
      |
      +--org.w3c.www.protocol.http.cache.push.Client

public class Client
extends java.lang.Object

PushCache Client - send messages to push cache server

Field Summary
`static java.lang.String` | `DEFAULT_SERVER` Default hostname - localhost
`static int` | `FAILED` Return/exit values
`static int` | `MAX_TRIES` How many times should we try to reconnect? 10
`static int` | `NO` Return/exit values
`static int` | `OK` Return/exit values
`static java.lang.String` | `VC_ID` Version Control Id
`static java.lang.String` | `VC_REVISION` Version Control Revision

Constructor Summary
`Client()` Construct a Client for the default hostname and port number
`Client(java.lang.String[] argv)` Construct client with command line arguments and execute command.
`Client(java.lang.String hostname, int port)` Construct a Client for the specified hostname and port number

Method Summary
`void` | `add(java.lang.String path, java.lang.String url)` Add file into cache as url
`protected void` | `checkCommand(java.lang.String com)` Throws IllegalArgumentException iff com is not a null terminated string of the correct length
`void` | `clean()` Clean cache - remove all entries
`protected void` | `cleanup()` Cleanup, shutdown and close socket and streams
`protected void` | `connect()` Connect to server - try up to MAX_TRIES times, then give up
`void` | `del(java.lang.String url)` Remove url from cache
`protected void` | `handleArgs(java.lang.String[] argv)` Interpret command line arguments
`boolean` | `isPresent(java.lang.String url)` True iff url is present in cache
`static void` | `main(java.lang.String[] argv)` For use as stand alone program - constructs Client with argv
`void` | `nop()` Send a NOP packet
`protected void` | `readPayload()` Read remaining payload length bytes into buffer
`protected void` | `readReply()` Await reply packet
`void` | `sendBye()` Send a BYE packet, and cleanup
`protected void` | `serverError()` Handle an ERR message from server - cleanup, throw IOException
`void` | `simpleCommand(java.lang.String com)` Send a simple packet with specified command
`protected void` | `unexpectedReply()` Handle an unexpected message from server - send BYE, throw IOException
`void` | `urlCommand(java.lang.String com, java.lang.String url)` Send a packet with specified command and a url
`protected void` | `usage()` Display usage/help message
`protected void` | `version()` Display version information
`protected void` | `writeHeader()` Write header information into packet buffer

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

Field Detail

### OK

    public static final int OK

  Return/exit values

### NO

    public static final int NO

  Return/exit values

### FAILED

    public static final int FAILED

  Return/exit values

### MAX_TRIES

    public static final int MAX_TRIES

  How many times should we try to reconnect? 10

### DEFAULT_SERVER

    public static final java.lang.String DEFAULT_SERVER

  Default hostname - localhost

### VC_REVISION

    public static final java.lang.String VC_REVISION

  Version Control Revision

### VC_ID

    public static final java.lang.String VC_ID

  Version Control Id

Constructor Detail

### Client

    public Client()

  Construct a Client for the default hostname and port number

### Client

    public Client(java.lang.String hostname,
                  int port)

  Construct a Client for the specified hostname and port number

### Client

    public Client(java.lang.String[] argv)
           throws java.io.IOException

  Construct client with command line arguments and execute command. Called by main, for use as stand alone program - calls System.exit at the end of execution

Method Detail

### version

    protected void version()

  Display version information

### usage

    protected void usage()

  Display usage/help message

### handleArgs

    protected void handleArgs(java.lang.String[] argv)
                       throws java.io.IOException

  Interpret command line arguments

### connect

    protected void connect()
                    throws java.net.UnknownHostException,
                           java.io.IOException

  Connect to server - try up to MAX_TRIES times, then give up

### writeHeader

    protected void writeHeader()
                        throws java.io.IOException

  Write header information into packet buffer

### readPayload

    protected void readPayload()
                        throws java.io.IOException

  Read remaining payload length bytes into buffer

### readReply

    protected void readReply()
                      throws java.io.IOException

  Await reply packet

### serverError

    protected void serverError()
                        throws java.io.IOException

  Handle an ERR message from server - cleanup, throw IOException

### unexpectedReply

    protected void unexpectedReply()
                            throws java.io.IOException

  Handle an unexpected message from server - send BYE, throw IOException

### cleanup

    protected void cleanup()

  Cleanup, shutdown and close socket and streams

### sendBye

    public void sendBye()
                 throws java.io.IOException

  Send a BYE packet, and cleanup

### add

    public void add(java.lang.String path,
                    java.lang.String url)
             throws java.io.IOException,
                    java.lang.IllegalArgumentException

  Add file into cache as url

### checkCommand

    protected void checkCommand(java.lang.String com)
                         throws java.lang.IllegalArgumentException

  Throws IllegalArgumentException iff com is not a null terminated string of the correct length

### urlCommand

    public void urlCommand(java.lang.String com,
                           java.lang.String url)
                    throws java.io.IOException,
                           java.lang.IllegalArgumentException

  Send a packet with specified command and a url

### del

    public void del(java.lang.String url)
             throws java.io.IOException

  Remove url from cache

### isPresent

    public boolean isPresent(java.lang.String url)
                      throws java.io.IOException

  True iff url is present in cache

### simpleCommand

    public void simpleCommand(java.lang.String com)
                       throws java.io.IOException

  Send a simple packet with specified command

### nop

    public void nop()
             throws java.io.IOException

  Send a NOP packet

### clean

    public void clean()
               throws java.io.IOException

  Clean cache - remove all entries

### main

    public static void main(java.lang.String[] argv)

  For use as stand alone program - constructs Client with argv

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