solar.service.directory
Class FlatDirectory

java.lang.Object
  |
  +--solar.service.directory.FlatDirectory
All Implemented Interfaces:
Directory

public class FlatDirectory
extends java.lang.Object
implements Directory

A flat directory is a hashtable with name strands as the keys. TODO: name expiration

Version:
$Id: FlatDirectory.java,v 1.5 2003/09/25 21:37:38 glchen Exp $
Author:
Guanling Chen

Nested Class Summary
(package private)  class FlatDirectory.NameInfo
           
 
Field Summary
protected  java.util.Hashtable _directory
           
 
Constructor Summary
FlatDirectory()
          Constructs an empty flat name space.
 
Method Summary
 void addListener(Name pattern, DirectoryListener listener)
          Add a directory observer for the specified pattern.
 NameRecord advertise(Name name, NameRecord rec)
          Advertise a name to the name space.
private  java.util.List getAttributes(NameNode node)
           
 java.util.List lookup(Name pattern)
          Return a list of advertisement whose name matches the pattern.
private  Name mergeStrands(java.util.Set strands)
           
 void removeListener(Name pattern, DirectoryListener listener)
          Remove a directory observer for the specified pattern.
 NameRecord unadvertise(Name name, NameRecord rec)
          Unadvertise a name from the name space.
 NameRecord update(Name oldname, NameRecord oldrec, Name newname, NameRecord newrec)
          Update a name advertisement in the name space.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_directory

protected java.util.Hashtable _directory
Constructor Detail

FlatDirectory

public FlatDirectory()
Constructs an empty flat name space.

Method Detail

addListener

public void addListener(Name pattern,
                        DirectoryListener listener)
Description copied from interface: Directory
Add a directory observer for the specified pattern.

Specified by:
addListener in interface Directory

removeListener

public void removeListener(Name pattern,
                           DirectoryListener listener)
Description copied from interface: Directory
Remove a directory observer for the specified pattern.

Specified by:
removeListener in interface Directory

lookup

public java.util.List lookup(Name pattern)
Description copied from interface: Directory
Return a list of advertisement whose name matches the pattern.

Specified by:
lookup in interface Directory

mergeStrands

private Name mergeStrands(java.util.Set strands)

getAttributes

private java.util.List getAttributes(NameNode node)

advertise

public NameRecord advertise(Name name,
                            NameRecord rec)
Description copied from interface: Directory
Advertise a name to the name space.

Specified by:
advertise in interface Directory
Returns:
previous record if there is any.

unadvertise

public NameRecord unadvertise(Name name,
                              NameRecord rec)
Description copied from interface: Directory
Unadvertise a name from the name space.

Specified by:
unadvertise in interface Directory
Returns:
previous record if there is any.

update

public NameRecord update(Name oldname,
                         NameRecord oldrec,
                         Name newname,
                         NameRecord newrec)
Description copied from interface: Directory
Update a name advertisement in the name space.

Specified by:
update in interface Directory
Returns:
previous record if there is any.