qflib 0.99

de.qfs.lib.logrmi
Class RemoteLogLevelAdapter

java.lang.Object
  extended byjava.rmi.server.RemoteObject
      extended byjava.rmi.server.RemoteServer
          extended byjava.rmi.server.UnicastRemoteObject
              extended byde.qfs.lib.logrmi.RemoteLogLevelCallbackImplBase
                  extended byde.qfs.lib.logrmi.RemoteLogLevelAdapter
All Implemented Interfaces:
java.util.EventListener, LogLevelListener, java.rmi.Remote, RemoteLogLevelCallback, java.io.Serializable

public class RemoteLogLevelAdapter
extends RemoteLogLevelCallbackImplBase
implements LogLevelListener

Adapter that connects a RemoteLogLevelListener to an application.

Author:
Gregor Schmid
See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.rmi.server.RemoteObject
ref
 
Constructor Summary
RemoteLogLevelAdapter()
          Create a new RemoteLogLevelAdapter.
RemoteLogLevelAdapter(RemoteLogLevelListener listener)
          Create a new RemoteLogLevelAdapter.
 
Method Summary
 void classAdded(LogLevelEvent event)
          Notify the listener that a Logger for a formerly unknown class has requested its log level, adding the class to the log level tree.
 void disconnect()
          End the connection with the RemoteLogLevelListener.
 int getFlushBufferSize()
          Get the size of the flush buffer of the callback's application.
 int getFlushTriggerLevel()
          Get the level that will trigger a flush of the messages saved in the flush buffer of the callback's application.
 java.lang.Object[] getLogLevels()
          Get the current log levels from the callback.
 int getOutputLevel()
          Get the current output log level from the callback's application.
 int getPostFlushSize()
          Get the number of messages to pass unfiltered through the pre-queue stage after a flush happened in the callback's application.
 int getPreQueueLevel()
          Return the current pre-queue level from the callback's application.
 int getQueueSize()
          Get the size of log queue of the callback's application.
 boolean isDropOnOverflow()
          Check whether the callback's application is dropping entries when its log queue overflows.
 boolean isQueueing()
          Check whether the callback's application is using a log queue.
 void levelChanged(LogLevelEvent event)
          Notify the listener that a log level has been changed.
 void levelRemoved(LogLevelEvent event)
          Notify the listener that a log level has been unset.
 void removeLogLevel(java.lang.String name)
          Callback method for a LogLevelListener to remove the log level for a class or package.
 void setDropOnOverflow(boolean drop)
          Set whether the callback's application should drop entries when its log queue overflows.
 void setFlushBufferSize(int size)
          Set the size of the flush buffer of the callback's application.
 void setFlushTriggerLevel(int level)
          Set the level that will trigger a flush of the messages saved in the flush buffer of the callback's application.
 void setLogLevel(java.lang.String name, int level)
          Callback method for a LogLevelListener to change the log level for a class or package.
 void setLogLevelCallback(LogLevelCallback callback)
          Sets the LogLevelCallback for the LogLevelListener.
 void setOutputLevel(int level)
          Set the output log level for the callback's application.
 void setPostFlushSize(int size)
          Set the number of messages to pass unfiltered through the pre-queue stage after a flush happened in the callback's application.
 void setPreQueueLevel(int level)
          Set the pre-queue level for the callback's application.
 void setQueueing(boolean queue)
          Set whether the callback's application should use a log queue.
 void setQueueSize(int size)
          Set the size of log queue of the callback's application.
 void setRemoteListener(RemoteLogLevelListener listener)
          Set the listener to forward LogLevelEvents to.
 
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

RemoteLogLevelAdapter

public RemoteLogLevelAdapter()
                      throws java.rmi.RemoteException
Create a new RemoteLogLevelAdapter.

Throws:
java.rmi.RemoteException

RemoteLogLevelAdapter

public RemoteLogLevelAdapter(RemoteLogLevelListener listener)
                      throws java.rmi.RemoteException
Create a new RemoteLogLevelAdapter.

Parameters:
listener - The listener to forward LogLevelEvents to.
Throws:
java.rmi.RemoteException
Method Detail

setRemoteListener

public void setRemoteListener(RemoteLogLevelListener listener)
Set the listener to forward LogLevelEvents to.

Parameters:
listener - The listener to forward LogLevelEvents to.

getLogLevels

public java.lang.Object[] getLogLevels()
Get the current log levels from the callback. This method is needed to synchronize the LogLevelListener and the LogLevelCallback after the connection has been established.

Specified by:
getLogLevels in interface RemoteLogLevelCallback
Specified by:
getLogLevels in class RemoteLogLevelCallbackImplBase
Returns:
An object array that contains an alternating sequence of class/package names and log levels. The levels are Integers that may be null for classes for which a level has been requested but not explicitly set.

setLogLevel

public void setLogLevel(java.lang.String name,
                        int level)
Callback method for a LogLevelListener to change the log level for a class or package.

Specified by:
setLogLevel in interface RemoteLogLevelCallback
Specified by:
setLogLevel in class RemoteLogLevelCallbackImplBase
Parameters:
name - The name of the affected class or package.
level - The new log level.

removeLogLevel

public void removeLogLevel(java.lang.String name)
Callback method for a LogLevelListener to remove the log level for a class or package.

Specified by:
removeLogLevel in interface RemoteLogLevelCallback
Specified by:
removeLogLevel in class RemoteLogLevelCallbackImplBase
Parameters:
name - The name of the affected class or package.

getOutputLevel

public int getOutputLevel()
Get the current output log level from the callback's application.

Specified by:
getOutputLevel in interface RemoteLogLevelCallback
Specified by:
getOutputLevel in class RemoteLogLevelCallbackImplBase
Returns:
The current output log level.

setOutputLevel

public void setOutputLevel(int level)
Set the output log level for the callback's application.

Specified by:
setOutputLevel in interface RemoteLogLevelCallback
Specified by:
setOutputLevel in class RemoteLogLevelCallbackImplBase
Parameters:
level - Output log level to set.

getPreQueueLevel

public int getPreQueueLevel()
Return the current pre-queue level from the callback's application.

Specified by:
getPreQueueLevel in interface RemoteLogLevelCallback
Specified by:
getPreQueueLevel in class RemoteLogLevelCallbackImplBase
Returns:
The current pre-queue level.

setPreQueueLevel

public void setPreQueueLevel(int level)
Set the pre-queue level for the callback's application.

Specified by:
setPreQueueLevel in interface RemoteLogLevelCallback
Specified by:
setPreQueueLevel in class RemoteLogLevelCallbackImplBase
Parameters:
level - The pre-queue level to set.

isQueueing

public boolean isQueueing()
Check whether the callback's application is using a log queue.

Specified by:
isQueueing in interface RemoteLogLevelCallback
Specified by:
isQueueing in class RemoteLogLevelCallbackImplBase
Returns:
Whether the callback's application is queueing log entries.
See Also:
Log.isQueueing()

setQueueing

public void setQueueing(boolean queue)
Set whether the callback's application should use a log queue.

Specified by:
setQueueing in interface RemoteLogLevelCallback
Specified by:
setQueueing in class RemoteLogLevelCallbackImplBase
Parameters:
queue - Whether to queue log entries.
See Also:
Log.setQueueing(boolean)

getQueueSize

public int getQueueSize()
Get the size of log queue of the callback's application.

Specified by:
getQueueSize in interface RemoteLogLevelCallback
Specified by:
getQueueSize in class RemoteLogLevelCallbackImplBase
Returns:
The size of the log queue.
See Also:
Log.getQueueSize()

setQueueSize

public void setQueueSize(int size)
Set the size of log queue of the callback's application.

Specified by:
setQueueSize in interface RemoteLogLevelCallback
Specified by:
setQueueSize in class RemoteLogLevelCallbackImplBase
Parameters:
size - The size of the log queue.
See Also:
Log.setQueueSize(int)

isDropOnOverflow

public boolean isDropOnOverflow()
Check whether the callback's application is dropping entries when its log queue overflows.

