Class AbstractReadableRepositoryService
- java.lang.Object
-
- org.apache.jackrabbit.spi.commons.AbstractRepositoryService
-
- org.apache.jackrabbit.spi.commons.AbstractReadableRepositoryService
-
- All Implemented Interfaces:
RepositoryService
public abstract class AbstractReadableRepositoryService extends AbstractRepositoryService
AbstractReadableRepositoryServiceprovides an abstract base class where all methods that attempt to write throw anUnsupportedRepositoryOperationException. This class useful for repository service implementation that only provide read access to the underlying content.
-
-
Constructor Summary
Constructors Constructor Description AbstractReadableRepositoryService(java.util.Map<java.lang.String,QValue[]> descriptors, java.util.Map<java.lang.String,java.lang.String> namespaces, java.io.Reader cnd, java.util.List<java.lang.String> wspNames, java.lang.String defaultWsp)Creates a newAbstractReadableRepositoryService.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ItemInfoCachegetItemInfoCache(SessionInfo sessionInfo)Returns aItemInfoCachefor the givenSessionInfo.NodeInfogetNodeInfo(SessionInfo sessionInfo, NodeId nodeId)This default implementation returns the first item returned by the call toRepositoryService.getItemInfos(SessionInfo, ItemId).java.lang.String[]getWorkspaceNames(SessionInfo sessionInfo)This default implementation first callsAbstractRepositoryService.checkSessionInfo(SessionInfo)with thesessionInfo, then returns the workspaces that were passed to the constructor of this repository service.booleanisGranted(SessionInfo sessionInfo, ItemId itemId, java.lang.String[] actions)This default implementation first callsAbstractRepositoryService.checkSessionInfo(SessionInfo)with thesessionInfo, then returnsfalseif the any of theactionsare inWRITE_ACTIONS; otherwise returnstrue.-
Methods inherited from class org.apache.jackrabbit.spi.commons.AbstractRepositoryService
addVersionLabel, checkin, checkout, checkout, checkpoint, checkpoint, checkQueryStatement, clone, copy, createActivity, createBatch, createConfiguration, createEventFilter, createSubscription, createTree, createWorkspace, deleteWorkspace, dispose, dispose, executeQuery, getEvents, getEvents, getIdFactory, getLockInfo, getNameFactory, getNamespacePrefix, getNamespaceURI, getNodeDefinition, getPathFactory, getPropertyDefinition, getQNodeTypeDefinitions, getQNodeTypeDefinitions, getQValueFactory, getRegisteredNamespaces, getRepositoryDescriptors, getSupportedQueryLanguages, impersonate, importXml, lock, lock, merge, merge, mergeActivity, move, obtain, obtain, refreshLock, registerNamespace, registerNodeTypes, removeActivity, removeVersion, removeVersionLabel, resolveMergeConflict, restore, restore, submit, unlock, unregisterNamespace, unregisterNodeTypes, update, updateEventFilters
-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.jackrabbit.spi.RepositoryService
getChildInfos, getItemInfos, getPrivilegeDefinitions, getPrivilegeNames, getPropertyInfo, getReferences, getSupportedPrivileges
-
-
-
-
Constructor Detail
-
AbstractReadableRepositoryService
public AbstractReadableRepositoryService(java.util.Map<java.lang.String,QValue[]> descriptors, java.util.Map<java.lang.String,java.lang.String> namespaces, java.io.Reader cnd, java.util.List<java.lang.String> wspNames, java.lang.String defaultWsp) throws javax.jcr.RepositoryException, ParseException, java.lang.IllegalArgumentException
Creates a newAbstractReadableRepositoryService.- Parameters:
descriptors- the repository descriptors. Maps descriptor keys to descriptor values.namespaces- the namespaces. Maps namespace prefixes to namespace URIs.cnd- a reader on the compact node type definition.wspNames- a list of workspace names.defaultWsp- name of the default workspace- Throws:
javax.jcr.RepositoryException- if the namespace mappings are invalid.ParseException- if an error occurs while parsing the CND.java.lang.IllegalArgumentException- ifdefaultWspisnull
-
-
Method Detail
-
getItemInfoCache
public ItemInfoCache getItemInfoCache(SessionInfo sessionInfo)
Description copied from interface:RepositoryServiceReturns aItemInfoCachefor the givenSessionInfo.- Parameters:
sessionInfo-- Returns:
- a new instance of
ItemInfoCacheImpl
-
getNodeInfo
public NodeInfo getNodeInfo(SessionInfo sessionInfo, NodeId nodeId) throws javax.jcr.ItemNotFoundException, javax.jcr.RepositoryException
This default implementation returns the first item returned by the call toRepositoryService.getItemInfos(SessionInfo, ItemId). The underlying assumption here is that the implementation and the persistence layer are optimized for batch reading. That is, a call togetItemInfosis no more expensive than retrieving the singleNodeInfoonly. If this assumption does not hold, subclasses should override this method.- Returns:
- The
NodeInfofor the node identified by the given id. - Throws:
javax.jcr.ItemNotFoundExceptionjavax.jcr.RepositoryException- See Also:
Session.getItem(String),Node.getNode(String),VersionHistory.getAllVersions(),VersionHistory.getVersion(String),VersionHistory.getVersionByLabel(String),VersionHistory.getRootVersion(),Node.getBaseVersion(),Node.getVersionHistory(),Version.getContainingHistory()
-
getWorkspaceNames
public java.lang.String[] getWorkspaceNames(SessionInfo sessionInfo) throws javax.jcr.RepositoryException
This default implementation first callsAbstractRepositoryService.checkSessionInfo(SessionInfo)with thesessionInfo, then returns the workspaces that were passed to the constructor of this repository service.- Returns:
- An array of workspace names.
- Throws:
javax.jcr.RepositoryException- See Also:
Workspace.getAccessibleWorkspaceNames(),Workspace.getName()
-
isGranted
public boolean isGranted(SessionInfo sessionInfo, ItemId itemId, java.lang.String[] actions) throws javax.jcr.RepositoryException
This default implementation first callsAbstractRepositoryService.checkSessionInfo(SessionInfo)with thesessionInfo, then returnsfalseif the any of theactionsare inWRITE_ACTIONS; otherwise returnstrue.- Returns:
- true if the session with the given
SessionInfohas the specified rights for the given item. - Throws:
javax.jcr.RepositoryException- See Also:
Session.checkPermission(String, String),Session.hasPermission(String, String)
-
-