org.jasig.portal
Class ChannelRegistryManager

java.lang.Object
  extended by org.jasig.portal.ChannelRegistryManager

public class ChannelRegistryManager
extends java.lang.Object

Manages the channel registry which is a listing of published channels that one can subscribe to (add to their layout). Also currently manages the channel types data and CPD documents. (maybe these should be managed by another class -Ken)

Version:
$Revision: 1.54 $
Author:
Ken Weiner, kweiner@unicon.net

Field Summary
private static java.lang.String CHANNEL_REGISTRY_CACHE_KEY
           
private static java.lang.String CHANNEL_TYPES_CACHE_KEY
           
protected static SmartCache channelRegistryCache
           
protected static SmartCache channelTypesCache
           
protected static int chanTypesCacheTimeout
          Timeout, in seconds, of the cache of channel types.
private static java.lang.String CPD_CACHE_KEY
           
protected static SmartCache cpdCache
           
protected static int cpdCacheTimeout
          Timeout, in seconds, of the cache of channel publishing documents.
protected static IChannelRegistryStore crs
           
private static int DEFAULT_CHAN_TYPES_CACHE_TIMEOUT
          Default value for chanTypesCacheTimeout.
private static int DEFAULT_CPD_CACHE_TIMEOUT
          Default value for cpdCacheTimeout.
private static boolean DEFAULT_LOCALE_AWARE
          Default value for localeAware.
private static int DEFAULT_REGISTRY_CACHE_TIMEOUT
          Default value for registryCacheTimeout.
private static java.lang.String FRAMEWORK_OWNER
           
private static java.lang.String GRANT_PERMISSION_TYPE
           
protected static boolean localeAware
          Boolean indicating whether internationalization will be used.
private static org.apache.commons.logging.Log log
           
protected static int registryCacheTimeout
          Timeout, in seconds, of the cache of the registry of channels.
private static java.lang.String SUBSCRIBER_ACTIVITY
           
 
Constructor Summary
ChannelRegistryManager()
           
 
Method Summary
static org.w3c.dom.NodeList getCategories(java.lang.String channelPublishId)
          Looks in channel registry for a channel element matching the given channel ID.
static org.w3c.dom.Element getChannel(java.lang.String channelPublishId)
          Looks in channel registry for a channel element matching the given channel ID.
static org.w3c.dom.Document getChannelRegistry()
          Returns a copy of the channel registry as a Document.
static org.w3c.dom.Document getChannelRegistry(IPerson person)
          Returns the channel registry as a Document.
static org.w3c.dom.Document getChannelRegistryXML()
          Returns an XML document which describes the channel registry.
static org.w3c.dom.Document getChannelTypes()
          Returns the publishable channel types as a Document.
static org.w3c.dom.Document getChannelTypesXML()
          Create XML representing the channel types.
static org.w3c.dom.Element getChannelXML(java.lang.String subscribeId, ChannelDefinition channelDef)
          Create XML representing this channel definition.
static org.w3c.dom.Document getCPD(java.lang.String chanTypeID)
          Returns a CPD (channel publishing document) as a Document
private static void processGroupsRecursively(IEntityGroup group, org.w3c.dom.Document owner, org.w3c.dom.Element parentGroup)
           
static void publishChannel(org.w3c.dom.Element channel, java.lang.String[] categoryIDs, IGroupMember[] groupMembers, IPerson publisher)
          Publishes a channel.
static void removeChannel(java.lang.String channelID, IPerson person)
          Removes a channel from the channel registry.
static void setChannelXML(org.w3c.dom.Element channelE, ChannelDefinition channelDef)
          Update a channel definition with data from a channel XML element.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private static final org.apache.commons.logging.Log log

crs

protected static final IChannelRegistryStore crs

DEFAULT_REGISTRY_CACHE_TIMEOUT

private static final int DEFAULT_REGISTRY_CACHE_TIMEOUT
Default value for registryCacheTimeout. This value will be used when the corresponding property cannot be loaded.

See Also:
Constant Field Values

DEFAULT_CHAN_TYPES_CACHE_TIMEOUT

private static final int DEFAULT_CHAN_TYPES_CACHE_TIMEOUT
Default value for chanTypesCacheTimeout. This value will be used when the corresponding property cannot be loaded.

See Also:
Constant Field Values

DEFAULT_CPD_CACHE_TIMEOUT

private static final int DEFAULT_CPD_CACHE_TIMEOUT
Default value for cpdCacheTimeout. This value will be used when the corresponding property cannot be loaded.

See Also:
Constant Field Values

DEFAULT_LOCALE_AWARE

private static final boolean DEFAULT_LOCALE_AWARE
Default value for localeAware. This value will be used when the corresponding property cannot be loaded.

See Also:
Constant Field Values

registryCacheTimeout

protected static final int registryCacheTimeout
Timeout, in seconds, of the cache of the registry of channels.


chanTypesCacheTimeout

protected static final int chanTypesCacheTimeout
Timeout, in seconds, of the cache of channel types.


cpdCacheTimeout

protected static final int cpdCacheTimeout
Timeout, in seconds, of the cache of channel publishing documents.


localeAware

protected static final boolean localeAware
Boolean indicating whether internationalization will be used.


channelRegistryCache

protected static final SmartCache channelRegistryCache

channelTypesCache

protected static final SmartCache channelTypesCache

cpdCache

protected static final SmartCache cpdCache

CHANNEL_REGISTRY_CACHE_KEY

private static final java.lang.String CHANNEL_REGISTRY_CACHE_KEY
See Also:
Constant Field Values

CHANNEL_TYPES_CACHE_KEY

private static final java.lang.String CHANNEL_TYPES_CACHE_KEY
See Also:
Constant Field Values

CPD_CACHE_KEY

private static final java.lang.String CPD_CACHE_KEY
See Also:
Constant Field Values

FRAMEWORK_OWNER

private static final java.lang.String FRAMEWORK_OWNER
See Also:
Constant Field Values

SUBSCRIBER_ACTIVITY

private static final java.lang.String SUBSCRIBER_ACTIVITY
See Also:
Constant Field Values

GRANT_PERMISSION_TYPE

private static final java.lang.String GRANT_PERMISSION_TYPE
See Also:
Constant Field Values
Constructor Detail

ChannelRegistryManager

public ChannelRegistryManager()
Method Detail

getChannelRegistry

public static org.w3c.dom.Document getChannelRegistry()
                                               throws PortalException
Returns a copy of the channel registry as a Document. This document is not filtered according to a user's channel permissions. For a filtered list, see getChannelRegistry(IPerson person)

Returns:
a copy of the channel registry as a Document
Throws:
PortalException

getChannelRegistry

public static org.w3c.dom.Document getChannelRegistry(IPerson person)
                                               throws PortalException
Returns the channel registry as a Document. This document is filtered according to a user's channel permissions.

Returns:
the filtered channel registry as a Document
Throws:
PortalException

getChannelRegistryXML

public static org.w3c.dom.Document getChannelRegistryXML()
                                                  throws java.lang.Exception
Returns an XML document which describes the channel registry. See uPortal's channelRegistry.dtd

Returns:
doc the channel registry document
Throws:
java.lang.Exception

processGroupsRecursively

private static void processGroupsRecursively(IEntityGroup group,
                                             org.w3c.dom.Document owner,
                                             org.w3c.dom.Element parentGroup)
                                      throws java.lang.Exception
Throws:
java.lang.Exception

getChannel

public static org.w3c.dom.Element getChannel(java.lang.String channelPublishId)
                                      throws PortalException
Looks in channel registry for a channel element matching the given channel ID.

Parameters:
channelPublishId - the channel publish id
Returns:
the channel element matching specified channel publish id
Throws:
PortalException

getChannelXML

public static org.w3c.dom.Element getChannelXML(java.lang.String subscribeId,
                                                ChannelDefinition channelDef)
Create XML representing this channel definition. I don't think this method really belongs in the ChannelRegistryManager since this XML fragment is related more to a channel instance, but we'll hold it here for now and find a better place for it later :)

Parameters:
subscribeId - the channel subscibe ID, formerly called instance ID
channelDef - a channel definition
Returns:
the XML representing this channel definition

setChannelXML

public static void setChannelXML(org.w3c.dom.Element channelE,
                                 ChannelDefinition channelDef)
Update a channel definition with data from a channel XML element. I don't think this method really belongs in the ChannelRegistryManager since this XML fragment contains a channel subscribe ID, but we'll hold it here for now and find a better place for it later :) Note that this method does not set the ID, publisher ID, approver ID, pubish date, or approval date.

Parameters:
channelE - an XML element representing a channel definition
channelDef - the channel definition to update

getChannelTypesXML

public static org.w3c.dom.Document getChannelTypesXML()
                                               throws java.lang.Exception
Create XML representing the channel types. It will look something like this:

org.jasig.portal.channels.CImage Image Simple channel to display an image with optional caption and subcaption webpages/media/org/jasig/portal/channels/CImage/CImage.cpd org.jasig.portal.channels.CWebProxy Web Proxy Incorporate a dynamic HTML or XML application webpages/media/org/jasig/portal/channels/CWebProxy/CWebProxy.cpd

Returns:
channelTypesXML, the XML representing the channel types
Throws:
java.lang.Exception

getCategories

public static org.w3c.dom.NodeList getCategories(java.lang.String channelPublishId)
                                          throws PortalException
Looks in channel registry for a channel element matching the given channel ID.

Parameters:
channelPublishId - the channel publish ID
Returns:
the channel element matching chanID
Throws:
PortalException

publishChannel

public static void publishChannel(org.w3c.dom.Element channel,
                                  java.lang.String[] categoryIDs,
                                  IGroupMember[] groupMembers,
                                  IPerson publisher)
                           throws java.lang.Exception
Publishes a channel.

Parameters:
channel - the channel XML fragment
categoryIDs - a list of categories that the channel belongs to
groupMembers - a list of groups and/or people that are permitted to subscribe to and view the channel
publisher - the user ID of the channel publisher
Throws:
java.lang.Exception

removeChannel

public static void removeChannel(java.lang.String channelID,
                                 IPerson person)
                          throws java.lang.Exception
Removes a channel from the channel registry.

Parameters:
channelID - the channel ID
person - the person removing the channel
Throws:
java.lang.Exception

getChannelTypes

public static org.w3c.dom.Document getChannelTypes()
                                            throws PortalException
Returns the publishable channel types as a Document.

Returns:
a list of channel types as a Document
Throws:
PortalException

getCPD

public static org.w3c.dom.Document getCPD(java.lang.String chanTypeID)
                                   throws PortalException
Returns a CPD (channel publishing document) as a Document

Parameters:
chanTypeID - the channel type ID, "-1" if channel type is "custom"
Returns:
the CPD document matching the chanTypeID, null if "custom" channel
Throws:
PortalException