Groovy Documentation

java.gate.versioning.cmdline
Interface Repository


interface Repository

This is the main entry point for the version control package. See also the gate.versioning.cmdline package overview. The name of this interface is a little misleading: it doesn't really model version control repositories, but version control commands. In a perfect world it would be renamed.

Version control repository interface. Implementors are intended to use bean-type parameterisation and initialisation. The lifecycle is:

An exception to the rule of calling #init before other methods is #create, which can be called on an unitialised object (so that we can create repositories without having an existing one).

Implementors are expected to execute the command-line repository program to do the work specified by this API. The anticipated uses are with CVS and SVN. The API is kept close to the underlying version control systems, so, for example, to delete a file first delete the actual file from disk, then call #delete, then call #checkin to commit the deletion. A Repository object may also be obtained from AbstractRepository#getRepository(java.lang.String).


Method Summary
boolean add(String fileName)

Add to the repository.

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 create(String dirName)

Create a new repository filetree (i.e. not a new object but a new database/filesystem on disk).

boolean delete(String fileName)

Delete from the repository.

String diff(String fileName)

Get the difference with the repository version.

boolean exists(String moduleName)

Check for the existence of a module (i.e. top-level directory).

String getCommandName()

Name of the repository command to execute (e.g. cvs, svn).

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.

String getRoot()

The root / URL of the repository

boolean importDir(String dirName)

Import a directory.

void init()

Validate parameters.

boolean isModified(String fileName)

Use the repository's status command to figure out if the file has been locally modified.

boolean isOutOfDate(String fileName)

Use the repository's status command to figure out if the file is out-of-date.

boolean isUnknown(String fileName)

Use the repository's status command to figure out if the file is unknown.

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.

 

Method Detail

add

public boolean add(String fileName)
Add to the repository.
param:
fileName the file or directory to work on (should be relative to the repository's working directory, and use "/" as a path separator).
return:
boolean representing success or failure.


checkin

public boolean checkin(String fileName)
Commit changes. A default message is used.
param:
fileName the file or directory to work on (should be relative to the repository's working directory, and use "/" as a path separator).
return:
boolean representing success or failure.


checkin

public boolean checkin(String fileName, String message)
Commit changes.
param:
fileName the file or directory to work on (should be relative to the repository's working directory, and use "/" as a path separator).
param:
message a commit message.
return:
boolean representing success or failure.


checkout

public boolean checkout(String fileName)
Check out a file, directory or module.
param:
fileName the file or directory to work on (should be relative to the repository's working directory, and use "/" as a path separator).
return:
boolean representing success or failure.


create

public boolean create(String dirName)
Create a new repository filetree (i.e. not a new object but a new database/filesystem on disk).
param:
dirName the directory to work on, which will be created (should be an absolute path).
return:
boolean representing success or failure.


delete

public boolean delete(String fileName)
Delete from the repository.
param:
fileName the file or directory to work on (should be relative to the repository's working directory, and use "/" as a path separator).
return:
boolean representing success or failure.


diff

public String diff(String fileName)
Get the difference with the repository version.
param:
fileName the file or directory to work on (should be relative to the repository's working directory, and use "/" as a path separator).
return:
a string containing the difference, or "" for no difference, or null for error.


exists

public boolean exists(String moduleName)
Check for the existence of a module (i.e. top-level directory).
param:
moduleName directory to look for.
return:
boolean giving status indication.


getCommandName

public String getCommandName()
Name of the repository command to execute (e.g. cvs, svn). This is mainly useful for implementors of this interface.


getCommandOutput

public String getCommandOutput()
Get a string containing the stdout and stderr from the command execution.


getCommandStderr

public String getCommandStderr()
Get a string containing the stderr from the command execution.


getCommandStdout

public String getCommandStdout()
Get a string containing the stdout from the command execution.


getRoot

public String getRoot()
The root / URL of the repository


importDir

public boolean importDir(String dirName)
Import a directory.
param:
dirName the directory to import (this must exist).
return:
boolean representing success or failure.
throws:
GateException when the directory doesn't exist.


init

public void init()
Validate parameters.


isModified

public boolean isModified(String fileName)
Use the repository's status command to figure out if the file has been locally modified.
param:
fileName the file or directory to work on (should be relative to the repository's working directory, and use "/" as a path separator).
return:
boolean giving status indication.


isOutOfDate

public boolean isOutOfDate(String fileName)
Use the repository's status command to figure out if the file is out-of-date.
param:
fileName the file or directory to work on (should be relative to the repository's working directory, and use "/" as a path separator).
return:
boolean giving status indication.


isUnknown

public boolean isUnknown(String fileName)
Use the repository's status command to figure out if the file is unknown. This only works when you're looking for a file relative to a working copy - to check for existence use #exists.
param:
fileName the file or directory to work on (should be relative to the repository's working directory, and use "/" as a path separator).
return:
boolean giving status indication.


setRoot

public void setRoot(String root)
The root / URL of the repository


setWorkingDir

public void setWorkingDir(File workingDir)
The working directory for repository actions


status

public String status(String fileName)
Status.
param:
fileName the file or directory to work on (should be relative to the repository's working directory, and use "/" as a path separator).
return:
String giving status output.


update

public boolean update(String fileName)
Update.
param:
fileName the file or directory to work on (should be relative to the repository's working directory, and use "/" as a path separator).
return:
boolean representing success or failure.


 

Groovy Documentation