Class CreateNodesWithGroupEncodedIntoNameThenAddToSet
java.lang.Object
org.jclouds.compute.strategy.impl.CreateNodesWithGroupEncodedIntoNameThenAddToSet
- All Implemented Interfaces:
CreateNodesInGroupThenAddToSet
- Direct Known Subclasses:
ApplyNovaTemplateOptionsCreateNodesWithGroupEncodedIntoNameThenAddToSet
,AssignDataCenterToTemplate
,CreateKeyPairsThenCreateNodes
,CreateNodesWithGroupEncodedIntoNameThenAddToSet
,CreateResourcesThenCreateNodes
,CreateSshKeysThenCreateNodes
@Singleton
public class CreateNodesWithGroupEncodedIntoNameThenAddToSet
extends Object
implements CreateNodesInGroupThenAddToSet
creates futures that correlate to
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected class
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final CreateNodeWithGroupEncodedIntoName
protected final CustomizeNodeAndAddToGoodMapOrPutExceptionIntoBadMap.Factory
protected final ListNodesStrategy
protected Logger
protected final GroupNamingConvention.Factory
protected final com.google.common.util.concurrent.ListeningExecutorService
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
CreateNodesWithGroupEncodedIntoNameThenAddToSet
(CreateNodeWithGroupEncodedIntoName addNodeWithGroupStrategy, ListNodesStrategy listNodesStrategy, GroupNamingConvention.Factory namingConvention, com.google.common.util.concurrent.ListeningExecutorService userExecutor, CustomizeNodeAndAddToGoodMapOrPutExceptionIntoBadMap.Factory customizeNodeAndAddToGoodMapOrPutExceptionIntoBadMapFactory) -
Method Summary
Modifier and TypeMethodDescriptionprotected com.google.common.util.concurrent.ListenableFuture
<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 jcloudsNodeMetadata
object.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.getNextNames
(String group, Template template, int count) Find the next node names that can be used.
-
Field Details
-
logger
-
addNodeWithGroupStrategy
-
listNodesStrategy
-
namingConvention
-
userExecutor
protected final com.google.common.util.concurrent.ListeningExecutorService userExecutor -
customizeNodeAndAddToGoodMapOrPutExceptionIntoBadMapFactory
protected final CustomizeNodeAndAddToGoodMapOrPutExceptionIntoBadMap.Factory customizeNodeAndAddToGoodMapOrPutExceptionIntoBadMapFactory
-
-
Constructor Details
-
CreateNodesWithGroupEncodedIntoNameThenAddToSet
@Inject protected CreateNodesWithGroupEncodedIntoNameThenAddToSet(CreateNodeWithGroupEncodedIntoName addNodeWithGroupStrategy, ListNodesStrategy listNodesStrategy, GroupNamingConvention.Factory namingConvention, @Named("jclouds.user-threads") com.google.common.util.concurrent.ListeningExecutorService userExecutor, CustomizeNodeAndAddToGoodMapOrPutExceptionIntoBadMap.Factory customizeNodeAndAddToGoodMapOrPutExceptionIntoBadMapFactory)
-
-
Method Details
-
execute
public Map<?,com.google.common.util.concurrent.ListenableFuture<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 interfaceCreateNodesInGroupThenAddToSet
-
createNodeInGroupWithNameAndTemplate
protected com.google.common.util.concurrent.ListenableFuture<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 jcloudsNodeMetadata
object. This call directly precedes customization, such as executing scripts. The outcome of this operation does not imply the node isinvalid reference
running
@Override protected ListenableFuture<AtomicReference<NodeMetadata>> createNodeInGroupWithNameAndTemplate(String group, String name, Template template) { ListenableFuture<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
invalid reference
Status#RUNNING
-
getNextNames
Find the next node names that can be used. If the nodeNames template option is not specified or is empty, 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. If the nodeNames option is specified, names from that will be used instead, without any check for name conflicts. If there are insufficient names in nodeNames, subsequent names will be generated in the default format.- Parameters:
group
-template
-count
-- Returns:
-