/** * Configure and return a BigdataGraph based on the supplied configuration * parameters. * * @see {@link Options} * @see com.tinkerpop.rexster.config.GraphConfiguration#configureGraphInstance(com.tinkerpop.rexster.config.GraphConfigurationContext) */ @Override public BigdataGraph configureGraphInstance(final GraphConfigurationContext context) throws GraphConfigurationException { try { return configure(context); } catch (Exception ex) { throw new GraphConfigurationException(ex); } }
protected BigdataGraph configure(final GraphConfigurationContext context) throws Exception { final Configuration config = context.getProperties(); throw new GraphConfigurationException("missing required parameter: " + Options.TYPE); throw new GraphConfigurationException("missing required parameter: " + Options.HOST); throw new GraphConfigurationException("missing required parameter: " + Options.PORT); throw new GraphConfigurationException("unrecognized value for " + Options.TYPE + ": " + type);
@Override public Graph configureGraphInstance(GraphConfigurationContext configuration) throws GraphConfigurationException { Map configurationMap = ApacheConfigurationUtils.toMap(configuration.getProperties()); Map convertedConfigurationMap = new HashMap(); for (Object key : configurationMap.keySet()) { Object convertedKey = key.toString().replaceAll("-", "."); Object convertedValue = configurationMap.get(key); if (convertedValue instanceof List) { convertedValue = join((Iterable) convertedValue); } convertedConfigurationMap.put(convertedKey, convertedValue); } for (Object key : convertedConfigurationMap.keySet()) { System.out.println(key + " = " + convertedConfigurationMap.get(key)); } return new AccumuloVertexiumBlueprintsGraphFactory().createGraph(convertedConfigurationMap); }
public Graph configureGraphInstance(final GraphConfigurationContext context) throws GraphConfigurationException { final String graphFile = context.getProperties().getString(Tokens.REXSTER_GRAPH_LOCATION); if (graphFile == null || graphFile.length() == 0) { throw new GraphConfigurationException("Check graph configuration. Missing or empty configuration element: " + Tokens.REXSTER_GRAPH_LOCATION); } // get the <properties> section of the xml configuration final HierarchicalConfiguration graphSectionConfig = (HierarchicalConfiguration) context.getProperties(); SubnodeConfiguration orientDbSpecificConfiguration; try { orientDbSpecificConfiguration = graphSectionConfig.configurationAt(Tokens.REXSTER_GRAPH_PROPERTIES); } catch (IllegalArgumentException iae) { throw new GraphConfigurationException("Check graph configuration. Missing or empty configuration element: " + Tokens.REXSTER_GRAPH_PROPERTIES, iae); } try { final String username = orientDbSpecificConfiguration.getString("username", ""); final String password = orientDbSpecificConfiguration.getString("password", ""); // calling the open method opens the connection to graphdb. looks like the // implementation of shutdown will call the orientdb close method. return OrientGraphFactory.getTxGraphImplFactory().getGraph(graphFile, username, password); } catch (Exception ex) { throw new GraphConfigurationException(ex); } }
public Graph configureGraphInstance(final GraphConfigurationContext context) throws GraphConfigurationException { final String graphFile = context.getProperties().getString(Tokens.REXSTER_GRAPH_LOCATION); throw new GraphConfigurationException("Check graph configuration. Missing or empty configuration element: " + Tokens.REXSTER_GRAPH_LOCATION); final boolean highAvailabilityMode = context.getProperties().getBoolean(Tokens.REXSTER_GRAPH_HA, false); final HierarchicalConfiguration graphSectionConfig = (HierarchicalConfiguration) context.getProperties(); SubnodeConfiguration neo4jSpecificConfiguration; neo4jSpecificConfiguration = graphSectionConfig.configurationAt(Tokens.REXSTER_GRAPH_PROPERTIES); } catch (IllegalArgumentException iae) { throw new GraphConfigurationException("Check graph configuration. Missing or empty configuration element: " + Tokens.REXSTER_GRAPH_PROPERTIES); throw new GraphConfigurationException("Check graph configuration. Neo4j HA requires [ha.machine_id] in the <properties> of the configuration"); throw new GraphConfigurationException("Check graph configuration. Neo4j HA requires [ha.server] <properties> of the configuration"); throw new GraphConfigurationException("Check graph configuration. Neo4j HA requires [ha.initial_hosts] <properties> of the configuration"); throw gce; } catch (Exception ex) { throw new GraphConfigurationException(ex);
@Override public Graph configureGraphInstance(GraphConfigurationContext context) throws GraphConfigurationException { Configuration conf = context.getProperties(); try { conf = ((HierarchicalConfiguration) conf).configurationAt(Tokens.REXSTER_GRAPH_PROPERTIES); } catch (IllegalArgumentException iae) { throw new GraphConfigurationException("Check graph configuration. Missing or empty configuration element: " + Tokens.REXSTER_GRAPH_PROPERTIES); } AccumuloGraphConfiguration cfg = new AccumuloGraphConfiguration(conf); if (cfg.getInstanceType().equals(InstanceType.Mock)) { cfg.setPassword("".getBytes()); cfg.setUser("root"); } cfg.setGraphName(context.getProperties().getString(Tokens.REXSTER_GRAPH_NAME)); return GraphFactory.open(cfg.getConfiguration()); }
@Override public Graph configureGraphInstance(GraphConfigurationContext context) throws GraphConfigurationException { Configuration conf = context.getProperties(); try { conf = ((HierarchicalConfiguration) conf).configurationAt(Tokens.REXSTER_GRAPH_PROPERTIES); } catch (IllegalArgumentException iae) { throw new GraphConfigurationException("Check graph configuration. Missing or empty configuration element: " + Tokens.REXSTER_GRAPH_PROPERTIES); } AccumuloGraphConfiguration cfg = new AccumuloGraphConfiguration(conf); if (cfg.getInstanceType().equals(InstanceType.Mock)) { cfg.setPassword("".getBytes()); cfg.setUser("root"); } cfg.setGraphName(context.getProperties().getString(Tokens.REXSTER_GRAPH_NAME)); return GraphFactory.open(cfg.getConfiguration()); }
public Configuration convertConfiguration(final GraphConfigurationContext context) throws GraphConfigurationException { Configuration properties = context.getProperties(); try { final Configuration titanConfig = new BaseConfiguration(); throw new GraphConfigurationException("Check graph configuration. Missing or empty configuration element: " + Tokens.REXSTER_GRAPH_PROPERTIES); cause = cause.getCause(); throw new GraphConfigurationException(cause);