-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
+ improved sessionHolderProvider discovery mechanism (declarative lis…
…t or JDK 1.3 META-INF/services supported out-of-the-box) + TransactionAwareRepository added + refactored JcrOperations in different interfaces to mirror + added complete JCR exception convertor + changed the contract of SessionFactory interface
- Loading branch information
costin
committed
Nov 11, 2005
1 parent
370c272
commit a83c00f
Showing
24 changed files
with
1,518 additions
and
575 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
144 changes: 144 additions & 0 deletions
144
src/java/org/springmodules/jcr/JcrModel1Operations.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,144 @@ | ||
package org.springmodules.jcr; | ||
|
||
import java.util.List; | ||
import java.util.Map; | ||
|
||
import javax.jcr.Item; | ||
import javax.jcr.Node; | ||
import javax.jcr.ValueFactory; | ||
import javax.jcr.query.QueryResult; | ||
|
||
import org.xml.sax.ContentHandler; | ||
|
||
/** | ||
* Interface used for delimiting Jcr operations based on what the underlying repository supports | ||
* (in this case model 1 operations). | ||
* | ||
* Normally not used but useful for casting to restrict access in some situations. | ||
* @author Costin Leau | ||
* | ||
*/ | ||
public interface JcrModel1Operations { | ||
|
||
/** | ||
* @see javax.jcr.Session#getAttribute(java.lang.String) | ||
*/ | ||
public Object getAttribute(String name); | ||
|
||
/** | ||
* @see javax.jcr.Session#getAttributeNames() | ||
*/ | ||
public String[] getAttributeNames(); | ||
|
||
/** | ||
* @see javax.jcr.Session#getImportContentHandler(java.lang.String, int) | ||
*/ | ||
public ContentHandler getImportContentHandler(String parentAbsPath, int uuidBehavior); | ||
|
||
/** | ||
* @see javax.jcr.Session#getItem(java.lang.String) | ||
*/ | ||
public Item getItem(String absPath); | ||
|
||
/** | ||
* @see javax.jcr.Session#getNamespacePrefix(java.lang.String) | ||
*/ | ||
public String getNamespacePrefix(String uri); | ||
|
||
/** | ||
* @see javax.jcr.Session#getNamespacePrefixes() | ||
*/ | ||
public String[] getNamespacePrefixes(); | ||
|
||
/** | ||
* @see javax.jcr.Session#getNamespaceURI(java.lang.String) | ||
*/ | ||
public String getNamespaceURI(String prefix); | ||
|
||
/** | ||
* @see javax.jcr.Session#getNodeByUUID(java.lang.String) | ||
*/ | ||
public Node getNodeByUUID(String uuid); | ||
|
||
/** | ||
* @see javax.jcr.Session#getRootNode(); | ||
*/ | ||
public Node getRootNode(); | ||
|
||
/** | ||
* @see javax.jcr.Session#getUserID() | ||
*/ | ||
public String getUserID(); | ||
|
||
/** | ||
* @see javax.jcr.Session#getValueFactory() | ||
*/ | ||
public ValueFactory getValueFactory(); | ||
|
||
/** | ||
* @see javax.jcr.Session#isLive() | ||
*/ | ||
public boolean isLive(); | ||
|
||
/** | ||
* @see javax.jcr.Session#itemExists(java.lang.String) | ||
*/ | ||
public boolean itemExists(String absPath); | ||
|
||
/** | ||
* Execute a persistent query from the given node. | ||
* | ||
* @see javax.jcr.query.QueryManager#getQuery(javax.jcr.Node) | ||
* @param node node to be dumped | ||
* @return query result | ||
*/ | ||
public QueryResult query(Node node); | ||
|
||
/** | ||
* Execute a query with the given strings with XPATH as default language. | ||
* It's the same as #query(java.lang.String, java.lang.String) | ||
* | ||
* @see javax.jcr.query.QueryManager#createQuery(java.lang.String, java.lang.String) | ||
* @param statement query statement | ||
* @return query result | ||
*/ | ||
public QueryResult query(String statement); | ||
|
||
/** | ||
* Execute a query with the given strings. | ||
* | ||
* @see javax.jcr.query.QueryManager#createQuery(java.lang.String, java.lang.String) | ||
* @param statement query statement | ||
* @param language language statement | ||
* @return query result | ||
*/ | ||
public QueryResult query(String statement, String language); | ||
|
||
/** | ||
* Default method for doing multiple queries. It assumes the language is | ||
* XPATH and that errors will not be ignored. | ||
* | ||
* @param list a list of queries that will be executed against the | ||
* repository | ||
* @return a map containing the queries as keys and results as values | ||
*/ | ||
public Map query(final List list); | ||
|
||
/** | ||
* Utility method for executing a list of queries against the repository. | ||
* Reads the queries given and returns the results in a map. | ||
* | ||
* <p/> If possible the map will be a LinkedHashSet on JDK 1.4+, otherwise | ||
* LinkedHashSet from Commons collections 3.1 if the package is found. If | ||
* the above fails a HashMap will be returned. | ||
* | ||
* @see org.springframework.core.CollectionFactory | ||
* | ||
* @param list list of queries | ||
* @param language language of the queries. If null XPATH is assumed. | ||
* @param ignoreErrors if true it will populate unfound nodes with null | ||
* @return a map containing the queries as keys and results as values | ||
*/ | ||
public Map query(final List list, final String language, final boolean ignoreErrors); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
package org.springmodules.jcr; | ||
|
||
import java.io.File; | ||
import java.io.InputStream; | ||
|
||
import javax.jcr.Node; | ||
|
||
|
||
/** | ||
* Interface used for delimiting Jcr operations based on what the underlying repository supports (in this | ||
* case model 2 operations). | ||
* Normally not used but useful for casting to restrict access in some situations. | ||
* | ||
* @author Costin Leau | ||
* | ||
*/ | ||
public interface JcrModel2Operations extends JcrModel1Operations { | ||
|
||
/** | ||
* Import a File in the current workspace on the given node. If the | ||
* parentNode is null the root node will be used. | ||
* | ||
* <strong>Note</strong> this method has been mainly inspired from the | ||
* contrib/examples package inside JackRabbit repository. | ||
* | ||
* @param parentNode | ||
* Parent Repository Node | ||
* @param file | ||
* File to be imported | ||
* | ||
* @return the child node to which the file belongs to | ||
*/ | ||
public Node importFile(Node parentNode, File file); | ||
|
||
/** | ||
* Import a Folder using the current session on the given node. If the | ||
* parentNode is null the root node will be used. | ||
* | ||
* <strong>Note</strong> this method has been mainly inspired from the | ||
* contrib/examples package inside JackRabbit repository. | ||
* | ||
* @param parentnode | ||
* Parent Repository Node | ||
* @param directory | ||
* Directory to be traversed | ||
* @param includeStartDir | ||
* true if the given directory should be included or just it's | ||
* entries | ||
*/ | ||
|
||
public Node importFolder(Node parentnode, File directory, boolean includeStartDirectory); | ||
|
||
/** | ||
* @see javax.jcr.Session#hasPendingChanges() | ||
*/ | ||
public boolean hasPendingChanges(); | ||
|
||
/** | ||
* @see javax.jcr.Session#importXML(java.lang.String, java.io.InputStream, | ||
* int) | ||
*/ | ||
public void importXML(String parentAbsPath, InputStream in, int uuidBehavior); | ||
|
||
/** | ||
* @see javax.jcr.Session#refresh(boolean) | ||
*/ | ||
public void refresh(boolean keepChanges); | ||
|
||
/** | ||
* @see javax.jcr.Session#setNamespacePrefix(java.lang.String, | ||
* java.lang.String) | ||
*/ | ||
public void setNamespacePrefix(String prefix, String uri); | ||
|
||
/** | ||
* @see javax.jcr.Session#move(java.lang.String, java.lang.String) | ||
*/ | ||
public void move(String srcAbsPath, String destAbsPath); | ||
|
||
/** | ||
* @see javax.jcr.Session#save() | ||
*/ | ||
public void save(); | ||
|
||
} |
Oops, something went wrong.