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

com.windowsazure.messaging.PnsCredential Maven / Gradle / Ivy

package com.windowsazure.messaging;

import java.util.AbstractMap.SimpleEntry;
import java.util.List;

import org.apache.commons.digester3.Digester;

public abstract class PnsCredential {	
	private static final String PROPERTIES_START="";
	private static final String PROPERTY_START="";
	private static final String PROPERTY_MIDDLE="";
	private static final String PROPERTY_END="";
	private static final String PROPERTIES_END="";
	
    public static void setupDigister(Digester digester){
		digester.addCallMethod("*/Property", "setProperty",2);
		digester.addCallParam("*/Name", 0);
		digester.addCallParam("*/Value", 1);
	}
	
	public void setProperty(String propertyName, String propertyValue) throws Exception{
		this.getClass().getMethod("set"+propertyName, String.class).invoke(this, propertyValue);
	}
	
	public String getXml(){
		StringBuffer buf = new StringBuffer();
		buf.append("<");
		buf.append(getRootTagName());
		buf.append(">");
		buf.append(PROPERTIES_START);
		for (SimpleEntry property : getProperties()) {
			buf.append(PROPERTY_START);
			buf.append(property.getKey());
			buf.append(PROPERTY_MIDDLE);
			buf.append(property.getValue());
			buf.append(PROPERTY_END);
		}
		buf.append(PROPERTIES_END);
		buf.append("");
		return buf.toString();
	}
	
	public abstract List> getProperties();
	
	public abstract String getRootTagName();
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy