getApiContext();
-
- /**
- * Returns the administration service.
- *
- * This service provides an entry point to infrastructure administration
- * tasks.
- */
- AdministrationService getAdministrationService();
-
- /**
- * Returns the cloud service.
- *
- * This service provides an entry point to cloud management tasks.
- */
- CloudService getCloudService();
-
- /**
- * Returns the search service.
- *
- * This service provides an entry point to listing and filtering tasks.
- */
- SearchService getSearchService();
-
- /**
- * Returns the monitoring service.
- *
- * This service provides an entry point to asynchronous task monitoring
- * tasks.
- */
- MonitoringService getMonitoringService();
-
- /**
- * Returns the event service.
- *
- * This service provides an entry point to event management tasks.
- */
- EventService getEventService();
-
- /**
- * Returns the pricing service.
- *
- * This service provides an entry point to pricing management tasks.
- */
- PricingService getPricingService();
-}
diff --git a/labs/abiquo/src/main/java/org/jclouds/abiquo/AbiquoFallbacks.java b/labs/abiquo/src/main/java/org/jclouds/abiquo/AbiquoFallbacks.java
deleted file mode 100644
index 05a9b1cc90..0000000000
--- a/labs/abiquo/src/main/java/org/jclouds/abiquo/AbiquoFallbacks.java
+++ /dev/null
@@ -1,180 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds 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.abiquo;
-
-import static com.google.common.base.Throwables.getCausalChain;
-import static com.google.common.base.Throwables.propagate;
-import static com.google.common.collect.Iterables.find;
-import static com.google.common.util.concurrent.Futures.immediateFuture;
-
-import javax.ws.rs.core.Response.Status;
-
-import org.jclouds.Fallback;
-import org.jclouds.abiquo.domain.exception.AbiquoException;
-import org.jclouds.http.HttpResponse;
-import org.jclouds.http.HttpResponseException;
-import org.jclouds.rest.ResourceNotFoundException;
-
-import com.google.common.base.Predicate;
-import com.google.common.util.concurrent.ListenableFuture;
-
-/**
- * fallbacks common to abiquo
- *
- * @author Ignasi Barrera
- */
-public final class AbiquoFallbacks {
- private AbiquoFallbacks() {
- }
-
- /**
- * Return an Abiquo Exception on not found errors.
- */
- public static final class PropagateAbiquoExceptionOnNotFoundOr4xx implements Fallback {
- @Override
- public ListenableFuture create(Throwable from) throws Exception {
- return immediateFuture(createOrPropagate(from));
- }
-
- @Override
- public Object createOrPropagate(Throwable from) throws Exception {
- Throwable exception = find(getCausalChain(from), isNotFoundAndHasAbiquoException(from), null);
- throw propagate(exception == null ? from : exception.getCause());
- }
- }
-
- /**
- * Return null
on 303 response codes when requesting a task.
- */
- public static final class NullOn303 implements Fallback {
- @Override
- public ListenableFuture create(Throwable from) throws Exception {
- return immediateFuture(createOrPropagate(from));
- }
-
- @Override
- public Object createOrPropagate(Throwable from) throws Exception {
- Throwable exception = find(getCausalChain(from), hasResponse(from), null);
-
- if (exception != null) {
- HttpResponseException responseException = (HttpResponseException) exception;
- HttpResponse response = responseException.getResponse();
-
- if (response != null && response.getStatusCode() == Status.SEE_OTHER.getStatusCode()) {
- return null;
- }
- }
-
- throw propagate(from);
- }
-
- }
-
- /**
- * Return false on service error exceptions.
- */
- public static final class FalseOn5xx implements Fallback {
- @Override
- public ListenableFuture create(Throwable from) throws Exception {
- return immediateFuture(createOrPropagate(from));
- }
-
- @Override
- public Boolean createOrPropagate(Throwable from) throws Exception {
- Throwable exception = find(getCausalChain(from), hasResponse(from), null);
-
- if (exception != null) {
- HttpResponseException responseException = (HttpResponseException) exception;
- HttpResponse response = responseException.getResponse();
-
- if (response != null && response.getStatusCode() >= 500 && response.getStatusCode() < 600) {
- return false;
- }
- }
-
- throw propagate(from);
- }
-
- }
-
- /**
- * Return false on service error exceptions.
- */
- public static final class FalseIfNotAvailable implements Fallback {
- @Override
- public ListenableFuture create(Throwable from) throws Exception {
- return immediateFuture(createOrPropagate(from));
- }
-
- @Override
- public Boolean createOrPropagate(Throwable from) throws Exception {
- Throwable exception = find(getCausalChain(from), isNotAvailableException(from), null);
-
- if (exception != null) {
- if (exception instanceof HttpResponseException) {
- HttpResponseException responseException = (HttpResponseException) exception;
- HttpResponse response = responseException.getResponse();
-
- if (response != null && response.getStatusCode() >= 500 && response.getStatusCode() < 600) {
- return false;
- }
- } else {
- // Will enter here when exception is a ResourceNotFoundException
- return false;
- }
- }
-
- throw propagate(from);
- }
-
- }
-
- private static Predicate isNotFoundAndHasAbiquoException(final Throwable exception) {
- return new Predicate() {
- @Override
- public boolean apply(final Throwable input) {
- return input instanceof ResourceNotFoundException && input.getCause() instanceof AbiquoException;
- }
- };
- }
-
- private static Predicate isNotAvailableException(final Throwable exception) {
- return new Predicate() {
- @Override
- public boolean apply(final Throwable input) {
- boolean notAvailable = input instanceof HttpResponseException
- && ((HttpResponseException) input).getResponse() != null;
-
- notAvailable |= input instanceof ResourceNotFoundException;
-
- return notAvailable;
- }
- };
- }
-
- private static Predicate hasResponse(final Throwable exception) {
- return new Predicate() {
- @Override
- public boolean apply(final Throwable input) {
- return input instanceof HttpResponseException && ((HttpResponseException) input).getResponse() != null;
- }
- };
- }
-}
\ No newline at end of file
diff --git a/labs/abiquo/src/main/java/org/jclouds/abiquo/binders/AppendToPath.java b/labs/abiquo/src/main/java/org/jclouds/abiquo/binders/AppendToPath.java
deleted file mode 100644
index ff05887e99..0000000000
--- a/labs/abiquo/src/main/java/org/jclouds/abiquo/binders/AppendToPath.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds 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.abiquo.binders;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.net.URI;
-
-import javax.inject.Singleton;
-
-import org.jclouds.http.HttpRequest;
-import org.jclouds.rest.Binder;
-
-/**
- * Appends the parameter value to the end of the request URI.
- *
- * @author Ignasi Barrera
- */
-@Singleton
-public class AppendToPath implements Binder {
- @SuppressWarnings("unchecked")
- @Override
- public R bindToRequest(final R request, final Object input) {
- // Append the parameter to the request URI
- String valueToAppend = getValue(request, checkNotNull(input, "input"));
- URI path = URI.create(request.getEndpoint().toString() + "/" + valueToAppend);
- return (R) request.toBuilder().endpoint(path).build();
- }
-
- /**
- * Get the value that will be appended to the request URI.
- */
- protected String getValue(final R request, final Object input) {
- return input.toString();
- }
-}
diff --git a/labs/abiquo/src/main/java/org/jclouds/abiquo/binders/BindLinkToPath.java b/labs/abiquo/src/main/java/org/jclouds/abiquo/binders/BindLinkToPath.java
deleted file mode 100644
index e7bd255a05..0000000000
--- a/labs/abiquo/src/main/java/org/jclouds/abiquo/binders/BindLinkToPath.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds 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.abiquo.binders;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import javax.inject.Singleton;
-
-import org.jclouds.rest.internal.GeneratedHttpRequest;
-
-import com.abiquo.model.rest.RESTLink;
-
-/**
- * Binds the given link to the uri.
- *
- * @author Francesc Montserrat
- */
-@Singleton
-public class BindLinkToPath extends BindToPath {
-
- @Override
- protected String getNewEndpoint(final GeneratedHttpRequest gRequest, final Object input) {
- checkArgument(checkNotNull(input, "input") instanceof RESTLink, "this binder is only valid for RESTLink objects");
-
- return ((RESTLink) input).getHref();
- }
-
-}
diff --git a/labs/abiquo/src/main/java/org/jclouds/abiquo/binders/BindLinkToPathAndAcceptHeader.java b/labs/abiquo/src/main/java/org/jclouds/abiquo/binders/BindLinkToPathAndAcceptHeader.java
deleted file mode 100644
index e8ae015693..0000000000
--- a/labs/abiquo/src/main/java/org/jclouds/abiquo/binders/BindLinkToPathAndAcceptHeader.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds 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.abiquo.binders;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import javax.inject.Singleton;
-import javax.ws.rs.core.HttpHeaders;
-
-import org.jclouds.http.HttpRequest;
-
-import com.abiquo.model.rest.RESTLink;
-import com.google.common.annotations.VisibleForTesting;
-
-/**
- * Binds the given link to the uri and the Accept header.
- *
- * @author Ignasi Barrera
- */
-@Singleton
-public class BindLinkToPathAndAcceptHeader extends BindLinkToPath {
- @Override
- public R bindToRequest(final R request, final Object input) {
- R updatedRequest = super.bindToRequest(request, input);
- return addHeader(updatedRequest, HttpHeaders.ACCEPT, ((RESTLink) input).getType());
- }
-
- @SuppressWarnings("unchecked")
- @VisibleForTesting
- R addHeader(final R request, final String header, final String value) {
- return (R) request.toBuilder().replaceHeader(HttpHeaders.ACCEPT, checkNotNull(value, "value")).build();
- }
-}
diff --git a/labs/abiquo/src/main/java/org/jclouds/abiquo/binders/BindRefsToPayload.java b/labs/abiquo/src/main/java/org/jclouds/abiquo/binders/BindRefsToPayload.java
deleted file mode 100644
index 3dc129fcfc..0000000000
--- a/labs/abiquo/src/main/java/org/jclouds/abiquo/binders/BindRefsToPayload.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds 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.abiquo.binders;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import javax.inject.Inject;
-
-import org.jclouds.http.HttpRequest;
-import org.jclouds.rest.binders.BindToXMLPayload;
-import org.jclouds.xml.XMLParser;
-
-import com.abiquo.model.rest.RESTLink;
-import com.abiquo.model.transport.LinksDto;
-import com.abiquo.model.transport.SingleResourceTransportDto;
-
-/**
- * Bind multiple objects to the payload of the request as a list of links.
- *
- * @author Ignasi Barrera
- */
-public abstract class BindRefsToPayload extends BindToXMLPayload {
- @Inject
- public BindRefsToPayload(final XMLParser xmlParser) {
- super(xmlParser);
- }
-
- protected abstract String getRelToUse(final Object input);
-
- @Override
- public R bindToRequest(final R request, final Object input) {
- checkArgument(checkNotNull(input, "input") instanceof SingleResourceTransportDto[],
- "this binder is only valid for SingleResourceTransportDto arrays");
-
- SingleResourceTransportDto[] dtos = (SingleResourceTransportDto[]) input;
- LinksDto refs = new LinksDto();
-
- for (SingleResourceTransportDto dto : dtos) {
- RESTLink editLink = checkNotNull(dto.getEditLink(), "entity must have an edit link");
-
- // Do not add repeated references
- if (refs.searchLinkByHref(editLink.getHref()) == null) {
- refs.addLink(new RESTLink(getRelToUse(input), editLink.getHref()));
- }
- }
-
- return super.bindToRequest(request, refs);
- }
-
-}
diff --git a/labs/abiquo/src/main/java/org/jclouds/abiquo/binders/BindToPath.java b/labs/abiquo/src/main/java/org/jclouds/abiquo/binders/BindToPath.java
deleted file mode 100644
index ca892d90dc..0000000000
--- a/labs/abiquo/src/main/java/org/jclouds/abiquo/binders/BindToPath.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds 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.abiquo.binders;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.base.Preconditions.checkState;
-
-import java.lang.annotation.Annotation;
-import java.net.URI;
-import java.util.Arrays;
-
-import javax.inject.Singleton;
-
-import org.jclouds.abiquo.rest.annotations.EndpointLink;
-import org.jclouds.http.HttpRequest;
-import org.jclouds.rest.Binder;
-import org.jclouds.rest.binders.BindException;
-import org.jclouds.rest.internal.GeneratedHttpRequest;
-
-import com.abiquo.model.rest.RESTLink;
-import com.abiquo.model.transport.SingleResourceTransportDto;
-import com.google.common.base.Predicates;
-import com.google.common.collect.Iterables;
-
-/**
- * Binds the given object to the path..
- *
- * @author Ignasi Barrera
- */
-@Singleton
-public class BindToPath implements Binder {
- @Override
- public R bindToRequest(final R request, final Object input) {
- checkArgument(checkNotNull(request, "request") instanceof GeneratedHttpRequest,
- "this binder is only valid for GeneratedHttpRequests");
- GeneratedHttpRequest gRequest = (GeneratedHttpRequest) request;
- checkState(gRequest.getInvocation().getArgs() != null, "args should be initialized at this point");
-
- // Update the request URI with the configured link URI
- String newEndpoint = getNewEndpoint(gRequest, input);
- return bindToPath(request, newEndpoint);
- }
-
- /**
- * Get the new endpoint to use.
- *
- * @param gRequest
- * The request.
- * @param input
- * The input parameter.
- * @return The new endpoint to use.
- */
- protected String getNewEndpoint(final GeneratedHttpRequest gRequest, final Object input) {
- SingleResourceTransportDto dto = checkValidInput(input);
- return getLinkToUse(gRequest, dto).getHref();
- }
-
- /**
- * Get the link to be used to build the request URI.
- *
- * @param request
- * The current request.
- * @param payload
- * The object containing the link.
- * @return The link to be used to build the request URI.
- */
- static RESTLink getLinkToUse(final GeneratedHttpRequest request, final SingleResourceTransportDto payload) {
- int argIndex = request.getInvocation().getArgs().indexOf(payload);
- Annotation[] annotations = request.getInvocation().getInvokable().getParameters().get(argIndex).getAnnotations();
-
- EndpointLink linkName = (EndpointLink) Iterables.find(Arrays.asList(annotations),
- Predicates.instanceOf(EndpointLink.class), null);
-
- if (linkName == null) {
- throw new BindException(request, "Expected a EndpointLink annotation but not found in the parameter");
- }
-
- return checkNotNull(payload.searchLink(linkName.value()), "No link was found in object with rel: " + linkName);
- }
-
- /**
- * Bind the given link to the request URI.
- *
- * @param request
- * The request to modify.
- * @param endpoint
- * The endpoint to use as the request URI.
- * @return The updated request.
- */
- @SuppressWarnings("unchecked")
- static R bindToPath(final R request, final String endpoint) {
- // Preserve current query parameters
- String newEndpoint = endpoint + getParameterString(request);
-
- // Replace the URI with the edit link in the DTO
- URI path = URI.create(newEndpoint);
- return (R) request.toBuilder().endpoint(path).build();
- }
-
- protected static SingleResourceTransportDto checkValidInput(final Object input) {
- checkArgument(checkNotNull(input, "input") instanceof SingleResourceTransportDto,
- "this binder is only valid for SingleResourceTransportDto objects");
-
- return (SingleResourceTransportDto) input;
- }
-
- protected static String getParameterString(final R request) {
- String endpoint = request.getEndpoint().toString();
-
- int query = endpoint.indexOf('?');
-
- if (query == -1) {
- // No parameters
- return "";
- } else {
- // Only request parameters
- return endpoint.substring(query);
- }
-
- }
-}
diff --git a/labs/abiquo/src/main/java/org/jclouds/abiquo/binders/BindToXMLPayloadAndPath.java b/labs/abiquo/src/main/java/org/jclouds/abiquo/binders/BindToXMLPayloadAndPath.java
deleted file mode 100644
index 620a700618..0000000000
--- a/labs/abiquo/src/main/java/org/jclouds/abiquo/binders/BindToXMLPayloadAndPath.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds 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.abiquo.binders;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.base.Preconditions.checkState;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import org.jclouds.http.HttpRequest;
-import org.jclouds.rest.binders.BindToXMLPayload;
-import org.jclouds.rest.internal.GeneratedHttpRequest;
-import org.jclouds.xml.XMLParser;
-
-import com.abiquo.model.transport.SingleResourceTransportDto;
-
-/**
- * Binds the given object to the payload and extracts the path parameters from
- * the edit link.
- *
- * This method should be used in {@link PUT} methods to automatically extract
- * the path parameters from the edit link of the updated object.
- *
- * @author Ignasi Barrera
- */
-@Singleton
-public class BindToXMLPayloadAndPath extends BindToXMLPayload {
- @Inject
- public BindToXMLPayloadAndPath(final XMLParser xmlParser) {
- super(xmlParser);
- }
-
- @Override
- public R bindToRequest(final R request, final Object payload) {
- checkArgument(checkNotNull(request, "request") instanceof GeneratedHttpRequest,
- "this binder is only valid for GeneratedHttpRequests");
- GeneratedHttpRequest gRequest = (GeneratedHttpRequest) request;
- checkState(gRequest.getInvocation().getArgs() != null, "args should be initialized at this point");
-
- // Update the request URI with the configured link URI
- String newEndpoint = getNewEndpoint(gRequest, payload);
- R updatedRequest = BindToPath.bindToPath(request, newEndpoint);
-
- // Add the payload
- return super.bindToRequest(updatedRequest, payload);
- }
-
- /**
- * Get the new endpoint to use.
- *
- * @param gRequest
- * The request.
- * @param input
- * The input parameter.
- * @return The new endpoint to use.
- */
- protected String getNewEndpoint(final GeneratedHttpRequest gRequest, final Object input) {
- SingleResourceTransportDto dto = BindToPath.checkValidInput(input);
- return BindToPath.getLinkToUse(gRequest, dto).getHref();
- }
-}
diff --git a/labs/abiquo/src/main/java/org/jclouds/abiquo/binders/cloud/BindHardDiskRefsToPayload.java b/labs/abiquo/src/main/java/org/jclouds/abiquo/binders/cloud/BindHardDiskRefsToPayload.java
deleted file mode 100644
index 1762ccd64b..0000000000
--- a/labs/abiquo/src/main/java/org/jclouds/abiquo/binders/cloud/BindHardDiskRefsToPayload.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds 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.abiquo.binders.cloud;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import org.jclouds.abiquo.binders.BindRefsToPayload;
-import org.jclouds.xml.XMLParser;
-
-/**
- * Bind multiple {@link DiskManagementDto} objects to the payload of the request
- * as a list of links.
- *
- * @author Ignasi Barrera
- */
-@Singleton
-public class BindHardDiskRefsToPayload extends BindRefsToPayload {
- @Inject
- public BindHardDiskRefsToPayload(final XMLParser xmlParser) {
- super(xmlParser);
- }
-
- @Override
- protected String getRelToUse(final Object input) {
- return "disk";
- }
-
-}
diff --git a/labs/abiquo/src/main/java/org/jclouds/abiquo/binders/cloud/BindIpRefToPayload.java b/labs/abiquo/src/main/java/org/jclouds/abiquo/binders/cloud/BindIpRefToPayload.java
deleted file mode 100644
index e9a1ec4377..0000000000
--- a/labs/abiquo/src/main/java/org/jclouds/abiquo/binders/cloud/BindIpRefToPayload.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds 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.abiquo.binders.cloud;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import org.jclouds.http.HttpRequest;
-import org.jclouds.rest.binders.BindToXMLPayload;
-import org.jclouds.xml.XMLParser;
-
-import com.abiquo.model.rest.RESTLink;
-import com.abiquo.model.transport.LinksDto;
-import com.abiquo.server.core.infrastructure.network.AbstractIpDto;
-
-/**
- * Bind the link reference to an {@link AbstractIpDto} object into the payload.
- *
- * @author Ignasi Barrera
- */
-@Singleton
-public class BindIpRefToPayload extends BindToXMLPayload {
- @Inject
- public BindIpRefToPayload(final XMLParser xmlParser) {
- super(xmlParser);
- }
-
- @Override
- public R bindToRequest(final R request, final Object input) {
- checkArgument(checkNotNull(input, "input") instanceof AbstractIpDto,
- "this binder is only valid for AbstractIpDto objects");
-
- AbstractIpDto ip = (AbstractIpDto) input;
- RESTLink selfLink = checkNotNull(ip.searchLink("self"), "AbstractIpDto must have an self link");
-
- LinksDto refs = new LinksDto();
- refs.addLink(new RESTLink(selfLink.getTitle(), selfLink.getHref()));
-
- return super.bindToRequest(request, refs);
- }
-}
diff --git a/labs/abiquo/src/main/java/org/jclouds/abiquo/binders/cloud/BindIpRefsToPayload.java b/labs/abiquo/src/main/java/org/jclouds/abiquo/binders/cloud/BindIpRefsToPayload.java
deleted file mode 100644
index 71596fe3c7..0000000000
--- a/labs/abiquo/src/main/java/org/jclouds/abiquo/binders/cloud/BindIpRefsToPayload.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds 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.abiquo.binders.cloud;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import org.jclouds.abiquo.domain.util.LinkUtils;
-import org.jclouds.http.HttpRequest;
-import org.jclouds.rest.binders.BindToXMLPayload;
-import org.jclouds.xml.XMLParser;
-
-import com.abiquo.model.rest.RESTLink;
-import com.abiquo.model.transport.LinksDto;
-import com.abiquo.server.core.infrastructure.network.AbstractIpDto;
-
-/**
- * Bind the link reference to an {@link AbstractIpDto} object into the payload.
- *
- * @author Ignasi Barrera
- */
-@Singleton
-public class BindIpRefsToPayload extends BindToXMLPayload {
- @Inject
- public BindIpRefsToPayload(final XMLParser xmlParser) {
- super(xmlParser);
- }
-
- @Override
- public R bindToRequest(final R request, final Object input) {
- checkArgument(checkNotNull(input, "input") instanceof AbstractIpDto[],
- "this binder is only valid for AbstractIpDto arrays");
-
- AbstractIpDto[] ips = (AbstractIpDto[]) input;
- LinksDto refs = new LinksDto();
-
- for (AbstractIpDto ip : ips) {
- RESTLink selfLink = checkNotNull(LinkUtils.getSelfLink(ip), "AbstractIpDto must have an edit or self link");
- if (refs.searchLinkByHref(selfLink.getHref()) == null) {
- RESTLink ref = new RESTLink(selfLink.getTitle(), selfLink.getHref());
- ref.setType(selfLink.getType());
- refs.addLink(ref);
- }
- }
-
- return super.bindToRequest(request, refs);
- }
-}
diff --git a/labs/abiquo/src/main/java/org/jclouds/abiquo/binders/cloud/BindMoveVolumeToPath.java b/labs/abiquo/src/main/java/org/jclouds/abiquo/binders/cloud/BindMoveVolumeToPath.java
deleted file mode 100644
index f11d190227..0000000000
--- a/labs/abiquo/src/main/java/org/jclouds/abiquo/binders/cloud/BindMoveVolumeToPath.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds 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.abiquo.binders.cloud;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import org.jclouds.abiquo.binders.BindToPath;
-import org.jclouds.rest.internal.GeneratedHttpRequest;
-
-import com.abiquo.model.rest.RESTLink;
-import com.abiquo.server.core.infrastructure.storage.VolumeManagementDto;
-
-/**
- * Binds the move volume action to the request endpoint.
- *
- * @author Ignasi Barrera
- */
-public class BindMoveVolumeToPath extends BindToPath {
-
- @Override
- protected String getNewEndpoint(final GeneratedHttpRequest gRequest, final Object input) {
- checkArgument(checkNotNull(input, "input") instanceof VolumeManagementDto,
- "this binder is only valid for VolumeManagementDto objects");
-
- VolumeManagementDto volume = (VolumeManagementDto) input;
- RESTLink editLink = checkNotNull(volume.getEditLink(), "VolumeManagementDto must have an edit link");
-
- return editLink.getHref() + "/action/move";
- }
-
-}
diff --git a/labs/abiquo/src/main/java/org/jclouds/abiquo/binders/cloud/BindNetworkConfigurationRefToPayload.java b/labs/abiquo/src/main/java/org/jclouds/abiquo/binders/cloud/BindNetworkConfigurationRefToPayload.java
deleted file mode 100644
index f166d31a4a..0000000000
--- a/labs/abiquo/src/main/java/org/jclouds/abiquo/binders/cloud/BindNetworkConfigurationRefToPayload.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds 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.abiquo.binders.cloud;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.base.Preconditions.checkState;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import org.jclouds.http.HttpRequest;
-import org.jclouds.rest.binders.BindToXMLPayload;
-import org.jclouds.rest.internal.GeneratedHttpRequest;
-import org.jclouds.xml.XMLParser;
-
-import com.abiquo.model.rest.RESTLink;
-import com.abiquo.model.transport.LinksDto;
-import com.abiquo.server.core.cloud.VirtualMachineDto;
-import com.abiquo.server.core.infrastructure.network.VLANNetworkDto;
-import com.google.common.base.Predicates;
-import com.google.common.collect.Iterables;
-
-/**
- * Bind multiple objects to the payload of the request as a list of links.
- *
- * @author Ignasi Barrera
- */
-@Singleton
-public class BindNetworkConfigurationRefToPayload extends BindToXMLPayload {
- @Inject
- public BindNetworkConfigurationRefToPayload(final XMLParser xmlParser) {
- super(xmlParser);
- }
-
- @Override
- public R bindToRequest(final R request, final Object input) {
- checkArgument(checkNotNull(request, "request") instanceof GeneratedHttpRequest,
- "this binder is only valid for GeneratedHttpRequests");
- checkArgument(checkNotNull(input, "input") instanceof VLANNetworkDto,
- "this binder is only valid for VLANNetworkDto");
- GeneratedHttpRequest gRequest = (GeneratedHttpRequest) request;
- checkState(gRequest.getInvocation().getArgs() != null, "args should be initialized at this point");
-
- VLANNetworkDto network = (VLANNetworkDto) input;
- VirtualMachineDto vm = (VirtualMachineDto) Iterables.find(gRequest.getInvocation().getArgs(),
- Predicates.instanceOf(VirtualMachineDto.class));
-
- RESTLink configLink = checkNotNull(vm.searchLink("configurations"), "missing required link");
-
- LinksDto dto = new LinksDto();
- dto.addLink(new RESTLink("network_configuration", configLink.getHref() + "/" + network.getId()));
-
- return super.bindToRequest(request, dto);
- }
-}
diff --git a/labs/abiquo/src/main/java/org/jclouds/abiquo/binders/cloud/BindNetworkRefToPayload.java b/labs/abiquo/src/main/java/org/jclouds/abiquo/binders/cloud/BindNetworkRefToPayload.java
deleted file mode 100644
index 5d9ede9580..0000000000
--- a/labs/abiquo/src/main/java/org/jclouds/abiquo/binders/cloud/BindNetworkRefToPayload.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds 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.abiquo.binders.cloud;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import org.jclouds.http.HttpRequest;
-import org.jclouds.rest.binders.BindToXMLPayload;
-import org.jclouds.xml.XMLParser;
-
-import com.abiquo.model.rest.RESTLink;
-import com.abiquo.model.transport.LinksDto;
-import com.abiquo.server.core.infrastructure.network.VLANNetworkDto;
-
-/**
- * Bind the link reference to an {@link VLANNetworkDto} object into the payload.
- *
- * @author Ignasi Barrera
- */
-@Singleton
-public class BindNetworkRefToPayload extends BindToXMLPayload {
- @Inject
- public BindNetworkRefToPayload(final XMLParser xmlParser) {
- super(xmlParser);
- }
-
- @Override
- public R bindToRequest(final R request, final Object input) {
- checkArgument(checkNotNull(input, "input") instanceof VLANNetworkDto,
- "this binder is only valid for VLANNetworkDto objects");
-
- VLANNetworkDto network = (VLANNetworkDto) input;
- RESTLink editLink = checkNotNull(network.getEditLink(), "VLANNetworkDto must have an edit link");
-
- LinksDto refs = new LinksDto();
- switch (network.getType()) {
- case INTERNAL:
- refs.addLink(new RESTLink("internalnetwork", editLink.getHref()));
- break;
- case EXTERNAL:
- refs.addLink(new RESTLink("externalnetwork", editLink.getHref()));
- break;
- case PUBLIC:
- refs.addLink(new RESTLink("publicnetwork", editLink.getHref()));
- break;
- case UNMANAGED:
- refs.addLink(new RESTLink("unmanagednetwork", editLink.getHref()));
- break;
- default:
- // TODO: EXTERNAL_UNMANAGED network type
- throw new IllegalArgumentException("Unsupported network type");
- }
-
- return super.bindToRequest(request, refs);
- }
-
-}
diff --git a/labs/abiquo/src/main/java/org/jclouds/abiquo/binders/cloud/BindUnmanagedIpRefToPayload.java b/labs/abiquo/src/main/java/org/jclouds/abiquo/binders/cloud/BindUnmanagedIpRefToPayload.java
deleted file mode 100644
index a2b057dce4..0000000000
--- a/labs/abiquo/src/main/java/org/jclouds/abiquo/binders/cloud/BindUnmanagedIpRefToPayload.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds 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.abiquo.binders.cloud;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import org.jclouds.http.HttpRequest;
-import org.jclouds.rest.binders.BindToXMLPayload;
-import org.jclouds.xml.XMLParser;
-
-import com.abiquo.model.enumerator.NetworkType;
-import com.abiquo.model.rest.RESTLink;
-import com.abiquo.model.transport.LinksDto;
-import com.abiquo.server.core.infrastructure.network.VLANNetworkDto;
-
-/**
- * Bind the link reference to an {@link AbstractIpDto} object into the payload.
- *
- * @author Ignasi Barrera
- */
-@Singleton
-public class BindUnmanagedIpRefToPayload extends BindToXMLPayload {
- @Inject
- public BindUnmanagedIpRefToPayload(final XMLParser xmlParser) {
- super(xmlParser);
- }
-
- @Override
- public R bindToRequest(final R request, final Object input) {
- checkArgument(checkNotNull(input, "input") instanceof VLANNetworkDto,
- "this binder is only valid for VLANNetworkDto objects");
-
- VLANNetworkDto network = (VLANNetworkDto) input;
- checkArgument(network.getType() == NetworkType.UNMANAGED, "this binder is only valid for UNMANAGED networks");
-
- RESTLink ipsLink = checkNotNull(network.searchLink("ips"), "VLANNetworkDto must have an ips link");
-
- LinksDto refs = new LinksDto();
- refs.addLink(new RESTLink("unmanagedip", ipsLink.getHref()));
-
- return super.bindToRequest(request, refs);
- }
-}
diff --git a/labs/abiquo/src/main/java/org/jclouds/abiquo/binders/cloud/BindVirtualDatacenterRefToPayload.java b/labs/abiquo/src/main/java/org/jclouds/abiquo/binders/cloud/BindVirtualDatacenterRefToPayload.java
deleted file mode 100644
index daca344376..0000000000
--- a/labs/abiquo/src/main/java/org/jclouds/abiquo/binders/cloud/BindVirtualDatacenterRefToPayload.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds 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.abiquo.binders.cloud;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import org.jclouds.http.HttpRequest;
-import org.jclouds.rest.binders.BindToXMLPayload;
-import org.jclouds.xml.XMLParser;
-
-import com.abiquo.model.rest.RESTLink;
-import com.abiquo.model.transport.LinksDto;
-import com.abiquo.server.core.cloud.VirtualDatacenterDto;
-
-/**
- * Bind multiple {@link VolumeManagementDto} objects to the payload of the
- * request as a list of links.
- *
- * @author Ignasi Barrera
- */
-@Singleton
-public class BindVirtualDatacenterRefToPayload extends BindToXMLPayload {
- @Inject
- public BindVirtualDatacenterRefToPayload(final XMLParser xmlParser) {
- super(xmlParser);
- }
-
- @Override
- public R bindToRequest(final R request, final Object input) {
- checkArgument(checkNotNull(input, "input") instanceof VirtualDatacenterDto,
- "this binder is only valid for VirtualDatacenterDto objects");
-
- VirtualDatacenterDto vdc = (VirtualDatacenterDto) input;
- RESTLink editLink = checkNotNull(vdc.getEditLink(), "VirtualDatacenterDto must have an edit link");
- LinksDto refs = new LinksDto();
- refs.addLink(new RESTLink("virtualdatacenter", editLink.getHref()));
-
- return super.bindToRequest(request, refs);
- }
-
-}
diff --git a/labs/abiquo/src/main/java/org/jclouds/abiquo/binders/cloud/BindVolumeRefsToPayload.java b/labs/abiquo/src/main/java/org/jclouds/abiquo/binders/cloud/BindVolumeRefsToPayload.java
deleted file mode 100644
index fcecff5565..0000000000
--- a/labs/abiquo/src/main/java/org/jclouds/abiquo/binders/cloud/BindVolumeRefsToPayload.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds 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.abiquo.binders.cloud;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import org.jclouds.abiquo.binders.BindRefsToPayload;
-import org.jclouds.xml.XMLParser;
-
-/**
- * Bind multiple {@link VolumeManagementDto} objects to the payload of the
- * request as a list of links.
- *
- * @author Ignasi Barrera
- */
-@Singleton
-public class BindVolumeRefsToPayload extends BindRefsToPayload {
- @Inject
- public BindVolumeRefsToPayload(final XMLParser xmlParser) {
- super(xmlParser);
- }
-
- @Override
- protected String getRelToUse(final Object input) {
- return "volume";
- }
-
-}
diff --git a/labs/abiquo/src/main/java/org/jclouds/abiquo/binders/infrastructure/AppendMachineIdToPath.java b/labs/abiquo/src/main/java/org/jclouds/abiquo/binders/infrastructure/AppendMachineIdToPath.java
deleted file mode 100644
index 1ca5f91568..0000000000
--- a/labs/abiquo/src/main/java/org/jclouds/abiquo/binders/infrastructure/AppendMachineIdToPath.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds 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.abiquo.binders.infrastructure;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import org.jclouds.abiquo.binders.AppendToPath;
-import org.jclouds.abiquo.functions.infrastructure.ParseMachineId;
-import org.jclouds.http.HttpRequest;
-
-/**
- * Append the {@link Machine} id to the request URI.
- *
- * @author Ignasi Barrera
- */
-@Singleton
-public class AppendMachineIdToPath extends AppendToPath {
- private ParseMachineId parser;
-
- @Inject
- public AppendMachineIdToPath(final ParseMachineId parser) {
- super();
- this.parser = parser;
- }
-
- @Override
- protected String getValue(final R request, final Object input) {
- return parser.apply(input);
- }
-
-}
diff --git a/labs/abiquo/src/main/java/org/jclouds/abiquo/binders/infrastructure/AppendRemoteServiceTypeToPath.java b/labs/abiquo/src/main/java/org/jclouds/abiquo/binders/infrastructure/AppendRemoteServiceTypeToPath.java
deleted file mode 100644
index 77cd04de57..0000000000
--- a/labs/abiquo/src/main/java/org/jclouds/abiquo/binders/infrastructure/AppendRemoteServiceTypeToPath.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds 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.abiquo.binders.infrastructure;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import org.jclouds.abiquo.binders.AppendToPath;
-import org.jclouds.abiquo.functions.infrastructure.ParseRemoteServiceType;
-import org.jclouds.http.HttpRequest;
-
-/**
- * Append the {@link RemoteServiceType} service to the request URI.
- *
- * This method assumes that the input object is a {@link RemoteServiceType}
- * enumeration.
- *
- * @author Ignasi Barrera
- */
-@Singleton
-public class AppendRemoteServiceTypeToPath extends AppendToPath {
- private ParseRemoteServiceType parser;
-
- @Inject
- public AppendRemoteServiceTypeToPath(final ParseRemoteServiceType parser) {
- super();
- this.parser = parser;
- }
-
- @Override
- protected String getValue(final R request, final Object input) {
- return parser.apply(input);
- }
-
-}
diff --git a/labs/abiquo/src/main/java/org/jclouds/abiquo/binders/infrastructure/BindSupportedDevicesLinkToPath.java b/labs/abiquo/src/main/java/org/jclouds/abiquo/binders/infrastructure/BindSupportedDevicesLinkToPath.java
deleted file mode 100644
index e35dff8c23..0000000000
--- a/labs/abiquo/src/main/java/org/jclouds/abiquo/binders/infrastructure/BindSupportedDevicesLinkToPath.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds 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.abiquo.binders.infrastructure;
-
-import javax.inject.Singleton;
-
-import org.jclouds.abiquo.binders.BindToPath;
-import org.jclouds.rest.internal.GeneratedHttpRequest;
-
-/**
- * Binds the given link to the uri appends the supported devices action path.
- *
- * @author Ignasi Barrera
- */
-@Singleton
-public class BindSupportedDevicesLinkToPath extends BindToPath {
-
- @Override
- protected String getNewEndpoint(final GeneratedHttpRequest gRequest, final Object input) {
- return super.getNewEndpoint(gRequest, input) + "/action/supported";
- }
-
-}
diff --git a/labs/abiquo/src/main/java/org/jclouds/abiquo/binders/infrastructure/ucs/BindLogicServerParameters.java b/labs/abiquo/src/main/java/org/jclouds/abiquo/binders/infrastructure/ucs/BindLogicServerParameters.java
deleted file mode 100644
index dc819c4c53..0000000000
--- a/labs/abiquo/src/main/java/org/jclouds/abiquo/binders/infrastructure/ucs/BindLogicServerParameters.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds 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.abiquo.binders.infrastructure.ucs;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import javax.inject.Singleton;
-
-import org.jclouds.http.HttpRequest;
-import org.jclouds.rest.Binder;
-
-import com.abiquo.server.core.infrastructure.LogicServerDto;
-
-/**
- * Binds logic server query parameters to request. This method assumes that the
- * input object is a {@link LogicServerDto}.
- *
- * @author Francesc Montserrat
- * @author Ignasi Barrera
- */
-@Singleton
-public class BindLogicServerParameters implements Binder {
- @SuppressWarnings("unchecked")
- @Override
- public R bindToRequest(final R request, final Object input) {
- checkArgument(checkNotNull(input, "input") instanceof LogicServerDto,
- "this binder is only valid for LogicServerDto objects");
-
- LogicServerDto server = (LogicServerDto) input;
-
- return (R) request.toBuilder().addQueryParam("lsName", checkNotNull(server.getName(), "server.name")).build();
- }
-}
diff --git a/labs/abiquo/src/main/java/org/jclouds/abiquo/binders/infrastructure/ucs/BindOrganizationParameters.java b/labs/abiquo/src/main/java/org/jclouds/abiquo/binders/infrastructure/ucs/BindOrganizationParameters.java
deleted file mode 100644
index d63214e1ac..0000000000
--- a/labs/abiquo/src/main/java/org/jclouds/abiquo/binders/infrastructure/ucs/BindOrganizationParameters.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds 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.abiquo.binders.infrastructure.ucs;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import javax.inject.Singleton;
-
-import org.jclouds.http.HttpRequest;
-import org.jclouds.rest.Binder;
-
-import com.abiquo.server.core.infrastructure.OrganizationDto;
-
-/**
- * Binds organization query parameters to request. This method assumes that the
- * input object is a {@link OrganizationDto}.
- *
- * @author Francesc Montserrat
- * @author Ignasi Barrera
- */
-@Singleton
-public class BindOrganizationParameters implements Binder {
-
- @SuppressWarnings("unchecked")
- @Override
- public R bindToRequest(final R request, final Object input) {
- checkArgument(checkNotNull(input, "input") instanceof OrganizationDto,
- "this binder is only valid for OrganizationDto objects");
-
- OrganizationDto org = (OrganizationDto) input;
-
- return (R) request.toBuilder().addQueryParam("org", checkNotNull(org.getDn(), "org.dn")).build();
- }
-}
diff --git a/labs/abiquo/src/main/java/org/jclouds/abiquo/compute/config/AbiquoComputeServiceContextModule.java b/labs/abiquo/src/main/java/org/jclouds/abiquo/compute/config/AbiquoComputeServiceContextModule.java
deleted file mode 100644
index fe72c8d88e..0000000000
--- a/labs/abiquo/src/main/java/org/jclouds/abiquo/compute/config/AbiquoComputeServiceContextModule.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds 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.abiquo.compute.config;
-
-import org.jclouds.abiquo.compute.functions.DatacenterToLocation;
-import org.jclouds.abiquo.compute.functions.VirtualDatacenterToLocation;
-import org.jclouds.abiquo.compute.functions.VirtualMachineTemplateToImage;
-import org.jclouds.abiquo.compute.functions.VirtualMachineTemplateInVirtualDatacenterToHardware;
-import org.jclouds.abiquo.compute.functions.VirtualMachineToNodeMetadata;
-import org.jclouds.abiquo.compute.options.AbiquoTemplateOptions;
-import org.jclouds.abiquo.compute.strategy.AbiquoComputeServiceAdapter;
-import org.jclouds.abiquo.domain.cloud.VirtualDatacenter;
-import org.jclouds.abiquo.domain.cloud.VirtualMachine;
-import org.jclouds.abiquo.domain.cloud.VirtualMachineTemplate;
-import org.jclouds.abiquo.domain.cloud.VirtualMachineTemplateInVirtualDatacenter;
-import org.jclouds.abiquo.domain.infrastructure.Datacenter;
-import org.jclouds.compute.ComputeServiceAdapter;
-import org.jclouds.compute.config.ComputeServiceAdapterContextModule;
-import org.jclouds.compute.domain.Hardware;
-import org.jclouds.compute.domain.Image;
-import org.jclouds.compute.domain.NodeMetadata;
-import org.jclouds.compute.options.TemplateOptions;
-import org.jclouds.domain.Location;
-import org.jclouds.location.suppliers.ImplicitLocationSupplier;
-import org.jclouds.location.suppliers.implicit.OnlyLocationOrFirstZone;
-
-import com.google.common.base.Function;
-import com.google.inject.Scopes;
-import com.google.inject.TypeLiteral;
-
-/**
- * Abiquo Compute service configuration module.
- *
- * @author Ignasi Barrera
- */
-public class AbiquoComputeServiceContextModule
- extends
- ComputeServiceAdapterContextModule {
-
- @Override
- protected void configure() {
- super.configure();
- bind(
- new TypeLiteral>() {
- }).to(AbiquoComputeServiceAdapter.class);
- bind(new TypeLiteral>() {
- }).to(VirtualMachineToNodeMetadata.class);
- bind(new TypeLiteral>() {
- }).to(VirtualMachineTemplateToImage.class);
- bind(new TypeLiteral>() {
- }).to(VirtualMachineTemplateInVirtualDatacenterToHardware.class);
- bind(new TypeLiteral>() {
- }).to(DatacenterToLocation.class);
- bind(new TypeLiteral>() {
- }).to(VirtualDatacenterToLocation.class);
- bind(ImplicitLocationSupplier.class).to(OnlyLocationOrFirstZone.class).in(Scopes.SINGLETON);
- bind(TemplateOptions.class).to(AbiquoTemplateOptions.class);
- install(new LocationsFromComputeServiceAdapterModule() {
- });
- }
-
-}
diff --git a/labs/abiquo/src/main/java/org/jclouds/abiquo/compute/functions/DatacenterToLocation.java b/labs/abiquo/src/main/java/org/jclouds/abiquo/compute/functions/DatacenterToLocation.java
deleted file mode 100644
index 73e0ec53ff..0000000000
--- a/labs/abiquo/src/main/java/org/jclouds/abiquo/compute/functions/DatacenterToLocation.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds 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.abiquo.compute.functions;
-
-import javax.inject.Singleton;
-
-import org.jclouds.abiquo.domain.infrastructure.Datacenter;
-import org.jclouds.domain.Location;
-import org.jclouds.domain.LocationBuilder;
-import org.jclouds.domain.LocationScope;
-
-import com.google.common.base.Function;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableSet;
-
-/**
- * Converts a {@link Datacenter} to a {@link Location} one.
- *
- * Physical datacenters will be considered regions.
- *
- * @author Ignasi Barrera
- */
-@Singleton
-public class DatacenterToLocation implements Function {
-
- @Override
- public Location apply(final Datacenter datacenter) {
- LocationBuilder builder = new LocationBuilder();
- builder.id(datacenter.getId().toString());
- builder.description(datacenter.getName() + " [" + datacenter.getLocation() + "]");
- builder.metadata(ImmutableMap. of());
- builder.scope(LocationScope.REGION);
- builder.iso3166Codes(ImmutableSet. of());
-
- builder.parent(new LocationBuilder().scope(LocationScope.PROVIDER).id("abiquo").description("abiquo").build());
-
- return builder.build();
- }
-}
diff --git a/labs/abiquo/src/main/java/org/jclouds/abiquo/compute/functions/VirtualDatacenterToLocation.java b/labs/abiquo/src/main/java/org/jclouds/abiquo/compute/functions/VirtualDatacenterToLocation.java
deleted file mode 100644
index aca53ea8dd..0000000000
--- a/labs/abiquo/src/main/java/org/jclouds/abiquo/compute/functions/VirtualDatacenterToLocation.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds 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.abiquo.compute.functions;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.Map;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import org.jclouds.abiquo.domain.cloud.VirtualDatacenter;
-import org.jclouds.abiquo.domain.infrastructure.Datacenter;
-import org.jclouds.abiquo.reference.rest.ParentLinkName;
-import org.jclouds.collect.Memoized;
-import org.jclouds.domain.Location;
-import org.jclouds.domain.LocationBuilder;
-import org.jclouds.domain.LocationScope;
-
-import com.google.common.base.Function;
-import com.google.common.base.Supplier;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableSet;
-
-/**
- * Converts a {@link VirtualDatacenter} to a {@link Location} one.
- *
- * Virtual datacenters will be considered zones, since images will be deployed
- * in a virtual datacenter. Each zone will be scoped into a physical datacenter
- * (region).
- *
- * @author Ignasi Barrera
- */
-@Singleton
-public class VirtualDatacenterToLocation implements Function {
- private final Function datacenterToLocation;
-
- private final Supplier> regionMap;
-
- @Inject
- public VirtualDatacenterToLocation(final Function datacenterToLocation,
- @Memoized final Supplier> regionMap) {
- this.datacenterToLocation = checkNotNull(datacenterToLocation, "datacenterToLocation");
- this.regionMap = checkNotNull(regionMap, "regionMap");
- }
-
- @Override
- public Location apply(final VirtualDatacenter vdc) {
- LocationBuilder builder = new LocationBuilder();
- builder.id(vdc.getId().toString());
- builder.description(vdc.getName());
- builder.metadata(ImmutableMap. of());
- builder.scope(LocationScope.ZONE);
- builder.iso3166Codes(ImmutableSet. of());
-
- Datacenter parent = regionMap.get().get(vdc.unwrap().getIdFromLink(ParentLinkName.DATACENTER));
- builder.parent(datacenterToLocation.apply(parent));
-
- return builder.build();
- }
-}
diff --git a/labs/abiquo/src/main/java/org/jclouds/abiquo/compute/functions/VirtualMachineStateToNodeState.java b/labs/abiquo/src/main/java/org/jclouds/abiquo/compute/functions/VirtualMachineStateToNodeState.java
deleted file mode 100644
index 2ab7e4c272..0000000000
--- a/labs/abiquo/src/main/java/org/jclouds/abiquo/compute/functions/VirtualMachineStateToNodeState.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds 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.abiquo.compute.functions;
-
-import javax.inject.Singleton;
-
-import org.jclouds.compute.domain.NodeMetadata.Status;
-
-import com.abiquo.server.core.cloud.VirtualMachineState;
-import com.google.common.base.Function;
-
-/**
- * Converts a {@link VirtualMachineState} object to a {@link Status} one.
- *
- * @author Ignasi Barrera
- */
-@Singleton
-public class VirtualMachineStateToNodeState implements Function {
-
- @Override
- public Status apply(final VirtualMachineState state) {
- switch (state) {
- case ALLOCATED:
- case LOCKED:
- case CONFIGURED:
- case NOT_ALLOCATED:
- return Status.PENDING;
- case ON:
- return Status.RUNNING;
- case OFF:
- case PAUSED:
- return Status.SUSPENDED;
- case UNKNOWN:
- default:
- return Status.UNRECOGNIZED;
- }
- }
-}
diff --git a/labs/abiquo/src/main/java/org/jclouds/abiquo/compute/functions/VirtualMachineTemplateInVirtualDatacenterToHardware.java b/labs/abiquo/src/main/java/org/jclouds/abiquo/compute/functions/VirtualMachineTemplateInVirtualDatacenterToHardware.java
deleted file mode 100644
index c5338d2bd3..0000000000
--- a/labs/abiquo/src/main/java/org/jclouds/abiquo/compute/functions/VirtualMachineTemplateInVirtualDatacenterToHardware.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds 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.abiquo.compute.functions;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import org.jclouds.abiquo.domain.cloud.VirtualDatacenter;
-import org.jclouds.abiquo.domain.cloud.VirtualMachineTemplate;
-import org.jclouds.abiquo.domain.cloud.VirtualMachineTemplateInVirtualDatacenter;
-import org.jclouds.compute.domain.Hardware;
-import org.jclouds.compute.domain.HardwareBuilder;
-import org.jclouds.compute.domain.Processor;
-import org.jclouds.compute.domain.Volume;
-import org.jclouds.compute.domain.VolumeBuilder;
-import org.jclouds.compute.predicates.ImagePredicates;
-import org.jclouds.domain.Location;
-
-import com.google.common.base.Function;
-
-/**
- * Transforms a {@link VirtualMachineTemplate} into an {@link Hardware}.
- *
- * Each {@link Image} ({@link VirtualMachineTemplate}) will have one
- * {@link Hardware} entity for each zone (scoped to a virtualization technology)
- * supported by the image.
- *
- * @author Ignasi Barrera
- */
-@Singleton
-public class VirtualMachineTemplateInVirtualDatacenterToHardware implements
- Function {
- /** The default core speed, 2.0Ghz. */
- public static final double DEFAULT_CORE_SPEED = 2.0;
-
- private final Function virtualDatacenterToLocation;
-
- @Inject
- public VirtualMachineTemplateInVirtualDatacenterToHardware(
- final Function virtualDatacenterToLocation) {
- this.virtualDatacenterToLocation = checkNotNull(virtualDatacenterToLocation, "virtualDatacenterToLocation");
- }
-
- @Override
- public Hardware apply(final VirtualMachineTemplateInVirtualDatacenter templateInVirtualDatacenter) {
- VirtualMachineTemplate template = templateInVirtualDatacenter.getTemplate();
- VirtualDatacenter virtualDatacenter = templateInVirtualDatacenter.getZone();
-
- HardwareBuilder builder = new HardwareBuilder();
- builder.providerId(template.getId().toString());
- builder.id(template.getId().toString() + "/" + virtualDatacenter.getId());
- builder.uri(template.getURI());
-
- builder.name(template.getName());
- builder.processor(new Processor(template.getCpuRequired(), DEFAULT_CORE_SPEED));
- builder.ram(template.getRamRequired());
-
- // Location information
- builder.location(virtualDatacenterToLocation.apply(virtualDatacenter));
- builder.hypervisor(virtualDatacenter.getHypervisorType().name());
- builder.supportsImage(ImagePredicates.idEquals(template.getId().toString()));
-
- VolumeBuilder volumeBuilder = new VolumeBuilder();
- volumeBuilder.bootDevice(true);
- volumeBuilder.size(toGb(template.getHdRequired()));
- volumeBuilder.type(Volume.Type.LOCAL);
- volumeBuilder.durable(false);
- builder.volume(volumeBuilder.build());
-
- return builder.build();
- }
-
- private static float toGb(final long bytes) {
- return bytes / (float) (1024 * 1024 * 1024);
- }
-}
diff --git a/labs/abiquo/src/main/java/org/jclouds/abiquo/compute/functions/VirtualMachineTemplateToImage.java b/labs/abiquo/src/main/java/org/jclouds/abiquo/compute/functions/VirtualMachineTemplateToImage.java
deleted file mode 100644
index 9cf7a0ff22..0000000000
--- a/labs/abiquo/src/main/java/org/jclouds/abiquo/compute/functions/VirtualMachineTemplateToImage.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds 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.abiquo.compute.functions;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.net.URI;
-import java.util.Map;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import org.jclouds.abiquo.domain.cloud.VirtualMachineTemplate;
-import org.jclouds.abiquo.domain.infrastructure.Datacenter;
-import org.jclouds.abiquo.reference.rest.ParentLinkName;
-import org.jclouds.collect.Memoized;
-import org.jclouds.compute.domain.Image;
-import org.jclouds.compute.domain.Image.Status;
-import org.jclouds.compute.domain.ImageBuilder;
-import org.jclouds.compute.domain.OperatingSystem;
-import org.jclouds.domain.Location;
-
-import com.abiquo.model.rest.RESTLink;
-import com.google.common.base.Function;
-import com.google.common.base.Supplier;
-
-/**
- * Transforms a {@link VirtualMachineTemplate} into an {@link Image}.
- *
- * Images are scoped to a region (physical datacenter).
- *
- * @author Ignasi Barrera
- */
-@Singleton
-public class VirtualMachineTemplateToImage implements Function {
- private final Function datacenterToLocation;
-
- private final Supplier> regionMap;
-
- @Inject
- public VirtualMachineTemplateToImage(final Function datacenterToLocation,
- @Memoized final Supplier> regionMap) {
- this.datacenterToLocation = checkNotNull(datacenterToLocation, "datacenterToLocation");
- this.regionMap = checkNotNull(regionMap, "regionMap");
- }
-
- @Override
- public Image apply(final VirtualMachineTemplate template) {
- ImageBuilder builder = new ImageBuilder();
- builder.ids(template.getId().toString());
- builder.name(template.getName());
- builder.description(template.getDescription());
-
- // Location information
- Datacenter region = regionMap.get().get(template.unwrap().getIdFromLink(ParentLinkName.DATACENTER));
- builder.location(datacenterToLocation.apply(region));
-
- // Only conversions have a status
- builder.status(Status.AVAILABLE);
- builder.backendStatus(Status.AVAILABLE.name()); // Abiquo images do not
- // have a status
-
- RESTLink downloadLink = template.unwrap().searchLink("diskfile");
- builder.uri(downloadLink == null ? null : URI.create(downloadLink.getHref()));
-
- // TODO: Operating system not implemented in Abiquo Templates
- // TODO: Image credentials still not present in Abiquo template metadata
- // Will be added in Abiquo 2.4:
- // http://jira.abiquo.com/browse/ABICLOUDPREMIUM-3647
- builder.operatingSystem(OperatingSystem.builder().description(template.getName()).build());
-
- return builder.build();
- }
-}
diff --git a/labs/abiquo/src/main/java/org/jclouds/abiquo/compute/functions/VirtualMachineToNodeMetadata.java b/labs/abiquo/src/main/java/org/jclouds/abiquo/compute/functions/VirtualMachineToNodeMetadata.java
deleted file mode 100644
index 04fd623415..0000000000
--- a/labs/abiquo/src/main/java/org/jclouds/abiquo/compute/functions/VirtualMachineToNodeMetadata.java
+++ /dev/null
@@ -1,141 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds 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.abiquo.compute.functions;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.collect.Iterables.filter;
-import static com.google.common.collect.Iterables.transform;
-
-import java.util.List;
-
-import javax.annotation.Resource;
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import org.jclouds.abiquo.domain.cloud.VirtualDatacenter;
-import org.jclouds.abiquo.domain.cloud.VirtualMachine;
-import org.jclouds.abiquo.domain.cloud.VirtualMachineTemplate;
-import org.jclouds.abiquo.domain.cloud.VirtualMachineTemplateInVirtualDatacenter;
-import org.jclouds.abiquo.domain.network.Ip;
-import org.jclouds.abiquo.domain.network.PrivateIp;
-import org.jclouds.compute.domain.Hardware;
-import org.jclouds.compute.domain.HardwareBuilder;
-import org.jclouds.compute.domain.Image;
-import org.jclouds.compute.domain.NodeMetadata;
-import org.jclouds.compute.domain.NodeMetadataBuilder;
-import org.jclouds.compute.domain.Processor;
-import org.jclouds.domain.Location;
-import org.jclouds.logging.Logger;
-
-import com.abiquo.server.core.cloud.VirtualMachineState;
-import com.google.common.base.Function;
-import com.google.common.base.Predicates;
-import com.google.common.collect.Lists;
-
-/**
- * Links a {@link VirtualMachine} object to a {@link NodeMetadata} one.
- *
- * @author Ignasi Barrera
- */
-@Singleton
-public class VirtualMachineToNodeMetadata implements Function {
- @Resource
- protected Logger logger = Logger.NULL;
-
- private final VirtualMachineTemplateToImage virtualMachineTemplateToImage;
-
- private final VirtualMachineTemplateInVirtualDatacenterToHardware virtualMachineTemplateToHardware;
-
- private final VirtualMachineStateToNodeState virtualMachineStateToNodeState;
-
- private final Function virtualDatacenterToLocation;
-
- @Inject
- public VirtualMachineToNodeMetadata(final VirtualMachineTemplateToImage virtualMachineTemplateToImage,
- final VirtualMachineTemplateInVirtualDatacenterToHardware virtualMachineTemplateToHardware,
- final VirtualMachineStateToNodeState virtualMachineStateToNodeState,
- final Function virtualDatacenterToLocation) {
- this.virtualMachineTemplateToImage = checkNotNull(virtualMachineTemplateToImage, "virtualMachineTemplateToImage");
- this.virtualMachineTemplateToHardware = checkNotNull(virtualMachineTemplateToHardware,
- "virtualMachineTemplateToHardware");
- this.virtualMachineStateToNodeState = checkNotNull(virtualMachineStateToNodeState,
- "virtualMachineStateToNodeState");
- this.virtualDatacenterToLocation = checkNotNull(virtualDatacenterToLocation, "virtualDatacenterToLocation");
- }
-
- @Override
- public NodeMetadata apply(final VirtualMachine vm) {
- NodeMetadataBuilder builder = new NodeMetadataBuilder();
- builder.ids(vm.getId().toString());
- builder.uri(vm.getURI());
- builder.name(vm.getNameLabel());
- builder.group(vm.getVirtualAppliance().getName());
-
- // TODO: Node credentials still not present in Abiquo template metadata
- // Will be added in Abiquo 2.4:
- // http://jira.abiquo.com/browse/ABICLOUDPREMIUM-3647
-
- // Location details
- VirtualDatacenter vdc = vm.getVirtualDatacenter();
- builder.location(virtualDatacenterToLocation.apply(vdc));
-
- // Image details
- VirtualMachineTemplate template = vm.getTemplate();
- Image image = virtualMachineTemplateToImage.apply(template);
- builder.imageId(image.getId().toString());
- builder.operatingSystem(image.getOperatingSystem());
-
- // Hardware details
- Hardware defaultHardware = virtualMachineTemplateToHardware.apply(new VirtualMachineTemplateInVirtualDatacenter(
- template, vdc));
-
- Hardware hardware = HardwareBuilder
- .fromHardware(defaultHardware)
- .ram(vm.getRam())
- .processors(
- Lists.newArrayList(new Processor(vm.getCpu(),
- VirtualMachineTemplateInVirtualDatacenterToHardware.DEFAULT_CORE_SPEED))) //
- .build();
-
- builder.hardware(hardware);
-
- // Networking configuration
- List> nics = vm.listAttachedNics();
- builder.privateAddresses(ips(filter(nics, Predicates.instanceOf(PrivateIp.class))));
- builder.publicAddresses(ips(filter(nics, Predicates.not(Predicates.instanceOf(PrivateIp.class)))));
-
- // Node state
- VirtualMachineState state = vm.getState();
- builder.status(virtualMachineStateToNodeState.apply(state));
- builder.backendStatus(state.name());
-
- return builder.build();
- }
-
- private static Iterable ips(final Iterable> nics) {
- return transform(nics, new Function, String>() {
- @Override
- public String apply(final Ip, ?> nic) {
- return nic.getIp();
- }
- });
- }
-
-}
diff --git a/labs/abiquo/src/main/java/org/jclouds/abiquo/compute/options/AbiquoTemplateOptions.java b/labs/abiquo/src/main/java/org/jclouds/abiquo/compute/options/AbiquoTemplateOptions.java
deleted file mode 100644
index 2bc7b30411..0000000000
--- a/labs/abiquo/src/main/java/org/jclouds/abiquo/compute/options/AbiquoTemplateOptions.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds 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.abiquo.compute.options;
-
-import org.jclouds.compute.options.TemplateOptions;
-
-/**
- * Contains options supported by the
- * {@link ComputeService#createNodesInGroup(String, int, TemplateOptions)} and
- * {@link ComputeService#createNodesInGroup(String, int, TemplateOptions)}
- * operations on the Abiquo provider.
- *
- * @author Ignasi Barrera
- */
-public class AbiquoTemplateOptions extends TemplateOptions implements Cloneable {
- public static final AbiquoTemplateOptions NONE = new AbiquoTemplateOptions();
-
- private Integer overrideCores;
-
- private Integer overrideRam;
-
- private String vncPassword;
-
- @Override
- public TemplateOptions clone() {
- AbiquoTemplateOptions options = new AbiquoTemplateOptions();
- copyTo(options);
- return options;
- }
-
- @Override
- public void copyTo(final TemplateOptions to) {
- super.copyTo(to);
- if (to instanceof AbiquoTemplateOptions) {
- AbiquoTemplateOptions options = AbiquoTemplateOptions.class.cast(to);
- options.overrideCores(overrideCores);
- options.overrideRam(overrideRam);
- options.vncPassword(vncPassword);
- }
- }
-
- /**
- * Override the number of cores set by the hardware profile.
- *
- * @return The template options with the number of cores.
- */
- public AbiquoTemplateOptions overrideCores(final Integer overrideCores) {
- this.overrideCores = overrideCores;
- return this;
- }
-
- public Integer getOverrideCores() {
- return overrideCores;
- }
-
- /**
- * Override the amount of ram set by the hardware profile.
- *
- * @return The template options with the amount of ram.
- */
- public AbiquoTemplateOptions overrideRam(final Integer overrideRam) {
- this.overrideRam = overrideRam;
- return this;
- }
-
- public Integer getOverrideRam() {
- return overrideRam;
- }
-
- /**
- * Set the VNC password to access the virtual machine.
- *
- * By default virtual machines does not have VNC access password protected.
- *
- * @return The template options with the VNC password.
- */
- public AbiquoTemplateOptions vncPassword(final String vncPassword) {
- this.vncPassword = vncPassword;
- return this;
- }
-
- public String getVncPassword() {
- return vncPassword;
- }
-
- public static class Builder {
- /**
- * @see AbiquoTemplateOptions#overrideCores(int)
- */
- public static AbiquoTemplateOptions overrideCores(final Integer overrideCores) {
- AbiquoTemplateOptions options = new AbiquoTemplateOptions();
- return options.overrideCores(overrideCores);
- }
-
- /**
- * @see AbiquoTemplateOptions#overrideRam(int)
- */
- public static AbiquoTemplateOptions overrideRam(final Integer overrideRam) {
- AbiquoTemplateOptions options = new AbiquoTemplateOptions();
- return options.overrideRam(overrideRam);
- }
-
- /**
- * @see AbiquoTemplateOptions#vncPassword(String)
- */
- public static AbiquoTemplateOptions vncPassword(final String vncPassword) {
- AbiquoTemplateOptions options = new AbiquoTemplateOptions();
- return options.vncPassword(vncPassword);
- }
- }
-}
diff --git a/labs/abiquo/src/main/java/org/jclouds/abiquo/compute/strategy/AbiquoComputeServiceAdapter.java b/labs/abiquo/src/main/java/org/jclouds/abiquo/compute/strategy/AbiquoComputeServiceAdapter.java
deleted file mode 100644
index f7689cc751..0000000000
--- a/labs/abiquo/src/main/java/org/jclouds/abiquo/compute/strategy/AbiquoComputeServiceAdapter.java
+++ /dev/null
@@ -1,259 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds 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.abiquo.compute.strategy;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.collect.Iterables.concat;
-import static com.google.common.collect.Iterables.transform;
-
-import java.util.List;
-import java.util.Map;
-
-import javax.annotation.Resource;
-import javax.inject.Named;
-import javax.inject.Singleton;
-
-import org.jclouds.abiquo.AbiquoApi;
-import org.jclouds.abiquo.AbiquoAsyncApi;
-import org.jclouds.abiquo.compute.options.AbiquoTemplateOptions;
-import org.jclouds.abiquo.domain.cloud.VirtualAppliance;
-import org.jclouds.abiquo.domain.cloud.VirtualDatacenter;
-import org.jclouds.abiquo.domain.cloud.VirtualMachine;
-import org.jclouds.abiquo.domain.cloud.VirtualMachineTemplate;
-import org.jclouds.abiquo.domain.cloud.VirtualMachineTemplateInVirtualDatacenter;
-import org.jclouds.abiquo.domain.enterprise.Enterprise;
-import org.jclouds.abiquo.domain.infrastructure.Datacenter;
-import org.jclouds.abiquo.domain.network.PublicIp;
-import org.jclouds.abiquo.features.services.AdministrationService;
-import org.jclouds.abiquo.features.services.CloudService;
-import org.jclouds.abiquo.features.services.MonitoringService;
-import org.jclouds.abiquo.monitor.VirtualMachineMonitor;
-import org.jclouds.abiquo.predicates.cloud.VirtualAppliancePredicates;
-import org.jclouds.abiquo.predicates.cloud.VirtualMachineTemplatePredicates;
-import org.jclouds.abiquo.predicates.network.IpPredicates;
-import org.jclouds.collect.Memoized;
-import org.jclouds.compute.ComputeServiceAdapter;
-import org.jclouds.compute.domain.Hardware;
-import org.jclouds.compute.domain.Processor;
-import org.jclouds.compute.domain.Template;
-import org.jclouds.compute.reference.ComputeServiceConstants;
-import org.jclouds.logging.Logger;
-import org.jclouds.rest.RestContext;
-
-import com.abiquo.server.core.cloud.VirtualMachineState;
-import com.google.common.base.Function;
-import com.google.common.base.Predicate;
-import com.google.common.base.Supplier;
-import com.google.common.collect.Lists;
-import com.google.inject.Inject;
-
-/**
- * Defines the connection between the {@link AbiquoApi} implementation and the
- * jclouds {@link ComputeService}.
- *
- * @author Ignasi Barrera
- */
-@Singleton
-public class AbiquoComputeServiceAdapter
- implements
- ComputeServiceAdapter {
- @Resource
- @Named(ComputeServiceConstants.COMPUTE_LOGGER)
- protected Logger logger = Logger.NULL;
-
- private final RestContext context;
-
- private final AdministrationService adminService;
-
- private final CloudService cloudService;
-
- private final MonitoringService monitoringService;
-
- private final FindCompatibleVirtualDatacenters compatibleVirtualDatacenters;
-
- private final Supplier> regionMap;
-
- @Inject
- public AbiquoComputeServiceAdapter(final RestContext context,
- final AdministrationService adminService, final CloudService cloudService,
- final MonitoringService monitoringService,
- final FindCompatibleVirtualDatacenters compatibleVirtualDatacenters,
- @Memoized final Supplier> regionMap) {
- this.context = checkNotNull(context, "context");
- this.adminService = checkNotNull(adminService, "adminService");
- this.cloudService = checkNotNull(cloudService, "cloudService");
- this.monitoringService = checkNotNull(monitoringService, "monitoringService");
- this.compatibleVirtualDatacenters = checkNotNull(compatibleVirtualDatacenters, "compatibleVirtualDatacenters");
- this.regionMap = checkNotNull(regionMap, "regionMap");
- }
-
- @Override
- public NodeAndInitialCredentials createNodeWithGroupEncodedIntoName(final String tag,
- final String name, final Template template) {
- AbiquoTemplateOptions options = template.getOptions().as(AbiquoTemplateOptions.class);
- Enterprise enterprise = adminService.getCurrentEnterprise();
-
- // Get the region where the template is available
- Datacenter datacenter = regionMap.get().get(Integer.valueOf(template.getImage().getLocation().getId()));
-
- // Load the template
- VirtualMachineTemplate virtualMachineTemplate = enterprise.getTemplateInRepository(datacenter,
- Integer.valueOf(template.getImage().getId()));
-
- // Get the zone where the template will be deployed
- VirtualDatacenter vdc = cloudService.getVirtualDatacenter(Integer.valueOf(template.getHardware().getLocation()
- .getId()));
-
- // Load the virtual appliance or create it if it does not exist
- VirtualAppliance vapp = vdc.findVirtualAppliance(VirtualAppliancePredicates.name(tag));
- if (vapp == null) {
- vapp = VirtualAppliance.builder(context, vdc).name(tag).build();
- vapp.save();
- }
-
- Integer overrideCores = options.getOverrideCores();
- Integer overrideRam = options.getOverrideRam();
-
- VirtualMachine vm = VirtualMachine.builder(context, vapp, virtualMachineTemplate) //
- .nameLabel(name) //
- .cpu(overrideCores != null ? overrideCores : totalCores(template.getHardware())) //
- .ram(overrideRam != null ? overrideRam : template.getHardware().getRam()) //
- .password(options.getVncPassword()) // Can be null
- .build();
-
- vm.save();
-
- // Once the virtual machine is created, override the default network
- // settings if needed
- // If no public ip is available in the virtual datacenter, the virtual
- // machine will be assigned by default an ip address in the default
- // private VLAN for the virtual datacenter
- PublicIp publicIp = vdc.findPurchasedPublicIp(IpPredicates. notUsed());
- if (publicIp != null) {
- List ips = Lists.newArrayList();
- ips.add(publicIp);
- vm.setNics(ips);
- }
-
- // This is an async operation, but jclouds already waits until the node is
- // RUNNING, so there is no need to block here
- vm.deploy();
-
- return new NodeAndInitialCredentials(vm, vm.getId().toString(), null);
- }
-
- @Override
- public Iterable listHardwareProfiles() {
- // In Abiquo, images are scoped to a region (physical datacenter), and
- // hardware profiles are scoped to a zone (a virtual datacenter in the
- // region, with a concrete virtualization technology)
-
- return concat(transform(listImages(),
- new Function>() {
- @Override
- public Iterable apply(final VirtualMachineTemplate template) {
- Iterable compatibleZones = compatibleVirtualDatacenters.execute(template);
-
- return transform(compatibleZones,
- new Function() {
- @Override
- public VirtualMachineTemplateInVirtualDatacenter apply(final VirtualDatacenter vdc) {
- return new VirtualMachineTemplateInVirtualDatacenter(template, vdc);
- }
- });
- }
- }));
- }
-
- @Override
- public Iterable listImages() {
- Enterprise enterprise = adminService.getCurrentEnterprise();
- return enterprise.listTemplates();
- }
-
- @Override
- public VirtualMachineTemplate getImage(final String id) {
- Enterprise enterprise = adminService.getCurrentEnterprise();
- return enterprise.findTemplate(VirtualMachineTemplatePredicates.id(Integer.valueOf(id)));
- }
-
- @Override
- public Iterable listLocations() {
- return cloudService.listVirtualDatacenters();
- }
-
- @Override
- public VirtualMachine getNode(final String id) {
- return cloudService.findVirtualMachine(vmId(id));
- }
-
- @Override
- public void destroyNode(final String id) {
- VirtualMachine vm = getNode(id);
- vm.delete();
- }
-
- @Override
- public void rebootNode(final String id) {
- VirtualMachineMonitor monitor = monitoringService.getVirtualMachineMonitor();
- VirtualMachine vm = getNode(id);
- vm.reboot();
- monitor.awaitState(VirtualMachineState.ON, vm);
- }
-
- @Override
- public void resumeNode(final String id) {
- VirtualMachineMonitor monitor = monitoringService.getVirtualMachineMonitor();
- VirtualMachine vm = getNode(id);
- vm.changeState(VirtualMachineState.ON);
- monitor.awaitState(VirtualMachineState.ON, vm);
- }
-
- @Override
- public void suspendNode(final String id) {
- VirtualMachineMonitor monitor = monitoringService.getVirtualMachineMonitor();
- VirtualMachine vm = getNode(id);
- vm.changeState(VirtualMachineState.PAUSED);
- monitor.awaitState(VirtualMachineState.PAUSED, vm);
- }
-
- @Override
- public Iterable listNodes() {
- return cloudService.listVirtualMachines();
- }
-
- private static Predicate vmId(final String id) {
- return new Predicate() {
- @Override
- public boolean apply(final VirtualMachine input) {
- return Integer.valueOf(id).equals(input.getId());
- }
- };
- }
-
- private static int totalCores(final Hardware hardware) {
- double cores = 0;
- for (Processor processor : hardware.getProcessors()) {
- cores += processor.getCores();
- }
- return Double.valueOf(cores).intValue();
- }
-
-}
diff --git a/labs/abiquo/src/main/java/org/jclouds/abiquo/compute/strategy/FindCompatibleVirtualDatacenters.java b/labs/abiquo/src/main/java/org/jclouds/abiquo/compute/strategy/FindCompatibleVirtualDatacenters.java
deleted file mode 100644
index a80bb5391e..0000000000
--- a/labs/abiquo/src/main/java/org/jclouds/abiquo/compute/strategy/FindCompatibleVirtualDatacenters.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds 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.abiquo.compute.strategy;
-
-import org.jclouds.abiquo.compute.strategy.internal.FindCompatibleVirtualDatacentersForImageAndConversions;
-import org.jclouds.abiquo.domain.cloud.VirtualDatacenter;
-import org.jclouds.abiquo.domain.cloud.VirtualMachineTemplate;
-
-import com.google.inject.ImplementedBy;
-
-/**
- * Finds all virtual datacenters where the given {@link VirtualMachineTemplate}
- * can be deployed.
- *
- * @author Ignasi Barrera
- */
-@ImplementedBy(FindCompatibleVirtualDatacentersForImageAndConversions.class)
-public interface FindCompatibleVirtualDatacenters {
- Iterable execute(VirtualMachineTemplate template);
-}
diff --git a/labs/abiquo/src/main/java/org/jclouds/abiquo/compute/strategy/internal/FindCompatibleVirtualDatacentersForImageAndConversions.java b/labs/abiquo/src/main/java/org/jclouds/abiquo/compute/strategy/internal/FindCompatibleVirtualDatacentersForImageAndConversions.java
deleted file mode 100644
index d5eecd7b6e..0000000000
--- a/labs/abiquo/src/main/java/org/jclouds/abiquo/compute/strategy/internal/FindCompatibleVirtualDatacentersForImageAndConversions.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds 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.abiquo.compute.strategy.internal;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.collect.Iterables.filter;
-import static org.jclouds.abiquo.domain.DomainWrapper.wrap;
-import static org.jclouds.abiquo.predicates.cloud.VirtualDatacenterPredicates.compatibleWithTemplateOrConversions;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import org.jclouds.abiquo.AbiquoApi;
-import org.jclouds.abiquo.AbiquoAsyncApi;
-import org.jclouds.abiquo.compute.strategy.FindCompatibleVirtualDatacenters;
-import org.jclouds.abiquo.domain.cloud.VirtualDatacenter;
-import org.jclouds.abiquo.domain.cloud.VirtualMachineTemplate;
-import org.jclouds.abiquo.domain.infrastructure.Datacenter;
-import org.jclouds.abiquo.features.services.CloudService;
-import org.jclouds.abiquo.predicates.cloud.VirtualDatacenterPredicates;
-import org.jclouds.abiquo.reference.rest.ParentLinkName;
-import org.jclouds.rest.RestContext;
-
-import com.abiquo.server.core.infrastructure.DatacenterDto;
-
-/**
- * Default implementation for the {@link FindCompatibleVirtualDatacenters}
- * strategy.
- *
- * This strategy assumes that the datacenter will have different hypervisor
- * technologies, and images will have conversions to each of them.
- *
- * @author Ignasi Barrera
- */
-@Singleton
-public class FindCompatibleVirtualDatacentersForImageAndConversions implements FindCompatibleVirtualDatacenters {
- private final RestContext context;
-
- private final CloudService cloudService;
-
- @Inject
- public FindCompatibleVirtualDatacentersForImageAndConversions(final RestContext context,
- final CloudService cloudService) {
- this.context = checkNotNull(context, "context");
- this.cloudService = checkNotNull(cloudService, "cloudService");
- }
-
- @Override
- public Iterable execute(final VirtualMachineTemplate template) {
- // Build the transport object with the available information to avoid
- // making an unnecessary call to the target API (we only need the id of
- // the datacenter, and it is present in the link).
- DatacenterDto datacenterDto = new DatacenterDto();
- datacenterDto.setId(template.unwrap().getIdFromLink(ParentLinkName.DATACENTER_REPOSITORY));
- Datacenter datacenter = wrap(context, Datacenter.class, datacenterDto);
-
- Iterable vdcs = cloudService.listVirtualDatacenters(VirtualDatacenterPredicates
- .datacenter(datacenter));
-
- return filter(vdcs, compatibleWithTemplateOrConversions(template));
- }
-
-}
diff --git a/labs/abiquo/src/main/java/org/jclouds/abiquo/compute/strategy/internal/FindCompatibleVirtualDatacentersForImageBaseFormat.java b/labs/abiquo/src/main/java/org/jclouds/abiquo/compute/strategy/internal/FindCompatibleVirtualDatacentersForImageBaseFormat.java
deleted file mode 100644
index 862bb0bbd2..0000000000
--- a/labs/abiquo/src/main/java/org/jclouds/abiquo/compute/strategy/internal/FindCompatibleVirtualDatacentersForImageBaseFormat.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds 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.abiquo.compute.strategy.internal;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.collect.Iterables.filter;
-import static org.jclouds.abiquo.domain.DomainWrapper.wrap;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import org.jclouds.abiquo.AbiquoApi;
-import org.jclouds.abiquo.AbiquoAsyncApi;
-import org.jclouds.abiquo.compute.strategy.FindCompatibleVirtualDatacenters;
-import org.jclouds.abiquo.domain.cloud.VirtualDatacenter;
-import org.jclouds.abiquo.domain.cloud.VirtualMachineTemplate;
-import org.jclouds.abiquo.domain.infrastructure.Datacenter;
-import org.jclouds.abiquo.features.services.CloudService;
-import org.jclouds.abiquo.predicates.cloud.VirtualDatacenterPredicates;
-import org.jclouds.abiquo.reference.rest.ParentLinkName;
-import org.jclouds.rest.RestContext;
-
-import com.abiquo.model.enumerator.HypervisorType;
-import com.abiquo.server.core.infrastructure.DatacenterDto;
-import com.google.common.base.Predicate;
-
-/**
- * Implementation for the {@link FindCompatibleVirtualDatacenters} strategy to
- * be used in homogeneous datacenters.
- *
- * For providers that only have one hypervisor technology in the physical
- * datacenter and use compatible images, there is no need to check if the images
- * have conversions to other formats.
- *
- * This strategy will only consider the base disk format of the image.
- *
- * @author Ignasi Barrera
- */
-@Singleton
-public class FindCompatibleVirtualDatacentersForImageBaseFormat implements FindCompatibleVirtualDatacenters {
- private final RestContext context;
-
- private final CloudService cloudService;
-
- @Inject
- public FindCompatibleVirtualDatacentersForImageBaseFormat(final RestContext context,
- final CloudService cloudService) {
- this.context = checkNotNull(context, "context");
- this.cloudService = checkNotNull(cloudService, "cloudService");
- }
-
- @Override
- public Iterable execute(final VirtualMachineTemplate template) {
- // Build the transport object with the available information to avoid
- // making an unnecessary call to the target API (we only need the id of
- // the datacenter, and it is present in the link).
- DatacenterDto datacenterDto = new DatacenterDto();
- datacenterDto.setId(template.unwrap().getIdFromLink(ParentLinkName.DATACENTER_REPOSITORY));
- Datacenter datacenter = wrap(context, Datacenter.class, datacenterDto);
-
- Iterable vdcs = cloudService.listVirtualDatacenters(VirtualDatacenterPredicates
- .datacenter(datacenter));
-
- return filter(vdcs, new Predicate() {
- @Override
- public boolean apply(final VirtualDatacenter vdc) {
- HypervisorType type = vdc.getHypervisorType();
- return type.isCompatible(template.getDiskFormatType());
- }
- });
- }
-
-}
diff --git a/labs/abiquo/src/main/java/org/jclouds/abiquo/config/AbiquoEdition.java b/labs/abiquo/src/main/java/org/jclouds/abiquo/config/AbiquoEdition.java
deleted file mode 100644
index 158b0f5f60..0000000000
--- a/labs/abiquo/src/main/java/org/jclouds/abiquo/config/AbiquoEdition.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds 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.abiquo.config;
-
-/**
- * The Abiquo Edition (Community or Enterprise).
- *
- * @author Francesc Montserrat
- */
-public enum AbiquoEdition {
- ENTERPRISE, COMMUNITY;
-}
diff --git a/labs/abiquo/src/main/java/org/jclouds/abiquo/config/AbiquoProperties.java b/labs/abiquo/src/main/java/org/jclouds/abiquo/config/AbiquoProperties.java
deleted file mode 100644
index 1edb0ca0fa..0000000000
--- a/labs/abiquo/src/main/java/org/jclouds/abiquo/config/AbiquoProperties.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds 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.abiquo.config;
-
-/**
- * Configuration properties and constants used in Abiquo connections.
- *
- * @author Ignasi Barrera
- */
-public interface AbiquoProperties {
- /**
- * Boolean property indicating if the provided credential is an api token.
- *
- * Default value: false
- */
- public static final String CREDENTIAL_IS_TOKEN = "abiquo.credential-is-token";
-
- /**
- * The delay (in ms) used between requests by the {@link MonitoringService}
- * when monitoring asynchronous task state.
- *
- * Default value: 5000 ms
- */
- public static final String ASYNC_TASK_MONITOR_DELAY = "abiquo.monitor-delay";
-}
diff --git a/labs/abiquo/src/main/java/org/jclouds/abiquo/config/AbiquoRestClientModule.java b/labs/abiquo/src/main/java/org/jclouds/abiquo/config/AbiquoRestClientModule.java
deleted file mode 100644
index 3bbe2d5e39..0000000000
--- a/labs/abiquo/src/main/java/org/jclouds/abiquo/config/AbiquoRestClientModule.java
+++ /dev/null
@@ -1,173 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds 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.abiquo.config;
-
-import static org.jclouds.Constants.PROPERTY_SESSION_INTERVAL;
-import static org.jclouds.abiquo.domain.DomainWrapper.wrap;
-import static org.jclouds.rest.config.BinderUtils.bindHttpApi;
-
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicReference;
-
-import javax.inject.Named;
-
-import org.jclouds.abiquo.AbiquoApi;
-import org.jclouds.abiquo.AbiquoAsyncApi;
-import org.jclouds.abiquo.domain.enterprise.Enterprise;
-import org.jclouds.abiquo.domain.enterprise.User;
-import org.jclouds.abiquo.domain.infrastructure.Datacenter;
-import org.jclouds.abiquo.features.AdminApi;
-import org.jclouds.abiquo.features.AdminAsyncApi;
-import org.jclouds.abiquo.features.CloudApi;
-import org.jclouds.abiquo.features.CloudAsyncApi;
-import org.jclouds.abiquo.features.ConfigApi;
-import org.jclouds.abiquo.features.ConfigAsyncApi;
-import org.jclouds.abiquo.features.EnterpriseApi;
-import org.jclouds.abiquo.features.EnterpriseAsyncApi;
-import org.jclouds.abiquo.features.EventApi;
-import org.jclouds.abiquo.features.EventAsyncApi;
-import org.jclouds.abiquo.features.InfrastructureApi;
-import org.jclouds.abiquo.features.InfrastructureAsyncApi;
-import org.jclouds.abiquo.features.PricingApi;
-import org.jclouds.abiquo.features.PricingAsyncApi;
-import org.jclouds.abiquo.features.TaskApi;
-import org.jclouds.abiquo.features.TaskAsyncApi;
-import org.jclouds.abiquo.features.VirtualMachineTemplateApi;
-import org.jclouds.abiquo.features.VirtualMachineTemplateAsyncApi;
-import org.jclouds.abiquo.handlers.AbiquoErrorHandler;
-import org.jclouds.abiquo.rest.internal.AbiquoHttpAsyncClient;
-import org.jclouds.abiquo.rest.internal.AbiquoHttpClient;
-import org.jclouds.abiquo.rest.internal.ExtendedUtils;
-import org.jclouds.collect.Memoized;
-import org.jclouds.http.HttpErrorHandler;
-import org.jclouds.http.annotation.ClientError;
-import org.jclouds.http.annotation.Redirection;
-import org.jclouds.http.annotation.ServerError;
-import org.jclouds.rest.AuthorizationException;
-import org.jclouds.rest.ConfiguresRestClient;
-import org.jclouds.rest.RestContext;
-import org.jclouds.rest.Utils;
-import org.jclouds.rest.config.RestClientModule;
-import org.jclouds.rest.suppliers.MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier;
-
-import com.google.common.base.Function;
-import com.google.common.base.Supplier;
-import com.google.common.base.Suppliers;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Maps;
-import com.google.inject.Provides;
-import com.google.inject.Singleton;
-
-/**
- * Configures the Abiquo connection.
- *
- * @author Ignasi Barrera
- */
-@ConfiguresRestClient
-public class AbiquoRestClientModule extends RestClientModule {
- public static final Map, Class>> DELEGATE_MAP = ImmutableMap., Class>> builder() //
- .put(InfrastructureApi.class, InfrastructureAsyncApi.class) //
- .put(EnterpriseApi.class, EnterpriseAsyncApi.class) //
- .put(AdminApi.class, AdminAsyncApi.class) //
- .put(ConfigApi.class, ConfigAsyncApi.class) //
- .put(CloudApi.class, CloudAsyncApi.class) //
- .put(VirtualMachineTemplateApi.class, VirtualMachineTemplateAsyncApi.class) //
- .put(TaskApi.class, TaskAsyncApi.class) //
- .put(EventApi.class, EventAsyncApi.class) //
- .put(PricingApi.class, PricingAsyncApi.class) //
- .build();
-
- public AbiquoRestClientModule() {
- super(DELEGATE_MAP);
- }
-
- @Override
- protected void configure() {
- super.configure();
- bindHttpApi(binder(), AbiquoHttpClient.class, AbiquoHttpAsyncClient.class);
- bind(Utils.class).to(ExtendedUtils.class);
- }
-
- @Override
- protected void bindErrorHandlers() {
- bind(HttpErrorHandler.class).annotatedWith(Redirection.class).to(AbiquoErrorHandler.class);
- bind(HttpErrorHandler.class).annotatedWith(ClientError.class).to(AbiquoErrorHandler.class);
- bind(HttpErrorHandler.class).annotatedWith(ServerError.class).to(AbiquoErrorHandler.class);
- }
-
- @Provides
- @Singleton
- @Memoized
- public Supplier getCurrentUser(final AtomicReference authException,
- @Named(PROPERTY_SESSION_INTERVAL) final long seconds, final RestContext context) {
- return MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier.create(authException, new Supplier() {
- @Override
- public User get() {
- return wrap(context, User.class, context.getApi().getAdminApi().getCurrentUser());
- }
- }, seconds, TimeUnit.SECONDS);
- }
-
- @Provides
- @Singleton
- @Memoized
- public Supplier getCurrentEnterprise(final AtomicReference authException,
- @Named(PROPERTY_SESSION_INTERVAL) final long seconds, @Memoized final Supplier currentUser) {
- return MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier.create(authException,
- new Supplier() {
- @Override
- public Enterprise get() {
- return currentUser.get().getEnterprise();
- }
- }, seconds, TimeUnit.SECONDS);
- }
-
- @Provides
- @Singleton
- @Memoized
- public Supplier> getAvailableRegionsIndexedById(
- final AtomicReference authException,
- @Named(PROPERTY_SESSION_INTERVAL) final long seconds, @Memoized final Supplier currentEnterprise) {
- Supplier> availableRegionsMapSupplier = Suppliers.compose(
- new Function, Map>() {
- @Override
- public Map apply(final List datacenters) {
- // Index available regions by id
- return Maps.uniqueIndex(datacenters, new Function() {
- @Override
- public Integer apply(final Datacenter input) {
- return input.getId();
- }
- });
- }
- }, new Supplier>() {
- @Override
- public List get() {
- // Get the list of regions available for the user's tenant
- return currentEnterprise.get().listAllowedDatacenters();
- }
- });
-
- return MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier.create(authException,
- availableRegionsMapSupplier, seconds, TimeUnit.SECONDS);
- }
-}
diff --git a/labs/abiquo/src/main/java/org/jclouds/abiquo/domain/DomainWithLimitsWrapper.java b/labs/abiquo/src/main/java/org/jclouds/abiquo/domain/DomainWithLimitsWrapper.java
deleted file mode 100644
index 82cddcd393..0000000000
--- a/labs/abiquo/src/main/java/org/jclouds/abiquo/domain/DomainWithLimitsWrapper.java
+++ /dev/null
@@ -1,161 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds 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.abiquo.domain;
-
-import org.jclouds.abiquo.AbiquoApi;
-import org.jclouds.abiquo.AbiquoAsyncApi;
-import org.jclouds.rest.RestContext;
-
-import com.abiquo.model.transport.SingleResourceWithLimitsDto;
-
-/**
- * This class is used to decorate transport objects that have limits with high
- * level functionality.
- *
- * @author Ignasi Barrera
- */
-public abstract class DomainWithLimitsWrapper extends DomainWrapper {
-
- protected DomainWithLimitsWrapper(final RestContext context, final T target) {
- super(context, target);
- }
-
- // Delegate methods
-
- public int getCpuCountHardLimit() {
- return target.getCpuCountHardLimit();
- }
-
- public int getCpuCountSoftLimit() {
- return target.getCpuCountSoftLimit();
- }
-
- public long getHdHardLimitInMb() {
- return target.getHdHardLimitInMb();
- }
-
- public long getHdSoftLimitInMb() {
- return target.getHdSoftLimitInMb();
- }
-
- public long getPublicIpsHard() {
- return target.getPublicIpsHard();
- }
-
- public long getPublicIpsSoft() {
- return target.getPublicIpsSoft();
- }
-
- public int getRamHardLimitInMb() {
- return target.getRamHardLimitInMb();
- }
-
- public int getRamSoftLimitInMb() {
- return target.getRamSoftLimitInMb();
- }
-
- public long getStorageHard() {
- return target.getStorageHard();
- }
-
- public long getStorageSoft() {
- return target.getStorageSoft();
- }
-
- public long getVlansHard() {
- return target.getVlansHard();
- }
-
- public long getVlansSoft() {
- return target.getVlansSoft();
- }
-
- public void setCpuCountHardLimit(final int cpuCountHardLimit) {
- target.setCpuCountHardLimit(cpuCountHardLimit);
- }
-
- public void setCpuCountLimits(final int softLimit, final int hardLimit) {
- target.setCpuCountLimits(softLimit, hardLimit);
- }
-
- public void setCpuCountSoftLimit(final int cpuCountSoftLimit) {
- target.setCpuCountSoftLimit(cpuCountSoftLimit);
- }
-
- public void setHdHardLimitInMb(final long hdHardLimitInMb) {
- target.setHdHardLimitInMb(hdHardLimitInMb);
- }
-
- public void setHdLimitsInMb(final long softLimit, final long hardLimit) {
- target.setHdLimitsInMb(softLimit, hardLimit);
- }
-
- public void setHdSoftLimitInMb(final long hdSoftLimitInMb) {
- target.setHdSoftLimitInMb(hdSoftLimitInMb);
- }
-
- public void setPublicIPLimits(final long softLimit, final long hardLimit) {
- target.setPublicIPLimits(softLimit, hardLimit);
- }
-
- public void setPublicIpsHard(final long publicIpsHard) {
- target.setPublicIpsHard(publicIpsHard);
- }
-
- public void setPublicIpsSoft(final long publicIpsSoft) {
- target.setPublicIpsSoft(publicIpsSoft);
- }
-
- public void setRamHardLimitInMb(final int ramHardLimitInMb) {
- target.setRamHardLimitInMb(ramHardLimitInMb);
- }
-
- public void setRamLimitsInMb(final int softLimit, final int hardLimit) {
- target.setRamLimitsInMb(softLimit, hardLimit);
- }
-
- public void setRamSoftLimitInMb(final int ramSoftLimitInMb) {
- target.setRamSoftLimitInMb(ramSoftLimitInMb);
- }
-
- public void setStorageHard(final long storageHard) {
- target.setStorageHard(storageHard);
- }
-
- public void setStorageLimits(final long softLimit, final long hardLimit) {
- target.setStorageLimits(softLimit, hardLimit);
- }
-
- public void setStorageSoft(final long storageSoft) {
- target.setStorageSoft(storageSoft);
- }
-
- public void setVlansHard(final long vlansHard) {
- target.setVlansHard(vlansHard);
- }
-
- public void setVlansLimits(final long softLimit, final long hardLimit) {
- target.setVlansLimits(softLimit, hardLimit);
- }
-
- public void setVlansSoft(final long vlansSoft) {
- target.setVlansSoft(vlansSoft);
- }
-}
diff --git a/labs/abiquo/src/main/java/org/jclouds/abiquo/domain/DomainWithTasksWrapper.java b/labs/abiquo/src/main/java/org/jclouds/abiquo/domain/DomainWithTasksWrapper.java
deleted file mode 100644
index ac9dd0e894..0000000000
--- a/labs/abiquo/src/main/java/org/jclouds/abiquo/domain/DomainWithTasksWrapper.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds 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.abiquo.domain;
-
-import static com.google.common.collect.Iterables.filter;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.jclouds.abiquo.AbiquoApi;
-import org.jclouds.abiquo.AbiquoAsyncApi;
-import org.jclouds.abiquo.domain.task.AsyncTask;
-import org.jclouds.rest.RestContext;
-
-import com.abiquo.model.transport.SingleResourceTransportDto;
-import com.abiquo.server.core.task.TaskDto;
-import com.abiquo.server.core.task.TasksDto;
-import com.google.common.base.Predicate;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Ordering;
-import com.google.common.primitives.Longs;
-
-/**
- * This class is used to decorate transport objects that are owners of some
- * {@link TaskDto}
- *
- * @author Ignasi Barrera
- */
-public abstract class DomainWithTasksWrapper extends DomainWrapper {
-
- protected DomainWithTasksWrapper(final RestContext context, final T target) {
- super(context, target);
- }
-
- public List listTasks() {
- TasksDto result = context.getApi().getTaskApi().listTasks(target);
- List tasks = wrap(context, AsyncTask.class, result.getCollection());
-
- // Return the most recent task first
- Collections.sort(tasks, new Ordering() {
- @Override
- public int compare(final AsyncTask left, final AsyncTask right) {
- return Longs.compare(left.getTimestamp(), right.getTimestamp());
- }
- }.reverse());
-
- return tasks;
- }
-
- public List listTasks(final Predicate filter) {
- return ImmutableList.copyOf(filter(listTasks(), filter));
- }
-
- public AsyncTask findTask(final Predicate filter) {
- return Iterables.getFirst(filter(listTasks(), filter), null);
- }
-}
diff --git a/labs/abiquo/src/main/java/org/jclouds/abiquo/domain/DomainWrapper.java b/labs/abiquo/src/main/java/org/jclouds/abiquo/domain/DomainWrapper.java
deleted file mode 100644
index 2b19d9155a..0000000000
--- a/labs/abiquo/src/main/java/org/jclouds/abiquo/domain/DomainWrapper.java
+++ /dev/null
@@ -1,240 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds 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.abiquo.domain;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.collect.Iterables.concat;
-import static com.google.common.collect.Iterables.transform;
-import static org.jclouds.reflect.Reflection2.constructor;
-
-import java.lang.reflect.InvocationTargetException;
-import java.net.URI;
-import java.util.Collection;
-import java.util.List;
-
-import org.jclouds.abiquo.AbiquoApi;
-import org.jclouds.abiquo.AbiquoAsyncApi;
-import org.jclouds.abiquo.domain.exception.WrapperException;
-import org.jclouds.abiquo.domain.task.AsyncTask;
-import org.jclouds.abiquo.domain.util.LinkUtils;
-import org.jclouds.abiquo.reference.ValidationErrors;
-import org.jclouds.abiquo.rest.internal.ExtendedUtils;
-import org.jclouds.http.HttpResponse;
-import org.jclouds.http.functions.ParseXMLWithJAXB;
-import org.jclouds.rest.RestContext;
-
-import com.abiquo.model.rest.RESTLink;
-import com.abiquo.model.transport.AcceptedRequestDto;
-import com.abiquo.model.transport.SingleResourceTransportDto;
-import com.abiquo.model.transport.WrapperDto;
-import com.abiquo.server.core.task.TaskDto;
-import com.google.common.base.Function;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Lists;
-import com.google.common.reflect.Invokable;
-import com.google.inject.TypeLiteral;
-
-/**
- * This class is used to decorate transport objects with high level
- * functionality.
- *
- * @author Francesc Montserrat
- * @author Ignasi Barrera
- */
-public abstract class DomainWrapper {
- /** The rest context. */
- protected RestContext context;
-
- /** The wrapped object. */
- protected T target;
-
- protected DomainWrapper(final RestContext context, final T target) {
- super();
- this.context = checkNotNull(context, "context");
- this.target = checkNotNull(target, "target");
- }
-
- /**
- * Returns the URI that identifies the transport object
- *
- * @return The URI identifying the transport object
- */
- public URI getURI() {
- RESTLink link = LinkUtils.getSelfLink(target);
- return link == null ? null : URI.create(link.getHref());
- }
-
- /**
- * Returns the wrapped object.
- */
- public T unwrap() {
- return target;
- }
-
- /**
- * Refresh the state of the current object.
- */
- @SuppressWarnings("unchecked")
- public void refresh() {
- RESTLink link = checkNotNull(LinkUtils.getSelfLink(target), ValidationErrors.MISSING_REQUIRED_LINK + " edit/self");
-
- ExtendedUtils utils = (ExtendedUtils) context.getUtils();
- HttpResponse response = utils.getAbiquoHttpClient().get(link);
-
- ParseXMLWithJAXB parser = new ParseXMLWithJAXB(utils.getXml(),
- TypeLiteral.get((Class) target.getClass()));
-
- target = parser.apply(response);
- }
-
- /**
- * Read the ID of the parent resource from the given link.
- *
- * @param parentLinkRel
- * The link to the parent resource.
- * @return The ID of the parent resource.
- */
- protected Integer getParentId(final String parentLinkRel) {
- return target.getIdFromLink(parentLinkRel);
- }
-
- /**
- * Wraps an object in the given wrapper class.
- */
- public static > W wrap(
- final RestContext context, final Class wrapperClass, final T target) {
- if (target == null) {
- return null;
- }
-
- try {
- Invokable cons = constructor(wrapperClass, RestContext.class, target.getClass());
- return cons.invoke(null, context, target);
- } catch (InvocationTargetException e) {
- throw new WrapperException(wrapperClass, target, e.getTargetException());
- } catch (IllegalAccessException e) {
- throw new WrapperException(wrapperClass, target, e);
- }
- }
-
- /**
- * Wrap a collection of objects to the given wrapper class.
- */
- public static > List wrap(
- final RestContext context, final Class wrapperClass, final Iterable targets) {
- if (targets == null) {
- return null;
- }
-
- return ImmutableList.copyOf(transform(targets, new Function() {
- @Override
- public W apply(final T input) {
- return wrap(context, wrapperClass, input);
- }
- }));
- }
-
- /**
- * Unwrap a collection of objects.
- */
- public static > List unwrap(
- final Iterable targets) {
- return ImmutableList.copyOf(transform(targets, new Function() {
- @Override
- public T apply(final W input) {
- return input.unwrap();
- }
- }));
- }
-
- /**
- * Update or creates a link of "target" with the uri of a link from "source".
- */
- protected void updateLink(
- final T1 target, final String targetLinkRel, final T2 source, final String sourceLinkRel) {
- RESTLink parent = null;
-
- checkNotNull(source.searchLink(sourceLinkRel), ValidationErrors.MISSING_REQUIRED_LINK);
-
- // Insert
- if ((parent = target.searchLink(targetLinkRel)) == null) {
- target.addLink(new RESTLink(targetLinkRel, source.searchLink(sourceLinkRel).getHref()));
- }
- // Replace
- else {
- parent.setHref(source.searchLink(sourceLinkRel).getHref());
- }
- }
-
- /**
- * Join a collection of {@link WrapperDto} objects in a single collection
- * with all the elements of each wrapper object.
- */
- public static Iterable join(
- final Iterable extends WrapperDto> collection) {
- return concat(transform(collection, new Function, Collection>() {
- @Override
- public Collection apply(WrapperDto input) {
- return input.getCollection();
- }
- }));
- }
-
- /**
- * Utility method to get an {@link AsyncTask} given an
- * {@link AcceptedRequestDto}.
- *
- * @param acceptedRequest
- * The accepted request dto.
- * @return The async task.
- */
- protected AsyncTask getTask(final AcceptedRequestDto acceptedRequest) {
- RESTLink taskLink = acceptedRequest.getStatusLink();
- checkNotNull(taskLink, ValidationErrors.MISSING_REQUIRED_LINK + AsyncTask.class);
-
- // This will return null on untrackable tasks
- TaskDto task = context.getApi().getTaskApi().getTask(taskLink);
- return wrap(context, AsyncTask.class, task);
- }
-
- /**
- * Utility method to get all {@link AsyncTask} related to an
- * {@link AcceptedRequestDto}.
- *
- * @param acceptedRequest
- * The accepted request dto.
- * @return The async task array.
- */
- protected AsyncTask[] getTasks(final AcceptedRequestDto acceptedRequest) {
- List tasks = Lists.newArrayList();
-
- for (RESTLink link : acceptedRequest.getLinks()) {
- // This will return null on untrackable tasks
- TaskDto task = context.getApi().getTaskApi().getTask(link);
- if (task != null) {
- tasks.add(wrap(context, AsyncTask.class, task));
- }
- }
-
- AsyncTask[] taskArr = new AsyncTask[tasks.size()];
- return tasks.toArray(taskArr);
- }
-
-}
diff --git a/labs/abiquo/src/main/java/org/jclouds/abiquo/domain/builder/LimitsBuilder.java b/labs/abiquo/src/main/java/org/jclouds/abiquo/domain/builder/LimitsBuilder.java
deleted file mode 100644
index 013e0a3c8c..0000000000
--- a/labs/abiquo/src/main/java/org/jclouds/abiquo/domain/builder/LimitsBuilder.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds 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.abiquo.domain.builder;
-
-/**
- * Base class for all builders that represent limits.
- *
- * @author Ignasi Barrera
- * @param
- * The type of the target builder.
- */
-public abstract class LimitsBuilder> {
- /** The default limits for enterprises (unlimited). */
- protected static final int DEFAULT_LIMITS = 0;
-
- protected Integer ramSoftLimitInMb = DEFAULT_LIMITS;
-
- protected Integer ramHardLimitInMb = DEFAULT_LIMITS;
-
- protected Integer cpuCountSoftLimit = DEFAULT_LIMITS;
-
- protected Integer cpuCountHardLimit = DEFAULT_LIMITS;
-
- protected Long hdSoftLimitInMb = Long.valueOf(DEFAULT_LIMITS);
-
- protected Long hdHardLimitInMb = Long.valueOf(DEFAULT_LIMITS);
-
- protected Long storageSoft = Long.valueOf(DEFAULT_LIMITS);
-
- protected Long storageHard = Long.valueOf(DEFAULT_LIMITS);
-
- protected Long vlansSoft = Long.valueOf(DEFAULT_LIMITS);
-
- protected Long vlansHard = Long.valueOf(DEFAULT_LIMITS);
-
- protected Long publicIpsSoft = Long.valueOf(DEFAULT_LIMITS);
-
- protected Long publicIpsHard = Long.valueOf(DEFAULT_LIMITS);
-
- @SuppressWarnings("unchecked")
- public T ramLimits(final int soft, final int hard) {
- this.ramSoftLimitInMb = soft;
- this.ramHardLimitInMb = hard;
- return (T) this;
- }
-
- @SuppressWarnings("unchecked")
- public T cpuCountLimits(final int soft, final int hard) {
- this.cpuCountSoftLimit = soft;
- this.cpuCountHardLimit = hard;
- return (T) this;
- }
-
- @SuppressWarnings("unchecked")
- public T hdLimitsInMb(final long soft, final long hard) {
- this.hdSoftLimitInMb = soft;
- this.hdHardLimitInMb = hard;
- return (T) this;
- }
-
- @SuppressWarnings("unchecked")
- public T storageLimits(final long soft, final long hard) {
- this.storageSoft = soft;
- this.storageHard = hard;
- return (T) this;
- }
-
- @SuppressWarnings("unchecked")
- public T vlansLimits(final long soft, final long hard) {
- this.vlansSoft = soft;
- this.vlansHard = hard;
- return (T) this;
- }
-
- @SuppressWarnings("unchecked")
- public T publicIpsLimits(final long soft, final long hard) {
- this.publicIpsSoft = soft;
- this.publicIpsHard = hard;
- return (T) this;
- }
-}
diff --git a/labs/abiquo/src/main/java/org/jclouds/abiquo/domain/cloud/Conversion.java b/labs/abiquo/src/main/java/org/jclouds/abiquo/domain/cloud/Conversion.java
deleted file mode 100644
index 9f93668b7a..0000000000
--- a/labs/abiquo/src/main/java/org/jclouds/abiquo/domain/cloud/Conversion.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds 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.abiquo.domain.cloud;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.Date;
-
-import org.jclouds.abiquo.AbiquoApi;
-import org.jclouds.abiquo.AbiquoAsyncApi;
-import org.jclouds.abiquo.domain.DomainWithTasksWrapper;
-import org.jclouds.abiquo.domain.task.AsyncTask;
-import org.jclouds.abiquo.reference.ValidationErrors;
-import org.jclouds.abiquo.reference.rest.ParentLinkName;
-import org.jclouds.abiquo.rest.internal.ExtendedUtils;
-import org.jclouds.http.HttpResponse;
-import org.jclouds.http.functions.ParseXMLWithJAXB;
-import org.jclouds.rest.RestContext;
-
-import com.abiquo.model.enumerator.ConversionState;
-import com.abiquo.model.enumerator.DiskFormatType;
-import com.abiquo.model.rest.RESTLink;
-import com.abiquo.server.core.appslibrary.ConversionDto;
-import com.abiquo.server.core.appslibrary.VirtualMachineTemplateDto;
-import com.google.inject.TypeLiteral;
-
-/**
- * Adds high level functionality to {@link ConversionDto}.
- *
- * @author Ignasi Barrera
- * @author Francesc Montserrat
- * @see API:
- * http://community.abiquo.com/display/ABI20/Conversion+Resource
- */
-public class Conversion extends DomainWithTasksWrapper {
- /**
- * Constructor to be used only by the builder.
- */
- protected Conversion(final RestContext context, final ConversionDto target) {
- super(context, target);
- }
-
- // Parent access
-
- /**
- * @see API: http://community.abiquo.com/display/ABI20/Virtual+Machine+Template+
- * Resource
- */
- public VirtualMachineTemplate getVirtualMachineTemplate() {
- RESTLink link = checkNotNull(target.searchLink(ParentLinkName.VIRTUAL_MACHINE_TEMPLATE),
- ValidationErrors.MISSING_REQUIRED_LINK + " " + ParentLinkName.VIRTUAL_MACHINE_TEMPLATE);
-
- ExtendedUtils utils = (ExtendedUtils) context.getUtils();
- HttpResponse response = utils.getAbiquoHttpClient().get(link);
-
- ParseXMLWithJAXB parser = new ParseXMLWithJAXB(
- utils.getXml(), TypeLiteral.get(VirtualMachineTemplateDto.class));
-
- return wrap(context, VirtualMachineTemplate.class, parser.apply(response));
- }
-
- /**
- * Starts a new BPM task to regenerate a failed conversion.
- *
- * @see API: http://community.abiquo.com/display/ABI20/Conversion+Resource#
- * ConversionResource- UpdateConversion
- * @return The task reference to track its progress
- */
- public AsyncTask restartFailedConversion() {
- return getVirtualMachineTemplate().requestConversion(getTargetFormat());
- }
-
- // Delegate methods
-
- public String getSourcePath() {
- return target.getSourcePath();
- }
-
- public ConversionState getState() {
- return target.getState();
- }
-
- public String getTargetPath() {
- return target.getTargetPath();
- }
-
- public Long getTargetSizeInBytes() {
- return target.getTargetSizeInBytes();
- }
-
- public DiskFormatType getSourceFormat() {
- return target.getSourceFormat();
- }
-
- public DiskFormatType getTargetFormat() {
- return target.getTargetFormat();
- }
-
- public Date getStartTimestamp() {
- return target.getStartTimestamp();
- }
-
- @Override
- public String toString() {
- return "Conversion [sourcePath=" + getSourcePath() + ", sourceFormat=" + getSourceFormat() + ", targetPath="
- + getTargetPath() + ", targetFormat=" + getTargetFormat() + ", targetSizeInBytes=" + getTargetSizeInBytes()
- + ", startTimestamp=" + getStartTimestamp() + ", state=" + getState() + "]";
- }
-}
diff --git a/labs/abiquo/src/main/java/org/jclouds/abiquo/domain/cloud/HardDisk.java b/labs/abiquo/src/main/java/org/jclouds/abiquo/domain/cloud/HardDisk.java
deleted file mode 100644
index 81d9af7072..0000000000
--- a/labs/abiquo/src/main/java/org/jclouds/abiquo/domain/cloud/HardDisk.java
+++ /dev/null
@@ -1,164 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds 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.abiquo.domain.cloud;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import org.jclouds.abiquo.AbiquoApi;
-import org.jclouds.abiquo.AbiquoAsyncApi;
-import org.jclouds.abiquo.domain.DomainWrapper;
-import org.jclouds.abiquo.reference.ValidationErrors;
-import org.jclouds.abiquo.reference.rest.ParentLinkName;
-import org.jclouds.rest.RestContext;
-
-import com.abiquo.server.core.cloud.VirtualDatacenterDto;
-import com.abiquo.server.core.infrastructure.storage.DiskManagementDto;
-
-/**
- * Represents a disk attached to a virtual machine.
- *
- * This disks will be created when a virtual machine is deployed, and will be
- * destroyed when it is undeployed. If there is a need to use persistent
- * storage, a persistent {@link Volume} should be used instead.
- *
- * @author Ignasi Barrera
- * @see API:
- * http://community.abiquo.com/display/ABI20/Hard+Disks+Resource
- */
-public class HardDisk extends DomainWrapper {
- /** The virtual datacenter where the hard disk belongs. */
- private VirtualDatacenter virtualDatacenter;
-
- /**
- * Constructor to be used only by the builder.
- */
- protected HardDisk(final RestContext context, final DiskManagementDto target) {
- super(context, target);
- }
-
- // Domain operations
-
- /**
- * Creates the hard disk in the selected virtual datacenter.
- *
- * Once the hard disk has been created it can be attached to a virtual
- * machine of the virtual datacenter.
- */
- public void save() {
- target = context.getApi().getCloudApi().createHardDisk(virtualDatacenter.unwrap(), target);
- }
-
- /**
- * Deletes the hard disk.
- */
- public void delete() {
- context.getApi().getCloudApi().deleteHardDisk(target);
- target = null;
- }
-
- // Parent access
-
- /**
- * Gets the virtual datacenter where the hard disk belongs to.
- *
- * @see API: http://community.abiquo.com/display/ABI20/Virtual+Datacenter+
- * Resource# VirtualDatacenterResource-RetrieveaVirtualDatacenter
- */
- public VirtualDatacenter getVirtualDatacenter() {
- Integer virtualDatacenterId = target.getIdFromLink(ParentLinkName.VIRTUAL_DATACENTER);
- VirtualDatacenterDto dto = context.getApi().getCloudApi().getVirtualDatacenter(virtualDatacenterId);
- virtualDatacenter = wrap(context, VirtualDatacenter.class, dto);
- return virtualDatacenter;
- }
-
- // Builder
-
- public static Builder builder(final RestContext context,
- final VirtualDatacenter virtualDatacenter) {
- return new Builder(context, virtualDatacenter);
- }
-
- public static class Builder {
- private RestContext context;
-
- private Long sizeInMb;
-
- private VirtualDatacenter virtualDatacenter;
-
- public Builder(final RestContext context, final VirtualDatacenter virtualDatacenter) {
- super();
- checkNotNull(virtualDatacenter, ValidationErrors.NULL_RESOURCE + VirtualDatacenter.class);
- this.context = context;
- this.virtualDatacenter = virtualDatacenter;
- }
-
- public Builder sizeInMb(final long sizeInMb) {
- this.sizeInMb = sizeInMb;
- return this;
- }
-
- public HardDisk build() {
- DiskManagementDto dto = new DiskManagementDto();
- dto.setSizeInMb(sizeInMb);
-
- HardDisk hardDisk = new HardDisk(context, dto);
- hardDisk.virtualDatacenter = virtualDatacenter;
-
- return hardDisk;
- }
- }
-
- // Delegate methods. Since a hard disk cannot be edited, setters are not
- // visible
-
- /**
- * Returns the id of the hard disk.
- */
- public Integer getId() {
- // TODO: DiskManagementDto does not have an id field
- return target.getEditLink() == null ? null : target.getIdFromLink("edit");
- }
-
- /**
- * Returns the size of the hard disk in MB.
- */
- public Long getSizeInMb() {
- return target.getSizeInMb();
- }
-
- /**
- * Returns the sequence number of the hard disk.
- *
- * It will be computed when attaching the hard disk to a virtual machine and
- * will determine the attachment order of the disk in the virtual machine.
- */
- public Integer getSequence() {
- return target.getSequence();
- }
-
- @Override
- public String toString() {
- return "HardDisk [id=" + getId() + ", sizeInMb=" + getSizeInMb() + ", sequence=" + getSequence() + "]";
- }
-
-}
diff --git a/labs/abiquo/src/main/java/org/jclouds/abiquo/domain/cloud/VirtualAppliance.java b/labs/abiquo/src/main/java/org/jclouds/abiquo/domain/cloud/VirtualAppliance.java
deleted file mode 100644
index 0fb209b8ef..0000000000
--- a/labs/abiquo/src/main/java/org/jclouds/abiquo/domain/cloud/VirtualAppliance.java
+++ /dev/null
@@ -1,382 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds 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.abiquo.domain.cloud;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.collect.Iterables.filter;
-
-import java.util.List;
-
-import org.jclouds.abiquo.AbiquoApi;
-import org.jclouds.abiquo.AbiquoAsyncApi;
-import org.jclouds.abiquo.domain.DomainWrapper;
-import org.jclouds.abiquo.domain.cloud.options.VirtualMachineOptions;
-import org.jclouds.abiquo.domain.enterprise.Enterprise;
-import org.jclouds.abiquo.domain.task.AsyncTask;
-import org.jclouds.abiquo.reference.ValidationErrors;
-import org.jclouds.abiquo.reference.rest.ParentLinkName;
-import org.jclouds.rest.RestContext;
-
-import com.abiquo.model.transport.AcceptedRequestDto;
-import com.abiquo.server.core.cloud.VirtualApplianceDto;
-import com.abiquo.server.core.cloud.VirtualApplianceState;
-import com.abiquo.server.core.cloud.VirtualApplianceStateDto;
-import com.abiquo.server.core.cloud.VirtualDatacenterDto;
-import com.abiquo.server.core.cloud.VirtualMachineTaskDto;
-import com.abiquo.server.core.cloud.VirtualMachineWithNodeExtendedDto;
-import com.abiquo.server.core.cloud.VirtualMachinesWithNodeExtendedDto;
-import com.abiquo.server.core.enterprise.EnterpriseDto;
-import com.google.common.base.Predicate;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Iterables;
-
-/**
- * Represents a virtual appliance.
- *
- * A virtual appliance is a logic container for virtual machines that together
- * make an appliance.
- *
- * @author Ignasi Barrera
- * @author Francesc Montserrat
- * @see API:
- * http://community.abiquo.com/display/ABI20/Virtual+Appliance+Resource
- */
-public class VirtualAppliance extends DomainWrapper {
- /** The virtual datacenter where the virtual appliance belongs. */
- private VirtualDatacenter virtualDatacenter;
-
- /**
- * Constructor to be used only by the builder.
- */
- protected VirtualAppliance(final RestContext context, final VirtualApplianceDto target) {
- super(context, target);
- }
-
- // Domain operations
-
- /**
- * Deletes the virtual appliance.
- */
- public void delete() {
- context.getApi().getCloudApi().deleteVirtualAppliance(target);
- target = null;
- }
-
- /**
- * Creates the virtual appliance in the selected virtual datacenter.
- */
- public void save() {
- target = context.getApi().getCloudApi().createVirtualAppliance(virtualDatacenter.unwrap(), target);
- }
-
- /**
- * Updates the virtual appliance information when some of its properties have
- * changed.
- */
- public void update() {
- target = context.getApi().getCloudApi().updateVirtualAppliance(target);
- }
-
- // Parent access
-
- /**
- * Gets the virtual datacenter where the virtual appliance belongs to.
- *
- * @return The virtual datacenter where the virtual appliance belongs to.
- * @see API: http://community.abiquo.com/display/ABI20/Virtual+Datacenter+
- * Resource# VirtualDatacenterResource-RetrieveaVirtualDatacenter
- */
- public VirtualDatacenter getVirtualDatacenter() {
- Integer virtualDatacenterId = target.getIdFromLink(ParentLinkName.VIRTUAL_DATACENTER);
- VirtualDatacenterDto dto = context.getApi().getCloudApi().getVirtualDatacenter(virtualDatacenterId);
- virtualDatacenter = wrap(context, VirtualDatacenter.class, dto);
- return virtualDatacenter;
- }
-
- /**
- * Gets the enterprise where the virtual appliance belongs to.
- *
- * @return The enterprise where the virtual appliance belongs to.
- * @see API: http://community.abiquo.com/display/ABI20/Enterprise+Resource#
- * EnterpriseResource- RetrieveaEnterprise
- */
- public Enterprise getEnterprise() {
- Integer enterpriseId = target.getIdFromLink(ParentLinkName.ENTERPRISE);
- EnterpriseDto dto = context.getApi().getEnterpriseApi().getEnterprise(enterpriseId);
- return wrap(context, Enterprise.class, dto);
- }
-
- /**
- * Gets the current state of the virtual appliance.
- *
- * @return The current state of the virtual appliance.
- */
- public VirtualApplianceState getState() {
- VirtualApplianceStateDto stateDto = context.getApi().getCloudApi().getVirtualApplianceState(target);
- return stateDto.getPower();
- }
-
- // Children access
-
- /**
- * Gets the list of virtual machines in the virtual appliance.
- *
- * @return The list of virtual machines in the virtual appliance.
- * @see API: http://community.abiquo.com/display/ABI18/Virtual+Machine+Resource#
- * VirtualMachineResource -RetrievethelistofVirtualMachines.
- */
- public List listVirtualMachines() {
- return listVirtualMachines(VirtualMachineOptions.builder().disablePagination().build());
- }
-
- /**
- * Gets the list of virtual machines in the virtual appliance.
- *
- * @return The list of virtual machines in the virtual appliance.
- * @see API: http://community.abiquo.com/display/ABI18/Virtual+Machine+Resource#
- * VirtualMachineResource -RetrievethelistofVirtualMachines.
- */
- public List listVirtualMachines(final VirtualMachineOptions options) {
- VirtualMachinesWithNodeExtendedDto vms = context.getApi().getCloudApi().listVirtualMachines(target, options);
- return wrap(context, VirtualMachine.class, vms.getCollection());
- }
-
- /**
- * Gets the list of virtual machines in the virtual appliance matching the
- * given filter.
- *
- * @param filter
- * The filter to apply.
- * @return The list of virtual machines in the virtual appliance matching the
- * given filter.
- */
- public List listVirtualMachines(final Predicate filter) {
- return ImmutableList.copyOf(filter(listVirtualMachines(), filter));
- }
-
- /**
- * Gets a single virtual machine in the virtual appliance matching the given
- * filter.
- *
- * @param filter
- * The filter to apply.
- * @return The virtual machine or null
if none matched the given
- * filter.
- */
- public VirtualMachine findVirtualMachine(final Predicate filter) {
- return Iterables.getFirst(filter(listVirtualMachines(), filter), null);
- }
-
- /**
- * Gets a concrete virtual machine in the virtual appliance.
- *
- * @param id
- * The id of the virtual machine.
- * @return The requested virtual machine.
- */
- public VirtualMachine getVirtualMachine(final Integer id) {
- VirtualMachineWithNodeExtendedDto vm = context.getApi().getCloudApi().getVirtualMachine(target, id);
- return wrap(context, VirtualMachine.class, vm);
- }
-
- // Actions
-
- /**
- * Deploys the virtual appliance.
- *
- * This method will start the deployment of all the virtual machines in the
- * virtual appliance, and will return an {@link AsyncTask} reference for each
- * deployment operation. The deployment will finish when all individual tasks
- * finish.
- *
- * @return The list of tasks corresponding to the deploy process of each
- * virtual machine in the appliance.
- */
- public AsyncTask[] deploy() {
- return deploy(false);
- }
-
- /**
- * Deploys the virtual appliance.
- *
- * This method will start the deployment of all the virtual machines in the
- * virtual appliance, and will return an {@link AsyncTask} reference for each
- * deploy operation. The deployment will finish when all individual tasks
- * finish.
- *
- * @param forceEnterpriseSoftLimits
- * Boolean indicating if the deployment must be executed even if
- * the enterprise soft limits are reached.
- * @return The list of tasks corresponding to the deploy process of each
- * virtual machine in the appliance.
- */
- public AsyncTask[] deploy(final boolean forceEnterpriseSoftLimits) {
- VirtualMachineTaskDto force = new VirtualMachineTaskDto();
- force.setForceEnterpriseSoftLimits(forceEnterpriseSoftLimits);
-
- AcceptedRequestDto response = context.getApi().getCloudApi().deployVirtualAppliance(unwrap(), force);
-
- return getTasks(response);
- }
-
- /**
- * Undeploys the virtual appliance.
- *
- * This method will start the undeploy of all the virtual machines in the
- * virtual appliance, and will return an {@link AsyncTask} reference for each
- * undeploy operation. The undeploy will finish when all individual tasks
- * finish.
- *
- * @return The list of tasks corresponding to the undeploy process of each
- * virtual machine in the appliance.
- */
- public AsyncTask[] undeploy() {
- return undeploy(false);
- }
-
- /**
- * Undeploys the virtual appliance.
- *
- * This method will start the undeploy of all the virtual machines in the
- * virtual appliance, and will return an {@link AsyncTask} reference for each
- * undeploy operation. The undeploy will finish when all individual tasks
- * finish.
- *
- * @param forceUndeploy
- * Boolean flag to force the undeploy even if the virtual appliance
- * contains imported virtual machines.
- * @return The list of tasks corresponding to the undeploy process of each
- * virtual machine in the appliance.
- */
- public AsyncTask[] undeploy(final boolean forceUndeploy) {
- VirtualMachineTaskDto force = new VirtualMachineTaskDto();
- force.setForceUndeploy(forceUndeploy);
-
- AcceptedRequestDto response = context.getApi().getCloudApi().undeployVirtualAppliance(unwrap(), force);
-
- return getTasks(response);
- }
-
- /**
- * Returns a String message with the price info of the virtual appliance.
- *
- * @return The price of the virtual appliance
- */
- public String getPrice() {
- return context.getApi().getCloudApi().getVirtualAppliancePrice(target);
- }
-
- // Builder
-
- public static Builder builder(final RestContext context,
- final VirtualDatacenter virtualDatacenter) {
- return new Builder(context, virtualDatacenter);
- }
-
- public static class Builder {
- private RestContext context;
-
- private String name;
-
- private VirtualDatacenter virtualDatacenter;
-
- public Builder(final RestContext context, final VirtualDatacenter virtualDatacenter) {
- super();
- checkNotNull(virtualDatacenter, ValidationErrors.NULL_RESOURCE + VirtualDatacenter.class);
- this.virtualDatacenter = virtualDatacenter;
- this.context = context;
- }
-
- public Builder name(final String name) {
- this.name = name;
- return this;
- }
-
- public Builder virtualDatacenter(final VirtualDatacenter virtualDatacenter) {
- checkNotNull(virtualDatacenter, ValidationErrors.NULL_RESOURCE + VirtualDatacenter.class);
- this.virtualDatacenter = virtualDatacenter;
- return this;
- }
-
- public VirtualAppliance build() {
- VirtualApplianceDto dto = new VirtualApplianceDto();
- dto.setName(name);
-
- VirtualAppliance virtualAppliance = new VirtualAppliance(context, dto);
- virtualAppliance.virtualDatacenter = virtualDatacenter;
-
- return virtualAppliance;
- }
-
- public static Builder fromVirtualAppliance(final VirtualAppliance in) {
- return VirtualAppliance.builder(in.context, in.virtualDatacenter).name(in.getName());
- }
- }
-
- // Delegate methods
-
- public int getError() {
- return target.getError();
- }
-
- public int getHighDisponibility() {
- return target.getHighDisponibility();
- }
-
- public Integer getId() {
- return target.getId();
- }
-
- public String getName() {
- return target.getName();
- }
-
- public int getPublicApp() {
- return target.getPublicApp();
- }
-
- public void setHighDisponibility(final int highDisponibility) {
- target.setHighDisponibility(highDisponibility);
- }
-
- public void setName(final String name) {
- target.setName(name);
- }
-
- public void setPublicApp(final int publicApp) {
- target.setPublicApp(publicApp);
- }
-
- @Override
- public String toString() {
- return "VirtualAppliance [id=" + getId() + ", name=" + getName() + "]";
- }
-
-}
diff --git a/labs/abiquo/src/main/java/org/jclouds/abiquo/domain/cloud/VirtualDatacenter.java b/labs/abiquo/src/main/java/org/jclouds/abiquo/domain/cloud/VirtualDatacenter.java
deleted file mode 100644
index 61a4050f2f..0000000000
--- a/labs/abiquo/src/main/java/org/jclouds/abiquo/domain/cloud/VirtualDatacenter.java
+++ /dev/null
@@ -1,629 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds 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.abiquo.domain.cloud;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.collect.Iterables.filter;
-
-import java.util.List;
-
-import org.jclouds.abiquo.AbiquoApi;
-import org.jclouds.abiquo.AbiquoAsyncApi;
-import org.jclouds.abiquo.domain.DomainWithLimitsWrapper;
-import org.jclouds.abiquo.domain.builder.LimitsBuilder;
-import org.jclouds.abiquo.domain.cloud.options.VirtualMachineTemplateOptions;
-import org.jclouds.abiquo.domain.enterprise.Enterprise;
-import org.jclouds.abiquo.domain.infrastructure.Datacenter;
-import org.jclouds.abiquo.domain.infrastructure.Tier;
-import org.jclouds.abiquo.domain.network.ExternalNetwork;
-import org.jclouds.abiquo.domain.network.Network;
-import org.jclouds.abiquo.domain.network.PrivateIp;
-import org.jclouds.abiquo.domain.network.PrivateNetwork;
-import org.jclouds.abiquo.domain.network.PublicIp;
-import org.jclouds.abiquo.domain.network.options.IpOptions;
-import org.jclouds.abiquo.predicates.infrastructure.DatacenterPredicates;
-import org.jclouds.abiquo.reference.ValidationErrors;
-import org.jclouds.abiquo.reference.rest.ParentLinkName;
-import org.jclouds.rest.RestContext;
-
-import com.abiquo.model.enumerator.HypervisorType;
-import com.abiquo.model.enumerator.NetworkType;
-import com.abiquo.model.enumerator.StatefulInclusion;
-import com.abiquo.server.core.appslibrary.VirtualMachineTemplatesDto;
-import com.abiquo.server.core.cloud.VirtualApplianceDto;
-import com.abiquo.server.core.cloud.VirtualAppliancesDto;
-import com.abiquo.server.core.cloud.VirtualDatacenterDto;
-import com.abiquo.server.core.infrastructure.network.PublicIpsDto;
-import com.abiquo.server.core.infrastructure.network.VLANNetworkDto;
-import com.abiquo.server.core.infrastructure.network.VLANNetworksDto;
-import com.abiquo.server.core.infrastructure.storage.DiskManagementDto;
-import com.abiquo.server.core.infrastructure.storage.DisksManagementDto;
-import com.abiquo.server.core.infrastructure.storage.TierDto;
-import com.abiquo.server.core.infrastructure.storage.TiersDto;
-import com.abiquo.server.core.infrastructure.storage.VolumeManagementDto;
-import com.abiquo.server.core.infrastructure.storage.VolumesManagementDto;
-import com.google.common.base.Predicate;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Iterables;
-
-/**
- * Represents a virtual datacenter.
- *
- * Virtual datacenters expose a set of compute, storage and networking resources
- * that can be consumed by the tenants.
- *
- * @author Ignasi Barrera
- * @author Francesc Montserrat
- * @see API:
- * http
- * ://community.abiquo.com/display/ABI20/Virtual+Datacenter+Resource
- */
-public class VirtualDatacenter extends DomainWithLimitsWrapper {
- /** The enterprise where the rack belongs. */
- private Enterprise enterprise;
-
- /** The datacenter where the virtual datacenter will be deployed. */
- private Datacenter datacenter;
-
- /**
- * Constructor to be used only by the builder.
- */
- protected VirtualDatacenter(final RestContext context, final VirtualDatacenterDto target) {
- super(context, target);
- }
-
- // Domain operations
-
- /**
- * Delete the virtual datacenter.
- *
- * @see API: http://community.abiquo.com/display/ABI20/Virtual+Datacenter+
- * Resource#
- * VirtualDatacenterResource-DeleteanexistingVirtualDatacenter
- */
- public void delete() {
- context.getApi().getCloudApi().deleteVirtualDatacenter(target);
- target = null;
- }
-
- /**
- * Creates the virtual datacenter.
- *
- * @see API: http://community.abiquo.com/display/ABI20/Virtual+Datacenter+
- * Resource# VirtualDatacenterResource-CreateanewVirtualDatacenter
- */
- public void save() {
- target = context.getApi().getCloudApi().createVirtualDatacenter(target, datacenter.unwrap(), enterprise.unwrap());
- }
-
- /**
- * Updates the virtual datacenter information when some of its properties
- * have changed.
- *
- * @see API: http://community.abiquo.com/display/ABI20/Virtual+Datacenter+
- * Resource#
- * VirtualDatacenterResource-UpdatesanexistingVirtualDatacenter
- */
- public void update() {
- target = context.getApi().getCloudApi().updateVirtualDatacenter(target);
- }
-
- // Parent access
-
- /**
- * Gets the datacenter where this virtual datacenter is assigned.
- *
- * @return The datacenter where this virtual datacenter is assigned.
- * @see API: http://community.abiquo.com/display/ABI20/Datacenter+Resource#
- * DatacenterResource- RetrieveaDatacenter
- */
- public Datacenter getDatacenter() {
- Integer datacenterId = target.getIdFromLink(ParentLinkName.DATACENTER);
- datacenter = getEnterprise().findAllowedDatacenter(DatacenterPredicates.id(datacenterId));
- return datacenter;
- }
-
- /**
- * Gets the enterprise that owns this virtual datacenter.
- *
- * @return The enterprise that owns this virtual datacenter.
- * @see API: http://community.abiquo.com/display/ABI20/Enterprise+Resource#
- * EnterpriseResource- RetrieveanEnterprise
- */
- public Enterprise getEnterprise() {
- Integer enterpriseId = target.getIdFromLink(ParentLinkName.ENTERPRISE);
- enterprise = wrap(context, Enterprise.class, context.getApi().getEnterpriseApi().getEnterprise(enterpriseId));
- return enterprise;
- }
-
- // Children access
-
- /**
- * Lists all the virtual appliances in the virtual datacenter.
- *
- * @return The list of virtual appliances in the virtual datacenter.
- * @see API: http://community.abiquo.com/display/ABI20/Virtual+Appliance+Resource
- * # VirtualApplianceResource-RetrievethelistofVirtualAppliances
- */
- public List listVirtualAppliances() {
- VirtualAppliancesDto vapps = context.getApi().getCloudApi().listVirtualAppliances(target);
- return wrap(context, VirtualAppliance.class, vapps.getCollection());
- }
-
- /**
- * Lists all the virtual appliances in the virtual datacenter that match the
- * given filter.
- *
- * @param filter
- * The filter to apply.
- * @return The list of virtual appliances in the virtual datacenter that
- * match the given filter.
- * @see API: http://community.abiquo.com/display/ABI20/Virtual+Appliance+Resource
- * # VirtualApplianceResource-RetrievethelistofVirtualAppliances
- */
- public List listVirtualAppliances(final Predicate filter) {
- return ImmutableList.copyOf(filter(listVirtualAppliances(), filter));
- }
-
- /**
- * Gets the first virtual appliance in the virtual datacenter that match the
- * given filter.
- *
- * @param filter
- * The filter to apply.
- * @return the first virtual appliance in the virtual datacenter that match
- * the given filter or null
if none is found.
- * @see API: http://community.abiquo.com/display/ABI20/Virtual+Appliance+Resource
- * # VirtualApplianceResource-RetrievethelistofVirtualAppliances
- */
- public VirtualAppliance findVirtualAppliance(final Predicate filter) {
- return Iterables.getFirst(filter(listVirtualAppliances(), filter), null);
- }
-
- /**
- * Gets the virtual appliance with the given id in the current virtual
- * datacenter.
- *
- * @param id
- * The id of the virtual appliance to get.
- * @return The virtual appliance.
- */
- public VirtualAppliance getVirtualAppliance(final Integer id) {
- VirtualApplianceDto vapp = context.getApi().getCloudApi().getVirtualAppliance(target, id);
- return wrap(context, VirtualAppliance.class, vapp);
- }
-
- /**
- * Lists the storage tiers that are available to the virtual datacenter.
- *
- * @return The list of storage tiers that are available to the virtual
- * datacenter.
- * @see API: http://community.abiquo.com/display/ABI20/Virtual+Datacenter+
- * Resource# VirtualDatacenterResource-Retrieveenabledtiers
- */
- public List listStorageTiers() {
- TiersDto tiers = context.getApi().getCloudApi().listStorageTiers(target);
- return wrap(context, Tier.class, tiers.getCollection());
- }
-
- /**
- * Lists the storage tiers that are available to the virtual datacenter and
- * match the given filter.
- *
- * @param filter
- * The filter to apply.
- * @return The list of storage tiers that are available to the virtual
- * datacenter and match the given filter.
- * @see API: http://community.abiquo.com/display/ABI20/Virtual+Datacenter+
- * Resource# VirtualDatacenterResource-Retrieveenabledtiers
- */
- public List listStorageTiers(final Predicate filter) {
- return ImmutableList.copyOf(filter(listStorageTiers(), filter));
- }
-
- /**
- * Finds the first the storage tier that is available to the virtual
- * datacenter and matches the given filter.
- *
- * @param filter
- * The filter to apply.
- * @return The first the storage tier that is available to the virtual
- * datacenter and matches the given filter.
- * @see API: http://community.abiquo.com/display/ABI20/Virtual+Datacenter+
- * Resource# VirtualDatacenterResource-Retrieveenabledtiers
- */
- public Tier findStorageTier(final Predicate filter) {
- return Iterables.getFirst(filter(listStorageTiers(), filter), null);
- }
-
- /**
- * Gets the storage tier with the given id from the current virtual
- * datacenter.
- *
- * @param id
- * The id of the storage tier.
- * @return The storage tier.
- */
- public Tier getStorageTier(final Integer id) {
- TierDto tier = context.getApi().getCloudApi().getStorageTier(target, id);
- return wrap(context, Tier.class, tier);
- }
-
- /**
- * Lists all persistent volumes in the virtual datacenter.
- *
- * @return The list of all persistent volumes in the virtual datacenter.
- * @see API: http://community.abiquo.com/display/ABI20/Volume+Resource#
- * VolumeResource- Retrievethelistofvolumes
- */
- public List listVolumes() {
- VolumesManagementDto volumes = context.getApi().getCloudApi().listVolumes(target);
- return wrap(context, Volume.class, volumes.getCollection());
- }
-
- /**
- * Lists all persistent volumes in the virtual datacenter that match the
- * given filter.
- *
- * @param filter
- * The filter to apply.
- * @return The list of all persistent volumes in the virtual datacenter that
- * match the given filter.
- * @see API: http://community.abiquo.com/display/ABI20/Volume+Resource#
- * VolumeResource- Retrievethelistofvolumes
- */
- public List listVolumes(final Predicate filter) {
- return ImmutableList.copyOf(filter(listVolumes(), filter));
- }
-
- /**
- * Finds the first persistent volume in the virtual datacenter that matches
- * the given filter.
- *
- * @param filter
- * The filter to apply.
- * @return The first persistent volumes in the virtual datacenter that
- * matches the given filter.
- * @see API: http://community.abiquo.com/display/ABI20/Volume+Resource#
- * VolumeResource- Retrievethelistofvolumes
- */
- public Volume findVolume(final Predicate filter) {
- return Iterables.getFirst(filter(listVolumes(), filter), null);
- }
-
- public Volume getVolume(final Integer id) {
- VolumeManagementDto volume = context.getApi().getCloudApi().getVolume(target, id);
- return wrap(context, Volume.class, volume);
- }
-
- /**
- * @see API: http://community.abiquo.com/display/ABI20/Hard+Disks+Resource#
- * HardDisksResource- GetthelistofHardDisksofaVirtualDatacenter
- */
- public List listHardDisks() {
- DisksManagementDto hardDisks = context.getApi().getCloudApi().listHardDisks(target);
- return wrap(context, HardDisk.class, hardDisks.getCollection());
- }
-
- public List listHardDisks(final Predicate filter) {
- return ImmutableList.copyOf(filter(listHardDisks(), filter));
- }
-
- public HardDisk findHardDisk(final Predicate filter) {
- return Iterables.getFirst(filter(listHardDisks(), filter), null);
- }
-
- public HardDisk getHardDisk(final Integer id) {
- DiskManagementDto hardDisk = context.getApi().getCloudApi().getHardDisk(target, id);
- return wrap(context, HardDisk.class, hardDisk);
- }
-
- /**
- * @see API: http://community.abiquo.com/display/ABI20/Virtual+Datacenter+
- * Resource#
- * VirtualDatacenterResource-GetdefaultVLANusedbydefaultinVirtualDatacenter
- *
- */
- public Network> getDefaultNetwork() {
- VLANNetworkDto network = context.getApi().getCloudApi().getDefaultNetwork(target);
- return wrap(context, network.getType() == NetworkType.INTERNAL ? PrivateNetwork.class : ExternalNetwork.class,
- network);
- }
-
- /**
- * @see API: http://community.abiquo.com/display/ABI20/Private+Network+Resource#
- * PrivateNetworkResource -RetrievealistofPrivateNetworks
- */
- public List listPrivateNetworks() {
- VLANNetworksDto networks = context.getApi().getCloudApi().listPrivateNetworks(target);
- return wrap(context, PrivateNetwork.class, networks.getCollection());
- }
-
- public List listPrivateNetworks(final Predicate> filter) {
- return ImmutableList.copyOf(filter(listPrivateNetworks(), filter));
- }
-
- public PrivateNetwork findPrivateNetwork(final Predicate> filter) {
- return Iterables.getFirst(filter(listPrivateNetworks(), filter), null);
- }
-
- public PrivateNetwork getPrivateNetwork(final Integer id) {
- VLANNetworkDto network = context.getApi().getCloudApi().getPrivateNetwork(target, id);
- return wrap(context, PrivateNetwork.class, network);
- }
-
- /**
- * TODO needs to be in the wiki
- */
- public List listAvailableTemplates() {
- VirtualMachineTemplatesDto templates = context.getApi().getCloudApi().listAvailableTemplates(target);
-
- return wrap(context, VirtualMachineTemplate.class, templates.getCollection());
- }
-
- public List listAvailableTemplates(final VirtualMachineTemplateOptions options) {
- VirtualMachineTemplatesDto templates = context.getApi().getCloudApi().listAvailableTemplates(target, options);
-
- return wrap(context, VirtualMachineTemplate.class, templates.getCollection());
- }
-
- public List listAvailableTemplates(final Predicate filter) {
- return ImmutableList.copyOf(filter(listAvailableTemplates(), filter));
- }
-
- public VirtualMachineTemplate findAvailableTemplate(final Predicate filter) {
- return Iterables.getFirst(filter(listAvailableTemplates(), filter), null);
- }
-
- public VirtualMachineTemplate getAvailableTemplate(final Integer id) {
- VirtualMachineTemplatesDto templates = context.getApi().getCloudApi()
- .listAvailableTemplates(target, VirtualMachineTemplateOptions.builder().idTemplate(id).build());
-
- return templates.getCollection().isEmpty() ? null : //
- wrap(context, VirtualMachineTemplate.class, templates.getCollection().get(0));
- }
-
- public VirtualMachineTemplate getAvailablePersistentTemplate(final Integer id) {
- VirtualMachineTemplatesDto templates = context
- .getApi()
- .getCloudApi()
- .listAvailableTemplates(target,
- VirtualMachineTemplateOptions.builder().idTemplate(id).persistent(StatefulInclusion.ALL).build());
-
- return templates.getCollection().isEmpty() ? null : //
- wrap(context, VirtualMachineTemplate.class, templates.getCollection().get(0));
- }
-
- /**
- * @see API: http://community.abiquo.com/display/ABI20/Virtual+Datacenter+
- * Resource#
- * VirtualDatacenterResource-ListofPublicIPstopurchasebyVirtualDatacenter
- *
- */
- public List listAvailablePublicIps() {
- IpOptions options = IpOptions.builder().build();
-
- PublicIpsDto ips = context.getApi().getCloudApi().listAvailablePublicIps(target, options);
-
- return wrap(context, PublicIp.class, ips.getCollection());
- }
-
- public List listAvailablePublicIps(final Predicate filter) {
- return ImmutableList.copyOf(filter(listAvailablePublicIps(), filter));
- }
-
- public PublicIp findAvailablePublicIp(final Predicate filter) {
- return Iterables.getFirst(filter(listAvailablePublicIps(), filter), null);
- }
-
- /**
- * @see API: http://community.abiquo.com/display/ABI20/Virtual+Datacenter+
- * Resource#
- * VirtualDatacenterResource-ListofpurchasedPublicIPsbyVirtualDatacenter
- *
- */
- public List listPurchasedPublicIps() {
- IpOptions options = IpOptions.builder().build();
-
- PublicIpsDto ips = context.getApi().getCloudApi().listPurchasedPublicIps(target, options);
-
- return wrap(context, PublicIp.class, ips.getCollection());
- }
-
- public List listPurchasedPublicIps(final Predicate filter) {
- return ImmutableList.copyOf(filter(listPurchasedPublicIps(), filter));
- }
-
- public PublicIp findPurchasedPublicIp(final Predicate filter) {
- return Iterables.getFirst(filter(listPurchasedPublicIps(), filter), null);
- }
-
- public void purchasePublicIp(final PublicIp ip) {
- checkNotNull(ip.unwrap().searchLink("purchase"), ValidationErrors.MISSING_REQUIRED_LINK);
- context.getApi().getCloudApi().purchasePublicIp(ip.unwrap());
- }
-
- public void releasePublicIp(final PublicIp ip) {
- checkNotNull(ip.unwrap().searchLink("release"), ValidationErrors.MISSING_REQUIRED_LINK);
- context.getApi().getCloudApi().releasePublicIp(ip.unwrap());
- }
-
- // Actions
-
- public void setDefaultNetwork(final Network> network) {
- context.getApi().getCloudApi().setDefaultNetwork(target, network.unwrap());
- }
-
- // Builder
-
- public static Builder builder(final RestContext context, final Datacenter datacenter,
- final Enterprise enterprise) {
- return new Builder(context, datacenter, enterprise);
- }
-
- public static class Builder extends LimitsBuilder {
- private RestContext context;
-
- private String name;
-
- private HypervisorType hypervisorType;
-
- private Enterprise enterprise;
-
- private Datacenter datacenter;
-
- private PrivateNetwork network;
-
- public Builder(final RestContext context, final Datacenter datacenter,
- final Enterprise enterprise) {
- super();
- checkNotNull(datacenter, ValidationErrors.NULL_RESOURCE + Datacenter.class);
- this.datacenter = datacenter;
- checkNotNull(enterprise, ValidationErrors.NULL_RESOURCE + Enterprise.class);
- this.enterprise = enterprise;
- this.context = context;
- }
-
- public Builder name(final String name) {
- this.name = name;
- return this;
- }
-
- public Builder hypervisorType(final HypervisorType hypervisorType) {
- this.hypervisorType = hypervisorType;
- return this;
- }
-
- public Builder datacenter(final Datacenter datacenter) {
- checkNotNull(datacenter, ValidationErrors.NULL_RESOURCE + Datacenter.class);
- this.datacenter = datacenter;
- return this;
- }
-
- public Builder enterprise(final Enterprise enterprise) {
- checkNotNull(enterprise, ValidationErrors.NULL_RESOURCE + Enterprise.class);
- this.enterprise = enterprise;
- return this;
- }
-
- public Builder network(final PrivateNetwork network) {
- checkNotNull(network, ValidationErrors.NULL_RESOURCE + PrivateNetwork.class);
- this.network = network;
- return this;
- }
-
- public VirtualDatacenter build() {
- VirtualDatacenterDto dto = new VirtualDatacenterDto();
- dto.setName(name);
- dto.setRamLimitsInMb(ramSoftLimitInMb, ramHardLimitInMb);
- dto.setCpuCountLimits(cpuCountSoftLimit, cpuCountHardLimit);
- dto.setHdLimitsInMb(hdSoftLimitInMb, hdHardLimitInMb);
- dto.setStorageLimits(storageSoft, storageHard);
- dto.setVlansLimits(vlansSoft, vlansHard);
- dto.setPublicIPLimits(publicIpsSoft, publicIpsHard);
- dto.setName(name);
- dto.setHypervisorType(hypervisorType);
- dto.setVlan(network.unwrap());
-
- VirtualDatacenter virtualDatacenter = new VirtualDatacenter(context, dto);
- virtualDatacenter.datacenter = datacenter;
- virtualDatacenter.enterprise = enterprise;
-
- return virtualDatacenter;
- }
-
- public static Builder fromVirtualDatacenter(final VirtualDatacenter in) {
- return VirtualDatacenter.builder(in.context, in.datacenter, in.enterprise).name(in.getName())
- .ramLimits(in.getRamSoftLimitInMb(), in.getRamHardLimitInMb())
- .cpuCountLimits(in.getCpuCountSoftLimit(), in.getCpuCountHardLimit())
- .hdLimitsInMb(in.getHdSoftLimitInMb(), in.getHdHardLimitInMb())
- .storageLimits(in.getStorageSoft(), in.getStorageHard())
- .vlansLimits(in.getVlansSoft(), in.getVlansHard())
- .publicIpsLimits(in.getPublicIpsSoft(), in.getPublicIpsHard()).hypervisorType(in.getHypervisorType());
- }
- }
-
- // Delegate methods
-
- public HypervisorType getHypervisorType() {
- return target.getHypervisorType();
- }
-
- public Integer getId() {
- return target.getId();
- }
-
- public String getName() {
- return target.getName();
- }
-
- public void setHypervisorType(final HypervisorType hypervisorType) {
- target.setHypervisorType(hypervisorType);
- }
-
- public void setName(final String name) {
- target.setName(name);
- }
-
- @Override
- public String toString() {
- return "VirtualDatacenter [id=" + getId() + ", type=" + getHypervisorType() + ", name=" + getName() + "]";
- }
-
-}
diff --git a/labs/abiquo/src/main/java/org/jclouds/abiquo/domain/cloud/VirtualMachine.java b/labs/abiquo/src/main/java/org/jclouds/abiquo/domain/cloud/VirtualMachine.java
deleted file mode 100644
index f9353694f5..0000000000
--- a/labs/abiquo/src/main/java/org/jclouds/abiquo/domain/cloud/VirtualMachine.java
+++ /dev/null
@@ -1,899 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds 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.abiquo.domain.cloud;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.collect.Iterables.filter;
-
-import java.util.Arrays;
-import java.util.List;
-
-import org.jclouds.abiquo.AbiquoApi;
-import org.jclouds.abiquo.AbiquoAsyncApi;
-import org.jclouds.abiquo.domain.DomainWithTasksWrapper;
-import org.jclouds.abiquo.domain.cloud.options.VirtualMachineOptions;
-import org.jclouds.abiquo.domain.enterprise.Enterprise;
-import org.jclouds.abiquo.domain.network.Ip;
-import org.jclouds.abiquo.domain.network.Network;
-import org.jclouds.abiquo.domain.network.UnmanagedNetwork;
-import org.jclouds.abiquo.domain.task.AsyncTask;
-import org.jclouds.abiquo.domain.util.LinkUtils;
-import org.jclouds.abiquo.features.services.MonitoringService;
-import org.jclouds.abiquo.monitor.VirtualMachineMonitor;
-import org.jclouds.abiquo.predicates.LinkPredicates;
-import org.jclouds.abiquo.reference.ValidationErrors;
-import org.jclouds.abiquo.reference.rest.ParentLinkName;
-import org.jclouds.abiquo.rest.internal.ExtendedUtils;
-import org.jclouds.abiquo.strategy.cloud.ListAttachedNics;
-import org.jclouds.http.HttpResponse;
-import org.jclouds.http.functions.ParseXMLWithJAXB;
-import org.jclouds.rest.RestContext;
-
-import com.abiquo.model.rest.RESTLink;
-import com.abiquo.model.transport.AcceptedRequestDto;
-import com.abiquo.server.core.appslibrary.VirtualMachineTemplateDto;
-import com.abiquo.server.core.cloud.VirtualApplianceDto;
-import com.abiquo.server.core.cloud.VirtualDatacenterDto;
-import com.abiquo.server.core.cloud.VirtualMachineState;
-import com.abiquo.server.core.cloud.VirtualMachineStateDto;
-import com.abiquo.server.core.cloud.VirtualMachineTaskDto;
-import com.abiquo.server.core.cloud.VirtualMachineWithNodeExtendedDto;
-import com.abiquo.server.core.enterprise.EnterpriseDto;
-import com.abiquo.server.core.infrastructure.network.UnmanagedIpDto;
-import com.abiquo.server.core.infrastructure.network.VMNetworkConfigurationDto;
-import com.abiquo.server.core.infrastructure.network.VMNetworkConfigurationsDto;
-import com.abiquo.server.core.infrastructure.storage.DiskManagementDto;
-import com.abiquo.server.core.infrastructure.storage.DisksManagementDto;
-import com.abiquo.server.core.infrastructure.storage.DvdManagementDto;
-import com.abiquo.server.core.infrastructure.storage.VolumeManagementDto;
-import com.abiquo.server.core.infrastructure.storage.VolumesManagementDto;
-import com.google.common.base.Function;
-import com.google.common.base.Predicate;
-import com.google.common.base.Predicates;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Lists;
-import com.google.inject.TypeLiteral;
-
-/**
- * Adds high level functionality to {@link VirtualMachineWithNodeExtendedDto}.
- *
- * @author Ignasi Barrera
- * @author Francesc Montserrat
- * @see API:
- * http://community.abiquo.com/display/ABI20/VirtualMachineResource
- */
-public class VirtualMachine extends DomainWithTasksWrapper {
- /** The virtual appliance where the virtual machine belongs. */
- private VirtualAppliance virtualAppliance;
-
- /** The virtual machine template of the virtual machine. */
- private VirtualMachineTemplate template;
-
- /**
- * Constructor to be used only by the builder.
- */
- protected VirtualMachine(final RestContext context,
- final VirtualMachineWithNodeExtendedDto target) {
- super(context, target);
- }
-
- // Domain operations
-
- /**
- * Delete the virtual machine.
- *
- * @see API: http://community.abiquo.com/display/ABI20/VirtualMachineResource#
- * VirtualMachineResource -Deleteavirtualmachine
- */
- public void delete() {
- context.getApi().getCloudApi().deleteVirtualMachine(target);
- target = null;
- }
-
- /**
- * Create a new virtual machine in Abiquo.
- *
- * @see API: http://community.abiquo.com/display/ABI20/VirtualMachineResource#
- * VirtualMachineResource-Createavirtualmachine
- */
- public void save() {
- checkNotNull(template, ValidationErrors.NULL_RESOURCE + VirtualMachineTemplate.class);
- checkNotNull(template.getId(), ValidationErrors.MISSING_REQUIRED_FIELD + " id in " + VirtualMachineTemplate.class);
-
- this.updateLink(target, ParentLinkName.VIRTUAL_MACHINE_TEMPLATE, template.unwrap(), "edit");
-
- target = context.getApi().getCloudApi().createVirtualMachine(virtualAppliance.unwrap(), target);
- }
-
- /**
- * Update virtual machine information in the server with the data from this
- * virtual machine. This is an asynchronous call. This method returns a
- * {@link org.jclouds.abiquo.domain.task.AsyncTask} object that keeps track
- * of the task completion. Please refer to the documentation for details.
- *
- * @see API: http://community.abiquo.com/display/ABI20/VirtualMachineResource#
- * VirtualMachineResource-Modifyavirtualmachine
- * @see github: https://github.com/abiquo/jclouds-abiquo/wiki/Asynchronous-monitor-
- * example
- * @return The task reference or null
if the operation completed
- * synchronously.
- */
- public AsyncTask update() {
- AcceptedRequestDto taskRef = context.getApi().getCloudApi().updateVirtualMachine(target);
- return taskRef == null ? null : getTask(taskRef);
- }
-
- /**
- * Update virtual machine information in the server with the data from this
- * virtual machine. This is an asynchronous call. This method returns a
- * {@link org.jclouds.abiquo.domain.task.AsyncTask} object that keeps track
- * of the task completion. Please refer to the documentation for details.
- *
- * @param force
- * Force update.
- * @see API: http://community.abiquo.com/display/ABI20/VirtualMachineResource#
- * VirtualMachineResource-Modifyavirtualmachine
- * @see github: https://github.com/abiquo/jclouds-abiquo/wiki/Asynchronous-monitor-
- * example
- * @return The task reference or null
if the operation completed
- * synchronously.
- */
- public AsyncTask update(final boolean force) {
- AcceptedRequestDto taskRef = context.getApi().getCloudApi()
- .updateVirtualMachine(target, VirtualMachineOptions.builder().force(force).build());
- return taskRef == null ? null : getTask(taskRef);
- }
-
- /**
- * Change the state of the virtual machine. This is an asynchronous call.
- * This method returns a {@link org.jclouds.abiquo.domain.task.AsyncTask}
- * object that keeps track of the task completion. Please refer to the
- * documentation for details.
- *
- * @param state
- * The new state of the virtual machine.
- * @see API: http://community.abiquo.com/display/ABI20/VirtualMachineResource#
- * VirtualMachineResource-Changethestateofavirtualmachine
- * @see github: https://github.com/abiquo/jclouds-abiquo/wiki/Asynchronous-monitor-
- * example
- * @return The task reference or null
if the operation completed
- * synchronously.
- */
- public AsyncTask changeState(final VirtualMachineState state) {
- VirtualMachineStateDto dto = new VirtualMachineStateDto();
- dto.setState(state);
-
- AcceptedRequestDto taskRef = context.getApi().getCloudApi().changeVirtualMachineState(target, dto);
-
- return getTask(taskRef);
- }
-
- /**
- * Retrieve the state of the virtual machine.
- *
- * @see API: http://community.abiquo.com/display/ABI20/VirtualMachineResource#
- * VirtualMachineResource-Retrievethestateofthevirtualmachine
- * @return Current state of the virtual machine.
- */
- public VirtualMachineState getState() {
- VirtualMachineStateDto stateDto = context.getApi().getCloudApi().getVirtualMachineState(target);
- VirtualMachineState state = stateDto.getState();
- target.setState(state);
- target.setIdState(state.id());
- return state;
- }
-
- // Parent access
-
- /**
- * Retrieve the virtual appliance where this virtual machine is.
- *
- * @see API: http://community.abiquo.com/display/ABI20/VirtualApplianceResource#
- * VirtualApplianceResource-Retrieveavirtualappliance
- * @return The virtual appliance where this virtual machine is.
- */
- public VirtualAppliance getVirtualAppliance() {
- RESTLink link = checkNotNull(target.searchLink(ParentLinkName.VIRTUAL_APPLIANCE),
- ValidationErrors.MISSING_REQUIRED_LINK + " " + ParentLinkName.VIRTUAL_APPLIANCE);
-
- ExtendedUtils utils = (ExtendedUtils) context.getUtils();
- HttpResponse response = utils.getAbiquoHttpClient().get(link);
-
- ParseXMLWithJAXB parser = new ParseXMLWithJAXB(utils.getXml(),
- TypeLiteral.get(VirtualApplianceDto.class));
-
- return wrap(context, VirtualAppliance.class, parser.apply(response));
- }
-
- /**
- * Retrieve the virtual datacenter where this virtual machine is.
- *
- * @see API: http://community.abiquo.com/display/ABI20/VirtualDatacenterResource
- * # VirtualDatacenterResource-Retireveavirtualdatacenter
- * @return The virtual datacenter where this virtual machine is.
- */
- public VirtualDatacenter getVirtualDatacenter() {
- Integer virtualDatacenterId = target.getIdFromLink(ParentLinkName.VIRTUAL_DATACENTER);
- VirtualDatacenterDto dto = context.getApi().getCloudApi().getVirtualDatacenter(virtualDatacenterId);
- return wrap(context, VirtualDatacenter.class, dto);
- }
-
- /**
- * Retrieve the enterprise of this virtual machine.
- *
- * @see API: http://community.abiquo.com/display/ABI20/EnterpriseResource#
- * EnterpriseResource- RetrieveanEnterprise
- * @return Enterprise of this virtual machine.
- */
- public Enterprise getEnterprise() {
- Integer enterpriseId = target.getIdFromLink(ParentLinkName.ENTERPRISE);
- EnterpriseDto dto = context.getApi().getEnterpriseApi().getEnterprise(enterpriseId);
- return wrap(context, Enterprise.class, dto);
- }
-
- /**
- * Retrieve the template of this virtual machine.
- *
- * @return Template of this virtual machine.
- */
- public VirtualMachineTemplate getTemplate() {
- VirtualMachineTemplateDto dto = context.getApi().getCloudApi().getVirtualMachineTemplate(target);
- return wrap(context, VirtualMachineTemplate.class, dto);
- }
-
- // Children access
-
- public List listAttachedHardDisks() {
- refresh();
- DisksManagementDto hardDisks = context.getApi().getCloudApi().listAttachedHardDisks(target);
- return wrap(context, HardDisk.class, hardDisks.getCollection());
- }
-
- public List listAttachedHardDisks(final Predicate