info.magnolia.cms.util
Class WorkspaceAccessUtil

java.lang.Object
  extended by info.magnolia.cms.util.WorkspaceAccessUtil

public class WorkspaceAccessUtil
extends java.lang.Object

This class replaces SessionStore and provide generic methods to create Magnolia specific JCR-workspace access objects.

Author:
Sameer Charles $Id: WorkspaceAccessUtil.java 41137 2011-01-06 18:19:25Z gjoseph $
See Also:
HierarchyManager, Session, AccessManager, QueryManager

Constructor Summary
WorkspaceAccessUtil()
           
 
Method Summary
 AccessManager createAccessManager(java.util.List<Permission> permissions, java.lang.String repositoryName, java.lang.String workspaceName)
          Create access manager for the given permission list.
 AccessManager createAccessManager(javax.security.auth.Subject subject, java.lang.String repositoryName)
          Create access manager of jaas authorized subject.
 AccessManager createAccessManager(javax.security.auth.Subject subject, java.lang.String repositoryName, java.lang.String workspaceName)
          Create access manager of jaas authorized subject.
 HierarchyManager createHierarchyManager(java.lang.String userId, javax.jcr.Session jcrSession, AccessManager accessManager)
          Create new instance of DefaultHierarchyManager for the given session.
 QueryManager createQueryManager(javax.jcr.Session jcrSession, HierarchyManager hm)
          Create new access controlled magnolia query manager.
 javax.jcr.Session createRepositorySession(javax.jcr.SimpleCredentials credentials, javax.jcr.Repository repository, java.lang.String workspaceName)
          Login to the specified repository/workspace using given credentials.
 javax.jcr.Session createRepositorySession(javax.jcr.SimpleCredentials credentials, java.lang.String repositoryName)
          Login to the specified repository/default workspace using given credentials.
 javax.jcr.Session createRepositorySession(javax.jcr.SimpleCredentials credentials, java.lang.String repositoryName, java.lang.String workspaceName)
          Login to the specified repository/workspace using given credentials.
 javax.jcr.SimpleCredentials getDefaultCredentials()
           
static WorkspaceAccessUtil getInstance()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WorkspaceAccessUtil

public WorkspaceAccessUtil()
Method Detail

getInstance

public static WorkspaceAccessUtil getInstance()

getDefaultCredentials

public javax.jcr.SimpleCredentials getDefaultCredentials()
Returns:
Default SimpleCredentials as configured in magnolia.properties

createRepositorySession

public javax.jcr.Session createRepositorySession(javax.jcr.SimpleCredentials credentials,
                                                 java.lang.String repositoryName)
                                          throws javax.jcr.RepositoryException
Login to the specified repository/default workspace using given credentials.

Parameters:
credentials -
repositoryName -
Returns:
newly created JCR session
Throws:
javax.jcr.RepositoryException - if login fails or workspace does not exist

createRepositorySession

public javax.jcr.Session createRepositorySession(javax.jcr.SimpleCredentials credentials,
                                                 java.lang.String repositoryName,
                                                 java.lang.String workspaceName)
                                          throws javax.jcr.RepositoryException
Login to the specified repository/workspace using given credentials.

Parameters:
credentials -
repositoryName -
workspaceName -
Returns:
newly created JCR session
Throws:
javax.jcr.RepositoryException - if login fails or workspace does not exist

createRepositorySession

public javax.jcr.Session createRepositorySession(javax.jcr.SimpleCredentials credentials,
                                                 javax.jcr.Repository repository,
                                                 java.lang.String workspaceName)
                                          throws javax.jcr.RepositoryException
Login to the specified repository/workspace using given credentials.

Parameters:
credentials -
repository -
workspaceName -
Returns:
newly created JCR session
Throws:
javax.jcr.RepositoryException - if login fails or workspace does not exist

createAccessManager

public AccessManager createAccessManager(javax.security.auth.Subject subject,
                                         java.lang.String repositoryName)
Create access manager of jaas authorized subject.

Parameters:
subject -
repositoryName -
Returns:
newly created accessmanager

createAccessManager

public AccessManager createAccessManager(javax.security.auth.Subject subject,
                                         java.lang.String repositoryName,
                                         java.lang.String workspaceName)
Create access manager of jaas authorized subject.

Parameters:
subject -
repositoryName -
workspaceName -
Returns:
newly created accessmanager

createAccessManager

public AccessManager createAccessManager(java.util.List<Permission> permissions,
                                         java.lang.String repositoryName,
                                         java.lang.String workspaceName)
Create access manager for the given permission list.

Parameters:
permissions -

createQueryManager

public QueryManager createQueryManager(javax.jcr.Session jcrSession,
                                       HierarchyManager hm)
                                throws javax.jcr.RepositoryException
Create new access controlled magnolia query manager.

Parameters:
jcrSession -
accessManager -
Throws:
javax.jcr.RepositoryException

createHierarchyManager

public HierarchyManager createHierarchyManager(java.lang.String userId,
                                               javax.jcr.Session jcrSession,
                                               AccessManager accessManager)
                                        throws javax.jcr.RepositoryException
Create new instance of DefaultHierarchyManager for the given session.

Parameters:
userId - this is used in MetaData of objects created via this HierarchyManager instance
jcrSession -
accessManager -
queryManager -
Throws:
javax.jcr.RepositoryException


Copyright © 2003-2011 Magnolia International Ltd.. All Rights Reserved.