public void deserializeGraph(Graph graph, JsonObject graphJson)
      throws UnsupportedEncodingException, IOException {
    try (InputStream is = new ByteArrayInputStream(graphJson.toString().getBytes("UTF-8"))) {

      GraphSONReader.inputGraph(graph, is);
    }
  }
  public Vertex deserializeVertex(Graph graph, JsonObject vertexJson) throws IOException {
    Vertex vertex;
    try {
      GraphElementFactory factory = new GraphElementFactory(graph);
      vertex = GraphSONUtility.vertexFromJson(vertexJson.toString(), factory, graphsonMode, null);
    } finally {
    }

    return vertex;
  }
 @Override
 public void handle(JsonObject message) {
   if (message.containsField("error")) {
     replyForError(message);
   }
   message.removeField(MessageUtils.FROM);
   message.removeField(MessageUtils.TO);
   message.removeField(MessageUtils.COMTYPE);
   message.removeField(MessageUtils.MSGID);
   message.removeField(MessageUtils.MSGTYPE);
   request.response().end(message.toString());
   cleanup(requestId);
 }
  public Edge deserializeEdge(Graph graph, Vertex inVertex, Vertex outVertex, JsonObject edgeJson)
      throws IOException {
    Edge edge;
    try {
      GraphElementFactory factory = new GraphElementFactory(graph);
      edge =
          GraphSONUtility.edgeFromJson(
              edgeJson.toString(), inVertex, outVertex, factory, graphsonMode, null);
    } finally {
    }

    return edge;
  }
Exemple #5
0
  @Override
  public void start(final Future<Void> startedResult) {
    logger = new DebloxLogger("Boot");
    config = this.getContainer().config();

    logger.info("config: " + config.toString());
    logger.info("main: " + config.getString("main"));

    container.deployVerticle(
        config.getString("main", "com.deblox.services.TransponderService"),
        config,
        new AsyncResultHandler<String>() {

          public void handle(AsyncResult<String> deployResult) {
            if (deployResult.succeeded()) {

              // service classes
              for (final Object service : config.getArray("services", new JsonArray())) {
                logger.info("deploying service: " + service);
                container.deployVerticle(
                    service.toString(),
                    config,
                    new AsyncResultHandler<String>() {

                      public void handle(AsyncResult<String> deployResult) {
                        if (deployResult.succeeded()) {
                          logger.info("deployed service: " + service);
                        } else {
                          logger.warning(
                              "deploy of service: " + service + " failed, " + deployResult.cause());
                        }
                      }
                    });
              }

              startedResult.setResult(null);

            } else {
              logger.warning("deploying module, " + deployResult.cause());
              startedResult.setFailure(deployResult.cause());
            }
          }
        });
  }