Class RemoteFileManager
- java.lang.Object
-
- net.didion.jwnl.dictionary.file_manager.FileManagerImpl
-
- net.didion.jwnl.dictionary.file_manager.RemoteFileManager
-
- All Implemented Interfaces:
java.rmi.Remote,FileManager,Createable
public class RemoteFileManager extends FileManagerImpl
An object of this class can serve as aFileManagerfor remoteFileBackedDictionaryinstantiations using RMI. This class also contains utility routines to publish aRemoteFileManagerfor remote use, and to lookup a remote one for local use.To make a
RemoteFileManageravailable to remote clients:System.setSecurityManager(new RMISecurityManager()); LocateRegistry.createRegistry(Registry.REGISTRY_PORT); new RemoteFileManager().bind();
To create a local
Dictionarybacked by a remoteRemoteFileManager:Dictionary dictionary = new FileBackedDictionary(RemoteFileManager.lookup(hostname));
-
-
Field Summary
Fields Modifier and Type Field Description private static MessageLog_logstatic java.lang.StringBINDING_NAMEThe standard RMI binding name.-
Fields inherited from class net.didion.jwnl.dictionary.file_manager.FileManagerImpl
FILE_TYPE, PATH
-
-
Constructor Summary
Constructors Constructor Description RemoteFileManager(java.lang.String searchDir, java.lang.Class dictionaryFileType)Construct a file manager backed by a set of files contained in the default WN search directory.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbind()Bind this object to the value ofBINDING_NAMEin the local RMI registry.static FileManagerlookup(java.lang.String hostname)Lookup the object bound to the value ofBINDING_NAMEin the RMI registry on the host named by hostname-
Methods inherited from class net.didion.jwnl.dictionary.file_manager.FileManagerImpl
close, create, getFile, getFirstLinePointer, getIndexedLinePointer, getMatchingLinePointer, getNextLinePointer, getRandomLinePointer, readLineAt
-
-
-
-
Field Detail
-
_log
private static final MessageLog _log
-
BINDING_NAME
public static final java.lang.String BINDING_NAME
The standard RMI binding name.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
RemoteFileManager
public RemoteFileManager(java.lang.String searchDir, java.lang.Class dictionaryFileType) throws java.io.IOException, java.rmi.RemoteExceptionConstruct 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:
java.rmi.RemoteException- If remote operation failed.java.io.IOException
-
-
Method Detail
-
bind
public void bind() throws java.rmi.RemoteException, java.rmi.AlreadyBoundExceptionBind this object to the value ofBINDING_NAMEin the local RMI registry.- Throws:
java.rmi.AlreadyBoundException- IfBINDING_NAMEis already bound.java.rmi.RemoteException- If remote operation failed.
-
lookup
public static FileManager 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 ofBINDING_NAMEin the RMI registry on the host named by hostname- Returns:
- An RMI proxy of type
FileManager. - Throws:
java.rmi.AccessException- If this operation is not permitted.java.rmi.NotBoundException- If there is no object namedBINDING_NAMEin the remote registry.java.rmi.RemoteException- If remote operation failed.java.rmi.UnknownHostException- If the host could not be located.
-
-