void printCommandBuilder(CommandBuilder commandBuilder){
  if (displayEquivalentArgument.isPresent()) {
    println();
    printlnNoWrap(INFO_DSCFG_NON_INTERACTIVE.get(commandBuilder));
  }
  if (equivalentCommandFileArgument.isPresent()) {
    String file=equivalentCommandFileArgument.getValue();
    BufferedWriter writer=null;
    try {
      writer=new BufferedWriter(new FileWriter(file,true));
      if (!sessionStartTimePrinted) {
        writer.write(SHELL_COMMENT_SEPARATOR + getSessionStartTimeMessage());
        writer.newLine();
        sessionStartTimePrinted=true;
      }
      sessionEquivalentOperationNumber++;
      writer.newLine();
      writer.write(SHELL_COMMENT_SEPARATOR + INFO_DSCFG_EQUIVALENT_COMMAND_LINE_SESSION_OPERATION_NUMBER.get(sessionEquivalentOperationNumber));
      writer.newLine();
      writer.write(SHELL_COMMENT_SEPARATOR + getCurrentOperationDateMessage());
      writer.newLine();
      writer.write(commandBuilder.toString());
      writer.newLine();
      writer.newLine();
      writer.flush();
    }
 catch (    IOException ioe) {
      errPrintln(ERR_DSCFG_ERROR_WRITING_EQUIVALENT_COMMAND_LINE.get(file,ioe));
    }
 finally {
      closeSilently(writer);
    }
  }
}

void printCommandBuilder ( CommandBuilder commandBuilder ) { if ( displayEquivalentArgument . isPresent ( ) ) { println ( ) ; printlnNoWrap ( INFO_DSCFG_NON_INTERACTIVE . get ( commandBuilder ) ) ; } if ( equivalentCommandFileArgument . isPresent ( ) ) { String file = equivalentCommandFileArgument . getValue ( ) ; BufferedWriter writer = null ; try { writer = new BufferedWriter ( new FileWriter ( file , true ) ) ; if ( ! sessionStartTimePrinted ) { writer . write ( SHELL_COMMENT_SEPARATOR + getSessionStartTimeMessage ( ) ) ; writer . newLine ( ) ; sessionStartTimePrinted = true ; } sessionEquivalentOperationNumber ++ ; writer . newLine ( ) ; writer . write ( SHELL_COMMENT_SEPARATOR + INFO_DSCFG_EQUIVALENT_COMMAND_LINE_SESSION_OPERATION_NUMBER . get ( sessionEquivalentOperationNumber ) ) ; writer . newLine ( ) ; writer . write ( SHELL_COMMENT_SEPARATOR + getCurrentOperationDateMessage ( ) ) ; writer . newLine ( ) ; writer . write ( commandBuilder . toString ( ) ) ; writer . newLine ( ) ; writer . newLine ( ) ; writer . flush ( ) ; } catch ( IOException ioe ) { errPrintln ( ERR_DSCFG_ERROR_WRITING_EQUIVALENT_COMMAND_LINE . get ( file , ioe ) ) ; } finally { closeSilently ( writer ) ; } } }
prints the contents of a command builder . this method has been created since setpropsubcommandhandler calls it . all the logic of dsconfig is on this method . it writes the content of the commandbuilder to the standard output , or to a file depending on the options provided by the user .
