![JAR search and dependency download from the Maven repository](/logo.png)
com.windowsazure.messaging.MpnsRegistration 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.net.URI;
import java.net.URISyntaxException;
import java.util.Objects;
/**
* Class representing a native registration for a device using MPNS.
*/
public class MpnsRegistration extends Registration {
private static final String MPNS_NATIVE_REGISTRATION1 = "";
private static final String MPNS_NATIVE_REGISTRATION2 = "";
private static final String MPNS_NATIVE_REGISTRATION3 = " ";
protected URI channelUri;
/**
* Creates a new instance of the MpnsRegistration class.
*/
public MpnsRegistration() {
}
/**
* Creates a new instance of the MpnsRegistration class.
* @param channelUri The Windows Phone PNS channel URI.
*/
public MpnsRegistration(URI channelUri) {
super();
this.channelUri = channelUri;
}
/**
* Creates a new instance of the MpnsRegistration class.
* @param registrationId The Azure Notification Hubs registration ID.
* @param channelUri The Windows Phone PNS channel URI.
*/
public MpnsRegistration(String registrationId, URI channelUri) {
super(registrationId);
this.channelUri = channelUri;
}
/**
* Gets the Windows Phone PNS channel URI.
* @return The Windows Phone PNS channel URI.
*/
public URI getChannelUri() { return channelUri; }
/**
* Sets the Windows Phone PNS channel URI.
* @param channelUri The Windows Phone PNS channel URI to set.
*/
public void setChannelUri(String channelUri) {
try {
this.channelUri = new URI(channelUri);
} catch (URISyntaxException e) {
throw new RuntimeException(channelUri);
}
}
/**
* Gets the PNS handle for getting devices by channel.
* @return The PNS handle for getting devices by channel.
*/
@Override
public String getPnsHandle() { return channelUri.toString(); }
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (!super.equals(o)) return false;
MpnsRegistration that = (MpnsRegistration) o;
return Objects.equals(getChannelUri(), that.getChannelUri());
}
@Override
public int hashCode() {
return Objects.hash(super.hashCode(), getChannelUri());
}
@Override
public String getXml() {
return MPNS_NATIVE_REGISTRATION1 +
getTagsXml() +
MPNS_NATIVE_REGISTRATION2 +
channelUri.toString() +
MPNS_NATIVE_REGISTRATION3;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy