From 4e01fa336953b6a6301619f3f3e03c4e30f547f5 Mon Sep 17 00:00:00 2001 From: Andrew Donald Kennedy Date: Tue, 7 Feb 2012 11:04:24 +0000 Subject: [PATCH] Fix initial entity domain object heirarchy, particularly Builders and correct JAXB XML parsing --- .../vcloud/director/v1_5/domain/Entity.java | 220 +++++++--------- .../director/v1_5/domain/EntityType.java | 239 ++++++++++++++++++ .../vcloud/director/v1_5/domain/Error.java | 15 +- .../vcloud/director/v1_5/domain/Link.java | 52 +++- .../vcloud/director/v1_5/domain/Org.java | 88 ++++++- .../vcloud/director/v1_5/domain/OrgList.java | 20 +- .../director/v1_5/domain/Reference.java | 215 ++++------------ .../director/v1_5/domain/ReferenceType.java | 221 ++++++++++++++++ .../vcloud/director/v1_5/domain/Resource.java | 199 +++++---------- .../director/v1_5/domain/ResourceType.java | 202 +++++++++++++++ .../vcloud/director/v1_5/domain/Session.java | 9 +- .../v1_5/domain/SessionWithToken.java | 6 +- .../v1_5/features/OrgClientExpectTest.java | 20 +- 13 files changed, 1033 insertions(+), 473 deletions(-) create mode 100644 labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/EntityType.java create mode 100644 labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ReferenceType.java create mode 100644 labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ResourceType.java diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Entity.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Entity.java index affc2c05eb..c31c203205 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Entity.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Entity.java @@ -19,80 +19,41 @@ package org.jclouds.vcloud.director.v1_5.domain; import static com.google.common.base.Objects.*; +import static com.google.common.base.Preconditions.*; import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.*; import java.net.URI; +import java.util.Set; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlElement; import com.google.common.base.Objects; import com.google.common.base.Objects.ToStringHelper; +import com.google.common.collect.Sets; /** - * Basic entity type in the vCloud object model. + * An entity. * - * Includes a name, an optional description, and an optional list of links - * - *
- * <xs:complexType name="EntityType">
- * 
- * - * @author Adrian Cole + * @author grkvlt@apache.org */ -public class Entity> extends Resource { +public class Entity extends EntityType { - public static > Builder builder() { - return new Builder(); + @SuppressWarnings("unchecked") + public static Builder builder() { + return new Builder(); } @Override - public Builder toBuilder() { - return new Builder().fromEntity(this); + public Builder toBuilder() { + return new Builder(); } - public static class Builder> extends Resource.Builder { - - protected String description; - protected TaskList tasks; - protected String name; - protected String id; - - /** - * @see Entity#getName() - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * @see Entity#getDescription() - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * @see Entity#getId() - */ - public Builder id(String id) { - this.id = id; - return this; - } - - /** - * @see Entity#getTasks() - */ - public Builder tasks(TaskList tasks) { - this.tasks = tasks; - return this; - } + public static class Builder extends EntityType.Builder { @Override - public Entity build() { - Entity entity = new Entity(href, name); + public Entity build() { + Entity entity = new Entity(href, name); entity.setDescription(description); entity.setTasks(tasks); entity.setId(id); @@ -102,99 +63,100 @@ public class Entity> extends Resource { } /** - * {@inheritDoc} + * @see EntityType#getName() */ @Override - public Builder fromResource(Resource in) { - return Builder.class.cast(super.fromResource(in)); + public Builder name(String name) { + this.name = name; + return this; } - public Builder fromEntity(Entity in) { - return fromResource(in).description(in.getDescription()).tasks(in.getTasks()).id(in.getId()).name(in.getName()); + /** + * @see EntityType#getDescription() + */ + @Override + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * @see EntityType#getId() + */ + @Override + public Builder id(String id) { + this.id = id; + return this; + } + + /** + * @see EntityType#getTasks() + */ + @Override + public Builder tasks(TaskList tasks) { + this.tasks = tasks; + return this; + } + + /** + * @see ReferenceType#getHref() + */ + @Override + public Builder href(URI href) { + this.href = href; + return this; + } + + /** + * @see ReferenceType#getType() + */ + @Override + public Builder type(String type) { + this.type = type; + return this; + } + + /** + * @see ReferenceType#getLinks() + */ + @Override + public Builder links(Set links) { + this.links = Sets.newLinkedHashSet(checkNotNull(links, "links")); + return this; + } + + /** + * @see ReferenceType#getLinks() + */ + @Override + public Builder link(Link link) { + this.links.add(checkNotNull(link, "link")); + return this; + } + + @Override + public Builder fromEntityType(EntityType in) { + return Builder.class.cast(super.fromEntityType(in)); + } + + public Builder fromEntity(Entity in) { + return fromEntityType(in); } } - @XmlElement(namespace = NS, name = "Description") - protected String description; - @XmlElement(namespace = NS, name = "TasksInProgress") - protected TaskList tasks; - @XmlAttribute - protected String id; - @XmlAttribute - protected String name; - protected Entity(URI href, String name) { - super(href); - this.name = name; + super(href, name); } protected Entity() { // For JAXB } - /** - * Optional description. - */ - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - /** - * A list of queued, running, or recently completed tasks associated with this entity. - */ - public TaskList getTasks() { - return tasks; - } - - public void setTasks(TaskList tasks) { - this.tasks = tasks; - } - - /** - * The resource identifier, expressed in URN format. - * - * The value of this attribute uniquely identifies the resource, persists for the life of the - * resource, and is never reused. - */ - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - /** - * Contains the name of the the entity. - * - * The object type, specified as a MIME content type, of the object that the link references. - * This attribute is present only for links to objects. It is not present for links to actions. - * - * @return type definition, type, expressed as an HTTP Content-Type - */ - public String getName() { - return name; - } - @Override public boolean equals(Object o) { if (!super.equals(o)) return false; - Entity that = Entity.class.cast(o); - return super.equals(that) && equal(this.id, that.id) && equal(this.description, that.description) && equal(this.tasks, that.tasks); - } - - @Override - public int hashCode() { - return super.hashCode() + Objects.hashCode(description, tasks, id, name); - } - - @Override - public ToStringHelper string() { - return super.string().add("description", description).add("tasks", tasks).add("id", id).add("name", name); + Entity that = Entity.class.cast(o); + return super.equals(that); } } \ No newline at end of file diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/EntityType.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/EntityType.java new file mode 100644 index 0000000000..c38e8d5886 --- /dev/null +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/EntityType.java @@ -0,0 +1,239 @@ +/** + * 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.vcloud.director.v1_5.domain; + +import static com.google.common.base.Objects.*; +import static com.google.common.base.Preconditions.*; +import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.*; + +import java.net.URI; +import java.util.Set; + +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; + +import com.google.common.base.Objects; +import com.google.common.base.Objects.ToStringHelper; +import com.google.common.collect.Sets; + +/** + * Basic entity type in the vCloud object model. + * + * Includes a name, an optional description, and an optional list of links + * + *
+ * <xs:complexType name="EntityType">
+ * 
+ * + * @author grkvlt@apache.org + */ +public class EntityType> extends ResourceType { + + public static > Builder builder() { + return new Builder(); + } + + @Override + public Builder toBuilder() { + return new Builder().fromEntity(this); + } + + public static class Builder> extends ResourceType.Builder { + + protected String description; + protected TaskList tasks; + protected String name; + protected String id; + + /** + * @see EntityType#getName() + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * @see EntityType#getDescription() + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * @see EntityType#getId() + */ + public Builder id(String id) { + this.id = id; + return this; + } + + /** + * @see EntityType#getTasks() + */ + public Builder tasks(TaskList tasks) { + this.tasks = tasks; + return this; + } + + @Override + public EntityType build() { + EntityType entity = new EntityType(href, name); + entity.setDescription(description); + entity.setTasks(tasks); + entity.setId(id); + entity.setType(type); + entity.setLinks(links); + return entity; + } + + /** + * @see ReferenceType#getHref() + */ + @Override + public Builder href(URI href) { + this.href = href; + return this; + } + + /** + * @see ReferenceType#getType() + */ + @Override + public Builder type(String type) { + this.type = type; + return this; + } + + /** + * @see ReferenceType#getLinks() + */ + @Override + public Builder links(Set links) { + this.links = Sets.newLinkedHashSet(checkNotNull(links, "links")); + return this; + } + + /** + * @see ReferenceType#getLinks() + */ + @Override + public Builder link(Link link) { + this.links.add(checkNotNull(link, "link")); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public Builder fromResourceType(ResourceType in) { + return Builder.class.cast(super.fromResourceType(in)); + } + + public Builder fromEntityType(EntityType in) { + return fromResourceType(in).description(in.getDescription()).tasks(in.getTasks()).id(in.getId()).name(in.getName()); + } + } + + @XmlElement(namespace = NS, name = "Description") + private String description; + @XmlElement(namespace = NS, name = "TasksInProgress") + private TaskList tasks; + @XmlAttribute + private String id; + @XmlAttribute + private String name; + + protected EntityType(URI href, String name) { + super(href); + this.name = name; + } + + protected EntityType() { + // For JAXB + } + + /** + * Optional description. + */ + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + /** + * A list of queued, running, or recently completed tasks associated with this entity. + */ + public TaskList getTasks() { + return tasks; + } + + public void setTasks(TaskList tasks) { + this.tasks = tasks; + } + + /** + * The resource identifier, expressed in URN format. + * + * The value of this attribute uniquely identifies the resource, persists for the life of the + * resource, and is never reused. + */ + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + /** + * Contains the name of the the entity. + * + * The object type, specified as a MIME content type, of the object that the link references. + * This attribute is present only for links to objects. It is not present for links to actions. + * + * @return type definition, type, expressed as an HTTP Content-Type + */ + public String getName() { + return name; + } + + @Override + public boolean equals(Object o) { + if (!super.equals(o)) + return false; + EntityType that = EntityType.class.cast(o); + return super.equals(that) && equal(this.id, that.id) && equal(this.description, that.description) && equal(this.tasks, that.tasks); + } + + @Override + public int hashCode() { + return super.hashCode() + Objects.hashCode(description, tasks, id, name); + } + + @Override + public ToStringHelper string() { + return super.string().add("description", description).add("tasks", tasks).add("id", id).add("name", name); + } +} \ No newline at end of file diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Error.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Error.java index de87f8e493..3032a03d0e 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Error.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Error.java @@ -4,6 +4,8 @@ import static com.google.common.base.Objects.*; import static com.google.common.base.Preconditions.*; import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.*; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlRootElement; @@ -16,9 +18,10 @@ import com.google.common.base.Objects; * <xs:complexType name="ErrorType"> * * - * @author Adrian Cole + * @author grkvlt@apache.org */ @XmlRootElement(namespace = NS, name = "Error") +@XmlAccessorType(XmlAccessType.FIELD) public class Error { public static Builder builder() { @@ -94,15 +97,15 @@ public class Error { } @XmlAttribute - protected String message; + private String message; @XmlAttribute - protected int majorErrorCode; + private int majorErrorCode; @XmlAttribute - protected String minorErrorCode; + private String minorErrorCode; @XmlAttribute - protected String vendorSpecificErrorCode; + private String vendorSpecificErrorCode; @XmlAttribute - protected String stackTrace; + private String stackTrace; private Error(String message, int majorErrorCode, String minorErrorCode) { this.message = checkNotNull(message, "message"); diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Link.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Link.java index 921e217fc4..283ac6048e 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Link.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Link.java @@ -1,7 +1,7 @@ package org.jclouds.vcloud.director.v1_5.domain; -import static com.google.common.base.Objects.equal; -import static com.google.common.base.Preconditions.checkNotNull; +import static com.google.common.base.Objects.*; +import static com.google.common.base.Preconditions.*; import java.net.URI; import java.util.Map; @@ -20,7 +20,7 @@ import com.google.common.base.Objects.ToStringHelper; * * @author Adrian Cole */ -public class Link extends Reference { +public class Link extends ReferenceType { @SuppressWarnings("unchecked") public static Builder builder() { @@ -35,7 +35,7 @@ public class Link extends Reference { return new Builder().fromLink(this); } - public static class Builder extends Reference.Builder { + public static class Builder extends ReferenceType.Builder { protected String rel; @@ -47,11 +47,49 @@ public class Link extends Reference { return this; } + @Override public Link build() { Link link = new Link(href, rel); link.setId(id); link.setName(name); link.setType(type); + return link; + } + + /** + * @see ReferenceType#getHref() + */ + @Override + public Builder href(URI href) { + this.href = href; + return this; + } + + /** + * @see ReferenceType#getId() + */ + @Override + public Builder id(String id) { + this.id = id; + return this; + } + + /** + * @see ReferenceType#getType() + */ + @Override + public Builder type(String type) { + this.type = type; + return this; + } + + /** + * @see ReferenceType#getName() + */ + @Override + public Builder name(String name) { + this.name = name; + return this; } public Builder fromLink(Link in) { @@ -61,13 +99,15 @@ public class Link extends Reference { /** * {@inheritDoc} */ - public Builder fromReference(Reference in) { + @Override + public Builder fromReference(ReferenceType in) { return Builder.class.cast(super.fromReference(in)); } /** * {@inheritDoc} */ + @Override public Builder fromAttributes(Map attributes) { super.fromAttributes(attributes); rel(attributes.get("rel")); @@ -76,7 +116,7 @@ public class Link extends Reference { } @XmlAttribute - protected String rel; + private String rel; private Link(URI href, String rel) { super(href); diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Org.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Org.java index 3f03aaeae5..36ed8383fa 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Org.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Org.java @@ -18,22 +18,18 @@ */ package org.jclouds.vcloud.director.v1_5.domain; -import static com.google.common.base.Objects.equal; -import static com.google.common.base.Preconditions.checkNotNull; -import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.NS; +import static com.google.common.base.Objects.*; +import static com.google.common.base.Preconditions.*; +import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.*; import java.net.URI; import java.util.Set; -import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; -import org.jclouds.vcloud.director.v1_5.domain.Entity.Builder; - import com.google.common.base.Objects; import com.google.common.base.Objects.ToStringHelper; -import com.google.common.collect.ImmutableSet; import com.google.common.collect.Sets; /** @@ -48,7 +44,7 @@ import com.google.common.collect.Sets; * @author Adrian Cole */ @XmlRootElement(namespace = NS, name = "Org") -public class Org extends Entity { +public class Org extends EntityType { @SuppressWarnings("unchecked") public static Builder builder() { @@ -60,7 +56,7 @@ public class Org extends Entity { return new Builder().fromOrg(this); } - public static class Builder extends Entity.Builder { + public static class Builder extends EntityType.Builder { private String fullName; @@ -83,8 +79,80 @@ public class Org extends Entity { return org; } + /** + * @see EntityType#getName() + */ @Override - public Builder fromEntity(Entity in) { + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * @see EntityType#getDescription() + */ + @Override + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * @see EntityType#getId() + */ + @Override + public Builder id(String id) { + this.id = id; + return this; + } + + /** + * @see EntityType#getTasks() + */ + @Override + public Builder tasks(TaskList tasks) { + this.tasks = tasks; + return this; + } + + /** + * @see ReferenceType#getHref() + */ + @Override + public Builder href(URI href) { + this.href = href; + return this; + } + + /** + * @see ReferenceType#getType() + */ + @Override + public Builder type(String type) { + this.type = type; + return this; + } + + /** + * @see ReferenceType#getLinks() + */ + @Override + public Builder links(Set links) { + this.links = Sets.newLinkedHashSet(checkNotNull(links, "links")); + return this; + } + + /** + * @see ReferenceType#getLinks() + */ + @Override + public Builder link(Link link) { + this.links.add(checkNotNull(link, "link")); + return this; + } + + @Override + public Builder fromEntity(EntityType in) { return Builder.class.cast(super.fromEntity(in)); } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/OrgList.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/OrgList.java index 4f480e94c3..44c98f159e 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/OrgList.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/OrgList.java @@ -18,9 +18,9 @@ */ package org.jclouds.vcloud.director.v1_5.domain; -import static com.google.common.base.Objects.equal; -import static com.google.common.base.Preconditions.checkNotNull; -import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.NS; +import static com.google.common.base.Objects.*; +import static com.google.common.base.Preconditions.*; +import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.*; import java.util.Set; @@ -49,12 +49,12 @@ public class OrgList { public static class Builder { - private Set orgs = Sets.newLinkedHashSet(); + private Set orgs = Sets.newLinkedHashSet(); /** * @see OrgList#getOrgs */ - public Builder orgs(Set orgs) { + public Builder orgs(Set orgs) { this.orgs = Sets.newLinkedHashSet(checkNotNull(orgs, "orgs")); return this; } @@ -62,7 +62,7 @@ public class OrgList { /** * @see OrgList#getOrgs */ - public Builder addOrg(OrgLink org) { + public Builder org(Reference org) { orgs.add(checkNotNull(org, "org")); return this; } @@ -80,14 +80,14 @@ public class OrgList { // For JAXB and builder use } - private OrgList(Set orgs) { + private OrgList(Set orgs) { this.orgs = ImmutableSet.copyOf(orgs); } @XmlElement(namespace = NS, name = "Org") - private Set orgs = Sets.newLinkedHashSet(); + private Set orgs = Sets.newLinkedHashSet(); - public Set getOrgs() { + public Set getOrgs() { return ImmutableSet.copyOf(orgs); } @@ -98,7 +98,7 @@ public class OrgList { if (o == null || getClass() != o.getClass()) return false; OrgList that = OrgList.class.cast(o); - return equal(orgs, that.orgs); + return equal(this.orgs, that.orgs); } @Override diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Reference.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Reference.java index 49aac7ad0b..33ecf0c234 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Reference.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Reference.java @@ -18,202 +18,97 @@ */ package org.jclouds.vcloud.director.v1_5.domain; -import static com.google.common.base.Objects.equal; - import java.net.URI; -import java.util.Map; - -import javax.xml.bind.annotation.XmlAttribute; - -import com.google.common.base.Objects; -import com.google.common.base.Objects.ToStringHelper; /** * A reference to a resource. - * - * Contains an href attribute and optional name and type attributes. - * - *
- * <xs:complexType name="ReferenceType">
- * 
* - * @author Adrian Cole + * @author grkvlt@apache.org */ -public class Reference> { +public class Reference extends ReferenceType { - public static > Builder builder() { - return new Builder(); + @SuppressWarnings("unchecked") + public static Builder builder() { + return new Builder(); } - public Builder toBuilder() { - return new Builder().fromReference(this); + @Override + public Builder toBuilder() { + return new Builder().fromReference(this); } - public static class Builder> { + public static class Builder extends ReferenceType.Builder { - protected URI href; - protected String id; - protected String name; - protected String type; - - /** - * @see Reference#getHref() - */ - public Builder href(URI href) { - this.href = href; - return this; - } - - /** - * @see Reference#getId() - */ - public Builder id(String id) { - this.id = id; - return this; - } - - /** - * @see Reference#getType() - */ - public Builder type(String type) { - this.type = type; - return this; - } - - /** - * @see Reference#getName() - */ - public Builder name(String name) { - this.name = name; - return this; - } - - public Reference build() { - Reference reference = new Reference(href); + @Override + public Reference build() { + Reference reference = new Reference(href); reference.setId(id); reference.setName(name); reference.setType(type); return reference; } - protected Builder fromReference(Reference in) { - return href(in.getHref()).id(in.getId()).name(in.getName()).type(in.getType()); + /** + * @see ReferenceType#getHref() + */ + @Override + public Builder href(URI href) { + this.href = href; + return this; } - protected Builder fromAttributes(Map attributes) { - return href(URI.create(attributes.get("href"))).id(attributes.get("id")).name(attributes.get("name")).type(attributes.get("type")); + /** + * @see ReferenceType#getId() + */ + @Override + public Builder id(String id) { + this.id = id; + return this; } + /** + * @see ReferenceType#getType() + */ + @Override + public Builder type(String type) { + this.type = type; + return this; + } + + /** + * @see ReferenceType#getName() + */ + @Override + public Builder name(String name) { + this.name = name; + return this; + } + + @Override + protected Builder fromReferenceType(ReferenceType in) { + return Builder.class.cast(super.fromReferenceType(in)); + } + + protected Builder fromReference(Reference in) { + return fromReferenceType(in); + } } - @XmlAttribute - protected URI href; - @XmlAttribute - protected String id; - @XmlAttribute - protected String name; - @XmlAttribute - protected String type; - protected Reference(URI href) { - this.href = href; + super(href); } protected Reference() { // For JAXB } - /** - * Contains the URI to the entity. - * - * An object reference, expressed in URL format. Because this URL includes the object identifier - * portion of the id attribute value, it uniquely identifies the object, persists for the life of - * the object, and is never reused. The value of the href attribute is a reference to a view of - * the object, and can be used to access a representation of the object that is valid in a - * particular context. Although URLs have a well-known syntax and a well-understood - * interpretation, a client should treat each href as an opaque string. The rules that govern how - * the server constructs href strings might change in future releases. - * - * @return an opaque reference and should never be parsed - */ - public URI getHref() { - return href; - } - - /** - * The resource identifier, expressed in URN format. - * - * The value of this attribute uniquely identifies the resource, persists for the life of the - * resource, and is never reused. - */ - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - /** - * Contains the name of the the entity. - * - * The object type, specified as a MIME content type, of the object that the link references. - * This attribute is present only for links to objects. It is not present for links to actions. - * - * @return type definition, type, expressed as an HTTP Content-Type - */ - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - /** - * Contains the type of the the entity. - * - * The object type, specified as a MIME content type, of the object that the link references. - * This attribute is present only for links to objects. It is not present for links to actions. - * - * @return type definition, type, expressed as an HTTP Content-Type - */ - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - /** - * @see #getHref() - */ - public URI getURI() { - return getHref(); - } - @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; - Reference that = Reference.class.cast(o); - return equal(this.href, that.href) && equal(this.id, that.id) && equal(this.name, that.name) && equal(this.type, that.type); - } - - @Override - public int hashCode() { - return Objects.hashCode(href, id, name, type); - } - - @Override - public String toString() { - return string().toString(); - } - - protected ToStringHelper string() { - return Objects.toStringHelper("").add("href", href).add("id", id).add("name", name).add("type", type); + Reference that = Reference.class.cast(o); + return super.equals(that); } } \ No newline at end of file diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ReferenceType.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ReferenceType.java new file mode 100644 index 0000000000..4804bcac59 --- /dev/null +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ReferenceType.java @@ -0,0 +1,221 @@ +/** + * 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.vcloud.director.v1_5.domain; + +import static com.google.common.base.Objects.*; + +import java.net.URI; +import java.util.Map; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; + +import com.google.common.base.Objects; +import com.google.common.base.Objects.ToStringHelper; + +/** + * A reference to a resource. + * + * Contains an href attribute and optional name and type attributes. + * + *
+ * <xs:complexType name="ReferenceType">
+ * 
+ * + * @author grkvlt@apache.org + */ +@XmlAccessorType(XmlAccessType.FIELD) +public class ReferenceType> { + + public static > Builder builder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder().fromReference(this); + } + + public static class Builder> { + + protected URI href; + protected String id; + protected String name; + protected String type; + + /** + * @see ReferenceType#getHref() + */ + public Builder href(URI href) { + this.href = href; + return this; + } + + /** + * @see ReferenceType#getId() + */ + public Builder id(String id) { + this.id = id; + return this; + } + + /** + * @see ReferenceType#getType() + */ + public Builder type(String type) { + this.type = type; + return this; + } + + /** + * @see ReferenceType#getName() + */ + public Builder name(String name) { + this.name = name; + return this; + } + + public ReferenceType build() { + ReferenceType reference = new ReferenceType(href); + reference.setId(id); + reference.setName(name); + reference.setType(type); + return reference; + } + + protected Builder fromReferenceType(ReferenceType in) { + return href(in.getHref()).id(in.getId()).name(in.getName()).type(in.getType()); + } + + protected Builder fromAttributes(Map attributes) { + return href(URI.create(attributes.get("href"))).id(attributes.get("id")).name(attributes.get("name")).type(attributes.get("type")); + } + } + + @XmlAttribute + private URI href; + @XmlAttribute + private String id; + @XmlAttribute + private String name; + @XmlAttribute + private String type; + + protected ReferenceType(URI href) { + this.href = href; + } + + protected ReferenceType() { + // For JAXB + } + + /** + * Contains the URI to the entity. + * + * An object reference, expressed in URL format. Because this URL includes the object identifier + * portion of the id attribute value, it uniquely identifies the object, persists for the life of + * the object, and is never reused. The value of the href attribute is a reference to a view of + * the object, and can be used to access a representation of the object that is valid in a + * particular context. Although URLs have a well-known syntax and a well-understood + * interpretation, a client should treat each href as an opaque string. The rules that govern how + * the server constructs href strings might change in future releases. + * + * @return an opaque reference and should never be parsed + */ + public URI getHref() { + return href; + } + + /** + * The resource identifier, expressed in URN format. + * + * The value of this attribute uniquely identifies the resource, persists for the life of the + * resource, and is never reused. + */ + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + /** + * Contains the name of the the entity. + * + * The object type, specified as a MIME content type, of the object that the link references. + * This attribute is present only for links to objects. It is not present for links to actions. + * + * @return type definition, type, expressed as an HTTP Content-Type + */ + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + /** + * Contains the type of the the entity. + * + * The object type, specified as a MIME content type, of the object that the link references. + * This attribute is present only for links to objects. It is not present for links to actions. + * + * @return type definition, type, expressed as an HTTP Content-Type + */ + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + /** + * @see #getHref() + */ + public URI getURI() { + return getHref(); + } + + @Override + public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + ReferenceType that = ReferenceType.class.cast(o); + return equal(this.href, that.href) && equal(this.id, that.id) && equal(this.name, that.name) && equal(this.type, that.type); + } + + @Override + public int hashCode() { + return Objects.hashCode(href, id, name, type); + } + + @Override + public String toString() { + return string().toString(); + } + + protected ToStringHelper string() { + return Objects.toStringHelper("").add("href", href).add("id", id).add("name", name).add("type", type); + } +} \ No newline at end of file diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Resource.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Resource.java index 2d5fb93515..0778dd35ea 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Resource.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Resource.java @@ -18,185 +18,112 @@ */ package org.jclouds.vcloud.director.v1_5.domain; -import static com.google.common.base.Objects.equal; +import static com.google.common.base.Objects.*; import static com.google.common.base.Preconditions.*; import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.*; import java.net.URI; -import java.util.Map; import java.util.Set; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlElement; -import org.jclouds.vcloud.director.v1_5.domain.Task.Builder; +import org.jclouds.vcloud.director.v1_5.domain.Resource.Builder; import com.google.common.base.Objects; import com.google.common.base.Objects.ToStringHelper; import com.google.common.collect.Sets; /** - * The base type for all objects in the vCloud model. - * - * Has an optional list of links and href and type attributes. - * - *
- * <xs:complexType name="ResourceType">
- * 
+ * A resource. * - * @author Adrian Cole + * @author grkvlt@apache.org */ -public class Resource> { +public class Resource extends ResourceType { - public static > Builder builder() { - return new Builder(); + @SuppressWarnings("unchecked") + public static Builder builder() { + return new Builder(); } - public Builder toBuilder() { - return new Builder().fromResource(this); + @Override + public Builder toBuilder() { + return new Builder().fromResource(this); } - public static class Builder> { + public static class Builder extends ResourceType.Builder { - protected URI href; - protected String type; - protected Set links = Sets.newLinkedHashSet(); - - /** - * @see Reference#getHref() - */ - public Builder href(URI href) { - this.href = href; - return this; - } - - /** - * @see Reference#getType() - */ - public Builder type(String type) { - this.type = type; - return this; - } - - /** - * @see Reference#getLinks() - */ - public Builder links(Set links) { - this.links = Sets.newLinkedHashSet(checkNotNull(links, "links")); - return this; - } - - /** - * @see Reference#getLinks() - */ - public Builder link(Link link) { - this.links.add(checkNotNull(link, "link")); - return this; - } - - public Resource build() { - Resource reference = new Resource(href); + @Override + public Resource build() { + Resource reference = new Resource(href); reference.setType(type); reference.setLinks(links); return reference; } - protected Builder fromResource(Resource in) { - return href(in.getHref()).type(in.getType()).links(in.getLinks()); + /** + * @see ResourceType#getHref() + */ + @Override + public Builder href(URI href) { + this.href = href; + return this; + } + + /** + * @see ResourceType#getType() + */ + @Override + public Builder type(String type) { + this.type = type; + return this; + } + + /** + * @see ResourceType#getLinks() + */ + @Override + public Builder links(Set links) { + this.links = Sets.newLinkedHashSet(checkNotNull(links, "links")); + return this; + } + + /** + * @see ResourceType#getLinks() + */ + @Override + public Builder link(Link link) { + this.links.add(checkNotNull(link, "link")); + return this; + } + + @Override + protected Builder fromResourceType(ResourceType in) { + return Builder.class.cast(super.fromResourceType(in)); + } + + protected Builder fromResource(Resource in) { + return fromResourceType(in); } } - @XmlAttribute - protected URI href; - @XmlAttribute - protected String type; - @XmlElement(namespace = NS, name = "Link") - protected Set links = Sets.newLinkedHashSet(); - protected Resource(URI href) { - this.href = href; + super(href); } protected Resource() { // For JAXB } - /** - * Contains the URI to the entity. - * - * An object reference, expressed in URL format. Because this URL includes the object identifier - * portion of the id attribute value, it uniquely identifies the object, persists for the life of - * the object, and is never reused. The value of the href attribute is a reference to a view of - * the object, and can be used to access a representation of the object that is valid in a - * particular context. Although URLs have a well-known syntax and a well-understood - * interpretation, a client should treat each href as an opaque string. The rules that govern how - * the server constructs href strings might change in future releases. - * - * @return an opaque reference and should never be parsed - */ - public URI getHref() { - return href; - } - - /** - * Contains the type of the the entity. - * - * The object type, specified as a MIME content type, of the object that the link references. - * This attribute is present only for links to objects. It is not present for links to actions. - * - * @return type definition, type, expressed as an HTTP Content-Type - */ - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - /** - * Set of optional links to an entity or operation associated with this object. - */ - public SetgetLinks() { - return links; - } - - public void setLinks(Set links) { - this.links = Sets.newLinkedHashSet(checkNotNull(links, "links")); - } - - public void addLink(Link link) { - this.links.add(checkNotNull(link, "link")); - } - - /** - * @see #getHref() - */ - public URI getURI() { - return getHref(); - } - @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; - Resource that = Resource.class.cast(o); - return equal(this.href, that.href) && equal(this.links, that.links) && equal(this.type, that.type); - } - - @Override - public int hashCode() { - return Objects.hashCode(href, links, type); - } - - @Override - public String toString() { - return string().toString(); - } - - protected ToStringHelper string() { - return Objects.toStringHelper("").add("href", href).add("links", links).add("type", type); + Resource that = Resource.class.cast(o); + return super.equals(that); } } \ No newline at end of file diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ResourceType.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ResourceType.java new file mode 100644 index 0000000000..b04fcdccf2 --- /dev/null +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ResourceType.java @@ -0,0 +1,202 @@ +/** + * 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.vcloud.director.v1_5.domain; + +import static com.google.common.base.Objects.*; +import static com.google.common.base.Preconditions.*; +import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.*; + +import java.net.URI; +import java.util.Set; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; + +import com.google.common.base.Objects; +import com.google.common.base.Objects.ToStringHelper; +import com.google.common.collect.Sets; + +/** + * The base type for all objects in the vCloud model. + * + * Has an optional list of links and href and type attributes. + * + *
+ * <xs:complexType name="ResourceType">
+ * 
+ * + * @author Adrian Cole + */ +@XmlAccessorType(XmlAccessType.FIELD) +public class ResourceType> { + + public static > Builder builder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder().fromResource(this); + } + + public static class Builder> { + + protected URI href; + protected String type; + protected Set links = Sets.newLinkedHashSet(); + + /** + * @see ResourceType#getHref() + */ + public Builder href(URI href) { + this.href = href; + return this; + } + + /** + * @see ResourceType#getType() + */ + public Builder type(String type) { + this.type = type; + return this; + } + + /** + * @see ResourceType#getLinks() + */ + public Builder links(Set links) { + this.links = Sets.newLinkedHashSet(checkNotNull(links, "links")); + return this; + } + + /** + * @see ResourceType#getLinks() + */ + public Builder link(Link link) { + this.links.add(checkNotNull(link, "link")); + return this; + } + + public ResourceType build() { + ResourceType reference = new ResourceType(href); + reference.setType(type); + reference.setLinks(links); + return reference; + } + + protected Builder fromResourceType(ResourceType in) { + return href(in.getHref()).type(in.getType()).links(in.getLinks()); + } + } + + @XmlAttribute + private URI href; + @XmlAttribute + private String type; + @XmlElement(namespace = NS, name = "Link") + private Set links = Sets.newLinkedHashSet(); + + protected ResourceType(URI href) { + this.href = href; + } + + protected ResourceType() { + // For JAXB + } + + /** + * Contains the URI to the entity. + * + * An object reference, expressed in URL format. Because this URL includes the object identifier + * portion of the id attribute value, it uniquely identifies the object, persists for the life of + * the object, and is never reused. The value of the href attribute is a reference to a view of + * the object, and can be used to access a representation of the object that is valid in a + * particular context. Although URLs have a well-known syntax and a well-understood + * interpretation, a client should treat each href as an opaque string. The rules that govern how + * the server constructs href strings might change in future releases. + * + * @return an opaque reference and should never be parsed + */ + public URI getHref() { + return href; + } + + /** + * Contains the type of the the entity. + * + * The object type, specified as a MIME content type, of the object that the link references. + * This attribute is present only for links to objects. It is not present for links to actions. + * + * @return type definition, type, expressed as an HTTP Content-Type + */ + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + /** + * Set of optional links to an entity or operation associated with this object. + */ + public SetgetLinks() { + return links; + } + + public void setLinks(Set links) { + this.links = Sets.newLinkedHashSet(checkNotNull(links, "links")); + } + + public void addLink(Link link) { + this.links.add(checkNotNull(link, "link")); + } + + /** + * @see #getHref() + */ + public URI getURI() { + return getHref(); + } + + @Override + public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + ResourceType that = ResourceType.class.cast(o); + return equal(this.href, that.href) && equal(this.links, that.links) && equal(this.type, that.type); + } + + @Override + public int hashCode() { + return Objects.hashCode(href, links, type); + } + + @Override + public String toString() { + return string().toString(); + } + + protected ToStringHelper string() { + return Objects.toStringHelper("").add("href", href).add("links", links).add("type", type); + } +} \ No newline at end of file diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Session.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Session.java index c374db31c8..8778581e99 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Session.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Session.java @@ -18,13 +18,15 @@ */ package org.jclouds.vcloud.director.v1_5.domain; -import static com.google.common.base.Objects.equal; -import static com.google.common.base.Preconditions.checkNotNull; -import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.NS; +import static com.google.common.base.Objects.*; +import static com.google.common.base.Preconditions.*; +import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.*; import java.net.URI; import java.util.Set; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; @@ -41,6 +43,7 @@ import com.google.common.collect.Sets; * @author Adrian Cole */ @XmlRootElement(namespace = NS, name = "Session") +@XmlAccessorType(XmlAccessType.FIELD) public class Session { public static Builder builder() { diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/SessionWithToken.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/SessionWithToken.java index faadb84958..a9575e50ca 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/SessionWithToken.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/SessionWithToken.java @@ -18,7 +18,7 @@ */ package org.jclouds.vcloud.director.v1_5.domain; -import static com.google.common.base.Objects.equal; +import static com.google.common.base.Objects.*; import com.google.common.base.Objects; @@ -68,8 +68,8 @@ public class SessionWithToken { } - protected Session session; - protected String token; + private Session session; + private String token; protected SessionWithToken(String token, Session session) { this.session = session; diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/OrgClientExpectTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/OrgClientExpectTest.java index 3efcae7a0a..f059be2193 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/OrgClientExpectTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/OrgClientExpectTest.java @@ -18,7 +18,7 @@ */ package org.jclouds.vcloud.director.v1_5.features; -import static org.testng.Assert.assertEquals; +import static org.testng.Assert.*; import java.net.URI; @@ -28,8 +28,8 @@ import org.jclouds.vcloud.director.v1_5.VCloudDirectorClient; import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType; import org.jclouds.vcloud.director.v1_5.domain.Link; import org.jclouds.vcloud.director.v1_5.domain.Org; -import org.jclouds.vcloud.director.v1_5.domain.OrgLink; import org.jclouds.vcloud.director.v1_5.domain.OrgList; +import org.jclouds.vcloud.director.v1_5.domain.Reference; import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorRestClientExpectTest; import org.testng.annotations.Test; @@ -61,7 +61,7 @@ public class OrgClientExpectTest extends BaseVCloudDirectorRestClientExpectTest VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, orgListRequest, orgListResponse); assertEquals(client.getOrgClient().getOrgList(), OrgList.builder() - .addOrg(OrgLink.builder() + .org(Reference.builder() .type("application/vnd.vmware.vcloud.org+xml") .name("JClouds") .href(URI.create("https://vcloudbeta.bluelock.com/api/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0")) @@ -95,41 +95,41 @@ public class OrgClientExpectTest extends BaseVCloudDirectorRestClientExpectTest .id("urn:vcloud:org:6f312e42-cd2b-488d-a2bb-97519cd57ed0") .type(VCloudDirectorMediaType.ORG_XML) .href(URI.create("https://vcloudbeta.bluelock.com/api/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0")) - .addLink(Link.builder() + .link(Link.builder() .rel("down") .type("application/vnd.vmware.vcloud.vdc+xml") .name("Cluster01-JClouds") .href(URI.create("https://vcloudbeta.bluelock.com/api/vdc/d16d333b-e3c0-4176-845d-a5ee6392df07")) .build()) - .addLink(Link.builder() + .link(Link.builder() .rel("down") .type("application/vnd.vmware.vcloud.tasksList+xml") .href(URI.create("https://vcloudbeta.bluelock.com/api/tasksList/6f312e42-cd2b-488d-a2bb-97519cd57ed0")) .build()) - .addLink(Link.builder() + .link(Link.builder() .rel("down") .type("application/vnd.vmware.vcloud.catalog+xml") .name("Public") .href(URI.create("https://vcloudbeta.bluelock.com/api/catalog/9e08c2f6-077a-42ce-bece-d5332e2ebb5c")) .build()) - .addLink(Link.builder() + .link(Link.builder() .rel("down") .type("application/vnd.vmware.vcloud.controlAccess+xml") .href(URI.create("https://vcloudbeta.bluelock.com/api/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/catalog/9e08c2f6-077a-42ce-bece-d5332e2ebb5c/controlAccess/")) .build()) - .addLink(Link.builder() + .link(Link.builder() .rel("down") .type("application/vnd.vmware.vcloud.orgNetwork+xml") .name("ilsolation01-Jclouds") .href(URI.create("https://vcloudbeta.bluelock.com/api/network/f3ba8256-6f48-4512-aad6-600e85b4dc38")) .build()) - .addLink(Link.builder() + .link(Link.builder() .rel("down") .type("application/vnd.vmware.vcloud.orgNetwork+xml") .name("internet01-Jclouds") .href(URI.create("https://vcloudbeta.bluelock.com/api/network/55a677cf-ab3f-48ae-b880-fab90421980c")) .build()) - .addLink(Link.builder() + .link(Link.builder() .rel("down") .type("application/vnd.vmware.vcloud.metadata+xml") .href(URI.create("https://vcloudbeta.bluelock.com/api/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/metadata"))