Issue 695: Refactoring2: Introduced Resource for links,actions,name from schema. Removes duplication

This commit is contained in:
Jason King 2011-11-26 10:22:30 +00:00
parent 22a63f7177
commit 8f4a12f359
16 changed files with 343 additions and 222 deletions

View File

@ -18,7 +18,6 @@
*/ */
package org.jclouds.tmrk.enterprisecloud.domain; package org.jclouds.tmrk.enterprisecloud.domain;
import com.google.common.collect.Sets;
import org.jclouds.javax.annotation.Nullable; import org.jclouds.javax.annotation.Nullable;
import org.jclouds.tmrk.enterprisecloud.domain.internal.BaseNamedResource; import org.jclouds.tmrk.enterprisecloud.domain.internal.BaseNamedResource;
import org.jclouds.tmrk.enterprisecloud.domain.internal.BaseResource; import org.jclouds.tmrk.enterprisecloud.domain.internal.BaseResource;
@ -28,7 +27,6 @@ import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlEnumValue; import javax.xml.bind.annotation.XmlEnumValue;
import java.net.URI; import java.net.URI;
import java.util.Map; import java.util.Map;
import java.util.Set;
import static com.google.common.base.CaseFormat.LOWER_CAMEL; import static com.google.common.base.CaseFormat.LOWER_CAMEL;
import static com.google.common.base.CaseFormat.UPPER_UNDERSCORE; import static com.google.common.base.CaseFormat.UPPER_UNDERSCORE;
@ -121,8 +119,8 @@ public class Action extends BaseNamedResource<Action> {
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
public Builder fromResource(BaseResource<Action> in) { public Builder fromBaseResource(BaseResource<Action> in) {
return Builder.class.cast(super.fromResource(in)); return Builder.class.cast(super.fromBaseResource(in));
} }
/** /**
@ -157,22 +155,6 @@ public class Action extends BaseNamedResource<Action> {
return Builder.class.cast(super.type(type)); return Builder.class.cast(super.type(type));
} }
/**
* {@inheritDoc}
*/
@Override
public Builder links(Set<Link> links) {
throw new UnsupportedOperationException("links is not valid for Action");
}
/**
* {@inheritDoc}
*/
@Override
public Builder actions(Set<Action> actions) {
throw new UnsupportedOperationException("actions is not valid for Action");
}
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
@ -190,7 +172,7 @@ public class Action extends BaseNamedResource<Action> {
protected ActionDisabled actionDisabled; protected ActionDisabled actionDisabled;
private Action(URI href, String type, String name, @Nullable ActionDisabled actionDisabled) { private Action(URI href, String type, String name, @Nullable ActionDisabled actionDisabled) {
super(href, type, Sets.<Link>newLinkedHashSet(), Sets.<Action>newLinkedHashSet(), name); super(href, type, name);
this.actionDisabled = actionDisabled; this.actionDisabled = actionDisabled;
} }

View File

@ -136,8 +136,8 @@ public class Link extends BaseNamedResource<Link> {
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
public Builder fromResource(BaseResource<Link> in) { public Builder fromBaseResource(BaseResource<Link> in) {
return Builder.class.cast(super.fromResource(in)); return Builder.class.cast(super.fromBaseResource(in));
} }
/** /**
@ -172,22 +172,6 @@ public class Link extends BaseNamedResource<Link> {
return Builder.class.cast(super.type(type)); return Builder.class.cast(super.type(type));
} }
/**
* {@inheritDoc}
*/
@Override
public Builder links(Set<Link> links) {
throw new UnsupportedOperationException("links is not valid for Link");
}
/**
* {@inheritDoc}
*/
@Override
public Builder actions(Set<Action> actions) {
throw new UnsupportedOperationException("actions is not valid for Link");
}
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
@ -204,7 +188,7 @@ public class Link extends BaseNamedResource<Link> {
protected Relationship rel; protected Relationship rel;
private Link(URI href, String type, String name, Relationship rel) { private Link(URI href, String type, String name, Relationship rel) {
super(href, type, Sets.<Link>newLinkedHashSet(), Sets.<Action>newLinkedHashSet(), name); super(href, type, name);
this.rel = checkNotNull(rel, "rel"); this.rel = checkNotNull(rel, "rel");
} }

View File

@ -52,15 +52,15 @@ public class NamedResource extends BaseNamedResource<NamedResource> {
*/ */
@Override @Override
public NamedResource build() { public NamedResource build() {
return new NamedResource(href, type, links, actions, name); return new NamedResource(href, type, name);
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
public Builder fromResource(BaseResource<NamedResource> in) { public Builder fromBaseResource(BaseResource<NamedResource> in) {
return Builder.class.cast(super.fromResource(in)); return Builder.class.cast(super.fromBaseResource(in));
} }
/** /**
@ -95,22 +95,6 @@ public class NamedResource extends BaseNamedResource<NamedResource> {
return Builder.class.cast(super.type(type)); return Builder.class.cast(super.type(type));
} }
/**
* {@inheritDoc}
*/
@Override
public Builder links(Set<Link> links) {
return Builder.class.cast(super.links(links));
}
/**
* {@inheritDoc}
*/
@Override
public Builder actions(Set<Action> actions) {
return Builder.class.cast(super.actions(actions));
}
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
@ -121,8 +105,8 @@ public class NamedResource extends BaseNamedResource<NamedResource> {
} }
private NamedResource(URI href, String type, Set<Link> links, Set<Action> actions, String name) { private NamedResource(URI href, String type, String name) {
super(href, type, links, actions, name); super(href, type, name);
} }
protected NamedResource() { protected NamedResource() {

View File

@ -18,22 +18,22 @@
*/ */
package org.jclouds.tmrk.enterprisecloud.domain; package org.jclouds.tmrk.enterprisecloud.domain;
import static com.google.common.base.CaseFormat.UPPER_CAMEL;
import static com.google.common.base.CaseFormat.UPPER_UNDERSCORE;
import static com.google.common.base.Preconditions.checkNotNull;
import java.net.URI;
import java.util.Date;
import java.util.Map;
import java.util.Set;
import org.jclouds.javax.annotation.Nullable; import org.jclouds.javax.annotation.Nullable;
import org.jclouds.tmrk.enterprisecloud.domain.internal.BaseResource; import org.jclouds.tmrk.enterprisecloud.domain.internal.BaseResource;
import org.jclouds.tmrk.enterprisecloud.domain.internal.Resource;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlEnum; import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlEnumValue; import javax.xml.bind.annotation.XmlEnumValue;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
import java.net.URI;
import java.util.Date;
import java.util.Map;
import java.util.Set;
import static com.google.common.base.CaseFormat.UPPER_CAMEL;
import static com.google.common.base.CaseFormat.UPPER_UNDERSCORE;
import static com.google.common.base.Preconditions.checkNotNull;
/** /**
* <xs:complexType name="Task"> * <xs:complexType name="Task">
@ -41,7 +41,7 @@ import javax.xml.bind.annotation.XmlRootElement;
* *
*/ */
@XmlRootElement(name = "Task") @XmlRootElement(name = "Task")
public class Task extends BaseResource<Task> { public class Task extends Resource<Task> {
@XmlEnum @XmlEnum
public static enum Status { public static enum Status {
/** /**
@ -110,7 +110,7 @@ public class Task extends BaseResource<Task> {
return new Builder().fromTask(this); return new Builder().fromTask(this);
} }
public static class Builder extends BaseResource.Builder<Task> { public static class Builder extends Resource.Builder<Task> {
//TODO There are additional fields //TODO There are additional fields
protected String operation; protected String operation;
protected Status status; protected Status status;
@ -187,8 +187,8 @@ public class Task extends BaseResource<Task> {
@Override @Override
public Task build() { public Task build() {
return new Task(href, type, links, actions, operation, status, impactedItem, startTime, completedTime, notes, errorMessage, return new Task(href, type, name, links,
initiatedBy); actions, operation, status, impactedItem, startTime, completedTime, notes, errorMessage, initiatedBy);
} }
public Builder fromTask(Task in) { public Builder fromTask(Task in) {
@ -201,7 +201,15 @@ public class Task extends BaseResource<Task> {
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
public Builder fromResource(BaseResource<Task> in) { public Builder fromBaseResource(BaseResource<Task> in) {
return Builder.class.cast(super.fromBaseResource(in));
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromResource(Resource<Task> in) {
return Builder.class.cast(super.fromResource(in)); return Builder.class.cast(super.fromResource(in));
} }
@ -221,6 +229,14 @@ public class Task extends BaseResource<Task> {
return Builder.class.cast(super.href(href)); return Builder.class.cast(super.href(href));
} }
/**
* {@inheritDoc}
*/
@Override
public Builder name(String name) {
return Builder.class.cast(super.name(name));
}
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
@ -271,9 +287,9 @@ public class Task extends BaseResource<Task> {
@XmlElement(name = "InitiatedBy", required = true) @XmlElement(name = "InitiatedBy", required = true)
protected NamedResource initiatedBy; protected NamedResource initiatedBy;
private Task(URI href, String type, Set<Link> links, Set<Action> actions, String operation, Status status, NamedResource impactedItem, Date startTime, private Task(URI href, String type, String name, Set<Link> links, Set<Action> actions, String operation, Status status, NamedResource impactedItem, Date startTime,
@Nullable Date completedTime, @Nullable String notes, @Nullable String errorMessage, NamedResource initiatedBy) { @Nullable Date completedTime, @Nullable String notes, @Nullable String errorMessage, NamedResource initiatedBy) {
super(href, type, links, actions); super(href, type, name, links, actions);
this.operation = checkNotNull(operation, "operation"); this.operation = checkNotNull(operation, "operation");
this.status = checkNotNull(status, "status"); this.status = checkNotNull(status, "status");
this.impactedItem = checkNotNull(impactedItem, "impactedItem"); this.impactedItem = checkNotNull(impactedItem, "impactedItem");

View File

@ -24,6 +24,7 @@ import org.jclouds.javax.annotation.Nullable;
import org.jclouds.tmrk.enterprisecloud.domain.Action; import org.jclouds.tmrk.enterprisecloud.domain.Action;
import org.jclouds.tmrk.enterprisecloud.domain.Link; import org.jclouds.tmrk.enterprisecloud.domain.Link;
import org.jclouds.tmrk.enterprisecloud.domain.internal.BaseResource; import org.jclouds.tmrk.enterprisecloud.domain.internal.BaseResource;
import org.jclouds.tmrk.enterprisecloud.domain.internal.Resource;
import org.jclouds.tmrk.enterprisecloud.domain.internal.ResourceCapacity; import org.jclouds.tmrk.enterprisecloud.domain.internal.ResourceCapacity;
import org.jclouds.tmrk.enterprisecloud.domain.network.Nics; import org.jclouds.tmrk.enterprisecloud.domain.network.Nics;
import org.jclouds.tmrk.enterprisecloud.domain.network.VirtualNic; import org.jclouds.tmrk.enterprisecloud.domain.network.VirtualNic;
@ -42,7 +43,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
* @author Jason King * @author Jason King
*/ */
@XmlRootElement(name = "HardwareConfiguration") @XmlRootElement(name = "HardwareConfiguration")
public class HardwareConfiguration extends BaseResource<HardwareConfiguration> { public class HardwareConfiguration extends Resource<HardwareConfiguration> {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public static Builder builder() { public static Builder builder() {
@ -57,7 +58,7 @@ public class HardwareConfiguration extends BaseResource<HardwareConfiguration> {
return new Builder().fromHardwareConfiguration(this); return new Builder().fromHardwareConfiguration(this);
} }
public static class Builder extends BaseResource.Builder<HardwareConfiguration> { public static class Builder extends Resource.Builder<HardwareConfiguration> {
private int processorCount; private int processorCount;
private ResourceCapacity memory; private ResourceCapacity memory;
@ -106,7 +107,15 @@ public class HardwareConfiguration extends BaseResource<HardwareConfiguration> {
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
public Builder fromResource(BaseResource<HardwareConfiguration> in) { public Builder fromBaseResource(BaseResource<HardwareConfiguration> in) {
return Builder.class.cast(super.fromBaseResource(in));
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromResource(Resource<HardwareConfiguration> in) {
return Builder.class.cast(super.fromResource(in)); return Builder.class.cast(super.fromResource(in));
} }
@ -126,7 +135,15 @@ public class HardwareConfiguration extends BaseResource<HardwareConfiguration> {
return Builder.class.cast(super.href(href)); return Builder.class.cast(super.href(href));
} }
/** /**
* {@inheritDoc}
*/
@Override
public Builder name(String name) {
return Builder.class.cast(super.name(name));
}
/**
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override

View File

@ -18,16 +18,11 @@
*/ */
package org.jclouds.tmrk.enterprisecloud.domain.internal; package org.jclouds.tmrk.enterprisecloud.domain.internal;
import org.jclouds.tmrk.enterprisecloud.domain.Action;
import org.jclouds.tmrk.enterprisecloud.domain.Link;
import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlAttribute;
import static com.google.common.base.Preconditions.checkNotNull;
import java.net.URI; import java.net.URI;
import java.util.Map; import java.util.Map;
import java.util.Set;
import static com.google.common.base.Preconditions.checkNotNull;
/** /**
* Location of a Rest resource * Location of a Rest resource
@ -58,7 +53,7 @@ public class BaseNamedResource<T extends BaseNamedResource<T>> extends BaseResou
} }
public BaseNamedResource<T> build() { public BaseNamedResource<T> build() {
return new BaseNamedResource<T>(href, type, links, actions, name); return new BaseNamedResource<T>(href, type, name);
} }
/** /**
@ -66,12 +61,12 @@ public class BaseNamedResource<T extends BaseNamedResource<T>> extends BaseResou
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Override @Override
public Builder<T> fromResource(BaseResource<T> in) { public Builder<T> fromBaseResource(BaseResource<T> in) {
return Builder.class.cast(super.fromResource(in)); return Builder.class.cast(super.fromBaseResource(in));
} }
public Builder<T> fromNamedResource(BaseNamedResource<T> in) { public Builder<T> fromNamedResource(BaseNamedResource<T> in) {
return fromResource(in).name(in.getName()); return fromBaseResource(in).name(in.getName());
} }
/** /**
@ -86,8 +81,8 @@ public class BaseNamedResource<T extends BaseNamedResource<T>> extends BaseResou
@XmlAttribute @XmlAttribute
protected String name; protected String name;
protected BaseNamedResource(URI href, String type, Set<Link> links, Set<Action> actions, String name) { protected BaseNamedResource(URI href, String type, String name) {
super(href, type, links, actions); super(href, type);
this.name = checkNotNull(name, "name"); this.name = checkNotNull(name, "name");
} }

View File

@ -18,21 +18,11 @@
*/ */
package org.jclouds.tmrk.enterprisecloud.domain.internal; package org.jclouds.tmrk.enterprisecloud.domain.internal;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
import org.jclouds.tmrk.enterprisecloud.domain.Action;
import org.jclouds.tmrk.enterprisecloud.domain.Actions;
import org.jclouds.tmrk.enterprisecloud.domain.Link;
import org.jclouds.tmrk.enterprisecloud.domain.Links;
import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import static com.google.common.base.Preconditions.checkNotNull;
import java.net.URI; import java.net.URI;
import java.util.Map; import java.util.Map;
import java.util.Set;
import static com.google.common.base.Preconditions.checkNotNull;
/** /**
* Location of a Rest resource * Location of a Rest resource
@ -47,15 +37,13 @@ public class BaseResource<T extends BaseResource<T>> {
} }
public Builder<T> toBuilder() { public Builder<T> toBuilder() {
return new Builder<T>().fromResource(this); return new Builder<T>().fromBaseResource(this);
} }
public static class Builder<T extends BaseResource<T>> { public static class Builder<T extends BaseResource<T>> {
protected String type; protected String type;
protected URI href; protected URI href;
protected Set<Link> links = Sets.newLinkedHashSet();
protected Set<Action> actions = Sets.newLinkedHashSet();
/** /**
* @see BaseResource#getType * @see BaseResource#getType
@ -73,31 +61,15 @@ public class BaseResource<T extends BaseResource<T>> {
return this; return this;
} }
/**
* @see BaseResource#getLinks
*/
public Builder links(Set<Link> links) {
this.links = ImmutableSet.<Link> copyOf(checkNotNull(links, "links"));
return this;
}
/**
* @see BaseResource#getActions
*/
public Builder actions(Set<Action> actions) {
this.actions = ImmutableSet.<Action> copyOf(checkNotNull(actions, "actions"));
return this;
}
public BaseResource<T> build() { public BaseResource<T> build() {
return new BaseResource<T>(href, type, links, actions); return new BaseResource<T>(href, type);
} }
public Builder<T> fromResource(BaseResource<T> in) { protected Builder<T> fromBaseResource(BaseResource<T> in) {
return type(in.getType()).href(in.getHref()).links(in.getLinks()).actions(in.getActions()); return type(in.getType()).href(in.getHref());
} }
public Builder<T> fromAttributes(Map<String, String> attributes) { protected Builder<T> fromAttributes(Map<String, String> attributes) {
return href(URI.create(attributes.get("href"))).type(attributes.get("type")); return href(URI.create(attributes.get("href"))).type(attributes.get("type"));
} }
@ -109,17 +81,9 @@ public class BaseResource<T extends BaseResource<T>> {
@XmlAttribute @XmlAttribute
protected URI href; protected URI href;
@XmlElement(name = "Links", required = false) protected BaseResource(URI href, String type) {
protected Links links = Links.builder().build();
@XmlElement(name = "Actions", required = false)
protected Actions actions = Actions.builder().build();
public BaseResource(URI href, String type, Set<Link> links, Set<Action> actions) {
this.type = checkNotNull(type, "type"); this.type = checkNotNull(type, "type");
this.href = checkNotNull(href, "href"); this.href = checkNotNull(href, "href");
this.links = Links.builder().links(checkNotNull(links,"links")).build();
this.actions = Actions.builder().actions(checkNotNull(actions, "actions")).build();
} }
protected BaseResource() { protected BaseResource() {
@ -142,20 +106,6 @@ public class BaseResource<T extends BaseResource<T>> {
return href; return href;
} }
/**
* @return the links related to this object
*/
public Set<Link> getLinks() {
return links.getLinks();
}
/**
* @return the actions available from this object
*/
public Set<Action> getActions() {
return actions.getActions();
}
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) return true; if (this == o) return true;
@ -163,12 +113,8 @@ public class BaseResource<T extends BaseResource<T>> {
BaseResource that = (BaseResource) o; BaseResource that = (BaseResource) o;
if (actions != null ? !actions.equals(that.actions) : that.actions != null)
return false;
if (href != null ? !href.equals(that.href) : that.href != null) if (href != null ? !href.equals(that.href) : that.href != null)
return false; return false;
if (links != null ? !links.equals(that.links) : that.links != null)
return false;
if (type != null ? !type.equals(that.type) : that.type != null) if (type != null ? !type.equals(that.type) : that.type != null)
return false; return false;
@ -179,8 +125,6 @@ public class BaseResource<T extends BaseResource<T>> {
public int hashCode() { public int hashCode() {
int result = type != null ? type.hashCode() : 0; int result = type != null ? type.hashCode() : 0;
result = 31 * result + (href != null ? href.hashCode() : 0); result = 31 * result + (href != null ? href.hashCode() : 0);
result = 31 * result + (links != null ? links.hashCode() : 0);
result = 31 * result + (actions != null ? actions.hashCode() : 0);
return result; return result;
} }
@ -190,6 +134,6 @@ public class BaseResource<T extends BaseResource<T>> {
} }
protected String string() { protected String string() {
return "href="+href+", type="+type+", links="+links+", actions="+actions; return "href="+href+", type="+type;
} }
} }

View File

@ -0,0 +1,173 @@
/**
* 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.tmrk.enterprisecloud.domain.internal;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.tmrk.enterprisecloud.domain.Action;
import org.jclouds.tmrk.enterprisecloud.domain.Actions;
import org.jclouds.tmrk.enterprisecloud.domain.Link;
import org.jclouds.tmrk.enterprisecloud.domain.Links;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import java.net.URI;
import java.util.Collections;
import java.util.Map;
import java.util.Set;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* Base Resource class.
* has Links and Actions and name (plus href and type are inherited)
* <xs:complexType name="Resource">
* @author Jason King
*
*/
public class Resource<T extends Resource<T>> extends BaseResource<T> {
public static <T extends Resource<T>> Builder<T> builder() {
return new Builder<T>();
}
public Builder<T> toBuilder() {
return new Builder<T>().fromResource(this);
}
public static class Builder<T extends Resource<T>> extends BaseResource.Builder<T> {
protected Set<Link> links = Sets.newLinkedHashSet();
protected Set<Action> actions = Sets.newLinkedHashSet();
protected String name;
/**
* @see Resource#getLinks
*/
public Builder<T> links(Set<Link> links) {
this.links = ImmutableSet.<Link> copyOf(checkNotNull(links, "links"));
return this;
}
/**
* @see Resource#getActions
*/
public Builder<T> actions(Set<Action> actions) {
this.actions = ImmutableSet.<Action> copyOf(checkNotNull(actions, "actions"));
return this;
}
/**
* @see Resource#getActions
*/
public Builder<T> name(String name) {
this.name = checkNotNull(name, "name");
return this;
}
public Resource<T> build() {
return new Resource<T>(href, type, name, links, actions);
}
/**
* {@inheritDoc}
*/
public Builder<T> fromBaseResource(BaseResource<T> in) {
return Builder.class.cast(super.fromBaseResource(in));
}
public Builder<T> fromResource(Resource<T> in) {
return fromBaseResource(in).links(in.getLinks())
.actions(in.getActions()).name(in.getName());
}
/**
* {@inheritDoc}
*/
@SuppressWarnings("unchecked")
public Builder<T> fromAttributes(Map<String, String> attributes) {
return Builder.class.cast(super.fromAttributes(attributes));
}
}
@XmlElement(name = "Links", required = false)
protected Links links = Links.builder().build();
@XmlElement(name = "Actions", required = false)
protected Actions actions = Actions.builder().build();
@XmlAttribute(required = false)
protected String name;
protected Resource(URI href, String type, @Nullable String name, Set<Link> links, Set<Action> actions) {
super(href, type);
this.name = name;
this.links = Links.builder().links(checkNotNull(links,"links")).build();
this.actions = Actions.builder().actions(checkNotNull(actions, "actions")).build();
}
protected Resource() {
//For JAXB
}
public Set<Link> getLinks() {
return Collections.unmodifiableSet(links.getLinks());
}
public Set<Action> getActions() {
return Collections.unmodifiableSet(actions.getActions());
}
public String getName() {
return name;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (!super.equals(o)) return false;
Resource resource = (Resource) o;
if (actions != null ? !actions.equals(resource.actions) : resource.actions != null)
return false;
if (links != null ? !links.equals(resource.links) : resource.links != null)
return false;
if (name != null ? !name.equals(resource.name) : resource.name != null)
return false;
return true;
}
@Override
public int hashCode() {
int result = super.hashCode();
result = 31 * result + (links != null ? links.hashCode() : 0);
result = 31 * result + (actions != null ? actions.hashCode() : 0);
result = 31 * result + (name != null ? name.hashCode() : 0);
return result;
}
@Override
public String string() {
return super.string()+", name="+name+", links="+links+", actions="+actions;
}
}

View File

@ -21,7 +21,7 @@ package org.jclouds.tmrk.enterprisecloud.domain.network;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
import org.jclouds.tmrk.enterprisecloud.domain.Actions; import org.jclouds.tmrk.enterprisecloud.domain.Actions;
import org.jclouds.tmrk.enterprisecloud.domain.Link; import org.jclouds.tmrk.enterprisecloud.domain.Link;
import org.jclouds.tmrk.enterprisecloud.domain.internal.BaseResource; import org.jclouds.tmrk.enterprisecloud.domain.internal.Resource;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
@ -34,13 +34,13 @@ import static com.google.common.base.Preconditions.checkNotNull;
* @author Jason King * @author Jason King
*/ */
@XmlRootElement(name="AssignedIpAddresses") @XmlRootElement(name="AssignedIpAddresses")
public class AssignedIpAddresses extends BaseResource<AssignedIpAddresses> { public class AssignedIpAddresses extends Resource<AssignedIpAddresses> {
@XmlElement(name = "Networks", required = true) @XmlElement(name = "Networks", required = true)
private DeviceNetworks networks = new DeviceNetworks(); private DeviceNetworks networks = new DeviceNetworks();
public AssignedIpAddresses(URI href, String type, Actions actions, DeviceNetworks networks) { public AssignedIpAddresses(URI href, String type, String name, Actions actions, DeviceNetworks networks) {
super(href, type, Sets.<Link>newIdentityHashSet(), actions.getActions()); super(href, type, name, Sets.<Link>newIdentityHashSet(), actions.getActions());
checkNotNull(networks,"networks"); checkNotNull(networks,"networks");
} }

View File

@ -18,7 +18,7 @@
*/ */
package org.jclouds.tmrk.enterprisecloud.domain.network; package org.jclouds.tmrk.enterprisecloud.domain.network;
import org.jclouds.tmrk.enterprisecloud.domain.internal.BaseNamedResource; import org.jclouds.tmrk.enterprisecloud.domain.internal.Resource;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
@ -27,7 +27,9 @@ import javax.xml.bind.annotation.XmlElement;
* <xs:complexType name="DeviceNetwork"> * <xs:complexType name="DeviceNetwork">
* @author Jason King * @author Jason King
*/ */
public class DeviceNetwork extends BaseNamedResource<DeviceNetwork> { public class DeviceNetwork extends Resource<DeviceNetwork> {
//TODO: Builder
@XmlElement(name = "IpAddresses") @XmlElement(name = "IpAddresses")
private DeviceIps ipAddresses = new DeviceIps(); private DeviceIps ipAddresses = new DeviceIps();

View File

@ -86,7 +86,7 @@ public class NetworkReference extends BaseNamedResource<NetworkReference> {
@Override @Override
public NetworkReference build() { public NetworkReference build() {
return new NetworkReference(href, type, links, actions, name, networkType); return new NetworkReference(href, type, name, networkType);
} }
public Builder fromNetworkReference(NetworkReference in) { public Builder fromNetworkReference(NetworkReference in) {
@ -97,8 +97,8 @@ public class NetworkReference extends BaseNamedResource<NetworkReference> {
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
public Builder fromResource(BaseResource<NetworkReference> in) { public Builder fromBaseResource(BaseResource<NetworkReference> in) {
return Builder.class.cast(super.fromResource(in)); return Builder.class.cast(super.fromBaseResource(in));
} }
/** /**
@ -140,29 +140,13 @@ public class NetworkReference extends BaseNamedResource<NetworkReference> {
public Builder fromAttributes(Map<String, String> attributes) { public Builder fromAttributes(Map<String, String> attributes) {
return Builder.class.cast(super.fromAttributes(attributes)); return Builder.class.cast(super.fromAttributes(attributes));
} }
/**
* {@inheritDoc}
*/
@Override
public Builder links(Set<Link> links) {
return Builder.class.cast(super.links(links));
}
/**
* {@inheritDoc}
*/
@Override
public Builder actions(Set<Action> actions) {
return Builder.class.cast(super.actions(actions));
}
} }
@XmlElement(name = "NetworkType") @XmlElement(name = "NetworkType")
private NetworkType networkType; private NetworkType networkType;
private NetworkReference(URI href, String type, Set<Link> links, Set<Action> actions, String name,@Nullable NetworkType networkType) { private NetworkReference(URI href, String type, String name,@Nullable NetworkType networkType) {
super(href, type, links, actions, name); super(href, type, name);
this.networkType = networkType; this.networkType = networkType;
} }

View File

@ -20,8 +20,8 @@ package org.jclouds.tmrk.enterprisecloud.domain.software;
import org.jclouds.tmrk.enterprisecloud.domain.Action; import org.jclouds.tmrk.enterprisecloud.domain.Action;
import org.jclouds.tmrk.enterprisecloud.domain.Link; import org.jclouds.tmrk.enterprisecloud.domain.Link;
import org.jclouds.tmrk.enterprisecloud.domain.internal.BaseNamedResource;
import org.jclouds.tmrk.enterprisecloud.domain.internal.BaseResource; import org.jclouds.tmrk.enterprisecloud.domain.internal.BaseResource;
import org.jclouds.tmrk.enterprisecloud.domain.internal.Resource;
import java.net.URI; import java.net.URI;
import java.util.Map; import java.util.Map;
@ -32,7 +32,7 @@ import java.util.Set;
* @author Jason King * @author Jason King
* *
*/ */
public class OperatingSystem extends BaseNamedResource<OperatingSystem> { public class OperatingSystem extends Resource<OperatingSystem> {
//TODO There are other fields //TODO There are other fields
@ -46,10 +46,10 @@ public class OperatingSystem extends BaseNamedResource<OperatingSystem> {
*/ */
@Override @Override
public Builder toBuilder() { public Builder toBuilder() {
return new Builder().fromNamedResource(this); return new Builder().fromOperatingSystem(this);
} }
public static class Builder extends BaseNamedResource.Builder<OperatingSystem> { public static class Builder extends Resource.Builder<OperatingSystem> {
/** /**
* {@inheritDoc} * {@inheritDoc}
@ -63,7 +63,7 @@ public class OperatingSystem extends BaseNamedResource<OperatingSystem> {
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
public Builder fromResource(BaseResource<OperatingSystem> in) { public Builder fromResource(Resource<OperatingSystem> in) {
return Builder.class.cast(super.fromResource(in)); return Builder.class.cast(super.fromResource(in));
} }
@ -71,8 +71,12 @@ public class OperatingSystem extends BaseNamedResource<OperatingSystem> {
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
public Builder fromNamedResource(BaseNamedResource<OperatingSystem> in) { public Builder fromBaseResource(BaseResource<OperatingSystem> in) {
return Builder.class.cast(super.fromNamedResource(in)); return Builder.class.cast(super.fromBaseResource(in));
}
public Builder fromOperatingSystem(OperatingSystem in) {
return fromResource(in);
} }
/** /**
@ -126,7 +130,7 @@ public class OperatingSystem extends BaseNamedResource<OperatingSystem> {
} }
private OperatingSystem(URI href, String type, Set<Link> links, Set<Action> actions, String name) { private OperatingSystem(URI href, String type, Set<Link> links, Set<Action> actions, String name) {
super(href, type, links, actions, name); super(href, type, name, links, actions);
} }
private OperatingSystem() { private OperatingSystem() {

View File

@ -20,8 +20,8 @@ package org.jclouds.tmrk.enterprisecloud.domain.template;
import org.jclouds.javax.annotation.Nullable; import org.jclouds.javax.annotation.Nullable;
import org.jclouds.tmrk.enterprisecloud.domain.*; import org.jclouds.tmrk.enterprisecloud.domain.*;
import org.jclouds.tmrk.enterprisecloud.domain.internal.BaseNamedResource;
import org.jclouds.tmrk.enterprisecloud.domain.internal.BaseResource; import org.jclouds.tmrk.enterprisecloud.domain.internal.BaseResource;
import org.jclouds.tmrk.enterprisecloud.domain.internal.Resource;
import org.jclouds.tmrk.enterprisecloud.domain.software.OperatingSystem; import org.jclouds.tmrk.enterprisecloud.domain.software.OperatingSystem;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
@ -36,7 +36,7 @@ import java.util.Set;
* *
*/ */
@XmlRootElement(name = "Template") @XmlRootElement(name = "Template")
public class Template extends BaseNamedResource<Template> { public class Template extends Resource<Template> {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public static Builder builder() { public static Builder builder() {
@ -51,7 +51,7 @@ public class Template extends BaseNamedResource<Template> {
return new Builder().fromTask(this); return new Builder().fromTask(this);
} }
public static class Builder extends BaseNamedResource.Builder<Template> { public static class Builder extends Resource.Builder<Template> {
//TODO There are additional fields //TODO There are additional fields
protected OperatingSystem operatingSystem; protected OperatingSystem operatingSystem;
protected String description; protected String description;
@ -125,14 +125,25 @@ public class Template extends BaseNamedResource<Template> {
} }
public Builder fromTask(Template in) { public Builder fromTask(Template in) {
return fromResource(in).description(in.getDescription()); return fromResource(in).description(in.getDescription())
.operatingSystem(in.getOperatingSystem()).processor(in.getProcessor())
.memory(in.getMemory()).storage(in.getStorage()).networkAdapters(in.getNetworkAdapters())
.customization(in.getCustomization());
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
public Builder fromResource(BaseResource<Template> in) { public Builder fromBaseResource(BaseResource<Template> in) {
return Builder.class.cast(super.fromBaseResource(in));
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromResource(Resource<Template> in) {
return Builder.class.cast(super.fromResource(in)); return Builder.class.cast(super.fromResource(in));
} }
@ -213,7 +224,7 @@ public class Template extends BaseNamedResource<Template> {
private Template(URI href, String type, Set<Link> links, Set<Action> actions, String name, @Nullable OperatingSystem operatingSystem, @Nullable String description, private Template(URI href, String type, Set<Link> links, Set<Action> actions, String name, @Nullable OperatingSystem operatingSystem, @Nullable String description,
@Nullable ConfigurationOptionRange processor, @Nullable ResourceCapacityRange memory, @Nullable ConfigurationOptionRange processor, @Nullable ResourceCapacityRange memory,
@Nullable TemplateStorage storage, @Nullable int networkAdapters, @Nullable CustomizationOption customization) { @Nullable TemplateStorage storage, @Nullable int networkAdapters, @Nullable CustomizationOption customization) {
super(href, type, links, actions, name); super(href, type, name, links, actions);
this.operatingSystem = operatingSystem; this.operatingSystem = operatingSystem;
this.description = description; this.description = description;
this.processor = processor; this.processor = processor;

View File

@ -22,6 +22,7 @@ import com.google.common.collect.Sets;
import org.jclouds.tmrk.enterprisecloud.domain.Action; import org.jclouds.tmrk.enterprisecloud.domain.Action;
import org.jclouds.tmrk.enterprisecloud.domain.Link; import org.jclouds.tmrk.enterprisecloud.domain.Link;
import org.jclouds.tmrk.enterprisecloud.domain.internal.BaseResource; import org.jclouds.tmrk.enterprisecloud.domain.internal.BaseResource;
import org.jclouds.tmrk.enterprisecloud.domain.internal.Resource;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
@ -39,8 +40,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
* *
*/ */
@XmlRootElement(name = "Templates") @XmlRootElement(name = "Templates")
public class Templates extends BaseResource<Templates> { public class Templates extends Resource<Templates> {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public static Builder builder() { public static Builder builder() {
@ -55,7 +55,7 @@ public class Templates extends BaseResource<Templates> {
return new Builder().fromTemplates(this); return new Builder().fromTemplates(this);
} }
public static class Builder extends BaseResource.Builder<Templates> { public static class Builder extends Resource.Builder<Templates> {
private Set<TemplateFamily> families = Sets.newLinkedHashSet(); private Set<TemplateFamily> families = Sets.newLinkedHashSet();
/** /**
@ -68,7 +68,7 @@ public class Templates extends BaseResource<Templates> {
@Override @Override
public Templates build() { public Templates build() {
return new Templates(href, type, links, actions, families); return new Templates(href, type, name, links, actions, families);
} }
public Builder fromTemplates(Templates in) { public Builder fromTemplates(Templates in) {
@ -79,7 +79,15 @@ public class Templates extends BaseResource<Templates> {
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
public Builder fromResource(BaseResource<Templates> in) { public Builder fromBaseResource(BaseResource<Templates> in) {
return Builder.class.cast(super.fromBaseResource(in));
}
/**
* {@inheritDoc}
*/
@Override
public Builder fromResource(Resource<Templates> in) {
return Builder.class.cast(super.fromResource(in)); return Builder.class.cast(super.fromResource(in));
} }
@ -99,6 +107,14 @@ public class Templates extends BaseResource<Templates> {
return Builder.class.cast(super.href(href)); return Builder.class.cast(super.href(href));
} }
/**
* {@inheritDoc}
*/
@Override
public Builder name(String name) {
return Builder.class.cast(super.name(name));
}
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
@ -128,8 +144,8 @@ public class Templates extends BaseResource<Templates> {
@XmlElement(name = "Families", required = false) @XmlElement(name = "Families", required = false)
private TemplateFamilies families; private TemplateFamilies families;
private Templates(URI href, String type, Set<Link> links, Set<Action> actions, Set<TemplateFamily> families) { private Templates(URI href, String type, String name, Set<Link> links, Set<Action> actions, Set<TemplateFamily> families) {
super(href, type, links, actions); super(href, type, name, links, actions);
this.families = TemplateFamilies.builder().families(families).build(); this.families = TemplateFamilies.builder().families(families).build();
} }

View File

@ -21,8 +21,8 @@ package org.jclouds.tmrk.enterprisecloud.domain.vm;
import org.jclouds.javax.annotation.Nullable; import org.jclouds.javax.annotation.Nullable;
import org.jclouds.tmrk.enterprisecloud.domain.*; import org.jclouds.tmrk.enterprisecloud.domain.*;
import org.jclouds.tmrk.enterprisecloud.domain.hardware.HardwareConfiguration; import org.jclouds.tmrk.enterprisecloud.domain.hardware.HardwareConfiguration;
import org.jclouds.tmrk.enterprisecloud.domain.internal.BaseNamedResource;
import org.jclouds.tmrk.enterprisecloud.domain.internal.BaseResource; import org.jclouds.tmrk.enterprisecloud.domain.internal.BaseResource;
import org.jclouds.tmrk.enterprisecloud.domain.internal.Resource;
import org.jclouds.tmrk.enterprisecloud.domain.software.OperatingSystem; import org.jclouds.tmrk.enterprisecloud.domain.software.OperatingSystem;
import org.jclouds.tmrk.enterprisecloud.domain.software.ToolsStatus; import org.jclouds.tmrk.enterprisecloud.domain.software.ToolsStatus;
@ -45,7 +45,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
* *
*/ */
@XmlRootElement(name = "VirtualMachine") @XmlRootElement(name = "VirtualMachine")
public class VirtualMachine extends BaseNamedResource<VirtualMachine> { public class VirtualMachine extends Resource<VirtualMachine> {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public static Builder builder() { public static Builder builder() {
@ -60,7 +60,7 @@ public class VirtualMachine extends BaseNamedResource<VirtualMachine> {
return new Builder().fromVirtualMachine(this); return new Builder().fromVirtualMachine(this);
} }
public static class Builder extends BaseNamedResource.Builder<VirtualMachine> { public static class Builder extends Resource.Builder<VirtualMachine> {
//TODO There are some more fields //TODO There are some more fields
private Tasks tasks = Tasks.builder().build(); private Tasks tasks = Tasks.builder().build();
private String description; private String description;
@ -179,7 +179,7 @@ public class VirtualMachine extends BaseNamedResource<VirtualMachine> {
} }
public Builder fromVirtualMachine(VirtualMachine in) { public Builder fromVirtualMachine(VirtualMachine in) {
return fromNamedResource(in) return fromResource(in)
.tasks(in.getTasks()) .tasks(in.getTasks())
.description(in.getDescription()) .description(in.getDescription())
.layout(in.getLayout()) .layout(in.getLayout())
@ -197,16 +197,16 @@ public class VirtualMachine extends BaseNamedResource<VirtualMachine> {
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
public Builder fromResource(BaseResource<VirtualMachine> in) { public Builder fromBaseResource(BaseResource<VirtualMachine> in) {
return Builder.class.cast(super.fromResource(in)); return Builder.class.cast(super.fromBaseResource(in));
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
public Builder fromNamedResource(BaseNamedResource<VirtualMachine> in) { public Builder fromResource(Resource<VirtualMachine> in) {
return Builder.class.cast(super.fromNamedResource(in)); return Builder.class.cast(super.fromResource(in));
} }
/** /**
@ -298,7 +298,7 @@ public class VirtualMachine extends BaseNamedResource<VirtualMachine> {
private VirtualMachine(URI href, String type, String name, Tasks tasks, Set<Action> actions, Set<Link> links, String description, @Nullable Layout layout, private VirtualMachine(URI href, String type, String name, Tasks tasks, Set<Action> actions, Set<Link> links, String description, @Nullable Layout layout,
VirtualMachineStatus status, boolean poweredOn, @Nullable ToolsStatus toolsStatus, @Nullable VirtualMachineMediaStatus mediaStatus, boolean customizationPending, VirtualMachineStatus status, boolean poweredOn, @Nullable ToolsStatus toolsStatus, @Nullable VirtualMachineMediaStatus mediaStatus, boolean customizationPending,
@Nullable OperatingSystem operatingSystem, @Nullable HardwareConfiguration hardwareConfiguration, @Nullable VirtualMachineIpAddresses ipAddresses) { @Nullable OperatingSystem operatingSystem, @Nullable HardwareConfiguration hardwareConfiguration, @Nullable VirtualMachineIpAddresses ipAddresses) {
super(href, type, links, actions, name); super(href, type, name, links, actions);
this.description = checkNotNull(description, "description"); this.description = checkNotNull(description, "description");
this.tasks = checkNotNull(tasks, "tasks"); this.tasks = checkNotNull(tasks, "tasks");
this.status = checkNotNull(status, "status"); this.status = checkNotNull(status, "status");

View File

@ -22,6 +22,7 @@ import org.jclouds.javax.annotation.Nullable;
import org.jclouds.tmrk.enterprisecloud.domain.*; import org.jclouds.tmrk.enterprisecloud.domain.*;
import org.jclouds.tmrk.enterprisecloud.domain.hardware.DiskConfigurationOption; import org.jclouds.tmrk.enterprisecloud.domain.hardware.DiskConfigurationOption;
import org.jclouds.tmrk.enterprisecloud.domain.internal.BaseResource; import org.jclouds.tmrk.enterprisecloud.domain.internal.BaseResource;
import org.jclouds.tmrk.enterprisecloud.domain.internal.Resource;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
@ -35,7 +36,7 @@ import java.util.Set;
* *
*/ */
@XmlRootElement(name = "VirtualMachineConfigurationOptions") @XmlRootElement(name = "VirtualMachineConfigurationOptions")
public class VirtualMachineConfigurationOptions extends BaseResource<VirtualMachineConfigurationOptions> { public class VirtualMachineConfigurationOptions extends Resource<VirtualMachineConfigurationOptions> {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public static Builder builder() { public static Builder builder() {
@ -50,7 +51,7 @@ public class VirtualMachineConfigurationOptions extends BaseResource<VirtualMach
return new Builder().fromVirtualMachineConfigurationOptions(this); return new Builder().fromVirtualMachineConfigurationOptions(this);
} }
public static class Builder extends BaseResource.Builder<VirtualMachineConfigurationOptions> { public static class Builder extends Resource.Builder<VirtualMachineConfigurationOptions> {
protected ConfigurationOptionRange processor; protected ConfigurationOptionRange processor;
protected ResourceCapacityRange memory; protected ResourceCapacityRange memory;
@ -101,7 +102,7 @@ public class VirtualMachineConfigurationOptions extends BaseResource<VirtualMach
@Override @Override
public VirtualMachineConfigurationOptions build() { public VirtualMachineConfigurationOptions build() {
return new VirtualMachineConfigurationOptions(href, type, links, actions, processor, memory, disk, networkAdapter, customization); return new VirtualMachineConfigurationOptions(href, type, name, links, actions, processor, memory, disk, networkAdapter, customization);
} }
public Builder fromVirtualMachineConfigurationOptions(VirtualMachineConfigurationOptions in) { public Builder fromVirtualMachineConfigurationOptions(VirtualMachineConfigurationOptions in) {
@ -116,10 +117,18 @@ public class VirtualMachineConfigurationOptions extends BaseResource<VirtualMach
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
public Builder fromResource(BaseResource<VirtualMachineConfigurationOptions> in) { public Builder fromResource(Resource<VirtualMachineConfigurationOptions> in) {
return Builder.class.cast(super.fromResource(in)); return Builder.class.cast(super.fromResource(in));
} }
/**
* {@inheritDoc}
*/
@Override
public Builder fromBaseResource(BaseResource<VirtualMachineConfigurationOptions> in) {
return Builder.class.cast(super.fromBaseResource(in));
}
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
@ -176,9 +185,9 @@ public class VirtualMachineConfigurationOptions extends BaseResource<VirtualMach
@XmlElement(name = "Customization", required = false) @XmlElement(name = "Customization", required = false)
private CustomizationOption customization; private CustomizationOption customization;
private VirtualMachineConfigurationOptions(URI href, String type, Set<Link> links, Set<Action> actions, @Nullable ConfigurationOptionRange processor, @Nullable ResourceCapacityRange memory, private VirtualMachineConfigurationOptions(URI href, String type, String name, Set<Link> links, Set<Action> actions, @Nullable ConfigurationOptionRange processor, @Nullable ResourceCapacityRange memory,
@Nullable DiskConfigurationOption disk, @Nullable ConfigurationOptionRange networkAdapter, @Nullable CustomizationOption customization) { @Nullable DiskConfigurationOption disk, @Nullable ConfigurationOptionRange networkAdapter, @Nullable CustomizationOption customization) {
super(href, type, links, actions); super(href, type, name, links, actions);
this.processor = processor; this.processor = processor;
this.memory = memory; this.memory = memory;
this.disk = disk; this.disk = disk;