com.atlassian.fisheye.spi.admin.services
Interface RepositoryAdminService


public interface RepositoryAdminService

API for adminstration of FishEye repositories.

Most methods require a String parameter, name, naming the repository.

All methods, unless mentioned otherwise, will throw the following exceptions:

NotFoundException
if the supplied repository name doesn't exist.
NotPermittedException
if the requesting user isn't an administrator.


Method Summary
 void create(RepositoryData repData)
          Creates a repository and leaves it disabled.
 void delete(java.lang.String name)
          Delete a repository.
 void disable(java.lang.String name)
          Disable the repository.
 void enable(java.lang.String name)
          Enable the repository.
 DefaultRepositoryOptions getDefaultOptions()
          Get the default repository options.
 RepositoryOptions getEffectiveOptions(java.lang.String name)
          Get the effective repository options for the repository, after delegating to- and merging with the repository defaults.
 RepositoryIndexer getIndexer(java.lang.String name)
          Get the repository indexing service for the repository.
 java.util.Set<java.lang.String> getNames()
          Returns the name of all repositories.
 java.util.Set<RepositoryData> getRepositories()
          Returns the RepositoryData of all repositories.
 RepositoryData getRepositoryData(java.lang.String name)
          Return the data object for the repository.
 RepositoryOptions getRepositoryOptions(java.lang.String name)
          Return the repository options defined for the repository.
 RepositoryState getState(java.lang.String name)
          Return the state of the repository.
 boolean isEnabled(java.lang.String name)
          Whether the repository is enabled.
 void setDefaultOptions(DefaultRepositoryOptions options)
          Set the default repository options.
 void setRepositoryOptions(java.lang.String name, RepositoryOptions options)
          Set the repository options for just the specified repostiory.
 RepositoryState start(java.lang.String name)
          Start the repository.
 RepositoryState stop(java.lang.String name)
          Non-blocking call to stop the repository.
 RepositoryState stopAndWait(java.lang.String name, long timeoutMs)
          Blocking call to stop the repository.
 RepositoryUpdateResult update(RepositoryData repData)
           
 

Method Detail

getNames

java.util.Set<java.lang.String> getNames()
Returns the name of all repositories.

Returns:
a Set of all repository names, or an empty set if there are none

getRepositories

java.util.Set<RepositoryData> getRepositories()
Returns the RepositoryData of all repositories.

Returns:
a Set of RepositoryData, or an empty set if there are none

getRepositoryData

RepositoryData getRepositoryData(java.lang.String name)
Return the data object for the repository.


getRepositoryOptions

RepositoryOptions getRepositoryOptions(java.lang.String name)
Return the repository options defined for the repository.

This excludes any merging with the default repository options. Use getEffectiveOptions(String) to get the effective options used by the repository.


setRepositoryOptions

void setRepositoryOptions(java.lang.String name,
                          RepositoryOptions options)
                          throws RepositoryConfigException
Set the repository options for just the specified repostiory.

When querying repository options, FishEye combines the repository and default options (see getEffectiveOptions(String)).

Throws:
java.lang.NullPointerException - if options is null
RepositoryConfigException - if the repository options could not be persisted

getDefaultOptions

DefaultRepositoryOptions getDefaultOptions()
Get the default repository options.

Returns:
the default repository options

setDefaultOptions

void setDefaultOptions(DefaultRepositoryOptions options)
                       throws RepositoryConfigException
Set the default repository options.

Throws:
java.lang.NullPointerException - if options is null
RepositoryConfigException - if the default repository options could not be persisted

getEffectiveOptions

RepositoryOptions getEffectiveOptions(java.lang.String name)
Get the effective repository options for the repository, after delegating to- and merging with the repository defaults.


create

void create(RepositoryData repData)
            throws RepositoryConfigException
Creates a repository and leaves it disabled.

For CVS repositories, the directory must exist otherwise creation will fail.

Throws:
java.lang.IllegalArgumentException - if the repository name is already used
RepositoryConfigException - if the repository couldn't be created

update

RepositoryUpdateResult update(RepositoryData repData)
                              throws RepositoryConfigException
Throws:
NotFoundException - if the repository name doesn't exist
RepositoryConfigException - if the repository couldn't be updated

getState

RepositoryState getState(java.lang.String name)
Return the state of the repository.

Throws:
java.lang.IllegalStateException - if the repository is disabled

isEnabled

boolean isEnabled(java.lang.String name)
Whether the repository is enabled.


enable

void enable(java.lang.String name)
            throws RepositoryConfigException
Enable the repository.

Throws:
java.lang.IllegalStateException - if the repository is enabled
RepositoryConfigException - if the enabling could not be persisted

disable

void disable(java.lang.String name)
             throws RepositoryConfigException
Disable the repository.

Throws:
java.lang.IllegalStateException - if the repository is disabled or not @{link RepositoryState#STOPPED}
RepositoryConfigException - if the disabling could not be persisted

stop

RepositoryState stop(java.lang.String name)
Non-blocking call to stop the repository.

This method does not wait for the repository to stop. Use getState(String) to check the progress of stopping the repository.

Returns:
RepositoryState.STOPPING, or RepositoryState.STOPPED if immediately stopped
Throws:
java.lang.IllegalStateException - if the repository is disabled or not @{link RepositoryState#RUNNING}

stopAndWait

RepositoryState stopAndWait(java.lang.String name,
                            long timeoutMs)
Blocking call to stop the repository.

Behaves the same as stop(String), but waits upto approximately timeoutMs for the repository to stop before returning.

Parameters:
timeoutMs - if timeoutMs <= 0, this acts as a call to stop(String)
Returns:
RepositoryState.STOPPING, or RepositoryState.STOPPED if stopped after waiting
See Also:
stop(String)

start

RepositoryState start(java.lang.String name)
                      throws RepositoryConfigException
Start the repository.

Returns:
RepositoryState.STARTING or RepositoryState.RUNNING if successfully started
Throws:
java.lang.IllegalStateException - if the repository is disabled or not RepositoryState.STOPPED
RepositoryConfigException - if there was a problem starting the repository

delete

void delete(java.lang.String name)
            throws RepositoryConfigException
Delete a repository.

Throws:
java.lang.IllegalStateException - if the repository is enabled but not @{link RepositoryState#STOPPED}
RepositoryConfigException - if there was a problem deleting the repository

getIndexer

RepositoryIndexer getIndexer(java.lang.String name)
Get the repository indexing service for the repository.

Returns:
an instance of CvsRepositoryIndexer, GitRepositoryIndexer, P4RepositoryIndexer, or SvnRepositoryIndexer. You should cast the result based on the type of the repository.