Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: jordanlewis/blueprints
base: 6bef74753a
...
head fork: jordanlewis/blueprints
compare: dbfb39ace2
Checking mergeability… Don't worry, you can still create the pull request.
  • 5 commits
  • 19 files changed
  • 0 commit comments
  • 3 contributors
Showing with 111 additions and 60 deletions.
  1. +3 −0  CHANGELOG.textile
  2. +1 −1  blueprints-core/src/main/java/com/tinkerpop/blueprints/pgm/util/wrappers/partition/PartitionGraph.java
  3. +1 −1  blueprints-core/src/main/java/com/tinkerpop/blueprints/pgm/util/wrappers/readonly/ReadOnlyGraph.java
  4. +1 −1  blueprints-core/src/main/java/com/tinkerpop/blueprints/pgm/util/wrappers/readonly/ReadOnlyIndexableGraph.java
  5. +1 −1  blueprints-core/src/main/java/com/tinkerpop/blueprints/pgm/util/wrappers/wrapped/WrappedGraph.java
  6. +1 −1  blueprints-dex-graph/src/main/java/com/tinkerpop/blueprints/pgm/impls/dex/DexGraph.java
  7. +1 −1  blueprints-graph-sail/pom.xml
  8. +3 −14 blueprints-neo4j-graph/pom.xml
  9. +1 −12 blueprints-neo4jbatch-graph/pom.xml
  10. +1 −1  blueprints-neo4jbatch-graph/src/main/java/com/tinkerpop/blueprints/pgm/impls/neo4jbatch/Neo4jBatchGraph.java
  11. +1 −1  blueprints-orient-graph/src/main/java/com/tinkerpop/blueprints/pgm/impls/orientdb/OrientGraph.java
  12. +8 −12 blueprints-rexster-graph/pom.xml
  13. +27 −2 blueprints-rexster-graph/src/main/java/com/tinkerpop/blueprints/pgm/impls/rexster/RexsterGraph.java
  14. +1 −0  blueprints-rexster-graph/src/main/java/com/tinkerpop/blueprints/pgm/impls/rexster/RexsterTokens.java
  15. +16 −1 blueprints-rexster-graph/src/main/java/com/tinkerpop/blueprints/pgm/impls/rexster/util/RestHelper.java
  16. +30 −0 ...ints-rexster-graph/src/main/java/com/tinkerpop/blueprints/pgm/impls/rexster/util/RexsterAuthentication.java
  17. +12 −9 blueprints-rexster-graph/src/test/java/com/tinkerpop/blueprints/pgm/impls/rexster/RexsterGraphTest.java
  18. +1 −1  blueprints-sail-graph/src/main/java/com/tinkerpop/blueprints/pgm/impls/sail/SailGraph.java
  19. +1 −1  pom.xml
