org.jclouds.openstack.nova.v2_0.compute
Class NovaComputeServiceAdapter

java.lang.Object
  extended by org.jclouds.openstack.nova.v2_0.compute.NovaComputeServiceAdapter
All Implemented Interfaces:
ComputeServiceAdapter<ServerInZone,FlavorInZone,ImageInZone,Location>
Direct Known Subclasses:
HPCloudComputeServiceAdapter, TryStackNovaServiceAdapter

public class NovaComputeServiceAdapter
extends Object
implements ComputeServiceAdapter<ServerInZone,FlavorInZone,ImageInZone,Location>

The adapter used by the NovaComputeServiceContextModule to interface the nova-specific domain model to the computeService generic domain model.

Author:
Matt Stephenson, Adrian Cole

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.jclouds.compute.ComputeServiceAdapter
ComputeServiceAdapter.NodeAndInitialCredentials<N>
 
Field Summary
protected  com.google.common.cache.LoadingCache<ZoneAndName,KeyPair> keyPairCache
           
protected  Logger logger
           
protected  NovaApi novaApi
           
protected  RemoveFloatingIpFromNodeAndDeallocate removeFloatingIpFromNodeAndDeallocate
           
protected  com.google.common.base.Supplier<Set<String>> zoneIds
           
 
Constructor Summary
NovaComputeServiceAdapter(NovaApi novaApi, com.google.common.base.Supplier<Set<String>> zoneIds, RemoveFloatingIpFromNodeAndDeallocate removeFloatingIpFromNodeAndDeallocate, com.google.common.cache.LoadingCache<ZoneAndName,KeyPair> keyPairCache)
           
 
Method Summary
 ComputeServiceAdapter.NodeAndInitialCredentials<ServerInZone> createNodeWithGroupEncodedIntoName(String group, String name, Template template)
          Note that we do not validate extensions here, on basis that ApplyNovaTemplateOptionsCreateNodesWithGroupEncodedIntoNameThenAddToSet has already done so.
 void destroyNode(String id)
           
 ImageInZone getImage(String id)
          get a specific image by id
 ServerInZone getNode(String id)
           
 Iterable<FlavorInZone> listHardwareProfiles()
          Hardware profiles describe available cpu, memory, and disk configurations that can be used to run a node.
 Iterable<ImageInZone> listImages()
          Images are the available configured operating systems that someone can run a node with.
 Iterable<Location> listLocations()
           
 Iterable<ServerInZone> listNodes()
           
 void rebootNode(String id)
           
 void resumeNode(String id)
           
 void suspendNode(String id)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

@Named(value="jclouds.compute")
protected Logger logger

novaApi

protected final NovaApi novaApi

zoneIds

protected final com.google.common.base.Supplier<Set<String>> zoneIds

removeFloatingIpFromNodeAndDeallocate

protected final RemoveFloatingIpFromNodeAndDeallocate removeFloatingIpFromNodeAndDeallocate

keyPairCache

protected final com.google.common.cache.LoadingCache<ZoneAndName,KeyPair> keyPairCache
Constructor Detail

NovaComputeServiceAdapter

@Inject
public NovaComputeServiceAdapter(NovaApi novaApi,
                                        com.google.common.base.Supplier<Set<String>> zoneIds,
                                        RemoveFloatingIpFromNodeAndDeallocate removeFloatingIpFromNodeAndDeallocate,
                                        com.google.common.cache.LoadingCache<ZoneAndName,KeyPair> keyPairCache)
Method Detail

createNodeWithGroupEncodedIntoName

public ComputeServiceAdapter.NodeAndInitialCredentials<ServerInZone> createNodeWithGroupEncodedIntoName(String group,
                                                                                                        String name,
                                                                                                        Template template)
Note that we do not validate extensions here, on basis that ApplyNovaTemplateOptionsCreateNodesWithGroupEncodedIntoNameThenAddToSet has already done so.

Specified by:
createNodeWithGroupEncodedIntoName in interface ComputeServiceAdapter<ServerInZone,FlavorInZone,ImageInZone,Location>
Parameters:
group - used to aggregate nodes with identical configuration
name - unique supplied name for the node, which has the group encoded into it.
template - includes imageId, locationId, and hardwareId used to resume the instance.
Returns:
library-native representation of a node. TODO: return typed exception on createNodeFailure
See Also:
ComputeService.createNodesInGroup(String, int, Template)

listHardwareProfiles

public Iterable<FlavorInZone> listHardwareProfiles()
Description copied from interface: ComputeServiceAdapter
Hardware profiles describe available cpu, memory, and disk configurations that can be used to run a node.

To implement this method, return the library native hardware profiles available to the user. These will be used to launch nodes as a part of the template.

Specified by:
listHardwareProfiles in interface ComputeServiceAdapter<ServerInZone,FlavorInZone,ImageInZone,Location>
Returns:
a non-null iterable of available hardware profiles.
See Also:
ComputeService.listHardwareProfiles()

listImages

public Iterable<ImageInZone> listImages()
Description copied from interface: ComputeServiceAdapter
Images are the available configured operating systems that someone can run a node with.

To implement this method, return the library native images available to the user. These will be used to launch nodes as a part of the template.

Specified by:
listImages in interface ComputeServiceAdapter<ServerInZone,FlavorInZone,ImageInZone,Location>
Returns:
a non-null iterable of available images.
See Also:
ComputeService.listImages()

listNodes

public Iterable<ServerInZone> listNodes()
Specified by:
listNodes in interface ComputeServiceAdapter<ServerInZone,FlavorInZone,ImageInZone,Location>

listLocations

public Iterable<Location> listLocations()
Specified by:
listLocations in interface ComputeServiceAdapter<ServerInZone,FlavorInZone,ImageInZone,Location>

getNode

public ServerInZone getNode(String id)
Specified by:
getNode in interface ComputeServiceAdapter<ServerInZone,FlavorInZone,ImageInZone,Location>

getImage

public ImageInZone getImage(String id)
Description copied from interface: ComputeServiceAdapter
get a specific image by id

Specified by:
getImage in interface ComputeServiceAdapter<ServerInZone,FlavorInZone,ImageInZone,Location>
Parameters:
id - ComputeMetadata.getId(), which is not necessarily ComputeMetadata.getProviderId()
Returns:
image or null if not exists.

destroyNode

public void destroyNode(String id)
Specified by:
destroyNode in interface ComputeServiceAdapter<ServerInZone,FlavorInZone,ImageInZone,Location>

rebootNode

public void rebootNode(String id)
Specified by:
rebootNode in interface ComputeServiceAdapter<ServerInZone,FlavorInZone,ImageInZone,Location>

resumeNode

public void resumeNode(String id)
Specified by:
resumeNode in interface ComputeServiceAdapter<ServerInZone,FlavorInZone,ImageInZone,Location>

suspendNode

public void suspendNode(String id)
Specified by:
suspendNode in interface ComputeServiceAdapter<ServerInZone,FlavorInZone,ImageInZone,Location>


Copyright © 2009-2012 jclouds. All Rights Reserved.