org.e2etrace.config
Class PropertiesTraceConfig

java.lang.Object
  extended by org.e2etrace.config.PropertiesTraceConfig
All Implemented Interfaces:
ITraceConfig

public class PropertiesTraceConfig
extends Object
implements ITraceConfig

Properties file implementation of the e2etrace configuration.

The property file must be structured as follows:

            global.enabletrace=true/false
            global.reloadinterval=<n>
            id.<trace step id>=true/false
 
If a reloadinterval is defined in the configuration file, the property file will be automatically reloaded every n seconds. If no reload interval or an interval of 0 seconds is defined, the configuration will only be loaded once.

The trace step ids must match the string representation of the id (see ITraceStepId.asString()). The default value for trace ids is true. That is, if no ids are defined in the configuration file , tracing will be enabled for all trace steps.

Author:
Gunther Popp

Constructor Summary
PropertiesTraceConfig()
          Default constructor.
 
Method Summary
 boolean isTraceEnabled()
          Is tracing enabled at all?
 boolean isTraceEnabledForId(ITraceStepId id)
          Is tracing enabled for the given trace step id?
 void loadConfigFile(String fileName)
          Loads the e2etrace configuration from the specified properties file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PropertiesTraceConfig

public PropertiesTraceConfig()
Default constructor.

Method Detail

isTraceEnabled

public boolean isTraceEnabled()
Is tracing enabled at all?

If this method returns false e2etrace does not collect any trace information. All potential time consuming methods of e2etrace will immediately return.

Specified by:
isTraceEnabled in interface ITraceConfig
Returns:
true / false

isTraceEnabledForId

public boolean isTraceEnabledForId(ITraceStepId id)
Is tracing enabled for the given trace step id?

If this method returns false for the given id, e2etrace does not collect any trace information for this specific trace id. Basically, this reduces the amount of collected data but not the general overhead of the trace mechanismn itself. Note: If tracing is disabled for a trace session id, no trace data will be collected for the complete session.

Specified by:
isTraceEnabledForId in interface ITraceConfig
Parameters:
id - the trace id
Returns:
true / false

loadConfigFile

public void loadConfigFile(String fileName)
                    throws IOException
Loads the e2etrace configuration from the specified properties file.

The following search order is used:

loaded as resource via the thread context class loader. Hence, the specified file must be accessible in the classpath of the application.

Parameters:
fileName - path and name of the configuration file
Throws:
IOException - Error loading the specified file


Copyright © 2013 Gunther Popp. All Rights Reserved.