Class FileBasedPersister
- java.lang.Object
-
- com.atlassian.bamboo.persister.file.FileBasedPersister
-
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
Fields Modifier and Type Field Description static StringADMIN_CONFIG_FILEstatic StringDEFAULT_BUILD_DIRECTORYstatic StringDEFAULT_CONFIG_DIRECTORY
-
Constructor Summary
Constructors Constructor Description FileBasedPersister(@Nullable BootstrapManager bootstrapManager, @NotNull XStreamFactory xStreamFactory)FileBasedPersister(XStreamFactory xStreamFactory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddBuildResults(PlanKey planKey, BuildResults buildResults)Associate the given buildResults with the given build.voidclear()Clears all interal caches the persister may havevoiddeleteBuildResults(PlanKey planKey, long buildNumber)Remove a specific build result MXLAdministrationConfigurationgetAdministrationConfiguration()Reload the persisted admin configuration dataAdministrationConfigurationgetAdministrationConfiguration(@Nullable FeatureManager featureManager)Reload the persisted admin configuration data@Nullable BuildResultsgetBuildResults(Key planKey, int buildNumber)Get the Nth build for a given build.StringgetConfigurationDirectory()Provide the UI with the current configuration directoryFilegetConfigurationDirectoryFile()Return the directory containing the administration.xml file.StringgetDataDirectory()Provide the UI with the current build data directoryFilegetDataDirectoryFile()StringgetName()What's the name of plugin - used to identify the plugin in the bamboo.xml configuration file.StringgetUrl()Who implemented this plugin?booleanisActive()Indicates whether this is currently active.booleanisInitialised()Does the persister reference valid admin configuration data?voidreload()Restart with the latest configurations...voidreloadAdministrationConfiguration()Reloads the administration configuration from the xml.voidsaveAdministrationConfiguration(AdministrationConfiguration administrationConfiguration)Save the given administrationConfiguration in the persister's configuration data directoryvoidsaveAdministrationConfigurationNoXsrfCheck(AdministrationConfiguration administrationConfiguration)voidsetConfigurationDirectory(String configurationDataDirectory)Set by the configuration loader from the value in the bamboo.xml data file.voidsetDataDirectory(String buildDataDirectory)Set by the configuration loader from the value in the bamboo.xml data file.voidsetPersisterOptions(PersisterOptions persisterOptions)Let the UI update the persistervoidstart()Make the persister available for use.voidstop()Stop the component and clean up any resources
-
-
-
Field Detail
-
ADMIN_CONFIG_FILE
public static final String ADMIN_CONFIG_FILE
- See Also:
- Constant Field Values
-
DEFAULT_BUILD_DIRECTORY
public static final String DEFAULT_BUILD_DIRECTORY
- See Also:
- Constant Field Values
-
DEFAULT_CONFIG_DIRECTORY
public static final String DEFAULT_CONFIG_DIRECTORY
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
FileBasedPersister
public FileBasedPersister(XStreamFactory xStreamFactory)
-
FileBasedPersister
public FileBasedPersister(@Nullable @Nullable BootstrapManager bootstrapManager, @NotNull @NotNull XStreamFactory xStreamFactory)
-
-
Method Detail
-
setPersisterOptions
public void setPersisterOptions(PersisterOptions persisterOptions)
Description copied from interface:PersisterLet the UI update the persister- Specified by:
setPersisterOptionsin interfacePersister
-
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:
getDataDirectoryFilein interfacePersister
-
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()
Description copied from interface:PersisterReturn the directory containing the administration.xml file.- Specified by:
getConfigurationDirectoryFilein interfacePersister- Returns:
-
start
public void start() throws ExceptionMake the persister available for use.
-
stop
public void stop() throws ExceptionDescription copied from interface:StartableStop the component and clean up any resources
-
isActive
public boolean isActive()
Description copied from interface:StartableIndicates whether this is currently active.
-
reload
public void reload()
Restart with the latest configurations...
-
clear
public void clear()
Description copied from interface:PersisterClears all interal caches the persister may have
-
isInitialised
public boolean isInitialised()
Does the persister reference valid admin configuration data?- Specified by:
isInitialisedin interfacePersister- Returns:
- true if the persister can load the admin configuration file
-
reloadAdministrationConfiguration
public void reloadAdministrationConfiguration()
Description copied from interface:PersisterReloads the administration configuration from the xml.- Specified by:
reloadAdministrationConfigurationin interfacePersister
-
getAdministrationConfiguration
public AdministrationConfiguration getAdministrationConfiguration()
Description copied from interface:PersisterReload the persisted admin configuration data- Specified by:
getAdministrationConfigurationin interfacePersister- Returns:
- The data
-
getAdministrationConfiguration
public AdministrationConfiguration getAdministrationConfiguration(@Nullable @Nullable FeatureManager featureManager)
Description copied from interface:PersisterReload the persisted admin configuration data- Specified by:
getAdministrationConfigurationin interfacePersister- Returns:
- The data
-
saveAdministrationConfiguration
public void saveAdministrationConfiguration(AdministrationConfiguration administrationConfiguration)
Save the given administrationConfiguration in the persister's configuration data directory- Specified by:
saveAdministrationConfigurationin interfacePersister- Parameters:
administrationConfiguration- The object to save
-
saveAdministrationConfigurationNoXsrfCheck
public void saveAdministrationConfigurationNoXsrfCheck(AdministrationConfiguration administrationConfiguration)
-
deleteBuildResults
public void deleteBuildResults(PlanKey planKey, long buildNumber)
Description copied from interface:PersisterRemove a specific build result MXL- Specified by:
deleteBuildResultsin interfacePersisterbuildNumber- The build to remove
-
addBuildResults
public void addBuildResults(PlanKey planKey, BuildResults buildResults)
Description copied from interface:PersisterAssociate the given buildResults with the given build.- Specified by:
addBuildResultsin interfacePersisterbuildResults- The build results we are adding
-
getBuildResults
@Nullable public @Nullable BuildResults getBuildResults(Key planKey, int buildNumber)
Description copied from interface:PersisterGet the Nth build for a given build.- Specified by:
getBuildResultsin interfacePersisterbuildNumber- The build's build number- Returns:
- The build result
-
-