jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fmesc...@apache.org
Subject svn commit: r644020 - in /jackrabbit/branches/1.4/jackrabbit-jcr-rmi: ./ src/main/java/org/apache/jackrabbit/rmi/client/ src/main/java/org/apache/jackrabbit/rmi/xml/
Date Wed, 02 Apr 2008 19:40:45 GMT
Author: fmeschbe
Date: Wed Apr  2 12:40:44 2008
New Revision: 644020

URL: http://svn.apache.org/viewvc?rev=644020&view=rev
Log:
JCR-1343 Replace xerces for serialization by JAXP
  - Backport Rev. 616082 fix using new jackrabbit-jcr-commons XML features
  - Explicitly require jackrabbit-jcr-commons release 1.4.2 containing the
    XML features

Removed:
    jackrabbit/branches/1.4/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/xml/
Modified:
    jackrabbit/branches/1.4/jackrabbit-jcr-rmi/pom.xml
    jackrabbit/branches/1.4/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientSession.java
    jackrabbit/branches/1.4/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientWorkspace.java

Modified: jackrabbit/branches/1.4/jackrabbit-jcr-rmi/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.4/jackrabbit-jcr-rmi/pom.xml?rev=644020&r1=644019&r2=644020&view=diff
==============================================================================
--- jackrabbit/branches/1.4/jackrabbit-jcr-rmi/pom.xml (original)
+++ jackrabbit/branches/1.4/jackrabbit-jcr-rmi/pom.xml Wed Apr  2 12:40:44 2008
@@ -94,6 +94,7 @@
     <dependency>
       <groupId>org.apache.jackrabbit</groupId>
       <artifactId>jackrabbit-jcr-commons</artifactId>
+      <version>1.4.2</version>
     </dependency>
     <dependency>
       <groupId>xerces</groupId>

Modified: jackrabbit/branches/1.4/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientSession.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.4/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientSession.java?rev=644020&r1=644019&r2=644020&view=diff
==============================================================================
--- jackrabbit/branches/1.4/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientSession.java
(original)
+++ jackrabbit/branches/1.4/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientSession.java
Wed Apr  2 12:40:44 2008
@@ -41,8 +41,9 @@
 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.xml.SessionImportContentHandler;
 import org.apache.jackrabbit.rmi.value.SerialValueFactory;
 import org.xml.sax.ContentHandler;
 import org.xml.sax.SAXException;
@@ -263,9 +264,25 @@
     }
 
     /** {@inheritDoc} */
-    public ContentHandler getImportContentHandler(String path, int mode)
-            throws RepositoryException {
-        return new SessionImportContentHandler(this, path, mode);
+    public ContentHandler getImportContentHandler(
+            final String path, final int mode) throws RepositoryException {
+        try {
+            final ByteArrayOutputStream buffer = new ByteArrayOutputStream();
+            ContentHandler handler =
+                SerializingContentHandler.getSerializer(buffer);
+            return new DefaultContentHandler(handler) {
+                public void endDocument() throws SAXException {
+                    super.endDocument();
+                    try {
+                        remote.importXML(path, buffer.toByteArray(), mode);
+                    } catch (Exception e) {
+                        throw new SAXException("XML import failed", e);
+                    }
+                }
+            };
+        } catch (SAXException e) {
+            throw new RepositoryException("XML serialization failed", e);
+        }
     }
 
     /** {@inheritDoc} */

Modified: jackrabbit/branches/1.4/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientWorkspace.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.4/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientWorkspace.java?rev=644020&r1=644019&r2=644020&view=diff
==============================================================================
--- jackrabbit/branches/1.4/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientWorkspace.java
(original)
+++ jackrabbit/branches/1.4/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientWorkspace.java
Wed Apr  2 12:40:44 2008
@@ -31,12 +31,14 @@
 import javax.jcr.query.QueryManager;
 import javax.jcr.version.Version;
 
+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;
 import org.apache.jackrabbit.rmi.remote.RemoteWorkspace;
-import org.apache.jackrabbit.rmi.xml.WorkspaceImportContentHandler;
 import org.xml.sax.ContentHandler;
+import org.xml.sax.SAXException;
 
 /**
  * Local adapter for the JCR-RMI {@link RemoteWorkspace RemoteWorkspace}
@@ -193,9 +195,23 @@
 
     /** {@inheritDoc} */
     public ContentHandler getImportContentHandler(
-            String path, int uuidBehaviour)
-            throws RepositoryException {
-        return new WorkspaceImportContentHandler(this, path, uuidBehaviour);
+            final String path, final int mode) throws RepositoryException {
+        try {
+            final ByteArrayOutputStream buffer = new ByteArrayOutputStream();
+            return new DefaultContentHandler(
+                    SerializingContentHandler.getSerializer(buffer)) {
+                public void endDocument() throws SAXException {
+                    super.endDocument();
+                    try {
+                        remote.importXML(path, buffer.toByteArray(), mode);
+                    } catch (Exception e) {
+                        throw new SAXException("XML import failed", e);
+                    }
+                }
+            };
+        } catch (SAXException e) {
+            throw new RepositoryException("XML serialization failed", e);
+        }
     }
 
     /** {@inheritDoc} */



Mime
View raw message