You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@marmotta.apache.org by ja...@apache.org on 2014/02/07 10:48:33 UTC

git commit: MARMOTTA-437: replaced RDFFormat.forFileName / forMIMEType with their Rio-successors.

Updated Branches:
  refs/heads/develop 5e5836886 -> 4b2a9ad75


MARMOTTA-437: replaced RDFFormat.forFileName / forMIMEType with their Rio-successors.


Project: http://git-wip-us.apache.org/repos/asf/marmotta/repo
Commit: http://git-wip-us.apache.org/repos/asf/marmotta/commit/4b2a9ad7
Tree: http://git-wip-us.apache.org/repos/asf/marmotta/tree/4b2a9ad7
Diff: http://git-wip-us.apache.org/repos/asf/marmotta/diff/4b2a9ad7

Branch: refs/heads/develop
Commit: 4b2a9ad753d5583131429ad7f1b63a80da16c068
Parents: 5e58368
Author: Jakob Frank <ja...@apache.org>
Authored: Fri Feb 7 10:44:29 2014 +0100
Committer: Jakob Frank <ja...@apache.org>
Committed: Fri Feb 7 10:44:29 2014 +0100

----------------------------------------------------------------------
 .../commons/sesame/rio/ical/ICalFormat.java     |  7 ++--
 .../commons/sesame/rio/rss/AtomFormat.java      |  4 ---
 .../commons/sesame/rio/rss/RSSFormat.java       |  4 ---
 .../commons/sesame/rio/vcard/VCardFormat.java   |  3 --
 .../ldpath/backend/file/FileBackend.java        | 13 +++----
 .../marmotta/loader/core/MarmottaLoader.java    | 14 +++-----
 .../marmotta/loader/rio/GeonamesFormat.java     |  4 ---
 .../loader/core/test/GeonamesParserTest.java    |  2 +-
 .../platform/core/rio/RDFHtmlFormat.java        |  3 --
 .../core/webservices/io/ExportWebService.java   | 37 +++++++++-----------
 10 files changed, 30 insertions(+), 61 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/marmotta/blob/4b2a9ad7/commons/marmotta-sesame-tools/marmotta-rio-api/src/main/java/org/apache/marmotta/commons/sesame/rio/ical/ICalFormat.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-api/src/main/java/org/apache/marmotta/commons/sesame/rio/ical/ICalFormat.java b/commons/marmotta-sesame-tools/marmotta-rio-api/src/main/java/org/apache/marmotta/commons/sesame/rio/ical/ICalFormat.java
index 9f130af..0ff1bd8 100644
--- a/commons/marmotta-sesame-tools/marmotta-rio-api/src/main/java/org/apache/marmotta/commons/sesame/rio/ical/ICalFormat.java
+++ b/commons/marmotta-sesame-tools/marmotta-rio-api/src/main/java/org/apache/marmotta/commons/sesame/rio/ical/ICalFormat.java
@@ -33,7 +33,7 @@ import java.util.Arrays;
  * </ul>
  * 
  * @author Sebastian Schaffert
