com.atlassian.bamboo.persister
Class CachedBuildPersisterDecorator

java.lang.Object
  extended by com.atlassian.bamboo.persister.CachedBuildPersisterDecorator
All Implemented Interfaces:
Startable, BuildPersisterDecorator

public class CachedBuildPersisterDecorator
extends Object
implements BuildPersisterDecorator

Caches the builds so speed up performance and handle transient LegacyBuildObject fields.


Constructor Summary
CachedBuildPersisterDecorator(BuildPersisterDecorator parent)
           
 
Method Summary
 void deleteBuild(Build build)
          Remove the build from the internal cache and pass it along to the parent to do the actual deleting
 void deleteBuildResults(Build build, long buildNumber)
          Remove a specific build build
 Iterator getBuildNames()
          Obtain an iterator that visits the names of the builds currently held in the cache.
 long getNumberOfCachedBuilds()
           
 BuildResults loadBuildResults(Build build, long buildNumber)
          Cache the build results so that the least used results get purged
 Collection loadBuilds()
          Obtain the list of build's currently in the cache
 Build loadBuilds(String buildName)
          Tries to load the requested build from the cache.
 void saveBuild(Build build)
          Save the build in the internal cache and pass it along to the parent to do the actual saving
 void saveBuildResults(Build build, BuildResults buildResults)
          Simply pass this request onto the parent
 void start()
          Loads the cache from the parent decorator on startup;
 void stop()
          Stop the component and clean up any resources
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CachedBuildPersisterDecorator

public CachedBuildPersisterDecorator(BuildPersisterDecorator parent)
Method Detail

start

public void start()
           throws Exception
Loads the cache from the parent decorator on startup;

Specified by:
start in interface Startable
Throws:
Exception - a generic failure

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

saveBuild

public void saveBuild(Build build)
               throws PersisterException
Save the build in the internal cache and pass it along to the parent to do the actual saving

Specified by:
saveBuild in interface BuildPersisterDecorator
Parameters:
build - The build to same
Throws:
PersisterException - A generic failure

deleteBuild

public void deleteBuild(Build build)
                 throws PersisterException
Remove the build from the internal cache and pass it along to the parent to do the actual deleting

Specified by:
deleteBuild in interface BuildPersisterDecorator
Parameters:
build - The build to delete
Throws:
PersisterException - A generic failure

deleteBuildResults

public void deleteBuildResults(Build build,
                               long buildNumber)
                        throws PersisterException
Remove a specific build build

Specified by:
deleteBuildResults in interface BuildPersisterDecorator
Parameters:
build - The build the build belongs to
buildNumber - The build number
Throws:
PersisterException

loadBuilds

public Build loadBuilds(String buildName)
                 throws PersisterException
Tries to load the requested build from the cache. If it is not in the cache, it's loaded from the parent.

Specified by:
loadBuilds in interface BuildPersisterDecorator
Parameters:
buildName - The name of the build we are after
Returns:
The build, null a build with the given name does not exist
Throws:
PersisterException - A generic failure

saveBuildResults

public void saveBuildResults(Build build,
                             BuildResults buildResults)
                      throws PersisterException
Simply pass this request onto the parent

Specified by:
saveBuildResults in interface BuildPersisterDecorator
Parameters:
build - The buildResults' build
buildResults - The build results to persist
Throws:
PersisterException - Failed to persist the build results

loadBuildResults

public BuildResults loadBuildResults(Build build,
                                     long buildNumber)
                              throws PersisterException
Cache the build results so that the least used results get purged

Specified by:
loadBuildResults in interface BuildPersisterDecorator
Parameters:
build - The build whos build results we want to load
buildNumber - The number of the build results we are interested in
Returns:
The buildResults
Throws:
PersisterException - Failed to load the build results

loadBuilds

public Collection loadBuilds()
                      throws PersisterException
Obtain the list of build's currently in the cache

Specified by:
loadBuilds in interface BuildPersisterDecorator
Returns:
The collections of Build objects.
Throws:
PersisterException - A generic failure

getBuildNames

public Iterator getBuildNames()
Obtain an iterator that visits the names of the builds currently held in the cache.

Specified by:
getBuildNames in interface BuildPersisterDecorator
Returns:
The iterator.

getNumberOfCachedBuilds

public long getNumberOfCachedBuilds()


Copyright © 2006 Atlassian Software Systems. All Rights Reserved.