public RunInformation initializeSimulationRun(
SimulationRunConfiguration config, String simName,
List<ISimulationHost> bookedResources) throws RemoteException {
RunInformation result = new RunInformation(config);
ISimulationRun simulation;
// create the model reader
IModelReader modelReader = null;
ModelReaderFactory modelReaderFactory =
SimSystem.getRegistry().getFactory(AbstractModelReaderFactory.class,
config.getAbsModelReaderFactoryParams());
modelReader = modelReaderFactory.create(config.getModelReaderParams(), SimSystem.getRegistry().createContext());
// IDataStorage ds = config.createDataStorage(simID.id);
// Create list of all available resources (including this one)
// FIXME: Ensure that all bookedResources are instances of ISimulationServer
List<ISimulationServer> simResources = new ArrayList<>();
simResources.add(this);
if (bookedResources != null) {
for (ISimulationHost simHost : bookedResources) {
simResources.add((ISimulationServer) simHost);
}
}
IInitializedComputationTask initTask =
ComputationTaskHandler.initComputationTask(config, modelReader, result,
simResources.size() == 1 ? null : simResources);
// FIXME (the cast should not be here, i.e., the server needs to maintain a
// list of tasks and not of simruns!)
simulation = (ISimulationRun) initTask.getComputationTask();
simulation.setName(simName);
getTaskManager().addComputationTask(simulation, config);
// result.setSimulationUID(simulation.getUid());
return result;