http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/Task.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/Task.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/Task.java new file mode 100644 index 0000000..82585d6 --- /dev/null +++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/Task.java @@ -0,0 +1,72 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jclouds.vcloud.domain; + +import java.util.Date; + +import org.jclouds.javax.annotation.Nullable; +import org.jclouds.vcloud.domain.internal.TaskImpl; + +import com.google.inject.ImplementedBy; + +/** + * Whenever the result of a request cannot be returned immediately, the server creates a Task + * object. Tasks owned by an object such as a vApp or vDC are contained in the Tasks element of the + * objectâs XML representation. This element is readâonly. + */ +@ImplementedBy(TaskImpl.class) +public interface Task extends ReferenceType { + /** + * The current status of the task. + */ + String getOperation(); + + /** + * The current status of the task. + */ + TaskStatus getStatus(); + + /** + * date and time when the task was started. + */ + Date getStartTime(); + + /** + * date and time when the task completed. Does not appear for running tasks. + */ + Date getEndTime(); + + /** + * date and time at which the task expires. By default, tasks expire 24 hours after their start + * time. Expired tasks cannot be queried. + */ + Date getExpiryTime(); + + /** + * A link to the object that owns the task. For copy operations, the owner is the copy that is + * being created. For delete operations, the owner is the deleted object, so this element is not + * included. For all other operations, the owner is the object to which the request was made. + */ + ReferenceType getOwner(); + + /** + * error message or related information returned by the task + */ + @Nullable + VCloudError getError(); + +}
http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/TaskStatus.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/TaskStatus.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/TaskStatus.java new file mode 100644 index 0000000..68ee690 --- /dev/null +++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/TaskStatus.java @@ -0,0 +1,68 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jclouds.vcloud.domain; + +import static com.google.common.base.Preconditions.checkNotNull; + +public enum TaskStatus { + /** + * The task has completed and returned a value indicating success. + */ + SUCCESS, + /** + * The task is running. + */ + RUNNING, + + /** + * The task has been queued for execution. + */ + QUEUED, + /** + * The task has completed and returned a value indicating an error. + */ + ERROR, + /** + * not an official status, temporarily in. + */ + CANCELLED, UNRECOGNIZED; + public String value() { + return name().toLowerCase(); + } + + @Override + public String toString() { + return value(); + } + + public static TaskStatus fromValue(String status) { + if ("CANCELED".equals(status.toUpperCase())) { + // TODO: ecloud hack + status = "CANCELLED"; + } else if ("FAILED".equals(status.toUpperCase())) { + status = "ERROR"; + } else if ("COMPLETED".equals(status.toUpperCase())) { + status = "SUCCESS"; + } + try { + return valueOf(checkNotNull(status, "status").toUpperCase()); + } catch (IllegalArgumentException e) { + return UNRECOGNIZED; + } + } + +} http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/TasksList.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/TasksList.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/TasksList.java new file mode 100644 index 0000000..6405054 --- /dev/null +++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/TasksList.java @@ -0,0 +1,34 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jclouds.vcloud.domain; + +import java.net.URI; +import java.util.SortedSet; + +import org.jclouds.vcloud.domain.internal.TasksListImpl; + +import com.google.inject.ImplementedBy; + [email protected] +@ImplementedBy(TasksListImpl.class) +public interface TasksList { + + URI getLocation(); + + SortedSet<Task> getTasks(); + +} http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/VApp.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/VApp.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/VApp.java new file mode 100644 index 0000000..98efea2 --- /dev/null +++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/VApp.java @@ -0,0 +1,85 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jclouds.vcloud.domain; + +import java.util.List; +import java.util.Set; + +import org.jclouds.javax.annotation.Nullable; +import org.jclouds.vcloud.domain.ovf.VCloudNetworkSection; + +/** + * A VApp is the result of instantiation of a {@link VAppTemplate}. <h2>note</h2> + * <p/> + * When the {@link #getStatus} is {@link Status#UNRESOLVED}, there will be a task present for the + * instantiation of the VApp. + */ +public interface VApp extends ReferenceType { + /** + * Reference to the vdc containing this vApp. + * + * @since vcloud api 1.0 + * @return vdc, or null if this is a version before 1.0 where the org isn't present + */ + ReferenceType getVDC(); + + /** + * The creation status of the vDC + * + * @since vcloud api 1.0 + */ + Status getStatus(); + + /** + * optional description + * + * @since vcloud api 0.8 + */ + @Nullable + String getDescription(); + + /** + * + * @return true if the OVF descriptor for the template has been uploaded to the containing vDC. + * @since vcloud api 1.0 + */ + boolean isOvfDescriptorUploaded(); + + /** + * readâonly container for Task elements. Each element in the container represents a queued, + * running, or failed task owned by this object. + * + * @since vcloud api 1.0 + */ + List<Task> getTasks(); + + /** + * container for Vm elements representing virtual machines + * + * @since vcloud api 1.0 + */ + Set<Vm> getChildren(); + + /** + * description of the predefined vApp internal networks in this template + * + * @return null if the vApp is not yet instantiated + * @since vcloud api 1.0 + */ + @Nullable + VCloudNetworkSection getNetworkSection(); +} http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/VAppTemplate.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/VAppTemplate.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/VAppTemplate.java new file mode 100644 index 0000000..8fdd6fb --- /dev/null +++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/VAppTemplate.java @@ -0,0 +1,95 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jclouds.vcloud.domain; + +import java.util.List; +import java.util.Set; + +import org.jclouds.javax.annotation.Nullable; +import org.jclouds.vcloud.domain.internal.VAppTemplateImpl; +import org.jclouds.vcloud.domain.ovf.VCloudNetworkSection; + +import com.google.inject.ImplementedBy; + +/** + * A VAppTemplate is an abstract description of a vApp. It is created when you upload an OVF package + * to a vDC. + */ +@ImplementedBy(VAppTemplateImpl.class) +public interface VAppTemplate extends ReferenceType { + /** + * Reference to the VDC containing this template. + * + * @since vcloud api 1.0 + * @return org, or null if this is a version before 1.0 where the vdc isn't present + */ + ReferenceType getVDC(); + + /** + * @return creation status of the VAppTemplate. + * + * @since vcloud api 1.0 + */ + Status getStatus(); + + /** + * optional description + * + * @since vcloud api 1.0 + */ + @Nullable + String getDescription(); + + /** + * read-only container for Task elements. Each element in the container represents a queued, + * running, or failed task owned by this object. + * + * @since vcloud api 1.0 + */ + List<Task> getTasks(); + + /** + * + * @return true if the OVF descriptor for the template has been uploaded to the containing vDC. + * @since vcloud api 1.0 + */ + boolean isOvfDescriptorUploaded(); + + /** + * read-only identifier created on import + * + * @since vcloud api 1.0 + */ + @Nullable + String getVAppScopedLocalId(); + + /** + * container for Vm elements representing virtual machines + * + * @since vcloud api 1.0 + */ + Set<Vm> getChildren(); + + /** + * description of the predefined vApp internal networks in this template + * + * @return null if the vAppTemplate is still copying + * @since vcloud api 1.0 + */ + @Nullable + VCloudNetworkSection getNetworkSection(); +} http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/VCloudError.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/VCloudError.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/VCloudError.java new file mode 100644 index 0000000..3fa88b6 --- /dev/null +++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/VCloudError.java @@ -0,0 +1,118 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jclouds.vcloud.domain; + +import static com.google.common.base.Preconditions.checkNotNull; + +import org.jclouds.javax.annotation.Nullable; +import org.jclouds.vcloud.domain.internal.ErrorImpl; + +import com.google.inject.ImplementedBy; + +@ImplementedBy(ErrorImpl.class) +public interface VCloudError { + public static enum MinorCode { + /** + * The request was made by a user who had insufficient rights to the object or operation. + */ + ACCESS_TO_RESOURCE_IS_FORBIDDEN, + /** + * The request could not be validated or contained invalid XML. + */ + BAD_REQUEST, + /** + * A conflict was detected between sections of an OVF descriptor. + */ + CONFLICT, + /** + * The entity is busy + */ + BUSY_ENTITY, + /** + * An attempt to instantiate a vAppTemplate or use a vAppTemplate or a Vm in a composition did + * not include an AllEULAsAccepted element with a value of true. + */ + EULA_NOT_ACCEPTED, + /** + * Returned for any failure that cannot be matched to another minor error code. + */ + INTERNAL_SERVER_ERROR, + /** + * One or more references (href attribute values) supplied in the request could not be + * resolved to an object. + */ + INVALID_REFERENCE, + /** + * The HTTP method (GET, PUT, POST, DELETE) is not allowed for the request. + */ + METHOD_NOT_ALLOWED, + /** + * One or more references (href attribute values) supplied in the request could not be + * resolved to an object, or the Contentâtype of the request was incorrect. + */ + RESOURCE_NOT_FOUND, + /** + * The request raised an exception that did not match any HTTP status code. + */ + UNKNOWN, + /** + * The wrong content type was specified for the request. + */ + UNSUPPORTED_MEDIA_TYPE, UNRECOGNIZED; + + public static MinorCode fromValue(String minorCode) { + try { + return valueOf(checkNotNull(minorCode, "minorCode")); + } catch (IllegalArgumentException e) { + return UNRECOGNIZED; + } + } + } + + /** + * + * @return message describing the error + */ + String getMessage(); + + /** + * + * @return matches the HTTP status code + */ + int getMajorErrorCode(); + + /** + * + * @return error code specific to the failed operation or null if vcloud <0.9 + */ + @Nullable + MinorCode getMinorErrorCode(); + + /** + * + * @return optional additional information about the source of the error + */ + @Nullable + String getVendorSpecificErrorCode(); + + /** + * + * @return stack trace of the error, if available. This attribute is returned only when a request + * is made by the system administrator. + */ + String getStackTrace(); +} http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/VCloudSession.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/VCloudSession.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/VCloudSession.java new file mode 100644 index 0000000..01acd91 --- /dev/null +++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/VCloudSession.java @@ -0,0 +1,25 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jclouds.vcloud.domain; + +import java.util.Map; + +public interface VCloudSession { + String getVCloudToken(); + + Map<String, ReferenceType> getOrgs(); +} http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/VDC.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/VDC.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/VDC.java new file mode 100644 index 0000000..c741d26 --- /dev/null +++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/VDC.java @@ -0,0 +1,144 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jclouds.vcloud.domain; + +import java.util.List; +import java.util.Map; + +import org.jclouds.javax.annotation.Nullable; +import org.jclouds.vcloud.domain.internal.VDCImpl; + +import com.google.inject.ImplementedBy; + +/** + * A vDC is a deployment environment for vApps. A Vdc element provides a user view of a vDC. + */ [email protected] +@ImplementedBy(VDCImpl.class) +public interface VDC extends ReferenceType { + /** + * Reference to the org containing this vDC. + * + * @since vcloud api 1.0 + * @return org, or null if this is a version before 1.0 where the org isn't present + */ + ReferenceType getOrg(); + + /** + * The creation status of the vDC + * + * @since vcloud api 1.0 + */ + VDCStatus getStatus(); + + /** + * optional description + * + * @since vcloud api 0.8 + */ + @Nullable + String getDescription(); + + /** + * readâonly container for Task elements. Each element in the container represents a queued, + * running, or failed task owned by this object. + * + * @since vcloud api 1.0 + */ + List<Task> getTasks(); + + /** + * defines how resources are allocated by the vDC. The value of this element is set by the + * administrator who created the vDC. It is readâonly to users. + * + * @since vcloud api 1.0 + */ + AllocationModel getAllocationModel(); + + /** + * defines the storage capacity available in the vDC + * + * @since vcloud api 0.8 + * @return null if the provider doesn't support storage capacity + */ + @Nullable + Capacity getStorageCapacity(); + + /** + * reports CPU resource consumption in a vDC + * + * @since vcloud api 0.8 + * @return null if the provider doesn't support cpu capacity + */ + @Nullable + Capacity getCpuCapacity(); + + /** + * reports memory resource consumption in a vDC + * + * @since vcloud api 0.8 + * @return null if the provider doesn't support memory capacity + */ + @Nullable + Capacity getMemoryCapacity(); + + /** + * container for ResourceEntity elements + * + * @since vcloud api 0.8 + */ + Map<String, ReferenceType> getResourceEntities(); + + /** + * container for OrgNetwork elements that represent organization networks contained by the vDC + * + * @since vcloud api 0.8 + */ + Map<String, ReferenceType> getAvailableNetworks(); + + /** + * maximum number of virtual NICs allowed in this vDC. Defaults to 0, which specifies an + * unlimited number. + * + * @since vcloud api 1.0 + */ + int getNicQuota(); + + /** + * maximum number of OrgNetwork objects that can be deployed in this vDC. Defaults to 0, which + * specifies an unlimited number. + * + * @since vcloud api 1.0 + */ + int getNetworkQuota(); + + /** + * maximum number of virtual machines that can be deployed in this vDC. Defaults to 0, which + * specifies an unlimited number. + * + * @since vcloud api 0.8 + */ + int getVmQuota(); + + /** + * true if this vDC is enabled + * + * @since vcloud api 1.0 + */ + boolean isEnabled(); + +} http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/VDCStatus.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/VDCStatus.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/VDCStatus.java new file mode 100644 index 0000000..81b25d9 --- /dev/null +++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/VDCStatus.java @@ -0,0 +1,57 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jclouds.vcloud.domain; + +/** + * The creation status of the vDC + * + * @see VDC#getStatus + */ +public enum VDCStatus { + + CREATION_FAILED, NOT_READY, READY, UNKNOWN, UNRECOGNIZED; + + public int value() { + switch (this) { + case CREATION_FAILED: + return -1; + case NOT_READY: + return 0; + case READY: + return 1; + case UNKNOWN: + return 2; + default: + return 3; + } + } + + public static VDCStatus fromValue(int status) { + switch (status) { + case -1: + return CREATION_FAILED; + case 0: + return NOT_READY; + case 1: + return READY; + case 2: + return UNKNOWN; + default: + return UNRECOGNIZED; + } + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/Vm.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/Vm.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/Vm.java new file mode 100644 index 0000000..79657b1 --- /dev/null +++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/Vm.java @@ -0,0 +1,106 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jclouds.vcloud.domain; + +import java.util.List; + +import org.jclouds.javax.annotation.Nullable; +import org.jclouds.vcloud.domain.internal.VmImpl; +import org.jclouds.vcloud.domain.ovf.VCloudOperatingSystemSection; +import org.jclouds.vcloud.domain.ovf.VCloudVirtualHardwareSection; + +import com.google.inject.ImplementedBy; + +/** + * A Vm represents a virtual machine, a member of a vAppâs Children container. <h2>note</h2> + * <p/> + * When the {@link #getStatus} is {@link Status#UNRESOLVED}, there will be a task present for the + * instantiation of the VApp. + */ +@ImplementedBy(VmImpl.class) +public interface Vm extends ReferenceType { + /** + * Reference to the {@link VApp} or {@link VAppTemplate} containing this vm. + * + * @since vcloud api 1.0 + */ + ReferenceType getParent(); + + /** + * @return creation status of the Vm or null, if a part of a VAppTemplate + * + * @since vcloud api 1.0 + */ + @Nullable + Status getStatus(); + + /** + * optional description + * + * @since vcloud api 0.8 + */ + @Nullable + String getDescription(); + + /** + * readâonly container for Task elements. Each element in the container represents a queued, + * running, or failed task owned by this object. + * + * @since vcloud api 1.0 + */ + List<Task> getTasks(); + + /** + * @return virtual hardware that comprises this VM, or null, if part of a vApp template + * + * @since vcloud api 1.0 + */ + @Nullable + VCloudVirtualHardwareSection getVirtualHardwareSection(); + + /** + * @return operating system on this VM, or null, if part of a vApp template + * + * @since vcloud api 1.0 + */ + @Nullable + VCloudOperatingSystemSection getOperatingSystemSection(); + + /** + * @return network connections for this VM, or null if it doesn't exist + * + * @since vcloud api 1.0 + */ + @Nullable + NetworkConnectionSection getNetworkConnectionSection(); + + /** + * @return guest customization section for this VM, or null if it doesn't exist + * + * @since vcloud api 1.0 + */ + @Nullable + GuestCustomizationSection getGuestCustomizationSection(); + + /** + * read-only identifier created on import + * + * @since vcloud api 1.0 + */ + @Nullable + String getVAppScopedLocalId(); +} http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/CatalogImpl.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/CatalogImpl.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/CatalogImpl.java new file mode 100644 index 0000000..03d1532 --- /dev/null +++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/CatalogImpl.java @@ -0,0 +1,189 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jclouds.vcloud.domain.internal; + +import static com.google.common.base.Preconditions.checkNotNull; + +import java.net.URI; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +import org.jclouds.javax.annotation.Nullable; +import org.jclouds.vcloud.domain.Catalog; +import org.jclouds.vcloud.domain.ReferenceType; +import org.jclouds.vcloud.domain.Task; + +import com.google.common.collect.Iterables; +import com.google.common.collect.Lists; + +/** + * Locations of resources in vCloud + */ +public class CatalogImpl extends LinkedHashMap<String, ReferenceType> implements Catalog { + + private final String name; + private final String type; + private final URI href; + private final ReferenceType org; + @Nullable + private final String description; + private final List<Task> tasks = Lists.newArrayList(); + private final boolean published; + private final boolean readOnly; + + public CatalogImpl(String name, String type, URI href, ReferenceType org, @Nullable String description, + Map<String, ReferenceType> contents, Iterable<Task> tasks, boolean published, boolean readOnly) { + this.name = checkNotNull(name, "name"); + this.type = checkNotNull(type, "type"); + this.org = org;// TODO: once <1.0 is killed check not null + this.description = description; + this.href = checkNotNull(href, "href"); + putAll(checkNotNull(contents, "contents")); + Iterables.addAll(this.tasks, checkNotNull(tasks, "tasks")); + this.published = published; + this.readOnly = readOnly; + } + + /** + * {@inheritDoc} + */ + @Override + public URI getHref() { + return href; + } + + /** + * {@inheritDoc} + */ + @Override + public String getName() { + return name; + } + + /** + * {@inheritDoc} + */ + @Override + public ReferenceType getOrg() { + return org; + } + + /** + * {@inheritDoc} + */ + public String getDescription() { + return description; + } + + /** + * {@inheritDoc} + */ + @Override + public String getType() { + return type; + } + + /** + * {@inheritDoc} + */ + @Override + public List<Task> getTasks() { + return tasks; + } + + /** + * {@inheritDoc} + */ + @Override + public boolean isPublished() { + return published; + } + + /** + * {@inheritDoc} + */ + @Override + public boolean isReadOnly() { + return readOnly; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = super.hashCode(); + result = prime * result + ((description == null) ? 0 : description.hashCode()); + result = prime * result + ((href == null) ? 0 : href.hashCode()); + result = prime * result + ((name == null) ? 0 : name.hashCode()); + result = prime * result + ((org == null) ? 0 : org.hashCode()); + result = prime * result + ((tasks == null) ? 0 : tasks.hashCode()); + result = prime * result + ((type == null) ? 0 : type.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (!super.equals(obj)) + return false; + if (getClass() != obj.getClass()) + return false; + CatalogImpl other = (CatalogImpl) obj; + if (description == null) { + if (other.description != null) + return false; + } else if (!description.equals(other.description)) + return false; + if (href == null) { + if (other.href != null) + return false; + } else if (!href.equals(other.href)) + return false; + if (name == null) { + if (other.name != null) + return false; + } else if (!name.equals(other.name)) + return false; + if (org == null) { + if (other.org != null) + return false; + } else if (!org.equals(other.org)) + return false; + if (tasks == null) { + if (other.tasks != null) + return false; + } else if (!tasks.equals(other.tasks)) + return false; + if (type == null) { + if (other.type != null) + return false; + } else if (!type.equals(other.type)) + return false; + return true; + } + + @Override + public int compareTo(ReferenceType o) { + return (this == o) ? 0 : getHref().compareTo(o.getHref()); + } + + @Override + public String getRelationship() { + throw new UnsupportedOperationException(); + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/CatalogItemImpl.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/CatalogItemImpl.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/CatalogItemImpl.java new file mode 100644 index 0000000..5cac6ab --- /dev/null +++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/CatalogItemImpl.java @@ -0,0 +1,106 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jclouds.vcloud.domain.internal; + +import static com.google.common.base.Preconditions.checkNotNull; + +import java.net.URI; +import java.util.Map; + +import org.jclouds.javax.annotation.Nullable; +import org.jclouds.vcloud.VCloudMediaType; +import org.jclouds.vcloud.domain.CatalogItem; +import org.jclouds.vcloud.domain.ReferenceType; + +import com.google.common.collect.Maps; + +public class CatalogItemImpl extends ReferenceTypeImpl implements CatalogItem { + + private final String description; + private final ReferenceType entity; + private final Map<String, String> properties = Maps.newLinkedHashMap(); + + public CatalogItemImpl(String name, URI id, @Nullable String description, ReferenceType entity, + Map<String, String> properties) { + super(name, VCloudMediaType.CATALOGITEM_XML, id); + this.description = description; + this.entity = checkNotNull(entity, "entity"); + this.properties.putAll(checkNotNull(properties, "properties")); + } + + @Override + public String getType() { + return VCloudMediaType.CATALOGITEM_XML; + } + + public ReferenceType getEntity() { + return entity; + } + + @Override + public String getDescription() { + return description; + } + + public Map<String, String> getProperties() { + return properties; + } + + @Override + public String toString() { + return "CatalogItemImpl [id=" + getHref() + ", name=" + getName() + ", type=" + getType() + ", description=" + + getDescription() + ", entity=" + entity + ", properties=" + properties + "]"; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = super.hashCode(); + result = prime * result + ((description == null) ? 0 : description.hashCode()); + result = prime * result + ((entity == null) ? 0 : entity.hashCode()); + result = prime * result + ((properties == null) ? 0 : properties.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (!super.equals(obj)) + return false; + if (getClass() != obj.getClass()) + return false; + CatalogItemImpl other = (CatalogItemImpl) obj; + if (description == null) { + if (other.description != null) + return false; + } else if (!description.equals(other.description)) + return false; + if (entity == null) { + if (other.entity != null) + return false; + } else if (!entity.equals(other.entity)) + return false; + if (properties == null) { + if (other.properties != null) + return false; + } else if (!properties.equals(other.properties)) + return false; + return true; + } + +} http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/ErrorImpl.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/ErrorImpl.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/ErrorImpl.java new file mode 100644 index 0000000..2550f1b --- /dev/null +++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/ErrorImpl.java @@ -0,0 +1,114 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jclouds.vcloud.domain.internal; + +import static com.google.common.base.Preconditions.checkNotNull; + +import org.jclouds.javax.annotation.Nullable; +import org.jclouds.vcloud.domain.VCloudError; + +public class ErrorImpl implements VCloudError { + private final String message; + private final int majorErrorCode; + private final MinorCode minorErrorCode; + @Nullable + private final String vendorSpecificErrorCode; + @Nullable + private final String stackTrace; + + public ErrorImpl(String message, int majorErrorCode, @Nullable MinorCode minorErrorCode, + @Nullable String vendorSpecificErrorCode, @Nullable String stackTrace) { + this.message = checkNotNull(message, "message"); + this.majorErrorCode = majorErrorCode; + this.minorErrorCode = minorErrorCode; // check null after 0.8 is gone + this.vendorSpecificErrorCode = vendorSpecificErrorCode; + this.stackTrace = stackTrace; + } + + public String getMessage() { + return message; + } + + public int getMajorErrorCode() { + return majorErrorCode; + } + + public MinorCode getMinorErrorCode() { + return minorErrorCode; + } + + public String getVendorSpecificErrorCode() { + return vendorSpecificErrorCode; + } + + public String getStackTrace() { + return stackTrace; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + majorErrorCode; + result = prime * result + ((message == null) ? 0 : message.hashCode()); + result = prime * result + ((minorErrorCode == null) ? 0 : minorErrorCode.hashCode()); + result = prime * result + ((stackTrace == null) ? 0 : stackTrace.hashCode()); + result = prime * result + ((vendorSpecificErrorCode == null) ? 0 : vendorSpecificErrorCode.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + ErrorImpl other = (ErrorImpl) obj; + if (majorErrorCode != other.majorErrorCode) + return false; + if (message == null) { + if (other.message != null) + return false; + } else if (!message.equals(other.message)) + return false; + if (minorErrorCode == null) { + if (other.minorErrorCode != null) + return false; + } else if (!minorErrorCode.equals(other.minorErrorCode)) + return false; + if (stackTrace == null) { + if (other.stackTrace != null) + return false; + } else if (!stackTrace.equals(other.stackTrace)) + return false; + if (vendorSpecificErrorCode == null) { + if (other.vendorSpecificErrorCode != null) + return false; + } else if (!vendorSpecificErrorCode.equals(other.vendorSpecificErrorCode)) + return false; + return true; + } + + @Override + public String toString() { + return "[majorErrorCode=" + majorErrorCode + ", message=" + message + ", minorErrorCode=" + minorErrorCode + + ", stackTrace=" + stackTrace + ", vendorSpecificErrorCode=" + vendorSpecificErrorCode + "]"; + } + +} http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/OrgImpl.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/OrgImpl.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/OrgImpl.java new file mode 100644 index 0000000..87327d1 --- /dev/null +++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/OrgImpl.java @@ -0,0 +1,168 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jclouds.vcloud.domain.internal; + +import static com.google.common.base.Preconditions.checkNotNull; + +import java.net.URI; +import java.util.List; +import java.util.Map; + +import org.jclouds.javax.annotation.Nullable; +import org.jclouds.vcloud.domain.Org; +import org.jclouds.vcloud.domain.ReferenceType; +import org.jclouds.vcloud.domain.Task; + +import com.google.common.collect.Iterables; +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; + +/** + * Locations of resources in vCloud + */ +public class OrgImpl extends ReferenceTypeImpl implements Org { + private final String fullName; + @Nullable + private final String description; + private final Map<String, ReferenceType> catalogs = Maps.newLinkedHashMap(); + private final Map<String, ReferenceType> vdcs = Maps.newLinkedHashMap(); + private final Map<String, ReferenceType> networks = Maps.newLinkedHashMap(); + private final ReferenceType tasksList; + private final List<Task> tasks = Lists.newArrayList(); + + public OrgImpl(String name, String type, URI id, String fullName, String description, + Map<String, ReferenceType> catalogs, Map<String, ReferenceType> vdcs, Map<String, ReferenceType> networks, + @Nullable ReferenceType tasksList, Iterable<Task> tasks) { + super(name, type, id); + this.fullName = checkNotNull(fullName, "fullName"); + this.description = description; + this.catalogs.putAll(checkNotNull(catalogs, "catalogs")); + this.vdcs.putAll(checkNotNull(vdcs, "vdcs")); + this.networks.putAll(checkNotNull(networks, "networks")); + this.tasksList = tasksList; + Iterables.addAll(this.tasks, checkNotNull(tasks, "tasks")); + } + + @Override + public String getFullName() { + return fullName; + } + + @Override + public String getDescription() { + return description; + } + + @Override + public Map<String, ReferenceType> getCatalogs() { + return catalogs; + } + + @Override + public Map<String, ReferenceType> getVDCs() { + return vdcs; + } + + @Override + public Map<String, ReferenceType> getNetworks() { + return networks; + } + + @Override + public ReferenceType getTasksList() { + return tasksList; + } + + @Override + public List<Task> getTasks() { + return tasks; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = super.hashCode(); + result = prime * result + ((catalogs == null) ? 0 : catalogs.hashCode()); + result = prime * result + ((description == null) ? 0 : description.hashCode()); + result = prime * result + ((fullName == null) ? 0 : fullName.hashCode()); + result = prime * result + ((networks == null) ? 0 : networks.hashCode()); + result = prime * result + ((tasks == null) ? 0 : tasks.hashCode()); + result = prime * result + ((tasksList == null) ? 0 : tasksList.hashCode()); + result = prime * result + ((vdcs == null) ? 0 : vdcs.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (!super.equals(obj)) + return false; + if (getClass() != obj.getClass()) + return false; + OrgImpl other = (OrgImpl) obj; + if (catalogs == null) { + if (other.catalogs != null) + return false; + } else if (!catalogs.equals(other.catalogs)) + return false; + if (description == null) { + if (other.description != null) + return false; + } else if (!description.equals(other.description)) + return false; + if (fullName == null) { + if (other.fullName != null) + return false; + } else if (!fullName.equals(other.fullName)) + return false; + if (networks == null) { + if (other.networks != null) + return false; + } else if (!networks.equals(other.networks)) + return false; + if (tasks == null) { + if (other.tasks != null) + return false; + } else if (!tasks.equals(other.tasks)) + return false; + if (tasksList == null) { + if (other.tasksList != null) + return false; + } else if (!tasksList.equals(other.tasksList)) + return false; + if (vdcs == null) { + if (other.vdcs != null) + return false; + } else if (!vdcs.equals(other.vdcs)) + return false; + return true; + } + + @Override + public int compareTo(ReferenceType o) { + return (this == o) ? 0 : getHref().compareTo(o.getHref()); + } + + @Override + public String toString() { + return "[href=" + getHref() + ", name=" + getName() + ", type=" + getType() + ", fullName=" + fullName + + ", description=" + description + ", catalogs=" + catalogs + ", networks=" + networks + ", tasksList=" + + tasksList + ", vdcs=" + vdcs + ", tasks=" + tasks + "]"; + } + +} http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/ReferenceTypeImpl.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/ReferenceTypeImpl.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/ReferenceTypeImpl.java new file mode 100644 index 0000000..fa128f9 --- /dev/null +++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/ReferenceTypeImpl.java @@ -0,0 +1,99 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jclouds.vcloud.domain.internal; + +import static com.google.common.base.Objects.equal; + +import java.net.URI; + +import org.jclouds.vcloud.domain.ReferenceType; + +import com.google.common.base.Objects; +import com.google.common.base.Objects.ToStringHelper; + +/** + * Location of a Rest resource + */ +public class ReferenceTypeImpl implements ReferenceType { + private final String name; + private final String type; + private final URI href; + private final String relationship; + + public ReferenceTypeImpl(String name, String type, URI href) { + this.name = name; + this.type = type; + this.href = href; + this.relationship = null; + } + + public ReferenceTypeImpl(String name, String type, URI href, String relationship) { + this.name = name; + this.type = type; + this.href = href; + this.relationship = relationship; + } + + @Override + public String getName() { + return name; + } + + @Override + public String getType() { + return type; + } + + @Override + public URI getHref() { + return href; + } + + @Override + public int compareTo(ReferenceType that) { + return (this == that) ? 0 : getHref().compareTo(that.getHref()); + } + + @Override + public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + ReferenceTypeImpl that = ReferenceTypeImpl.class.cast(o); + return equal(this.href, that.href); + } + + @Override + public int hashCode() { + return Objects.hashCode(href); + } + + @Override + public String toString() { + return string().toString(); + } + + protected ToStringHelper string() { + return Objects.toStringHelper("").omitNullValues().add("href", href).add("name", name).add("type", type).add("relationship", relationship); + } + + @Override + public String getRelationship() { + return relationship; + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/TaskImpl.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/TaskImpl.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/TaskImpl.java new file mode 100644 index 0000000..70815a1 --- /dev/null +++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/TaskImpl.java @@ -0,0 +1,160 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jclouds.vcloud.domain.internal; + +import static com.google.common.base.Preconditions.checkNotNull; + +import java.net.URI; +import java.util.Date; + +import org.jclouds.javax.annotation.Nullable; +import org.jclouds.vcloud.VCloudMediaType; +import org.jclouds.vcloud.domain.ReferenceType; +import org.jclouds.vcloud.domain.Task; +import org.jclouds.vcloud.domain.TaskStatus; +import org.jclouds.vcloud.domain.VCloudError; + +import com.google.common.base.Objects; + +public class TaskImpl extends ReferenceTypeImpl implements Task { + + private final String operation; + private final TaskStatus status; + private final Date startTime; + @Nullable + private final Date endTime; + @Nullable + private final Date expiryTime; + private final ReferenceType owner; + @Nullable + private final VCloudError error; + + public TaskImpl(URI id, String operation, TaskStatus status, Date startTime, @Nullable Date endTime, + @Nullable Date expiryTime, ReferenceType owner, VCloudError error) { + super(null, VCloudMediaType.TASK_XML, id); + this.operation = operation; + this.status = checkNotNull(status, "status"); + this.startTime = startTime; + this.endTime = endTime; + this.expiryTime = expiryTime; + this.owner = owner; + this.error = error; + } + + @Override + public TaskStatus getStatus() { + return status; + } + + @Override + public Date getStartTime() { + return startTime; + } + + @Override + public ReferenceType getOwner() { + return owner; + } + + @Override + public Date getEndTime() { + return endTime; + } + + @Override + public VCloudError getError() { + return error; + } + + @Override + public String toString() { + return Objects.toStringHelper("").omitNullValues().add("href", getHref()).add("name", getName()) + .add("owner", owner).add("operation", operation).add("startTime", startTime).add("endTime", endTime) + .add("expiryTime", expiryTime).add("error", error).toString(); + } + + public Date getExpiryTime() { + return expiryTime; + } + + @Override + public String getOperation() { + return operation; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = super.hashCode(); + result = prime * result + ((endTime == null) ? 0 : endTime.hashCode()); + result = prime * result + ((error == null) ? 0 : error.hashCode()); + result = prime * result + ((expiryTime == null) ? 0 : expiryTime.hashCode()); + result = prime * result + ((operation == null) ? 0 : operation.hashCode()); + result = prime * result + ((owner == null) ? 0 : owner.hashCode()); + result = prime * result + ((startTime == null) ? 0 : startTime.hashCode()); + result = prime * result + ((status == null) ? 0 : status.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (!super.equals(obj)) + return false; + if (getClass() != obj.getClass()) + return false; + TaskImpl other = (TaskImpl) obj; + if (endTime == null) { + if (other.endTime != null) + return false; + } else if (!endTime.equals(other.endTime)) + return false; + if (error == null) { + if (other.error != null) + return false; + } else if (!error.equals(other.error)) + return false; + if (expiryTime == null) { + if (other.expiryTime != null) + return false; + } else if (!expiryTime.equals(other.expiryTime)) + return false; + if (operation == null) { + if (other.operation != null) + return false; + } else if (!operation.equals(other.operation)) + return false; + if (owner == null) { + if (other.owner != null) + return false; + } else if (!owner.equals(other.owner)) + return false; + if (startTime == null) { + if (other.startTime != null) + return false; + } else if (!startTime.equals(other.startTime)) + return false; + if (status == null) { + if (other.status != null) + return false; + } else if (!status.equals(other.status)) + return false; + return true; + } + +} http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/TasksListImpl.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/TasksListImpl.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/TasksListImpl.java new file mode 100644 index 0000000..4c8b2c8 --- /dev/null +++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/TasksListImpl.java @@ -0,0 +1,78 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jclouds.vcloud.domain.internal; + +import java.net.URI; +import java.util.SortedSet; + +import org.jclouds.vcloud.domain.Task; +import org.jclouds.vcloud.domain.TasksList; + +/** + * Locations of resources in vCloud + */ +public class TasksListImpl implements TasksList { + private final SortedSet<Task> tasks; + private final URI id; + + public TasksListImpl(URI id, SortedSet<Task> tasks) { + this.id = id; + this.tasks = tasks; + } + + @Override + public SortedSet<Task> getTasks() { + return tasks; + } + + @Override + public URI getLocation() { + return id; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((id == null) ? 0 : id.hashCode()); + result = prime * result + ((tasks == null) ? 0 : tasks.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + TasksListImpl other = (TasksListImpl) obj; + if (id == null) { + if (other.id != null) + return false; + } else if (!id.equals(other.id)) + return false; + if (tasks == null) { + if (other.tasks != null) + return false; + } else if (!tasks.equals(other.tasks)) + return false; + return true; + } + +} http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/VAppImpl.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/VAppImpl.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/VAppImpl.java new file mode 100644 index 0000000..7b032bc --- /dev/null +++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/VAppImpl.java @@ -0,0 +1,163 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jclouds.vcloud.domain.internal; + +import static com.google.common.base.Preconditions.checkNotNull; + +import java.net.URI; +import java.util.List; +import java.util.Set; + +import org.jclouds.javax.annotation.Nullable; +import org.jclouds.vcloud.domain.ReferenceType; +import org.jclouds.vcloud.domain.Status; +import org.jclouds.vcloud.domain.Task; +import org.jclouds.vcloud.domain.VApp; +import org.jclouds.vcloud.domain.Vm; +import org.jclouds.vcloud.domain.ovf.VCloudNetworkSection; + +import com.google.common.collect.Iterables; +import com.google.common.collect.Lists; +import com.google.common.collect.Sets; + +/** + * Locations of resources in vCloud + */ +public class VAppImpl extends ReferenceTypeImpl implements VApp { + + private final Status status; + private final ReferenceType vdc; + @Nullable + private final String description; + private final List<Task> tasks = Lists.newArrayList(); + private final boolean ovfDescriptorUploaded; + private final Set<Vm> children = Sets.newLinkedHashSet(); + @Nullable + private final VCloudNetworkSection networkSection; + + public VAppImpl(String name, String type, URI id, Status status, ReferenceType vdc, @Nullable String description, + Iterable<Task> tasks, boolean ovfDescriptorUploaded, Iterable<Vm> children, + @Nullable VCloudNetworkSection networkSection) { + super(name, type, id); + this.status = checkNotNull(status, "status"); + this.vdc = vdc;// TODO: once <1.0 is killed check not null + this.description = description; + Iterables.addAll(this.tasks, checkNotNull(tasks, "tasks")); + this.ovfDescriptorUploaded = ovfDescriptorUploaded; + Iterables.addAll(this.children, checkNotNull(children, "children")); + this.networkSection = networkSection; // can be null when copying + } + + /** + * {@inheritDoc} + */ + @Override + public Status getStatus() { + return status; + } + + /** + * {@inheritDoc} + */ + @Override + public ReferenceType getVDC() { + return vdc; + } + + /** + * {@inheritDoc} + */ + @Override + public String getDescription() { + return description; + } + + /** + * {@inheritDoc} + */ + @Override + public List<Task> getTasks() { + return tasks; + } + + /** + * {@inheritDoc} + */ + @Override + public boolean isOvfDescriptorUploaded() { + return ovfDescriptorUploaded; + } + + /** + * {@inheritDoc} + */ + @Override + public Set<Vm> getChildren() { + return children; + } + + /** + * {@inheritDoc} + */ + @Override + public VCloudNetworkSection getNetworkSection() { + return networkSection; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = super.hashCode(); + result = prime * result + ((description == null) ? 0 : description.hashCode()); + result = prime * result + (ovfDescriptorUploaded ? 1231 : 1237); + result = prime * result + ((status == null) ? 0 : status.hashCode()); + result = prime * result + ((tasks == null) ? 0 : tasks.hashCode()); + result = prime * result + ((vdc == null) ? 0 : vdc.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (!super.equals(obj)) + return false; + if (getClass() != obj.getClass()) + return false; + VAppImpl other = (VAppImpl) obj; + if (description == null) { + if (other.description != null) + return false; + } else if (!description.equals(other.description)) + return false; + if (ovfDescriptorUploaded != other.ovfDescriptorUploaded) + return false; + if (vdc == null) { + if (other.vdc != null) + return false; + } else if (!vdc.equals(other.vdc)) + return false; + return true; + } + + @Override + public String toString() { + return "[id=" + getHref() + ", name=" + getName() + ", vdc=" + vdc + ", description=" + description + ", status=" + + status + "]"; + } + +} http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/VAppTemplateImpl.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/VAppTemplateImpl.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/VAppTemplateImpl.java new file mode 100644 index 0000000..fa480c7 --- /dev/null +++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/VAppTemplateImpl.java @@ -0,0 +1,202 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jclouds.vcloud.domain.internal; + +import static com.google.common.base.Preconditions.checkNotNull; + +import java.net.URI; +import java.util.List; +import java.util.Set; + +import org.jclouds.javax.annotation.Nullable; +import org.jclouds.vcloud.domain.ReferenceType; +import org.jclouds.vcloud.domain.Status; +import org.jclouds.vcloud.domain.Task; +import org.jclouds.vcloud.domain.VAppTemplate; +import org.jclouds.vcloud.domain.Vm; +import org.jclouds.vcloud.domain.ovf.VCloudNetworkSection; + +import com.google.common.collect.Iterables; +import com.google.common.collect.Lists; +import com.google.common.collect.Sets; + +/** + * Locations of resources in vCloud + */ +public class VAppTemplateImpl extends ReferenceTypeImpl implements VAppTemplate { + + private final Status status; + private final ReferenceType vdc; + @Nullable + private final String description; + private final List<Task> tasks = Lists.newArrayList(); + private final boolean ovfDescriptorUploaded; + private final String vAppScopedLocalId; + private final Set<Vm> children = Sets.newLinkedHashSet(); + @Nullable + private final VCloudNetworkSection networkSection; + + public VAppTemplateImpl(String name, String type, URI id, Status status, ReferenceType vdc, + @Nullable String description, Iterable<Task> tasks, boolean ovfDescriptorUploaded, + @Nullable String vAppScopedLocalId, Iterable<Vm> children, + @Nullable VCloudNetworkSection networkSection) { + super(name, type, id); + this.status = checkNotNull(status, "status"); + this.vdc = vdc;// TODO: once <1.0 is killed check not null + this.description = description; + Iterables.addAll(this.tasks, checkNotNull(tasks, "tasks")); + this.vAppScopedLocalId = vAppScopedLocalId; + this.ovfDescriptorUploaded = ovfDescriptorUploaded; + Iterables.addAll(this.children, checkNotNull(children, "children")); + this.networkSection = networkSection; // can be null when copying + } + + /** + * {@inheritDoc} + */ + @Override + public Status getStatus() { + return status; + } + + /** + * {@inheritDoc} + */ + @Override + public ReferenceType getVDC() { + return vdc; + } + + /** + * {@inheritDoc} + */ + @Override + public String getDescription() { + return description; + } + + /** + * {@inheritDoc} + */ + @Override + public List<Task> getTasks() { + return tasks; + } + + /** + * {@inheritDoc} + */ + @Override + public String getVAppScopedLocalId() { + return vAppScopedLocalId; + } + + /** + * {@inheritDoc} + */ + @Override + public boolean isOvfDescriptorUploaded() { + return ovfDescriptorUploaded; + } + + /** + * {@inheritDoc} + */ + @Override + public Set<Vm> getChildren() { + return children; + } + + /** + * {@inheritDoc} + */ + @Override + public VCloudNetworkSection getNetworkSection() { + return networkSection; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = super.hashCode(); + result = prime * result + ((children == null) ? 0 : children.hashCode()); + result = prime * result + ((description == null) ? 0 : description.hashCode()); + result = prime * result + ((networkSection == null) ? 0 : networkSection.hashCode()); + result = prime * result + (ovfDescriptorUploaded ? 1231 : 1237); + result = prime * result + ((status == null) ? 0 : status.hashCode()); + result = prime * result + ((tasks == null) ? 0 : tasks.hashCode()); + result = prime * result + ((vAppScopedLocalId == null) ? 0 : vAppScopedLocalId.hashCode()); + result = prime * result + ((vdc == null) ? 0 : vdc.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (!super.equals(obj)) + return false; + if (getClass() != obj.getClass()) + return false; + VAppTemplateImpl other = (VAppTemplateImpl) obj; + if (children == null) { + if (other.children != null) + return false; + } else if (!children.equals(other.children)) + return false; + if (description == null) { + if (other.description != null) + return false; + } else if (!description.equals(other.description)) + return false; + if (networkSection == null) { + if (other.networkSection != null) + return false; + } else if (!networkSection.equals(other.networkSection)) + return false; + if (ovfDescriptorUploaded != other.ovfDescriptorUploaded) + return false; + if (status == null) { + if (other.status != null) + return false; + } else if (!status.equals(other.status)) + return false; + if (tasks == null) { + if (other.tasks != null) + return false; + } else if (!tasks.equals(other.tasks)) + return false; + if (vAppScopedLocalId == null) { + if (other.vAppScopedLocalId != null) + return false; + } else if (!vAppScopedLocalId.equals(other.vAppScopedLocalId)) + return false; + if (vdc == null) { + if (other.vdc != null) + return false; + } else if (!vdc.equals(other.vdc)) + return false; + return true; + } + + @Override + public String toString() { + return "[id=" + getHref() + ", name=" + getName() + ", vdc=" + vdc + ", description=" + description + ", status=" + + status + "]"; + } + +} http://git-wip-us.apache.org/repos/asf/stratos/blob/b45ae00e/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/VDCImpl.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/VDCImpl.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/VDCImpl.java new file mode 100644 index 0000000..740df72 --- /dev/null +++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/VDCImpl.java @@ -0,0 +1,289 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jclouds.vcloud.domain.internal; + +import static com.google.common.base.Preconditions.checkNotNull; + +import java.net.URI; +import java.util.List; +import java.util.Map; + +import org.jclouds.javax.annotation.Nullable; +import org.jclouds.vcloud.domain.AllocationModel; +import org.jclouds.vcloud.domain.Capacity; +import org.jclouds.vcloud.domain.ReferenceType; +import org.jclouds.vcloud.domain.Task; +import org.jclouds.vcloud.domain.VDC; +import org.jclouds.vcloud.domain.VDCStatus; + +import com.google.common.collect.Iterables; +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; + +/** + * Locations of resources in vCloud + */ +public class VDCImpl extends ReferenceTypeImpl implements VDC { + + private final VDCStatus status; + private final ReferenceType org; + @Nullable + private final String description; + private final List<Task> tasks = Lists.newArrayList(); + private final AllocationModel allocationModel; + private final Capacity storageCapacity; + private final Capacity cpuCapacity; + private final Capacity memoryCapacity; + private final Map<String, ReferenceType> resourceEntities = Maps.newLinkedHashMap(); + private final Map<String, ReferenceType> availableNetworks = Maps.newLinkedHashMap(); + private final int nicQuota; + private final int networkQuota; + private final int vmQuota; + private final boolean isEnabled; + + public VDCImpl(String name, String type, URI id, VDCStatus status, ReferenceType org, @Nullable String description, + Iterable<Task> tasks, AllocationModel allocationModel, @Nullable Capacity storageCapacity, + @Nullable Capacity cpuCapacity, @Nullable Capacity memoryCapacity, + Map<String, ReferenceType> resourceEntities, Map<String, ReferenceType> availableNetworks, int nicQuota, + int networkQuota, int vmQuota, boolean isEnabled) { + super(name, type, id); + this.status = checkNotNull(status, "status"); + this.org = org;// TODO: once <1.0 is killed check not null + this.description = description; + Iterables.addAll(this.tasks, checkNotNull(tasks, "tasks")); + this.allocationModel = checkNotNull(allocationModel, "allocationModel"); + this.storageCapacity = storageCapacity;// TODO: once <1.0 is killed check not null + this.cpuCapacity = cpuCapacity;// TODO: once <1.0 is killed check not null + this.memoryCapacity = memoryCapacity;// TODO: once <1.0 is killed check not null + this.resourceEntities.putAll(checkNotNull(resourceEntities, "resourceEntities")); + this.availableNetworks.putAll(checkNotNull(availableNetworks, "availableNetworks")); + this.nicQuota = nicQuota; + this.networkQuota = networkQuota; + this.vmQuota = vmQuota; + this.isEnabled = isEnabled; + } + + /** + * {@inheritDoc} + */ + @Override + public VDCStatus getStatus() { + return status; + } + + /** + * {@inheritDoc} + */ + @Override + public ReferenceType getOrg() { + return org; + } + + /** + * {@inheritDoc} + */ + @Override + public String getDescription() { + return description; + } + + /** + * {@inheritDoc} + */ + @Override + public List<Task> getTasks() { + return tasks; + } + + /** + * {@inheritDoc} + */ + @Override + public AllocationModel getAllocationModel() { + return allocationModel; + } + + /** + * {@inheritDoc} + */ + @Override + public Capacity getStorageCapacity() { + return storageCapacity; + } + + /** + * {@inheritDoc} + */ + @Override + public Capacity getCpuCapacity() { + return cpuCapacity; + } + + /** + * {@inheritDoc} + */ + @Override + public Capacity getMemoryCapacity() { + return memoryCapacity; + } + + /** + * {@inheritDoc} + */ + @Override + public Map<String, ReferenceType> getResourceEntities() { + return resourceEntities; + } + + /** + * {@inheritDoc} + */ + @Override + public Map<String, ReferenceType> getAvailableNetworks() { + return availableNetworks; + } + + /** + * {@inheritDoc} + */ + @Override + public int getNicQuota() { + return nicQuota; + } + + /** + * {@inheritDoc} + */ + @Override + public int getNetworkQuota() { + return networkQuota; + } + + /** + * {@inheritDoc} + */ + @Override + public int getVmQuota() { + return vmQuota; + } + + /** + * {@inheritDoc} + */ + @Override + public boolean isEnabled() { + return isEnabled; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = super.hashCode(); + result = prime * result + ((allocationModel == null) ? 0 : allocationModel.hashCode()); + result = prime * result + ((availableNetworks == null) ? 0 : availableNetworks.hashCode()); + result = prime * result + ((cpuCapacity == null) ? 0 : cpuCapacity.hashCode()); + result = prime * result + ((description == null) ? 0 : description.hashCode()); + result = prime * result + (isEnabled ? 1231 : 1237); + result = prime * result + ((memoryCapacity == null) ? 0 : memoryCapacity.hashCode()); + result = prime * result + networkQuota; + result = prime * result + nicQuota; + result = prime * result + ((org == null) ? 0 : org.hashCode()); + result = prime * result + ((resourceEntities == null) ? 0 : resourceEntities.hashCode()); + result = prime * result + ((status == null) ? 0 : status.hashCode()); + result = prime * result + ((storageCapacity == null) ? 0 : storageCapacity.hashCode()); + result = prime * result + ((tasks == null) ? 0 : tasks.hashCode()); + result = prime * result + vmQuota; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (!super.equals(obj)) + return false; + if (getClass() != obj.getClass()) + return false; + VDCImpl other = (VDCImpl) obj; + if (allocationModel == null) { + if (other.allocationModel != null) + return false; + } else if (!allocationModel.equals(other.allocationModel)) + return false; + if (availableNetworks == null) { + if (other.availableNetworks != null) + return false; + } else if (!availableNetworks.equals(other.availableNetworks)) + return false; + if (cpuCapacity == null) { + if (other.cpuCapacity != null) + return false; + } else if (!cpuCapacity.equals(other.cpuCapacity)) + return false; + if (description == null) { + if (other.description != null) + return false; + } else if (!description.equals(other.description)) + return false; + if (isEnabled != other.isEnabled) + return false; + if (memoryCapacity == null) { + if (other.memoryCapacity != null) + return false; + } else if (!memoryCapacity.equals(other.memoryCapacity)) + return false; + if (networkQuota != other.networkQuota) + return false; + if (nicQuota != other.nicQuota) + return false; + if (org == null) { + if (other.org != null) + return false; + } else if (!org.equals(other.org)) + return false; + if (resourceEntities == null) { + if (other.resourceEntities != null) + return false; + } else if (!resourceEntities.equals(other.resourceEntities)) + return false; + if (status == null) { + if (other.status != null) + return false; + } else if (!status.equals(other.status)) + return false; + if (storageCapacity == null) { + if (other.storageCapacity != null) + return false; + } else if (!storageCapacity.equals(other.storageCapacity)) + return false; + if (tasks == null) { + if (other.tasks != null) + return false; + } else if (!tasks.equals(other.tasks)) + return false; + if (vmQuota != other.vmQuota) + return false; + return true; + } + + @Override + public String toString() { + return "[id=" + getHref() + ", name=" + getName() + ", org=" + org + ", description=" + description + ", status=" + + status + ", isEnabled=" + isEnabled + "]"; + } + +}
