org.apache.whirr
Class ClusterSpec

java.lang.Object
  extended by org.apache.whirr.ClusterSpec

public class ClusterSpec
extends Object

This class represents the specification of a cluster. It is used to describe the properties of a cluster before it is launched.


Nested Class Summary
static class ClusterSpec.Property
           
 
Constructor Summary
ClusterSpec()
           
ClusterSpec(org.apache.commons.configuration.Configuration config)
           
ClusterSpec(org.apache.commons.configuration.Configuration userConfig, boolean loadDefaults)
           
ClusterSpec(org.apache.commons.configuration.Configuration userConfig, boolean loadDefaults, Map<String,org.jclouds.byon.Node> byonNodes)
           
 
Method Summary
protected  void checkAndSetKeyPair()
           
 ClusterSpec copy()
          Create a deep object copy.
 boolean equals(Object o)
           
 String getAutoHostnamePrefix()
           
 String getAutoHostnameSuffix()
           
 String getAwsEc2PlacementGroup()
           
 Float getAwsEc2SpotPrice()
           
 String getBlobStoreCacheContainer()
           
 String getBlobStoreContextName()
           
 String getBlobStoreCredential()
           
 String getBlobStoreEndpoint()
          Optionally specifies the url of the blobstore provider.
 String getBlobStoreIdentity()
           
 String getBlobStoreLocationId()
           
 String getBlobStoreProvider()
           
 Map<String,org.jclouds.byon.Node> getByonNodes()
           
 List<String> getClientCidrs()
           
 File getClusterDirectory()
           
 String getClusterName()
           
 String getClusterUser()
           
 org.apache.commons.configuration.Configuration getConfiguration()
           
 org.apache.commons.configuration.Configuration getConfigurationForKeysMatching(Pattern pattern)
           
 org.apache.commons.configuration.Configuration getConfigurationForKeysWithPrefix(String prefix)
           
 String getContextName()
           
 String getCredential()
           
 String getEndpoint()
          Optionally specifies the url of the compute provider.
 Map<String,List<String>> getFirewallRules()
           
 String getIdentity()
           
 InstanceTemplate getInstanceTemplate(Set<String> roles)
           
 InstanceTemplate getInstanceTemplate(String... roles)
           
 List<InstanceTemplate> getInstanceTemplates()
           
 String getJdkInstallUrl()
           
 String getKerberosRealm()
           
 int getMaxStartupRetries()
           
 String getPrivateKey()
           
 File getPrivateKeyFile()
           
 String getProvider()
           
 String getPublicKey()
           
 String getRunUrlBase()
           
 String getServiceName()
           
 String getStateStore()
           
 String getStateStoreBlob()
           
 String getStateStoreContainer()
           
 org.jclouds.compute.domain.TemplateBuilderSpec getTemplate()
          Parameters that define how an instance is built, including hardware, image, and login information.
 String getVersion()
           
 int hashCode()
           
 boolean isStoreClusterInEtcHosts()
           
 boolean isStub()
           
 boolean isTerminateAllOnLaunchFailure()
           
 void setAutoHostnamePrefix(String autoHostnamePrefix)
           
 void setAutoHostnameSuffix(String autoHostnameSuffix)
           
 void setAwsEc2PlacementGroup(String awsEc2PlacementGroup)
           
 void setAwsEc2SpotPrice(Float value)
           
 void setBlobStoreCacheContainer(String container)
           
 void setBlobStoreContextName(String blobStoreContextName)
           
 void setBlobStoreCredential(String credential)
           
 void setBlobStoreEndpoint(String endpoint)
           
 void setBlobStoreIdentity(String identity)
           
 void setBlobStoreLocationId(String locationId)
           
 void setBlobStoreProvider(String provider)
           
 void setByonNodes(Map<String,org.jclouds.byon.Node> byonNodes)
          Sets the list of BYON nodes.
 void setClientCidrs(List<String> clientCidrs)
           
 void setClusterName(String clusterName)
           
 void setClusterUser(String user)
           
 void setContextName(String contextName)
           
 void setCredential(String credential)
           
 void setEndpoint(String endpoint)
           
 void setFirewallRules(Map<String,List<String>> firewallRules)
           
 void setIdentity(String identity)
           
 void setInstanceTemplates(List<InstanceTemplate> instanceTemplates)
           
 void setJdkInstallUrl(String jdkInstallUrl)
           
 void setKerberosRealm(String kerberosRealm)
           
 void setMaxStartupRetries(int maxStartupRetries)
           
 void setPrivateKey(File privateKey)
           
 void setPrivateKey(String privateKey)
          The rsa private key which is used as the login identity on the cloud nodes.
 void setProvider(String provider)
           
 void setPublicKey(File publicKey)
           
 void setPublicKey(String publicKey)
          The rsa public key which is authorized to login to your on the cloud nodes.
 void setRunUrlBase(String runUrlBase)
           
 void setServiceName(String serviceName)
           
 void setStateStore(String type)
           
 void setStateStoreBlob(String blob)
           
 void setStateStoreContainer(String container)
           
 void setStoreClusterInEtcHosts(boolean storeClusterInEtcHosts)
           
 void setTemplate(org.jclouds.compute.domain.TemplateBuilderSpec template)
           
 void setTerminateAllOnLaunchFailure(boolean terminateAllOnLaunchFailure)
           
 void setVersion(String version)
           
 String toString()
           
static ClusterSpec withNoDefaults()
          Create new empty instance for testing.
static ClusterSpec withNoDefaults(org.apache.commons.configuration.Configuration conf)
           
static ClusterSpec withTemporaryKeys()
          Create an instance that uses a temporary RSA key pair.
static ClusterSpec withTemporaryKeys(org.apache.commons.configuration.Configuration conf)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ClusterSpec

public ClusterSpec()
            throws org.apache.commons.configuration.ConfigurationException
Throws:
org.apache.commons.configuration.ConfigurationException

ClusterSpec

public ClusterSpec(org.apache.commons.configuration.Configuration config)
            throws org.apache.commons.configuration.ConfigurationException
Throws:
org.apache.commons.configuration.ConfigurationException

ClusterSpec

public ClusterSpec(org.apache.commons.configuration.Configuration userConfig,
                   boolean loadDefaults)
            throws org.apache.commons.configuration.ConfigurationException
Throws:
org.apache.commons.configuration.ConfigurationException

ClusterSpec

public ClusterSpec(org.apache.commons.configuration.Configuration userConfig,
                   boolean loadDefaults,
                   Map<String,org.jclouds.byon.Node> byonNodes)
            throws org.apache.commons.configuration.ConfigurationException
Throws:
org.apache.commons.configuration.ConfigurationException - if something is wrong
Method Detail

withTemporaryKeys

public static ClusterSpec withTemporaryKeys()
                                     throws org.apache.commons.configuration.ConfigurationException,
                                            com.jcraft.jsch.JSchException,
                                            IOException
Create an instance that uses a temporary RSA key pair.

Throws:
org.apache.commons.configuration.ConfigurationException
com.jcraft.jsch.JSchException
IOException

withTemporaryKeys

public static ClusterSpec withTemporaryKeys(org.apache.commons.configuration.Configuration conf)
                                     throws org.apache.commons.configuration.ConfigurationException,
                                            com.jcraft.jsch.JSchException,
                                            IOException
Throws:
org.apache.commons.configuration.ConfigurationException
com.jcraft.jsch.JSchException
IOException

withNoDefaults

public static ClusterSpec withNoDefaults()
                                  throws org.apache.commons.configuration.ConfigurationException
Create new empty instance for testing.

Throws:
org.apache.commons.configuration.ConfigurationException

withNoDefaults

public static ClusterSpec withNoDefaults(org.apache.commons.configuration.Configuration conf)
                                  throws org.apache.commons.configuration.ConfigurationException
Throws:
org.apache.commons.configuration.ConfigurationException

copy

public ClusterSpec copy()
                 throws org.apache.commons.configuration.ConfigurationException
Create a deep object copy. It's not enough to just copy the configuration because the object can also be modified using the setters and the changes are not reflected in the configuration object.

Throws:
org.apache.commons.configuration.ConfigurationException

checkAndSetKeyPair

protected void checkAndSetKeyPair()
                           throws org.apache.commons.configuration.ConfigurationException
Throws:
org.apache.commons.configuration.ConfigurationException

getInstanceTemplates

public List<InstanceTemplate> getInstanceTemplates()

getInstanceTemplate

public InstanceTemplate getInstanceTemplate(Set<String> roles)

getInstanceTemplate

public InstanceTemplate getInstanceTemplate(String... roles)

getMaxStartupRetries

public int getMaxStartupRetries()

getContextName

public String getContextName()

getProvider

public String getProvider()

isStub

public boolean isStub()

getEndpoint

public String getEndpoint()
Optionally specifies the url of the compute provider. For example, for openstack-nova, it is the keystone url, like: http://localhost:5000/v2.0/.


getIdentity

public String getIdentity()

getCredential

public String getCredential()

getClusterName

public String getClusterName()

getBlobStoreContextName

public String getBlobStoreContextName()

getBlobStoreProvider

public String getBlobStoreProvider()

getBlobStoreEndpoint

public String getBlobStoreEndpoint()
Optionally specifies the url of the blobstore provider. For example, for swift-keystone, it is the keystone url, like: http://localhost:5000/v2.0/.


getBlobStoreIdentity

public String getBlobStoreIdentity()

getBlobStoreCredential

public String getBlobStoreCredential()

getBlobStoreLocationId

public String getBlobStoreLocationId()

getBlobStoreCacheContainer

public String getBlobStoreCacheContainer()

getStateStore

public String getStateStore()

getStateStoreContainer

public String getStateStoreContainer()

getStateStoreBlob

public String getStateStoreBlob()

getAwsEc2SpotPrice

@Nullable
public Float getAwsEc2SpotPrice()

getServiceName

public String getServiceName()

getPrivateKey

public String getPrivateKey()

getPrivateKeyFile

public File getPrivateKeyFile()

getPublicKey

public String getPublicKey()

getTemplate

