@Override public <T extends Element> void dropKeyIndex(String key, Class<T> elementClass) { if (elementClass == null) { throw ExceptionFactory.classForElementCannotBeNull(); } throw new UnsupportedOperationException(); }
public <T extends Element> void dropKeyIndex(final String key, final Class<T> elementClass) { if (elementClass == null) throw ExceptionFactory.classForElementCannotBeNull(); boolean v = isVertexClass(elementClass); boolean supported = ((v && supportVertexIds) || (!v && supportEdgeIds)); if (supported && key.equals(ID)) { throw new IllegalArgumentException("index key " + ID + " is reserved by IdGraph"); } else { baseGraph.dropKeyIndex(key, elementClass); } }
public <T extends Element> void createKeyIndex(final String key, final Class<T> elementClass, final Parameter... indexParameters) { if (elementClass == null) throw ExceptionFactory.classForElementCannotBeNull(); boolean v = isVertexClass(elementClass); boolean supported = ((v && supportVertexIds) || (!v && supportEdgeIds)); if (supported && key.equals(ID)) { throw new IllegalArgumentException("index key " + ID + " is reserved by IdGraph"); } else { baseGraph.createKeyIndex(key, elementClass, indexParameters); } }
public <T extends Element> Set<String> getIndexedKeys(final Class<T> elementClass) { if (elementClass == null) throw ExceptionFactory.classForElementCannotBeNull(); if (Vertex.class.isAssignableFrom(elementClass)) { return this.vertexKeyIndex.getIndexedKeys(); } else if (Edge.class.isAssignableFrom(elementClass)) { return this.edgeKeyIndex.getIndexedKeys(); } else { throw ExceptionFactory.classIsNotIndexable(elementClass); } }
public <T extends Element> void createKeyIndex(final String key, final Class<T> elementClass, final Parameter... indexParameters) { if (elementClass == null) throw ExceptionFactory.classForElementCannotBeNull(); if (Vertex.class.isAssignableFrom(elementClass)) { this.vertexKeyIndex.createKeyIndex(key); } else if (Edge.class.isAssignableFrom(elementClass)) { this.edgeKeyIndex.createKeyIndex(key); } else { throw ExceptionFactory.classIsNotIndexable(elementClass); } }
public <T extends Element> Set<String> getIndexedKeys(final Class<T> elementClass) { if (elementClass == null) throw ExceptionFactory.classForElementCannotBeNull(); boolean v = isVertexClass(elementClass); boolean supported = ((v && supportVertexIds) || (!v && supportEdgeIds)); if (supported) { Set<String> keys = new HashSet<String>(); keys.addAll(baseGraph.getIndexedKeys(elementClass)); keys.remove(ID); return keys; } else { return baseGraph.getIndexedKeys(elementClass); } }
public <T extends Element> void dropKeyIndex(final String key, final Class<T> elementClass) { if (elementClass == null) throw ExceptionFactory.classForElementCannotBeNull(); if (Vertex.class.isAssignableFrom(elementClass)) { this.vertexKeyIndex.dropKeyIndex(key); } else if (Edge.class.isAssignableFrom(elementClass)) { this.edgeKeyIndex.dropKeyIndex(key); } else { throw ExceptionFactory.classIsNotIndexable(elementClass); } }
/** * Drops the index against a field name. * * @param key Field name * @param elementClass Element class as instances of Vertex and Edge */ public <T extends Element> void dropKeyIndex(final String key, final Class<T> elementClass) { makeActive(); if (elementClass == null) throw ExceptionFactory.classForElementCannotBeNull(); executeOutsideTx(new OCallable<OClass, OrientBaseGraph>() { @Override public OClass call(final OrientBaseGraph g) { final String className = getClassName(elementClass); getRawGraph().getMetadata().getIndexManager().dropIndex(className + "." + key); return null; } }, "drop key index '", elementClass.getSimpleName(), ".", key, "'"); }
@Override public <T extends Element> Index<T> getIndex(String indexName, Class<T> indexClass) { if (indexClass == null) { throw ExceptionFactory.classForElementCannotBeNull(); } else if (globals.getConfig().getIndexableGraphDisabled()) { throw new UnsupportedOperationException("IndexableGraph is disabled via the configuration"); } return globals.getIndexMetadataWrapper().getIndex(indexName, indexClass); }
@Override public <T extends Element> Index<T> getIndex(String indexName, Class<T> indexClass) { if (indexClass == null) { throw ExceptionFactory.classForElementCannotBeNull(); } else if (globals.getConfig().getIndexableGraphDisabled()) { throw new UnsupportedOperationException("IndexableGraph is disabled via the configuration"); } return globals.getIndexMetadataWrapper().getIndex(indexName, indexClass); }
public <T extends Element> Set<String> getIndexedKeys(Class<T> elementClass) { if (elementClass == null) { throw ExceptionFactory.classForElementCannotBeNull(); } IndexedItemsListParser parser = new IndexedItemsListParser(elementClass); Scanner scan = null; try { scan = getScanner(); scan.fetchColumnFamily(new Text(IndexMetadataEntryType.__INDEX_KEY__.name())); Set<String> keys = new HashSet<String>(); for (IndexedItem item : parser.parse(scan)) { keys.add(item.getKey()); } return keys; } finally { if (scan != null) { scan.close(); } } }
public <T extends Element> Set<String> getIndexedKeys(Class<T> elementClass) { if (elementClass == null) { throw ExceptionFactory.classForElementCannotBeNull(); } IndexedItemsListParser parser = new IndexedItemsListParser(elementClass); Scanner scan = null; try { scan = getScanner(); scan.fetchColumnFamily(new Text(IndexMetadataEntryType.__INDEX_KEY__.name())); Set<String> keys = new HashSet<String>(); for (IndexedItem item : parser.parse(scan)) { keys.add(item.getKey()); } return keys; } finally { if (scan != null) { scan.close(); } } }
@SuppressWarnings("rawtypes") @Override public <T extends Element> Index<T> createIndex(String indexName, Class<T> indexClass, Parameter... indexParameters) { if (indexClass == null) { throw ExceptionFactory.classForElementCannotBeNull(); } else if (globals.getConfig().getIndexableGraphDisabled()) { throw new UnsupportedOperationException("IndexableGraph is disabled via the configuration"); } for (Index<?> index : globals.getIndexMetadataWrapper().getIndices()) { if (index.getIndexName().equals(indexName)) { throw ExceptionFactory.indexAlreadyExists(indexName); } } return globals.getIndexMetadataWrapper().createIndex(indexName, indexClass); }
@SuppressWarnings("rawtypes") @Override public <T extends Element> Index<T> createIndex(String indexName, Class<T> indexClass, Parameter... indexParameters) { if (indexClass == null) { throw ExceptionFactory.classForElementCannotBeNull(); } else if (globals.getConfig().getIndexableGraphDisabled()) { throw new UnsupportedOperationException("IndexableGraph is disabled via the configuration"); } for (Index<?> index : globals.getIndexMetadataWrapper().getIndices()) { if (index.getIndexName().equals(indexName)) { throw ExceptionFactory.indexAlreadyExists(indexName); } } return globals.getIndexMetadataWrapper().createIndex(indexName, indexClass); }
public <T extends Element> Set<String> getIndexedKeys(final Class<T> elementClass) { if (elementClass == null) throw ExceptionFactory.classForElementCannotBeNull(); if (Vertex.class.isAssignableFrom(elementClass)) { if (!this.rawGraph.index().getNodeAutoIndexer().isEnabled()) return Collections.emptySet(); return this.rawGraph.index().getNodeAutoIndexer().getAutoIndexedProperties(); } else if (Edge.class.isAssignableFrom(elementClass)) { if (!this.rawGraph.index().getRelationshipAutoIndexer().isEnabled()) return Collections.emptySet(); return this.rawGraph.index().getRelationshipAutoIndexer().getAutoIndexedProperties(); } else { throw ExceptionFactory.classIsNotIndexable(elementClass); } }
@SuppressWarnings("rawtypes") @Override public <T extends Element> void createKeyIndex(String key, Class<T> elementClass, Parameter... indexParameters) { // TODO Move below to somewhere appropriate. if (elementClass == null) { throw ExceptionFactory.classForElementCannotBeNull(); } // Add key to indexed keys list. globals.getIndexMetadataWrapper().writeKeyMetadataEntry(key, elementClass); globals.checkedFlush(); // Reindex graph. globals.getKeyIndexTableWrapper(elementClass).rebuildIndex(key, elementClass); globals.getVertexKeyIndexWrapper().dump(); globals.checkedFlush(); }
@SuppressWarnings("rawtypes") @Override public <T extends Element> void createKeyIndex(String key, Class<T> elementClass, Parameter... indexParameters) { // TODO Move below to somewhere appropriate. if (elementClass == null) { throw ExceptionFactory.classForElementCannotBeNull(); } // Add key to indexed keys list. globals.getIndexMetadataWrapper().writeKeyMetadataEntry(key, elementClass); globals.checkedFlush(); // Reindex graph. globals.getKeyIndexTableWrapper(elementClass).rebuildIndex(key, elementClass); globals.getVertexKeyIndexWrapper().dump(); globals.checkedFlush(); }
public <T extends Element> void createKeyIndex(final String key, final Class<T> elementClass, final Parameter... indexParameters) { if (elementClass == null) throw ExceptionFactory.classForElementCannotBeNull(); if (Vertex.class.isAssignableFrom(elementClass)) { this.autoStartTransaction(true); if (!this.rawGraph.index().getNodeAutoIndexer().isEnabled()) this.rawGraph.index().getNodeAutoIndexer().setEnabled(true); this.rawGraph.index().getNodeAutoIndexer().startAutoIndexingProperty(key); if (!this.getInternalIndexKeys(Vertex.class).contains(key)) { KeyIndexableGraphHelper.reIndexElements(this, this.getVertices(), new HashSet<String>(Arrays.asList(key))); this.autoStartTransaction(true); this.createInternalIndexKey(key, elementClass); } } else if (Edge.class.isAssignableFrom(elementClass)) { this.autoStartTransaction(true); if (!this.rawGraph.index().getRelationshipAutoIndexer().isEnabled()) this.rawGraph.index().getRelationshipAutoIndexer().setEnabled(true); this.rawGraph.index().getRelationshipAutoIndexer().startAutoIndexingProperty(key); if (!this.getInternalIndexKeys(Edge.class).contains(key)) { KeyIndexableGraphHelper.reIndexElements(this, this.getEdges(), new HashSet<String>(Arrays.asList(key))); this.autoStartTransaction(true); this.createInternalIndexKey(key, elementClass); } } else { throw ExceptionFactory.classIsNotIndexable(elementClass); } }
public <T extends Element> void dropKeyIndex(final String key, final Class<T> elementClass) { if (elementClass == null) throw ExceptionFactory.classForElementCannotBeNull(); this.autoStartTransaction(true); if (Vertex.class.isAssignableFrom(elementClass)) { if (!this.rawGraph.index().getNodeAutoIndexer().isEnabled()) return; this.rawGraph.index().getNodeAutoIndexer().stopAutoIndexingProperty(key); } else if (Edge.class.isAssignableFrom(elementClass)) { if (!this.rawGraph.index().getRelationshipAutoIndexer().isEnabled()) return; this.rawGraph.index().getRelationshipAutoIndexer().stopAutoIndexingProperty(key); } else { throw ExceptionFactory.classIsNotIndexable(elementClass); } this.dropInternalIndexKey(key, elementClass); }
@Override public <T extends Element> void dropKeyIndex(String key, Class<T> elementClass) { // TODO Move below to somewhere appropriate. if (elementClass == null) { throw ExceptionFactory.classForElementCannotBeNull(); } globals.getIndexMetadataWrapper().clearKeyMetadataEntry(key, elementClass); String table = null; if (elementClass.equals(Vertex.class)) { table = globals.getConfig().getVertexKeyIndexTableName(); } else { table = globals.getConfig().getEdgeKeyIndexTableName(); } BatchDeleter bd = null; try { bd = globals.getConfig().getConnector().createBatchDeleter(table, globals.getConfig().getAuthorizations(), globals.getConfig().getMaxWriteThreads(), globals.getConfig().getBatchWriterConfig()); bd.setRanges(Collections.singleton(new Range())); bd.fetchColumnFamily(new Text(key)); bd.delete(); } catch (Exception e) { throw new AccumuloGraphException(e); } finally { if (bd != null) bd.close(); } globals.checkedFlush(); }