com.windowsazure.samples.internal.queue.QueueMessageAdapter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jpa4azure Show documentation
Show all versions of jpa4azure Show documentation
jpa4azure, implements a subset of the JPA specification using Azure Storage for pesisting beans. see http://jpa4azure.codeplex.com for more information.
The newest version!
package com.windowsazure.samples.internal.queue;
import java.util.Date;
import com.windowsazure.samples.internal.util.Base64;
import com.windowsazure.samples.internal.util.Util;
import com.windowsazure.samples.internal.web.XmlHttpResult;
import com.windowsazure.samples.internal.xml.AzureDOMAdapter;
import com.windowsazure.samples.queue.AzureQueueMessage;
final class QueueMessageDOMAdapter extends AzureDOMAdapter {
@Override
public AzureQueueMessage build()
throws Exception {
String messageId = getInnerText("MessageId");
String insertionTimeText = getInnerText("InsertionTime");
String expirationTimeText = getInnerText("ExpirationTime");
String popReceipt = getOptionalInnerText("PopReceipt");
String timeNextVisibleText = getOptionalInnerText("TimeNextVisible");
String dequeueCountText = getOptionalInnerText("DequeueCount");
String messageText = new String(Base64.decode(getInnerText("MessageText").getBytes()));
Date insertionTime = Util.gmtFormatToDate(insertionTimeText);
Date expirationTime = Util.gmtFormatToDate(expirationTimeText);
Date timeNextVisible = Util.isStringNullOrEmpty(timeNextVisibleText) ?
null : Util.gmtFormatToDate(timeNextVisibleText);
Integer dequeueCount = Util.isStringNullOrEmpty(dequeueCountText) ? null : Integer.parseInt(dequeueCountText);
return new AzureQueueMessage(messageId, insertionTime, expirationTime, popReceipt, timeNextVisible, dequeueCount, messageText);
}
protected QueueMessageDOMAdapter(XmlHttpResult result) {
super(result);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy