com.mulesoft.adapter.ra
Class XITrace

java.lang.Object
  extended by com.mulesoft.adapter.ra.XITrace

public class XITrace
extends Object

Basic XITrace wrapper class for the new AdapterFramework, which will make the usage of SAP J2EE standard logging and tracing more convenient and consistent throughout the sample adapter. (ra implementation specific)


Field Summary
protected  com.sap.tc.logging.Location location
           
static int SEVERITY_ALL
           
static int SEVERITY_DEBUG
           
static int SEVERITY_ERROR
           
static int SEVERITY_FATAL
           
static int SEVERITY_GROUP
           
static int SEVERITY_INFO
           
static int SEVERITY_MAX
           
static int SEVERITY_MIN
           
static int SEVERITY_NONE
           
static int SEVERITY_PATH
           
static int SEVERITY_WARNING
           
protected static boolean tracing
           
 
Constructor Summary
XITrace(String className)
          Constructor for trace utility class
 
Method Summary
 void assertion(String signature, com.sap.tc.logging.Category category, boolean assertion, String msg)
          Writes an error trace message if a given condition is false.
 boolean beLogged(int severity)
          This method can be used to avoid unneccessary and unperformant object creation, in cases where debugging is switched off, or the serverity level is lower than the current one.
 void catching(String signature, Throwable t)
          Writes a trace entry that the specified throwable was caught.
 void debugT(String signature, com.sap.tc.logging.Category category, String msg)
          Writes a debug trace and log message.
 void debugT(String signature, com.sap.tc.logging.Category category, String msg, Object[] args)
          Writes a debug trace and log message.
 void debugT(String signature, String msg)
          Writes a debug trace message.
 void debugT(String signature, String msg, Object[] args)
          Writes a debug trace message.
 void entering(String signature)
          Writes a trace entry that the specified method was entered.
 void entering(String signature, Object[] args)
          Writes a trace entry that the specified method was entered.
 void errorT(String signature, com.sap.tc.logging.Category category, String msg)
          Writes an error trace and log message.
 void errorT(String signature, com.sap.tc.logging.Category category, String msg, Object[] args)
          Writes an error trace and log message.
 void errorT(String SIGNATURE, com.sap.tc.logging.Category category, String messageID, String msg)
          Writes an error trace and log message.
 void errorT(String SIGNATURE, com.sap.tc.logging.Category category, String messageID, String msg, Object... args)
          Writes an error trace and log message.
 void errorT(String signature, String msg)
          Writes an error trace message.
 void errorT(String signature, String msg, Object[] args)
          Writes an error trace and log message.
 void errorT(String SIGNATURE, String messageID, String msg)
          Writes an error trace message.
 void errorT(String SIGNATURE, String messageID, String msg, Object... args)
          Writes an error trace and log message.
 void exiting(String signature)
          Writes a trace entry that the specified method is about to be exited.
 void exiting(String signature, Object res)
          Writes a trace entry that the specified method is about to be exited.
 void fatalT(String signature, com.sap.tc.logging.Category category, String msg)
          Writes a fatal trace and log message.
 void fatalT(String signature, com.sap.tc.logging.Category category, String msg, Object[] args)
          Writes a fatal trace and log message.
 void fatalT(String SIGNATURE, com.sap.tc.logging.Category category, String messageID, String msg)
          Writes a fatal trace and log message.
 void fatalT(String SIGNATURE, com.sap.tc.logging.Category category, String messageID, String msg, Object... args)
          Writes a fatal trace and log message.
 void fatalT(String signature, String msg)
          Writes a fatal trace message.
 void fatalT(String signature, String msg, Object[] args)
          Writes a fatal trace message.
 void fatalT(String SIGNATURE, String messageID, String msg)
          Writes a fatal trace message.
 void fatalT(String SIGNATURE, String messageID, String msg, Object... args)
          Writes a fatal trace message.
 void infoT(String signature, com.sap.tc.logging.Category category, String msg)
          Writes an info trace and log message.
 void infoT(String signature, com.sap.tc.logging.Category category, String msg, Object[] args)
          Writes an info trace and log message.
 void infoT(String signature, String msg)
          Writes an info trace message.
 void infoT(String signature, String msg, Object[] args)
          Writes an info trace message.
 void throwing(String signature, Throwable t)
          Writes a trace entry that the specified throwable is about to be thrown.
 String toString()
           
 void warningT(String signature, com.sap.tc.logging.Category category, String msg)
          Writes an warning trace and log message.
 void warningT(String signature, com.sap.tc.logging.Category category, String msg, Object[] args)
          Writes a warning trace and log message.
 void warningT(String signature, String msg)
          Writes a warning trace message.
 void warningT(String signature, String msg, Object[] args)
          Writes a warning trace message.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

