com.atlassian.bamboo.repository.perforce
Class PerforceRepository

java.lang.Object
  extended by com.atlassian.bamboo.repository.AbstractRepository
      extended by com.atlassian.bamboo.repository.perforce.PerforceRepository
All Implemented Interfaces:
ConvertibleFromConfig, Repository

public class PerforceRepository
extends AbstractRepository

This class provides a Perforce implemention of the Repository interface.


Field Summary
static String KEY
           
static String NAME
           
static String NO_IDEA
           
static String P4_CLIENT
           
static String P4_DEPOT
           
static String P4_EXE
           
static String P4_PORT
           
static String P4_USER
           
 
Fields inherited from class com.atlassian.bamboo.repository.AbstractRepository
BUILD_TRIGGER_IP, WEB_REPO_MODULE_NAME, WEB_REPO_URL
 
Fields inherited from interface com.atlassian.bamboo.repository.Repository
REPOSIORTY_TYPE, UNKNOWN_HOST
 
Constructor Summary
PerforceRepository()
           
 
Method Summary
 void addDefaultValues(BuildConfiguration buildConfiguration)
           
 boolean equals(Object o)
           
 void getAllSourceCode(Build build)
          Force perforce to checkout all the source code.
 Collection getChangesSinceLastBuild(Build build, Date lastBuildStartTime)
          What changes to the build depot have happened since the given lastBuild date?
 String getClient()
          Obtain the perforce client we're using
 String getDepot()
          What's the build depot that we're checking for changes?
 String getHost()
          What's the repostory server host
 String getKey()
           
 String getName()
           
 String getP4Executable()
          Which perforce p4 exe are we using?
 String getPort()
          Which perforce server are we using?
 File getSourceCodeDirectory(Build build)
          Perforce checks out the depot into the client's root directory.
 String getUrl()
           
 String getUser()
          What's the optional perforce user name? Returns null if we are not using a user
 String getWebRepositoryUrl()
          What's the repository's web url
 String getWebRepositoryUrlForFile(CommitFile file)
          What's the URL to the repostory for the modified file?
 String getWebRepositoryUrlRepoName()
          What's the repository's web url repository
 int hashCode()
           
 boolean hasWebBasedRepositoryAccess()
          Does this implementation of the repository provide a web access to the repository?
 boolean isRepositoryDifferent(Repository repository)
          Checks if the current repo is the same or not and sets the referencesDifferentRepository flag accordingly
 void populateFromConfig(HierarchicalConfiguration config)
          Update the current object with data in the FieldValueItemHolder
 void setClient(String client)
          Define the client we're using to connect to the perforce server
 void setDepot(String depot)
          Define the build depot
 void setP4Executable(String p4Exe)
          Set the user specify which p4 executable we're using
 void setPort(String port)
          Define the perforce server and port we're going to connect to
 void setUser(String user)
          Override the default user, if you want to specify the perforce user
 void setWebRepositoryUrl(String url)
          Where should we link to to show build file changes?
 void setWebRepositoryUrlRepoName(String repoName)
          This is used to identify the repository on multi-repository configurations.
 void setWorkingDir(File workingDir)
          Ignore in as perforce places the files according to the depot spec
 HierarchicalConfiguration toConfiguration()
          Generate a FieldValueItemHolder from the current state of the object
 ErrorCollection validate()
          Ensure we have been set up correctly
 ErrorCollection validate(BuildConfiguration buildConfiguration)
           
 
Methods inherited from class com.atlassian.bamboo.repository.AbstractRepository
addPasswordToCvsRoot, createStringFromList, getLabel, getTriggerIpAddress, getWorkingDirectory, isProcessingRepositoryRequest, referencesDifferentRepository, setLabel, setProcessingRepositoryRequest, setReferencesDifferentRepository, setTriggerIpAddress, updateAectIfRepositoryHasChanged
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NAME

public static final String NAME
See Also:
Constant Field Values

KEY

public static final String KEY
See Also:
Constant Field Values

P4_EXE

public static final String P4_EXE
See Also:
Constant Field Values

P4_PORT

public static final String P4_PORT
See Also:
Constant Field Values

P4_CLIENT

public static final String P4_CLIENT
See Also:
Constant Field Values

P4_DEPOT

public static final String P4_DEPOT
See Also:
Constant Field Values

P4_USER

public static final String P4_USER
See Also:
Constant Field Values

NO_IDEA

public static final String NO_IDEA
See Also:
Constant Field Values
Constructor Detail

PerforceRepository

public PerforceRepository()
Method Detail

getP4Executable

public String getP4Executable()
Which perforce p4 exe are we using?

Returns:
The location of the exe

setP4Executable

public void setP4Executable(String p4Exe)
Set the user specify which p4 executable we're using

Parameters:
p4Exe - The locataion of the perforce p4 app (eg /usr/local/bin)

