![JAR search and dependency download from the Maven repository](/logo.png)
com.windowsazure.messaging.PnsCredential Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of Notification-Hubs-java-sdk Show documentation
Show all versions of Notification-Hubs-java-sdk Show documentation
Azure Notification Hubs Java SDK for interacting with the data and management plane operations.
The newest version!
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
package com.windowsazure.messaging;
import java.util.AbstractMap.SimpleEntry;
import java.util.List;
import org.apache.commons.digester3.Digester;
/**
* This class represents a platform notification service (PNS) credentials in Azure Notification Hubs.
*/
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 void setProperty(String propertyName, String propertyValue) throws Exception {
String setterName = "set" + propertyName.substring(0, 1).toUpperCase() + propertyName.substring(1);
this.getClass().getMethod(setterName, String.class).invoke(this, propertyValue);
}
public static void setupDigester(Digester digester) {
digester.addCallMethod("*/Property", "setProperty", 2);
digester.addCallParam("*/Name", 0);
digester.addCallParam("*/Value", 1);
}
public String getXml() {
StringBuilder buf = new StringBuilder();
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("");
buf.append(getRootTagName());
buf.append(">");
return buf.toString();
}
public abstract List> getProperties();
public abstract String getRootTagName();
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy