|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.jackrabbit.ocm.manager.impl.ObjectContentManagerImpl
public class ObjectContentManagerImpl
Default implementation for
ObjectContentManager
Field Summary | |
---|---|
protected Mapper |
mapper
|
protected ObjectConverter |
objectConverter
|
protected QueryManager |
queryManager
|
protected ObjectCache |
requestObjectCache
|
protected javax.jcr.Session |
session
|
Constructor Summary | |
---|---|
ObjectContentManagerImpl(Mapper mapper,
ObjectConverter converter,
QueryManager queryManager,
ObjectCache requestObjectCache,
javax.jcr.Session session)
Full constructor. |
|
ObjectContentManagerImpl(javax.jcr.Session session,
InputStream[] xmlMappingFiles)
Creates a new ObjectContentManager based on a JCR session
and some xml mapping files. |
|
ObjectContentManagerImpl(javax.jcr.Session session,
Mapper mapper)
Creates a new ObjectContentManager that uses the passed in
Mapper , and a Session |
|
ObjectContentManagerImpl(javax.jcr.Session session,
String[] xmlMappingFiles)
Creates a new ObjectContentManager based on a JCR session
and some xml mapping files. |
Method Summary | |
---|---|
void |
addVersionLabel(String path,
String versionName,
String versionLabel)
Add a new label to a particular version |
protected void |
checkIfNodeLocked(String absPath)
Throws LockedException id node is locked so alter nopde cannot be
done |
void |
checkin(String path)
Checkin an object |
void |
checkin(String path,
String[] versionLabels)
Checkin an object and apply some labels to this new version Within a particular object path, a given label may appear a maximum of once |
void |
checkout(String path)
Checkout - Create a new version This is only possible if the object is based on mix:versionable node type |
void |
copy(String srcPath,
String destPath)
Copy an object from scrPath to destPath . |
String[] |
getAllVersionLabels(String path)
Get all version labels assigned to all versions |
VersionIterator |
getAllVersions(String path)
Get all object versions |
Version |
getBaseVersion(String path)
Get the lastest object version |
protected javax.jcr.Node |
getNode(String absPath)
|
Object |
getObject(Class objectClass,
String path)
Get an object from the JCR repository |
Object |
getObject(Class objectClass,
String path,
String versionName)
Get an object from the JCR repository |
Object |
getObject(Query query)
Retrieve an object matching to a query |
Object |
getObject(String path)
Get an object from the JCR repository |
Object |
getObject(String path,
String versionName)
Get an object from the JCR repository |
Object |
getObjectByUuid(String uuid)
Get an object from the JCR repository |
Iterator |
getObjectIterator(Query query)
Retrieve some objects matching to a query. |
Iterator |
getObjectIterator(String query,
String language)
Retrieve an objects matching a query specified in a specific query language. |
Collection |
getObjects(Class objectClass,
String path)
Returns a list of objects (not supertypes) of that particular class which are associated to a specific path. |
Collection |
getObjects(Query query)
Retrieve some objects matching to a query |
Collection |
getObjects(String query,
String language)
Return a list of object matching to a JCR query |
QueryManager |
getQueryManager()
|
Version |
getRootVersion(String path)
Get the first object version |
javax.jcr.Session |
getSession()
This method returns the JCR session. |
Version |
getVersion(String path,
String versionName)
Get a particular version |
String[] |
getVersionLabels(String path,
String versionName)
Get all version labels assigned to a particular object version |
void |
insert(Object object)
Insert an object into the JCR repository |
boolean |
isLocked(String absPath)
Is that path locked? |
boolean |
isPersistent(Class clazz)
Can this object content manager insert, update, delete, ... |
Lock |
lock(String absPath,
boolean isDeep,
boolean isSessionScoped)
Lock object saved on . |
void |
logout()
Close the session |
protected void |
maybeAddLockToken(String lockToken,
String path)
|
void |
move(String srcPath,
String destPath)
Move an object |
boolean |
objectExists(String path)
Check if an object exists |
void |
refresh(boolean keepChanges)
Refresh the underlying jcr session (see the jcr spec) |
void |
remove(Object object)
Remove an object from a JCR repository |
void |
remove(Query query)
Remove all objects matching to a query |
void |
remove(String path)
Remove an object from a JCR repository |
void |
retrieveAllMappedAttributes(Object object)
Retrieve all mapped attributes for the given persistent object. |
void |
retrieveMappedAttribute(Object object,
String attributeName)
Retrieve the specified attribute for the given persistent object. |
void |
save()
Save all modifications made by the object content manager |
void |
setMapper(Mapper mapper)
Sets the Mapper used by this object content manager. |
void |
setObjectConverter(ObjectConverter objectConverter)
Sets the ObjectConverter that is used internally by this
object content manager. |
void |
setQueryManager(QueryManager queryManager)
Sets the QueryManager used by the object content manager. |
void |
setRequestObjectCache(ObjectCache requestObjectCache)
|
void |
unlock(String absPath,
String lockToken)
Unlock object stored on . |
void |
update(Object object)
Update an object |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected javax.jcr.Session session
protected Mapper mapper
protected QueryManager queryManager
protected ObjectConverter objectConverter
protected ObjectCache requestObjectCache
Constructor Detail |
---|
public ObjectContentManagerImpl(javax.jcr.Session session, Mapper mapper)
ObjectContentManager
that uses the passed in
Mapper
, and a Session
mapper
- the Mapper componentsession
- The JCR sessionpublic ObjectContentManagerImpl(javax.jcr.Session session, String[] xmlMappingFiles)
ObjectContentManager
based on a JCR session
and some xml mapping files.
session
- The JCR sessionxmlMappingFiles
- the JCR mapping files used mainly to create the
Mapper
componentpublic ObjectContentManagerImpl(javax.jcr.Session session, InputStream[] xmlMappingFiles)
ObjectContentManager
based on a JCR session
and some xml mapping files.
session
- The JCR sessionxmlMappingFiles
- the JCR mapping files used mainly to create the
Mapper
componentpublic ObjectContentManagerImpl(Mapper mapper, ObjectConverter converter, QueryManager queryManager, ObjectCache requestObjectCache, javax.jcr.Session session)
mapper
- the Mapper componentconverter
- the ObjectConverter
to be used internallyqueryManager
- the query manager to usedsession
- The JCR sessionMethod Detail |
---|
public void setMapper(Mapper mapper)
Mapper
used by this object content manager.
mapper
- mapping solverpublic void setObjectConverter(ObjectConverter objectConverter)
ObjectConverter
that is used internally by this
object content manager.
objectConverter
- the internal ObjectConverter
public void setQueryManager(QueryManager queryManager)
QueryManager
used by the object content manager.
queryManager
- a QueryManager
public void setRequestObjectCache(ObjectCache requestObjectCache)
public Object getObject(String path)
ObjectContentManager
getObject
in interface ObjectContentManager
path
- the object path
RepositoryException
- if the underlying repository has thrown a
javax.jcr.RepositoryException
JcrMappingException
- if the mapping for the class is not correct
ObjectContentManagerException
- if the object cannot be retrieved from the pathObjectContentManager.getObject(java.lang.Class,
java.lang.String)
public Object getObjectByUuid(String uuid)
ObjectContentManager
getObjectByUuid
in interface ObjectContentManager
uuid
- the uuid
of the backing jcr node
uuid
RepositoryException
- if the underlying repository has thrown a javax.jcr.RepositoryException
JcrMappingException
- if the mapping for the class is not correct
ObjectContentManagerException
- if the object cannot be retrieved from the path
IllegalArgumentException
- when the uuid
is null
or not a valid UUIDpublic Object getObject(String path, String versionName)
ObjectContentManager
getObject
in interface ObjectContentManager
path
- the object's absolute jcr pathversionName
- the version that needs to be fetched
path
and version versionName
or null
if there is no jcr node for the specified
path and versionName
RepositoryException
- if the underlying repository has thrown a
javax.jcr.RepositoryException
JcrMappingException
- if the mapping for the class is not correct
ObjectContentManagerException
- if the object cannot be retrieved from the path and versionNamepublic Object getObject(Class objectClass, String path)
ObjectContentManager
getObject
in interface ObjectContentManager
objectClass
- the object mapping classpath
- the object's absolute jcr path
path
pr null
if there is no jcr node at path
RepositoryException
- if the underlying repository has thrown a
javax.jcr.RepositoryException
JcrMappingException
- if the mapping for the class is not correct
ObjectContentManagerException
- if the object cannot be retrieved from the pathpublic Object getObject(Class objectClass, String path, String versionName)
ObjectContentManager
getObject
in interface ObjectContentManager
objectClass
- the object classpath
- the object pathversionName
- The desired object version number
public void retrieveAllMappedAttributes(Object object)
ObjectContentManager
retrieveAllMappedAttributes
in interface ObjectContentManager
object
- The persistent objectpublic void retrieveMappedAttribute(Object object, String attributeName)
ObjectContentManager
retrieveMappedAttribute
in interface ObjectContentManager
object
- The persistent objectattributeName
- The name of the attribute to retrievepublic void insert(Object object)
ObjectContentManager
insert
in interface ObjectContentManager
object
- the object to addpublic void update(Object object)
ObjectContentManager
update
in interface ObjectContentManager
object
- the object to updatepublic void remove(String path)
ObjectContentManager
remove
in interface ObjectContentManager
path
- the object pathpublic void remove(Object object)
ObjectContentManager
remove
in interface ObjectContentManager
object
- the object to removepublic void remove(Query query)
ObjectContentManager
remove
in interface ObjectContentManager
query
- The query used to find the objects to removepublic boolean objectExists(String path)
ObjectContentManager
objectExists
in interface ObjectContentManager
path
- the object path
public boolean isPersistent(Class clazz)
ObjectContentManager
isPersistent
in interface ObjectContentManager
clazz
- class for question
true
if the class is persistencepublic Object getObject(Query query)
ObjectContentManager
getObject
in interface ObjectContentManager
query
- The Query object used to seach the object
public Collection getObjects(Query query)
ObjectContentManager
getObjects
in interface ObjectContentManager
query
- The query used to seach the objects
public Collection getObjects(Class objectClass, String path) throws ObjectContentManagerException
ObjectContentManager
getObjects
in interface ObjectContentManager
path
- Node path.
path
or when
objectClass is not mapped
ObjectContentManagerException
public Iterator getObjectIterator(Query query)
ObjectContentManager
getObjectIterator
in interface ObjectContentManager
query
- The query used to seach the objects
public Iterator getObjectIterator(String query, String language)
ObjectContentManager
Query
using the session's QueryManager
with the given query
exception and language parameters.
If the query statement
is syntactically invalid, given the
language specified, an InvalidQueryException
is thrown.
The language
must be a string from among those returned by
javax.jcr.QueryManager.getSupportedQueryLanguages()
; if
it is not, then an InvalidQueryException
is thrown.
getObjectIterator
in interface ObjectContentManager
query
- The query to execute to find the objects.language
- The language in which the query is written
QueryManager.createQuery(String, String)
,
QueryManager.getSupportedQueryLanguages()
public Collection getObjects(String query, String language)
ObjectContentManager
getObjects
in interface ObjectContentManager
query
- the JCR querylanguage
- the JCR Language ("XPATH" or "SQL").
public void checkin(String path)
ObjectContentManager
checkin
in interface ObjectContentManager
path
- the object pathpublic void checkin(String path, String[] versionLabels)
ObjectContentManager
checkin
in interface ObjectContentManager
path
- The object pathversionLabels
- the version labels to apply to the new versionpublic void checkout(String path)
ObjectContentManager
checkout
in interface ObjectContentManager
path
- The object pathpublic void addVersionLabel(String path, String versionName, String versionLabel)
ObjectContentManager
addVersionLabel
in interface ObjectContentManager
path
- the object pathversionName
- the object versio name (1.0, 1.1, ...)versionLabel
- The new label to applypublic Version getVersion(String path, String versionName)
ObjectContentManager
getVersion
in interface ObjectContentManager
path
- the object pathversionName
- the version name
public String[] getVersionLabels(String path, String versionName)
ObjectContentManager
getVersionLabels
in interface ObjectContentManager
path
- the object pathversionName
- the object version name (1.0, ...)
public String[] getAllVersionLabels(String path)
ObjectContentManager
getAllVersionLabels
in interface ObjectContentManager
path
- the object path
public VersionIterator getAllVersions(String path)
ObjectContentManager
getAllVersions
in interface ObjectContentManager
path
- the object path
public Version getRootVersion(String path)
ObjectContentManager
getRootVersion
in interface ObjectContentManager
path
- the object path
public Version getBaseVersion(String path)
ObjectContentManager
getBaseVersion
in interface ObjectContentManager
path
- the object path
public Lock lock(String absPath, boolean isDeep, boolean isSessionScoped) throws LockedException
ObjectContentManager
lock
in interface ObjectContentManager
absPath
- path to saved object.isDeep
- is lock deep? See JCR spec: 8.4.3 Shallow and Deep LocksisSessionScoped
- is lock session scoped? See JCR spec: Session-scoped and
Open-scoped Locks
LockedException
- if path is locked (cannot lock same path again)public void unlock(String absPath, String lockToken) throws IllegalUnlockException
ObjectContentManager
unlock
in interface ObjectContentManager
absPath
- path to stored objectlockToken
- see JCR spec: 8.4.6 Lock Token; can be null
IllegalUnlockException
- throws if the current operation does not own the current lockpublic boolean isLocked(String absPath)
ObjectContentManager
isLocked
in interface ObjectContentManager
true
if path lockedpublic QueryManager getQueryManager()
getQueryManager
in interface ObjectContentManager
protected void checkIfNodeLocked(String absPath) throws javax.jcr.RepositoryException, LockedException
LockedException
id node is locked so alter nopde cannot be
done
absPath
- abs path to node
javax.jcr.RepositoryException
LockedException
- if node is lockedprotected void maybeAddLockToken(String lockToken, String path)
protected javax.jcr.Node getNode(String absPath) throws javax.jcr.PathNotFoundException, javax.jcr.RepositoryException
javax.jcr.PathNotFoundException
javax.jcr.RepositoryException
public void logout()
ObjectContentManager
logout
in interface ObjectContentManager
public void save()
ObjectContentManager
save
in interface ObjectContentManager
public javax.jcr.Session getSession()
ObjectContentManager
getSession
in interface ObjectContentManager
public void refresh(boolean keepChanges)
ObjectContentManager
refresh
in interface ObjectContentManager
public void move(String srcPath, String destPath)
ObjectContentManager
move
in interface ObjectContentManager
srcPath
- path of the object to movedestPath
- destination pathpublic void copy(String srcPath, String destPath) throws ObjectContentManagerException
ObjectContentManager
scrPath
to destPath
. When there does not exist a node yet at
destPath
a new node will be created there if the parent Node
exists already. If
the parent does not exist, an ObjectContentManagerException
will be thrown
If there already exists a node at destPath
, we
try to add the Node
from srcPath
. If not possible, an ObjectContentManagerException
will be thrown.
copy
in interface ObjectContentManager
srcPath
- path of the object to copydestPath
- destination path
ObjectContentManagerException
- when the copy did not succeed for example because there exists no Node
at
srcPath
the parent of destPath
does not exist or there already exists an (incompatible) node at destPath
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |