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 java.lang.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 java.lang.String ADMIN_CONFIG_FILE
           
static java.lang.String DEFALT_BUILD_DIRECTORY
           
static java.lang.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 deleteBuildResults(Build build, long buildNumber)
          Remove a specific build result MXL
 AdministrationConfiguration getAdministrationConfiguration()
          Reload the persisted admin configuration data
protected  BuildPersisterDecorator getBuildDecorator()
          Lets us override the default behaviour when testing
 BuildResults getBuildResults(java.lang.String planKey, java.lang.Integer buildNumber)
          Get the Nth build for a given build.
 java.lang.String getConfigurationDirectory()
          Provide the UI with the current configuration directory
 java.io.File getConfigurationDirectoryFile()
          Return the directory containing the administration.xml file.
 java.lang.String getDataDirectory()
          Provide the UI with the current build data directory
 java.io.File getDataDirectoryFile()
           
 java.lang.String getName()
          What's the name of plugin - used to identify the plugin in the bamboo.xml configuration file.
 java.lang.String getUrl()
          Who implemented this plugin?
 boolean isActive()
          Indicates whether this is currently active.
 boolean isInitialised()
          Does the persister reference valid admin configuration data?
 void reload()
          Restart with the latest configurations...
 void reloadAdministrationConfiguration()
          Reloads the administration configuration from the xml.
 void saveAdministrationConfiguration(AdministrationConfiguration administrationConfiguration)
          Save the given administrationConfiguration in the persister's configiuration data directory
 void setConfigurationDirectory(java.lang.String configurationDataDirectory)
          Set by the configuration loader from the value in the bamboo.xml data file.
 void setDataDirectory(java.lang.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 start()
          Make the persister available for use.
 void stop()
          Stop the component and clean up any resources
 void updateBuildResults(Build build, BuildResults buildResults)
           
 
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 java.lang.String ADMIN_CONFIG_FILE
See Also:
Constant Field Values

DEFALT_BUILD_DIRECTORY

public static final java.lang.String DEFALT_BUILD_DIRECTORY

DEFALT_CONFIG_DIRECTORY

public static final java.lang.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 java.lang.String getName()
What's the name of plugin - used to identify the plugin in the bamboo.xml configuration file.

Returns:
the name

getUrl

public java.lang.String getUrl()
Who implemented this plugin?


setDataDirectory

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

Parameters:
buildDataDirectory - The build data directory

getDataDirectory

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

Returns:
The directory

getDataDirectoryFile

public java.io.File getDataDirectoryFile()
Specified by:
getDataDirectoryFile in interface Persister

setConfigurationDirectory

public void setConfigurationDirectory(java.lang.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 java.lang.String getConfigurationDirectory()
Provide the UI with the current configuration directory

Returns:
The directory

getConfigurationDirectoryFile

public java.io.File getConfigurationDirectoryFile()
Description copied from interface: Persister
Return the directory containing the administration.xml file.

Specified by:
getConfigurationDirectoryFile in interface Persister
Returns:

start

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

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

stop

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

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

isActive

public boolean isActive()
Description copied from interface: Startable

Indicates whether this is currently active.

Specified by:
isActive in interface Startable
Returns:
true if this is active, false otherwise.

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


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

reloadAdministrationConfiguration

public void reloadAdministrationConfiguration()
Description copied from interface: Persister
Reloads the administration configuration from the xml.

Specified by:
reloadAdministrationConfiguration in interface Persister

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

deleteBuildResults

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

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)
Specified by:
updateBuildResults in interface Persister

getBuildResults

public BuildResults getBuildResults(java.lang.String planKey,
                                    java.lang.Integer buildNumber)
Description copied from interface: Persister
Get the Nth build for a given build.

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


Copyright © 2010 Atlassian. All Rights Reserved.