Java Code Examples for com.tinkerpop.blueprints.util.ExceptionFactory#classForElementCannotBeNull()
The following examples show how to use
com.tinkerpop.blueprints.util.ExceptionFactory#classForElementCannotBeNull() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AccumuloGraph.java From AccumuloGraph with Apache License 2.0 | 6 votes |
@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); }
Example 2
Source File: AccumuloGraph.java From AccumuloGraph with Apache License 2.0 | 6 votes |
@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(); }
Example 3
Source File: IndexMetadataTableWrapper.java From AccumuloGraph with Apache License 2.0 | 6 votes |
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(); } } }
Example 4
Source File: IdGraph.java From org.openntf.domino with Apache License 2.0 | 6 votes |
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); } }
Example 5
Source File: AccumuloGraph.java From AccumuloGraph with Apache License 2.0 | 5 votes |
@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); }
Example 6
Source File: AccumuloGraph.java From AccumuloGraph with Apache License 2.0 | 5 votes |
@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(); }
Example 7
Source File: IdGraph.java From org.openntf.domino with Apache License 2.0 | 5 votes |
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); } }
Example 8
Source File: IdGraph.java From org.openntf.domino with Apache License 2.0 | 5 votes |
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); } }