getKey

public String getKey()

getName

public String getName()

getUrl

public String getUrl()

setWorkingDir

public void setWorkingDir(File workingDir)
Ignore in as perforce places the files according to the depot spec

Specified by:
setWorkingDir in interface Repository
Overrides:
setWorkingDir in class AbstractRepository
Parameters:
workingDir - ignored

getSourceCodeDirectory

public File getSourceCodeDirectory(Build build)
Perforce checks out the depot into the client's root directory.

Specified by:
getSourceCodeDirectory in interface Repository
Overrides:
getSourceCodeDirectory in class AbstractRepository
Parameters:
build -
Returns:
The location of the perforce build files

getClient

public String getClient()
Obtain the perforce client we're using

Returns:
the client

setClient

public void setClient(String client)
Define the client we're using to connect to the perforce server

Parameters:
client - The client

getPort

public String getPort()
Which perforce server are we using?

Returns:
The perforce server (they call it port for some strange reason)

setPort

public void setPort(String port)
Define the perforce server and port we're going to connect to

Parameters:
port - The perforce server and port

getDepot

public String getDepot()
What's the build depot that we're checking for changes?

Returns:
the build

setDepot

public void setDepot(String depot)
Define the build depot

Parameters:
depot - The depot

setUser

public void setUser(String user)
Override the default user, if you want to specify the perforce user

Parameters:
user - The perforce user

getUser

public String getUser()
What's the optional perforce user name? Returns null if we are not using a user

Returns:
The perforce user

getChangesSinceLastBuild

public Collection getChangesSinceLastBuild(Build build,
                                           Date lastBuildStartTime)
                                    throws RepositoryException
What changes to the build depot have happened since the given lastBuild date?

Parameters:
build -
lastBuildStartTime - the date we are checking from
Returns:
A collection of ChangeLogEntry objects.
Throws:
RepositoryException - A generic failure

hasWebBasedRepositoryAccess

public boolean hasWebBasedRepositoryAccess()
Description copied from class: AbstractRepository
Does this implementation of the repository provide a web access to the repository?

Specified by:
hasWebBasedRepositoryAccess in interface Repository
Overrides:
hasWebBasedRepositoryAccess in class AbstractRepository
Returns:
true iff we can link to the a web based representation of repository changes

getWebRepositoryUrl

public String getWebRepositoryUrl()
Description copied from interface: Repository
What's the repository's web url

Returns:
The url

getWebRepositoryUrlRepoName

public String getWebRepositoryUrlRepoName()
Description copied from interface: Repository
What's the repository's web url repository

Returns:
The repository (only used in multi-build repositories). Null if not used.

getWebRepositoryUrlForFile

public String getWebRepositoryUrlForFile(CommitFile file)
Description copied from interface: Repository
What's the URL to the repostory for the modified file?

Parameters:
file - The file that has been modified
Returns:
The url

getHost

public String getHost()
Description copied from interface: Repository
What's the repostory server host

Returns:
The host!

isRepositoryDifferent

public boolean isRepositoryDifferent(Repository repository)
Description copied from interface: Repository
Checks if the current repo is the same or not and sets the referencesDifferentRepository flag accordingly


setWebRepositoryUrl

public void setWebRepositoryUrl(String url)
Description copied from interface: Repository
Where should we link to to show build file changes?

Parameters:
url - The url of the repositories web interface

setWebRepositoryUrlRepoName

public void setWebRepositoryUrlRepoName(String repoName)
Description copied from interface: Repository
This is used to identify the repository on multi-repository configurations.

Parameters:
repoName - The name of the repository we are viewing

getAllSourceCode

public void getAllSourceCode(Build build)
                      throws RepositoryException
Force perforce to checkout all the source code. The -f flag is required so that even if the src dir has been deleted locally, P4 still d/l the source files again.

Parameters:
build -
Throws:
RepositoryException - Something went wrong

validate

public ErrorCollection validate()
Ensure we have been set up correctly

Returns:
The collection of form configuration errors

validate

public ErrorCollection validate(BuildConfiguration buildConfiguration)

addDefaultValues

public void addDefaultValues(BuildConfiguration buildConfiguration)
Specified by:
addDefaultValues in interface Repository
Overrides:
addDefaultValues in class AbstractRepository

populateFromConfig

public void populateFromConfig(HierarchicalConfiguration config)
Description copied from interface: ConvertibleFromConfig
Update the current object with data in the FieldValueItemHolder


toConfiguration

public HierarchicalConfiguration toConfiguration()
Description copied from interface: ConvertibleFromConfig
Generate a FieldValueItemHolder from the current state of the object

Returns:
Always returns an FieldValueItemHolder. Never null

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object o)
Overrides:
equals in class Object


Copyright © 2006 Atlassian Software Systems. All Rights Reserved.