@Singleton public class CreateNodesWithGroupEncodedIntoNameThenAddToSet extends Object implements CreateNodesInGroupThenAddToSet
Modifier and Type | Class and Description |
---|---|
protected class |
CreateNodesWithGroupEncodedIntoNameThenAddToSet.AddNode |
Modifier and Type | Field and Description |
---|---|
protected CreateNodeWithGroupEncodedIntoName |
addNodeWithGroupStrategy |
protected CustomizeNodeAndAddToGoodMapOrPutExceptionIntoBadMap.Factory |
customizeNodeAndAddToGoodMapOrPutExceptionIntoBadMapFactory |
protected ExecutorService |
executor |
protected ListNodesStrategy |
listNodesStrategy |
protected Logger |
logger |
protected GroupNamingConvention.Factory |
namingConvention |
Modifier | Constructor and Description |
---|---|
protected |
CreateNodesWithGroupEncodedIntoNameThenAddToSet(CreateNodeWithGroupEncodedIntoName addNodeWithGroupStrategy,
ListNodesStrategy listNodesStrategy,
GroupNamingConvention.Factory namingConvention,
ExecutorService executor,
CustomizeNodeAndAddToGoodMapOrPutExceptionIntoBadMap.Factory customizeNodeAndAddToGoodMapOrPutExceptionIntoBadMapFactory) |
Modifier and Type | Method and Description |
---|---|
protected Future<AtomicReference<NodeMetadata>> |
createNodeInGroupWithNameAndTemplate(String group,
String name,
Template template)
This calls logic necessary to create a node and convert it from its provider-specific object
to the jclouds
NodeMetadata object. |
Map<?,Future<Void>> |
execute(String group,
int count,
Template template,
Set<NodeMetadata> goodNodes,
Map<NodeMetadata,Exception> badNodes,
com.google.common.collect.Multimap<NodeMetadata,CustomizationResponse> customizationResponses)
This implementation gets a list of acceptable node names to encode the group into, then it
simultaneously runs the nodes and applies options to them.
|
protected Set<String> |
getNextNames(String group,
Template template,
int count)
Find the next node names that can be used.
|
@Named(value="jclouds.compute") protected Logger logger
protected final CreateNodeWithGroupEncodedIntoName addNodeWithGroupStrategy
protected final ListNodesStrategy listNodesStrategy
protected final GroupNamingConvention.Factory namingConvention
protected final ExecutorService executor
protected final CustomizeNodeAndAddToGoodMapOrPutExceptionIntoBadMap.Factory customizeNodeAndAddToGoodMapOrPutExceptionIntoBadMapFactory
@Inject protected CreateNodesWithGroupEncodedIntoNameThenAddToSet(CreateNodeWithGroupEncodedIntoName addNodeWithGroupStrategy, ListNodesStrategy listNodesStrategy, GroupNamingConvention.Factory namingConvention, @Named(value="jclouds.user-threads") ExecutorService executor, CustomizeNodeAndAddToGoodMapOrPutExceptionIntoBadMap.Factory customizeNodeAndAddToGoodMapOrPutExceptionIntoBadMapFactory)
public Map<?,Future<Void>> execute(String group, int count, Template template, Set<NodeMetadata> goodNodes, Map<NodeMetadata,Exception> badNodes, com.google.common.collect.Multimap<NodeMetadata,CustomizationResponse> customizationResponses)
execute
in interface CreateNodesInGroupThenAddToSet
protected Future<AtomicReference<NodeMetadata>> createNodeInGroupWithNameAndTemplate(String group, String name, Template template)
NodeMetadata
object. This call directly precedes customization, such as
executing scripts.
The outcome of this operation does not imply the node is running
. If you want to insert logic after the node is created, yet before an attempt to
customize the node, then append your behaviour to this method.
ex. to attach an ip address post-creation
@Override protected Future<AtomicReference<NodeMetadata>> createNodeInGroupWithNameAndTemplate(String group, String name, Template template) { Future<AtomicReference<NodeMetadata>> future = super.addNodeIntoGroupWithNameAndTemplate(group, name, template); return Futures.compose(future, new Function<AtomicReference<NodeMetadata>, AtomicReference<NodeMetadata>>() { @Override public AtomicReference<NodeMetadata> apply(AtomicReference<NodeMetadata> input) { NodeMetadata node = input.get(); // allocate and attach an ip input.set(NodeMetadataBuilder.fromNodeMetadata(node).publicAddresses(ImmutableSet.of(ip.getIp())).build()); return input; } }, executor); }
group
- group the node belongs toname
- generated name of the nodetemplate
- user-specified templateNodeMetadata.Status.RUNNING
protected Set<String> getNextNames(String group, Template template, int count)
group
- count
- template
- Copyright © 2009-2013 jclouds. All Rights Reserved.