Brooklyn

brooklyn.location.jclouds
[Java] Class JcloudsLocation

java.lang.Object
  brooklyn.location.basic.AbstractLocation
      brooklyn.location.cloud.AbstractCloudMachineProvisioningLocation
          brooklyn.location.jclouds.JcloudsLocation
All Implemented Interfaces:
JcloudsLocationConfig

public class JcloudsLocation
extends AbstractCloudMachineProvisioningLocation

For provisioning and managing VMs in a particular provider/region, using jclouds. Configuration flags are defined in JcloudsLocationConfig.


Field Summary
static java.util.List COMMON_USER_NAMES_TO_TRY

static Logger LOG

these userNames are known to be the preferred/required logins in some common/default images where root@ is not allowed to log in

static java.util.List ROOT_ALIASES

static java.lang.String ROOT_USERNAME

static java.util.Map SUPPORTED_TEMPLATE_BUILDER_PROPERTIES

static java.util.Map SUPPORTED_TEMPLATE_OPTIONS_PROPERTIES

properties which cause customization of the TemplateOptions

 
Fields inherited from class AbstractLocation
LOG, PARENT_LOCATION, hostGeoInfo, name
 
Constructor Summary
JcloudsLocation()

JcloudsLocation(java.util.Map conf)

 
Method Summary
static java.io.File asFile(java.lang.Object o)

protected Template buildTemplate(ComputeService computeService, ConfigBag config)

void configure(java.util.Map properties)

protected JcloudsSshMachineLocation createJcloudsSshMachineLocation(NodeMetadata node, java.lang.String vmHostname, ConfigBag setup)

protected java.lang.String extractAvailabilityZone(ConfigBag setup, NodeMetadata node)

protected java.lang.String extractNodeLocationId(ConfigBag setup, NodeMetadata node, LocationScope scope)

protected java.lang.String extractProvider(ConfigBag setup, NodeMetadata node)

Extracts the user that jclouds tells us about (i.e. from the jclouds node).

protected java.lang.String extractRegion(ConfigBag setup, NodeMetadata node)

protected java.util.Map extractSshConfig(ConfigBag setup, NodeMetadata node)

protected LoginCredentials extractVmCredentials(ConfigBag setup, NodeMetadata node)

static java.lang.String fileAsString(java.lang.Object o)

static java.util.Set getAllSupportedProperties()

ComputeService getComputeService()

ComputeService getComputeService(java.util.Map flags)

attaches a string describing where something is being created (provider, region/location and/or endpoint, callerContext)

java.lang.String getCredential()

protected java.util.Collection getCustomizers(ConfigBag setup)

java.lang.String getEndpoint()

java.lang.String getIdentity()

returns the location ID used by the provider, if set, e.g. us-west-1

java.lang.String getJcloudsProviderLocationId()

protected java.util.concurrent.Semaphore getMachineCreationSemaphore()

java.lang.String getProvider()

java.util.Map getProvisioningFlags(java.util.Collection tags)

java.lang.String getRegion()

@deprecated since 0.5.0 use getRegion

java.lang.String getUser(ConfigBag config)

void init()

protected LoginCredentials initUserTemplateOptions(Template template, ConfigBag config)

java.util.Set listNodes()

java.util.Set listNodes(java.util.Map flags)

protected void logAvailableTemplates(ConfigBag config)

JcloudsLocation newSubLocation(java.util.Map newFlags)

JcloudsSshMachineLocation obtain()

core method for obtaining a VM using jclouds; Map should contain CLOUD_PROVIDER and CLOUD_ENDPOINT or CLOUD_REGION, depending on the cloud, as well as ACCESS_IDENTITY and ACCESS_CREDENTIAL, plus any further properties to specify e.g. images, hardware profiles, accessing user (for initial login, and a user potentially to create for subsequent ie normal access)

JcloudsSshMachineLocation obtain(TemplateBuilder tb)

JcloudsSshMachineLocation obtain(java.util.Map flags, TemplateBuilder tb)

JcloudsSshMachineLocation obtain(java.util.Map flags)

protected JcloudsSshMachineLocation obtainOnce(ConfigBag setup)

JcloudsSshMachineLocation rebindMachine(NodeMetadata metadata)

JcloudsSshMachineLocation rebindMachine(java.util.Map flags, NodeMetadata metadata)

JcloudsSshMachineLocation rebindMachine(ConfigBag setup)

JcloudsSshMachineLocation rebindMachine(java.util.Map flags)

