org.hippoecm.hst.jaxrs.services
Class AbstractResource

java.lang.Object
  extended by org.hippoecm.hst.jaxrs.services.AbstractResource
Direct Known Subclasses:
AbstractContentResource

public abstract class AbstractResource
extends Object

Version:
$Id: AbstractResource.java 32630 2012-01-23 20:12:36Z wko $

Field Summary
static String BEANS_ANNOTATED_CLASSES_CONF_PARAM
           
static String HST_MOUNT_REL_PREFIX
           
static String HST_REST_RELATIONS_BASE_URI
           
static String MOUNT_ALIAS_ASSETS
           
static String MOUNT_ALIAS_GALLERY
           
static String MOUNT_ALIAS_REST
           
static String MOUNT_ALIAS_SITE
           
 
Constructor Summary
AbstractResource()
           
 
Method Summary
protected  String deleteHippoBean(javax.servlet.http.HttpServletRequest servletRequest, HippoBean hippoBean)
           
 List<Class<? extends HippoBean>> getAnnotatedClasses(HstRequestContext requestContext)
           
 String getAnnotatedClassesResourcePath()
           
protected  HippoBean getChildBeanByRelPathOrPrimaryNodeType(HippoBean hippoBean, String relPath, String primaryNodeType)
           
protected  ObjectBeanPersistenceManager getContentPersistenceManager(HstRequestContext requestContext)
          Deprecated. Use getPersistableSession(HstRequestContext) with Persistable annotation on the method, or getPersistenceManager(HstRequestContext, Session) with getPersistableSession(HstRequestContext) argument instead.
 ContentRewriter<String> getContentRewriter()
           
protected  String getHstQualifiedLinkRel(String simpleRel)
           
 HstQueryManager getHstQueryManager(HstRequestContext requestContext)
           
 HstQueryManager getHstQueryManager(javax.jcr.Session session, HstRequestContext requestContext)
           
protected  String getLinkMountRelation(String mountName)
           
 HippoFolderBean getMountContentBaseBean(HstRequestContext requestContext)
           
protected  Link getMountLink(HstRequestContext requestContext, HippoBean hippoBean, String mountAliasName, String subPath)
           
protected  Link getNodeLink(HstRequestContext requestContext, HippoBean hippoBean)
           
 ObjectConverter getObjectConverter(HstRequestContext requestContext)
           
protected  javax.jcr.Session getPersistableSession(HstRequestContext requestContext)
          Creates a persistable JCR session with the default credentials
protected  javax.jcr.Session getPersistableSession(HstRequestContext requestContext, javax.jcr.Credentials credentials)
          Creates a persistable JCR session with provided credentials.
protected  ObjectBeanPersistenceManager getPersistenceManager(HstRequestContext requestContext)
          Creates and returns a persistence manager with the default session of the requestContext.
protected  ObjectBeanPersistenceManager getPersistenceManager(HstRequestContext requestContext, javax.jcr.Session persistableSession)
          Creates and returns a persistence manager with the specified session.
protected  String getQualifiedLinkRel(String simpleRel)
           
protected  String getQualifiedLinkRel(String iri, String simpleRel)
           
protected  HippoBean getRequestContentBean(HstRequestContext requestContext)
          Returns the content HippoBean for the current request.
protected
<T extends HippoBean>
T
getRequestContentBean(HstRequestContext requestContext, Class<T> beanMappingClass)
          Returns the content HippoBean of type T for the current request.
protected  HstRequestContext getRequestContext(javax.servlet.http.HttpServletRequest servletRequest)
           
protected  Link getRestLink(HstRequestContext requestContext, HippoBean hippoBean, String subPath)
           
 String getRestRelationsBaseUri()
           
