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:19:28 UTC
[12/19] jclouds git commit: JCLOUDS-780 Remove vcloud.
http://git-wip-us.apache.org/repos/asf/jclouds/blob/6f974f34/apis/vcloud/src/main/java/org/jclouds/vcloud/features/VmApi.java
----------------------------------------------------------------------
diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/features/VmApi.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/features/VmApi.java
deleted file mode 100644
index 8aa186e..0000000
--- a/apis/vcloud/src/main/java/org/jclouds/vcloud/features/VmApi.java
+++ /dev/null
@@ -1,293 +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.features;
-
-import static org.jclouds.vcloud.VCloudMediaType.DEPLOYVAPPPARAMS_XML;
-import static org.jclouds.vcloud.VCloudMediaType.GUESTCUSTOMIZATIONSECTION_XML;
-import static org.jclouds.vcloud.VCloudMediaType.NETWORKCONNECTIONSECTION_XML;
-import static org.jclouds.vcloud.VCloudMediaType.RASDITEM_XML;
-import static org.jclouds.vcloud.VCloudMediaType.TASK_XML;
-import static org.jclouds.vcloud.VCloudMediaType.UNDEPLOYVAPPPARAMS_XML;
-import static org.jclouds.vcloud.VCloudMediaType.VM_XML;
-
-import java.io.InputStream;
-import java.net.URI;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.Produces;
-
-import org.jclouds.Fallbacks;
-import org.jclouds.rest.annotations.BinderParam;
-import org.jclouds.rest.annotations.EndpointParam;
-import org.jclouds.rest.annotations.Fallback;
-import org.jclouds.rest.annotations.MapBinder;
-import org.jclouds.rest.annotations.PayloadParams;
-import org.jclouds.rest.annotations.RequestFilters;
-import org.jclouds.rest.annotations.XMLResponseParser;
-import org.jclouds.vcloud.binders.BindCPUCountToXmlPayload;
-import org.jclouds.vcloud.binders.BindDeployVAppParamsToXmlPayload;
-import org.jclouds.vcloud.binders.BindGuestCustomizationSectionToXmlPayload;
-import org.jclouds.vcloud.binders.BindMemoryToXmlPayload;
-import org.jclouds.vcloud.binders.BindNetworkConnectionSectionToXmlPayload;
-import org.jclouds.vcloud.binders.BindUndeployVAppParamsToXmlPayload;
-import org.jclouds.vcloud.domain.GuestCustomizationSection;
-import org.jclouds.vcloud.domain.NetworkConnectionSection;
-import org.jclouds.vcloud.domain.Task;
-import org.jclouds.vcloud.domain.Vm;
-import org.jclouds.vcloud.filters.AddVCloudAuthorizationAndCookieToRequest;
-import org.jclouds.vcloud.xml.TaskHandler;
-import org.jclouds.vcloud.xml.VmHandler;
-
-
-/**
- * Provides access to VM functionality in vCloud
- * <p/>
- */
-@RequestFilters(AddVCloudAuthorizationAndCookieToRequest.class)
-public interface VmApi {
-
- @GET
- @Consumes(VM_XML)
- @XMLResponseParser(VmHandler.class)
- @Fallback(Fallbacks.NullOnNotFoundOr404.class)
- Vm getVm(@EndpointParam URI href);
-
- /**
- * To deploy a vApp, the client makes a request to its action/deploy URL. Deploying a vApp
- * automatically deploys all of the virtual machines it contains. To deploy a virtual machine,
- * the client makes a request to its action/deploy URL.
- * <p/>
- * Deploying a Vm implicitly deploys the parent vApp if that vApp is not already deployed.
- */
- @POST
- @Consumes(TASK_XML)
- @Produces(DEPLOYVAPPPARAMS_XML)
- @Path("/action/deploy")
- @MapBinder(BindDeployVAppParamsToXmlPayload.class)
- @XMLResponseParser(TaskHandler.class)
- Task deployVm(@EndpointParam URI href);
-
- /**
- * like {@link #deploy(URI)}, except deploy transitions to power on state
- *
- */
- @POST
- @Consumes(TASK_XML)
- @Produces(DEPLOYVAPPPARAMS_XML)
- @Path("/action/deploy")
- @MapBinder(BindDeployVAppParamsToXmlPayload.class)
- @PayloadParams(keys = "powerOn", values = "true")
- @XMLResponseParser(TaskHandler.class)
- Task deployAndPowerOnVm(@EndpointParam URI href);
-
- /**
- * Undeploying a vApp powers off or suspends any running virtual machines it contains, then frees
- * the resources reserved for the vApp and sets the vApp’s deploy attribute to a value of false
- * to indicate that it is not deployed.
- * <p/>
- * Undeploying a virtual machine powers off or suspends the virtual machine, then frees the
- * resources reserved for it and sets the its deploy attribute to a value of false to indicate
- * that it is not deployed. This operation has no effect on the containing vApp.
- * <h4>NOTE</h4>
- * Using this method will simply power off the vms. In order to save their state, use
- * {@link #undeployAndSaveStateOf}
- *
- */
- @POST
- @Consumes(TASK_XML)
- @Produces(UNDEPLOYVAPPPARAMS_XML)
- @Path("/action/undeploy")
- @MapBinder(BindUndeployVAppParamsToXmlPayload.class)
- @XMLResponseParser(TaskHandler.class)
- Task undeployVm(@EndpointParam URI href);
-
- /**
- * like {@link #undeploy(URI)}, where the undeployed virtual machines are suspended and their
- * suspend state saved
- *
- */
- @POST
- @Consumes(TASK_XML)
- @Produces(UNDEPLOYVAPPPARAMS_XML)
- @Path("/action/undeploy")
- @MapBinder(BindUndeployVAppParamsToXmlPayload.class)
- @PayloadParams(keys = "saveState", values = "true")
- @XMLResponseParser(TaskHandler.class)
- Task undeployAndSaveStateOfVm(@EndpointParam URI href);
-
- /**
- * A powerOn request to a vApp URL powers on all of the virtual machines in the vApp, as
- * specified in the vApp’s StartupSection field.
- * <p/>
- * A powerOn request to a virtual machine URL powers on the specified virtual machine and forces
- * deployment of the parent vApp.
- * <p/>
- * <h4>NOTE</h4> A powerOn request to a vApp or virtual machine that is undeployed forces
- * deployment.
- */
- @POST
- @Consumes(TASK_XML)
- @Path("/power/action/powerOn")
- @XMLResponseParser(TaskHandler.class)
- Task powerOnVm(@EndpointParam URI href);
-
- /**
- * A powerOff request to a vApp URL powers off all of the virtual machines in the vApp, as
- * specified in its StartupSection field.
- * <p/>
- * A powerOff request to a virtual machine URL powers off the specified virtual machine.
- */
- @POST
- @Consumes(TASK_XML)
- @Path("/power/action/powerOff")
- @XMLResponseParser(TaskHandler.class)
- Task powerOffVm(@EndpointParam URI href);
-
- /**
- * A shutdown request to a vApp URL shuts down all of the virtual machines in the vApp, as
- * specified in its StartupSection field.
- * <p/>
- * A shutdown request to a virtual machine URL shuts down the specified virtual machine.
- * <p/>
- * <h4>NOTE</h4Because this request sends a signal to the guest OS, the vCloud API cannot track
- * the progress or verify the result of the requested operation. Hence, void is returned
- */
- @POST
- @Path("/power/action/shutdown")
- void shutdownVm(@EndpointParam URI href);
-
- /**
- * A reset request to a vApp URL resets all of the virtual machines in the vApp, as specified in
- * its StartupSection field.
- * <p/>
- * A reset request to a virtual machine URL resets the specified virtual machine.
- */
- @POST
- @Consumes(TASK_XML)
- @Path("/power/action/reset")
- @XMLResponseParser(TaskHandler.class)
- Task resetVm(@EndpointParam URI href);
-
- /**
- * A reboot request to a vApp URL reboots all of the virtual machines in the vApp, as specified
- * in its StartupSection field.
- * <p/>
- * A reboot request to a virtual machine URL reboots the specified virtual machine.
- * <p/>
- * <h4>NOTE</h4> Because this request sends a signal to the guest OS, the vCloud API cannot track
- * the progress or verify the result of the requested operation. Hence, void is returned
- */
- @POST
- @Path("/power/action/reboot")
- void rebootVm(@EndpointParam URI href);
-
- /**
- * A suspend request to a vApp URL suspends all of the virtual machines in the vApp, as specified
- * in its StartupSection field.
- * <p/>
- * A suspend request to a virtual machine URL suspends the specified virtual machine.
- */
- @POST
- @Consumes(TASK_XML)
- @Path("/power/action/suspend")
- @XMLResponseParser(TaskHandler.class)
- Task suspendVm(@EndpointParam URI href);
-
- /**
- * Get a Screen Thumbnail for a Virtual Machine
- *
- * @param href
- * to snapshot
- */
- @GET
- @Path("/screen")
- @Consumes("image/png")
- @Fallback(Fallbacks.NullOnNotFoundOr404.class)
- InputStream getScreenThumbnailForVm(@EndpointParam URI vm);
-
- /**
- * Modify the Guest Customization Section of a Virtual Machine
- *
- * @param href
- * uri to modify
- * @param updated
- * guestCustomizationSection
- * @return task in progress
- */
- @PUT
- @Consumes(TASK_XML)
- @Produces(GUESTCUSTOMIZATIONSECTION_XML)
- @Path("/guestCustomizationSection")
- @XMLResponseParser(TaskHandler.class)
- Task updateGuestCustomizationOfVm(
- @BinderParam(BindGuestCustomizationSectionToXmlPayload.class) GuestCustomizationSection guestCustomizationSection,
- @EndpointParam URI href);
-
- /**
- * Modify the Network Connection Section of a Virtual Machine
- *
- * @param href
- * uri to modify
- * @param updated
- * networkConnectionSection
- * @return task in progress
- */
- @PUT
- @Consumes(TASK_XML)
- @Produces(NETWORKCONNECTIONSECTION_XML)
- @Path("/networkConnectionSection")
- @XMLResponseParser(TaskHandler.class)
- Task updateNetworkConnectionOfVm(
- @BinderParam(BindNetworkConnectionSectionToXmlPayload.class) NetworkConnectionSection networkConnectionSection,
- @EndpointParam URI href);
-
- /**
- * update the cpuCount of an existing VM
- *
- * @param href
- * to update
- * @param cpuCount
- * count to change the primary cpu to
- */
- @PUT
- @Consumes(TASK_XML)
- @Produces(RASDITEM_XML)
- @Path("/virtualHardwareSection/cpu")
- @XMLResponseParser(TaskHandler.class)
- Task updateCPUCountOfVm(@BinderParam(BindCPUCountToXmlPayload.class) int cpuCount,
- @EndpointParam URI href);
-
- /**
- * update the memoryInMB of an existing VM
- *
- * @param href
- * to update
- * @param memoryInMB
- * memory in MB to assign to the VM
- */
- @PUT
- @Consumes(TASK_XML)
- @Produces(RASDITEM_XML)
- @Path("/virtualHardwareSection/memory")
- @XMLResponseParser(TaskHandler.class)
- Task updateMemoryMBOfVm(@BinderParam(BindMemoryToXmlPayload.class) int memoryInMB,
- @EndpointParam URI href);
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/6f974f34/apis/vcloud/src/main/java/org/jclouds/vcloud/filters/AddVCloudAuthorizationAndCookieToRequest.java
----------------------------------------------------------------------
diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/filters/AddVCloudAuthorizationAndCookieToRequest.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/filters/AddVCloudAuthorizationAndCookieToRequest.java
deleted file mode 100644
index 9d2953f..0000000
--- a/apis/vcloud/src/main/java/org/jclouds/vcloud/filters/AddVCloudAuthorizationAndCookieToRequest.java
+++ /dev/null
@@ -1,52 +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.filters;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import org.jclouds.http.HttpException;
-import org.jclouds.http.HttpRequest;
-import org.jclouds.http.HttpRequestFilter;
-import org.jclouds.vcloud.VCloudToken;
-
-import com.google.common.base.Supplier;
-import com.google.common.collect.ImmutableMultimap;
-import com.google.common.net.HttpHeaders;
-
-/**
- * Adds the VCloud Token to the request as a cookie
- */
-@Singleton
-public class AddVCloudAuthorizationAndCookieToRequest implements HttpRequestFilter {
- private Supplier<String> vcloudTokenProvider;
-
- @Inject
- public AddVCloudAuthorizationAndCookieToRequest(@VCloudToken Supplier<String> authTokenProvider) {
- this.vcloudTokenProvider = authTokenProvider;
- }
-
- @Override
- public HttpRequest filter(HttpRequest request) throws HttpException {
- String token = vcloudTokenProvider.get();
- return request
- .toBuilder()
- .replaceHeaders(
- ImmutableMultimap.of("x-vcloud-authorization", token, HttpHeaders.COOKIE, "vcloud-token="
- + token)).build();
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/6f974f34/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/CatalogItemsInCatalog.java
----------------------------------------------------------------------
diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/CatalogItemsInCatalog.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/CatalogItemsInCatalog.java
deleted file mode 100644
index db18f9e..0000000
--- a/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/CatalogItemsInCatalog.java
+++ /dev/null
@@ -1,61 +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.functions;
-
-import static com.google.common.collect.Iterables.filter;
-import static com.google.common.collect.Iterables.transform;
-
-import javax.annotation.Resource;
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import org.jclouds.logging.Logger;
-import org.jclouds.vcloud.VCloudApi;
-import org.jclouds.vcloud.VCloudMediaType;
-import org.jclouds.vcloud.domain.Catalog;
-import org.jclouds.vcloud.domain.CatalogItem;
-import org.jclouds.vcloud.domain.ReferenceType;
-
-import com.google.common.base.Function;
-import com.google.common.base.Predicate;
-
-@Singleton
-public class CatalogItemsInCatalog implements Function<Catalog, Iterable<CatalogItem>> {
- @Resource
- public Logger logger = Logger.NULL;
-
- private final VCloudApi aclient;
-
- @Inject
- CatalogItemsInCatalog(VCloudApi aclient) {
- this.aclient = aclient;
- }
-
- @Override
- public Iterable<CatalogItem> apply(Catalog from) {
- return transform(filter(from.values(), new Predicate<ReferenceType>() {
- public boolean apply(ReferenceType input) {
- return input.getType().equals(VCloudMediaType.CATALOGITEM_XML);
- }
- }), new Function<ReferenceType, CatalogItem>() {
- public CatalogItem apply(ReferenceType from) {
- return aclient.getCatalogApi().getCatalogItem(from.getHref());
- }
- });
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/6f974f34/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/CatalogItemsInOrg.java
----------------------------------------------------------------------
diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/CatalogItemsInOrg.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/CatalogItemsInOrg.java
deleted file mode 100644
index f6ccf7d..0000000
--- a/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/CatalogItemsInOrg.java
+++ /dev/null
@@ -1,54 +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.functions;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import org.jclouds.vcloud.domain.Catalog;
-import org.jclouds.vcloud.domain.CatalogItem;
-import org.jclouds.vcloud.domain.Org;
-
-import com.google.common.base.Function;
-import com.google.common.collect.Iterables;
-
-@Singleton
-public class CatalogItemsInOrg implements Function<Org, Iterable<CatalogItem>> {
-
- private final Function<Org, Iterable<Catalog>> allCatalogsInOrg;
-
- private final Function<Catalog, Iterable<CatalogItem>> allCatalogItemsInCatalog;
-
- @Inject
- CatalogItemsInOrg(Function<Org, Iterable<Catalog>> allCatalogsInOrg,
- Function<Catalog, Iterable<CatalogItem>> allCatalogItemsInCatalog) {
- this.allCatalogsInOrg = allCatalogsInOrg;
- this.allCatalogItemsInCatalog = allCatalogItemsInCatalog;
- }
-
- @Override
- public Iterable<CatalogItem> apply(Org from) {
- return Iterables.concat(Iterables.transform(allCatalogsInOrg.apply(from),
- new Function<Catalog, Iterable<? extends CatalogItem>>() {
- @Override
- public Iterable<? extends CatalogItem> apply(Catalog from) {
- return allCatalogItemsInCatalog.apply(from);
- }
-
- }));
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/6f974f34/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/CatalogsInOrg.java
----------------------------------------------------------------------
diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/CatalogsInOrg.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/CatalogsInOrg.java
deleted file mode 100644
index 15be6c7..0000000
--- a/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/CatalogsInOrg.java
+++ /dev/null
@@ -1,53 +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.functions;
-
-import static com.google.common.collect.Iterables.transform;
-
-import javax.annotation.Resource;
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import org.jclouds.logging.Logger;
-import org.jclouds.vcloud.VCloudApi;
-import org.jclouds.vcloud.domain.Catalog;
-import org.jclouds.vcloud.domain.Org;
-import org.jclouds.vcloud.domain.ReferenceType;
-
-import com.google.common.base.Function;
-
-@Singleton
-public class CatalogsInOrg implements Function<Org, Iterable<Catalog>> {
- @Resource
- public Logger logger = Logger.NULL;
-
- private final VCloudApi aclient;
-
- @Inject
- CatalogsInOrg(VCloudApi aclient) {
- this.aclient = aclient;
- }
-
- @Override
- public Iterable<Catalog> apply(final Org org) {
- return transform(org.getCatalogs().values(), new Function<ReferenceType, Catalog>() {
- public Catalog apply(ReferenceType from) {
- return aclient.getCatalogApi().getCatalog(from.getHref());
- }
- });
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/6f974f34/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/DefaultNetworkNameInTemplate.java
----------------------------------------------------------------------
diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/DefaultNetworkNameInTemplate.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/DefaultNetworkNameInTemplate.java
deleted file mode 100644
index 11712cc..0000000
--- a/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/DefaultNetworkNameInTemplate.java
+++ /dev/null
@@ -1,47 +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.functions;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.collect.Iterables.get;
-
-import java.util.Set;
-
-import javax.annotation.Resource;
-import javax.inject.Singleton;
-
-import org.jclouds.logging.Logger;
-import org.jclouds.ovf.Network;
-import org.jclouds.vcloud.domain.VAppTemplate;
-
-import com.google.common.base.Function;
-
-@Singleton
-public class DefaultNetworkNameInTemplate implements Function<VAppTemplate, String> {
- @Resource
- protected Logger logger = Logger.NULL;
-
- @Override
- public String apply(VAppTemplate vAppTemplate) {
- checkArgument(vAppTemplate != null, "vAppTemplate was null!");
- Set<Network> networks = vAppTemplate.getNetworkSection().getNetworks();
- checkArgument(!networks.isEmpty(), "no networks found in vAppTemplate %s", vAppTemplate);
- if (networks.size() > 1)
- logger.warn("multiple networks found for %s, choosing first from: %s", vAppTemplate.getName(), networks);
- return get(networks, 0).getName();
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/6f974f34/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/NetworksInOrg.java
----------------------------------------------------------------------
diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/NetworksInOrg.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/NetworksInOrg.java
deleted file mode 100644
index 25c18a1..0000000
--- a/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/NetworksInOrg.java
+++ /dev/null
@@ -1,54 +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.functions;
-
-import static com.google.common.collect.Iterables.transform;
-
-import javax.annotation.Resource;
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import org.jclouds.logging.Logger;
-import org.jclouds.vcloud.VCloudApi;
-import org.jclouds.vcloud.domain.Org;
-import org.jclouds.vcloud.domain.ReferenceType;
-import org.jclouds.vcloud.domain.network.OrgNetwork;
-
-import com.google.common.base.Function;
-
-@Singleton
-public class NetworksInOrg implements Function<Org, Iterable<OrgNetwork>> {
- @Resource
- public Logger logger = Logger.NULL;
-
- private final VCloudApi aclient;
-
- @Inject
- NetworksInOrg(VCloudApi aclient) {
- this.aclient = aclient;
- }
-
- @Override
- public Iterable<OrgNetwork> apply(final Org org) {
- return transform(org.getNetworks().values(), new Function<ReferenceType, OrgNetwork>() {
- public OrgNetwork apply(ReferenceType from) {
- return aclient.getNetworkApi().getNetwork(from.getHref());
- }
- });
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/6f974f34/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/OrgNameToEndpoint.java
----------------------------------------------------------------------
diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/OrgNameToEndpoint.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/OrgNameToEndpoint.java
deleted file mode 100644
index bc762a5..0000000
--- a/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/OrgNameToEndpoint.java
+++ /dev/null
@@ -1,53 +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.functions;
-
-import java.net.URI;
-import java.util.Map;
-import java.util.NoSuchElementException;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import org.jclouds.vcloud.domain.ReferenceType;
-import org.jclouds.vcloud.endpoints.Org;
-
-import com.google.common.base.Function;
-import com.google.common.base.Supplier;
-
-@Singleton
-public class OrgNameToEndpoint implements Function<Object, URI> {
- private final Supplier<Map<String, ReferenceType>> orgNameToEndpointSupplier;
- private final Supplier<ReferenceType> defaultOrg;
-
- @Inject
- public OrgNameToEndpoint(@Org Supplier<Map<String, ReferenceType>> orgNameToEndpointSupplier,
- @Org Supplier<ReferenceType> defaultOrg) {
- this.orgNameToEndpointSupplier = orgNameToEndpointSupplier;
- this.defaultOrg = defaultOrg;
- }
-
- public URI apply(Object from) {
- try {
- Map<String, ReferenceType> orgNameToEndpoint = orgNameToEndpointSupplier.get();
- return from == null ? defaultOrg.get().getHref() : orgNameToEndpoint.get(from).getHref();
- } catch (NullPointerException e) {
- throw new NoSuchElementException("org " + from + " not found in " + orgNameToEndpointSupplier.get().keySet());
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/6f974f34/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/OrgNameToTasksListEndpoint.java
----------------------------------------------------------------------
diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/OrgNameToTasksListEndpoint.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/OrgNameToTasksListEndpoint.java
deleted file mode 100644
index 1d3fc4a..0000000
--- a/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/OrgNameToTasksListEndpoint.java
+++ /dev/null
@@ -1,58 +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.functions;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.net.URI;
-import java.util.Map;
-import java.util.NoSuchElementException;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import org.jclouds.vcloud.domain.Org;
-import org.jclouds.vcloud.domain.ReferenceType;
-import org.jclouds.vcloud.endpoints.TasksList;
-
-import com.google.common.base.Function;
-import com.google.common.base.Supplier;
-
-@Singleton
-public class OrgNameToTasksListEndpoint implements Function<Object, URI> {
- private final Supplier<Map<String, Org>> orgMap;
- private final Supplier<ReferenceType> defaultTasksList;
-
- @Inject
- public OrgNameToTasksListEndpoint(Supplier<Map<String, Org>> orgMap,
- @TasksList Supplier<ReferenceType> defaultTasksList) {
- this.orgMap = orgMap;
- this.defaultTasksList = defaultTasksList;
- }
-
- public URI apply(Object from) {
- Object org = from;
- if (org == null)
- return defaultTasksList.get().getHref();
- try {
- return checkNotNull(orgMap.get().get(org)).getTasksList().getHref();
- } catch (NullPointerException e) {
- throw new NoSuchElementException(org + " not found in " + orgMap.get());
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/6f974f34/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/OrgsForLocations.java
----------------------------------------------------------------------
diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/OrgsForLocations.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/OrgsForLocations.java
deleted file mode 100644
index 72be2f6..0000000
--- a/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/OrgsForLocations.java
+++ /dev/null
@@ -1,70 +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.functions;
-
-import static com.google.common.collect.Iterables.transform;
-
-import java.net.URI;
-
-import javax.annotation.Resource;
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import org.jclouds.domain.Location;
-import org.jclouds.domain.LocationScope;
-import org.jclouds.logging.Logger;
-import org.jclouds.vcloud.VCloudApi;
-import org.jclouds.vcloud.domain.Org;
-
-import com.google.common.base.Function;
-import com.google.common.base.Predicate;
-import com.google.common.collect.FluentIterable;
-
-@Singleton
-public class OrgsForLocations implements Function<Iterable<Location>, Iterable<Org>> {
- @Resource
- public Logger logger = Logger.NULL;
- private final VCloudApi aclient;
-
- @Inject
- OrgsForLocations(VCloudApi aclient) {
- this.aclient = aclient;
- }
-
- /**
- * Zones are assignable, but we want regions. so we look for zones, whose
- * parent is region. then, we use a set to extract the unique set.
- */
- @Override
- public Iterable<Org> apply(Iterable<Location> from) {
- FluentIterable<URI> uris = FluentIterable.from(from).filter(new Predicate<Location>() {
- public boolean apply(Location input) {
- return input.getScope() == LocationScope.ZONE;
- }
- }).transform(new Function<Location, URI>() {
- public URI apply(Location from) {
- return URI.create(from.getParent().getId());
- }
- });
- return transform(uris, new Function<URI, Org>() {
- public Org apply(URI from) {
- return aclient.getOrgApi().getOrg(from);
- }
- });
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/6f974f34/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/OrgsForNames.java
----------------------------------------------------------------------
diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/OrgsForNames.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/OrgsForNames.java
deleted file mode 100644
index ce3cd9e..0000000
--- a/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/OrgsForNames.java
+++ /dev/null
@@ -1,53 +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.functions;
-
-import static com.google.common.collect.Iterables.transform;
-
-import javax.annotation.Resource;
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import org.jclouds.logging.Logger;
-import org.jclouds.vcloud.VCloudApi;
-import org.jclouds.vcloud.domain.Org;
-
-import com.google.common.base.Function;
-import com.google.common.base.Predicates;
-import com.google.common.collect.Iterables;
-
-@Singleton
-public class OrgsForNames implements Function<Iterable<String>, Iterable<Org>> {
- @Resource
- public Logger logger = Logger.NULL;
- private final VCloudApi aclient;
-
- @Inject
- OrgsForNames(VCloudApi aclient) {
- this.aclient = aclient;
- }
-
- @Override
- public Iterable<Org> apply(Iterable<String> from) {
- return Iterables.filter(transform(from, new Function<String, Org>() {
- public Org apply(String from) {
- return aclient.getOrgApi().findOrgNamed(from);
- }
- }), Predicates.notNull());
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/6f974f34/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/ParseLoginResponseFromHeaders.java
----------------------------------------------------------------------
diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/ParseLoginResponseFromHeaders.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/ParseLoginResponseFromHeaders.java
deleted file mode 100644
index d9900fd..0000000
--- a/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/ParseLoginResponseFromHeaders.java
+++ /dev/null
@@ -1,103 +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.functions;
-import static com.google.common.base.Preconditions.checkNotNull;
-import static org.jclouds.http.HttpUtils.releasePayload;
-
-import java.util.Map;
-import java.util.NoSuchElementException;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import javax.inject.Inject;
-import javax.inject.Provider;
-import javax.inject.Singleton;
-
-import org.jclouds.http.HttpResponse;
-import org.jclouds.http.HttpResponseException;
-import org.jclouds.http.functions.ParseSax;
-import org.jclouds.http.functions.ParseSax.Factory;
-import org.jclouds.vcloud.VCloudToken;
-import org.jclouds.vcloud.domain.ReferenceType;
-import org.jclouds.vcloud.domain.VCloudSession;
-import org.jclouds.vcloud.endpoints.Org;
-import org.jclouds.vcloud.xml.OrgListHandler;
-
-import com.google.common.base.Function;
-import com.google.common.base.Predicates;
-import com.google.common.collect.Iterables;
-import com.google.common.net.HttpHeaders;
-
-/**
- * This parses {@link VCloudSession} from HTTP headers.
- */
-@Singleton
-public class ParseLoginResponseFromHeaders implements Function<HttpResponse, VCloudSession> {
- static final Pattern pattern = Pattern.compile("(vcloud-token)=?([^;]+)(;.*)?");
-
- private final ParseSax.Factory factory;
- private final Provider<OrgListHandler> orgHandlerProvider;
-
- @Inject
- private ParseLoginResponseFromHeaders(Factory factory, Provider<OrgListHandler> orgHandlerProvider) {
- this.factory = factory;
- this.orgHandlerProvider = orgHandlerProvider;
- }
-
- /**
- * parses the http response headers to create a new {@link VCloudSession} object.
- */
- public VCloudSession apply(HttpResponse from) {
- try {
- final String token = parseTokenFromHeaders(from);
- final Map<String, ReferenceType> org = factory.create(orgHandlerProvider.get()).parse(
- checkNotNull(from.getPayload().getInput(), "no payload in http response to login request %s", from));
-
- return new VCloudSession() {
- @VCloudToken
- public String getVCloudToken() {
- return token;
- }
-
- @Org
- public Map<String, ReferenceType> getOrgs() {
- return org;
- }
- };
- } finally {
- releasePayload(from);
- }
- }
-
- public String parseTokenFromHeaders(HttpResponse from) {
- String cookieHeader = from.getFirstHeaderOrNull("x-vcloud-authorization");
- if (cookieHeader != null) {
- Matcher matcher = pattern.matcher(cookieHeader);
- return matcher.find() ? matcher.group(2) : cookieHeader;
- } else {
- try {
- cookieHeader = Iterables.find(from.getHeaders().get(HttpHeaders.SET_COOKIE), Predicates.contains(pattern));
- Matcher matcher = pattern.matcher(cookieHeader);
- matcher.find();
- return matcher.group(2);
- } catch (NoSuchElementException e) {
- throw new HttpResponseException(String.format("Header %s or %s must be present", "x-vcloud-authorization",
- HttpHeaders.SET_COOKIE), null, from);
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/6f974f34/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/VAppTemplatesForCatalogItems.java
----------------------------------------------------------------------
diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/VAppTemplatesForCatalogItems.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/VAppTemplatesForCatalogItems.java
deleted file mode 100644
index d3a6a9b..0000000
--- a/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/VAppTemplatesForCatalogItems.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.functions;
-
-import static com.google.common.collect.Iterables.filter;
-import static com.google.common.collect.Iterables.transform;
-
-import javax.annotation.Resource;
-import javax.inject.Inject;
-import javax.inject.Named;
-import javax.inject.Singleton;
-
-import org.jclouds.compute.reference.ComputeServiceConstants;
-import org.jclouds.logging.Logger;
-import org.jclouds.vcloud.VCloudApi;
-import org.jclouds.vcloud.VCloudMediaType;
-import org.jclouds.vcloud.domain.CatalogItem;
-import org.jclouds.vcloud.domain.VAppTemplate;
-
-import com.google.common.base.Function;
-import com.google.common.base.Predicate;
-import com.google.common.base.Predicates;
-
-@Singleton
-public class VAppTemplatesForCatalogItems implements Function<Iterable<CatalogItem>, Iterable<VAppTemplate>> {
- @Resource
- @Named(ComputeServiceConstants.COMPUTE_LOGGER)
- private Logger logger = Logger.NULL;
- private final VCloudApi aclient;
-
- @Inject
- VAppTemplatesForCatalogItems(VCloudApi aclient) {
- this.aclient = aclient;
- }
-
- @Override
- public Iterable<VAppTemplate> apply(Iterable<CatalogItem> from) {
- return filter(transform(filter(from, new Predicate<CatalogItem>() {
- public boolean apply(CatalogItem input) {
- return input.getEntity().getType().equals(VCloudMediaType.VAPPTEMPLATE_XML);
- }
- }), new Function<CatalogItem, VAppTemplate>() {
- public VAppTemplate apply(CatalogItem from) {
- return aclient.getVAppTemplateApi().getVAppTemplate(from.getEntity().getHref());
- }
- }), Predicates.notNull());
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/6f974f34/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/VAppTemplatesInOrg.java
----------------------------------------------------------------------
diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/VAppTemplatesInOrg.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/VAppTemplatesInOrg.java
deleted file mode 100644
index 992c2af..0000000
--- a/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/VAppTemplatesInOrg.java
+++ /dev/null
@@ -1,62 +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.functions;
-
-import static com.google.common.base.Predicates.and;
-import static com.google.common.base.Predicates.notNull;
-import static com.google.common.collect.Iterables.filter;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import org.jclouds.vcloud.domain.CatalogItem;
-import org.jclouds.vcloud.domain.Org;
-import org.jclouds.vcloud.domain.Status;
-import org.jclouds.vcloud.domain.VAppTemplate;
-
-import com.google.common.base.Function;
-import com.google.common.base.Predicate;
-import com.google.common.collect.ImmutableSet;
-
-@Singleton
-public class VAppTemplatesInOrg implements Function<Org, Iterable<VAppTemplate>> {
-
- private final Function<Org, Iterable<CatalogItem>> allCatalogItemsInOrg;
- private final Function<Iterable<CatalogItem>, Iterable<VAppTemplate>> vAppTemplatesForCatalogItems;
-
- @Inject
- VAppTemplatesInOrg(Function<Org, Iterable<CatalogItem>> allCatalogItemsInOrg,
- Function<Iterable<CatalogItem>, Iterable<VAppTemplate>> vAppTemplatesForCatalogItems) {
- this.allCatalogItemsInOrg = allCatalogItemsInOrg;
- this.vAppTemplatesForCatalogItems = vAppTemplatesForCatalogItems;
- }
-
- @Override
- public Iterable<VAppTemplate> apply(Org from) {
- Iterable<CatalogItem> catalogs = allCatalogItemsInOrg.apply(from);
- Iterable<VAppTemplate> vAppTemplates = vAppTemplatesForCatalogItems.apply(catalogs);
- return filter(vAppTemplates, and(notNull(), new Predicate<VAppTemplate>() {
- @Override
- public boolean apply(VAppTemplate input) {
- if (input == null)
- return false;
- return ImmutableSet.of(Status.RESOLVED, Status.OFF).contains(input.getStatus());
- }
- }));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/6f974f34/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/VDCsInOrg.java
----------------------------------------------------------------------
diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/VDCsInOrg.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/VDCsInOrg.java
deleted file mode 100644
index 4457233..0000000
--- a/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/VDCsInOrg.java
+++ /dev/null
@@ -1,54 +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.functions;
-
-import static com.google.common.collect.Iterables.transform;
-
-import javax.annotation.Resource;
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import org.jclouds.logging.Logger;
-import org.jclouds.vcloud.VCloudApi;
-import org.jclouds.vcloud.domain.Org;
-import org.jclouds.vcloud.domain.ReferenceType;
-import org.jclouds.vcloud.domain.VDC;
-
-import com.google.common.base.Function;
-
-@Singleton
-public class VDCsInOrg implements Function<Org, Iterable<VDC>> {
- @Resource
- public Logger logger = Logger.NULL;
-
- private final VCloudApi aclient;
-
- @Inject
- VDCsInOrg(VCloudApi aclient) {
- this.aclient = aclient;
- }
-
- @Override
- public Iterable<VDC> apply(final Org org) {
- return transform(org.getVDCs().values(), new Function<ReferenceType, VDC>() {
- public VDC apply(ReferenceType from) {
- return aclient.getVDCApi().getVDC(from.getHref());
- }
- });
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/6f974f34/apis/vcloud/src/main/java/org/jclouds/vcloud/handlers/ParseVCloudErrorFromHttpResponse.java
----------------------------------------------------------------------
diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/handlers/ParseVCloudErrorFromHttpResponse.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/handlers/ParseVCloudErrorFromHttpResponse.java
deleted file mode 100644
index 2c9f96f..0000000
--- a/apis/vcloud/src/main/java/org/jclouds/vcloud/handlers/ParseVCloudErrorFromHttpResponse.java
+++ /dev/null
@@ -1,118 +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.handlers;
-
-import static org.jclouds.http.HttpUtils.releasePayload;
-
-import java.io.IOException;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import javax.annotation.Resource;
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import org.jclouds.http.HttpCommand;
-import org.jclouds.http.HttpErrorHandler;
-import org.jclouds.http.HttpRequest;
-import org.jclouds.http.HttpResponse;
-import org.jclouds.http.HttpResponseException;
-import org.jclouds.logging.Logger;
-import org.jclouds.rest.AuthorizationException;
-import org.jclouds.rest.ResourceNotFoundException;
-import org.jclouds.util.Strings2;
-import org.jclouds.vcloud.VCloudResponseException;
-import org.jclouds.vcloud.domain.VCloudError;
-import org.jclouds.vcloud.domain.VCloudError.MinorCode;
-import org.jclouds.vcloud.util.VCloudUtils;
-
-/**
- * This will parse and set an appropriate exception on the command object.
- */
-@Singleton
-public class ParseVCloudErrorFromHttpResponse implements HttpErrorHandler {
- @Resource
- protected Logger logger = Logger.NULL;
- public static final Pattern RESOURCE_PATTERN = Pattern.compile(".*/v[^/]+/([^/]+)/([0-9]+)");
- private final VCloudUtils utils;
-
- @Inject
- public ParseVCloudErrorFromHttpResponse(VCloudUtils utils) {
- this.utils = utils;
- }
-
- public void handleError(HttpCommand command, HttpResponse response) {
- HttpRequest request = command.getCurrentRequest();
- Exception exception = new HttpResponseException(command, response);
- try {
- VCloudError error = null;
- String message = null;
- if (response.getPayload() != null) {
- try {
- error = utils.parseErrorFromContent(request, response);
- if (error != null) {
- message = error.getMessage();
- exception = new VCloudResponseException(command, response, error);
- } else {
- message = Strings2.toStringAndClose(response.getPayload().openStream());
- exception = message != null ? new HttpResponseException(command, response, message) : exception;
- }
- } catch (IOException e) {
- } finally {
- response.getPayload().release();
- }
- }
- message = message != null ? message : String.format("%s -> %s", request.getRequestLine(), response
- .getStatusLine());
-
- switch (response.getStatusCode()) {
- case 400:
- if (error != null
- && ((error.getMinorErrorCode() != null && error.getMinorErrorCode() == MinorCode.BUSY_ENTITY)
- || (error.getMessage() != null && error.getMessage().indexOf("is not running") != -1)))
- exception = new IllegalStateException(message, exception);
- else
- exception = new IllegalArgumentException(message, exception);
- break;
- case 401:
- case 403:
- if (error != null
- && ((error.getMinorErrorCode() != null && error.getMinorErrorCode() == MinorCode.ACCESS_TO_RESOURCE_IS_FORBIDDEN)
- || (error.getMessage() != null && error.getMessage().indexOf("No access to entity") != -1)))
- exception = new ResourceNotFoundException(message, exception);
- else
- exception = new AuthorizationException(exception.getMessage(), exception);
- break;
- case 404:
- if (!command.getCurrentRequest().getMethod().equals("DELETE")) {
- String path = command.getCurrentRequest().getEndpoint().getPath();
- Matcher matcher = RESOURCE_PATTERN.matcher(path);
- if (matcher.find()) {
- message = String.format("%s %s not found", matcher.group(1), matcher.group(2));
- } else {
- message = path;
- }
- exception = new ResourceNotFoundException(message);
- }
- break;
- }
- } finally {
- releasePayload(response);
- command.setException(exception);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/6f974f34/apis/vcloud/src/main/java/org/jclouds/vcloud/internal/VCloudLoginApi.java
----------------------------------------------------------------------
diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/internal/VCloudLoginApi.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/internal/VCloudLoginApi.java
deleted file mode 100644
index acf77c5..0000000
--- a/apis/vcloud/src/main/java/org/jclouds/vcloud/internal/VCloudLoginApi.java
+++ /dev/null
@@ -1,44 +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.internal;
-
-import java.io.Closeable;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.POST;
-
-import org.jclouds.http.filters.BasicAuthentication;
-import org.jclouds.rest.annotations.Endpoint;
-import org.jclouds.rest.annotations.RequestFilters;
-import org.jclouds.rest.annotations.ResponseParser;
-import org.jclouds.vcloud.VCloudMediaType;
-import org.jclouds.vcloud.domain.VCloudSession;
-import org.jclouds.vcloud.functions.ParseLoginResponseFromHeaders;
-
-@Endpoint(org.jclouds.vcloud.endpoints.VCloudLogin.class)
-@RequestFilters(BasicAuthentication.class)
-public interface VCloudLoginApi extends Closeable {
-
- /**
- * This request returns a token to use in subsequent requests. After 30 minutes of inactivity,
- * the token expires and you have to request a new token with this call.
- */
- @POST
- @ResponseParser(ParseLoginResponseFromHeaders.class)
- @Consumes(VCloudMediaType.ORGLIST_XML)
- VCloudSession login();
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/6f974f34/apis/vcloud/src/main/java/org/jclouds/vcloud/loaders/OVFLoader.java
----------------------------------------------------------------------
diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/loaders/OVFLoader.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/loaders/OVFLoader.java
deleted file mode 100644
index f004f97..0000000
--- a/apis/vcloud/src/main/java/org/jclouds/vcloud/loaders/OVFLoader.java
+++ /dev/null
@@ -1,47 +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.loaders;
-
-import java.net.URI;
-
-import javax.annotation.Resource;
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import org.jclouds.logging.Logger;
-import org.jclouds.ovf.Envelope;
-import org.jclouds.vcloud.VCloudApi;
-
-import com.google.common.cache.CacheLoader;
-
-@Singleton
-public class OVFLoader extends CacheLoader<URI, Envelope> {
- @Resource
- protected Logger logger = Logger.NULL;
-
- private final VCloudApi client;
-
- @Inject
- OVFLoader(VCloudApi client) {
- this.client = client;
- }
-
- @Override
- public Envelope load(URI template) {
- return client.getVAppTemplateApi().getOvfEnvelopeForVAppTemplate(template);
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/6f974f34/apis/vcloud/src/main/java/org/jclouds/vcloud/loaders/VAppTemplateLoader.java
----------------------------------------------------------------------
diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/loaders/VAppTemplateLoader.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/loaders/VAppTemplateLoader.java
deleted file mode 100644
index ee707db..0000000
--- a/apis/vcloud/src/main/java/org/jclouds/vcloud/loaders/VAppTemplateLoader.java
+++ /dev/null
@@ -1,47 +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.loaders;
-
-import java.net.URI;
-
-import javax.annotation.Resource;
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import org.jclouds.logging.Logger;
-import org.jclouds.vcloud.VCloudApi;
-import org.jclouds.vcloud.domain.VAppTemplate;
-
-import com.google.common.cache.CacheLoader;
-
-@Singleton
-public class VAppTemplateLoader extends CacheLoader<URI, VAppTemplate> {
- @Resource
- protected Logger logger = Logger.NULL;
-
- private final VCloudApi client;
-
- @Inject
- VAppTemplateLoader(VCloudApi client) {
- this.client = client;
- }
-
- @Override
- public VAppTemplate load(URI template) {
- return client.getVAppTemplateApi().getVAppTemplate(template);
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/6f974f34/apis/vcloud/src/main/java/org/jclouds/vcloud/location/DefaultVDC.java
----------------------------------------------------------------------
diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/location/DefaultVDC.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/location/DefaultVDC.java
deleted file mode 100644
index 38fb340..0000000
--- a/apis/vcloud/src/main/java/org/jclouds/vcloud/location/DefaultVDC.java
+++ /dev/null
@@ -1,74 +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.location;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.collect.Iterables.find;
-
-import java.util.Set;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import org.jclouds.collect.Memoized;
-import org.jclouds.domain.Location;
-import org.jclouds.domain.LocationScope;
-import org.jclouds.location.suppliers.ImplicitLocationSupplier;
-import org.jclouds.vcloud.domain.ReferenceType;
-import org.jclouds.vcloud.endpoints.VDC;
-
-import com.google.common.base.Predicate;
-import com.google.common.base.Supplier;
-
-@Singleton
-public class DefaultVDC implements ImplicitLocationSupplier {
- private final Supplier<Set<? extends Location>> locationsSupplier;
- private final IsDefaultVDC isDefaultVDC;
-
- @Inject
- DefaultVDC(@Memoized Supplier<Set<? extends Location>> locationsSupplier, IsDefaultVDC isDefaultVDC) {
- this.locationsSupplier = checkNotNull(locationsSupplier, "locationsSupplierSupplier");
- this.isDefaultVDC = checkNotNull(isDefaultVDC, "isDefaultVDC");
- }
-
- @Override
- public Location get() {
- return find(locationsSupplier.get(), isDefaultVDC);
- }
-
-
- @Singleton
- public static class IsDefaultVDC implements Predicate<Location> {
- private final Supplier<ReferenceType> defaultVDCSupplier;
-
- @Inject
- IsDefaultVDC(@VDC Supplier<ReferenceType> defaultVDCSupplier) {
- this.defaultVDCSupplier = checkNotNull(defaultVDCSupplier, "defaultVDCSupplier");
- }
-
- @Override
- public boolean apply(Location input) {
- ReferenceType defaultVDC = defaultVDCSupplier.get();
- return input.getScope() == LocationScope.ZONE && input.getId().equals(defaultVDC.getHref().toASCIIString());
- }
-
- @Override
- public String toString() {
- return "isDefaultVDC()";
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/6f974f34/apis/vcloud/src/main/java/org/jclouds/vcloud/location/OrgAndVDCToLocationSupplier.java
----------------------------------------------------------------------
diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/location/OrgAndVDCToLocationSupplier.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/location/OrgAndVDCToLocationSupplier.java
deleted file mode 100644
index a0c1505..0000000
--- a/apis/vcloud/src/main/java/org/jclouds/vcloud/location/OrgAndVDCToLocationSupplier.java
+++ /dev/null
@@ -1,90 +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.location;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.net.URI;
-import java.util.Map;
-import java.util.Set;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import org.jclouds.domain.Location;
-import org.jclouds.domain.LocationBuilder;
-import org.jclouds.domain.LocationScope;
-import org.jclouds.location.Iso3166;
-import org.jclouds.location.Provider;
-import org.jclouds.location.suppliers.LocationsSupplier;
-import org.jclouds.location.suppliers.all.JustProvider;
-import org.jclouds.vcloud.domain.Org;
-import org.jclouds.vcloud.domain.ReferenceType;
-
-import com.google.common.base.Supplier;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.ImmutableSet.Builder;
-import com.google.common.collect.Iterables;
-
-@Singleton
-public class OrgAndVDCToLocationSupplier extends JustProvider implements LocationsSupplier {
-
- private final Supplier<Map<String, ReferenceType>> orgNameToResource;
- private final Supplier<Map<String, Org>> orgNameToVDCResource;
- private final Supplier<Map<String, Supplier<Set<String>>>> isoCodesByIdSupplier;
-
- @Inject
- OrgAndVDCToLocationSupplier(@Iso3166 Set<String> isoCodes, @Provider String providerName,
- @Provider Supplier<URI> endpoint,
- @org.jclouds.vcloud.endpoints.Org Supplier<Map<String, ReferenceType>> orgNameToResource,
- Supplier<Map<String, Org>> orgNameToVDCResource,
- @Iso3166 Supplier<Map<String, Supplier<Set<String>>>> isoCodesByIdSupplier) {
- super(providerName, endpoint, isoCodes);
- this.orgNameToResource = checkNotNull(orgNameToResource, "orgNameToResource");
- this.orgNameToVDCResource = checkNotNull(orgNameToVDCResource, "orgNameToVDCResource");
- this.isoCodesByIdSupplier = checkNotNull(isoCodesByIdSupplier, "isoCodesByIdSupplier");
- }
-
- @Override
- public Set<Location> get() {
- return buildJustProviderOrVDCs().build();
- }
-
- protected Builder<Location> buildJustProviderOrVDCs() {
- Builder<Location> locations = ImmutableSet.builder();
- Location provider = Iterables.getOnlyElement(super.get());
- if (orgNameToResource.get().isEmpty())
- return locations.add(provider);
- Map<String, Supplier<Set<String>>> isoCodesById = isoCodesByIdSupplier.get();
- for (ReferenceType org : orgNameToResource.get().values()) {
- LocationBuilder builder = new LocationBuilder().scope(LocationScope.REGION).id(org.getHref().toASCIIString())
- .description(org.getName()).parent(provider);
- if (isoCodesById.containsKey(org.getHref().toASCIIString()))
- builder.iso3166Codes(isoCodesById.get(org.getHref().toASCIIString()).get());
- Location orgL = builder.build();
- for (ReferenceType vdc : orgNameToVDCResource.get().get(org.getName()).getVDCs().values()) {
- builder = new LocationBuilder().scope(LocationScope.ZONE).id(vdc.getHref().toASCIIString()).description(
- vdc.getName()).parent(orgL);
- if (isoCodesById.containsKey(vdc.getHref().toASCIIString()))
- builder.iso3166Codes(isoCodesById.get(vdc.getHref().toASCIIString()).get());
- locations.add(builder.build());
- }
- }
- return locations;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/6f974f34/apis/vcloud/src/main/java/org/jclouds/vcloud/options/CaptureVAppOptions.java
----------------------------------------------------------------------
diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/options/CaptureVAppOptions.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/options/CaptureVAppOptions.java
deleted file mode 100644
index 89580fd..0000000
--- a/apis/vcloud/src/main/java/org/jclouds/vcloud/options/CaptureVAppOptions.java
+++ /dev/null
@@ -1,46 +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.options;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-public class CaptureVAppOptions {
-
- private String description;
-
- public CaptureVAppOptions withDescription(String description) {
- checkNotNull(description, "description");
- this.description = description;
- return this;
- }
-
- public String getDescription() {
- return description;
- }
-
- public static class Builder {
-
- /**
- * @see CaptureVAppOptions#withDescription(String)
- */
- public static CaptureVAppOptions withDescription(String description) {
- CaptureVAppOptions options = new CaptureVAppOptions();
- return options.withDescription(description);
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/6f974f34/apis/vcloud/src/main/java/org/jclouds/vcloud/options/CatalogItemOptions.java
----------------------------------------------------------------------
diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/options/CatalogItemOptions.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/options/CatalogItemOptions.java
deleted file mode 100644
index 6512031..0000000
--- a/apis/vcloud/src/main/java/org/jclouds/vcloud/options/CatalogItemOptions.java
+++ /dev/null
@@ -1,72 +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.options;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.Map;
-
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Maps;
-
-public class CatalogItemOptions {
-
- private String description;
- private Map<String, String> properties = Maps.newLinkedHashMap();
-
- /**
- * optional description for the CatalogItem
- */
- public CatalogItemOptions description(String description) {
- this.description = checkNotNull(description, "description");
- return this;
- }
-
- /**
- * optional properties for the CatalogItem
- */
- public CatalogItemOptions properties(Map<String, String> properties) {
- this.properties = ImmutableMap.copyOf(checkNotNull(properties, "properties"));
- return this;
- }
-
- public String getDescription() {
- return description;
- }
-
- public Map<String, String> getProperties() {
- return properties;
- }
-
- public static class Builder {
-
- /**
- * @see CatalogItemOptions#description
- */
- public static CatalogItemOptions description(String description) {
- return new CatalogItemOptions().description(description);
- }
-
- /**
- * @see CatalogItemOptions#properties
- */
- public static CatalogItemOptions properties(Map<String, String> properties) {
- return new CatalogItemOptions().properties(properties);
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/6f974f34/apis/vcloud/src/main/java/org/jclouds/vcloud/options/CloneOptions.java
----------------------------------------------------------------------
diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/options/CloneOptions.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/options/CloneOptions.java
deleted file mode 100644
index e3f5eea..0000000
--- a/apis/vcloud/src/main/java/org/jclouds/vcloud/options/CloneOptions.java
+++ /dev/null
@@ -1,48 +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.options;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-public class CloneOptions {
-
- private String description;
-
- /**
- * the clone should be powered on after it is deployed
- */
- public CloneOptions description(String description) {
- checkNotNull(description, "description");
- this.description = description;
- return this;
- }
-
- public String getDescription() {
- return description;
- }
-
- public static class Builder {
-
- /**
- * @see CloneOptions#description(String)
- */
- public static CloneOptions description(String description) {
- return new CloneOptions().description(description);
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/6f974f34/apis/vcloud/src/main/java/org/jclouds/vcloud/options/CloneVAppOptions.java
----------------------------------------------------------------------
diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/options/CloneVAppOptions.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/options/CloneVAppOptions.java
deleted file mode 100644
index 23793ef..0000000
--- a/apis/vcloud/src/main/java/org/jclouds/vcloud/options/CloneVAppOptions.java
+++ /dev/null
@@ -1,80 +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.options;
-
-import static com.google.common.base.Preconditions.checkState;
-
-public class CloneVAppOptions extends CloneOptions {
-
- private boolean deploy;
- private boolean powerOn;
-
- /**
- * the clone should be deployed after it is created
- */
- public CloneVAppOptions deploy() {
- this.deploy = true;
- return this;
- }
-
- /**
- * the clone should be powered on after it is deployed
- */
- public CloneVAppOptions powerOn() {
- checkState(deploy, "must set deploy before setting powerOn");
- powerOn = true;
- return this;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public CloneVAppOptions description(String description) {
- return CloneVAppOptions.class.cast(super.description(description));
- }
-
- public boolean isDeploy() {
- return deploy;
- }
-
- public boolean isPowerOn() {
- return powerOn;
- }
-
- public static class Builder {
-
- /**
- * @see CloneVAppOptions#deploy()
- */
- public static CloneVAppOptions deploy() {
- return new CloneVAppOptions().deploy();
- }
-
- /**
- * @see CloneVAppOptions#powerOn()
- */
- public static CloneVAppOptions powerOn() {
- return new CloneVAppOptions().powerOn();
- }
-
- public static CloneVAppOptions description(String description) {
- return new CloneVAppOptions().description(description);
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/6f974f34/apis/vcloud/src/main/java/org/jclouds/vcloud/options/CloneVAppTemplateOptions.java
----------------------------------------------------------------------
diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/options/CloneVAppTemplateOptions.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/options/CloneVAppTemplateOptions.java
deleted file mode 100644
index d0332ea..0000000
--- a/apis/vcloud/src/main/java/org/jclouds/vcloud/options/CloneVAppTemplateOptions.java
+++ /dev/null
@@ -1,34 +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.options;
-
-public class CloneVAppTemplateOptions extends CloneOptions {
- /**
- * {@inheritDoc}
- */
- @Override
- public CloneVAppTemplateOptions description(String description) {
- return CloneVAppTemplateOptions.class.cast(super.description(description));
- }
-
- public static class Builder {
- public static CloneVAppTemplateOptions description(String description) {
- return new CloneVAppTemplateOptions().description(description);
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/6f974f34/apis/vcloud/src/main/java/org/jclouds/vcloud/options/InstantiateVAppTemplateOptions.java
----------------------------------------------------------------------
diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/options/InstantiateVAppTemplateOptions.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/options/InstantiateVAppTemplateOptions.java
deleted file mode 100644
index 7f6c2c1..0000000
--- a/apis/vcloud/src/main/java/org/jclouds/vcloud/options/InstantiateVAppTemplateOptions.java
+++ /dev/null
@@ -1,173 +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.options;
-
-import static com.google.common.base.Objects.equal;
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.Set;
-
-import org.jclouds.vcloud.domain.network.NetworkConfig;
-
-import com.google.common.base.Objects;
-import com.google.common.base.Objects.ToStringHelper;
-import com.google.common.collect.Sets;
-
-public class InstantiateVAppTemplateOptions {
- private Set<NetworkConfig> networkConfig = Sets.newLinkedHashSet();
-
- private Boolean customizeOnInstantiate;
- private String description = null;
- private boolean deploy = true;
- private boolean powerOn = true;
-
- public String getDescription() {
- return description;
- }
-
- public boolean shouldDeploy() {
- return deploy;
- }
-
- public boolean shouldPowerOn() {
- return powerOn;
- }
-
- /**
- * Optional description. Used for the Description of the vApp created by this
- * instantiation.
- */
- public InstantiateVAppTemplateOptions description(String description) {
- this.description = description;
- return this;
- }
-
- /**
- * deploy the vapp after it is instantiated?
- */
- public InstantiateVAppTemplateOptions deploy(boolean deploy) {
- this.deploy = deploy;
- return this;
- }
-
- /**
- * powerOn the vapp after it is instantiated?
- */
- public InstantiateVAppTemplateOptions powerOn(boolean powerOn) {
- this.powerOn = powerOn;
- return this;
- }
-
- /**
- * {@networkConfig VAppTemplate}s have internal networks that can be
- * connected in order to access the internet or other external networks.
- *
- * <h4>default behaviour if you don't use this option</h4> By default, we
- * connect the first internal {@networkConfig
- * org.jclouds.vcloud.domain.VAppTemplate#getNetworkSection network in the
- * vapp template}to a default chosen from the org or specified via
- * {@networkConfig
- * org.jclouds.vcloud.reference.VCloudConstants#
- * PROPERTY_VCLOUD_DEFAULT_NETWORK} using the {@networkConfig
- * org.jclouds.vcloud.domain.FenceMode#BRIDGED} or an
- * override set by the property {@networkConfig
- * org.jclouds.vcloud.reference.VCloudConstants#
- * PROPERTY_VCLOUD_DEFAULT_FENCEMODE}.
- */
- public InstantiateVAppTemplateOptions addNetworkConfig(NetworkConfig networkConfig) {
- this.networkConfig.add(checkNotNull(networkConfig, "networkConfig"));
- return this;
- }
-
- public Set<NetworkConfig> getNetworkConfig() {
- return networkConfig;
- }
-
- public static class Builder {
-
- /**
- * @see InstantiateVAppTemplateOptions#description
- */
- public static InstantiateVAppTemplateOptions description(String description) {
- InstantiateVAppTemplateOptions options = new InstantiateVAppTemplateOptions();
- return options.description(description);
- }
-
- /**
- * @see InstantiateVAppTemplateOptions#deploy
- */
- public static InstantiateVAppTemplateOptions deploy(boolean deploy) {
- InstantiateVAppTemplateOptions options = new InstantiateVAppTemplateOptions();
- return options.deploy(deploy);
- }
-
- /**
- * @see InstantiateVAppTemplateOptions#powerOn
- */
- public static InstantiateVAppTemplateOptions powerOn(boolean powerOn) {
- InstantiateVAppTemplateOptions options = new InstantiateVAppTemplateOptions();
- return options.powerOn(powerOn);
- }
-
- /**
- * @see InstantiateVAppTemplateOptions#addNetworkConfig
- */
- public static InstantiateVAppTemplateOptions addNetworkConfig(NetworkConfig networkConfig) {
- InstantiateVAppTemplateOptions options = new InstantiateVAppTemplateOptions();
- return options.addNetworkConfig(networkConfig);
- }
-
- }
-
- @Override
- public boolean equals(Object object) {
- if (this == object) {
- return true;
- }
- if (object instanceof InstantiateVAppTemplateOptions) {
- final InstantiateVAppTemplateOptions other = InstantiateVAppTemplateOptions.class.cast(object);
- return equal(networkConfig, other.networkConfig)
- && equal(customizeOnInstantiate, other.customizeOnInstantiate) && equal(description, other.description)
- && equal(deploy, other.deploy) && equal(powerOn, other.powerOn);
- } else {
- return false;
- }
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(networkConfig, customizeOnInstantiate, description, deploy, powerOn);
- }
-
- @Override
- public String toString() {
- return string().toString();
- }
-
- protected ToStringHelper string() {
- ToStringHelper toString = Objects.toStringHelper("").omitNullValues();
- toString.add("customizeOnInstantiate", customizeOnInstantiate).add("description", description);
- if (!networkConfig.isEmpty())
- toString.add("networkConfig", networkConfig);
- if (!deploy)
- toString.add("deploy", deploy);
- if (!powerOn)
- toString.add("powerOn", powerOn);
- return toString;
- }
-
-}