public void writeRecords(final List<? extends OIdentifiable> resultSet, final int limit) { writeRecords(resultSet, limit, null); }
private void browseRecords(final OIdentifiableIterator<?> it) { final int limit = Integer.parseInt(properties.get("limit")); final OTableFormatter tableFormatter = new OTableFormatter(this).setMaxWidthSize(getConsoleWidth()) .setMaxMultiValueEntries(maxMultiValueEntries); setResultset(new ArrayList<OIdentifiable>()); while (it.hasNext() && currentResultSet.size() <= limit) currentResultSet.add(it.next()); tableFormatter.writeRecords(currentResultSet, limit); }
@ConsoleCommand(description = "List all the active connections to the server", onlineHelp = "Console-Command-List-Connections") public void listConnections() throws IOException { checkForRemoteServer(); OrientDBRemote remote = (OrientDBRemote) OrientDBInternal.extract(orientDB); final ODocument serverInfo = remote.getServerInfo(currentDatabaseUserName, currentDatabaseUserPassword); final List<OIdentifiable> resultSet = new ArrayList<OIdentifiable>(); final List<Map<String, Object>> connections = serverInfo.field("connections"); for (Map<String, Object> conn : connections) { final ODocument row = new ODocument(); String commandDetail = (String) conn.get("commandInfo"); if (commandDetail != null && ((String) conn.get("commandDetail")).length() > 1) commandDetail += " (" + conn.get("commandDetail") + ")"; row.fields("ID", conn.get("connectionId"), "REMOTE_ADDRESS", conn.get("remoteAddress"), "PROTOC", conn.get("protocol"), "LAST_OPERATION_ON", conn.get("lastCommandOn"), "DATABASE", conn.get("db"), "USER", conn.get("user"), "COMMAND", commandDetail, "TOT_REQS", conn.get("totalRequests")); resultSet.add(row); } Collections.sort(resultSet, new Comparator<OIdentifiable>() { @Override public int compare(final OIdentifiable o1, final OIdentifiable o2) { final String o1s = ((ODocument) o1).field("LAST_OPERATION_ON"); final String o2s = ((ODocument) o2).field("LAST_OPERATION_ON"); return o2s.compareTo(o1s); } }); final OTableFormatter formatter = new OTableFormatter(this); formatter.writeRecords(resultSet, -1); out.println(); }
@ConsoleCommand(description = "Return all configured properties") public void properties() { message("\nPROPERTIES:"); final List<ODocument> resultSet = new ArrayList<ODocument>(); for (Entry<String, String> p : properties.entrySet()) { final ODocument row = new ODocument(); resultSet.add(row); row.field("NAME", p.getKey()); row.field("VALUE", p.getValue()); } final OTableFormatter formatter = new OTableFormatter(this); formatter.writeRecords(resultSet, -1); message("\n"); }
protected void dumpResultSet(final int limit) { new OTableFormatter(this).setMaxWidthSize(getConsoleWidth()).setMaxMultiValueEntries(getMaxMultiValueEntries()) .writeRecords(currentResultSet, limit); }
@ConsoleCommand(description = "Return all the configuration values") public void config() throws IOException { if (orientDB != null && !OrientDBInternal.extract(orientDB).isEmbedded()) { final Map<String, String> values = ((OrientDBRemote) OrientDBInternal.extract(orientDB)) .getGlobalConfigurations(currentDatabaseUserName, currentDatabaseUserPassword); message("\nREMOTE SERVER CONFIGURATION"); final List<ODocument> resultSet = new ArrayList<ODocument>(); for (Entry<String, String> p : values.entrySet()) { final ODocument row = new ODocument(); resultSet.add(row); row.field("NAME", p.getKey()); row.field("VALUE", p.getValue()); } final OTableFormatter formatter = new OTableFormatter(this); formatter.writeRecords(resultSet, -1); } else { // LOCAL STORAGE message("\nLOCAL SERVER CONFIGURATION"); final List<ODocument> resultSet = new ArrayList<ODocument>(); for (OGlobalConfiguration cfg : OGlobalConfiguration.values()) { final ODocument row = new ODocument(); resultSet.add(row); row.field("NAME", cfg.getKey()); row.field("VALUE", (Object) cfg.getValue()); } final OTableFormatter formatter = new OTableFormatter(this); formatter.writeRecords(resultSet, -1); } message("\n"); }
formatter.writeRecords(resultSet, -1);
formatter.setFooter(footer); formatter.writeRecords(resultSet, -1);
formatter.writeRecords(resultSet, -1);
new OTableFormatter(this).setMaxWidthSize(getConsoleWidth()).writeRecords(servers, -1);
formatter.writeRecords(resultSet, -1); dbFormatter.writeRecords(dbResultSet, -1);
formatter.writeRecords(resultSet, -1); formatter.writeRecords(resultSet, -1);
formatter.writeRecords(resultSet, -1); formatter.writeRecords(resultSet, -1); formatter.writeRecords(resultSet, -1);
formatter.writeRecords(resultSet, -1);