|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object gate.versioning.cmdline.AbstractRepository
public abstract class AbstractRepository
Abstract repository implementation.
The public API of this class is documented on the
Repository
interface.
Implementors control the behaviour of the methods here by overriding
parameterisation methods like getCommandName()
, or simply by
providing their own replacement implementations of the Repository
methods.
Repository
,
CvsRepository
,
SvnRepository
Field Summary | |
---|---|
protected String |
commandOutput
Output from repository command execution. |
protected static boolean |
DEBUG
Debugging messages. |
protected String |
nl
Shorthand for newlines. |
protected String |
root
The root or URL of the repository. |
protected String |
stderrOutput
Stderr from repository command execution. |
protected String |
stdoutOutput
Stdout from repository command execution. |
protected File |
workingDir
The current working directory. |
Constructor Summary | |
---|---|
AbstractRepository()
Construction. |
Method Summary | |
---|---|
boolean |
add(String fileName)
Add to the repository. |
protected String[] |
buildCommandArray(String fileName,
String subCommand,
String subCommandFlag)
Calls buildCommandArray/4
with the no root parameter set false. |
protected String[] |
buildCommandArray(String fileName,
String subCommand,
String subCommandFlag,
boolean noRoot)
Build an array to pass to runtime.exec. |
boolean |
checkin(String fileName)
Commit changes. |
boolean |
checkin(String fileName,
String message)
Commit changes. |
boolean |
checkout(String fileName)
Check out a file, directory or module. |
boolean |
delete(String fileName)
Delete from the repository. |
String |
diff(String fileName)
Get the difference with the repository version. |
abstract String |
getCommandName()
Name of the repository command to execute. |
String |
getCommandOutput()
Get a string containing the stdout and stderr from the command execution. |
String |
getCommandStderr()
Get a string containing the stderr from the command execution. |
String |
getCommandStdout()
Get a string containing the stdout from the command execution. |
protected abstract List |
getPostCommand(String fileName,
boolean noRoot)
Specifies what (if anything) should follow the subcommand. |
protected abstract List |
getPreCommand()
Specifies what (if anything) should precede the subcommand. |
static Repository |
getRepository(String root)
Return a class that supports the given root specifier. |
String |
getRoot()
The root / URL of the repository |
void |
init()
Validate parameters. |
protected boolean |
runCommand(String[] command)
Run a command, wait for termination and report status |
protected boolean |
runCommand(String[] command,
boolean allowExitOne)
Run a command, wait for termination and report status. |
void |
setRoot(String root)
The root / URL of the repository |
void |
setWorkingDir(File workingDir)
The working directory for repository actions |
String |
status(String fileName)
Status. |
boolean |
update(String fileName)
Update. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface gate.versioning.cmdline.Repository |
---|
create, exists, importDir, isModified, isOutOfDate, isUnknown |
Field Detail |
---|
protected String root
protected File workingDir
protected static boolean DEBUG
protected String commandOutput
protected String stdoutOutput
protected String stderrOutput
protected String nl
Constructor Detail |
---|
public AbstractRepository()
Method Detail |
---|
public abstract String getCommandName()
getCommandName
in interface Repository
public void init() throws gate.util.GateException
init
in interface Repository
gate.util.GateException
public void setRoot(String root)
setRoot
in interface Repository
public String getRoot()
getRoot
in interface Repository
public void setWorkingDir(File workingDir)
setWorkingDir
in interface Repository
public boolean checkout(String fileName)
checkout
in interface Repository
fileName
- the file or directory to work on (should be relative
to the repository's working directory, and use "/" as a path separator).
protected abstract List getPreCommand()
protected abstract List getPostCommand(String fileName, boolean noRoot)
protected String[] buildCommandArray(String fileName, String subCommand, String subCommandFlag)
buildCommandArray/4
with the no root parameter set false.
protected String[] buildCommandArray(String fileName, String subCommand, String subCommandFlag, boolean noRoot)
getCommandName()
, getPreCommand()
and getPostCommand(java.lang.String, boolean)
.
fileName
- the file or directory to work on (should be relative
to the repository's working directory, and use "/" as a path separator).subCommand
- the repository command, e.g. "co".subCommandFlag
- a flag for the command (e.g. "-d"), or null.noRoot
- when true indicates that the root isn't necessary for this
command.public boolean checkin(String fileName)
checkin
in interface Repository
fileName
- the file or directory to work on (should be relative
to the repository's working directory, and use "/" as a path separator).
public boolean checkin(String fileName, String message)
checkin
in interface Repository
fileName
- the file or directory to work on (should be relative
to the repository's working directory, and use "/" as a path separator).message
- a commit message.
public boolean update(String fileName)
update
in interface Repository
fileName
- the file or directory to work on (should be relative
to the repository's working directory, and use "/" as a path separator).
public String status(String fileName)
status
in interface Repository
fileName
- the file or directory to work on (should be relative
to the repository's working directory, and use "/" as a path separator).
public boolean delete(String fileName)
delete
in interface Repository
fileName
- the file or directory to work on (should be relative
to the repository's working directory, and use "/" as a path separator).
public boolean add(String fileName)
add
in interface Repository
fileName
- the file or directory to work on (should be relative
to the repository's working directory, and use "/" as a path separator).
public String diff(String fileName)
diff
in interface Repository
fileName
- the file or directory to work on (should be relative
to the repository's working directory, and use "/" as a path separator).
public String getCommandStdout()
getCommandStdout
in interface Repository
public String getCommandStderr()
getCommandStderr
in interface Repository
public String getCommandOutput()
getCommandOutput
in interface Repository
public static Repository getRepository(String root)
root
- root specifier for the desired Repository implementor.
protected boolean runCommand(String[] command)
protected boolean runCommand(String[] command, boolean allowExitOne)
allowExitOne
- accept a command return value of 1 as success (e.g.
for cvs diff).
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |