*/
public String update(String cbSessionId, String updateKeyLiteral, byte[] content,
String updateQosLiteral) throws XmlBlasterException
{
// import (decrypt) message
I_ClientPlugin secPlgn = getSecurityPlugin();
if (secPlgn != null) {
MsgUnitRaw in = new MsgUnitRaw(updateKeyLiteral, content, updateQosLiteral);
CryptDataHolder dataHolder = new CryptDataHolder(MethodName.UPDATE, in, null);
MsgUnitRaw msg = secPlgn.importMessage(dataHolder);
updateKeyLiteral = msg.getKey();
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) {