org.dasein.cloud.vcloud.compute
Class TemplateSupport

java.lang.Object
  extended by org.dasein.cloud.vcloud.compute.TemplateSupport
All Implemented Interfaces:
AccessControlledService, MachineImageSupport

public class TemplateSupport
extends Object
implements MachineImageSupport

Implements vApp Template support in accordance with the Dasein Cloud image support model. Dasein Cloud images map to vApp templates in a vCloud catalog.

Created by George Reese: 9/17/12 10:58 AM

Since:
2013.04
Version:
2013.04 initial version
Author:
George Reese

Nested Class Summary
static class TemplateSupport.Catalog
           
 
Field Summary
 
Fields inherited from interface org.dasein.cloud.compute.MachineImageSupport
ANY, DOWNLOAD_IMAGE, GET_IMAGE, IMAGE_VM, LIST_IMAGE, MAKE_PUBLIC, REGISTER_IMAGE, REMOVE_IMAGE, SHARE_IMAGE, UPLOAD_IMAGE
 
Constructor Summary
TemplateSupport(vCloud cloud)
           
 
Method Summary
 void addImageShare(String providerImageId, String accountNumber)
           
 void addPublicShare(String providerImageId)
           
 String bundleVirtualMachine(String virtualMachineId, MachineImageFormat format, String bucket, String name)
           
 void bundleVirtualMachineAsync(String virtualMachineId, MachineImageFormat format, String bucket, String name, AsynchronousTask<String> trackingTask)
           
protected  MachineImage capture(ImageCreateOptions options)
           
 MachineImage captureImage(ImageCreateOptions options)
           
 void captureImageAsync(ImageCreateOptions options, AsynchronousTask<MachineImage> taskTracker)
           
protected  ProviderContext getContext()
           
 MachineImage getImage(String providerImageId)
           
 MachineImage getMachineImage(String providerImageId)
           
protected  CloudProvider getProvider()
           
 String getProviderTermForCustomImage(Locale locale, ImageClass cls)
           
 String getProviderTermForImage(Locale locale)
           
 String getProviderTermForImage(Locale locale, ImageClass cls)
           
 boolean hasPublicLibrary()
           
 Requirement identifyLocalBundlingRequirement()
           
 AsynchronousTask<String> imageVirtualMachine(String vmId, String name, String description)
           
 boolean isImageSharedWithPublic(String machineImageId)
           
 boolean isSubscribed()
           
 Iterable<MachineImage> listImages(ImageClass cls)
           
 Iterable<MachineImage> listImages(ImageClass cls, String ownedBy)
           
 Iterable<ResourceStatus> listImageStatus(ImageClass cls)
           
 Iterable<MachineImage> listMachineImages()
           
 Iterable<MachineImage> listMachineImagesOwnedBy(String accountId)
           
 Iterable<String> listShares(String forMachineImageId)
           
 Iterable<MachineImageFormat> listSupportedFormats()
           
 Iterable<MachineImageFormat> listSupportedFormatsForBundling()
           
 Iterable<ImageClass> listSupportedImageClasses()
           
 Iterable<MachineImageType> listSupportedImageTypes()
           
 String[] mapServiceAction(ServiceAction action)
           
protected  boolean matches(MachineImage image, String keyword, Platform platform, Architecture architecture, ImageClass... classes)
           
 MachineImage registerImageBundle(ImageCreateOptions options)
           
 void remove(String providerImageId)
           
 void remove(String providerImageId, boolean checkState)
           
 void removeAllImageShares(String providerImageId)
           
 void removeImageShare(String providerImageId, String accountNumber)
           
 void removePublicShare(String providerImageId)
           
 Iterable<MachineImage> searchImages(String accountNumber, String keyword, Platform platform, Architecture architecture, ImageClass... imageClasses)
           
 Iterable<MachineImage> searchMachineImages(String keyword, Platform platform, Architecture architecture)
           
 Iterable<MachineImage> searchPublicImages(String keyword, Platform platform, Architecture architecture, ImageClass... imageClasses)
           
 void shareMachineImage(String providerImageId, String withAccountId, boolean allow)
           
 boolean supportsCustomImages()
           
 boolean supportsDirectImageUpload()
           
 boolean supportsImageCapture(MachineImageType type)
           
 boolean supportsImageSharing()
           
 boolean supportsImageSharingWithPublic()
           
 boolean supportsPublicLibrary(ImageClass cls)
           
 void updateTags(String imageId, Tag... tags)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TemplateSupport

