com.atlassian.jira.vcs
Interface RepositoryManager

All Known Implementing Classes:
DefaultRepositoryManager

public interface RepositoryManager

The RepositoryManager is used to interface with JIRA's CVS integration. Through this manager you can create, retrieve, update, and delete CVS repository references. You can also associate/unassociate repositories with JIRA projects.

NOTE: JIRA also integrates with Perforce and Subversion repositories but this integration is done via JIRA's plugin framework and therefore does not utilize this manager.


Field Summary
static String CVS_TYPE
           
static long VCS_SERVICE_DELAY
           
static String VCS_SERVICE_NAME
           
static Collection<String> VCS_TYPES
           
 
Method Summary
 Repository createRepository(String type, String name, String description, Properties properties)
          Creates a new Repository with the provided attributes and properties and creates a VcsService if one does not yet exist.
 Map<Long,Set<CVSCommit>> getCommits(Issue issue, com.atlassian.crowd.embedded.api.User remoteUser)
          Retrieves all of the commits for this Issue from ALL of the repositories associated with the issue's project.
 Collection<org.ofbiz.core.entity.GenericValue> getProjectsForRepository(Repository repository)
          This method allows you to find the projects that have been associated with a given Repository.
 com.opensymphony.module.propertyset.PropertySet getPropertySet(org.ofbiz.core.entity.GenericValue versionControlGV)
          Retrieves a PropertySet for a repository provided the repositories GenericValue.
 Collection<Repository> getRepositories()
          This method will return all Repository's that exist within JIRA.
 Collection<Repository> getRepositoriesForProject(org.ofbiz.core.entity.GenericValue project)
          This method will return a list of Repositorys that are associated with the provided project.
 Repository getRepository(Long id)
          Retrieves the Repository by its Repository.getId().
 Repository getRepository(String name)
          Retrieves the Repository by its Repository.getName().
 boolean isValidType(String type)
          Validates if a Repository.getType() is valid for this RepositoryManager.
 void refresh()
          This will clear the repository cache and load all Repository's from the datastore.
 void removeRepository(Long id)
          This method will remove the Repository specified by id from the datastore and it will remove all associations that may exist from the repository to projects.
 void setProjectRepositories(org.ofbiz.core.entity.GenericValue project, Collection<Long> repositoryIds)
          This method will associate the provided repositories with the provided project.
 boolean updateRepositories()
          Tries to update (e.g.
 void updateRepository(Long id, String type, String name, String description, Properties properties)
          Updates the properties and attributes of the Repository with the given id.
 

Field Detail

CVS_TYPE

static final String CVS_TYPE
See Also:
Constant Field Values

VCS_TYPES

static final Collection<String> VCS_TYPES

VCS_SERVICE_NAME

static final String VCS_SERVICE_NAME
See Also:
Constant Field Values

VCS_SERVICE_DELAY

static final long VCS_SERVICE_DELAY
See Also:
Constant Field Values
Method Detail

getRepositoriesForProject

Collection<Repository> getRepositoriesForProject(org.ofbiz.core.entity.GenericValue project)
                                                 throws org.ofbiz.core.entity.GenericEntityException
This method will return a list of Repositorys that are associated with the provided project.

Parameters:
project - a GenericValue representing the project associated with the repositories you would like to retrieve.
Returns:
collection of Repository's.
Throws:
org.ofbiz.core.entity.GenericEntityException - if there is a problem accessing the data store.

setProjectRepositories

void setProjectRepositories(org.ofbiz.core.entity.GenericValue project,
                            Collection<Long> repositoryIds)
                            throws org.ofbiz.core.entity.GenericEntityException
This method will associate the provided repositories with the provided project. The provided repository id's must reference valid existing repository instances. Associating a repository with a project causes JIRA to show relevant commit messages on the projects CVS issue tab panel.

Parameters:
project - a GenericValue representing the project to associate the repositories to.
repositoryIds - a list of Long's representing the Repository.getId() of the repositories you would like to associate with the project.
Throws:
org.ofbiz.core.entity.GenericEntityException - thrown if a repository id can not be resolved.

getProjectsForRepository

Collection<org.ofbiz.core.entity.GenericValue> getProjectsForRepository(Repository repository)
                                                                        throws org.ofbiz.core.entity.GenericEntityException
This method allows you to find the projects that have been associated with a given Repository.

Parameters:
repository - represents the repository associated with the collection of projects returned.
Returns:
a collection of GenericValues that represent the projects the provided repository are associated with.
Throws:
org.ofbiz.core.entity.GenericEntityException - thrown if there is trouble accessing the datastore.

getRepositories

Collection<Repository> getRepositories()
This method will return all Repository's that exist within JIRA.

Returns:
a collection of Repository objects.

getRepository

Repository getRepository(Long id)
                         throws org.ofbiz.core.entity.GenericEntityException
Retrieves the Repository by its Repository.getId(). If the repository is not found in the datastore a RuntimeException will be generated.

Parameters:
id - represents the repositories id.
Returns:
a Repository object as found by id.
Throws:
org.ofbiz.core.entity.GenericEntityException - thrown if there is trouble accessing the datastore.

getRepository

Repository getRepository(String name)
Retrieves the Repository by its Repository.getName(). If the repository is not found then this will return null.

Parameters:
name - represents the repositories name.
Returns:
the Repository with the given name if one is found, null otherwise.

isValidType

boolean isValidType(String type)
Validates if a Repository.getType() is valid for this RepositoryManager.

Parameters:
type - is a repository type (e.g. CVS_TYPE)
Returns:
true if the passed type is in the VCS_TYPES, false otherwise.

removeRepository

void removeRepository(Long id)
                      throws Exception
This method will remove the Repository specified by id from the datastore and it will remove all associations that may exist from the repository to projects.

Parameters:
id - represents the repositories id.
Throws:
Exception - thrown if there is trouble removing the values from the datastore.

updateRepository

void updateRepository(Long id,
                      String type,
                      String name,
                      String description,
                      Properties properties)
                      throws org.ofbiz.core.entity.GenericEntityException
Updates the properties and attributes of the Repository with the given id. All passed in values will replace any previously existing values. For example, if you would like to change the description, but not the name you should pass in all the existing attributes and properties as well as the new description.

Parameters:
id - represents the repositories id.
type - represents the type to update the repository to.
name - represents the name to update the repository to.
description - represents the description to update the repository to.
properties - defines the properties to update on the repository.
Throws:
org.ofbiz.core.entity.GenericEntityException - thrown if the Repository can not be found by id or if there is trouble accessing the datastore.

updateRepositories

boolean updateRepositories()
                           throws org.ofbiz.core.entity.GenericEntityException
Tries to update (e.g. cvs up) all the repositories in the system.

Returns:
true if ALL repositories were updated without a problem, false if an exception occurred.
Throws:
org.ofbiz.core.entity.GenericEntityException - throw if there is trouble accessing the datastore.

createRepository

Repository createRepository(String type,
                            String name,
                            String description,
                            Properties properties)
                            throws Exception
Creates a new Repository with the provided attributes and properties and creates a VcsService if one does not yet exist.

Parameters:
type - the type of the Repository, this should be CVS_TYPE.
name - the name of the Repository.
description - the description of the Repository.
properties - are properties that are essential for the repository to work, such as ViewCvsBrowser.ROOT_PARAMETER and ViewCvsBrowser.KEY_BASE_URL.
Returns:
the Repository object representation of the newly created repository.
Throws:
Exception - thrown if there is a problem creating the repository, this could be caused by trouble accessing the datastore, or trouble creating the VcsService.

refresh

void refresh()
             throws org.ofbiz.core.entity.GenericEntityException
This will clear the repository cache and load all Repository's from the datastore.

Throws:
org.ofbiz.core.entity.GenericEntityException - thrown if there is trouble accessing the datastore.

getPropertySet

com.opensymphony.module.propertyset.PropertySet getPropertySet(org.ofbiz.core.entity.GenericValue versionControlGV)
Retrieves a PropertySet for a repository provided the repositories GenericValue. The property set stores values such as ViewCvsBrowser.ROOT_PARAMETER and ViewCvsBrowser.KEY_BASE_URL.

Parameters:
versionControlGV - the generic value representation of the repository.
Returns:
the PropertySet for the specified repository.

getCommits

Map<Long,Set<CVSCommit>> getCommits(Issue issue,
                                    com.atlassian.crowd.embedded.api.User remoteUser)
Retrieves all of the commits for this Issue from ALL of the repositories associated with the issue's project. It will only show commits if the user has the Permissions.VIEW_VERSION_CONTROL permission.

Returns a map of (repository id -> Set of CVSCommit):

If the map is empty, there are no associated repositories for the issue and user. If the List of CVSCommit is null, then the vcs log has not yet been parsed for that repository.

Parameters:
issue - is the issue which identifies the project which should be used to find Repository's.
remoteUser - is the user who's permissions will determine which commits are visible. This is the user who is making the browse request.
Returns:
map of (repository id -> List of CVSCommit)


Copyright © 2002-2012 Atlassian. All Rights Reserved.