org.elkoserver.util.trace
Interface TraceMessageAcceptor


public interface TraceMessageAcceptor

This interface represents objects that accept messages and do something useful with them. A TraceMessageAcceptor lives in two main states: prior to its starting environment being set up, and after that environment is set up. A TraceMessageAcceptor may choose to accept messages prior to the completion of setup, but it may not make them available to a user.

An instance of this interface is given to the TraceController via its setAcceptor() method. If a message acceptor is not provided in this way, the TraceController class will provide a standard default implementation, which simply writes messages to a log file. Typically that default implementation is the one you want to use. This interface exists for circumstances which require trace messages to receive special handling (for example, to make the message appear in an application server's log file using a vendor-proprietary logging API).


Method Summary
 void accept(TraceMessage message)
          Accept a message and do whatever is appropriate to make it visible to a user, either now or later.
 boolean setConfiguration(String name, String value)
          Modify the acceptor configuration based on a property setting.
 void setupIsComplete()
          After this call, the TraceMessageAcceptor must obey settings from the environment.
 

Method Detail

accept

void accept(TraceMessage message)
Accept a message and do whatever is appropriate to make it visible to a user, either now or later. Typically this will involve an action such as writing the message to a log file or displaying it in a trace window.

Note that this method will be called after the message passes a priority threshold check. TraceMessageAcceptors don't know about priorities.

The TraceMessageAcceptor is allowed to unilaterally discard the message. Generally, this is done only if it was turned off by a control external to this interface.

Parameters:
message - The trace message to be handled.

setConfiguration

boolean setConfiguration(String name,
                         String value)
Modify the acceptor configuration based on a property setting.

Parameters:
name - Property name.
value - Property value.
Returns:
true if the property was recognized and handled, false if not.

setupIsComplete

void setupIsComplete()
After this call, the TraceMessageAcceptor must obey settings from the environment. Before this call, it must defer taking any visible action, because it can't yet know what action is appropriate. Note that the message acceptor may (is encouraged to) accept messages before setup is complete, because some of those trace messages might be useful.

It is an error to call this method more than once.