public TemplateSupport(@Nonnull
                       vCloud cloud)
Method Detail

getContext

@Nonnull
protected ProviderContext getContext()
                              throws CloudException
Throws:
CloudException

getProvider

@Nonnull
protected final CloudProvider getProvider()

capture

protected MachineImage capture(@Nonnull
                               ImageCreateOptions options)
                        throws CloudException,
                               InternalException
Throws:
CloudException
InternalException

getImage

public MachineImage getImage(@Nonnull
                             String providerImageId)
                      throws CloudException,
                             InternalException
Specified by:
getImage in interface MachineImageSupport
Throws:
CloudException
InternalException

getProviderTermForImage

@Nonnull
public String getProviderTermForImage(@Nonnull
                                              Locale locale,
                                              @Nonnull
                                              ImageClass cls)
Specified by:
getProviderTermForImage in interface MachineImageSupport

isImageSharedWithPublic

public boolean isImageSharedWithPublic(@Nonnull
                                       String machineImageId)
                                throws CloudException,
                                       InternalException
Specified by:
isImageSharedWithPublic in interface MachineImageSupport
Throws:
CloudException
InternalException

isSubscribed

public boolean isSubscribed()
                     throws CloudException,
                            InternalException
Specified by:
isSubscribed in interface MachineImageSupport
Throws:
CloudException
InternalException

listImages

@Nonnull
public Iterable<MachineImage> listImages(@Nullable
                                                 ImageClass cls)
                                  throws CloudException,
                                         InternalException
Specified by:
listImages in interface MachineImageSupport
Throws:
CloudException
InternalException

listSupportedFormats

@Nonnull
public Iterable<MachineImageFormat> listSupportedFormats()
                                                  throws CloudException,
                                                         InternalException
Specified by:
listSupportedFormats in interface MachineImageSupport
Throws:
CloudException
InternalException

listShares

@Nonnull
public Iterable<String> listShares(@Nonnull
                                           String forMachineImageId)
                            throws CloudException,
                                   InternalException
Specified by:
listShares in interface MachineImageSupport
Throws:
CloudException
InternalException

remove

public void remove(@Nonnull
                   String providerImageId,
                   boolean checkState)
            throws CloudException,
                   InternalException
Specified by:
remove in interface MachineImageSupport
Throws:
CloudException
InternalException

searchPublicImages

@Nonnull
public Iterable<MachineImage> searchPublicImages(@Nullable
                                                         String keyword,
                                                         @Nullable
                                                         Platform platform,
                                                         @Nullable
                                                         Architecture architecture,
                                                         @Nullable
                                                         ImageClass... imageClasses)
                                          throws CloudException,
                                                 InternalException
Specified by:
searchPublicImages in interface MachineImageSupport
Throws:
CloudException
InternalException

supportsCustomImages

public boolean supportsCustomImages()
Specified by:
supportsCustomImages in interface MachineImageSupport

supportsImageCapture

public boolean supportsImageCapture(@Nonnull
                                    MachineImageType type)
                             throws CloudException,
                                    InternalException
Specified by:
supportsImageCapture in interface MachineImageSupport
Throws:
CloudException
InternalException

matches

protected boolean matches(@Nonnull
                          MachineImage image,
                          @Nullable
                          String keyword,
                          @Nullable
                          Platform platform,
                          @Nullable
                          Architecture architecture,
                          @Nullable
                          ImageClass... classes)

addImageShare

public void addImageShare(@Nonnull
                          String providerImageId,
                          @Nonnull
                          String accountNumber)
                   throws CloudException,
                          InternalException
Specified by:
addImageShare in interface MachineImageSupport
Throws:
CloudException
InternalException

addPublicShare

public void addPublicShare(@Nonnull
                           String providerImageId)
                    throws CloudException,
                           InternalException
Specified by:
addPublicShare in interface MachineImageSupport
Throws:
CloudException
InternalException

bundleVirtualMachine

@Nonnull
public String bundleVirtualMachine(@Nonnull
                                           String virtualMachineId,
                                           @Nonnull
                                           MachineImageFormat format,
                                           @Nonnull
                                           String bucket,
                                           @Nonnull
                                           String name)
                            throws CloudException,
                                   InternalException
