public abstract class ErrorHandler extends java.lang.Object implements IObserver, IObservable
sendErrors()
. Subclasses will get
a change to handle all ImportEvent
instances, but should
try not to duplicate handling.修飾子とタイプ | クラスと説明 |
---|---|
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
ErrorHandler.FILE_EXCEPTION , UNKNOWN_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
ErrorHandler.UNKNOWN_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. |
修飾子とタイプ | フィールドと説明 |
---|---|
protected boolean |
cancelUploads |
protected ImportConfig |
config |
protected java.util.ArrayList<ErrorContainer> |
errors |
boolean |
fileUploadErrors |
protected org.slf4j.Logger |
log |
protected java.util.ArrayList<IObserver> |
observers |
protected boolean |
sendFiles |
protected boolean |
sendLogs |
protected int |
totalErrors |
コンストラクタと説明 |
---|
ErrorHandler(ImportConfig config)
Initialize
|
修飾子とタイプ | メソッドと説明 |
---|---|
protected void |
addError(java.lang.Throwable error,
java.io.File file,
java.lang.String[] files,
java.lang.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() |
void |
executePost(java.lang.String sendUrl,
java.util.List<org.apache.commons.httpclient.methods.multipart.Part> postList)
Execute a post with the given post list.
|
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 java.lang.String |
getStackTrace(java.lang.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,
java.lang.String message)
Action to take on adding an error to container
|
protected void |
onCancel()
action to take on cancel
|
protected void |
onException(java.lang.Exception exception)
Action to take on exception
|
protected void |
onNotSending(int index,
java.lang.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
|
void |
uploadFile(ErrorContainer errorContainer)
Upload a single
ErrorContainer . |
protected final org.slf4j.Logger log
protected final java.util.ArrayList<IObserver> observers
protected final java.util.ArrayList<ErrorContainer> errors
protected final ImportConfig config
protected boolean cancelUploads
protected boolean sendFiles
protected boolean sendLogs
public boolean fileUploadErrors
protected int totalErrors
public ErrorHandler(ImportConfig config)
config
- public final void update(IObservable observable, ImportEvent event)
IObserver
public int errorCount()
protected abstract void onUpdate(IObservable importLibrary, ImportEvent event)
importLibrary
- event
- - importEventprotected void sendErrors()
public void executePost(java.lang.String sendUrl, java.util.List<org.apache.commons.httpclient.methods.multipart.Part> postList) throws HtmlMessengerException
sendUrl
- postList
- HtmlMessengerException
public void uploadFile(ErrorContainer errorContainer)
ErrorContainer
. This can be overwritten in order
to test error handling without touching QA.errorContainer
- protected void addError(java.lang.Throwable error, java.io.File file, java.lang.String[] files, java.lang.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
インタフェース内 IObservable
object
- - observer objectpublic final boolean deleteObserver(IObserver object)
IObservable
deleteObserver
インタフェース内 IObservable
object
- - observer to deletepublic final void notifyObservers(ImportEvent event)
IObservable
notifyObservers
インタフェース内 IObservable
event
- - event that happenedprotected void onCancel()
protected void onAddError(ErrorContainer errorContainer, java.lang.String message)
errorContainer
- - error containermessage
- - message string for action (if needed)protected boolean isSend(int index)
index
- - index in error containerprotected void onSending(int index)
index
- protected void onSent(int index)
index
- protected void onNotSending(int index, java.lang.String serverReply)
index
- serverReply
- protected void onException(java.lang.Exception exception)
exception
- protected void finishCancelled()
protected void finishComplete()
protected void finishWithErroredFiles()
public static java.lang.String getStackTrace(java.lang.Throwable throwable)
throwable
-