GitLab Mirror pushed to branch 2.16 at cms-community / hippo-jackrabbit

Commits:
930ee607 by Julian Reschke at 2018-02-03T06:36:04+00:00
JCR-4250: remove guava dependency (ported to 2.16)

git-svn-id: https://svn.apache.org/repos/asf/jackrabbit/branches/2.16@1823019 
13f79535-47bb-0310-9956-ffa450edef68

- - - - -


3 changed files:

- jackrabbit-jcr-commons/pom.xml
- 
jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/value/ValueHelper.java
- jackrabbit-parent/pom.xml


Changes:

=====================================
jackrabbit-jcr-commons/pom.xml
=====================================
--- a/jackrabbit-jcr-commons/pom.xml
+++ b/jackrabbit-jcr-commons/pom.xml
@@ -73,10 +73,6 @@
       <optional>true</optional>
     </dependency>
     <dependency>
-      <groupId>com.google.guava</groupId>
-      <artifactId>guava</artifactId>
-    </dependency>
-    <dependency>
       <groupId>org.osgi</groupId>
       <artifactId>org.osgi.annotation</artifactId>
       <scope>provided</scope>


=====================================
jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/value/ValueHelper.java
=====================================
--- 
a/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/value/ValueHelper.java
+++ 
b/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/value/ValueHelper.java
@@ -29,7 +29,6 @@ import static javax.jcr.PropertyType.STRING;
 import static javax.jcr.PropertyType.UNDEFINED;
 import static javax.jcr.PropertyType.WEAKREFERENCE;
 
-import com.google.common.collect.ImmutableSet;
 import org.apache.jackrabbit.util.Base64;
 import org.apache.jackrabbit.util.Text;
 import org.apache.jackrabbit.util.TransientFileFactory;
@@ -53,7 +52,9 @@ import java.io.OutputStream;
 import java.io.BufferedOutputStream;
 import java.net.URI;
 import java.nio.charset.StandardCharsets;
+import java.util.Collections;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.Map;
 import java.util.Set;
 
@@ -71,18 +72,26 @@ public class ValueHelper {
 
     private static final Map<Integer, Set<Integer>> SUPPORTED_CONVERSIONS = 
new HashMap<Integer, Set<Integer>>();
     static {
-        SUPPORTED_CONVERSIONS.put(DATE, ImmutableSet.of(STRING, BINARY, 
DOUBLE, DECIMAL, LONG));
-        SUPPORTED_CONVERSIONS.put(DOUBLE, ImmutableSet.of(STRING, BINARY, 
DECIMAL, DATE, LONG));
-        SUPPORTED_CONVERSIONS.put(DECIMAL, ImmutableSet.of(STRING, BINARY, 
DOUBLE, DATE, LONG));
-        SUPPORTED_CONVERSIONS.put(LONG, ImmutableSet.of(STRING, BINARY, 
DECIMAL, DATE, DOUBLE));
-        SUPPORTED_CONVERSIONS.put(BOOLEAN, ImmutableSet.of(STRING, BINARY));
-        SUPPORTED_CONVERSIONS.put(NAME, ImmutableSet.of(STRING, BINARY, PATH, 
PropertyType.URI));
-        SUPPORTED_CONVERSIONS.put(PATH, ImmutableSet.of(STRING, BINARY, NAME, 
PropertyType.URI));
-        SUPPORTED_CONVERSIONS.put(PropertyType.URI, ImmutableSet.of(STRING, 
BINARY, NAME, PATH));
-        SUPPORTED_CONVERSIONS.put(REFERENCE, ImmutableSet.of(STRING, BINARY, 
WEAKREFERENCE));
-        SUPPORTED_CONVERSIONS.put(WEAKREFERENCE, ImmutableSet.of(STRING, 
BINARY, REFERENCE));
+        SUPPORTED_CONVERSIONS.put(DATE, immutableSetOf(STRING, BINARY, DOUBLE, 
DECIMAL, LONG));
+        SUPPORTED_CONVERSIONS.put(DOUBLE, immutableSetOf(STRING, BINARY, 
DECIMAL, DATE, LONG));
+        SUPPORTED_CONVERSIONS.put(DECIMAL, immutableSetOf(STRING, BINARY, 
DOUBLE, DATE, LONG));
+        SUPPORTED_CONVERSIONS.put(LONG, immutableSetOf(STRING, BINARY, 
DECIMAL, DATE, DOUBLE));
+        SUPPORTED_CONVERSIONS.put(BOOLEAN, immutableSetOf(STRING, BINARY));
+        SUPPORTED_CONVERSIONS.put(NAME, immutableSetOf(STRING, BINARY, PATH, 
PropertyType.URI));
+        SUPPORTED_CONVERSIONS.put(PATH, immutableSetOf(STRING, BINARY, NAME, 
PropertyType.URI));
+        SUPPORTED_CONVERSIONS.put(PropertyType.URI, immutableSetOf(STRING, 
BINARY, NAME, PATH));
+        SUPPORTED_CONVERSIONS.put(REFERENCE, immutableSetOf(STRING, BINARY, 
WEAKREFERENCE));
+        SUPPORTED_CONVERSIONS.put(WEAKREFERENCE, immutableSetOf(STRING, 
BINARY, REFERENCE));
     }
 
+    private static Set<Integer> immutableSetOf(int... types) {
+        Set<Integer> t = new HashSet<Integer>();
+        for (int type : types) {
+            t.add(type);
+        }
+        return Collections.unmodifiableSet(t);
+    }
+    
     public static boolean isSupportedConversion(int fromType, int toType) {
         if (fromType == toType) {
             return true;


=====================================
jackrabbit-parent/pom.xml
=====================================
--- a/jackrabbit-parent/pom.xml
+++ b/jackrabbit-parent/pom.xml
@@ -586,11 +586,6 @@
         <version>3.4</version>
       </dependency>
       <dependency>
-        <groupId>com.google.guava</groupId>
-        <artifactId>guava</artifactId>
-        <version>15.0</version>
-      </dependency>
-      <dependency>
         <groupId>junit</groupId>
         <artifactId>junit</artifactId>
         <version>4.12</version>



View it on GitLab: 
https://code.onehippo.org/cms-community/hippo-jackrabbit/commit/930ee607ccf8d6c94b9a9cc840c53ff3ed659baf

---
View it on GitLab: 
https://code.onehippo.org/cms-community/hippo-jackrabbit/commit/930ee607ccf8d6c94b9a9cc840c53ff3ed659baf
You're receiving this email because of your account on code.onehippo.org.
_______________________________________________
Hippocms-svn mailing list
Hippocms-svn@lists.onehippo.org
https://lists.onehippo.org/mailman/listinfo/hippocms-svn

Reply via email to