You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jclouds.apache.org by ad...@apache.org on 2014/11/17 17:21:35 UTC
[28/32] jclouds-labs git commit: JCLOUDS-780 Remove vcloud-director.
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/775b89fd/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/compute/functions/VmToNodeMetadata.java
----------------------------------------------------------------------
diff --git a/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/compute/functions/VmToNodeMetadata.java b/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/compute/functions/VmToNodeMetadata.java
deleted file mode 100644
index 2a25539..0000000
--- a/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/compute/functions/VmToNodeMetadata.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.vcloud.director.v1_5.compute.functions;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.base.Predicates.not;
-import static com.google.common.collect.Iterables.filter;
-import static org.jclouds.vcloud.director.v1_5.compute.util.VCloudDirectorComputeUtils.getCredentialsFrom;
-import static org.jclouds.vcloud.director.v1_5.compute.util.VCloudDirectorComputeUtils.getIpsFromVm;
-import static org.jclouds.vcloud.director.v1_5.compute.util.VCloudDirectorComputeUtils.toComputeOs;
-
-import java.util.Map;
-import java.util.Set;
-
-import javax.annotation.Resource;
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import org.jclouds.compute.domain.Hardware;
-import org.jclouds.compute.domain.NodeMetadata;
-import org.jclouds.compute.domain.NodeMetadataBuilder;
-import org.jclouds.compute.functions.GroupNamingConvention;
-import org.jclouds.domain.Credentials;
-import org.jclouds.logging.Logger;
-import org.jclouds.util.InetAddresses2.IsPrivateIPAddress;
-import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
-import org.jclouds.vcloud.director.v1_5.domain.Vm;
-import org.jclouds.vcloud.director.v1_5.domain.ResourceEntity.Status;
-import org.jclouds.vcloud.director.v1_5.predicates.LinkPredicates;
-
-import com.google.common.base.Function;
-import com.google.common.collect.Iterables;
-
-@Singleton
-public class VmToNodeMetadata implements Function<Vm, NodeMetadata> {
- @Resource
- protected static Logger logger = Logger.NULL;
-
- protected final FindLocationForResource findLocationForResourceInVDC;
- protected final Function<Vm, Hardware> hardwareForVm;
- protected final Map<Status, NodeMetadata.Status> vAppStatusToNodeStatus;
- protected final Map<String, Credentials> credentialStore;
- protected final GroupNamingConvention nodeNamingConvention;
-
- @Inject
- protected VmToNodeMetadata(Map<Status, NodeMetadata.Status> vAppStatusToNodeStatus, Map<String, Credentials> credentialStore,
- FindLocationForResource findLocationForResourceInVDC, Function<Vm, Hardware> hardwareForVm,
- GroupNamingConvention.Factory namingConvention) {
- this.nodeNamingConvention = checkNotNull(namingConvention, "namingConvention").createWithoutPrefix();
- this.hardwareForVm = checkNotNull(hardwareForVm, "hardwareForVm");
- this.findLocationForResourceInVDC = checkNotNull(findLocationForResourceInVDC, "findLocationForResourceInVDC");
- this.credentialStore = checkNotNull(credentialStore, "credentialStore");
- this.vAppStatusToNodeStatus = checkNotNull(vAppStatusToNodeStatus, "vAppStatusToNodeStatus");
- }
-
- public NodeMetadata apply(Vm from) {
- NodeMetadataBuilder builder = new NodeMetadataBuilder();
- builder.ids(from.getHref().toASCIIString());
- builder.uri(from.getHref());
- builder.name(from.getName());
- builder.hostname(from.getName());
- builder.location(findLocationForResourceInVDC.apply(
- Iterables.find(from.getLinks(), LinkPredicates.typeEquals(VCloudDirectorMediaType.VDC))));
- builder.group(nodeNamingConvention.groupInUniqueNameOrNull(from.getName()));
- builder.operatingSystem(toComputeOs(from));
- builder.hardware(hardwareForVm.apply(from));
- builder.status(vAppStatusToNodeStatus.get(from.getStatus()));
- Set<String> addresses = getIpsFromVm(from);
- builder.publicAddresses(filter(addresses, not(IsPrivateIPAddress.INSTANCE)));
- builder.privateAddresses(filter(addresses, IsPrivateIPAddress.INSTANCE));
-
- // normally, we don't affect the credential store when reading vApps.
- // However, login user, etc, is actually in the metadata, so lets see
- Credentials fromApi = getCredentialsFrom(from);
- if (fromApi != null && !credentialStore.containsKey("node#" + from.getHref().toASCIIString()))
- credentialStore.put("node#" + from.getHref().toASCIIString(), fromApi);
- return builder.build();
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/775b89fd/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/compute/util/VCloudDirectorComputeUtils.java
----------------------------------------------------------------------
diff --git a/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/compute/util/VCloudDirectorComputeUtils.java b/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/compute/util/VCloudDirectorComputeUtils.java
deleted file mode 100644
index 25a13af..0000000
--- a/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/compute/util/VCloudDirectorComputeUtils.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.vcloud.director.v1_5.compute.util;
-
-import static com.google.common.collect.Iterables.filter;
-
-import java.util.Set;
-
-import org.jclouds.cim.OSType;
-import org.jclouds.compute.domain.CIMOperatingSystem;
-import org.jclouds.compute.domain.OperatingSystem;
-import org.jclouds.dmtf.CIMPredicates;
-import org.jclouds.dmtf.cim.ResourceAllocationSettingData;
-import org.jclouds.dmtf.cim.ResourceAllocationSettingData.ResourceType;
-import org.jclouds.domain.LoginCredentials;
-import org.jclouds.vcloud.director.v1_5.domain.VApp;
-import org.jclouds.vcloud.director.v1_5.domain.VAppTemplate;
-import org.jclouds.vcloud.director.v1_5.domain.Vm;
-import org.jclouds.vcloud.director.v1_5.domain.network.NetworkConnection;
-import org.jclouds.vcloud.director.v1_5.domain.section.GuestCustomizationSection;
-import org.jclouds.vcloud.director.v1_5.domain.section.NetworkConnectionSection;
-import org.jclouds.vcloud.director.v1_5.domain.section.OperatingSystemSection;
-import org.jclouds.vcloud.director.v1_5.domain.section.VirtualHardwareSection;
-import org.jclouds.vcloud.director.v1_5.functions.SectionForVApp;
-
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.ImmutableSet.Builder;
-import com.google.common.collect.Iterables;
-import com.google.inject.Inject;
-
-public class VCloudDirectorComputeUtils {
-
- public static OperatingSystem toComputeOs(VApp vApp, OperatingSystem defaultOs) {
- CIMOperatingSystem cimOs = toComputeOs(vApp);
- return cimOs != null ? cimOs : defaultOs;
- }
-
- public static CIMOperatingSystem toComputeOs(VApp vApp) {
- // TODO we need to change the design so that it doesn't assume single-vms
- return vApp.getChildren().getVms().size() > 0 ? toComputeOs(Iterables.get(vApp.getChildren().getVms(), 0)) : null;
- }
-
- private static SectionForVApp<OperatingSystemSection> findOperatingSystemSectionForVApp =
- new SectionForVApp<OperatingSystemSection>(OperatingSystemSection.class);
-
- public static CIMOperatingSystem toComputeOs(Vm vm) {
- return toComputeOs(findOperatingSystemSectionForVApp.apply(vm));
- }
-
- public static CIMOperatingSystem toComputeOs(OperatingSystemSection os) {
- return new CIMOperatingSystem(OSType.fromValue(os.getId()), "", null, os.getDescription());
- }
-
- public static String getVirtualSystemIdentifierOfFirstVMIn(VApp vApp) {
- return vApp.getChildren().getVms().size() > 0 ?
- getVirtualSystemIdentifierOf(Iterables.get(vApp.getChildren().getVms(), 0)) : null;
- }
-
- @Inject private static SectionForVApp<VirtualHardwareSection> findVirtualHardwareSectionForVApp =
- new SectionForVApp<VirtualHardwareSection>(VirtualHardwareSection.class);
-
- public static String getVirtualSystemIdentifierOf(Vm vm) {
- VirtualHardwareSection virtualHardwareSection = findVirtualHardwareSectionForVApp.apply(vm);
- if (virtualHardwareSection != null && virtualHardwareSection.getSystem() != null)
- return virtualHardwareSection.getSystem().getVirtualSystemIdentifier();
- return null;
- }
-
- public static LoginCredentials getCredentialsFrom(VApp vApp) {
- return vApp.getChildren().getVms().size() > 0 ?
- getCredentialsFrom(Iterables.get(vApp.getChildren().getVms(), 0)) : null;
- }
-
- public static LoginCredentials getCredentialsFrom(VAppTemplate vApp) {
- return vApp.getChildren().size() > 0 ? getCredentialsFrom(Iterables.get(vApp.getChildren(), 0)) : null;
- }
-
- @Inject private static SectionForVApp<GuestCustomizationSection> findGuestCustomizationSectionForVApp =
- new SectionForVApp<GuestCustomizationSection>(GuestCustomizationSection.class);
-
- public static LoginCredentials getCredentialsFrom(Vm vm) {
- LoginCredentials.Builder builder = LoginCredentials.builder();
- GuestCustomizationSection guestCustomizationSection = findGuestCustomizationSectionForVApp.apply(vm);
- if (guestCustomizationSection != null)
- builder.password(guestCustomizationSection.getAdminPassword());
- return builder.build();
- }
-
- @Inject private static SectionForVApp<NetworkConnectionSection> findNetworkConnectionSectionForVApp =
- new SectionForVApp<NetworkConnectionSection>(NetworkConnectionSection.class);
-
- public static Set<String> getIpsFromVApp(VApp vApp) {
- // TODO make this work with composite vApps
- if (vApp.getChildren().getVms().size() == 0)
- return ImmutableSet.of();
- return getIpsFromVm(Iterables.get(vApp.getChildren().getVms(), 0));
- }
-
- public static Set<String> getIpsFromVm(Vm vm) {
- Builder<String> ips = ImmutableSet.builder();
- // TODO: figure out how to differentiate public from private ip addresses
- // assumption is that we'll do this from the network object, which may
- // have
- // enough data to tell whether or not it is a public network without
- // string
- // parsing. At worst, we could have properties set per cloud provider to
- // declare the networks which are public, then check against these in
- // networkconnection.getNetwork
- NetworkConnectionSection networkConnectionSection = findNetworkConnectionSectionForVApp.apply(vm);
- if (networkConnectionSection != null) {
- for (NetworkConnection connection : networkConnectionSection.getNetworkConnections()) {
- if (connection.getIpAddress() != null)
- ips.add(connection.getIpAddress());
- if (connection.getExternalIpAddress() != null)
- ips.add(connection.getExternalIpAddress());
- }
- } else {
- for (ResourceAllocationSettingData net : filter(findVirtualHardwareSectionForVApp.apply(vm).getItems(),
- CIMPredicates.resourceTypeIn(ResourceType.ETHERNET_ADAPTER))) {
- // FIXME: not yet implemented
-// if (net instanceof VCloudNetworkAdapter) {
-// VCloudNetworkAdapter vNet = VCloudNetworkAdapter.class.cast(net);
-// if (vNet.getIpAddress() != null)
-// ips.add(vNet.getIpAddress());
-// }
- }
- }
- return ips.build();
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/775b89fd/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/config/VCloudDirectorHttpApiModule.java
----------------------------------------------------------------------
diff --git a/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/config/VCloudDirectorHttpApiModule.java b/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/config/VCloudDirectorHttpApiModule.java
deleted file mode 100644
index c78d68e..0000000
--- a/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/config/VCloudDirectorHttpApiModule.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.vcloud.director.v1_5.config;
-
-import static org.jclouds.Constants.PROPERTY_SESSION_INTERVAL;
-import static org.jclouds.rest.config.BinderUtils.bindHttpApi;
-
-import java.net.URI;
-import java.util.concurrent.TimeUnit;
-
-import org.jclouds.domain.Credentials;
-import org.jclouds.http.HttpErrorHandler;
-import org.jclouds.http.HttpRetryHandler;
-import org.jclouds.http.annotation.ClientError;
-import org.jclouds.http.annotation.Redirection;
-import org.jclouds.http.annotation.ServerError;
-import org.jclouds.location.Provider;
-import org.jclouds.rest.ApiContext;
-import org.jclouds.rest.ConfiguresHttpApi;
-import org.jclouds.rest.config.HttpApiModule;
-import org.jclouds.rest.internal.ApiContextImpl;
-import org.jclouds.vcloud.director.v1_5.admin.VCloudDirectorAdminApi;
-import org.jclouds.vcloud.director.v1_5.annotations.Login;
-import org.jclouds.vcloud.director.v1_5.domain.Entity;
-import org.jclouds.vcloud.director.v1_5.domain.Session;
-import org.jclouds.vcloud.director.v1_5.domain.SessionWithToken;
-import org.jclouds.vcloud.director.v1_5.features.OrgApi;
-import org.jclouds.vcloud.director.v1_5.features.TaskApi;
-import org.jclouds.vcloud.director.v1_5.features.VAppApi;
-import org.jclouds.vcloud.director.v1_5.features.VmApi;
-import org.jclouds.vcloud.director.v1_5.handlers.InvalidateSessionAndRetryOn401AndLogoutOnClose;
-import org.jclouds.vcloud.director.v1_5.handlers.VCloudDirectorErrorHandler;
-import org.jclouds.vcloud.director.v1_5.loaders.LoginUserInOrgWithPassword;
-import org.jclouds.vcloud.director.v1_5.loaders.ResolveEntity;
-import org.jclouds.vcloud.director.v1_5.login.SessionApi;
-import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorApi;
-
-import com.google.common.base.Function;
-import com.google.common.base.Supplier;
-import com.google.common.base.Suppliers;
-import com.google.common.cache.CacheBuilder;
-import com.google.common.cache.LoadingCache;
-import com.google.inject.Provides;
-import com.google.inject.Singleton;
-import com.google.inject.TypeLiteral;
-import com.google.inject.name.Named;
-
-@ConfiguresHttpApi
-public class VCloudDirectorHttpApiModule extends HttpApiModule<VCloudDirectorApi> {
- @Override
- protected void configure() {
- bind(new TypeLiteral<ApiContext<VCloudDirectorAdminApi>>() {
- }).to(new TypeLiteral<ApiContextImpl<VCloudDirectorAdminApi>>() {
- });
-
- // Bind apis that are used directly in Functions, Predicates and other circumstances
- bindHttpApi(binder(), OrgApi.class);
- bindHttpApi(binder(), SessionApi.class);
- bindHttpApi(binder(), TaskApi.class);
- bindHttpApi(binder(), VAppApi.class);
- bindHttpApi(binder(), VmApi.class);
-
- bind(HttpRetryHandler.class).annotatedWith(ClientError.class).to(InvalidateSessionAndRetryOn401AndLogoutOnClose.class);
-
- super.configure();
- bindHttpApi(binder(), VCloudDirectorAdminApi.class);
- }
-
- @Override
- protected void bindErrorHandlers() {
- bind(HttpErrorHandler.class).annotatedWith(Redirection.class).to(VCloudDirectorErrorHandler.class);
- bind(HttpErrorHandler.class).annotatedWith(ClientError.class).to(VCloudDirectorErrorHandler.class);
- bind(HttpErrorHandler.class).annotatedWith(ServerError.class).to(VCloudDirectorErrorHandler.class);
- }
-
- @Provides
- @Login
- protected Supplier<URI> loginUrl(@Provider Supplier<URI> provider) {
- // TODO: technically, we should implement version api, but this will work
- return Suppliers.compose(new Function<URI, URI>() {
-
- @Override
- public URI apply(URI arg0) {
- return URI.create(arg0.toASCIIString() + "/sessions");
- }
-
- }, provider);
- }
-
- @Provides
- protected Supplier<Session> currentSession(Supplier<SessionWithToken> in) {
- return Suppliers.compose(new Function<SessionWithToken, Session>() {
-
- @Override
- public Session apply(SessionWithToken arg0) {
- return arg0.getSession();
- }
-
- }, in);
-
- }
-
- @Provides
- @Singleton
- @org.jclouds.vcloud.director.v1_5.annotations.Session
- protected Supplier<String> sessionToken(Supplier<SessionWithToken> in) {
- return Suppliers.compose(new Function<SessionWithToken, String>() {
-
- @Override
- public String apply(SessionWithToken arg0) {
- return arg0.getToken();
- }
-
- }, in);
-
- }
-
- @Provides
- @Singleton
- LoadingCache<String, Entity> resolveEntityCache(ResolveEntity loader, @Named(PROPERTY_SESSION_INTERVAL) int seconds) {
- return CacheBuilder.newBuilder().expireAfterWrite(seconds, TimeUnit.SECONDS).build(loader);
- }
-
- @Provides
- @Singleton
- LoadingCache<Credentials, SessionWithToken> provideSessionWithTokenCache(LoginUserInOrgWithPassword loader,
- @Named(PROPERTY_SESSION_INTERVAL) int seconds) {
- return CacheBuilder.newBuilder().expireAfterWrite(seconds, TimeUnit.SECONDS).build(loader);
- }
-
- // Temporary conversion of a cache to a supplier until there is a single-element cache
- // http://code.google.com/p/guava-libraries/issues/detail?id=872
- @Provides
- @Singleton
- protected Supplier<SessionWithToken> provideSessionWithTokenSupplier(
- final LoadingCache<Credentials, SessionWithToken> cache, @Provider final Supplier<Credentials> creds) {
- return new Supplier<SessionWithToken>() {
- @Override
- public SessionWithToken get() {
- return cache.getUnchecked(creds.get());
- }
- };
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/775b89fd/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/AbstractVApp.java
----------------------------------------------------------------------
diff --git a/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/AbstractVApp.java b/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/AbstractVApp.java
deleted file mode 100644
index 6b6af2a..0000000
--- a/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/AbstractVApp.java
+++ /dev/null
@@ -1,227 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.vcloud.director.v1_5.domain;
-
-import static com.google.common.base.Objects.equal;
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.Set;
-
-import javax.xml.bind.annotation.XmlAttribute;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlElementRef;
-import javax.xml.bind.annotation.XmlElementRefs;
-import javax.xml.bind.annotation.XmlType;
-
-import org.jclouds.dmtf.ovf.DeploymentOptionSection;
-import org.jclouds.dmtf.ovf.DiskSection;
-import org.jclouds.dmtf.ovf.NetworkSection;
-import org.jclouds.dmtf.ovf.ProductSection;
-import org.jclouds.dmtf.ovf.SectionType;
-import org.jclouds.dmtf.ovf.StartupSection;
-import org.jclouds.vcloud.director.v1_5.domain.section.CustomizationSection;
-import org.jclouds.vcloud.director.v1_5.domain.section.GuestCustomizationSection;
-import org.jclouds.vcloud.director.v1_5.domain.section.LeaseSettingsSection;
-import org.jclouds.vcloud.director.v1_5.domain.section.NetworkConfigSection;
-import org.jclouds.vcloud.director.v1_5.domain.section.NetworkConnectionSection;
-import org.jclouds.vcloud.director.v1_5.domain.section.OperatingSystemSection;
-import org.jclouds.vcloud.director.v1_5.domain.section.RuntimeInfoSection;
-import org.jclouds.vcloud.director.v1_5.domain.section.VirtualHardwareSection;
-
-import com.google.common.base.Objects;
-import com.google.common.base.Objects.ToStringHelper;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Sets;
-
-@XmlType(name = "AbstractVAppType")
-public abstract class AbstractVApp extends ResourceEntity {
-
- public static Builder<?> builder() {
- return new ConcreteBuilder();
- }
-
- @Override
- public Builder<?> toBuilder() {
- return builder().fromResourceEntityType(this);
- }
-
- private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
- }
-
- public abstract static class Builder<B extends Builder<B>> extends ResourceEntity.Builder<B> {
-
- private Boolean deployed;
- private Reference vAppParent;
- private Set<SectionType> sections = Sets.newLinkedHashSet();
-
- /**
- * @see AbstractVApp#isDeployed()
- */
- public B isDeployed(Boolean deployed) {
- this.deployed = deployed;
- return self();
- }
-
- /**
- * @see AbstractVApp#isDeployed()
- */
- public B deployed() {
- this.deployed = Boolean.TRUE;
- return self();
- }
-
- /**
- * @see AbstractVApp#isDeployed()
- */
- public B notDeployed() {
- this.deployed = Boolean.FALSE;
- return self();
- }
-
- /**
- * @see AbstractVApp#getVAppParent()
- */
- public B parent(Reference vAppParent) {
- this.vAppParent = vAppParent;
- return self();
- }
-
- /**
- * @see AbstractVApp#getSections()
- */
- public B sections(Iterable<? extends SectionType> sections) {
- this.sections = Sets.newLinkedHashSet(checkNotNull(sections, "sections"));
- return self();
- }
-
- /**
- * @see AbstractVApp#getSections()
- */
- public B section(SectionType section) {
- this.sections.add(checkNotNull(section, "section"));
- return self();
- }
-
- public B fromAbstractVAppType(AbstractVApp in) {
- return fromResourceEntityType(in).parent(vAppParent).sections(sections).isDeployed(deployed);
- }
- }
-
- @XmlElement(name = "VAppParent")
- private Reference vAppParent;
- @XmlElementRefs({
- @XmlElementRef(type = VirtualHardwareSection.class),
- @XmlElementRef(type = LeaseSettingsSection.class),
-// @XmlElementRef(type = EulaSection.class),
- @XmlElementRef(type = RuntimeInfoSection.class),
-// @XmlElementRef(type = AnnotationSection.class),
- @XmlElementRef(type = DeploymentOptionSection.class),
- @XmlElementRef(type = StartupSection.class),
-// @XmlElementRef(type = ResourceAllocationSection.class),
- @XmlElementRef(type = NetworkConnectionSection.class),
- @XmlElementRef(type = CustomizationSection.class),
- @XmlElementRef(type = ProductSection.class),
- @XmlElementRef(type = GuestCustomizationSection.class),
- @XmlElementRef(type = OperatingSystemSection.class),
- @XmlElementRef(type = NetworkConfigSection.class),
- @XmlElementRef(type = NetworkSection.class),
-// @XmlElementRef(type = InstallSection.class),
- @XmlElementRef(type = DiskSection.class)
- })
- private Set<SectionType> sections = Sets.newLinkedHashSet();
- @XmlAttribute
- private Boolean deployed;
-
- protected AbstractVApp() {
- // for JAXB and Builders
- }
-
- protected AbstractVApp(Builder<?> builder) {
- super(builder);
- this.vAppParent = builder.vAppParent;
- this.sections = builder.sections.isEmpty() ? null : ImmutableSet.copyOf(builder.sections);
- this.deployed = builder.deployed;
- }
-
- /**
- * Gets the value of the vAppParent property.
- */
- public Reference getVAppParent() {
- return vAppParent;
- }
-
- /**
- * Specific {@code ovf:Section} with additional information for the vApp.
- *
- * Objects of the following type(s) are allowed in the list:
- * <ul>
- * <li>{@link VirtualHardwareSectionType}
- * <li>{@link LeaseSettingsSectionType}
- * <li>{@link EulaSectionType}
- * <li>{@link RuntimeInfoSectionType}
- * <li>{@link AnnotationSectionType}
- * <li>{@link DeploymentOptionSectionType}
- * <li>{@link StartupSectionType}
- * <li>{@link ResourceAllocationSectionType}
- * <li>{@link NetworkConnectionSectionType}
- * <li>{@link CustomizationSectionType}
- * <li>{@link ProductSectionType}
- * <li>{@link GuestCustomizationSectionType}
- * <li>{@link OperatingSystemSectionType}
- * <li>{@link NetworkConfigSectionType}
- * <li>{@link NetworkSectionType}
- * <li>{@link DiskSectionType}
- * <li>{@link InstallSectionType}
- * </ul>
- */
- public Set<SectionType> getSections() {
- return sections != null ? ImmutableSet.copyOf(sections) : ImmutableSet.<SectionType>of();
- }
-
- /**
- * Gets the value of the deployed property.
- */
- public Boolean isDeployed() {
- return deployed;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o)
- return true;
- if (o == null || getClass() != o.getClass())
- return false;
- AbstractVApp that = AbstractVApp.class.cast(o);
- return super.equals(that)
- && equal(this.vAppParent, that.vAppParent)
- && equal(this.sections, that.sections)
- && equal(this.deployed, that.deployed);
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(super.hashCode(), vAppParent, sections, deployed);
- }
-
- @Override
- public ToStringHelper string() {
- return super.string()
- .add("vAppParent", vAppParent)
- .add("sections", sections)
- .add("deployed", deployed);
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/775b89fd/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/AccessSetting.java
----------------------------------------------------------------------
diff --git a/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/AccessSetting.java b/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/AccessSetting.java
deleted file mode 100644
index bdb19b4..0000000
--- a/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/AccessSetting.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.vcloud.director.v1_5.domain;
-
-import static com.google.common.base.Objects.equal;
-
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlType;
-
-import com.google.common.base.Objects;
-
-/**
- * Specifies who can access a resource.
- */
-@XmlRootElement(name = "AccessSetting")
-@XmlType(name = "AccessSettingType")
-public class AccessSetting {
-
- public static Builder builder() {
- return new Builder();
- }
-
- public Builder toBuilder() {
- return new Builder().fromAccessSetting(this);
- }
-
- public static class Builder {
-
- private Reference subject;
- private String accessLevel;
-
- /**
- * @see AccessSetting#getSubject()
- */
- public Builder subject(Reference subject) {
- this.subject = subject;
- return this;
- }
-
- /**
- * @see AccessSetting#getAccessLevel()
- */
- public Builder accessLevel(String accessLevel) {
- this.accessLevel = accessLevel;
- return this;
- }
-
- public AccessSetting build() {
- AccessSetting accessSetting = new AccessSetting(subject, accessLevel);
- return accessSetting;
- }
-
- public Builder fromAccessSetting(AccessSetting in) {
- return subject(in.getSubject()).accessLevel(in.getAccessLevel());
- }
- }
-
- protected AccessSetting() {
- // For JAXB and builder use
- }
-
- public AccessSetting(Reference subject, String accessLevel) {
- this.subject = subject;
- this.accessLevel = accessLevel;
- }
-
- @XmlElement(name = "Subject", required = true)
- protected Reference subject;
- @XmlElement(name = "AccessLevel", required = true)
- protected String accessLevel;
-
- /**
- * Gets the value of the subject property.
- */
- public Reference getSubject() {
- return subject;
- }
-
- /**
- * Gets the value of the accessLevel property.
- */
- public String getAccessLevel() {
- return accessLevel;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o)
- return true;
- if (o == null || getClass() != o.getClass())
- return false;
- AccessSetting that = AccessSetting.class.cast(o);
- return equal(this.subject, that.subject) && equal(this.accessLevel, that.accessLevel);
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(subject, accessLevel);
- }
-
- @Override
- public String toString() {
- return Objects.toStringHelper("").add("subject", subject).add("accessLevel", accessLevel).toString();
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/775b89fd/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/AdminCatalog.java
----------------------------------------------------------------------
diff --git a/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/AdminCatalog.java b/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/AdminCatalog.java
deleted file mode 100644
index 78e562a..0000000
--- a/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/AdminCatalog.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.vcloud.director.v1_5.domain;
-
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlType;
-
-
-/**
- * Admin representation of the container for meta data (key-value pair) associated to different
- * entities in the system.
- */
-@XmlRootElement(name = "AdminCatalog")
-@XmlType(name = "AdminCatalogType")
-public class AdminCatalog extends Catalog {
-
- public static Builder<?> builder() {
- return new ConcreteBuilder();
- }
-
- @Override
- public Builder<?> toBuilder() {
- return builder().fromAdminCatalog(this);
- }
-
- private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
- }
-
- public abstract static class Builder<B extends Builder<B>> extends Catalog.Builder<B> {
-
- @Override
- public AdminCatalog build() {
- return new AdminCatalog(this);
- }
-
- public B fromAdminCatalog(AdminCatalog in) {
- return fromCatalogType(in);
- }
- }
-
- @SuppressWarnings("unused")
- private AdminCatalog() {
- // For JAXB
- }
-
- protected AdminCatalog(Builder<?> builder) {
- super(builder);
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/775b89fd/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/AdminVdc.java
----------------------------------------------------------------------
diff --git a/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/AdminVdc.java b/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/AdminVdc.java
deleted file mode 100644
index a317d64..0000000
--- a/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/AdminVdc.java
+++ /dev/null
@@ -1,298 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.vcloud.director.v1_5.domain;
-
-import static com.google.common.base.Objects.equal;
-
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlType;
-
-import com.google.common.base.Objects;
-import com.google.common.base.Objects.ToStringHelper;
-
-/**
- * Provides an administrative view of a vDC. Includes all members
- * of the Vdc element, and adds several elements that can be
- * viewed and modified only by administrators.
- *
- * <p/> The redwood admin can disable an
- * organization vDC. This will prevent any further allocation to be used by the organization.
- * Changing the state will not affect allocations already used. For example, if an organization
- * vDC is disabled, an organization user cannot deploy or add a new virtual machine in the
- * vDC (deploy uses memory and cpu allocations, and add uses storage allocation).
- */
-@XmlRootElement(name = "AdminVdc")
-@XmlType(name = "AdminVdcType", propOrder = {
- "resourceGuaranteedMemory",
- "resourceGuaranteedCpu",
- "vCpuInMhz",
- "isThinProvision",
- "networkPoolReference",
- "providerVdcReference",
- "usesFastProvisioning"
-})
-public class AdminVdc extends Vdc {
- public static Builder<?> builder() {
- return new ConcreteBuilder();
- }
-
- public abstract static class Builder<T extends Builder<T>> extends Vdc.Builder<T> {
- private Double resourceGuaranteedMemory;
- private Double resourceGuaranteedCpu;
- private Long vCpuInMhz;
- private Boolean isThinProvision;
- private Reference networkPoolReference;
- private Reference providerVdcReference;
- private Boolean usesFastProvisioning;
-
- /**
- * @see AdminVdc#getResourceGuaranteedMemory()
- */
- public T resourceGuaranteedMemory(Double resourceGuaranteedMemory) {
- this.resourceGuaranteedMemory = resourceGuaranteedMemory;
- return self();
- }
-
- /**
- * @see AdminVdc#getResourceGuaranteedCpu()
- */
- public T resourceGuaranteedCpu(Double resourceGuaranteedCpu) {
- this.resourceGuaranteedCpu = resourceGuaranteedCpu;
- return self();
- }
-
- /**
- * @see AdminVdc#getVCpuInMhz()
- */
- public T vCpuInMhz(Long vCpuInMhz) {
- this.vCpuInMhz = vCpuInMhz;
- return self();
- }
-
- /**
- * @see AdminVdc#getIsThinProvision()
- */
- public T isThinProvision(Boolean isThinProvision) {
- this.isThinProvision = isThinProvision;
- return self();
- }
-
- /**
- * @see AdminVdc#getNetworkPoolReference()
- */
- public T networkPoolReference(Reference networkPoolReference) {
- this.networkPoolReference = networkPoolReference;
- return self();
- }
-
- /**
- * @see AdminVdc#getProviderVdcReference()
- */
- public T providerVdcReference(Reference providerVdcReference) {
- this.providerVdcReference = providerVdcReference;
- return self();
- }
-
- /**
- * @see AdminVdc#getUsesFastProvisioning()
- */
- public T usesFastProvisioning(Boolean usesFastProvisioning) {
- this.usesFastProvisioning = usesFastProvisioning;
- return self();
- }
-
- @Override
- public AdminVdc build() {
- return new AdminVdc(this);
- }
-
- public T fromAdminVdc(AdminVdc in) {
- return fromVdc(in)
- .resourceGuaranteedMemory(in.getResourceGuaranteedMemory())
- .resourceGuaranteedCpu(in.getResourceGuaranteedCpu())
- .vCpuInMhz(in.getVCpuInMhz())
- .isThinProvision(in.isThinProvision())
- .networkPoolReference(in.getNetworkPoolReference())
- .providerVdcReference(in.getProviderVdcReference())
- .usesFastProvisioning(in.usesFastProvisioning());
- }
- }
-
- private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
- @Override protected ConcreteBuilder self() {
- return this;
- }
- }
-
- @SuppressWarnings("unused")
- private AdminVdc() {
- // For JAXB
- }
-
- public AdminVdc(Builder<?> b) {
- super(b);
- resourceGuaranteedMemory = b.resourceGuaranteedMemory;
- resourceGuaranteedCpu = b.resourceGuaranteedCpu;
- vCpuInMhz = b.vCpuInMhz;
- isThinProvision = b.isThinProvision;
- networkPoolReference = b.networkPoolReference;
- providerVdcReference = b.providerVdcReference;
- usesFastProvisioning = b.usesFastProvisioning;
- }
-
- @XmlElement(name = "ResourceGuaranteedMemory")
- protected Double resourceGuaranteedMemory;
- @XmlElement(name = "ResourceGuaranteedCpu")
- protected Double resourceGuaranteedCpu;
- @XmlElement(name = "VCpuInMhz")
- protected Long vCpuInMhz;
- @XmlElement(name = "IsThinProvision")
- protected Boolean isThinProvision;
- @XmlElement(name = "NetworkPoolReference")
- protected Reference networkPoolReference;
- @XmlElement(name = "ProviderVdcReference")
- protected Reference providerVdcReference;
- @XmlElement(name = "UsesFastProvisioning")
- protected Boolean usesFastProvisioning;
-
- /**
- * Gets the value of the resourceGuaranteedMemory property.
- *
- * @return
- * possible object is
- * {@link Double }
- *
- */
- public Double getResourceGuaranteedMemory() {
- return resourceGuaranteedMemory;
- }
-
- /**
- * Gets the value of the resourceGuaranteedCpu property.
- *
- * @return
- * possible object is
- * {@link Double }
- *
- */
- public Double getResourceGuaranteedCpu() {
- return resourceGuaranteedCpu;
- }
-
- /**
- * Gets the value of the vCpuInMhz property.
- *
- * @return
- * possible object is
- * {@link Long }
- *
- */
- public Long getVCpuInMhz() {
- return vCpuInMhz;
- }
-
- /**
- * Gets the value of the isThinProvision property.
- *
- * @return
- * possible object is
- * {@link Boolean }
- *
- */
- public Boolean isThinProvision() {
- return isThinProvision;
- }
-
- /**
- * Gets the value of the networkPoolReference property.
- *
- * @return
- * possible object is
- * {@link Reference }
- *
- */
- public Reference getNetworkPoolReference() {
- return networkPoolReference;
- }
-
- /**
- * Gets the value of the providerVdcReference property.
- *
- * @return
- * possible object is
- * {@link Reference }
- *
- */
- public Reference getProviderVdcReference() {
- return providerVdcReference;
- }
-
- /**
- * Gets the value of the usesFastProvisioning property.
- *
- * @return
- * possible object is
- * {@link Boolean }
- *
- */
- public Boolean usesFastProvisioning() {
- return usesFastProvisioning;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o)
- return true;
- if (o == null || getClass() != o.getClass())
- return false;
- AdminVdc that = AdminVdc.class.cast(o);
- return super.equals(that) &&
- equal(resourceGuaranteedMemory, that.resourceGuaranteedMemory) &&
- equal(resourceGuaranteedCpu, that.resourceGuaranteedCpu) &&
- equal(vCpuInMhz, that.vCpuInMhz) &&
- equal(isThinProvision, that.isThinProvision) &&
- equal(networkPoolReference, that.networkPoolReference) &&
- equal(providerVdcReference, that.providerVdcReference) &&
- equal(usesFastProvisioning, that.usesFastProvisioning);
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(super.hashCode(),
- resourceGuaranteedMemory,
- resourceGuaranteedCpu,
- vCpuInMhz,
- isThinProvision,
- networkPoolReference,
- providerVdcReference,
- usesFastProvisioning);
- }
-
- @Override
- public ToStringHelper string() {
- return super.string()
- .add("resourceGuaranteedMemory", resourceGuaranteedMemory)
- .add("resourceGuaranteedCpu", resourceGuaranteedCpu)
- .add("vCpuInMhz", vCpuInMhz)
- .add("isThinProvision", isThinProvision)
- .add("networkPoolReference", networkPoolReference)
- .add("providerVdcReference", providerVdcReference)
- .add("usesFastProvisioning", usesFastProvisioning);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/775b89fd/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Capabilities.java
----------------------------------------------------------------------
diff --git a/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Capabilities.java b/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Capabilities.java
deleted file mode 100644
index 543c4d0..0000000
--- a/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Capabilities.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.vcloud.director.v1_5.domain;
-
-import static com.google.common.base.Objects.equal;
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.Set;
-
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlElementWrapper;
-import javax.xml.bind.annotation.XmlType;
-
-import com.google.common.base.Objects;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Sets;
-
-
-/**
- * Collection of supported hardware capabilities.
- */
-@XmlType(name = "Capabilities", propOrder = {
- "supportedHardwareVersions"
-})
-public class Capabilities {
- public static Builder builder() {
- return new Builder();
- }
-
- public Builder toBuilder() {
- return new Builder().fromCapabilities(this);
- }
-
- public static class Builder {
-
- private Set<String> supportedHardwareVersions = Sets.newLinkedHashSet();
-
- /**
- * @see Capabilities#getSupportedHardwareVersions()
- */
- public Builder supportedHardwareVersions(Set<String> supportedHardwareVersions) {
- this.supportedHardwareVersions = Sets.newLinkedHashSet(checkNotNull(supportedHardwareVersions, "supportedHardwareVersions"));
- return this;
- }
-
- /**
- * @see Capabilities#getSupportedHardwareVersions()
- */
- public Builder supportedHardwareVersion(String supportedHardwareVersion) {
- this.supportedHardwareVersions.add(checkNotNull(supportedHardwareVersion, "supportedHardwareVersion"));
- return this;
- }
-
-
- public Capabilities build() {
- return new Capabilities(supportedHardwareVersions);
- }
-
-
- public Builder fromCapabilities(Capabilities in) {
- return supportedHardwareVersions(Sets.newLinkedHashSet(in.getSupportedHardwareVersions()));
- }
- }
-
- private Capabilities(Set<String> supportedHardwareVersions) {
- this.supportedHardwareVersions = supportedHardwareVersions == null ? Sets.<String>newLinkedHashSet() : ImmutableSet.copyOf(supportedHardwareVersions);
- }
-
- private Capabilities() {
- // For JAXB
- }
-
-
- @XmlElementWrapper(name = "SupportedHardwareVersions")
- @XmlElement(name = "SupportedHardwareVersion")
- protected Set<String> supportedHardwareVersions = Sets.newLinkedHashSet();
-
- /**
- * Gets the value of the supportedHardwareVersions property.
- */
- public Set<String> getSupportedHardwareVersions() {
- return supportedHardwareVersions;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o)
- return true;
- if (o == null || getClass() != o.getClass())
- return false;
- Capabilities that = Capabilities.class.cast(o);
- return equal(supportedHardwareVersions, that.supportedHardwareVersions);
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(supportedHardwareVersions);
- }
-
- @Override
- public String toString() {
- return Objects.toStringHelper("")
- .add("supportedHardwareVersions", supportedHardwareVersions).toString();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/775b89fd/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Capacity.java
----------------------------------------------------------------------
diff --git a/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Capacity.java b/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Capacity.java
deleted file mode 100644
index b466f7b..0000000
--- a/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Capacity.java
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.vcloud.director.v1_5.domain;
-
-import static com.google.common.base.Objects.equal;
-
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlSeeAlso;
-import javax.xml.bind.annotation.XmlType;
-
-import com.google.common.base.Objects;
-
-
-/**
- * Represents a capacity of a given resource.
- */
-@XmlType(name = "Capacity", propOrder = {
- "units",
- "allocated",
- "limit"
-})
-@XmlSeeAlso({
- CapacityWithUsage.class
-})
-public class Capacity<T extends Capacity<T>> {
-
- public static <T extends Capacity<T>> Builder<T> builder() {
- return new Builder<T>();
- }
-
- public Builder<T> toBuilder() {
- return new Builder<T>().fromCapacityType(this);
- }
-
- public static class Builder<T extends Capacity<T>> {
-
- protected String units;
- protected Long allocated;
- protected Long limit;
-
- /**
- * @see Capacity#getUnits()
- */
- public Builder<T> units(String units) {
- this.units = units;
- return this;
- }
-
- /**
- * @see Capacity#getAllocated()
- */
- public Builder<T> allocated(Long allocated) {
- this.allocated = allocated;
- return this;
- }
-
- /**
- * @see Capacity#getLimit()
- */
- public Builder<T> limit(Long limit) {
- this.limit = limit;
- return this;
- }
-
-
- public Capacity<T> build() {
- return new Capacity<T>(units, allocated, limit);
- }
-
-
- public Builder<T> fromCapacityType(Capacity<T> in) {
- return units(in.getUnits())
- .allocated(in.getAllocated())
- .limit(in.getLimit());
- }
- }
-
- protected Capacity(String units, Long allocated, Long limit) {
- this.units = units;
- this.allocated = allocated;
- this.limit = limit;
- }
-
- protected Capacity() {
- // for JAXB
- }
-
- @XmlElement(name = "Units", required = true)
- protected String units;
- @XmlElement(name = "Allocated")
- protected Long allocated;
- @XmlElement(name = "Limit")
- protected Long limit;
-
- /**
- * Gets the value of the units property.
- *
- * @return possible object is
- * {@link String }
- */
- public String getUnits() {
- return units;
- }
-
- /**
- * Gets the value of the allocated property.
- *
- * @return possible object is
- * {@link Long }
- */
- public Long getAllocated() {
- return allocated;
- }
-
- /**
- * Gets the value of the limit property.
- */
- public Long getLimit() {
- return limit;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o)
- return true;
- if (o == null || getClass() != o.getClass())
- return false;
- Capacity<?> that = Capacity.class.cast(o);
- return equal(units, that.units) &&
- equal(allocated, that.allocated) &&
- equal(limit, that.limit);
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(units,
- allocated,
- limit);
- }
-
- @Override
- public String toString() {
- return Objects.toStringHelper("")
- .add("units", units)
- .add("allocated", allocated)
- .add("limit", limit).toString();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/775b89fd/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CapacityWithUsage.java
----------------------------------------------------------------------
diff --git a/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CapacityWithUsage.java b/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CapacityWithUsage.java
deleted file mode 100644
index ea29b1d..0000000
--- a/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CapacityWithUsage.java
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.vcloud.director.v1_5.domain;
-
-import static com.google.common.base.Objects.equal;
-
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlType;
-
-import com.google.common.base.Objects;
-
-
-/**
- * Represents a capacity and usage of a given resource.
- */
-@XmlType(name = "CapacityWithUsage", propOrder = {
- "used",
- "overhead"
-})
-public class CapacityWithUsage extends Capacity<CapacityWithUsage> {
-
- @SuppressWarnings("unchecked")
- public static Builder builder() {
- return new Builder();
- }
-
- @Override
- public Builder toBuilder() {
- return new Builder().fromCapacityWithUsage(this);
- }
-
- public static class Builder extends Capacity.Builder<CapacityWithUsage> {
-
- private Long used;
- private Long overhead;
-
- /**
- * @see CapacityWithUsage#getUsed()
- */
- public Builder used(Long used) {
- this.used = used;
- return this;
- }
-
- /**
- * @see CapacityWithUsage#getOverhead()
- */
- public Builder overhead(Long overhead) {
- this.overhead = overhead;
- return this;
- }
-
-
- @Override
- public CapacityWithUsage build() {
- return new CapacityWithUsage(units, allocated, limit, used, overhead);
- }
-
- /**
- * @see Capacity#getUnits()
- */
- @Override
- public Builder units(String units) {
- this.units = units;
- return this;
- }
-
- /**
- * @see Capacity#getAllocated()
- */
- @Override
- public Builder allocated(Long allocated) {
- this.allocated = allocated;
- return this;
- }
-
- /**
- * @see Capacity#getLimit()
- */
- @Override
- public Builder limit(Long limit) {
- this.limit = limit;
- return this;
- }
-
-
- @Override
- public Builder fromCapacityType(Capacity<CapacityWithUsage> in) {
- return Builder.class.cast(super.fromCapacityType(in));
- }
-
- public Builder fromCapacityWithUsage(CapacityWithUsage in) {
- return fromCapacityType(in)
- .used(in.getUsed())
- .overhead(in.getOverhead());
- }
- }
-
- private CapacityWithUsage(String units, Long allocated, Long limit, Long used, Long overhead) {
- super(units, allocated, limit);
- this.used = used;
- this.overhead = overhead;
- }
-
- private CapacityWithUsage() {
- // for JAXB
- }
-
- @XmlElement(name = "Used")
- protected Long used;
- @XmlElement(name = "Overhead")
- protected Long overhead;
-
- /**
- * Gets the value of the used property.
- *
- * @return possible object is
- * {@link Long }
- */
- public Long getUsed() {
- return used;
- }
-
- /**
- * Gets the value of the overhead property.
- *
- * @return possible object is
- * {@link Long }
- */
- public Long getOverhead() {
- return overhead;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o)
- return true;
- if (o == null || getClass() != o.getClass())
- return false;
- CapacityWithUsage that = CapacityWithUsage.class.cast(o);
- return equal(used, that.used) &&
- equal(overhead, that.overhead);
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(used,
- overhead);
- }
-
- @Override
- public String toString() {
- return Objects.toStringHelper("")
- .add("used", used)
- .add("overhead", overhead).toString();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/775b89fd/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Catalog.java
----------------------------------------------------------------------
diff --git a/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Catalog.java b/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Catalog.java
deleted file mode 100644
index d5c2ab9..0000000
--- a/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Catalog.java
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.vcloud.director.v1_5.domain;
-
-import static com.google.common.base.Objects.equal;
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.Set;
-
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlElementWrapper;
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlSeeAlso;
-import javax.xml.bind.annotation.XmlType;
-
-import com.google.common.base.Objects;
-import com.google.common.base.Objects.ToStringHelper;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Sets;
-
-/**
- * Container for references to {@link VAppTemplate} and {@link Media} objects.
- */
-@XmlSeeAlso({ AdminCatalog.class })
-@XmlRootElement(name = "Catalog")
-@XmlType(name = "CatalogType")
-public class Catalog extends Entity {
-
- public static Builder<?> builder() {
- return new ConcreteBuilder();
- }
-
- @Override
- public Builder<?> toBuilder() {
- return builder().fromCatalogType(this);
- }
-
- private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
- }
-
- public static class Builder<B extends Builder<B>> extends Entity.Builder<B> {
-
- private Owner owner;
- private Set<Reference> catalogItems = Sets.newLinkedHashSet();
- private Boolean isPublished;
-
- /**
- * @see CatalogType#getOwner()
- */
- public B owner(Owner owner) {
- this.owner = owner;
- return self();
- }
-
- /**
- * @see CatalogItems#getCatalogItems()
- */
- public B items(Iterable<Reference> catalogItems) {
- this.catalogItems = Sets.newLinkedHashSet(checkNotNull(catalogItems, "catalogItems"));
- return self();
- }
-
- /**
- * @see CatalogItems#getCatalogItems()
- */
- public B item(Reference catalogItem) {
- this.catalogItems.add(checkNotNull(catalogItem, "catalogItem"));
- return self();
- }
-
- /**
- * @see CatalogType#isPublished()
- */
- public B isPublished(Boolean isPublished) {
- this.isPublished = isPublished;
- return self();
- }
-
- /**
- * @see CatalogType#isPublished()
- */
- public B published() {
- this.isPublished = Boolean.TRUE;
- return self();
- }
-
- @Override
- public Catalog build() {
- return new Catalog(this);
- }
-
- public B fromCatalogType(Catalog in) {
- return fromEntityType(in).owner(in.getOwner()).items(in.getCatalogItems()).isPublished(in.isPublished());
- }
- }
-
- protected Catalog(Builder<?> builder) {
- super(builder);
- this.owner = builder.owner;
- this.catalogItems = builder.catalogItems == null || builder.catalogItems.isEmpty() ? null : ImmutableSet.copyOf(builder.catalogItems);
- this.isPublished = builder.isPublished;
- }
-
- protected Catalog() {
- // For JAXB
- }
-
- @XmlElement(name = "Owner")
- private Owner owner;
- @XmlElementWrapper(name = "CatalogItems")
- @XmlElement(name = "CatalogItem")
- private Set<Reference> catalogItems;
- @XmlElement(name = "IsPublished")
- private Boolean isPublished;
-
- /**
- * Gets the value of the owner property.
- */
- public Owner getOwner() {
- return owner;
- }
-
- /**
- * Gets the value of the catalogItems property.
- */
- public Set<Reference> getCatalogItems() {
- return catalogItems == null ? ImmutableSet.<Reference>of() : ImmutableSet.copyOf(catalogItems);
- }
-
- /**
- * Gets the value of the isPublished property.
- */
- public Boolean isPublished() {
- return isPublished;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o)
- return true;
- if (o == null || getClass() != o.getClass())
- return false;
- Catalog that = Catalog.class.cast(o);
- return super.equals(that) &&
- equal(this.owner, that.owner) &&
- equal(this.getCatalogItems(), that.getCatalogItems()) &&
- equal(this.isPublished, that.isPublished);
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(super.hashCode(), owner, getCatalogItems(), catalogItems);
- }
-
- @Override
- public ToStringHelper string() {
- return super.string().add("owner", owner)
- .add("catalogItems", getCatalogItems())
- .add("isPublished", isPublished);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/775b89fd/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CatalogItem.java
----------------------------------------------------------------------
diff --git a/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CatalogItem.java b/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CatalogItem.java
deleted file mode 100644
index e1d422f..0000000
--- a/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CatalogItem.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.vcloud.director.v1_5.domain;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.Collections;
-import java.util.Set;
-
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlRootElement;
-
-import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
-
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Sets;
-
-/**
- * Contains a reference to a VappTemplate or Media object and related metadata.
- */
-@XmlRootElement(name = "CatalogItem")
-public class CatalogItem extends Entity {
-
- public static final String MEDIA_TYPE = VCloudDirectorMediaType.CATALOG_ITEM;
-
- public static Builder<?> builder() {
- return new ConcreteBuilder();
- }
-
- @Override
- public Builder<?> toBuilder() {
- return builder().fromCatalogItem(this);
- }
-
- private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
- }
-
- public static class Builder<B extends Builder<B>> extends Entity.Builder<B> {
-
- private Reference entity;
- private Set<Property> properties = Sets.newLinkedHashSet();
-
- /**
- * @see CatalogItem#getEntity()
- */
- public B entity(Reference entity) {
- this.entity = entity;
- return self();
- }
-
- /**
- * @see CatalogItem#getProperties()
- */
- public B properties(Set<Property> properties) {
- this.properties = Sets.newLinkedHashSet(checkNotNull(properties, "properties"));
- return self();
- }
-
- /**
- * @see CatalogItem#getProperties()
- */
- public B property(Property property) {
- this.properties.add(checkNotNull(property, "property"));
- return self();
- }
-
- @Override
- public CatalogItem build() {
- return new CatalogItem(this);
- }
-
- public B fromCatalogItem(CatalogItem in) {
- return fromEntityType(in).entity(in.getEntity()).properties(in.getProperties());
- }
- }
-
- protected CatalogItem(Builder<?> builder) {
- super(builder);
- this.entity = builder.entity;
- this.properties = ImmutableSet.copyOf(builder.properties);
- }
-
- protected CatalogItem() {
- // for JAXB
- }
-
- @XmlElement(name = "Entity", required = true)
- private Reference entity;
- @XmlElement(name = "Property")
- private Set<Property> properties = Sets.newLinkedHashSet();
-
- /**
- * A reference to a VappTemplate or Media object.
- */
- public Reference getEntity() {
- return entity;
- }
-
- /**
- * User-specified key/value pair.
- * <p/>
- * This element has been superseded by the {@link Metadata} element, which is the preferred way to specify key/value pairs for objects.
- */
- public Set<Property> getProperties() {
- return Collections.unmodifiableSet(this.properties);
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/775b89fd/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CatalogReference.java
----------------------------------------------------------------------
diff --git a/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CatalogReference.java b/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CatalogReference.java
deleted file mode 100644
index 84d6d53..0000000
--- a/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CatalogReference.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.vcloud.director.v1_5.domain;
-
-import java.net.URI;
-
-import javax.xml.bind.annotation.XmlRootElement;
-
-@XmlRootElement(name = "CatalogReference")
-public class CatalogReference extends Reference {
-
- public static Builder<?> builder() {
- return new ConcreteBuilder();
- }
-
- @Override
- public Builder<?> toBuilder() {
- return builder().fromCatalogReference(this);
- }
-
- private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
- }
-
- public static class Builder<B extends Builder<B>> extends Reference.Builder<B> {
-
- @Override
- public CatalogReference build() {
- return new CatalogReference(this);
- }
-
- protected B fromCatalogReference(CatalogReference in) {
- return fromReference(in);
- }
- }
-
- public CatalogReference(Builder<?> builder) {
- super(builder);
- }
-
- public CatalogReference(URI href, String name, String type) {
- super(href, name, type);
- }
-
- protected CatalogReference() {
- // For JAXB
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o)
- return true;
- if (o == null || getClass() != o.getClass())
- return false;
- CatalogReference that = CatalogReference.class.cast(o);
- return super.equals(that);
- }
-
- // NOTE hashcode inherited from Reference
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/775b89fd/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ComputeCapacity.java
----------------------------------------------------------------------
diff --git a/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ComputeCapacity.java b/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ComputeCapacity.java
deleted file mode 100644
index 9b85e77..0000000
--- a/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ComputeCapacity.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.vcloud.director.v1_5.domain;
-
-import static com.google.common.base.Objects.equal;
-
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlType;
-
-import com.google.common.base.Objects;
-
-
-/**
- * Represents a compute capacity with usage.
- */
-@XmlType(name = "ComputeCapacity", propOrder = {
- "cpu",
- "memory"
-})
-public class ComputeCapacity {
- public static Builder builder() {
- return new Builder();
- }
-
- public Builder toBuilder() {
- return new Builder().fromComputeCapacity(this);
- }
-
- public static class Builder {
-
- private CapacityWithUsage cpu;
- private CapacityWithUsage memory;
-
- /**
- * @see ComputeCapacity#getCpu()
- */
- public Builder cpu(CapacityWithUsage cpu) {
- this.cpu = cpu;
- return this;
- }
-
- /**
- * @see ComputeCapacity#getMemory()
- */
- public Builder memory(CapacityWithUsage memory) {
- this.memory = memory;
- return this;
- }
-
- public ComputeCapacity build() {
- return new ComputeCapacity(cpu, memory);
- }
-
- public Builder fromComputeCapacity(ComputeCapacity in) {
- return cpu(in.getCpu())
- .memory(in.getMemory());
- }
- }
-
- private ComputeCapacity(CapacityWithUsage cpu, CapacityWithUsage memory) {
- this.cpu = cpu;
- this.memory = memory;
- }
-
- private ComputeCapacity() {
- // for JAXB
- }
-
-
- @XmlElement(name = "Cpu", required = true)
- protected CapacityWithUsage cpu;
- @XmlElement(name = "Memory", required = true)
- protected CapacityWithUsage memory;
-
- /**
- * Gets the value of the cpu property.
- *
- * @return possible object is
- * {@link CapacityWithUsage }
- */
- public CapacityWithUsage getCpu() {
- return cpu;
- }
-
- /**
- * Gets the value of the memory property.
- *
- * @return possible object is
- * {@link CapacityWithUsage }
- */
- public CapacityWithUsage getMemory() {
- return memory;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o)
- return true;
- if (o == null || getClass() != o.getClass())
- return false;
- ComputeCapacity that = ComputeCapacity.class.cast(o);
- return equal(cpu, that.cpu) &&
- equal(memory, that.memory);
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(cpu,
- memory);
- }
-
- @Override
- public String toString() {
- return Objects.toStringHelper("")
- .add("cpu", cpu)
- .add("memory", memory).toString();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/775b89fd/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Entity.java
----------------------------------------------------------------------
diff --git a/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Entity.java b/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Entity.java
deleted file mode 100644
index 956dcb2..0000000
--- a/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Entity.java
+++ /dev/null
@@ -1,208 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.vcloud.director.v1_5.domain;
-
-import static com.google.common.base.Objects.equal;
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.List;
-
-import javax.xml.bind.annotation.XmlAttribute;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlElementWrapper;
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlType;
-
-import com.google.common.base.Objects;
-import com.google.common.base.Objects.ToStringHelper;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Lists;
-
-/**
- * Basic entity type in the vCloud object model.
- *
- * Includes the entity name and an optional id, description, and set of running {@link Task}s.
- */
-@XmlRootElement(name = "Entity")
-@XmlType(name = "EntityType")
-public class Entity extends Resource {
-
- public static Builder<?> builder() {
- return new ConcreteBuilder();
- }
-
- @Override
- public Builder<?> toBuilder() {
- return builder().fromEntityType(this);
- }
-
- private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
- }
-
- public abstract static class Builder<B extends Builder<B>> extends Resource.Builder<B> {
-
- private String description;
- private List<Task> tasks = Lists.newArrayList();
- private String name;
- private String id;
-
- /**
- * @see EntityType#getName()
- */
- public B name(String name) {
- this.name = name;
- return self();
- }
-
- /**
- * @see EntityType#getDescription()
- */
- public B description(String description) {
- this.description = description;
- return self();
- }
-
- /**
- * @see EntityType#getId()
- */
- public B id(String id) {
- this.id = id;
- return self();
- }
-
- /**
- * @see EntityType#getTasks()
- */
- public B tasks(Iterable<Task> tasks) {
- this.tasks = Lists.newArrayList(checkNotNull(tasks, "tasks"));
- return self();
- }
-
- /**
- * @see EntityType#getTasks()
- */
- public B task(Task task) {
- this.tasks.add(checkNotNull(task, "task"));
- return self();
- }
-
- @Override
- public Entity build() {
- return new Entity(this);
- }
-
- public B fromEntityType(Entity in) {
- return fromResource(in)
- .description(in.getDescription())
- .tasks(in.getTasks())
- .id(in.getId()).name(in.getName());
- }
- }
-
- @XmlElement(name = "Description")
- private String description;
- @XmlElementWrapper(name = "Tasks")
- @XmlElement(name = "Task")
- private List<Task> tasks;
- @XmlAttribute
- private String id;
- @XmlAttribute(required = true)
- private String name;
-
- protected Entity(Builder<?> builder) {
- super(builder);
- this.description = builder.description;
- this.tasks = builder.tasks == null || builder.tasks.isEmpty() ? null : ImmutableList.copyOf(builder.tasks);
- this.id = builder.id;
- this.name = builder.name;
- }
-
- protected Entity() {
- // For JAXB
- }
-
- /**
- * Optional description.
- */
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- /**
- * A list of queued, running, or recently completed tasks associated with this entity.
- */
- public List<Task> getTasks() {
- return tasks == null ? ImmutableList.<Task>of() : ImmutableList.copyOf(tasks);
- }
-
- /**
- * The resource identifier, expressed in URN format.
- *
- * The value of this attribute uniquely identifies the resource, persists for the life of the
- * resource, and is never reused.
- */
- public String getId() {
- return id;
- }
-
- /**
- * Contains the name of the the entity.
- */
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o)
- return true;
- if (o == null || getClass() != o.getClass())
- return false;
- Entity that = Entity.class.cast(o);
- return super.equals(that) &&
- equal(this.id, that.id) && equal(this.description, that.description) &&
- equal(this.tasks, that.tasks) && equal(this.name, that.name);
- }
-
- @Override
- public boolean clone(Object o) {
- if (this == o)
- return false;
- if (o == null || getClass() != o.getClass())
- return false;
- Entity that = Entity.class.cast(o);
- return super.clone(that);
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(super.hashCode(), description, tasks, id, name);
- }
-
- @Override
- public ToStringHelper string() {
- return super.string().add("description", description).add("tasks", tasks).add("id", id).add("name", name);
- }
-}