net.rim.pushsdk.subscription.auth
Class SubscriberPrincipal

java.lang.Object
  extended by net.rim.pushsdk.subscription.auth.SubscriberPrincipal
All Implemented Interfaces:
Serializable, Principal

public class SubscriberPrincipal
extends Object
implements Principal, Serializable

This class implements the Principal interface and represents a subscriber returned from authentication with a name (unique identification) and a set of properties (e.g. private encryption key, etc.).

Note: It is the responsibility of the content provider to lower case the name if they wish to have case insensitive unique ids.

Author:
mdandrea
See Also:
Serialized Form

Constructor Summary
SubscriberPrincipal(String name)
          Constructs a subscriber principal with the given name (unique id).
 
Method Summary
 void addProperty(String key, String value)
          Adds a new key-value pair to a subscriber principal's properties.
 boolean equals(Object obj)
          Returns true if two subscriber principals are found to be equal and false otherwise.
 String getName()
          Returns the name of this principal.
 Map<String,String> getProperties()
          Gets a set of key-value pairs that relate to a subscriber principal.
 int hashCode()
          Returns a hashcode for this subscriber principal.
 String removeProperty(String key)
          Removes a key-value pair from a subscriber principal's properties.
 void setName(String name)
          Sets the unique name/id of a subscriber.
 void setProperties(Map<String,String> properties)
          Sets the key-value pairs that relate to a subscriber principal.
 String toString()
          Constructs a String with all attributes in name = value format.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SubscriberPrincipal

public SubscriberPrincipal(String name)
Constructs a subscriber principal with the given name (unique id).

If a case insensitive id is required, consider lower casing the name before calling this constructor.

Parameters:
name - an id uniquely identifying a subscriber (a primary key)
Method Detail

getName

public String getName()
Returns the name of this principal.

Specified by:
getName in interface Principal
Returns:
the name of this principal.

setName

public void setName(String name)
Sets the unique name/id of a subscriber.

If a case insensitive id is required, consider lower casing the name before calling this setter.

Parameters:
name - an id uniquely identifying a subscriber (a primary key)

getProperties

public Map<String,String> getProperties()
Gets a set of key-value pairs that relate to a subscriber principal.

Returns:
the set of key-value pairs

setProperties

public void setProperties(Map<String,String> properties)
Sets the key-value pairs that relate to a subscriber principal.

Parameters:
properties - a set of key-value pairs

addProperty

public void addProperty(String key,
                        String value)
Adds a new key-value pair to a subscriber principal's properties.

Parameters:
key - the property's key
value - the property's value

removeProperty

public String removeProperty(String key)
Removes a key-value pair from a subscriber principal's properties.

Parameters:
key - the property's key
Returns:
the previous value associated with key, or null if there was no mapping for the key.

hashCode

public int hashCode()
Returns a hashcode for this subscriber principal.

Specified by:
hashCode in interface Principal
Overrides:
hashCode in class Object
Returns:
a hashcode for this subscriber principal.

equals

public boolean equals(Object obj)
Returns true if two subscriber principals are found to be equal and false otherwise.

Specified by:
equals in interface Principal
Overrides:
equals in class Object
Returns:
whether two subscriber principals are equal

toString

public String toString()
Constructs a String with all attributes in name = value format.

Specified by:
toString in interface Principal
Overrides:
toString in class Object
Returns:
a String representation of this object.


Copyright © 2011 Research In Motion. All Rights Reserved.