com.atlassian.bamboo.persister.file
Class FileBasedPersister

java.lang.Object
  extended by com.atlassian.bamboo.persister.file.FileBasedPersister
All Implemented Interfaces:
Startable, Persister

public class FileBasedPersister
extends Object
implements Persister

This class persists all data as xml data files on the file system.

It uses a decorator chain of BuildPersisterDecorators to handle caching, and actually saving.


Field Summary
static String ADMIN_CONFIG_FILE
           
static String DEFALT_BUILD_DIRECTORY
           
static String DEFALT_CONFIG_DIRECTORY
           
 
Constructor Summary
FileBasedPersister()
           
FileBasedPersister(BootstrapManager bootstrapManager)
           
 
Method Summary
 void addBuildResults(Build build, BuildResults buildResults)
          Associate the given buildResults with the given build.
 void clear()
          Clears all interal caches the persister may have
 void deleteBuild(Build build)
          Remove a build from the System.
 void deleteBuildResults(Build build, long buildNumber)
          Remove a specific build build.
 AdministrationConfiguration getAdministrationConfiguration()
          Reload the persisted admin configuration data
 Build getBuildByKey(String buildKey)
          Obtain the build with the given buildKey
 Build getBuildByName(String buildName)
          Deprecated.  
protected  BuildPersisterDecorator getBuildDecorator()
          Lets us override the default behaviour when testing
 BuildResults getBuildResults(Build build, long buildNumber)
          Get the Nth build for a given build.
 Collection getBuilds()
          Obtain a collection of all the currently persisted builds.
 String getConfigurationDirectory()
          Provide the UI with the current configuration directory
 File getConfigurationDirectoryFile()
           
 int getCurrentVersion()
          Return the version of the persisted data
 String getDataDirectory()
          Provide the UI with the current build data directory
 File getDataDirectoryFile()
           
 String getName()
          What's the name of plugin - used to identify the plugin in the bamboo.xml configuration file.
 String getUrl()
          Who implemented this plugin?
 VersionUpgrader getVersionUpgrader()
          Which upgrader does the persister use?
 boolean isExistingBuild(String buildName)
          Have we persisted a build with the given buildName?
 boolean isInitialised()
          Does the persister reference valid admin configuration data?
 void reload()
          Restart with the latest configurations...
 void saveAdministrationConfiguration(AdministrationConfiguration administrationConfiguration)
          Save the given administrationConfiguration in the persister's configiuration data directory
 void saveBuild(Build build)
          Persist a build.
 void setBuildManager(BuilderManager builderManager)
           
 void setConfigurationDirectory(String configurationDataDirectory)
          Set by the configuration loader from the value in the bamboo.xml data file.
 void setDataDirectory(String buildDataDirectory)
          Set by the configuration loader from the value in the bamboo.xml data file.
 void setPersisterOptions(PersisterOptions persisterOptions)
          Let the UI update the persister
 void setVersionUpgrader(VersionUpgrader versionUpgrader)
          Set by the configuration loader when the persister is first instantiated.
 void start()
          Make the persister available for use.
 void stop()
          Stop the component and clean up any resources
 void updateBuildResults(Build build, BuildResults buildResults)
           
 void updateToCurrentVersion()
          The system requests the that the persisted data is upgraded to work with the lasted code.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ADMIN_CONFIG_FILE

public static final String ADMIN_CONFIG_FILE
See Also:
Constant Field Values

DEFALT_BUILD_DIRECTORY

public static final String DEFALT_BUILD_DIRECTORY

DEFALT_CONFIG_DIRECTORY

public static final String DEFALT_CONFIG_DIRECTORY
Constructor Detail

FileBasedPersister

public FileBasedPersister()

FileBasedPersister

public FileBasedPersister(BootstrapManager bootstrapManager)
Method Detail

setPersisterOptions

public void setPersisterOptions(PersisterOptions persisterOptions)
Description copied from interface: Persister
Let the UI update the persister

Specified by:
setPersisterOptions in interface Persister

getName

public String getName()
What's the name of plugin - used to identify the plugin in the bamboo.xml configuration file.

Returns:
the name

getUrl

public String getUrl()
Who implemented this plugin?


setDataDirectory

public void setDataDirectory(String buildDataDirectory)
Set by the configuration loader from the value in the bamboo.xml data file.

Parameters:
buildDataDirectory - The build data directory

getDataDirectory

public String getDataDirectory()
Provide the UI with the current build data directory

Returns:
The directory

getDataDirectoryFile

public File getDataDirectoryFile()
Specified by:
getDataDirectoryFile in interface Persister

getCurrentVersion

public int getCurrentVersion()
Description copied from interface: Persister
Return the version of the persisted data

Specified by:
getCurrentVersion in interface Persister
Returns:
The version number

getVersionUpgrader

