distributed/src/main/java/com/orientechnologies/orient/server/distributed/sql/OCommandExecutorSQLHAStatus.java
public Object execute(final Map<Object, Object> iArgs) {
    final ODatabaseDocumentInternal database = getDatabase();
    database.checkSecurity(ORule.ResourceGeneric.SERVER, "status", ORole.PERMISSION_READ);

    if (!(database instanceof ODatabaseDocumentDistributed)) {
      throw new OCommandExecutionException("OrientDB is not started in distributed mode");
    }

    final OHazelcastPlugin dManager = (OHazelcastPlugin) ((ODatabaseDocumentDistributed) database).getDistributedManager();
    if (dManager == null || !dManager.isEnabled())
      throw new OCommandExecutionException("OrientDB is not started in distributed mode");

    final String databaseName = database.getName();

    final ODistributedConfiguration cfg = dManager.getDatabaseConfiguration(databaseName);

    if (parsedStatement.outputText) {
      final StringBuilder output = new StringBuilder();
      if (parsedStatement.servers)
        output.append(ODistributedOutput.formatServerStatus(dManager, dManager.getClusterConfiguration()));
      if (parsedStatement.db)
        output.append(ODistributedOutput.formatClusterTable(dManager, databaseName, cfg, dManager.getTotalNodes(databaseName)));
      if (parsedStatement.latency)
        output.append(ODistributedOutput.formatLatency(dManager, dManager.getClusterConfiguration()));
      if (parsedStatement.messages)
        output.append(ODistributedOutput.formatMessages(dManager, dManager.getClusterConfiguration()));
      return output.toString();
    }

    final ODocument output = new ODocument();
    if (parsedStatement.servers)
      output.field("servers", dManager.getClusterConfiguration(), OType.EMBEDDED);
    if (parsedStatement.db)
      output.field("database", cfg.getDocument(), OType.EMBEDDED);

    return output;
  }
public Object execute(final Map<Object, Object> iArgs) {
    final ODatabaseDocumentInternal database = getDatabase();
    database.checkSecurity(ORule.ResourceGeneric.SERVER, "status", ORole.PERMISSION_READ);

    if (!(database instanceof ODatabaseDocumentDistributed)) {
      throw new OCommandExecutionException("OrientDB is not started in distributed mode");
    }

    final OHazelcastPlugin dManager = (OHazelcastPlugin) ((ODatabaseDocumentDistributed) database).getDistributedManager();
    if (dManager == null || !dManager.isEnabled())
      throw new OCommandExecutionException("OrientDB is not started in distributed mode");

    final String databaseName = database.getName();

    final ODistributedConfiguration cfg = dManager.getDatabaseConfiguration(databaseName);

    if (parsedStatement.outputText) {
      final StringBuilder output = new StringBuilder();
      if (parsedStatement.servers)
        output.append(ODistributedOutput.formatServerStatus(dManager, dManager.getClusterConfiguration()));
      if (parsedStatement.db)
        output.append(ODistributedOutput.formatClusterTable(dManager, databaseName, cfg, dManager.getTotalNodes(databaseName)));
      if (parsedStatement.latency)
        output.append(ODistributedOutput.formatLatency(dManager, dManager.getClusterConfiguration()));
      if (parsedStatement.messages)
        output.append(ODistributedOutput.formatMessages(dManager, dManager.getClusterConfiguration()));
      return output.toString();
    }

    final ODocument output = new ODocument();
    if (parsedStatement.servers)
      output.field("servers", dManager.getClusterConfiguration(), OType.EMBEDDED);
    if (parsedStatement.db)
      output.field("database", cfg.getDocument(), OType.EMBEDDED);

    return output;
  }
Execute the command.