org.jclouds.nodepool.internal
Class BaseNodePoolComputeServiceAdapter

java.lang.Object
  extended by org.jclouds.nodepool.internal.BaseNodePoolComputeServiceAdapter
All Implemented Interfaces:
ComputeServiceAdapter<NodeMetadata,Hardware,Image,Location>, JCloudsNativeComputeServiceAdapter, NodePoolComputeServiceAdapter
Direct Known Subclasses:
EagerNodePoolComputeServiceAdapter

public abstract class BaseNodePoolComputeServiceAdapter
extends Object
implements NodePoolComputeServiceAdapter

A base class for NodePoolComputeService, takes care of keeping (not changing assignments) and of everything that does not change the pool.

Author:
David Alves

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.jclouds.compute.JCloudsNativeComputeServiceAdapter
JCloudsNativeComputeServiceAdapter.NodeWithInitialCredentials
 
Nested classes/interfaces inherited from interface org.jclouds.compute.ComputeServiceAdapter
ComputeServiceAdapter.NodeAndInitialCredentials<N>
 
Field Summary
protected  com.google.common.base.Supplier<ComputeService> backendComputeService
           
protected  com.google.common.base.Supplier<Template> backendTemplate
           
protected  AdminAccess.Builder initialCredentialsBuilder
           
protected  NodeMetadataStore metadataStore
           
protected  String poolGroupName
           
 
Constructor Summary
BaseNodePoolComputeServiceAdapter(com.google.common.base.Supplier<ComputeService> backendComputeService, com.google.common.base.Supplier<Template> backendTemplate, String poolGroupName, NodeMetadataStore metadataStore, String poolNodeAdminAccess, AdminAccess.Configuration configuration)
           
 
Method Summary
protected  Set<? extends NodeMetadata> addToPool(int number)
           
 void destroyPool()
           
 ComputeServiceContext getBackendComputeServiceContext()
           
protected  Set<NodeMetadata> getBackendNodes()
           
 Image getImage(String id)
          get a specific image by id
 NodeMetadata getNode(String id)
          
 String getPoolGroupName()
           
 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()
          
 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
 
Methods inherited from interface org.jclouds.nodepool.NodePoolComputeServiceAdapter
currentSize, idleNodes, maxNodes, minNodes, usedNodes
 
Methods inherited from interface org.jclouds.compute.JCloudsNativeComputeServiceAdapter
createNodeWithGroupEncodedIntoName, destroyNode
 

Field Detail

backendComputeService

protected final com.google.common.base.Supplier<ComputeService> backendComputeService

backendTemplate

protected final com.google.common.base.Supplier<Template> backendTemplate

poolGroupName

protected final String poolGroupName

metadataStore

protected final NodeMetadataStore metadataStore

initialCredentialsBuilder

protected final AdminAccess.Builder initialCredentialsBuilder
Constructor Detail

BaseNodePoolComputeServiceAdapter

public BaseNodePoolComputeServiceAdapter(com.google.common.base.Supplier<ComputeService> backendComputeService,
                                         com.google.common.base.Supplier<Template> backendTemplate,
                                         @Named(value="jclouds.nodepool.backend-group")
                                         String poolGroupName,
                                         NodeMetadataStore metadataStore,
                                         @Named(value="jclouds.nodepool.admin-access")
                                         String poolNodeAdminAccess,
                                         AdminAccess.Configuration configuration)
Method Detail

getNode

public NodeMetadata getNode(String id)
Description copied from interface: JCloudsNativeComputeServiceAdapter

Specified by:
getNode in interface ComputeServiceAdapter<NodeMetadata,Hardware,Image,Location>
Specified by:
getNode in interface JCloudsNativeComputeServiceAdapter

listNodes

public Iterable<NodeMetadata> listNodes()
Description copied from interface: JCloudsNativeComputeServiceAdapter

Specified by:
listNodes in interface ComputeServiceAdapter<NodeMetadata,Hardware,Image,Location>
Specified by:
listNodes in interface JCloudsNativeComputeServiceAdapter

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 interface ComputeServiceAdapter<NodeMetadata,Hardware,Image,Location>
Specified by:
listHardwareProfiles in interface JCloudsNativeComputeServiceAdapter
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 interface ComputeServiceAdapter<NodeMetadata,Hardware,Image,Location>
Specified by:
listImages in interface JCloudsNativeComputeServiceAdapter
Returns:
a non-null iterable of available images.
See Also:
ComputeService.listImages()

listLocations

public Iterable<Location> listLocations()
Description copied from interface: JCloudsNativeComputeServiceAdapter

Specified by:
listLocations in interface ComputeServiceAdapter<NodeMetadata,Hardware,Image,Location>
Specified by:
listLocations in interface JCloudsNativeComputeServiceAdapter

getImage

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

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

suspendNode

public void suspendNode(String id)
Specified by:
suspendNode in interface ComputeServiceAdapter<NodeMetadata,Hardware,Image,Location>

resumeNode

public void resumeNode(String id)
Specified by:
resumeNode in interface ComputeServiceAdapter<NodeMetadata,Hardware,Image,Location>

rebootNode

public void rebootNode(String id)
Description copied from interface: JCloudsNativeComputeServiceAdapter

Specified by:
rebootNode in interface ComputeServiceAdapter<NodeMetadata,Hardware,Image,Location>
Specified by:
rebootNode in interface JCloudsNativeComputeServiceAdapter

getBackendNodes

protected Set<NodeMetadata> getBackendNodes()

destroyPool

public void destroyPool()
Specified by:
destroyPool in interface NodePoolComputeServiceAdapter

getBackendComputeServiceContext

public ComputeServiceContext getBackendComputeServiceContext()
Specified by:
getBackendComputeServiceContext in interface NodePoolComputeServiceAdapter

addToPool

protected Set<? extends NodeMetadata> addToPool(int number)

getPoolGroupName

public String getPoolGroupName()
Specified by:
getPoolGroupName in interface NodePoolComputeServiceAdapter


Copyright © 2009-2012 jclouds. All Rights Reserved.