org.jclouds.softlayer.compute.functions
Class ProductItemToImage

java.lang.Object
  extended by org.jclouds.softlayer.compute.functions.ProductItemToImage
All Implemented Interfaces:
com.google.common.base.Function<ProductItem,Image>

@Singleton
public class ProductItemToImage
extends Object
implements com.google.common.base.Function<ProductItem,Image>

Author:
Jason King

Field Summary
protected  Logger logger
           
 
Constructor Summary
ProductItemToImage()
           
 
Method Summary
 Image apply(ProductItem productItem)
           
static com.google.common.base.Function<ProductItem,String> imageId()
          Generates an id for an Image.
static com.google.common.base.Function<ProductItem,Integer> osBits()
          Parses the item description to determine the number of OS bits Expects the number to be in parenthesis and to contain the word "bit".
static com.google.common.base.Function<ProductItem,OsFamily> osFamily()
          Parses the item description to determine the OSFamily
static com.google.common.base.Function<ProductItem,String> osVersion()
          Parses the item description to determine the os version
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.google.common.base.Function
equals
 

Field Detail

logger

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

ProductItemToImage

public ProductItemToImage()
Method Detail

apply

public Image apply(ProductItem productItem)
Specified by:
apply in interface com.google.common.base.Function<ProductItem,Image>

osFamily

public static com.google.common.base.Function<ProductItem,OsFamily> osFamily()
Parses the item description to determine the OSFamily

Returns:
the @see OsFamily or OsFamily.UNRECOGNIZED

osVersion

public static com.google.common.base.Function<ProductItem,String> osVersion()
Parses the item description to determine the os version

Returns:
the version
Throws:
NoSuchElementException - if the version cannot be determined

osBits

public static com.google.common.base.Function<ProductItem,Integer> osBits()
Parses the item description to determine the number of OS bits Expects the number to be in parenthesis and to contain the word "bit". The following return 64: "A (64 bit) OS", "A (64bit) OS"

Returns:
the number of bits
Throws:
NoSuchElementException - if the number of bits cannot be determined

imageId

public static com.google.common.base.Function<ProductItem,String> imageId()
Generates an id for an Image.

Returns:
the generated id


Copyright © 2009-2011 jclouds. All Rights Reserved.