Specified by:
isDropOnOverflow in interface RemoteLogLevelCallback
Specified by:
isDropOnOverflow in class RemoteLogLevelCallbackImplBase
Returns:
Whether entries are dropped on overflow.
See Also:
Log.isDropOnOverflow()

setDropOnOverflow

public void setDropOnOverflow(boolean drop)
Set whether the callback's application should drop entries when its log queue overflows.

Specified by:
setDropOnOverflow in interface RemoteLogLevelCallback
Specified by:
setDropOnOverflow in class RemoteLogLevelCallbackImplBase
Parameters:
drop - Whether to drop entries on overflow.
See Also:
Log.setDropOnOverflow(boolean)

getFlushBufferSize

public int getFlushBufferSize()
Get the size of the flush buffer of the callback's application.

Specified by:
getFlushBufferSize in interface RemoteLogLevelCallback
Specified by:
getFlushBufferSize in class RemoteLogLevelCallbackImplBase
Returns:
The flush buffer size or 0 to indicate no flush buffer.

setFlushBufferSize

public void setFlushBufferSize(int size)
Set the size of the flush buffer of the callback's application. Setting it to 0 will turn the flush buffer off.

Specified by:
setFlushBufferSize in interface RemoteLogLevelCallback
Specified by:
setFlushBufferSize in class RemoteLogLevelCallbackImplBase
Parameters:
size - The size of the flush buffer.

getFlushTriggerLevel

public int getFlushTriggerLevel()
Get the level that will trigger a flush of the messages saved in the flush buffer of the callback's application.

Specified by:
getFlushTriggerLevel in interface RemoteLogLevelCallback
Specified by:
getFlushTriggerLevel in class RemoteLogLevelCallbackImplBase
Returns:
The flush buffer's trigger level.

setFlushTriggerLevel

public void setFlushTriggerLevel(int level)
Set the level that will trigger a flush of the messages saved in the flush buffer of the callback's application.

Specified by:
setFlushTriggerLevel in interface RemoteLogLevelCallback
Specified by:
setFlushTriggerLevel in class RemoteLogLevelCallbackImplBase
Parameters:
level - The trigger level to set.

getPostFlushSize

public int getPostFlushSize()
Get the number of messages to pass unfiltered through the pre-queue stage after a flush happened in the callback's application.

Specified by:
getPostFlushSize in interface RemoteLogLevelCallback
Specified by:
getPostFlushSize in class RemoteLogLevelCallbackImplBase
Returns:
The number of messages to pass.

setPostFlushSize

public void setPostFlushSize(int size)
Set the number of messages to pass unfiltered through the pre-queue stage after a flush happened in the callback's application.

Specified by:
setPostFlushSize in interface RemoteLogLevelCallback
Specified by:
setPostFlushSize in class RemoteLogLevelCallbackImplBase
Parameters:
size - The number of messages to pass.

disconnect

public void disconnect()
                throws java.rmi.RemoteException
End the connection with the RemoteLogLevelListener.

Specified by:
disconnect in interface RemoteLogLevelCallback
Specified by:
disconnect in class RemoteLogLevelCallbackImplBase
Throws:
java.rmi.RemoteException - If something RMI specific goes wrong.

classAdded

public void classAdded(LogLevelEvent event)
Notify the listener that a Logger for a formerly unknown class has requested its log level, adding the class to the log level tree.

Specified by:
classAdded in interface LogLevelListener
Parameters:
event - The LogLevelEvent holding the details.

levelChanged

public void levelChanged(LogLevelEvent event)
Notify the listener that a log level has been changed.

Specified by:
levelChanged in interface LogLevelListener
Parameters:
event - The LogLevelEvent holding the details.

levelRemoved

public void levelRemoved(LogLevelEvent event)
Notify the listener that a log level has been unset.

Specified by:
levelRemoved in interface LogLevelListener
Parameters:
event - The LogLevelEvent holding the details.

setLogLevelCallback

public void setLogLevelCallback(LogLevelCallback callback)
Sets the LogLevelCallback for the LogLevelListener.

Specified by:
setLogLevelCallback in interface LogLevelListener
Parameters:
callback - The LogLevelCallback to use to change the log levels.

qflib 0.99