org.jclouds.compute.strategy.impl
Class CreateNodesWithGroupEncodedIntoNameThenAddToSet

java.lang.Object
  extended by org.jclouds.compute.strategy.impl.CreateNodesWithGroupEncodedIntoNameThenAddToSet
All Implemented Interfaces:
CreateNodesInGroupThenAddToSet
Direct Known Subclasses:
TerremarkEncodeTagIntoNameRunNodesAndAddToSetStrategy

@Singleton
public class CreateNodesWithGroupEncodedIntoNameThenAddToSet
extends Object
implements CreateNodesInGroupThenAddToSet

creates futures that correlate to

Author:
Adrian Cole

Field Summary
protected  CreateNodeWithGroupEncodedIntoName addNodeWithTagStrategy
           
protected  CustomizeNodeAndAddToGoodMapOrPutExceptionIntoBadMap.Factory customizeNodeAndAddToGoodMapOrPutExceptionIntoBadMapFactory
           
protected  ExecutorService executor
           
protected  ListNodesStrategy listNodesStrategy
           
protected  Logger logger
           
protected  String nodeNamingConvention
           
 
Constructor Summary
protected CreateNodesWithGroupEncodedIntoNameThenAddToSet(CreateNodeWithGroupEncodedIntoName addNodeWithTagStrategy, ListNodesStrategy listNodesStrategy, String nodeNamingConvention, ExecutorService executor, CustomizeNodeAndAddToGoodMapOrPutExceptionIntoBadMap.Factory customizeNodeAndAddToGoodMapOrPutExceptionIntoBadMapFactory)
           
 
Method Summary
 Map<?,Future<Void>> execute(String tag, 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 tag into, then it simultaneously runs the nodes and applies options to them.
protected  String getNextName(String tag, Template template)
          Get a name using a random mechanism that still ties all nodes in a tag together.
protected  Set<String> getNextNames(String tag, 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
 

Field Detail

logger

@Named(value="jclouds.compute")
protected Logger logger

addNodeWithTagStrategy

protected final CreateNodeWithGroupEncodedIntoName addNodeWithTagStrategy

listNodesStrategy

protected final ListNodesStrategy listNodesStrategy

nodeNamingConvention

protected final String nodeNamingConvention

executor

protected final ExecutorService executor

customizeNodeAndAddToGoodMapOrPutExceptionIntoBadMapFactory

protected final CustomizeNodeAndAddToGoodMapOrPutExceptionIntoBadMap.Factory customizeNodeAndAddToGoodMapOrPutExceptionIntoBadMapFactory
Constructor Detail

CreateNodesWithGroupEncodedIntoNameThenAddToSet

@Inject
protected CreateNodesWithGroupEncodedIntoNameThenAddToSet(CreateNodeWithGroupEncodedIntoName addNodeWithTagStrategy,
                                                                 ListNodesStrategy listNodesStrategy,
                                                                 @Named(value="NAMING_CONVENTION")
                                                                 String nodeNamingConvention,
                                                                 @Named(value="jclouds.user-threads")
                                                                 ExecutorService executor,
                                                                 CustomizeNodeAndAddToGoodMapOrPutExceptionIntoBadMap.Factory customizeNodeAndAddToGoodMapOrPutExceptionIntoBadMapFactory)
Method Detail

execute

public Map<?,Future<Void>> execute(String tag,
                                   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 tag into, then it simultaneously runs the nodes and applies options to them.

Specified by:
execute in interface CreateNodesInGroupThenAddToSet

getNextNames

protected Set<String> getNextNames(String tag,
                                   Template template,
                                   int count)
Find the next node names that can be used. These will be derived from the tag 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:
tag -
count -
template -
Returns:

getNextName

protected String getNextName(String tag,
                             Template template)
Get a name using a random mechanism that still ties all nodes in a tag together. This implementation will pass the tag and a hex formatted random number to the configured naming convention.



Copyright © 2009-2011 jclouds. All Rights Reserved.