[Mulgara-svn] r2015 - in trunk/src/jar: content-mbox/java/org/mulgara/content/mbox content-mp3/java/org/mulgara/content/mp3 content-n3/java/org/mulgara/content/n3 content-rdfa/java/org/mulgara/content/rdfa content-rdfxml/java/org/mulgara/content/rdfxml content-rlog/java/org/mulgara/content/rlog query/java/org/mulgara/query/operation query/java/org/mulgara/server resolver/java/org/mulgara/resolver resolver-spi/java/org/mulgara/content server-rmi/java/org/mulgara/server/rmi

alexhall at mulgara.org alexhall at mulgara.org
Tue Jul 19 23:18:13 UTC 2011


Author: alexhall
Date: 2011-07-19 23:18:12 +0000 (Tue, 19 Jul 2011)
New Revision: 2015

Modified:
   trunk/src/jar/content-mbox/java/org/mulgara/content/mbox/MBoxContentHandler.java
   trunk/src/jar/content-mp3/java/org/mulgara/content/mp3/MP3ContentHandler.java
   trunk/src/jar/content-n3/java/org/mulgara/content/n3/N3ContentHandler.java
   trunk/src/jar/content-rdfa/java/org/mulgara/content/rdfa/RdfaContentHandler.java
   trunk/src/jar/content-rdfxml/java/org/mulgara/content/rdfxml/RDFXMLContentHandler.java
   trunk/src/jar/content-rlog/java/org/mulgara/content/rlog/RlogContentHandler.java
   trunk/src/jar/query/java/org/mulgara/query/operation/Export.java
   trunk/src/jar/query/java/org/mulgara/server/Session.java
   trunk/src/jar/resolver-spi/java/org/mulgara/content/ContentHandler.java
   trunk/src/jar/resolver-spi/java/org/mulgara/content/ContentResolver.java
   trunk/src/jar/resolver/java/org/mulgara/resolver/BasicDatabaseSessionUnitTest.java
   trunk/src/jar/resolver/java/org/mulgara/resolver/DatabaseSession.java
   trunk/src/jar/resolver/java/org/mulgara/resolver/ExportOperation.java
   trunk/src/jar/server-rmi/java/org/mulgara/server/rmi/RemoteSession.java
   trunk/src/jar/server-rmi/java/org/mulgara/server/rmi/RemoteSessionWrapperSession.java
   trunk/src/jar/server-rmi/java/org/mulgara/server/rmi/SessionWrapperRemoteSession.java
Log:
Use ContentHandlerManager to select a writer instead of hard-coding a check for pathnames when exporting. This allows clients writing to an output stream to specify a content type, whereas before it would always be exported as RDF/XML

Modified: trunk/src/jar/content-mbox/java/org/mulgara/content/mbox/MBoxContentHandler.java
===================================================================
--- trunk/src/jar/content-mbox/java/org/mulgara/content/mbox/MBoxContentHandler.java	2011-07-19 23:16:06 UTC (rev 2014)
+++ trunk/src/jar/content-mbox/java/org/mulgara/content/mbox/MBoxContentHandler.java	2011-07-19 23:18:12 UTC (rev 2015)
@@ -32,8 +32,10 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
+import java.net.URI;
 import java.util.Collection;
 import java.util.Collections;
+import java.util.Map;
 
 import javax.activation.MimeType;
 
