com.atlassian.bamboo.agent.elastic.server
Class ElasticFunctionalityFacadeImpl

java.lang.Object
  extended by com.atlassian.bamboo.agent.elastic.server.ElasticFunctionalityFacadeImpl
All Implemented Interfaces:
ElasticFunctionalityFacade

public class ElasticFunctionalityFacadeImpl
extends java.lang.Object
implements ElasticFunctionalityFacade


Field Summary
 
Fields inherited from interface com.atlassian.bamboo.agent.elastic.server.ElasticFunctionalityFacade
DEFAULT_ALLOWED_AGENTS, ELASTIC_BAMBOO_SECURITY_GROUP
 
Constructor Summary
ElasticFunctionalityFacadeImpl()
           
 
Method Summary
 void addElasticLogEntry(java.lang.String logEntry)
           
 void adjustElasticInstanceNumbers(ElasticInstanceSchedule instanceSchedule)
          Given the ElasticInstanceSchedule startup or bring down the correct number of agents
protected  void attemptShutdownInstances(java.util.Collection<RemoteElasticInstance> instances, int agentsToShutdown, ElasticImageConfiguration elasticImageConfiguration)
           
 java.util.Map<java.lang.String,com.atlassian.aws.ec2.EC2AvailabilityZone> getAvailabilityZones()
          Returns a list of availability zones and their status.
 ElasticConfiguration getElasticConfig()
          Retrieve ElasticConfiguration object from persistent storage.
 int getMaxConcurrentInstances()
           
 java.lang.String getPkFileLocation()
           
 boolean isElasticSupportEnabled()
           
 boolean isElasticSupportPossible(ErrorCollection errorCollection)
           
 void persistElasticConfig(ElasticConfiguration elasticConfiguration)
          Persist ElasticConfiguration object.
 void recheckElasticSupportEnabledFlag()
           
 void setAdministrationConfigurationManager(AdministrationConfigurationManager administrationConfigurationManager)
           
 void setApplicationConfig(com.atlassian.config.ApplicationConfiguration applicationConfig)
           
 void setAwsManager(com.atlassian.aws.AWSManager awsManager)
           
 void setBambooLicenseManager(BambooLicenseManager bambooLicenseManager)
           
 void setElasticAgentManager(ElasticInstanceManager elasticInstanceManager)
           
 void setElasticImageConfigurationAccessor(ElasticImageConfigurationAccessor elasticImageConfigurationAccessor)
           
 void setElasticSupportEnabled(boolean elasticSupportEnabled)
          Enable/disable Elastic Bamboo functionality
 void setEventManager(com.atlassian.event.EventManager eventManager)
           
 void setLocalAgentManager(LocalAgentManager localAgentManager)
           
 void setRemoteAgentManager(RemoteAgentManager remoteAgentManager)
           
 void setStopBuildManager(StopBuildManager stopBuildManager)
           
 void setTextProvider(com.opensymphony.xwork.TextProvider textProvider)
           
 void shutdownAllInstances()
           
 void shutdownInstance(RemoteElasticInstance elasticInstance)
           
 void shutdownInstance(java.lang.String instanceId)
           
 void startupAgents(java.util.Collection<ElasticImageConfiguration> elasticImageConfigurations)
          Starts the given number of agents
 void updateAgentPendingStatus(java.lang.String instanceId)
          Set the agent pending status to true for the given instance id
 boolean validateAgentCreation(int numAgentsRequired, ErrorCollection errorCollection)
          Validates whether the requested number of agents can be created and adds any errors to the error collection.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ElasticFunctionalityFacadeImpl

public ElasticFunctionalityFacadeImpl()
Method Detail

recheckElasticSupportEnabledFlag

public void recheckElasticSupportEnabledFlag()
Specified by:
recheckElasticSupportEnabledFlag in interface ElasticFunctionalityFacade

shutdownInstance

public void shutdownInstance(@NotNull
                             RemoteElasticInstance elasticInstance)
Specified by:
shutdownInstance in interface ElasticFunctionalityFacade

shutdownInstance

public void shutdownInstance(java.lang.String instanceId)
                      throws com.atlassian.aws.AWSException
Specified by:
shutdownInstance in interface ElasticFunctionalityFacade
Throws:
com.atlassian.aws.AWSException

shutdownAllInstances

public void shutdownAllInstances()
Specified by:
shutdownAllInstances in interface ElasticFunctionalityFacade

startupAgents

public void startupAgents(java.util.Collection<ElasticImageConfiguration> elasticImageConfigurations)
                   throws com.atlassian.aws.AWSException
Starts the given number of agents

Specified by:
startupAgents in interface ElasticFunctionalityFacade
Throws:
com.atlassian.aws.AWSException

isElasticSupportEnabled

public boolean isElasticSupportEnabled()
Specified by:
isElasticSupportEnabled in interface ElasticFunctionalityFacade
Returns:
true, if elastic support is turned on

isElasticSupportPossible

