use of cbit.vcell.message.local.LocalVCMessageAdapter.LocalVCMessageListener in project vcell by virtualcell.
the class SimulationControllerImpl method stopSimulation.
/**
* This method was created by a SmartGuide.
* @throws JMSException
* @throws AuthenticationException
* @throws DataAccessException
* @throws SQLException
* @throws FileNotFoundException
* @exception java.rmi.RemoteException The exception description.
* @throws VCMessagingException
*/
public void stopSimulation(Simulation simulation) throws FileNotFoundException, SQLException, DataAccessException, AuthenticationException, JMSException, VCMessagingException {
LocalVCMessageListener localVCMessageListener = new LocalVCMessageListener() {
public void onLocalVCMessage(VCDestination destination, VCMessage objectMessage) {
String messageTypeProperty = VCMessagingConstants.MESSAGE_TYPE_PROPERTY;
String stopSimulationValue = MessageConstants.MESSAGE_TYPE_STOPSIMULATION_VALUE;
if (destination == VCellTopic.ClientStatusTopic && objectMessage.getObjectContent() instanceof SimulationJobStatus) {
onClientStatusTopic_SimulationJobStatus(objectMessage);
} else if (destination == VCellTopic.ServiceControlTopic && objectMessage.getStringProperty(messageTypeProperty).equals(stopSimulationValue)) {
onServiceControlTopic_StopSimulation(objectMessage);
} else {
throw new RuntimeException("SimulationControllerImpl.startSimulation().objectMessageListener:: expecting message with SimulationJobStatus to topic " + VCellTopic.ClientStatusTopic.getName() + ": received \"" + objectMessage.show() + "\" on destination \"" + destination + "\"");
}
}
};
LocalVCMessageAdapter vcMessageSession = new LocalVCMessageAdapter(localVCMessageListener);
VCSimulationIdentifier vcSimID = new VCSimulationIdentifier(simulation.getKey(), simulation.getVersion().getOwner());
simulationDispatcherEngine.onStopRequest(vcSimID, localVCellConnection.getUserLoginInfo().getUser(), simulationDatabase, vcMessageSession);
vcMessageSession.deliverAll();
}
use of cbit.vcell.message.local.LocalVCMessageAdapter.LocalVCMessageListener in project vcell by virtualcell.
the class SimulationControllerImpl method startSimulation.
/**
* This method was created by a SmartGuide.
* @exception java.rmi.RemoteException The exception description.
*/
public void startSimulation(Simulation simulation) throws Exception {
LocalVCMessageListener localVCMessageListener = new LocalVCMessageListener() {
public void onLocalVCMessage(VCDestination destination, VCMessage vcMessage) {
if (destination == VCellTopic.ClientStatusTopic && vcMessage.getObjectContent() instanceof SimulationJobStatus) {
onClientStatusTopic_SimulationJobStatus(vcMessage);
} else if (destination == VCellQueue.SimJobQueue && vcMessage.getStringProperty(VCMessagingConstants.MESSAGE_TYPE_PROPERTY).equals(MessageConstants.MESSAGE_TYPE_SIMULATION_JOB_VALUE)) {
onSimJobQueue_SimulationTask(vcMessage);
} else {
throw new RuntimeException("SimulationControllerImpl.startSimulation().objectMessageListener:: expecting object message with SimulationJobStatus to topic " + VCellTopic.ClientStatusTopic.getName() + ": received \"" + vcMessage.show() + "\"");
}
}
};
LocalVCMessageAdapter vcMessageSession = new LocalVCMessageAdapter(localVCMessageListener);
removeSimulationJobStatusListener(localVCellConnection.getMessageCollector());
addSimulationJobStatusListener(localVCellConnection.getMessageCollector());
VCSimulationIdentifier vcSimID = new VCSimulationIdentifier(simulation.getKey(), simulation.getVersion().getOwner());
simulationDispatcherEngine.onStartRequest(vcSimID, localVCellConnection.getUserLoginInfo().getUser(), simulation.getScanCount(), simulationDatabase, vcMessageSession, vcMessageSession);
vcMessageSession.deliverAll();
for (int jobIndex = 0; jobIndex < simulation.getScanCount(); jobIndex++) {
SimulationJobStatus latestSimJobStatus = simulationDatabase.getLatestSimulationJobStatus(simulation.getKey(), jobIndex);
simulationDispatcherEngine.onDispatch(simulation, latestSimJobStatus, simulationDatabase, vcMessageSession);
vcMessageSession.deliverAll();
}
}
use of cbit.vcell.message.local.LocalVCMessageAdapter.LocalVCMessageListener in project vcell by virtualcell.
the class SimulationControllerImpl method onWorkerEvent.
/**
* Insert the method's description here.
* Creation date: (3/11/2004 10:44:18 AM)
* @param newJobStatus cbit.vcell.messaging.db.SimulationJobStatus
* @param progress java.lang.Double
* @param timePoint java.lang.Double
*/
public void onWorkerEvent(WorkerEvent workerEvent) {
try {
LocalVCMessageListener localVCMessageListener = new LocalVCMessageListener() {
public void onLocalVCMessage(VCDestination destination, VCMessage objectMessage) {
if (destination == VCellTopic.ClientStatusTopic && objectMessage.getObjectContent() instanceof SimulationJobStatus) {
onClientStatusTopic_SimulationJobStatus(objectMessage);
} else {
throw new RuntimeException("SimulationControllerImpl.onWorkerEvent().localMessageListener:: expecting object message with SimulationJobStatus to topic " + VCellTopic.ClientStatusTopic.getName() + ": received \"" + objectMessage.show() + "\"");
}
}
};
LocalVCMessageAdapter vcMessageSession = new LocalVCMessageAdapter(localVCMessageListener);
simulationDispatcherEngine.onWorkerEvent(workerEvent, simulationDatabase, vcMessageSession);
vcMessageSession.deliverAll();
} catch (Exception e) {
lg.error(e.getMessage(), e);
}
}
Aggregations