location

protected com.sap.tc.logging.Location location

tracing

protected static boolean tracing

SEVERITY_ALL

public static final int SEVERITY_ALL
See Also:
Constant Field Values

SEVERITY_DEBUG

public static final int SEVERITY_DEBUG
See Also:
Constant Field Values

SEVERITY_ERROR

public static final int SEVERITY_ERROR
See Also:
Constant Field Values

SEVERITY_FATAL

public static final int SEVERITY_FATAL
See Also:
Constant Field Values

SEVERITY_GROUP

public static final int SEVERITY_GROUP
See Also:
Constant Field Values

SEVERITY_INFO

public static final int SEVERITY_INFO
See Also:
Constant Field Values

SEVERITY_MAX

public static final int SEVERITY_MAX
See Also:
Constant Field Values

SEVERITY_MIN

public static final int SEVERITY_MIN
See Also:
Constant Field Values

SEVERITY_NONE

public static final int SEVERITY_NONE
See Also:
Constant Field Values

SEVERITY_PATH

public static final int SEVERITY_PATH
See Also:
Constant Field Values

SEVERITY_WARNING

public static final int SEVERITY_WARNING
See Also:
Constant Field Values
Constructor Detail

XITrace

public XITrace(String className)
Constructor for trace utility class

Parameters:
className: - Name of the class that uses this trace utility, usually this.getClass().getName()
Method Detail

toString

public String toString()
Overrides:
toString in class Object

entering

public void entering(String signature)
Writes a trace entry that the specified method was entered.

Parameters:
signature - Signature of the method

entering

public void entering(String signature,
                     Object[] args)
Writes a trace entry that the specified method was entered.

Parameters:
signature - Signature of the method
args - Arguments as object references

exiting

public void exiting(String signature)
Writes a trace entry that the specified method is about to be exited.

Parameters:
signature - Signature of the method

exiting

public void exiting(String signature,
                    Object res)
Writes a trace entry that the specified method is about to be exited.

Parameters:
signature - Signature of the method
res - Result as object references

throwing

public void throwing(String signature,
                     Throwable t)
Writes a trace entry that the specified throwable is about to be thrown.

Parameters:
signature - Signature of the method
t - Throwable

catching

public void catching(String signature,
                     Throwable t)
Writes a trace entry that the specified throwable was caught.

Parameters:
signature - Signature of the method
t - Throwable

debugT

public void debugT(String signature,
                   com.sap.tc.logging.Category category,
                   String msg)
Writes a debug trace and log message.

Parameters:
signature - Signature of the method
category - Category of the trace
msg - Can have placeholders of java.text.MessageFormat syntax, in the form of { } to be substituted by the respective arguments

debugT

public void debugT(String signature,
                   String msg)
Writes a debug trace message.

Parameters:
signature - Signature of the method
msg - Debug message text

debugT

public void debugT(String signature,
                   com.sap.tc.logging.Category category,
                   String msg,
                   Object[] args)
Writes a debug trace and log message.

Parameters:
signature - Signature of the method
category - Category of the trace
msg - Can have placeholders of java.text.MessageFormat syntax, in the form of { } to be substituted by the arguments
args - Can be single argument but also array of arguments. For collections, their method toArray is used.

debugT

public void debugT(String signature,
                   String msg,
                   Object[] args)
Writes a debug trace message.

Parameters:
signature - Signature of the method
msg - Can have placeholders of java.text.MessageFormat syntax in the form of { } to be substituted by the arguments.
args - Can be single argument but also array of arguments. For collections, their method toArray is used.

infoT

public void infoT(String signature,
                  com.sap.tc.logging.Category category,
                  String msg)
Writes an info trace and log message.

Parameters:
signature - Signature of the method
category - Category of the trace
msg - Can have placeholders of java.text.MessageFormat syntax, in the form of { } to be substituted by the respective arguments

infoT

public void infoT(String signature,
                  String msg)
Writes an info trace message.

Parameters:
signature - Signature of the method
msg - Info message text

infoT

public void infoT(String signature,
                  com.sap.tc.logging.Category category,
                  String msg,
                  Object[] args)
