mirror of https://github.com/apache/jclouds.git
Query client and domain objects
This commit is contained in:
parent
c42137ab08
commit
e764785219
|
@ -23,6 +23,7 @@ import org.jclouds.vcloud.director.v1_5.domain.Session;
|
|||
import org.jclouds.vcloud.director.v1_5.features.CatalogAsyncClient;
|
||||
import org.jclouds.vcloud.director.v1_5.features.NetworkAsyncClient;
|
||||
import org.jclouds.vcloud.director.v1_5.features.OrgAsyncClient;
|
||||
import org.jclouds.vcloud.director.v1_5.features.QueryAsyncClient;
|
||||
import org.jclouds.vcloud.director.v1_5.features.TaskAsyncClient;
|
||||
|
||||
import com.google.inject.Provides;
|
||||
|
@ -42,6 +43,12 @@ public interface VCloudDirectorAsyncClient {
|
|||
@Provides
|
||||
Session getCurrentSession();
|
||||
|
||||
/**
|
||||
* @return asynchronous access to query features
|
||||
*/
|
||||
@Delegate
|
||||
QueryAsyncClient getQueryClient();
|
||||
|
||||
/**
|
||||
* @return asynchronous access to {@link Org} features
|
||||
*/
|
||||
|
|
|
@ -27,13 +27,13 @@ import org.jclouds.vcloud.director.v1_5.features.CatalogClient;
|
|||
import org.jclouds.vcloud.director.v1_5.features.MediaClient;
|
||||
import org.jclouds.vcloud.director.v1_5.features.NetworkClient;
|
||||
import org.jclouds.vcloud.director.v1_5.features.OrgClient;
|
||||
import org.jclouds.vcloud.director.v1_5.features.QueryClient;
|
||||
import org.jclouds.vcloud.director.v1_5.features.TaskClient;
|
||||
|
||||
import com.google.inject.Provides;
|
||||
|
||||
/**
|
||||
* Provides synchronous access to VCloudDirector.
|
||||
* <p/>
|
||||
*
|
||||
* @see VCloudDirectorAsyncClient
|
||||
* @author Adrian Cole
|
||||
|
@ -41,12 +41,17 @@ import com.google.inject.Provides;
|
|||
@Timeout(duration = 60, timeUnit = TimeUnit.SECONDS)
|
||||
public interface VCloudDirectorClient {
|
||||
/**
|
||||
*
|
||||
* @return the current login session
|
||||
*/
|
||||
@Provides
|
||||
Session getCurrentSession();
|
||||
|
||||
/**
|
||||
* @return asynchronous access to query features
|
||||
*/
|
||||
@Delegate
|
||||
QueryClient getQueryClient();
|
||||
|
||||
/**
|
||||
* @return synchronous access to {@link Org} features
|
||||
*/
|
||||
|
|
|
@ -73,10 +73,12 @@ public class VCloudDirectorMediaType {
|
|||
|
||||
public static final String ADMIN_USER = "application/vnd.vmware.admin.user+xml";
|
||||
|
||||
public static final String QUERY_RESULT_RECORDS = "application/vnd.vmware.vcloud.query.records+xml";
|
||||
|
||||
public static final List<String> ALL = Arrays.asList(
|
||||
SESSION, ERROR, ORG_LIST, METADATA, METADATA_ENTRY,
|
||||
METADATA_VALUE, ORG, TASKS_LIST, TASK, ORG_NETWORK,
|
||||
CATALOG, CATALOG_ITEM, CATALOG_ITEMS, CATALOGS_LIST, PROPERTY,
|
||||
MEDIA, OWNER, VDC, ADMIN_USER
|
||||
MEDIA, OWNER, VDC, ADMIN_USER, QUERY_RESULT_RECORDS
|
||||
);
|
||||
}
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
*/
|
||||
package org.jclouds.vcloud.director.v1_5.config;
|
||||
|
||||
import static com.google.common.base.Throwables.propagate;
|
||||
import static org.jclouds.rest.config.BinderUtils.bindClientAndAsyncClient;
|
||||
import static com.google.common.base.Throwables.*;
|
||||
import static org.jclouds.rest.config.BinderUtils.*;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Map;
|
||||
|
@ -50,6 +50,8 @@ import org.jclouds.vcloud.director.v1_5.features.NetworkAsyncClient;
|
|||
import org.jclouds.vcloud.director.v1_5.features.NetworkClient;
|
||||
import org.jclouds.vcloud.director.v1_5.features.OrgAsyncClient;
|
||||
import org.jclouds.vcloud.director.v1_5.features.OrgClient;
|
||||
import org.jclouds.vcloud.director.v1_5.features.QueryAsyncClient;
|
||||
import org.jclouds.vcloud.director.v1_5.features.QueryClient;
|
||||
import org.jclouds.vcloud.director.v1_5.features.TaskAsyncClient;
|
||||
import org.jclouds.vcloud.director.v1_5.features.TaskClient;
|
||||
import org.jclouds.vcloud.director.v1_5.functions.LoginUserInOrgWithPassword;
|
||||
|
@ -82,6 +84,7 @@ public class VCloudDirectorRestClientModule extends RestClientModule<VCloudDirec
|
|||
.put(CatalogClient.class, CatalogAsyncClient.class)
|
||||
.put(NetworkClient.class, NetworkAsyncClient.class)
|
||||
.put(OrgClient.class, OrgAsyncClient.class)
|
||||
.put(QueryClient.class, QueryAsyncClient.class)
|
||||
.put(MediaClient.class, MediaAsyncClient.class)
|
||||
.put(TaskClient.class, TaskAsyncClient.class)
|
||||
.build();
|
||||
|
|
|
@ -105,7 +105,7 @@ public class EntityType<T extends EntityType<T>> extends ResourceType<T> {
|
|||
}
|
||||
|
||||
/**
|
||||
* @see ReferenceType#getHref()
|
||||
* @see ResourceType#getHref()
|
||||
*/
|
||||
@Override
|
||||
public Builder<T> href(URI href) {
|
||||
|
@ -114,7 +114,7 @@ public class EntityType<T extends EntityType<T>> extends ResourceType<T> {
|
|||
}
|
||||
|
||||
/**
|
||||
* @see ReferenceType#getType()
|
||||
* @see ResourceType#getType()
|
||||
*/
|
||||
@Override
|
||||
public Builder<T> type(String type) {
|
||||
|
@ -123,7 +123,7 @@ public class EntityType<T extends EntityType<T>> extends ResourceType<T> {
|
|||
}
|
||||
|
||||
/**
|
||||
* @see ReferenceType#getLinks()
|
||||
* @see ResourceType#getLinks()
|
||||
*/
|
||||
@Override
|
||||
public Builder<T> links(Set<Link> links) {
|
||||
|
@ -132,7 +132,7 @@ public class EntityType<T extends EntityType<T>> extends ResourceType<T> {
|
|||
}
|
||||
|
||||
/**
|
||||
* @see ReferenceType#getLinks()
|
||||
* @see ResourceType#getLinks()
|
||||
*/
|
||||
@Override
|
||||
public Builder<T> link(Link link) {
|
||||
|
|
|
@ -0,0 +1,258 @@
|
|||
/**
|
||||
* 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 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.XmlSeeAlso;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* Base type that represents a resource entity such as a vApp
|
||||
* template or virtual media.
|
||||
*
|
||||
*
|
||||
* <p>Java class for ResourceEntity complex type.
|
||||
*
|
||||
* <p>The following schema fragment specifies the expected content contained within this class.
|
||||
*
|
||||
* <pre>
|
||||
* <complexType name="ResourceEntity">
|
||||
* <complexContent>
|
||||
* <extension base="{http://www.vmware.com/vcloud/v1.5}EntityType">
|
||||
* <sequence>
|
||||
* <element name="Files" type="{http://www.vmware.com/vcloud/v1.5}FilesListType" minOccurs="0"/>
|
||||
* </sequence>
|
||||
* <attribute name="status" type="{http://www.w3.org/2001/XMLSchema}int" />
|
||||
* <anyAttribute processContents='lax' namespace='##other'/>
|
||||
* </extension>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlType(name = "ResourceEntity", propOrder = {
|
||||
"files"
|
||||
})
|
||||
@XmlSeeAlso({
|
||||
MediaType.class,
|
||||
VAppTemplateType.class,
|
||||
AbstractVAppType.class,
|
||||
NetworkPoolType.class
|
||||
})
|
||||
public class ResourceEntity
|
||||
extends EntityType<ResourceEntity>
|
||||
|
||||
{
|
||||
@SuppressWarnings("unchecked")
|
||||
public static Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
public Builder toBuilder() {
|
||||
return new Builder().fromResourceEntity(this);
|
||||
}
|
||||
|
||||
public static class Builder extends EntityType.Builder<ResourceEntity> {
|
||||
|
||||
private FilesList files;
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* @see ResourceEntity#getFiles()
|
||||
*/
|
||||
public Builder files(FilesList files) {
|
||||
this.files = files;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ResourceEntity#getStatus()
|
||||
*/
|
||||
public Builder status(Integer status) {
|
||||
this.status = status;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public ResourceEntity build() {
|
||||
ResourceEntity resourceEntity = new ResourceEntity();
|
||||
resourceEntity.setFiles(files);
|
||||
resourceEntity.setStatus(status);
|
||||
return resourceEntity;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see EntityType#getId()
|
||||
*/
|
||||
@Override
|
||||
public Builder id(String id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see EntityType#getTasksInProgress()
|
||||
*/
|
||||
@Override
|
||||
public Builder tasksInProgress(TasksInProgress tasksInProgress) {
|
||||
this.tasksInProgress = tasksInProgress;
|
||||
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<Link> 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<ResourceEntity> in) {
|
||||
return Builder.class.cast(super.fromEntityType(in));
|
||||
}
|
||||
public Builder fromResourceEntity(ResourceEntity in) {
|
||||
return fromEntityType(in)
|
||||
.files(in.getFiles())
|
||||
.status(in.getStatus());
|
||||
}
|
||||
}
|
||||
|
||||
private ResourceEntity() {
|
||||
// For JAXB and builder use
|
||||
}
|
||||
|
||||
|
||||
|
||||
@XmlElement(name = "Files")
|
||||
protected FilesList files;
|
||||
@XmlAttribute
|
||||
protected Integer status;
|
||||
|
||||
/**
|
||||
* Gets the value of the files property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link FilesList }
|
||||
*
|
||||
*/
|
||||
public FilesList getFiles() {
|
||||
return files;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the files property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link FilesList }
|
||||
*
|
||||
*/
|
||||
public void setFiles(FilesList value) {
|
||||
this.files = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the status property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link Integer }
|
||||
*
|
||||
*/
|
||||
public Integer getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the status property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link Integer }
|
||||
*
|
||||
*/
|
||||
public void setStatus(Integer value) {
|
||||
this.status = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o)
|
||||
return true;
|
||||
if (o == null || getClass() != o.getClass())
|
||||
return false;
|
||||
ResourceEntity that = ResourceEntity.class.cast(o);
|
||||
return equal(files, that.files) &&
|
||||
equal(status, that.status);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(files,
|
||||
status);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Objects.toStringHelper("")
|
||||
.add("files", files)
|
||||
.add("status", status).toString();
|
||||
}
|
||||
|
||||
}
|
|
@ -32,7 +32,6 @@ import javax.xml.bind.annotation.XmlElement;
|
|||
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.base.Objects.ToStringHelper;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
/**
|
||||
|
|
|
@ -0,0 +1,924 @@
|
|||
/**
|
||||
* 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 javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* Represents users in the vCloud system.
|
||||
*
|
||||
*
|
||||
* <p>Java class for User complex type.
|
||||
*
|
||||
* <p>The following schema fragment specifies the expected content contained within this class.
|
||||
*
|
||||
* <pre>
|
||||
* <complexType name="User">
|
||||
* <complexContent>
|
||||
* <extension base="{http://www.vmware.com/vcloud/v1.5}EntityType">
|
||||
* <sequence>
|
||||
* <element name="FullName" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
|
||||
* <element name="EmailAddress" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
|
||||
* <element name="Telephone" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
|
||||
* <element name="IsEnabled" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
|
||||
* <element name="IsLocked" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
|
||||
* <element name="IM" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
|
||||
* <element name="NameInSource" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
|
||||
* <element name="IsAlertEnabled" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
|
||||
* <element name="AlertEmailPrefix" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
|
||||
* <element name="AlertEmail" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
|
||||
* <element name="IsExternal" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
|
||||
* <element name="IsDefaultCached" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
|
||||
* <element name="IsGroupRole" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
|
||||
* <element name="StoredVmQuota" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
|
||||
* <element name="DeployedVmQuota" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
|
||||
* <element name="Role" type="{http://www.vmware.com/vcloud/v1.5}ReferenceType" minOccurs="0"/>
|
||||
* <element name="Password" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
|
||||
* <element name="GroupReferences" type="{http://www.vmware.com/vcloud/v1.5}GroupsListType" minOccurs="0"/>
|
||||
* </sequence>
|
||||
* <anyAttribute processContents='lax' namespace='##other'/>
|
||||
* </extension>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlType(name = "User", propOrder = {
|
||||
"fullName",
|
||||
"emailAddress",
|
||||
"telephone",
|
||||
"isEnabled",
|
||||
"isLocked",
|
||||
"im",
|
||||
"nameInSource",
|
||||
"isAlertEnabled",
|
||||
"alertEmailPrefix",
|
||||
"alertEmail",
|
||||
"isExternal",
|
||||
"isDefaultCached",
|
||||
"isGroupRole",
|
||||
"storedVmQuota",
|
||||
"deployedVmQuota",
|
||||
"role",
|
||||
"password",
|
||||
"groupReferences"
|
||||
})
|
||||
public class User
|
||||
extends EntityType<User>
|
||||
|
||||
{
|
||||
@SuppressWarnings("unchecked")
|
||||
public static Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
public Builder toBuilder() {
|
||||
return new Builder().fromUser(this);
|
||||
}
|
||||
|
||||
public static class Builder extends EntityType.Builder<User> {
|
||||
|
||||
private String fullName;
|
||||
private String emailAddress;
|
||||
private String telephone;
|
||||
private Boolean isEnabled;
|
||||
private Boolean isLocked;
|
||||
private String im;
|
||||
private String nameInSource;
|
||||
private Boolean isAlertEnabled;
|
||||
private String alertEmailPrefix;
|
||||
private String alertEmail;
|
||||
private Boolean isExternal;
|
||||
private Boolean isDefaultCached;
|
||||
private Boolean isGroupRole;
|
||||
private Integer storedVmQuota;
|
||||
private Integer deployedVmQuota;
|
||||
private Reference role;
|
||||
private String password;
|
||||
private GroupsList groupReferences;
|
||||
|
||||
/**
|
||||
* @see User#getFullName()
|
||||
*/
|
||||
public Builder fullName(String fullName) {
|
||||
this.fullName = fullName;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see User#getEmailAddress()
|
||||
*/
|
||||
public Builder emailAddress(String emailAddress) {
|
||||
this.emailAddress = emailAddress;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see User#getTelephone()
|
||||
*/
|
||||
public Builder telephone(String telephone) {
|
||||
this.telephone = telephone;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see User#getIsEnabled()
|
||||
*/
|
||||
public Builder isEnabled(Boolean isEnabled) {
|
||||
this.isEnabled = isEnabled;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see User#getIsLocked()
|
||||
*/
|
||||
public Builder isLocked(Boolean isLocked) {
|
||||
this.isLocked = isLocked;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see User#getIm()
|
||||
*/
|
||||
public Builder im(String im) {
|
||||
this.im = im;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see User#getNameInSource()
|
||||
*/
|
||||
public Builder nameInSource(String nameInSource) {
|
||||
this.nameInSource = nameInSource;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see User#getIsAlertEnabled()
|
||||
*/
|
||||
public Builder isAlertEnabled(Boolean isAlertEnabled) {
|
||||
this.isAlertEnabled = isAlertEnabled;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see User#getAlertEmailPrefix()
|
||||
*/
|
||||
public Builder alertEmailPrefix(String alertEmailPrefix) {
|
||||
this.alertEmailPrefix = alertEmailPrefix;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see User#getAlertEmail()
|
||||
*/
|
||||
public Builder alertEmail(String alertEmail) {
|
||||
this.alertEmail = alertEmail;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see User#getIsExternal()
|
||||
*/
|
||||
public Builder isExternal(Boolean isExternal) {
|
||||
this.isExternal = isExternal;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see User#getIsDefaultCached()
|
||||
*/
|
||||
public Builder isDefaultCached(Boolean isDefaultCached) {
|
||||
this.isDefaultCached = isDefaultCached;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see User#getIsGroupRole()
|
||||
*/
|
||||
public Builder isGroupRole(Boolean isGroupRole) {
|
||||
this.isGroupRole = isGroupRole;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see User#getStoredVmQuota()
|
||||
*/
|
||||
public Builder storedVmQuota(Integer storedVmQuota) {
|
||||
this.storedVmQuota = storedVmQuota;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see User#getDeployedVmQuota()
|
||||
*/
|
||||
public Builder deployedVmQuota(Integer deployedVmQuota) {
|
||||
this.deployedVmQuota = deployedVmQuota;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see User#getRole()
|
||||
*/
|
||||
public Builder role(Reference role) {
|
||||
this.role = role;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see User#getPassword()
|
||||
*/
|
||||
public Builder password(String password) {
|
||||
this.password = password;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see User#getGroupReferences()
|
||||
*/
|
||||
public Builder groupReferences(GroupsList groupReferences) {
|
||||
this.groupReferences = groupReferences;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public User build() {
|
||||
User user = new User(im);
|
||||
user.setFullName(fullName);
|
||||
user.setEmailAddress(emailAddress);
|
||||
user.setTelephone(telephone);
|
||||
user.setIsEnabled(isEnabled);
|
||||
user.setIsLocked(isLocked);
|
||||
user.setNameInSource(nameInSource);
|
||||
user.setIsAlertEnabled(isAlertEnabled);
|
||||
user.setAlertEmailPrefix(alertEmailPrefix);
|
||||
user.setAlertEmail(alertEmail);
|
||||
user.setIsExternal(isExternal);
|
||||
user.setIsDefaultCached(isDefaultCached);
|
||||
user.setIsGroupRole(isGroupRole);
|
||||
user.setStoredVmQuota(storedVmQuota);
|
||||
user.setDeployedVmQuota(deployedVmQuota);
|
||||
user.setRole(role);
|
||||
user.setPassword(password);
|
||||
user.setGroupReferences(groupReferences);
|
||||
return user;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see EntityType#getId()
|
||||
*/
|
||||
@Override
|
||||
public Builder id(String id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see EntityType#getTasksInProgress()
|
||||
*/
|
||||
@Override
|
||||
public Builder tasksInProgress(TasksInProgress tasksInProgress) {
|
||||
this.tasksInProgress = tasksInProgress;
|
||||
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<Link> 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<User> in) {
|
||||
return Builder.class.cast(super.fromEntityType(in));
|
||||
}
|
||||
public Builder fromUser(User in) {
|
||||
return fromEntityType(in)
|
||||
.fullName(in.getFullName())
|
||||
.emailAddress(in.getEmailAddress())
|
||||
.telephone(in.getTelephone())
|
||||
.isEnabled(in.getIsEnabled())
|
||||
.isLocked(in.getIsLocked())
|
||||
.im(in.getIm())
|
||||
.nameInSource(in.getNameInSource())
|
||||
.isAlertEnabled(in.getIsAlertEnabled())
|
||||
.alertEmailPrefix(in.getAlertEmailPrefix())
|
||||
.alertEmail(in.getAlertEmail())
|
||||
.isExternal(in.getIsExternal())
|
||||
.isDefaultCached(in.getIsDefaultCached())
|
||||
.isGroupRole(in.getIsGroupRole())
|
||||
.storedVmQuota(in.getStoredVmQuota())
|
||||
.deployedVmQuota(in.getDeployedVmQuota())
|
||||
.role(in.getRole())
|
||||
.password(in.getPassword())
|
||||
.groupReferences(in.getGroupReferences());
|
||||
}
|
||||
}
|
||||
|
||||
private User() {
|
||||
// For JAXB and builder use
|
||||
}
|
||||
|
||||
private User(String im) {
|
||||
this.im = im;
|
||||
}
|
||||
|
||||
|
||||
@XmlElement(name = "FullName")
|
||||
protected String fullName;
|
||||
@XmlElement(name = "EmailAddress")
|
||||
protected String emailAddress;
|
||||
@XmlElement(name = "Telephone")
|
||||
protected String telephone;
|
||||
@XmlElement(name = "IsEnabled")
|
||||
protected Boolean isEnabled;
|
||||
@XmlElement(name = "IsLocked")
|
||||
protected Boolean isLocked;
|
||||
@XmlElement(name = "IM")
|
||||
protected String im;
|
||||
@XmlElement(name = "NameInSource")
|
||||
protected String nameInSource;
|
||||
@XmlElement(name = "IsAlertEnabled")
|
||||
protected Boolean isAlertEnabled;
|
||||
@XmlElement(name = "AlertEmailPrefix")
|
||||
protected String alertEmailPrefix;
|
||||
@XmlElement(name = "AlertEmail")
|
||||
protected String alertEmail;
|
||||
@XmlElement(name = "IsExternal")
|
||||
protected Boolean isExternal;
|
||||
@XmlElement(name = "IsDefaultCached")
|
||||
protected Boolean isDefaultCached;
|
||||
@XmlElement(name = "IsGroupRole")
|
||||
protected Boolean isGroupRole;
|
||||
@XmlElement(name = "StoredVmQuota")
|
||||
protected Integer storedVmQuota;
|
||||
@XmlElement(name = "DeployedVmQuota")
|
||||
protected Integer deployedVmQuota;
|
||||
@XmlElement(name = "Role")
|
||||
protected Reference role;
|
||||
@XmlElement(name = "Password")
|
||||
protected String password;
|
||||
@XmlElement(name = "GroupReferences")
|
||||
protected GroupsList groupReferences;
|
||||
|
||||
/**
|
||||
* Gets the value of the fullName property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public String getFullName() {
|
||||
return fullName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the fullName property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public void setFullName(String value) {
|
||||
this.fullName = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the emailAddress property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public String getEmailAddress() {
|
||||
return emailAddress;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the emailAddress property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public void setEmailAddress(String value) {
|
||||
this.emailAddress = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the telephone property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public String getTelephone() {
|
||||
return telephone;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the telephone property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public void setTelephone(String value) {
|
||||
this.telephone = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the isEnabled property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link Boolean }
|
||||
*
|
||||
*/
|
||||
public Boolean isIsEnabled() {
|
||||
return isEnabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the isEnabled property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link Boolean }
|
||||
*
|
||||
*/
|
||||
public void setIsEnabled(Boolean value) {
|
||||
this.isEnabled = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the isLocked property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link Boolean }
|
||||
*
|
||||
*/
|
||||
public Boolean isIsLocked() {
|
||||
return isLocked;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the isLocked property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link Boolean }
|
||||
*
|
||||
*/
|
||||
public void setIsLocked(Boolean value) {
|
||||
this.isLocked = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the im property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public String getIM() {
|
||||
return im;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the im property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public void setIM(String value) {
|
||||
this.im = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the nameInSource property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public String getNameInSource() {
|
||||
return nameInSource;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the nameInSource property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public void setNameInSource(String value) {
|
||||
this.nameInSource = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the isAlertEnabled property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link Boolean }
|
||||
*
|
||||
*/
|
||||
public Boolean isIsAlertEnabled() {
|
||||
return isAlertEnabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the isAlertEnabled property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link Boolean }
|
||||
*
|
||||
*/
|
||||
public void setIsAlertEnabled(Boolean value) {
|
||||
this.isAlertEnabled = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the alertEmailPrefix property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public String getAlertEmailPrefix() {
|
||||
return alertEmailPrefix;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the alertEmailPrefix property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public void setAlertEmailPrefix(String value) {
|
||||
this.alertEmailPrefix = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the alertEmail property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public String getAlertEmail() {
|
||||
return alertEmail;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the alertEmail property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public void setAlertEmail(String value) {
|
||||
this.alertEmail = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the isExternal property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link Boolean }
|
||||
*
|
||||
*/
|
||||
public Boolean isIsExternal() {
|
||||
return isExternal;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the isExternal property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link Boolean }
|
||||
*
|
||||
*/
|
||||
public void setIsExternal(Boolean value) {
|
||||
this.isExternal = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the isDefaultCached property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link Boolean }
|
||||
*
|
||||
*/
|
||||
public Boolean isIsDefaultCached() {
|
||||
return isDefaultCached;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the isDefaultCached property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link Boolean }
|
||||
*
|
||||
*/
|
||||
public void setIsDefaultCached(Boolean value) {
|
||||
this.isDefaultCached = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the isGroupRole property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link Boolean }
|
||||
*
|
||||
*/
|
||||
public Boolean isIsGroupRole() {
|
||||
return isGroupRole;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the isGroupRole property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link Boolean }
|
||||
*
|
||||
*/
|
||||
public void setIsGroupRole(Boolean value) {
|
||||
this.isGroupRole = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the storedVmQuota property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link Integer }
|
||||
*
|
||||
*/
|
||||
public Integer getStoredVmQuota() {
|
||||
return storedVmQuota;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the storedVmQuota property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link Integer }
|
||||
*
|
||||
*/
|
||||
public void setStoredVmQuota(Integer value) {
|
||||
this.storedVmQuota = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the deployedVmQuota property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link Integer }
|
||||
*
|
||||
*/
|
||||
public Integer getDeployedVmQuota() {
|
||||
return deployedVmQuota;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the deployedVmQuota property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link Integer }
|
||||
*
|
||||
*/
|
||||
public void setDeployedVmQuota(Integer value) {
|
||||
this.deployedVmQuota = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the role property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link Reference }
|
||||
*
|
||||
*/
|
||||
public Reference getRole() {
|
||||
return role;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the role property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link Reference }
|
||||
*
|
||||
*/
|
||||
public void setRole(Reference value) {
|
||||
this.role = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the password property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the password property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public void setPassword(String value) {
|
||||
this.password = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the groupReferences property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link GroupsList }
|
||||
*
|
||||
*/
|
||||
public GroupsList getGroupReferences() {
|
||||
return groupReferences;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the groupReferences property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link GroupsList }
|
||||
*
|
||||
*/
|
||||
public void setGroupReferences(GroupsList value) {
|
||||
this.groupReferences = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o)
|
||||
return true;
|
||||
if (o == null || getClass() != o.getClass())
|
||||
return false;
|
||||
User that = User.class.cast(o);
|
||||
return equal(fullName, that.fullName) &&
|
||||
equal(emailAddress, that.emailAddress) &&
|
||||
equal(telephone, that.telephone) &&
|
||||
equal(isEnabled, that.isEnabled) &&
|
||||
equal(isLocked, that.isLocked) &&
|
||||
equal(im, that.im) &&
|
||||
equal(nameInSource, that.nameInSource) &&
|
||||
equal(isAlertEnabled, that.isAlertEnabled) &&
|
||||
equal(alertEmailPrefix, that.alertEmailPrefix) &&
|
||||
equal(alertEmail, that.alertEmail) &&
|
||||
equal(isExternal, that.isExternal) &&
|
||||
equal(isDefaultCached, that.isDefaultCached) &&
|
||||
equal(isGroupRole, that.isGroupRole) &&
|
||||
equal(storedVmQuota, that.storedVmQuota) &&
|
||||
equal(deployedVmQuota, that.deployedVmQuota) &&
|
||||
equal(role, that.role) &&
|
||||
equal(password, that.password) &&
|
||||
equal(groupReferences, that.groupReferences);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(fullName,
|
||||
emailAddress,
|
||||
telephone,
|
||||
isEnabled,
|
||||
isLocked,
|
||||
im,
|
||||
nameInSource,
|
||||
isAlertEnabled,
|
||||
alertEmailPrefix,
|
||||
alertEmail,
|
||||
isExternal,
|
||||
isDefaultCached,
|
||||
isGroupRole,
|
||||
storedVmQuota,
|
||||
deployedVmQuota,
|
||||
role,
|
||||
password,
|
||||
groupReferences);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Objects.toStringHelper("")
|
||||
.add("fullName", fullName)
|
||||
.add("emailAddress", emailAddress)
|
||||
.add("telephone", telephone)
|
||||
.add("isEnabled", isEnabled)
|
||||
.add("isLocked", isLocked)
|
||||
.add("im", im)
|
||||
.add("nameInSource", nameInSource)
|
||||
.add("isAlertEnabled", isAlertEnabled)
|
||||
.add("alertEmailPrefix", alertEmailPrefix)
|
||||
.add("alertEmail", alertEmail)
|
||||
.add("isExternal", isExternal)
|
||||
.add("isDefaultCached", isDefaultCached)
|
||||
.add("isGroupRole", isGroupRole)
|
||||
.add("storedVmQuota", storedVmQuota)
|
||||
.add("deployedVmQuota", deployedVmQuota)
|
||||
.add("role", role)
|
||||
.add("password", password)
|
||||
.add("groupReferences", groupReferences).toString();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,238 @@
|
|||
/**
|
||||
* 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.query;
|
||||
|
||||
import static com.google.common.base.Objects.*;
|
||||
import static com.google.common.base.Preconditions.*;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Link;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.ResourceType;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.base.Objects.ToStringHelper;
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
/**
|
||||
* Container for query result sets.
|
||||
*
|
||||
* <pre>
|
||||
* <complexType name="Container" />
|
||||
* </pre>
|
||||
*
|
||||
* @author grkvlt@apache.org
|
||||
*/
|
||||
public class ContainerType<T extends ContainerType<T>> extends ResourceType<T> {
|
||||
|
||||
public static <T extends ContainerType<T>> Builder<T> builder() {
|
||||
return new Builder<T>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Builder<T> toBuilder() {
|
||||
return new Builder<T>().fromContainerType(this);
|
||||
}
|
||||
|
||||
public static class Builder<T extends ContainerType<T>> extends ResourceType.Builder<T> {
|
||||
|
||||
protected String name;
|
||||
protected Integer page;
|
||||
protected Integer pageSize;
|
||||
protected Long total;
|
||||
|
||||
/**
|
||||
* @see Container#getName()
|
||||
*/
|
||||
public Builder<T> name(String name) {
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Container#getPage()
|
||||
*/
|
||||
public Builder<T> page(Integer page) {
|
||||
this.page = page;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Container#getPageSize()
|
||||
*/
|
||||
public Builder<T> pageSize(Integer pageSize) {
|
||||
this.pageSize = pageSize;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Container#getTotal()
|
||||
*/
|
||||
public Builder<T> total(Long total) {
|
||||
this.total = total;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ContainerType<T> build() {
|
||||
ContainerType<T> container = new ContainerType<T>(href);
|
||||
container.setName(name);
|
||||
container.setPage(page);
|
||||
container.setPageSize(pageSize);
|
||||
container.setTotal(total);
|
||||
container.setType(type);
|
||||
container.setLinks(links);
|
||||
return container;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ResourceType#getHref()
|
||||
*/
|
||||
@Override
|
||||
public Builder<T> href(URI href) {
|
||||
super.href(href);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ResourceType#getType()
|
||||
*/
|
||||
@Override
|
||||
public Builder<T> type(String type) {
|
||||
super.type(type);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ResourceType#getLinks()
|
||||
*/
|
||||
@Override
|
||||
public Builder<T> links(Set<Link> links) {
|
||||
super.links(Sets.newLinkedHashSet(checkNotNull(links, "links")));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ResourceType#getLinks()
|
||||
*/
|
||||
@Override
|
||||
public Builder<T> link(Link link) {
|
||||
super.link(link);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Builder<T> fromResourceType(ResourceType<T> in) {
|
||||
return Builder.class.cast(super.fromResourceType(in));
|
||||
}
|
||||
|
||||
public Builder<T> fromContainerType(ContainerType<T> in) {
|
||||
return fromResourceType(in).name(in.getName()).page(in.getPage()).pageSize(in.getPageSize()).total(in.getTotal());
|
||||
}
|
||||
}
|
||||
|
||||
protected ContainerType() {
|
||||
// For JAXB and builder use
|
||||
}
|
||||
|
||||
protected ContainerType(URI href) {
|
||||
super(href);
|
||||
}
|
||||
|
||||
|
||||
@XmlAttribute
|
||||
protected String name;
|
||||
@XmlAttribute
|
||||
protected Integer page;
|
||||
@XmlAttribute
|
||||
protected Integer pageSize;
|
||||
@XmlAttribute
|
||||
protected Long total;
|
||||
|
||||
/**
|
||||
* Query name that generated this result set.
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String value) {
|
||||
this.name = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Page of the result set that this container holds. The first page is page number 1.
|
||||
*/
|
||||
public Integer getPage() {
|
||||
return page;
|
||||
}
|
||||
|
||||
public void setPage(Integer value) {
|
||||
this.page = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Page size, as a number of records or references.
|
||||
*/
|
||||
public Integer getPageSize() {
|
||||
return pageSize;
|
||||
}
|
||||
|
||||
public void setPageSize(Integer value) {
|
||||
this.pageSize = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Total number of records or references in the container.
|
||||
*/
|
||||
public Long getTotal() {
|
||||
return total;
|
||||
}
|
||||
|
||||
public void setTotal(Long value) {
|
||||
this.total = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o)
|
||||
return true;
|
||||
if (o == null || getClass() != o.getClass())
|
||||
return false;
|
||||
ContainerType<T> that = ContainerType.class.cast(o);
|
||||
return super.equals(that) &&
|
||||
equal(this.name, that.name) && equal(this.page, that.page) &&
|
||||
equal(this.pageSize, that.pageSize) && equal(this.total, that.total);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return super.hashCode() + Objects.hashCode(name, page, pageSize, total);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ToStringHelper string() {
|
||||
return super.string().add("name", name).add("page", page).add("pageSize", pageSize).add("total", total);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,406 @@
|
|||
/**
|
||||
* 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.query;
|
||||
|
||||
import static com.google.common.base.Objects.*;
|
||||
import static com.google.common.base.Preconditions.*;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Date;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
import javax.xml.bind.annotation.XmlSchemaType;
|
||||
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Link;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.base.Objects.ToStringHelper;
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
/**
|
||||
* Represents the results from a Catalog vCloud query as a record.
|
||||
*
|
||||
* <pre>
|
||||
* <complexType name="QueryResultCatalogRecord" />
|
||||
* </pre>
|
||||
*
|
||||
* @author grkvlt@apache.org
|
||||
*/
|
||||
public class QueryResultCatalogRecord extends QueryResultRecordType<QueryResultCatalogRecord> {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Builder toBuilder() {
|
||||
return new Builder().fromQueryResultCatalogRecord(this);
|
||||
}
|
||||
|
||||
public static class Builder extends QueryResultRecordType.Builder<QueryResultCatalogRecord> {
|
||||
|
||||
private String name;
|
||||
private Boolean isPublished;
|
||||
private Boolean isShared;
|
||||
private Date creationDate;
|
||||
private String orgName;
|
||||
private String ownerName;
|
||||
private Integer numberOfVAppTemplates;
|
||||
private Integer numberOfMedia;
|
||||
private String owner;
|
||||
|
||||
/**
|
||||
* @see QueryResultCatalogRecord#getName()
|
||||
*/
|
||||
public Builder name(String name) {
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see QueryResultCatalogRecord#getIsPublished()
|
||||
*/
|
||||
public Builder isPublished(Boolean isPublished) {
|
||||
this.isPublished = isPublished;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see QueryResultCatalogRecord#getIsPublished()
|
||||
*/
|
||||
public Builder published() {
|
||||
this.isPublished = Boolean.TRUE;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see QueryResultCatalogRecord#getIsPublished()
|
||||
*/
|
||||
public Builder notPublished() {
|
||||
this.isPublished = Boolean.FALSE;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see QueryResultCatalogRecord#getIsShared()
|
||||
*/
|
||||
public Builder isShared(Boolean isShared) {
|
||||
this.isShared = isShared;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see QueryResultCatalogRecord#getIsShared()
|
||||
*/
|
||||
public Builder shared() {
|
||||
this.isShared = Boolean.TRUE;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see QueryResultCatalogRecord#getIsShared()
|
||||
*/
|
||||
public Builder notShared() {
|
||||
this.isShared = Boolean.FALSE;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see QueryResultCatalogRecord#getCreationDate()
|
||||
*/
|
||||
public Builder creationDate(Date creationDate) {
|
||||
this.creationDate = creationDate;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see QueryResultCatalogRecord#getOrgName()
|
||||
*/
|
||||
public Builder orgName(String orgName) {
|
||||
this.orgName = orgName;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see QueryResultCatalogRecord#getOwnerName()
|
||||
*/
|
||||
public Builder ownerName(String ownerName) {
|
||||
this.ownerName = ownerName;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see QueryResultCatalogRecord#getNumberOfVAppTemplates()
|
||||
*/
|
||||
public Builder numberOfVAppTemplates(Integer numberOfVAppTemplates) {
|
||||
this.numberOfVAppTemplates = numberOfVAppTemplates;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see QueryResultCatalogRecord#getNumberOfMedia()
|
||||
*/
|
||||
public Builder numberOfMedia(Integer numberOfMedia) {
|
||||
this.numberOfMedia = numberOfMedia;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see QueryResultCatalogRecord#getOwner()
|
||||
*/
|
||||
public Builder owner(String owner) {
|
||||
this.owner = owner;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public QueryResultCatalogRecord build() {
|
||||
QueryResultCatalogRecord queryResultCatalogRecord = new QueryResultCatalogRecord(href);
|
||||
queryResultCatalogRecord.setName(name);
|
||||
queryResultCatalogRecord.setIsPublished(isPublished);
|
||||
queryResultCatalogRecord.setIsShared(isShared);
|
||||
queryResultCatalogRecord.setCreationDate(creationDate);
|
||||
queryResultCatalogRecord.setOrgName(orgName);
|
||||
queryResultCatalogRecord.setOwnerName(ownerName);
|
||||
queryResultCatalogRecord.setNumberOfVAppTemplates(numberOfVAppTemplates);
|
||||
queryResultCatalogRecord.setNumberOfMedia(numberOfMedia);
|
||||
queryResultCatalogRecord.setOwner(owner);
|
||||
queryResultCatalogRecord.setId(id);
|
||||
queryResultCatalogRecord.setType(type);
|
||||
queryResultCatalogRecord.setLinks(links);
|
||||
return queryResultCatalogRecord;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see QueryResultRecordType#getHref()
|
||||
*/
|
||||
@Override
|
||||
public Builder href(URI href) {
|
||||
this.href = href;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see QueryResultRecordType#getId()
|
||||
*/
|
||||
@Override
|
||||
public Builder id(String id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see QueryResultRecordType#getType()
|
||||
*/
|
||||
@Override
|
||||
public Builder type(String type) {
|
||||
this.type = type;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see QueryResultRecordType#getLinks()
|
||||
*/
|
||||
@Override
|
||||
public Builder links(Set<Link> links) {
|
||||
this.links = Sets.newLinkedHashSet(checkNotNull(links, "links"));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see QueryResultRecordType#getLinks()
|
||||
*/
|
||||
@Override
|
||||
public Builder link(Link link) {
|
||||
this.links.add(checkNotNull(link, "link"));
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Builder fromQueryResultRecordType(QueryResultRecordType<QueryResultCatalogRecord> in) {
|
||||
return Builder.class.cast(super.fromQueryResultRecordType(in));
|
||||
}
|
||||
|
||||
public Builder fromQueryResultCatalogRecord(QueryResultCatalogRecord in) {
|
||||
return fromQueryResultRecordType(in).name(in.getName()).isPublished(in.isPublished()).isShared(in.isShared()).creationDate(in.getCreationDate()).orgName(in.getOrgName()).ownerName(
|
||||
in.getOwnerName()).numberOfVAppTemplates(in.getNumberOfVAppTemplates()).numberOfMedia(in.getNumberOfMedia()).owner(in.getOwner());
|
||||
}
|
||||
}
|
||||
|
||||
private QueryResultCatalogRecord() {
|
||||
// For JAXB and builder use
|
||||
}
|
||||
|
||||
private QueryResultCatalogRecord(URI href) {
|
||||
super(href);
|
||||
}
|
||||
|
||||
@XmlAttribute
|
||||
protected String name;
|
||||
@XmlAttribute
|
||||
protected Boolean isPublished;
|
||||
@XmlAttribute
|
||||
protected Boolean isShared;
|
||||
@XmlAttribute
|
||||
@XmlSchemaType(name = "dateTime")
|
||||
protected Date creationDate;
|
||||
@XmlAttribute
|
||||
protected String orgName;
|
||||
@XmlAttribute
|
||||
protected String ownerName;
|
||||
@XmlAttribute
|
||||
protected Integer numberOfVAppTemplates;
|
||||
@XmlAttribute
|
||||
protected Integer numberOfMedia;
|
||||
@XmlAttribute
|
||||
protected String owner;
|
||||
|
||||
/**
|
||||
* Gets the value of the name property.
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String value) {
|
||||
this.name = value;
|
||||
}
|
||||
|
||||
public Boolean isPublished() {
|
||||
return isPublished;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the isPublished property.
|
||||
*/
|
||||
public void setIsPublished(Boolean value) {
|
||||
this.isPublished = value;
|
||||
}
|
||||
|
||||
public Boolean isShared() {
|
||||
return isShared;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the isShared property.
|
||||
*/
|
||||
public void setIsShared(Boolean value) {
|
||||
this.isShared = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the creationDate property.
|
||||
*/
|
||||
public Date getCreationDate() {
|
||||
return creationDate;
|
||||
}
|
||||
|
||||
public void setCreationDate(Date value) {
|
||||
this.creationDate = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the orgName property.
|
||||
*/
|
||||
public String getOrgName() {
|
||||
return orgName;
|
||||
}
|
||||
|
||||
public void setOrgName(String value) {
|
||||
this.orgName = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the ownerName property.
|
||||
*/
|
||||
public String getOwnerName() {
|
||||
return ownerName;
|
||||
}
|
||||
|
||||
public void setOwnerName(String value) {
|
||||
this.ownerName = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the numberOfVAppTemplates property.
|
||||
*/
|
||||
public Integer getNumberOfVAppTemplates() {
|
||||
return numberOfVAppTemplates;
|
||||
}
|
||||
|
||||
public void setNumberOfVAppTemplates(Integer value) {
|
||||
this.numberOfVAppTemplates = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the numberOfMedia property.
|
||||
*/
|
||||
public Integer getNumberOfMedia() {
|
||||
return numberOfMedia;
|
||||
}
|
||||
|
||||
public void setNumberOfMedia(Integer value) {
|
||||
this.numberOfMedia = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the owner property.
|
||||
*/
|
||||
public String getOwner() {
|
||||
return owner;
|
||||
}
|
||||
|
||||
public void setOwner(String value) {
|
||||
this.owner = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o)
|
||||
return true;
|
||||
if (o == null || getClass() != o.getClass())
|
||||
return false;
|
||||
QueryResultCatalogRecord that = QueryResultCatalogRecord.class.cast(o);
|
||||
return super.equals(that) &&
|
||||
equal(this.name, that.name) && equal(this.isPublished, that.isPublished) &&
|
||||
equal(this.isShared, that.isShared) && equal(this.creationDate, that.creationDate) &&
|
||||
equal(this.orgName, that.orgName) && equal(this.ownerName, that.ownerName) &&
|
||||
equal(this.numberOfVAppTemplates, that.numberOfVAppTemplates) &&
|
||||
equal(this.numberOfMedia, that.numberOfMedia) && equal(this.owner, that.owner);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return super.hashCode() + Objects.hashCode(name, isPublished, isShared, creationDate,
|
||||
orgName, ownerName, numberOfVAppTemplates, numberOfMedia, owner);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ToStringHelper string() {
|
||||
return super.string()
|
||||
.add("name", name).add("isPublished", isPublished).add("isShared", isShared)
|
||||
.add("creationDate", creationDate).add("orgName", orgName).add("ownerName", ownerName)
|
||||
.add("numberOfVAppTemplates", numberOfVAppTemplates).add("numberOfMedia", numberOfMedia)
|
||||
.add("owner", owner);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,358 @@
|
|||
/**
|
||||
* 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.query;
|
||||
|
||||
import static com.google.common.base.Objects.*;
|
||||
import static com.google.common.base.Preconditions.*;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Link;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.query.QueryResultRecordType.Builder;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.base.Objects.ToStringHelper;
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
/**
|
||||
* Represents the results from a Network vCloud query as a record.
|
||||
*
|
||||
* <pre>
|
||||
* <complexType name="QueryResultNetworkRecord" />
|
||||
* </pre>
|
||||
*
|
||||
* @author grkvlt@apache.org
|
||||
*/
|
||||
public class QueryResultNetworkRecord extends QueryResultRecordType<QueryResultNetworkRecord> {
|
||||
@SuppressWarnings("unchecked")
|
||||
public static Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Builder toBuilder() {
|
||||
return new Builder().fromQueryResultNetworkRecord(this);
|
||||
}
|
||||
|
||||
public static class Builder extends QueryResultRecordType.Builder<QueryResultNetworkRecord> {
|
||||
|
||||
private String name;
|
||||
private String ipScopeId;
|
||||
private String gateway;
|
||||
private String netmask;
|
||||
private String dns1;
|
||||
private String dns2;
|
||||
private String dnsSuffix;
|
||||
private Boolean isBusy;
|
||||
|
||||
/**
|
||||
* @see QueryResultNetworkRecord#getName()
|
||||
*/
|
||||
public Builder name(String name) {
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see QueryResultNetworkRecord#getIpScopeId()
|
||||
*/
|
||||
public Builder ipScopeId(String ipScopeId) {
|
||||
this.ipScopeId = ipScopeId;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see QueryResultNetworkRecord#getGateway()
|
||||
*/
|
||||
public Builder gateway(String gateway) {
|
||||
this.gateway = gateway;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see QueryResultNetworkRecord#getNetmask()
|
||||
*/
|
||||
public Builder netmask(String netmask) {
|
||||
this.netmask = netmask;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see QueryResultNetworkRecord#getDns1()
|
||||
*/
|
||||
public Builder dns1(String dns1) {
|
||||
this.dns1 = dns1;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see QueryResultNetworkRecord#getDns2()
|
||||
*/
|
||||
public Builder dns2(String dns2) {
|
||||
this.dns2 = dns2;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see QueryResultNetworkRecord#getDnsSuffix()
|
||||
*/
|
||||
public Builder dnsSuffix(String dnsSuffix) {
|
||||
this.dnsSuffix = dnsSuffix;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see QueryResultNetworkRecord#isBusy()
|
||||
*/
|
||||
public Builder isBusy(Boolean isBusy) {
|
||||
this.isBusy = isBusy;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see QueryResultNetworkRecord#isBusy()
|
||||
*/
|
||||
public Builder busy() {
|
||||
this.isBusy = Boolean.TRUE;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see QueryResultNetworkRecord#isBusy()
|
||||
*/
|
||||
public Builder notBusy() {
|
||||
this.isBusy = Boolean.FALSE;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public QueryResultNetworkRecord build() {
|
||||
QueryResultNetworkRecord queryResultNetworkRecord = new QueryResultNetworkRecord(href);
|
||||
queryResultNetworkRecord.setName(name);
|
||||
queryResultNetworkRecord.setIpScopeId(ipScopeId);
|
||||
queryResultNetworkRecord.setGateway(gateway);
|
||||
queryResultNetworkRecord.setNetmask(netmask);
|
||||
queryResultNetworkRecord.setDns1(dns1);
|
||||
queryResultNetworkRecord.setDns2(dns2);
|
||||
queryResultNetworkRecord.setDnsSuffix(dnsSuffix);
|
||||
queryResultNetworkRecord.setIsBusy(isBusy);
|
||||
queryResultNetworkRecord.setId(id);
|
||||
queryResultNetworkRecord.setType(type);
|
||||
queryResultNetworkRecord.setLinks(links);
|
||||
return queryResultNetworkRecord;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see QueryResultRecordType#getHref()
|
||||
*/
|
||||
@Override
|
||||
public Builder href(URI href) {
|
||||
this.href = href;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see QueryResultRecordType#getId()
|
||||
*/
|
||||
@Override
|
||||
public Builder id(String id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see QueryResultRecordType#getType()
|
||||
*/
|
||||
@Override
|
||||
public Builder type(String type) {
|
||||
this.type = type;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see QueryResultRecordType#getLinks()
|
||||
*/
|
||||
@Override
|
||||
public Builder links(Set<Link> links) {
|
||||
this.links = Sets.newLinkedHashSet(checkNotNull(links, "links"));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see QueryResultRecordType#getLinks()
|
||||
*/
|
||||
@Override
|
||||
public Builder link(Link link) {
|
||||
this.links.add(checkNotNull(link, "link"));
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Builder fromQueryResultRecordType(QueryResultRecordType<QueryResultNetworkRecord> in) {
|
||||
return Builder.class.cast(super.fromQueryResultRecordType(in));
|
||||
}
|
||||
|
||||
public Builder fromQueryResultNetworkRecord(QueryResultNetworkRecord in) {
|
||||
return fromQueryResultRecordType(in)
|
||||
.name(in.getName()).ipScopeId(in.getIpScopeId()).gateway(in.getGateway())
|
||||
.netmask(in.getNetmask()).dns1(in.getDns1()).dns2(in.getDns2())
|
||||
.dnsSuffix(in.getDnsSuffix()).isBusy(in.isBusy());
|
||||
}
|
||||
}
|
||||
|
||||
private QueryResultNetworkRecord() {
|
||||
// For JAXB and builder use
|
||||
}
|
||||
|
||||
private QueryResultNetworkRecord(URI href) {
|
||||
super(href);
|
||||
}
|
||||
|
||||
@XmlAttribute
|
||||
protected String name;
|
||||
@XmlAttribute
|
||||
protected String ipScopeId;
|
||||
@XmlAttribute
|
||||
protected String gateway;
|
||||
@XmlAttribute
|
||||
protected String netmask;
|
||||
@XmlAttribute
|
||||
protected String dns1;
|
||||
@XmlAttribute
|
||||
protected String dns2;
|
||||
@XmlAttribute
|
||||
protected String dnsSuffix;
|
||||
@XmlAttribute
|
||||
protected Boolean isBusy;
|
||||
|
||||
/**
|
||||
* name.
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String value) {
|
||||
this.name = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* IP scope object of this network.
|
||||
*/
|
||||
public String getIpScopeId() {
|
||||
return ipScopeId;
|
||||
}
|
||||
|
||||
public void setIpScopeId(String value) {
|
||||
this.ipScopeId = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gateway for the network.
|
||||
*/
|
||||
public String getGateway() {
|
||||
return gateway;
|
||||
}
|
||||
|
||||
public void setGateway(String value) {
|
||||
this.gateway = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Netmask for the network.
|
||||
*/
|
||||
public String getNetmask() {
|
||||
return netmask;
|
||||
}
|
||||
|
||||
public void setNetmask(String value) {
|
||||
this.netmask = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Primary DNS for the network.
|
||||
*/
|
||||
public String getDns1() {
|
||||
return dns1;
|
||||
}
|
||||
|
||||
public void setDns1(String value) {
|
||||
this.dns1 = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Secondary DNS for the network.
|
||||
*/
|
||||
public String getDns2() {
|
||||
return dns2;
|
||||
}
|
||||
|
||||
public void setDns2(String value) {
|
||||
this.dns2 = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* DNS suffix for the network.
|
||||
*/
|
||||
public String getDnsSuffix() {
|
||||
return dnsSuffix;
|
||||
}
|
||||
|
||||
public void setDnsSuffix(String value) {
|
||||
this.dnsSuffix = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows whether it is busy.
|
||||
*/
|
||||
public Boolean isBusy() {
|
||||
return isBusy;
|
||||
}
|
||||
|
||||
public void setIsBusy(Boolean value) {
|
||||
this.isBusy = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o)
|
||||
return true;
|
||||
if (o == null || getClass() != o.getClass())
|
||||
return false;
|
||||
QueryResultNetworkRecord that = QueryResultNetworkRecord.class.cast(o);
|
||||
return super.equals(that) && equal(name, that.name) && equal(ipScopeId, that.ipScopeId) && equal(gateway, that.gateway) && equal(netmask, that.netmask) && equal(dns1, that.dns1)
|
||||
&& equal(dns2, that.dns2) && equal(dnsSuffix, that.dnsSuffix) && equal(isBusy, that.isBusy);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(name, ipScopeId, gateway, netmask, dns1, dns2, dnsSuffix, isBusy);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ToStringHelper string() {
|
||||
return string().add("name", name).add("ipScopeId", ipScopeId).add("gateway", gateway).add("netmask", netmask).add("dns1", dns1).add("dns2", dns2).add("dnsSuffix", dnsSuffix).add("isBusy",
|
||||
isBusy);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,238 @@
|
|||
/**
|
||||
* 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.query;
|
||||
|
||||
import static com.google.common.base.Objects.*;
|
||||
import static com.google.common.base.Preconditions.*;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.*;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.HashMap;
|
||||
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.XmlAnyAttribute;
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlSchemaType;
|
||||
import javax.xml.namespace.QName;
|
||||
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Link;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.base.Objects.ToStringHelper;
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
/**
|
||||
* Base type for query result Records. Subtypes define more specific elements.
|
||||
*
|
||||
* <pre>
|
||||
* <complexType name="QueryResultRecordType" />
|
||||
* </pre>
|
||||
*
|
||||
* @author grkvlt@apache.org
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class QueryResultRecordType<T extends QueryResultRecordType<T>> {
|
||||
|
||||
public static <T extends QueryResultRecordType<T>> Builder<T> builder() {
|
||||
return new Builder<T>();
|
||||
}
|
||||
|
||||
public Builder<T> toBuilder() {
|
||||
return new Builder<T>().fromQueryResultRecordType(this);
|
||||
}
|
||||
|
||||
public static class Builder<T extends QueryResultRecordType<T>> {
|
||||
|
||||
protected URI href;
|
||||
protected String id;
|
||||
protected String type;
|
||||
protected Set<Link> links = Sets.newLinkedHashSet();
|
||||
|
||||
/**
|
||||
* @see QueryResultRecordType#getHref()
|
||||
*/
|
||||
public Builder<T> href(URI href) {
|
||||
this.href = href;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see QueryResultRecordType#getId()
|
||||
*/
|
||||
public Builder<T> id(String id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see QueryResultRecordType#getType()
|
||||
*/
|
||||
public Builder<T> type(String type) {
|
||||
this.type = type;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see QueryResultRecordType#getLinks()
|
||||
*/
|
||||
public Builder<T> links(Set<Link> links) {
|
||||
this.links = Sets.newLinkedHashSet(checkNotNull(links, "links"));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see QueryResultRecordType#getLinks()
|
||||
*/
|
||||
public Builder<T> link(Link link) {
|
||||
this.links.add(checkNotNull(link, "link"));
|
||||
return this;
|
||||
}
|
||||
|
||||
public QueryResultRecordType<T> build() {
|
||||
QueryResultRecordType<T> record = new QueryResultRecordType<T>(href);
|
||||
record.setId(id);
|
||||
record.setType(type);
|
||||
record.setLinks(links);
|
||||
return record;
|
||||
}
|
||||
|
||||
public Builder<T> fromQueryResultRecordType(QueryResultRecordType<T> in) {
|
||||
return href(in.getHref()).id(in.getId()).type(in.getType());
|
||||
}
|
||||
}
|
||||
|
||||
@XmlElement(namespace = VCLOUD_1_5_NS, name = "Link")
|
||||
private Set<Link> links = Sets.newLinkedHashSet();
|
||||
@XmlAttribute
|
||||
@XmlSchemaType(name = "anyURI")
|
||||
private URI href;
|
||||
@XmlAttribute
|
||||
private String id;
|
||||
@XmlAttribute
|
||||
private String type;
|
||||
@XmlAnyAttribute
|
||||
// XXX not sure about this
|
||||
private Map<QName, String> otherAttributes = new HashMap<QName, String>();
|
||||
|
||||
public QueryResultRecordType(URI href) {
|
||||
this.href = href;
|
||||
}
|
||||
|
||||
public QueryResultRecordType() {
|
||||
// For JAXB
|
||||
}
|
||||
|
||||
/**
|
||||
* Set of optional links to an entity or operation associated with this object.
|
||||
*/
|
||||
public Set<Link> getLinks() {
|
||||
return links;
|
||||
}
|
||||
|
||||
public void setLinks(Set<Link> links) {
|
||||
this.links = Sets.newLinkedHashSet(checkNotNull(links, "links"));
|
||||
}
|
||||
|
||||
public void addLink(Link link) {
|
||||
this.links.add(checkNotNull(link, "link"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
|
||||
public void setHref(URI href) {
|
||||
this.href = 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 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;
|
||||
}
|
||||
|
||||
// XXX not sure about this
|
||||
|
||||
/**
|
||||
* Gets a map that contains attributes that aren't bound to any typed property on this class.
|
||||
*/
|
||||
public Map<QName, String> getOtherAttributes() {
|
||||
return otherAttributes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o)
|
||||
return true;
|
||||
if (o == null || getClass() != o.getClass())
|
||||
return false;
|
||||
QueryResultRecordType<?> that = QueryResultRecordType.class.cast(o);
|
||||
return equal(this.href, that.href) && equal(this.id, that.id) &&
|
||||
equal(this.type, that.type) && equal(this.links, that.links);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(href, id, type, links);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return string().toString();
|
||||
}
|
||||
|
||||
protected ToStringHelper string() {
|
||||
return Objects.toStringHelper("").add("href", href).add("id", id)
|
||||
.add("type", type).add("links", links);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,212 @@
|
|||
/**
|
||||
* 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.query;
|
||||
|
||||
import static com.google.common.base.Objects.*;
|
||||
import static com.google.common.base.Preconditions.*;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.*;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElementRef;
|
||||
|
||||
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.query.ContainerType.Builder;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.base.Objects.ToStringHelper;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
/**
|
||||
* Represents the results from a vCloud query as records.
|
||||
*
|
||||
* <pre>
|
||||
* <complexType name="QueryResultRecords" />
|
||||
* </pre>
|
||||
*
|
||||
* @author grkvlt@apache.org
|
||||
*/
|
||||
public class QueryResultRecords extends ContainerType<QueryResultRecords> {
|
||||
|
||||
public static final String MEDIA_TYPE = VCloudDirectorMediaType.QUERY_RESULT_RECORDS;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Builder toBuilder() {
|
||||
return new Builder().fromQueryResultRecords(this);
|
||||
}
|
||||
|
||||
public static class Builder extends ContainerType.Builder<QueryResultRecords> {
|
||||
|
||||
private List<QueryResultRecordType<?>> records = Lists.newArrayList();
|
||||
|
||||
/**
|
||||
* @see QueryResultRecords#getRecords()
|
||||
*/
|
||||
public Builder records(List<QueryResultRecordType<?>> records) {
|
||||
this.records = records;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see QueryResultRecords#getRecords()
|
||||
*/
|
||||
public Builder record(QueryResultRecordType<?> record) {
|
||||
this.records.add(record);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public QueryResultRecords build() {
|
||||
QueryResultRecords queryResultRecords = new QueryResultRecords(href);
|
||||
queryResultRecords.setRecords(records);
|
||||
queryResultRecords.setName(name);
|
||||
queryResultRecords.setPage(page);
|
||||
queryResultRecords.setPageSize(pageSize);
|
||||
queryResultRecords.setTotal(total);
|
||||
queryResultRecords.setType(type);
|
||||
queryResultRecords.setLinks(links);
|
||||
return queryResultRecords;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Container#getName()
|
||||
*/
|
||||
@Override
|
||||
public Builder name(String name) {
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Container#getPage()
|
||||
*/
|
||||
@Override
|
||||
public Builder page(Integer page) {
|
||||
this.page = page;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Container#getPageSize()
|
||||
*/
|
||||
@Override
|
||||
public Builder pageSize(Integer pageSize) {
|
||||
this.pageSize = pageSize;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ResourceType#getHref()
|
||||
*/
|
||||
@Override
|
||||
public Builder href(URI href) {
|
||||
super.href(href);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ResourceType#getType()
|
||||
*/
|
||||
@Override
|
||||
public Builder type(String type) {
|
||||
super.type(type);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ResourceType#getLinks()
|
||||
*/
|
||||
@Override
|
||||
public Builder links(Set<Link> links) {
|
||||
super.links(Sets.newLinkedHashSet(checkNotNull(links, "links")));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ResourceType#getLinks()
|
||||
*/
|
||||
@Override
|
||||
public Builder link(Link link) {
|
||||
super.link(link);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Builder fromContainerType(ContainerType<QueryResultRecords> in) {
|
||||
return Builder.class.cast(super.fromContainerType(in));
|
||||
}
|
||||
|
||||
public Builder fromQueryResultRecords(QueryResultRecords in) {
|
||||
return fromContainerType(in).records(in.getRecords());
|
||||
}
|
||||
}
|
||||
|
||||
private QueryResultRecords() {
|
||||
// For JAXB and builder use
|
||||
}
|
||||
|
||||
@XmlElementRef(name = "Record", namespace = VCLOUD_1_5_NS)
|
||||
protected List<QueryResultRecordType<?>> records;
|
||||
|
||||
/**
|
||||
* Set of records representing query results.
|
||||
*/
|
||||
public List<QueryResultRecordType<?>> getRecords() {
|
||||
return records;
|
||||
}
|
||||
|
||||
public void setRecords(List<QueryResultRecordType<?>> links) {
|
||||
this.records = Lists.newArrayList(checkNotNull(links, "links"));
|
||||
}
|
||||
|
||||
public void addRecords(QueryResultRecordType<?> record) {
|
||||
this.records.add(checkNotNull(record, "record"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o)
|
||||
return true;
|
||||
if (o == null || getClass() != o.getClass())
|
||||
return false;
|
||||
QueryResultRecords that = QueryResultRecords.class.cast(o);
|
||||
return super.equals(that) && equal(this.records, that.records);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return super.hashCode() + Objects.hashCode(records);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ToStringHelper string() {
|
||||
return super.string().add("records", records);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,177 @@
|
|||
//
|
||||
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6
|
||||
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
|
||||
// Any modifications to this file will be lost upon recompilation of the source schema.
|
||||
// Generated on: 2012.02.08 at 02:47:44 PM GMT
|
||||
//
|
||||
|
||||
|
||||
package org.jclouds.vcloud.director.v1_5.domain.vapp;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.xml.bind.JAXBElement;
|
||||
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.XmlElementRef;
|
||||
import javax.xml.bind.annotation.XmlSeeAlso;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
import com.vmware.vcloud.api.rest.schema.ovf.AnnotationSectionType;
|
||||
import com.vmware.vcloud.api.rest.schema.ovf.DeploymentOptionSectionType;
|
||||
import com.vmware.vcloud.api.rest.schema.ovf.DiskSectionType;
|
||||
import com.vmware.vcloud.api.rest.schema.ovf.EulaSectionType;
|
||||
import com.vmware.vcloud.api.rest.schema.ovf.InstallSectionType;
|
||||
import com.vmware.vcloud.api.rest.schema.ovf.NetworkSectionType;
|
||||
import com.vmware.vcloud.api.rest.schema.ovf.OperatingSystemSectionType;
|
||||
import com.vmware.vcloud.api.rest.schema.ovf.ProductSectionType;
|
||||
import com.vmware.vcloud.api.rest.schema.ovf.ResourceAllocationSectionType;
|
||||
import com.vmware.vcloud.api.rest.schema.ovf.SectionType;
|
||||
import com.vmware.vcloud.api.rest.schema.ovf.StartupSectionType;
|
||||
import com.vmware.vcloud.api.rest.schema.ovf.VirtualHardwareSectionType;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* Represents a base type for VAppType and VmType.
|
||||
*
|
||||
*
|
||||
* <p>Java class for AbstractVAppType complex type.
|
||||
*
|
||||
* <p>The following schema fragment specifies the expected content contained within this class.
|
||||
*
|
||||
* <pre>
|
||||
* <complexType name="AbstractVAppType">
|
||||
* <complexContent>
|
||||
* <extension base="{http://www.vmware.com/vcloud/v1.5}ResourceEntityType">
|
||||
* <sequence>
|
||||
* <element name="VAppParent" type="{http://www.vmware.com/vcloud/v1.5}ReferenceType" minOccurs="0"/>
|
||||
* <element ref="{http://schemas.dmtf.org/ovf/envelope/1}Section" maxOccurs="unbounded" minOccurs="0"/>
|
||||
* </sequence>
|
||||
* <attribute name="deployed" type="{http://www.w3.org/2001/XMLSchema}boolean" />
|
||||
* <anyAttribute processContents='lax' namespace='##other'/>
|
||||
* </extension>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlType(name = "AbstractVAppType", propOrder = {
|
||||
"vAppParent",
|
||||
"section"
|
||||
})
|
||||
@XmlSeeAlso({
|
||||
VmType.class,
|
||||
VAppType.class
|
||||
})
|
||||
public abstract class AbstractVAppType
|
||||
extends ResourceEntityType
|
||||
{
|
||||
|
||||
@XmlElement(name = "VAppParent")
|
||||
protected ReferenceType vAppParent;
|
||||
@XmlElementRef(name = "Section", namespace = "http://schemas.dmtf.org/ovf/envelope/1", type = JAXBElement.class)
|
||||
protected List<JAXBElement<? extends SectionType>> section;
|
||||
@XmlAttribute
|
||||
protected Boolean deployed;
|
||||
|
||||
/**
|
||||
* Gets the value of the vAppParent property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link ReferenceType }
|
||||
*
|
||||
*/
|
||||
public ReferenceType getVAppParent() {
|
||||
return vAppParent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the vAppParent property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link ReferenceType }
|
||||
*
|
||||
*/
|
||||
public void setVAppParent(ReferenceType value) {
|
||||
this.vAppParent = value;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Specific ovf:Section with additional information for the vApp.
|
||||
* Gets the value of the section property.
|
||||
*
|
||||
* <p>
|
||||
* This accessor method returns a reference to the live list,
|
||||
* not a snapshot. Therefore any modification you make to the
|
||||
* returned list will be present inside the JAXB object.
|
||||
* This is why there is not a <CODE>set</CODE> method for the section property.
|
||||
*
|
||||
* <p>
|
||||
* For example, to add a new item, do as follows:
|
||||
* <pre>
|
||||
* getSection().add(newItem);
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
* <p>
|
||||
* Objects of the following type(s) are allowed in the list
|
||||
* {@link JAXBElement }{@code <}{@link SectionType }{@code >}
|
||||
* {@link JAXBElement }{@code <}{@link VirtualHardwareSectionType }{@code >}
|
||||
* {@link JAXBElement }{@code <}{@link LeaseSettingsSectionType }{@code >}
|
||||
* {@link JAXBElement }{@code <}{@link EulaSectionType }{@code >}
|
||||
* {@link JAXBElement }{@code <}{@link RuntimeInfoSectionType }{@code >}
|
||||
* {@link JAXBElement }{@code <}{@link AnnotationSectionType }{@code >}
|
||||
* {@link JAXBElement }{@code <}{@link DeploymentOptionSectionType }{@code >}
|
||||
* {@link JAXBElement }{@code <}{@link StartupSectionType }{@code >}
|
||||
* {@link JAXBElement }{@code <}{@link ResourceAllocationSectionType }{@code >}
|
||||
* {@link JAXBElement }{@code <}{@link NetworkConnectionSectionType }{@code >}
|
||||
* {@link JAXBElement }{@code <}{@link CustomizationSectionType }{@code >}
|
||||
* {@link JAXBElement }{@code <}{@link ProductSectionType }{@code >}
|
||||
* {@link JAXBElement }{@code <}{@link GuestCustomizationSectionType }{@code >}
|
||||
* {@link JAXBElement }{@code <}{@link OperatingSystemSectionType }{@code >}
|
||||
* {@link JAXBElement }{@code <}{@link NetworkConfigSectionType }{@code >}
|
||||
* {@link JAXBElement }{@code <}{@link NetworkSectionType }{@code >}
|
||||
* {@link JAXBElement }{@code <}{@link DiskSectionType }{@code >}
|
||||
* {@link JAXBElement }{@code <}{@link InstallSectionType }{@code >}
|
||||
*
|
||||
*
|
||||
*/
|
||||
public List<JAXBElement<? extends SectionType>> getSection() {
|
||||
if (section == null) {
|
||||
section = new ArrayList<JAXBElement<? extends SectionType>>();
|
||||
}
|
||||
return this.section;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the deployed property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link Boolean }
|
||||
*
|
||||
*/
|
||||
public Boolean isDeployed() {
|
||||
return deployed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the deployed property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link Boolean }
|
||||
*
|
||||
*/
|
||||
public void setDeployed(Boolean value) {
|
||||
this.deployed = value;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,279 @@
|
|||
/**
|
||||
* 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.vapp;
|
||||
|
||||
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.XmlType;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* Represents a vApp.
|
||||
*
|
||||
*
|
||||
* <p>Java class for VApp complex type.
|
||||
*
|
||||
* <p>The following schema fragment specifies the expected content contained within this class.
|
||||
*
|
||||
* <pre>
|
||||
* <complexType name="VApp">
|
||||
* <complexContent>
|
||||
* <extension base="{http://www.vmware.com/vcloud/v1.5}AbstractVApp">
|
||||
* <sequence>
|
||||
* <element name="Owner" type="{http://www.vmware.com/vcloud/v1.5}OwnerType" minOccurs="0"/>
|
||||
* <element name="InMaintenanceMode" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
|
||||
* <element name="Children" type="{http://www.vmware.com/vcloud/v1.5}VAppChildrenType" minOccurs="0"/>
|
||||
* </sequence>
|
||||
* <attribute name="ovfDescriptorUploaded" type="{http://www.w3.org/2001/XMLSchema}boolean" />
|
||||
* <anyAttribute processContents='lax' namespace='##other'/>
|
||||
* </extension>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlType(name = "VApp", propOrder = {
|
||||
"owner",
|
||||
"inMaintenanceMode",
|
||||
"children"
|
||||
})
|
||||
public class VApp
|
||||
extends AbstractVAppType<VApp>
|
||||
|
||||
{
|
||||
@SuppressWarnings("unchecked")
|
||||
public static Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
public Builder toBuilder() {
|
||||
return new Builder().fromVApp(this);
|
||||
}
|
||||
|
||||
public static class Builder extends AbstractVAppType.Builder<VApp> {
|
||||
|
||||
private Owner owner;
|
||||
private Boolean inMaintenanceMode;
|
||||
private VAppChildren children;
|
||||
private Boolean ovfDescriptorUploaded;
|
||||
|
||||
/**
|
||||
* @see VApp#getOwner()
|
||||
*/
|
||||
public Builder owner(Owner owner) {
|
||||
this.owner = owner;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see VApp#getInMaintenanceMode()
|
||||
*/
|
||||
public Builder inMaintenanceMode(Boolean inMaintenanceMode) {
|
||||
this.inMaintenanceMode = inMaintenanceMode;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see VApp#getChildren()
|
||||
*/
|
||||
public Builder children(VAppChildren children) {
|
||||
this.children = children;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see VApp#getOvfDescriptorUploaded()
|
||||
*/
|
||||
public Builder ovfDescriptorUploaded(Boolean ovfDescriptorUploaded) {
|
||||
this.ovfDescriptorUploaded = ovfDescriptorUploaded;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public VApp build() {
|
||||
VApp vApp = new VApp();
|
||||
vApp.setOwner(owner);
|
||||
vApp.setInMaintenanceMode(inMaintenanceMode);
|
||||
vApp.setChildren(children);
|
||||
vApp.setOvfDescriptorUploaded(ovfDescriptorUploaded);
|
||||
return vApp;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Builder fromAbstractVAppType(AbstractVAppType<VApp> in) {
|
||||
return Builder.class.cast(super.fromAbstractVAppType(in));
|
||||
}
|
||||
public Builder fromVApp(VApp in) {
|
||||
return fromAbstractVAppType(in)
|
||||
.owner(in.getOwner())
|
||||
.inMaintenanceMode(in.getInMaintenanceMode())
|
||||
.children(in.getChildren())
|
||||
.ovfDescriptorUploaded(in.getOvfDescriptorUploaded());
|
||||
}
|
||||
}
|
||||
|
||||
private VApp() {
|
||||
// For JAXB and builder use
|
||||
}
|
||||
|
||||
|
||||
|
||||
@XmlElement(name = "Owner")
|
||||
protected Owner owner;
|
||||
@XmlElement(name = "InMaintenanceMode")
|
||||
protected Boolean inMaintenanceMode;
|
||||
@XmlElement(name = "Children")
|
||||
protected VAppChildren children;
|
||||
@XmlAttribute
|
||||
protected Boolean ovfDescriptorUploaded;
|
||||
|
||||
/**
|
||||
* Gets the value of the owner property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link Owner }
|
||||
*
|
||||
*/
|
||||
public Owner getOwner() {
|
||||
return owner;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the owner property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link Owner }
|
||||
*
|
||||
*/
|
||||
public void setOwner(Owner value) {
|
||||
this.owner = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the inMaintenanceMode property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link Boolean }
|
||||
*
|
||||
*/
|
||||
public Boolean isInMaintenanceMode() {
|
||||
return inMaintenanceMode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the inMaintenanceMode property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link Boolean }
|
||||
*
|
||||
*/
|
||||
public void setInMaintenanceMode(Boolean value) {
|
||||
this.inMaintenanceMode = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the children property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link VAppChildren }
|
||||
*
|
||||
*/
|
||||
public VAppChildren getChildren() {
|
||||
return children;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the children property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link VAppChildren }
|
||||
*
|
||||
*/
|
||||
public void setChildren(VAppChildren value) {
|
||||
this.children = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the ovfDescriptorUploaded property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link Boolean }
|
||||
*
|
||||
*/
|
||||
public Boolean isOvfDescriptorUploaded() {
|
||||
return ovfDescriptorUploaded;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the ovfDescriptorUploaded property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link Boolean }
|
||||
*
|
||||
*/
|
||||
public void setOvfDescriptorUploaded(Boolean value) {
|
||||
this.ovfDescriptorUploaded = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o)
|
||||
return true;
|
||||
if (o == null || getClass() != o.getClass())
|
||||
return false;
|
||||
VApp that = VApp.class.cast(o);
|
||||
return equal(owner, that.owner) &&
|
||||
equal(inMaintenanceMode, that.inMaintenanceMode) &&
|
||||
equal(children, that.children) &&
|
||||
equal(ovfDescriptorUploaded, that.ovfDescriptorUploaded);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(owner,
|
||||
inMaintenanceMode,
|
||||
children,
|
||||
ovfDescriptorUploaded);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Objects.toStringHelper("")
|
||||
.add("owner", owner)
|
||||
.add("inMaintenanceMode", inMaintenanceMode)
|
||||
.add("children", children)
|
||||
.add("ovfDescriptorUploaded", ovfDescriptorUploaded).toString();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,76 @@
|
|||
/**
|
||||
* 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.features;
|
||||
|
||||
import java.net.URI;
|
||||
|
||||
import javax.ws.rs.Consumes;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.POST;
|
||||
import javax.ws.rs.Path;
|
||||
|
||||
import org.jclouds.rest.annotations.EndpointParam;
|
||||
import org.jclouds.rest.annotations.ExceptionParser;
|
||||
import org.jclouds.rest.annotations.JAXBResponseParser;
|
||||
import org.jclouds.rest.annotations.RequestFilters;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.ReferenceType;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Task;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.TasksList;
|
||||
import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationToRequest;
|
||||
import org.jclouds.vcloud.director.v1_5.functions.OrgReferenceToTaskListEndpoint;
|
||||
import org.jclouds.vcloud.director.v1_5.functions.ReferenceToEndpoint;
|
||||
import org.jclouds.vcloud.director.v1_5.functions.ThrowVCloudErrorOn4xx;
|
||||
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
/**
|
||||
* @see TaskClient
|
||||
* @author grkvlt@apache.org
|
||||
*/
|
||||
@RequestFilters(AddVCloudAuthorizationToRequest.class)
|
||||
public interface QueryAsyncClient {
|
||||
|
||||
/**
|
||||
* @see TaskClient#getTaskList(ReferenceType<?>)
|
||||
*/
|
||||
@GET
|
||||
@Consumes
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
||||
ListenableFuture<TasksList> getTaskList(@EndpointParam(parser = OrgReferenceToTaskListEndpoint.class) ReferenceType<?> orgRef);
|
||||
|
||||
/**
|
||||
* @see TaskClient#getTask(URI)
|
||||
*/
|
||||
@GET
|
||||
@Consumes
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
||||
ListenableFuture<Task> getTask(@EndpointParam URI taskUri);
|
||||
|
||||
/**
|
||||
* @see TaskClient#cancelTask(URI)
|
||||
*/
|
||||
@POST
|
||||
@Path("/action/cancel")
|
||||
@Consumes
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
||||
ListenableFuture<Void> cancelTask(@EndpointParam URI taskUri);
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
/**
|
||||
* 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.features;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.jclouds.concurrent.Timeout;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.ReferenceType;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Task;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.TasksList;
|
||||
|
||||
/**
|
||||
* Provides synchronous access to The REST API query interface.
|
||||
*
|
||||
* @see TaskAsyncClient
|
||||
* @author grkvlt@apache.org
|
||||
*/
|
||||
@Timeout(duration = 180, timeUnit = TimeUnit.SECONDS)
|
||||
public interface QueryClient {
|
||||
|
||||
/**
|
||||
* REST API General queries handler.
|
||||
*
|
||||
* <pre>
|
||||
* GET /query/
|
||||
* </pre>
|
||||
*/
|
||||
ContainerType query(String queryParams);
|
||||
|
||||
/**
|
||||
* Retrieves a list of Catalogs by using REST API general QueryHandler.
|
||||
*
|
||||
* If filter is provided it will be applied to the corresponding result set.
|
||||
* Format determines the elements representation - references or records.
|
||||
* Default format is references.
|
||||
*
|
||||
* <pre>
|
||||
* GET /catalogs/query/
|
||||
* </pre>
|
||||
*
|
||||
* @param orgId the unique id for the organization
|
||||
* @return a list of tasks
|
||||
*/
|
||||
ContainerType catalogsQuery(ReferenceType<?> orgRef);
|
||||
}
|
|
@ -33,55 +33,30 @@ import org.testng.annotations.Test;
|
|||
import com.google.common.collect.Iterables;
|
||||
|
||||
/**
|
||||
* Tests live behavior of {@link taskClient}.
|
||||
*
|
||||
* @author grkvlt@apache.task
|
||||
*/
|
||||
@Test(groups = { "live", "apitests" }, testName = "TaskClientLiveTest")
|
||||
* Tests live behavior of {@link CatalogClient}.
|
||||
*
|
||||
* @author grkvlt@apache.org
|
||||
*/
|
||||
@Test(groups = { "live", "apitests" }, testName = "CatalogClientLiveTest")
|
||||
public class CatalogClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
||||
|
||||
/*
|
||||
* Convenience references to API clients.
|
||||
*/
|
||||
|
||||
private final CatalogClient catalogClient = context.getApi().getCatalogClient();
|
||||
private final QueryClient queryClient = context.getApi().getQueryClient();
|
||||
|
||||
/*
|
||||
* Shared state between dependant tests.
|
||||
*/
|
||||
|
||||
private OrgList orgList;
|
||||
private Reference orgRef;
|
||||
private TasksList taskList;
|
||||
private Task task;
|
||||
private URI taskUri;
|
||||
private Reference catalogRef;
|
||||
private Catalog catalog;
|
||||
|
||||
@Test(testName = "GET /tasksList/{id}")
|
||||
@Test(testName = "GET /catalog/{id}")
|
||||
public void testGetTaskList() {
|
||||
orgList = context.getApi().getOrgClient().getOrgList();
|
||||
orgRef = Iterables.getFirst(orgList.getOrgs(), null);
|
||||
|
||||
// Call the method being tested
|
||||
taskList = context.getApi().getTaskClient().getTaskList(orgRef);
|
||||
|
||||
// NOTE The environment MUST have ...
|
||||
|
||||
// Check required elements and attributes
|
||||
assertFalse(Iterables.isEmpty(taskList.getTasks()), "There must always be Task elements in the TaskList");
|
||||
|
||||
for (Task task : taskList.getTasks()) {
|
||||
checkTask(task);
|
||||
}
|
||||
}
|
||||
|
||||
@Test(testName = "GET /task/{id}", dependsOnMethods = { "testGetTaskList" })
|
||||
public void testGetTask() {
|
||||
taskUri = Iterables.getFirst(taskList.getTasks(), null).getHref();
|
||||
|
||||
// Call the method being tested
|
||||
task = context.getApi().getTaskClient().getTask(taskUri);
|
||||
|
||||
// Check required elements and attributes
|
||||
checkTask(task);
|
||||
}
|
||||
|
||||
@Test(testName = "GET /task/{id}/metadata/", dependsOnMethods = { "testGetTask" })
|
||||
public void testCancelTask() {
|
||||
// Call the method being tested
|
||||
context.getApi().getTaskClient().cancelTask(taskUri);
|
||||
catalogRef = null;
|
||||
catalog = catalogClient.getCatalog(catalogRef);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
/*
|
||||
* 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.features;
|
||||
|
||||
import static org.testng.Assert.*;
|
||||
|
||||
import java.net.URI;
|
||||
|
||||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.http.HttpResponse;
|
||||
import org.jclouds.vcloud.director.v1_5.VCloudDirectorClient;
|
||||
import org.jclouds.vcloud.director.v1_5.VCloudDirectorException;
|
||||
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Error;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Reference;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Task;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.TasksList;
|
||||
import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorRestClientExpectTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.ImmutableMultimap;
|
||||
|
||||
/**
|
||||
* Test the {@link TaskClient} by observing its side effects.
|
||||
*
|
||||
* @author grkvlt@apache.org
|
||||
*/
|
||||
@Test(groups = "unit", singleThreaded = true, testName = "QueryClientExpectTest")
|
||||
public class QueryClientExpectTest extends BaseVCloudDirectorRestClientExpectTest {
|
||||
|
||||
@Test
|
||||
public void testQueryCatalogNoParam() {
|
||||
assertTrue(true);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
/*
|
||||
* 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.features;
|
||||
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.*;
|
||||
import static org.jclouds.vcloud.director.v1_5.domain.Checks.*;
|
||||
import static org.testng.Assert.*;
|
||||
|
||||
import java.net.URI;
|
||||
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Metadata;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.MetadataEntry;
|
||||
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.domain.Task;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.TasksList;
|
||||
import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorClientLiveTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.Iterables;
|
||||
|
||||
/**
|
||||
* Tests live behavior of {@link QueryClient}.
|
||||
*
|
||||
* @author grkvlt@apache.org
|
||||
*/
|
||||
@Test(groups = { "live", "apitests" }, testName = "QueryClientLiveTest")
|
||||
public class QueryClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
||||
|
||||
/*
|
||||
* Convenience references to API clients.
|
||||
*/
|
||||
|
||||
private final CatalogClient catalogClient = context.getApi().getCatalogClient();
|
||||
private final QueryClient queryClient = context.getApi().getQueryClient();
|
||||
|
||||
/*
|
||||
* Shared state between dependant tests.
|
||||
*/
|
||||
|
||||
private OrgList orgList;
|
||||
private Reference orgRef;
|
||||
private TasksList taskList;
|
||||
private Task task;
|
||||
private URI taskUri;
|
||||
|
||||
@Test(testName = "GET /catalogs/query/")
|
||||
public void testQueryCatalogNoParam() {
|
||||
assertTrue(true);
|
||||
}
|
||||
}
|
|
@ -62,3 +62,4 @@ public class BaseVCloudDirectorClientLiveTest extends BaseVersionedServiceLiveTe
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<QueryResultRecords xmlns="http://www.vmware.com/vcloud/v1.5" total="3" pageSize="25" page="1" name="catalog" type="application/vnd.vmware.vcloud.query.records+xml" href="https://vcloudbeta.bluelock.com/api/catalogs/query?page=1&pageSize=25&format=records" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/v1.5 http://vcloudbeta.bluelock.com/api/v1.5/schema/master.xsd">
|
||||
<Link rel="alternate" type="application/vnd.vmware.vcloud.query.references+xml" href="https://vcloudbeta.bluelock.com/api/catalogs/query?page=1&pageSize=25&format=references"/>
|
||||
<Link rel="alternate" type="application/vnd.vmware.vcloud.query.idrecords+xml" href="https://vcloudbeta.bluelock.com/api/catalogs/query?page=1&pageSize=25&format=idrecords"/>
|
||||
<CatalogRecord ownerName="qunying.huang@enstratus.com" owner="https://vcloudbeta.bluelock.com/api/admin/user/967d317c-4273-4a95-b8a4-bf63b78e9c69" orgName="JClouds" numberOfVAppTemplates="0" numberOfMedia="0" name="QunyingTestCatalog" isShared="true" isPublished="false" creationDate="2012-02-07T00:16:28.323-05:00" href="https://vcloudbeta.bluelock.com/api/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4"/>
|
||||
<CatalogRecord ownerName="system" owner="https://vcloudbeta.bluelock.com/api/admin/user/0ebf2453-5e95-48ab-b223-02671965ee91" orgName="Bluelock" numberOfVAppTemplates="0" numberOfMedia="0" name="Public" isShared="false" isPublished="true" creationDate="2011-09-28T13:45:44.207-04:00" href="https://vcloudbeta.bluelock.com/api/catalog/9e08c2f6-077a-42ce-bece-d5332e2ebb5c"/>
|
||||
<CatalogRecord ownerName="adk@cloudsoftcorp.com" owner="https://vcloudbeta.bluelock.com/api/admin/user/e9eb1b29-0404-4c5e-8ef7-e584acc51da9" orgName="JClouds" numberOfVAppTemplates="0" numberOfMedia="0" name="test" isShared="true" isPublished="false" creationDate="2012-02-09T12:32:17.723-05:00" href="https://vcloudbeta.bluelock.com/api/catalog/b7289d54-4ca4-497f-9a93-2d4afc97e3da"/>
|
||||
</QueryResultRecords>
|
Loading…
Reference in New Issue