|
qflib 0.98.1 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.rmi.server.RemoteObject | +--java.rmi.server.RemoteServer | +--java.rmi.server.UnicastRemoteObject | +--de.qfs.lib.logrmi.LogClientImplBase | +--de.qfs.lib.logrmi.RemoteLogFilter
The RemoteLogFilter class takes care of all the necessary details to
connect to a LogServer
and pass the log messages created
by a program to it. The convenience methods logRemote
and stopLogging
handle all the details.
There are two possible modes of operation: Contact a server as soon as the RemoteLogFilter is created or register with the RMI registry to get contacted later by a LogServer. The most useful mode of operation is to combine these two, since then the user doesn't need to concern himself with the order in which server and clients are started.
If the RemoteLogFilter is to register itself with the RMI registry, a few
additional things have to be decided:
- Which registry port to use
- Whether to create a registry, if the rmiregistry tool hasn't been
started. This can be useful when a long-running server program is using its
own registry port anyway, but should be used with care, as the termination
of the program that created the registry will destroy all other
registrations.
- Whether LogServers from different machines are allowed to connect. This
can be very useful but is also a great security hole. The decision depends
on your kind of program and whether your machine is safe behind a
firewall.
To handle the log messages, the RemoteLogFilter must be added to the Log
filter chain with Log.addFilter
. It implements the
LogUser
interface to enable configuration of which messages
to pass on through the filter chain. Its default filter mode is FILTER_NONE
.
Fields inherited from class java.rmi.server.RemoteObject |
ref |
Fields inherited from interface de.qfs.lib.log.LogUser |
FILTER_ALL, FILTER_NONE, FILTER_UNUSED, FILTER_USED |
Fields inherited from interface de.qfs.lib.logrmi.LogClient |
REGISTRY_BASE_NAME |
Constructor Summary | |
RemoteLogFilter(java.lang.String name)
Deprecated. Create a new RemoteLogFilter and connect to a LogServer. |
Method Summary | |
void |
connect(LogServer logServer)
Deprecated. Tell the LogClient that it should disengage from the registry and connect itself to a LogServer. |
void |
connect(java.lang.String server)
Deprecated. Connect to a LogServer. |
void |
disconnect()
Deprecated. Disconnect from the LogServer. |
boolean |
filter(LogEntry logEntry)
Deprecated. Take a LogEntry and pass it to the LogServer. |
LogEntry[] |
filter(LogEntry[] entries)
Deprecated. Send all messages from the list to the remote listener. |
static RemoteLogFilter |
getInstance()
Deprecated. No replacement. |
static void |
logRemote(java.lang.String name,
int port,
boolean createRegistry,
boolean localOnly)
Deprecated. Please use RemoteLogWriter.logRemote instead. |
static void |
logRemote(java.lang.String server,
java.lang.String name)
Deprecated. Please use RemoteLogWriter.logRemote instead. |
static void |
logRemote(java.lang.String server,
java.lang.String name,
int port,
boolean createRegistry,
boolean localOnly)
Deprecated. Please use RemoteLogWriter.logRemote instead. |
void |
register(int port,
boolean createRegistry,
boolean localOnly)
Deprecated. Register the RemoteLogFilter with the RMI registry. |
void |
setFilterMode(int mode)
Deprecated. Configure the RemoteLogFilter's filter mode. |
static void |
stopLogging()
Deprecated. Please use RemoteLogWriter.stopLogging instead. |
Methods inherited from class java.rmi.server.UnicastRemoteObject |
clone, exportObject, exportObject, exportObject, unexportObject |
Methods inherited from class java.rmi.server.RemoteServer |
getClientHost, getLog, setLog |
Methods inherited from class java.rmi.server.RemoteObject |
equals, getRef, hashCode, toString, toStub |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public RemoteLogFilter(java.lang.String name) throws java.rmi.RemoteException
name
- The name to connect under.java.rmi.RemoteException
- If something RMI specific goes wrong.Method Detail |
public static void logRemote(java.lang.String server, java.lang.String name) throws java.net.MalformedURLException, java.rmi.NotBoundException, java.rmi.RemoteException
RemoteLogWriter.logRemote
instead.
server
- The servername to connect to in the format used
by java.rmi.Naming.lookup
.name
- The name to connect under.java.net.MalformedURLException
- If the server URL is bad.java.rmi.NotBoundException
- If the server is not bound under that
name.java.rmi.RemoteException
- If something RMI specific goes wrong.public static void logRemote(java.lang.String name, int port, boolean createRegistry, boolean localOnly) throws java.rmi.RemoteException
RemoteLogWriter.logRemote
instead.
name
- The name to use when connecting to a LogServer.port
- The registry port to use. The value -1 means
use the standard RMI registry port.createRegistry
- Whether to create a new Registry if none is
available.localOnly
- If true, only LogServers from the same network
address as the RemoteLogFilter are allowed to
connect.java.rmi.RemoteException
- If something RMI specific goes wrong.public static void logRemote(java.lang.String server, java.lang.String name, int port, boolean createRegistry, boolean localOnly) throws java.net.MalformedURLException, java.rmi.NotBoundException, java.rmi.RemoteException
RemoteLogWriter.logRemote
instead.
server
- The servername to connect to in the format used
by java.rmi.Naming.lookup
.name
- The name to connect under.port
- The registry port to use. The value -1 means
use the standard RMI registry port.createRegistry
- Whether to create a new Registry if none is
available.localOnly
- If true, only LogServers from the same network
address as the RemoteLogFilter are allowed to
connect.java.net.MalformedURLException
- If the server URL is bad.java.rmi.NotBoundException
- If the server is not bound under that
name.java.rmi.RemoteException
- If something RMI specific goes wrong.public static void stopLogging()
RemoteLogWriter.stopLogging
instead.
public static RemoteLogFilter getInstance()
logRemote
methods.public void connect(java.lang.String server) throws java.net.MalformedURLException, java.rmi.NotBoundException, java.rmi.RemoteException
server
- The servername to connect to in the format used
by java.rmi.Naming.lookup
.java.net.MalformedURLException
- If the server URL is bad.java.rmi.NotBoundException
- If the server is not bound under that
name.java.rmi.RemoteException
- If something RMI specific goes wrong.public void register(int port, boolean createRegistry, boolean localOnly) throws java.rmi.RemoteException
port
- The registry port to use, -1 for default.createRegistry
- Whether to create the registry if none exists.localOnly
- If true, only LogServers from the same network
address as the RemoteLogFilter are allowed to
connect.java.rmi.RemoteException
- If no working Registry can be found or created.public void disconnect()
public boolean filter(LogEntry logEntry)
filter
in interface LogFilter
logEntry
- The entry to pass on.public LogEntry[] filter(LogEntry[] entries)
filter
in interface LogFilter
entries
- The list of LogEntries.public void setFilterMode(int mode)
setFilterMode
in interface LogUser
mode
- The mode to set.public void connect(LogServer logServer) throws java.rmi.RemoteException
connect
in class LogClientImplBase
logServer
- The LogServer to connect to.java.rmi.RemoteException
- If something RMI specific goes wrong.
|
qflib 0.98.1 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |