jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r900484 - in /jackrabbit/commons/jcr-rmi/trunk: ./ src/main/java/org/apache/jackrabbit/rmi/client/ src/main/java/org/apache/jackrabbit/rmi/remote/ src/main/java/org/apache/jackrabbit/rmi/repository/ src/main/java/org/apache/jackrabbit/rmi/s...
Date Mon, 18 Jan 2010 18:00:54 GMT
Author: jukka
Date: Mon Jan 18 18:00:53 2010
New Revision: 900484

URL: http://svn.apache.org/viewvc?rev=900484&view=rev
Log:
JCRRMI-26: JSR-283 support

Drop the jackrabbit-jcr-commons and jackrabbit-api dependencies.

Added:
    jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/client/DefaultContentHandler.java   (contents, props changed)
      - copied, changed from r900446, jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/xml/DefaultContentHandler.java
    jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/client/SerializingContentHandler.java   (contents, props changed)
      - copied, changed from r900446, jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/xml/SerializingContentHandler.java
    jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/repository/ProxyRepository.java   (contents, props changed)
      - copied, changed from r900448, jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/repository/ProxyRepository.java
    jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/repository/RepositoryFactory.java   (contents, props changed)
      - copied, changed from r900450, jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/repository/RepositoryFactory.java
Removed:
    jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/client/ClientXAResource.java
    jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/remote/RemoteXAResource.java
    jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/ServerXAResource.java
Modified:
    jackrabbit/commons/jcr-rmi/trunk/pom.xml
    jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/client/ClientAdapterFactory.java
    jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/client/ClientRepository.java
    jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/client/ClientSession.java
    jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/client/ClientWorkspace.java
    jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/client/ClientXASession.java
    jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/client/LocalAdapterFactory.java
    jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/remote/RemoteXASession.java
    jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/repository/AbstractRemoteRepositoryFactory.java
    jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/repository/JNDIRemoteRepository.java
    jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/repository/RMIRemoteRepository.java
    jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/repository/URLRemoteRepository.java
    jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/RemoteAdapterFactory.java
    jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/ServerAdapterFactory.java
    jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/ServerXASession.java
    jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/jmx/JCRServer.java

Modified: jackrabbit/commons/jcr-rmi/trunk/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/commons/jcr-rmi/trunk/pom.xml?rev=900484&r1=900483&r2=900484&view=diff
==============================================================================
--- jackrabbit/commons/jcr-rmi/trunk/pom.xml (original)
+++ jackrabbit/commons/jcr-rmi/trunk/pom.xml Mon Jan 18 18:00:53 2010
@@ -1053,16 +1053,6 @@
       <version>2.0</version>
     </dependency>
     <dependency>
-      <groupId>org.apache.jackrabbit</groupId>
-      <artifactId>jackrabbit-api</artifactId>
-      <version>2.0-beta5</version>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.jackrabbit</groupId>
-      <artifactId>jackrabbit-jcr-commons</artifactId>
-      <version>2.0-beta5</version>
-    </dependency>
-    <dependency>
       <groupId>org.slf4j</groupId>
       <artifactId>slf4j-api</artifactId>
       <version>1.5.8</version>
@@ -1078,13 +1068,13 @@
     <dependency>
       <groupId>org.apache.jackrabbit</groupId>
       <artifactId>jackrabbit-core</artifactId>
-      <version>2.0-beta4</version>
+      <version>2.0-beta6</version>
       <scope>test</scope>
     </dependency>
     <dependency>
       <groupId>org.apache.jackrabbit</groupId>
       <artifactId>jackrabbit-jcr-tests</artifactId>
-      <version>2.0-beta4</version>
+      <version>2.0-beta6</version>
       <scope>test</scope>
     </dependency>
     <dependency>

Modified: jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/client/ClientAdapterFactory.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/client/ClientAdapterFactory.java?rev=900484&r1=900483&r2=900484&view=diff
==============================================================================
--- jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/client/ClientAdapterFactory.java (original)
+++ jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/client/ClientAdapterFactory.java Mon Jan 18 18:00:53 2010
@@ -41,7 +41,6 @@
 import javax.jcr.version.Version;
 import javax.jcr.version.VersionHistory;
 import javax.jcr.version.VersionIterator;
-import javax.transaction.xa.XAResource;
 
 import org.apache.jackrabbit.rmi.client.iterator.ClientNodeIterator;
 import org.apache.jackrabbit.rmi.client.iterator.ClientNodeTypeIterator;
@@ -69,7 +68,6 @@
 import org.apache.jackrabbit.rmi.remote.RemoteVersion;
 import org.apache.jackrabbit.rmi.remote.RemoteVersionHistory;
 import org.apache.jackrabbit.rmi.remote.RemoteWorkspace;
-import org.apache.jackrabbit.rmi.remote.RemoteXAResource;
 import org.apache.jackrabbit.rmi.remote.RemoteXASession;
 
 /**
@@ -322,11 +320,4 @@
         return new ClientRowIterator(remote, this);
     }
 
-    /**
-     * Creates and returns a {@link ClientXAResource} instance.
-     */
-    public XAResource getXAResource(RemoteXAResource remote) {
-        return new ClientXAResource(remote);
-    }
-
 }

Modified: jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/client/ClientRepository.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/client/ClientRepository.java?rev=900484&r1=900483&r2=900484&view=diff
==============================================================================
--- jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/client/ClientRepository.java (original)
+++ jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/client/ClientRepository.java Mon Jan 18 18:00:53 2010
@@ -17,6 +17,8 @@
 package org.apache.jackrabbit.rmi.client;
 
 import java.rmi.RemoteException;
+import java.util.HashSet;
+import java.util.Set;
 
 import javax.jcr.Credentials;
 import javax.jcr.Repository;
@@ -24,7 +26,6 @@
 import javax.jcr.Session;
 import javax.jcr.Value;
 
