Class RemoteFileManager
java.lang.Object
net.didion.jwnl.dictionary.file_manager.FileManagerImpl
net.didion.jwnl.dictionary.file_manager.RemoteFileManager
- All Implemented Interfaces:
Remote, FileManager, Createable
An object of this class can serve as a
FileManager 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 Dictionary backed by a remote RemoteFileManager:
Dictionary dictionary = new FileBackedDictionary(RemoteFileManager.lookup(hostname));
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final MessageLogstatic final StringThe standard RMI binding name.Fields inherited from class FileManagerImpl
FILE_TYPE, PATH -
Constructor Summary
ConstructorsConstructorDescriptionRemoteFileManager(String searchDir, Class dictionaryFileType) Construct a file manager backed by a set of files contained in the default WN search directory. -
Method Summary
Modifier and TypeMethodDescriptionvoidbind()Bind this object to the value ofBINDING_NAMEin the local RMI registry.static FileManagerLookup the object bound to the value ofBINDING_NAMEin the RMI registry on the host named by hostnameMethods inherited from class FileManagerImpl
close, create, getFile, getFirstLinePointer, getIndexedLinePointer, getMatchingLinePointer, getNextLinePointer, getRandomLinePointer, readLineAt
-
Field Details
-
_log
-
BINDING_NAME
-
-
Constructor Details
-
RemoteFileManager
public RemoteFileManager(String searchDir, Class dictionaryFileType) throws IOException, RemoteException Construct a file manager backed by a set of files contained in the default WN search directory. SeeFileManagerImplfor a description of the default search directory.- Throws:
RemoteException- If remote operation failed.IOException
-
-
Method Details
-
bind
Bind this object to the value ofBINDING_NAMEin the local RMI registry.- Throws:
AlreadyBoundException- IfBINDING_NAMEis already bound.RemoteException- If remote operation failed.
-
lookup
public static FileManager lookup(String hostname) throws AccessException, NotBoundException, RemoteException, UnknownHostException Lookup the object bound to the value ofBINDING_NAMEin the RMI registry on the host named by hostname- Returns:
- An RMI proxy of type
FileManager. - Throws:
AccessException- If this operation is not permitted.NotBoundException- If there is no object namedBINDING_NAMEin the remote registry.RemoteException- If remote operation failed.UnknownHostException- If the host could not be located.
-