opends/src/server/org/opends/server/admin/client/cli/DsFrameworkCliMain.java
@@ -130,25 +130,8 @@ public static int mainCLI(String[] args, boolean initializeServer, OutputStream outStream, OutputStream errStream) { PrintStream out; if (outStream == null) { out = NullOutputStream.printStream(); } else { out = new PrintStream(outStream); } PrintStream err; if (errStream == null) { err = NullOutputStream.printStream(); } else { err = new PrintStream(errStream); } PrintStream out = NullOutputStream.wrapOrNullStream(outStream); PrintStream err = NullOutputStream.wrapOrNullStream(errStream); DsFrameworkCliMain dsFrameworkCli = new DsFrameworkCliMain(out, err); return dsFrameworkCli.execute(args,initializeServer); opends/src/server/org/opends/server/tools/BackUpDB.java
@@ -26,9 +26,6 @@ * Portions copyright 2013 ForgeRock AS. */ package org.opends.server.tools; import org.opends.messages.Message; import java.io.File; import java.io.OutputStream; @@ -41,39 +38,45 @@ import java.util.List; import java.util.TimeZone; import org.opends.messages.Message; import org.opends.server.admin.std.server.BackendCfg; import org.opends.server.api.Backend; import org.opends.server.api.ErrorLogPublisher; import org.opends.server.api.DebugLogPublisher; import org.opends.server.api.ErrorLogPublisher; import org.opends.server.config.ConfigException; import static org.opends.server.config.ConfigConstants.*; import org.opends.server.core.CoreConfigManager; import org.opends.server.core.DirectoryServer; import org.opends.server.core.LockFileManager; import org.opends.server.extensions.ConfigFileHandler; import org.opends.server.loggers.TextWriter; import org.opends.server.loggers.TextErrorLogPublisher; import org.opends.server.loggers.ErrorLogger; import org.opends.server.loggers.debug.TextDebugLogPublisher; import org.opends.server.loggers.TextErrorLogPublisher; import org.opends.server.loggers.TextWriter; import org.opends.server.loggers.debug.DebugLogger; import static org.opends.server.loggers.ErrorLogger.*; import org.opends.server.types.*; import org.opends.server.loggers.debug.TextDebugLogPublisher; import org.opends.server.protocols.ldap.LDAPAttribute; import org.opends.server.tasks.BackupTask; import org.opends.server.tools.tasks.TaskTool; import org.opends.server.types.BackupConfig; import org.opends.server.types.BackupDirectory; import org.opends.server.types.ByteString; import org.opends.server.types.DN; import org.opends.server.types.DirectoryException; import org.opends.server.types.InitializationException; import org.opends.server.types.NullOutputStream; import org.opends.server.types.RawAttribute; import org.opends.server.util.BuildVersion; import org.opends.server.util.args.ArgumentException; import org.opends.server.util.args.BooleanArgument; import org.opends.server.util.args.StringArgument; import org.opends.server.util.args.LDAPConnectionArgumentParser; import org.opends.server.util.args.StringArgument; import org.opends.server.util.cli.CLIException; import static org.opends.messages.ToolMessages.*; import static org.opends.server.config.ConfigConstants.*; import static org.opends.server.loggers.ErrorLogger.*; import static org.opends.server.tools.ToolConstants.*; import static org.opends.server.util.ServerConstants.*; import static org.opends.server.util.StaticUtils.*; import static org.opends.server.tools.ToolConstants.*; import org.opends.server.tools.tasks.TaskTool; import org.opends.server.admin.std.server.BackendCfg; import org.opends.server.tasks.BackupTask; import org.opends.server.protocols.ldap.LDAPAttribute; /** * This program provides a utility that may be used to back up a Directory @@ -150,25 +153,8 @@ private int process(String[] args, boolean initializeServer, OutputStream outStream, OutputStream errStream) { PrintStream out; if (outStream == null) { out = NullOutputStream.printStream(); } else { out = new PrintStream(outStream); } PrintStream err; if (errStream == null) { err = NullOutputStream.printStream(); } else { err = new PrintStream(errStream); } PrintStream out = NullOutputStream.wrapOrNullStream(outStream); PrintStream err = NullOutputStream.wrapOrNullStream(errStream); // Create the command-line argument parser for use with this program. LDAPConnectionArgumentParser argParser = @@ -447,6 +433,7 @@ /** * {@inheritDoc} */ @Override public void addTaskAttributes(List<RawAttribute> attributes) { ArrayList<ByteString> values; @@ -546,6 +533,7 @@ /** * {@inheritDoc} */ @Override public String getTaskObjectclass() { return "ds-task-backup"; } @@ -553,6 +541,7 @@ /** * {@inheritDoc} */ @Override public Class<?> getTaskClass() { return BackupTask.class; } @@ -560,6 +549,7 @@ /** * {@inheritDoc} */ @Override protected int processLocal(boolean initializeServer, PrintStream out, PrintStream err) { @@ -1137,6 +1127,7 @@ /** * {@inheritDoc} */ @Override public String getTaskId() { if (backupIDString != null) { return backupIDString.getValue(); opends/src/server/org/opends/server/tools/ConfigureDS.java
@@ -23,12 +23,9 @@ * * * Copyright 2006-2009 Sun Microsystems, Inc. * Portions copyright 2012 ForgeRock AS. * Portions copyright 2012-2013 ForgeRock AS. */ package org.opends.server.tools; import org.opends.messages.Message; import java.net.InetAddress; import java.security.GeneralSecurityException; @@ -43,6 +40,7 @@ import javax.crypto.Cipher; import org.opends.messages.Message; import org.opends.server.admin.DefaultBehaviorProvider; import org.opends.server.admin.DefinedDefaultBehaviorProvider; import org.opends.server.admin.StringPropertyDefinition; @@ -83,8 +81,6 @@ import static org.opends.server.util.StaticUtils.*; import static org.opends.server.tools.ToolConstants.*; /** * This class provides a very basic tool that can be used to configure some of * the most important settings in the Directory Server. This configuration is @@ -211,19 +207,9 @@ StringArgument certNickName; StringArgument keyManagerPath; StringArgument serverRoot; PrintStream out, err; PrintStream out = NullOutputStream.wrapOrNullStream(outStream); PrintStream err = NullOutputStream.wrapOrNullStream(errStream); if (outStream != null) { out = new PrintStream(outStream); } else { out = NullOutputStream.printStream(); } if (errStream != null) { err = new PrintStream(errStream); } else { err = NullOutputStream.printStream(); } Message toolDescription = INFO_CONFIGDS_TOOL_DESCRIPTION.get(); ArgumentParser argParser = new ArgumentParser(CLASS_NAME, toolDescription, false); opends/src/server/org/opends/server/tools/ConfigureWindowsService.java
@@ -196,25 +196,8 @@ OutputStream outStream, OutputStream errStream) { int returnValue = 0; PrintStream out; if (outStream == null) { out = NullOutputStream.printStream(); } else { out = new PrintStream(outStream); } PrintStream err; if (errStream == null) { err = NullOutputStream.printStream(); } else { err = new PrintStream(errStream); } PrintStream out = NullOutputStream.wrapOrNullStream(outStream); PrintStream err = NullOutputStream.wrapOrNullStream(errStream); // Define all the arguments that may be used with this program. Message toolDescription = opends/src/server/org/opends/server/tools/CreateRCScript.java
@@ -97,15 +97,7 @@ public static int main(String[] args, OutputStream outStream, OutputStream errStream) { PrintStream err; if (errStream == null) { err = NullOutputStream.printStream(); } else { err = new PrintStream(errStream); } PrintStream err = NullOutputStream.wrapOrNullStream(errStream); EmbeddedUtils.initializeForClientUse(); opends/src/server/org/opends/server/tools/DBTest.java
@@ -27,38 +27,32 @@ */ package org.opends.server.tools; import org.opends.server.loggers.debug.DebugTracer; import static org.opends.server.loggers.debug.DebugLogger.getTracer; import static org.opends.server.loggers.debug.DebugLogger.debugEnabled; import static org.opends.messages.ToolMessages.*; import static org.opends.server.loggers.debug.DebugLogger.*; import static org.opends.server.tools.ToolConstants.*; import static org.opends.server.util.ServerConstants.*; import static org.opends.server.util.StaticUtils.*; import org.opends.server.util.args.*; import static org.opends.server.util.ServerConstants.MAX_LINE_WIDTH; import org.opends.server.util.BuildVersion; import org.opends.server.util.StaticUtils; import org.opends.server.util.table.TableBuilder; import org.opends.server.util.table.TextTablePrinter; import org.opends.server.types.*; import static org.opends.messages.ToolMessages.*; import org.opends.messages.Message; import static org.opends.server.tools.ToolConstants.OPTION_SHORT_CONFIG_CLASS; import static org.opends.server.tools.ToolConstants.OPTION_LONG_CONFIG_CLASS; import static org.opends.server.tools.ToolConstants.OPTION_SHORT_HELP; import static org.opends.server.tools.ToolConstants.OPTION_LONG_HELP; import org.opends.server.extensions.ConfigFileHandler; import org.opends.server.core.DirectoryServer; import org.opends.server.core.LockFileManager; import org.opends.server.core.CoreConfigManager; import org.opends.server.config.ConfigException; import org.opends.server.api.Backend; import org.opends.server.admin.std.server.BackendCfg; import org.opends.server.admin.std.server.LocalDBBackendCfg; import org.opends.server.api.Backend; import org.opends.server.backends.jeb.*; import org.opends.server.config.ConfigException; import org.opends.server.core.CoreConfigManager; import org.opends.server.core.DirectoryServer; import org.opends.server.core.LockFileManager; import org.opends.server.extensions.ConfigFileHandler; import org.opends.server.loggers.debug.DebugTracer; import org.opends.server.types.*; import org.opends.server.util.BuildVersion; import org.opends.server.util.StaticUtils; import org.opends.server.util.args.*; import org.opends.server.util.table.TableBuilder; import org.opends.server.util.table.TextTablePrinter; import java.io.*; import java.io.OutputStream; import java.io.PrintStream; import java.util.*; import com.sleepycat.je.*; @@ -77,30 +71,34 @@ */ private static final DebugTracer TRACER = getTracer(); // The error stream which this application should use. /** The error stream which this application should use. */ private final PrintStream err; // The output stream which this application should use. /** The output stream which this application should use. */ private final PrintStream out; // Flag indicating whether or not the global arguments have // already been initialized. /** * Flag indicating whether or not the global arguments have already been * initialized. */ private boolean globalArgumentsInitialized = false; // The command-line argument parser. /** The command-line argument parser. */ private final SubCommandArgumentParser parser; // The argument which should be used to request usage information. /** The argument which should be used to request usage information. */ private BooleanArgument showUsageArgument; // The argument which should be used to specify the config class. /** The argument which should be used to specify the config class. */ private StringArgument configClass; // THe argument which should be used to specify the config file. /** THe argument which should be used to specify the config file. */ private StringArgument configFile; // Flag indicating whether or not the sub-commands have // already been initialized. /** * Flag indicating whether or not the sub-commands have already been * initialized. */ private boolean subCommandsInitialized = false; @@ -157,17 +155,8 @@ */ public DBTest(OutputStream out, OutputStream err) { if (out != null) { this.out = new PrintStream(out); } else { this.out = NullOutputStream.printStream(); } if (err != null) { this.err = new PrintStream(err); } else { this.err = NullOutputStream.printStream(); } this.out = NullOutputStream.wrapOrNullStream(out); this.err = NullOutputStream.wrapOrNullStream(err); Message toolDescription = INFO_DESCRIPTION_DBTEST_TOOL.get(); this.parser = new SubCommandArgumentParser(this.getClass().getName(), opends/src/server/org/opends/server/tools/EncodePassword.java
@@ -135,25 +135,8 @@ OutputStream outStream, OutputStream errStream) { PrintStream out; if (outStream == null) { out = NullOutputStream.printStream(); } else { out = new PrintStream(outStream); } PrintStream err; if (errStream == null) { err = NullOutputStream.printStream(); } else { err = new PrintStream(errStream); } PrintStream out = NullOutputStream.wrapOrNullStream(outStream); PrintStream err = NullOutputStream.wrapOrNullStream(errStream); // Define the command-line arguments that may be used with this program. BooleanArgument authPasswordSyntax = null; opends/src/server/org/opends/server/tools/ExportLDIF.java
@@ -148,25 +148,8 @@ private int process(String[] args, boolean initializeServer, OutputStream outStream, OutputStream errStream) { PrintStream out; if (outStream == null) { out = NullOutputStream.printStream(); } else { out = new PrintStream(outStream); } PrintStream err; if (errStream == null) { err = NullOutputStream.printStream(); } else { err = new PrintStream(errStream); } PrintStream out = NullOutputStream.wrapOrNullStream(outStream); PrintStream err = NullOutputStream.wrapOrNullStream(errStream); // Create the command-line argument parser for use with this program. LDAPConnectionArgumentParser argParser = opends/src/server/org/opends/server/tools/ImportLDIF.java
@@ -177,25 +177,8 @@ private int process(String[] args, boolean initializeServer, OutputStream outStream, OutputStream errStream) { PrintStream out; if (outStream == null) { out = NullOutputStream.printStream(); } else { out = new PrintStream(outStream); } PrintStream err; if (errStream == null) { err = NullOutputStream.printStream(); } else { err = new PrintStream(errStream); } PrintStream out = NullOutputStream.wrapOrNullStream(outStream); PrintStream err = NullOutputStream.wrapOrNullStream(errStream); // FIXME -- Need to add a mechanism for verifying the file signature. opends/src/server/org/opends/server/tools/JavaPropertiesTool.java
@@ -174,27 +174,11 @@ public static int mainCLI(String[] args, OutputStream outStream, OutputStream errStream, InputStream inStream) { PrintStream out; if (outStream == null) { out = NullOutputStream.printStream(); } else { out = new PrintStream(outStream); } PrintStream out = NullOutputStream.wrapOrNullStream(outStream); System.setProperty(Constants.CLI_JAVA_PROPERTY, "true"); PrintStream err; if (errStream == null) { err = NullOutputStream.printStream(); } else { err = new PrintStream(errStream); } PrintStream err = NullOutputStream.wrapOrNullStream(errStream); JavaPropertiesTool tool = new JavaPropertiesTool(out, err, inStream); opends/src/server/org/opends/server/tools/LDAPCompare.java
@@ -368,26 +368,8 @@ public static int mainCompare(String[] args, boolean initializeServer, OutputStream outStream, OutputStream errStream) { PrintStream out; if (outStream == null) { out = NullOutputStream.printStream(); } else { out = new PrintStream(outStream); } PrintStream err; if (errStream == null) { err = NullOutputStream.printStream(); } else { err = new PrintStream(errStream); } PrintStream out = NullOutputStream.wrapOrNullStream(outStream); PrintStream err = NullOutputStream.wrapOrNullStream(errStream); LDAPConnectionOptions connectionOptions = new LDAPConnectionOptions(); LDAPCompareOptions compareOptions = new LDAPCompareOptions(); opends/src/server/org/opends/server/tools/LDAPDelete.java
@@ -23,7 +23,7 @@ * * * Copyright 2006-2010 Sun Microsystems, Inc. * Portions Copyright 2012 ForgeRock AS. * Portions Copyright 2012-2013 ForgeRock AS. */ package org.opends.server.tools; import org.opends.admin.ads.util.ConnectionUtils; @@ -293,25 +293,8 @@ public static int mainDelete(String[] args, boolean initializeServer, OutputStream outStream, OutputStream errStream) { PrintStream out; if (outStream == null) { out = NullOutputStream.printStream(); } else { out = new PrintStream(outStream); } PrintStream err; if (errStream == null) { err = NullOutputStream.printStream(); } else { err = new PrintStream(errStream); } PrintStream out = NullOutputStream.wrapOrNullStream(outStream); PrintStream err = NullOutputStream.wrapOrNullStream(errStream); LDAPConnectionOptions connectionOptions = new LDAPConnectionOptions(); opends/src/server/org/opends/server/tools/LDAPModify.java
@@ -600,26 +600,8 @@ public static int mainModify(String[] args, boolean initializeServer, OutputStream outStream, OutputStream errStream) { PrintStream out; if (outStream == null) { out = NullOutputStream.printStream(); } else { out = new PrintStream(outStream); } PrintStream err; if (errStream == null) { err = NullOutputStream.printStream(); } else { err = new PrintStream(errStream); } PrintStream out = NullOutputStream.wrapOrNullStream(outStream); PrintStream err = NullOutputStream.wrapOrNullStream(errStream); LDAPConnectionOptions connectionOptions = new LDAPConnectionOptions(); LDAPModifyOptions modifyOptions = new LDAPModifyOptions(); opends/src/server/org/opends/server/tools/LDAPPasswordModify.java
@@ -23,12 +23,9 @@ * * * Copyright 2006-2010 Sun Microsystems, Inc. * Portions Copyright 2013 ForgeRock AS */ package org.opends.server.tools; import org.opends.admin.ads.util.ConnectionUtils; import org.opends.messages.Message; import java.io.OutputStream; import java.io.PrintStream; @@ -36,6 +33,8 @@ import java.util.List; import java.util.concurrent.atomic.AtomicInteger; import org.opends.admin.ads.util.ConnectionUtils; import org.opends.messages.Message; import org.opends.server.controls.PasswordPolicyErrorType; import org.opends.server.controls.PasswordPolicyResponseControl; import org.opends.server.controls.PasswordPolicyWarningType; @@ -62,8 +61,6 @@ import static org.opends.server.tools.ToolConstants.*; import static org.opends.server.protocols.ldap.LDAPResultCode.*; /** * This program provides a utility that uses the LDAP password modify extended * operation to change the password for a user. It exposes the three primary @@ -72,7 +69,7 @@ * <UL> * <LI>The user identity whose password should be changed.</LI> * <LI>The current password for the user.</LI> * <LI>The new password for the user. * <LI>The new password for the user.</LI> * </UL> * * All of these are optional components that may be included or omitted from the @@ -142,25 +139,8 @@ OutputStream outStream, OutputStream errStream) { PrintStream out; if (outStream == null) { out = NullOutputStream.printStream(); } else { out = new PrintStream(outStream); } PrintStream err; if (errStream == null) { err = NullOutputStream.printStream(); } else { err = new PrintStream(errStream); } PrintStream out = NullOutputStream.wrapOrNullStream(outStream); PrintStream err = NullOutputStream.wrapOrNullStream(errStream); // Create the arguments that will be used by this program. opends/src/server/org/opends/server/tools/LDAPSearch.java
@@ -23,11 +23,9 @@ * * * Copyright 2006-2010 Sun Microsystems, Inc. * Portions Copyright 2012 ForgeRock AS. * Portions Copyright 2012-2013 ForgeRock AS */ package org.opends.server.tools; import org.opends.admin.ads.util.ConnectionUtils; import org.opends.messages.Message; import java.io.BufferedReader; import java.io.FileReader; @@ -37,7 +35,10 @@ import java.util.*; import java.util.concurrent.atomic.AtomicInteger; import org.opends.admin.ads.util.ConnectionUtils; import org.opends.messages.Message; import org.opends.server.controls.*; import org.opends.server.loggers.debug.DebugTracer; import org.opends.server.protocols.ldap.*; import org.opends.server.util.Base64; import org.opends.server.util.EmbeddedUtils; @@ -53,7 +54,6 @@ import org.opends.server.types.*; import static org.opends.server.loggers.debug.DebugLogger.*; import org.opends.server.loggers.debug.DebugTracer; import static org.opends.messages.ToolMessages.*; import static org.opends.server.protocols.ldap.LDAPConstants.*; import static org.opends.server.protocols.ldap.LDAPResultCode.*; @@ -61,7 +61,6 @@ import static org.opends.server.util.StaticUtils.*; import static org.opends.server.tools.ToolConstants.*; /** * This class provides a tool that can be used to issue search requests to the * Directory Server. @@ -645,25 +644,8 @@ boolean returnMatchingEntries, OutputStream outStream, OutputStream errStream) { PrintStream out; if (outStream == null) { out = NullOutputStream.printStream(); } else { out = new PrintStream(outStream); } PrintStream err; if (errStream == null) { err = NullOutputStream.printStream(); } else { err = new PrintStream(errStream); } PrintStream out = NullOutputStream.wrapOrNullStream(outStream); PrintStream err = NullOutputStream.wrapOrNullStream(errStream); LDAPConnectionOptions connectionOptions = new LDAPConnectionOptions(); LDAPSearchOptions searchOptions = new LDAPSearchOptions(); opends/src/server/org/opends/server/tools/LDIFDiff.java
@@ -145,25 +145,8 @@ public static int mainDiff(String[] args, boolean serverInitialized, OutputStream outStream, OutputStream errStream) { PrintStream out; if (outStream == null) { out = NullOutputStream.printStream(); } else { out = new PrintStream(outStream); } PrintStream err; if (errStream == null) { err = NullOutputStream.printStream(); } else { err = new PrintStream(errStream); } PrintStream out = NullOutputStream.wrapOrNullStream(outStream); PrintStream err = NullOutputStream.wrapOrNullStream(errStream); BooleanArgument overwriteExisting; BooleanArgument showUsage; opends/src/server/org/opends/server/tools/LDIFModify.java
@@ -26,9 +26,6 @@ * Portions Copyright 2012-2013 ForgeRock AS */ package org.opends.server.tools; import org.opends.messages.Message; import java.io.File; import java.io.IOException; @@ -41,14 +38,15 @@ import java.util.Map; import java.util.TreeMap; import org.opends.messages.Message; import org.opends.server.core.DirectoryServer; import org.opends.server.extensions.ConfigFileHandler; import org.opends.server.protocols.ldap.LDAPResultCode; import org.opends.server.types.Attribute; import org.opends.server.types.AttributeType; import org.opends.server.types.AttributeValue; import org.opends.server.types.DirectoryException; import org.opends.server.types.DN; import org.opends.server.types.DirectoryException; import org.opends.server.types.Entry; import org.opends.server.types.ExistingFileBehavior; import org.opends.server.types.InitializationException; @@ -73,11 +71,9 @@ import org.opends.server.util.args.StringArgument; import static org.opends.messages.ToolMessages.*; import static org.opends.server.util.ServerConstants.MAX_LINE_WIDTH; import static org.opends.server.util.StaticUtils.*; import static org.opends.server.tools.ToolConstants.*; import static org.opends.server.util.ServerConstants.*; import static org.opends.server.util.StaticUtils.*; /** * This class provides a program that may be used to apply a set of changes (in @@ -433,15 +429,7 @@ OutputStream outStream, OutputStream errStream) { PrintStream err; if (errStream == null) { err = NullOutputStream.printStream(); } else { err = new PrintStream(errStream); } PrintStream err = NullOutputStream.wrapOrNullStream(errStream); // Prepare the argument parser. BooleanArgument showUsage; opends/src/server/org/opends/server/tools/LDIFSearch.java
@@ -26,10 +26,6 @@ * Portions copyright 2013 ForgeRock AS */ package org.opends.server.tools; import org.opends.messages.Message; import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; @@ -40,6 +36,7 @@ import java.util.LinkedHashSet; import java.util.LinkedList; import org.opends.messages.Message; import org.opends.server.core.DirectoryServer; import org.opends.server.extensions.ConfigFileHandler; import org.opends.server.protocols.ldap.LDAPResultCode; @@ -66,9 +63,9 @@ import org.opends.server.util.args.StringArgument; import static org.opends.messages.ToolMessages.*; import static org.opends.server.util.ServerConstants.MAX_LINE_WIDTH; import static org.opends.server.util.StaticUtils.*; import static org.opends.server.tools.ToolConstants.*; import static org.opends.server.util.ServerConstants.*; import static org.opends.server.util.StaticUtils.*; @@ -153,25 +150,8 @@ public static int mainSearch(String[] args, boolean initializeServer, OutputStream outStream, OutputStream errStream) { PrintStream out; if (outStream == null) { out = NullOutputStream.printStream(); } else { out = new PrintStream(outStream); } PrintStream err; if (errStream == null) { err = NullOutputStream.printStream(); } else { err = new PrintStream(errStream); } PrintStream out = NullOutputStream.wrapOrNullStream(outStream); PrintStream err = NullOutputStream.wrapOrNullStream(errStream); LinkedHashSet<String> scopeStrings = new LinkedHashSet<String>(4); scopeStrings.add(SCOPE_STRING_BASE); opends/src/server/org/opends/server/tools/ListBackends.java
@@ -123,25 +123,8 @@ public static int listBackends(String[] args, boolean initializeServer, OutputStream outStream, OutputStream errStream) { PrintStream out; if (outStream == null) { out = NullOutputStream.printStream(); } else { out = new PrintStream(outStream); } PrintStream err; if (errStream == null) { err = NullOutputStream.printStream(); } else { err = new PrintStream(errStream); } PrintStream out = NullOutputStream.wrapOrNullStream(outStream); PrintStream err = NullOutputStream.wrapOrNullStream(errStream); // Define the command-line arguments that may be used with this program. BooleanArgument displayUsage = null; opends/src/server/org/opends/server/tools/ManageAccount.java
@@ -24,12 +24,9 @@ * * * Copyright 2006-2009 Sun Microsystems, Inc. * Portions Copyright 2011-2012 ForgeRock AS * Portions Copyright 2011-2013 ForgeRock AS */ package org.opends.server.tools; import org.opends.messages.Message; import java.io.OutputStream; import java.io.PrintStream; @@ -41,6 +38,7 @@ import javax.net.ssl.SSLException; import org.opends.messages.Message; import org.opends.server.admin.AdministrationConnector; import org.opends.server.protocols.asn1.*; import org.opends.server.protocols.ldap.ExtendedRequestProtocolOp; @@ -537,27 +535,8 @@ public static int main(String[] args, Boolean initServer, OutputStream outStream, OutputStream errStream) { if (outStream == null) { out = NullOutputStream.printStream(); } else { out = new PrintStream(outStream); } if (errStream == null) { err = NullOutputStream.printStream(); } else { err = new PrintStream(errStream); } out = NullOutputStream.wrapOrNullStream(outStream); err = NullOutputStream.wrapOrNullStream(errStream); // Parse the command-line arguments provided to the program. int result = parseArgsAndConnect(args, initServer); opends/src/server/org/opends/server/tools/RebuildIndex.java
@@ -128,25 +128,8 @@ private int process(String[] args, boolean initializeServer, OutputStream outStream, OutputStream errStream) { PrintStream out; if (outStream == null) { out = NullOutputStream.printStream(); } else { out = new PrintStream(outStream); } PrintStream err; if (errStream == null) { err = NullOutputStream.printStream(); } else { err = new PrintStream(errStream); } PrintStream out = NullOutputStream.wrapOrNullStream(outStream); PrintStream err = NullOutputStream.wrapOrNullStream(errStream); // Define the command-line arguments that may be used with this program. BooleanArgument displayUsage ; opends/src/server/org/opends/server/tools/RestoreDB.java
@@ -142,25 +142,8 @@ private int process(String[] args, boolean initializeServer, OutputStream outStream, OutputStream errStream) { PrintStream out; if (outStream == null) { out = NullOutputStream.printStream(); } else { out = new PrintStream(outStream); } PrintStream err; if (errStream == null) { err = NullOutputStream.printStream(); } else { err = new PrintStream(errStream); } PrintStream out = NullOutputStream.wrapOrNullStream(outStream); PrintStream err = NullOutputStream.wrapOrNullStream(errStream); // Create the command-line argument parser for use with this program. LDAPConnectionArgumentParser argParser = opends/src/server/org/opends/server/tools/StartWindowsService.java
@@ -85,25 +85,8 @@ OutputStream errStream) { int returnValue; PrintStream out; if (outStream == null) { out = NullOutputStream.printStream(); } else { out = new PrintStream(outStream); } PrintStream err; if (errStream == null) { err = NullOutputStream.printStream(); } else { err = new PrintStream(errStream); } PrintStream out = NullOutputStream.wrapOrNullStream(outStream); PrintStream err = NullOutputStream.wrapOrNullStream(errStream); String serviceName = ConfigureWindowsService.getServiceName(); if (serviceName == null) opends/src/server/org/opends/server/tools/StopDS.java
@@ -23,12 +23,9 @@ * * * Copyright 2006-2010 Sun Microsystems, Inc. * Portions Copyright 2011 ForgeRock AS * Portions Copyright 2011-2013 ForgeRock AS */ package org.opends.server.tools; import org.opends.messages.Message; import java.io.IOException; import java.io.OutputStream; @@ -40,8 +37,9 @@ import java.util.TimeZone; import java.util.UUID; import java.util.concurrent.atomic.AtomicInteger; import javax.net.ssl.SSLException; import org.opends.messages.Message; import org.opends.server.admin.AdministrationConnector; import org.opends.server.controls.ProxiedAuthV2Control; import org.opends.server.core.DirectoryServer; @@ -72,8 +70,6 @@ import static org.opends.server.util.StaticUtils.*; import static org.opends.server.tools.ToolConstants.*; /** * This class provides a tool that can send a request to the Directory Server * that will cause it to shut down. @@ -182,25 +178,8 @@ public static int stopDS(String[] args, OutputStream outStream, OutputStream errStream) { PrintStream out; if (outStream == null) { out = NullOutputStream.printStream(); } else { out = new PrintStream(outStream); } PrintStream err; if (errStream == null) { err = NullOutputStream.printStream(); } else { err = new PrintStream(errStream); } PrintStream out = NullOutputStream.wrapOrNullStream(outStream); PrintStream err = NullOutputStream.wrapOrNullStream(errStream); // Define all the arguments that may be used with this program. opends/src/server/org/opends/server/tools/StopWindowsService.java
@@ -84,25 +84,8 @@ OutputStream errStream) { int returnValue; PrintStream out; if (outStream == null) { out = NullOutputStream.printStream(); } else { out = new PrintStream(outStream); } PrintStream err; if (errStream == null) { err = NullOutputStream.printStream(); } else { err = new PrintStream(errStream); } PrintStream out = NullOutputStream.wrapOrNullStream(outStream); PrintStream err = NullOutputStream.wrapOrNullStream(errStream); String serviceName = ConfigureWindowsService.getServiceName(); if (serviceName == null) opends/src/server/org/opends/server/tools/VerifyIndex.java
@@ -108,25 +108,8 @@ OutputStream outStream, OutputStream errStream) { PrintStream out; if (outStream == null) { out = NullOutputStream.printStream(); } else { out = new PrintStream(outStream); } PrintStream err; if (errStream == null) { err = NullOutputStream.printStream(); } else { err = new PrintStream(errStream); } PrintStream out = NullOutputStream.wrapOrNullStream(outStream); PrintStream err = NullOutputStream.wrapOrNullStream(errStream); // Define the command-line arguments that may be used with this program. StringArgument configClass = null; opends/src/server/org/opends/server/tools/WaitForFileDelete.java
@@ -23,11 +23,9 @@ * * * Copyright 2006-2009 Sun Microsystems, Inc. * Portions Copyright 2013 ForgeRock AS */ package org.opends.server.tools; import org.opends.messages.Message; import java.io.File; import java.io.InputStream; @@ -35,6 +33,7 @@ import java.io.PrintStream; import java.io.RandomAccessFile; import org.opends.messages.Message; import org.opends.server.core.DirectoryServer; import org.opends.server.types.NullOutputStream; import org.opends.server.util.args.ArgumentException; @@ -135,25 +134,8 @@ OutputStream outStream, OutputStream errStream, InputStream inStream) { int exitCode; PrintStream out; if (outStream == null) { out = NullOutputStream.printStream(); } else { out = new PrintStream(outStream); } PrintStream err; if (errStream == null) { err = NullOutputStream.printStream(); } else { err = new PrintStream(errStream); } PrintStream out = NullOutputStream.wrapOrNullStream(outStream); PrintStream err = NullOutputStream.wrapOrNullStream(errStream); try { WaitForFileDelete wffd = new WaitForFileDelete(out, err, System.in); opends/src/server/org/opends/server/tools/dsreplication/ReplicationCliMain.java
@@ -55,16 +55,12 @@ import java.util.logging.Level; import java.util.logging.Logger; import static org.opends.admin.ads.ServerDescriptor.getReplicationServer; import static org.opends.admin.ads.ServerDescriptor.getServerRepresentation; import static org.opends.admin.ads.ServerDescriptor.getSuffixDisplay; import static org.opends.admin.ads.ServerDescriptor.*; import static org.opends.messages.AdminToolMessages.*; import static org.opends.messages.QuickSetupMessages.*; import static org.opends.messages.ToolMessages.*; import static org.opends.messages.UtilityMessages. ERR_CONFIRMATION_TRIES_LIMIT_REACHED; import static org.opends.quicksetup.util.Utils.getFirstValue; import static org.opends.quicksetup.util.Utils.getThrowableMsg; import static org.opends.messages.UtilityMessages.*; import static org.opends.quicksetup.util.Utils.*; import static org.opends.server.tools.ToolConstants.*; import static org.opends.server.tools.dsreplication.ReplicationCliReturnCode.*; @@ -82,6 +78,9 @@ import javax.net.ssl.TrustManager; import org.opends.admin.ads.ADSContext; import org.opends.admin.ads.ADSContext.ADSPropertySyntax; import org.opends.admin.ads.ADSContext.AdministratorProperty; import org.opends.admin.ads.ADSContext.ServerProperty; import org.opends.admin.ads.ADSContextException; import org.opends.admin.ads.ReplicaDescriptor; import org.opends.admin.ads.ServerDescriptor; @@ -89,8 +88,6 @@ import org.opends.admin.ads.TopologyCache; import org.opends.admin.ads.TopologyCacheException; import org.opends.admin.ads.TopologyCacheFilter; import org.opends.admin.ads.ADSContext.ADSPropertySyntax; import org.opends.admin.ads.ADSContext.AdministratorProperty; import org.opends.admin.ads.util.ApplicationTrustManager; import org.opends.admin.ads.util.ConnectionUtils; import org.opends.admin.ads.util.PreferredConnection; @@ -325,25 +322,8 @@ public static int mainCLI(String[] args, boolean initializeServer, OutputStream outStream, OutputStream errStream, InputStream inStream) { PrintStream out; if (outStream == null) { out = NullOutputStream.printStream(); } else { out = new PrintStream(outStream); } PrintStream err; if (errStream == null) { err = NullOutputStream.printStream(); } else { err = new PrintStream(errStream); } PrintStream out = NullOutputStream.wrapOrNullStream(outStream); PrintStream err = NullOutputStream.wrapOrNullStream(errStream); try { @@ -8069,11 +8049,11 @@ domains[i] = sync.getReplicationDomain(domainNames[i]); } ReplicationDomainCfgClient domain = null; for (int i=0; i<domains.length; i++) for (ReplicationDomainCfgClient domain2 : domains) { if (Utils.areDnsEqual(baseDN, domains[i].getBaseDN().toString())) if (Utils.areDnsEqual(baseDN, domain2.getBaseDN().toString())) { domain = domains[i]; domain = domain2; break; } } @@ -8933,10 +8913,10 @@ String[] domainNames = sync.listReplicationDomains(); if (domainNames != null) { for (int i=0; i<domainNames.length; i++) for (String domainName : domainNames) { ReplicationDomainCfgClient domain = sync.getReplicationDomain(domainNames[i]); sync.getReplicationDomain(domainName); for (String baseDN : baseDNs) { lastBaseDN = baseDN; @@ -8970,7 +8950,7 @@ } else { sync.removeReplicationDomain(domainNames[i]); sync.removeReplicationDomain(domainName); sync.commit(); } } @@ -9085,16 +9065,16 @@ String[] domainNames = sync.listReplicationDomains(); if (domainNames != null) { for (int i=0; i<domainNames.length; i++) for (String domainName : domainNames) { ReplicationDomainCfgClient domain = sync.getReplicationDomain(domainNames[i]); sync.getReplicationDomain(domainName); if (Utils.areDnsEqual(domain.getBaseDN().toString(), baseDN)) { printProgress(formatter.getFormattedWithPoints( INFO_REPLICATION_DISABLING_BASEDN.get(baseDN, hostPort))); sync.removeReplicationDomain(domainNames[i]); sync.removeReplicationDomain(domainName); sync.commit(); printProgress(formatter.getFormattedDone()); @@ -9510,14 +9490,12 @@ { Set<ADSContext.ServerProperty> propertiesToCompare = new HashSet<ADSContext.ServerProperty>(); ADSContext.ServerProperty[] properties = ADSContext.ServerProperty.values(); for (int i=0; i<properties.length; i++) for (ServerProperty property : ADSContext.ServerProperty.values()) { if (properties[i].getAttributeSyntax() != if (property.getAttributeSyntax() != ADSPropertySyntax.CERTIFICATE_BINARY) { propertiesToCompare.add(properties[i]); propertiesToCompare.add(property); } } for (Map<ADSContext.ServerProperty, Object> server1 : registry1) opends/src/server/org/opends/server/tools/makeldif/MakeLDIF.java
@@ -26,9 +26,6 @@ * Portions Copyright 2013 ForgeRock AS */ package org.opends.server.tools.makeldif; import org.opends.messages.Message; import java.io.File; import java.io.IOException; @@ -37,6 +34,7 @@ import java.util.LinkedList; import java.util.Random; import org.opends.messages.Message; import org.opends.server.core.DirectoryServer; import org.opends.server.types.AttributeType; import org.opends.server.types.ExistingFileBehavior; @@ -52,11 +50,9 @@ import org.opends.server.util.args.StringArgument; import static org.opends.messages.ToolMessages.*; import static org.opends.server.tools.ToolConstants.*; import static org.opends.server.util.ServerConstants.*; import static org.opends.server.util.StaticUtils.*; import static org.opends.server.tools.ToolConstants.*; /** * This class defines a program that can be used to generate LDIF content based @@ -71,12 +67,10 @@ private static final String CLASS_NAME = "org.opends.server.tools.makeldif.MakeLDIF"; // The LDIF writer that will be used to write the entries. /** The LDIF writer that will be used to write the entries. */ private LDIFWriter ldifWriter; // The total number of entries that have been written. /** The total number of entries that have been written. */ private long entriesWritten; private PrintStream out = System.out; @@ -130,23 +124,8 @@ OutputStream outStream, OutputStream errStream) { if (outStream == null) { out = NullOutputStream.printStream(); } else { out = new PrintStream(outStream); } if (errStream == null) { err = NullOutputStream.printStream(); } else { err = new PrintStream(errStream); } out = NullOutputStream.wrapOrNullStream(outStream); err = NullOutputStream.wrapOrNullStream(errStream); // Create and initialize the argument parser for this program. Message toolDescription = INFO_MAKELDIF_TOOL_DESCRIPTION.get(); @@ -443,6 +422,7 @@ * * @throws MakeLDIFException If some other problem occurs. */ @Override public boolean writeEntry(TemplateEntry entry) throws IOException, MakeLDIFException { @@ -497,6 +477,7 @@ * Notifies the entry writer that no more entries will be provided and that * any associated cleanup may be performed. */ @Override public void closeEntryWriter() { Message message = INFO_MAKELDIF_PROCESSING_COMPLETE.get(entriesWritten); opends/src/server/org/opends/server/tools/status/StatusCli.java
@@ -230,25 +230,8 @@ public static int mainCLI(String[] args, boolean initializeServer, OutputStream outStream, OutputStream errStream, InputStream inStream) { PrintStream out; if (outStream == null) { out = NullOutputStream.printStream(); } else { out = new PrintStream(outStream); } PrintStream err; if (errStream == null) { err = NullOutputStream.printStream(); } else { err = new PrintStream(errStream); } PrintStream out = NullOutputStream.wrapOrNullStream(outStream); PrintStream err = NullOutputStream.wrapOrNullStream(errStream); try { ControlPanelLog.initLogFileHandler( opends/src/server/org/opends/server/types/NullOutputStream.java
@@ -23,16 +23,13 @@ * * * Copyright 2006-2008 Sun Microsystems, Inc. * Portions Copyright 2013 ForgeRock AS */ package org.opends.server.types; import java.io.OutputStream; import java.io.PrintStream; /** * This class defines a custom output stream that simply discards any * data written to it. @@ -84,6 +81,24 @@ } /** * Returns s wrapped into a {@link PrintStream} if is not null, * {@link NullOutputStream#printStream()} otherwise. * * @param s * the OutputStream to wrap into a {@link PrintStream}. Can be null. * @return a PrintStream wrapping s if not null, * {@link NullOutputStream#printStream()} otherwise. */ public static PrintStream wrapOrNullStream(OutputStream s) { if (s != null) { return new PrintStream(s); } return NullOutputStream.printStream(); } /** * Creates a new instance of this null output stream. @@ -98,6 +113,7 @@ /** * Closes the output stream. This has no effect. */ @Override public void close() { // No implementation is required. @@ -108,6 +124,7 @@ /** * Flushes the output stream. This has no effect. */ @Override public void flush() { // No implementation is required. @@ -121,6 +138,7 @@ * * @param b The byte array containing the data to be written. */ @Override public void write(byte[] b) { // No implementation is required. @@ -136,6 +154,7 @@ * @param off The offset at which the real data begins. * @param len The number of bytes to be written. */ @Override public void write(byte[] b, int off, int len) { // No implementation is required. @@ -149,6 +168,7 @@ * * @param b The byte to be written. */ @Override public void write(int b) { // No implementation is required. opends/src/server/org/opends/server/util/cli/ConsoleApplication.java
@@ -176,23 +176,8 @@ this.in = new BufferedReader(new NullReader()); } if (out != null) { this.out = out; } else { this.out = NullOutputStream.printStream(); } if (err != null) { this.err = out; } else { this.err = NullOutputStream.printStream(); } this.out = NullOutputStream.wrapOrNullStream(out); this.err = NullOutputStream.wrapOrNullStream(err); } /** @@ -217,23 +202,8 @@ this.in = new BufferedReader(new NullReader()); } if (out != null) { this.out = new PrintStream(out); } else { this.out = NullOutputStream.printStream(); } if (err != null) { this.err = new PrintStream(err); } else { this.err = NullOutputStream.printStream(); } this.out = NullOutputStream.wrapOrNullStream(out); this.err = NullOutputStream.wrapOrNullStream(err); } /**