org.jclouds.compute.strategy.impl
Class CreateNodesWithGroupEncodedIntoNameThenAddToSet
java.lang.Object
org.jclouds.compute.strategy.impl.CreateNodesWithGroupEncodedIntoNameThenAddToSet
- All Implemented Interfaces:
- CreateNodesInGroupThenAddToSet
- Direct Known Subclasses:
- ApplyJoyentCloudTemplateOptionsCreateNodesWithGroupEncodedIntoNameThenAddToSet, ApplyNovaTemplateOptionsCreateNodesWithGroupEncodedIntoNameThenAddToSet, TerremarkEncodeTagIntoNameRunNodesAndAddToSetStrategy
@Singleton
public class CreateNodesWithGroupEncodedIntoNameThenAddToSet
- extends Object
- implements CreateNodesInGroupThenAddToSet
creates futures that correlate to
- Author:
- Adrian Cole
|
Method Summary |
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. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
logger
@Named(value="jclouds.compute")
protected Logger logger
addNodeWithGroupStrategy
protected final CreateNodeWithGroupEncodedIntoName addNodeWithGroupStrategy
listNodesStrategy
protected final ListNodesStrategy listNodesStrategy
namingConvention
protected final GroupNamingConvention.Factory namingConvention
executor
protected final ExecutorService executor
customizeNodeAndAddToGoodMapOrPutExceptionIntoBadMapFactory
protected final CustomizeNodeAndAddToGoodMapOrPutExceptionIntoBadMap.Factory customizeNodeAndAddToGoodMapOrPutExceptionIntoBadMapFactory
CreateNodesWithGroupEncodedIntoNameThenAddToSet
@Inject
protected CreateNodesWithGroupEncodedIntoNameThenAddToSet(CreateNodeWithGroupEncodedIntoName addNodeWithGroupStrategy,
ListNodesStrategy listNodesStrategy,
GroupNamingConvention.Factory namingConvention,
@Named(value="jclouds.user-threads")
ExecutorService executor,
CustomizeNodeAndAddToGoodMapOrPutExceptionIntoBadMap.Factory customizeNodeAndAddToGoodMapOrPutExceptionIntoBadMapFactory)
execute
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)
- 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.
- Specified by:
execute in interface CreateNodesInGroupThenAddToSet
createNodeInGroupWithNameAndTemplate
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. 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);
}
- Parameters:
group - group the node belongs toname - generated name of the nodetemplate - user-specified template
- Returns:
- node that is created, yet not necessarily in
NodeMetadata.Status.RUNNING
getNextNames
protected Set<String> getNextNames(String group,
Template template,
int count)
- Find the next node names that can be used. These will be derived from the group and the
template. We will pre-allocate a specified quantity, and attempt to verify that there is no
name conflict with the current service.
- Parameters:
group - count - template -
- Returns:
Copyright © 2009-2012 jclouds. All Rights Reserved.