com.ptc.windchill.upgrade.util
Class ClearcaseCLI

java.lang.Object
  extended bycom.ptc.windchill.upgrade.util.ClearcaseCLI
All Implemented Interfaces:
ClearcaseIfc

public class ClearcaseCLI
extends Object
implements ClearcaseIfc


Nested Class Summary
 
Nested classes inherited from class com.ptc.windchill.upgrade.util.ClearcaseIfc
ClearcaseIfc.Status
 
Field Summary
private  char[] buf
           
private  Process cleartool
           
private  String newLine
           
private  String prompt
           
private  BufferedReader stderr
           
private  Writer stdin
           
private  BufferedReader stdout
           
 
Constructor Summary
ClearcaseCLI()
           
 
Method Summary
 ClearcaseIfc.Status add(String file, String comment, boolean isdirectory)
          Adds the given file to clearcase source control.
 ClearcaseIfc.Status checkin(String file, String comment, boolean ptime)
          Does a clearcase checkin of the given file.
 ClearcaseIfc.Status checkout(String file, String comment, boolean reserved, boolean ptime)
          Does a clearcase checkout of the given file.
 ClearcaseIfc.Status cleartool(String cmd)
          Executes the command "cmd" just like a command line "cleartool cmd".
 ClearcaseIfc.Status delete(String file, String comment)
          Removes the given file from clearcase source control (rmname NOT rmelem).
 void destroy()
          Destroys this instance
private  ClearcaseIfc.Status execute(String cmd)
           
 ClearcaseIfc.Status getViewName(String file)
          Gets the view tag name for the view associated with file.
 boolean isCheckedOut(String file)
          Returns true if the file is under version control and checked out
 boolean isDifferent(String file)
          Returns true if the file is checked out and different from its predecessor
 boolean isElement(String file)
          Returns true if the file is under clearcase version control
 boolean isHijacked(String file)
          Returns true if the file is under version control and hijacked from a snapshot view
private  boolean isRunning()
           
 boolean isSnapShot(String file)
          Returns true if the file is under version control and part of a snapshot view
 ClearcaseIfc.Status move(String file, String newfile, String comment)
          Moves file to newfile.
private  ClearcaseIfc.Status readOutput()
           
private  String readStderr()
           
 ClearcaseIfc.Status uncheckout(String file, boolean keep)
          Does a clearcase uncheckout of the given file.
private  void validateProcess()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

newLine

private String newLine

prompt

private String prompt

cleartool

private Process cleartool

stdout

private BufferedReader stdout

stderr

private BufferedReader stderr

stdin

private Writer stdin

buf

private char[] buf
Constructor Detail

ClearcaseCLI

public ClearcaseCLI()
             throws IOException
Method Detail

destroy

public void destroy()
Description copied from interface: ClearcaseIfc
Destroys this instance

Specified by:
destroy in interface ClearcaseIfc

isRunning

private boolean isRunning()

validateProcess

private void validateProcess()
                      throws IOException
Throws:
IOException

execute

private ClearcaseIfc.Status execute(String cmd)

readOutput

private ClearcaseIfc.Status readOutput()

readStderr

private String readStderr()

add

public ClearcaseIfc.Status add(String file,
                               String comment,
                               boolean isdirectory)
Description copied from interface: ClearcaseIfc
Adds the given file to clearcase source control. This requires the parent directory to be under version control and checked out. The isdirectory flag causes creation of a directory element when true. Comment can be empty string.

Specified by:
add in interface ClearcaseIfc
See Also:
net.sourceforge.eclipseccase.ClearcaseIfc#add(String, String, boolean)

checkin

public ClearcaseIfc.Status checkin(String file,
                                   String comment,
                                   boolean ptime)
Description copied from interface: ClearcaseIfc
Does a clearcase checkin of the given file. Comment can be empty string. ptime preserves file timestamp

Specified by:
checkin in interface ClearcaseIfc
See Also:
net.sourceforge.eclipseccase.ClearcaseIfc#checkin(String, String, boolean)