- * @see http://wiki.modularity.net.au/ical4j/index.php?title=Compatibility
+ * @see <a href="http://wiki.modularity.net.au/ical4j/index.php?title=Compatibility">http://wiki.modularity.net.au/ical4j/index.php?title=Compatibility</a>
  */
 public class ICalFormat {
 
@@ -57,7 +57,7 @@ public class ICalFormat {
      * <li>{@code ical4j.compatibility.notes}
      * </ul>
      * 
-     * @see http://wiki.modularity.net.au/ical4j/index.php?title=Compatibility
+     * @see <a href="http://wiki.modularity.net.au/ical4j/index.php?title=Compatibility">http://wiki.modularity.net.au/ical4j/index.php?title=Compatibility</a>
      */
     public static final RDFFormat FORMAT = new RDFFormat(
             "ICal",
@@ -67,8 +67,5 @@ public class ICalFormat {
             false,
             false
     );
-    static {
-        RDFFormat.register(FORMAT);
-    }
 
 }

http://git-wip-us.apache.org/repos/asf/marmotta/blob/4b2a9ad7/commons/marmotta-sesame-tools/marmotta-rio-api/src/main/java/org/apache/marmotta/commons/sesame/rio/rss/AtomFormat.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-api/src/main/java/org/apache/marmotta/commons/sesame/rio/rss/AtomFormat.java b/commons/marmotta-sesame-tools/marmotta-rio-api/src/main/java/org/apache/marmotta/commons/sesame/rio/rss/AtomFormat.java
index 6432f0b..6a2f970 100644
--- a/commons/marmotta-sesame-tools/marmotta-rio-api/src/main/java/org/apache/marmotta/commons/sesame/rio/rss/AtomFormat.java
+++ b/commons/marmotta-sesame-tools/marmotta-rio-api/src/main/java/org/apache/marmotta/commons/sesame/rio/rss/AtomFormat.java
@@ -36,9 +36,5 @@ public class AtomFormat {
             false,
             false
     );
-    static {
-        RDFFormat.register(FORMAT);
-    }
-
 
 }

http://git-wip-us.apache.org/repos/asf/marmotta/blob/4b2a9ad7/commons/marmotta-sesame-tools/marmotta-rio-api/src/main/java/org/apache/marmotta/commons/sesame/rio/rss/RSSFormat.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-api/src/main/java/org/apache/marmotta/commons/sesame/rio/rss/RSSFormat.java b/commons/marmotta-sesame-tools/marmotta-rio-api/src/main/java/org/apache/marmotta/commons/sesame/rio/rss/RSSFormat.java
index eef5438..eb25fbe 100644
--- a/commons/marmotta-sesame-tools/marmotta-rio-api/src/main/java/org/apache/marmotta/commons/sesame/rio/rss/RSSFormat.java
+++ b/commons/marmotta-sesame-tools/marmotta-rio-api/src/main/java/org/apache/marmotta/commons/sesame/rio/rss/RSSFormat.java
@@ -37,9 +37,5 @@ public class RSSFormat {
             false,
             false
     );
-    static {
-        RDFFormat.register(FORMAT);
-    }
-
 
 }

http://git-wip-us.apache.org/repos/asf/marmotta/blob/4b2a9ad7/commons/marmotta-sesame-tools/marmotta-rio-api/src/main/java/org/apache/marmotta/commons/sesame/rio/vcard/VCardFormat.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-api/src/main/java/org/apache/marmotta/commons/sesame/rio/vcard/VCardFormat.java b/commons/marmotta-sesame-tools/marmotta-rio-api/src/main/java/org/apache/marmotta/commons/sesame/rio/vcard/VCardFormat.java
index e438dee..3e7adc6 100644
--- a/commons/marmotta-sesame-tools/marmotta-rio-api/src/main/java/org/apache/marmotta/commons/sesame/rio/vcard/VCardFormat.java
+++ b/commons/marmotta-sesame-tools/marmotta-rio-api/src/main/java/org/apache/marmotta/commons/sesame/rio/vcard/VCardFormat.java
@@ -36,8 +36,5 @@ public class VCardFormat {
             false,
             false
     );
-    static {
-        RDFFormat.register(FORMAT);
-    }
 
 }

http://git-wip-us.apache.org/repos/asf/marmotta/blob/4b2a9ad7/libraries/ldpath/ldpath-backend-file/src/main/java/org/apache/marmotta/ldpath/backend/file/FileBackend.java
----------------------------------------------------------------------
diff --git a/libraries/ldpath/ldpath-backend-file/src/main/java/org/apache/marmotta/ldpath/backend/file/FileBackend.java b/libraries/ldpath/ldpath-backend-file/src/main/java/org/apache/marmotta/ldpath/backend/file/FileBackend.java
index d747cf3..92826a1 100644
--- a/libraries/ldpath/ldpath-backend-file/src/main/java/org/apache/marmotta/ldpath/backend/file/FileBackend.java
+++ b/libraries/ldpath/ldpath-backend-file/src/main/java/org/apache/marmotta/ldpath/backend/file/FileBackend.java
@@ -17,10 +17,6 @@
  */
 package org.apache.marmotta.ldpath.backend.file;
 
-import java.io.File;
-import java.io.IOException;
-import java.net.URL;
-
 import org.apache.marmotta.ldpath.backend.sesame.SesameRepositoryBackend;
 import org.openrdf.repository.Repository;
 import org.openrdf.repository.RepositoryConnection;
@@ -28,10 +24,15 @@ import org.openrdf.repository.RepositoryException;
 import org.openrdf.repository.sail.SailRepository;
 import org.openrdf.rio.RDFFormat;
 import org.openrdf.rio.RDFParseException;
