jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1504040 - /jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/Descriptors.java
Date Wed, 17 Jul 2013 08:14:59 GMT
Author: jukka
Date: Wed Jul 17 08:14:59 2013
New Revision: 1504040

URL: http://svn.apache.org/r1504040
Log:
OAK-906: Add the REP_VERSION_DESC descriptor

Modified:
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/Descriptors.java

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/Descriptors.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/Descriptors.java?rev=1504040&r1=1504039&r2=1504040&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/Descriptors.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/Descriptors.java
Wed Jul 17 08:14:59 2013
@@ -19,8 +19,11 @@
 
 package org.apache.jackrabbit.oak.jcr;
 
+import java.io.IOException;
+import java.io.InputStream;
 import java.util.HashMap;
 import java.util.Map;
+import java.util.Properties;
 
 import javax.jcr.PropertyType;
 import javax.jcr.Repository;
@@ -74,6 +77,7 @@ import static javax.jcr.Repository.QUERY
 import static javax.jcr.Repository.REP_NAME_DESC;
 import static javax.jcr.Repository.REP_VENDOR_DESC;
 import static javax.jcr.Repository.REP_VENDOR_URL_DESC;
+import static javax.jcr.Repository.REP_VERSION_DESC;
 import static javax.jcr.Repository.SPEC_NAME_DESC;
 import static javax.jcr.Repository.SPEC_VERSION_DESC;
 import static javax.jcr.Repository.WRITE_SUPPORTED;
@@ -231,10 +235,13 @@ public class Descriptors {
                 falseValue, true, true));
         put(new Descriptor(
                 REP_NAME_DESC,
-                valueFactory.createValue("Apache Jackrabbit Oak JCR implementation"), true,
true));
+                valueFactory.createValue("Apache Jackrabbit Oak"), true, true));
+        put(new Descriptor(
+                REP_VERSION_DESC,
+                valueFactory.createValue(getVersion()), true, true));
         put(new Descriptor(
                 REP_VENDOR_DESC,
-                valueFactory.createValue("Apache Software Foundation"), true, true));
+                valueFactory.createValue("The Apache Software Foundation"), true, true));
         put(new Descriptor(
                 REP_VENDOR_URL_DESC,
                 valueFactory.createValue("http://www.apache.org/"), true, true));
@@ -249,6 +256,25 @@ public class Descriptors {
                 trueValue, true, true));
     }
 
+    private String getVersion() {
+        InputStream stream = Descriptors.class.getResourceAsStream(
+                "/META-INF/maven/org.apache.jackrabbit/oak-jcr/pom.properties");
+        if (stream != null) {
+            try {
+                try {
+                    Properties properties = new Properties();
+                    properties.load(stream);
+                    return properties.getProperty("version");
+                } finally {
+                    stream.close();
+                }
+            } catch (IOException e) {
+                // ignore
+            }
+        }
+        return "SNAPSHOT";
+    }
+
     public Descriptors(ValueFactory valueFactory, Iterable<Descriptor> descriptors)
{
         this(valueFactory);
 



Mime
View raw message