protected  Link getSiteLink(HstRequestContext requestContext, HippoBean hippoBean)
           
 boolean isPageLinksExternal()
           
 void setAnnotatedClasses(List<Class<? extends HippoBean>> annotatedClasses)
           
 void setAnnotatedClassesResourcePath(String annotatedClassesResourcePath)
           
 void setContentRewriter(ContentRewriter<String> contentRewriter)
           
 void setHstQueryManagerFactory(HstQueryManagerFactory hstQueryManagerFactory)
           
 void setObjectConverter(ObjectConverter objectConverter)
           
 void setPageLinksExternal(boolean pageLinksExternal)
           
 void setRestRelationsBaseUri(String restRelationsBaseUri)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BEANS_ANNOTATED_CLASSES_CONF_PARAM

public static final String BEANS_ANNOTATED_CLASSES_CONF_PARAM
See Also:
Constant Field Values

MOUNT_ALIAS_REST

public static final String MOUNT_ALIAS_REST
See Also:
Constant Field Values

MOUNT_ALIAS_SITE

public static final String MOUNT_ALIAS_SITE
See Also:
Constant Field Values

MOUNT_ALIAS_GALLERY

public static final String MOUNT_ALIAS_GALLERY
See Also:
Constant Field Values

MOUNT_ALIAS_ASSETS

public static final String MOUNT_ALIAS_ASSETS
See Also:
Constant Field Values

HST_REST_RELATIONS_BASE_URI

public static final String HST_REST_RELATIONS_BASE_URI
See Also:
Constant Field Values

HST_MOUNT_REL_PREFIX

public static final String HST_MOUNT_REL_PREFIX
See Also:
Constant Field Values
Constructor Detail

AbstractResource

public AbstractResource()
Method Detail

getAnnotatedClassesResourcePath

public String getAnnotatedClassesResourcePath()

setAnnotatedClassesResourcePath

public void setAnnotatedClassesResourcePath(String annotatedClassesResourcePath)

getAnnotatedClasses

public List<Class<? extends HippoBean>> getAnnotatedClasses(HstRequestContext requestContext)

setAnnotatedClasses

public void setAnnotatedClasses(List<Class<? extends HippoBean>> annotatedClasses)

getObjectConverter

public ObjectConverter getObjectConverter(HstRequestContext requestContext)

setObjectConverter

public void setObjectConverter(ObjectConverter objectConverter)

getHstQueryManager

public HstQueryManager getHstQueryManager(HstRequestContext requestContext)
Parameters:
requestContext -
Returns:

getHstQueryManager

public HstQueryManager getHstQueryManager(javax.jcr.Session session,
                                          HstRequestContext requestContext)

setHstQueryManagerFactory

public void setHstQueryManagerFactory(HstQueryManagerFactory hstQueryManagerFactory)

getRestRelationsBaseUri

public String getRestRelationsBaseUri()

setRestRelationsBaseUri

public void setRestRelationsBaseUri(String restRelationsBaseUri)

isPageLinksExternal

public boolean isPageLinksExternal()

setPageLinksExternal

public void setPageLinksExternal(boolean pageLinksExternal)

getContentRewriter

public ContentRewriter<String> getContentRewriter()

setContentRewriter

public void setContentRewriter(ContentRewriter<String> contentRewriter)

getContentPersistenceManager

protected ObjectBeanPersistenceManager getContentPersistenceManager(HstRequestContext requestContext)
                                                             throws javax.jcr.RepositoryException
Deprecated. Use getPersistableSession(HstRequestContext) with Persistable annotation on the method, or getPersistenceManager(HstRequestContext, Session) with getPersistableSession(HstRequestContext) argument instead.

Parameters:
requestContext -
Returns:
Throws:
javax.jcr.RepositoryException

getPersistenceManager

protected ObjectBeanPersistenceManager getPersistenceManager(HstRequestContext requestContext)
                                                      throws javax.jcr.RepositoryException
Creates and returns a persistence manager with the default session of the requestContext.

Note: when the operation is annotated with Persistable, the default session of the requestContext should already be a persistable (writable) session.

Parameters:
requestContext -
Returns:
Throws:
javax.jcr.RepositoryException

getPersistenceManager

protected ObjectBeanPersistenceManager getPersistenceManager(HstRequestContext requestContext,
                                                             javax.jcr.Session persistableSession)
                                                      throws javax.jcr.RepositoryException
Creates and returns a persistence manager with the specified session.

Parameters:
requestContext -
persistableSession -
Returns:
Throws:
javax.jcr.RepositoryException

getRequestContext

protected HstRequestContext getRequestContext(javax.servlet.http.HttpServletRequest servletRequest)

getRequestContentBean

protected <T extends HippoBean> T getRequestContentBean(HstRequestContext requestContext,
                                                        Class<T> beanMappingClass)
                                             throws ObjectBeanManagerException
Returns the content HippoBean of type T for the current request. If there cannot be found a bean of type beanMappingClass for the relative content path of the resolved sitemap item a ObjectBeanManagerException is thrown If there is no resolved sitemap item, null is returned.

Type Parameters:
T -
Parameters:
requestContext -
beanMappingClass -
Returns:
a bean of type T
Throws:
ObjectBeanManagerException - when there cannot be returned a bean

getRequestContentBean

protected HippoBean getRequestContentBean(HstRequestContext requestContext)
                                   throws ObjectBeanManagerException
Returns the content HippoBean for the current request.

Parameters:
requestContext -
beanMappingClass -
Returns:
the HippoBean where the relative contentpath of the sitemap item points to
Throws:
ObjectBeanManagerException - when there cannot be returned a bean

getMountContentBaseBean

public HippoFolderBean getMountContentBaseBean(HstRequestContext requestContext)
                                        throws ObjectBeanManagerException
Parameters:
requestContext -
Returns:
HippoFolderBean the mountContentBaseBean
Throws:
ObjectBeanManagerException - when there cannot be returned a site content base bean

deleteHippoBean

protected String deleteHippoBean(javax.servlet.http.HttpServletRequest servletRequest,
                                 HippoBean hippoBean)
                          throws javax.jcr.RepositoryException,
                                 ObjectBeanPersistenceException
Throws:
javax.jcr.RepositoryException
ObjectBeanPersistenceException

getChildBeanByRelPathOrPrimaryNodeType

protected HippoBean getChildBeanByRelPathOrPrimaryNodeType(HippoBean hippoBean,
                                                           String relPath,
                                                           String primaryNodeType)

getQualifiedLinkRel

protected String getQualifiedLinkRel(String iri,
                                     String simpleRel)

getQualifiedLinkRel

protected String getQualifiedLinkRel(String simpleRel)

getHstQualifiedLinkRel

protected String getHstQualifiedLinkRel(String simpleRel)

getLinkMountRelation

protected String getLinkMountRelation(String mountName)

getNodeLink

protected Link getNodeLink(HstRequestContext requestContext,
                           HippoBean hippoBean)

getRestLink

protected Link getRestLink(HstRequestContext requestContext,
                           HippoBean hippoBean,
                           String subPath)

getSiteLink

protected Link getSiteLink(HstRequestContext requestContext,
                           HippoBean hippoBean)

getMountLink

protected Link getMountLink(HstRequestContext requestContext,
                            HippoBean hippoBean,
                            String mountAliasName,
                            String subPath)

getPersistableSession

protected javax.jcr.Session getPersistableSession(HstRequestContext requestContext)
                                           throws javax.jcr.RepositoryException
Creates a persistable JCR session with the default credentials

Note: The client should invoke logout() method on the session after use.

Internally, Session.impersonate(Credentials) method will be used to create a persistable JCR session. The method is invoked on the session from the session pooling repository.

Parameters:
requestContext -
Returns:
Throws:
javax.jcr.RepositoryException

getPersistableSession

protected javax.jcr.Session getPersistableSession(HstRequestContext requestContext,
                                                  javax.jcr.Credentials credentials)
                                           throws javax.jcr.RepositoryException
Creates a persistable JCR session with provided credentials.

Note: The client should invoke logout() method on the session after use.

Internally, Session.impersonate(Credentials) method will be used to create a persistable JCR session. The method is invoked on the session from the session pooling repository.

Parameters:
requestContext -
Returns:
Throws:
javax.jcr.RepositoryException


Copyright © 2008-2012 Hippo. All Rights Reserved.