You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commonsrdf.apache.org by st...@apache.org on 2015/05/08 13:04:52 UTC

[1/4] incubator-commonsrdf git commit: COMMONSRDF-20: Provide a mechanism for allowing the load of different RDF Term Factories

Repository: incubator-commonsrdf
Updated Branches:
  refs/heads/master 90b85287a -> d44aee6f7


COMMONSRDF-20: Provide a mechanism for allowing the load of different RDF Term Factories


Project: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/commit/8ba3b70c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/tree/8ba3b70c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/diff/8ba3b70c

Branch: refs/heads/master
Commit: 8ba3b70cb3166998872aec33131568ff011a1891
Parents: 7a0de10
Author: Benedikt Ritter <be...@gmail.com>
Authored: Fri May 1 23:31:53 2015 +0200
Committer: Benedikt Ritter <be...@gmail.com>
Committed: Fri May 1 23:31:53 2015 +0200

----------------------------------------------------------------------
 .../org.apache.commons.rdf.api.RDFTermFactory   |  1 +
 .../simple/SimpleRDFTermFactoryLookupTest.java  | 42 ++++++++++++++++++++
 src/site/markdown/userguide.md.vm               | 15 +++++++
 3 files changed, 58 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/8ba3b70c/simple/src/main/resources/META-INF/services/org.apache.commons.rdf.api.RDFTermFactory