Specified by:
bundleVirtualMachine in interface MachineImageSupport
Throws:
CloudException
InternalException

bundleVirtualMachineAsync

public void bundleVirtualMachineAsync(@Nonnull
                                      String virtualMachineId,
                                      @Nonnull
                                      MachineImageFormat format,
                                      @Nonnull
                                      String bucket,
                                      @Nonnull
                                      String name,
                                      @Nonnull
                                      AsynchronousTask<String> trackingTask)
                               throws CloudException,
                                      InternalException
Specified by:
bundleVirtualMachineAsync in interface MachineImageSupport
Throws:
CloudException
InternalException

captureImage

@Nonnull
public final MachineImage captureImage(@Nonnull
                                               ImageCreateOptions options)
                                throws CloudException,
                                       InternalException
Specified by:
captureImage in interface MachineImageSupport
Throws:
CloudException
InternalException

captureImageAsync

public final void captureImageAsync(@Nonnull
                                    ImageCreateOptions options,
                                    @Nonnull
                                    AsynchronousTask<MachineImage> taskTracker)
                             throws CloudException,
                                    InternalException
Specified by:
captureImageAsync in interface MachineImageSupport
Throws:
CloudException
InternalException

getMachineImage

@Nullable
public final MachineImage getMachineImage(@Nonnull
                                                   String providerImageId)
                                   throws CloudException,
                                          InternalException
Specified by:
getMachineImage in interface MachineImageSupport
Throws:
CloudException
InternalException

getProviderTermForImage

@Nonnull
public String getProviderTermForImage(@Nonnull
                                              Locale locale)
Specified by:
getProviderTermForImage in interface MachineImageSupport

getProviderTermForCustomImage

@Nonnull
public String getProviderTermForCustomImage(@Nonnull
                                                    Locale locale,
                                                    @Nonnull
                                                    ImageClass cls)
Specified by:
getProviderTermForCustomImage in interface MachineImageSupport

hasPublicLibrary

public boolean hasPublicLibrary()
Specified by:
hasPublicLibrary in interface MachineImageSupport

identifyLocalBundlingRequirement

@Nonnull
public Requirement identifyLocalBundlingRequirement()
                                             throws CloudException,
                                                    InternalException
Specified by:
identifyLocalBundlingRequirement in interface MachineImageSupport
Throws:
CloudException
InternalException

imageVirtualMachine

@Nonnull
public final AsynchronousTask<String> imageVirtualMachine(@Nonnull
                                                                  String vmId,
                                                                  @Nonnull
                                                                  String name,
                                                                  @Nonnull
                                                                  String description)
                                                   throws CloudException,
                                                          InternalException
Specified by:
imageVirtualMachine in interface MachineImageSupport
Throws:
CloudException
InternalException

listImageStatus

@Nonnull
public Iterable<ResourceStatus> listImageStatus(@Nonnull
                                                        ImageClass cls)
                                         throws CloudException,
                                                InternalException
Specified by:
listImageStatus in interface MachineImageSupport
Throws:
CloudException
InternalException

listImages

@Nonnull
public Iterable<MachineImage> listImages(@Nonnull
                                                 ImageClass cls,
                                                 @Nonnull
                                                 String ownedBy)
                                  throws CloudException,
                                         InternalException
Specified by:
listImages in interface MachineImageSupport
Throws:
CloudException
InternalException

listSupportedFormatsForBundling

@Nonnull
public Iterable<MachineImageFormat> listSupportedFormatsForBundling()
                                                             throws CloudException,
                                                                    InternalException
Specified by:
listSupportedFormatsForBundling in interface MachineImageSupport
Throws:
CloudException
InternalException

listMachineImages

@Nonnull
public Iterable<MachineImage> listMachineImages()
                                         throws CloudException,
                                                InternalException
Specified by:
listMachineImages in interface MachineImageSupport
Throws:
CloudException
InternalException

listMachineImagesOwnedBy

@Nonnull
public Iterable<MachineImage> listMachineImagesOwnedBy(@Nullable
                                                               String accountId)
                                                throws CloudException,
                                                       InternalException
Specified by:
listMachineImagesOwnedBy in interface MachineImageSupport
Throws:
CloudException
InternalException

listSupportedImageClasses

