if (log.isLoggable(Level.FINE)) log.fine("storageId=" + storageId + ": Read timestamp=" + timestamp + " topic keyOid=" + keyOid +
" msgUnitWrapperUniqueId=" + msgUnitWrapperUniqueId + " receiverStr=" + receiverStr +
" subscriptionId=" + subscriptionId + " flag=" + flag + " redeliverCount=" + redeliverCount);
SessionName receiver = new SessionName(glob, receiverStr);
Timestamp updateEntryTimestamp = new Timestamp(timestamp);
return new MsgQueueUpdateEntry(this.glob,
PriorityEnum.toPriorityEnum(priority), storageId, updateEntryTimestamp,
keyOid, msgUnitWrapperUniqueId.longValue(), persistent, sizeInBytes,
receiver, subscriptionId, flag, redeliverCount.intValue(),
qos, key, content);
}
catch (Exception ex) {
throw new XmlBlasterException(glob, ErrorCode.INTERNAL_UNKNOWN, ME, "createEntry-MsgQueueUpdateEntry", ex);
}
}
else if (ENTRY_TYPE_HISTORY_REF.equalsIgnoreCase(type)) { // still used
try {
ObjectInputStream objStream = new ObjectInputStream(is);
Object[] obj = (Object[])objStream.readObject();
if (obj.length < 2) {
throw new XmlBlasterException(glob, ErrorCode.INTERNAL_ILLEGALARGUMENT, ME,
"Expected 2 entries in serialized object '" + type + "' but got " + obj.length + " for priority=" + priority + " timestamp=" + timestamp + ". Could be a version incompatibility.");
}
String keyOid = (String)obj[0];
Long msgUnitWrapperUniqueId = (Long)obj[1];
Timestamp updateEntryTimestamp = new Timestamp(timestamp);
return new MsgQueueHistoryEntry(this.glob,
PriorityEnum.toPriorityEnum(priority), storageId, updateEntryTimestamp,
keyOid, msgUnitWrapperUniqueId.longValue(), persistent, sizeInBytes);
}
catch (Exception ex) {
throw new XmlBlasterException(glob, ErrorCode.INTERNAL_UNKNOWN, ME, "createEntry-MsgQueueHistoryEntry", ex);
}
}
else if (ENTRY_TYPE_MSG_XML.equalsIgnoreCase(type)) { // still used
try {
ObjectInputStream objStream = new ObjectInputStream(is);
Object[] obj = (Object[])objStream.readObject();
if (obj.length < 5) {
throw new XmlBlasterException(glob, ErrorCode.INTERNAL_ILLEGALARGUMENT, ME,
"Expected 5 entries in serialized object stream but got " + obj.length + " for priority=" + priority + " timestamp=" + timestamp);
}
String qos = (String)obj[0];
String key = (String)obj[1];
byte[] content = (byte[])obj[2];
Integer referenceCounter = (Integer)obj[3];
Integer historyReferenceCounter = (Integer)obj[4];
PublishQosServer publishQosServer = new PublishQosServer(glob, qos, true); // true marks from persistent store (prevents new timestamp)
MsgKeyData msgKeyData = glob.getMsgKeyFactory().readObject(key);
MsgUnit msgUnit = new MsgUnit(msgKeyData, content, publishQosServer.getData());
MsgUnitWrapper msgUnitWrapper = new MsgUnitWrapper(glob, msgUnit, storageId,
referenceCounter.intValue(), historyReferenceCounter.intValue(), sizeInBytes);
msgUnitWrapper.startExpiryTimer();
return msgUnitWrapper;
}
catch (Exception ex) {
throw new XmlBlasterException(glob, ErrorCode.INTERNAL_UNKNOWN, ME, "createEntry-MsgUnitWrapper", ex);
}
}
else if (ENTRY_TYPE_MSG_SERIAL.equalsIgnoreCase(type)) { // probably unused (not found in my tests)
try {
ObjectInputStream objStream = new ObjectInputStream(is);
Object[] obj = (Object[])objStream.readObject();
if (obj.length < 3) {
throw new XmlBlasterException(glob, ErrorCode.INTERNAL_ILLEGALARGUMENT, ME,
"Expected 3 entries in serialized object stream but got " + obj.length + " for priority=" + priority + " timestamp=" + timestamp);
}
MsgUnit msgUnit = (MsgUnit)obj[0];
Integer referenceCounter = (Integer)obj[1];
Integer historyReferenceCounter = (Integer)obj[2];
msgUnit.setGlobal(glob);
MsgUnitWrapper msgUnitWrapper = new MsgUnitWrapper(glob, msgUnit, storageId,
referenceCounter.intValue(), historyReferenceCounter.intValue(), sizeInBytes);
msgUnitWrapper.startExpiryTimer();
return msgUnitWrapper;
}
catch (Exception ex) {
throw new XmlBlasterException(glob, ErrorCode.INTERNAL_UNKNOWN, ME, "createEntry-MsgUnitWrapper", ex);
}
}
else if (ENTRY_TYPE_TOPIC_XML.equalsIgnoreCase(type)) { // still used
try {
ObjectInputStream objStream = new ObjectInputStream(is);
Object[] obj = (Object[])objStream.readObject();
if (obj.length < 2) {
throw new XmlBlasterException(glob, ErrorCode.INTERNAL_ILLEGALARGUMENT, ME,
"Expected 2 entries in serialized object stream but got " + obj.length + " for priority=" + priority + " timestamp=" + timestamp);
}
String qos = (String)obj[0];
String key = (String)obj[1];
byte[] content = null;
PublishQosServer publishQosServer = new PublishQosServer(glob, qos, true); // true marks from persistent store (prevents new timestamp)
MsgKeyData msgKeyData = glob.getMsgKeyFactory().readObject(key);
MsgUnit msgUnit = new MsgUnit(msgKeyData, content, publishQosServer.getData());
TopicEntry topicEntry = new TopicEntry(glob, msgUnit, storageId, type, sizeInBytes);
return topicEntry;
}
catch (Exception ex) {
throw new XmlBlasterException(glob, ErrorCode.INTERNAL_UNKNOWN, ME, "createEntry-TopicEntry", ex);
}
}
else if (ENTRY_TYPE_TOPIC_SERIAL.equalsIgnoreCase(type)) { // probably unused (not found in my tests)
try {
ObjectInputStream objStream = new ObjectInputStream(is);
Object[] obj = (Object[])objStream.readObject();
if (obj.length < 1) {
throw new XmlBlasterException(glob, ErrorCode.INTERNAL_ILLEGALARGUMENT, ME,
"Expected 1 entry in serialized object stream but got " + obj.length + " for priority=" + priority + " timestamp=" + timestamp);
}
MsgUnit msgUnit = (MsgUnit)obj[0];
msgUnit.setGlobal(glob);
TopicEntry topicEntry = new TopicEntry(glob, msgUnit, storageId, type, sizeInBytes);
return topicEntry;
}
catch (Exception ex) {
throw new XmlBlasterException(glob, ErrorCode.INTERNAL_UNKNOWN, ME, "createEntry-TopicEntry", ex);
}
}
else if (ENTRY_TYPE_SESSION.equalsIgnoreCase(type)) { // still used
try {
ObjectInputStream objStream = new ObjectInputStream(is);
Object[] obj = (Object[])objStream.readObject();
if (obj.length < 1) {
throw new XmlBlasterException(glob, ErrorCode.INTERNAL_ILLEGALARGUMENT, ME,
"Expected 1 entry in serialized object stream but got " + obj.length + " for priority=" + priority + " timestamp=" + timestamp);
}
String xmlLiteral = (String)obj[0];
SessionEntry sessionEntry = new SessionEntry(xmlLiteral, timestamp, sizeInBytes, storageId);
return sessionEntry;
}
catch (Exception ex) {
throw new XmlBlasterException(glob, ErrorCode.INTERNAL_UNKNOWN, ME, "createEntry-TopicEntry", ex);
}
}
else if (ENTRY_TYPE_SUBSCRIBE.equalsIgnoreCase(type)) { // still used
try {
ObjectInputStream objStream = new ObjectInputStream(is);
Object[] obj = (Object[])objStream.readObject();
if (obj.length < 3) {
throw new XmlBlasterException(glob, ErrorCode.INTERNAL_ILLEGALARGUMENT, ME,
"Expected 3 entries in serialized object stream but got " + obj.length + " for priority=" + priority + " timestamp=" + timestamp);
}
String keyLiteral = (String)obj[0];
String qosLiteral = (String)obj[1];
String sessionName = (String)obj[2];
SubscribeEntry subscribeEntry = new SubscribeEntry(keyLiteral, qosLiteral, sessionName, timestamp, sizeInBytes, storageId);
return subscribeEntry;
}
catch (Exception ex) {
throw new XmlBlasterException(glob, ErrorCode.INTERNAL_UNKNOWN, ME, "createEntry-TopicEntry", ex);
}
}
else if (ENTRY_TYPE_DUMMY.equalsIgnoreCase(type)) { // still used (for testing)
DummyEntry entry = new DummyEntry(glob, PriorityEnum.toPriorityEnum(priority), new Timestamp(timestamp), storageId, sizeInBytes, persistent);
//entry.setUniqueId(timestamp);
return entry;
}
throw new XmlBlasterException(glob, ErrorCode.INTERNAL_NOTIMPLEMENTED, ME, "Persistent object '" + type + "' is not implemented");