diff --git a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/Address.java b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/Address.java index 7faa0b49e7..fb6b3000aa 100644 --- a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/Address.java +++ b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/Address.java @@ -75,9 +75,15 @@ public class Address { return addr(from.getAddr()).version(from.getVersion()); } } - - protected final String addr; - protected final int version; + + protected Address() { + // we want serializers like Gson to work w/o using sun.misc.Unsafe, + // prohibited in GAE. This also implies fields are not final. + // see http://code.google.com/p/jclouds/issues/detail?id=925 + } + + protected String addr; + protected int version; public Address(String addr, int version) { this.addr = addr; diff --git a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/Extension.java b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/Extension.java index 6291c495c7..25d2a922d0 100644 --- a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/Extension.java +++ b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/Extension.java @@ -105,11 +105,17 @@ public class Extension extends Resource { return this; } } - - private final URI namespace; - private final String alias; - private final Date updated; - private final String description; + + protected Extension() { + // we want serializers like Gson to work w/o using sun.misc.Unsafe, + // prohibited in GAE. This also implies fields are not final. + // see http://code.google.com/p/jclouds/issues/detail?id=925 + } + + private URI namespace; + private String alias; + private Date updated; + private String description; protected Extension(Builder builder) { super(builder); diff --git a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/Flavor.java b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/Flavor.java index 6462539625..9aa94c14cc 100644 --- a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/Flavor.java +++ b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/Flavor.java @@ -122,15 +122,21 @@ public class Flavor extends Resource { return this; } } - + + protected Flavor() { + // we want serializers like Gson to work w/o using sun.misc.Unsafe, + // prohibited in GAE. This also implies fields are not final. + // see http://code.google.com/p/jclouds/issues/detail?id=925 + } + private int ram; private int disk; private int vcpus; - private final Optional swap; + private Optional swap = Optional.absent(); @SerializedName("rxtx_factor") - private final Optional rxtxFactor; + private Optional rxtxFactor = Optional.absent(); @SerializedName("OS-FLV-EXT-DATA:ephemeral") - private final Optional ephemeral; + private Optional ephemeral = Optional.absent(); protected Flavor(Builder builder) { super(builder); @@ -142,12 +148,6 @@ public class Flavor extends Resource { this.ephemeral = Optional.fromNullable(builder.ephemeral); } - protected Flavor() { - this.swap = Optional.absent(); - this.rxtxFactor = Optional.absent(); - this.ephemeral = Optional.absent(); - } - public int getRam() { return this.ram; } diff --git a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/FloatingIP.java b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/FloatingIP.java index fad8643619..c69bd6cf5c 100644 --- a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/FloatingIP.java +++ b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/FloatingIP.java @@ -76,7 +76,13 @@ public class FloatingIP implements Comparable { } } - + + protected FloatingIP() { + // we want serializers like Gson to work w/o using sun.misc.Unsafe, + // prohibited in GAE. This also implies fields are not final. + // see http://code.google.com/p/jclouds/issues/detail?id=925 + } + private String id; private String ip; @SerializedName("fixed_ip") diff --git a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/Host.java b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/Host.java index 2a4fedbf7b..6ed99745b2 100644 --- a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/Host.java +++ b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/Host.java @@ -72,10 +72,16 @@ public class Host { return this; } } - + + protected Host() { + // we want serializers like Gson to work w/o using sun.misc.Unsafe, + // prohibited in GAE. This also implies fields are not final. + // see http://code.google.com/p/jclouds/issues/detail?id=925 + } + @SerializedName(value="host_name") - private final String name; - private final String service; + private String name; + private String service; protected Host(Builder builder) { this.name = builder.name; diff --git a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/HostAggregate.java b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/HostAggregate.java index 6017843fe3..b3e018ce52 100644 --- a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/HostAggregate.java +++ b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/HostAggregate.java @@ -154,19 +154,25 @@ public class HostAggregate { return this; } } - - private final String id; - private final String name; + + protected HostAggregate() { + // we want serializers like Gson to work w/o using sun.misc.Unsafe, + // prohibited in GAE. This also implies fields are not final. + // see http://code.google.com/p/jclouds/issues/detail?id=925 + } + + private String id; + private String name; @SerializedName(value = "availability_zone") - private final String availabilityZone; - private final Set hosts; + private String availabilityZone; + private Set hosts = ImmutableSet.of(); @SerializedName(value = "operational_state") - private final String state; + private String state; @SerializedName(value = "created_at") - private final Date created; + private Date created; @SerializedName(value = "updated_at") - private final Optional updated; - private final Map metadata; + private Optional updated = Optional.absent(); + private Map metadata = ImmutableMap.of(); protected HostAggregate(Builder builder) { this.id = checkNotNull(builder.id, "id"); @@ -179,18 +185,6 @@ public class HostAggregate { this.metadata = ImmutableMap.copyOf(checkNotNull(builder.metadata, "metadata")); } - // Ensure GSON parsed objects don't have null collections or optionals - protected HostAggregate() { - this.id = null; - this.name = null; - this.availabilityZone = null; - this.hosts = ImmutableSet.of(); - this.state = null; - this.created = null; - this.updated = Optional.absent(); - this.metadata = ImmutableMap.of(); - } - public String getId() { return this.id; } diff --git a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/HostResourceUsage.java b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/HostResourceUsage.java index e8dbbd1301..649549fe54 100644 --- a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/HostResourceUsage.java +++ b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/HostResourceUsage.java @@ -95,14 +95,20 @@ public class HostResourceUsage { return this; } } - - private final String host; - private final String project; + + protected HostResourceUsage() { + // we want serializers like Gson to work w/o using sun.misc.Unsafe, + // prohibited in GAE. This also implies fields are not final. + // see http://code.google.com/p/jclouds/issues/detail?id=925 + } + + private String host; + private String project; @SerializedName(value="memory_mb") - private final int memoryMb; - private final int cpu; + private int memoryMb; + private int cpu; @SerializedName(value="disk_gb") - private final int diskGb; + private int diskGb; protected HostResourceUsage(Builder builder) { this.host = checkNotNull(builder.host, "host"); diff --git a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/Image.java b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/Image.java index 28196bf454..dc374b8b57 100644 --- a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/Image.java +++ b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/Image.java @@ -191,19 +191,25 @@ public class Image extends Resource { return this; } } - - private final Date updated; - private final Date created; + + protected Image() { + // we want serializers like Gson to work w/o using sun.misc.Unsafe, + // prohibited in GAE. This also implies fields are not final. + // see http://code.google.com/p/jclouds/issues/detail?id=925 + } + + private Date updated; + private Date created; @SerializedName("tenant_id") - private final String tenantId; + private String tenantId; @SerializedName("user_id") - private final String userId; - private final Status status; - private final int progress; - private final int minDisk; - private final int minRam; - private final Resource server; - private final Map metadata; + private String userId; + private Status status; + private int progress; + private int minDisk; + private int minRam; + private Resource server; + private Map metadata = ImmutableMap.of(); protected Image(Builder builder) { super(builder); diff --git a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/Ingress.java b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/Ingress.java index 1f76d0e817..1163124a1d 100644 --- a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/Ingress.java +++ b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/Ingress.java @@ -73,13 +73,19 @@ public class Ingress { return new Ingress(ipProtocol, fromPort, toPort); } } - + + protected Ingress() { + // we want serializers like Gson to work w/o using sun.misc.Unsafe, + // prohibited in GAE. This also implies fields are not final. + // see http://code.google.com/p/jclouds/issues/detail?id=925 + } + @SerializedName(value = "ip_protocol") - protected final IpProtocol ipProtocol; + protected IpProtocol ipProtocol; @SerializedName(value = "from_port") - protected final int fromPort; + protected int fromPort; @SerializedName(value = "to_port") - protected final int toPort; + protected int toPort; protected Ingress(IpProtocol ipProtocol, int fromPort, int toPort) { this.fromPort = fromPort; diff --git a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/KeyPair.java b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/KeyPair.java index 46fa9afc0f..b979b205ce 100644 --- a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/KeyPair.java +++ b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/KeyPair.java @@ -76,15 +76,21 @@ public class KeyPair implements Comparable { } } - + + protected KeyPair() { + // we want serializers like Gson to work w/o using sun.misc.Unsafe, + // prohibited in GAE. This also implies fields are not final. + // see http://code.google.com/p/jclouds/issues/detail?id=925 + } + @SerializedName("public_key") - String publicKey; + private String publicKey; @SerializedName("private_key") - String privateKey; + private String privateKey; @SerializedName("user_id") - String userId; - String name; - String fingerprint; + private String userId; + private String name; + private String fingerprint; protected KeyPair(String publicKey, String privateKey, @Nullable String userId, String name, String fingerprint) { this.publicKey = publicKey; diff --git a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/Quotas.java b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/Quotas.java index cb44d57cca..9228f4d896 100644 --- a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/Quotas.java +++ b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/Quotas.java @@ -187,28 +187,34 @@ public class Quotas { return this; } } - + + protected Quotas() { + // we want serializers like Gson to work w/o using sun.misc.Unsafe, + // prohibited in GAE. This also implies fields are not final. + // see http://code.google.com/p/jclouds/issues/detail?id=925 + } + @SerializedName("id") - private final String id; + private String id; @SerializedName("metadata_items") - private final int metadataItems; + private int metadataItems; @SerializedName("injected_file_content_bytes") - private final int injectedFileContentBytes; - private final int volumes; - private final int gigabytes; - private final int ram; + private int injectedFileContentBytes; + private int volumes; + private int gigabytes; + private int ram; @SerializedName("floating_ips") - private final int floatingIps; - private final int instances; + private int floatingIps; + private int instances; @SerializedName("injected_files") - private final int injectedFiles; - private final int cores; + private int injectedFiles; + private int cores; @SerializedName("security_groups") - private final int securityGroups; + private int securityGroups; @SerializedName("security_group_rules") - private final int securityGroupRules; + private int securityGroupRules; @SerializedName("key_pairs") - private final int keyPairs; + private int keyPairs; protected Quotas(Builder builder) { this.id = checkNotNull(builder.id, "id"); diff --git a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/SecurityGroup.java b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/SecurityGroup.java index 1b1665bc4b..f1b635501b 100644 --- a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/SecurityGroup.java +++ b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/SecurityGroup.java @@ -102,13 +102,19 @@ public class SecurityGroup { } } - - protected final String id; + + protected SecurityGroup() { + // we want serializers like Gson to work w/o using sun.misc.Unsafe, + // prohibited in GAE. This also implies fields are not final. + // see http://code.google.com/p/jclouds/issues/detail?id=925 + } + + protected String id; @SerializedName("tenant_id") - protected final String tenantId; - protected final String name; - protected final String description; - protected final Set rules; + protected String tenantId; + protected String name; + protected String description; + protected Set rules = ImmutableSet.of(); protected SecurityGroup(String id, String tenantId, @Nullable String name, @Nullable String description, Set rules) { diff --git a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/SecurityGroupRule.java b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/SecurityGroupRule.java index a312a01f4c..d1895fc79d 100644 --- a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/SecurityGroupRule.java +++ b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/SecurityGroupRule.java @@ -95,13 +95,19 @@ public class SecurityGroupRule extends Ingress { } } - - protected final String id; - - protected final TenantIdAndName group; - + + protected SecurityGroupRule() { + // we want serializers like Gson to work w/o using sun.misc.Unsafe, + // prohibited in GAE. This also implies fields are not final. + // see http://code.google.com/p/jclouds/issues/detail?id=925 + } + + protected String id; + protected TenantIdAndName group; @SerializedName(value = "parent_group_id") - protected final String parentGroupId; + protected String parentGroupId; + @SerializedName(value = "ip_range") + protected Cidr ipRange; // type to get around unnecessary structure private static class Cidr extends ForwardingObject { @@ -117,8 +123,6 @@ public class SecurityGroupRule extends Ingress { } } - @SerializedName(value = "ip_range") - protected final Cidr ipRange; protected SecurityGroupRule(IpProtocol ipProtocol, int fromPort, int toPort, String id, String parentGroupId, @Nullable TenantIdAndName group, @Nullable String ipRange) { diff --git a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/Server.java b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/Server.java index 9594e0619d..0cf4b8a6a2 100644 --- a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/Server.java +++ b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/Server.java @@ -34,7 +34,6 @@ import com.google.common.base.Objects.ToStringHelper; import com.google.common.base.Optional; import com.google.common.base.Predicates; import com.google.common.base.Strings; -import com.google.common.base.Objects.ToStringHelper; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMultimap; import com.google.common.collect.Maps; @@ -302,38 +301,41 @@ public class Server extends Resource { } } - private final String uuid; + protected Server() { + // we want serializers like Gson to work w/o using sun.misc.Unsafe, + // prohibited in GAE. This also implies fields are not final. + // see http://code.google.com/p/jclouds/issues/detail?id=925 + } + + private String uuid; @SerializedName("tenant_id") - private final String tenantId; + private String tenantId; @SerializedName("user_id") - private final String userId; - private final Date updated; - private final Date created; - private final String hostId; - private final String accessIPv4; - private final String accessIPv6; - private final Status status; - private final Resource image; - private final Resource flavor; + private String userId; + private Date updated; + private Date created; + private String hostId; + private String accessIPv4; + private String accessIPv6; + private Status status; + private Resource image; + private Resource flavor; @SerializedName("key_name") - private final String keyName; + private String keyName; @SerializedName("config_drive") - private final String configDrive; + private String configDrive; // TODO: get gson multimap adapter! - private final Map> addresses; - private final Map metadata; - + private Map> addresses = ImmutableMap.of(); + private Map metadata = ImmutableMap.of(); // Extended status extension // @Prefixed("OS-EXT-STS:") - private final Optional extendedStatus; - + private Optional extendedStatus = Optional.absent(); // Extended server attributes extension // @Prefixed("OS-EXT-SRV-ATTR:") - private final Optional extendedAttributes; - + private Optional extendedAttributes = Optional.absent(); // Disk Config extension @SerializedName("OS-DCF:diskConfig") - private final Optional diskConfig; + private Optional diskConfig = Optional.absent(); protected Server(Builder builder) { super(builder); @@ -357,28 +359,6 @@ public class Server extends Resource { this.diskConfig = builder.diskConfig == null ? Optional.absent() : Optional.of(builder.diskConfig); } - protected Server() { - // for GSON - this.uuid = null; - this.tenantId = null; - this.userId = null; - this.updated = null; - this.created = null; - this.hostId = null; - this.accessIPv4 = null; - this.accessIPv6 = null; - this.status = null; - this.configDrive = null; - this.image = null; - this.flavor = null; - this.metadata = ImmutableMap.of(); - this.addresses = ImmutableMap.of(); - this.keyName = null; - this.extendedStatus = Optional.absent(); - this.extendedAttributes = Optional.absent(); - this.diskConfig = Optional.absent(); - } - /** * only present until the id is in uuid form * diff --git a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/ServerCreated.java b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/ServerCreated.java index 607b2f3ae4..6ca7505385 100644 --- a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/ServerCreated.java +++ b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/ServerCreated.java @@ -18,7 +18,6 @@ */ package org.jclouds.openstack.nova.v1_1.domain; -import org.jclouds.javax.annotation.Nullable; import org.jclouds.openstack.domain.Resource; import com.google.common.base.Objects.ToStringHelper; @@ -68,17 +67,19 @@ public class ServerCreated extends Resource { } } - private final String adminPass; + protected ServerCreated() { + // we want serializers like Gson to work w/o using sun.misc.Unsafe, + // prohibited in GAE. This also implies fields are not final. + // see http://code.google.com/p/jclouds/issues/detail?id=925 + } + + private String adminPass; protected ServerCreated(Builder builder) { super(builder); this.adminPass = builder.adminPass; } - protected ServerCreated() { - this.adminPass =null; - } - /** * @return the administrative password for this server. Note: this is not available in Server responses. */ diff --git a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/ServerExtendedAttributes.java b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/ServerExtendedAttributes.java index 9dcd471e8b..bf43cfeac0 100644 --- a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/ServerExtendedAttributes.java +++ b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/ServerExtendedAttributes.java @@ -93,12 +93,18 @@ public class ServerExtendedAttributes { } } + protected ServerExtendedAttributes() { + // we want serializers like Gson to work w/o using sun.misc.Unsafe, + // prohibited in GAE. This also implies fields are not final. + // see http://code.google.com/p/jclouds/issues/detail?id=925 + } + @SerializedName(value=PREFIX + "instance_name") - private final String instanceName; + private String instanceName; @SerializedName(value=PREFIX + "host") - private final String hostName; + private String hostName; @SerializedName(value=PREFIX + "hypervisor_hostname") - private final String hypervisorHostName; + private String hypervisorHostName; protected ServerExtendedAttributes(Builder builder) { this.instanceName = builder.instanceName; diff --git a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/ServerExtendedStatus.java b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/ServerExtendedStatus.java index 02908d4a66..1d64089d42 100644 --- a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/ServerExtendedStatus.java +++ b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/ServerExtendedStatus.java @@ -94,25 +94,25 @@ public class ServerExtendedStatus { return this; } } - + + protected ServerExtendedStatus() { + // we want serializers like Gson to work w/o using sun.misc.Unsafe, + // prohibited in GAE. This also implies fields are not final. + // see http://code.google.com/p/jclouds/issues/detail?id=925 + } + @SerializedName(value=PREFIX + "task_state") - private final String taskState; + private String taskState; @SerializedName(value=PREFIX + "vm_state") - private final String vmState; + private String vmState; @SerializedName(value=PREFIX + "power_state") - private final int powerState; + private int powerState = Integer.MIN_VALUE; protected ServerExtendedStatus(Builder builder) { this.taskState = builder.taskState; this.vmState = builder.vmState; this.powerState = builder.powerState; } - - protected ServerExtendedStatus() { - this.taskState = null; - this.vmState = null; - this.powerState = Integer.MIN_VALUE; - } @Nullable public String getTaskState() { diff --git a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/ServerWithSecurityGroups.java b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/ServerWithSecurityGroups.java index bfe1d3ca83..fb294a4cfd 100644 --- a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/ServerWithSecurityGroups.java +++ b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/ServerWithSecurityGroups.java @@ -73,9 +73,15 @@ public class ServerWithSecurityGroups extends Server { return this; } } - + + protected ServerWithSecurityGroups() { + // we want serializers like Gson to work w/o using sun.misc.Unsafe, + // prohibited in GAE. This also implies fields are not final. + // see http://code.google.com/p/jclouds/issues/detail?id=925 + } + @SerializedName(value="security_groups") - private final Set securityGroupNames; + private Set securityGroupNames = ImmutableSet.of(); protected ServerWithSecurityGroups(Builder builder) { super(builder); diff --git a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/SimpleServerUsage.java b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/SimpleServerUsage.java index c199924b61..1fd7232fec 100644 --- a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/SimpleServerUsage.java +++ b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/SimpleServerUsage.java @@ -159,27 +159,33 @@ public class SimpleServerUsage { return this; } } - + + protected SimpleServerUsage() { + // we want serializers like Gson to work w/o using sun.misc.Unsafe, + // prohibited in GAE. This also implies fields are not final. + // see http://code.google.com/p/jclouds/issues/detail?id=925 + } + @SerializedName("name") - private final String instanceName; - private final double hours; + private String instanceName; + private double hours; @SerializedName("memory_mb") - private final double flavorMemoryMb; + private double flavorMemoryMb; @SerializedName("local_gb") - private final double flavorLocalGb; + private double flavorLocalGb; @SerializedName("vcpus") - private final double flavorVcpus; + private double flavorVcpus; @SerializedName("tenant_id") - private final String tenantId; + private String tenantId; @SerializedName("flavor") - private final String flavorName; + private String flavorName; @SerializedName("started_at") - private final Date instanceCreated; + private Date instanceCreated; @SerializedName("ended_at") - private final Date instanceTerminiated; + private Date instanceTerminiated; @SerializedName("state") - private final Status instanceStatus; - private final long uptime; + private Status instanceStatus; + private long uptime; private SimpleServerUsage(Builder builder) { this.instanceName = checkNotNull(builder.instanceName, "instanceName"); diff --git a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/SimpleTenantUsage.java b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/SimpleTenantUsage.java index b4b20ddd2e..882177ae5d 100644 --- a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/SimpleTenantUsage.java +++ b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/SimpleTenantUsage.java @@ -123,21 +123,27 @@ public class SimpleTenantUsage { return this; } } - + + protected SimpleTenantUsage() { + // we want serializers like Gson to work w/o using sun.misc.Unsafe, + // prohibited in GAE. This also implies fields are not final. + // see http://code.google.com/p/jclouds/issues/detail?id=925 + } + @SerializedName("tenant_id") - private final String tenantId; + private String tenantId; @SerializedName("total_local_gb_usage") - private final double totalLocalGbUsage; + private double totalLocalGbUsage; @SerializedName("total_vcpus_usage") - private final double totalVcpusUsage; + private double totalVcpusUsage; @SerializedName("total_memory_mb_usage") - private final double totalMemoryMbUsage; + private double totalMemoryMbUsage; @SerializedName("total_hours") - private final double totalHours; - private final Date start; - private final Date stop; + private double totalHours; + private Date start; + private Date stop; @SerializedName("server_usages") - private final Set serverUsages; + private Set serverUsages = ImmutableSet.of(); private SimpleTenantUsage(Builder builder) { this.tenantId = builder.tenantId; diff --git a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/TenantIdAndName.java b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/TenantIdAndName.java index d203dfd34f..f2019269df 100644 --- a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/TenantIdAndName.java +++ b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/TenantIdAndName.java @@ -31,9 +31,15 @@ import com.google.gson.annotations.SerializedName; */ public class TenantIdAndName { + protected TenantIdAndName() { + // we want serializers like Gson to work w/o using sun.misc.Unsafe, + // prohibited in GAE. This also implies fields are not final. + // see http://code.google.com/p/jclouds/issues/detail?id=925 + } + @SerializedName("tenant_id") - protected final String tenantId; - protected final String name; + protected String tenantId; + protected String name; public TenantIdAndName(String tenantId, String name) { this.tenantId = checkNotNull(tenantId, "tenantId"); diff --git a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/VirtualInterface.java b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/VirtualInterface.java index b35dbea7af..d333611ff4 100644 --- a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/VirtualInterface.java +++ b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/VirtualInterface.java @@ -82,9 +82,15 @@ public class VirtualInterface { } } - private final String id; + protected VirtualInterface() { + // we want serializers like Gson to work w/o using sun.misc.Unsafe, + // prohibited in GAE. This also implies fields are not final. + // see http://code.google.com/p/jclouds/issues/detail?id=925 + } + + private String id; @SerializedName(value="mac_address") - private final String macAddress; + private String macAddress; protected VirtualInterface(Builder builder) { this.id = checkNotNull(builder.id, "id"); diff --git a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/Volume.java b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/Volume.java index ad581a650c..5f299fb401 100644 --- a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/Volume.java +++ b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/Volume.java @@ -177,21 +177,27 @@ public class Volume { } } - private final String id; - private final Status status; - private final int size; + protected Volume() { + // we want serializers like Gson to work w/o using sun.misc.Unsafe, + // prohibited in GAE. This also implies fields are not final. + // see http://code.google.com/p/jclouds/issues/detail?id=925 + } + + private String id; + private Status status; + private int size; @SerializedName(value="availabilityZone") - private final String zone; + private String zone; @SerializedName(value="createdAt") - private final Date created; - private final Set attachments; - private final String volumeType; - private final String snapshotId; + private Date created; + private Set attachments = ImmutableSet.of(); + private String volumeType; + private String snapshotId; @SerializedName(value="displayName") - private final String name; + private String name; @SerializedName(value="displayDescription") - private final String description; - private final Map metadata; + private String description; + private Map metadata = ImmutableMap.of(); protected Volume(Builder builder) { this.id = builder.id; diff --git a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/VolumeAttachment.java b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/VolumeAttachment.java index bc33a0ba63..12b48c338d 100644 --- a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/VolumeAttachment.java +++ b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/VolumeAttachment.java @@ -92,10 +92,16 @@ public class VolumeAttachment { } } - private final String id; - private final String volumeId; - private final String serverId; - private final String device; + protected VolumeAttachment() { + // we want serializers like Gson to work w/o using sun.misc.Unsafe, + // prohibited in GAE. This also implies fields are not final. + // see http://code.google.com/p/jclouds/issues/detail?id=925 + } + + private String id; + private String volumeId; + private String serverId; + private String device; protected VolumeAttachment(Builder builder) { this.id = checkNotNull(builder.id, "id"); diff --git a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/VolumeSnapshot.java b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/VolumeSnapshot.java index d79d3d3231..8f0754da7d 100644 --- a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/VolumeSnapshot.java +++ b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/VolumeSnapshot.java @@ -119,16 +119,22 @@ public class VolumeSnapshot { } } - private final String id; - private final String volumeId; - private final Volume.Status status; - private final int size; + protected VolumeSnapshot() { + // we want serializers like Gson to work w/o using sun.misc.Unsafe, + // prohibited in GAE. This also implies fields are not final. + // see http://code.google.com/p/jclouds/issues/detail?id=925 + } + + private String id; + private String volumeId; + private Volume.Status status; + private int size; @SerializedName(value="createdAt") - private final Date created; + private Date created; @SerializedName(value="displayName") - private final String name; + private String name; @SerializedName(value="displayDescription") - private final String description; + private String description; protected VolumeSnapshot(Builder builder) { this.id = checkNotNull(builder.id, "id"); diff --git a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/VolumeType.java b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/VolumeType.java index c8480cefe5..9fe73ef01e 100644 --- a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/VolumeType.java +++ b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/domain/VolumeType.java @@ -116,14 +116,20 @@ public class VolumeType { } } + protected VolumeType() { + // we want serializers like Gson to work w/o using sun.misc.Unsafe, + // prohibited in GAE. This also implies fields are not final. + // see http://code.google.com/p/jclouds/issues/detail?id=925 + } + private String id; private String name; @SerializedName("created_at") private Date created; @SerializedName("updated_at") - private final Optional updated; + private Optional updated = Optional.absent(); @SerializedName(value = "extra_specs") - private final Map extraSpecs; + private Map extraSpecs = ImmutableMap.of(); protected VolumeType(Builder builder) { this.id = checkNotNull(builder.id, "id"); @@ -133,11 +139,6 @@ public class VolumeType { this.updated = Optional.fromNullable(builder.updated); } - protected VolumeType() { - this.updated = Optional.absent(); - this.extraSpecs = ImmutableMap.of(); - } - public String getId() { return this.id; } diff --git a/common/openstack/src/main/java/org/jclouds/openstack/domain/AuthenticationResponse.java b/common/openstack/src/main/java/org/jclouds/openstack/domain/AuthenticationResponse.java index 6311c657f1..5b36ad63d0 100644 --- a/common/openstack/src/main/java/org/jclouds/openstack/domain/AuthenticationResponse.java +++ b/common/openstack/src/main/java/org/jclouds/openstack/domain/AuthenticationResponse.java @@ -28,7 +28,7 @@ import com.google.common.collect.ImmutableMap; public class AuthenticationResponse { private final String authToken; - private Map services; + private final Map services; public AuthenticationResponse(String authToken, Map services) { this.authToken = checkNotNull(authToken, "authToken"); @@ -38,11 +38,7 @@ public class AuthenticationResponse { public Map getServices() { return services; } - - public void setEndpoints(Map services) { - this.services = services; - } - + public String getAuthToken() { return authToken; } diff --git a/common/openstack/src/main/java/org/jclouds/openstack/domain/Link.java b/common/openstack/src/main/java/org/jclouds/openstack/domain/Link.java index 1adf14abed..0a7ca38410 100644 --- a/common/openstack/src/main/java/org/jclouds/openstack/domain/Link.java +++ b/common/openstack/src/main/java/org/jclouds/openstack/domain/Link.java @@ -133,11 +133,17 @@ public class Link { return relation(from.getRelation()).type(from.getType()).href(from.getHref()); } } + + protected Link() { + // we want serializers like Gson to work w/o using sun.misc.Unsafe, + // prohibited in GAE. This also implies fields are not final. + // see http://code.google.com/p/jclouds/issues/detail?id=925 + } @SerializedName("rel") - protected final Relation relation; - protected final String type; - protected final URI href; + protected Relation relation; + protected String type; + protected URI href; protected Link(Relation relation, @Nullable String type, URI href) { this.relation = checkNotNull(relation, "relation"); diff --git a/common/openstack/src/main/java/org/jclouds/openstack/domain/Resource.java b/common/openstack/src/main/java/org/jclouds/openstack/domain/Resource.java index a05e4b55e5..60dceef752 100644 --- a/common/openstack/src/main/java/org/jclouds/openstack/domain/Resource.java +++ b/common/openstack/src/main/java/org/jclouds/openstack/domain/Resource.java @@ -105,23 +105,23 @@ public class Resource implements Comparable { return this; } } + + protected Resource() { + // we want serializers like Gson to work w/o using sun.misc.Unsafe, + // prohibited in GAE. This also implies fields are not final. + // see http://code.google.com/p/jclouds/issues/detail?id=925 + } - private final String id; - private final String name; - private final Set links; + private String id; + private String name; + private Set links = ImmutableSet.of(); protected Resource(Builder builder) { this.id = checkNotNull(builder.id, "id"); this.name = builder.name; this.links = ImmutableSet.copyOf(checkNotNull(builder.links, "links")); } - - protected Resource() { - this.id = null; - this.name = null; - this.links = ImmutableSet.of(); - } - + /** * When providing an ID, it is assumed that the resource exists in the current OpenStack * deployment diff --git a/common/openstack/src/main/java/org/jclouds/openstack/keystone/v1_1/domain/Auth.java b/common/openstack/src/main/java/org/jclouds/openstack/keystone/v1_1/domain/Auth.java index e37ab75ded..396ce78ffa 100644 --- a/common/openstack/src/main/java/org/jclouds/openstack/keystone/v1_1/domain/Auth.java +++ b/common/openstack/src/main/java/org/jclouds/openstack/keystone/v1_1/domain/Auth.java @@ -28,6 +28,7 @@ import java.util.Set; import org.jclouds.util.Multimaps2; import com.google.common.base.Objects; +import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMultimap; import com.google.common.collect.Multimap; @@ -78,9 +79,15 @@ public class Auth implements Comparable { } } - protected final Token token; + protected Auth() { + // we want serializers like Gson to work w/o using sun.misc.Unsafe, + // prohibited in GAE. This also implies fields are not final. + // see http://code.google.com/p/jclouds/issues/detail?id=925 + } + + protected Token token; // TODO: get gson multimap adapter! - protected final Map> serviceCatalog; + protected Map> serviceCatalog = ImmutableMap.of(); public Auth(Token token, Multimap serviceCatalog) { this.token = checkNotNull(token, "token"); diff --git a/common/openstack/src/main/java/org/jclouds/openstack/keystone/v1_1/domain/Endpoint.java b/common/openstack/src/main/java/org/jclouds/openstack/keystone/v1_1/domain/Endpoint.java index 7486b3198b..3ab554706d 100644 --- a/common/openstack/src/main/java/org/jclouds/openstack/keystone/v1_1/domain/Endpoint.java +++ b/common/openstack/src/main/java/org/jclouds/openstack/keystone/v1_1/domain/Endpoint.java @@ -99,10 +99,16 @@ public class Endpoint implements Comparable { } } - protected final boolean v1Default; - protected final String region; - protected final URI publicURL; - protected final URI internalURL; + protected Endpoint() { + // we want serializers like Gson to work w/o using sun.misc.Unsafe, + // prohibited in GAE. This also implies fields are not final. + // see http://code.google.com/p/jclouds/issues/detail?id=925 + } + + protected boolean v1Default; + protected String region; + protected URI publicURL; + protected URI internalURL; protected Endpoint(boolean v1Default, @Nullable String region, @Nullable URI publicURL, @Nullable URI internalURL) { this.v1Default = v1Default; diff --git a/common/openstack/src/main/java/org/jclouds/openstack/keystone/v1_1/domain/Token.java b/common/openstack/src/main/java/org/jclouds/openstack/keystone/v1_1/domain/Token.java index e8edb38680..4a48cce928 100644 --- a/common/openstack/src/main/java/org/jclouds/openstack/keystone/v1_1/domain/Token.java +++ b/common/openstack/src/main/java/org/jclouds/openstack/keystone/v1_1/domain/Token.java @@ -80,8 +80,14 @@ public class Token implements Comparable { } } - protected final String id; - protected final Date expires; + protected Token() { + // we want serializers like Gson to work w/o using sun.misc.Unsafe, + // prohibited in GAE. This also implies fields are not final. + // see http://code.google.com/p/jclouds/issues/detail?id=925 + } + + protected String id; + protected Date expires; public Token(String id, Date expires) { this.id = checkNotNull(id, "id"); diff --git a/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/domain/Access.java b/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/domain/Access.java index 65a93e508c..b6e9e57560 100644 --- a/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/domain/Access.java +++ b/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/domain/Access.java @@ -89,9 +89,16 @@ public class Access implements Comparable { } } - protected final Token token; - protected final User user; - protected final Set serviceCatalog; + + protected Access() { + // we want serializers like Gson to work w/o using sun.misc.Unsafe, + // prohibited in GAE. This also implies fields are not final. + // see http://code.google.com/p/jclouds/issues/detail?id=925 + } + + protected Token token; + protected User user; + protected Set serviceCatalog = ImmutableSet.of(); public Access(Token token, User user, Set serviceCatalog) { this.token = checkNotNull(token, "token"); diff --git a/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/domain/ApiMetadata.java b/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/domain/ApiMetadata.java index ef4f0bfe48..768ad8c8c5 100644 --- a/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/domain/ApiMetadata.java +++ b/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/domain/ApiMetadata.java @@ -94,14 +94,20 @@ public class ApiMetadata extends Resource { return this; } } + + protected ApiMetadata() { + // we want serializers like Gson to work w/o using sun.misc.Unsafe, + // prohibited in GAE. This also implies fields are not final. + // see http://code.google.com/p/jclouds/issues/detail?id=925 + } @Nullable - private final String status; + private String status; @Nullable - private final Date updated; + private Date updated; @SerializedName(value="media-types") @Nullable - private final Set mediaTypes; + private Set mediaTypes = ImmutableSet.of(); protected ApiMetadata(Builder builder) { super(builder); diff --git a/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/domain/Endpoint.java b/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/domain/Endpoint.java index 0b57843d22..fc3c58e440 100644 --- a/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/domain/Endpoint.java +++ b/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/domain/Endpoint.java @@ -115,19 +115,26 @@ public class Endpoint implements Comparable { from.getInternalURL()).tenantId(from.getTenantId()); } } + + protected Endpoint() { + // we want serializers like Gson to work w/o using sun.misc.Unsafe, + // prohibited in GAE. This also implies fields are not final. + // see http://code.google.com/p/jclouds/issues/detail?id=925 + } + // renamed half-way through @Deprecated protected String id; - protected final String versionId; - protected final String region; - protected final URI publicURL; - protected final URI internalURL; - protected final URI adminURL; + protected String versionId; + protected String region; + protected URI publicURL; + protected URI internalURL; + protected URI adminURL; // renamed half-way through @Deprecated protected String tenantName; - protected final String tenantId; + protected String tenantId; protected Endpoint(String versionId, String region, @Nullable URI publicURL, @Nullable URI internalURL, @Nullable URI adminURL, @Nullable String tenantId) { diff --git a/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/domain/MediaType.java b/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/domain/MediaType.java index cb3cf6d071..015b69a358 100644 --- a/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/domain/MediaType.java +++ b/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/domain/MediaType.java @@ -59,9 +59,15 @@ public class MediaType { return this.base(in.getBase()).type(in.getType()); } } - - private final String base; - private final String type; + + protected MediaType() { + // we want serializers like Gson to work w/o using sun.misc.Unsafe, + // prohibited in GAE. This also implies fields are not final. + // see http://code.google.com/p/jclouds/issues/detail?id=925 + } + + private String base; + private String type; protected MediaType(Builder builder) { this.base = builder.base; diff --git a/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/domain/Role.java b/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/domain/Role.java index 714e143561..3e7342ee31 100644 --- a/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/domain/Role.java +++ b/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/domain/Role.java @@ -96,14 +96,20 @@ public class Role implements Comparable { return id(from.getId()).name(from.getName()).serviceId(from.getServiceId()).tenantId(from.getTenantId()); } } - - protected final String id; - protected final String name; - protected final String serviceId; + + protected Role() { + // we want serializers like Gson to work w/o using sun.misc.Unsafe, + // prohibited in GAE. This also implies fields are not final. + // see http://code.google.com/p/jclouds/issues/detail?id=925 + } + + protected String id; + protected String name; + protected String serviceId; // renamed half-way through @Deprecated protected String tenantName; - protected final String tenantId; + protected String tenantId; protected Role(String id, String name, @Nullable String serviceId, @Nullable String tenantId) { this.id = checkNotNull(id, "id"); diff --git a/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/domain/Service.java b/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/domain/Service.java index 6f8d579f74..2da7bab460 100644 --- a/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/domain/Service.java +++ b/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/domain/Service.java @@ -90,10 +90,16 @@ public class Service implements Comparable { return type(from.getType()).name(from.getName()).endpoints(from.getEndpoints()); } } - - protected final String type; - protected final String name; - protected final Set endpoints; + + protected Service() { + // we want serializers like Gson to work w/o using sun.misc.Unsafe, + // prohibited in GAE. This also implies fields are not final. + // see http://code.google.com/p/jclouds/issues/detail?id=925 + } + + protected String type; + protected String name; + protected Set endpoints = ImmutableSet.of(); public Service(String type, String name, Set endpoints) { this.type = checkNotNull(type, "type"); diff --git a/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/domain/Tenant.java b/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/domain/Tenant.java index b0efc5365c..d39735074f 100644 --- a/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/domain/Tenant.java +++ b/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/domain/Tenant.java @@ -82,10 +82,16 @@ public class Tenant implements Comparable { return id(from.getId()).name(from.getName()); } } - - protected final String id; - protected final String name; - protected final String description; + + protected Tenant() { + // we want serializers like Gson to work w/o using sun.misc.Unsafe, + // prohibited in GAE. This also implies fields are not final. + // see http://code.google.com/p/jclouds/issues/detail?id=925 + } + + protected String id; + protected String name; + protected String description; protected Tenant(String id, String name, String description) { this.id = checkNotNull(id, "id"); diff --git a/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/domain/Token.java b/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/domain/Token.java index ebdfa9ecef..171ed7db4f 100644 --- a/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/domain/Token.java +++ b/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/domain/Token.java @@ -87,10 +87,16 @@ public class Token implements Comparable { return id(from.getId()).expires(from.getExpires()).tenant(from.getTenant()); } } - - protected final String id; - protected final Date expires; - protected final Tenant tenant; + + protected Token() { + // we want serializers like Gson to work w/o using sun.misc.Unsafe, + // prohibited in GAE. This also implies fields are not final. + // see http://code.google.com/p/jclouds/issues/detail?id=925 + } + + protected String id; + protected Date expires; + protected Tenant tenant; public Token(String id, Date expires, Tenant tenant) { this.id = checkNotNull(id, "id"); diff --git a/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/domain/User.java b/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/domain/User.java index e8d5ff7dcb..b6b19cd859 100644 --- a/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/domain/User.java +++ b/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/domain/User.java @@ -93,22 +93,22 @@ public class User implements Comparable { return id(from.getId()).name(from.getName()).roles(from.getRoles()); } } - - protected final String id; - protected final String name; - protected final Set roles; + + protected User() { + // we want serializers like Gson to work w/o using sun.misc.Unsafe, + // prohibited in GAE. This also implies fields are not final. + // see http://code.google.com/p/jclouds/issues/detail?id=925 + } + + protected String id; + protected String name; + protected Set roles = ImmutableSet.of(); protected User(String id, String name, Set roles) { this.id = checkNotNull(id, "id"); this.name = checkNotNull(name, "name"); this.roles = ImmutableSet.copyOf(checkNotNull(roles, "roles")); } - - protected User() { - id = null; - name = null; - roles = ImmutableSet.of(); - } /** * When providing an ID, it is assumed that the user exists in the current OpenStack deployment diff --git a/labs/openstack-swift/src/main/java/org/jclouds/openstack/swift/v1/domain/AccountMetadata.java b/labs/openstack-swift/src/main/java/org/jclouds/openstack/swift/v1/domain/AccountMetadata.java index 61a53d5c4a..18c1801ced 100644 --- a/labs/openstack-swift/src/main/java/org/jclouds/openstack/swift/v1/domain/AccountMetadata.java +++ b/labs/openstack-swift/src/main/java/org/jclouds/openstack/swift/v1/domain/AccountMetadata.java @@ -49,8 +49,14 @@ public class AccountMetadata { } } - protected final int containerCount; - protected final long bytesUsed; + protected AccountMetadata() { + // we want serializers like Gson to work w/o using sun.misc.Unsafe, + // prohibited in GAE. This also implies fields are not final. + // see http://code.google.com/p/jclouds/issues/detail?id=925 + } + + protected int containerCount; + protected long bytesUsed; public AccountMetadata(int containerCount, long bytesUsed) { this.containerCount = containerCount; diff --git a/labs/openstack-swift/src/main/java/org/jclouds/openstack/swift/v1/domain/ContainerMetadata.java b/labs/openstack-swift/src/main/java/org/jclouds/openstack/swift/v1/domain/ContainerMetadata.java index 2852022535..18e0018ef8 100644 --- a/labs/openstack-swift/src/main/java/org/jclouds/openstack/swift/v1/domain/ContainerMetadata.java +++ b/labs/openstack-swift/src/main/java/org/jclouds/openstack/swift/v1/domain/ContainerMetadata.java @@ -65,9 +65,15 @@ public class ContainerMetadata implements Comparable { } } - protected final String name; - protected final int count; - protected final int bytes; + protected ContainerMetadata() { + // we want serializers like Gson to work w/o using sun.misc.Unsafe, + // prohibited in GAE. This also implies fields are not final. + // see http://code.google.com/p/jclouds/issues/detail?id=925 + } + + protected String name; + protected int count; + protected int bytes; public ContainerMetadata(String name, int count, int bytes) { this.name = checkNotNull(name, "name"); diff --git a/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/domain/ContainerCDNMetadata.java b/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/domain/ContainerCDNMetadata.java index 14949d6a82..83155befa2 100644 --- a/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/domain/ContainerCDNMetadata.java +++ b/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/domain/ContainerCDNMetadata.java @@ -28,6 +28,12 @@ import com.google.gson.annotations.SerializedName; * */ public class ContainerCDNMetadata implements Comparable { + + protected ContainerCDNMetadata() { + // we want serializers like Gson to work w/o using sun.misc.Unsafe, + // prohibited in GAE. This also implies fields are not final. + // see http://code.google.com/p/jclouds/issues/detail?id=925 + } private String name; private boolean cdn_enabled; @@ -45,9 +51,6 @@ public class ContainerCDNMetadata implements Comparable { this.cdn_uri = cdnUri; } - public ContainerCDNMetadata() { - } - /** * Beware: The container name is not available from HEAD CDN responses and will be null. return * the name of the container to which these CDN settings apply.