org.jclouds.compute.domain
Class TemplateBuilderSpec

java.lang.Object
  extended by org.jclouds.compute.domain.TemplateBuilderSpec

@Beta
public class TemplateBuilderSpec
extends Object

A specification of a TemplateBuilder configuration.

TemplateBuilderSpec supports parsing configuration off of a string, which makes it especially useful for command-line configuration of a TemplateBuilder.

The string syntax is a series of comma-separated keys or key-value pairs, each corresponding to a TemplateBuilder method.

The set of supported keys will grow as TemplateBuilder evolves, but existing keys will never be removed.

Whitespace before and after commas and equal signs is ignored. Keys may not be repeated.

It is also illegal to use the following combination of keys

TemplateBuilderSpec does not support configuring TemplateBuilder methods with non-value parameters. These must be configured in code.

A new TemplateBuilder can be instantiated from a TemplateBuilderSpec using TemplateBuilder.from(TemplateBuilderSpec) or TemplateBuilder.from(String).

Design inspired by CacheBuilderSpec

Since:
1.5

Nested Class Summary
protected static interface TemplateBuilderSpec.ValueParser
          Parses a single value.
 
Field Summary
protected static com.google.common.base.Splitter KEY_VALUE_SPLITTER
          Splits the key from the value.
protected static com.google.common.base.Splitter KEYS_SPLITTER
          Splits each key-value pair.
protected  String specification
          Specification; used for toParseableString().
protected static com.google.common.collect.ImmutableMap<String,TemplateBuilderSpec.ValueParser> VALUE_PARSERS
          Map of names to ValueParser.
 
Constructor Summary
protected TemplateBuilderSpec()
           
protected TemplateBuilderSpec(String specification)
           
 
Method Summary
 TemplateBuilder copyTo(TemplateBuilder builder, TemplateOptions templateOptions)
          Returns a TemplateBuilder configured according to this instance's specification.
 boolean equals(Object obj)
           
 Boolean getAuthenticateSudo()
           
 String getHardwareId()
           
 String getHypervisorMatches()
           
 String getImageId()
           
 String getImageNameMatches()
           
 String getLocationId()
           
 String getLoginUser()
           
 Double getMinCores()
           
 Integer getMinRam()
           
 Boolean getOs64Bit()
           
 String getOsArchMatches()
           
 String getOsDescriptionMatches()
           
 OsFamily getOsFamily()
           
 String getOsVersionMatches()
           
 String getSpecification()
           
 int hashCode()
           
static TemplateBuilderSpec parse(String templateBuilderSpecification)
          Creates a TemplateBuilderSpec from a string.
 String toParsableString()
          Returns a string that can be used to parse an equivalent TemplateBuilderSpec.
 String toString()
          Returns a string representation for this TemplateBuilderSpec instance.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

KEYS_SPLITTER

protected static final com.google.common.base.Splitter KEYS_SPLITTER
Splits each key-value pair.


KEY_VALUE_SPLITTER

protected static final com.google.common.base.Splitter KEY_VALUE_SPLITTER
Splits the key from the value.


VALUE_PARSERS

protected static final com.google.common.collect.ImmutableMap<String,TemplateBuilderSpec.ValueParser> VALUE_PARSERS
Map of names to ValueParser.


specification

protected transient String specification
Specification; used for toParseableString().

Constructor Detail

TemplateBuilderSpec

protected TemplateBuilderSpec()

TemplateBuilderSpec

protected TemplateBuilderSpec(String specification)
Method Detail

parse

public static TemplateBuilderSpec parse(String templateBuilderSpecification)
Creates a TemplateBuilderSpec from a string.

Parameters:
templateBuilderSpecification - the string form

copyTo

public TemplateBuilder copyTo(TemplateBuilder builder,
                              TemplateOptions templateOptions)
Returns a TemplateBuilder configured according to this instance's specification.

Parameters:
templateOptions -

toParsableString

public String toParsableString()
Returns a string that can be used to parse an equivalent TemplateBuilderSpec. The order and form of this representation is not guaranteed, except that reparsing its output will produce a TemplateBuilderSpec equal to this instance.


toString

public String toString()
Returns a string representation for this TemplateBuilderSpec instance. The form of this representation is not guaranteed.

Overrides:
toString in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

getHardwareId

public String getHardwareId()

getMinCores

public Double getMinCores()

getMinRam

public Integer getMinRam()

getHypervisorMatches

public String getHypervisorMatches()

getImageId

public String getImageId()

getImageNameMatches

public String getImageNameMatches()

getOsFamily

public OsFamily getOsFamily()

getOsVersionMatches

public String getOsVersionMatches()

getOs64Bit

public Boolean getOs64Bit()

getOsArchMatches

public String getOsArchMatches()

getOsDescriptionMatches

public String getOsDescriptionMatches()

getLoginUser

public String getLoginUser()

getAuthenticateSudo

public Boolean getAuthenticateSudo()

getLocationId

public String getLocationId()

getSpecification

public String getSpecification()


Copyright © 2009-2014 The Apache Software Foundation. All Rights Reserved.