Package com.tek42.perforce.parse

Examples of com.tek42.perforce.parse.AbstractPerforceTemplate


                        output = currentProcess.getOutputStream();
      reader = new BufferedReader(new InputStreamReader(currentProcess.getInputStream()));
      writer = new BufferedWriter(new OutputStreamWriter(currentProcess.getOutputStream()));

    } catch(IOException e) {
      throw new PerforceException("Failed to open connection to: " + args[0], e);
    }
  }
View Full Code Here


              if (log.length() > 0) {
                  error.append("\nWith Data:\n===================\n");
                  error.append(log);
                            error.append("\n===================\n");
              }
                        throw new PerforceException(error.toString());
          }
          throw new PerforceException(info.toString());
        }

      } catch(IOException e) {
        throw new PerforceException("Failed to open connection to perforce", e);
      } finally {
                                try{
                                    p4.getWriter().close();
                                } catch (IOException e) {
                                    //failed to close pipe, but we can't do much about that
View Full Code Here

                                lines.add(line);
                                totalLength += line.length();
                                count++;
                            }
                            if(timedStreamCloser.timedOut()) {
                                throw new PerforceException("Perforce operation timed out after " + timeout + " seconds.");
                            }
      }
      catch(IOException ioe)
      {
        //this is generally not anything to worry about.  The underlying
        //perforce process terminated and that causes java to be angry
        StringWriter sw = new StringWriter();
        PrintWriter pw = new PrintWriter(sw, true);
        ioe.printStackTrace(pw);
        pw.flush();
        sw.flush();
        getLogger().warn("Perforce process terminated suddenly");
        getLogger().warn(sw.toString());
      }
      finally{
                            if(timedStreamCloser!=null) timedStreamCloser.interrupt();
                            try{
                                p4.getWriter().close();
                            } catch (IOException e) {
                                getLogger().warn("Write pipe failed to close.");
                            }
                            try{
                                p4.getReader().close();
                            } catch (IOException e) {
                                getLogger().warn("Read pipe failed to close.");
                            }
                            p4.close();
      }
      loop = false;
      // If we failed to execute because of an authentication issue, try a p4 login.
      if(attemptLogin && (mesgIndex == 1 || mesgIndex == 2 || mesgIndex == 6 || mesgIndex == 9)) {
        // password is unset means that perforce isn't using the environment var P4PASSWD
        // Instead it is using tickets. We must attempt to login via p4 login, then
        // retry this cmd.
        p4.close();
                                trustIfSSL();
        login();
        loop = true;
        attemptLogin = false;
        continue;
      }

      // We aren't using the exact message because we want to add the username for more info
      if(mesgIndex == 4)
        throw new PerforceException("Access for user '" + depot.getUser() + "' has not been enabled by 'p4 protect'");
      if(mesgIndex != -1)
        throw new PerforceException(p4errors[mesgIndex]);
      if(count == 0)
        throw new PerforceException("No output for: " + debugCmd);
    } while(loop);

    StringBuilder response = new StringBuilder(totalLength + lines.size());
    for (String line : lines)
        {
View Full Code Here

              getLogger().warn("Using p4 issued ticket.");
              depot.setP4Ticket(ticket);
          }

    } catch(IOException e) {
      throw new PerforceException("Unable to login via p4 login due to IOException: " + e.getMessage());
    }
  }
View Full Code Here

            String line;
            // The line matching ^[0-9A-F]{32}$ will be the ticket
            while ((line = reader.readLine()) != null) {
                int error = checkAuthnErrors(line);
                if (error != -1)
                    throw new PerforceException("Login attempt failed: " + line);
                if (line.trim().matches("^[0-9A-F]{32}$"))
                    ticket = line;
            }
           
            return ticket;
View Full Code Here

                String line;
                // The line matching ^[0-9A-F]{32}$ will be the ticket
                while ((line = reader.readLine()) != null) {
                    int error = checkAuthnErrors(line);
                    if (error != -1)
                        throw new PerforceException("Trust attempt failed: " + line);
                }
            } catch (IOException e) {
                throw new PerforceException("Could not establish ssl trust with perforce server", e);
            }
            trust.close();
        }
    }
View Full Code Here

      for(String s : group.getUsers()) {
        out.write(" " + s + "\n");
      }

    } catch(IOException e) {
      throw new PerforceException("Failed to save group: " + group.getName(), e);
    }
  }
View Full Code Here

   */
  public Group getGroup(String name) throws PerforceException {
    GroupBuilder builder = new GroupBuilder();
    Group group = builder.build(getPerforceResponse(builder.getBuildCmd(getP4Exe(), name)));
    if(group == null)
      throw new PerforceException("Failed to retrieve group: " + name);

    return group;
  }
View Full Code Here

    }
    else {
        workspace = builder.build(getPerforceResponse(builder.getBuildCmd(getP4Exe(), ws_name)));
    }
    if(workspace == null)
      throw new PerforceException("Failed to retrieve workspace: " + ws_name);

    return workspace;
  }
View Full Code Here

                cmdLineList.add(path);
                String[] cmdLine = cmdLineList.toArray(new String[cmdLineList.size()]);
   
                StringBuilder response = getPerforceResponse(cmdLine, filter);
                if(hitMax(response)){
                    throw new PerforceException("Hit perforce server limit while " + (forceSync?"force ":"") + "syncing: \n" + response);
                }
                if(errors.length()>0){
                    throw new PerforceException("Errors encountered while " + (forceSync?"force ":"") + "syncing: " + errors.toString());
                }
                return response;
  }
View Full Code Here

TOP

Related Classes of com.tek42.perforce.parse.AbstractPerforceTemplate

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.