public class DefaultReshapeListener extends Object implements ReshapeListener
A simple ReshapeListener
the logs the progress of the ReshapeWorker
.
In order not to flood the logging files the more pages a document has the less progress is logged. The progress is logged only if one the two conditions is met:
ReshapeListener.Context
Modifier and Type | Field and Description |
---|---|
static long |
DEFAULT_MINIMUM_LOG_INTERVAL
The default minimum interval in which the logging shall be performed.
|
Constructor and Description |
---|
DefaultReshapeListener() |
Modifier and Type | Method and Description |
---|---|
void |
done(ReshapeListener.Context context)
Called each time a reshape process is successfully completed.
|
void |
failed(ReshapeListener.Context context,
Exception cause)
Called each time a reshape process is unsuccessfully terminated.
|
long |
getLogInterval() |
protected static boolean |
isRelevantIndex(int idx)
Check if a page index is relevant for logging.
|
void |
pageDone(ReshapeListener.Context context,
com.levigo.jadice.document.Page page)
Called each time a reshape process successfully finishes reshaping a
Page . |
void |
pageFailed(ReshapeListener.Context context,
com.levigo.jadice.document.Page page,
Exception cause)
Called each time a reshape process unsuccessfully terminates reshaping a
Page . |
void |
pageStarted(ReshapeListener.Context ctx,
com.levigo.jadice.document.Page page)
Called each time a reshape process starts reshaping a
Page . |
void |
setLogInterval(long logInterval)
Set the minimum time interval for which the logging events shall be generated.
|
void |
started(ReshapeListener.Context context)
Called when a reshape process is started.
|
public static final long DEFAULT_MINIMUM_LOG_INTERVAL
public void pageStarted(ReshapeListener.Context ctx, com.levigo.jadice.document.Page page)
ReshapeListener
Page
.pageStarted
in interface ReshapeListener
ctx
- the ReshapeListener.Context
of this actionpage
- the current page being reshapedprotected static boolean isRelevantIndex(int idx)
Check if a page index is relevant for logging.
This algorithm uses a logarithmic threshold, i.e.
idx
- the page indextrue
iff the given index is relevantpublic long getLogInterval()
public void setLogInterval(long logInterval)
logInterval
- public void started(ReshapeListener.Context context)
ReshapeListener
started
in interface ReshapeListener
context
- the ReshapeListener.Context
of this actionpublic void done(ReshapeListener.Context context)
ReshapeListener
done
in interface ReshapeListener
context
- the ReshapeListener.Context
of this actionpublic void failed(ReshapeListener.Context context, Exception cause)
ReshapeListener
failed
in interface ReshapeListener
context
- the ReshapeListener.Context
of this actioncause
- gives the reason for the unsuccessful terminationpublic void pageDone(ReshapeListener.Context context, com.levigo.jadice.document.Page page)
ReshapeListener
Page
.pageDone
in interface ReshapeListener
context
- the ReshapeListener.Context
of this actionpage
- the page being reshapedpublic void pageFailed(ReshapeListener.Context context, com.levigo.jadice.document.Page page, Exception cause)
ReshapeListener
Page
.pageFailed
in interface ReshapeListener
context
- the ReshapeListener.Context
of this actionpage
- the page being reshapedcause
- gives the reason for the unsuccessful terminationCopyright © 2017 levigo holding gmbh. All rights reserved.