sam.ui
Class ErrorInterface

java.lang.Object
  |
  +--sam.ui.ErrorInterface

public abstract class ErrorInterface
extends java.lang.Object

Abstract error interface


Constructor Summary
ErrorInterface()
           
 
Method Summary
 void fail(java.lang.String message)
          Aborts the program.
 void fail(java.lang.String message, java.lang.Throwable error)
          Aborts the program due to specified Throwable.
 void fail(java.lang.Throwable error)
          Aborts the program due to specified Throwable.
protected abstract  void failure(java.lang.String message)
           
abstract  void handleException(java.lang.String message, java.lang.Throwable e)
          Attempts to handle specified exception.
abstract  void incompatibleArchiveLayout(int version)
          Called whenever an archive of incompatible layout version is submitted for extraction.
 void test()
          Simple test code.
abstract  void unhandledParameter(java.lang.String parameter)
          Called in case of an unhandled parameter being parsed from command-line.
abstract  void warn(java.lang.String message)
          Warns the user about a dangerous, possibly inconsistant or unusal event.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ErrorInterface

public ErrorInterface()
Method Detail

unhandledParameter

public abstract void unhandledParameter(java.lang.String parameter)
Called in case of an unhandled parameter being parsed from command-line. This could either ignore it (and warns the user about that) through the warn method or fail through the fail method. Note that it is not possible to handle the parameter (e.g. setting adequate value into ModusOperandi>/CODE>) since this would be a design mistake.


incompatibleArchiveLayout

public abstract void incompatibleArchiveLayout(int version)
Called whenever an archive of incompatible layout version is submitted for extraction. This could either ignore the problem (and warns the user about that) through the warn method or fail through the fail method. Note that attempts to continue extraction are subjects to subsequent errors as long as the layout versioning is what it is meant to be. A conservative workaround is to always use the included runtime of the archive (which is by construction up-to-date) instead of external binaries.


handleException

public abstract void handleException(java.lang.String message,
                                     java.lang.Throwable e)
Attempts to handle specified exception. Note that this might default to failing through the fail methods. However the program is expected to pursue its execution as the exception is not believed to be fatal.


warn

public abstract void warn(java.lang.String message)
Warns the user about a dangerous, possibly inconsistant or unusal event.


failure

protected abstract void failure(java.lang.String message)
                         throws UserInterface.Abort
Throws:
Abort - whenever the whole program should abort.
UserInterface.Abort

fail

public final void fail(java.lang.Throwable error)
                throws UserInterface.Abort
Aborts the program due to specified Throwable. Note that aborting is implemented through exception throwing rather than abrupt VM interruption (aka System.exit()) for obvious reasons.

Parameters:
error - the Throwable that caused the fatal error
UserInterface.Abort

fail

public final void fail(java.lang.String message,
                       java.lang.Throwable error)
                throws UserInterface.Abort
Aborts the program due to specified Throwable. Note that aborting is implemented through exception throwing rather than abrupt VM interruption (aka System.exit()) for obvious reasons.

Parameters:
message - a human-readable explanation of the error This might include a workaround suggestion
error - the Throwable that caused the fatal error
UserInterface.Abort

fail

public final void fail(java.lang.String message)
                throws UserInterface.Abort
Aborts the program. Note that aborting is implemented through exception throwing rather than abrupt VM interruption (aka System.exit()) for obvious reasons.

Parameters:
message - a human-readable explanation of the error This might include a workaround suggestion
UserInterface.Abort

test

public void test()
Simple test code.