|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.springframework.extensions.jcr.JcrAccessor
org.springframework.extensions.jcr.JcrTemplate
public class JcrTemplate
Helper class that simplifies JCR data access code. Typically used to implement data access or business
logic services that use JCR within their implementation but are JCR-agnostic in their interface. Requires a
JcrSessionFactory to provide access to a JCR repository. A workspace name is optional, as the
repository will choose the default workspace if a name is not provided.
| Constructor Summary | |
|---|---|
JcrTemplate()
|
|
JcrTemplate(SessionFactory sessionFactory)
|
|
| Method Summary | |
|---|---|
void |
addLockToken(java.lang.String lock)
|
protected javax.jcr.Session |
createSessionProxy(javax.jcr.Session session)
Create a close-suppressing proxy for the given Jcr Session. |
java.lang.String |
dump(javax.jcr.Node node)
Dump the contents of the given node in a String. |
protected java.lang.String |
dumpNode(javax.jcr.Node node)
Recursive method for dumping a node. |
java.lang.Object |
execute(JcrCallback callback)
Execute the action specified by the given action object within a Session. |
java.lang.Object |
execute(JcrCallback action,
boolean exposeNativeSession)
Execute the action specified by the given action object within a Session. |
java.lang.Object |
getAttribute(java.lang.String name)
|
java.lang.String[] |
getAttributeNames()
|
org.xml.sax.ContentHandler |
getImportContentHandler(java.lang.String parentAbsPath,
int uuidBehavior)
|
javax.jcr.Item |
getItem(java.lang.String absPath)
|
java.lang.String[] |
getLockTokens()
|
java.lang.String |
getNamespacePrefix(java.lang.String uri)
|
java.lang.String[] |
getNamespacePrefixes()
|
java.lang.String |
getNamespaceURI(java.lang.String prefix)
|
javax.jcr.Node |
getNodeByUUID(java.lang.String uuid)
|
javax.jcr.Node |
getRootNode()
|
protected javax.jcr.Session |
getSession()
Return a Session for use by this template. |
java.lang.String |
getUserID()
|
javax.jcr.ValueFactory |
getValueFactory()
|
boolean |
hasPendingChanges()
|
void |
importXML(java.lang.String parentAbsPath,
java.io.InputStream in,
int uuidBehavior)
|
boolean |
isAllowCreate()
|
boolean |
isExposeNativeSession()
|
boolean |
isLive()
|
protected boolean |
isVersionable(javax.jcr.Node node)
|
boolean |
itemExists(java.lang.String absPath)
|
void |
move(java.lang.String srcAbsPath,
java.lang.String destAbsPath)
|
java.util.Map |
query(java.util.List list)
Default method for doing multiple queries. |
java.util.Map |
query(java.util.List list,
java.lang.String language,
boolean ignoreErrors)
Utility method for executing a list of queries against the repository. |
javax.jcr.query.QueryResult |
query(javax.jcr.Node node)
Execute a persistent query from the given node. |
javax.jcr.query.QueryResult |
query(java.lang.String statement)
Execute a query with the given strings with XPATH as default language. |
javax.jcr.query.QueryResult |
query(java.lang.String statement,
java.lang.String language)
Execute a query with the given strings. |
void |
refresh(boolean keepChanges)
|
void |
removeLockToken(java.lang.String lt)
|
void |
rename(javax.jcr.Node node,
java.lang.String newName)
Renames a node (with the given name) |
void |
save()
|
void |
setAllowCreate(boolean allowCreate)
|
void |
setExposeNativeSession(boolean exposeNativeSession)
|
void |
setNamespacePrefix(java.lang.String prefix,
java.lang.String uri)
|
| Methods inherited from class org.springframework.extensions.jcr.JcrAccessor |
|---|
afterPropertiesSet, convertJcrAccessException, convertJcrAccessException, convertJcrAccessException, getSessionFactory, setSessionFactory |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public JcrTemplate()
public JcrTemplate(SessionFactory sessionFactory)
| Method Detail |
|---|
public java.lang.Object execute(JcrCallback action,
boolean exposeNativeSession)
throws org.springframework.dao.DataAccessException
JcrOperations
execute in interface JcrOperationsaction - callback object that specifies the Jcr actionexposeNativeSession - whether to expose the native Jcr Session to callback code
org.springframework.dao.DataAccessException - in case of Jcr errorsJcrOperations.execute(org.springframework.extensions.jcr.JcrCallback,
boolean)
public java.lang.Object execute(JcrCallback callback)
throws org.springframework.dao.DataAccessException
JcrOperationsSession. Application
exceptions thrown by the action object get propagated to the caller (can only be unchecked). JCR
exceptions are transformed into appropriate DAO ones. Allows for returning a result object, i.e. a
domain object or a collection of domain objects. Note: Callback code does not need to explicitly log
out of the Session; this method will handle that itself. The workspace logged into will be
that named by the workspaceName property; if that property is null, the
repository's default workspace will be used.
execute in interface JcrOperationscallback - the JCRCallback that executes the client operation
org.springframework.dao.DataAccessExceptionJcrOperations.execute(org.springframework.extensions.jcr.JcrCallback)protected javax.jcr.Session getSession()
SessionFactoryUtils.getSession(org.springframework.extensions.jcr.SessionFactory, boolean),
SessionFactoryUtils#getNewSession,
setAllowCreate(boolean)public void addLockToken(java.lang.String lock)
addLockToken in interface JcrOptionalOperationsJcrOptionalOperations.addLockToken(java.lang.String)public java.lang.Object getAttribute(java.lang.String name)
getAttribute in interface JcrModel1OperationsJcrModel1Operations.getAttribute(java.lang.String)public java.lang.String[] getAttributeNames()
getAttributeNames in interface JcrModel1OperationsJcrModel1Operations.getAttributeNames()
public org.xml.sax.ContentHandler getImportContentHandler(java.lang.String parentAbsPath,
int uuidBehavior)
getImportContentHandler in interface JcrModel1OperationsJcrModel1Operations.getImportContentHandler(java.lang.String, int)public javax.jcr.Item getItem(java.lang.String absPath)
getItem in interface JcrModel1OperationsJcrModel1Operations.getItem(java.lang.String)public java.lang.String[] getLockTokens()
getLockTokens in interface JcrOptionalOperationsJcrOptionalOperations.getLockTokens()public java.lang.String getNamespacePrefix(java.lang.String uri)
getNamespacePrefix in interface JcrModel1OperationsJcrModel1Operations.getNamespacePrefix(java.lang.String)public java.lang.String[] getNamespacePrefixes()
getNamespacePrefixes in interface JcrModel1OperationsJcrModel1Operations.getNamespacePrefixes()public java.lang.String getNamespaceURI(java.lang.String prefix)
getNamespaceURI in interface JcrModel1OperationsJcrModel1Operations.getNamespaceURI(java.lang.String)public javax.jcr.Node getNodeByUUID(java.lang.String uuid)
getNodeByUUID in interface JcrModel1OperationsJcrModel1Operations.getNodeByUUID(java.lang.String)public javax.jcr.Node getRootNode()
getRootNode in interface JcrModel1OperationsJcrModel1Operations.getRootNode()public java.lang.String getUserID()
getUserID in interface JcrModel1OperationsJcrModel1Operations.getUserID()public javax.jcr.ValueFactory getValueFactory()
getValueFactory in interface JcrModel1OperationsJcrModel1Operations.getValueFactory()public boolean hasPendingChanges()
hasPendingChanges in interface JcrModel2OperationsJcrModel2Operations.hasPendingChanges()
public void importXML(java.lang.String parentAbsPath,
java.io.InputStream in,
int uuidBehavior)
importXML in interface JcrModel2OperationsJcrModel2Operations.importXML(java.lang.String, java.io.InputStream,
int)public void refresh(boolean keepChanges)
refresh in interface JcrModel2OperationsJcrModel2Operations.refresh(boolean)public void removeLockToken(java.lang.String lt)
removeLockToken in interface JcrOptionalOperationsJcrOptionalOperations.removeLockToken(java.lang.String)
public void rename(javax.jcr.Node node,
java.lang.String newName)
JcrOperations
rename in interface JcrOperationsnode - node to renamenewName - new name for the nodeJcrOperations.rename(javax.jcr.Node, java.lang.String)
public void setNamespacePrefix(java.lang.String prefix,
java.lang.String uri)
setNamespacePrefix in interface JcrModel2OperationsJcrModel2Operations.setNamespacePrefix(java.lang.String,
java.lang.String)public boolean isLive()
isLive in interface JcrModel1OperationsJcrModel1Operations.isLive()public boolean itemExists(java.lang.String absPath)
itemExists in interface JcrModel1OperationsJcrModel1Operations.itemExists(java.lang.String)
public void move(java.lang.String srcAbsPath,
java.lang.String destAbsPath)
move in interface JcrModel2OperationsJcrModel2Operations.move(java.lang.String, java.lang.String)public void save()
save in interface JcrModel2OperationsJcrModel2Operations.save()public java.lang.String dump(javax.jcr.Node node)
JcrOperations
dump in interface JcrOperationsnode - node to be dumped (null is equivalent to the root node)
JcrOperations.dump(javax.jcr.Node)
protected java.lang.String dumpNode(javax.jcr.Node node)
throws javax.jcr.RepositoryException
node -
javax.jcr.RepositoryExceptionpublic javax.jcr.query.QueryResult query(javax.jcr.Node node)
JcrModel1Operations
query in interface JcrModel1Operationsnode - node to be dumped
JcrModel1Operations.query(javax.jcr.Node)public javax.jcr.query.QueryResult query(java.lang.String statement)
JcrModel1Operations
query in interface JcrModel1Operationsstatement - query statement
JcrModel1Operations.query(java.lang.String)
public javax.jcr.query.QueryResult query(java.lang.String statement,
java.lang.String language)
JcrModel1Operations
query in interface JcrModel1Operationsstatement - query statementlanguage - language statement
JcrModel1Operations.query(java.lang.String, java.lang.String)public java.util.Map query(java.util.List list)
JcrModel1Operations
query in interface JcrModel1Operationslist - a list of queries that will be executed against the repository
JcrModel1Operations.query(java.util.List)
public java.util.Map query(java.util.List list,
java.lang.String language,
boolean ignoreErrors)
JcrModel1Operations
query in interface JcrModel1Operationslist - list of querieslanguage - language of the queries. If null XPATH is assumed.ignoreErrors - if true it will populate unfound nodes with null
JcrModel1Operations.query(java.util.List, java.lang.String, boolean)public boolean isAllowCreate()
public void setAllowCreate(boolean allowCreate)
allowCreate - The allowCreate to set.protected javax.jcr.Session createSessionProxy(javax.jcr.Session session)
session - the Jcr Session to create a proxy for
Session.logout()
protected boolean isVersionable(javax.jcr.Node node)
throws javax.jcr.RepositoryException
javax.jcr.RepositoryExceptionpublic boolean isExposeNativeSession()
public void setExposeNativeSession(boolean exposeNativeSession)
exposeNativeSession - The exposeNativeSession to set.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||