Permalink
Browse files

Added parameters argument to createKeyIndex.

Allow individual graph implementations to take advantage of additional parameters for configuring indices.
  • Loading branch information...
1 parent 1ccc06b commit e15c3a9310b8b46af5dc305831d231fc4b17b88c @spmallette spmallette committed Jan 7, 2013
View
@@ -21,9 +21,10 @@ h3. Version 2.3.0 (NOT OFFICIALLY RELEASED YET)
* Deprecated @stopTransaction()@ in favor of @commit()@ and @rollback()@
* Deprecated @startTransaction()@ in favor of @newTransaction()@
* Loosened restrictions on edge-indexing in @GraphSail@ (though for some types of queries, exception thrown)
-* @RestHelper@ in @RexsterGraph@ packages is no longer publically available.
-* Add @execute@ methods to @RexsterGraph@ to allow execution of raw Gremlin scripts to the Gremlin Extension in Rexster.
+* @RestHelper@ in @RexsterGraph@ packages is no longer publicly available
+* Add @execute@ methods to @RexsterGraph@ to allow execution of raw Gremlin scripts to the Gremlin Extension in Rexster
* Include the original property value in property changed/removed events generated from @EventGraph@
+* Add the option for graph-specific index parameters on @createKeyIndex@ method on @KeyIndexableGraph@
==<hr/>==
@@ -23,11 +23,12 @@
/**
* Create an automatic indexing structure for indexing provided key for element class.
*
- * @param key the key to create the index for
- * @param elementClass the element class that the index is for
- * @param <T> the element class specification
+ * @param key the key to create the index for
+ * @param elementClass the element class that the index is for
+ * @param indexParameters a collection of parameters for the underlying index implementation
+ * @param <T> the element class specification
*/
- public <T extends Element> void createKeyIndex(String key, Class<T> elementClass);
+ public <T extends Element> void createKeyIndex(String key, Class<T> elementClass, final Parameter... indexParameters);
/**
* Return all the index keys associated with a particular element class.
@@ -133,7 +133,7 @@ public TinkerGraph() {
}
}
- public <T extends Element> void createKeyIndex(final String key, final Class<T> elementClass) {
+ public <T extends Element> void createKeyIndex(final String key, final Class<T> elementClass, final Parameter... indexParameters) {
if (Vertex.class.isAssignableFrom(elementClass)) {
this.vertexKeyIndex.createKeyIndex(key);
} else if (Edge.class.isAssignableFrom(elementClass)) {
@@ -268,11 +268,11 @@ public String toString() {
}
}
- public <T extends Element> void createKeyIndex(final String key, final Class<T> elementClass) {
+ public <T extends Element> void createKeyIndex(final String key, final Class<T> elementClass, final Parameter... indexParameters) {
if (key.equals(ID)) {
throw new IllegalArgumentException("Index key " + ID + " is reserved by IdGraph");
} else {
- baseGraph.createKeyIndex(key, elementClass);
+ baseGraph.createKeyIndex(key, elementClass, indexParameters);
}
}
@@ -3,6 +3,7 @@
import com.tinkerpop.blueprints.Element;
import com.tinkerpop.blueprints.IndexableGraph;
import com.tinkerpop.blueprints.KeyIndexableGraph;
+import com.tinkerpop.blueprints.Parameter;
import java.util.Set;
@@ -27,7 +28,7 @@ public ReadOnlyKeyIndexableGraph(final T baseKIGraph) {
/**
* @throws UnsupportedOperationException
*/
- public <T extends Element> void createKeyIndex(final String name, Class<T> elementClass) throws UnsupportedOperationException {
+ public <T extends Element> void createKeyIndex(final String name, Class<T> elementClass, final Parameter... indexParameters) throws UnsupportedOperationException {
throw new UnsupportedOperationException(ReadOnlyTokens.MUTATE_ERROR_MESSAGE);
}
@@ -8,6 +8,7 @@
import com.tinkerpop.blueprints.Features;
import com.tinkerpop.blueprints.KeyIndexableGraph;
import com.tinkerpop.blueprints.MetaGraph;
+import com.tinkerpop.blueprints.Parameter;
import com.tinkerpop.blueprints.TransactionalGraph;
import com.tinkerpop.blueprints.Vertex;
import com.tinkerpop.blueprints.util.ExceptionFactory;
@@ -671,7 +672,7 @@ public Features getFeatures() {
*/
@Override
public <T extends Element> void createKeyIndex(String key,
- Class<T> elementClass) {
+ Class<T> elementClass, final Parameter... indexParameters) {
autoStartTransaction();
String label = this.label.get();
@@ -366,7 +366,7 @@ else if (id instanceof Number)
this.dropInternalIndexKey(key, elementClass);
}
- public <T extends Element> void createKeyIndex(final String key, final Class<T> elementClass) {
+ public <T extends Element> void createKeyIndex(final String key, final Class<T> elementClass, final Parameter... indexParameters) {
this.autoStartTransaction();
if (Vertex.class.isAssignableFrom(elementClass)) {
if (!this.rawGraph.index().getNodeAutoIndexer().isEnabled())
@@ -387,7 +387,7 @@ public void dropIndex(final String indexName) throws UnsupportedOperationExcepti
}
}
- public <T extends Element> void createKeyIndex(final String key, final Class<T> elementClass) {
+ public <T extends Element> void createKeyIndex(final String key, final Class<T> elementClass, final Parameter... indexParameters) {
if (Vertex.class.isAssignableFrom(elementClass)) {
this.vertexIndexKeys.add(key);
} else {
@@ -451,7 +451,7 @@ private void removeContext() {
getRawGraph().getMetadata().getIndexManager().dropIndex(className + "." + key);
}
- public <T extends Element> void createKeyIndex(final String key, Class<T> elementClass) {
+ public <T extends Element> void createKeyIndex(final String key, Class<T> elementClass, final Parameter... indexParameters) {
final String className = getClassName(elementClass);
final OGraphDatabase db = getRawGraph();
@@ -275,7 +275,7 @@ public Features getFeatures() {
RestHelper.delete(this.graphURI + RexsterTokens.SLASH_KEY_INDICES_SLASH + c + RexsterTokens.SLASH + key);
}
- public <T extends Element> void createKeyIndex(String key, Class<T> elementClass) {
+ public <T extends Element> void createKeyIndex(String key, Class<T> elementClass, final Parameter... indexParameters) {
final String c = getKeyIndexClass(elementClass);
RestHelper.post(this.graphURI + RexsterTokens.SLASH_KEY_INDICES_SLASH + c + RexsterTokens.SLASH + key);
}

0 comments on commit e15c3a9

Please sign in to comment.