cz.cuni.pogamut.Client
Class AgentAux

java.lang.Object
  extended by cz.cuni.pogamut.Client.AgentAux

public class AgentAux
extends java.lang.Object

Auxiliary class providing support for storing logs to file, etc ...


Field Summary
protected  Agent agent
          Agent wrapped by this decorator.
protected  AgentIterationEndListener flushingListener
          Listener that will flush all stream handlers every STREAM_LOG_FLUSH_INTERVAL iterations.
protected static int STREAM_LOG_FLUSH_INTERVAL
          number of logic iterations between two flushes to log files
protected  java.util.Collection<java.util.logging.StreamHandler> streamHandlers
          Set of all streamhandlers of this agent's logs.
protected  int streamLogFlushCounter
          counter for log flush
 
Constructor Summary
AgentAux(Agent agent)
          Creates a new instance of AgentAux
 
Method Summary
 void logPlatformLogToFile(java.lang.String filePath)
          Logs all messages from platform log to given file.
 void logPlatformLogToStream(java.util.logging.StreamHandler handler)
          Logs all messages from platform log to given stream handler.
private  void logToStream(java.util.logging.Logger log, java.util.logging.StreamHandler handler)
          Logs all messages from a log to given stream handler.
 void logUserLogToFile(java.lang.String filePath)
          Logs all messages from userlog to given file.
 void logUserLogToStream(java.util.logging.StreamHandler handler)
          Logs all messages from userlog to given stream handler.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

agent

protected Agent agent
Agent wrapped by this decorator.


STREAM_LOG_FLUSH_INTERVAL

protected static final int STREAM_LOG_FLUSH_INTERVAL
number of logic iterations between two flushes to log files

See Also:
Constant Field Values

streamLogFlushCounter

protected int streamLogFlushCounter
counter for log flush


streamHandlers

protected java.util.Collection<java.util.logging.StreamHandler> streamHandlers
Set of all streamhandlers of this agent's logs. Allways synchronise on this.


flushingListener

protected AgentIterationEndListener flushingListener
Listener that will flush all stream handlers every STREAM_LOG_FLUSH_INTERVAL iterations.

Constructor Detail

AgentAux

public AgentAux(Agent agent)
Creates a new instance of AgentAux

Method Detail

logToStream

private void logToStream(java.util.logging.Logger log,
                         java.util.logging.StreamHandler handler)
Logs all messages from a log to given stream handler.


logUserLogToFile

public void logUserLogToFile(java.lang.String filePath)
                      throws java.io.IOException
Logs all messages from userlog to given file. This will use default formater for the handler.

Throws:
java.io.IOException

logPlatformLogToFile

public void logPlatformLogToFile(java.lang.String filePath)
                          throws java.io.IOException
Logs all messages from platform log to given file. This will use default formater for the handler.

Throws:
java.io.IOException

logUserLogToStream

public void logUserLogToStream(java.util.logging.StreamHandler handler)
Logs all messages from userlog to given stream handler.


logPlatformLogToStream

public void logPlatformLogToStream(java.util.logging.StreamHandler handler)
Logs all messages from platform log to given stream handler.