edu.brandeis.cs.steele.wn
Class RemoteFileManager

java.lang.Object
  extended by edu.brandeis.cs.steele.wn.FileManager
      extended by edu.brandeis.cs.steele.wn.RemoteFileManager
All Implemented Interfaces:
FileManagerInterface, java.rmi.Remote

public class RemoteFileManager
extends FileManager
implements java.rmi.Remote

An object of this class can serve as a file manager for remote FileBackedDictionary instantiations, using RMI. This class also contains utility routines to publish a RemoteFileManager for remote use, and to lookup a remote one for local use.

To make a RemoteFileManager available to remote clients:

   System.setSecurityManager(new RMISecurityManager());
   LocateRegistry.createRegistry(Registry.REGISTRY_PORT);
   new RemoteFileManager().bind();
 

To create a local DictionaryDatabase backed by a remote RemoteFileManager:

   DictionaryDatabase dictionary = new FileBackedDictionary(RemoteFileManager.lookup(hostname));
 

Author:
Oliver Steele, steele@cs.brandeis.edu
Copyright 1998 Oliver Steele, see http://www.cs.brandeis.edu/~steele/WNJ/license.html.

Nested Class Summary
 
Nested classes/interfaces inherited from class edu.brandeis.cs.steele.wn.FileManager
FileManager.NextLineCache
 
Field Summary
static java.lang.String BINDING_NAME
          The standard RMI binding name.
 
Fields inherited from class edu.brandeis.cs.steele.wn.FileManager
filenameCache, fileSeparator, IS_MAC_OS, IS_MW_VM, IS_WINDOWS_OS, nextLineCache, searchDirectory, TRACE_LOOKUP, VERSION
 
Constructor Summary
RemoteFileManager()
          Construct a file manager backed by a set of files contained in the default WN search directory.
RemoteFileManager(java.lang.String searchDirectory)
          Construct a file manager backed by a set of files contained in searchDirectory.
 
Method Summary
 void bind()
          Bind this object to the value of BINDING_NAME in the local RMI registry.
static FileManagerInterface lookup(java.lang.String hostname)
          Lookup the object bound to the value of BINDING_NAME in the RMI registry on the host named by hostname
 
Methods inherited from class edu.brandeis.cs.steele.wn.FileManager
compare, getFileStream, getIndexedLinePointer, getMatchingLinePointer, getNextLinePointer, getWNHome, getWNSearchDir, mapToWindowsFilename, readLine, readLineAt, readLineWord, skipLine
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BINDING_NAME

public static final java.lang.String BINDING_NAME
The standard RMI binding name.

Constructor Detail

RemoteFileManager

public RemoteFileManager()
                  throws java.rmi.RemoteException
Construct a file manager backed by a set of files contained in the default WN search directory. See FileManager for a description of the default search directory.

Throws:
java.rmi.RemoteException - If remote operation failed.

RemoteFileManager

public RemoteFileManager(java.lang.String searchDirectory)
                  throws java.rmi.RemoteException
Construct a file manager backed by a set of files contained in searchDirectory.

Throws:
java.rmi.RemoteException - If remote operation failed.
Method Detail

bind

public void bind()
          throws java.rmi.RemoteException,
                 java.rmi.AlreadyBoundException
Bind this object to the value of BINDING_NAME in the local RMI registry.

Throws:
java.rmi.AlreadyBoundException - If BINDING_NAME is already bound.
java.rmi.RemoteException - If remote operation failed.

lookup

public static FileManagerInterface lookup(java.lang.String hostname)
                                   throws java.rmi.AccessException,
                                          java.rmi.NotBoundException,
                                          java.rmi.RemoteException,
                                          java.rmi.UnknownHostException
Lookup the object bound to the value of BINDING_NAME in the RMI registry on the host named by hostname

Returns:
An RMI proxy of type FileManagerInterface.
Throws:
java.rmi.AccessException - If this operation is not permitted.
java.rmi.NotBoundException - If there is no object named BINDING_NAME in the remote registry.
java.rmi.RemoteException - If remote operation failed.
java.rmi.UnknownHostException - If the host could not be located.