You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by ju...@apache.org on 2009/04/30 17:01:08 UTC
svn commit: r770268 - in
/jackrabbit/trunk/jackrabbit-jca/src/main/java/org/apache/jackrabbit/jca:
JCARepositoryHandle.java JCASessionHandle.java
Author: jukka
Date: Thu Apr 30 15:01:07 2009
New Revision: 770268
URL: http://svn.apache.org/viewvc?rev=770268&view=rev
Log:
JCR-1104: JSR 283 support
Upgrade jackrabbit-jcar to JCR 2.0
Modified:
jackrabbit/trunk/jackrabbit-jca/src/main/java/org/apache/jackrabbit/jca/JCARepositoryHandle.java
jackrabbit/trunk/jackrabbit-jca/src/main/java/org/apache/jackrabbit/jca/JCASessionHandle.java
Modified: jackrabbit/trunk/jackrabbit-jca/src/main/java/org/apache/jackrabbit/jca/JCARepositoryHandle.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jca/src/main/java/org/apache/jackrabbit/jca/JCARepositoryHandle.java?rev=770268&r1=770267&r2=770268&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jca/src/main/java/org/apache/jackrabbit/jca/JCARepositoryHandle.java (original)
+++ jackrabbit/trunk/jackrabbit-jca/src/main/java/org/apache/jackrabbit/jca/JCARepositoryHandle.java Thu Apr 30 15:01:07 2009
@@ -26,13 +26,17 @@
import javax.resource.Referenceable;
import javax.resource.ResourceException;
import javax.resource.spi.ConnectionManager;
+
+import org.apache.jackrabbit.commons.repository.ProxyRepository;
+import org.apache.jackrabbit.commons.repository.RepositoryFactory;
+
import java.io.Serializable;
/**
* This class implements the JCA implementation of repository.
*/
-public final class JCARepositoryHandle
- implements Repository, Referenceable, Serializable {
+public final class JCARepositoryHandle extends ProxyRepository
+ implements Referenceable, Serializable {
/**
* Managed connection factory.
@@ -52,7 +56,9 @@
/**
* Construct the repository.
*/
- public JCARepositoryHandle(JCAManagedConnectionFactory mcf, ConnectionManager cm) {
+ public JCARepositoryHandle(
+ JCAManagedConnectionFactory mcf, ConnectionManager cm) {
+ super(new JCARepositoryFactory(mcf));
this.mcf = mcf;
this.cm = cm;
}
@@ -60,45 +66,13 @@
/**
* Creates a new session.
*/
- public Session login()
- throws LoginException, NoSuchWorkspaceException, RepositoryException {
- return login(null, null);
- }
-
- /**
- * Creates a new session.
- */
- public Session login(Credentials creds)
- throws LoginException, NoSuchWorkspaceException, RepositoryException {
- return login(creds, null);
- }
-
- /**
- * Creates a new session.
- */
- public Session login(String workspace)
- throws LoginException, NoSuchWorkspaceException, RepositoryException {
- return login(null, workspace);
- }
-
- /**
- * Creates a new session.
- */
public Session login(Credentials creds, String workspace)
- throws LoginException, NoSuchWorkspaceException, RepositoryException {
- return login(new JCAConnectionRequestInfo(creds, workspace));
- }
-
- /**
- * Creates a new session.
- */
- private Session login(JCAConnectionRequestInfo cri)
- throws LoginException, NoSuchWorkspaceException, RepositoryException {
+ throws RepositoryException {
try {
- return (Session) cm.allocateConnection(mcf, cri);
+ return (Session) cm.allocateConnection(
+ mcf, new JCAConnectionRequestInfo(creds, workspace));
} catch (ResourceException e) {
Throwable cause = e.getCause();
-
if (cause instanceof LoginException) {
throw (LoginException) cause;
} else if (cause instanceof NoSuchWorkspaceException) {
@@ -114,20 +88,6 @@
}
/**
- * Return the descriptor keys.
- */
- public String[] getDescriptorKeys() {
- return mcf.getRepository().getDescriptorKeys();
- }
-
- /**
- * Return the descriptor for key.
- */
- public String getDescriptor(String key) {
- return mcf.getRepository().getDescriptor(key);
- }
-
- /**
* Return the reference.
*/
public Reference getReference() {
@@ -140,4 +100,20 @@
public void setReference(Reference reference) {
this.reference = reference;
}
+
+ private static class JCARepositoryFactory
+ implements RepositoryFactory, Serializable {
+
+ private final JCAManagedConnectionFactory mcf;
+
+ public JCARepositoryFactory(JCAManagedConnectionFactory mcf) {
+ this.mcf = mcf;
+ }
+
+ public Repository getRepository() {
+ return mcf.getRepository();
+ }
+
+ }
+
}
Modified: jackrabbit/trunk/jackrabbit-jca/src/main/java/org/apache/jackrabbit/jca/JCASessionHandle.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jca/src/main/java/org/apache/jackrabbit/jca/JCASessionHandle.java?rev=770268&r1=770267&r2=770268&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jca/src/main/java/org/apache/jackrabbit/jca/JCASessionHandle.java (original)
+++ jackrabbit/trunk/jackrabbit-jca/src/main/java/org/apache/jackrabbit/jca/JCASessionHandle.java Thu Apr 30 15:01:07 2009
@@ -31,6 +31,7 @@
import javax.jcr.NamespaceException;
import javax.jcr.Node;
import javax.jcr.PathNotFoundException;
+import javax.jcr.Property;
import javax.jcr.Repository;
import javax.jcr.RepositoryException;
import javax.jcr.Session;
@@ -40,6 +41,8 @@
import javax.jcr.lock.LockException;
import javax.jcr.nodetype.ConstraintViolationException;
import javax.jcr.nodetype.NoSuchNodeTypeException;
+import javax.jcr.retention.RetentionManager;
+import javax.jcr.security.AccessControlManager;
import javax.jcr.version.VersionException;
import javax.transaction.xa.XAResource;
@@ -47,6 +50,7 @@
import java.io.InputStream;
import java.io.OutputStream;
import java.security.AccessControlException;
+import java.util.Map;
/**
* This class implements the JCA implementation of session.
@@ -330,6 +334,50 @@
getSession().removeLockToken(arg0);
}
+ public AccessControlManager getAccessControlManager()
+ throws RepositoryException {
+ return getSession().getAccessControlManager();
+ }
+
+ public Node getNode(String arg0) throws RepositoryException {
+ return getSession().getNode(arg0);
+ }
+
+ public Node getNodeByIdentifier(String arg0) throws RepositoryException {
+ return getSession().getNodeByIdentifier(arg0);
+ }
+
+ public Property getProperty(String arg0) throws RepositoryException {
+ return getSession().getProperty(arg0);
+ }
+
+ public RetentionManager getRetentionManager()
+ throws RepositoryException {
+ return getSession().getRetentionManager();
+ }
+
+ public boolean hasCapability(String arg0, Object arg1, Map arg2)
+ throws RepositoryException {
+ return getSession().hasCapability(arg0, arg1, arg2);
+ }
+
+ public boolean hasPermission(String arg0, String arg1)
+ throws RepositoryException {
+ return getSession().hasPermission(arg0, arg1);
+ }
+
+ public boolean nodeExists(String path) throws RepositoryException {
+ return getSession().nodeExists(path);
+ }
+
+ public boolean propertyExists(String path) throws RepositoryException {
+ return getSession().propertyExists(path);
+ }
+
+ public void removeItem(String path) throws RepositoryException {
+ getSession().removeItem(path);
+ }
+
//---------------------------------------------------------< XASession >--
/**