You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by ra...@apache.org on 2015/08/21 09:09:24 UTC
[11/52] [abbrv] [partial] stratos git commit: Merging jclouds GCE fix
with upstream - resolving conflicts
http://git-wip-us.apache.org/repos/asf/stratos/blob/897edde8/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/features/VAppApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/features/VAppApi.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/features/VAppApi.java
deleted file mode 100644
index af44c3e..0000000
--- a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/features/VAppApi.java
+++ /dev/null
@@ -1,260 +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.TASK_XML;
-import static org.jclouds.vcloud.VCloudMediaType.UNDEPLOYVAPPPARAMS_XML;
-import static org.jclouds.vcloud.VCloudMediaType.VAPP_XML;
-
-import java.net.URI;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.DELETE;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.Produces;
-
-import org.jclouds.Fallbacks;
-import org.jclouds.javax.annotation.Nullable;
-import org.jclouds.predicates.validators.DnsNameValidator;
-import org.jclouds.rest.annotations.EndpointParam;
-import org.jclouds.rest.annotations.Fallback;
-import org.jclouds.rest.annotations.MapBinder;
-import org.jclouds.rest.annotations.ParamValidators;
-import org.jclouds.rest.annotations.PayloadParam;
-import org.jclouds.rest.annotations.PayloadParams;
-import org.jclouds.rest.annotations.RequestFilters;
-import org.jclouds.rest.annotations.XMLResponseParser;
-import org.jclouds.vcloud.binders.BindCloneVAppParamsToXmlPayload;
-import org.jclouds.vcloud.binders.BindDeployVAppParamsToXmlPayload;
-import org.jclouds.vcloud.binders.BindUndeployVAppParamsToXmlPayload;
-import org.jclouds.vcloud.binders.OrgNameVDCNameResourceEntityNameToEndpoint;
-import org.jclouds.vcloud.domain.Task;
-import org.jclouds.vcloud.domain.VApp;
-import org.jclouds.vcloud.filters.AddVCloudAuthorizationAndCookieToRequest;
-import org.jclouds.vcloud.options.CloneVAppOptions;
-import org.jclouds.vcloud.xml.TaskHandler;
-import org.jclouds.vcloud.xml.VAppHandler;
-
-
-/**
- * Provides access to VApp functionality in vCloud
- * <p/>
- *
- * @see <a href="http://communities.vmware.com/community/developer/forums/vcloudapi" />
- */
-@RequestFilters(AddVCloudAuthorizationAndCookieToRequest.class)
-public interface VAppApi {
- @GET
- @Consumes(VAPP_XML)
- @XMLResponseParser(VAppHandler.class)
- @Fallback(Fallbacks.NullOnNotFoundOr404.class)
- @MapBinder(OrgNameVDCNameResourceEntityNameToEndpoint.class)
- VApp findVAppInOrgVDCNamed(@Nullable @PayloadParam("orgName") String orgName,
- @Nullable @PayloadParam("vdcName") String vdcName, @PayloadParam("resourceName") String vAppName);
-
- @POST
- @Path("/action/cloneVApp")
- @Produces("application/vnd.vmware.vcloud.cloneVAppParams+xml")
- @Consumes(TASK_XML)
- @XMLResponseParser(TaskHandler.class)
- @MapBinder(BindCloneVAppParamsToXmlPayload.class)
- Task copyVAppToVDCAndName(@PayloadParam("Source") URI sourceVApp,
- @EndpointParam URI vdc, @PayloadParam("name") @ParamValidators(DnsNameValidator.class) String newName,
- CloneVAppOptions... options);
-
- @POST
- @Path("/action/cloneVApp")
- @Produces("application/vnd.vmware.vcloud.cloneVAppParams+xml")
- @Consumes(TASK_XML)
- @XMLResponseParser(TaskHandler.class)
- @PayloadParams(keys = "IsSourceDelete", values = "true")
- @MapBinder(BindCloneVAppParamsToXmlPayload.class)
- Task moveVAppToVDCAndRename(@PayloadParam("Source") URI sourceVApp,
- @EndpointParam URI vdc, @PayloadParam("name") @ParamValidators(DnsNameValidator.class) String newName,
- CloneVAppOptions... options);
-
- @GET
- @Consumes(VAPP_XML)
- @XMLResponseParser(VAppHandler.class)
- @Fallback(Fallbacks.NullOnNotFoundOr404.class)
- VApp getVApp(@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 deployVApp(@EndpointParam URI href);
-
- /**
- * like {@link #deployVApp(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 deployAndPowerOnVApp(@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 undeployVApp(@EndpointParam URI href);
-
- /**
- * like {@link #undeployVApp(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 undeployAndSaveStateOfVApp(@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 powerOnVApp(@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 powerOffVApp(@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 shutdownVApp(@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 resetVApp(@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 rebootVApp(@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 suspendVApp(@EndpointParam URI href);
-
- /**
- * delete a vAppTemplate, vApp, or media image. You cannot delete an object if it is in use. Any
- * object that is being copied or moved is in use. Other criteria that determine whether an
- * object is in use depend on the object type.
- * <ul>
- * <li>A vApptemplate is in use if it is being instantiated. After instantiation is complete, the
- * template is no longer in use.</li>
- * <li>A vApp is in use if it is deployed.</li>
- * <li>A media image is in use if it is inserted in a Vm.</li>
- * </ul>
- *
- * @param href
- * href of the vApp
- * @return task of the operation in progress
- */
- @DELETE
- @Consumes(TASK_XML)
- @Fallback(Fallbacks.VoidOnNotFoundOr404.class)
- @XMLResponseParser(TaskHandler.class)
- Task deleteVApp(@EndpointParam URI href);
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/897edde8/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/features/VAppTemplateApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/features/VAppTemplateApi.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/features/VAppTemplateApi.java
deleted file mode 100644
index 8f4aa29..0000000
--- a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/features/VAppTemplateApi.java
+++ /dev/null
@@ -1,179 +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.TASK_XML;
-import static org.jclouds.vcloud.VCloudMediaType.VAPPTEMPLATE_XML;
-import static org.jclouds.vcloud.VCloudMediaType.VAPP_XML;
-
-import java.net.URI;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.DELETE;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.Fallbacks;
-import org.jclouds.javax.annotation.Nullable;
-import org.jclouds.ovf.Envelope;
-import org.jclouds.ovf.xml.EnvelopeHandler;
-import org.jclouds.predicates.validators.DnsNameValidator;
-import org.jclouds.rest.annotations.EndpointParam;
-import org.jclouds.rest.annotations.Fallback;
-import org.jclouds.rest.annotations.MapBinder;
-import org.jclouds.rest.annotations.ParamValidators;
-import org.jclouds.rest.annotations.PayloadParam;
-import org.jclouds.rest.annotations.PayloadParams;
-import org.jclouds.rest.annotations.RequestFilters;
-import org.jclouds.rest.annotations.XMLResponseParser;
-import org.jclouds.vcloud.binders.BindCaptureVAppParamsToXmlPayload;
-import org.jclouds.vcloud.binders.BindCloneVAppTemplateParamsToXmlPayload;
-import org.jclouds.vcloud.binders.BindInstantiateVAppTemplateParamsToXmlPayload;
-import org.jclouds.vcloud.binders.OrgNameCatalogNameVAppTemplateNameToEndpoint;
-import org.jclouds.vcloud.domain.Task;
-import org.jclouds.vcloud.domain.VApp;
-import org.jclouds.vcloud.domain.VAppTemplate;
-import org.jclouds.vcloud.filters.AddVCloudAuthorizationAndCookieToRequest;
-import org.jclouds.vcloud.options.CaptureVAppOptions;
-import org.jclouds.vcloud.options.CloneVAppTemplateOptions;
-import org.jclouds.vcloud.options.InstantiateVAppTemplateOptions;
-import org.jclouds.vcloud.xml.TaskHandler;
-import org.jclouds.vcloud.xml.VAppHandler;
-import org.jclouds.vcloud.xml.VAppTemplateHandler;
-
-
-/**
- * Provides access to VApp Template functionality in vCloud
- * <p/>
- *
- * @see <a href="http://communities.vmware.com/community/developer/forums/vcloudapi" />
- */
-@RequestFilters(AddVCloudAuthorizationAndCookieToRequest.class)
-public interface VAppTemplateApi {
- /**
- * returns the vapp template corresponding to a catalog item in the catalog associated with the
- * specified name. Note that the org and catalog parameters can be null to choose default.
- *
- * @param orgName
- * organization name, or null for the default
- * @param catalogName
- * catalog name, or null for the default
- * @param itemName
- * item you wish to lookup
- *
- * @throws NoSuchElementException
- * if you specified an org, catalog, or catalog item name that isn't present
- */
- @GET
- @Consumes(VAPPTEMPLATE_XML)
- @XMLResponseParser(VAppTemplateHandler.class)
- @Fallback(Fallbacks.NullOnNotFoundOr404.class)
- @MapBinder(OrgNameCatalogNameVAppTemplateNameToEndpoint.class)
- VAppTemplate findVAppTemplateInOrgCatalogNamed(@Nullable @PayloadParam("orgName") String orgName,
- @Nullable @PayloadParam("catalogName") String catalogName,
- @PayloadParam("itemName") String itemName);
-
- /**
- */
- @POST
- @Path("/action/instantiateVAppTemplate")
- @Produces("application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml")
- @Consumes(VAPP_XML)
- @XMLResponseParser(VAppHandler.class)
- @MapBinder(BindInstantiateVAppTemplateParamsToXmlPayload.class)
- VApp createVAppInVDCByInstantiatingTemplate(
- @PayloadParam("name") @ParamValidators(DnsNameValidator.class) String appName, @EndpointParam URI vdc,
- @PayloadParam("template") URI template, InstantiateVAppTemplateOptions... options);
-
- @POST
- @Path("/action/cloneVAppTemplate")
- @Produces("application/vnd.vmware.vcloud.cloneVAppTemplateParams+xml")
- @Consumes(TASK_XML)
- @XMLResponseParser(TaskHandler.class)
- @MapBinder(BindCloneVAppTemplateParamsToXmlPayload.class)
- Task copyVAppTemplateToVDCAndName(@PayloadParam("Source") URI sourceVAppTemplate,
- @EndpointParam URI vdc, @PayloadParam("name") @ParamValidators(DnsNameValidator.class) String newName,
- CloneVAppTemplateOptions... options);
-
- @POST
- @Path("/action/cloneVAppTemplate")
- @Produces("application/vnd.vmware.vcloud.cloneVAppTemplateParams+xml")
- @Consumes(TASK_XML)
- @XMLResponseParser(TaskHandler.class)
- @PayloadParams(keys = "IsSourceDelete", values = "true")
- @MapBinder(BindCloneVAppTemplateParamsToXmlPayload.class)
- Task moveVAppTemplateToVDCAndRename(@PayloadParam("Source") URI toClone,
- @EndpointParam URI vdc, @PayloadParam("name") @ParamValidators(DnsNameValidator.class) String newName,
- CloneVAppTemplateOptions... options);
-
- /**
- * The captureVApp request creates a vApp template from an instantiated vApp. <h4>Note</h4>
- * Before it can be captured, a vApp must be undeployed
- *
- * @param targetVdcHref
- * @param sourceVAppHref
- * @param newTemplateName
- * @param options
- * @return template in progress
- */
- @POST
- @Path("/action/captureVApp")
- @Produces("application/vnd.vmware.vcloud.captureVAppParams+xml")
- @Consumes(VAPPTEMPLATE_XML)
- @XMLResponseParser(VAppTemplateHandler.class)
- @MapBinder(BindCaptureVAppParamsToXmlPayload.class)
- VAppTemplate captureVAppAsTemplateInVDC(@PayloadParam("vApp") URI toCapture,
- @PayloadParam("templateName") @ParamValidators(DnsNameValidator.class) String templateName,
- @EndpointParam URI vdc, CaptureVAppOptions... options);
-
- @GET
- @Consumes(VAPPTEMPLATE_XML)
- @XMLResponseParser(VAppTemplateHandler.class)
- @Fallback(Fallbacks.NullOnNotFoundOr404.class)
- VAppTemplate getVAppTemplate(@EndpointParam URI vAppTemplate);
-
- @GET
- @Consumes(MediaType.TEXT_XML)
- @Path("/ovf")
- @XMLResponseParser(EnvelopeHandler.class)
- @Fallback(Fallbacks.NullOnNotFoundOr404.class)
- Envelope getOvfEnvelopeForVAppTemplate(@EndpointParam URI href);
-
- /**
- * delete a vAppTemplate, vApp, or media image. You cannot delete an object if it is in use. Any
- * object that is being copied or moved is in use. Other criteria that determine whether an
- * object is in use depend on the object type.
- * <ul>
- * <li>A vApptemplate is in use if it is being instantiated. After instantiation is complete, the
- * template is no longer in use.</li>
- * <li>A vApp is in use if it is deployed.</li>
- * <li>A media image is in use if it is inserted in a Vm.</li>
- * </ul>
- *
- * @param id
- * href of the vApp
- * @return task of the operation in progress
- */
- @DELETE
- @Consumes(TASK_XML)
- @Fallback(Fallbacks.VoidOnNotFoundOr404.class)
- @XMLResponseParser(TaskHandler.class)
- Task deleteVAppTemplate(@EndpointParam URI href);
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/897edde8/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/features/VDCApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/features/VDCApi.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/features/VDCApi.java
deleted file mode 100644
index 7b02798..0000000
--- a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/features/VDCApi.java
+++ /dev/null
@@ -1,71 +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.VDC_XML;
-
-import java.net.URI;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.GET;
-
-import org.jclouds.Fallbacks;
-import org.jclouds.javax.annotation.Nullable;
-import org.jclouds.rest.annotations.EndpointParam;
-import org.jclouds.rest.annotations.Fallback;
-import org.jclouds.rest.annotations.MapBinder;
-import org.jclouds.rest.annotations.PayloadParam;
-import org.jclouds.rest.annotations.RequestFilters;
-import org.jclouds.rest.annotations.XMLResponseParser;
-import org.jclouds.vcloud.binders.OrgNameAndVDCNameToEndpoint;
-import org.jclouds.vcloud.domain.VDC;
-import org.jclouds.vcloud.filters.AddVCloudAuthorizationAndCookieToRequest;
-import org.jclouds.vcloud.xml.VDCHandler;
-
-
-/**
- * Provides access to VDC functionality in vCloud
- * <p/>
- */
-@RequestFilters(AddVCloudAuthorizationAndCookieToRequest.class)
-public interface VDCApi {
- @GET
- @XMLResponseParser(VDCHandler.class)
- @Consumes(VDC_XML)
- @Fallback(Fallbacks.NullOnNotFoundOr404.class)
- VDC getVDC(@EndpointParam URI vdc);
-
- /**
- * returns the VDC in the organization associated with the specified name. Note that both
- * parameters can be null to choose default.
- *
- * @param orgName
- * organization name, or null for the default
- * @param vdcName
- * catalog name, or null for the default
- * @throws NoSuchElementException
- * if you specified an org or vdc name that isn't present
- */
- @GET
- @XMLResponseParser(VDCHandler.class)
- @Consumes(VDC_XML)
- @Fallback(Fallbacks.NullOnNotFoundOr404.class)
- @MapBinder(OrgNameAndVDCNameToEndpoint.class)
- VDC findVDCInOrgNamed(@Nullable @PayloadParam("orgName") String orgName,
- @Nullable @PayloadParam("vdcName") String vdcName);
-
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/897edde8/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/features/VmApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/features/VmApi.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/features/VmApi.java
deleted file mode 100644
index 40b7e43..0000000
--- a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/features/VmApi.java
+++ /dev/null
@@ -1,326 +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.RASDITEMLIST_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.*;
-import org.jclouds.vcloud.binders.*;
-import org.jclouds.vcloud.domain.*;
-import org.jclouds.vcloud.domain.ovf.VCloudNetworkAdapter;
-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/>
- *
- * @author Adrian Cole
- */
-@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);
-
- /**
- * Detach disk
- */
- @POST
- @Consumes(TASK_XML)
- @Produces(DiskAttachOrDetachParams.DISK_XML)
- @Path("/disk/action/detach")
- @MapBinder(BindDiskAttachOrDetachParamsToXmlPayload.class)
- @XMLResponseParser(TaskHandler.class)
- Task detachDisk(
- @EndpointParam URI href,
- @PayloadParam("params") DiskAttachOrDetachParams diskAttachOrDetachParams);
-
- /**
- * Attach disk
- */
- @POST
- @Consumes(TASK_XML)
- @Produces("application/vnd.vmware.vcloud.diskAttachOrDetachParams+xml")
- @Path("/disk/action/attach")
- @MapBinder(BindDiskAttachOrDetachParamsToXmlPayload.class)
- @XMLResponseParser(TaskHandler.class)
- Task attachDisk(
- @EndpointParam URI href,
- @PayloadParam("params") DiskAttachOrDetachParams diskAttachOrDetachParams);
-
- /**
- * 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);
-
- /**
- * update the networkCards of an existing VM
- *
- * @param href
- * to update
- * @param networkCards
- * new list of Network Interface Cards (NICs)
- */
- @PUT
- @Consumes(TASK_XML)
- @Produces(RASDITEMLIST_XML)
- @Path("/virtualHardwareSection/networkCards")
- @MapBinder(BindVCloudNetworkAdapterToXmlPayload.class)
- @XMLResponseParser(TaskHandler.class)
- Task updateNetworkCardsOfVm(@PayloadParam("params") Iterable<VCloudNetworkAdapter> networkCards,
- @EndpointParam URI href);
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/897edde8/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/filters/AddVCloudAuthorizationAndCookieToRequest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/filters/AddVCloudAuthorizationAndCookieToRequest.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/filters/AddVCloudAuthorizationAndCookieToRequest.java
deleted file mode 100644
index 1d3ba5d..0000000
--- a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/filters/AddVCloudAuthorizationAndCookieToRequest.java
+++ /dev/null
@@ -1,60 +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.rest.annotations.ApiVersion;
-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;
- private final String apiVersion;
-
- @Inject
- public AddVCloudAuthorizationAndCookieToRequest(@VCloudToken Supplier<String> authTokenProvider, @ApiVersion final String apiVersion) {
- this.vcloudTokenProvider = authTokenProvider;
- this.apiVersion = apiVersion;
- }
-
- @Override
- public HttpRequest filter(HttpRequest request) throws HttpException {
- String token = vcloudTokenProvider.get();
- String acceptType = request.getFirstHeaderOrNull(HttpHeaders.ACCEPT) == null
- ? "application/*+xml"
- : request.getFirstHeaderOrNull(HttpHeaders.ACCEPT);
- String version = ";version=" + apiVersion;
- String acceptHeader = acceptType + version;
- return request.toBuilder()
- .replaceHeaders(ImmutableMultimap.of(HttpHeaders.ACCEPT,
- acceptHeader, "x-vcloud-authorization", token,
- HttpHeaders.COOKIE, "vcloud-token=" +
- token)).build();
- }
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/897edde8/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/functions/CatalogItemsInCatalog.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/functions/CatalogItemsInCatalog.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/functions/CatalogItemsInCatalog.java
deleted file mode 100644
index db18f9e..0000000
--- a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/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/stratos/blob/897edde8/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/functions/CatalogItemsInOrg.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/functions/CatalogItemsInOrg.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/functions/CatalogItemsInOrg.java
deleted file mode 100644
index f6ccf7d..0000000
--- a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/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/stratos/blob/897edde8/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/functions/CatalogsInOrg.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/functions/CatalogsInOrg.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/functions/CatalogsInOrg.java
deleted file mode 100644
index 917f651..0000000
--- a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/functions/CatalogsInOrg.java
+++ /dev/null
@@ -1,69 +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 com.google.common.base.Predicate;
-import com.google.common.collect.Collections2;
-import com.google.common.collect.ImmutableSet;
-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;
-
-import java.util.Collection;
-
-@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) {
- Collection<ReferenceType> filtered = Collections2.filter(
- org.getCatalogs().values(), new Predicate<ReferenceType>() {
- @Override
- public boolean apply(ReferenceType type) {
- if (type == null) {
- return false;
- }
- return !ImmutableSet.of("add", "remove").contains(type.getRelationship());
- }
- });
-
- return transform(filtered, new Function<ReferenceType, Catalog>() {
- public Catalog apply(ReferenceType from) {
- return aclient.getCatalogApi().getCatalog(from.getHref());
- }
- });
- }
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/897edde8/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/functions/DefaultNetworkNameInTemplate.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/functions/DefaultNetworkNameInTemplate.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/functions/DefaultNetworkNameInTemplate.java
deleted file mode 100644
index eeecb8d..0000000
--- a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/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.size() > 0, "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/stratos/blob/897edde8/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/functions/NetworksInOrg.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/functions/NetworksInOrg.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/functions/NetworksInOrg.java
deleted file mode 100644
index 25c18a1..0000000
--- a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/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/stratos/blob/897edde8/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/functions/OrgNameToEndpoint.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/functions/OrgNameToEndpoint.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/functions/OrgNameToEndpoint.java
deleted file mode 100644
index bc762a5..0000000
--- a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/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/stratos/blob/897edde8/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/functions/OrgNameToTasksListEndpoint.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/functions/OrgNameToTasksListEndpoint.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/functions/OrgNameToTasksListEndpoint.java
deleted file mode 100644
index 1d3fc4a..0000000
--- a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/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/stratos/blob/897edde8/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/functions/OrgsForLocations.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/functions/OrgsForLocations.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/functions/OrgsForLocations.java
deleted file mode 100644
index 72be2f6..0000000
--- a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/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/stratos/blob/897edde8/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/functions/OrgsForNames.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/functions/OrgsForNames.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/functions/OrgsForNames.java
deleted file mode 100644
index ce3cd9e..0000000
--- a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/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/stratos/blob/897edde8/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/functions/ParseLoginResponseFromHeaders.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/functions/ParseLoginResponseFromHeaders.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/functions/ParseLoginResponseFromHeaders.java
deleted file mode 100644
index d9900fd..0000000
--- a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/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/stratos/blob/897edde8/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/functions/VAppTemplatesForCatalogItems.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/functions/VAppTemplatesForCatalogItems.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/functions/VAppTemplatesForCatalogItems.java
deleted file mode 100644
index d3a6a9b..0000000
--- a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/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/stratos/blob/897edde8/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/functions/VAppTemplatesInOrg.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/functions/VAppTemplatesInOrg.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/functions/VAppTemplatesInOrg.java
deleted file mode 100644
index 992c2af..0000000
--- a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/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/stratos/blob/897edde8/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/functions/VDCsInOrg.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/functions/VDCsInOrg.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/functions/VDCsInOrg.java
deleted file mode 100644
index 4457233..0000000
--- a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/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/stratos/blob/897edde8/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/handlers/ParseVCloudErrorFromHttpResponse.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/handlers/ParseVCloudErrorFromHttpResponse.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/handlers/ParseVCloudErrorFromHttpResponse.java
deleted file mode 100644
index 2c9f96f..0000000
--- a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/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/stratos/blob/897edde8/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/http/filters/VCloudBasicAuthentication.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/http/filters/VCloudBasicAuthentication.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/http/filters/VCloudBasicAuthentication.java
deleted file mode 100644
index a333874..0000000
--- a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/http/filters/VCloudBasicAuthentication.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.http.filters;
-
-import com.google.common.base.Preconditions;
-import com.google.common.base.Supplier;
-import javax.inject.Inject;
-import javax.inject.Singleton;
-import org.jclouds.domain.Credentials;
-import org.jclouds.http.HttpException;
-import org.jclouds.http.HttpRequest;
-import org.jclouds.http.HttpRequest.Builder;
-import org.jclouds.http.HttpRequestFilter;
-import org.jclouds.http.filters.BasicAuthentication;
-import org.jclouds.location.Provider;
-import org.jclouds.rest.annotations.ApiVersion;
-
-@Singleton
-public class VCloudBasicAuthentication implements HttpRequestFilter
-{
- private final Supplier<Credentials> creds;
- private final String apiVersion;
-
- @Inject
- public VCloudBasicAuthentication(@Provider Supplier<Credentials> creds, @ApiVersion String apiVersion)
- {
- this.creds = ((Supplier)Preconditions.checkNotNull(creds, "creds"));
- this.apiVersion = apiVersion;
- }
-
- public HttpRequest filter(HttpRequest request) throws HttpException
- {
- Credentials currentCreds = (Credentials)Preconditions.checkNotNull(this.creds.get(), "credential supplier returned null");
- String acceptType = request.getFirstHeaderOrNull("Accept") == null ? "application/*+xml" : request.getFirstHeaderOrNull("Accept");
-
- String version = ";version=" + this.apiVersion;
- String acceptHeader = acceptType + version;
-
- request = ((HttpRequest.Builder)request.toBuilder().replaceHeader("Accept", new String[] { acceptHeader })).build();
-
- return ((HttpRequest.Builder)request.toBuilder().replaceHeader("Authorization", new String[] { BasicAuthentication.basic(currentCreds.identity, currentCreds.credential) })).build();
- }
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/897edde8/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/http/filters/VCloudSupportedVersions.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/http/filters/VCloudSupportedVersions.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/http/filters/VCloudSupportedVersions.java
deleted file mode 100644
index 3769fda..0000000
--- a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/http/filters/VCloudSupportedVersions.java
+++ /dev/null
@@ -1,35 +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.http.filters;
-
-import javax.inject.Singleton;
-
-import org.jclouds.http.HttpException;
-import org.jclouds.http.HttpRequest;
-import org.jclouds.http.HttpRequestFilter;
-
-@Singleton
-public class VCloudSupportedVersions implements HttpRequestFilter
-{
- @SuppressWarnings("rawtypes")
-public HttpRequest filter(HttpRequest request)
- throws HttpException
- {
- return ((HttpRequest.Builder)request.toBuilder().replaceHeader("Accept", new String[] { "*/*" })).build();
- }
-}