----------------------------------------------------------------------
diff --git a/simple/src/main/resources/META-INF/services/org.apache.commons.rdf.api.RDFTermFactory b/simple/src/main/resources/META-INF/services/org.apache.commons.rdf.api.RDFTermFactory
new file mode 100644
index 0000000..cc53468
--- /dev/null
+++ b/simple/src/main/resources/META-INF/services/org.apache.commons.rdf.api.RDFTermFactory
@@ -0,0 +1 @@
+org.apache.commons.rdf.simple.SimpleRDFTermFactory
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/8ba3b70c/simple/src/test/java/org/apache/commons/rdf/simple/SimpleRDFTermFactoryLookupTest.java
----------------------------------------------------------------------
diff --git a/simple/src/test/java/org/apache/commons/rdf/simple/SimpleRDFTermFactoryLookupTest.java b/simple/src/test/java/org/apache/commons/rdf/simple/SimpleRDFTermFactoryLookupTest.java
new file mode 100644
index 0000000..2fdeba7
--- /dev/null
+++ b/simple/src/test/java/org/apache/commons/rdf/simple/SimpleRDFTermFactoryLookupTest.java
@@ -0,0 +1,42 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.commons.rdf.simple;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.util.Iterator;
+import java.util.ServiceLoader;
+
+import org.apache.commons.rdf.api.RDFTermFactory;
+import org.junit.Test;
+
+public class SimpleRDFTermFactoryLookupTest {
+
+    @Test
+    public void testServiceLoaderLookup() {
+        ServiceLoader<RDFTermFactory> loader = ServiceLoader.load(RDFTermFactory.class);
+
+        Iterator<RDFTermFactory> iterator = loader.iterator();
+        RDFTermFactory factory = iterator.next();
+
+        assertTrue(factory instanceof SimpleRDFTermFactory);
+        assertFalse(iterator.hasNext());
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/8ba3b70c/src/site/markdown/userguide.md.vm
----------------------------------------------------------------------
diff --git a/src/site/markdown/userguide.md.vm b/src/site/markdown/userguide.md.vm
index cca6998..fc63b6f 100644
--- a/src/site/markdown/userguide.md.vm
+++ b/src/site/markdown/userguide.md.vm
@@ -148,6 +148,21 @@ import org.apache.commons.rdf.simple.SimpleRDFTermFactory;
 RDFTermFactory factory = new SimpleRDFTermFactory();
 ```
 
+If you don't want to depend up the concret implementation you can use a
+[ServiceLoader](http://docs.oracle.com/javase/8/docs/api/java/util/ServiceLoader.html)
+to lookup instances:
+
+```java
+import java.util.Iterator;
+import java.util.ServiceLoader;
+
+import org.apache.commons.rdf.api.*;
+// ...
+ServiceLoader<RDFTermFactory> loader = ServiceLoader.load(RDFTermFactory.class);
+Iterator<RDFTermFactory> iterator = loader.iterator();
+RDFTermFactory factory = iterator.next();
+```
+
 Using the factory you can construct
 any [RDFTerm](apidocs/org/apache/commons/rdf/api/RDFTerm.html), e.g. to create a
 [BlankNode](apidocs/org/apache/commons/rdf/api/BlankNode.html),


[2/4] incubator-commonsrdf git commit: Incorporate feedback by Stian Soiland-Reyes

Posted by st...@apache.org.
Incorporate feedback by Stian Soiland-Reyes


Project: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/commit/f223b21b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/tree/f223b21b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/diff/f223b21b

Branch: refs/heads/master
Commit: f223b21bff10a32f3735923819bad5237a5efd56
Parents: 8ba3b70
Author: Benedikt Ritter <be...@gmail.com>
Authored: Tue May 5 17:33:36 2015 +0200
Committer: Benedikt Ritter <be...@gmail.com>
Committed: Tue May 5 17:33:36 2015 +0200

----------------------------------------------------------------------
 src/site/markdown/userguide.md.vm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/f223b21b/src/site/markdown/userguide.md.vm
----------------------------------------------------------------------
diff --git a/src/site/markdown/userguide.md.vm b/src/site/markdown/userguide.md.vm
index fc63b6f..b6a8a58 100644
--- a/src/site/markdown/userguide.md.vm
+++ b/src/site/markdown/userguide.md.vm
@@ -148,9 +148,9 @@ import org.apache.commons.rdf.simple.SimpleRDFTermFactory;
 RDFTermFactory factory = new SimpleRDFTermFactory();
 ```
 
-If you don't want to depend up the concret implementation you can use a
+If you don't want to depend up the concrete implementation you can use a
 [ServiceLoader](http://docs.oracle.com/javase/8/docs/api/java/util/ServiceLoader.html)
-to lookup instances:
+to lookup any implementations found on the classpath:
 
 ```java
 import java.util.Iterator;


[4/4] incubator-commonsrdf git commit: COMMONSRDF-20 clarify ServiceLoader text

Posted by st...@apache.org.
COMMONSRDF-20 clarify ServiceLoader text


Project: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/commit/d44aee6f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/tree/d44aee6f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/diff/d44aee6f

Branch: refs/heads/master
Commit: d44aee6f7593676dfb39da41ef8f4ab5a350e94a
Parents: ee8af7a
Author: Stian Soiland-Reyes <st...@apache.org>
Authored: Fri May 8 12:04:41 2015 +0100
Committer: Stian Soiland-Reyes <st...@apache.org>
Committed: Fri May 8 12:04:41 2015 +0100

----------------------------------------------------------------------
 src/site/markdown/userguide.md.vm | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/d44aee6f/src/site/markdown/userguide.md.vm
----------------------------------------------------------------------
diff --git a/src/site/markdown/userguide.md.vm b/src/site/markdown/userguide.md.vm
index b6a8a58..a734e50 100644
--- a/src/site/markdown/userguide.md.vm
+++ b/src/site/markdown/userguide.md.vm
@@ -148,9 +148,10 @@ import org.apache.commons.rdf.simple.SimpleRDFTermFactory;
 RDFTermFactory factory = new SimpleRDFTermFactory();
 ```
 
-If you don't want to depend up the concrete implementation you can use a
+If you don't want to depend on instnatiating a concrete implementation,
+you can alternatively use the 
 [ServiceLoader](http://docs.oracle.com/javase/8/docs/api/java/util/ServiceLoader.html)
-to lookup any implementations found on the classpath:
+to lookup any `RDFTermFactory` implementations found on the classpath:
 
 ```java
 import java.util.Iterator;


[3/4] incubator-commonsrdf git commit: Merge remote-tracking branch 'britter/COMMONSRDF-20'

Posted by st...@apache.org.
Merge remote-tracking branch 'britter/COMMONSRDF-20'

Add a ServiceLoader for SimpleRDFTermFactory

Good as a first go at COMMONSRDF-20 for basic discovery
requirement, while futher details about priorities,
selection and configuration of the factory still
needs to be sorted.

This closes #12.


Project: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/commit/ee8af7a6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/tree/ee8af7a6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/diff/ee8af7a6

Branch: refs/heads/master
Commit: ee8af7a6a6f813f59529eb1a172524d881778119
Parents: 90b8528 f223b21
Author: Stian Soiland-Reyes <st...@apache.org>
Authored: Fri May 8 12:02:24 2015 +0100
Committer: Stian Soiland-Reyes <st...@apache.org>
Committed: Fri May 8 12:02:24 2015 +0100

----------------------------------------------------------------------
 .../org.apache.commons.rdf.api.RDFTermFactory   |  1 +
 .../simple/SimpleRDFTermFactoryLookupTest.java  | 42 ++++++++++++++++++++
 src/site/markdown/userguide.md.vm               | 15 +++++++
 3 files changed, 58 insertions(+)
----------------------------------------------------------------------