simple.http
Class FilterPipeline

java.lang.Object
  extended by simple.http.Pipeline
      extended by simple.http.FilterPipeline
All Implemented Interfaces:
Attributes

public class FilterPipeline
extends Pipeline

This is a FilterPipeline object that is used to wrap the Pipeline it is given. This contains methods that act as proxies to the given Pipeline

The FilterPipeline enables the Pipeline to be subclassed easily. Subclasses may want to implement buffering or security features to the Pipeline's that it uses. The PipelineFactory can produce these implementations to be processed with the PipelineHandler.

Author:
Niall Gallagher

Field Summary
protected  Pipeline pipe
          This is the Pipeline that is wrapped.
 
Fields inherited from class simple.http.Pipeline
sock, table
 
Constructor Summary
protected FilterPipeline()
          /** This constructor allows the FilterPipeline to be extended in such a way that it does not do any initialization of the object itself.
  FilterPipeline(Pipeline pipe)
          This wraps the Pipeline given.
 
Method Summary
 void close()
          This is a close method that ensures the communication link is shutdown.
 java.lang.Object get(java.lang.String name)
          The get method is used to retrieve the value mapped to the specified name.
 java.net.InetAddress getInetAddress()
          This corresponds to the identity of the host that created the connection.
 java.io.InputStream getInputStream()
          Retrieves the InputStream.
 java.io.OutputStream getOutputStream()
          Retrieves the OutputStream.
 java.util.Set keySet()
          To ascertain what mappings exist, the names of all values previously put into this attributes can be retrieved with this method.
 void put(java.lang.String name, java.lang.Object value)
          The put method is used to insert a mapping to the attributes that pairs the issued name with the issued value.
 void remove(java.lang.String name)
          The remove method is used to remove the named value from the attributes.
 
Methods inherited from class simple.http.Pipeline
contains
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

pipe

protected Pipeline pipe
This is the Pipeline that is wrapped.

Constructor Detail

FilterPipeline

protected FilterPipeline()
/** This constructor allows the FilterPipeline to be extended in such a way that it does not do any initialization of the object itself. This is used if there is no need for a Socket or Hashtable reference. This is used by the Poller object.


FilterPipeline

public FilterPipeline(Pipeline pipe)
               throws java.io.IOException
This wraps the Pipeline given. This will contain the same Socket object as the Pipeline it is given. Any sub classes of the Pipeline may use this to enable it to attach some extra functionality to the Pipeline like buffering or security.

Parameters:
pipe - the Pipeline that is being wrapped
Throws:
java.io.IOException - if the object could not be created
Method Detail

getInputStream

public java.io.InputStream getInputStream()
                                   throws java.io.IOException
Retrieves the InputStream. This is a communication channel between the client and the server. The stream returned is the same as the Pipeline.getInputStream.

Overrides:
getInputStream in class Pipeline
Returns:
an InputStream from the client, i.e. the Pipeline
Throws:
java.io.IOException - thrown if there is an I/O problem.

getOutputStream

public java.io.OutputStream getOutputStream()
                                     throws java.io.IOException
Retrieves the OutputStream. This is a communication channel from the server to the client. The stream returned is the same as the Pipeline.getOuputStream.

Overrides:
getOutputStream in class Pipeline
Returns:
an OutputStream to the client, i.e. the Pipeline
Throws:
java.io.IOException - thrown if there is an I/O problem

getInetAddress

public java.net.InetAddress getInetAddress()
This corresponds to the identity of the host that created the connection. The domain name can be retrieved from this.

Overrides:
getInetAddress in class Pipeline
Returns:
the identity of the peer that created connection

put

public void put(java.lang.String name,
                java.lang.Object value)
The put method is used to insert a mapping to the attributes that pairs the issued name with the issued value. The value can be referenced in future by its name.

Specified by:
put in interface Attributes
Overrides:
put in class Pipeline
Parameters:
name - this is the name of the value being inserted
value - this is the named value that is inserted

get

public java.lang.Object get(java.lang.String name)
The get method is used to retrieve the value mapped to the specified name. If a value does not exist matching the given name, then this returns null.

Specified by:
get in interface Attributes
Overrides:
get in class Pipeline
Parameters:
name - this is the name of the value to be retrieved
Returns:
returns the value if it exists or null otherwise

remove

public void remove(java.lang.String name)
The remove method is used to remove the named value from the attributes. This method will remove the value or returns silently if the name does not exits.

Specified by:
remove in interface Attributes
Overrides:
remove in class Pipeline
Parameters:
name - this is the name of the value to be removed

keySet

public java.util.Set keySet()
To ascertain what mappings exist, the names of all values previously put into this attributes can be retrieved with this method. This will return a Set that contains the names of all the mappings added to this.

Specified by:
keySet in interface Attributes
Overrides:
keySet in class Pipeline
Returns:
this returns all the keys for existing mappings

close

public void close()
This is a close method that ensures the communication link is shutdown. Closes the InputStream and the OutputStream of the Pipeline. This method will not propagate any exceptions.

Overrides:
close in class Pipeline