Package com.orientechnologies.orient.core.record.impl

Examples of com.orientechnologies.orient.core.record.impl.ODocument.toJSON()


    final ArrayList<ODocument> list = new ArrayList<ODocument>();
    newDoc.field("embeddedList", list, OType.EMBEDDEDLIST);
    list.add(new ODocument().field("name", "Luca"));
    list.add(new ODocument().field("name", "Marcus"));

    String json = newDoc.toJSON();
    ODocument loadedDoc = new ODocument().fromJSON(json);

    Assert.assertTrue(newDoc.hasSameContentOf(loadedDoc));

    Assert.assertTrue(loadedDoc.containsField("embeddedList"));
View Full Code Here


    ODocument newDoc = new ODocument();

    final Map<String, ODocument> map = new HashMap<String, ODocument>();
    newDoc.field("embeddedMap", map, OType.EMBEDDEDMAP);

    String json = newDoc.toJSON();
    ODocument loadedDoc = new ODocument().fromJSON(json);

    Assert.assertTrue(newDoc.hasSameContentOf(loadedDoc));

    Assert.assertTrue(loadedDoc.containsField("embeddedMap"));
View Full Code Here

    newDoc.field("map", map);
    map.put("Luca", new ODocument().field("name", "Luca"));
    map.put("Marcus", new ODocument().field("name", "Marcus"));
    map.put("Cesare", new ODocument().field("name", "Cesare"));

    String json = newDoc.toJSON();
    ODocument loadedDoc = new ODocument().fromJSON(json);

    Assert.assertTrue(newDoc.hasSameContentOf(loadedDoc));

    Assert.assertTrue(loadedDoc.containsField("map"));
View Full Code Here

    map1.put("map2", (HashMap<?, ?>) map2);

    final Map<String, HashMap<?, ?>> map3 = new HashMap<String, HashMap<?, ?>>();
    map2.put("map3", (HashMap<?, ?>) map3);

    String json = newDoc.toJSON();
    ODocument loadedDoc = new ODocument().fromJSON(json);

    Assert.assertTrue(newDoc.hasSameContentOf(loadedDoc));

    Assert.assertTrue(loadedDoc.containsField("map1"));
View Full Code Here

      out.println("\nTotal size: " + OFileUtils.getSizeAsString(stg.getSize()));

      if (stg instanceof OStorageRemoteThread) {
        final ODocument clusterConfig = ((OStorageRemoteThread) stg).getClusterConfiguration();
        if (clusterConfig != null)
          out.println("\nCluster configuration: " + clusterConfig.toJSON("indent:2"));
        else
          out.println("\nCluster configuration: none");
      } else if (stg instanceof OStorageLocal) {
        final OStorageLocal localStorage = (OStorageLocal) stg;
View Full Code Here

      // UPDATE IT
      clusterConfiguration.fromStream(iContent);

      if (OLogManager.instance().isInfoEnabled())
        OLogManager.instance().info(this, "Received new cluster configuration: %s", clusterConfiguration.toJSON(""));
    }
  }

  private void commitEntry(final OChannelBinaryClient iNetwork, final OTransactionRecordEntry txEntry) throws IOException {
    if (txEntry.status == OTransactionRecordEntry.LOADED)
View Full Code Here

      // UPDATE IT
      clusterConfiguration.fromStream(iContent);

      if (OLogManager.instance().isInfoEnabled())
        OLogManager.instance().info(this, "Received new cluster configuration: %s", clusterConfiguration.toJSON(""));
    }
  }

  private void commitEntry(final OChannelBinaryClient iNetwork, final OTransactionEntry txEntry) throws IOException {
    if (txEntry.status == OTransactionEntry.LOADED)
View Full Code Here

      data.commandInfo = "Update db configuration from server node leader";

      final ODocument config = (ODocument) new ODocument().fromStream(channel.readBytes());
      manager.getClusterConfiguration(connection.database.getName(), config);

      OLogManager.instance().warn(this, "Changed distributed server configuration:\n%s", config.toJSON("indent:2"));

      sendOk(lastClientTxId);
      break;
    }
View Full Code Here

      data.commandInfo = "Update db configuration from server node leader";

      final ODocument config = (ODocument) new ODocument().fromStream(channel.readBytes());
      manager.setClusterConfiguration(connection.database.getName(), config);

      OLogManager.instance().warn(this, "Changed distributed server configuration:\n%s", config.toJSON(""));

      channel.acquireExclusiveLock();
      try {
        sendOk(lastClientTxId);
      } finally {
View Full Code Here

      OStorage stg = currentDatabase.getStorage();
      if (stg instanceof OStorageRemoteThread) {
        final ODocument clusterConfig = ((OStorageRemoteThread) stg).getClusterConfiguration();
        if (clusterConfig != null)
          out.println("\nCluster configuration: " + clusterConfig.toJSON("indent:2"));
        else
          out.println("\nCluster configuration: none");
      }

      clusters();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.