org.hippoecm.hst.configuration.channel
Class ChannelManagerImpl

java.lang.Object
  extended by org.hippoecm.hst.configuration.channel.ChannelManagerImpl
All Implemented Interfaces:
ChannelManager, MutableChannelManager

public class ChannelManagerImpl
extends Object
implements MutableChannelManager


Constructor Summary
ChannelManagerImpl()
           
 
Method Summary
 void addChannelManagerEventListeners(ChannelManagerEventListener... listeners)
          Adds channel manager listeners.
 boolean canUserModifyChannels()
          Can the current user (set in HstSubject) create or modify channels.
protected  String createUniqueChannelId(String channelName, javax.jcr.Session session)
          Creates a unique ID for a channel.
 Blueprint getBlueprint(String id)
          Retrieve a blue print from it's ID.
 List<Blueprint> getBlueprints()
          The list of available blueprints
 Channel getChannel(String jcrPath)
          Returns the channel configured at the given JCR path.
<T extends ChannelInfo>
T
getChannelInfo(Channel channel)
          The channel info for this channel.
 Class<? extends ChannelInfo> getChannelInfoClass(Channel channel)
          The channel info class for this channel.
 Map<String,Channel> getChannels()
          List all managed channels, identified by their channel IDs
 List<HstPropertyDefinition> getPropertyDefinitions(Channel channel)
           
 ResourceBundle getResourceBundle(Channel channel, Locale locale)
          The resource bundle for the channel info.
protected  javax.jcr.Session getSession(boolean writable)
           
 org.hippoecm.repository.api.Workflow getWorkflow(String category, javax.jcr.Node node)
           
 void invalidate()
          discard cached channel information; there have been external changes to the backend storage.
 void load(VirtualHosts virtualHosts)
          Populate the mounts under the virtual hosts with channel information.
 String persist(String blueprintId, Channel channel)
          Persists a channel.
 void removeChannelManagerEventListeners(ChannelManagerEventListener... listeners)
          Removes channel manager listeners.
 void save(Channel channel)
          Save channel properties.
 void setContentRoot(String contentRoot)
           
 void setCredentials(javax.jcr.Credentials credentials)
           
 void setRepository(javax.jcr.Repository repository)
           
 void setRootPath(String rootPath)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ChannelManagerImpl

public ChannelManagerImpl()
Method Detail

setCredentials

public void setCredentials(javax.jcr.Credentials credentials)

setRepository

public void setRepository(javax.jcr.Repository repository)

setRootPath

public void setRootPath(String rootPath)

setContentRoot

public void setContentRoot(String contentRoot)

addChannelManagerEventListeners

public void addChannelManagerEventListeners(ChannelManagerEventListener... listeners)
Description copied from interface: ChannelManager
Adds channel manager listeners.

Specified by:
addChannelManagerEventListeners in interface ChannelManager

removeChannelManagerEventListeners

public void removeChannelManagerEventListeners(ChannelManagerEventListener... listeners)
Description copied from interface: ChannelManager
Removes channel manager listeners.

Specified by:
removeChannelManagerEventListeners in interface ChannelManager

load

public void load(VirtualHosts virtualHosts)
          throws RepositoryNotAvailableException
Description copied from interface: MutableChannelManager
Populate the mounts under the virtual hosts with channel information.

Specified by:
load in interface MutableChannelManager
Throws:
RepositoryNotAvailableException

getSession

protected javax.jcr.Session getSession(boolean writable)
                                throws javax.jcr.RepositoryException
Throws:
javax.jcr.RepositoryException

getChannel

public Channel getChannel(String jcrPath)
                   throws ChannelException
Description copied from interface: ChannelManager
Returns the channel configured at the given JCR path.

Specified by:
getChannel in interface ChannelManager
Throws:
ChannelException

getChannels

public Map<String,Channel> getChannels()
                                throws ChannelException
Description copied from interface: ChannelManager
List all managed channels, identified by their channel IDs

Specified by:
getChannels in interface ChannelManager
Returns:
Throws:
ChannelException

persist

public String persist(String blueprintId,
                      Channel channel)
               throws ChannelException
Description copied from interface: ChannelManager
Persists a channel. Will create the mounts, sites and configuration when the channel is new.

When invoking this method, an HstSubject context must be provided with the credentials necessary to persist the channel.

The persisted channel can be retrieved again via #getChannels#get(String) with the returned channel ID.

Specified by:
persist in interface ChannelManager
Parameters:
blueprintId - blueprint that contains prototypes for mount, site and hst configuration
channel - a channel instance to be persisted
Returns:
the channel ID of the created channel
Throws:
ChannelException - with type @{link ChannelException.Type#MOUNT_NOT_FOUND} when all but the last path-step in the URL path of a new channel do not map to existing mounts. The exception has one parameter: the absolute JCR path of the missing mount.

createUniqueChannelId

protected String createUniqueChannelId(String channelName,
                                       javax.jcr.Session session)
                                throws ChannelException
Creates a unique ID for a channel. The ID can safely be used as a new JCR node name in the hst:channels, hst:sites, and hst:configurations configuration.

Parameters:
channelName - the name of the channel
session - JCR session to use for sanity checks of node names
Returns:
a unique channel ID based on the given channel name
Throws:
ChannelException

save

public void save(Channel channel)
          throws ChannelException
Description copied from interface: ChannelManager
Save channel properties. If the URL path of the new channel is not empty, all path-steps except the last one should already map to an existing mount.

When invoking this method, an HstSubject context must be provided with the credentials necessary to persist the channel.

Specified by:
save in interface ChannelManager
Parameters:
channel - the channel to persist
Throws:
ChannelException - with type @{link ChannelException.Type#MOUNT_NOT_FOUND} when all but the last path-step in the URL path of a new channel do not map to existing mounts, or the URL path of an existing channel does not map to an existing mount. The exception has one parameter: the absolute JCR path of the missing mount.

getBlueprints

public List<Blueprint> getBlueprints()
                              throws ChannelException
Description copied from interface: ChannelManager
The list of available blueprints

Specified by:
getBlueprints in interface ChannelManager
Returns:
Throws:
ChannelException

getBlueprint

public Blueprint getBlueprint(String id)
                       throws ChannelException
Description copied from interface: ChannelManager
Retrieve a blue print from it's ID.

Specified by:
getBlueprint in interface ChannelManager
Returns:
Throws:
ChannelException

getChannelInfoClass

public Class<? extends ChannelInfo> getChannelInfoClass(Channel channel)
                                                 throws ChannelException
Description copied from interface: ChannelManager
The channel info class for this channel. Since this class comes from a separate context, it cannot be deserialized.

Specified by:
getChannelInfoClass in interface ChannelManager
Returns:
Throws:
ChannelException

getChannelInfo

public <T extends ChannelInfo> T getChannelInfo(Channel channel)
                                     throws ChannelException
Description copied from interface: ChannelManager
The channel info for this channel. It is an instance of the ChannelManager.getChannelInfoClass(org.hippoecm.hst.configuration.channel.Channel) class.

Specified by:
getChannelInfo in interface ChannelManager
Returns:
Throws:
ChannelException

getPropertyDefinitions

public List<HstPropertyDefinition> getPropertyDefinitions(Channel channel)
Specified by:
getPropertyDefinitions in interface ChannelManager

getResourceBundle

public ResourceBundle getResourceBundle(Channel channel,
                                        Locale locale)
Description copied from interface: ChannelManager
The resource bundle for the channel info. It contains the display names for fields and values.

Specified by:
getResourceBundle in interface ChannelManager

canUserModifyChannels

public boolean canUserModifyChannels()
Description copied from interface: ChannelManager
Can the current user (set in HstSubject) create or modify channels.

Specified by:
canUserModifyChannels in interface ChannelManager
Returns:
true when the user can create a channel, false otherwise

invalidate

public void invalidate()
Description copied from interface: MutableChannelManager
discard cached channel information; there have been external changes to the backend storage.

Specified by:
invalidate in interface MutableChannelManager

getWorkflow

public org.hippoecm.repository.api.Workflow getWorkflow(String category,
                                                        javax.jcr.Node node)
                                                 throws javax.jcr.RepositoryException
Throws:
javax.jcr.RepositoryException


Copyright © 2008-2012 Hippo. All Rights Reserved.