public class ManagementSystem extends Object implements TitanManagement
Modifier and Type | Class and Description |
---|---|
static class |
ManagementSystem.IndexJobStatus |
TitanManagement.IndexJobFuture
Constructor and Description |
---|
ManagementSystem(StandardTitanGraph graph,
KCVSConfiguration config,
Log sysLog,
ManagementLogger mgmtLogger,
SchemaCache schemaCache) |
Modifier and Type | Method and Description |
---|---|
void |
addIndexKey(TitanGraphIndex index,
PropertyKey key,
Parameter... parameters) |
static GraphIndexStatusWatcher |
awaitGraphIndexStatus(TitanGraph g,
String graphIndexName)
|
static RelationIndexStatusWatcher |
awaitRelationIndexStatus(TitanGraph g,
String relationIndexName,
String relationTypeName)
Returns a
RelationIndexStatusWatcher configured to watch the index specified by
relationIndexName and relationIndexType through graph g . |
RelationTypeIndex |
buildEdgeIndex(EdgeLabel label,
String name,
org.apache.tinkerpop.gremlin.structure.Direction direction,
org.apache.tinkerpop.gremlin.process.traversal.Order sortOrder,
PropertyKey... sortKeys)
Creates a
RelationTypeIndex for the provided edge label. |
RelationTypeIndex |
buildEdgeIndex(EdgeLabel label,
String name,
org.apache.tinkerpop.gremlin.structure.Direction direction,
PropertyKey... sortKeys)
Identical to
#buildEdgeIndex(com.thinkaurelius.titan.core.EdgeLabel, String, com.tinkerpop.gremlin.structure.Direction, com.tinkerpop.gremlin.structure.Order, com.thinkaurelius.titan.core.PropertyKey...)
with default sort order Order.incr . |
TitanManagement.IndexBuilder |
buildIndex(String indexName,
Class<? extends org.apache.tinkerpop.gremlin.structure.Element> elementType)
Returns an
TitanManagement.IndexBuilder to add a graph index to this Titan graph. |
RelationTypeIndex |
buildPropertyIndex(PropertyKey key,
String name,
org.apache.tinkerpop.gremlin.process.traversal.Order sortOrder,
PropertyKey... sortKeys)
Creates a
RelationTypeIndex for the provided property key. |
RelationTypeIndex |
buildPropertyIndex(PropertyKey key,
String name,
PropertyKey... sortKeys)
Identical to
#buildPropertyIndex(com.thinkaurelius.titan.core.PropertyKey, String, com.tinkerpop.gremlin.structure.Order, com.thinkaurelius.titan.core.PropertyKey...)
with default sort order com.tinkerpop.gremlin.structure.Order#incr . |
void |
changeName(TitanSchemaElement element,
String newName)
Changes the name of a
TitanSchemaElement to the provided new name. |
void |
commit()
Commits this management transaction and persists all schema changes.
|
boolean |
containsEdgeLabel(String name)
Checks whether an edge label of the given name has been defined in the Titan schema.
|
boolean |
containsGraphIndex(String name)
Whether the graph has a graph index defined with the given name.
|
boolean |
containsPropertyKey(String name)
Checks whether a property key of the given name has been defined in the Titan schema.
|
boolean |
containsRelationIndex(RelationType type,
String name)
Whether a
RelationTypeIndex with the given name has been defined for the provided RelationType |
boolean |
containsRelationType(String name)
Checks whether a type with the specified name exists.
|
boolean |
containsVertexLabel(String name)
Whether a vertex label with the given name exists in the graph.
|
void |
forceCloseInstance(String instanceId)
Forcefully removes a Titan instance from this graph cluster as identified by its name.
|
String |
get(String path)
Returns a string representation of the provided configuration option or namespace for inspection.
|
ConsistencyModifier |
getConsistency(TitanSchemaElement element)
Retrieves the consistency level for a schema element (types and internal indexes)
|
EdgeLabel |
getEdgeLabel(String name)
Returns the edge label with the given name.
|
TitanGraphIndex |
getGraphIndex(String name)
Returns the graph index with the given name or null if it does not exist
|
static IndexType |
getGraphIndexDirect(String name,
StandardTitanTx transaction) |
Iterable<TitanGraphIndex> |
getGraphIndexes(Class<? extends org.apache.tinkerpop.gremlin.structure.Element> elementType)
Returns all graph indexes that index the given element type.
|
TitanManagement.IndexJobFuture |
getIndexJobStatus(TitanIndex index)
If an index update job was triggered through
TitanManagement.updateIndex(TitanIndex, SchemaAction) with schema actions
SchemaAction.REINDEX or SchemaAction.REMOVE_INDEX
then this method can be used to track the status of this asynchronous process. |
Set<String> |
getOpenInstances()
Returns a set of unique instance ids for all Titan instances that are currently
part of this graph cluster.
|
Set<String> |
getOpenInstancesInternal() |
EdgeLabel |
getOrCreateEdgeLabel(String name)
Returns the edge label with the given name.
|
PropertyKey |
getOrCreatePropertyKey(String name)
Returns the property key with the given name.
|
VertexLabel |
getOrCreateVertexLabel(String name)
Returns the vertex label with the given name.
|
PropertyKey |
getPropertyKey(String name)
Returns the property key with the given name.
|
RelationTypeIndex |
getRelationIndex(RelationType type,
String name)
Returns the
RelationTypeIndex with the given name for the provided RelationType or null
if it does not exist |
Iterable<RelationTypeIndex> |
getRelationIndexes(RelationType type)
|
RelationType |
getRelationType(String name)
Returns the type with the given name.
|
<T extends RelationType> |
getRelationTypes(Class<T> clazz)
Returns an iterable over all defined types that have the given clazz (either
EdgeLabel which returns all labels,
PropertyKey which returns all keys, or RelationType which returns all types). |
TitanSchemaElement |
getSchemaElement(long id) |
TitanSchemaVertex |
getSchemaVertex(TitanSchemaElement element) |
java.time.Duration |
getTTL(TitanSchemaType type)
Retrieves the time-to-live for the given
TitanSchemaType as a Duration . |
VertexLabel |
getVertexLabel(String name)
Returns the vertex label with the given name.
|
Iterable<VertexLabel> |
getVertexLabels()
Returns an
Iterable over all defined VertexLabel s. |
StandardTitanTx |
getWrappedTx() |
boolean |
isOpen()
Whether this management transaction is open or has been closed (i.e.
|
EdgeLabelMaker |
makeEdgeLabel(String name)
Returns a
EdgeLabelMaker instance to define a new EdgeLabel with the given name. |
PropertyKeyMaker |
makePropertyKey(String name)
Returns a
PropertyKeyMaker instance to define a new PropertyKey with the given name. |
VertexLabelMaker |
makeVertexLabel(String name)
Returns a
VertexLabelMaker to define a new vertex label with the given name. |
void |
rollback()
Closes this management transaction and discards all changes.
|
TitanConfiguration |
set(String path,
Object value)
Sets the configuration option identified by the provided path to the given value.
|
void |
setConsistency(TitanSchemaElement element,
ConsistencyModifier consistency)
Sets the consistency level for those schema elements that support it (types and internal indexes)
|
void |
setTTL(TitanSchemaType type,
java.time.Duration duration)
Sets time-to-live for those schema types that support it
|
TitanManagement.IndexJobFuture |
updateIndex(TitanIndex index,
SchemaAction updateAction)
Updates the provided index according to the given
SchemaAction |
public ManagementSystem(StandardTitanGraph graph, KCVSConfiguration config, Log sysLog, ManagementLogger mgmtLogger, SchemaCache schemaCache)
public Set<String> getOpenInstances()
TitanManagement
getOpenInstances
in interface TitanManagement
public void forceCloseInstance(String instanceId)
TitanManagement
forceCloseInstance
in interface TitanManagement
public void commit()
TitanManagement
commit
in interface TitanManagement
TitanTransaction.commit()
public void rollback()
TitanManagement
rollback
in interface TitanManagement
TitanTransaction.rollback()
public boolean isOpen()
TitanManagement
isOpen
in interface TitanManagement
public StandardTitanTx getWrappedTx()
public TitanSchemaElement getSchemaElement(long id)
public RelationTypeIndex buildEdgeIndex(EdgeLabel label, String name, org.apache.tinkerpop.gremlin.structure.Direction direction, PropertyKey... sortKeys)
TitanManagement
#buildEdgeIndex(com.thinkaurelius.titan.core.EdgeLabel, String, com.tinkerpop.gremlin.structure.Direction, com.tinkerpop.gremlin.structure.Order, com.thinkaurelius.titan.core.PropertyKey...)
with default sort order Order.incr
.buildEdgeIndex
in interface TitanManagement
RelationTypeIndex
public RelationTypeIndex buildEdgeIndex(EdgeLabel label, String name, org.apache.tinkerpop.gremlin.structure.Direction direction, org.apache.tinkerpop.gremlin.process.traversal.Order sortOrder, PropertyKey... sortKeys)
TitanManagement
RelationTypeIndex
for the provided edge label. That means, that all edges of that label will be
indexed according to this index definition which will speed up certain vertex-centric queries.
An indexed is defined by its name, the direction in which the index should be created (can be restricted to one
direction or both), the sort order and - most importantly - the sort keys which define the index key.buildEdgeIndex
in interface TitanManagement
RelationTypeIndex
public RelationTypeIndex buildPropertyIndex(PropertyKey key, String name, PropertyKey... sortKeys)
TitanManagement
#buildPropertyIndex(com.thinkaurelius.titan.core.PropertyKey, String, com.tinkerpop.gremlin.structure.Order, com.thinkaurelius.titan.core.PropertyKey...)
with default sort order com.tinkerpop.gremlin.structure.Order#incr
.buildPropertyIndex
in interface TitanManagement
RelationTypeIndex
public RelationTypeIndex buildPropertyIndex(PropertyKey key, String name, org.apache.tinkerpop.gremlin.process.traversal.Order sortOrder, PropertyKey... sortKeys)
TitanManagement
RelationTypeIndex
for the provided property key. That means, that all properties of that key will be
indexed according to this index definition which will speed up certain vertex-centric queries.
An indexed is defined by its name, the sort order and - most importantly - the sort keys which define the index key.buildPropertyIndex
in interface TitanManagement
RelationTypeIndex
public boolean containsRelationIndex(RelationType type, String name)
TitanManagement
RelationTypeIndex
with the given name has been defined for the provided RelationType
containsRelationIndex
in interface TitanManagement
public RelationTypeIndex getRelationIndex(RelationType type, String name)
TitanManagement
RelationTypeIndex
with the given name for the provided RelationType
or null
if it does not existgetRelationIndex
in interface TitanManagement
public Iterable<RelationTypeIndex> getRelationIndexes(RelationType type)
TitanManagement
getRelationIndexes
in interface TitanManagement
public static IndexType getGraphIndexDirect(String name, StandardTitanTx transaction)
public boolean containsGraphIndex(String name)
TitanManagement
containsGraphIndex
in interface TitanManagement
public TitanGraphIndex getGraphIndex(String name)
TitanManagement
getGraphIndex
in interface TitanManagement
public Iterable<TitanGraphIndex> getGraphIndexes(Class<? extends org.apache.tinkerpop.gremlin.structure.Element> elementType)
TitanManagement
getGraphIndexes
in interface TitanManagement
public static GraphIndexStatusWatcher awaitGraphIndexStatus(TitanGraph g, String graphIndexName)
GraphIndexStatusWatcher
configured to watch
graphIndexName
through graph g
.
This method just instantiates an object.
Invoke GraphIndexStatusWatcher.call()
to wait.g
- the graph through which to read index informationgraphIndexName
- the name of a graph index to watchpublic static RelationIndexStatusWatcher awaitRelationIndexStatus(TitanGraph g, String relationIndexName, String relationTypeName)
RelationIndexStatusWatcher
configured to watch the index specified by
relationIndexName
and relationIndexType
through graph g
.
This method just instantiates an object.
Invoke RelationIndexStatusWatcher.call()
to wait.g
- the graph through which to read index informationrelationIndexName
- the name of the relation index to watchrelationTypeName
- the type on the relation index to watchpublic void addIndexKey(TitanGraphIndex index, PropertyKey key, Parameter... parameters)
addIndexKey
in interface TitanManagement
public TitanManagement.IndexBuilder buildIndex(String indexName, Class<? extends org.apache.tinkerpop.gremlin.structure.Element> elementType)
TitanManagement
TitanManagement.IndexBuilder
to add a graph index to this Titan graph. The index to-be-created
has the provided name and indexes elements of the given type.buildIndex
in interface TitanManagement
public TitanManagement.IndexJobFuture updateIndex(TitanIndex index, SchemaAction updateAction)
TitanManagement
SchemaAction
updateIndex
in interface TitanManagement
public TitanManagement.IndexJobFuture getIndexJobStatus(TitanIndex index)
TitanManagement
TitanManagement.updateIndex(TitanIndex, SchemaAction)
with schema actions
SchemaAction.REINDEX
or SchemaAction.REMOVE_INDEX
then this method can be used to track the status of this asynchronous process.getIndexJobStatus
in interface TitanManagement
public void changeName(TitanSchemaElement element, String newName)
TitanManagement
TitanSchemaElement
to the provided new name.
The new name must be valid and not already in use, otherwise an IllegalArgumentException
is thrown.changeName
in interface TitanManagement
public TitanSchemaVertex getSchemaVertex(TitanSchemaElement element)
public ConsistencyModifier getConsistency(TitanSchemaElement element)
getConsistency
in interface TitanManagement
element
- public void setConsistency(TitanSchemaElement element, ConsistencyModifier consistency)
setConsistency
in interface TitanManagement
element
- consistency
- public java.time.Duration getTTL(TitanSchemaType type)
TitanManagement
TitanSchemaType
as a Duration
.
If no TTL has been defined, the returned Duration will be zero-length ("lives forever").getTTL
in interface TitanManagement
public void setTTL(TitanSchemaType type, java.time.Duration duration)
setTTL
in interface TitanManagement
type
- duration
- Note that only 'seconds' granularity is supportedpublic boolean containsRelationType(String name)
SchemaInspector
containsRelationType
in interface SchemaInspector
name
- name of the typepublic RelationType getRelationType(String name)
SchemaInspector
getRelationType
in interface SchemaInspector
name
- name of the type to returnRelationType
public boolean containsPropertyKey(String name)
SchemaInspector
containsPropertyKey
in interface SchemaInspector
name
- name of the property keypublic PropertyKey getPropertyKey(String name)
SchemaInspector
getPropertyKey
in interface SchemaInspector
public boolean containsEdgeLabel(String name)
SchemaInspector
containsEdgeLabel
in interface SchemaInspector
name
- name of the edge labelpublic EdgeLabel getOrCreateEdgeLabel(String name)
SchemaInspector
getOrCreateEdgeLabel
in interface SchemaInspector
name
- name of the edge label to returnEdgeLabel
public PropertyKey getOrCreatePropertyKey(String name)
SchemaInspector
getOrCreatePropertyKey
in interface SchemaInspector
name
- name of the property key to returnPropertyKey
public EdgeLabel getEdgeLabel(String name)
SchemaInspector
getEdgeLabel
in interface SchemaInspector
public PropertyKeyMaker makePropertyKey(String name)
SchemaManager
PropertyKeyMaker
instance to define a new PropertyKey
with the given name.
By defining types explicitly (rather than implicitly through usage) one can control various
aspects of the key and associated consistency constraints.
The key constructed with this maker will be created in the context of this transaction.makePropertyKey
in interface SchemaManager
PropertyKeyMaker
linked to this transaction.PropertyKeyMaker
,
PropertyKey
public EdgeLabelMaker makeEdgeLabel(String name)
SchemaManager
EdgeLabelMaker
instance to define a new EdgeLabel
with the given name.
By defining types explicitly (rather than implicitly through usage) one can control various
aspects of the label and associated consistency constraints.
The label constructed with this maker will be created in the context of this transaction.makeEdgeLabel
in interface SchemaManager
EdgeLabelMaker
linked to this transaction.EdgeLabelMaker
,
EdgeLabel
public <T extends RelationType> Iterable<T> getRelationTypes(Class<T> clazz)
TitanManagement
EdgeLabel
which returns all labels,
PropertyKey
which returns all keys, or RelationType
which returns all types).getRelationTypes
in interface TitanManagement
clazz
- RelationType
or sub-interfacepublic boolean containsVertexLabel(String name)
SchemaInspector
containsVertexLabel
in interface SchemaInspector
public VertexLabel getVertexLabel(String name)
SchemaInspector
getVertexLabel
in interface SchemaInspector
public VertexLabel getOrCreateVertexLabel(String name)
SchemaInspector
DefaultSchemaMaker
.
Attempting to automatically create a vertex label might cause an exception depending on the configuration.getOrCreateVertexLabel
in interface SchemaInspector
public VertexLabelMaker makeVertexLabel(String name)
SchemaManager
VertexLabelMaker
to define a new vertex label with the given name. Note, that the name must
be unique.makeVertexLabel
in interface SchemaManager
public Iterable<VertexLabel> getVertexLabels()
TitanManagement
Iterable
over all defined VertexLabel
s.getVertexLabels
in interface TitanManagement
public String get(String path)
TitanConfiguration
get
in interface TitanConfiguration
public TitanConfiguration set(String path, Object value)
TitanConfiguration
set
in interface TitanConfiguration
Copyright © 2012–2015. All rights reserved.