You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by an...@apache.org on 2012/09/14 12:56:44 UTC

svn commit: r1384719 - in /jena/Experimental/riot-reader/src/main/java/riot_reader: TypedInputStream2.java fm2/LocatorFile2.java fm2/LocatorURL2.java fm2/LocatorZip.java

Author: andy
Date: Fri Sep 14 10:56:44 2012
New Revision: 1384719

URL: http://svn.apache.org/viewvc?rev=1384719&view=rev
Log:
Add .hashCode/.equals to Locators.
Add deprecated compatibility operation to TypedInputStream.

Modified:
    jena/Experimental/riot-reader/src/main/java/riot_reader/TypedInputStream2.java
    jena/Experimental/riot-reader/src/main/java/riot_reader/fm2/LocatorFile2.java
    jena/Experimental/riot-reader/src/main/java/riot_reader/fm2/LocatorURL2.java
    jena/Experimental/riot-reader/src/main/java/riot_reader/fm2/LocatorZip.java

Modified: jena/Experimental/riot-reader/src/main/java/riot_reader/TypedInputStream2.java
URL: http://svn.apache.org/viewvc/jena/Experimental/riot-reader/src/main/java/riot_reader/TypedInputStream2.java?rev=1384719&r1=1384718&r2=1384719&view=diff
==============================================================================
--- jena/Experimental/riot-reader/src/main/java/riot_reader/TypedInputStream2.java (original)
+++ jena/Experimental/riot-reader/src/main/java/riot_reader/TypedInputStream2.java Fri Sep 14 10:56:44 2012
@@ -48,6 +48,12 @@ public class TypedInputStream2
     }
     
     public InputStream getInput()           { return input ; }
+    
+    /** @deprecated Use {@link #getContentType} */
+    @Deprecated 
+    public String getMimeType()                 { return getContentType()  ; }
+
+    
     public String getContentType()          { return mediaType == null ? null : mediaType.getContentType() ; }
     public String getCharset()              { return mediaType == null ? null : mediaType.getCharset() ; }
     public ContentType getMediaType()       { return mediaType ; }

Modified: jena/Experimental/riot-reader/src/main/java/riot_reader/fm2/LocatorFile2.java
URL: http://svn.apache.org/viewvc/jena/Experimental/riot-reader/src/main/java/riot_reader/fm2/LocatorFile2.java?rev=1384719&r1=1384718&r2=1384719&view=diff
==============================================================================
--- jena/Experimental/riot-reader/src/main/java/riot_reader/fm2/LocatorFile2.java (original)
+++ jena/Experimental/riot-reader/src/main/java/riot_reader/fm2/LocatorFile2.java Fri Sep 14 10:56:44 2012
@@ -147,4 +147,34 @@ public class LocatorFile2 implements Loc
             tmp = tmp+"("+altDir+")" ;
         return tmp ;
     }
+
+    @Override
+    public int hashCode()
+    {
+        final int prime = 31 ;
+        int result = 1 ;
+        result = prime * result + ((altDir == null) ? 0 : altDir.hashCode()) ;
+        result = prime * result + ((altDirLogStr == null) ? 0 : altDirLogStr.hashCode()) ;
+        return result ;
+    }
+
+    @Override
+    public boolean equals(Object obj)
+    {
+        if (this == obj) return true ;
+        if (obj == null) return false ;
+        if (getClass() != obj.getClass()) return false ;
+        LocatorFile2 other = (LocatorFile2)obj ;
+        if (altDir == null)
+        {
+            if (other.altDir != null) return false ;
+        } else
+            if (!altDir.equals(other.altDir)) return false ;
+        if (altDirLogStr == null)
+        {
+            if (other.altDirLogStr != null) return false ;
+        } else
+            if (!altDirLogStr.equals(other.altDirLogStr)) return false ;
+        return true ;
+    }
 }