protected JcloudsSshMachineLocation registerJcloudsSshMachineLocation(NodeMetadata node, java.lang.String vmHostname, ConfigBag setup)

void release(SshMachineLocation machine)

protected void releaseNode(java.lang.String instanceId)

protected void releaseNodeSafely(NodeMetadata node)

protected void releaseSafely(SshMachineLocation machine)

protected void setCreationString(ConfigBag config)

void setDefaultImageId(java.lang.String val)

protected boolean setHostname(ConfigBag setup, NodeMetadata metadata, boolean rethrow)

protected void setHostnameUpdatingCredentials(ConfigBag setup, NodeMetadata metadata)

void setTagMapping(java.util.Map val)

protected static byte[] toByteArray(java.lang.Object v)

protected static double toDouble(java.lang.Object v)

protected static java.util.List toListOfStrings(java.lang.Object v)

protected static java.util.Map toMapStringString(java.lang.Object v)

java.lang.String toString()

protected static java.lang.String[] toStringArray(java.lang.Object v)

java.lang.String toVerboseString()

protected void waitForReachable(ComputeService computeService, NodeMetadata node, LoginCredentials expectedCredentials, ConfigBag setup)

 
Methods inherited from class AbstractCloudMachineProvisioningLocation
extractSshConfig, getProvisioningFlags, newSubLocation
 
Methods inherited from class AbstractLocation
addChild, addChild, addChildLocation, addExtension, assertNotYetManaged, configure, containsLocation, equals, findLocationProperty, getAllConfig, getAllConfig, getChildLocations, getChildren, getConfig, getConfigBag, getDisplayName, getExtension, getHostGeoInfo, getId, getLocationProperty, getManagementContext, getName, getParent, getParentLocation, getRawLocalConfigBag, getRebindSupport, hasConfig, hasConfig, hasExtension, hasLocationProperty, hashCode, init, isLegacyConstruction, isManaged, onManagementStarted, onManagementStopped, removeChild, removeChildLocation, setConfig, setHostGeoInfo, setManagementContext, setName, setParent, setParentLocation, string, toMetadataRecord, toString, toVerboseString
 

Field Detail

COMMON_USER_NAMES_TO_TRY

public static final java.util.List COMMON_USER_NAMES_TO_TRY


LOG

public static final Logger LOG
these userNames are known to be the preferred/required logins in some common/default images where root@ is not allowed to log in


ROOT_ALIASES

public static final java.util.List ROOT_ALIASES


ROOT_USERNAME

public static final java.lang.String ROOT_USERNAME


SUPPORTED_TEMPLATE_BUILDER_PROPERTIES

public static final java.util.Map SUPPORTED_TEMPLATE_BUILDER_PROPERTIES


SUPPORTED_TEMPLATE_OPTIONS_PROPERTIES

public static final java.util.Map SUPPORTED_TEMPLATE_OPTIONS_PROPERTIES
properties which cause customization of the TemplateOptions


 
Constructor Detail

JcloudsLocation

public JcloudsLocation()


JcloudsLocation

public JcloudsLocation(java.util.Map conf)


 
Method Detail

asFile

public static java.io.File asFile(java.lang.Object o)


buildTemplate

protected Template buildTemplate(ComputeService computeService, ConfigBag config)


configure

}
public void configure(java.util.Map properties)


createJcloudsSshMachineLocation

protected JcloudsSshMachineLocation createJcloudsSshMachineLocation(NodeMetadata node, java.lang.String vmHostname, ConfigBag setup)


extractAvailabilityZone

protected java.lang.String extractAvailabilityZone(ConfigBag setup, NodeMetadata node)


extractNodeLocationId

protected java.lang.String extractNodeLocationId(ConfigBag setup, NodeMetadata node, LocationScope scope)


extractProvider

protected java.lang.String extractProvider(ConfigBag setup, NodeMetadata node)
Extracts the user that jclouds tells us about (i.e. from the jclouds node).


extractRegion

protected java.lang.String extractRegion(ConfigBag setup, NodeMetadata node)


extractSshConfig

protected java.util.Map extractSshConfig(ConfigBag setup, NodeMetadata node)


extractVmCredentials

protected LoginCredentials extractVmCredentials(ConfigBag setup, NodeMetadata node)


fileAsString

public static java.lang.String fileAsString(java.lang.Object o)


getAllSupportedProperties

public static final java.util.Set getAllSupportedProperties()


getComputeService

