mirror of https://github.com/apache/jclouds.git
Tidy up domain objects, using media type enum
This commit is contained in:
parent
69c4bd62e6
commit
aab725d9eb
|
@ -0,0 +1,31 @@
|
||||||
|
/**
|
||||||
|
* 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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constants used by VCloudDirector clients
|
||||||
|
*
|
||||||
|
* @author grkvlt@apache.org
|
||||||
|
*/
|
||||||
|
public class VCloudDirectorConstants {
|
||||||
|
|
||||||
|
/** The XML namespace used by the clients. */
|
||||||
|
public static final String XMLNS = "http://www.vmware.com/vcloud/v1.5";
|
||||||
|
|
||||||
|
}
|
|
@ -26,27 +26,24 @@ package org.jclouds.vcloud.director.v1_5;
|
||||||
*
|
*
|
||||||
* @see javax.ws.rs.core.MediaType;
|
* @see javax.ws.rs.core.MediaType;
|
||||||
*/
|
*/
|
||||||
public interface VCloudDirectorMediaType {
|
public enum VCloudDirectorMediaType {
|
||||||
public final static String NS = "http://www.vmware.com/vcloud/v1.5";
|
ANY("*/*"),
|
||||||
|
SESSION("application/vnd.vmware.vcloud.session+xml"),
|
||||||
|
ERROR("application/vnd.vmware.vcloud.error+xml"),
|
||||||
|
ORG_LIST("application/vnd.vmware.vcloud.orgList+xml"),
|
||||||
|
METADATA("application/vnd.vmware.vcloud.metadata+xml"),
|
||||||
|
METADATA_ENTRY("*/*"), // TODO
|
||||||
|
ORG("application/vnd.vmware.vcloud.org+xml"),
|
||||||
|
TASKS_LIST("application/vnd.vmware.vcloud.tasksList+xml"),
|
||||||
|
TASK("application/vnd.vmware.vcloud.task+xml");
|
||||||
|
|
||||||
public final static String ANY = "*/*";
|
private final String mediaType;
|
||||||
|
|
||||||
public final static String SESSION_XML = "application/vnd.vmware.vcloud.session+xml";
|
private VCloudDirectorMediaType(String mediaType) {
|
||||||
|
this.mediaType = mediaType;
|
||||||
public final static String ERROR_XML = "application/vnd.vmware.vcloud.error+xml";
|
}
|
||||||
|
|
||||||
public final static String ORGLIST_XML = "application/vnd.vmware.vcloud.orgList+xml";
|
|
||||||
|
|
||||||
public final static String METADATA_XML = "application/vnd.vmware.vcloud.metadata+xml";
|
|
||||||
|
|
||||||
public static final String METADATAENTRY_XML = "TODO"; // TODO
|
|
||||||
|
|
||||||
public final static String ORG_XML = "application/vnd.vmware.vcloud.org+xml";
|
|
||||||
|
|
||||||
public static final String ORG_NETWORK_XML = "application/vnd.vmware.vcloud.orgNetwork+xml";
|
|
||||||
|
|
||||||
public final static String TASK_XML = "application/vnd.vmware.vcloud.task+xml";
|
|
||||||
|
|
||||||
public static final String TASKSLIST_XML = "application/vnd.vmware.vcloud.tasksList+xml";
|
|
||||||
|
|
||||||
|
public String getMediaType() {
|
||||||
|
return mediaType;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,9 +18,9 @@
|
||||||
*/
|
*/
|
||||||
package org.jclouds.vcloud.director.v1_5.domain;
|
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.checkNotNull;
|
import static com.google.common.base.Preconditions.*;
|
||||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.NS;
|
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.*;
|
||||||
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
@ -30,6 +30,8 @@ import javax.xml.bind.annotation.XmlElement;
|
||||||
|
|
||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
import com.google.common.base.Objects.ToStringHelper;
|
import com.google.common.base.Objects.ToStringHelper;
|
||||||
|
import com.google.common.base.Splitter;
|
||||||
|
import com.google.common.collect.Iterables;
|
||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -143,7 +145,6 @@ public class EntityType<T extends EntityType<T>> extends ResourceType<T> {
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
@Override
|
@Override
|
||||||
public Builder<T> fromResourceType(ResourceType<T> in) {
|
public Builder<T> fromResourceType(ResourceType<T> in) {
|
||||||
return Builder.class.cast(super.fromResourceType(in));
|
return Builder.class.cast(super.fromResourceType(in));
|
||||||
|
@ -156,9 +157,9 @@ public class EntityType<T extends EntityType<T>> extends ResourceType<T> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@XmlElement(namespace = NS, name = "Description")
|
@XmlElement(namespace = XMLNS, name = "Description")
|
||||||
private String description;
|
private String description;
|
||||||
@XmlElement(namespace = NS, name = "TasksInProgress")
|
@XmlElement(namespace = XMLNS, name = "TasksInProgress")
|
||||||
private TasksInProgress tasksInProgress;
|
private TasksInProgress tasksInProgress;
|
||||||
@XmlAttribute
|
@XmlAttribute
|
||||||
private String id;
|
private String id;
|
||||||
|
@ -211,12 +212,20 @@ public class EntityType<T extends EntityType<T>> extends ResourceType<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contains the name of the the entity.
|
* Returns the unique UUID string for this entity.
|
||||||
*
|
*
|
||||||
* The object type, specified as a MIME content type, of the object that the link references.
|
* Once we have an entity, the {@link #getId()} field is better suited to retrieving the
|
||||||
* This attribute is present only for links to objects. It is not present for links to actions.
|
* id than {@link #getHref()}.
|
||||||
*
|
*
|
||||||
* @return type definition, type, expressed as an HTTP Content-Type
|
* @see ReferenceType#getUuid()
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String getUuid() {
|
||||||
|
return Iterables.getLast(Splitter.on(":").split(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Contains the name of the the entity.
|
||||||
*/
|
*/
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return name;
|
return name;
|
||||||
|
@ -231,7 +240,7 @@ public class EntityType<T extends EntityType<T>> extends ResourceType<T> {
|
||||||
EntityType<?> that = EntityType.class.cast(o);
|
EntityType<?> that = EntityType.class.cast(o);
|
||||||
return super.equals(that) &&
|
return super.equals(that) &&
|
||||||
equal(this.id, that.id) && equal(this.description, that.description) &&
|
equal(this.id, that.id) && equal(this.description, that.description) &&
|
||||||
equal(this.tasksInProgress, that.tasksInProgress);
|
equal(this.tasksInProgress, that.tasksInProgress) && equal(this.name, that.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -20,12 +20,7 @@ package org.jclouds.vcloud.director.v1_5.domain;
|
||||||
|
|
||||||
import static com.google.common.base.Objects.*;
|
import static com.google.common.base.Objects.*;
|
||||||
import static com.google.common.base.Preconditions.*;
|
import static com.google.common.base.Preconditions.*;
|
||||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.*;
|
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.*;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileWriter;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.PrintWriter;
|
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
|
@ -43,7 +38,7 @@ import com.google.common.base.Objects;
|
||||||
*
|
*
|
||||||
* @author grkvlt@apache.org
|
* @author grkvlt@apache.org
|
||||||
*/
|
*/
|
||||||
@XmlRootElement(namespace = NS, name = "Error")
|
@XmlRootElement(namespace = XMLNS, name = "Error")
|
||||||
@XmlAccessorType(XmlAccessType.FIELD)
|
@XmlAccessorType(XmlAccessType.FIELD)
|
||||||
public class Error {
|
public class Error {
|
||||||
|
|
||||||
|
|
|
@ -18,8 +18,8 @@
|
||||||
*/
|
*/
|
||||||
package org.jclouds.vcloud.director.v1_5.domain;
|
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.checkNotNull;
|
import static com.google.common.base.Preconditions.*;
|
||||||
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
|
@ -18,9 +18,9 @@
|
||||||
*/
|
*/
|
||||||
package org.jclouds.vcloud.director.v1_5.domain;
|
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.checkNotNull;
|
import static com.google.common.base.Preconditions.*;
|
||||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.NS;
|
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.*;
|
||||||
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
@ -42,7 +42,7 @@ import com.google.common.collect.Sets;
|
||||||
*
|
*
|
||||||
* @author danikov
|
* @author danikov
|
||||||
*/
|
*/
|
||||||
@XmlRootElement(namespace = NS, name = "Metadata")
|
@XmlRootElement(namespace = XMLNS, name = "Metadata")
|
||||||
public class Metadata extends ResourceType<Metadata>{
|
public class Metadata extends ResourceType<Metadata>{
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
|
@ -133,7 +133,7 @@ public class Metadata extends ResourceType<Metadata>{
|
||||||
this.metadata = ImmutableSet.copyOf(metadataEntries);
|
this.metadata = ImmutableSet.copyOf(metadataEntries);
|
||||||
}
|
}
|
||||||
|
|
||||||
@XmlElement(namespace = NS, name = "MetadataEntry")
|
@XmlElement(namespace = XMLNS, name = "MetadataEntry")
|
||||||
private Set<MetadataEntry> metadata = Sets.newLinkedHashSet();
|
private Set<MetadataEntry> metadata = Sets.newLinkedHashSet();
|
||||||
|
|
||||||
public Set<MetadataEntry> getMetadata() {
|
public Set<MetadataEntry> getMetadata() {
|
||||||
|
|
|
@ -18,9 +18,9 @@
|
||||||
*/
|
*/
|
||||||
package org.jclouds.vcloud.director.v1_5.domain;
|
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.checkNotNull;
|
import static com.google.common.base.Preconditions.*;
|
||||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.NS;
|
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.*;
|
||||||
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
@ -41,7 +41,7 @@ import com.google.common.collect.Sets;
|
||||||
*
|
*
|
||||||
* @author danikov
|
* @author danikov
|
||||||
*/
|
*/
|
||||||
@XmlRootElement(namespace = NS, name = "TODO")
|
@XmlRootElement(namespace = XMLNS, name = "MetadataEntry")
|
||||||
public class MetadataEntry extends ResourceType<MetadataEntry> {
|
public class MetadataEntry extends ResourceType<MetadataEntry> {
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
|
@ -134,9 +134,9 @@ public class MetadataEntry extends ResourceType<MetadataEntry> {
|
||||||
this.value = checkNotNull(value, "value");
|
this.value = checkNotNull(value, "value");
|
||||||
}
|
}
|
||||||
|
|
||||||
@XmlElement(namespace = NS, name = "Key")
|
@XmlElement(namespace = XMLNS, name = "Key")
|
||||||
private String key;
|
private String key;
|
||||||
@XmlElement(namespace = NS, name = "Value")
|
@XmlElement(namespace = XMLNS, name = "Value")
|
||||||
private String value;
|
private String value;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -20,7 +20,7 @@ package org.jclouds.vcloud.director.v1_5.domain;
|
||||||
|
|
||||||
import static com.google.common.base.Objects.*;
|
import static com.google.common.base.Objects.*;
|
||||||
import static com.google.common.base.Preconditions.*;
|
import static com.google.common.base.Preconditions.*;
|
||||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.*;
|
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.*;
|
||||||
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
@ -43,7 +43,7 @@ import com.google.common.collect.Sets;
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
@XmlRootElement(namespace = NS, name = "Org")
|
@XmlRootElement(namespace = XMLNS, name = "Org")
|
||||||
public class Org extends EntityType<Org> {
|
public class Org extends EntityType<Org> {
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
|
@ -170,7 +170,7 @@ public class Org extends EntityType<Org> {
|
||||||
this.fullName = fullName;
|
this.fullName = fullName;
|
||||||
}
|
}
|
||||||
|
|
||||||
@XmlElement(namespace = NS, name = "FullName")
|
@XmlElement(namespace = XMLNS, name = "FullName")
|
||||||
private String fullName;
|
private String fullName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -18,9 +18,9 @@
|
||||||
*/
|
*/
|
||||||
package org.jclouds.vcloud.director.v1_5.domain;
|
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.checkNotNull;
|
import static com.google.common.base.Preconditions.*;
|
||||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.NS;
|
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.*;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ import com.google.common.collect.Sets;
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
@XmlRootElement(namespace = NS, name = "OrgList")
|
@XmlRootElement(namespace = XMLNS, name = "OrgList")
|
||||||
public class OrgList {
|
public class OrgList {
|
||||||
|
|
||||||
public static Builder builder() {
|
public static Builder builder() {
|
||||||
|
@ -84,7 +84,7 @@ public class OrgList {
|
||||||
this.orgs = ImmutableSet.copyOf(orgs);
|
this.orgs = ImmutableSet.copyOf(orgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
@XmlElement(namespace = NS, name = "Org")
|
@XmlElement(namespace = XMLNS, name = "Org")
|
||||||
private Set<Reference> orgs = Sets.newLinkedHashSet();
|
private Set<Reference> orgs = Sets.newLinkedHashSet();
|
||||||
|
|
||||||
public Set<Reference> getOrgs() {
|
public Set<Reference> getOrgs() {
|
||||||
|
|
|
@ -28,7 +28,9 @@ import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
import javax.xml.bind.annotation.XmlAttribute;
|
import javax.xml.bind.annotation.XmlAttribute;
|
||||||
|
|
||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
|
import com.google.common.base.Splitter;
|
||||||
import com.google.common.base.Objects.ToStringHelper;
|
import com.google.common.base.Objects.ToStringHelper;
|
||||||
|
import com.google.common.collect.Iterables;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A reference to a resource.
|
* A reference to a resource.
|
||||||
|
@ -42,7 +44,7 @@ import com.google.common.base.Objects.ToStringHelper;
|
||||||
* @author grkvlt@apache.org
|
* @author grkvlt@apache.org
|
||||||
*/
|
*/
|
||||||
@XmlAccessorType(XmlAccessType.FIELD)
|
@XmlAccessorType(XmlAccessType.FIELD)
|
||||||
public class ReferenceType<T extends ReferenceType<T>> {
|
public class ReferenceType<T extends ReferenceType<T>> implements URISupplier {
|
||||||
|
|
||||||
public static <T extends ReferenceType<T>> Builder<T> builder() {
|
public static <T extends ReferenceType<T>> Builder<T> builder() {
|
||||||
return new Builder<T>();
|
return new Builder<T>();
|
||||||
|
@ -156,6 +158,15 @@ public class ReferenceType<T extends ReferenceType<T>> {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the unique UUID string for this reference.
|
||||||
|
*
|
||||||
|
* @see ResourceType#getUuid()
|
||||||
|
*/
|
||||||
|
public String getUuid() {
|
||||||
|
return Iterables.getLast(Splitter.on("/").split(href.getPath()));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contains the name of the the entity.
|
* Contains the name of the the entity.
|
||||||
*
|
*
|
||||||
|
@ -189,8 +200,9 @@ public class ReferenceType<T extends ReferenceType<T>> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see #getHref()
|
* @see URISupplier#getURI()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public URI getURI() {
|
public URI getURI() {
|
||||||
return getHref();
|
return getHref();
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
*/
|
*/
|
||||||
package org.jclouds.vcloud.director.v1_5.domain;
|
package org.jclouds.vcloud.director.v1_5.domain;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.*;
|
||||||
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
|
@ -20,7 +20,7 @@ package org.jclouds.vcloud.director.v1_5.domain;
|
||||||
|
|
||||||
import static com.google.common.base.Objects.*;
|
import static com.google.common.base.Objects.*;
|
||||||
import static com.google.common.base.Preconditions.*;
|
import static com.google.common.base.Preconditions.*;
|
||||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.*;
|
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.*;
|
||||||
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
@ -31,7 +31,9 @@ import javax.xml.bind.annotation.XmlAttribute;
|
||||||
import javax.xml.bind.annotation.XmlElement;
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
|
|
||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
|
import com.google.common.base.Splitter;
|
||||||
import com.google.common.base.Objects.ToStringHelper;
|
import com.google.common.base.Objects.ToStringHelper;
|
||||||
|
import com.google.common.collect.Iterables;
|
||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -46,7 +48,7 @@ import com.google.common.collect.Sets;
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
@XmlAccessorType(XmlAccessType.FIELD)
|
@XmlAccessorType(XmlAccessType.FIELD)
|
||||||
public class ResourceType<T extends ResourceType<T>> {
|
public class ResourceType<T extends ResourceType<T>> implements URISupplier {
|
||||||
|
|
||||||
public static <T extends ResourceType<T>> Builder<T> builder() {
|
public static <T extends ResourceType<T>> Builder<T> builder() {
|
||||||
return new Builder<T>();
|
return new Builder<T>();
|
||||||
|
@ -110,7 +112,7 @@ public class ResourceType<T extends ResourceType<T>> {
|
||||||
private URI href;
|
private URI href;
|
||||||
@XmlAttribute
|
@XmlAttribute
|
||||||
private String type;
|
private String type;
|
||||||
@XmlElement(namespace = NS, name = "Link")
|
@XmlElement(namespace = XMLNS, name = "Link")
|
||||||
private Set<Link> links = Sets.newLinkedHashSet();
|
private Set<Link> links = Sets.newLinkedHashSet();
|
||||||
|
|
||||||
protected ResourceType(URI href) {
|
protected ResourceType(URI href) {
|
||||||
|
@ -138,6 +140,23 @@ public class ResourceType<T extends ResourceType<T>> {
|
||||||
return href;
|
return href;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see URISupplier#getURI()
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public URI getURI() {
|
||||||
|
return getHref();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the unique UUID string for this resource.
|
||||||
|
*
|
||||||
|
* @see ReferenceType#getUuid()
|
||||||
|
*/
|
||||||
|
public String getUuid() {
|
||||||
|
return Iterables.getLast(Splitter.on("/").split(href.getPath()));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contains the type of the the entity.
|
* Contains the type of the the entity.
|
||||||
*
|
*
|
||||||
|
@ -169,13 +188,6 @@ public class ResourceType<T extends ResourceType<T>> {
|
||||||
this.links.add(checkNotNull(link, "link"));
|
this.links.add(checkNotNull(link, "link"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @see #getHref()
|
|
||||||
*/
|
|
||||||
public URI getURI() {
|
|
||||||
return getHref();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o)
|
if (this == o)
|
||||||
|
|
|
@ -20,7 +20,7 @@ package org.jclouds.vcloud.director.v1_5.domain;
|
||||||
|
|
||||||
import static com.google.common.base.Objects.*;
|
import static com.google.common.base.Objects.*;
|
||||||
import static com.google.common.base.Preconditions.*;
|
import static com.google.common.base.Preconditions.*;
|
||||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.*;
|
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.*;
|
||||||
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
@ -42,7 +42,7 @@ import com.google.common.collect.Sets;
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
@XmlRootElement(namespace = NS, name = "Session")
|
@XmlRootElement(namespace = XMLNS, name = "Session")
|
||||||
@XmlAccessorType(XmlAccessType.FIELD)
|
@XmlAccessorType(XmlAccessType.FIELD)
|
||||||
public class Session {
|
public class Session {
|
||||||
|
|
||||||
|
@ -120,7 +120,7 @@ public class Session {
|
||||||
this.links = ImmutableSet.copyOf(links);
|
this.links = ImmutableSet.copyOf(links);
|
||||||
}
|
}
|
||||||
|
|
||||||
@XmlElement(namespace = NS, name = "Link")
|
@XmlElement(namespace = XMLNS, name = "Link")
|
||||||
private Set<Link> links = Sets.newLinkedHashSet();
|
private Set<Link> links = Sets.newLinkedHashSet();
|
||||||
@XmlAttribute
|
@XmlAttribute
|
||||||
private String user;
|
private String user;
|
||||||
|
|
|
@ -43,7 +43,7 @@ public class SessionWithToken {
|
||||||
protected String token;
|
protected String token;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see SessionWithToken#getType
|
* @see SessionWithToken#getSession()
|
||||||
*/
|
*/
|
||||||
public Builder session(Session session) {
|
public Builder session(Session session) {
|
||||||
this.session = session;
|
this.session = session;
|
||||||
|
@ -51,7 +51,7 @@ public class SessionWithToken {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see SessionWithToken#getHref
|
* @see SessionWithToken#getToken()
|
||||||
*/
|
*/
|
||||||
public Builder token(String token) {
|
public Builder token(String token) {
|
||||||
this.token = token;
|
this.token = token;
|
||||||
|
|
|
@ -7,20 +7,20 @@
|
||||||
* "License"); you may not use this file except in compliance
|
* "License"); you may not use this file except in compliance
|
||||||
* with the License. You may obtain a copy of the License at
|
* with the License. You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICEXMLNSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing,
|
* Unless required by applicable law or agreed to in writing,
|
||||||
* software distributed under the License is distributed on an
|
* software distributed under the License is distributed on an
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIOXMLNS OF ANY
|
||||||
* KIND, either express or implied. See the License for the
|
* KIND, either express or implied. See the License for the
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
package org.jclouds.vcloud.director.v1_5.domain;
|
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.checkNotNull;
|
import static com.google.common.base.Preconditions.*;
|
||||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.NS;
|
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.*;
|
||||||
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
@ -43,7 +43,7 @@ import com.google.common.collect.Sets;
|
||||||
*
|
*
|
||||||
* @author grkvlt@apache.org
|
* @author grkvlt@apache.org
|
||||||
*/
|
*/
|
||||||
@XmlRootElement(namespace = NS, name = "Task")
|
@XmlRootElement(namespace = XMLNS, name = "Task")
|
||||||
public class Task extends EntityType<Task> {
|
public class Task extends EntityType<Task> {
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
|
@ -282,17 +282,17 @@ public class Task extends EntityType<Task> {
|
||||||
super(href, name);
|
super(href, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@XmlElement(namespace = NS, name = "Error")
|
@XmlElement(namespace = XMLNS, name = "Error")
|
||||||
private Error error;
|
private Error error;
|
||||||
@XmlElement(namespace = NS, name = "Organization")
|
@XmlElement(namespace = XMLNS, name = "Organization")
|
||||||
private Reference org;
|
private Reference org;
|
||||||
@XmlElement(namespace = NS, name = "Progress")
|
@XmlElement(namespace = XMLNS, name = "Progress")
|
||||||
private Integer progress;
|
private Integer progress;
|
||||||
@XmlElement(namespace = NS, name = "Owner")
|
@XmlElement(namespace = XMLNS, name = "Owner")
|
||||||
private Reference owner;
|
private Reference owner;
|
||||||
@XmlElement(namespace = NS, name = "User")
|
@XmlElement(namespace = XMLNS, name = "User")
|
||||||
private Reference user;
|
private Reference user;
|
||||||
@XmlElement(namespace = NS, name = "Params")
|
@XmlElement(namespace = XMLNS, name = "Params")
|
||||||
private Object params;
|
private Object params;
|
||||||
@XmlAttribute
|
@XmlAttribute
|
||||||
private String status;
|
private String status;
|
||||||
|
|
|
@ -7,11 +7,11 @@
|
||||||
* "License"); you may not use this file except in compliance
|
* "License"); you may not use this file except in compliance
|
||||||
* with the License. You may obtain a copy of the License at
|
* with the License. You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICEXMLNSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing,
|
* Unless required by applicable law or agreed to in writing,
|
||||||
* software distributed under the License is distributed on an
|
* software distributed under the License is distributed on an
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIOXMLNS OF ANY
|
||||||
* KIND, either express or implied. See the License for the
|
* KIND, either express or implied. See the License for the
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
|
@ -20,7 +20,7 @@ package org.jclouds.vcloud.director.v1_5.domain;
|
||||||
|
|
||||||
import static com.google.common.base.Objects.*;
|
import static com.google.common.base.Objects.*;
|
||||||
import static com.google.common.base.Preconditions.*;
|
import static com.google.common.base.Preconditions.*;
|
||||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.*;
|
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.*;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
@ -37,7 +37,7 @@ import com.google.common.collect.Sets;
|
||||||
/**
|
/**
|
||||||
* @author grkvlt@apache.org
|
* @author grkvlt@apache.org
|
||||||
*/
|
*/
|
||||||
@XmlRootElement(namespace = NS, name = "TasksInProgress")
|
@XmlRootElement(namespace = XMLNS, name = "TasksInProgress")
|
||||||
@XmlAccessorType(XmlAccessType.FIELD)
|
@XmlAccessorType(XmlAccessType.FIELD)
|
||||||
public class TasksInProgress {
|
public class TasksInProgress {
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ public class TasksInProgress {
|
||||||
this.tasks = ImmutableSet.copyOf(tasks);
|
this.tasks = ImmutableSet.copyOf(tasks);
|
||||||
}
|
}
|
||||||
|
|
||||||
@XmlElement(namespace = NS, name = "Task")
|
@XmlElement(namespace = XMLNS, name = "Task")
|
||||||
private Set<Task> tasks = Sets.newLinkedHashSet();
|
private Set<Task> tasks = Sets.newLinkedHashSet();
|
||||||
|
|
||||||
public Set<Task> getTasks() {
|
public Set<Task> getTasks() {
|
||||||
|
|
|
@ -20,7 +20,7 @@ package org.jclouds.vcloud.director.v1_5.domain;
|
||||||
|
|
||||||
import static com.google.common.base.Objects.*;
|
import static com.google.common.base.Objects.*;
|
||||||
import static com.google.common.base.Preconditions.*;
|
import static com.google.common.base.Preconditions.*;
|
||||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.*;
|
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.*;
|
||||||
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
@ -38,7 +38,7 @@ import com.google.common.collect.Sets;
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
@XmlRootElement(namespace = NS, name = "TasksList")
|
@XmlRootElement(namespace = XMLNS, name = "TasksList")
|
||||||
public class TasksList extends EntityType<TasksList> {
|
public class TasksList extends EntityType<TasksList> {
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
|
@ -173,7 +173,7 @@ public class TasksList extends EntityType<TasksList> {
|
||||||
this.tasks = ImmutableSet.copyOf(tasks);
|
this.tasks = ImmutableSet.copyOf(tasks);
|
||||||
}
|
}
|
||||||
|
|
||||||
@XmlElement(namespace = NS, name = "Task")
|
@XmlElement(namespace = XMLNS, name = "Task")
|
||||||
private Set<Task> tasks = Sets.newLinkedHashSet();
|
private Set<Task> tasks = Sets.newLinkedHashSet();
|
||||||
|
|
||||||
public Set<Task> getTasks() {
|
public Set<Task> getTasks() {
|
||||||
|
|
Loading…
Reference in New Issue