Modified: jena/Experimental/riot-reader/src/main/java/riot_reader/fm2/LocatorURL2.java
URL: http://svn.apache.org/viewvc/jena/Experimental/riot-reader/src/main/java/riot_reader/fm2/LocatorURL2.java?rev=1384719&r1=1384718&r2=1384719&view=diff
==============================================================================
--- jena/Experimental/riot-reader/src/main/java/riot_reader/fm2/LocatorURL2.java (original)
+++ jena/Experimental/riot-reader/src/main/java/riot_reader/fm2/LocatorURL2.java Fri Sep 14 10:56:44 2012
@@ -28,9 +28,9 @@ import riot_reader.TypedInputStream2 ;
 public class LocatorURL2 implements Locator
 {
     private static Logger log = LoggerFactory.getLogger(LocatorURL2.class) ;
-    public static final String acceptTriples = "text/turtle,application/rdf+xml;q=0.9,application/xml;q=0.8,*/*;q=0.5" ; 
+    private static final String[] schemeNames = { "http" , "https" } ;    // Must be lower case and not include the ":"
     
-    static final String[] schemeNames = { "http" , "https" } ;    // Must be lower case and not include the ":"
+    public final String acceptTriples = "text/turtle,application/rdf+xml;q=0.9,application/xml;q=0.8,*/*;q=0.5" ; 
 
     @Override
     public TypedInputStream2 open(String uri)
@@ -65,5 +65,29 @@ public class LocatorURL2 implements Loca
         }
         return false ;
     }
+
+    @Override
+    public int hashCode()
+    {
+        final int prime = 31 ;
+        int result = 1 ;
+        result = prime * result + ((acceptTriples == null) ? 0 : acceptTriples.hashCode()) ;
+        return result ;
+    }
+
+    @Override
+    public boolean equals(Object obj)
+    {
+        if (this == obj) return true ;
+        if (obj == null) return false ;
+        if (getClass() != obj.getClass()) return false ;
+        LocatorURL2 other = (LocatorURL2)obj ;
+        if (acceptTriples == null)
+        {
+            if (other.acceptTriples != null) return false ;
+        } else
+            if (!acceptTriples.equals(other.acceptTriples)) return false ;
+        return true ;
+    }
 }
 

Modified: jena/Experimental/riot-reader/src/main/java/riot_reader/fm2/LocatorZip.java
URL: http://svn.apache.org/viewvc/jena/Experimental/riot-reader/src/main/java/riot_reader/fm2/LocatorZip.java?rev=1384719&r1=1384718&r2=1384719&view=diff
==============================================================================
--- jena/Experimental/riot-reader/src/main/java/riot_reader/fm2/LocatorZip.java (original)
+++ jena/Experimental/riot-reader/src/main/java/riot_reader/fm2/LocatorZip.java Fri Sep 14 10:56:44 2012
@@ -36,9 +36,9 @@ import com.hp.hpl.jena.shared.JenaExcept
 
 public class LocatorZip implements Locator
 {
-    static Logger log = LoggerFactory.getLogger(LocatorZip.class) ;
-    String zipFileName = null ; 
-    ZipFile zipFile = null ;
+    private static Logger log = LoggerFactory.getLogger(LocatorZip.class) ;
+    private final String zipFileName ; 
+    private final ZipFile zipFile ;
     
     public LocatorZip(String zfn)
     {
@@ -47,7 +47,7 @@ public class LocatorZip implements Locat
             zipFile = new ZipFile(zipFileName) ;
         } catch  (IOException ex)
         { 
-            throw new JenaException("Problems accessing "+zipFileName, ex) ;
+            throw new JenaException("Problems accessing "+zfn, ex) ;
         }
     }
     
@@ -88,4 +88,28 @@ public class LocatorZip implements Locat
     @Override
     public String getName() { return "LocatorZip("+zipFileName+")" ; } 
 
+    @Override
+    public int hashCode()
+    {
+        final int prime = 31 ;
+        int result = 1 ;
+        result = prime * result + ((zipFileName == null) ? 0 : zipFileName.hashCode()) ;
+        return result ;
+    }
+
+    @Override
+    public boolean equals(Object obj)
+    {
+        if (this == obj) return true ;
+        if (obj == null) return false ;
+        if (getClass() != obj.getClass()) return false ;
+        LocatorZip other = (LocatorZip)obj ;
+        if (zipFileName == null)
+        {
+            if (other.zipFileName != null) return false ;
+        } else
+            if (!zipFileName.equals(other.zipFileName)) return false ;
+        return true ;
+    }
+
 }