public class RemoteFileManager extends FileManagerImpl
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));
| Modifier and Type | Field and Description |
|---|---|
static String |
BINDING_NAME
The standard RMI binding name.
|
FILE_TYPE, PATH| Constructor and Description |
|---|
RemoteFileManager(String searchDir,
Class dictionaryFileType)
Construct a file manager backed by a set of files contained in the default WN search directory.
|
| Modifier and Type | Method and Description |
|---|---|
void |
bind()
Bind this object to the value of
BINDING_NAME in the local RMI
registry. |
static FileManager |
lookup(String hostname)
Lookup the object bound to the value of
BINDING_NAME in the RMI
registry on the host named by hostname |
close, create, getFile, getFirstLinePointer, getIndexedLinePointer, getMatchingLinePointer, getNextLinePointer, getRandomLinePointer, readLineAtpublic static final String BINDING_NAME
public RemoteFileManager(String searchDir, Class dictionaryFileType) throws IOException, RemoteException
FileManagerImpl for a description of the default search directory.RemoteException - If remote operation failed.IOExceptionpublic void bind()
throws RemoteException,
AlreadyBoundException
BINDING_NAME in the local RMI
registry.AlreadyBoundException - If BINDING_NAME is already bound.RemoteException - If remote operation failed.public static FileManager lookup(String hostname) throws AccessException, NotBoundException, RemoteException, UnknownHostException
BINDING_NAME in the RMI
registry on the host named by hostnameFileManager.AccessException - If this operation is not permitted.NotBoundException - If there is no object named BINDING_NAME in the remote registry.RemoteException - If remote operation failed.UnknownHostException - If the host could not be located.Copyright © 2023. All rights reserved.