mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

jvergara
20.48.2009 56949846363abf037c29913c4a3d7065ef4033e6
opends/src/server/org/opends/server/tools/LDAPCompare.java
@@ -93,6 +93,9 @@
  // The print stream to use for standard output.
  private PrintStream out;
  // Tells whether the command-line is being executed in script friendly mode
  // or not.
  private boolean isScriptFriendly;
  /**
@@ -196,9 +199,12 @@
                                     attributeType, attrValOctetStr);
    out.println(INFO_PROCESSING_COMPARE_OPERATION.get(
            attributeType, String.valueOf(attrValOctetStr),
            String.valueOf(dnOctetStr)));
    if (!isScriptFriendly())
    {
      out.println(INFO_PROCESSING_COMPARE_OPERATION.get(
          attributeType, String.valueOf(attrValOctetStr),
          String.valueOf(dnOctetStr)));
    }
    if(!compareOptions.showOperations())
    {
@@ -244,12 +250,24 @@
      {
        if(resultCode == COMPARE_FALSE)
        {
          out.println(INFO_COMPARE_OPERATION_RESULT_FALSE.get(line));
          if (isScriptFriendly())
          {
            out.println(line+": "+COMPARE_FALSE);
          }
          else
          {
            out.println(INFO_COMPARE_OPERATION_RESULT_FALSE.get(line));
          }
        } else if(resultCode == COMPARE_TRUE)
        {
          out.println(INFO_COMPARE_OPERATION_RESULT_TRUE.get(line));
          if (isScriptFriendly())
          {
            out.println(line+": "+COMPARE_TRUE);
          }
          else
          {
            out.println(INFO_COMPARE_OPERATION_RESULT_TRUE.get(line));
          }
        } else
        {
@@ -362,6 +380,7 @@
    StringArgument    saslOptions            = null;
    StringArgument    trustStorePath         = null;
    StringArgument    trustStorePassword     = null;
    BooleanArgument   scriptFriendlyArgument = null;
    StringArgument    propertiesFileArgument = null;
    BooleanArgument   noPropertiesFileArgument = null;
@@ -378,6 +397,15 @@
    try
    {
      scriptFriendlyArgument = new BooleanArgument(
          "script-friendly",
          's',
          "script-friendly",
          INFO_DESCRIPTION_SCRIPT_FRIENDLY.get());
      scriptFriendlyArgument.setPropertyName(
          scriptFriendlyArgument.getLongIdentifier());
      argParser.addInputOutputArgument(scriptFriendlyArgument);
      propertiesFileArgument = new StringArgument("propertiesFilePath",
          null, OPTION_LONG_PROP_FILE_PATH,
          false, false, true, INFO_PROP_FILE_PATH_PLACEHOLDER.get(), null, null,
@@ -949,6 +977,7 @@
      ldapCompare = new LDAPCompare(nextMessageID, out, err);
      ldapCompare.isScriptFriendly = scriptFriendlyArgument.isPresent();
      if(fileNameValue == null && dnStrings.isEmpty())
      {
        // Read from stdin.
@@ -1035,5 +1064,10 @@
    return 0;
  }
  private boolean isScriptFriendly()
  {
    return isScriptFriendly;
  }
}