org.hippoecm.hst.core.linking
Class AbstractResourceContainer

java.lang.Object
  extended by org.hippoecm.hst.core.linking.AbstractResourceContainer
All Implemented Interfaces:
ResourceContainer
Direct Known Subclasses:
DefaultResourceContainer, HippoGalleryAssetSet, HippoGalleryExampleImageSetContainer, HippoGalleryImageSetContainer

public abstract class AbstractResourceContainer
extends Object
implements ResourceContainer

Abstract implementation of default (simple) resource containers (like "hippogallery:exampleAssetSet" and "hippogallery:exampleImageSet"). Method ResourceContainer.getNodeType() is not yet implemented, but must be done by the concrete implementations. When you have a resource container that has its complete custom methods for resolving from and to pathInfo of the resource, then, those classes should implement their own resolveToPathInfo(Node, Node, Mount) and resolveToResourceNode(Session, String)


Constructor Summary
AbstractResourceContainer()
           
 
Method Summary
 Map<String,String> getMappings()
          returns the mapping from nodename to url prefix.
 String getPrimaryItem()
           
 String resolveToPathInfo(javax.jcr.Node resourceContainerNode, javax.jcr.Node resourceNode, Mount mount)
          Implementations should here do their logic, possibly linkrewriting.
 javax.jcr.Node resolveToResourceNode(javax.jcr.Session session, String pathInfo)
          This is the reverse of #resolvePathInfo(Node, Node, HstSite).
 void setMappings(Map<String,String> mappings)
           
 void setPrimaryItem(String primaryItem)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.hippoecm.hst.core.linking.ResourceContainer
getNodeType
 

Constructor Detail

AbstractResourceContainer

public AbstractResourceContainer()
Method Detail

setMappings

public void setMappings(Map<String,String> mappings)

getMappings

public Map<String,String> getMappings()
Description copied from interface: ResourceContainer
returns the mapping from nodename to url prefix. For example, hippogallery:thumbnail <--> thumbnail

Specified by:
getMappings in interface ResourceContainer
Returns:
the mapping from nodename to url prefix

setPrimaryItem

public void setPrimaryItem(String primaryItem)

getPrimaryItem

public String getPrimaryItem()
Specified by:
getPrimaryItem in interface ResourceContainer
Returns:
the primary item for this resource container

resolveToPathInfo

public String resolveToPathInfo(javax.jcr.Node resourceContainerNode,
                                javax.jcr.Node resourceNode,
                                Mount mount)
Description copied from interface: ResourceContainer
Implementations should here do their logic, possibly linkrewriting. With the resolved path from this method, a HstLink object is created

Specified by:
resolveToPathInfo in interface ResourceContainer
Parameters:
resourceContainerNode - The parent node of the resource node
resourceNode - The resource node itself containing the binary
mount - the Mount the link is meant for
Returns:
the resolved pathInfo for the node, or null when not able to create one

resolveToResourceNode

public javax.jcr.Node resolveToResourceNode(javax.jcr.Session session,
                                            String pathInfo)
Description copied from interface: ResourceContainer
This is the reverse of #resolvePathInfo(Node, Node, HstSite). If this ResourceContainer can resolve the pathInfo to a resource node of type ResourceContainer.getNodeType(), it returns the resourceNode. If it cannot resolve the pathInfo, null is returned

Specified by:
resolveToResourceNode in interface ResourceContainer
pathInfo - : the path from the url after the context and servlet path. It starts with a slash
Returns:
the resourceNode or null if this resource container does not know how to resolve this pathInfo


Copyright © 2008-2012 Hippo. All Rights Reserved.