Package org.jclouds.compute.stub.config
Class StubComputeServiceAdapter
- java.lang.Object
-
- org.jclouds.compute.stub.config.StubComputeServiceAdapter
-
- All Implemented Interfaces:
ComputeServiceAdapter<NodeMetadata,Hardware,Image,Location>
,JCloudsNativeComputeServiceAdapter
@Singleton public class StubComputeServiceAdapter extends Object implements JCloudsNativeComputeServiceAdapter
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.jclouds.compute.ComputeServiceAdapter
ComputeServiceAdapter.NodeAndInitialCredentials<N>
-
Nested classes/interfaces inherited from interface org.jclouds.compute.JCloudsNativeComputeServiceAdapter
JCloudsNativeComputeServiceAdapter.NodeWithInitialCredentials
-
-
Constructor Summary
Constructors Constructor Description StubComputeServiceAdapter(ConcurrentMap<String,NodeMetadata> nodes, com.google.common.util.concurrent.ListeningExecutorService executor, com.google.common.base.Supplier<Location> location, javax.inject.Provider<Integer> idProvider, String publicIpPrefix, String privateIpPrefix, String passwordPrefix, JustProvider locationSupplier, Map<OsFamily,Map<String,String>> osToVersionMap, com.google.common.collect.Multimap<String,SecurityGroup> groupsForNodes, com.google.common.base.Optional<SecurityGroupExtension> securityGroupExtension)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description JCloudsNativeComputeServiceAdapter.NodeWithInitialCredentials
createNodeWithGroupEncodedIntoName(String group, String name, Template template)
ComputeService.createNodesInGroup(String, int, Template)
generates the parameters passed into this method such that each node in the set has a unique name.void
destroyNode(String id)
Image
getImage(String id)
get a specific image by idNodeMetadata
getNode(String id)
Iterable<Hardware>
listHardwareProfiles()
Hardware profiles describe available cpu, memory, and disk configurations that can be used to run a node.Iterable<Image>
listImages()
Images are the available configured operating systems that someone can run a node with.Iterable<Location>
listLocations()
Iterable<NodeMetadata>
listNodes()
Iterable<NodeMetadata>
listNodesByIds(Iterable<String> ids)
void
rebootNode(String id)
void
resumeNode(String id)
protected void
setStateOnNode(NodeMetadata.Status status, NodeMetadata node)
protected void
setStateOnNodeAfterDelay(NodeMetadata.Status status, NodeMetadata node, long millis)
void
suspendNode(String id)
-
-
-
Constructor Detail
-
StubComputeServiceAdapter
@Inject public StubComputeServiceAdapter(ConcurrentMap<String,NodeMetadata> nodes, @Named("jclouds.user-threads") com.google.common.util.concurrent.ListeningExecutorService executor, com.google.common.base.Supplier<Location> location, @Named("NODE_ID") javax.inject.Provider<Integer> idProvider, @Named("PUBLIC_IP_PREFIX") String publicIpPrefix, @Named("PRIVATE_IP_PREFIX") String privateIpPrefix, @Named("PASSWORD_PREFIX") String passwordPrefix, JustProvider locationSupplier, Map<OsFamily,Map<String,String>> osToVersionMap, com.google.common.collect.Multimap<String,SecurityGroup> groupsForNodes, com.google.common.base.Optional<SecurityGroupExtension> securityGroupExtension)
-
-
Method Detail
-
setStateOnNode
protected void setStateOnNode(NodeMetadata.Status status, NodeMetadata node)
-
setStateOnNodeAfterDelay
protected void setStateOnNodeAfterDelay(NodeMetadata.Status status, NodeMetadata node, long millis)
-
createNodeWithGroupEncodedIntoName
public JCloudsNativeComputeServiceAdapter.NodeWithInitialCredentials createNodeWithGroupEncodedIntoName(String group, String name, Template template)
Description copied from interface:JCloudsNativeComputeServiceAdapter
ComputeService.createNodesInGroup(String, int, Template)
generates the parameters passed into this method such that each node in the set has a unique name.note
It is intentional to return the library native node object, as generic typeN
. If you are not using library-native objects (such as libvirtDomain
) useJCloudsNativeComputeServiceAdapter
instead.note
Your responsibility is to create a node with the underlying library and return after storing its credentials in the supplied map corresponding tocredentialStore
- Specified by:
createNodeWithGroupEncodedIntoName
in interfaceComputeServiceAdapter<NodeMetadata,Hardware,Image,Location>
- Specified by:
createNodeWithGroupEncodedIntoName
in interfaceJCloudsNativeComputeServiceAdapter
- Parameters:
group
- used to aggregate nodes with identical configurationname
- unique supplied name for the node, which has the group encoded into it.template
- includesimageId
,locationId
, andhardwareId
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<Hardware> listHardwareProfiles()
Description copied from interface:JCloudsNativeComputeServiceAdapter
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 interfaceComputeServiceAdapter<NodeMetadata,Hardware,Image,Location>
- Specified by:
listHardwareProfiles
in interfaceJCloudsNativeComputeServiceAdapter
- Returns:
- a non-null iterable of available hardware profiles.
- See Also:
ComputeService.listHardwareProfiles()
-
listImages
public Iterable<Image> listImages()
Description copied from interface:JCloudsNativeComputeServiceAdapter
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 interfaceComputeServiceAdapter<NodeMetadata,Hardware,Image,Location>
- Specified by:
listImages
in interfaceJCloudsNativeComputeServiceAdapter
- Returns:
- a non-null iterable of available images.
- See Also:
ComputeService.listImages()
-
getImage
public Image getImage(String id)
Description copied from interface:ComputeServiceAdapter
get a specific image by id- Specified by:
getImage
in interfaceComputeServiceAdapter<NodeMetadata,Hardware,Image,Location>
- Parameters:
id
-Image#getId
, which is not necessarilyImage#getProviderId
- Returns:
- image or null if not exists.
-
listNodes
public Iterable<NodeMetadata> listNodes()
Description copied from interface:JCloudsNativeComputeServiceAdapter
- Specified by:
listNodes
in interfaceComputeServiceAdapter<NodeMetadata,Hardware,Image,Location>
- Specified by:
listNodes
in interfaceJCloudsNativeComputeServiceAdapter
-
listNodesByIds
public Iterable<NodeMetadata> listNodesByIds(Iterable<String> ids)
- Specified by:
listNodesByIds
in interfaceComputeServiceAdapter<NodeMetadata,Hardware,Image,Location>
-
listLocations
public Iterable<Location> listLocations()
Description copied from interface:JCloudsNativeComputeServiceAdapter
- Specified by:
listLocations
in interfaceComputeServiceAdapter<NodeMetadata,Hardware,Image,Location>
- Specified by:
listLocations
in interfaceJCloudsNativeComputeServiceAdapter
-
getNode
public NodeMetadata getNode(String id)
Description copied from interface:JCloudsNativeComputeServiceAdapter
- Specified by:
getNode
in interfaceComputeServiceAdapter<NodeMetadata,Hardware,Image,Location>
- Specified by:
getNode
in interfaceJCloudsNativeComputeServiceAdapter
-
destroyNode
public void destroyNode(String id)
Description copied from interface:JCloudsNativeComputeServiceAdapter
- Specified by:
destroyNode
in interfaceComputeServiceAdapter<NodeMetadata,Hardware,Image,Location>
- Specified by:
destroyNode
in interfaceJCloudsNativeComputeServiceAdapter
-
rebootNode
public void rebootNode(String id)
Description copied from interface:JCloudsNativeComputeServiceAdapter
- Specified by:
rebootNode
in interfaceComputeServiceAdapter<NodeMetadata,Hardware,Image,Location>
- Specified by:
rebootNode
in interfaceJCloudsNativeComputeServiceAdapter
-
resumeNode
public void resumeNode(String id)
- Specified by:
resumeNode
in interfaceComputeServiceAdapter<NodeMetadata,Hardware,Image,Location>
-
suspendNode
public void suspendNode(String id)
- Specified by:
suspendNode
in interfaceComputeServiceAdapter<NodeMetadata,Hardware,Image,Location>
-
-