+import org.openrdf.rio.Rio;
 import org.openrdf.sail.memory.MemoryStore;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import java.io.File;
+import java.io.IOException;
+import java.net.URL;
+
 
 /**
  * Add file description here!
@@ -53,7 +54,7 @@ public class FileBackend extends SesameRepositoryBackend {
         RDFFormat format = null;
 
         if(mimetype != null) {
-            format = RDFFormat.forMIMEType(mimetype);
+            format = Rio.getParserFormatForMIMEType(mimetype);
         }
 
         try {
@@ -102,7 +103,7 @@ public class FileBackend extends SesameRepositoryBackend {
         RDFFormat format = null;
 
         if(mimetype != null) {
-            format = RDFFormat.forMIMEType(mimetype);
+            format = Rio.getParserFormatForMIMEType(mimetype);
         }
 
         try {

http://git-wip-us.apache.org/repos/asf/marmotta/blob/4b2a9ad7/loader/marmotta-loader-core/src/main/java/org/apache/marmotta/loader/core/MarmottaLoader.java
----------------------------------------------------------------------
diff --git a/loader/marmotta-loader-core/src/main/java/org/apache/marmotta/loader/core/MarmottaLoader.java b/loader/marmotta-loader-core/src/main/java/org/apache/marmotta/loader/core/MarmottaLoader.java
index fc9ef1a..357c126 100644
--- a/loader/marmotta-loader-core/src/main/java/org/apache/marmotta/loader/core/MarmottaLoader.java
+++ b/loader/marmotta-loader-core/src/main/java/org/apache/marmotta/loader/core/MarmottaLoader.java
@@ -48,14 +48,8 @@ public class MarmottaLoader {
 
     private static ServiceLoader<LoaderBackend> backends = ServiceLoader.load(LoaderBackend.class);
 
-
     private static Logger log = LoggerFactory.getLogger(MarmottaLoader.class);
 
-    static {
-        RDFFormat.register(GeonamesFormat.FORMAT);
-    }
-
-
     private Configuration configuration;
 
     public MarmottaLoader(Configuration configuration) {
@@ -200,7 +194,7 @@ public class MarmottaLoader {
 
 
         // detect the file format
-        RDFFormat detectedFormat = RDFFormat.forFileName(uncompressedName(file));
+        RDFFormat detectedFormat = Rio.getParserFormatForFileName(uncompressedName(file));
         if(format == null) {
             if(detectedFormat != null) {
                 log.info("using auto-detected format ({})", detectedFormat.getName());
@@ -289,7 +283,7 @@ public class MarmottaLoader {
                             log.info("loading entry {} ...", entry.getName());
 
                             // detect the file format
-                            RDFFormat detectedFormat = RDFFormat.forFileName(entry.getName());
+                            RDFFormat detectedFormat = Rio.getParserFormatForFileName(entry.getName());
                             if(format == null) {
                                 if(detectedFormat != null) {
                                     log.info("auto-detected entry format: {}", detectedFormat.getName());
@@ -357,7 +351,7 @@ public class MarmottaLoader {
                         log.info("loading entry {} ...", entry.getName());
 
                         // detect the file format
-                        RDFFormat detectedFormat = RDFFormat.forFileName(entry.getName());
+                        RDFFormat detectedFormat = Rio.getParserFormatForFileName(entry.getName());
                         if(format == null) {
                             if(detectedFormat != null) {
                                 log.info("auto-detected entry format: {}", detectedFormat.getName());
@@ -497,7 +491,7 @@ public class MarmottaLoader {
         } else if(StringUtils.equalsIgnoreCase(spec,"geonames")) {
             return GeonamesFormat.FORMAT;
         } else if(spec != null) {
-            return RDFFormat.forMIMEType(spec);
+            return Rio.getParserFormatForMIMEType(spec);
         } else {
             return null;
         }

http://git-wip-us.apache.org/repos/asf/marmotta/blob/4b2a9ad7/loader/marmotta-loader-core/src/main/java/org/apache/marmotta/loader/rio/GeonamesFormat.java
----------------------------------------------------------------------
diff --git a/loader/marmotta-loader-core/src/main/java/org/apache/marmotta/loader/rio/GeonamesFormat.java b/loader/marmotta-loader-core/src/main/java/org/apache/marmotta/loader/rio/GeonamesFormat.java
index f8059e8..095233c 100644
--- a/loader/marmotta-loader-core/src/main/java/org/apache/marmotta/loader/rio/GeonamesFormat.java
+++ b/loader/marmotta-loader-core/src/main/java/org/apache/marmotta/loader/rio/GeonamesFormat.java
@@ -37,9 +37,5 @@ public class GeonamesFormat {
             false,
             false
     );
-    static {
-        RDFFormat.register(FORMAT);
-    }
-
 
 }

http://git-wip-us.apache.org/repos/asf/marmotta/blob/4b2a9ad7/loader/marmotta-loader-core/src/test/java/org/apache/marmotta/loader/core/test/GeonamesParserTest.java
----------------------------------------------------------------------
diff --git a/loader/marmotta-loader-core/src/test/java/org/apache/marmotta/loader/core/test/GeonamesParserTest.java b/loader/marmotta-loader-core/src/test/java/org/apache/marmotta/loader/core/test/GeonamesParserTest.java
index 57af9ea..938ccf1 100644
--- a/loader/marmotta-loader-core/src/test/java/org/apache/marmotta/loader/core/test/GeonamesParserTest.java
+++ b/loader/marmotta-loader-core/src/test/java/org/apache/marmotta/loader/core/test/GeonamesParserTest.java
@@ -50,7 +50,7 @@ public class GeonamesParserTest {
     public void testFormat() throws ClassNotFoundException {
         Class.forName("org.apache.marmotta.loader.rio.GeonamesFormat");
 
-        RDFFormat f = RDFFormat.forMIMEType("text/vnd.geonames.rdf");
+        RDFFormat f = Rio.getParserFormatForMIMEType("text/vnd.geonames.rdf");
 
         Assert.assertEquals(GeonamesFormat.FORMAT, f);
     }

http://git-wip-us.apache.org/repos/asf/marmotta/blob/4b2a9ad7/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/rio/RDFHtmlFormat.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/rio/RDFHtmlFormat.java b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/rio/RDFHtmlFormat.java
index df8d0ef..2c28435 100644
--- a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/rio/RDFHtmlFormat.java
+++ b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/rio/RDFHtmlFormat.java
@@ -37,8 +37,5 @@ public class RDFHtmlFormat {
             true,
             false
     );
-    static {
-        RDFFormat.register(FORMAT);
-    }
 
 }

http://git-wip-us.apache.org/repos/asf/marmotta/blob/4b2a9ad7/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/webservices/io/ExportWebService.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/webservices/io/ExportWebService.java b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/webservices/io/ExportWebService.java
index d62ca82..7125252 100644
--- a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/webservices/io/ExportWebService.java
+++ b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/webservices/io/ExportWebService.java
@@ -17,26 +17,6 @@
  */
 package org.apache.marmotta.platform.core.webservices.io;
 