View
3  CHANGELOG.textile
@@ -15,6 +15,9 @@ h3. Version 1.2 (NOT OFFICIALLY RELEASED YET)
* Added a var args based @ElementHelper.setProperties()@ method
* GML Reader/Writer utility
+* Bumped to support Neo4j 1.7.M01
+* Neo4jGraph makes use of the kernel properties for more efficient index handling
+* RexsterGraph supports Rexster Authentication.
==<hr/>==
View
2  blueprints-core/src/main/java/com/tinkerpop/blueprints/pgm/util/wrappers/partition/PartitionGraph.java
@@ -4,8 +4,8 @@
import com.tinkerpop.blueprints.pgm.Element;
import com.tinkerpop.blueprints.pgm.Graph;
import com.tinkerpop.blueprints.pgm.Vertex;
-import com.tinkerpop.blueprints.pgm.impls.StringFactory;
import com.tinkerpop.blueprints.pgm.WrappableGraph;
+import com.tinkerpop.blueprints.pgm.impls.StringFactory;
import com.tinkerpop.blueprints.pgm.util.wrappers.partition.util.PartitionEdgeSequence;
import com.tinkerpop.blueprints.pgm.util.wrappers.partition.util.PartitionVertexSequence;
View
2  blueprints-core/src/main/java/com/tinkerpop/blueprints/pgm/util/wrappers/readonly/ReadOnlyGraph.java
@@ -3,8 +3,8 @@
import com.tinkerpop.blueprints.pgm.Edge;
import com.tinkerpop.blueprints.pgm.Graph;
import com.tinkerpop.blueprints.pgm.Vertex;
-import com.tinkerpop.blueprints.pgm.impls.StringFactory;
import com.tinkerpop.blueprints.pgm.WrappableGraph;
+import com.tinkerpop.blueprints.pgm.impls.StringFactory;
import com.tinkerpop.blueprints.pgm.util.wrappers.readonly.util.ReadOnlyEdgeSequence;
import com.tinkerpop.blueprints.pgm.util.wrappers.readonly.util.ReadOnlyVertexSequence;
View
2  ...rints-core/src/main/java/com/tinkerpop/blueprints/pgm/util/wrappers/readonly/ReadOnlyIndexableGraph.java
@@ -4,8 +4,8 @@
import com.tinkerpop.blueprints.pgm.Element;
import com.tinkerpop.blueprints.pgm.Index;
import com.tinkerpop.blueprints.pgm.IndexableGraph;
-import com.tinkerpop.blueprints.pgm.impls.Parameter;
import com.tinkerpop.blueprints.pgm.WrappableGraph;
+import com.tinkerpop.blueprints.pgm.impls.Parameter;
import com.tinkerpop.blueprints.pgm.util.wrappers.readonly.util.ReadOnlyIndexSequence;
import java.util.Set;
View
2  blueprints-core/src/main/java/com/tinkerpop/blueprints/pgm/util/wrappers/wrapped/WrappedGraph.java
@@ -3,8 +3,8 @@
import com.tinkerpop.blueprints.pgm.Edge;
import com.tinkerpop.blueprints.pgm.Graph;
import com.tinkerpop.blueprints.pgm.Vertex;
-import com.tinkerpop.blueprints.pgm.impls.StringFactory;
import com.tinkerpop.blueprints.pgm.WrappableGraph;
+import com.tinkerpop.blueprints.pgm.impls.StringFactory;
import com.tinkerpop.blueprints.pgm.util.wrappers.wrapped.util.WrappedEdgeSequence;
import com.tinkerpop.blueprints.pgm.util.wrappers.wrapped.util.WrappedVertexSequence;
View
2  blueprints-dex-graph/src/main/java/com/tinkerpop/blueprints/pgm/impls/dex/DexGraph.java
@@ -7,11 +7,11 @@
import com.tinkerpop.blueprints.pgm.Index;
import com.tinkerpop.blueprints.pgm.IndexableGraph;
import com.tinkerpop.blueprints.pgm.Vertex;
+import com.tinkerpop.blueprints.pgm.WrappableGraph;
import com.tinkerpop.blueprints.pgm.impls.Parameter;
import com.tinkerpop.blueprints.pgm.impls.StringFactory;
import com.tinkerpop.blueprints.pgm.impls.dex.util.DexAttributes;
import com.tinkerpop.blueprints.pgm.impls.dex.util.DexTypes;
-import com.tinkerpop.blueprints.pgm.WrappableGraph;
import java.io.File;
import java.util.ArrayList;
View
2  blueprints-graph-sail/pom.xml
@@ -22,7 +22,7 @@
<dependency>
<groupId>net.fortytwo.sesametools</groupId>
<artifactId>common</artifactId>
- <version>1.4</version>
+ <version>${sesametools.version}</version>
</dependency>
<dependency>
<groupId>org.openrdf.sesame</groupId>
View
17 blueprints-neo4j-graph/pom.xml
@@ -22,19 +22,19 @@
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j</artifactId>
- <version>1.6.1</version>
+ <version>1.7.M01</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-ha</artifactId>
- <version>1.6.1</version>
+ <version>1.7.M01</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-management</artifactId>
- <version>1.6.1</version>
+ <version>1.7.M01</version>
<scope>compile</scope>
</dependency>
<dependency>
@@ -44,17 +44,6 @@
<scope>test</scope>
</dependency>
</dependencies>
- <repositories>
- <repository>
- <id>neo4j-public-repository</id>
- <name>Publicly available Maven 2 repository for Neo4j</name>
- <url>http://m2.neo4j.org/</url>
- <snapshots>
- <enabled>true</enabled>
- <updatePolicy>always</updatePolicy>
- </snapshots>
- </repository>
- </repositories>
<build>
<directory>${basedir}/target</directory>
<finalName>${project.artifactId}-${project.version}</finalName>
View
13 blueprints-neo4jbatch-graph/pom.xml
@@ -22,7 +22,7 @@
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j</artifactId>
- <version>1.6.1</version>
+ <version>1.7.M01</version>
<type>pom</type>
</dependency>
<!-- TESTING -->
@@ -39,17 +39,6 @@
<scope>test</scope>
</dependency>
</dependencies>
- <repositories>
- <repository>
- <id>neo4j-public-repository</id>
- <name>Publicly available Maven 2 repository for Neo4j</name>
- <url>http://m2.neo4j.org/</url>
- <snapshots>
- <enabled>true</enabled>
- <updatePolicy>always</updatePolicy>
- </snapshots>
- </repository>
- </repositories>
<build>
<directory>${basedir}/target</directory>
<finalName>${project.artifactId}-${project.version}</finalName>
View
2  ...prints-neo4jbatch-graph/src/main/java/com/tinkerpop/blueprints/pgm/impls/neo4jbatch/Neo4jBatchGraph.java
@@ -6,9 +6,9 @@
import com.tinkerpop.blueprints.pgm.Index;
import com.tinkerpop.blueprints.pgm.IndexableGraph;
import com.tinkerpop.blueprints.pgm.Vertex;
+import com.tinkerpop.blueprints.pgm.WrappableGraph;
import com.tinkerpop.blueprints.pgm.impls.Parameter;
import com.tinkerpop.blueprints.pgm.impls.StringFactory;
-import com.tinkerpop.blueprints.pgm.WrappableGraph;
import org.neo4j.graphdb.DynamicRelationshipType;
import org.neo4j.graphdb.index.BatchInserterIndexProvider;
import org.neo4j.index.impl.lucene.LuceneBatchInserterIndexProvider;
View
2  blueprints-orient-graph/src/main/java/com/tinkerpop/blueprints/pgm/impls/orientdb/OrientGraph.java
@@ -17,11 +17,11 @@
import com.tinkerpop.blueprints.pgm.IndexableGraph;
import com.tinkerpop.blueprints.pgm.TransactionalGraph;
import com.tinkerpop.blueprints.pgm.Vertex;
+import com.tinkerpop.blueprints.pgm.WrappableGraph;
import com.tinkerpop.blueprints.pgm.impls.Parameter;
import com.tinkerpop.blueprints.pgm.impls.StringFactory;
import com.tinkerpop.blueprints.pgm.impls.orientdb.util.OrientElementSequence;
import com.tinkerpop.blueprints.pgm.util.AutomaticIndexHelper;
-import com.tinkerpop.blueprints.pgm.WrappableGraph;
import java.util.ArrayList;
import java.util.HashSet;
View
20 blueprints-rexster-graph/pom.xml
@@ -25,6 +25,11 @@
<version>${blueprints.version}</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>commons-codec</groupId>
+ <artifactId>commons-codec</artifactId>
+ <version>1.4</version>
+ </dependency>
</dependencies>
<build>
<directory>${basedir}/target</directory>
@@ -53,19 +58,10 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
- <version>2.4.2</version>
+ <version>2.5</version>
+
<configuration>
- <systemProperties>
- <!-- REXSTERGRAPH TEST PROPERTIES -->
- <property>
- <name>testRexsterGraph</name>
- <value>false</value>
- </property>
- <property>
- <name>rexsterGraphURI</name>
- <value>http://127.0.0.1:8182/graphs/emptygraph</value>
- </property>
- </systemProperties>
+ <argLine>-DtestRexsterGraph=false -Dusername=rexster -Dpassword=rexster -DrexsterGraphURI=http://127.0.0.1:8182/graphs/emptygraph</argLine>
</configuration>
</plugin>
</plugins>
View
29 blueprints-rexster-graph/src/main/java/com/tinkerpop/blueprints/pgm/impls/rexster/RexsterGraph.java
@@ -10,6 +10,7 @@
import com.tinkerpop.blueprints.pgm.impls.Parameter;
import com.tinkerpop.blueprints.pgm.impls.StringFactory;
import com.tinkerpop.blueprints.pgm.impls.rexster.util.RestHelper;
+import com.tinkerpop.blueprints.pgm.impls.rexster.util.RexsterAuthentication;
import com.tinkerpop.blueprints.pgm.impls.rexster.util.RexsterEdgeSequence;
import com.tinkerpop.blueprints.pgm.impls.rexster.util.RexsterVertexSequence;
import org.codehaus.jettison.json.JSONArray;
@@ -20,22 +21,46 @@
import java.util.Set;
/**
- * A Blueprints implementation of the RESTful API of Rexster (http://rexster.tinkerpop.com)
+ * A Blueprints implementation of the RESTful API of Rexster (http://rexster.tinkerpop.com).
*
* @author Marko A. Rodriguez (http://markorodriguez.com)
*/
public class RexsterGraph implements IndexableGraph, WrappableGraph<JSONObject> {
+ public static final int DEFAULT_BUFFER_SIZE = 100;
private final String graphURI;
private int bufferSize;
+ /**
+ * Construct a RexsterGraph with no authentication and default buffer size.
+ */
public RexsterGraph(final String graphURI) {
- this(graphURI, 100);
+ this(graphURI, DEFAULT_BUFFER_SIZE);
+ }
+
+ /**
+ * Construct a RexsterGraph with authentication enabled (assuming username and password are
+ * both non-null values) and default buffer size.
+ */
+ public RexsterGraph(final String graphURI, final String username, final String password) {
+ this(graphURI, DEFAULT_BUFFER_SIZE, username, password);
}
+ /**
+ * Construct a RexsterGraph with no authentication.
+ */
public RexsterGraph(final String graphURI, final int bufferSize) {
+ this(graphURI, bufferSize, null, null);
+ }
+
+ /**
+ * Construct a RexsterGraph with authentication enabled (assuming username and password are
+ * both non-null values).
+ */
+ public RexsterGraph(final String graphURI, final int bufferSize, final String username, final String password) {
this.graphURI = graphURI;
this.bufferSize = bufferSize;
+ RestHelper.Authentication = new RexsterAuthentication(username, password);
}
public String getGraphURI() {
View
1  blueprints-rexster-graph/src/main/java/com/tinkerpop/blueprints/pgm/impls/rexster/RexsterTokens.java
@@ -64,6 +64,7 @@
public static final String LONG = "long";
public static final String ACCEPT = "Accept";
+ public static final String AUTHORIZATION = "Authorization";
public static final String APPLICATION_REXSTER_TYPED_JSON = "application/vnd.rexster-typed-v1+json";
}
View
17 blueprints-rexster-graph/src/main/java/com/tinkerpop/blueprints/pgm/impls/rexster/util/RestHelper.java
@@ -19,7 +19,7 @@
*/
public class RestHelper {
- private static final String POST = "POST";
+ public static RexsterAuthentication Authentication;
private static final String PUT = "PUT";
private static final String DELETE = "DELETE";
@@ -28,6 +28,9 @@ public static JSONObject get(final String uri) {
final URL url = new URL(safeUri(uri));
final URLConnection connection = url.openConnection();
connection.setRequestProperty(RexsterTokens.ACCEPT, RexsterTokens.APPLICATION_REXSTER_TYPED_JSON);
+ if (Authentication.isAuthenticationEnabled()) {
+ connection.setRequestProperty(RexsterTokens.AUTHORIZATION, Authentication.getAuthenticationHeaderValue());
+ }
connection.connect();
final JSONTokener tokener = new JSONTokener(convertStreamToString(connection.getInputStream()));
final JSONObject object = new JSONObject(tokener);
@@ -52,6 +55,9 @@ public static JSONObject postResultObject(final String uri) {
String data = postData(uri);
final HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestProperty(RexsterTokens.ACCEPT, RexsterTokens.APPLICATION_REXSTER_TYPED_JSON);
+ if (Authentication.isAuthenticationEnabled()) {
+ connection.setRequestProperty(RexsterTokens.AUTHORIZATION, Authentication.getAuthenticationHeaderValue());
+ }
connection.setDoOutput(true);
OutputStreamWriter writer = new OutputStreamWriter(connection.getOutputStream());
writer.write(data); // post data with Content-Length automatically set
@@ -74,6 +80,9 @@ public static void post(final String uri) {
String data = postData(uri);
final HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestProperty(RexsterTokens.ACCEPT, RexsterTokens.APPLICATION_REXSTER_TYPED_JSON);
+ if (Authentication.isAuthenticationEnabled()) {
+ connection.setRequestProperty(RexsterTokens.AUTHORIZATION, Authentication.getAuthenticationHeaderValue());
+ }
connection.setDoOutput(true);
OutputStreamWriter writer = new OutputStreamWriter(connection.getOutputStream());
writer.write(data); // post data with Content-Length automatically set
@@ -114,6 +123,9 @@ public static void delete(final String uri) {
final URL url = new URL(uri);
final HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestProperty(RexsterTokens.ACCEPT, RexsterTokens.APPLICATION_REXSTER_TYPED_JSON);
+ if (Authentication.isAuthenticationEnabled()) {
+ connection.setRequestProperty(RexsterTokens.AUTHORIZATION, Authentication.getAuthenticationHeaderValue());
+ }
connection.setRequestMethod(DELETE);
final InputStreamReader reader = new InputStreamReader(connection.getInputStream());
reader.close();
@@ -127,6 +139,9 @@ public static void put(final String uri) {
final URL url = new URL(uri);
final HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestProperty(RexsterTokens.ACCEPT, RexsterTokens.APPLICATION_REXSTER_TYPED_JSON);
+ if (Authentication.isAuthenticationEnabled()) {
+ connection.setRequestProperty(RexsterTokens.AUTHORIZATION, Authentication.getAuthenticationHeaderValue());
+ }
connection.setRequestMethod(PUT);
final InputStreamReader reader = new InputStreamReader(connection.getInputStream());
reader.close();
View
30 ...s-rexster-graph/src/main/java/com/tinkerpop/blueprints/pgm/impls/rexster/util/RexsterAuthentication.java
@@ -0,0 +1,30 @@
+package com.tinkerpop.blueprints.pgm.impls.rexster.util;
+
+import org.apache.commons.codec.binary.Base64;
+
+public class RexsterAuthentication {
+
+ private final String username;
+ private final String password;
+
+ public RexsterAuthentication(final String username, final String password) {
+ this.username = username;
+ this.password = password;
+ }
+
+ public boolean isAuthenticationEnabled() {
+ return this.username != null && this.password != null;
+ }
+
+ public String getUsername() {
+ return username;
+ }
+
+ public String getPassword() {
+ return password;
+ }
+
+ public String getAuthenticationHeaderValue(){
+ return "Basic " + Base64.encodeBase64URLSafeString((username + ":" + password).getBytes());
+ }
+}
View
21 blueprints-rexster-graph/src/test/java/com/tinkerpop/blueprints/pgm/impls/rexster/RexsterGraphTest.java
@@ -17,6 +17,9 @@
* @author Marko A. Rodriguez (http://markorodriguez.com)
*/
public class RexsterGraphTest extends GraphTest {
+
+ private String username = null;
+ private String password = null;
public RexsterGraphTest() {
// intended to be used with TinkerGraph as the endpoint graph
@@ -89,12 +92,16 @@ public void testGraphMLReaderTestSuite() throws Exception {
public Graph getGraphInstance() {
- return new RexsterGraph(this.getWorkingUri());
+ return new RexsterGraph(this.getWorkingUri(), this.username, this.password);
}
public void doTestSuite(final TestSuite testSuite) throws Exception {
- String doTest = System.getProperty("testRexsterGraph");
- if (doTest == null || doTest.equals("true")) {
+ String doTest = System.getProperty("testRexsterGraph", "http://127.0.0.1:8182/graphs/emptygraph");
+ if (doTest.equals("true")) {
+
+ this.username = System.getProperty("username");
+ this.password = System.getProperty("password");
+
this.resetGraph();
for (Method method : testSuite.getClass().getDeclaredMethods()) {
if (method.getName().startsWith("test")) {
@@ -107,15 +114,11 @@ public void doTestSuite(final TestSuite testSuite) throws Exception {
}
private void resetGraph() {
- IndexableGraph graph = new RexsterGraph(this.getWorkingUri());
+ IndexableGraph graph = new RexsterGraph(this.getWorkingUri(), this.username, this.password);
graph.clear();
}
private String getWorkingUri() {
- String uri = System.getProperty("rexsterGraphURI");
- if (uri == null) {
- uri = "http://127.0.0.1:8182/graphs/emptygraph";
- }
- return uri;
+ return System.getProperty("rexsterGraphURI", "http://127.0.0.1:8182/graphs/emptygraph");
}
}
View
2  blueprints-sail-graph/src/main/java/com/tinkerpop/blueprints/pgm/impls/sail/SailGraph.java
@@ -4,9 +4,9 @@
import com.tinkerpop.blueprints.pgm.Edge;
import com.tinkerpop.blueprints.pgm.TransactionalGraph;
import com.tinkerpop.blueprints.pgm.Vertex;
+import com.tinkerpop.blueprints.pgm.WrappableGraph;
import com.tinkerpop.blueprints.pgm.impls.StringFactory;
import com.tinkerpop.blueprints.pgm.impls.sail.util.SailEdgeSequence;
-import com.tinkerpop.blueprints.pgm.WrappableGraph;
import info.aduna.iteration.CloseableIteration;
import net.fortytwo.sesametools.nquads.NQuadsFormat;
import org.apache.log4j.PropertyConfigurator;
View
2  pom.xml
@@ -72,7 +72,7 @@
<properties>
<blueprints.version>1.3-SNAPSHOT</blueprints.version>
- <sesame.version>2.6.0</sesame.version>
+ <sesame.version>2.6.4</sesame.version>
<sesametools.version>1.6</sesametools.version>
<junit.version>4.5</junit.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

No commit comments for this range

Something went wrong with that request. Please try again.