All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.windowsazure.samples.internal.blob.ACLDOMAdapter Maven / Gradle / Ivy

Go to download

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.blob;

import java.util.Date;
import java.util.Set;

import com.windowsazure.samples.blob.ACL;
import com.windowsazure.samples.blob.Permission;
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.internal.xml.XmlNode;


final class ACLDOMAdapter extends AzureDOMAdapter {

	@Override
	public ACL build()
		throws Exception {
		
		String id = getInnerText("Id");
		
		XmlNode accessPolicyNode = getNode("AccessPolicy");
		
		String startText = getInnerText(accessPolicyNode, "Start");
		Date start = Util.xmlStringToDate(startText);
		
		String expiryText = getInnerText(accessPolicyNode, "Expiry");
		Date expiry = Util.xmlStringToDate(expiryText);
		
		String permissionText = getInnerText(accessPolicyNode, "Permission");
		Set permissions = Permission.fromRepresentation(permissionText);
		
		return ACL.newACL(id, start, expiry, permissions);
	}
	
	protected ACLDOMAdapter(XmlHttpResult result) {
		super(result);
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy