org.hippoecm.hst.configuration.hosting
Class MountService

java.lang.Object
  extended by org.hippoecm.hst.configuration.hosting.MountService
All Implemented Interfaces:
Mount, MutableMount, ContextualizableMount

public class MountService
extends Object
implements ContextualizableMount, MutableMount


Field Summary
 
Fields inherited from interface org.hippoecm.hst.configuration.hosting.Mount
LIVE_NAME, PREVIEW_NAME, PROPERTY_NAME_MOUNT_PREFIX
 
Constructor Summary
MountService(HstNode mount, Mount parent, VirtualHost virtualHost, HstManagerImpl hstManager, int port)
           
 
Method Summary
 void addMount(MutableMount mount)
           
 String getAlias()
          Returns the alias of this Mount item.
 String getCanonicalContentPath()
          Returns the absolute canonical content path for the content of this Mount.
<T extends ChannelInfo>
T
getChannelInfo()
          The channel properties for this mount.
 String getChannelPath()
           
 Mount getChildMount(String name)
           
 List<Mount> getChildMounts()
           
 String getCmsLocation()
           
 String getContentPath()
           Returns the content path for this Mount object.
 String[] getDefaultSiteMapItemHandlerIds()
           
 String getEmbeddedMountPath()
          for embedded delegation of sites a mountpath needs to point to the delegated Mount.
 String getFormLoginPage()
          Returns FORM Login Page
 String getHomePage()
           
 HstSite getHstSite()
           
 HstSiteMapMatcher getHstSiteMapMatcher()
          This is a shortcut method fetching the HstSiteMapMatcher from the backing HstManager
 String getIdentifier()
           
 String getLocale()
          the locale for this Mount or null when it does not contain one.
 String getLockedBy()
          Return null when the mount is not locked.
 Calendar getLockedOn()
          Get the date on which the mount was locked.
 String getMountPath()
           Returns the mount path for this Mount object.
 String getMountPoint()
           Returns the mount point for this Mount object.
 Map<String,String> getMountProperties()
           Returns all the properties that start with "hst:mount" and have value of type String.
 String getName()
           
 String getNamedPipeline()
          Note that if an ancestor Mount contains a namedPipeline, this value is inherited unless this Mount explicitly defines its own
 String getPageNotFound()
           
 Mount getParent()
           
 int getPort()
           
 String getPreviewCanonicalContentPath()
          internal only : not api
 String getPreviewContentPath()
          internal only : not api
 HstSite getPreviewHstSite()
          internal only : not api
 String getPreviewMountPoint()
          internal only : not api
 String getProperty(String name)
          the string value of the property or null when the property is not present.
 Set<String> getRoles()
          Returns the roles that are allowed to access this Mount when Mount.isAuthenticated() is true.
 String getScheme()
           
 String getType()
           
 List<String> getTypes()
           
 Set<String> getUsers()
          Returns the users that are allowed to access this Mount when Mount.isAuthenticated() is true.
 VirtualHost getVirtualHost()
           
 boolean isAuthenticated()
          If this method returns true, then only if the user is explicitly allowed or servletRequest.isUserInRole(role) returns true this Mount is accessible for the request.
 boolean isContextPathInUrl()
           
 boolean isMapped()
          When this Mount is not using a HstSiteMap for the request processing, this method returns false.
 boolean isOfType(String type)
          When a this Mount is of type type this returns true.
 boolean isPortInUrl()
           
 boolean isPreview()
          This method returns the same as Mount.isOfType(String type) with type="preview"
 boolean isSessionStateful()
          Returns true if subject based jcr session should be statefully managed.
 boolean isSite()
          When this method returns false, then HstLink will have the HstLink.PATH_SUBPATH_DELIMITER included even for empty or null HstLink.getSubPath(), if and only if the VirtualHosts.isExcluded(String) for the path to create a link for returns true.
 boolean isSubjectBasedSession()
          Returns true if subject based jcr session should be used for this Mount
 boolean isVersionInPreviewHeader()
          When this Mount has Mount.isPreview() return false, this method always returns false.
 String onlyForContextPath()
          In case the HttpServletRequest.getContextPath() does not matter, this method must return null or empty.
 void setChannelInfo(ChannelInfo channelInfo)
          Set the channel info for the mount.
 void setLockedBy(String userId)
          Set the mount's lock owner userId.
 void setLockedOn(Calendar lockedOn)
          Set the date on which the mount was locked.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MountService

public MountService(HstNode mount,
                    Mount parent,
                    VirtualHost virtualHost,
                    HstManagerImpl hstManager,
                    int port)
             throws ServiceException
Throws:
ServiceException
Method Detail

addMount

public void addMount(MutableMount mount)
              throws IllegalArgumentException,
                     ServiceException
Specified by:
addMount in interface MutableMount
Parameters:
mount - the MutableMount to add
Throws:
IllegalArgumentException - if the mount could not be added
ServiceException - if the mount could not be added

getChildMounts

public List<Mount> getChildMounts()
Specified by:
getChildMounts in interface Mount
Returns:
the unmodifiable List of all child Mounts and an empty List if there are no child Mounts

getChildMount

public Mount getChildMount(String name)
Specified by:
getChildMount in interface Mount
Parameters:
name - of the child Mount
Returns:
a Mount with Mount.getName() equal to name or null when there is no such item

getHstSite

public HstSite getHstSite()
Specified by:
getHstSite in interface Mount
Returns:
the HstSite this Mount is pointing to or null when none found

getPreviewHstSite

public HstSite getPreviewHstSite()
Description copied from interface: ContextualizableMount
internal only : not api

Specified by:
getPreviewHstSite in interface ContextualizableMount
Returns:
the preview hstSite of this mount. If this mount is already a preview mount, the same is returned as Mount.getHstSite()

getName

public String getName()
Specified by:
getName in interface Mount
Returns:
The name of this Mount item

getIdentifier

public String getIdentifier()
Specified by:
getIdentifier in interface Mount
Returns:
the identifier of this Mount

getAlias

public String getAlias()
Description copied from interface: Mount
Returns the alias of this Mount item. The alias of a Mount must be unique in combination with every type Mount.getTypes() within a single host group, also see (VirtualHost.getHostGroupName()). When there is no alias defined on the Mount, null is returned. The Mount can then not be used to lookup by alias

Specified by:
getAlias in interface Mount
Returns:
The alias of this Mount item or null when it does not have one

getMountPath

public String getMountPath()
Description copied from interface: Mount

Returns the mount path for this Mount object. The root Mount has an empty String ("") as mount path. A mountPath for a Mount is its own Mount.getName() plus all ancestors up to the root and always starts with a "/" (unless for the root, this one is empty). It can contain wildcards, for example /preview/*. Typically, these wildcards are replaced by their request specific values in the ResolvedMount.

Note the difference with Mount.getMountPoint(): the Mount.getMountPoint() returns the jcr location of the (sub)site or of the content

Specified by:
getMountPath in interface Mount
Returns:
the mountPath for this Mount
See Also:
ResolvedMount.getResolvedMountPath()

getContentPath

public String getContentPath()
Description copied from interface: Mount

Returns the content path for this Mount object. The content path is the absolute jcr path to the root site node content, for example something like '/hst:hst/hst:sites/mysite-live/hst:content'. The Mount.getContentPath() can be the same as Mount.getMountPoint(), but this is in general only for Mount's that have Mount.isMapped() returning false. When the Mount does have Mount.isMapped() equal to true, the Mount.getContentPath() can return a different path than Mount.getMountPoint(). In general, it will be then Mount.getMountPoint() + "/hst:content".

Specified by:
getContentPath in interface Mount
Returns:
the content path for this Mount. It cannot be null

getCanonicalContentPath

public String getCanonicalContentPath()
Description copied from interface: Mount
Returns the absolute canonical content path for the content of this Mount. Note that it can return the same value as Mount.getContentPath(), but this is in general not the case: When the Mount.getContentPath() points to a virtual node, this method returns the location of the canonical version. When the Mount.getContentPath() points to a node which behaves like a mirror, then this method returns the location where the mirror points to. If Mount.getContentPath() does not point to a virtual node, nor to a mirror, this method returns the same value.

Specified by:
getCanonicalContentPath in interface Mount
Returns:
The absolute absolute content path for this Mount. It can be null in case Mount.getContentPath() points to a virtual node that does not have a canonical version.

getPreviewContentPath

public String getPreviewContentPath()
Description copied from interface: ContextualizableMount
internal only : not api

Specified by:
getPreviewContentPath in interface ContextualizableMount
Returns:
the preview content path of this mount. If there cannot be created a preview or this mount is already a preview, this returns the same as Mount.getContentPath()

getPreviewCanonicalContentPath

public String getPreviewCanonicalContentPath()
Description copied from interface: ContextualizableMount
internal only : not api

Specified by:
getPreviewCanonicalContentPath in interface ContextualizableMount
Returns:
the preview canonical content path of this mount. If there cannot be created a preview or this mount is already a preview, this returns the same as Mount.getCanonicalContentPath()

getMountPoint

public String getMountPoint()
Description copied from interface: Mount

Returns the mount point for this Mount object. The mount point can be the absolute jcr path to the root site node, for example something like '/hst:hst/hst:sites/mysite-live', but it can also be some jcr path to some virtual or canonical node in the repository. For example it can be '/content/gallery' , which might be the case for a Mount suited for REST gallery calls.

Specified by:
getMountPoint in interface Mount
Returns:
the mountPoint for this Mount and null if there is no mountPoint configured (nor inherited)
See Also:
ResolvedMount.getResolvedMountPath()

getPreviewMountPoint

public String getPreviewMountPoint()
Description copied from interface: ContextualizableMount
internal only : not api

Specified by:
getPreviewMountPoint in interface ContextualizableMount
Returns:
the preview mount point of this mount. If this mount is already a preview mount, the same is returned as Mount.getMountPoint()

isMapped

public boolean isMapped()
Description copied from interface: Mount
When this Mount is not using a HstSiteMap for the request processing, this method returns false. When it returns false, then Mount.getNamedPipeline() should also be configured, and a pipeline should be invoked that is independent of the ResolvedSiteMapItem as their won't be one. Note that the Mount.getMountPoint() can still point to a HstSite which in that case contains the hst:content node which is the filtered mirror for accessing the content

Specified by:
isMapped in interface Mount

getParent

public Mount getParent()
Specified by:
getParent in interface Mount
Returns:
the parent Mount of this Mount and null if we are at the root Mount

getScheme

public String getScheme()
Specified by:
getScheme in interface Mount
Returns:
the scheme to use for creating external urls, for example http / https

getLocale

public String getLocale()
Description copied from interface: Mount
the locale for this Mount or null when it does not contain one. Note that if an ancestor Mount contains a locale, this value is inherited unless this Mount explicitly defines its own. The root Mount inherits the value from the VirtualHost if the virtual host contains a locale

Specified by:
getLocale in interface Mount
Returns:
the locale for this Mount or null when it does not contain one.

getHomePage

public String getHomePage()
Specified by:
getHomePage in interface Mount
Returns:
the homepage for this Mount or null when not present

getPageNotFound

public String getPageNotFound()
Specified by:
getPageNotFound in interface Mount
Returns:
the pagenotfound for this Mount or null when not present

getVirtualHost

public VirtualHost getVirtualHost()
Specified by:
getVirtualHost in interface Mount
Returns:
the virtualHost where this Mount belongs to

isContextPathInUrl

public boolean isContextPathInUrl()
Specified by:
isContextPathInUrl in interface Mount
Returns:
true when the created url should have the contextpath in it

getPort

public int getPort()
Specified by:
getPort in interface Mount
Returns:
the portnumber for this Mount

isPortInUrl

public boolean isPortInUrl()
Specified by:
isPortInUrl in interface Mount
Returns:
true when the created url should have contain the port number

isSite

public boolean isSite()
Description copied from interface: Mount
When this method returns false, then HstLink will have the HstLink.PATH_SUBPATH_DELIMITER included even for empty or null HstLink.getSubPath(), if and only if the VirtualHosts.isExcluded(String) for the path to create a link for returns true. This is to avoid that for example a path that ends with .pdf will be skipped by the HstRequestProcessor due to VirtualHosts.isExcluded(String) : This is undesirable in case of a REST link for a binary for example

Specified by:
isSite in interface Mount
Returns:
true when the Mount is meant to be a site (false in case of for example being used for REST calls)

onlyForContextPath

public String onlyForContextPath()
Description copied from interface: Mount
In case the HttpServletRequest.getContextPath() does not matter, this method must return null or empty. If only this Mount can be used for a certain contextPath, this method should return that contextPath. . If configured, the contextPath is either an empty String, or it has to start with a "/" and is not allowed to have any other "/".

Specified by:
onlyForContextPath in interface Mount
Returns:
null or empty if the contextPath does not matter, otherwise it returns the value the contextPath must have a possible to match to this Mount

isPreview

public boolean isPreview()
Description copied from interface: Mount
This method returns the same as Mount.isOfType(String type) with type="preview"

Specified by:
isPreview in interface Mount
Returns:
true when this Mount is configured to be a preview Mount.

getType

public String getType()
Specified by:
getType in interface Mount
Returns:
the primary type of this Mount

getTypes

public List<String> getTypes()
Specified by:
getTypes in interface Mount
Returns:
the list of all types this Mount belongs to, including the primary type Mount.getType(). The primary type is the first item in the List

isOfType

public boolean isOfType(String type)
Description copied from interface: Mount
When a this Mount is of type type this returns true. A Mount can be of multiple types at once.

Specified by:
isOfType in interface Mount
Parameters:
type - the type to test
Returns:
true when this Mount is of type type

isVersionInPreviewHeader

public boolean isVersionInPreviewHeader()
Description copied from interface: Mount
When this Mount has Mount.isPreview() return false, this method always returns false. When the Mount is preview, and the Mount is configured to have the hst version number in preview, then this method returns true

Specified by:
isVersionInPreviewHeader in interface Mount
Returns:
true when for this Mount the current hst version should be added as a response header

getCmsLocation

public String getCmsLocation()
Specified by:
getCmsLocation in interface MutableMount
Returns:
the cms location (fully qualified URL) or null if not configured

getLockedBy

public String getLockedBy()
Description copied from interface: MutableMount
Return null when the mount is not locked.

Specified by:
getLockedBy in interface MutableMount
Returns:
userId of the lock owner or null if not locked

setLockedBy

public void setLockedBy(String userId)
Description copied from interface: MutableMount
Set the mount's lock owner userId.

Specified by:
setLockedBy in interface MutableMount

getLockedOn

public Calendar getLockedOn()
Description copied from interface: MutableMount
Get the date on which the mount was locked. If the mount is not locked, this date can by any date and null.

Specified by:
getLockedOn in interface MutableMount
Returns:
the date on which the mount was locked

setLockedOn

public void setLockedOn(Calendar lockedOn)
Description copied from interface: MutableMount
Set the date on which the mount was locked.

Specified by:
setLockedOn in interface MutableMount

getNamedPipeline

public String getNamedPipeline()
Description copied from interface: Mount
Note that if an ancestor Mount contains a namedPipeline, this value is inherited unless this Mount explicitly defines its own

Specified by:
getNamedPipeline in interface Mount
Returns:
the named pipeline to be used for this Mount or null when the default pipeline is to be used

getHstSiteMapMatcher

public HstSiteMapMatcher getHstSiteMapMatcher()
Description copied from interface: Mount
This is a shortcut method fetching the HstSiteMapMatcher from the backing HstManager

Specified by:
getHstSiteMapMatcher in interface Mount
Returns:
the HstSiteMapMatcher implementation

getEmbeddedMountPath

public String getEmbeddedMountPath()
Description copied from interface: Mount
for embedded delegation of sites a mountpath needs to point to the delegated Mount. This is only relevant for portal environment

Specified by:
getEmbeddedMountPath in interface Mount
Returns:
the embedded Mount path and null if not present

isAuthenticated

public boolean isAuthenticated()
Description copied from interface: Mount
If this method returns true, then only if the user is explicitly allowed or servletRequest.isUserInRole(role) returns true this Mount is accessible for the request. If a Mount does not have a configuration for authenticated, the value from the parent item is taken.

Specified by:
isAuthenticated in interface Mount
Returns:
true if the Mount is authenticated.

getRoles

public Set<String> getRoles()
Description copied from interface: Mount
Returns the roles that are allowed to access this Mount when Mount.isAuthenticated() is true. If the Mount does not have any roles defined by itself, it inherits them from the parent. If it defines roles, the roles from any ancestor are ignored. An empty set of roles in combination with Mount.isAuthenticated() return true means nobody has access to the item

Specified by:
getRoles in interface Mount
Returns:
The set of roles that are allowed to access this Mount. When no roles defined, the roles from the parent item are inherited. If none of the parent items have a role defined, an empty set is returned

getUsers

public Set<String> getUsers()
Description copied from interface: Mount
Returns the users that are allowed to access this Mount when Mount.isAuthenticated() is true. If the Mount does not have any users defined by itself, it inherits them from the parent. If it defines users, the users from any ancestor are ignored. An empty set of users in combination with Mount.isAuthenticated() return true means nobody has access to the item

Specified by:
getUsers in interface Mount
Returns:
The set of users that are allowed to access this Mount. When no users defined, the users from the parent item are inherited. If none of the parent items have a user defined, an empty set is returned

isSubjectBasedSession

public boolean isSubjectBasedSession()
Description copied from interface: Mount
Returns true if subject based jcr session should be used for this Mount

Specified by:
isSubjectBasedSession in interface Mount
Returns:

isSessionStateful

public boolean isSessionStateful()
Description copied from interface: Mount
Returns true if subject based jcr session should be statefully managed.

Specified by:
isSessionStateful in interface Mount
Returns:

getFormLoginPage

public String getFormLoginPage()
Description copied from interface: Mount
Returns FORM Login Page

Specified by:
getFormLoginPage in interface Mount
Returns:
the FORM Login Page and null if not configured

getProperty

public String getProperty(String name)
Description copied from interface: Mount
the string value of the property or null when the property is not present. When the property value is not of type String, we'll return the Object.toString() value

Specified by:
getProperty in interface Mount
Parameters:
name - the name of the property
Returns:
the value of the property or null when the property is not present

getDefaultSiteMapItemHandlerIds

public String[] getDefaultSiteMapItemHandlerIds()
Specified by:
getDefaultSiteMapItemHandlerIds in interface Mount
Returns:
the String[] of defaultSiteMapItemHandlerIds which all HstSiteMapItem's get or null if non configured

getMountProperties

public Map<String,String> getMountProperties()
Description copied from interface: Mount

Returns all the properties that start with "hst:mount" and have value of type String. This map has as key the propertyname after "hst:mount".

Note The property called hst:mountpoint is excluded from this map, as it has a complete different purpose

Specified by:
getMountProperties in interface Mount
Returns:
all the mount properties and an empty map if there where no mount properties

getChannelPath

public String getChannelPath()
Specified by:
getChannelPath in interface Mount
Returns:
the repository path to the channel configuration node and null if not configured

getChannelInfo

public <T extends ChannelInfo> T getChannelInfo()
Description copied from interface: Mount
The channel properties for this mount. The actual type of the info is set on the blueprint for the channel of the Mount (Blueprint#getChannelInfoClass()).

Specified by:
getChannelInfo in interface Mount
Type Parameters:
T - Type of the channel info. Only checked at runtime on assignment.
Returns:
A channel properties instance.

setChannelInfo

public void setChannelInfo(ChannelInfo channelInfo)
Description copied from interface: MutableMount
Set the channel info for the mount. The info must be constant, i.e. it must always return the same values.

Specified by:
setChannelInfo in interface MutableMount

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2008-2012 Hippo. All Rights Reserved.