Java Reference
In-Depth Information
30.
"RetrieveStatsDS", NamedObject.physicalDataSet);
31.
}
32.
return null;
33.}
Line 2 checks if the
PhysicalDataSet
named
RetrieveStatsDS
exists
in the MOR. If it does, we retrieve the
PhysicalDataSet
and check that
its URI is the same as the one of the current console, which is stored
in the member variable
mBuildData
. If so, we return the restored
PhysicalDataSet
that should contain statistical information from a
previous execution of the
ComputeStatisticsTask
object.
When the
PhysicalDataSet
called
RetrieveStatsDS
does not match,
we save a new version of the
PhysicalDataSet
named
RetrieveStatsDS
in the repository (note the last argument on line 14 overwrites any
previous version). We then create the
ComputeStatisticsTask
associ-
ated with this dataset and save, verify, and execute. Note that the
PhysicalDataSet
was saved before task creation because the
Compute-
StatisticsTaskFactory
needs a named
PhysicalDataSet,
as shown in line
16. When the task successfully completes, it saves a new version of
this
PhysicalDataSet
with the statistical information.
In JDM, vendors are required to support synchronous execution;
while asynchronous execution is optional. We have chosen to illustrate
asynchronous execution for our tool examples. We monitor task exe-
cution using the method
monitorTaskExecution
for all tasks executed
from the
JDMConsole
. The code for this method is provided here:
1. protected boolean monitorTaskExecution(ExecutionHandle iExecHandle)
2.
throws JDMException {
3.
ExecutionState lState
iExecHandle.getLatestStatus().getState();
4.
boolean lIsTerminated
false;
5.
while (!lIsTerminated) {
6.
lState
iExecHandle.getLatestStatus().getState();
7.
lIsTerminated
(lState.equals(ExecutionState.success)
8.
|| lState.equals(ExecutionState.error));
9.
try {
10.
Thread.sleep(100);
11.
} catch (InterruptedException lException) {
12.
JOptionPane.showMessageDialog(this,
13.
"InterruptedException Occured: "
14.
lException.getMessage());
15.
}
16.
}
17.
return lState.equals(ExecutionState.success);
18.}
Search WWH ::
Custom Search