public abstract class AbstractSynchronizableOperation extends java.lang.Object implements IOperation
AbstractSynchronizableOperation
implements all necessary
members from it's super class IOperation
and provides the possibility
to notify all registered listeners in a thread-safe manner.
All delegates will be called from the thread, which creates this operation.
So the execution itself can run asynchronously. To reach this goal, the
operation holds an internally created nUIObject
and fires events by
using nUIController.eventListenerQueue(nUIObject, int)
.
Subclasses must call fireEvent(int)
to synchronized notify all
delegates. Possible arguments are OperationNotifier.FINISHED
and
OperationNotifier.FAILED
correspondent to the methods described by
IOperationDelegate
.
Subclasses must override internalExecute()
.
Constructor and Description |
---|
AbstractSynchronizableOperation() |
Modifier and Type | Method and Description |
---|---|
void |
addOperationDelegate(IOperationDelegate delegate)
Adds the delivered
IOperationDelegate . |
void |
execute()
Executes this operation.
|
byte[] |
getRawResult()
Returns the
result as an byte -array. |
java.lang.String |
getResult()
Returns the
result as a String . |
java.lang.String |
getResult(java.lang.String encoding)
Returns the
result as a String with s specific
encoding. |
int |
getResultCode()
Returns the
resultCode as an int -value. |
void |
removeOperationDelegate(IOperationDelegate delegate)
Removes the delivered
IOperationDelegate . |
public final int getResultCode()
IOperation
resultCode
as an int
-value.getResultCode
in interface IOperation
public void execute()
IOperation
execute
in interface IOperation
public final java.lang.String getResult()
IOperation
result
as a String
. byte
-result from IOperation.getRawResult()
into
a String
by using UTF-8 as encoding. Call
IOperation.getResult(String)
under the hood.getResult
in interface IOperation
IOperation.getResult(String)
public java.lang.String getResult(java.lang.String encoding) throws java.io.UnsupportedEncodingException
IOperation
result
as a String
with s specific
encoding.getResult
in interface IOperation
java.io.UnsupportedEncodingException
public byte[] getRawResult()
IOperation
result
as an byte
-array.getRawResult
in interface IOperation
public void addOperationDelegate(IOperationDelegate delegate)
IOperation
IOperationDelegate
.addOperationDelegate
in interface IOperation
public void removeOperationDelegate(IOperationDelegate delegate)
IOperation
IOperationDelegate
.removeOperationDelegate
in interface IOperation