mirror of https://github.com/apache/jclouds.git
fix SectionForVApp usage
This commit is contained in:
parent
ef79f94e1d
commit
9b7bd20986
|
@ -60,7 +60,8 @@ public class VCloudDirectorComputeUtils {
|
||||||
return vApp.getChildren().getVms().size() > 0 ? toComputeOs(Iterables.get(vApp.getChildren().getVms(), 0)) : null;
|
return vApp.getChildren().getVms().size() > 0 ? toComputeOs(Iterables.get(vApp.getChildren().getVms(), 0)) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject private static SectionForVApp<OperatingSystemSection> findOperatingSystemSectionForVApp;
|
private static SectionForVApp<OperatingSystemSection> findOperatingSystemSectionForVApp =
|
||||||
|
new SectionForVApp<OperatingSystemSection>(OperatingSystemSection.class);
|
||||||
|
|
||||||
public static CIMOperatingSystem toComputeOs(Vm vm) {
|
public static CIMOperatingSystem toComputeOs(Vm vm) {
|
||||||
return toComputeOs(findOperatingSystemSectionForVApp.apply(vm));
|
return toComputeOs(findOperatingSystemSectionForVApp.apply(vm));
|
||||||
|
@ -75,7 +76,8 @@ public class VCloudDirectorComputeUtils {
|
||||||
getVirtualSystemIdentifierOf(Iterables.get(vApp.getChildren().getVms(), 0)) : null;
|
getVirtualSystemIdentifierOf(Iterables.get(vApp.getChildren().getVms(), 0)) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject private static SectionForVApp<VirtualHardwareSection> findVirtualHardwareSectionForVApp;
|
@Inject private static SectionForVApp<VirtualHardwareSection> findVirtualHardwareSectionForVApp =
|
||||||
|
new SectionForVApp<VirtualHardwareSection>(VirtualHardwareSection.class);
|
||||||
|
|
||||||
public static String getVirtualSystemIdentifierOf(Vm vm) {
|
public static String getVirtualSystemIdentifierOf(Vm vm) {
|
||||||
VirtualHardwareSection virtualHardwareSection = findVirtualHardwareSectionForVApp.apply(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;
|
return vApp.getChildren().size() > 0 ? getCredentialsFrom(Iterables.get(vApp.getChildren(), 0)) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject private static SectionForVApp<GuestCustomizationSection> findGuestCustomizationSectionForVApp;
|
@Inject private static SectionForVApp<GuestCustomizationSection> findGuestCustomizationSectionForVApp =
|
||||||
|
new SectionForVApp<GuestCustomizationSection>(GuestCustomizationSection.class);
|
||||||
|
|
||||||
public static LoginCredentials getCredentialsFrom(Vm vm) {
|
public static LoginCredentials getCredentialsFrom(Vm vm) {
|
||||||
LoginCredentials.Builder builder = LoginCredentials.builder();
|
LoginCredentials.Builder builder = LoginCredentials.builder();
|
||||||
|
@ -103,7 +106,8 @@ public class VCloudDirectorComputeUtils {
|
||||||
return builder.build();
|
return builder.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject private static SectionForVApp<NetworkConnectionSection> findNetworkConnectionSectionForVApp;
|
@Inject private static SectionForVApp<NetworkConnectionSection> findNetworkConnectionSectionForVApp =
|
||||||
|
new SectionForVApp<NetworkConnectionSection>(NetworkConnectionSection.class);
|
||||||
|
|
||||||
public static Set<String> getIpsFromVApp(VApp vApp) {
|
public static Set<String> getIpsFromVApp(VApp vApp) {
|
||||||
// TODO make this work with composite vApps
|
// TODO make this work with composite vApps
|
||||||
|
|
|
@ -174,8 +174,6 @@ public class VCloudDirectorRestClientModule extends RestClientModule<VCloudDirec
|
||||||
|
|
||||||
bind(HttpRetryHandler.class).annotatedWith(ClientError.class).to(InvalidateSessionAndRetryOn401AndLogoutOnClose.class);
|
bind(HttpRetryHandler.class).annotatedWith(ClientError.class).to(InvalidateSessionAndRetryOn401AndLogoutOnClose.class);
|
||||||
|
|
||||||
requestStaticInjection(VCloudDirectorComputeUtils.class);
|
|
||||||
|
|
||||||
super.configure();
|
super.configure();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,9 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package org.jclouds.vcloud.director.v1_5.functions;
|
package org.jclouds.vcloud.director.v1_5.functions;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
|
||||||
import javax.inject.Singleton;
|
|
||||||
|
|
||||||
import org.jclouds.dmtf.ovf.SectionType;
|
import org.jclouds.dmtf.ovf.SectionType;
|
||||||
import org.jclouds.vcloud.director.v1_5.domain.AbstractVAppType;
|
import org.jclouds.vcloud.director.v1_5.domain.AbstractVAppType;
|
||||||
|
|
||||||
|
@ -29,13 +26,11 @@ import com.google.common.base.Function;
|
||||||
/**
|
/**
|
||||||
* @author danikov
|
* @author danikov
|
||||||
*/
|
*/
|
||||||
@Singleton
|
|
||||||
public class SectionForVApp<S extends SectionType> implements Function<AbstractVAppType, S> {
|
public class SectionForVApp<S extends SectionType> implements Function<AbstractVAppType, S> {
|
||||||
|
|
||||||
private final Class<? extends SectionType> sectionType;
|
private final Class<? extends SectionType> sectionType;
|
||||||
|
|
||||||
@Inject
|
public SectionForVApp(Class<S> sectionType) {
|
||||||
SectionForVApp(Class<S> sectionType) {
|
|
||||||
this.sectionType = sectionType;
|
this.sectionType = sectionType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue