util
Class RemoteLogServer

java.lang.Object
  extended by com.protomatter.syslog.BasicLogger
      extended by util.RemoteLogServer
All Implemented Interfaces:
com.protomatter.syslog.Syslogger, Remote, ExitCleaning, RmiCaster, RmiLogCaster

public class RemoteLogServer
extends com.protomatter.syslog.BasicLogger
implements RmiLogCaster, ExitCleaning

A logger that sends messages to remote receivers. Receivers may be added or removed with the addRmiLogListener(com.protomatter.syslog.RemoteLogReceiver) and removeRmiLogListener(com.protomatter.syslog.RemoteLogReceiver) at any time within the livetime of this logger. This differs from the original impleemntation of RemoteLog in the protomatter package, as this allowed easy adding of remote loggers only on construct time.


Field Summary
private  String bindname
          The binding name of the remote log server.
private static int EXPORTPORT
          The port where we want to export.
private  List<com.protomatter.syslog.RemoteLogReceiver> receiver
          A list of RemoteLogReceiver instances that should be logged.
 
Fields inherited from class com.protomatter.syslog.BasicLogger
formatter, policy, realPolicy
 
Constructor Summary
RemoteLogServer(String servername)
          You will need to call the configure() method if you use this constructor.
 
Method Summary
 void addRmiLogListener(com.protomatter.syslog.RemoteLogReceiver ear)
          Adds a remote log receiver to this server.
 boolean bindToRegistry()
          Binds this receiver's casting capabilities to a running registry.
 void exit()
          Unbinds this server from the registry.
 void flush()
          Does nothing.
 boolean isValid()
          Returns true.
 void log(com.protomatter.syslog.SyslogMessage sm)
          Log the given message to all bound listeners.
 void removeRmiLogListener(com.protomatter.syslog.RemoteLogReceiver ear)
          Removes a remote log receiver to this server.
 void shutdown()
          Prepare for shutdown and call the exit method.
 boolean unbindFromRegistry()
          Unbinds this receiver torso from the registry.
 
Methods inherited from class com.protomatter.syslog.BasicLogger
formatLogEntry, getName, getPolicy, getTextFormatter, isSuspended, mightLog, resetDateFormat, resume, setName, setPolicy, setTextFormatter, shouldLog, suspend
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

receiver

private List<com.protomatter.syslog.RemoteLogReceiver> receiver
A list of RemoteLogReceiver instances that should be logged.


bindname

private String bindname
The binding name of the remote log server.


EXPORTPORT

private static final int EXPORTPORT
The port where we want to export.

See Also:
Constant Field Values
Constructor Detail

RemoteLogServer

public RemoteLogServer(String servername)
You will need to call the configure() method if you use this constructor.

Method Detail

log

public final void log(com.protomatter.syslog.SyslogMessage sm)
Log the given message to all bound listeners. If a RemoteException is thrown while calling the logging callback method on the receiver, then the receiver is unbound from JNDI to prevent further problems with that receiver.

Specified by:
log in interface com.protomatter.syslog.Syslogger
Specified by:
log in class com.protomatter.syslog.BasicLogger

shutdown

public void shutdown()
Prepare for shutdown and call the exit method.

Specified by:
shutdown in interface com.protomatter.syslog.Syslogger
Specified by:
shutdown in class com.protomatter.syslog.BasicLogger

flush

public void flush()
Does nothing.

Specified by:
flush in interface com.protomatter.syslog.Syslogger
Specified by:
flush in class com.protomatter.syslog.BasicLogger

exit

public void exit()
Unbinds this server from the registry.

Specified by:
exit in interface ExitCleaning

isValid

public boolean isValid()
                throws RemoteException
Returns true. This method is implemented for rmi-listeners to regularly check if they still listen to a correct remote reference.

Specified by:
isValid in interface RmiCaster
Throws:
RemoteException

bindToRegistry

public boolean bindToRegistry()
                       throws RemoteException
Binds this receiver's casting capabilities to a running registry.

Specified by:
bindToRegistry in interface RmiCaster
Returns:
True if successful.
Throws:
RemoteException

unbindFromRegistry

public boolean unbindFromRegistry()
                           throws RemoteException
Unbinds this receiver torso from the registry.

Specified by:
unbindFromRegistry in interface RmiCaster
Returns:
True if successful.
Throws:
RemoteException

addRmiLogListener

public void addRmiLogListener(com.protomatter.syslog.RemoteLogReceiver ear)
                       throws RemoteException
Adds a remote log receiver to this server.

Specified by:
addRmiLogListener in interface RmiLogCaster
Throws:
RemoteException

removeRmiLogListener

public void removeRmiLogListener(com.protomatter.syslog.RemoteLogReceiver ear)
                          throws RemoteException
Removes a remote log receiver to this server.

Specified by:
removeRmiLogListener in interface RmiLogCaster
Throws:
RemoteException