|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectome.formats.importer.util.ErrorHandler
public abstract class ErrorHandler
Top of the error handling hierarchy. Will add errors to a queue
which can be sent with sendErrors()
. Subclasses will get
a change to handle all ImportEvent
instances, but should
try not to duplicate handling.
Nested Class Summary | |
---|---|
static class |
ErrorHandler.EXCEPTION_EVENT
|
static class |
ErrorHandler.FILE_EXCEPTION
ErrorHandler.FILE_EXCEPTION s are thrown any time in the context of a particular
file and otherwise unspecified exception takes place. |
static class |
ErrorHandler.INTERNAL_EXCEPTION
|
static class |
ErrorHandler.MISSING_LIBRARY
A ErrorHandler.FILE_EXCEPTION caused specifically by some library (native
or otherwise) not being installed locally. |
static class |
ErrorHandler.UNKNOWN_FORMAT
Unlike FILE_EXECEPTION , UKNOWN_FORMAT does not have a reader
since bio-formats is telling us that it does not know how to handle
the given file. |
static class |
ErrorHandler.UNREADABLE_FILE
Similar to UKNOWN_FORMAT UNREADABLE_FILE specifies that the
file which is being accessed is unreadable (does not exist or canRead
is false), so if the user is specifically saying that the file should
be imported, there may be some underlying issue. |
Field Summary | |
---|---|
protected boolean |
cancelUploads
|
protected ImportConfig |
config
|
protected ArrayList<ErrorContainer> |
errors
|
boolean |
fileUploadErrors
|
protected org.apache.commons.logging.Log |
log
|
protected ArrayList<IObserver> |
observers
|
protected boolean |
sendFiles
|
protected boolean |
sendLogs
|
protected int |
totalErrors
|
Constructor Summary | |
---|---|
ErrorHandler(ImportConfig config)
Initialize |
Method Summary | |
---|---|
protected void |
addError(Throwable error,
File file,
String[] files,
String readerType)
Add detailed error to error container array |
boolean |
addObserver(IObserver object)
Add observer for notification |
protected void |
clearErrors(int index)
|
boolean |
deleteObserver(IObserver object)
Delete observer |
int |
errorCount()
|
protected void |
finishCancelled()
Action to take when finish cancelled |
protected void |
finishComplete()
Action to take when finish completed |
protected void |
finishWithErroredFiles()
Action to take when finish completed but with some errors (For example, missing files) |
static String |
getStackTrace(Throwable throwable)
Return stack trace from throwable |
protected boolean |
isSend(int index)
Check if files need sending at error container index |
void |
notifyObservers(ImportEvent event)
Notify observers of event |
protected void |
onAddError(ErrorContainer errorContainer,
String message)
Action to take on adding an error to container |
protected void |
onCancel()
action to take on cancel |
protected void |
onException(Exception exception)
Action to take on exception |
protected void |
onNotSending(int index,
String serverReply)
|
protected void |
onSending(int index)
|
protected void |
onSent(int index)
|
protected abstract void |
onUpdate(IObservable importLibrary,
ImportEvent event)
abstract on update method |
protected void |
sendErrors()
Send existing errors in ErrorContainer array to server |
void |
update(IObservable observable,
ImportEvent event)
Update observable on event |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final org.apache.commons.logging.Log log
protected final ArrayList<IObserver> observers
protected final ArrayList<ErrorContainer> errors
protected final ImportConfig config
protected boolean cancelUploads
protected boolean sendFiles
protected boolean sendLogs
public boolean fileUploadErrors
protected int totalErrors
Constructor Detail |
---|
public ErrorHandler(ImportConfig config)
config
- Method Detail |
---|
public final void update(IObservable observable, ImportEvent event)
IObserver
update
in interface IObserver
public int errorCount()
protected abstract void onUpdate(IObservable importLibrary, ImportEvent event)
importLibrary
- event
- - importEventprotected void sendErrors()
protected void addError(Throwable error, File file, String[] files, String readerType)
error
- - error thrownfile
- - head file for errorfiles
- - all files in import collectionreaderType
- - reader type supplied from bio-formatsprotected void clearErrors(int index)
public final boolean addObserver(IObserver object)
IObservable
addObserver
in interface IObservable
object
- - observer object
public final boolean deleteObserver(IObserver object)
IObservable
deleteObserver
in interface IObservable
object
- - observer to delete
public final void notifyObservers(ImportEvent event)
IObservable
notifyObservers
in interface IObservable
event
- - event that happenedprotected void onCancel()
protected void onAddError(ErrorContainer errorContainer, String message)
errorContainer
- - error containermessage
- - message string for action (if needed)protected boolean isSend(int index)
index
- - index in error container
protected void onSending(int index)
index
- protected void onSent(int index)
index
- protected void onNotSending(int index, String serverReply)
index
- serverReply
- protected void onException(Exception exception)
exception
- protected void finishCancelled()
protected void finishComplete()
protected void finishWithErroredFiles()
public static String getStackTrace(Throwable throwable)
throwable
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Version: 4.3.3-00d1137e-b2894
Copyright © 2009 The University of Dundee. All Rights Reserved.