@@ -118,7 +120,8 @@
    */
   public void serialize(Statements      statements,
                         Content         content,
-                        ResolverSession resolverSession)
+                        ResolverSession resolverSession,
+                        Map<String,URI> prefixMap)
     throws ContentHandlerException
   {
     throw new ContentHandlerException("Mboxes are not writable.");

Modified: trunk/src/jar/content-mp3/java/org/mulgara/content/mp3/MP3ContentHandler.java
===================================================================
--- trunk/src/jar/content-mp3/java/org/mulgara/content/mp3/MP3ContentHandler.java	2011-07-19 23:16:06 UTC (rev 2014)
+++ trunk/src/jar/content-mp3/java/org/mulgara/content/mp3/MP3ContentHandler.java	2011-07-19 23:18:12 UTC (rev 2015)
@@ -33,6 +33,7 @@
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
+import java.util.Map;
 
 import javax.activation.MimeType;
 
@@ -132,7 +133,8 @@
    */
   public void serialize(Statements      statements,
                         Content         content,
-                        ResolverSession resolverSession)
+                        ResolverSession resolverSession,
+                        Map<String,URI> prefixMap)
     throws ContentHandlerException
   {
     throw new ContentHandlerException("MP3s are not writable.");

Modified: trunk/src/jar/content-n3/java/org/mulgara/content/n3/N3ContentHandler.java
===================================================================
--- trunk/src/jar/content-n3/java/org/mulgara/content/n3/N3ContentHandler.java	2011-07-19 23:16:06 UTC (rev 2014)
+++ trunk/src/jar/content-n3/java/org/mulgara/content/n3/N3ContentHandler.java	2011-07-19 23:18:12 UTC (rev 2015)
@@ -32,9 +32,11 @@
 import java.io.IOException;
 import java.io.OutputStreamWriter;
 import java.io.Writer;
+import java.net.URI;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
+import java.util.Map;
 
 import javax.activation.MimeType;
 
@@ -61,7 +63,6 @@
  */
 public class N3ContentHandler implements ContentHandler {
   /** Logger. */
-  @SuppressWarnings("unused")
   private static Logger logger = Logger.getLogger(N3ContentHandler.class);
 
   private static final Collection<MimeType> mimeTypes = 
@@ -97,9 +98,11 @@
    */
   public void serialize(Statements      statements,
                         Content         content,
-                        ResolverSession resolverSession)
+                        ResolverSession resolverSession,
+                        Map<String,URI> prefixMap)
       throws ContentHandlerException, ModifiedException {
     try {
+      if (prefixMap != null) logger.debug("Prefix map will be ignored for N3 output.");
       Writer out = new BufferedWriter(new OutputStreamWriter(content.newOutputStream(), "utf-8"));
       new N3Writer().write(statements, resolverSession, out);
       out.close();

Modified: trunk/src/jar/content-rdfa/java/org/mulgara/content/rdfa/RdfaContentHandler.java
===================================================================
--- trunk/src/jar/content-rdfa/java/org/mulgara/content/rdfa/RdfaContentHandler.java	2011-07-19 23:16:06 UTC (rev 2014)
+++ trunk/src/jar/content-rdfa/java/org/mulgara/content/rdfa/RdfaContentHandler.java	2011-07-19 23:18:12 UTC (rev 2015)
@@ -18,9 +18,11 @@
 
 // Java packages
 // Java 2 enterprise packages
+import java.net.URI;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
+import java.util.Map;
 
 import javax.activation.MimeType;
 
@@ -88,7 +90,8 @@
    */
   public void serialize(Statements      statements,
                         Content         content,
-                        ResolverSession resolverSession)
+                        ResolverSession resolverSession,
+                        Map<String,URI> prefixMap)
       throws ContentHandlerException, ModifiedException {
     throw new UnsupportedOperationException();
   }

Modified: trunk/src/jar/content-rdfxml/java/org/mulgara/content/rdfxml/RDFXMLContentHandler.java
===================================================================
--- trunk/src/jar/content-rdfxml/java/org/mulgara/content/rdfxml/RDFXMLContentHandler.java	2011-07-19 23:16:06 UTC (rev 2014)
+++ trunk/src/jar/content-rdfxml/java/org/mulgara/content/rdfxml/RDFXMLContentHandler.java	2011-07-19 23:18:12 UTC (rev 2015)
@@ -30,9 +30,11 @@
 // Java 2 standard packages
 import java.io.IOException;
 import java.io.OutputStreamWriter;
+import java.net.URI;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
+import java.util.Map;
 
 import javax.activation.MimeType;
 
@@ -107,7 +109,8 @@
    */
   public void serialize(Statements      statements,
                         Content         content,
-                        ResolverSession resolverSession)
+                        ResolverSession resolverSession,
+                        Map<String,URI> prefixMap)
       throws ContentHandlerException, ModifiedException {
 
     RDFXMLWriter rdfXmlWriter = new RDFXMLWriter();
@@ -115,7 +118,8 @@
       rdfXmlWriter.write(
         statements,
         resolverSession,
-        new OutputStreamWriter(content.newOutputStream(), "utf-8")
+        new OutputStreamWriter(content.newOutputStream(), "utf-8"),
+        prefixMap
       );
     } catch (QueryException e) {
       throw new ContentHandlerException("Failed to serialize RDF/XML to " + content.getURIString(), e);

Modified: trunk/src/jar/content-rlog/java/org/mulgara/content/rlog/RlogContentHandler.java
===================================================================
--- trunk/src/jar/content-rlog/java/org/mulgara/content/rlog/RlogContentHandler.java	2011-07-19 23:16:06 UTC (rev 2014)
+++ trunk/src/jar/content-rlog/java/org/mulgara/content/rlog/RlogContentHandler.java	2011-07-19 23:18:12 UTC (rev 2015)
@@ -21,9 +21,11 @@
 import java.io.BufferedWriter;
 import java.io.OutputStreamWriter;
 import java.io.Writer;
+import java.net.URI;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
+import java.util.Map;
 
 import javax.activation.MimeType;
 
@@ -45,7 +47,6 @@
  */
 public class RlogContentHandler implements ContentHandler {
   /** Logger. */
-  @SuppressWarnings("unused")
   private static Logger logger = Logger.getLogger(RlogContentHandler.class);
 
   /** Supported content types */
@@ -80,9 +81,10 @@
   /**
    * Writes out the statements in basic RLog format.
    */
-  public void serialize(Statements statements, Content content, ResolverSession resolverSession)
+  public void serialize(Statements statements, Content content, ResolverSession resolverSession, Map<String,URI> prefixMap)
           throws ContentHandlerException, ModifiedException {
     try {
+      if (prefixMap != null) logger.debug("Prefix map will be ignored for RLog writer.");
       Writer out = new BufferedWriter(new OutputStreamWriter(content.newOutputStream(), "utf-8"));
       RlogStructure struct = new RlogStructure(resolverSession);
       struct.load(statements);

Modified: trunk/src/jar/query/java/org/mulgara/query/operation/Export.java
===================================================================
--- trunk/src/jar/query/java/org/mulgara/query/operation/Export.java	2011-07-19 23:16:06 UTC (rev 2014)
+++ trunk/src/jar/query/java/org/mulgara/query/operation/Export.java	2011-07-19 23:18:12 UTC (rev 2015)
@@ -22,6 +22,8 @@
 import java.util.HashMap;
 import java.util.Map;
 
+import javax.activation.MimeType;
+
 import org.mulgara.connection.Connection;
 import org.mulgara.connection.Connection.SessionOp;
 import org.mulgara.query.QueryException;
@@ -40,6 +42,9 @@
   /** Optional user-defined namespace prefix mappings. */
   private Map<String,URI> namespacePrefixes;
   
+  /** Optional content type specifier. */
+  private MimeType contentType = null;
+  
   /**
    * Creates a new Export command, exporting data from the graph URI to a file or output stream.
    * @param graphURI The graph to export.
@@ -62,6 +67,11 @@
     setOverrideOutputStream(outputStream);
   }
   
+  public Export(URI graphURI, OutputStream outputStream, MimeType contentType) {
+    this(graphURI, outputStream);
+    this.contentType = contentType;
+  }
+  
   /**
    * Provide a set of namespace prefix mappings which will be used to pre-populate the namespace
    * prefix definitions in the exported RDF/XML.
@@ -125,7 +135,7 @@
   protected SessionOp<Object,QueryException> getOp(final OutputStream outputStream) {
     return new SessionOp<Object,QueryException>() {
       public Object fn(Session session) throws QueryException {
-        session.export(getSource(), outputStream, namespacePrefixes);
+        session.export(getSource(), outputStream, namespacePrefixes, contentType);
         return null;
       }
     };

Modified: trunk/src/jar/query/java/org/mulgara/server/Session.java
===================================================================
--- trunk/src/jar/query/java/org/mulgara/server/Session.java	2011-07-19 23:16:06 UTC (rev 2014)
+++ trunk/src/jar/query/java/org/mulgara/server/Session.java	2011-07-19 23:18:12 UTC (rev 2015)
@@ -169,9 +169,10 @@
    *
    * @param graphURI The URI of the graph to export.
    * @param outputStream The stream to receive the contents
+   * @param contentType An optional content type to determine the format in which to write to the output stream.
    * @throws QueryException if the export cannot be completed.
    */
-  public void export(URI graphURI, OutputStream outputStream) throws QueryException;
+  public void export(URI graphURI, OutputStream outputStream, MimeType contentType) throws QueryException;
 
   /**
    * Export the data in the specified graph to an output stream.
@@ -184,9 +185,10 @@
    * @param outputStream The stream to receive the contents
    * @param prefixes An optional set of user-supplied namespace prefix mappings;
    *   may be <code>null</code> to use the generated namespace prefixes.
+   * @param contentType An optional content type to determine the format in which to write to the output stream.
    * @throws QueryException if the export cannot be completed.
    */
-  public void export(URI graphURI, OutputStream outputStream, Map<String,URI> prefixes) throws QueryException;
+  public void export(URI graphURI, OutputStream outputStream, Map<String,URI> prefixes, MimeType contentType) throws QueryException;
 
   /**
    * Restore all the data on the server. If the database is not

Modified: trunk/src/jar/resolver/java/org/mulgara/resolver/BasicDatabaseSessionUnitTest.java
===================================================================
--- trunk/src/jar/resolver/java/org/mulgara/resolver/BasicDatabaseSessionUnitTest.java	2011-07-19 23:16:06 UTC (rev 2014)
+++ trunk/src/jar/resolver/java/org/mulgara/resolver/BasicDatabaseSessionUnitTest.java	2011-07-19 23:18:12 UTC (rev 2015)
@@ -30,6 +30,7 @@
 // Java 2 standard packages
 import java.io.File;
 import java.io.FileInputStream;
+import java.io.FileOutputStream;
 import java.io.PrintWriter;
 import java.io.StringWriter;
 import java.net.URI;
@@ -374,6 +375,28 @@
       }
       
       assertHasData(session, graph, TEST_SUBJECT, TEST_PREDICATE, TEST_OBJECT);
+      
+      // Verify we can export as Turtle.
+      File f = File.createTempFile("results", "ttl");
+      f.deleteOnExit();
+      FileOutputStream out = new FileOutputStream(f);
+      try {
+        session.export(graph, out, MimeTypes.TEXT_TURTLE);
+      } finally {
+        out.close();
+      }
+      
+      URI graph2 = URI.create("test:graph2");
+      session.createModel(graph2, null);
+      
+      in = new FileInputStream(f);
+      try {
+        session.setModel(in, graph2, null, MimeTypes.TEXT_TURTLE);
+      } finally {
+        in.close();
+      }
+      
+      assertHasData(session, graph2, TEST_SUBJECT, TEST_PREDICATE, TEST_OBJECT);
     } finally {
       session.close();
     }

Modified: trunk/src/jar/resolver/java/org/mulgara/resolver/DatabaseSession.java
===================================================================
--- trunk/src/jar/resolver/java/org/mulgara/resolver/DatabaseSession.java	2011-07-19 23:16:06 UTC (rev 2014)
+++ trunk/src/jar/resolver/java/org/mulgara/resolver/DatabaseSession.java	2011-07-19 23:18:12 UTC (rev 2015)
@@ -382,7 +382,7 @@
    * @throws QueryException if the export cannot be completed.
    */
   public void export(URI graphURI, URI destinationURI) throws QueryException {
-    this.export(null, graphURI, destinationURI, null);
+    this.export(null, graphURI, destinationURI, null, null);
   }
   
   
@@ -395,7 +395,7 @@
    * @throws QueryException if the export cannot be completed.
    */
   public void export(URI graphURI, URI destinationURI, Map<String,URI> prefixes) throws QueryException {
-    this.export(null, graphURI, destinationURI, prefixes);
+    this.export(null, graphURI, destinationURI, prefixes, null);
   }
   
   
@@ -406,8 +406,8 @@
    * @param outputStream The stream to receive the contents
    * @throws QueryException if the export cannot be completed.
    */
-  public void export(URI graphURI, OutputStream outputStream) throws QueryException {
-    this.export(outputStream, graphURI, null, null);
+  public void export(URI graphURI, OutputStream outputStream, MimeType contentType) throws QueryException {
+    this.export(outputStream, graphURI, null, null, contentType);
   }
 
 
@@ -419,8 +419,8 @@
    * @param prefixes An optional mapping for pre-populating the RDF/XML namespace prefixes.
    * @throws QueryException if the export cannot be completed.
    */
-  public void export(URI graphURI, OutputStream outputStream, Map<String,URI> prefixes) throws QueryException {
-    this.export(outputStream, graphURI, null, prefixes);
+  public void export(URI graphURI, OutputStream outputStream, Map<String,URI> prefixes, MimeType contentType) throws QueryException {
+    this.export(outputStream, graphURI, null, prefixes, contentType);
   }
 
 
@@ -699,11 +699,12 @@
    * @param destinationURI Optional URI of the file to export into.
    * @param initialPrefixes An optional set of user-supplied namespace prefix mappings;
    *   may be <code>null</code> to use the generated namespace prefixes.
+   * @param contentType TODO
    * @throws QueryException if the export cannot be completed.
    */
   private synchronized void export(OutputStream outputStream, URI graphURI, URI destinationURI,
-        Map<String,URI> initialPrefixes) throws QueryException {
-    execute(new ExportOperation(outputStream, graphURI, destinationURI, initialPrefixes),
+        Map<String,URI> initialPrefixes, MimeType contentType) throws QueryException {
+    execute(new ExportOperation(outputStream, graphURI, destinationURI, initialPrefixes, contentType, contentHandlers),
         "Unable to export " + graphURI);
   }
 

Modified: trunk/src/jar/resolver/java/org/mulgara/resolver/ExportOperation.java
===================================================================
--- trunk/src/jar/resolver/java/org/mulgara/resolver/ExportOperation.java	2011-07-19 23:16:06 UTC (rev 2014)
+++ trunk/src/jar/resolver/java/org/mulgara/resolver/ExportOperation.java	2011-07-19 23:18:12 UTC (rev 2015)
@@ -16,13 +16,14 @@
 package org.mulgara.resolver;
 
 import java.io.OutputStream;
-import java.io.OutputStreamWriter;
 import java.net.URI;
 import java.util.Map;
 
-import org.mulgara.content.rdfxml.writer.RDFXMLWriter;
-import org.mulgara.content.rlog.RlogStructure;
-import org.mulgara.content.n3.N3Writer;
+import javax.activation.MimeType;
+
+import org.mulgara.content.Content;
+import org.mulgara.content.ContentHandler;
+import org.mulgara.content.ContentHandlerManager;
 import org.mulgara.query.Constraint;
 import org.mulgara.query.ConstraintImpl;
 import org.mulgara.query.LocalNode;
@@ -50,6 +51,8 @@
 
   private final URI graphURI;
   private final Map<String,URI> prefixes;
+  private final MimeType contentType;
+  private final ContentHandlerManager contentManager;
 
   /**
    * Create an {@link Operation} which exports the contents of the specified RDF graph
@@ -67,14 +70,19 @@
    *   may be <code>null</code> to use the generated namespace prefixes.
    */
   public ExportOperation(OutputStream outputStream, URI graphURI, URI destinationURI,
-      Map<String,URI> initialPrefixes) {
+      Map<String,URI> initialPrefixes, MimeType contentType, ContentHandlerManager contentManager) {
     super(outputStream, destinationURI);
 
     if (graphURI == null) {
       throw new IllegalArgumentException("Graph URI may not be null.");
     }
+    if (contentManager == null) {
+      throw new IllegalArgumentException("Content manager may not be null.");
+    }
     this.graphURI = graphURI;
+    this.contentType = contentType;
     this.prefixes = initialPrefixes;
+    this.contentManager = contentManager;
   }
 
   /* (non-Javadoc)
@@ -90,10 +98,11 @@
     if (resolverFactory.supportsExport()) {
       OutputStream os = getOutputStream();
       assert os != null;
-      OutputStreamWriter writer = null;
 
       try {
-        writer = new OutputStreamWriter(os, "UTF-8");
+        Content content = new StreamContent(os, destinationURI, contentType);
+        ContentHandler handler = contentManager.getContentHandler(content);
+        if (handler == null) throw new QueryException("Unable to determine content handler for " + destinationURI);
 
         // create a constraint to get all statements
         Variable[] vars = new Variable[] {
@@ -109,29 +118,14 @@
 
         // Do the writing.
         try {
-          String path = (destinationURI != null) ? destinationURI.getPath() : null;
-          if (path != null && (path.endsWith(".n3") || path.endsWith(".nt") || path.endsWith(".ttl"))) {
-            N3Writer n3Writer = new N3Writer();
-            n3Writer.write(graphStatements, systemResolver, writer);
-          } else if (path != null && (path.endsWith(".rl") || path.endsWith(".dl") || path.endsWith(".rlog"))) {
-            RlogStructure struct = new RlogStructure(systemResolver);
-            struct.load(graphStatements);
-            struct.write(writer);
-          } else {
-            RDFXMLWriter rdfWriter = new RDFXMLWriter();
-            rdfWriter.write(graphStatements, systemResolver, writer, prefixes);
-          }
+          handler.serialize(graphStatements, content, systemResolver, prefixes);
         } finally {
           // This will close the wrapped resolution as well.
           graphStatements.close();
         }
       } finally {
         // Clean up.
-        if (writer != null) {
-          // Close the writer if it exists.  This will also close the wrapped
-          // OutputStream.
-          writer.close();
-        } else if (os != null) {
+        if (os != null) {
           // Close the os if it exists.
           os.close();
         }

Modified: trunk/src/jar/resolver-spi/java/org/mulgara/content/ContentHandler.java
===================================================================
--- trunk/src/jar/resolver-spi/java/org/mulgara/content/ContentHandler.java	2011-07-19 23:16:06 UTC (rev 2014)
+++ trunk/src/jar/resolver-spi/java/org/mulgara/content/ContentHandler.java	2011-07-19 23:18:12 UTC (rev 2015)
@@ -28,7 +28,9 @@
 package org.mulgara.content;
 
 // Local packages
+import java.net.URI;
 import java.util.Collection;
+import java.util.Map;
 
 import javax.activation.MimeType;
 
@@ -100,6 +102,7 @@
    * @param content  the document to populate
    * @param resolverSession  the context in which to globalize local node
    *   numbers contained within the <var>statements</var>
+   * @param prefixMap TODO
    * @throws ContentHandlerException  if the serialization failed; whether or
    *   not this can corrupt the {@link Content} depends on whether this
    *   particular handler is transactional
@@ -108,6 +111,7 @@
    */
   public void serialize(Statements      statements,
                         Content         content,
-                        ResolverSession resolverSession)
+                        ResolverSession resolverSession,
+                        Map<String,URI> prefixMap)
     throws ContentHandlerException, ModifiedException;
 }

Modified: trunk/src/jar/resolver-spi/java/org/mulgara/content/ContentResolver.java
===================================================================
--- trunk/src/jar/resolver-spi/java/org/mulgara/content/ContentResolver.java	2011-07-19 23:16:06 UTC (rev 2014)
+++ trunk/src/jar/resolver-spi/java/org/mulgara/content/ContentResolver.java	2011-07-19 23:18:12 UTC (rev 2015)
@@ -156,7 +156,7 @@
 
     try {
       ContentHandler contentHandler = contentManager.getContentHandler(content);
-      contentHandler.serialize(statements, content, resolverSession);
+      contentHandler.serialize(statements, content, resolverSession, null);
     } catch (RuntimeException e) {
       throw e;
     } catch (Exception e) {

Modified: trunk/src/jar/server-rmi/java/org/mulgara/server/rmi/RemoteSession.java
===================================================================
--- trunk/src/jar/server-rmi/java/org/mulgara/server/rmi/RemoteSession.java	2011-07-19 23:16:06 UTC (rev 2014)
+++ trunk/src/jar/server-rmi/java/org/mulgara/server/rmi/RemoteSession.java	2011-07-19 23:18:12 UTC (rev 2015)
@@ -163,9 +163,10 @@
    * 
    * @param graphURI The URI of the server or model to export.
    * @param outputStream The stream to receive the contents
+   * @param contentType Optional content type specifier.
    * @throws QueryException if the export cannot be completed.
    */
-  public void export(URI graphURI, OutputStream outputStream) throws QueryException, RemoteException;
+  public void export(URI graphURI, OutputStream outputStream, MimeType contentType) throws QueryException, RemoteException;
 
   /**
    * Export the data in the specified graph to an output stream using predefined namespace prefixes.
@@ -174,9 +175,10 @@
    * @param graphURI The URI of the server or model to export.
    * @param outputStream The stream to receive the contents
    * @param prefixes An optional mapping for pre-populating the RDF/XML namespace prefixes.
+   * @param contentType Optional content type specifier.
    * @throws QueryException if the export cannot be completed.
    */
-  public void export(URI graphURI, OutputStream outputStream, Map<String,URI> prefixes)
+  public void export(URI graphURI, OutputStream outputStream, Map<String,URI> prefixes, MimeType contentType)
       throws QueryException, RemoteException;
 
   /**

Modified: trunk/src/jar/server-rmi/java/org/mulgara/server/rmi/RemoteSessionWrapperSession.java
===================================================================
--- trunk/src/jar/server-rmi/java/org/mulgara/server/rmi/RemoteSessionWrapperSession.java	2011-07-19 23:16:06 UTC (rev 2014)
+++ trunk/src/jar/server-rmi/java/org/mulgara/server/rmi/RemoteSessionWrapperSession.java	2011-07-19 23:18:12 UTC (rev 2015)
@@ -356,13 +356,13 @@
    * @param outputStream The stream to receive the contents
    * @throws QueryException if the export cannot be completed.
    */
-  public void export(URI graphURI, OutputStream outputStream) throws QueryException {
+  public void export(URI graphURI, OutputStream outputStream, MimeType contentType) throws QueryException {
     try {
-      remoteSession.export(graphURI, outputStream);
+      remoteSession.export(graphURI, outputStream, contentType);
       resetRetries();
     } catch (RemoteException e) {
       testRetry(e);
-      export(graphURI, outputStream);
+      export(graphURI, outputStream, contentType);
     }
   }
 
@@ -376,13 +376,13 @@
    * @param prefixes An optional mapping for pre-populating the RDF/XML namespace prefixes.
    * @throws QueryException if the export cannot be completed.
    */
-  public void export(URI graphURI, OutputStream outputStream, Map<String,URI> prefixes) throws QueryException {
+  public void export(URI graphURI, OutputStream outputStream, Map<String,URI> prefixes, MimeType contentType) throws QueryException {
     try {
-      remoteSession.export(graphURI, outputStream, prefixes);
+      remoteSession.export(graphURI, outputStream, prefixes, contentType);
       resetRetries();
     } catch (RemoteException e) {
       testRetry(e);
-      export(graphURI, outputStream);
+      export(graphURI, outputStream, prefixes, contentType);
     }
   }
 

Modified: trunk/src/jar/server-rmi/java/org/mulgara/server/rmi/SessionWrapperRemoteSession.java
===================================================================
--- trunk/src/jar/server-rmi/java/org/mulgara/server/rmi/SessionWrapperRemoteSession.java	2011-07-19 23:16:06 UTC (rev 2014)
+++ trunk/src/jar/server-rmi/java/org/mulgara/server/rmi/SessionWrapperRemoteSession.java	2011-07-19 23:18:12 UTC (rev 2015)
@@ -250,9 +250,9 @@
    * @param outputStream The stream to receive the contents
    * @throws QueryException if the export cannot be completed.
    */
-  public void export(URI graphURI, OutputStream outputStream) throws QueryException, RemoteException {
+  public void export(URI graphURI, OutputStream outputStream, MimeType contentType) throws QueryException, RemoteException {
     try {
-      session.export(graphURI, outputStream);
+      session.export(graphURI, outputStream, contentType);
     } catch (Throwable t) {
       throw convertToQueryException(t);
     }
@@ -267,9 +267,9 @@
    * @param prefixes An optional mapping for pre-populating the RDF/XML namespace prefixes.
    * @throws QueryException if the export cannot be completed.
    */
-  public void export(URI graphURI, OutputStream outputStream, Map<String,URI> prefixes) throws QueryException, RemoteException {
+  public void export(URI graphURI, OutputStream outputStream, Map<String,URI> prefixes, MimeType contentType) throws QueryException, RemoteException {
     try {
-      session.export(graphURI, outputStream, prefixes);
+      session.export(graphURI, outputStream, prefixes, contentType);
     } catch (Throwable t) {
       throw convertToQueryException(t);
     }



More information about the Mulgara-svn mailing list