content = msg.getContent();
updateQosLiteral = msg.getQos();
}
// parse XML key and QoS
UpdateKey updateKey = null;
UpdateQos updateQos = null;
try {
updateKey = new UpdateKey(glob, updateKeyLiteral);
//updateKey.init(updateKeyLiteral); // does the parsing
updateQos = new UpdateQos(glob, updateQosLiteral); // does the parsing
}
catch (XmlBlasterException e) {
log.severe("Parsing error: " + e.toString());
throw new XmlBlasterException(glob, ErrorCode.USER_UPDATE_ILLEGALARGUMENT, ME+".update", "Parsing error", e);
}
// invoke client code
try {
// Now we know all about the received message, dump it or do some checks
/*
if (log.isLoggable(Level.FINEST)) log.dump(ME+".UpdateKey", "\n" + updateKey.toXml());
if (log.isLoggable(Level.FINEST)) log.dump(ME+".content", "\n" + new String(content));
if (log.isLoggable(Level.FINEST)) log.dump(ME+".UpdateQos", "\n" + updateQos.toXml());
*/
if (log.isLoggable(Level.FINE)) log.fine("Received message [" + updateKey.getOid() + "] from publisher " + updateQos.getSender());
String ret = update(cbSessionId, updateKey, content, updateQos);
DispatchStatistic statistic = getDispatchStatistic();
if (statistic != null) statistic.incrNumUpdate(1);
// export (encrypt) return value
if (secPlgn != null) {
MsgUnitRaw msg = new MsgUnitRaw(null, (byte[])null, ret);
CryptDataHolder dataHolder = new CryptDataHolder(MethodName.UPDATE, msg, null);
dataHolder.setReturnValue(true);
ret = secPlgn.exportMessage(dataHolder).getQos();
}
return ret;
}
catch (XmlBlasterException e) {
throw e;
}
catch (Throwable e) {
e.printStackTrace();
log.warning("Error in client user code of update("+
((updateKey!=null)?updateKey.getOid():"")+
((updateQos!=null)?", "+updateQos.getRcvTime():"")+
"): " + e.toString());
throw new XmlBlasterException(glob, ErrorCode.USER_UPDATE_INTERNALERROR, ME+".update", "Error in client code, please check your clients update() implementation.", e);
}
}