se.biltmore.tools.odttoapt.maven.plugin
Class Failure

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by java.lang.RuntimeException
              extended by se.biltmore.tools.odttoapt.maven.plugin.Failure
All Implemented Interfaces:
Serializable

public class Failure
extends RuntimeException

This is a special class handling failures, and handling them differently depending on configuration.

See Also:
Serialized Form

Nested Class Summary
private static class Failure.ThreadInstance
          Provides a thread safe instance of the failure handler.
 
Field Summary
private  boolean dontFail
          When true we only display warnings, otherwise and exceptions is thrown.
private  PrintStream failStream
          The stream to write failure messages to.
private static Failure.ThreadInstance failureHandlerWrapper
          The handler instance of this class hung on the local thread.
 
Constructor Summary
private Failure()
          Creates a new Failure instance.
private Failure(String message)
          Creates a new Failure instance.
private Failure(String message, Exception cause)
          Creates a new Failure instance.
 
Method Summary
private  void _fail(String message)
          Handles a failure.
private  void _fail(String message, Exception cause)
          Handles a failure.
private  void _warn(String message)
          Displays a warning message.
static void fail(String message)
          Hanldes a failure.
static void fail(String message, Exception cause)
          Handles a failure.
static void initialize(boolean dontFail, OutputStream failStream)
          Initialized the failure handler.
private  void setDontFail(boolean dontFail)
          Sets the dont fail parameter.
private  void setFailStream(PrintStream failStream)
          Sets the stream to write failure messages on.
static void warn(String message)
          Displays a warning message.
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

dontFail

private boolean dontFail
When true we only display warnings, otherwise and exceptions is thrown.


failStream

private PrintStream failStream
The stream to write failure messages to.


failureHandlerWrapper

private static Failure.ThreadInstance failureHandlerWrapper
The handler instance of this class hung on the local thread.

Constructor Detail

Failure

private Failure()
Creates a new Failure instance.


Failure

private Failure(String message)
Creates a new Failure instance.

Parameters:
messgae - The failure message.

Failure

private Failure(String message,
                Exception cause)
Creates a new Failure instance.

Parameters:
message - The failure message
cause - The cause of the failure.
Method Detail

setDontFail

private void setDontFail(boolean dontFail)
Sets the dont fail parameter.

Parameters:
dontFail - The value to set.

setFailStream

private void setFailStream(PrintStream failStream)
Sets the stream to write failure messages on.

Parameters:
failStream - The stream to set.

_fail

private void _fail(String message)
            throws Failure
Handles a failure.

Parameters:
message - The failure message.
Throws:
Failure - unless dontFail is true.

_fail

private void _fail(String message,
                   Exception cause)
            throws Failure
Handles a failure.

Parameters:
message - The failure message.
cause - The cause of the failure.
Throws:
Failure - unless dontFail is true.

_warn

private void _warn(String message)
Displays a warning message.

Parameters:
message - The warning message to display.

initialize

public static void initialize(boolean dontFail,
                              OutputStream failStream)
Initialized the failure handler.

Parameters:
dontFail - true will only display a message without breaking the build.
failStream - The stream to write failure messages on.

fail

public static void fail(String message)
Hanldes a failure.

Parameters:
message - The failure message.

fail

public static void fail(String message,
                        Exception cause)
Handles a failure.

Parameters:
message - The failure message.
cause - The cause of the failure.

warn

public static void warn(String message)
Displays a warning message.

Parameters:
message - The warning message to display.


Copyright © 2009-2010 Biltmore Group AB. All Rights Reserved.