/**
  * Returns the arguments of the command in the command-line style. Similar to getCVSCommand()
  * however without the files and command's name
  */
 public String getCVSArguments() {
   StringBuffer cvsArguments = new StringBuffer();
   if (!isRecursive()) {
     cvsArguments.append("-l "); // NOI18N
   }
   return cvsArguments.toString();
 }
Beispiel #2
0
  /**
   * Handle the response from a request.
   *
   * @throws ResponseException if there is a problem reading the response
   */
  private void handleResponse() throws ResponseException, CommandAbortedException {
    try {
      LoggedDataInputStream dis = connection.getInputStream();
      loggedDataInputStream = dis;

      int ch = -1;
      try {
        ch = dis.read();
      } catch (InterruptedIOException ex) {
        abort();
      }

      while (!abort && ch != -1) {
        StringBuffer responseNameBuffer = new StringBuffer();
        // read in the response name
        while (ch != -1 && (char) ch != '\n' && (char) ch != ' ') {
          responseNameBuffer.append((char) ch);
          try {
            ch = dis.read();
          } catch (InterruptedIOException ex) {
            abort();
            break;
          }
        }

        String responseString = responseNameBuffer.toString();
        Response response = getResponseFactory().createResponse(responseString);
        // Logger.logInput(new String("<" + responseString + " processing start>\n").getBytes()); //
        // NOI18N
        response.process(dis, this);
        boolean terminal = response.isTerminalResponse();

        // handle SpecialResponses
        if (terminal && response instanceof ErrorMessageResponse) {
          ErrorMessageResponse errorResponce = (ErrorMessageResponse) response;
          String errMsg = errorResponce.getMessage();
          throw new CommandAbortedException(errMsg, errMsg);
        }
        // Logger.logInput(new String("<" + responseString + " processed " + terminal +
        // ">\n").getBytes()); // NOI18N
        if (terminal || abort) {
          break;
        }

        try {
          ch = dis.read();
        } catch (InterruptedIOException ex) {
          abort();
          break;
        }
      }

      if (abort) {
        String localMsg = CommandException.getLocalMessage("Client.commandAborted", null); // NOI18N
        throw new CommandAbortedException("Aborted during request processing", localMsg); // NOI18N
      }
    } catch (EOFException ex) {
      throw new ResponseException(
          ex, ResponseException.getLocalMessage("CommandException.EndOfFile", null)); // NOI18N
    } catch (IOException ex) {
      throw new ResponseException(ex);
    }
  }
 /** This method returns how the tag command would looklike when typed on the command line. */
 public String getCVSCommand() {
   StringBuffer cvsCommandLine = new StringBuffer("edit "); // NOI18N
   cvsCommandLine.append(getCVSArguments());
   appendFileArguments(cvsCommandLine);
   return cvsCommandLine.toString();
 }