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

java.lang.Object
  extended by com.atlassian.bamboo.agent.elastic.server.ElasticInstanceManagerImpl
All Implemented Interfaces:
ElasticInstanceManager, ElasticAgentTunnelPorts

public class ElasticInstanceManagerImpl
extends java.lang.Object
implements ElasticInstanceManager


Field Summary
 
Fields inherited from interface com.atlassian.bamboo.agent.elastic.server.ElasticInstanceManager
DEFAULT_INSTANCE_TYPE
 
Constructor Summary
ElasticInstanceManagerImpl(AwsAccountBean awsAccountBean, AdministrationConfigurationManager administrationConfigurationManager, int startupTimeoutSeconds, java.util.concurrent.Executor executor, KeyStoreFactory keyStoreFactory, SSLContextFactory sslContextFactory, BootstrapManager bootstrapManager, ErrorHandler errorHandler, com.atlassian.bamboo.agent.elastic.server.EBSVolumeSupervisorFactory ebsVolumeSupervisorFactory)
           
 
Method Summary
 void addElasticLogEntry(java.lang.String logEntry)
          Add a line to the elastic activity logs
 void ensureLoginKeyPairExists(com.atlassian.aws.AWSAccount awsAccount)
          Ensures that a key pair, named "elasticbamboo", has been defined in the configured AWS account.
 com.google.common.collect.SetMultimap<ElasticImageConfiguration,RemoteElasticInstance> getAllElasticAgentsAsMap()
          Returns all elastic instances in a SetMultimap, keyed by the ElasticImageConfiguration
 java.util.List<RemoteElasticInstance> getAllElasticRemoteAgents()
          Returns all elastic agents.
 java.util.Set<com.atlassian.aws.ec2.EC2InstanceType> getAllowedInstanceTypes()
           
 java.lang.String getDefaultImageId()
           
 java.util.List<java.lang.String> getElasticAgentLogs()
          Retrieve activity logs
 RemoteElasticInstance getElasticRemoteAgentByInstanceId(java.lang.String instanceId)
          Retrieve elastic instance of the given ID.
 java.util.List<RemoteElasticInstance> getElasticRemoteAgents()
          Retrieve a readonly list of any currently existing EC2 instances
 java.util.List<RemoteElasticInstance> getElasticRemoteAgentsByConfiguration(ElasticImageConfiguration elasticImageConfiguration)
           
 java.util.List<RemoteElasticInstance> getElasticRemoteAgentsByConfiguration(long id)
           
 int getHTTPProxyPort()
          The TCP port upon which the Elastic Agent listens for HTTP traffic intended for the Bamboo Server.
 int getJMSProxyPort()
          The TCP port upon which the Elastic Agent listens for JMS traffic intended for the Bamboo Server.
 java.util.List<RemoteElasticInstance> getRequestedElasticRemoteAgents()
          Return the elastic instances which have been requested but not yet started up yet.
 int getTotalNumElasticRemoteAgents()
          Return how many license spots are currently being occupied by elastic instances (pending and running)
 int getTunnelPort()
          The TCP port upon which Elastic Agents listens for incoming tunnel connections from the Bamboo Server.
 boolean isElasticSupportEnabled()
           
 RemoteElasticInstance newElasticAgent(RemoteElasticInstanceListener listener, com.atlassian.aws.AWSAccount awsAccount, LocalAgentManager localAgentManager, ElasticImageConfiguration elasticImageConfiguration)
           
 void registerElasticAgentStarted(RemoteElasticInstance instance)
          Tell the manager that the agent is up and running
 void registerElasticAgentStopped(RemoteElasticInstance instance)
          Remove and EC2 instance from the "currently Running map
 boolean validateAwsCredentials(java.lang.String awsAccessID, java.lang.String awsSecretKey, ErrorCollection errorCollection)
          Validate a set of supplied AWS credentials.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ElasticInstanceManagerImpl