Writes an info trace and log message.

Parameters:
signature - Signature of the method
category - Category of the trace
msg - Can have placeholders of java.text.MessageFormat syntax, in the form of { } to be substituted by the respective arguments
args - Can be single argument but also array of arguments. For collections, their method toArray is used.

infoT

public void infoT(String signature,
                  String msg,
                  Object[] args)
Writes an info trace message.

Parameters:
signature - Signature of the method
msg - Can have placeholders of java.text.MessageFormat syntax in the form of { } to be substituted by the arguments.
args - Can be single argument but also array of arguments. For collections, their method toArray is used.

warningT

public void warningT(String signature,
                     com.sap.tc.logging.Category category,
                     String msg)
Writes an warning trace and log message.

Parameters:
signature - Signature of the method
category - Category of the trace
msg - Can have placeholders of java.text.MessageFormat syntax, in the form of { } to be substituted by the respective arguments

warningT

public void warningT(String signature,
                     String msg)
Writes a warning trace message.

Parameters:
signature - Signature of the method
msg - Warning message text

warningT

public void warningT(String signature,
                     com.sap.tc.logging.Category category,
                     String msg,
                     Object[] args)
Writes a warning trace and log message.

Parameters:
signature - Signature of the method
category - Category of the trace
msg - Can have placeholders of java.text.MessageFormat syntax, in the form of { } to be substituted by the respective arguments
args - Can be single argument but also array of arguments. For collections, their method toArray is used.

warningT

public void warningT(String signature,
                     String msg,
                     Object[] args)
Writes a warning trace message.

Parameters:
signature - Signature of the method
msg - Can have placeholders of java.text.MessageFormat syntax in the form of { } to be substituted by the arguments.
args - Can be single argument but also array of arguments. For collections, their method toArray is used.

errorT

public void errorT(String signature,
                   com.sap.tc.logging.Category category,
                   String msg)
Writes an error trace and log message.

Parameters:
signature - Signature of the method
category - Category of the trace
msg - Can have placeholders of java.text.MessageFormat syntax, in the form of { } to be substituted by the respective arguments

errorT

public void errorT(String signature,
                   String msg)
Writes an error trace message.

Parameters:
signature - Signature of the method
category - Category of the trace
msg - Can have placeholders of java.text.MessageFormat syntax, in the form of { } to be substituted by the respective arguments

errorT

public void errorT(String signature,
                   com.sap.tc.logging.Category category,
                   String msg,
                   Object[] args)
Writes an error trace and log message.

Parameters:
signature - Signature of the method
category - Category of the trace
msg - Can have placeholders of java.text.MessageFormat syntax, in the form of { } to be substituted by the respective arguments
args - Can be single argument but also array of arguments. For collections, their method toArray is used.

errorT

public void errorT(String signature,
                   String msg,
                   Object[] args)
Writes an error trace and log message.

Parameters:
signature - Signature of the method
category - Category of the trace
msg - Can have placeholders of java.text.MessageFormat syntax, in the form of { } to be substituted by the respective arguments
args - Can be single argument but also array of arguments. For collections, their method toArray is used.

fatalT

public void fatalT(String signature,
                   com.sap.tc.logging.Category category,
                   String msg)
Writes a fatal trace and log message.

Parameters:
signature - Signature of the method
category - Category of the trace
msg - Can have placeholders of java.text.MessageFormat syntax, in the form of { } to be substituted by the respective arguments

fatalT

public void fatalT(String signature,
                   String msg)
Writes a fatal trace message.

Parameters:
signature - Signature of the method
category - Category of the trace
msg - Can have placeholders of java.text.MessageFormat syntax, in the form of { } to be substituted by the respective arguments

fatalT

public void fatalT(String signature,
                   com.sap.tc.logging.Category category,
                   String msg,
                   Object[] args)
Writes a fatal trace and log message.

Parameters:
signature - Signature of the method
category - Category of the trace
msg - Can have placeholders of java.text.MessageFormat syntax, in the form of { } to be substituted by the respective arguments
args - Can be single argument but also array of arguments. For collections, their method toArray is used.

fatalT

public void fatalT(String signature,
                   String msg,
                   Object[] args)
Writes a fatal trace message.

Parameters:
signature - Signature of the method
category - Category of the trace
msg - Can have placeholders of java.text.MessageFormat syntax, in the form of { } to be substituted by the respective arguments
args - Can be single argument but also array of arguments. For collections, their method toArray is used.

assertion

public void assertion(String signature,
                      com.sap.tc.logging.Category category,
                      boolean assertion,
                      String msg)
Writes an error trace message if a given condition is false.

Parameters:
signature - Signature of the method
category - Category of the trace
assertion - A true or false condition to be evaluated
msg - Can have placeholders of java.text.MessageFormat syntax, in the form of { } to be substituted by the respective arguments

beLogged

public boolean beLogged(int severity)

This method can be used to avoid unneccessary and unperformant object creation, in cases where debugging is switched off, or the serverity level is lower than the current one. In such cases the parameter object array will still be created and passed into the logging/tracing methods, without beeing used/logged at all.

This method is to be used, if huge byte arrays or streams are being traced. For small objects which implement the toString method it shouldn't be neccessary, to call this method. We suggest the following usage:


 TRACE.infoT(SIGNATURE, Categories.SYSTEM, "Message bytes: {0} ",
     TRACE.beLogged(TRACE.SEVERITY_INFO) ?
     new Object [] {new String(message.getBytes())} :
     null);
 

Parameters:
severity - One of the severity constants in the Trace wrapper class.
Returns:
if a logging/tracing call would currently be logged at the given severity level.

errorT

public void errorT(String SIGNATURE,
                   com.sap.tc.logging.Category category,
                   String messageID,
                   String msg)
Writes an error trace and log message.

Parameters:
SIGNATURE - Signature of the method
category - Category of the trace
messageID - Unique Message ID
msg - Can have placeholders of java.text.MessageFormat syntax, in the form of { } to be substituted by the respective arguments

errorT

public void errorT(String SIGNATURE,
                   String messageID,
                   String msg)
Writes an error trace message.

Parameters:
SIGNATURE - Signature of the method
messageID - Unique Message ID
msg - Can have placeholders of java.text.MessageFormat syntax, in the form of { } to be substituted by the respective arguments

errorT

public void errorT(String SIGNATURE,
                   com.sap.tc.logging.Category category,
                   String messageID,
                   String msg,
                   Object... args)
Writes an error trace and log message.

Parameters:
SIGNATURE - Signature of the method
category - Category of the trace
messageID - Unique Message ID
msg - Can have placeholders of java.text.MessageFormat syntax, in the form of { } to be substituted by the respective arguments
args - Can be single argument but also array of arguments. For collections, their method toArray is used.

errorT

public void errorT(String SIGNATURE,
                   String messageID,
                   String msg,
                   Object... args)
Writes an error trace and log message.

Parameters:
SIGNATURE - Signature of the method
messageID - Unique Message ID
msg - Can have placeholders of java.text.MessageFormat syntax, in the form of { } to be substituted by the respective arguments
args - Can be single argument but also array of arguments. For collections, their method toArray is used.

fatalT

public void fatalT(String SIGNATURE,
                   com.sap.tc.logging.Category category,
                   String messageID,
                   String msg)
Writes a fatal trace and log message.

Parameters:
SIGNATURE - Signature of the method
category - Category of the trace
messageID - Unique Message ID
msg - Can have placeholders of java.text.MessageFormat syntax, in the form of { } to be substituted by the respective arguments

fatalT

public void fatalT(String SIGNATURE,
                   String messageID,
                   String msg)
Writes a fatal trace message.

Parameters:
SIGNATURE - Signature of the method
messageID - Unique Message ID
msg - Can have placeholders of java.text.MessageFormat syntax, in the form of { } to be substituted by the respective arguments

fatalT

public void fatalT(String SIGNATURE,
                   com.sap.tc.logging.Category category,
                   String messageID,
                   String msg,
                   Object... args)
Writes a fatal trace and log message.

Parameters:
SIGNATURE - Signature of the method
category - Category of the trace
messageID - Unique Message ID
msg - Can have placeholders of java.text.MessageFormat syntax, in the form of { } to be substituted by the respective arguments
args - Can be single argument but also array of arguments. For collections, their method toArray is used.

fatalT

public void fatalT(String SIGNATURE,
                   String messageID,
                   String msg,
                   Object... args)
Writes a fatal trace message.

Parameters:
SIGNATURE - Signature of the method
messageID - Unique Message ID
msg - Can have placeholders of java.text.MessageFormat syntax, in the form of { } to be substituted by the respective arguments
args - Can be single argument but also array of arguments. For collections, their method toArray is used.


Copyright © 2012. All Rights Reserved.