Package org.jclouds.compute.internal
Class FormatSharedNamesAndAppendUniqueStringToThoseWhichRepeat
java.lang.Object
org.jclouds.compute.internal.FormatSharedNamesAndAppendUniqueStringToThoseWhichRepeat
- All Implemented Interfaces:
GroupNamingConvention
public class FormatSharedNamesAndAppendUniqueStringToThoseWhichRepeat
extends Object
implements GroupNamingConvention
Get a name using a random mechanism that still ties all nodes in a group
together.
This implementation will pass the group and a hex formatted random number to
the configured naming convention.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionFormatSharedNamesAndAppendUniqueStringToThoseWhichRepeat
(String prefix, char delimiter, com.google.common.base.Supplier<String> suffixSupplier, Validator<String> groupValidator) -
Method Summary
Modifier and TypeMethodDescriptionprotected String
checkGroup
(String group) com.google.common.base.Predicate
<String> A predicate that identifies if an input has any group encoded in it.com.google.common.base.Predicate
<String> containsGroup
(String group) A predicate that identifies if an input has the given group encoded in it.extractGroup
(String encoded) Extracts the group from a shared/unique name.protected String
firstGroupInPatternOrNull
(Pattern pattern, String encoded) groupInSharedNameOrNull
(String encoded) retrieve the group associated with the encoded namegroupInUniqueNameOrNull
(String encoded) retrieve the group associated with the encoded namesharedNameForGroup
(String group) encodes the {code group parameter} into a name that exists only once in the group.uniqueNameForGroup
(String group) encodes the {code group parameter} into a name that exists more than once in the group.
-
Field Details
-
prefix
-
delimiter
protected final char delimiter -
suffixSupplier
-
uniqueFormat
-
uniqueGroupPattern
-
groupValidator
-
-
Constructor Details
-
FormatSharedNamesAndAppendUniqueStringToThoseWhichRepeat
-
-
Method Details
-
checkGroup
-
uniqueNameForGroup
Description copied from interface:GroupNamingConvention
encodes the {code group parameter} into a name that exists more than once in the group.note
Do not expect this name to be guaranteed unique, though a good implementation should guess a unique name in one or two tries.- Specified by:
uniqueNameForGroup
in interfaceGroupNamingConvention
-
groupInUniqueNameOrNull
Description copied from interface:GroupNamingConvention
retrieve the group associated with the encoded name- Specified by:
groupInUniqueNameOrNull
in interfaceGroupNamingConvention
-
firstGroupInPatternOrNull
-
containsGroup
Description copied from interface:GroupNamingConvention
A predicate that identifies if an input has the given group encoded in it.- Specified by:
containsGroup
in interfaceGroupNamingConvention
-
containsAnyGroup
Description copied from interface:GroupNamingConvention
A predicate that identifies if an input has any group encoded in it.- Specified by:
containsAnyGroup
in interfaceGroupNamingConvention
-
extractGroup
Description copied from interface:GroupNamingConvention
Extracts the group from a shared/unique name. Or returns null if not in correct format to contain a group.- Specified by:
extractGroup
in interfaceGroupNamingConvention