@Override public InputStream getInputStream() { try { return fs.open(this.path); } catch (IOException ex) { throw new SecureGraphException("Could not open: " + this.path, ex); } } }
public Class getValueType() { try { return Class.forName(valueType); } catch (ClassNotFoundException e) { throw new SecureGraphException("Could not get type: " + valueType); } }
private String getPropertyNameFromColumnQualifier(String columnQualifier) { int i = columnQualifier.indexOf(ElementMutationBuilder.VALUE_SEPARATOR); if (i < 0) { throw new SecureGraphException("Invalid property column qualifier"); } return columnQualifier.substring(0, i); }
@Override public String getOtherVertexId(String myVertexId) { if (inVertexId.equals(myVertexId)) { return outVertexId; } else if (outVertexId.equals(myVertexId)) { return inVertexId; } throw new SecureGraphException("myVertexId does not appear on either the in or the out."); }
private String getRowPrefixForElement(AccumuloElement element) { if (element instanceof Vertex) { return AccumuloConstants.VERTEX_ROW_KEY_PREFIX; } if (element instanceof Edge) { return AccumuloConstants.EDGE_ROW_KEY_PREFIX; } throw new SecureGraphException("Unexpected element type: " + element.getClass().getName()); }
@Override public String nextId() { synchronized (ids) { if (ids.size() == 0) { throw new SecureGraphException("No ids in the queue to give out"); } return ids.remove(); } }
private static SecureGraphBlueprintsFactory createFactory(String factoryClassName) { try { Class factoryClass = Class.forName(factoryClassName); Constructor constructor = factoryClass.getConstructor(); return (SecureGraphBlueprintsFactory) constructor.newInstance(); } catch (Exception ex) { throw new SecureGraphException("Could not create factory: " + factoryClassName, ex); } } }
void markPropertyHiddenInternal(Property property, Visibility visibility) { if (property instanceof MutableProperty) { ((MutableProperty) property).addHiddenVisibility(visibility); } else { throw new SecureGraphException("Could not mark property hidden. Must be of type " + MutableProperty.class.getName()); } }
private static String[] getElasticSearchLocations(GraphConfiguration config) { String esLocationsString = config.getString(GraphConfiguration.SEARCH_INDEX_PROP_PREFIX + "." + CONFIG_ES_LOCATIONS, null); if (esLocationsString == null) { throw new SecureGraphException(GraphConfiguration.SEARCH_INDEX_PROP_PREFIX + "." + CONFIG_ES_LOCATIONS + " is a required configuration parameter"); } LOGGER.info("Using elastic search locations: " + esLocationsString); return esLocationsString.split(","); }
public void alterEdgeLabel(String edgeId, String newEdgeLabel) { InMemoryEdge edge = this.edges.get(edgeId); if (edge == null) { throw new SecureGraphException("Could not find edge " + edgeId); } edge.setLabel(newEdgeLabel); } }
void markPropertyVisibleInternal(Property property, Visibility visibility) { if (property instanceof MutableProperty) { ((MutableProperty) property).removeHiddenVisibility(visibility); } else { throw new SecureGraphException("Could not mark property visible. Must be of type " + MutableProperty.class.getName()); } }
private Iterable<Map.Entry<String, EdgeInfo>> getEdgeInfos(Direction direction) { switch (direction) { case IN: return this.inEdges.entrySet(); case OUT: return this.outEdges.entrySet(); case BOTH: return new JoinIterable<>(this.inEdges.entrySet(), this.outEdges.entrySet()); default: throw new SecureGraphException("Unexpected direction: " + direction); } }
private VisibilityProvider createVisibilityProvider(GraphConfiguration config) { try { return ConfigurationUtils.createProvider(config, "visibilityProvider", DefaultVisibilityProvider.class.getName()); } catch (Exception ex) { throw new SecureGraphException("Could not create visibility provider", ex); } }
public Entry getEntry(String key) { Entry entry = null; for (Map.Entry<String, Entry> e : entries.entrySet()) { if (e.getValue().getKey().equals(key)) { if (entry != null) { throw new SecureGraphException("Multiple matching entries for key: " + key); } entry = e.getValue(); } } return entry; }
private static String[] getElasticSearchLocations(GraphConfiguration config) { String esLocationsString = config.getString(GraphConfiguration.SEARCH_INDEX_PROP_PREFIX + "." + CONFIG_ES_LOCATIONS, null); if (esLocationsString == null) { throw new SecureGraphException(GraphConfiguration.SEARCH_INDEX_PROP_PREFIX + "." + CONFIG_ES_LOCATIONS + " is a required configuration parameter"); } LOGGER.info("Using elastic search locations: " + esLocationsString); return esLocationsString.split(","); }
protected BatchWriter getWriterFromElementType(Element element) { if (element instanceof Vertex) { return getVerticesWriter(); } else if (element instanceof Edge) { return getEdgesWriter(); } else { throw new SecureGraphException("Unexpected element type: " + element.getClass().getName()); } }
@Override protected void setup() { super.setup(); if (accumuloGraphVersion == null) { setMetadata(METADATA_ACCUMULO_GRAPH_VERSION_KEY, METADATA_ACCUMULO_GRAPH_VERSION); } else if (!METADATA_ACCUMULO_GRAPH_VERSION.equals(accumuloGraphVersion)) { throw new SecureGraphException("Invalid accumulo graph version. Expected " + METADATA_ACCUMULO_GRAPH_VERSION + " found " + accumuloGraphVersion); } }
private void decodeBytes() { if (!decoded) { try { ByteBuffer in = ByteBuffer.wrap(this.bytes); this.label = readString(in); this.vertexId = readString(in); this.decoded = true; } catch (IOException ex) { throw new SecureGraphException("Could not decode EdgeInfo data", ex); } } }
public static void decodeCell(String key, org.elasticsearch.common.geo.GeoPoint northWest, org.elasticsearch.common.geo.GeoPoint southEast) { try { double[] interval = (double[]) decodeCell.invoke(null, key); northWest.reset(interval[1], interval[2]); southEast.reset(interval[0], interval[3]); } catch (Exception e) { throw new SecureGraphException("Could not decode cell", e); } } }
public static void decodeCell(String key, org.elasticsearch.common.geo.GeoPoint northWest, org.elasticsearch.common.geo.GeoPoint southEast) { try { double[] interval = (double[]) decodeCell.invoke(null, key); northWest.reset(interval[1], interval[2]); southEast.reset(interval[0], interval[3]); } catch (Exception e) { throw new SecureGraphException("Could not decode cell", e); } } }