diff --git a/src/main/java/edu/jhuapl/tinkerpop/AccumuloEdge.java b/src/main/java/edu/jhuapl/tinkerpop/AccumuloEdge.java index 3d62e7a..3fe7893 100644 --- a/src/main/java/edu/jhuapl/tinkerpop/AccumuloEdge.java +++ b/src/main/java/edu/jhuapl/tinkerpop/AccumuloEdge.java @@ -50,6 +50,7 @@ public class AccumuloEdge extends AccumuloElement implements Edge { this.outId = outVertex; } + @Override public Vertex getVertex(Direction direction) throws IllegalArgumentException { switch (direction) { case IN: @@ -79,6 +80,7 @@ public class AccumuloEdge extends AccumuloElement implements Edge { } } + @Override public String getLabel() { // TODO less special treatment for "LABEL" property... if (label != null) { @@ -87,6 +89,7 @@ public class AccumuloEdge extends AccumuloElement implements Edge { return getProperty(StringFactory.LABEL); } + @Override public void remove() { parent.removeEdge(this); } @@ -111,6 +114,7 @@ public class AccumuloEdge extends AccumuloElement implements Edge { this.label = label; } + @Override public String toString() { return "[" + getId() + ":" + getVertex(Direction.OUT) + " -> " + getLabel() + " -> " + getVertex(Direction.IN) + "]"; } diff --git a/src/main/java/edu/jhuapl/tinkerpop/AccumuloElement.java b/src/main/java/edu/jhuapl/tinkerpop/AccumuloElement.java index 6239f4e..4cc9c7a 100644 --- a/src/main/java/edu/jhuapl/tinkerpop/AccumuloElement.java +++ b/src/main/java/edu/jhuapl/tinkerpop/AccumuloElement.java @@ -37,6 +37,7 @@ public abstract class AccumuloElement implements Element { this.type = type; } + @Override public T getProperty(String key) { if (propertiesCache == null) { // lazily create the properties cache... @@ -71,11 +72,13 @@ public abstract class AccumuloElement implements Element { return parent.getPropertyKeys(type, id); } + @Override public void setProperty(String key, Object value) { Integer timeout = parent.setProperty(type, id, key, value); cacheProperty(key, value, timeout); } + @Override public T removeProperty(String key) { if (propertiesCache != null) { // we have the cached value but we still need to pass this on to the @@ -88,10 +91,12 @@ public abstract class AccumuloElement implements Element { return parent.removeProperty(type, id, key); } + @Override public Object getId() { return id; } + @Override public boolean equals(Object obj) { if (obj == null) { return false; diff --git a/src/main/java/edu/jhuapl/tinkerpop/AccumuloGraph.java b/src/main/java/edu/jhuapl/tinkerpop/AccumuloGraph.java index 6a28e1a..c456d94 100644 --- a/src/main/java/edu/jhuapl/tinkerpop/AccumuloGraph.java +++ b/src/main/java/edu/jhuapl/tinkerpop/AccumuloGraph.java @@ -81,7 +81,7 @@ import com.tinkerpop.blueprints.util.StringFactory; * VertexIDLABELEXISTS[empty] * VertexIDINEDGEInVertexID_EdgeIDEdgeLabel * VertexIDOUTEDGEOutVertexID_EdgeIDEdgeLabel - * VertexIDPropertyKey[empty]PropertyValue + * VertexIDPropertyKey[empty]Encoded Value * * * @@ -106,7 +106,7 @@ import com.tinkerpop.blueprints.util.StringFactory; * ROWIDCOLFAMCOLQUALVALUE * * - * Encoded PropertyValuePropertyKeyElementID[empty] + * Encoded ValuePropertyKeyElementID[empty] * * * diff --git a/src/main/java/edu/jhuapl/tinkerpop/AccumuloGraphUtils.java b/src/main/java/edu/jhuapl/tinkerpop/AccumuloGraphUtils.java index 395e359..4008da0 100644 --- a/src/main/java/edu/jhuapl/tinkerpop/AccumuloGraphUtils.java +++ b/src/main/java/edu/jhuapl/tinkerpop/AccumuloGraphUtils.java @@ -14,37 +14,13 @@ */ package edu.jhuapl.tinkerpop; -import java.io.IOException; import java.util.SortedSet; -import org.apache.accumulo.core.client.AccumuloException; -import org.apache.accumulo.core.client.AccumuloSecurityException; -import org.apache.accumulo.core.client.TableExistsException; -import org.apache.accumulo.core.client.TableNotFoundException; import org.apache.accumulo.core.client.admin.TableOperations; -import org.apache.accumulo.core.data.Value; import org.apache.hadoop.io.Text; -import com.tinkerpop.blueprints.util.StringFactory; - final class AccumuloGraphUtils { - public static final Value EMPTY_VALUE = new Value(new byte[0]); - public static final Text EMPTY_TEXT = new Text(""); - - public static final Text ID = new Text(StringFactory.ID); - - public static final Text IN = new Text("I"); - public static final Text OUT = new Text("O"); - - public static final String toId(Object obj) { - return obj.toString(); - } - - public static Value toValue(String val) { - return new Value(val.getBytes()); - } - /** * Create and/or clear existing graph tables for the given configuration. * @@ -96,17 +72,7 @@ final class AccumuloGraphUtils { } } - } catch (AccumuloException e) { - throw new IllegalArgumentException(e); - } catch (AccumuloSecurityException e) { - throw new IllegalArgumentException(e); - } catch (IOException e) { - throw new IllegalArgumentException(e); - } catch (InterruptedException e) { - throw new IllegalArgumentException(e); - } catch (TableNotFoundException e) { - throw new IllegalArgumentException(e); - } catch (TableExistsException e) { + } catch (Exception e) { throw new IllegalArgumentException(e); } } diff --git a/src/main/java/edu/jhuapl/tinkerpop/AccumuloVertex.java b/src/main/java/edu/jhuapl/tinkerpop/AccumuloVertex.java index 0616323..2b4cbb0 100644 --- a/src/main/java/edu/jhuapl/tinkerpop/AccumuloVertex.java +++ b/src/main/java/edu/jhuapl/tinkerpop/AccumuloVertex.java @@ -26,26 +26,32 @@ public class AccumuloVertex extends AccumuloElement implements Vertex { super(parent, id, Vertex.class); } + @Override public Iterable getEdges(Direction direction, String... labels) { return parent.getEdges(id, direction, labels); } + @Override public Iterable getVertices(Direction direction, String... labels) { return parent.getVertices(id, direction, labels); } + @Override public VertexQuery query() { return new DefaultVertexQuery(this); } + @Override public Edge addEdge(String label, Vertex inVertex) { return parent.addEdge(null, this, inVertex, label); } + @Override public void remove() { parent.removeVertex(this); } + @Override public String toString() { return "[" + getId() + "]"; }