use of cbit.rmi.event.MessageData in project vcell by virtualcell.
the class ClientTopicMessageCollector method onTopicMessage.
/**
* Insert the method's description here.
* Creation date: (10/23/2001 3:58:52 PM)
* @param message javax.jms.Message
* @throws VCMessagingException
*/
public void onTopicMessage(VCMessage message, VCMessageSession session) {
if (message == null) {
return;
}
try {
if (message.getObjectContent() == null) {
throw new Exception(this.getClass().getName() + ".onTopicMessage: unimplemented message class " + message.show());
}
setTimeSinceLastMessage(System.currentTimeMillis());
String msgType = message.getStringProperty(VCMessagingConstants.MESSAGE_TYPE_PROPERTY);
if (msgType == null) {
throw new Exception(this.getClass().getName() + ".onTopicMessage: message type NULL for message " + message);
}
if (msgType.equals(MessageConstants.MESSAGE_TYPE_SIMSTATUS_VALUE)) {
String messageUserName = message.getStringProperty(VCMessagingConstants.USERNAME_PROPERTY);
StatusMessage statusMessage = new StatusMessage(message);
String userName = VCMessagingConstants.USERNAME_PROPERTY_VALUE_ALL;
if (message.propertyExists(VCMessagingConstants.USERNAME_PROPERTY)) {
userName = message.getStringProperty(VCMessagingConstants.USERNAME_PROPERTY);
}
SimulationJobStatus newJobStatus = statusMessage.getJobStatus();
if (newJobStatus == null) {
return;
}
VCSimulationIdentifier vcSimID = newJobStatus.getVCSimulationIdentifier();
Double progress = statusMessage.getProgress();
Double timePoint = statusMessage.getTimePoint();
fireSimulationJobStatusEvent(new SimulationJobStatusEvent(this, vcSimID.getID(), newJobStatus, progress, timePoint, messageUserName));
} else if (msgType.equals(MessageConstants.MESSAGE_TYPE_EXPORT_EVENT_VALUE)) {
String messageUserName = message.getStringProperty(VCMessagingConstants.USERNAME_PROPERTY);
ExportEvent event = (ExportEvent) message.getObjectContent();
fireExportEvent(event);
} else if (msgType.equals(MessageConstants.MESSAGE_TYPE_DATA_EVENT_VALUE)) {
String messageUserName = message.getStringProperty(VCMessagingConstants.USERNAME_PROPERTY);
DataJobEvent event = (DataJobEvent) message.getObjectContent();
fireMessageEvent(event);
} else if (msgType.equals(MessageConstants.MESSAGE_TYPE_BROADCASTMESSAGE_VALUE)) {
String messageUserName = message.getStringProperty(VCMessagingConstants.USERNAME_PROPERTY);
fireMessageEvent(new VCellMessageEvent(this, System.currentTimeMillis() + "", new MessageData((BigString) message.getObjectContent()), VCellMessageEvent.VCELL_MESSAGEEVENT_TYPE_BROADCAST, messageUserName));
} else {
throw new Exception(this.getClass().getName() + ".onControlTopicMessage: Unimplemented message " + message.show());
}
} catch (Exception e) {
e.printStackTrace();
lg.error(e.getMessage(), e);
}
}
Aggregations