public ComputeService getComputeService()


getComputeService

public ComputeService getComputeService(java.util.Map flags)
attaches a string describing where something is being created (provider, region/location and/or endpoint, callerContext)


getCredential

public java.lang.String getCredential()


getCustomizers

protected java.util.Collection getCustomizers(ConfigBag setup)


getEndpoint

public java.lang.String getEndpoint()


getIdentity

public java.lang.String getIdentity()
returns the location ID used by the provider, if set, e.g. us-west-1


getJcloudsProviderLocationId

public java.lang.String getJcloudsProviderLocationId()


getMachineCreationSemaphore

protected java.util.concurrent.Semaphore getMachineCreationSemaphore()


getProvider

public java.lang.String getProvider()


getProvisioningFlags

public java.util.Map getProvisioningFlags(java.util.Collection tags)


getRegion

public java.lang.String getRegion()
deprecated:
since 0.5.0 use getRegion


getUser

public java.lang.String getUser(ConfigBag config)


init

@Override
public void init()


initUserTemplateOptions

protected LoginCredentials initUserTemplateOptions(Template template, ConfigBag config)


listNodes

public java.util.Set listNodes()


listNodes

public java.util.Set listNodes(java.util.Map flags)


logAvailableTemplates

protected void logAvailableTemplates(ConfigBag config)


newSubLocation

}
public JcloudsLocation newSubLocation(java.util.Map newFlags)


obtain

public JcloudsSshMachineLocation obtain()
core method for obtaining a VM using jclouds; Map should contain CLOUD_PROVIDER and CLOUD_ENDPOINT or CLOUD_REGION, depending on the cloud, as well as ACCESS_IDENTITY and ACCESS_CREDENTIAL, plus any further properties to specify e.g. images, hardware profiles, accessing user (for initial login, and a user potentially to create for subsequent ie normal access)


obtain

public JcloudsSshMachineLocation obtain(TemplateBuilder tb)


obtain

public JcloudsSshMachineLocation obtain(java.util.Map flags, TemplateBuilder tb)


obtain

public JcloudsSshMachineLocation obtain(java.util.Map flags)


obtainOnce

protected JcloudsSshMachineLocation obtainOnce(ConfigBag setup)


rebindMachine

public JcloudsSshMachineLocation rebindMachine(NodeMetadata metadata)


rebindMachine

public JcloudsSshMachineLocation rebindMachine(java.util.Map flags, NodeMetadata metadata)


rebindMachine

public JcloudsSshMachineLocation rebindMachine(ConfigBag setup)


rebindMachine

public JcloudsSshMachineLocation rebindMachine(java.util.Map flags)


registerJcloudsSshMachineLocation

protected JcloudsSshMachineLocation registerJcloudsSshMachineLocation(NodeMetadata node, java.lang.String vmHostname, ConfigBag setup)


release

LOG.warn("overriding username 'root' in favour of '"+nodeCredentials.getUser()+"' at {}; this behaviour may be removed in future", node);
public void release(SshMachineLocation machine)


releaseNode

protected void releaseNode(java.lang.String instanceId)


releaseNodeSafely

protected void releaseNodeSafely(NodeMetadata node)


releaseSafely

protected void releaseSafely(SshMachineLocation machine)


setCreationString

protected void setCreationString(ConfigBag config)


setDefaultImageId

public void setDefaultImageId(java.lang.String val)


setHostname

protected boolean setHostname(ConfigBag setup, NodeMetadata metadata, boolean rethrow)


setHostnameUpdatingCredentials

protected void setHostnameUpdatingCredentials(ConfigBag setup, NodeMetadata metadata)


setTagMapping

public void setTagMapping(java.util.Map val)


toByteArray

protected static byte[] toByteArray(java.lang.Object v)


toDouble

protected static double toDouble(java.lang.Object v)


toListOfStrings

protected static java.util.List toListOfStrings(java.lang.Object v)


toMapStringString

protected static java.util.Map toMapStringString(java.lang.Object v)


toString

public java.lang.String toString()


toStringArray

protected static java.lang.String[] toStringArray(java.lang.Object v)


toVerboseString

public String getProvider() {
public java.lang.String toVerboseString()


waitForReachable

protected void waitForReachable(ComputeService computeService, NodeMetadata node, LoginCredentials expectedCredentials, ConfigBag setup)


 

Brooklyn Multi-Cloud Application Management Platform
brooklyncentral.github.com. Apache License. © 2012.