public boolean isElasticSupportPossible(@NotNull
                                        ErrorCollection errorCollection)
Specified by:
isElasticSupportPossible in interface ElasticFunctionalityFacade
Returns:
true, if all preconditions for turning elastic support on are met

setElasticSupportEnabled

public void setElasticSupportEnabled(boolean elasticSupportEnabled)
Description copied from interface: ElasticFunctionalityFacade
Enable/disable Elastic Bamboo functionality

Specified by:
setElasticSupportEnabled in interface ElasticFunctionalityFacade
Parameters:
elasticSupportEnabled - Specifies if Elastc Baboo shall be enabled or disabled.

validateAgentCreation

public boolean validateAgentCreation(int numAgentsRequired,
                                     ErrorCollection errorCollection)
Description copied from interface: ElasticFunctionalityFacade
Validates whether the requested number of agents can be created and adds any errors to the error collection.

Specified by:
validateAgentCreation in interface ElasticFunctionalityFacade
Parameters:
numAgentsRequired - - number of agents to be created
errorCollection - - error collection to add any validation errors to.

getElasticConfig

@Nullable
public ElasticConfiguration getElasticConfig()
Description copied from interface: ElasticFunctionalityFacade
Retrieve ElasticConfiguration object from persistent storage.

Specified by:
getElasticConfig in interface ElasticFunctionalityFacade
Returns:

persistElasticConfig

public void persistElasticConfig(@NotNull
                                 ElasticConfiguration elasticConfiguration)
Description copied from interface: ElasticFunctionalityFacade
Persist ElasticConfiguration object.

Specified by:
persistElasticConfig in interface ElasticFunctionalityFacade

getAvailabilityZones

@NotNull
public java.util.Map<java.lang.String,com.atlassian.aws.ec2.EC2AvailabilityZone> getAvailabilityZones()
                                                                                               throws com.atlassian.aws.AWSException
Description copied from interface: ElasticFunctionalityFacade
Returns a list of availability zones and their status.

Specified by:
getAvailabilityZones in interface ElasticFunctionalityFacade
Returns:
A map of zones and their availability keyed by zone name.
Throws:
com.atlassian.aws.AWSException

updateAgentPendingStatus

public void updateAgentPendingStatus(@NotNull
                                     java.lang.String instanceId)
Description copied from interface: ElasticFunctionalityFacade
Set the agent pending status to true for the given instance id

Specified by:
updateAgentPendingStatus in interface ElasticFunctionalityFacade

addElasticLogEntry

public void addElasticLogEntry(java.lang.String logEntry)
Specified by:
addElasticLogEntry in interface ElasticFunctionalityFacade

adjustElasticInstanceNumbers

public void adjustElasticInstanceNumbers(@NotNull
                                         ElasticInstanceSchedule instanceSchedule)
                                  throws com.atlassian.aws.AWSException
Description copied from interface: ElasticFunctionalityFacade
Given the ElasticInstanceSchedule startup or bring down the correct number of agents

Specified by:
adjustElasticInstanceNumbers in interface ElasticFunctionalityFacade
Throws:
com.atlassian.aws.AWSException

attemptShutdownInstances

protected void attemptShutdownInstances(java.util.Collection<RemoteElasticInstance> instances,
                                        int agentsToShutdown,
                                        ElasticImageConfiguration elasticImageConfiguration)

getMaxConcurrentInstances

public int getMaxConcurrentInstances()
Specified by:
getMaxConcurrentInstances in interface ElasticFunctionalityFacade
Returns:
max number of elastic instances allowed for this instance. It's based on license restrictions.

getPkFileLocation

@NotNull
public java.lang.String getPkFileLocation()
Specified by:
getPkFileLocation in interface ElasticFunctionalityFacade

setLocalAgentManager

public void setLocalAgentManager(LocalAgentManager localAgentManager)

setElasticAgentManager

public void setElasticAgentManager(ElasticInstanceManager elasticInstanceManager)

setBambooLicenseManager

public void setBambooLicenseManager(BambooLicenseManager bambooLicenseManager)

setElasticImageConfigurationAccessor

public void setElasticImageConfigurationAccessor(ElasticImageConfigurationAccessor elasticImageConfigurationAccessor)

setAwsManager

public void setAwsManager(com.atlassian.aws.AWSManager awsManager)

setEventManager

public void setEventManager(com.atlassian.event.EventManager eventManager)

setRemoteAgentManager

public void setRemoteAgentManager(RemoteAgentManager remoteAgentManager)

setAdministrationConfigurationManager

public void setAdministrationConfigurationManager(AdministrationConfigurationManager administrationConfigurationManager)

setTextProvider

public void setTextProvider(com.opensymphony.xwork.TextProvider textProvider)

setApplicationConfig

public void setApplicationConfig(com.atlassian.config.ApplicationConfiguration applicationConfig)

setStopBuildManager

public void setStopBuildManager(StopBuildManager stopBuildManager)


Copyright © 2009 Atlassian Pty Ltd. All Rights Reserved.