org.opencms.report
Interface I_CmsReport

All Known Implementing Classes:
A_CmsReport

public interface I_CmsReport

This is the interface for the report classes which are used for the output during operations that run on a spearate Thread in OpenCms, like publish, import, export etc.

Since:
6.0.0
Version:
$Revision: 1.26 $
Author:
Alexander Kandzior, Jan Baudisch

Field Summary
static String BUNDLE_NAME
          The name of the property file.
static int FORMAT_DEFAULT
          Indicates default formatting.
static int FORMAT_ERROR
          Indicates error formatting.
static int FORMAT_HEADLINE
          Indicates headline formatting.
static int FORMAT_NOTE
          Indicates note formatting.
static int FORMAT_OK
          Indicates OK formatting.
static int FORMAT_WARNING
          Indicates warning formatting.
static String REPORT_TYPE_EXTENDED
          Request parameter value that this report should create an "extended" output.
static String REPORT_TYPE_SIMPLE
          Request parameter value that this report should create a "simple" output.
 
Method Summary
 void addBundle(String bundleName)
          Adds a bundle specified by it's name to the List of resource bundles.
 void addError(Object obj)
          Adds an error object to the list of errors that occured during the report.
 String formatRuntime()
          Formats the runtime formatted as "hh:mm:ss".
 List getErrors()
          Returns a list of all errors that occured during the report.
 Locale getLocale()
          Returns the locale this report was initialized with.
 String getReportUpdate()
          Updates this report, this processes all new output added since the last call to this method.
 long getRuntime()
          Returns the time this report has been running.
 boolean hasError()
          Returns if the report generated an error output.
 String key(String keyName)
          Gets the localized resource string for a given message key.
 void print(CmsMessageContainer container)
          Prints a localized message to the report.
 void print(CmsMessageContainer container, int format)
          Prints a localized message to the report, using the indicated formatting.
 void println()
          Adds a line break to the report.
 void println(CmsMessageContainer container)
          Prints a localized message to the report.
 void println(CmsMessageContainer container, int format)
          Prints a localized message to the report, using the indicated formatting.
 void println(Throwable t)
          Adds an Exception to the report, ensuring that the Exception content is processed to generate a valid output esp.
 void printMessageWithParam(CmsMessageContainer container, Object param)
          Prints a localized message followed by a parametera and dots to the report.
 void printMessageWithParam(int m, int n, CmsMessageContainer container, Object param)
          Convenience method to print a localized message, followed by a parameter and dots to the report.
 void resetRuntime()
          Resets the runtime to 0 milliseconds.
 

Field Detail

BUNDLE_NAME

public static final String BUNDLE_NAME
The name of the property file.

See Also:
Constant Field Values

FORMAT_DEFAULT

public static final int FORMAT_DEFAULT
Indicates default formatting.

See Also:
Constant Field Values

FORMAT_ERROR

public static final int FORMAT_ERROR
Indicates error formatting.

See Also:
Constant Field Values

FORMAT_HEADLINE

public static final int FORMAT_HEADLINE
Indicates headline formatting.

See Also:
Constant Field Values

FORMAT_NOTE

public static final int FORMAT_NOTE
Indicates note formatting.

See Also:
Constant Field Values

FORMAT_OK

public static final int FORMAT_OK
Indicates OK formatting.

See Also:
Constant Field Values

FORMAT_WARNING

public static final int FORMAT_WARNING
Indicates warning formatting.

See Also:
Constant Field Values

REPORT_TYPE_EXTENDED

public static final String REPORT_TYPE_EXTENDED
Request parameter value that this report should create an "extended" output.

See Also:
Constant Field Values

REPORT_TYPE_SIMPLE

public static final String REPORT_TYPE_SIMPLE
Request parameter value that this report should create a "simple" output.

See Also:
Constant Field Values
Method Detail

addBundle

public void addBundle(String bundleName)
Adds a bundle specified by it's name to the List of resource bundles.

Parameters:
bundleName - the name of the resource bundle with localized strings

addError

public void addError(Object obj)
Adds an error object to the list of errors that occured during the report.

Parameters:
obj - the error object

formatRuntime

public String formatRuntime()
Formats the runtime formatted as "hh:mm:ss".

Returns:
the runtime formatted as "hh:mm:ss"

getErrors

public List getErrors()
Returns a list of all errors that occured during the report.

Returns:
an error list that occured during the report

getLocale

public Locale getLocale()
Returns the locale this report was initialized with.

Returns:
the locale this report was initialized with

getReportUpdate

public String getReportUpdate()
Updates this report, this processes all new output added since the last call to this method.

This is only required in case the output is written to a HTML page, if the shell output is used, this will just return an empty String.

Returns:
new elements that have been added to the report and not yet processed.

getRuntime

public long getRuntime()
Returns the time this report has been running.

Returns:
the time this report has been running

hasError

public boolean hasError()
Returns if the report generated an error output.

Returns:
true if the report generated an error, otherwise false

key

public String key(String keyName)
Gets the localized resource string for a given message key.

The internal implementation should be passing the keyName to the class CmsMessages.

Parameters:
keyName - the key for the desired string
Returns:
the resource string for the given key
See Also:
CmsMessages.key(String)

print

public void print(CmsMessageContainer container)
Prints a localized message to the report.

Parameters:
container - the String to add

print

public void print(CmsMessageContainer container,
                  int format)
Prints a localized message to the report, using the indicated formatting.

Use the contants starting with FORMAT from this interface to indicate which formatting to use.

Parameters:
container - the String to add
format - the formatting to use for the output

println

public void println()
Adds a line break to the report.


println

public void println(CmsMessageContainer container)
Prints a localized message to the report.

Parameters:
container - the message container to add

println

public void println(CmsMessageContainer container,
                    int format)
Prints a localized message to the report, using the indicated formatting.

Use the contants starting with FORMAT from this interface to indicate which formatting to use.

Parameters:
container - the message container to add
format - the formatting to use for the output

println

public void println(Throwable t)
Adds an Exception to the report, ensuring that the Exception content is processed to generate a valid output esp. for HTML pages.

The exception will be stored and the output will later be processed in a special way.

Parameters:
t - the exception to add

printMessageWithParam

public void printMessageWithParam(CmsMessageContainer container,
                                  Object param)
Prints a localized message followed by a parametera and dots to the report.

Parameters:
container - the Message to add
param - the Parameter to add

printMessageWithParam

public void printMessageWithParam(int m,
                                  int n,
                                  CmsMessageContainer container,
                                  Object param)
Convenience method to print a localized message, followed by a parameter and dots to the report.

The output follows the pattern: ( 3 / 8 ) Deleting filename.txt ...

Parameters:
m - the number of the report output
n - the total number of report outputs
container - the Message to add
param - the Parameter to add

resetRuntime

public void resetRuntime()
Resets the runtime to 0 milliseconds.