checkout

public ClearcaseIfc.Status checkout(String file,
                                    String comment,
                                    boolean reserved,
                                    boolean ptime)
Description copied from interface: ClearcaseIfc
Does a clearcase checkout of the given file. Comment can be empty string. If reserved is true, does a reserved checkout. ptime preserves file timestamp

Specified by:
checkout in interface ClearcaseIfc
See Also:
net.sourceforge.eclipseccase.ClearcaseIfc#checkout(String, String, boolean, boolean)

cleartool

public ClearcaseIfc.Status cleartool(String cmd)
Description copied from interface: ClearcaseIfc
Executes the command "cmd" just like a command line "cleartool cmd".

Specified by:
cleartool in interface ClearcaseIfc
See Also:
net.sourceforge.eclipseccase.ClearcaseIfc#cleartool(String)

delete

public ClearcaseIfc.Status delete(String file,
                                  String comment)
Description copied from interface: ClearcaseIfc
Removes the given file from clearcase source control (rmname NOT rmelem). This requires the parent directory to be under version control and checked out. Comment can be empty string.

Specified by:
delete in interface ClearcaseIfc
See Also:
net.sourceforge.eclipseccase.ClearcaseIfc#delete(String, String)

getViewName

public ClearcaseIfc.Status getViewName(String file)
Description copied from interface: ClearcaseIfc
Gets the view tag name for the view associated with file.

Specified by:
getViewName in interface ClearcaseIfc
See Also:
net.sourceforge.eclipseccase.ClearcaseIfc#getViewName(String)

isCheckedOut

public boolean isCheckedOut(String file)
Description copied from interface: ClearcaseIfc
Returns true if the file is under version control and checked out

Specified by:
isCheckedOut in interface ClearcaseIfc
See Also:
net.sourceforge.eclipseccase.ClearcaseIfc#isCheckedOut(String)

isDifferent

public boolean isDifferent(String file)
Description copied from interface: ClearcaseIfc
Returns true if the file is checked out and different from its predecessor

Specified by:
isDifferent in interface ClearcaseIfc
See Also:
net.sourceforge.eclipseccase.ClearcaseIfc#isDifferent(String)

isElement

public boolean isElement(String file)
Description copied from interface: ClearcaseIfc
Returns true if the file is under clearcase version control

Specified by:
isElement in interface ClearcaseIfc
See Also:
net.sourceforge.eclipseccase.ClearcaseIfc#isElement(String)

isHijacked

public boolean isHijacked(String file)
Description copied from interface: ClearcaseIfc
Returns true if the file is under version control and hijacked from a snapshot view

Specified by:
isHijacked in interface ClearcaseIfc
See Also:
net.sourceforge.eclipseccase.ClearcaseIfc#isHijacked(String)

isSnapShot

public boolean isSnapShot(String file)
Description copied from interface: ClearcaseIfc
Returns true if the file is under version control and part of a snapshot view

Specified by:
isSnapShot in interface ClearcaseIfc
See Also:
net.sourceforge.eclipseccase.ClearcaseIfc#isSnapShot(String)

move

public ClearcaseIfc.Status move(String file,
                                String newfile,
                                String comment)
Description copied from interface: ClearcaseIfc
Moves file to newfile. The parent directories of both file and newfile must be checked out. Comment can be empty string.

Specified by:
move in interface ClearcaseIfc
See Also:
net.sourceforge.eclipseccase.ClearcaseIfc#move(String, String, String)

uncheckout

public ClearcaseIfc.Status uncheckout(String file,
                                      boolean keep)
Description copied from interface: ClearcaseIfc
Does a clearcase uncheckout of the given file. If keep is true, the file is copied to a ".keep" file

Specified by:
uncheckout in interface ClearcaseIfc
See Also:
net.sourceforge.eclipseccase.ClearcaseIfc#uncheckout(String, boolean)