public org.jclouds.compute.domain.TemplateBuilderSpec getTemplate()
Parameters that define how an instance is built, including hardware, image, and login information.


getClientCidrs

public List<String> getClientCidrs()

getFirewallRules

public Map<String,List<String>> getFirewallRules()

getByonNodes

public Map<String,org.jclouds.byon.Node> getByonNodes()

getVersion

public String getVersion()

getRunUrlBase

public String getRunUrlBase()

getClusterUser

public String getClusterUser()

setInstanceTemplates

public void setInstanceTemplates(List<InstanceTemplate> instanceTemplates)

setMaxStartupRetries

public void setMaxStartupRetries(int maxStartupRetries)

setContextName

public void setContextName(String contextName)

setProvider

public void setProvider(String provider)

setEndpoint

public void setEndpoint(String endpoint)

setIdentity

public void setIdentity(String identity)

setCredential

public void setCredential(String credential)

setBlobStoreContextName

public void setBlobStoreContextName(String blobStoreContextName)

setBlobStoreProvider

public void setBlobStoreProvider(String provider)

setBlobStoreEndpoint

public void setBlobStoreEndpoint(String endpoint)

setBlobStoreIdentity

public void setBlobStoreIdentity(String identity)

setBlobStoreCredential

public void setBlobStoreCredential(String credential)

setBlobStoreLocationId

public void setBlobStoreLocationId(String locationId)

setBlobStoreCacheContainer

public void setBlobStoreCacheContainer(String container)

setStateStore

public void setStateStore(String type)

setStateStoreContainer

public void setStateStoreContainer(String container)

setStateStoreBlob

public void setStateStoreBlob(String blob)

setAwsEc2SpotPrice

public void setAwsEc2SpotPrice(@Nullable
                               Float value)

setClusterName

public void setClusterName(String clusterName)

setServiceName

public void setServiceName(String serviceName)

isTerminateAllOnLaunchFailure

public boolean isTerminateAllOnLaunchFailure()

setTerminateAllOnLaunchFailure

public void setTerminateAllOnLaunchFailure(boolean terminateAllOnLaunchFailure)

isStoreClusterInEtcHosts

public boolean isStoreClusterInEtcHosts()

setStoreClusterInEtcHosts

public void setStoreClusterInEtcHosts(boolean storeClusterInEtcHosts)

getAwsEc2PlacementGroup

public String getAwsEc2PlacementGroup()

setAwsEc2PlacementGroup

public void setAwsEc2PlacementGroup(String awsEc2PlacementGroup)

getAutoHostnameSuffix

public String getAutoHostnameSuffix()

setAutoHostnameSuffix

public void setAutoHostnameSuffix(String autoHostnameSuffix)

getAutoHostnamePrefix

public String getAutoHostnamePrefix()

setAutoHostnamePrefix

public void setAutoHostnamePrefix(String autoHostnamePrefix)

getJdkInstallUrl

public String getJdkInstallUrl()

setJdkInstallUrl

public void setJdkInstallUrl(String jdkInstallUrl)

getKerberosRealm

public String getKerberosRealm()

setKerberosRealm

public void setKerberosRealm(String kerberosRealm)

setPublicKey

public void setPublicKey(String publicKey)
The rsa public key which is authorized to login to your on the cloud nodes.

Parameters:
publicKey -

setPublicKey

public void setPublicKey(File publicKey)
                  throws IOException
Throws:
IOException - if there is a problem reading the file
See Also:
setPublicKey(String)

setPrivateKey

public void setPrivateKey(String privateKey)
The rsa private key which is used as the login identity on the cloud nodes.

Parameters:
privateKey -

setPrivateKey

public void setPrivateKey(File privateKey)
                   throws IOException
Throws:
IOException - if there is a problem reading the file
See Also:
setPrivateKey(String)

setTemplate

public void setTemplate(org.jclouds.compute.domain.TemplateBuilderSpec template)

setClientCidrs

public void setClientCidrs(List<String> clientCidrs)

setFirewallRules

public void setFirewallRules(Map<String,List<String>> firewallRules)

setByonNodes

public void setByonNodes(Map<String,org.jclouds.byon.Node> byonNodes)
Sets the list of BYON nodes. Optional. Once the Cluster has been initialized from the ClusterSpec, further calls to setByonNodes will not result in changes in the Cluster. Generally, byonNodes should be initialized via the full constructor rather than this setter.

Parameters:
byonNodes -

setVersion

public void setVersion(String version)

setRunUrlBase

public void setRunUrlBase(String runUrlBase)

setClusterUser

public void setClusterUser(String user)

getConfiguration

public org.apache.commons.configuration.Configuration getConfiguration()

getConfigurationForKeysWithPrefix

public org.apache.commons.configuration.Configuration getConfigurationForKeysWithPrefix(String prefix)

getConfigurationForKeysMatching

public org.apache.commons.configuration.Configuration getConfigurationForKeysMatching(Pattern pattern)

getClusterDirectory

public File getClusterDirectory()
Returns:
the directory for storing cluster-related files

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2010-2013 The Apache Software Foundation. All Rights Reserved.