The Java Activities can be classes that must implement:
net.arsretia.jawflow.kernel.processmgr.IRunnableActivity
defined as
public
interface IRunnableActivity extends Serializable
{
public
int doWork(InputContext oInput,OutputContext oOutput);
public
void forceQuit();
public
void gracefulStop();
}
The doWork method must return one of the following statuses defined in
net.arsretia.jawflow.objectmodel.IStates
public static final int iACTIVITY_CLOSED = 0x00F0;
public static final int iACTIVITY_CLOSED_ABORTED = 0x0020;
public static final int iACTIVITY_CLOSED_TERMINATED = 0x0040;
public static final int iACTIVITY_CLOSED_COMPLETED = 0x0080;
depending on the end activity status
The forceQuit method must stop the activity immediately.
The gracefulStop method can shutdown cleanly the activity.
A typical doWork method can be:
public
int doWork(InputContext oInput,OutputContext oOutput);
while(boRunning){
// do some important stuff here
}
if(boForcedQuit){
return IStates.iACTIVITY_CLOSED_TERMINATED;
}
if(boCleanShutdown){
return IStates.iACTIVITY_CLOSED_COMPLETED;
}
return IStates.iACTIVITY_CLOSED_COMPLETED;
}
|