All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class AcmeNet.Assn4.Naming

AcmeNet.Assn4.Naming

public class Naming
This class provides a handy way for clients of distributed AcmeNet name services to access the name space. For example, it allows clients to use Unix-style pathnames like "/cs461/echo/swedish_chef"; this class parses pathnames into their components and does the necessary string of lookups to traverse the name hierarchy.

See Also:
NameService

Constructor Index

 o Naming(String, long)
Create a new Naming object that uses a newly created NetworkInterface.
 o Naming(String, long, ClientServerNI)
Create a new Naming object that uses an existing network interface.

Method Index

 o bind(String, ServiceAddress)
Bind a service to a name in the AcmeNet name space.
 o connectTo(String)
Connect to the service that is bound to a specified pathname in the AcmeNet name space.
 o listDirectory(String)
List all of the names bound in an AcmeNet "directory".
 o unbind(String)
Unbind a name in the AcmeNet name space.

Constructors

 o Naming
 public Naming(String username,
               long userkey)
Create a new Naming object that uses a newly created NetworkInterface.

Parameters:
username - the user-ID under which the object should run
userkey - the secret key of the user-ID under which the object should run
 o Naming
 public Naming(String username,
               long userkey,
               ClientServerNI ni)
Create a new Naming object that uses an existing network interface.

Parameters:
username - the user-ID under which the object should run
userkey - the secret key of the user-ID under which the object should run
ni - the network interface the object should use

Methods

 o bind
 public boolean bind(String pathname,
                     ServiceAddress servAddr) throws IOException
Bind a service to a name in the AcmeNet name space.

Parameters:
pathname - the pathname at which the service should be bound
servAddr - the address of the service to bind to pathname
Returns:
true if the operation succeeded; false otherwise
Throws: IOException
some I/O error occurred
 o unbind
 public boolean unbind(String pathname) throws IOException
Unbind a name in the AcmeNet name space.

Parameters:
pathname - the pathname to unbind
Returns:
true if the operation succeeded; false otherwise
Throws: IOException
some I/O error occurred
 o listDirectory
 public Enumeration listDirectory(String pathname) throws IOException
List all of the names bound in an AcmeNet "directory".

Parameters:
pathname - the pathname of the directory to list
Returns:
a java.util.Enumeration of all of the names bound in the directory, or null if the operation failed
Throws: IOException
some I/O error occurred
 o connectTo
 public Connection connectTo(String pathname) throws IOException
Connect to the service that is bound to a specified pathname in the AcmeNet name space.

Parameters:
pathname - the pathname of the service to connect to
Returns:
a connection to the service, or null if the operation failed
Throws: IOException
some I/O error occurred

All Packages  Class Hierarchy  This Package  Previous  Next  Index