| | |
| | | INFO_JAVA_VERSION_LABEL.get() |
| | | }; |
| | | int labelWidth = 0; |
| | | Message title = INFO_SERVER_STATUS_TITLE.get(); |
| | | if (!isScriptFriendly()) |
| | | { |
| | | for (int i=0; i<labels.length; i++) |
| | | { |
| | | labelWidth = Math.max(labelWidth, labels[i].length()); |
| | | } |
| | | out.println(); |
| | | Message title = INFO_SERVER_STATUS_TITLE.get(); |
| | | out.println(centerTitle(title)); |
| | | } |
| | | writeStatusContents(desc, labelWidth); |
| | | writeCurrentConnectionContents(desc, labelWidth); |
| | | if (!isScriptFriendly()) |
| | | { |
| | | out.println(); |
| | | } |
| | | |
| | | title = INFO_SERVER_DETAILS_TITLE.get(); |
| | | if (!isScriptFriendly()) |
| | | { |
| | | out.println(centerTitle(title)); |
| | | } |
| | | writeHostnameContents(desc, labelWidth); |
| | | writeAdministrativeUserContents(desc, labelWidth); |
| | | writeInstallPathContents(desc, labelWidth); |
| | | writeVersionContents(desc, labelWidth); |
| | | writeJavaVersionContents(desc, labelWidth); |
| | | if (!isScriptFriendly()) |
| | | { |
| | | out.println(); |
| | | } |
| | | |
| | | writeListenerContents(desc); |
| | | if (!isScriptFriendly()) |
| | | { |
| | | out.println(); |
| | | } |
| | | |
| | | writeDatabaseContents(desc); |
| | | |
| | | writeErrorContents(desc); |
| | | |
| | | if (!isScriptFriendly()) |
| | | { |
| | | if (displayMustStartLegend) |
| | | { |
| | | out.println(); |
| | |
| | | out.println( |
| | | wrap(INFO_NOT_AVAILABLE_AUTHENTICATION_REQUIRED_CLI_LEGEND.get())); |
| | | } |
| | | } |
| | | out.println(); |
| | | } |
| | | |
| | |
| | | */ |
| | | private void writeListenerContents(ServerStatusDescriptor desc) |
| | | { |
| | | if (!isScriptFriendly()) |
| | | { |
| | | Message title = INFO_LISTENERS_TITLE.get(); |
| | | out.println(centerTitle(title)); |
| | | } |
| | | |
| | | Set<ListenerDescriptor> allListeners = desc.getListeners(); |
| | | |
| | |
| | | private void writeDatabaseContents(ServerStatusDescriptor desc) |
| | | { |
| | | Message title = INFO_DATABASES_TITLE.get(); |
| | | if (!isScriptFriendly()) |
| | | { |
| | | out.println(centerTitle(title)); |
| | | } |
| | | |
| | | Set<DatabaseDescriptor> databases = desc.getDatabases(); |
| | | |
| | |
| | | headerLine.append(" "); |
| | | } |
| | | } |
| | | if (!isScriptFriendly()) |
| | | { |
| | | out.println(wrap(headerLine.toMessage())); |
| | | MessageBuilder t = new MessageBuilder(); |
| | | for (int i=0; i<headerLine.length(); i++) |
| | |
| | | t.append("="); |
| | | } |
| | | out.println(wrap(t.toMessage())); |
| | | } |
| | | |
| | | for (int i=0; i<tableModel.getRowCount(); i++) |
| | | { |
| | | if (isScriptFriendly()) |
| | | { |
| | | out.println("-"); |
| | | } |
| | | MessageBuilder line = new MessageBuilder(); |
| | | for (int j=0; j<tableModel.getColumnCount(); j++) |
| | | { |
| | | if (isScriptFriendly()) |
| | | { |
| | | line.append(tableModel.getColumnName(j)+": "); |
| | | } |
| | | int extra = maxWidths[j]; |
| | | Object v = tableModel.getValueAt(i, j); |
| | | if (v != null) |
| | |
| | | { |
| | | throw new IllegalStateException("Unknown object type: "+v); |
| | | } |
| | | |
| | | if (isScriptFriendly()) |
| | | { |
| | | out.println(wrap(line.toMessage())); |
| | | line = new MessageBuilder(); |
| | | } |
| | | } |
| | | if (!isScriptFriendly()) |
| | | { |
| | | for (int k=0; k<extra; k++) |
| | | { |
| | | line.append(" "); |
| | | } |
| | | } |
| | | } |
| | | if (!isScriptFriendly()) |
| | | { |
| | | out.println(wrap(line.toMessage())); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Writes the contents of the provided database table model. Every base DN |
| | |
| | | Message replicatedLabel = INFO_BASEDN_REPLICATED_LABEL.get(); |
| | | for (int i=0; i<tableModel.getRowCount(); i++) |
| | | { |
| | | if (i > 0) |
| | | if (isScriptFriendly()) |
| | | { |
| | | out.println("-"); |
| | | } |
| | | else if (i > 0) |
| | | { |
| | | out.println(); |
| | | } |
| | |
| | | { |
| | | return argParser.getTrustManager(); |
| | | } |
| | | |
| | | /** |
| | | * Tells whether the user specified to have a script-friendly output or not. |
| | | * This method must be called after calling parseArguments. |
| | | * @return <CODE>true</CODE> if the user specified to have a script-friendly |
| | | * output and <CODE>false</CODE> otherwise. |
| | | */ |
| | | private boolean isScriptFriendly() |
| | | { |
| | | return argParser.isScriptFriendly(); |
| | | } |
| | | } |