-import org.apache.jackrabbit.commons.AbstractRepository;
 import org.apache.jackrabbit.rmi.remote.RemoteRepository;
 import org.apache.jackrabbit.rmi.remote.RemoteSession;
 import org.apache.jackrabbit.rmi.value.SerialValueFactory;
@@ -38,7 +39,63 @@
  * @see javax.jcr.Repository
  * @see org.apache.jackrabbit.rmi.remote.RemoteRepository
  */
-public class ClientRepository extends AbstractRepository implements Repository {
+public class ClientRepository implements Repository {
+
+    /**
+     * The set of standard descriptor keys defined in the
+     * {@link Repository} interface. 
+     */
+    private static final Set<String> STANDARD_KEYS = new HashSet<String>() {{
+        add(Repository.IDENTIFIER_STABILITY);
+        add(Repository.LEVEL_1_SUPPORTED);
+        add(Repository.LEVEL_2_SUPPORTED);
+        add(Repository.OPTION_NODE_TYPE_MANAGEMENT_SUPPORTED);
+        add(Repository.NODE_TYPE_MANAGEMENT_AUTOCREATED_DEFINITIONS_SUPPORTED);
+        add(Repository.NODE_TYPE_MANAGEMENT_INHERITANCE);
+        add(Repository.NODE_TYPE_MANAGEMENT_MULTIPLE_BINARY_PROPERTIES_SUPPORTED);
+        add(Repository.NODE_TYPE_MANAGEMENT_MULTIVALUED_PROPERTIES_SUPPORTED);
+        add(Repository.NODE_TYPE_MANAGEMENT_ORDERABLE_CHILD_NODES_SUPPORTED);
+        add(Repository.NODE_TYPE_MANAGEMENT_OVERRIDES_SUPPORTED);
+        add(Repository.NODE_TYPE_MANAGEMENT_PRIMARY_ITEM_NAME_SUPPORTED);
+        add(Repository.NODE_TYPE_MANAGEMENT_PROPERTY_TYPES);
+        add(Repository.NODE_TYPE_MANAGEMENT_RESIDUAL_DEFINITIONS_SUPPORTED);
+        add(Repository.NODE_TYPE_MANAGEMENT_SAME_NAME_SIBLINGS_SUPPORTED);
+        add(Repository.NODE_TYPE_MANAGEMENT_VALUE_CONSTRAINTS_SUPPORTED);
+        add(Repository.NODE_TYPE_MANAGEMENT_UPDATE_IN_USE_SUPORTED);
+        add(Repository.OPTION_ACCESS_CONTROL_SUPPORTED);
+        add(Repository.OPTION_JOURNALED_OBSERVATION_SUPPORTED);
+        add(Repository.OPTION_LIFECYCLE_SUPPORTED);
+        add(Repository.OPTION_LOCKING_SUPPORTED);
+        add(Repository.OPTION_OBSERVATION_SUPPORTED);
+        add(Repository.OPTION_NODE_AND_PROPERTY_WITH_SAME_NAME_SUPPORTED);
+        add(Repository.OPTION_QUERY_SQL_SUPPORTED);
+        add(Repository.OPTION_RETENTION_SUPPORTED);
+        add(Repository.OPTION_SHAREABLE_NODES_SUPPORTED);
+        add(Repository.OPTION_SIMPLE_VERSIONING_SUPPORTED);
+        add(Repository.OPTION_TRANSACTIONS_SUPPORTED);
+        add(Repository.OPTION_UNFILED_CONTENT_SUPPORTED);
+        add(Repository.OPTION_UPDATE_MIXIN_NODE_TYPES_SUPPORTED);
+        add(Repository.OPTION_UPDATE_PRIMARY_NODE_TYPE_SUPPORTED);
+        add(Repository.OPTION_VERSIONING_SUPPORTED);
+        add(Repository.OPTION_WORKSPACE_MANAGEMENT_SUPPORTED);
+        add(Repository.OPTION_XML_EXPORT_SUPPORTED);
+        add(Repository.OPTION_XML_IMPORT_SUPPORTED);
+        add(Repository.OPTION_ACTIVITIES_SUPPORTED);
+        add(Repository.OPTION_BASELINES_SUPPORTED);
+        
+        add(Repository.QUERY_FULL_TEXT_SEARCH_SUPPORTED);
+        add(Repository.QUERY_JOINS);
+        add(Repository.QUERY_LANGUAGES);
+        add(Repository.QUERY_STORED_QUERIES_SUPPORTED);
+        add(Repository.QUERY_XPATH_DOC_ORDER);
+        add(Repository.QUERY_XPATH_POS_INDEX);
+        add(Repository.REP_NAME_DESC);
+        add(Repository.REP_VENDOR_DESC);
+        add(Repository.REP_VENDOR_URL_DESC);
+        add(Repository.SPEC_NAME_DESC);
+        add(Repository.SPEC_VERSION_DESC);
+        add(Repository.WRITE_SUPPORTED);
+    }};
 
     /** The adapted remote repository. */
     private final RemoteRepository remote;
@@ -112,4 +169,50 @@
         }
     }
 
+    /**
+     * Returns true if the given key identifies a standard descriptor.
+     *
+     * @param key descriptor key
+     * @return <code>true</code> if the key identifies a standard descriptor,
+     *         <code>false</code> otherwise
+     */
+    public boolean isStandardDescriptor(String key) {
+        return STANDARD_KEYS.contains(key);
+    }
+
+    /**
+     * Calls {@link Repository#login(Credentials, String)} with
+     * <code>null</code> arguments.
+     *
+     * @return logged in session
+     * @throws RepositoryException if an error occurs
+     */
+    public Session login() throws RepositoryException {
+        return login(null, null);
+    }
+
+    /**
+     * Calls {@link Repository#login(Credentials, String)} with
+     * the given credentials and a <code>null</code> workspace name.
+     *
+     * @param credentials login credentials
+     * @return logged in session
+     * @throws RepositoryException if an error occurs
+     */
+    public Session login(Credentials credentials) throws RepositoryException {
+        return login(credentials, null);
+    }
+
+    /**
+     * Calls {@link Repository#login(Credentials, String)} with
+     * <code>null</code> credentials and the given workspace name.
+     *
+     * @param workspace workspace name
+     * @return logged in session
+     * @throws RepositoryException if an error occurs
+     */
+    public Session login(String workspace) throws RepositoryException {
+        return login(null, workspace);
+    }
+
 }

Modified: jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/client/ClientSession.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/client/ClientSession.java?rev=900484&r1=900483&r2=900484&view=diff
==============================================================================
--- jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/client/ClientSession.java (original)
+++ jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/client/ClientSession.java Mon Jan 18 18:00:53 2010
@@ -45,8 +45,6 @@
 import javax.xml.transform.sax.SAXResult;
 import javax.xml.transform.stream.StreamSource;
 
-import org.apache.jackrabbit.commons.xml.DefaultContentHandler;
-import org.apache.jackrabbit.commons.xml.SerializingContentHandler;
 import org.apache.jackrabbit.rmi.remote.RemoteSession;
 import org.apache.jackrabbit.rmi.value.SerialValueFactory;
 import org.slf4j.Logger;

Modified: jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/client/ClientWorkspace.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/client/ClientWorkspace.java?rev=900484&r1=900483&r2=900484&view=diff
==============================================================================
--- jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/client/ClientWorkspace.java (original)
+++ jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/client/ClientWorkspace.java Mon Jan 18 18:00:53 2010
@@ -33,8 +33,6 @@
 import javax.jcr.version.Version;
 import javax.jcr.version.VersionManager;
 
-import org.apache.jackrabbit.commons.xml.DefaultContentHandler;
-import org.apache.jackrabbit.commons.xml.SerializingContentHandler;
 import org.apache.jackrabbit.rmi.remote.RemoteNamespaceRegistry;
 import org.apache.jackrabbit.rmi.remote.RemoteNodeTypeManager;
 import org.apache.jackrabbit.rmi.remote.RemoteQueryManager;

Modified: jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/client/ClientXASession.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/client/ClientXASession.java?rev=900484&r1=900483&r2=900484&view=diff
==============================================================================
--- jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/client/ClientXASession.java (original)
+++ jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/client/ClientXASession.java Mon Jan 18 18:00:53 2010
@@ -18,12 +18,14 @@
 
 import java.rmi.RemoteException;
 
+import javax.transaction.xa.XAException;
 import javax.transaction.xa.XAResource;
+import javax.transaction.xa.Xid;
 
 import javax.jcr.Repository;
 
-import org.apache.jackrabbit.api.XASession;
 import org.apache.jackrabbit.rmi.remote.RemoteXASession;
+import org.apache.jackrabbit.rmi.remote.SerializableXid;
 
 /**
  * Local adapter for the JCR-RMI
@@ -32,7 +34,7 @@
  *
  * @since 1.4
  */
-public class ClientXASession extends ClientSession implements XASession {
+public class ClientXASession extends ClientSession implements XAResource {
 
     /**
      * The adapted remote transaction enabled session.
@@ -50,11 +52,92 @@
         this.remote = remote;
     }
 
-    public XAResource getXAResource() {
+    /**
+     * Returns <code>true</code> if the given object is a local
+     * adapter that refers to the same remote XA resource.
+     *
+     * @see http://blogs.sun.com/fkieviet/entry/j2ee_jca_resource_adapters_the
+     */
+    public boolean isSameRM(XAResource xares) throws XAException {
+        return xares instanceof ClientXASession
+            && remote == ((ClientXASession) xares).remote;
+    }
+
+    private XAException getXAException(RemoteException e) {
+        XAException exception = new XAException("Remote operation failed");
+        exception.initCause(e);
+        return exception;
+    }
+
+    public void commit(Xid xid, boolean onePhase) throws XAException {
+        try {
+            remote.commit(new SerializableXid(xid), onePhase);
+        } catch (RemoteException e) {
+            throw getXAException(e);
+        }
+    }
+
+    public void end(Xid xid, int flags) throws XAException {
+        try {
+            remote.end(new SerializableXid(xid), flags);
+        } catch (RemoteException e) {
+            throw getXAException(e);
+        }
+    }
+
+    public void forget(Xid xid) throws XAException {
+        try {
+            remote.forget(new SerializableXid(xid));
+        } catch (RemoteException e) {
+            throw getXAException(e);
+        }
+    }
+
+    public int getTransactionTimeout() throws XAException {
+        try {
+            return remote.getTransactionTimeout();
+        } catch (RemoteException e) {
+            throw getXAException(e);
+        }
+    }
+
+    public int prepare(Xid xid) throws XAException {
+        try {
+            return remote.prepare(new SerializableXid(xid));
+        } catch (RemoteException e) {
+            throw getXAException(e);
+        }
+    }
+
+    public Xid[] recover(int flag) throws XAException {
+        try {
+            return remote.recover(flag);
+        } catch (RemoteException e) {
+            throw getXAException(e);
+        }
+    }
+
+    public void rollback(Xid xid) throws XAException {
+        try {
+            remote.rollback(new SerializableXid(xid));
+        } catch (RemoteException e) {
+            throw getXAException(e);
+        }
+    }
+
+    public boolean setTransactionTimeout(int seconds) throws XAException {
+        try {
+            return remote.setTransactionTimeout(seconds);
+        } catch (RemoteException e) {
+            throw getXAException(e);
+        }
+    }
+
+    public void start(Xid xid, int flags) throws XAException {
         try {
-            return getFactory().getXAResource(remote.getXAResource());
+            remote.start(new SerializableXid(xid), flags);
         } catch (RemoteException e) {
-            throw new RemoteRuntimeException(e);
+            throw getXAException(e);
         }
     }
 

Copied: jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/client/DefaultContentHandler.java (from r900446, jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/xml/DefaultContentHandler.java)
URL: http://svn.apache.org/viewvc/jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/client/DefaultContentHandler.java?p2=jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/client/DefaultContentHandler.java&p1=jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/xml/DefaultContentHandler.java&r1=900446&r2=900484&rev=900484&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/xml/DefaultContentHandler.java (original)
+++ jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/client/DefaultContentHandler.java Mon Jan 18 18:00:53 2010
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.jackrabbit.commons.xml;
+package org.apache.jackrabbit.rmi.client;
 
 import org.xml.sax.Attributes;
 import org.xml.sax.ContentHandler;
@@ -25,10 +25,8 @@
 /**
  * Adapter class for exposing a {@link ContentHandler} instance as
  * {@link DefaultHandler} object.
- *
- * @since Jackrabbit JCR Commons 1.5
  */
-public class DefaultContentHandler extends DefaultHandler {
+class DefaultContentHandler extends DefaultHandler {
 
     /**
      * The adapted content handler instance.

Propchange: jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/client/DefaultContentHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/client/DefaultContentHandler.java
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Mon Jan 18 18:00:53 2010
@@ -0,0 +1,4 @@
+/jackrabbit/branches/1.5/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/xml/DefaultContentHandler.java:794012,794100,794102
+/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/xml/DefaultContentHandler.java:774917-886178
+/jackrabbit/sandbox/JCR-2170/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/xml/DefaultContentHandler.java:812417-816332
+/jackrabbit/sandbox/tripod-JCR-2209/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/xml/DefaultContentHandler.java:795441-795863

Modified: jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/client/LocalAdapterFactory.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/client/LocalAdapterFactory.java?rev=900484&r1=900483&r2=900484&view=diff
==============================================================================
--- jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/client/LocalAdapterFactory.java (original)
+++ jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/client/LocalAdapterFactory.java Mon Jan 18 18:00:53 2010
@@ -41,7 +41,6 @@
 import javax.jcr.version.Version;
 import javax.jcr.version.VersionHistory;
 import javax.jcr.version.VersionIterator;
-import javax.transaction.xa.XAResource;
 
 import org.apache.jackrabbit.rmi.remote.RemoteItem;
 import org.apache.jackrabbit.rmi.remote.RemoteItemDefinition;
@@ -64,7 +63,6 @@
 import org.apache.jackrabbit.rmi.remote.RemoteVersion;
 import org.apache.jackrabbit.rmi.remote.RemoteVersionHistory;
 import org.apache.jackrabbit.rmi.remote.RemoteWorkspace;
-import org.apache.jackrabbit.rmi.remote.RemoteXAResource;
 
 /**
  * Factory interface for creating local adapters for remote references.
@@ -320,12 +318,4 @@
      */
     RowIterator getRowIterator(RemoteIterator remote);
 
-    /**
-     * Factory method for creating a local adapter for a remote XA resource.
-     *
-     * @param remote remote XA resource
-     * @return local XA adapter
-     */
-    XAResource getXAResource(RemoteXAResource remote);
-
 }

Copied: jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/client/SerializingContentHandler.java (from r900446, jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/xml/SerializingContentHandler.java)
URL: http://svn.apache.org/viewvc/jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/client/SerializingContentHandler.java?p2=jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/client/SerializingContentHandler.java&p1=jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/xml/SerializingContentHandler.java&r1=900446&r2=900484&rev=900484&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/xml/SerializingContentHandler.java (original)
+++ jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/client/SerializingContentHandler.java Mon Jan 18 18:00:53 2010
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.jackrabbit.commons.xml;
+package org.apache.jackrabbit.rmi.client;
 
 import java.io.OutputStream;
 import java.io.StringWriter;
@@ -54,10 +54,8 @@
  * is included with some modifications here in Apache Jackrabbit. See the
  * org.apache.cocoon.serialization.AbstractTextSerializer class in the
  * cocoon-pipeline-impl component for the original code.
- *
- * @since Jackrabbit JCR Commons 1.5
  */
-public class SerializingContentHandler extends DefaultContentHandler {
+class SerializingContentHandler extends DefaultContentHandler {
 
     /**
      * The character encoding used for serialization (UTF-8).

Propchange: jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/client/SerializingContentHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/client/SerializingContentHandler.java
------------------------------------------------------------------------------
    svn:keywords = Id Revision Author Date

Propchange: jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/client/SerializingContentHandler.java
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Mon Jan 18 18:00:53 2010
@@ -0,0 +1,4 @@
+/jackrabbit/branches/1.5/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/xml/SerializingContentHandler.java:794012,794100,794102
+/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/xml/SerializingContentHandler.java:774917-886178
+/jackrabbit/sandbox/JCR-2170/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/xml/SerializingContentHandler.java:812417-816332
+/jackrabbit/sandbox/tripod-JCR-2209/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/xml/SerializingContentHandler.java:795441-795863

Modified: jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/remote/RemoteXASession.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/remote/RemoteXASession.java?rev=900484&r1=900483&r2=900484&view=diff
==============================================================================
--- jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/remote/RemoteXASession.java (original)
+++ jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/remote/RemoteXASession.java Mon Jan 18 18:00:53 2010
@@ -19,18 +19,68 @@
 import java.rmi.Remote;
 import java.rmi.RemoteException;
 
+import javax.transaction.xa.XAException;
+import javax.transaction.xa.Xid;
+
 /**
  * Remote version of the {@link org.apache.jackrabbit.api.XASession}
  * interface.
- *
- * @since 1.4
  */
 public interface RemoteXASession extends RemoteSession, Remote {
 
     /**
      * Remote version of the
-     * {@link org.apache.jackrabbit.api.XASession#getXAResource()} method.
+     * {@link javax.transaction.xa.XAResource#commit(Xid, boolean)} method.
+     */
+    void commit(Xid xid, boolean onePhase) throws XAException, RemoteException;
+
+    /**
+     * Remote version of the
+     * {@link javax.transaction.xa.XAResource#end(Xid, int)} method.
+     */
+    void end(Xid xid, int flags) throws XAException, RemoteException;
+
+    /**
+     * Remote version of the
+     * {@link javax.transaction.xa.XAResource#forget(Xid)} method.
+     */
+    void forget(Xid xid) throws XAException, RemoteException;
+
+    /**
+     * Remote version of the
+     * {@link javax.transaction.xa.XAResource#getTransactionTimeout()} method.
+     */
+    int getTransactionTimeout() throws XAException, RemoteException;
+
+    /**
+     * Remote version of the
+     * {@link javax.transaction.xa.XAResource#prepare(Xid)} method.
+     */
+    int prepare(Xid xid) throws XAException, RemoteException;
+
+    /**
+     * Remote version of the
+     * {@link javax.transaction.xa.XAResource#recover(int)} method.
+     */
+    Xid[] recover(int flag) throws XAException, RemoteException;
+
+    /**
+     * Remote version of the
+     * {@link javax.transaction.xa.XAResource#rollback(Xid)} method.
+     */
+    void rollback(Xid xid) throws XAException, RemoteException;
+
+    /**
+     * Remote version of the
+     * {@link javax.transaction.xa.XAResource#setTransactionTimeout(int)} method.
+     */
+    boolean setTransactionTimeout(int seconds)
+        throws XAException, RemoteException;
+
+    /**
+     * Remote version of the
+     * {@link javax.transaction.xa.XAResource#start(Xid, int)} method.
      */
-    RemoteXAResource getXAResource() throws RemoteException;
+    void start(Xid xid, int flags) throws XAException, RemoteException;
 
 }

Modified: jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/repository/AbstractRemoteRepositoryFactory.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/repository/AbstractRemoteRepositoryFactory.java?rev=900484&r1=900483&r2=900484&view=diff
==============================================================================
--- jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/repository/AbstractRemoteRepositoryFactory.java (original)
+++ jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/repository/AbstractRemoteRepositoryFactory.java Mon Jan 18 18:00:53 2010
@@ -19,7 +19,6 @@
 import javax.jcr.Repository;
 import javax.jcr.RepositoryException;
 
-import org.apache.jackrabbit.commons.repository.RepositoryFactory;
 import org.apache.jackrabbit.rmi.client.LocalAdapterFactory;
 import org.apache.jackrabbit.rmi.remote.RemoteRepository;
 

Modified: jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/repository/JNDIRemoteRepository.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/repository/JNDIRemoteRepository.java?rev=900484&r1=900483&r2=900484&view=diff
==============================================================================
--- jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/repository/JNDIRemoteRepository.java (original)
+++ jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/repository/JNDIRemoteRepository.java Mon Jan 18 18:00:53 2010
@@ -20,9 +20,8 @@
 import javax.naming.InitialContext;
 import javax.naming.NamingException;
 
-import org.apache.jackrabbit.commons.repository.ProxyRepository;
+import org.apache.jackrabbit.rmi.client.ClientAdapterFactory;
 import org.apache.jackrabbit.rmi.client.LocalAdapterFactory;
-import org.apache.jackrabbit.rmi.jackrabbit.JackrabbitClientAdapterFactory;
 
 /**
  * Proxy for a remote repository bound in JNDI. The configured repository is
@@ -56,7 +55,7 @@
      * @param location JNDI location
      */
     public JNDIRemoteRepository(Context context, String location) {
-        this(new JackrabbitClientAdapterFactory(), context, location);
+        this(new ClientAdapterFactory(), context, location);
     }
 
     /**

Copied: jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/repository/ProxyRepository.java (from r900448, jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/repository/ProxyRepository.java)
URL: http://svn.apache.org/viewvc/jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/repository/ProxyRepository.java?p2=jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/repository/ProxyRepository.java&p1=jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/repository/ProxyRepository.java&r1=900448&r2=900484&rev=900484&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/repository/ProxyRepository.java (original)
+++ jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/repository/ProxyRepository.java Mon Jan 18 18:00:53 2010
@@ -14,15 +14,17 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.jackrabbit.commons.repository;
+package org.apache.jackrabbit.rmi.repository;
+
+import java.util.HashSet;
+import java.util.Set;
 
 import javax.jcr.Credentials;
+import javax.jcr.Repository;
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
 import javax.jcr.Value;
 
-import org.apache.jackrabbit.commons.AbstractRepository;
-
 /**
  * Repository that proxies all method calls to another repository.
  * The other repository is accessed lazily using a
@@ -30,7 +32,63 @@
  *
  * @since 1.4
  */
-public class ProxyRepository extends AbstractRepository {
+public class ProxyRepository implements Repository {
+
+    /**
+     * The set of standard descriptor keys defined in the
+     * {@link Repository} interface. 
+     */
+    private static final Set<String> STANDARD_KEYS = new HashSet<String>() {{
+        add(Repository.IDENTIFIER_STABILITY);
+        add(Repository.LEVEL_1_SUPPORTED);
+        add(Repository.LEVEL_2_SUPPORTED);
+        add(Repository.OPTION_NODE_TYPE_MANAGEMENT_SUPPORTED);
+        add(Repository.NODE_TYPE_MANAGEMENT_AUTOCREATED_DEFINITIONS_SUPPORTED);
+        add(Repository.NODE_TYPE_MANAGEMENT_INHERITANCE);
+        add(Repository.NODE_TYPE_MANAGEMENT_MULTIPLE_BINARY_PROPERTIES_SUPPORTED);
+        add(Repository.NODE_TYPE_MANAGEMENT_MULTIVALUED_PROPERTIES_SUPPORTED);
+        add(Repository.NODE_TYPE_MANAGEMENT_ORDERABLE_CHILD_NODES_SUPPORTED);
+        add(Repository.NODE_TYPE_MANAGEMENT_OVERRIDES_SUPPORTED);
+        add(Repository.NODE_TYPE_MANAGEMENT_PRIMARY_ITEM_NAME_SUPPORTED);
+        add(Repository.NODE_TYPE_MANAGEMENT_PROPERTY_TYPES);
+        add(Repository.NODE_TYPE_MANAGEMENT_RESIDUAL_DEFINITIONS_SUPPORTED);
+        add(Repository.NODE_TYPE_MANAGEMENT_SAME_NAME_SIBLINGS_SUPPORTED);
+        add(Repository.NODE_TYPE_MANAGEMENT_VALUE_CONSTRAINTS_SUPPORTED);
+        add(Repository.NODE_TYPE_MANAGEMENT_UPDATE_IN_USE_SUPORTED);
+        add(Repository.OPTION_ACCESS_CONTROL_SUPPORTED);
+        add(Repository.OPTION_JOURNALED_OBSERVATION_SUPPORTED);
+        add(Repository.OPTION_LIFECYCLE_SUPPORTED);
+        add(Repository.OPTION_LOCKING_SUPPORTED);
+        add(Repository.OPTION_OBSERVATION_SUPPORTED);
+        add(Repository.OPTION_NODE_AND_PROPERTY_WITH_SAME_NAME_SUPPORTED);
+        add(Repository.OPTION_QUERY_SQL_SUPPORTED);
+        add(Repository.OPTION_RETENTION_SUPPORTED);
+        add(Repository.OPTION_SHAREABLE_NODES_SUPPORTED);
+        add(Repository.OPTION_SIMPLE_VERSIONING_SUPPORTED);
+        add(Repository.OPTION_TRANSACTIONS_SUPPORTED);
+        add(Repository.OPTION_UNFILED_CONTENT_SUPPORTED);
+        add(Repository.OPTION_UPDATE_MIXIN_NODE_TYPES_SUPPORTED);
+        add(Repository.OPTION_UPDATE_PRIMARY_NODE_TYPE_SUPPORTED);
+        add(Repository.OPTION_VERSIONING_SUPPORTED);
+        add(Repository.OPTION_WORKSPACE_MANAGEMENT_SUPPORTED);
+        add(Repository.OPTION_XML_EXPORT_SUPPORTED);
+        add(Repository.OPTION_XML_IMPORT_SUPPORTED);
+        add(Repository.OPTION_ACTIVITIES_SUPPORTED);
+        add(Repository.OPTION_BASELINES_SUPPORTED);
+        
+        add(Repository.QUERY_FULL_TEXT_SEARCH_SUPPORTED);
+        add(Repository.QUERY_JOINS);
+        add(Repository.QUERY_LANGUAGES);
+        add(Repository.QUERY_STORED_QUERIES_SUPPORTED);
+        add(Repository.QUERY_XPATH_DOC_ORDER);
+        add(Repository.QUERY_XPATH_POS_INDEX);
+        add(Repository.REP_NAME_DESC);
+        add(Repository.REP_VENDOR_DESC);
+        add(Repository.REP_VENDOR_URL_DESC);
+        add(Repository.SPEC_NAME_DESC);
+        add(Repository.SPEC_VERSION_DESC);
+        add(Repository.WRITE_SUPPORTED);
+    }};
 
     /**
      * Factory for accessing the proxied repository.
@@ -141,4 +199,50 @@
         return factory.getRepository().login(credentials, workspace);
     }
 
+    /**
+     * Returns true if the given key identifies a standard descriptor.
+     *
+     * @param key descriptor key
+     * @return <code>true</code> if the key identifies a standard descriptor,
+     *         <code>false</code> otherwise
+     */
+    public boolean isStandardDescriptor(String key) {
+        return STANDARD_KEYS.contains(key);
+    }
+
+    /**
+     * Calls {@link Repository#login(Credentials, String)} with
+     * <code>null</code> arguments.
+     *
+     * @return logged in session
+     * @throws RepositoryException if an error occurs
+     */
+    public Session login() throws RepositoryException {
+        return login(null, null);
+    }
+
+    /**
+     * Calls {@link Repository#login(Credentials, String)} with
+     * the given credentials and a <code>null</code> workspace name.
+     *
+     * @param credentials login credentials
+     * @return logged in session
+     * @throws RepositoryException if an error occurs
+     */
+    public Session login(Credentials credentials) throws RepositoryException {
+        return login(credentials, null);
+    }
+
+    /**
+     * Calls {@link Repository#login(Credentials, String)} with
+     * <code>null</code> credentials and the given workspace name.
+     *
+     * @param workspace workspace name
+     * @return logged in session
+     * @throws RepositoryException if an error occurs
+     */
+    public Session login(String workspace) throws RepositoryException {
+        return login(null, workspace);
+    }
+
 }

Propchange: jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/repository/ProxyRepository.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/repository/ProxyRepository.java
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Mon Jan 18 18:00:53 2010
@@ -0,0 +1,4 @@
+/jackrabbit/branches/1.5/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/repository/ProxyRepository.java:794012,794100,794102
+/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/repository/ProxyRepository.java:774917-886178
+/jackrabbit/sandbox/JCR-2170/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/repository/ProxyRepository.java:812417-816332
+/jackrabbit/sandbox/tripod-JCR-2209/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/repository/ProxyRepository.java:795441-795863

Modified: jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/repository/RMIRemoteRepository.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/repository/RMIRemoteRepository.java?rev=900484&r1=900483&r2=900484&view=diff
==============================================================================
--- jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/repository/RMIRemoteRepository.java (original)
+++ jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/repository/RMIRemoteRepository.java Mon Jan 18 18:00:53 2010
@@ -16,7 +16,6 @@
  */
 package org.apache.jackrabbit.rmi.repository;
 
-import org.apache.jackrabbit.commons.repository.ProxyRepository;
 import org.apache.jackrabbit.rmi.client.LocalAdapterFactory;
 import org.apache.jackrabbit.rmi.jackrabbit.JackrabbitClientAdapterFactory;
 

Copied: jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/repository/RepositoryFactory.java (from r900450, jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/repository/RepositoryFactory.java)
URL: http://svn.apache.org/viewvc/jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/repository/RepositoryFactory.java?p2=jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/repository/RepositoryFactory.java&p1=jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/repository/RepositoryFactory.java&r1=900450&r2=900484&rev=900484&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/repository/RepositoryFactory.java (original)
+++ jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/repository/RepositoryFactory.java Mon Jan 18 18:00:53 2010
@@ -14,17 +14,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.jackrabbit.commons.repository;
+package org.apache.jackrabbit.rmi.repository;
 
 import javax.jcr.Repository;
 import javax.jcr.RepositoryException;
 
 /**
  * Factory interface for JCR content repositories.
- *
- * @since 1.4
  */
-public interface RepositoryFactory {
+interface RepositoryFactory {
 
     /**
      * Returns a content repository.

Propchange: jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/repository/RepositoryFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/repository/RepositoryFactory.java
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Mon Jan 18 18:00:53 2010
@@ -0,0 +1,4 @@
+/jackrabbit/branches/1.5/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/repository/RepositoryFactory.java:794012,794100,794102
+/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/repository/RepositoryFactory.java:774917-886178
+/jackrabbit/sandbox/JCR-2170/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/repository/RepositoryFactory.java:812417-816332
+/jackrabbit/sandbox/tripod-JCR-2209/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/repository/RepositoryFactory.java:795441-795863

Modified: jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/repository/URLRemoteRepository.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/repository/URLRemoteRepository.java?rev=900484&r1=900483&r2=900484&view=diff
==============================================================================
--- jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/repository/URLRemoteRepository.java (original)
+++ jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/repository/URLRemoteRepository.java Mon Jan 18 18:00:53 2010
@@ -19,9 +19,8 @@
 import java.net.MalformedURLException;
 import java.net.URL;
 
-import org.apache.jackrabbit.commons.repository.ProxyRepository;
+import org.apache.jackrabbit.rmi.client.ClientAdapterFactory;
 import org.apache.jackrabbit.rmi.client.LocalAdapterFactory;
-import org.apache.jackrabbit.rmi.jackrabbit.JackrabbitClientAdapterFactory;
 
 /**
  * Proxy for a remote repository accessed via a URL. The configured URL is
@@ -52,7 +51,7 @@
      * @param url URL of the remote repository
      */
     public URLRemoteRepository(URL url) {
-        this(new JackrabbitClientAdapterFactory(), url);
+        this(new ClientAdapterFactory(), url);
     }
 
     /**

Modified: jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/RemoteAdapterFactory.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/RemoteAdapterFactory.java?rev=900484&r1=900483&r2=900484&view=diff
==============================================================================
--- jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/RemoteAdapterFactory.java (original)
+++ jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/RemoteAdapterFactory.java Mon Jan 18 18:00:53 2010
@@ -28,12 +28,12 @@
 import javax.jcr.Session;
 import javax.jcr.Workspace;
 import javax.jcr.lock.Lock;
+import javax.jcr.nodetype.ItemDefinition;
+import javax.jcr.nodetype.NodeDefinition;
 import javax.jcr.nodetype.NodeType;
 import javax.jcr.nodetype.NodeTypeIterator;
 import javax.jcr.nodetype.NodeTypeManager;
-import javax.jcr.nodetype.NodeDefinition;
 import javax.jcr.nodetype.PropertyDefinition;
-import javax.jcr.nodetype.ItemDefinition;
 import javax.jcr.observation.EventIterator;
 import javax.jcr.observation.ObservationManager;
 import javax.jcr.query.Query;
@@ -44,7 +44,6 @@
 import javax.jcr.version.Version;
 import javax.jcr.version.VersionHistory;
 import javax.jcr.version.VersionIterator;
-import javax.transaction.xa.XAResource;
 
 import org.apache.jackrabbit.rmi.remote.RemoteEventCollection;
 import org.apache.jackrabbit.rmi.remote.RemoteItem;
@@ -68,7 +67,6 @@
 import org.apache.jackrabbit.rmi.remote.RemoteVersion;
 import org.apache.jackrabbit.rmi.remote.RemoteVersionHistory;
 import org.apache.jackrabbit.rmi.remote.RemoteWorkspace;
-import org.apache.jackrabbit.rmi.remote.RemoteXAResource;
 
 /**
  * Factory interface for creating remote adapters for local resources.
@@ -363,14 +361,4 @@
     RemoteIterator getRemoteRowIterator(RowIterator iterator)
         throws RemoteException;
 
-    /**
-     * Returns a remote adapter for the given local XA resource.
-     *
-     * @param iterator local XA resource
-     * @return remote XA resource adapter
-     * @throws RemoteException on RMI errors
-     */
-    RemoteXAResource getRemoteXAResource(XAResource resource)
-        throws RemoteException;
-
 }

Modified: jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/ServerAdapterFactory.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/ServerAdapterFactory.java?rev=900484&r1=900483&r2=900484&view=diff
==============================================================================
--- jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/ServerAdapterFactory.java (original)
+++ jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/ServerAdapterFactory.java Mon Jan 18 18:00:53 2010
@@ -50,7 +50,6 @@
 import javax.jcr.version.VersionIterator;
 import javax.transaction.xa.XAResource;
 
-import org.apache.jackrabbit.api.XASession;
 import org.apache.jackrabbit.rmi.remote.ArrayIterator;
 import org.apache.jackrabbit.rmi.remote.BufferIterator;
 import org.apache.jackrabbit.rmi.remote.RemoteEventCollection;
@@ -75,7 +74,6 @@
 import org.apache.jackrabbit.rmi.remote.RemoteVersion;
 import org.apache.jackrabbit.rmi.remote.RemoteVersionHistory;
 import org.apache.jackrabbit.rmi.remote.RemoteWorkspace;
-import org.apache.jackrabbit.rmi.remote.RemoteXAResource;
 import org.apache.jackrabbit.rmi.server.iterator.ServerNodeIterator;
 import org.apache.jackrabbit.rmi.server.iterator.ServerNodeTypeIterator;
 import org.apache.jackrabbit.rmi.server.iterator.ServerPropertyIterator;
@@ -165,8 +163,8 @@
      */
     public RemoteSession getRemoteSession(Session session)
             throws RemoteException {
-        if (session instanceof XASession) {
-            return new ServerXASession((XASession) session, this);
+        if (session instanceof XAResource) {
+            return new ServerXASession(session, (XAResource) session, this);
         } else {
             return new ServerSession(session, this);
         }
@@ -434,12 +432,4 @@
                 new ServerRowIterator(iterator, this, bufferSize));
     }
 
-    /**
-     * Creates a {@link ServerXAResource} instance.
-     */
-    public RemoteXAResource getRemoteXAResource(XAResource resource)
-            throws RemoteException {
-        return new ServerXAResource(resource);
-    }
-
 }

Modified: jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/ServerXASession.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/ServerXASession.java?rev=900484&r1=900483&r2=900484&view=diff
==============================================================================
--- jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/ServerXASession.java (original)
+++ jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/ServerXASession.java Mon Jan 18 18:00:53 2010
@@ -18,34 +18,115 @@
 
 import java.rmi.RemoteException;
 
-import org.apache.jackrabbit.api.XASession;
-import org.apache.jackrabbit.rmi.remote.RemoteXAResource;
+import javax.jcr.Session;
+import javax.transaction.xa.XAException;
+import javax.transaction.xa.XAResource;
+import javax.transaction.xa.Xid;
+
 import org.apache.jackrabbit.rmi.remote.RemoteXASession;
+import org.apache.jackrabbit.rmi.remote.SerializableXid;
 
 /**
- * Remote adapter for the Jackrabbit {@link XASession} interface.
+ * Remote adapter for XA-enabled sessions.
  *
  * @since 1.4
  */
 public class ServerXASession extends ServerSession implements RemoteXASession {
 
     /**
-     * The adapted transaction enabled local session.
+     * The adapted local XA resource
      */
-    private XASession session;
+    private final XAResource resource;
 
     /**
      * Creates a remote adapter for the given local, transaction enabled,
      * session.
      */
-    public ServerXASession(XASession session, RemoteAdapterFactory factory)
+    public ServerXASession(
+            Session session, XAResource resource, RemoteAdapterFactory factory)
             throws RemoteException {
         super(session, factory);
-        this.session = session;
+        this.resource = resource;
+    }
+
+    private static XAException getXAException(XAException e) {
+        return new XAException(e.getMessage());
+    }
+
+    public void commit(Xid xid, boolean onePhase) throws XAException {
+        try {
+            resource.commit(xid, onePhase);
+        } catch (XAException e) {
+            throw getXAException(e);
+        }
+    }
+
+    public void end(Xid xid, int flags) throws XAException {
+        try {
+            resource.end(xid, flags);
+        } catch (XAException e) {
+            throw getXAException(e);
+        }
+    }
+
+    public void forget(Xid xid) throws XAException {
+        try {
+            resource.forget(xid);
+        } catch (XAException e) {
+            throw getXAException(e);
+        }
+    }
+
+    public int getTransactionTimeout() throws XAException {
+        try {
+            return resource.getTransactionTimeout();
+        } catch (XAException e) {
+            throw getXAException(e);
+        }
+    }
+
+    public int prepare(Xid xid) throws XAException {
+        try {
+            return resource.prepare(xid);
+        } catch (XAException e) {
+            throw getXAException(e);
+        }
+    }
+
+    public Xid[] recover(int flag) throws XAException {
+        try {
+            Xid[] xids = resource.recover(flag);
+            for (int i = 0; i < xids.length; i++) {
+                xids[i] = new SerializableXid(xids[i]);
+            }
+            return xids;
+        } catch (XAException e) {
+            throw getXAException(e);
+        }
+    }
+
+    public void rollback(Xid xid) throws XAException {
+        try {
+            resource.rollback(xid);
+        } catch (XAException e) {
+            throw getXAException(e);
+        }
+    }
+
+    public boolean setTransactionTimeout(int seconds) throws XAException {
+        try {
+            return resource.setTransactionTimeout(seconds);
+        } catch (XAException e) {
+            throw getXAException(e);
+        }
     }
 
-    public RemoteXAResource getXAResource() throws RemoteException {
-        return getFactory().getRemoteXAResource(session.getXAResource());
+    public void start(Xid xid, int flags) throws XAException {
+        try {
+            resource.start(xid, flags);
+        } catch (XAException e) {
+            throw getXAException(e);
+        }
     }
 
 }

Modified: jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/jmx/JCRServer.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/jmx/JCRServer.java?rev=900484&r1=900483&r2=900484&view=diff
==============================================================================
--- jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/jmx/JCRServer.java (original)
+++ jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/jmx/JCRServer.java Mon Jan 18 18:00:53 2010
@@ -24,10 +24,8 @@
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
 import javax.jcr.SimpleCredentials;
-import javax.jcr.Workspace;
 import javax.naming.InitialContext;
 
-import org.apache.jackrabbit.api.JackrabbitWorkspace;
 import org.apache.jackrabbit.rmi.remote.RemoteRepository;
 import org.apache.jackrabbit.rmi.server.RemoteAdapterFactory;
 import org.apache.jackrabbit.rmi.server.ServerAdapterFactory;
@@ -129,13 +127,7 @@
         Session session = localRepository.login(
                 new SimpleCredentials(username, password.toCharArray()));
         try {
-            Workspace workspace = session.getWorkspace();
-            if (workspace instanceof JackrabbitWorkspace) {
-                ((JackrabbitWorkspace) workspace).createWorkspace(name);
-            } else {
-                throw new RepositoryException(
-                        "Not a Jackrabbit workspace: " + workspace);
-            }
+            session.getWorkspace().createWorkspace(name);
         } finally {
             session.logout();
         }



Mime
View raw message