public abstract class AbstractReadableRepositoryService extends AbstractRepositoryService
AbstractReadableRepositoryService
provides an abstract base
class where all methods that attempt to write throw an
UnsupportedRepositoryOperationException
. This class useful for
repository service implementation that only provide read access to the
underlying content.Modifier and Type | Field and Description |
---|---|
protected String |
defaulWsp
The name of the default workspace
|
protected static Set<String> |
WRITE_ACTIONS |
protected List<String> |
wspNames
The list of workspaces that this repository service exposes.
|
descriptors, namespaces, nodeTypeDefs, rootNodeDefinition
Constructor and Description |
---|
AbstractReadableRepositoryService(Map<String,QValue[]> descriptors,
Map<String,String> namespaces,
Reader cnd,
List<String> wspNames,
String defaultWsp)
Creates a new
AbstractReadableRepositoryService . |
Modifier and Type | Method and Description |
---|---|
protected void |
checkWorkspace(String workspaceName)
Checks whether the
workspaceName is valid. |
protected SessionInfo |
createSessionInfo(javax.jcr.Credentials credentials,
String workspaceName)
Creates a session info instance for the given
credentials and
workspaceName . |
ItemInfoCache |
getItemInfoCache(SessionInfo sessionInfo)
Returns a
ItemInfoCache for the given SessionInfo . |
NodeInfo |
getNodeInfo(SessionInfo sessionInfo,
NodeId nodeId)
This default implementation returns the first item returned by the call to
RepositoryService.getItemInfos(SessionInfo, ItemId) . |
String[] |
getWorkspaceNames(SessionInfo sessionInfo)
This default implementation first calls
AbstractRepositoryService.checkSessionInfo(SessionInfo)
with the sessionInfo , then returns the workspaces that were
passed to the constructor of this repository service. |
boolean |
isGranted(SessionInfo sessionInfo,
ItemId itemId,
String[] actions)
This default implementation first calls
AbstractRepositoryService.checkSessionInfo(SessionInfo)
with the sessionInfo , then returns false if
the any of the actions are in WRITE_ACTIONS ;
otherwise returns true . |
addVersionLabel, checkCredentials, checkin, checkout, checkout, checkpoint, checkpoint, checkQueryStatement, checkSessionInfo, clone, copy, createActivity, createBatch, createConfiguration, createEventFilter, createRootNodeDefinition, createSessionInfo, 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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getChildInfos, getItemInfos, getPrivilegeDefinitions, getPrivilegeNames, getPropertyInfo, getReferences, getSupportedPrivileges
protected final List<String> wspNames
protected final String defaulWsp
public AbstractReadableRepositoryService(Map<String,QValue[]> descriptors, Map<String,String> namespaces, Reader cnd, List<String> wspNames, String defaultWsp) throws javax.jcr.RepositoryException, ParseException, IllegalArgumentException
AbstractReadableRepositoryService
.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 workspacejavax.jcr.RepositoryException
- if the namespace mappings are invalid.ParseException
- if an error occurs while parsing the CND.IllegalArgumentException
- if defaultWsp
is null
protected void checkWorkspace(String workspaceName) throws javax.jcr.NoSuchWorkspaceException
workspaceName
is valid.checkWorkspace
in class AbstractRepositoryService
workspaceName
- name of the workspace to checkjavax.jcr.NoSuchWorkspaceException
- if workspaceName
is neither in the
list of workspace nor null (i.e. default workspace).protected SessionInfo createSessionInfo(javax.jcr.Credentials credentials, String workspaceName) throws javax.jcr.RepositoryException
AbstractRepositoryService
credentials
and
workspaceName
. This default implementation creates a
SessionInfoImpl
instance and sets the userId
and
workspaceName. The user userId
is null
or the
userId
from credentials
if it is of type
SimpleCredentials
.createSessionInfo
in class AbstractRepositoryService
credentials
- the credentials.workspaceName
- the name of the workspace to access or null
for the default workspace.credentials
and
workspaceName
.javax.jcr.RepositoryException
public ItemInfoCache getItemInfoCache(SessionInfo sessionInfo)
RepositoryService
ItemInfoCache
for the given SessionInfo
.sessionInfo
- ItemInfoCacheImpl
public NodeInfo getNodeInfo(SessionInfo sessionInfo, NodeId nodeId) throws javax.jcr.ItemNotFoundException, javax.jcr.RepositoryException
RepositoryService.getItemInfos(SessionInfo, ItemId)
. The underlying assumption here is that
the implementation and the persistence layer are optimized for batch reading. That is,
a call to getItemInfos
is no more expensive than retrieving the single
NodeInfo
only. If this assumption does not hold, subclasses should override
this method.NodeInfo
for the node identified by the given id.javax.jcr.ItemNotFoundException
javax.jcr.RepositoryException
Session.getItem(String)
,
Node.getNode(String)
,
VersionHistory.getAllVersions()
,
VersionHistory.getVersion(String)
,
VersionHistory.getVersionByLabel(String)
,
VersionHistory.getRootVersion()
,
Node.getBaseVersion()
,
Node.getVersionHistory()
,
Version.getContainingHistory()
public String[] getWorkspaceNames(SessionInfo sessionInfo) throws javax.jcr.RepositoryException
AbstractRepositoryService.checkSessionInfo(SessionInfo)
with the sessionInfo
, then returns the workspaces that were
passed to the constructor of this repository service.javax.jcr.RepositoryException
Workspace.getAccessibleWorkspaceNames()
,
Workspace.getName()
public boolean isGranted(SessionInfo sessionInfo, ItemId itemId, String[] actions) throws javax.jcr.RepositoryException
AbstractRepositoryService.checkSessionInfo(SessionInfo)
with the sessionInfo
, then returns false
if
the any of the actions
are in WRITE_ACTIONS
;
otherwise returns true
.SessionInfo
has
the specified rights for the given item.javax.jcr.RepositoryException
Session.checkPermission(String, String)
,
Session.hasPermission(String, String)
Copyright © 2004-2020 The Apache Software Foundation. All Rights Reserved.