private Graph getGraphFromConfiguration(final HierarchicalConfiguration graphConfiguration)
      throws GraphConfigurationException {
    String graphConfigurationType = graphConfiguration.getString(Tokens.REXSTER_GRAPH_TYPE);
    final boolean isReadOnly = graphConfiguration.getBoolean(Tokens.REXSTER_GRAPH_READ_ONLY, false);

    if (graphConfigurationType.equals("neo4jgraph")) {
      graphConfigurationType = Neo4jGraphConfiguration.class.getName();
    } else if (graphConfigurationType.equals("orientgraph")) {
      graphConfigurationType = OrientGraphConfiguration.class.getName();
    } else if (graphConfigurationType.equals("tinkergraph")) {
      graphConfigurationType = TinkerGraphGraphConfiguration.class.getName();
    } else if (graphConfigurationType.equals("rexstergraph")) {
      graphConfigurationType = RexsterGraphGraphConfiguration.class.getName();
    } else if (graphConfigurationType.equals("memorystoresailgraph")) {
      graphConfigurationType = MemoryStoreSailGraphConfiguration.class.getName();
    } else if (graphConfigurationType.equals("nativestoresailgraph")) {
      graphConfigurationType = NativeStoreSailGraphConfiguration.class.getName();
    } else if (graphConfigurationType.equals("sparqlrepositorysailgraph")) {
      graphConfigurationType = SparqlRepositorySailGraphConfiguration.class.getName();
    } else if (graphConfigurationType.equals("dexgraph")) {
      graphConfigurationType = DexGraphConfiguration.class.getName();
    }

    final Graph graph;
    try {
      final Class clazz =
          Class.forName(
              graphConfigurationType, true, Thread.currentThread().getContextClassLoader());
      final GraphConfiguration graphConfigInstance = (GraphConfiguration) clazz.newInstance();
      Graph readWriteGraph = graphConfigInstance.configureGraphInstance(graphConfiguration);

      if (isReadOnly) {
        // the graph is configured to be readonly so wrap it up
        if (readWriteGraph instanceof IndexableGraph) {
          graph = new ReadOnlyIndexableGraph((IndexableGraph) readWriteGraph);
        } else {
          graph = new ReadOnlyGraph(readWriteGraph);
        }
      } else {
        graph = readWriteGraph;
      }

    } catch (NoClassDefFoundError err) {
      throw new GraphConfigurationException(
          String.format(
              "GraphConfiguration [%s] could not instantiate a class [%s].  Ensure that it is in Rexster's path.",
              graphConfigurationType, err.getMessage()));
    } catch (Exception ex) {
      throw new GraphConfigurationException(
          String.format(
              "GraphConfiguration could not be found or otherwise instantiated: [%s]. Ensure that it is in Rexster's path.",
              graphConfigurationType),
          ex);
    }

    return graph;
  }
 @Override
 public void subscribe(int appId, String nodeName) throws RemoteException {
   Log.d(TAG, "subscribe for " + nodeName);
   mApplicationMap.get(appId).addSubscribedNodeNames(nodeName);
   mGraphConfig.subscribe(mApplicationMap.get(appId), nodeName);
   mNotification.showNotificationNow("Subscribed " + nodeName);
 }
 @Override
 public void unregister(int appId) throws RemoteException {
   synchronized (mApplicationMap) {
     Application removedApp = mApplicationMap.remove(appId);
     mGraphConfig.removeApplication(removedApp);
     mNotification.showNotificationNow("Unregistering application ID " + appId);
   }
 }