xsul.dispatcher.routingtable
Interface RoutingTable

All Known Implementing Classes:
DenRoutingTable, RoutingTableImpl

public interface RoutingTable

The Routing Table interface.

Implements it to create your own Routing Table.

The keys are String which represent the virtual path of the WS. This virtual path must not start with a / but with the first virtual directory.

Author:
Alexandre di Costanzo

Method Summary
 void clear()
          Clears the Routing Table so that it contains no keys.
 boolean contains(java.lang.Object value)
          Tests if some key maps into the specified value in this Routing Table.
 boolean containsKey(java.lang.String key)
          Tests if the specified object is a key in this Routing Table.
 boolean containsKey(java.net.URI key)
          Tests if the specified object is a key in this Routing Table.
 boolean containsValue(java.lang.Object value)
          Returns true if this Routing Table maps one or more keys to this value.
 java.util.Enumeration elements()
          Returns an enumeration of the values in this Routing Table.
 java.lang.Object get(java.lang.String key)
          Returns the value to which the specified key is mapped in this Routing Table.
 java.lang.Object get(java.net.URI Key)
          Returns the value to which the specified key is mapped in this Routing Table.
 java.util.Map getTable()
          Returns the whole routing table.
 boolean isEmpty()
          Tests if this Routing Table maps no keys to values.
 java.util.Enumeration keys()
          Returns an enumeration of the keys in this Routing Table.
 java.lang.Object put(java.lang.String key, java.lang.Object value)
          Maps the specified key to the specified value in this Routing Table.
 java.lang.Object put(java.net.URI key, java.lang.Object value)
          Maps the specified key to the specified value in this Routing Table.
 void putAll(RoutingTable t)
          Copies all of the mappings from the specified Map to this Routing Table These mappings will replace any mappings that this Routing Table had for any of the keys currently in the specified Routing Table.
 java.lang.Object remove(java.lang.String key)
          Removes the key (and its corresponding value) from this Routing Table.
 java.lang.Object remove(java.net.URI key)
          Removes the key (and its corresponding value) from this Routing Table.
 int size()
          Returns the number of keys in this Routing Table.
 java.util.Collection values()
          Returns a Collection view of the values contained in this Routing Table.
 

Method Detail

clear

public void clear()
Clears the Routing Table so that it contains no keys.


contains

public boolean contains(java.lang.Object value)
Tests if some key maps into the specified value in this Routing Table.

Parameters:
value - a value to search for.
Returns:
true if and only if some key maps to the value argument in this Routing Table as determined by the equals method; false otherwise.
Throws:
java.lang.NullPointerException - if the value is null.
See Also:
containsKey(String), containsValue(Object)

containsKey

public boolean containsKey(java.lang.String key)
Tests if the specified object is a key in this Routing Table.

Parameters:
key - possible key.
Returns:
true if and only if the specified object is a key in this Routing Table, as determined by the equals method; false otherwise.
Throws:
java.lang.NullPointerException - if the key is null.
See Also:
contains(Object)

containsKey

public boolean containsKey(java.net.URI key)
Tests if the specified object is a key in this Routing Table.

Parameters:
key - possible key.
Returns:
true if and only if the specified object is a key in this Routing Table, as determined by the equals method; false otherwise.
Throws:
java.lang.NullPointerException - if the key is null.
See Also:
contains(Object)

containsValue

public boolean containsValue(java.lang.Object value)
Returns true if this Routing Table maps one or more keys to this value.

Parameters:
value - value whose presence in this Routing Table is to be tested.
Returns:
true if this Routing Table maps one or more keys to the specified value.
Throws:
java.lang.NullPointerException - if the value is null.

elements

public java.util.Enumeration elements()
Returns an enumeration of the values in this Routing Table. Use the Enumeration methods on the returned object to fetch the elements sequentially.

Returns:
an enumeration of the values in this Routing Table.
See Also:
Enumeration, keys(), values()

get

public java.lang.Object get(java.lang.String key)
Returns the value to which the specified key is mapped in this Routing Table.

Parameters:
key - a key in the Routing Table.
Returns:
the value to which the key is mapped in this Routing Table; null if the key is not mapped to any value in this Routing Table.
Throws:
java.lang.NullPointerException - if the key is null.
See Also:
put(String, Object)

get

public java.lang.Object get(java.net.URI Key)
Returns the value to which the specified key is mapped in this Routing Table.

Returns:
the value to which the key is mapped in this Routing Table; null if the key is not mapped to any value in this Routing Table.
Throws:
java.lang.NullPointerException - if the key is null.
See Also:
put(URI, Object)

isEmpty

public boolean isEmpty()
Tests if this Routing Table maps no keys to values.

Returns:
true if this Routing Table maps no keys to values; false otherwise.

keys

public java.util.Enumeration keys()
Returns an enumeration of the keys in this Routing Table.

Returns:
an enumeration of the keys in this Routing Table.
See Also:
Enumeration, elements()

put

public java.lang.Object put(java.lang.String key,
                            java.lang.Object value)
Maps the specified key to the specified value in this Routing Table. Neither the key nor the value can be null.

The value can be retrieved by calling the get method with a key that is equal to the original key.

Parameters:
key - the Routing Table key.
value - the value.
Returns:
the previous value of the specified key in this Routing Table, or null if it did not have one.
Throws:
java.lang.NullPointerException - if the key or value is null.
See Also:
Object.equals(Object), get(String)

put

public java.lang.Object put(java.net.URI key,
                            java.lang.Object value)
Maps the specified key to the specified value in this Routing Table. Neither the key nor the value can be null.

The value can be retrieved by calling the get method with a key that is equal to the original key.

Parameters:
key - the Routing Table key.
value - the value.
Returns:
the previous value of the specified key in this Routing Table, or null if it did not have one.
Throws:
java.lang.NullPointerException - if the key or value is null.
See Also:
Object.equals(Object), get(URI)

putAll

public void putAll(RoutingTable t)
Copies all of the mappings from the specified Map to this Routing Table These mappings will replace any mappings that this Routing Table had for any of the keys currently in the specified Routing Table.

Parameters:
t - Mappings to be stored in this Routing Table.
Throws:
java.lang.NullPointerException - if the specified Routing Table is null.

remove

public java.lang.Object remove(java.lang.String key)
Removes the key (and its corresponding value) from this Routing Table. This method does nothing if the key is not in the Routing Table.

Parameters:
key - the key that needs to be removed.
Returns:
the value to which the key had been mapped in this routing Table, or null if the key did not have a mapping.
Throws:
java.lang.NullPointerException - if the key is null.

remove

public java.lang.Object remove(java.net.URI key)
Removes the key (and its corresponding value) from this Routing Table. This method does nothing if the key is not in the Routing Table.

Parameters:
key - the key that needs to be removed.
Returns:
the value to which the key had been mapped in this routing Table, or null if the key did not have a mapping.
Throws:
java.lang.NullPointerException - if the key is null.

size

public int size()
Returns the number of keys in this Routing Table.

Returns:
the number of keys in this Routing Table.

values

public java.util.Collection values()
Returns a Collection view of the values contained in this Routing Table. The Collection is backed by the Routing Table, so changes to the Routing Table are reflected in the Collection, and vice-versa. The Collection supports element removal (which removes the corresponding entry from the Routing Table), but not element addition.

Returns:
a collection view of the values contained in this Routing Table.

getTable

public java.util.Map getTable()
Returns the whole routing table.

Returns:
a map view of the whole Routing Table.


IU Extreme! Lab (http://www.extreme.indiana.edu)