@Nonnull
public Iterable<ImageClass> listSupportedImageClasses()
                                               throws CloudException,
                                                      InternalException
Specified by:
listSupportedImageClasses in interface MachineImageSupport
Throws:
CloudException
InternalException

listSupportedImageTypes

@Nonnull
public Iterable<MachineImageType> listSupportedImageTypes()
                                                   throws CloudException,
                                                          InternalException
Specified by:
listSupportedImageTypes in interface MachineImageSupport
Throws:
CloudException
InternalException

mapServiceAction

@Nonnull
public String[] mapServiceAction(@Nonnull
                                         ServiceAction action)
Specified by:
mapServiceAction in interface AccessControlledService

registerImageBundle

@Nonnull
public MachineImage registerImageBundle(@Nonnull
                                                ImageCreateOptions options)
                                 throws CloudException,
                                        InternalException
Specified by:
registerImageBundle in interface MachineImageSupport
Throws:
CloudException
InternalException

remove

public void remove(@Nonnull
                   String providerImageId)
            throws CloudException,
                   InternalException
Specified by:
remove in interface MachineImageSupport
Throws:
CloudException
InternalException

removeAllImageShares

public void removeAllImageShares(@Nonnull
                                 String providerImageId)
                          throws CloudException,
                                 InternalException
Specified by:
removeAllImageShares in interface MachineImageSupport
Throws:
CloudException
InternalException

removeImageShare

public void removeImageShare(@Nonnull
                             String providerImageId,
                             @Nonnull
                             String accountNumber)
                      throws CloudException,
                             InternalException
Specified by:
removeImageShare in interface MachineImageSupport
Throws:
CloudException
InternalException

removePublicShare

public void removePublicShare(@Nonnull
                              String providerImageId)
                       throws CloudException,
                              InternalException
Specified by:
removePublicShare in interface MachineImageSupport
Throws:
CloudException
InternalException

searchImages

@Nonnull
public Iterable<MachineImage> searchImages(@Nullable
                                                   String accountNumber,
                                                   @Nullable
                                                   String keyword,
                                                   @Nullable
                                                   Platform platform,
                                                   @Nullable
                                                   Architecture architecture,
                                                   @Nullable
                                                   ImageClass... imageClasses)
                                    throws CloudException,
                                           InternalException
Specified by:
searchImages in interface MachineImageSupport
Throws:
CloudException
InternalException

searchMachineImages

@Nonnull
public Iterable<MachineImage> searchMachineImages(@Nullable
                                                          String keyword,
                                                          @Nullable
                                                          Platform platform,
                                                          @Nullable
                                                          Architecture architecture)
                                           throws CloudException,
                                                  InternalException
Specified by:
searchMachineImages in interface MachineImageSupport
Throws:
CloudException
InternalException

shareMachineImage

public final void shareMachineImage(@Nonnull
                                    String providerImageId,
                                    @Nullable
                                    String withAccountId,
                                    boolean allow)
                             throws CloudException,
                                    InternalException
Specified by:
shareMachineImage in interface MachineImageSupport
Throws:
CloudException
InternalException

supportsDirectImageUpload

public boolean supportsDirectImageUpload()
                                  throws CloudException,
                                         InternalException
Specified by:
supportsDirectImageUpload in interface MachineImageSupport
Throws:
CloudException
InternalException

supportsImageSharing

public boolean supportsImageSharing()
                             throws CloudException,
                                    InternalException
Specified by:
supportsImageSharing in interface MachineImageSupport
Throws:
CloudException
InternalException

supportsImageSharingWithPublic

public boolean supportsImageSharingWithPublic()
                                       throws CloudException,
                                              InternalException
Specified by:
supportsImageSharingWithPublic in interface MachineImageSupport
Throws:
CloudException
InternalException

supportsPublicLibrary

public boolean supportsPublicLibrary(@Nonnull
                                     ImageClass cls)
                              throws CloudException,
                                     InternalException
Specified by:
supportsPublicLibrary in interface MachineImageSupport
Throws:
CloudException
InternalException

updateTags

public void updateTags(@Nonnull
                       String imageId,
                       @Nonnull
                       Tag... tags)
                throws CloudException,
                       InternalException
Specified by:
updateTags in interface MachineImageSupport
Throws:
CloudException
InternalException


Copyright © 2013 enStratus Networks Inc. All Rights Reserved.