public abstract class AbstractEc2InstanceLaunchingFactoryBean extends AbstractFactoryBean
Public AMIs will need to be created, bundled and registered for each server setup. A subclass of this FactoryBean is then added to create the actual target object (e.g. a DataSource), implementing the {link #doCreateInstance} method. This method will be supplied the IP address of the instance that was created, enabling the subclass to configure the created instance appropriately.
logger
Constructor and Description |
---|
AbstractEc2InstanceLaunchingFactoryBean() |
Modifier and Type | Method and Description |
---|---|
protected Object |
createInstance() |
protected void |
destroyInstance(Object ignored) |
protected abstract Object |
doCreateInstance(String ip)
Implement to create the actual target object.
|
void |
setAwsKey(String awsKey)
Set the AWS key.
|
void |
setAwsSecretKey(String awsSecretKey)
Set the AWS secret key.
|
void |
setGroupName(String groupName)
Set the name of the access group.
|
void |
setImageName(String imageName)
Set the name of the AMI image to be launched.
|
void |
setKeypairName(String keypairName)
Set the name of the keypair.
|
afterPropertiesSet, destroy, getBeanFactory, getBeanTypeConverter, getEarlySingletonInterfaces, getObject, getObjectType, isSingleton, setBeanClassLoader, setBeanFactory, setSingleton
public AbstractEc2InstanceLaunchingFactoryBean()
public void setImageName(String imageName)
imageName
- the AMI image name.public void setAwsKey(String awsKey)
awsKey
- the AWS key.public void setAwsSecretKey(String awsSecretKey)
awsSecretKey
- the aws secret key.public void setKeypairName(String keypairName)
keypairName
- The keypair name.public void setGroupName(String groupName)
groupName
- the group name.protected final Object createInstance() throws Exception
createInstance
in class AbstractFactoryBean
Exception
protected abstract Object doCreateInstance(String ip) throws Exception
ip
- the ip address of the launched EC2 image.Exception
- if an error occurs during initialization.protected void destroyInstance(Object ignored) throws Exception
destroyInstance
in class AbstractFactoryBean
Exception