-import static org.apache.marmotta.commons.sesame.repository.ExceptionUtils.handleRepositoryException;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Date;
-import java.util.List;
-
-import javax.enterprise.context.ApplicationScoped;
-import javax.inject.Inject;
-import javax.ws.rs.GET;
-import javax.ws.rs.HeaderParam;
-import javax.ws.rs.Path;
-import javax.ws.rs.Produces;
-import javax.ws.rs.QueryParam;
-import javax.ws.rs.WebApplicationException;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.StreamingOutput;
-
 import org.apache.marmotta.commons.http.ContentType;
 import org.apache.marmotta.commons.http.MarmottaHttpUtils;
 import org.apache.marmotta.commons.util.DateUtils;
@@ -47,8 +27,23 @@ import org.openrdf.model.URI;
 import org.openrdf.repository.RepositoryConnection;
 import org.openrdf.repository.RepositoryException;
 import org.openrdf.rio.RDFFormat;
+import org.openrdf.rio.Rio;
 import org.slf4j.Logger;
 
+import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Inject;
+import javax.ws.rs.*;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.StreamingOutput;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Date;
+import java.util.List;
+
+import static org.apache.marmotta.commons.sesame.repository.ExceptionUtils.handleRepositoryException;
+
 /**
  * A web service for exporting data from the Apache Marmotta triple store
  * <p/>
@@ -119,7 +114,7 @@ public class ExportWebService {
         }
 
         if(bestType != null) {
-            RDFFormat format = RDFFormat.forMIMEType(bestType.getMime());
+            RDFFormat format = Rio.getWriterFormatForMIMEType(bestType.getMime());
             if(format != null) {
                 fileName += "." + format.getDefaultFileExtension();
             }