public ElasticInstanceManagerImpl(AwsAccountBean awsAccountBean,
                                  AdministrationConfigurationManager administrationConfigurationManager,
                                  int startupTimeoutSeconds,
                                  java.util.concurrent.Executor executor,
                                  KeyStoreFactory keyStoreFactory,
                                  SSLContextFactory sslContextFactory,
                                  BootstrapManager bootstrapManager,
                                  ErrorHandler errorHandler,
                                  com.atlassian.bamboo.agent.elastic.server.EBSVolumeSupervisorFactory ebsVolumeSupervisorFactory)
Method Detail

newElasticAgent

public RemoteElasticInstance newElasticAgent(RemoteElasticInstanceListener listener,
                                             com.atlassian.aws.AWSAccount awsAccount,
                                             @NotNull
                                             LocalAgentManager localAgentManager,
                                             @NotNull
                                             ElasticImageConfiguration elasticImageConfiguration)
                                      throws java.security.NoSuchAlgorithmException,
                                             java.security.KeyManagementException,
                                             java.io.IOException,
                                             java.security.cert.CertificateException,
                                             java.security.UnrecoverableKeyException,
                                             java.security.KeyStoreException
Specified by:
newElasticAgent in interface ElasticInstanceManager
Throws:
java.security.NoSuchAlgorithmException
java.security.KeyManagementException
java.io.IOException
java.security.cert.CertificateException
java.security.UnrecoverableKeyException
java.security.KeyStoreException

ensureLoginKeyPairExists

public void ensureLoginKeyPairExists(com.atlassian.aws.AWSAccount awsAccount)
                              throws com.atlassian.aws.AWSException
Description copied from interface: ElasticInstanceManager

Ensures that a key pair, named "elasticbamboo", has been defined in the configured AWS account.

Specified by:
ensureLoginKeyPairExists in interface ElasticInstanceManager
Parameters:
awsAccount - that should contain the key pair
Throws:
com.atlassian.aws.AWSException - if there is a problem communicating with EC2.

getDefaultImageId

@Nullable
public java.lang.String getDefaultImageId()
Specified by:
getDefaultImageId in interface ElasticInstanceManager

validateAwsCredentials

public boolean validateAwsCredentials(java.lang.String awsAccessID,
                                      java.lang.String awsSecretKey,
                                      ErrorCollection errorCollection)
Description copied from interface: ElasticInstanceManager

Validate a set of supplied AWS credentials.

Specified by:
validateAwsCredentials in interface ElasticInstanceManager
Parameters:
awsAccessID - The Access ID of the Amazon Web Services Account
awsSecretKey - The Secret Key of the Amazon Web Services Account
errorCollection - An ErrorCollection to which validation errors should be added, or null if validation errors are not required.
Returns:
true if the supplied credentials are successfully validated; false otherwise.

getElasticRemoteAgents

@NotNull
public java.util.List<RemoteElasticInstance> getElasticRemoteAgents()
Description copied from interface: ElasticInstanceManager
Retrieve a readonly list of any currently existing EC2 instances

Specified by:
getElasticRemoteAgents in interface ElasticInstanceManager
Returns:
List of RemoteElasticInstance

getElasticRemoteAgentsByConfiguration

@NotNull
public java.util.List<RemoteElasticInstance> getElasticRemoteAgentsByConfiguration(ElasticImageConfiguration elasticImageConfiguration)
Specified by:
getElasticRemoteAgentsByConfiguration in interface ElasticInstanceManager

getElasticRemoteAgentsByConfiguration

@NotNull
public java.util.List<RemoteElasticInstance> getElasticRemoteAgentsByConfiguration(long id)
Specified by:
getElasticRemoteAgentsByConfiguration in interface ElasticInstanceManager

getElasticRemoteAgentByInstanceId

@Nullable
public RemoteElasticInstance getElasticRemoteAgentByInstanceId(java.lang.String instanceId)
Description copied from interface: ElasticInstanceManager
Retrieve elastic instance of the given ID.

Specified by:
getElasticRemoteAgentByInstanceId in interface ElasticInstanceManager
Parameters:
instanceId - of the instance
Returns:
the elastic remote agent specific to the provided instance id

