From 9b7bd209864e7f1da12e878716912ccf703c4043 Mon Sep 17 00:00:00 2001 From: danikov Date: Wed, 25 Apr 2012 11:34:25 +0100 Subject: [PATCH] fix SectionForVApp usage --- .../compute/util/VCloudDirectorComputeUtils.java | 12 ++++++++---- .../v1_5/config/VCloudDirectorRestClientModule.java | 2 -- .../director/v1_5/functions/SectionForVApp.java | 7 +------ 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/compute/util/VCloudDirectorComputeUtils.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/compute/util/VCloudDirectorComputeUtils.java index 13262b3e3c..c70942bf38 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/compute/util/VCloudDirectorComputeUtils.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/compute/util/VCloudDirectorComputeUtils.java @@ -60,7 +60,8 @@ public class VCloudDirectorComputeUtils { return vApp.getChildren().getVms().size() > 0 ? toComputeOs(Iterables.get(vApp.getChildren().getVms(), 0)) : null; } - @Inject private static SectionForVApp findOperatingSystemSectionForVApp; + private static SectionForVApp findOperatingSystemSectionForVApp = + new SectionForVApp(OperatingSystemSection.class); public static CIMOperatingSystem toComputeOs(Vm vm) { return toComputeOs(findOperatingSystemSectionForVApp.apply(vm)); @@ -75,7 +76,8 @@ public class VCloudDirectorComputeUtils { getVirtualSystemIdentifierOf(Iterables.get(vApp.getChildren().getVms(), 0)) : null; } - @Inject private static SectionForVApp findVirtualHardwareSectionForVApp; + @Inject private static SectionForVApp findVirtualHardwareSectionForVApp = + new SectionForVApp(VirtualHardwareSection.class); public static String getVirtualSystemIdentifierOf(Vm vm) { VirtualHardwareSection virtualHardwareSection = findVirtualHardwareSectionForVApp.apply(vm); @@ -93,7 +95,8 @@ public class VCloudDirectorComputeUtils { return vApp.getChildren().size() > 0 ? getCredentialsFrom(Iterables.get(vApp.getChildren(), 0)) : null; } - @Inject private static SectionForVApp findGuestCustomizationSectionForVApp; + @Inject private static SectionForVApp findGuestCustomizationSectionForVApp = + new SectionForVApp(GuestCustomizationSection.class); public static LoginCredentials getCredentialsFrom(Vm vm) { LoginCredentials.Builder builder = LoginCredentials.builder(); @@ -103,7 +106,8 @@ public class VCloudDirectorComputeUtils { return builder.build(); } - @Inject private static SectionForVApp findNetworkConnectionSectionForVApp; + @Inject private static SectionForVApp findNetworkConnectionSectionForVApp = + new SectionForVApp(NetworkConnectionSection.class); public static Set getIpsFromVApp(VApp vApp) { // TODO make this work with composite vApps diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/config/VCloudDirectorRestClientModule.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/config/VCloudDirectorRestClientModule.java index 288c4b6c85..2f560e50a1 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/config/VCloudDirectorRestClientModule.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/config/VCloudDirectorRestClientModule.java @@ -174,8 +174,6 @@ public class VCloudDirectorRestClientModule extends RestClientModule implements Function { private final Class sectionType; - @Inject - SectionForVApp(Class sectionType) { + public SectionForVApp(Class sectionType) { this.sectionType = sectionType; }