public VersionUpgrader getVersionUpgrader()
Description copied from interface: Persister
Which upgrader does the persister use?

Specified by:
getVersionUpgrader in interface Persister
Returns:
The upgrader

setBuildManager

public void setBuildManager(BuilderManager builderManager)
Specified by:
setBuildManager in interface Persister

setConfigurationDirectory

public void setConfigurationDirectory(String configurationDataDirectory)
Set by the configuration loader from the value in the bamboo.xml data file.

Parameters:
configurationDataDirectory - The server configuration data directory

getConfigurationDirectory

public String getConfigurationDirectory()
Provide the UI with the current configuration directory

Returns:
The directory

getConfigurationDirectoryFile

public File getConfigurationDirectoryFile()

setVersionUpgrader

public void setVersionUpgrader(VersionUpgrader versionUpgrader)
Set by the configuration loader when the persister is first instantiated.

Specified by:
setVersionUpgrader in interface Persister

start

public void start()
           throws Exception
Make the persister available for use.

Specified by:
start in interface Startable
Throws:
Exception - A generic exception

stop

public void stop()
          throws Exception
Description copied from interface: Startable
Stop the component and clean up any resources

Specified by:
stop in interface Startable
Throws:
Exception - A generic failure

reload

public void reload()
Restart with the latest configurations...

Specified by:
reload in interface Persister

clear

public void clear()
Description copied from interface: Persister
Clears all interal caches the persister may have

Specified by:
clear in interface Persister

getBuildDecorator

protected BuildPersisterDecorator getBuildDecorator()
Lets us override the default behaviour when testing


updateToCurrentVersion

public void updateToCurrentVersion()
The system requests the that the persisted data is upgraded to work with the lasted code.

Specified by:
updateToCurrentVersion in interface Persister

isInitialised

public boolean isInitialised()
Does the persister reference valid admin configuration data?

Specified by:
isInitialised in interface Persister
Returns:
true if the persister can load the admin configuration file

getAdministrationConfiguration

public AdministrationConfiguration getAdministrationConfiguration()
Description copied from interface: Persister
Reload the persisted admin configuration data

Specified by:
getAdministrationConfiguration in interface Persister
Returns:
The data

saveAdministrationConfiguration

public void saveAdministrationConfiguration(AdministrationConfiguration administrationConfiguration)
Save the given administrationConfiguration in the persister's configiuration data directory

Specified by:
saveAdministrationConfiguration in interface Persister
Parameters:
administrationConfiguration - The object to save

getBuildByName

public Build getBuildByName(String buildName)
Deprecated. 

Description copied from interface: Persister
Obtain the build with the given buildName

Specified by:
getBuildByName in interface Persister
Parameters:
buildName - The name of the persisted build we require
Returns:
The build

getBuildByKey

public Build getBuildByKey(String buildKey)
Description copied from interface: Persister
Obtain the build with the given buildKey

Specified by:
getBuildByKey in interface Persister
Parameters:
buildKey - The key of the persisted build we require
Returns:
The build

isExistingBuild

public boolean isExistingBuild(String buildName)
Description copied from interface: Persister
Have we persisted a build with the given buildName?

Specified by:
isExistingBuild in interface Persister
Parameters:
buildName - The name of the build we're checking
Returns:
true iff we have already persisted a build with this name

getBuilds

public Collection getBuilds()
Description copied from interface: Persister
Obtain a collection of all the currently persisted builds.

Specified by:
getBuilds in interface Persister
Returns:
The builds

saveBuild

public void saveBuild(Build build)
Description copied from interface: Persister
Persist a build.

It creates builds that have not already been persisted and updates ones that have.

Specified by:
saveBuild in interface Persister
Parameters:
build - The build

deleteBuild

public void deleteBuild(Build build)
Description copied from interface: Persister
Remove a build from the System.

Specified by:
deleteBuild in interface Persister
Parameters:
build - The build to delete

deleteBuildResults

public void deleteBuildResults(Build build,
                               long buildNumber)
Description copied from interface: Persister
Remove a specific build build.

Specified by:
deleteBuildResults in interface Persister
Parameters:
build - The build it's being removed from
buildNumber - The build to remove

addBuildResults

public void addBuildResults(Build build,
                            BuildResults buildResults)
Description copied from interface: Persister
Associate the given buildResults with the given build.

Specified by:
addBuildResults in interface Persister
Parameters:
build - The build we are adding the new build result to
buildResults - The build results we are adding

updateBuildResults

public void updateBuildResults(Build build,
                               BuildResults buildResults)

getBuildResults

public BuildResults getBuildResults(Build build,
                                    long buildNumber)
Description copied from interface: Persister
Get the Nth build for a given build.

Specified by:
getBuildResults in interface Persister
Parameters:
build - The build
buildNumber - The build's build number
Returns:
The build result


Copyright © 2006 Atlassian Software Systems. All Rights Reserved.