getRequestedElasticRemoteAgents

@NotNull
public java.util.List<RemoteElasticInstance> getRequestedElasticRemoteAgents()
Description copied from interface: ElasticInstanceManager
Return the elastic instances which have been requested but not yet started up yet.

Specified by:
getRequestedElasticRemoteAgents in interface ElasticInstanceManager
Returns:
List of elastic instances which have been requested but not yet started up yet..

getAllElasticRemoteAgents

public java.util.List<RemoteElasticInstance> getAllElasticRemoteAgents()
Description copied from interface: ElasticInstanceManager
Returns all elastic agents. It includes requested agents as well as active agents

Specified by:
getAllElasticRemoteAgents in interface ElasticInstanceManager
Returns:

getAllElasticAgentsAsMap

public com.google.common.collect.SetMultimap<ElasticImageConfiguration,RemoteElasticInstance> getAllElasticAgentsAsMap()
Description copied from interface: ElasticInstanceManager
Returns all elastic instances in a SetMultimap, keyed by the ElasticImageConfiguration

Specified by:
getAllElasticAgentsAsMap in interface ElasticInstanceManager
Returns:

getTotalNumElasticRemoteAgents

public int getTotalNumElasticRemoteAgents()
Description copied from interface: ElasticInstanceManager
Return how many license spots are currently being occupied by elastic instances (pending and running)

Specified by:
getTotalNumElasticRemoteAgents in interface ElasticInstanceManager
Returns:
Number of license slots currently occupied by elastic instances (pending and running).

registerElasticAgentStarted

public void registerElasticAgentStarted(@NotNull
                                        RemoteElasticInstance instance)
Description copied from interface: ElasticInstanceManager
Tell the manager that the agent is up and running

Specified by:
registerElasticAgentStarted in interface ElasticInstanceManager
Parameters:
instance - - the agent that is running

registerElasticAgentStopped

public void registerElasticAgentStopped(@NotNull
                                        RemoteElasticInstance instance)
Description copied from interface: ElasticInstanceManager
Remove and EC2 instance from the "currently Running map

Specified by:
registerElasticAgentStopped in interface ElasticInstanceManager
Parameters:
instance - - the one to be deleted from the map

addElasticLogEntry

public void addElasticLogEntry(java.lang.String logEntry)
Description copied from interface: ElasticInstanceManager
Add a line to the elastic activity logs

Specified by:
addElasticLogEntry in interface ElasticInstanceManager
Parameters:
logEntry - - the line you want added to the logs

getElasticAgentLogs

public java.util.List<java.lang.String> getElasticAgentLogs()
Description copied from interface: ElasticInstanceManager
Retrieve activity logs

Specified by:
getElasticAgentLogs in interface ElasticInstanceManager
Returns:
a copy of the current elastic agent logs

isElasticSupportEnabled

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

getAllowedInstanceTypes

@NotNull
public java.util.Set<com.atlassian.aws.ec2.EC2InstanceType> getAllowedInstanceTypes()
Specified by:
getAllowedInstanceTypes in interface ElasticInstanceManager
Returns:
Set of allowed instance types.

getTunnelPort

public int getTunnelPort()
Description copied from interface: ElasticAgentTunnelPorts

The TCP port upon which Elastic Agents listens for incoming tunnel connections from the Bamboo Server.

Specified by:
getTunnelPort in interface ElasticAgentTunnelPorts

getHTTPProxyPort

public int getHTTPProxyPort()
Description copied from interface: ElasticAgentTunnelPorts

The TCP port upon which the Elastic Agent listens for HTTP traffic intended for the Bamboo Server.

Specified by:
getHTTPProxyPort in interface ElasticAgentTunnelPorts

getJMSProxyPort

public int getJMSProxyPort()
Description copied from interface: ElasticAgentTunnelPorts

The TCP port upon which the Elastic Agent listens for JMS traffic intended for the Bamboo Server.

Specified by:
getJMSProxyPort in interface ElasticAgentTunnelPorts


Copyright © 2010 Atlassian. All Rights Reserved.