com.webmethods.caf.faces.data.pubsub
Class SubscriptionContentProvider

java.lang.Object
  extended by com.webmethods.caf.faces.data.pubsub.SubscriptionContentProvider
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
PubSubContentProvider

public abstract class SubscriptionContentProvider
extends Object
implements Serializable

See Also:
Serialized Form

Field Summary
protected  String m_subscriptionID
           
protected  String m_subscriptionName
           
static String PRINCIPAL_TYPE_GROUP
           
static String PRINCIPAL_TYPE_ROLE
           
static String PRINCIPAL_TYPE_USER
           
 
Constructor Summary
SubscriptionContentProvider()
           
 
Method Summary
protected abstract  String getPrincipalID()
          Get the principal Id which to subscribe or unsubscribe.
protected abstract  String getPrincipalType()
          Get the principal type for the current principal Id.
 IPrincipalProvider[] getSubscribers()
          Get an array of principal Ids for the current subscription Id.
 String getSubscriptionID()
          Get the current subscription Id for this content provider.
 String getSubscriptionName()
          Get the current subscription name for this content provider.
 String getSubscriptionObjectID()
          Get the the subscription object Id for the current subscription Id.
 boolean isSubscribed()
          Determines if current principal is already subscribed to the current subscription Id.
 void setSubscriptionID(String id)
          Set the current subscription Id for this content provider.
 void setSubscriptionName(String name)
          Set the current subscription name for this content provider.
 String subscribe()
          Subscribes current principal to the source identified by the current subscription Id.
 void unsubscribe()
          Unsubscribes the current principal from the source identified by the current subscription Id.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PRINCIPAL_TYPE_USER

public static final String PRINCIPAL_TYPE_USER
See Also:
Constant Field Values

PRINCIPAL_TYPE_GROUP

public static final String PRINCIPAL_TYPE_GROUP
See Also:
Constant Field Values

PRINCIPAL_TYPE_ROLE

public static final String PRINCIPAL_TYPE_ROLE
See Also:
Constant Field Values

m_subscriptionID

protected String m_subscriptionID

m_subscriptionName

protected String m_subscriptionName
Constructor Detail

SubscriptionContentProvider

public SubscriptionContentProvider()
Method Detail

getPrincipalID

protected abstract String getPrincipalID()
Get the principal Id which to subscribe or unsubscribe.

Used by methods SubscriptionContentProvider.subscribe(), SubscriptionContentProvider.unsubscribe(), SubscriptionContentProvider.isSubscribed(), and SubscriptionContentProvider.getSubscriptionObjectID()

Returns:
A principal Id.

getPrincipalType

protected abstract String getPrincipalType()
Get the principal type for the current principal Id.

Used by methods SubscriptionContentProvider.subscribe(), SubscriptionContentProvider.unsubscribe(), SubscriptionContentProvider.isSubscribed()(), and SubscriptionContentProvider.getSubscriptionObjectID()



Principal type can be SubscriptionContentProvider.PRINCIPAL_TYPE_USER, SubscriptionContentProvider.PRINCIPAL_TYPE_ROLE, or SubscriptionContentProvider.PRINCIPAL_TYPE_GROUP. Default value is SubscriptionContentProvider.PRINCIPAL_TYPE_USER.

Returns:
The principal type for the current principal Id.

subscribe

public String subscribe()
                 throws ContentProviderException
Subscribes current principal to the source identified by the current subscription Id.

Returns:
The id of the subscription.
Throws:
ContentProviderException

unsubscribe

public void unsubscribe()
                 throws ContentProviderException
Unsubscribes the current principal from the source identified by the current subscription Id.

Throws:
ContentProviderException

isSubscribed

public boolean isSubscribed()
                     throws ContentProviderException
Determines if current principal is already subscribed to the current subscription Id.

Returns:
True if user is subscribed. Otherwise false.
Throws:
ContentProviderException

getSubscriptionObjectID

public String getSubscriptionObjectID()
                               throws ContentProviderException
Get the the subscription object Id for the current subscription Id. The current principal must be subscribed to this Id to get a valid Id.

Returns:
The user subscription object Id.
Throws:
ContentProviderException

getSubscribers

public IPrincipalProvider[] getSubscribers()
                                    throws ContentProviderException
Get an array of principal Ids for the current subscription Id.

Returns:
An array IPrincipalProvider IDs, currently subscribed to this resource
Throws:
ContentProviderException

getSubscriptionID

public String getSubscriptionID()
Get the current subscription Id for this content provider.

Returns:
The source Id.

setSubscriptionID

public void setSubscriptionID(String id)
Set the current subscription Id for this content provider.

Parameters:
id - The source Id.

getSubscriptionName

public String getSubscriptionName()
Get the current subscription name for this content provider.

Returns:
The current subscription name.

setSubscriptionName

public void setSubscriptionName(String name)
Set the current subscription name for this content provider.

Parameters:
name - The current subscription name.