net.haefelingerit.tagmod
Class Static

java.lang.Object
  extended by net.haefelingerit.tagmod.Static

public class Static
extends Object

This class contains static methods only. The class - as such - has no particular meaning and represents nothing.

Author:
geronimo

Field Summary
protected static Logger log
          A logger for all classes in this package.
 
Constructor Summary
Static()
           
 
Method Summary
static void close(InputStream s)
          A method to close an input stream without throwing an exception.
static void close(OutputStream s)
          A method to close an output stream without throwing an exception.
static void close(Reader r)
          A method to close a reader without throwing an exception.
static void close(Writer w)
          A method to close a writer without throwing an exception.
protected static void debug(String msg)
          A function to log a message.
protected static void error(String msg)
          A function to log a message.
protected static void error(String msg, Exception e)
          A function to log a message.
protected static void fatal(String msg)
          A function to log a message.
protected static void fatal(String msg, Exception e)
          A function to log a message.
protected static void info(String msg)
          A function to log a message.
protected static void log(String msg)
          A function to log a message.
static SimpleDateFormat mkdatefmt()
          Returns a SimpleDateFormat suitable to parse a date string.
protected static void throwx(String msg)
          A function to throw an CruiseControl exception.
static String trim(String s, String otherwise)
          A method to trim - remove leading and trailing whitespace - a string.
protected static void warn(String msg)
          A function to log a message.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static Logger log
A logger for all classes in this package.

Use something like

 log4j.logger.net.haefelingerit.tagmod = DEBUG
 
to turn on debugging in your log4j configuration file.

Constructor Detail

Static

public Static()
Method Detail

trim

public static String trim(String s,
                          String otherwise)
A method to trim - remove leading and trailing whitespace - a string. If the argument s is null or if the trimmed value becomes empty, then the second argument otherwise gets returned.

Parameters:
s - (can be null)
otherwise - (can be null)
Returns:
s.trim() or otherwise

close

public static void close(Writer w)
A method to close a writer without throwing an exception. Use this method if as shortcut if you don't care about exceptions on closing a writer. Notice that the exception will be logged using log level DEBUG
Parameters:
w - (can be null)

close

public static void close(Reader r)
A method to close a reader without throwing an exception. Use this method if as shortcut if you don't care about exceptions on closing a reader. Notice that the exception will be logged using log level DEBUG
Parameters:
r - (can be null)

close

public static void close(InputStream s)
A method to close an input stream without throwing an exception. Use this method if as shortcut if you don't care about exceptions on closing an input stream. Notice that the exception will be logged using log level DEBUG
Parameters:
s - (can be null)

close

public static void close(OutputStream s)
A method to close an output stream without throwing an exception. Use this method if as shortcut if you don't care about exceptions on closing an output stream. Notice that the exception will be logged using log level DEBUG
Parameters:
s - (can be null)

log

protected static void log(String msg)
A function to log a message. Same as log.info(msg). See also log4j for further details.

Parameters:
msg -

info

protected static void info(String msg)
A function to log a message. Same as log.info(msg). See also log4j for further details.

Parameters:
msg -

debug

protected static void debug(String msg)
A function to log a message. Same as log.debug(msg). See also log4j for further details.

Parameters:
msg -

error

protected static void error(String msg)
A function to log a message. Same as log.error(msg). See also log4j for further details.

Parameters:
msg -

warn

protected static void warn(String msg)
A function to log a message. Same as log.warn(msg). See also log4j for further details.

Parameters:
msg -

error

protected static void error(String msg,
                            Exception e)
A function to log a message. Same as log.error(msg). See also log4j for further details.

Parameters:
msg -

fatal

protected static void fatal(String msg)
A function to log a message. Same as log.fatal(msg). See also log4j for further details.

Parameters:
msg -

fatal

protected static void fatal(String msg,
                            Exception e)
A function to log a message. Same as log.fatal(msg). See also log4j for further details.

Parameters:
msg -

throwx

protected static void throwx(String msg)
                      throws CruiseControlException
A function to throw an CruiseControl exception. Same as throw new CruiseControlException(msg)

Parameters:
msg - (not null)
Throws:
CruiseControlException

mkdatefmt

public static SimpleDateFormat mkdatefmt()
Returns a SimpleDateFormat suitable to parse a date string. T

The format accepted will be yyyy-MM-dd HH:mm:ss UTC. Such a date string is generated by tag handler script as log entry once a tag got assigned. Note that this format is not the format CVS is using for its date lines.

This function does not implement a singleton. Hence, each call returns a new date format object.

See also SimpleDateFormat for further formatting details.

Returns:
the date format instance.


Copyright © 2009. All Rights Reserved.