From f088d3012f758dfeb87fc7441477c71272e4d148 Mon Sep 17 00:00:00 2001 From: Daniele Date: Sat, 15 Mar 2014 01:31:26 +0100 Subject: [PATCH 1/6] tested version --- .../ceilometer/v2/api/MetersResource.java | 141 +- .../openstack/ceilometer/v2/model/Meter.java | 108 +- .../ceilometer/v2/model/Resource.java | 100 +- .../openstack/ceilometer/v2/model/Sample.java | 188 +-- .../ceilometer/v2/model/Statistics.java | 176 +-- .../openstack/glance/ImagesResource.java | 559 ++++---- .../glance/SharedImagesResource.java | 59 +- .../woorea/openstack/glance/model/Image.java | 648 ++++----- .../openstack/glance/model/ImageMember.java | 104 +- .../openstack/glance/model/ImageMembers.java | 50 +- .../woorea/openstack/glance/model/Images.java | 52 +- .../openstack/glance/model/SharedImages.java | 50 +- .../heat/model/CreateStackParam.java | 200 +-- .../openstack/heat/model/Explanation.java | 56 +- .../com/woorea/openstack/heat/model/Link.java | 70 +- .../woorea/openstack/heat/model/Resource.java | 244 ++-- .../openstack/heat/model/Resources.java | 54 +- .../woorea/openstack/heat/model/Stack.java | 230 ++-- .../woorea/openstack/heat/model/Stacks.java | 34 +- .../woorea/openstack/keystone/Keystone.java | 129 +- .../openstack/keystone/api/UsersResource.java | 158 ++- .../openstack/keystone/v3/Keystone.java | 146 +- .../keystone/v3/api/PoliciesResource.java | 28 +- .../openstack/keystone/model/Access.java | 504 +++---- .../keystone/model/Authentication.java | 80 +- .../openstack/keystone/model/Endpoint.java | 242 ++-- .../openstack/keystone/model/Endpoints.java | 68 +- .../openstack/keystone/model/Error.java | 92 +- .../woorea/openstack/keystone/model/Role.java | 134 +- .../openstack/keystone/model/Roles.java | 68 +- .../openstack/keystone/model/Service.java | 152 +- .../openstack/keystone/model/Services.java | 68 +- .../openstack/keystone/model/Tenant.java | 204 +-- .../openstack/keystone/model/Tenants.java | 88 +- .../woorea/openstack/keystone/model/User.java | 280 ++-- .../openstack/keystone/model/Users.java | 68 +- .../model/authentication/AccessKey.java | 143 +- .../authentication/TokenAuthentication.java | 99 +- .../authentication/UsernamePassword.java | 141 +- .../keystone/v3/model/Authentication.java | 570 ++++---- .../keystone/v3/model/Credential.java | 122 +- .../keystone/v3/model/Credentials.java | 68 +- .../openstack/keystone/v3/model/Domain.java | 96 +- .../openstack/keystone/v3/model/Domains.java | 68 +- .../openstack/keystone/v3/model/Endpoint.java | 102 +- .../keystone/v3/model/Endpoints.java | 68 +- .../openstack/keystone/v3/model/Group.java | 100 +- .../openstack/keystone/v3/model/Groups.java | 68 +- .../openstack/keystone/v3/model/Policies.java | 68 +- .../openstack/keystone/v3/model/Policy.java | 122 +- .../openstack/keystone/v3/model/Project.java | 100 +- .../openstack/keystone/v3/model/Projects.java | 68 +- .../openstack/keystone/v3/model/Role.java | 134 +- .../openstack/keystone/v3/model/Roles.java | 68 +- .../openstack/keystone/v3/model/Service.java | 96 +- .../openstack/keystone/v3/model/Services.java | 71 +- .../openstack/keystone/v3/model/Token.java | 464 +++---- .../openstack/keystone/v3/model/User.java | 182 +-- .../openstack/keystone/v3/model/Users.java | 71 +- .../java/com/woorea/openstack/nova/Nova.java | 226 +-- .../api/extensions/AggregatesExtension.java | 323 +++-- .../api/extensions/FloatingIpsExtension.java | 133 +- .../openstack/nova/model/Certificate.java | 72 +- .../openstack/nova/model/Cloudpipe.java | 268 ++-- .../openstack/nova/model/Cloudpipes.java | 56 +- .../openstack/nova/model/Extension.java | 150 +- .../openstack/nova/model/Extensions.java | 68 +- .../woorea/openstack/nova/model/Flavor.java | 478 +++---- .../openstack/nova/model/FlavorForCreate.java | 283 ++-- .../woorea/openstack/nova/model/Flavors.java | 68 +- .../openstack/nova/model/FloatingIp.java | 134 +- .../nova/model/FloatingIpDomain.java | 116 +- .../nova/model/FloatingIpDomains.java | 68 +- .../openstack/nova/model/FloatingIpPools.java | 113 +- .../openstack/nova/model/FloatingIps.java | 68 +- .../com/woorea/openstack/nova/model/Host.java | 218 +-- .../openstack/nova/model/HostAggregate.java | 220 +-- .../openstack/nova/model/HostAggregates.java | 68 +- .../woorea/openstack/nova/model/Hosts.java | 154 +-- .../woorea/openstack/nova/model/Image.java | 464 +++---- .../openstack/nova/model/ImageFromVolume.java | 224 +-- .../woorea/openstack/nova/model/Images.java | 70 +- .../woorea/openstack/nova/model/KeyPair.java | 196 +-- .../woorea/openstack/nova/model/KeyPairs.java | 92 +- .../woorea/openstack/nova/model/Limits.java | 788 +++++------ .../woorea/openstack/nova/model/Network.java | 580 ++++---- .../nova/model/NetworkForCreate.java | 57 +- .../woorea/openstack/nova/model/Networks.java | 68 +- .../woorea/openstack/nova/model/QuotaSet.java | 310 ++--- .../openstack/nova/model/SecurityGroup.java | 414 +++--- .../nova/model/SecurityGroupForCreate.java | 128 +- .../model/SecurityGroupRuleForCreate.java | 396 +++--- .../openstack/nova/model/SecurityGroups.java | 68 +- .../woorea/openstack/nova/model/Server.java | 1027 +++++++------- .../openstack/nova/model/ServerAction.java | 1220 ++++++++--------- .../openstack/nova/model/ServerForCreate.java | 652 ++++----- .../woorea/openstack/nova/model/Servers.java | 68 +- .../nova/model/SimpleTenantUsage.java | 464 +++---- .../nova/model/SimpleTenantUsages.java | 68 +- .../woorea/openstack/nova/model/Snapshot.java | 174 +-- .../nova/model/SnapshotForCreate.java | 174 +-- .../openstack/nova/model/Snapshots.java | 68 +- .../woorea/openstack/nova/model/Volume.java | 232 ++-- .../nova/model/VolumeAttachment.java | 118 +- .../nova/model/VolumeAttachments.java | 68 +- .../openstack/nova/model/VolumeForCreate.java | 246 ++-- .../nova/model/VolumeForImageCreate.java | 142 +- .../openstack/nova/model/VolumeType.java | 20 +- .../openstack/nova/model/VolumeTypes.java | 68 +- .../woorea/openstack/nova/model/Volumes.java | 68 +- .../openstack/connector/JerseyConnector.java | 205 +-- .../woorea/openstack/connector/OpenStack.java | 217 +-- .../connector/RESTEasyConnector.java | 246 ++-- .../openstack/connector/RESTEasyResponse.java | 102 +- .../woorea/openstack/base/client/Entity.java | 107 +- .../base/client/OpenStackRequest.java | 284 ++-- .../woorea/openstack/console/Commands.java | 60 +- .../examples/ExamplesConfiguration.java | 70 +- .../examples/glance/GlanceListImages.java | 165 ++- .../examples/heat/HeatListStacks.java | 144 +- .../hpcloud/Keystone3Authentication.java | 68 +- .../examples/metering/v2/TestAll.java | 119 +- .../examples/network/QuantumListNetworks.java | 93 +- .../network/QuantumNetworkCreate.java | 205 ++- .../network/QuantumQueryNetworks.java | 117 +- .../examples/objectstore/SwiftExample.java | 179 ++- pom.xml | 295 ++-- .../quantum/api/query/AbsOpenStackCmd.java | 159 ++- .../openstack/quantum/model/GatewayInfo.java | 47 +- .../openstack/quantum/model/Network.java | 550 ++++---- .../quantum/model/NetworkForCreate.java | 18 +- .../openstack/quantum/model/Networks.java | 77 +- .../woorea/openstack/quantum/model/Port.java | 538 ++++---- .../quantum/model/PortForCreate.java | 24 +- .../woorea/openstack/quantum/model/Ports.java | 80 +- .../openstack/quantum/model/Router.java | 154 +-- .../quantum/model/RouterForAddInterface.java | 56 +- .../quantum/model/RouterForCreate.java | 150 +- .../quantum/model/RouterInterface.java | 37 +- .../openstack/quantum/model/Routers.java | 77 +- .../openstack/quantum/model/Subnet.java | 528 +++---- .../quantum/model/SubnetForCreate.java | 68 +- .../openstack/quantum/model/Subnets.java | 72 +- .../openstack/quantum/model/NetworkTest.java | 239 ++-- .../openstack/quantum/model/PortTest.java | 328 ++--- .../openstack/quantum/model/SubnetTest.java | 296 ++-- .../swift/api/ContainerResource.java | 220 ++- .../swift/api/ContainersResource.java | 174 ++- .../openstack/swift/model/Container.java | 2 +- .../woorea/openstack/swift/model/Object.java | 203 +-- 150 files changed, 13751 insertions(+), 13759 deletions(-) diff --git a/ceilometer-client/src/main/java/com/woorea/openstack/ceilometer/v2/api/MetersResource.java b/ceilometer-client/src/main/java/com/woorea/openstack/ceilometer/v2/api/MetersResource.java index e44dbe649..3841f1703 100644 --- a/ceilometer-client/src/main/java/com/woorea/openstack/ceilometer/v2/api/MetersResource.java +++ b/ceilometer-client/src/main/java/com/woorea/openstack/ceilometer/v2/api/MetersResource.java @@ -1,71 +1,70 @@ -package com.woorea.openstack.ceilometer.v2.api; - - -import com.woorea.openstack.base.client.OpenStackClient; -import com.woorea.openstack.base.client.OpenStackRequest; -import com.woorea.openstack.ceilometer.QueriableCeilometerCommand; -import com.woorea.openstack.ceilometer.v2.model.Sample; - -public class MetersResource { - - private final OpenStackClient CLIENT; - - public MetersResource(OpenStackClient client) { - CLIENT = client; - } - - public List list() { - return new List(); - } - - public Show show() { - return new Show(); - } - - public Statistics statistics() { - return new Statistics(); - } - - public class List extends QueriableCeilometerCommand> { - public List() { - //return query(target.path("meters")).request(MediaType.APPLICATION_JSON).get(new GenericType>() {}); - } - } - - public class Show extends QueriableCeilometerCommand> { - - private String name; - - public Show name(String name) { - this.name = name; - return this; - } - - public Show() { -// if(name == null) { -// throw new UnsupportedOperationException("meter id is mandatory"); -// } -// return query(target.path("meters").path(name)).request(MediaType.APPLICATION_JSON).get(new GenericType>() {}); - } - - } - - public class Statistics extends QueriableCeilometerCommand> { - - private String name; - - public Statistics name(String name) { - this.name = name; - return this; - } - - public Statistics() { -// if(name == null) { -// throw new UnsupportedOperationException("meter id is mandatory"); -// } -// return query(target.path("meters").path(name).path("statistics")).request(MediaType.APPLICATION_JSON).get(new GenericType>(){}); - } - - } - -} +package com.woorea.openstack.ceilometer.v2.api; + + +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.ceilometer.QueriableCeilometerCommand; +import com.woorea.openstack.ceilometer.v2.model.Sample; + +public class MetersResource { + + private final OpenStackClient CLIENT; + + public MetersResource(OpenStackClient client) { + CLIENT = client; + } + + public List list() { + return new List(); + } + + public Show show() { + return new Show(); + } + + public Statistics statistics() { + return new Statistics(); + } + + public class List extends QueriableCeilometerCommand> { + public List() { + //return query(target.path("meters")).request(MediaType.APPLICATION_JSON).get(new GenericType>() {}); + } + } + + public class Show extends QueriableCeilometerCommand> { + + private String name; + + public Show name(String name) { + this.name = name; + return this; + } + + public Show() { +// if(name == null) { +// throw new UnsupportedOperationException("meter id is mandatory"); +// } +// return query(target.path("meters").path(name)).request(MediaType.APPLICATION_JSON).get(new GenericType>() {}); + } + + } + + public class Statistics extends QueriableCeilometerCommand> { + + private String name; + + public Statistics name(String name) { + this.name = name; + return this; + } + + public Statistics() { +// if(name == null) { +// throw new UnsupportedOperationException("meter id is mandatory"); +// } +// return query(target.path("meters").path(name).path("statistics")).request(MediaType.APPLICATION_JSON).get(new GenericType>(){}); + } + + } + +} diff --git a/ceilometer-model/src/main/java/com/woorea/openstack/ceilometer/v2/model/Meter.java b/ceilometer-model/src/main/java/com/woorea/openstack/ceilometer/v2/model/Meter.java index df9182f9c..f92605add 100644 --- a/ceilometer-model/src/main/java/com/woorea/openstack/ceilometer/v2/model/Meter.java +++ b/ceilometer-model/src/main/java/com/woorea/openstack/ceilometer/v2/model/Meter.java @@ -1,54 +1,54 @@ -package com.woorea.openstack.ceilometer.v2.model; - -import org.codehaus.jackson.annotate.JsonProperty; - -public class Meter { - - @JsonProperty("user_id") - private String user; - - - private String name; - - @JsonProperty("resource_id") - private String resource; - - @JsonProperty("project_id") - private String project; - - private String type; - - private String unit; - - public String getUser() { - return user; - } - - public String getName() { - return name; - } - - public String getResource() { - return resource; - } - - public String getProject() { - return project; - } - - public String getType() { - return type; - } - - public String getUnit() { - return unit; - } - - @Override - public String toString() { - return "Meter [user=" + user + ", name=" + name + ", resource=" - + resource + ", project=" + project + ", type=" + type - + ", unit=" + unit + "]"; - } - -} +package com.woorea.openstack.ceilometer.v2.model; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class Meter { + + @JsonProperty("user_id") + private String user; + + + private String name; + + @JsonProperty("resource_id") + private String resource; + + @JsonProperty("project_id") + private String project; + + private String type; + + private String unit; + + public String getUser() { + return user; + } + + public String getName() { + return name; + } + + public String getResource() { + return resource; + } + + public String getProject() { + return project; + } + + public String getType() { + return type; + } + + public String getUnit() { + return unit; + } + + @Override + public String toString() { + return "Meter [user=" + user + ", name=" + name + ", resource=" + + resource + ", project=" + project + ", type=" + type + + ", unit=" + unit + "]"; + } + +} diff --git a/ceilometer-model/src/main/java/com/woorea/openstack/ceilometer/v2/model/Resource.java b/ceilometer-model/src/main/java/com/woorea/openstack/ceilometer/v2/model/Resource.java index 24e14aa3d..3a2e3ac56 100644 --- a/ceilometer-model/src/main/java/com/woorea/openstack/ceilometer/v2/model/Resource.java +++ b/ceilometer-model/src/main/java/com/woorea/openstack/ceilometer/v2/model/Resource.java @@ -1,50 +1,50 @@ -package com.woorea.openstack.ceilometer.v2.model; - -import java.util.Map; - -import org.codehaus.jackson.annotate.JsonProperty; - -public class Resource { - //{"resource_id": "23b55841eedd41e99d5f3f32149ca086", "timestamp": "2013-03-03T15:19:00", "project_id": "23b55841eedd41e99d5f3f32149ca086", "user_id": null, "metadata": {}} - - @JsonProperty("resource_id") - private String resource; - - private String timestamp; - - @JsonProperty("project_id") - private String project; - - @JsonProperty("user_id") - private String user; - - private Map metadata; - - public String getResource() { - return resource; - } - - public String getTimestamp() { - return timestamp; - } - - public String getProject() { - return project; - } - - public String getUser() { - return user; - } - - public Map getMetadata() { - return metadata; - } - - @Override - public String toString() { - return "Resource [resource=" + resource + ", timestamp=" + timestamp - + ", project=" + project + ", user=" + user + ", metadata=" - + metadata + "]"; - } - -} +package com.woorea.openstack.ceilometer.v2.model; + +import java.util.Map; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class Resource { + //{"resource_id": "23b55841eedd41e99d5f3f32149ca086", "timestamp": "2013-03-03T15:19:00", "project_id": "23b55841eedd41e99d5f3f32149ca086", "user_id": null, "metadata": {}} + + @JsonProperty("resource_id") + private String resource; + + private String timestamp; + + @JsonProperty("project_id") + private String project; + + @JsonProperty("user_id") + private String user; + + private Map metadata; + + public String getResource() { + return resource; + } + + public String getTimestamp() { + return timestamp; + } + + public String getProject() { + return project; + } + + public String getUser() { + return user; + } + + public Map getMetadata() { + return metadata; + } + + @Override + public String toString() { + return "Resource [resource=" + resource + ", timestamp=" + timestamp + + ", project=" + project + ", user=" + user + ", metadata=" + + metadata + "]"; + } + +} diff --git a/ceilometer-model/src/main/java/com/woorea/openstack/ceilometer/v2/model/Sample.java b/ceilometer-model/src/main/java/com/woorea/openstack/ceilometer/v2/model/Sample.java index 8827de466..3ec191647 100644 --- a/ceilometer-model/src/main/java/com/woorea/openstack/ceilometer/v2/model/Sample.java +++ b/ceilometer-model/src/main/java/com/woorea/openstack/ceilometer/v2/model/Sample.java @@ -1,94 +1,94 @@ -package com.woorea.openstack.ceilometer.v2.model; - -import java.util.Map; - -import org.codehaus.jackson.annotate.JsonProperty; - -public class Sample { - - @JsonProperty("counter_type") - private String counterType; - - @JsonProperty("counter_name") - private String counterName; - - @JsonProperty("counter_unit") - private String counterUnit; - - @JsonProperty("counter_volume") - private String counterVolume; - - private String source; - - @JsonProperty("project_id") - private String project; - - @JsonProperty("user_id") - private String user; - - @JsonProperty("resource_id") - private String resource; - - private String timestamp; - - @JsonProperty("message_id") - private String message; - - @JsonProperty("resource_metadata") - private Map metadata; - - public String getCounterType() { - return counterType; - } - - public String getCounterName() { - return counterName; - } - - public String getCounterUnit() { - return counterUnit; - } - - public String getCounterVolume() { - return counterVolume; - } - - public String getSource() { - return source; - } - - public String getProject() { - return project; - } - - public String getUser() { - return user; - } - - public String getResource() { - return resource; - } - - public String getTimestamp() { - return timestamp; - } - - public String getMessage() { - return message; - } - - public Map getMetadata() { - return metadata; - } - - @Override - public String toString() { - return "Sample [counterType=" + counterType + ", counterName=" - + counterName + ", counterUnit=" + counterUnit - + ", counterVolume=" + counterVolume + ", source=" + source - + ", project=" + project + ", user=" + user + ", resource=" - + resource + ", timestamp=" + timestamp + ", message=" - + message + ", metadata=" + metadata + "]"; - } - -} +package com.woorea.openstack.ceilometer.v2.model; + +import java.util.Map; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class Sample { + + @JsonProperty("counter_type") + private String counterType; + + @JsonProperty("counter_name") + private String counterName; + + @JsonProperty("counter_unit") + private String counterUnit; + + @JsonProperty("counter_volume") + private String counterVolume; + + private String source; + + @JsonProperty("project_id") + private String project; + + @JsonProperty("user_id") + private String user; + + @JsonProperty("resource_id") + private String resource; + + private String timestamp; + + @JsonProperty("message_id") + private String message; + + @JsonProperty("resource_metadata") + private Map metadata; + + public String getCounterType() { + return counterType; + } + + public String getCounterName() { + return counterName; + } + + public String getCounterUnit() { + return counterUnit; + } + + public String getCounterVolume() { + return counterVolume; + } + + public String getSource() { + return source; + } + + public String getProject() { + return project; + } + + public String getUser() { + return user; + } + + public String getResource() { + return resource; + } + + public String getTimestamp() { + return timestamp; + } + + public String getMessage() { + return message; + } + + public Map getMetadata() { + return metadata; + } + + @Override + public String toString() { + return "Sample [counterType=" + counterType + ", counterName=" + + counterName + ", counterUnit=" + counterUnit + + ", counterVolume=" + counterVolume + ", source=" + source + + ", project=" + project + ", user=" + user + ", resource=" + + resource + ", timestamp=" + timestamp + ", message=" + + message + ", metadata=" + metadata + "]"; + } + +} diff --git a/ceilometer-model/src/main/java/com/woorea/openstack/ceilometer/v2/model/Statistics.java b/ceilometer-model/src/main/java/com/woorea/openstack/ceilometer/v2/model/Statistics.java index 5a34fe54b..cea9cca71 100644 --- a/ceilometer-model/src/main/java/com/woorea/openstack/ceilometer/v2/model/Statistics.java +++ b/ceilometer-model/src/main/java/com/woorea/openstack/ceilometer/v2/model/Statistics.java @@ -1,88 +1,88 @@ -package com.woorea.openstack.ceilometer.v2.model; - -import java.math.BigDecimal; - -import org.codehaus.jackson.annotate.JsonProperty; - -public class Statistics { - - private BigDecimal avg; - - private BigDecimal count; - - private BigDecimal duration; - - @JsonProperty("duration_start") - private String durationStart; - - @JsonProperty("duration_end") - private String durationEnd; - - private BigDecimal max; - - private BigDecimal min; - - private BigDecimal period; - - @JsonProperty("period_start") - private String periodStart; - - @JsonProperty("period_end") - private String periodEnd; - - private BigDecimal sum; - - public BigDecimal getAvg() { - return avg; - } - - public BigDecimal getCount() { - return count; - } - - public BigDecimal getDuration() { - return duration; - } - - public String getDurationStart() { - return durationStart; - } - - public String getDurationEnd() { - return durationEnd; - } - - public BigDecimal getMax() { - return max; - } - - public BigDecimal getMin() { - return min; - } - - public BigDecimal getPeriod() { - return period; - } - - public String getPeriodStart() { - return periodStart; - } - - public String getPeriodEnd() { - return periodEnd; - } - - public BigDecimal getSum() { - return sum; - } - - @Override - public String toString() { - return "Statistics [avg=" + avg + ", count=" + count + ", duration=" - + duration + ", durationStart=" + durationStart - + ", durationEnd=" + durationEnd + ", max=" + max + ", min=" - + min + ", period=" + period + ", periodStart=" + periodStart - + ", periodEnd=" + periodEnd + ", sum=" + sum + "]"; - } - -} +package com.woorea.openstack.ceilometer.v2.model; + +import java.math.BigDecimal; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class Statistics { + + private BigDecimal avg; + + private BigDecimal count; + + private BigDecimal duration; + + @JsonProperty("duration_start") + private String durationStart; + + @JsonProperty("duration_end") + private String durationEnd; + + private BigDecimal max; + + private BigDecimal min; + + private BigDecimal period; + + @JsonProperty("period_start") + private String periodStart; + + @JsonProperty("period_end") + private String periodEnd; + + private BigDecimal sum; + + public BigDecimal getAvg() { + return avg; + } + + public BigDecimal getCount() { + return count; + } + + public BigDecimal getDuration() { + return duration; + } + + public String getDurationStart() { + return durationStart; + } + + public String getDurationEnd() { + return durationEnd; + } + + public BigDecimal getMax() { + return max; + } + + public BigDecimal getMin() { + return min; + } + + public BigDecimal getPeriod() { + return period; + } + + public String getPeriodStart() { + return periodStart; + } + + public String getPeriodEnd() { + return periodEnd; + } + + public BigDecimal getSum() { + return sum; + } + + @Override + public String toString() { + return "Statistics [avg=" + avg + ", count=" + count + ", duration=" + + duration + ", durationStart=" + durationStart + + ", durationEnd=" + durationEnd + ", max=" + max + ", min=" + + min + ", period=" + period + ", periodStart=" + periodStart + + ", periodEnd=" + periodEnd + ", sum=" + sum + "]"; + } + +} diff --git a/glance-client/src/main/java/com/woorea/openstack/glance/ImagesResource.java b/glance-client/src/main/java/com/woorea/openstack/glance/ImagesResource.java index ae46548db..1c03b4d7d 100644 --- a/glance-client/src/main/java/com/woorea/openstack/glance/ImagesResource.java +++ b/glance-client/src/main/java/com/woorea/openstack/glance/ImagesResource.java @@ -1,280 +1,279 @@ -package com.woorea.openstack.glance; - -import java.util.Calendar; -import java.util.Collection; -import java.util.HashMap; -import java.util.Map; - -import org.codehaus.jackson.annotate.JsonProperty; - -import com.woorea.openstack.base.client.Entity; -import com.woorea.openstack.base.client.HttpMethod; -import com.woorea.openstack.base.client.OpenStackClient; -import com.woorea.openstack.base.client.OpenStackRequest; -import com.woorea.openstack.base.client.OpenStackResponse; -import com.woorea.openstack.glance.model.Image; -import com.woorea.openstack.glance.model.ImageDownload; -import com.woorea.openstack.glance.model.ImageUpload; -import com.woorea.openstack.glance.model.ImageMember; -import com.woorea.openstack.glance.model.ImageMembers; -import com.woorea.openstack.glance.model.Images; - -public class ImagesResource { - - private final OpenStackClient CLIENT; - - public ImagesResource(OpenStackClient client) { - CLIENT = client; - } - - public List list(boolean detail) { - return new List(detail); - } - - public Create create(Image image) { - return new Create(image); - } - - public Show show(String id) { - return new Show(id); - } - - public Update update(String id, Image image) { - return new Update(id, image); - } - - public Delete delete(String id) { - return new Delete(id); - } - - public Upload upload(ImageUpload image) { - return new Upload(image); - } - - public Upload upload(String id, ImageUpload image) { - return new Upload(id, image); - } - - public Download download(String id) { - return new Download(id); - } - - public ListMembers listMembers(String id) { - return new ListMembers(id); - } - - public ReplaceMembers replaceMembers(String id, Collection members) { - return new ReplaceMembers(id, members); - } - - public AddMember addMember(String id, String tenantId) { - return new AddMember(id, tenantId); - } - - public AddMember removeMember(String id, String tenantId) { - return new AddMember(id, tenantId); - } - - public class List extends OpenStackRequest { - - public List(boolean detail) { - super(CLIENT, HttpMethod.GET, detail ? "/images/detail" : "images", null, Images.class); - } - - } - - public class Create extends OpenStackRequest { - - public Create(Image image) { - super(CLIENT, HttpMethod.POST, "/images", null, Image.class); - for (Map.Entry entry : compose(image).entrySet()) { - header(entry.getKey(), entry.getValue()); - } - } - - } - - public class Update extends OpenStackRequest { - - public Update(String id, Image image) { - super(CLIENT, HttpMethod.PUT, new StringBuilder("/images/").append(id).toString(), Entity.json(image), Image.class); - } - - } - - public class Delete extends OpenStackRequest { - - public Delete(String id) { - super(CLIENT, HttpMethod.DELETE, new StringBuilder("/images/").append(id).toString(), null, Void.class); - } - - } - - public class Show extends OpenStackRequest { - - public Show(String id) { - super(CLIENT, HttpMethod.HEAD, new StringBuilder("/images/").append(id).toString(), null, Image.class); - } - - @Override - public Image execute() { - // custom parsing here - return parse(CLIENT.request(this).headers()); - } - - } - - public class Upload extends OpenStackRequest { - - public Upload(String id, ImageUpload imageUpload) { - super(CLIENT, HttpMethod.PUT, new StringBuilder("/images/").append(id).toString(), - Entity.stream(imageUpload.getInputStream()), Image.class); - } - - public Upload(ImageUpload imageUpload) { - super(CLIENT, HttpMethod.POST, "/images", Entity.stream(imageUpload.getInputStream()), Image.class); - - for (Map.Entry entry : compose(imageUpload.getImage()).entrySet()) { - header(entry.getKey(), entry.getValue()); - } - - //file,s3,swift - header("x-image-meta-store", imageUpload.getStore()); - } - - } - - public class Download extends OpenStackRequest { - - public Download(String id) { - super(CLIENT, HttpMethod.GET, new StringBuilder("/images/").append(id).toString(), null, ImageDownload.class); - header("Accept", "application/octet-stream"); - } - - @Override - public ImageDownload execute() { - // custom parsing here - OpenStackResponse response = CLIENT.request(this); - ImageDownload imageDownload = new ImageDownload(); - imageDownload.setImage(parse(response.headers())); - imageDownload.setInputStream(response.getInputStream()); - return imageDownload; - } - - } - - public class ListMembers extends OpenStackRequest { - - public ListMembers(String id) { - super(CLIENT, HttpMethod.GET, new StringBuilder("/images/").append(id).append("/members").toString(), null, ImageMembers.class); - } - - } - - public class ReplaceMembers extends OpenStackRequest { - - public ReplaceMembers(String id, Collection members) { - super(CLIENT, HttpMethod.PUT, new StringBuilder("/images/").append(id).append("/members").toString(), Entity.json(new Memberships(members)), Void.class); - } - - } - - public class AddMember extends OpenStackRequest { - - public AddMember(String id, String tenantId) { - super(CLIENT, HttpMethod.PUT, new StringBuilder("/images/").append(id).append("/members").append(tenantId).toString(), null, ImageMember.class); - } - - } - - public class RemoveMember extends OpenStackRequest { - - public RemoveMember(String id, String tenantId) { - super(CLIENT, HttpMethod.DELETE, new StringBuilder("/images/").append(id).append("/members/").append(tenantId).toString(), null, Void.class); - } - - } - - public static Map compose(Image image) { - Map headers = new HashMap(); - - headers.put("X-Image-Meta-Name", image.getName()); - headers.put("X-Image-Meta-Disk_format", image.getDiskFormat()); - headers.put("X-Image-Meta-Container_format", image.getContainerFormat()); - headers.put("X-Image-Meta-Id", image.getId()); - headers.put("X-Image-Meta-Size", (image.getSize() != null) ? image.getSize().toString() : null); - headers.put("X-Image-Meta-Checksum", image.getChecksum()); - headers.put("X-Image-Meta-Is_public", String.valueOf(image.isPublic())); - headers.put("X-Image-Meta-Owner", image.getOwner()); - - for(String key : image.getProperties().keySet()) { - image.getProperties().put("x-image-meta-property-" + key, image.getProperties().get(key)); - } - - return headers; - } - - public static Image parse(Map headers) { - Image image = new Image(); - image.setId(headers.get("X-Image-Meta-Id")); - image.setUri(headers.get("Location")); - image.setName(headers.get("X-Image-Meta-Name")); - image.setDiskFormat(headers.get("X-Image-Meta-Disk_format")); - image.setContainerFormat(headers.get("X-Image-Meta-Container_format")); - image.setSize(asLong(headers.get("X-Image-Meta-Size"))); - image.setChecksum(headers.get("X-Image-Meta-Checksum")); - image.setCreatedAt(asCalendar(headers.get("X-Image-Meta-Created_at"))); - image.setUpdatedAt(asCalendar(headers.get("X-Image-Meta-Updated_at"))); - image.setDeletedAt(asCalendar(headers.get("X-Image-Meta-Deleted_at"))); - image.setDeleted(asBoolean(headers.get("X-Image-Meta-Deleted"))); - image.setStatus(headers.get("X-Image-Meta-Status")); - image.setProtected(asBoolean(headers.get("X-Image-Meta-Protected"))); - image.setPublic(asBoolean(headers.get("X-Image-Meta-Is_public"))); - image.setMinRam(asInteger(headers.get("X-Image-Meta-Min_ram"))); - image.setMinDisk(asInteger(headers.get("X-Image-Meta-Min_disk"))); - image.setOwner(headers.get("X-Image-Meta-Owner")); - for(String key : headers.keySet()) { - if(key.startsWith("x-image-meta-property-")) { - image.getProperties().put(key.substring(22), headers.get(key)); - } - } - return image; - } - - private static Calendar asCalendar(String calendarString) { - return Calendar.getInstance(); - } - - private static Integer asInteger(String integerString) { - if(integerString != null) { - return Integer.parseInt(integerString); - } - return 0; - } - - private static Boolean asBoolean(String booleanString) { - if(booleanString != null) { - return Boolean.parseBoolean(booleanString); - } - return Boolean.FALSE; - } - - private static Long asLong(String longString) { - if(longString != null) { - return Long.parseLong(longString); - } - return 0L; - } - - public static class Memberships { - - @JsonProperty("memberships") - private Collection memberships; - - public Memberships(Collection memberships) { - this.memberships = memberships; - } - - } - -} +package com.woorea.openstack.glance; + +import java.util.Calendar; +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.woorea.openstack.base.client.Entity; +import com.woorea.openstack.base.client.HttpMethod; +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.base.client.OpenStackRequest; +import com.woorea.openstack.base.client.OpenStackResponse; +import com.woorea.openstack.glance.model.Image; +import com.woorea.openstack.glance.model.ImageDownload; +import com.woorea.openstack.glance.model.ImageMember; +import com.woorea.openstack.glance.model.ImageMembers; +import com.woorea.openstack.glance.model.ImageUpload; +import com.woorea.openstack.glance.model.Images; + +public class ImagesResource { + + private final OpenStackClient CLIENT; + + public ImagesResource(OpenStackClient client) { + CLIENT = client; + } + + public List list(boolean detail) { + return new List(detail); + } + + public Create create(Image image) { + return new Create(image); + } + + public Show show(String id) { + return new Show(id); + } + + public Update update(String id, Image image) { + return new Update(id, image); + } + + public Delete delete(String id) { + return new Delete(id); + } + + public Upload upload(ImageUpload image) { + return new Upload(image); + } + + public Upload upload(String id, ImageUpload image) { + return new Upload(id, image); + } + + public Download download(String id) { + return new Download(id); + } + + public ListMembers listMembers(String id) { + return new ListMembers(id); + } + + public ReplaceMembers replaceMembers(String id, Collection members) { + return new ReplaceMembers(id, members); + } + + public AddMember addMember(String id, String tenantId) { + return new AddMember(id, tenantId); + } + + public AddMember removeMember(String id, String tenantId) { + return new AddMember(id, tenantId); + } + + public class List extends OpenStackRequest { + + public List(boolean detail) { + super(CLIENT, HttpMethod.GET, detail ? "/images/detail" : "images", null, Images.class); + } + + } + + public class Create extends OpenStackRequest { + + public Create(Image image) { + super(CLIENT, HttpMethod.POST, "/images", null, Image.class); + for (Map.Entry entry : compose(image).entrySet()) { + header(entry.getKey(), entry.getValue()); + } + } + + } + + public class Update extends OpenStackRequest { + + public Update(String id, Image image) { + super(CLIENT, HttpMethod.PUT, new StringBuilder("/images/").append(id).toString(), Entity.json(image), Image.class); + } + + } + + public class Delete extends OpenStackRequest { + + public Delete(String id) { + super(CLIENT, HttpMethod.DELETE, new StringBuilder("/images/").append(id).toString(), null, Void.class); + } + + } + + public class Show extends OpenStackRequest { + + public Show(String id) { + super(CLIENT, HttpMethod.HEAD, new StringBuilder("/images/").append(id).toString(), null, Image.class); + } + + @Override + public Image execute() { + // custom parsing here + return parse(CLIENT.request(this).headers()); + } + + } + + public class Upload extends OpenStackRequest { + + public Upload(String id, ImageUpload imageUpload) { + super(CLIENT, HttpMethod.PUT, new StringBuilder("/images/").append(id).toString(), + Entity.stream(imageUpload.getInputStream()), Image.class); + } + + public Upload(ImageUpload imageUpload) { + super(CLIENT, HttpMethod.POST, "/images", Entity.stream(imageUpload.getInputStream()), Image.class); + + for (Map.Entry entry : compose(imageUpload.getImage()).entrySet()) { + header(entry.getKey(), entry.getValue()); + } + + //file,s3,swift + header("x-image-meta-store", imageUpload.getStore()); + } + + } + + public class Download extends OpenStackRequest { + + public Download(String id) { + super(CLIENT, HttpMethod.GET, new StringBuilder("/images/").append(id).toString(), null, ImageDownload.class); + header("Accept", "application/octet-stream"); + } + + @Override + public ImageDownload execute() { + // custom parsing here + OpenStackResponse response = CLIENT.request(this); + ImageDownload imageDownload = new ImageDownload(); + imageDownload.setImage(parse(response.headers())); + imageDownload.setInputStream(response.getInputStream()); + return imageDownload; + } + + } + + public class ListMembers extends OpenStackRequest { + + public ListMembers(String id) { + super(CLIENT, HttpMethod.GET, new StringBuilder("/images/").append(id).append("/members").toString(), null, ImageMembers.class); + } + + } + + public class ReplaceMembers extends OpenStackRequest { + + public ReplaceMembers(String id, Collection members) { + super(CLIENT, HttpMethod.PUT, new StringBuilder("/images/").append(id).append("/members").toString(), Entity.json(new Memberships(members)), Void.class); + } + + } + + public class AddMember extends OpenStackRequest { + + public AddMember(String id, String tenantId) { + super(CLIENT, HttpMethod.PUT, new StringBuilder("/images/").append(id).append("/members").append(tenantId).toString(), null, ImageMember.class); + } + + } + + public class RemoveMember extends OpenStackRequest { + + public RemoveMember(String id, String tenantId) { + super(CLIENT, HttpMethod.DELETE, new StringBuilder("/images/").append(id).append("/members/").append(tenantId).toString(), null, Void.class); + } + + } + + public static Map compose(Image image) { + Map headers = new HashMap(); + + headers.put("X-Image-Meta-Name", image.getName()); + headers.put("X-Image-Meta-Disk_format", image.getDiskFormat()); + headers.put("X-Image-Meta-Container_format", image.getContainerFormat()); + headers.put("X-Image-Meta-Id", image.getId()); + headers.put("X-Image-Meta-Size", (image.getSize() != null) ? image.getSize().toString() : null); + headers.put("X-Image-Meta-Checksum", image.getChecksum()); + headers.put("X-Image-Meta-Is_public", String.valueOf(image.isPublic())); + headers.put("X-Image-Meta-Owner", image.getOwner()); + + for(String key : image.getProperties().keySet()) { + image.getProperties().put("x-image-meta-property-" + key, image.getProperties().get(key)); + } + + return headers; + } + + public static Image parse(Map headers) { + Image image = new Image(); + image.setId(headers.get("X-Image-Meta-Id")); + image.setUri(headers.get("Location")); + image.setName(headers.get("X-Image-Meta-Name")); + image.setDiskFormat(headers.get("X-Image-Meta-Disk_format")); + image.setContainerFormat(headers.get("X-Image-Meta-Container_format")); + image.setSize(asLong(headers.get("X-Image-Meta-Size"))); + image.setChecksum(headers.get("X-Image-Meta-Checksum")); + image.setCreatedAt(asCalendar(headers.get("X-Image-Meta-Created_at"))); + image.setUpdatedAt(asCalendar(headers.get("X-Image-Meta-Updated_at"))); + image.setDeletedAt(asCalendar(headers.get("X-Image-Meta-Deleted_at"))); + image.setDeleted(asBoolean(headers.get("X-Image-Meta-Deleted"))); + image.setStatus(headers.get("X-Image-Meta-Status")); + image.setProtected(asBoolean(headers.get("X-Image-Meta-Protected"))); + image.setPublic(asBoolean(headers.get("X-Image-Meta-Is_public"))); + image.setMinRam(asInteger(headers.get("X-Image-Meta-Min_ram"))); + image.setMinDisk(asInteger(headers.get("X-Image-Meta-Min_disk"))); + image.setOwner(headers.get("X-Image-Meta-Owner")); + for(String key : headers.keySet()) { + if(key.startsWith("x-image-meta-property-")) { + image.getProperties().put(key.substring(22), headers.get(key)); + } + } + return image; + } + + private static Calendar asCalendar(String calendarString) { + return Calendar.getInstance(); + } + + private static Integer asInteger(String integerString) { + if(integerString != null) { + return Integer.parseInt(integerString); + } + return 0; + } + + private static Boolean asBoolean(String booleanString) { + if(booleanString != null) { + return Boolean.parseBoolean(booleanString); + } + return Boolean.FALSE; + } + + private static Long asLong(String longString) { + if(longString != null) { + return Long.parseLong(longString); + } + return 0L; + } + + public static class Memberships { + + @JsonProperty("memberships") + private Collection memberships; + + public Memberships(Collection memberships) { + this.memberships = memberships; + } + + } + +} diff --git a/glance-client/src/main/java/com/woorea/openstack/glance/SharedImagesResource.java b/glance-client/src/main/java/com/woorea/openstack/glance/SharedImagesResource.java index a46155463..d280b4753 100644 --- a/glance-client/src/main/java/com/woorea/openstack/glance/SharedImagesResource.java +++ b/glance-client/src/main/java/com/woorea/openstack/glance/SharedImagesResource.java @@ -1,30 +1,29 @@ -package com.woorea.openstack.glance; - - -import com.woorea.openstack.base.client.HttpMethod; -import com.woorea.openstack.base.client.OpenStackClient; -import com.woorea.openstack.base.client.OpenStackRequest; -import com.woorea.openstack.glance.model.Images; -import com.woorea.openstack.glance.model.SharedImages; - -public class SharedImagesResource { - - private final OpenStackClient CLIENT; - - public SharedImagesResource(OpenStackClient client) { - CLIENT = client; - } - - public List list(String tenantId, boolean detail) { - return new List(tenantId, detail); - } - - public class List extends OpenStackRequest { - - public List(String tenantId, boolean detail) { - super(CLIENT, HttpMethod.GET, new StringBuffer(detail ? "/shared-images/detail" : "/shared-images/").append(tenantId).toString(), null, SharedImages.class); - } - - } - -} +package com.woorea.openstack.glance; + + +import com.woorea.openstack.base.client.HttpMethod; +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.base.client.OpenStackRequest; +import com.woorea.openstack.glance.model.SharedImages; + +public class SharedImagesResource { + + private final OpenStackClient CLIENT; + + public SharedImagesResource(OpenStackClient client) { + CLIENT = client; + } + + public List list(String tenantId, boolean detail) { + return new List(tenantId, detail); + } + + public class List extends OpenStackRequest { + + public List(String tenantId, boolean detail) { + super(CLIENT, HttpMethod.GET, new StringBuffer(detail ? "/shared-images/detail" : "/shared-images/").append(tenantId).toString(), null, SharedImages.class); + } + + } + +} diff --git a/glance-model/src/main/java/com/woorea/openstack/glance/model/Image.java b/glance-model/src/main/java/com/woorea/openstack/glance/model/Image.java index 491fde640..dab85ad05 100644 --- a/glance-model/src/main/java/com/woorea/openstack/glance/model/Image.java +++ b/glance-model/src/main/java/com/woorea/openstack/glance/model/Image.java @@ -1,324 +1,324 @@ -package com.woorea.openstack.glance.model; - -import java.io.Serializable; -import java.util.Calendar; -import java.util.HashMap; -import java.util.Map; - -import org.codehaus.jackson.annotate.JsonProperty; -import org.codehaus.jackson.map.annotate.JsonRootName; - -@JsonRootName("image") -public class Image implements Serializable { - - private String id; - - private String uri; - - private String name; - - @JsonProperty("disk_format") - private String diskFormat; - - @JsonProperty("container_format") - private String containerFormat; - - private Long size; - - private String checksum; - - @JsonProperty("created_at") - private Calendar createdAt; - - @JsonProperty("updated_at") - private Calendar updatedAt; - - @JsonProperty("deleted_at") - private Calendar deletedAt; - - private String status; - - @JsonProperty("is_public") - private boolean isPublic; - - @JsonProperty("min_ram") - private Integer minRam; - - @JsonProperty("min_disk") - private Integer minDisk; - - private String owner; - - @JsonProperty("deleted") - private boolean isDeleted; - - @JsonProperty("protected") - private boolean isProtected; - - private Map properties; - - /** - * @return the id - */ - public String getId() { - return id; - } - - /** - * @param id the id to set - */ - public void setId(String id) { - this.id = id; - } - - /** - * @return the uri - */ - public String getUri() { - return uri; - } - - /** - * @param uri the uri to set - */ - public void setUri(String uri) { - this.uri = uri; - } - - /** - * @return the name - */ - public String getName() { - return name; - } - - /** - * @param name the name to set - */ - public void setName(String name) { - this.name = name; - } - - /** - * @return the diskFormat - */ - public String getDiskFormat() { - return diskFormat; - } - - /** - * @param diskFormat the diskFormat to set - */ - public void setDiskFormat(String diskFormat) { - this.diskFormat = diskFormat; - } - - /** - * @return the containerFormat - */ - public String getContainerFormat() { - return containerFormat; - } - - /** - * @param containerFormat the containerFormat to set - */ - public void setContainerFormat(String containerFormat) { - this.containerFormat = containerFormat; - } - - /** - * @return the size - */ - public Long getSize() { - return size; - } - - /** - * @param size the size to set - */ - public void setSize(Long size) { - this.size = size; - } - - /** - * @return the checksum - */ - public String getChecksum() { - return checksum; - } - - /** - * @param checksum the checksum to set - */ - public void setChecksum(String checksum) { - this.checksum = checksum; - } - - /** - * @return the createdAt - */ - public Calendar getCreatedAt() { - return createdAt; - } - - /** - * @param createdAt the createdAt to set - */ - public void setCreatedAt(Calendar createdAt) { - this.createdAt = createdAt; - } - - /** - * @return the updatedAt - */ - public Calendar getUpdatedAt() { - return updatedAt; - } - - /** - * @param updatedAt the updatedAt to set - */ - public void setUpdatedAt(Calendar updatedAt) { - this.updatedAt = updatedAt; - } - - /** - * @return the deletedAt - */ - public Calendar getDeletedAt() { - return deletedAt; - } - - /** - * @param deletedAt the deletedAt to set - */ - public void setDeletedAt(Calendar deletedAt) { - this.deletedAt = deletedAt; - } - - /** - * @return the status - */ - public String getStatus() { - return status; - } - - /** - * @param status the status to set - */ - public void setStatus(String status) { - this.status = status; - } - - /** - * @return the isPublic - */ - public boolean isPublic() { - return isPublic; - } - - /** - * @param isPublic the isPublic to set - */ - public void setPublic(boolean isPublic) { - this.isPublic = isPublic; - } - - /** - * @return the minRam - */ - public Integer getMinRam() { - return minRam; - } - - /** - * @param minRam the minRam to set - */ - public void setMinRam(Integer minRam) { - this.minRam = minRam; - } - - /** - * @return the minDisk - */ - public Integer getMinDisk() { - return minDisk; - } - - /** - * @param minDisk the minDisk to set - */ - public void setMinDisk(Integer minDisk) { - this.minDisk = minDisk; - } - - /** - * @return the owner - */ - public String getOwner() { - return owner; - } - - /** - * @param owner the owner to set - */ - public void setOwner(String owner) { - this.owner = owner; - } - - /** - * @return the isDeleted - */ - public boolean isDeleted() { - return isDeleted; - } - - /** - * @param isDeleted the isDeleted to set - */ - public void setDeleted(boolean isDeleted) { - this.isDeleted = isDeleted; - } - - /** - * @return the isProtected - */ - public boolean isProtected() { - return isProtected; - } - - /** - * @param isProtected the isProtected to set - */ - public void setProtected(boolean isProtected) { - this.isProtected = isProtected; - } - - /** - * @return the properties - */ - public Map getProperties() { - if(properties == null) { - properties = new HashMap(); - } - return properties; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Image [id=" + id + ", uri=" + uri + ", name=" + name - + ", diskFormat=" + diskFormat + ", containerFormat=" - + containerFormat + ", size=" + size + ", checksum=" + checksum - + ", createdAt=" + createdAt + ", updatedAt=" + updatedAt - + ", deletedAt=" + deletedAt + ", status=" + status - + ", isPublic=" + isPublic + ", minRam=" + minRam - + ", minDisk=" + minDisk + ", owner=" + owner + ", isDeleted=" - + isDeleted + ", isProtected=" + isProtected + ", properties=" - + properties + "]"; - } - -} +package com.woorea.openstack.glance.model; + +import java.io.Serializable; +import java.util.Calendar; +import java.util.HashMap; +import java.util.Map; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName("image") +public class Image implements Serializable { + + private String id; + + private String uri; + + private String name; + + @JsonProperty("disk_format") + private String diskFormat; + + @JsonProperty("container_format") + private String containerFormat; + + private Long size; + + private String checksum; + + @JsonProperty("created_at") + private Calendar createdAt; + + @JsonProperty("updated_at") + private Calendar updatedAt; + + @JsonProperty("deleted_at") + private Calendar deletedAt; + + private String status; + + @JsonProperty("is_public") + private boolean isPublic; + + @JsonProperty("min_ram") + private Integer minRam; + + @JsonProperty("min_disk") + private Integer minDisk; + + private String owner; + + @JsonProperty("deleted") + private boolean isDeleted; + + @JsonProperty("protected") + private boolean isProtected; + + private Map properties; + + /** + * @return the id + */ + public String getId() { + return id; + } + + /** + * @param id the id to set + */ + public void setId(String id) { + this.id = id; + } + + /** + * @return the uri + */ + public String getUri() { + return uri; + } + + /** + * @param uri the uri to set + */ + public void setUri(String uri) { + this.uri = uri; + } + + /** + * @return the name + */ + public String getName() { + return name; + } + + /** + * @param name the name to set + */ + public void setName(String name) { + this.name = name; + } + + /** + * @return the diskFormat + */ + public String getDiskFormat() { + return diskFormat; + } + + /** + * @param diskFormat the diskFormat to set + */ + public void setDiskFormat(String diskFormat) { + this.diskFormat = diskFormat; + } + + /** + * @return the containerFormat + */ + public String getContainerFormat() { + return containerFormat; + } + + /** + * @param containerFormat the containerFormat to set + */ + public void setContainerFormat(String containerFormat) { + this.containerFormat = containerFormat; + } + + /** + * @return the size + */ + public Long getSize() { + return size; + } + + /** + * @param size the size to set + */ + public void setSize(Long size) { + this.size = size; + } + + /** + * @return the checksum + */ + public String getChecksum() { + return checksum; + } + + /** + * @param checksum the checksum to set + */ + public void setChecksum(String checksum) { + this.checksum = checksum; + } + + /** + * @return the createdAt + */ + public Calendar getCreatedAt() { + return createdAt; + } + + /** + * @param createdAt the createdAt to set + */ + public void setCreatedAt(Calendar createdAt) { + this.createdAt = createdAt; + } + + /** + * @return the updatedAt + */ + public Calendar getUpdatedAt() { + return updatedAt; + } + + /** + * @param updatedAt the updatedAt to set + */ + public void setUpdatedAt(Calendar updatedAt) { + this.updatedAt = updatedAt; + } + + /** + * @return the deletedAt + */ + public Calendar getDeletedAt() { + return deletedAt; + } + + /** + * @param deletedAt the deletedAt to set + */ + public void setDeletedAt(Calendar deletedAt) { + this.deletedAt = deletedAt; + } + + /** + * @return the status + */ + public String getStatus() { + return status; + } + + /** + * @param status the status to set + */ + public void setStatus(String status) { + this.status = status; + } + + /** + * @return the isPublic + */ + public boolean isPublic() { + return isPublic; + } + + /** + * @param isPublic the isPublic to set + */ + public void setPublic(boolean isPublic) { + this.isPublic = isPublic; + } + + /** + * @return the minRam + */ + public Integer getMinRam() { + return minRam; + } + + /** + * @param minRam the minRam to set + */ + public void setMinRam(Integer minRam) { + this.minRam = minRam; + } + + /** + * @return the minDisk + */ + public Integer getMinDisk() { + return minDisk; + } + + /** + * @param minDisk the minDisk to set + */ + public void setMinDisk(Integer minDisk) { + this.minDisk = minDisk; + } + + /** + * @return the owner + */ + public String getOwner() { + return owner; + } + + /** + * @param owner the owner to set + */ + public void setOwner(String owner) { + this.owner = owner; + } + + /** + * @return the isDeleted + */ + public boolean isDeleted() { + return isDeleted; + } + + /** + * @param isDeleted the isDeleted to set + */ + public void setDeleted(boolean isDeleted) { + this.isDeleted = isDeleted; + } + + /** + * @return the isProtected + */ + public boolean isProtected() { + return isProtected; + } + + /** + * @param isProtected the isProtected to set + */ + public void setProtected(boolean isProtected) { + this.isProtected = isProtected; + } + + /** + * @return the properties + */ + public Map getProperties() { + if(properties == null) { + properties = new HashMap(); + } + return properties; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Image [id=" + id + ", uri=" + uri + ", name=" + name + + ", diskFormat=" + diskFormat + ", containerFormat=" + + containerFormat + ", size=" + size + ", checksum=" + checksum + + ", createdAt=" + createdAt + ", updatedAt=" + updatedAt + + ", deletedAt=" + deletedAt + ", status=" + status + + ", isPublic=" + isPublic + ", minRam=" + minRam + + ", minDisk=" + minDisk + ", owner=" + owner + ", isDeleted=" + + isDeleted + ", isProtected=" + isProtected + ", properties=" + + properties + "]"; + } + +} diff --git a/glance-model/src/main/java/com/woorea/openstack/glance/model/ImageMember.java b/glance-model/src/main/java/com/woorea/openstack/glance/model/ImageMember.java index 4b8c3e753..0dd5e9e1b 100644 --- a/glance-model/src/main/java/com/woorea/openstack/glance/model/ImageMember.java +++ b/glance-model/src/main/java/com/woorea/openstack/glance/model/ImageMember.java @@ -1,52 +1,52 @@ -package com.woorea.openstack.glance.model; - -import java.io.Serializable; - -import org.codehaus.jackson.annotate.JsonProperty; - -public class ImageMember implements Serializable { - - @JsonProperty("can_share") - private boolean canShare; - - @JsonProperty("member_id") - private String memberId; - - public ImageMember() { - - } - - public ImageMember(boolean canShare, String memberId) { - this.canShare = canShare; - this.memberId = memberId; - } - - /** - * @return the canShare - */ - public boolean isCanShare() { - return canShare; - } - - /** - * @param canShare the canShare to set - */ - public void setCanShare(boolean canShare) { - this.canShare = canShare; - } - - /** - * @return the memberId - */ - public String getMemberId() { - return memberId; - } - - /** - * @param memberId the memberId to set - */ - public void setMemberId(String memberId) { - this.memberId = memberId; - } - -} +package com.woorea.openstack.glance.model; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class ImageMember implements Serializable { + + @JsonProperty("can_share") + private boolean canShare; + + @JsonProperty("member_id") + private String memberId; + + public ImageMember() { + + } + + public ImageMember(boolean canShare, String memberId) { + this.canShare = canShare; + this.memberId = memberId; + } + + /** + * @return the canShare + */ + public boolean isCanShare() { + return canShare; + } + + /** + * @param canShare the canShare to set + */ + public void setCanShare(boolean canShare) { + this.canShare = canShare; + } + + /** + * @return the memberId + */ + public String getMemberId() { + return memberId; + } + + /** + * @param memberId the memberId to set + */ + public void setMemberId(String memberId) { + this.memberId = memberId; + } + +} diff --git a/glance-model/src/main/java/com/woorea/openstack/glance/model/ImageMembers.java b/glance-model/src/main/java/com/woorea/openstack/glance/model/ImageMembers.java index 68aa17612..23218686d 100644 --- a/glance-model/src/main/java/com/woorea/openstack/glance/model/ImageMembers.java +++ b/glance-model/src/main/java/com/woorea/openstack/glance/model/ImageMembers.java @@ -1,26 +1,26 @@ -package com.woorea.openstack.glance.model; - -import java.io.Serializable; -import java.util.Iterator; -import java.util.List; - -import org.codehaus.jackson.annotate.JsonProperty; - -public class ImageMembers implements Iterable, Serializable { - - @JsonProperty("members") - private List list; - - /** - * @return the list - */ - public List getList() { - return list; - } - - @Override - public Iterator iterator() { - return list.iterator(); - } - +package com.woorea.openstack.glance.model; + +import java.io.Serializable; +import java.util.Iterator; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class ImageMembers implements Iterable, Serializable { + + @JsonProperty("members") + private List list; + + /** + * @return the list + */ + public List getList() { + return list; + } + + @Override + public Iterator iterator() { + return list.iterator(); + } + } \ No newline at end of file diff --git a/glance-model/src/main/java/com/woorea/openstack/glance/model/Images.java b/glance-model/src/main/java/com/woorea/openstack/glance/model/Images.java index af612ba1d..55dfc4636 100644 --- a/glance-model/src/main/java/com/woorea/openstack/glance/model/Images.java +++ b/glance-model/src/main/java/com/woorea/openstack/glance/model/Images.java @@ -1,26 +1,26 @@ -package com.woorea.openstack.glance.model; - -import java.io.Serializable; -import java.util.Iterator; -import java.util.List; - -import org.codehaus.jackson.annotate.JsonProperty; - -public class Images implements Iterable, Serializable { - - @JsonProperty("images") - private List list; - - /** - * @return the list - */ - public List getList() { - return list; - } - - @Override - public Iterator iterator() { - return list.iterator(); - } - -} +package com.woorea.openstack.glance.model; + +import java.io.Serializable; +import java.util.Iterator; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class Images implements Iterable, Serializable { + + @JsonProperty("images") + private List list; + + /** + * @return the list + */ + public List getList() { + return list; + } + + @Override + public Iterator iterator() { + return list.iterator(); + } + +} diff --git a/glance-model/src/main/java/com/woorea/openstack/glance/model/SharedImages.java b/glance-model/src/main/java/com/woorea/openstack/glance/model/SharedImages.java index 111d0942b..b218d1256 100644 --- a/glance-model/src/main/java/com/woorea/openstack/glance/model/SharedImages.java +++ b/glance-model/src/main/java/com/woorea/openstack/glance/model/SharedImages.java @@ -1,26 +1,26 @@ -package com.woorea.openstack.glance.model; - -import java.io.Serializable; -import java.util.Iterator; -import java.util.List; - -import org.codehaus.jackson.annotate.JsonProperty; - -public class SharedImages implements Iterable, Serializable { - - @JsonProperty("shared_images") - private List list; - - /** - * @return the list - */ - public List getList() { - return list; - } - - @Override - public Iterator iterator() { - return list.iterator(); - } - +package com.woorea.openstack.glance.model; + +import java.io.Serializable; +import java.util.Iterator; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class SharedImages implements Iterable, Serializable { + + @JsonProperty("shared_images") + private List list; + + /** + * @return the list + */ + public List getList() { + return list; + } + + @Override + public Iterator iterator() { + return list.iterator(); + } + } \ No newline at end of file diff --git a/heat-model/src/main/java/com/woorea/openstack/heat/model/CreateStackParam.java b/heat-model/src/main/java/com/woorea/openstack/heat/model/CreateStackParam.java index ebdddfa09..a34d34e86 100644 --- a/heat-model/src/main/java/com/woorea/openstack/heat/model/CreateStackParam.java +++ b/heat-model/src/main/java/com/woorea/openstack/heat/model/CreateStackParam.java @@ -1,100 +1,100 @@ -package com.woorea.openstack.heat.model; - -import org.codehaus.jackson.annotate.JsonProperty; - -import java.util.Map; - -public class CreateStackParam { - @JsonProperty("stack_name") - private String stackName; - - @JsonProperty("template_url") - private String templateUrl; - - @JsonProperty - private String template; - - @JsonProperty("parameters") - private Map parameters; - - @JsonProperty("timeout_mins") - private int timeoutMinutes; - - @JsonProperty("environment") - private String environment; - - public String getStackName() { - return stackName; - } - - public void setStackName(String stackName) { - this.stackName = stackName; - } - - public String getTemplateUrl() { - return templateUrl; - } - - /** - * The URL of the template to instantiate. This value is ignored if the template is supplied inline. - * - * @param templateUrl a template url. - */ - public void setTemplateUrl(String templateUrl) { - this.templateUrl = templateUrl; - } - - public Map getParameters() { - return parameters; - } - - public String getTemplate() { - return template; - } - - /** - * A JSON template to instantiate. This value takes precedence over the template URL if both are supplied. - * - * @param template a template json. - */ - public void setTemplate(String template) { - this.template = template; - } - - public void setParameters(Map parameters) { - this.parameters = parameters; - } - - public int getTimeoutMinutes() { - return timeoutMinutes; - } - - public void setTimeoutMinutes(int timeoutMinutes) { - this.timeoutMinutes = timeoutMinutes; - } - - public String getEnvironment() { - return environment; - } - - /** - * A JSON environment for the stack. - * - * @param environment a environment. - */ - public void setEnvironment(String environment) { - this.environment = environment; - } - - @Override - public String toString() { - return "CreateStackParam{" + - "stackName='" + stackName + '\'' + - ", templateUrl='" + templateUrl + '\'' + - ", template='" + template + '\'' + - ", parameters=" + parameters + - ", timeoutMinutes=" + timeoutMinutes + - ", environment='" + environment + '\'' + - '}'; - } -} +package com.woorea.openstack.heat.model; + +import java.util.Map; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class CreateStackParam { + @JsonProperty("stack_name") + private String stackName; + + @JsonProperty("template_url") + private String templateUrl; + + @JsonProperty + private String template; + + @JsonProperty("parameters") + private Map parameters; + + @JsonProperty("timeout_mins") + private int timeoutMinutes; + + @JsonProperty("environment") + private String environment; + + public String getStackName() { + return stackName; + } + + public void setStackName(String stackName) { + this.stackName = stackName; + } + + public String getTemplateUrl() { + return templateUrl; + } + + /** + * The URL of the template to instantiate. This value is ignored if the template is supplied inline. + * + * @param templateUrl a template url. + */ + public void setTemplateUrl(String templateUrl) { + this.templateUrl = templateUrl; + } + + public Map getParameters() { + return parameters; + } + + public String getTemplate() { + return template; + } + + /** + * A JSON template to instantiate. This value takes precedence over the template URL if both are supplied. + * + * @param template a template json. + */ + public void setTemplate(String template) { + this.template = template; + } + + public void setParameters(Map parameters) { + this.parameters = parameters; + } + + public int getTimeoutMinutes() { + return timeoutMinutes; + } + + public void setTimeoutMinutes(int timeoutMinutes) { + this.timeoutMinutes = timeoutMinutes; + } + + public String getEnvironment() { + return environment; + } + + /** + * A JSON environment for the stack. + * + * @param environment a environment. + */ + public void setEnvironment(String environment) { + this.environment = environment; + } + + @Override + public String toString() { + return "CreateStackParam{" + + "stackName='" + stackName + '\'' + + ", templateUrl='" + templateUrl + '\'' + + ", template='" + template + '\'' + + ", parameters=" + parameters + + ", timeoutMinutes=" + timeoutMinutes + + ", environment='" + environment + '\'' + + '}'; + } +} diff --git a/heat-model/src/main/java/com/woorea/openstack/heat/model/Explanation.java b/heat-model/src/main/java/com/woorea/openstack/heat/model/Explanation.java index 7e255643a..ae0bbdb07 100644 --- a/heat-model/src/main/java/com/woorea/openstack/heat/model/Explanation.java +++ b/heat-model/src/main/java/com/woorea/openstack/heat/model/Explanation.java @@ -1,28 +1,28 @@ -package com.woorea.openstack.heat.model; - -import org.codehaus.jackson.annotate.JsonProperty; -import org.codehaus.jackson.map.annotate.JsonRootName; - -@JsonRootName("error") -public class Explanation { - @JsonProperty("explanation") - private String explanation; - - @JsonProperty("code") - private int code; - - @JsonRootName("error") - public static class Error { - @JsonProperty("message") - private String message; - - @JsonProperty("traceback") - private String traceback; - - @JsonProperty("type") - private String type; - - @JsonProperty("title") - private String title; - } -} +package com.woorea.openstack.heat.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName("error") +public class Explanation { + @JsonProperty("explanation") + private String explanation; + + @JsonProperty("code") + private int code; + + @JsonRootName("error") + public static class Error { + @JsonProperty("message") + private String message; + + @JsonProperty("traceback") + private String traceback; + + @JsonProperty("type") + private String type; + + @JsonProperty("title") + private String title; + } +} diff --git a/heat-model/src/main/java/com/woorea/openstack/heat/model/Link.java b/heat-model/src/main/java/com/woorea/openstack/heat/model/Link.java index ec1970fd6..b5bf29516 100644 --- a/heat-model/src/main/java/com/woorea/openstack/heat/model/Link.java +++ b/heat-model/src/main/java/com/woorea/openstack/heat/model/Link.java @@ -1,35 +1,35 @@ -package com.woorea.openstack.heat.model; - -import org.codehaus.jackson.annotate.JsonProperty; - -public class Link { - @JsonProperty("href") - private String href; - - @JsonProperty("rel") - private String rel; - - public String getHref() { - return href; - } - - public void setHref(String href) { - this.href = href; - } - - public String getRel() { - return rel; - } - - public void setRel(String rel) { - this.rel = rel; - } - - @Override - public String toString() { - return "Link{" + - "href='" + href + '\'' + - ", rel='" + rel + '\'' + - '}'; - } -} +package com.woorea.openstack.heat.model; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class Link { + @JsonProperty("href") + private String href; + + @JsonProperty("rel") + private String rel; + + public String getHref() { + return href; + } + + public void setHref(String href) { + this.href = href; + } + + public String getRel() { + return rel; + } + + public void setRel(String rel) { + this.rel = rel; + } + + @Override + public String toString() { + return "Link{" + + "href='" + href + '\'' + + ", rel='" + rel + '\'' + + '}'; + } +} diff --git a/heat-model/src/main/java/com/woorea/openstack/heat/model/Resource.java b/heat-model/src/main/java/com/woorea/openstack/heat/model/Resource.java index 159bbcda2..df2d96480 100644 --- a/heat-model/src/main/java/com/woorea/openstack/heat/model/Resource.java +++ b/heat-model/src/main/java/com/woorea/openstack/heat/model/Resource.java @@ -1,122 +1,122 @@ -package com.woorea.openstack.heat.model; - -import org.codehaus.jackson.annotate.JsonProperty; - -import java.util.Date; -import java.util.List; - -public class Resource { - @JsonProperty("resource_name") - private String name; - - @JsonProperty("links") - private List links; - - @JsonProperty("resource_status") - private String status; - - @JsonProperty("physical_resource_id") - private String physicalResourceId; - - @JsonProperty("logical_resource_id") - private String logicalResourceId; - - @JsonProperty("required_by") - private List requiredBy; - - @JsonProperty("updated_time") - private Date updatedTime; - - @JsonProperty("resource_type") - private String type; - - @JsonProperty("resource_status_reason") - private String statusReason; - - public String getStatusReason() { - return statusReason; - } - - public void setStatusReason(String statusReason) { - this.statusReason = statusReason; - } - - public String getLogicalResourceId() { - return logicalResourceId; - } - - public void setLogicalResourceId(String logicalResourceId) { - this.logicalResourceId = logicalResourceId; - } - - public String getStatus() { - return status; - } - - public void setStatus(String status) { - this.status = status; - } - - public String getPhysicalResourceId() { - return physicalResourceId; - } - - public void setPhysicalResourceId(String physicalResourceId) { - this.physicalResourceId = physicalResourceId; - } - - public List getRequiredBy() { - return requiredBy; - } - - public void setRequiredBy(List requiredBy) { - this.requiredBy = requiredBy; - } - - public Date getUpdatedTime() { - return updatedTime; - } - - public void setUpdatedTime(Date updatedTime) { - this.updatedTime = updatedTime; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public List getLinks() { - return links; - } - - public void setLinks(List links) { - this.links = links; - } - - @Override - public String toString() { - return "Resource{" + - "name='" + name + '\'' + - ", links=" + links + - ", status='" + status + '\'' + - ", physicalResourceId='" + physicalResourceId + '\'' + - ", logicalResourceId='" + logicalResourceId + '\'' + - ", requiredBy=" + requiredBy + - ", updatedTime=" + updatedTime + - ", type='" + type + '\'' + - ", statusReason='" + statusReason + '\'' + - '}'; - } -} +package com.woorea.openstack.heat.model; + +import java.util.Date; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class Resource { + @JsonProperty("resource_name") + private String name; + + @JsonProperty("links") + private List links; + + @JsonProperty("resource_status") + private String status; + + @JsonProperty("physical_resource_id") + private String physicalResourceId; + + @JsonProperty("logical_resource_id") + private String logicalResourceId; + + @JsonProperty("required_by") + private List requiredBy; + + @JsonProperty("updated_time") + private Date updatedTime; + + @JsonProperty("resource_type") + private String type; + + @JsonProperty("resource_status_reason") + private String statusReason; + + public String getStatusReason() { + return statusReason; + } + + public void setStatusReason(String statusReason) { + this.statusReason = statusReason; + } + + public String getLogicalResourceId() { + return logicalResourceId; + } + + public void setLogicalResourceId(String logicalResourceId) { + this.logicalResourceId = logicalResourceId; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getPhysicalResourceId() { + return physicalResourceId; + } + + public void setPhysicalResourceId(String physicalResourceId) { + this.physicalResourceId = physicalResourceId; + } + + public List getRequiredBy() { + return requiredBy; + } + + public void setRequiredBy(List requiredBy) { + this.requiredBy = requiredBy; + } + + public Date getUpdatedTime() { + return updatedTime; + } + + public void setUpdatedTime(Date updatedTime) { + this.updatedTime = updatedTime; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public List getLinks() { + return links; + } + + public void setLinks(List links) { + this.links = links; + } + + @Override + public String toString() { + return "Resource{" + + "name='" + name + '\'' + + ", links=" + links + + ", status='" + status + '\'' + + ", physicalResourceId='" + physicalResourceId + '\'' + + ", logicalResourceId='" + logicalResourceId + '\'' + + ", requiredBy=" + requiredBy + + ", updatedTime=" + updatedTime + + ", type='" + type + '\'' + + ", statusReason='" + statusReason + '\'' + + '}'; + } +} diff --git a/heat-model/src/main/java/com/woorea/openstack/heat/model/Resources.java b/heat-model/src/main/java/com/woorea/openstack/heat/model/Resources.java index 068c5e08c..e026456b5 100644 --- a/heat-model/src/main/java/com/woorea/openstack/heat/model/Resources.java +++ b/heat-model/src/main/java/com/woorea/openstack/heat/model/Resources.java @@ -1,28 +1,28 @@ -package com.woorea.openstack.heat.model; - -import org.codehaus.jackson.annotate.JsonProperty; - -import java.io.Serializable; -import java.util.Iterator; -import java.util.List; - -public class Resources implements Iterable, Serializable { - @JsonProperty("resources") - private List list; - - public List getList() { - return list; - } - - @Override - public Iterator iterator() { - return list.iterator(); - } - - @Override - public String toString() { - return "Resources{" + - "list=" + list + - '}'; - } +package com.woorea.openstack.heat.model; + +import java.io.Serializable; +import java.util.Iterator; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class Resources implements Iterable, Serializable { + @JsonProperty("resources") + private List list; + + public List getList() { + return list; + } + + @Override + public Iterator iterator() { + return list.iterator(); + } + + @Override + public String toString() { + return "Resources{" + + "list=" + list + + '}'; + } } \ No newline at end of file diff --git a/heat-model/src/main/java/com/woorea/openstack/heat/model/Stack.java b/heat-model/src/main/java/com/woorea/openstack/heat/model/Stack.java index 9ed8f245c..ac66dcc60 100644 --- a/heat-model/src/main/java/com/woorea/openstack/heat/model/Stack.java +++ b/heat-model/src/main/java/com/woorea/openstack/heat/model/Stack.java @@ -1,115 +1,115 @@ -package com.woorea.openstack.heat.model; - -import org.codehaus.jackson.annotate.JsonIgnoreProperties; -import org.codehaus.jackson.annotate.JsonProperty; -import org.codehaus.jackson.map.annotate.JsonRootName; - -import java.util.Date; -import java.util.List; - -@JsonIgnoreProperties(ignoreUnknown = true) -@JsonRootName("stack") -public class Stack { - @JsonProperty("description") - private String description; - - @JsonProperty("links") - private List links; - - @JsonProperty("stack_status_reason") - private String stackStatusReason; - - @JsonProperty("stack_name") - private String stackName; - - @JsonProperty("updated_time") - private Date updatedTime; - - @JsonProperty("creation_time") - private Date creationTime; - - @JsonProperty("stack_status") - private String stackStatus; - - @JsonProperty("id") - private String id; - - public Date getUpdatedTime() { - return updatedTime; - } - - public void setUpdatedTime(Date updatedTime) { - this.updatedTime = updatedTime; - } - - public String getStackStatus() { - return stackStatus; - } - - public void setStackStatus(String stackStatus) { - this.stackStatus = stackStatus; - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public Date getCreationTime() { - return creationTime; - } - - public void setCreationTime(Date creationTime) { - this.creationTime = creationTime; - } - - public String getStackName() { - return stackName; - } - - public void setStackName(String stackName) { - this.stackName = stackName; - } - - public String getStackStatusReason() { - return stackStatusReason; - } - - public void setStackStatusReason(String stackStatusReason) { - this.stackStatusReason = stackStatusReason; - } - - public List getLinks() { - return links; - } - - public void setLinks(List links) { - this.links = links; - } - - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - @Override - public String toString() { - return "Stack{" + - "description='" + description + '\'' + - ", links=" + links + - ", stackStatusReason='" + stackStatusReason + '\'' + - ", stackName='" + stackName + '\'' + - ", updatedTime=" + updatedTime + - ", creationTime=" + creationTime + - ", stackStatus='" + stackStatus + '\'' + - ", id='" + id + '\'' + - '}'; - } -} +package com.woorea.openstack.heat.model; + +import java.util.Date; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonIgnoreProperties(ignoreUnknown = true) +@JsonRootName("stack") +public class Stack { + @JsonProperty("description") + private String description; + + @JsonProperty("links") + private List links; + + @JsonProperty("stack_status_reason") + private String stackStatusReason; + + @JsonProperty("stack_name") + private String stackName; + + @JsonProperty("updated_time") + private Date updatedTime; + + @JsonProperty("creation_time") + private Date creationTime; + + @JsonProperty("stack_status") + private String stackStatus; + + @JsonProperty("id") + private String id; + + public Date getUpdatedTime() { + return updatedTime; + } + + public void setUpdatedTime(Date updatedTime) { + this.updatedTime = updatedTime; + } + + public String getStackStatus() { + return stackStatus; + } + + public void setStackStatus(String stackStatus) { + this.stackStatus = stackStatus; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public Date getCreationTime() { + return creationTime; + } + + public void setCreationTime(Date creationTime) { + this.creationTime = creationTime; + } + + public String getStackName() { + return stackName; + } + + public void setStackName(String stackName) { + this.stackName = stackName; + } + + public String getStackStatusReason() { + return stackStatusReason; + } + + public void setStackStatusReason(String stackStatusReason) { + this.stackStatusReason = stackStatusReason; + } + + public List getLinks() { + return links; + } + + public void setLinks(List links) { + this.links = links; + } + + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + @Override + public String toString() { + return "Stack{" + + "description='" + description + '\'' + + ", links=" + links + + ", stackStatusReason='" + stackStatusReason + '\'' + + ", stackName='" + stackName + '\'' + + ", updatedTime=" + updatedTime + + ", creationTime=" + creationTime + + ", stackStatus='" + stackStatus + '\'' + + ", id='" + id + '\'' + + '}'; + } +} diff --git a/heat-model/src/main/java/com/woorea/openstack/heat/model/Stacks.java b/heat-model/src/main/java/com/woorea/openstack/heat/model/Stacks.java index 6f174aa1b..c53b4c4a5 100644 --- a/heat-model/src/main/java/com/woorea/openstack/heat/model/Stacks.java +++ b/heat-model/src/main/java/com/woorea/openstack/heat/model/Stacks.java @@ -1,17 +1,17 @@ -package com.woorea.openstack.heat.model; - -import org.codehaus.jackson.annotate.JsonProperty; - -import java.io.Serializable; -import java.util.Iterator; -import java.util.List; - -public class Stacks implements Iterable, Serializable { - @JsonProperty("stacks") - private List list; - - @Override - public Iterator iterator() { - return list.iterator(); - } -} +package com.woorea.openstack.heat.model; + +import java.io.Serializable; +import java.util.Iterator; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class Stacks implements Iterable, Serializable { + @JsonProperty("stacks") + private List list; + + @Override + public Iterator iterator() { + return list.iterator(); + } +} diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/Keystone.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/Keystone.java index 38d42f001..670cb4d4a 100644 --- a/keystone-client/src/main/java/com/woorea/openstack/keystone/Keystone.java +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/Keystone.java @@ -1,65 +1,64 @@ -package com.woorea.openstack.keystone; - -import com.woorea.openstack.keystone.api.EndpointsResource; -import com.woorea.openstack.keystone.api.RolesResource; -import com.woorea.openstack.keystone.api.ServicesResource; -import com.woorea.openstack.keystone.api.TenantsResource; -import com.woorea.openstack.keystone.api.TokensResource; -import com.woorea.openstack.keystone.api.UsersResource; - -import com.woorea.openstack.base.client.OpenStackClient; -import com.woorea.openstack.base.client.OpenStackClientConnector; - -public class Keystone extends OpenStackClient { - - private final TokensResource TOKENS; - - private final TenantsResource TENANTS; - - private final UsersResource USERS; - - private final RolesResource ROLES; - - private final ServicesResource SERVICES; - - private final EndpointsResource ENDPOINTS; - - public Keystone(String endpoint, OpenStackClientConnector connector) { - super(endpoint, connector); - TOKENS = new TokensResource(this); - TENANTS = new TenantsResource(this); - USERS = new UsersResource(this); - ROLES = new RolesResource(this); - SERVICES = new ServicesResource(this); - ENDPOINTS = new EndpointsResource(this); - } - - public Keystone(String endpoint) { - this(endpoint, null); - } - - public TokensResource tokens() { - return TOKENS; - } - - public TenantsResource tenants() { - return TENANTS; - } - - public UsersResource users() { - return USERS; - } - - public RolesResource roles() { - return ROLES; - } - - public ServicesResource services() { - return SERVICES; - } - - public EndpointsResource endpoints() { - return ENDPOINTS; - } - -} +package com.woorea.openstack.keystone; + +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.base.client.OpenStackClientConnector; +import com.woorea.openstack.keystone.api.EndpointsResource; +import com.woorea.openstack.keystone.api.RolesResource; +import com.woorea.openstack.keystone.api.ServicesResource; +import com.woorea.openstack.keystone.api.TenantsResource; +import com.woorea.openstack.keystone.api.TokensResource; +import com.woorea.openstack.keystone.api.UsersResource; + +public class Keystone extends OpenStackClient { + + private final TokensResource TOKENS; + + private final TenantsResource TENANTS; + + private final UsersResource USERS; + + private final RolesResource ROLES; + + private final ServicesResource SERVICES; + + private final EndpointsResource ENDPOINTS; + + public Keystone(String endpoint, OpenStackClientConnector connector) { + super(endpoint, connector); + TOKENS = new TokensResource(this); + TENANTS = new TenantsResource(this); + USERS = new UsersResource(this); + ROLES = new RolesResource(this); + SERVICES = new ServicesResource(this); + ENDPOINTS = new EndpointsResource(this); + } + + public Keystone(String endpoint) { + this(endpoint, null); + } + + public TokensResource tokens() { + return TOKENS; + } + + public TenantsResource tenants() { + return TENANTS; + } + + public UsersResource users() { + return USERS; + } + + public RolesResource roles() { + return ROLES; + } + + public ServicesResource services() { + return SERVICES; + } + + public EndpointsResource endpoints() { + return ENDPOINTS; + } + +} diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/api/UsersResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/api/UsersResource.java index dbb897cf5..735dcead2 100644 --- a/keystone-client/src/main/java/com/woorea/openstack/keystone/api/UsersResource.java +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/api/UsersResource.java @@ -1,5 +1,7 @@ package com.woorea.openstack.keystone.api; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; import com.woorea.openstack.base.client.Entity; import com.woorea.openstack.base.client.HttpMethod; @@ -8,78 +10,88 @@ import com.woorea.openstack.keystone.model.User; import com.woorea.openstack.keystone.model.Users; + + public class UsersResource { - - private OpenStackClient client; - - public UsersResource(OpenStackClient client) { - this.client = client; - } - - public List list() { - return new List(); - } - - public Create create(User user) { - return new Create(user); - } - - public Show show(String id) { - return new Show(id); - } - - public Update update(String id, User user) { - return new Update(id, user); - } - - public Delete delete(String id) { - return new Delete(id); - } - - public class List extends OpenStackRequest { - - public List() { - super(client, HttpMethod.GET, "/users", null, Users.class); - } - - } - - public class Create extends OpenStackRequest { - - private User user; - - public Create(User user) { - super(client, HttpMethod.POST, "/users", Entity.json(user), User.class); - this.user = user; - } - - } - - public class Show extends OpenStackRequest { - - public Show(String id) { - super(client, HttpMethod.GET, new StringBuilder("/users/").append(id).toString(), null, User.class); - } - - } - - public class Update extends OpenStackRequest { - - private User user; - - public Update(String id, User user) { - super(client, HttpMethod.PUT, new StringBuilder("/users/").append(id).toString(), Entity.json(user), User.class); - this.user = user; - } - - } - - public class Delete extends OpenStackRequest { - - public Delete(String id) { - super(client, HttpMethod.DELETE, new StringBuilder("/users/").append(id).toString(), null, Void.class); - } - - } - + private OpenStackClient client; + + public UsersResource(OpenStackClient client) { + this.client = client; + } + + public List list() { + return new List(); + } + + public Create create(User user) { + return new Create(user); + } + + public Show show(String id) { + return new Show(id); + } + + public Find find(String username) { + return new Find(username); + } + + public Update update(String id, User user) { + return new Update(id, user); + } + + public Delete delete(String id) { + return new Delete(id); + } + + public class List extends OpenStackRequest { + public List() { + super(client, HttpMethod.GET, "/users", null, Users.class); + } + } + + public class Create extends OpenStackRequest { + public Create(User user) { + super(client, HttpMethod.POST, "/users/", Entity.json(user), + User.class); + } + } + public class Show extends OpenStackRequest { + public Show(String id) { + super(client, HttpMethod.GET, + new StringBuilder("/users/").append(id).toString(), null, + User.class); + } + } + + public class Find extends OpenStackRequest { + public Find(String username) { + super(client, HttpMethod.GET, new StringBuilder("/users/"), null, + User.class); + + try { + this.queryParam("name", URLEncoder.encode(username, "UTF-8")); + } catch (UnsupportedEncodingException e) { + //ignore + } + } + } + + public class Update extends OpenStackRequest { + private User user; + + public Update(String id, User user) { + super(client, HttpMethod.PUT, + new StringBuilder("/users/").append(id).toString(), + Entity.json(user), User.class); + this.user = user; + } + } + + public class Delete extends OpenStackRequest { + public Delete(String id) { + super(client, HttpMethod.DELETE, + new StringBuilder("/users/").append(id).toString(), null, + Void.class); + } + } } diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/Keystone.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/Keystone.java index 6ff889cb5..fe6383c7a 100644 --- a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/Keystone.java +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/Keystone.java @@ -1,73 +1,73 @@ -package com.woorea.openstack.keystone.v3; - -import com.woorea.openstack.keystone.v3.api.DomainsResource; -import com.woorea.openstack.keystone.v3.api.EndpointsResource; -import com.woorea.openstack.keystone.v3.api.RolesResource; -import com.woorea.openstack.keystone.v3.api.ServicesResource; -import com.woorea.openstack.keystone.v3.api.ProjectsResource; -import com.woorea.openstack.keystone.v3.api.TokensResource; -import com.woorea.openstack.keystone.v3.api.UsersResource; -import com.woorea.openstack.base.client.OpenStackClient; -import com.woorea.openstack.base.client.OpenStackClientConnector; - -public class Keystone extends OpenStackClient { - - private final TokensResource TOKENS; - - private final DomainsResource DOMAINS; - - private final ProjectsResource PROJECTS; - - private final UsersResource USERS; - - private final RolesResource ROLES; - - private final ServicesResource SERVICES; - - private final EndpointsResource ENDPOINTS; - - public Keystone(String endpoint, OpenStackClientConnector connector) { - super(endpoint, connector); - TOKENS = new TokensResource(this); - DOMAINS = new DomainsResource(this); - PROJECTS = new ProjectsResource(this); - USERS = new UsersResource(this); - ROLES = new RolesResource(this); - SERVICES = new ServicesResource(this); - ENDPOINTS = new EndpointsResource(this); - } - - public Keystone(String endpoint) { - this(endpoint, null); - } - - public TokensResource tokens() { - return TOKENS; - } - - public DomainsResource domains() { - return DOMAINS; - } - - public ProjectsResource projects() { - return PROJECTS; - } - - public UsersResource users() { - return USERS; - } - - public RolesResource roles() { - return ROLES; - } - - public ServicesResource services() { - return SERVICES; - } - - public EndpointsResource endpoints() { - return ENDPOINTS; - } - -} - +package com.woorea.openstack.keystone.v3; + +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.base.client.OpenStackClientConnector; +import com.woorea.openstack.keystone.v3.api.DomainsResource; +import com.woorea.openstack.keystone.v3.api.EndpointsResource; +import com.woorea.openstack.keystone.v3.api.ProjectsResource; +import com.woorea.openstack.keystone.v3.api.RolesResource; +import com.woorea.openstack.keystone.v3.api.ServicesResource; +import com.woorea.openstack.keystone.v3.api.TokensResource; +import com.woorea.openstack.keystone.v3.api.UsersResource; + +public class Keystone extends OpenStackClient { + + private final TokensResource TOKENS; + + private final DomainsResource DOMAINS; + + private final ProjectsResource PROJECTS; + + private final UsersResource USERS; + + private final RolesResource ROLES; + + private final ServicesResource SERVICES; + + private final EndpointsResource ENDPOINTS; + + public Keystone(String endpoint, OpenStackClientConnector connector) { + super(endpoint, connector); + TOKENS = new TokensResource(this); + DOMAINS = new DomainsResource(this); + PROJECTS = new ProjectsResource(this); + USERS = new UsersResource(this); + ROLES = new RolesResource(this); + SERVICES = new ServicesResource(this); + ENDPOINTS = new EndpointsResource(this); + } + + public Keystone(String endpoint) { + this(endpoint, null); + } + + public TokensResource tokens() { + return TOKENS; + } + + public DomainsResource domains() { + return DOMAINS; + } + + public ProjectsResource projects() { + return PROJECTS; + } + + public UsersResource users() { + return USERS; + } + + public RolesResource roles() { + return ROLES; + } + + public ServicesResource services() { + return SERVICES; + } + + public EndpointsResource endpoints() { + return ENDPOINTS; + } + +} + diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/PoliciesResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/PoliciesResource.java index ba16a4657..56aa7fb5d 100644 --- a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/PoliciesResource.java +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/PoliciesResource.java @@ -1,15 +1,13 @@ -package com.woorea.openstack.keystone.v3.api; - -import com.woorea.openstack.base.client.OpenStackClient; -import com.woorea.openstack.keystone.model.Role; -import com.woorea.openstack.keystone.model.Roles; -import com.woorea.openstack.keystone.v3.model.Policies; -import com.woorea.openstack.keystone.v3.model.Policy; - -public class PoliciesResource extends GenericResource { - - public PoliciesResource(OpenStackClient client) { - super(client, "/policies", Policy.class, Policies.class); - } - -} +package com.woorea.openstack.keystone.v3.api; + +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.keystone.v3.model.Policies; +import com.woorea.openstack.keystone.v3.model.Policy; + +public class PoliciesResource extends GenericResource { + + public PoliciesResource(OpenStackClient client) { + super(client, "/policies", Policy.class, Policies.class); + } + +} diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Access.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Access.java index a7968ff44..385d6962e 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Access.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Access.java @@ -1,252 +1,252 @@ -package com.woorea.openstack.keystone.model; - -import java.io.Serializable; -import java.util.List; -import java.util.Map; - -import org.codehaus.jackson.annotate.JsonIgnoreProperties; -import org.codehaus.jackson.annotate.JsonProperty; -import org.codehaus.jackson.map.annotate.JsonRootName; - -@JsonRootName("access") -public class Access implements Serializable { - - public static final class Service { - - @JsonIgnoreProperties(ignoreUnknown=true) - public static final class Endpoint { - - private String region; - - private String publicURL; - - private String internalURL; - - private String adminURL; - - /** - * @return the region - */ - public String getRegion() { - return region; - } - - /** - * @return the publicURL - */ - public String getPublicURL() { - return publicURL; - } - - /** - * @return the internalURL - */ - public String getInternalURL() { - return internalURL; - } - - /** - * @return the adminURL - */ - public String getAdminURL() { - return adminURL; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Endpoint [region=" + region + ", publicURL=" - + publicURL + ", internalURL=" + internalURL - + ", adminURL=" + adminURL + "]"; - } - - } - - private String type; - - private String name; - - private List endpoints; - - @JsonProperty("endpoints_links") - private List endpointsLinks; - - /** - * @return the type - */ - public String getType() { - return type; - } - - /** - * @return the name - */ - public String getName() { - return name; - } - - /** - * @return the endpoints - */ - public List getEndpoints() { - return endpoints; - } - - /** - * @return the endpointsLinks - */ - public List getEndpointsLinks() { - return endpointsLinks; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Service [type=" + type + ", name=" + name + ", endpoints=" - + endpoints + ", endpointsLinks=" + endpointsLinks + "]"; - } - - } - - @JsonIgnoreProperties(ignoreUnknown=true) - public static final class User { - - @JsonIgnoreProperties(ignoreUnknown=true) - public static final class Role { - - private String id; - - private String name; - - /** - * @return the id - */ - public String getId() { - return id; - } - - /** - * @return the name - */ - public String getName() { - return name; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Role [id=" + id + ", name=" + name + "]"; - } - - } - - private String id; - - private String name; - - private String username; - - private List roles; - - @JsonProperty("roles_links") - private List rolesLinks; - - /** - * @return the id - */ - public String getId() { - return id; - } - - /** - * @return the name - */ - public String getName() { - return name; - } - - /** - * @return the username - */ - public String getUsername() { - return username; - } - - /** - * @return the roles - */ - public List getRoles() { - return roles; - } - - /** - * @return the rolesLinks - */ - public List getRolesLinks() { - return rolesLinks; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "User [id=" + id + ", name=" + name + ", username=" - + username + ", roles=" + roles + ", rolesLinks=" - + rolesLinks + "]"; - } - - } - - private Token token; - - private List serviceCatalog; - - private User user; - - private Map metadata; - - /** - * @return the token - */ - public Token getToken() { - return token; - } - - /** - * @return the serviceCatalog - */ - public List getServiceCatalog() { - return serviceCatalog; - } - - /** - * @return the user - */ - public User getUser() { - return user; - } - - /** - * @return the metadata - */ - public Map getMetadata() { - return metadata; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Access [token=" + token + ", serviceCatalog=" + serviceCatalog - + ", user=" + user + ", metadata=" + metadata + "]"; - } - -} +package com.woorea.openstack.keystone.model; + +import java.io.Serializable; +import java.util.List; +import java.util.Map; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName("access") +public class Access implements Serializable { + + public static final class Service { + + @JsonIgnoreProperties(ignoreUnknown=true) + public static final class Endpoint { + + private String region; + + private String publicURL; + + private String internalURL; + + private String adminURL; + + /** + * @return the region + */ + public String getRegion() { + return region; + } + + /** + * @return the publicURL + */ + public String getPublicURL() { + return publicURL; + } + + /** + * @return the internalURL + */ + public String getInternalURL() { + return internalURL; + } + + /** + * @return the adminURL + */ + public String getAdminURL() { + return adminURL; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Endpoint [region=" + region + ", publicURL=" + + publicURL + ", internalURL=" + internalURL + + ", adminURL=" + adminURL + "]"; + } + + } + + private String type; + + private String name; + + private List endpoints; + + @JsonProperty("endpoints_links") + private List endpointsLinks; + + /** + * @return the type + */ + public String getType() { + return type; + } + + /** + * @return the name + */ + public String getName() { + return name; + } + + /** + * @return the endpoints + */ + public List getEndpoints() { + return endpoints; + } + + /** + * @return the endpointsLinks + */ + public List getEndpointsLinks() { + return endpointsLinks; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Service [type=" + type + ", name=" + name + ", endpoints=" + + endpoints + ", endpointsLinks=" + endpointsLinks + "]"; + } + + } + + @JsonIgnoreProperties(ignoreUnknown=true) + public static final class User { + + @JsonIgnoreProperties(ignoreUnknown=true) + public static final class Role { + + private String id; + + private String name; + + /** + * @return the id + */ + public String getId() { + return id; + } + + /** + * @return the name + */ + public String getName() { + return name; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Role [id=" + id + ", name=" + name + "]"; + } + + } + + private String id; + + private String name; + + private String username; + + private List roles; + + @JsonProperty("roles_links") + private List rolesLinks; + + /** + * @return the id + */ + public String getId() { + return id; + } + + /** + * @return the name + */ + public String getName() { + return name; + } + + /** + * @return the username + */ + public String getUsername() { + return username; + } + + /** + * @return the roles + */ + public List getRoles() { + return roles; + } + + /** + * @return the rolesLinks + */ + public List getRolesLinks() { + return rolesLinks; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "User [id=" + id + ", name=" + name + ", username=" + + username + ", roles=" + roles + ", rolesLinks=" + + rolesLinks + "]"; + } + + } + + private Token token; + + private List serviceCatalog; + + private User user; + + private Map metadata; + + /** + * @return the token + */ + public Token getToken() { + return token; + } + + /** + * @return the serviceCatalog + */ + public List getServiceCatalog() { + return serviceCatalog; + } + + /** + * @return the user + */ + public User getUser() { + return user; + } + + /** + * @return the metadata + */ + public Map getMetadata() { + return metadata; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Access [token=" + token + ", serviceCatalog=" + serviceCatalog + + ", user=" + user + ", metadata=" + metadata + "]"; + } + +} diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Authentication.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Authentication.java index f5c8f5c9d..95daeac53 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Authentication.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Authentication.java @@ -1,41 +1,39 @@ -package com.woorea.openstack.keystone.model; - -import java.io.Serializable; - -import org.codehaus.jackson.map.annotate.JsonRootName; - -public abstract class Authentication implements Serializable { - - private String tenantId; - - private String tenantName; - - /** - * @return the tenantId - */ - public String getTenantId() { - return tenantId; - } - - /** - * @param tenantId the tenantId to set - */ - public void setTenantId(String tenantId) { - this.tenantId = tenantId; - } - - /** - * @return the tenantName - */ - public String getTenantName() { - return tenantName; - } - - /** - * @param tenantName the tenantName to set - */ - public void setTenantName(String tenantName) { - this.tenantName = tenantName; - } - -} +package com.woorea.openstack.keystone.model; + +import java.io.Serializable; + +public abstract class Authentication implements Serializable { + + private String tenantId; + + private String tenantName; + + /** + * @return the tenantId + */ + public String getTenantId() { + return tenantId; + } + + /** + * @param tenantId the tenantId to set + */ + public void setTenantId(String tenantId) { + this.tenantId = tenantId; + } + + /** + * @return the tenantName + */ + public String getTenantName() { + return tenantName; + } + + /** + * @param tenantName the tenantName to set + */ + public void setTenantName(String tenantName) { + this.tenantName = tenantName; + } + +} diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Endpoint.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Endpoint.java index f179e2542..073a1fb5d 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Endpoint.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Endpoint.java @@ -1,121 +1,121 @@ -package com.woorea.openstack.keystone.model; - -import java.io.Serializable; - -import org.codehaus.jackson.annotate.JsonProperty; -import org.codehaus.jackson.map.annotate.JsonRootName; - -@JsonRootName("endpoint") -public class Endpoint implements Serializable { - - private String id; - - @JsonProperty("service_id") - private String serviceId; - - private String region; - - @JsonProperty("publicurl") - private String publicURL; - - @JsonProperty("internalurl") - private String internalURL; - - @JsonProperty("adminurl") - private String adminURL; - - /** - * @return the id - */ - public String getId() { - return id; - } - - /** - * @param id the id to set - */ - public void setId(String id) { - this.id = id; - } - - /** - * @return the serviceId - */ - public String getServiceId() { - return serviceId; - } - - /** - * @param serviceId the serviceId to set - */ - public void setServiceId(String serviceId) { - this.serviceId = serviceId; - } - - /** - * @return the region - */ - public String getRegion() { - return region; - } - - /** - * @param region the region to set - */ - public void setRegion(String region) { - this.region = region; - } - - /** - * @return the publicURL - */ - public String getPublicURL() { - return publicURL; - } - - /** - * @param publicURL the publicURL to set - */ - public void setPublicURL(String publicURL) { - this.publicURL = publicURL; - } - - /** - * @return the internalURL - */ - public String getInternalURL() { - return internalURL; - } - - /** - * @param internalURL the internalURL to set - */ - public void setInternalURL(String internalURL) { - this.internalURL = internalURL; - } - - /** - * @return the adminURL - */ - public String getAdminURL() { - return adminURL; - } - - /** - * @param adminURL the adminURL to set - */ - public void setAdminURL(String adminURL) { - this.adminURL = adminURL; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Endpoint [id=" + id + ", serviceId=" + serviceId + ", region=" - + region + ", publicURL=" + publicURL + ", internalURL=" - + internalURL + ", adminURL=" + adminURL + "]"; - } - -} +package com.woorea.openstack.keystone.model; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName("endpoint") +public class Endpoint implements Serializable { + + private String id; + + @JsonProperty("service_id") + private String serviceId; + + private String region; + + @JsonProperty("publicurl") + private String publicURL; + + @JsonProperty("internalurl") + private String internalURL; + + @JsonProperty("adminurl") + private String adminURL; + + /** + * @return the id + */ + public String getId() { + return id; + } + + /** + * @param id the id to set + */ + public void setId(String id) { + this.id = id; + } + + /** + * @return the serviceId + */ + public String getServiceId() { + return serviceId; + } + + /** + * @param serviceId the serviceId to set + */ + public void setServiceId(String serviceId) { + this.serviceId = serviceId; + } + + /** + * @return the region + */ + public String getRegion() { + return region; + } + + /** + * @param region the region to set + */ + public void setRegion(String region) { + this.region = region; + } + + /** + * @return the publicURL + */ + public String getPublicURL() { + return publicURL; + } + + /** + * @param publicURL the publicURL to set + */ + public void setPublicURL(String publicURL) { + this.publicURL = publicURL; + } + + /** + * @return the internalURL + */ + public String getInternalURL() { + return internalURL; + } + + /** + * @param internalURL the internalURL to set + */ + public void setInternalURL(String internalURL) { + this.internalURL = internalURL; + } + + /** + * @return the adminURL + */ + public String getAdminURL() { + return adminURL; + } + + /** + * @param adminURL the adminURL to set + */ + public void setAdminURL(String adminURL) { + this.adminURL = adminURL; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Endpoint [id=" + id + ", serviceId=" + serviceId + ", region=" + + region + ", publicURL=" + publicURL + ", internalURL=" + + internalURL + ", adminURL=" + adminURL + "]"; + } + +} diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Endpoints.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Endpoints.java index d7a58983c..8b11bdbbf 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Endpoints.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Endpoints.java @@ -1,34 +1,34 @@ -package com.woorea.openstack.keystone.model; - -import java.io.Serializable; -import java.util.Iterator; -import java.util.List; - -import org.codehaus.jackson.annotate.JsonProperty; - -public class Endpoints implements Iterable, Serializable { - - @JsonProperty("endpoints") - private List list; - - /** - * @return the list - */ - public List getList() { - return list; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Endpoints [list=" + list + "]"; - } - - @Override - public Iterator iterator() { - return list.iterator(); - } - -} +package com.woorea.openstack.keystone.model; + +import java.io.Serializable; +import java.util.Iterator; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class Endpoints implements Iterable, Serializable { + + @JsonProperty("endpoints") + private List list; + + /** + * @return the list + */ + public List getList() { + return list; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Endpoints [list=" + list + "]"; + } + + @Override + public Iterator iterator() { + return list.iterator(); + } + +} diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Error.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Error.java index 5549f4c83..c3f7e6ac7 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Error.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Error.java @@ -1,46 +1,46 @@ -package com.woorea.openstack.keystone.model; - -import java.io.Serializable; - -import org.codehaus.jackson.map.annotate.JsonRootName; - -@JsonRootName("error") -public class Error implements Serializable { - - private Integer code; - - private String title; - - private String message; - - /** - * @return the code - */ - public Integer getCode() { - return code; - } - - /** - * @return the title - */ - public String getTitle() { - return title; - } - - /** - * @return the message - */ - public String getMessage() { - return message; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Error [code=" + code + ", title=" + title + ", message=" - + message + "]"; - } - -} +package com.woorea.openstack.keystone.model; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName("error") +public class Error implements Serializable { + + private Integer code; + + private String title; + + private String message; + + /** + * @return the code + */ + public Integer getCode() { + return code; + } + + /** + * @return the title + */ + public String getTitle() { + return title; + } + + /** + * @return the message + */ + public String getMessage() { + return message; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Error [code=" + code + ", title=" + title + ", message=" + + message + "]"; + } + +} diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Role.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Role.java index 993b0d9e2..b77b7f430 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Role.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Role.java @@ -1,67 +1,67 @@ -package com.woorea.openstack.keystone.model; - -import java.io.Serializable; - -import org.codehaus.jackson.map.annotate.JsonRootName; - -@JsonRootName("role") -public class Role implements Serializable { - - private String id; - - private String name; - - private String description; - - private String enabled; - - /** - * @return the id - */ - public String getId() { - return id; - } - - /** - * @return the name - */ - public String getName() { - return name; - } - - /** - * @param name the name to set - */ - public void setName(String name) { - this.name = name; - } - - /** - * @return the description - */ - public String getDescription() { - return description; - } - - /** - * @param description the description to set - */ - public void setDescription(String description) { - this.description = description; - } - - /** - * @return the enabled - */ - public String getEnabled() { - return enabled; - } - - /** - * @param enabled the enabled to set - */ - public void setEnabled(String enabled) { - this.enabled = enabled; - } - -} +package com.woorea.openstack.keystone.model; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName("role") +public class Role implements Serializable { + + private String id; + + private String name; + + private String description; + + private String enabled; + + /** + * @return the id + */ + public String getId() { + return id; + } + + /** + * @return the name + */ + public String getName() { + return name; + } + + /** + * @param name the name to set + */ + public void setName(String name) { + this.name = name; + } + + /** + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * @param description the description to set + */ + public void setDescription(String description) { + this.description = description; + } + + /** + * @return the enabled + */ + public String getEnabled() { + return enabled; + } + + /** + * @param enabled the enabled to set + */ + public void setEnabled(String enabled) { + this.enabled = enabled; + } + +} diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Roles.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Roles.java index 22e18ed95..8b74d0d5b 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Roles.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Roles.java @@ -1,34 +1,34 @@ -package com.woorea.openstack.keystone.model; - -import java.io.Serializable; -import java.util.Iterator; -import java.util.List; - -import org.codehaus.jackson.annotate.JsonProperty; - -public class Roles implements Iterable, Serializable { - - @JsonProperty("roles") - private List list; - - /** - * @return the list - */ - public List getList() { - return list; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Roles [list=" + list + "]"; - } - - @Override - public Iterator iterator() { - return list.iterator(); - } - -} +package com.woorea.openstack.keystone.model; + +import java.io.Serializable; +import java.util.Iterator; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class Roles implements Iterable, Serializable { + + @JsonProperty("roles") + private List list; + + /** + * @return the list + */ + public List getList() { + return list; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Roles [list=" + list + "]"; + } + + @Override + public Iterator iterator() { + return list.iterator(); + } + +} diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Service.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Service.java index ed9eb53ec..f0d19dbd1 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Service.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Service.java @@ -1,76 +1,76 @@ -package com.woorea.openstack.keystone.model; - -import java.io.Serializable; - -import org.codehaus.jackson.map.annotate.JsonRootName; - -@JsonRootName("OS-KSADM:service") -public class Service implements Serializable { - - private String id; - - private String type; - - private String name; - - private String description; - - /** - * @return the id - */ - public String getId() { - return id; - } - - /** - * @return the type - */ - public String getType() { - return type; - } - - /** - * @param type the type to set - */ - public void setType(String type) { - this.type = type; - } - - /** - * @return the name - */ - public String getName() { - return name; - } - - /** - * @param name the name to set - */ - public void setName(String name) { - this.name = name; - } - - /** - * @return the description - */ - public String getDescription() { - return description; - } - - /** - * @param description the description to set - */ - public void setDescription(String description) { - this.description = description; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Service [id=" + id + ", type=" + type + ", name=" + name - + ", description=" + description + "]"; - } - -} +package com.woorea.openstack.keystone.model; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName("OS-KSADM:service") +public class Service implements Serializable { + + private String id; + + private String type; + + private String name; + + private String description; + + /** + * @return the id + */ + public String getId() { + return id; + } + + /** + * @return the type + */ + public String getType() { + return type; + } + + /** + * @param type the type to set + */ + public void setType(String type) { + this.type = type; + } + + /** + * @return the name + */ + public String getName() { + return name; + } + + /** + * @param name the name to set + */ + public void setName(String name) { + this.name = name; + } + + /** + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * @param description the description to set + */ + public void setDescription(String description) { + this.description = description; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Service [id=" + id + ", type=" + type + ", name=" + name + + ", description=" + description + "]"; + } + +} diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Services.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Services.java index 5c7958cf1..be02891b6 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Services.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Services.java @@ -1,34 +1,34 @@ -package com.woorea.openstack.keystone.model; - -import java.io.Serializable; -import java.util.Iterator; -import java.util.List; - -import org.codehaus.jackson.annotate.JsonProperty; - -public class Services implements Iterable, Serializable { - - @JsonProperty("OS-KSADM:services") - private List list; - - /** - * @return the list - */ - public List getList() { - return list; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Services [list=" + list + "]"; - } - - @Override - public Iterator iterator() { - return list.iterator(); - } - -} +package com.woorea.openstack.keystone.model; + +import java.io.Serializable; +import java.util.Iterator; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class Services implements Iterable, Serializable { + + @JsonProperty("OS-KSADM:services") + private List list; + + /** + * @return the list + */ + public List getList() { + return list; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Services [list=" + list + "]"; + } + + @Override + public Iterator iterator() { + return list.iterator(); + } + +} diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Tenant.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Tenant.java index a20b71b7e..dc29db8e6 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Tenant.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Tenant.java @@ -1,102 +1,102 @@ -package com.woorea.openstack.keystone.model; - -import java.io.Serializable; - -import org.codehaus.jackson.annotate.JsonIgnoreProperties; -import org.codehaus.jackson.map.annotate.JsonRootName; - -@JsonRootName("tenant") -@JsonIgnoreProperties(ignoreUnknown=true) -public class Tenant implements Serializable { - - private String id; - - private String name; - - private String description; - - private Boolean enabled; - - public Tenant(String name, String description, Boolean enabled) { - this.name = name; - this.description = description; - this.enabled = enabled; - } - - public Tenant(String name, String description) { - this(name, description, Boolean.TRUE); - } - - public Tenant(String name) { - this(name, null); - } - - public Tenant() { - } - - /** - * @return the id - */ - public String getId() { - return id; - } - - /** - * @param id the id to set - */ - public void setId(String id) { - this.id = id; - } - - /** - * @return the name - */ - public String getName() { - return name; - } - - /** - * @param name the name to set - */ - public void setName(String name) { - this.name = name; - } - - /** - * @return the description - */ - public String getDescription() { - return description; - } - - /** - * @param description the description to set - */ - public void setDescription(String description) { - this.description = description; - } - - /** - * @return the enabled - */ - public Boolean getEnabled() { - return enabled; - } - - /** - * @param enabled the enabled to set - */ - public void setEnabled(Boolean enabled) { - this.enabled = enabled; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Tenant [id=" + id + ", name=" + name + ", description=" - + description + ", enabled=" + enabled + "]"; - } - -} +package com.woorea.openstack.keystone.model; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName("tenant") +@JsonIgnoreProperties(ignoreUnknown=true) +public class Tenant implements Serializable { + + private String id; + + private String name; + + private String description; + + private Boolean enabled; + + public Tenant(String name, String description, Boolean enabled) { + this.name = name; + this.description = description; + this.enabled = enabled; + } + + public Tenant(String name, String description) { + this(name, description, Boolean.TRUE); + } + + public Tenant(String name) { + this(name, null); + } + + public Tenant() { + } + + /** + * @return the id + */ + public String getId() { + return id; + } + + /** + * @param id the id to set + */ + public void setId(String id) { + this.id = id; + } + + /** + * @return the name + */ + public String getName() { + return name; + } + + /** + * @param name the name to set + */ + public void setName(String name) { + this.name = name; + } + + /** + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * @param description the description to set + */ + public void setDescription(String description) { + this.description = description; + } + + /** + * @return the enabled + */ + public Boolean getEnabled() { + return enabled; + } + + /** + * @param enabled the enabled to set + */ + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Tenant [id=" + id + ", name=" + name + ", description=" + + description + ", enabled=" + enabled + "]"; + } + +} diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Tenants.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Tenants.java index 51e370c02..c28dd2ab6 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Tenants.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Tenants.java @@ -1,44 +1,44 @@ -package com.woorea.openstack.keystone.model; - -import java.io.Serializable; -import java.util.Iterator; -import java.util.List; - -import org.codehaus.jackson.annotate.JsonProperty; - -public class Tenants implements Iterable, Serializable { - - @JsonProperty("tenants") - private List list; - - @JsonProperty("tenants_links") - private List links; - - /** - * @return the list - */ - public List getList() { - return list; - } - - /** - * @return the links - */ - public List getLinks() { - return links; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Tenants [list=" + list + ", links=" + links + "]"; - } - - @Override - public Iterator iterator() { - return list.iterator(); - } - -} +package com.woorea.openstack.keystone.model; + +import java.io.Serializable; +import java.util.Iterator; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class Tenants implements Iterable, Serializable { + + @JsonProperty("tenants") + private List list; + + @JsonProperty("tenants_links") + private List links; + + /** + * @return the list + */ + public List getList() { + return list; + } + + /** + * @return the links + */ + public List getLinks() { + return links; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Tenants [list=" + list + ", links=" + links + "]"; + } + + @Override + public Iterator iterator() { + return list.iterator(); + } + +} diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/User.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/User.java index a308d609e..47f32a124 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/User.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/User.java @@ -1,134 +1,146 @@ -package com.woorea.openstack.keystone.model; - -import java.io.Serializable; - -import org.codehaus.jackson.annotate.JsonProperty; -import org.codehaus.jackson.map.annotate.JsonRootName; - -@JsonRootName("user") -public class User implements Serializable { - - private String id; - - private String username; - - @JsonProperty("OS-KSADM:password") - private String password; - - private String tenantId; - - private String name; - - private String email; - - private Boolean enabled; - - /** - * @return the id - */ - public String getId() { - return id; - } - - /** - * @param id the id to set - */ - public void setId(String id) { - this.id = id; - } - - /** - * @return the username - */ - public String getUsername() { - return username; - } - - /** - * @param username the username to set - */ - public void setUsername(String username) { - this.username = username; - } - - /** - * @return the password - */ - public String getPassword() { - return password; - } - - /** - * @param password the password to set - */ - public void setPassword(String password) { - this.password = password; - } - - /** - * @return the tenantId - */ - public String getTenantId() { - return tenantId; - } - - /** - * @param tenantId the tenantId to set - */ - public void setTenantId(String tenantId) { - this.tenantId = tenantId; - } - - /** - * @return the name - */ - public String getName() { - return name; - } - - /** - * @param name the name to set - */ - public void setName(String name) { - this.name = name; - } - - /** - * @return the email - */ - public String getEmail() { - return email; - } - - /** - * @param email the email to set - */ - public void setEmail(String email) { - this.email = email; - } - - /** - * @return the enabled - */ - public Boolean getEnabled() { - return enabled; - } - - /** - * @param enabled the enabled to set - */ - public void setEnabled(Boolean enabled) { - this.enabled = enabled; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "User [id=" + id + ", username=" + username + ", password=" - + password + ", tenantId=" + tenantId + ", name=" + name - + ", email=" + email + ", enabled=" + enabled + "]"; - } - -} +package com.woorea.openstack.keystone.model; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonRootName; + + +@JsonRootName("user") +public class User implements Serializable { + private String id; + private String username; + private String OS_KSADM_password; + private String password; + private String tenantId; + private String name; + private String email; + + //@JsonProperty("extra") + private Extra extra; + private Boolean enabled; + + /** + * @return the id + */ + public String getId() { + return id; + } + + /** + * @param id the id to set + */ + public void setId(String id) { + this.id = id; + } + + /** + * @return the username + */ + public String getUsername() { + return username; + } + + /** + * @param username the username to set + */ + public void setUsername(String username) { + this.username = username; + } + + /** + * @return the password + */ + public String getPassword() { + return password; + } + + /** + * @param password the password to set + */ + public void setPassword(String password) { + this.password = password; + } + + /** + * @return the tenantId + */ + public String getTenantId() { + return tenantId; + } + + /** + * @param tenantId the tenantId to set + */ + public void setTenantId(String tenantId) { + this.tenantId = tenantId; + } + + /** + * @return the name + */ + public String getName() { + return name; + } + + /** + * @param name the name to set + */ + public void setName(String name) { + this.name = name; + } + + /** + * @return the email + */ + public String getEmail() { + return email; + } + + /** + * @param email the email to set + */ + public void setEmail(String email) { + this.email = email; + } + + /** + * @return the enabled + */ + public Boolean getEnabled() { + return enabled; + } + + /** + * @param enabled the enabled to set + */ + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "User [id=" + id + ", username=" + username + ", password=" + + password + ", tenantId=" + tenantId + ", name=" + name + ", email=" + + email + ", enabled=" + enabled + + ((extra != null) ? (", " + extra.toString()) : "") + "]"; + } + + public String getOS_KSADM_password() { + return password; + } + + public void setOS_KSADM_password(String oS_KSADM_password) { + password = oS_KSADM_password; + } + + public Extra getExtra() { + return extra; + } + + public void setExtra(Extra extra) { + this.extra = extra; + } +} diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Users.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Users.java index c88aabcf9..b45616d05 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Users.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Users.java @@ -1,34 +1,34 @@ -package com.woorea.openstack.keystone.model; - -import java.io.Serializable; -import java.util.Iterator; -import java.util.List; - -import org.codehaus.jackson.annotate.JsonProperty; - -public class Users implements Iterable, Serializable { - - @JsonProperty("users") - private List list; - - /** - * @return the list - */ - public List getList() { - return list; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Users [list=" + list + "]"; - } - - @Override - public Iterator iterator() { - return list.iterator(); - } - -} +package com.woorea.openstack.keystone.model; + +import java.io.Serializable; +import java.util.Iterator; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class Users implements Iterable, Serializable { + + @JsonProperty("users") + private List list; + + /** + * @return the list + */ + public List getList() { + return list; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Users [list=" + list + "]"; + } + + @Override + public Iterator iterator() { + return list.iterator(); + } + +} diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/authentication/AccessKey.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/authentication/AccessKey.java index 4767450a5..e35812320 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/authentication/AccessKey.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/authentication/AccessKey.java @@ -1,72 +1,71 @@ -package com.woorea.openstack.keystone.model.authentication; - -import org.codehaus.jackson.map.annotate.JsonRootName; - -import com.woorea.openstack.keystone.model.Authentication; - -@JsonRootName("auth") -public class AccessKey extends Authentication { - - public static final class ApiAccessKeyCredentials { - - private String accessKey; - - private String secretKey; - - /** - * @return the accessKey - */ - public String getAccessKey() { - return accessKey; - } - - /** - * @param accessKey the accessKey to set - */ - public void setAccessKey(String accessKey) { - this.accessKey = accessKey; - } - - /** - * @return the secretKey - */ - public String getSecretKey() { - return secretKey; - } - - /** - * @param secretKey the secretKey to set - */ - public void setSecretKey(String secretKey) { - this.secretKey = secretKey; - } - - } - - private ApiAccessKeyCredentials apiAccessKeyCredentials = new ApiAccessKeyCredentials(); - - public AccessKey() { - - } - - public AccessKey(String accessKey, String secretKey) { - apiAccessKeyCredentials.setAccessKey(accessKey); - apiAccessKeyCredentials.setSecretKey(secretKey); - } - - /** - * @return the apiAccessKeyCredentials - */ - public ApiAccessKeyCredentials getApiAccessKeyCredentials() { - return apiAccessKeyCredentials; - } - - /** - * @param apiAccessKeyCredentials the apiAccessKeyCredentials to set - */ - public void setApiAccessKeyCredentials( - ApiAccessKeyCredentials apiAccessKeyCredentials) { - this.apiAccessKeyCredentials = apiAccessKeyCredentials; - } - -} +package com.woorea.openstack.keystone.model.authentication; + +import com.fasterxml.jackson.annotation.JsonRootName; +import com.woorea.openstack.keystone.model.Authentication; + +@JsonRootName("auth") +public class AccessKey extends Authentication { + + public static final class ApiAccessKeyCredentials { + + private String accessKey; + + private String secretKey; + + /** + * @return the accessKey + */ + public String getAccessKey() { + return accessKey; + } + + /** + * @param accessKey the accessKey to set + */ + public void setAccessKey(String accessKey) { + this.accessKey = accessKey; + } + + /** + * @return the secretKey + */ + public String getSecretKey() { + return secretKey; + } + + /** + * @param secretKey the secretKey to set + */ + public void setSecretKey(String secretKey) { + this.secretKey = secretKey; + } + + } + + private ApiAccessKeyCredentials apiAccessKeyCredentials = new ApiAccessKeyCredentials(); + + public AccessKey() { + + } + + public AccessKey(String accessKey, String secretKey) { + apiAccessKeyCredentials.setAccessKey(accessKey); + apiAccessKeyCredentials.setSecretKey(secretKey); + } + + /** + * @return the apiAccessKeyCredentials + */ + public ApiAccessKeyCredentials getApiAccessKeyCredentials() { + return apiAccessKeyCredentials; + } + + /** + * @param apiAccessKeyCredentials the apiAccessKeyCredentials to set + */ + public void setApiAccessKeyCredentials( + ApiAccessKeyCredentials apiAccessKeyCredentials) { + this.apiAccessKeyCredentials = apiAccessKeyCredentials; + } + +} diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/authentication/TokenAuthentication.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/authentication/TokenAuthentication.java index 68cfcd2c5..3643dec9c 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/authentication/TokenAuthentication.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/authentication/TokenAuthentication.java @@ -1,50 +1,49 @@ -package com.woorea.openstack.keystone.model.authentication; - -import org.codehaus.jackson.map.annotate.JsonRootName; - -import com.woorea.openstack.keystone.model.Authentication; - -@JsonRootName("auth") -public class TokenAuthentication extends Authentication { - - public static final class Token { - - private String id; - - /** - * @return the id - */ - public String getId() { - return id; - } - - /** - * @param id the id to set - */ - public void setId(String id) { - this.id = id; - } - - } - - private Token token = new Token(); - - public TokenAuthentication(String token) { - this.token.id = token; - } - - /** - * @return the token - */ - public Token getToken() { - return token; - } - - /** - * @param token the token to set - */ - public void setToken(Token token) { - this.token = token; - } - -} +package com.woorea.openstack.keystone.model.authentication; + +import com.fasterxml.jackson.annotation.JsonRootName; +import com.woorea.openstack.keystone.model.Authentication; + +@JsonRootName("auth") +public class TokenAuthentication extends Authentication { + + public static final class Token { + + private String id; + + /** + * @return the id + */ + public String getId() { + return id; + } + + /** + * @param id the id to set + */ + public void setId(String id) { + this.id = id; + } + + } + + private Token token = new Token(); + + public TokenAuthentication(String token) { + this.token.id = token; + } + + /** + * @return the token + */ + public Token getToken() { + return token; + } + + /** + * @param token the token to set + */ + public void setToken(Token token) { + this.token = token; + } + +} diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/authentication/UsernamePassword.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/authentication/UsernamePassword.java index ee94692bd..56a22aafb 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/authentication/UsernamePassword.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/authentication/UsernamePassword.java @@ -1,71 +1,70 @@ -package com.woorea.openstack.keystone.model.authentication; - -import org.codehaus.jackson.map.annotate.JsonRootName; - -import com.woorea.openstack.keystone.model.Authentication; - -@JsonRootName("auth") -public class UsernamePassword extends Authentication { - - public static final class PasswordCredentials { - - private String username; - - private String password; - - /** - * @return the username - */ - public String getUsername() { - return username; - } - - /** - * @param username the username to set - */ - public void setUsername(String username) { - this.username = username; - } - - /** - * @return the password - */ - public String getPassword() { - return password; - } - - /** - * @param password the password to set - */ - public void setPassword(String password) { - this.password = password; - } - - } - - private PasswordCredentials passwordCredentials = new PasswordCredentials(); - - public UsernamePassword() { - - } - - public UsernamePassword(String username, String password) { - passwordCredentials.setUsername(username); - passwordCredentials.setPassword(password); - } - - /** - * @return the passwordCredentials - */ - public PasswordCredentials getPasswordCredentials() { - return passwordCredentials; - } - - /** - * @param passwordCredentials the passwordCredentials to set - */ - public void setPasswordCredentials(PasswordCredentials passwordCredentials) { - this.passwordCredentials = passwordCredentials; - } - -} +package com.woorea.openstack.keystone.model.authentication; + +import com.fasterxml.jackson.annotation.JsonRootName; +import com.woorea.openstack.keystone.model.Authentication; + +@JsonRootName("auth") +public class UsernamePassword extends Authentication { + + public static final class PasswordCredentials { + + private String username; + + private String password; + + /** + * @return the username + */ + public String getUsername() { + return username; + } + + /** + * @param username the username to set + */ + public void setUsername(String username) { + this.username = username; + } + + /** + * @return the password + */ + public String getPassword() { + return password; + } + + /** + * @param password the password to set + */ + public void setPassword(String password) { + this.password = password; + } + + } + + private PasswordCredentials passwordCredentials = new PasswordCredentials(); + + public UsernamePassword() { + + } + + public UsernamePassword(String username, String password) { + passwordCredentials.setUsername(username); + passwordCredentials.setPassword(password); + } + + /** + * @return the passwordCredentials + */ + public PasswordCredentials getPasswordCredentials() { + return passwordCredentials; + } + + /** + * @param passwordCredentials the passwordCredentials to set + */ + public void setPasswordCredentials(PasswordCredentials passwordCredentials) { + this.passwordCredentials = passwordCredentials; + } + +} diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Authentication.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Authentication.java index cbb6d5dd6..de9973747 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Authentication.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Authentication.java @@ -1,286 +1,284 @@ -package com.woorea.openstack.keystone.v3.model; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; - -import org.codehaus.jackson.map.annotate.JsonRootName; - -import com.woorea.openstack.keystone.v3.model.Authentication.Scope; - -@JsonRootName("auth") -public class Authentication implements Serializable { - - public static final class Identity { - - public static final Identity password(String userId, String password) { - Identity identity = new Identity(); - identity.getMethods().add("password"); - Password method = new Password(); - method.getUser().setId(userId); - method.getUser().setPassword(password); - identity.setPassword(method); - return identity; - } - - public static final Identity password(String domainName, String username, String password) { - Identity identity = new Identity(); - identity.getMethods().add("password"); - Password method = new Password(); - com.woorea.openstack.keystone.v3.model.Authentication.Identity.Password.User.Domain domain = new com.woorea.openstack.keystone.v3.model.Authentication.Identity.Password.User.Domain(); - domain.setName(domainName); - method.getUser().setDomain(domain); - method.getUser().setName(username); - method.getUser().setPassword(password); - identity.setPassword(method); - return identity; - } - - public static final Identity token(String token) { - Identity identity = new Identity(); - identity.getMethods().add("token"); - Token method = new Token(); - method.setId(token); - identity.setToken(method); - return identity; - } - - private List methods = new ArrayList(); - - public static final class Password { - - public static final class User { - - public static final class Domain { - - private String id; - - private String name; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - } - - private Domain domain; - - private String id; - - private String name; - - private String password; - - public Domain getDomain() { - return domain; - } - - public void setDomain(Domain domain) { - this.domain = domain; - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getPassword() { - return password; - } - - public void setPassword(String password) { - this.password = password; - } - - } - - private User user = new User(); - - public User getUser() { - return user; - } - - public void setUser(User user) { - this.user = user; - } - - } - - private Password password; - - public static final class Token { - - private String id; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - } - - private Token token; - - public List getMethods() { - return methods; - } - - public void setMethods(List methods) { - this.methods = methods; - } - - public Password getPassword() { - return password; - } - - public void setPassword(Password password) { - this.password = password; - } - - public Token getToken() { - return token; - } - - public void setToken(Token token) { - this.token = token; - } - - } - - private Identity identity; - - public static final class Scope { - - public static Scope project(String id) { - Scope scope = new Scope(); - Project project = new Project(); - project.setId(id); - scope.setProject(project); - return scope; - } - - public static Scope project(String domainName, String projectName) { - Scope scope = new Scope(); - com.woorea.openstack.keystone.v3.model.Authentication.Scope.Project.Domain domain = new com.woorea.openstack.keystone.v3.model.Authentication.Scope.Project.Domain(); - domain.setName(domainName); - Project project = new Project(); - project.setDomain(domain); - project.setName(projectName); - scope.setProject(project); - return scope; - } - - public static final class Project { - - public static final class Domain { - - private String id; - - private String name; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - } - - private String id; - - private Domain domain; - - private String name; - - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public Domain getDomain() { - return domain; - } - - public void setDomain(Domain domain) { - this.domain = domain; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - } - - private Project project; - - public Project getProject() { - return project; - } - - public void setProject(Project project) { - this.project = project; - } - - } - - private Scope scope; - - public Identity getIdentity() { - return identity; - } - - public void setIdentity(Identity identity) { - this.identity = identity; - } - - public Scope getScope() { - return scope; - } - - public void setScope(Scope scope) { - this.scope = scope; - } - -} +package com.woorea.openstack.keystone.v3.model; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName("auth") +public class Authentication implements Serializable { + + public static final class Identity { + + public static final Identity password(String userId, String password) { + Identity identity = new Identity(); + identity.getMethods().add("password"); + Password method = new Password(); + method.getUser().setId(userId); + method.getUser().setPassword(password); + identity.setPassword(method); + return identity; + } + + public static final Identity password(String domainName, String username, String password) { + Identity identity = new Identity(); + identity.getMethods().add("password"); + Password method = new Password(); + com.woorea.openstack.keystone.v3.model.Authentication.Identity.Password.User.Domain domain = new com.woorea.openstack.keystone.v3.model.Authentication.Identity.Password.User.Domain(); + domain.setName(domainName); + method.getUser().setDomain(domain); + method.getUser().setName(username); + method.getUser().setPassword(password); + identity.setPassword(method); + return identity; + } + + public static final Identity token(String token) { + Identity identity = new Identity(); + identity.getMethods().add("token"); + Token method = new Token(); + method.setId(token); + identity.setToken(method); + return identity; + } + + private List methods = new ArrayList(); + + public static final class Password { + + public static final class User { + + public static final class Domain { + + private String id; + + private String name; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + } + + private Domain domain; + + private String id; + + private String name; + + private String password; + + public Domain getDomain() { + return domain; + } + + public void setDomain(Domain domain) { + this.domain = domain; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + } + + private User user = new User(); + + public User getUser() { + return user; + } + + public void setUser(User user) { + this.user = user; + } + + } + + private Password password; + + public static final class Token { + + private String id; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + } + + private Token token; + + public List getMethods() { + return methods; + } + + public void setMethods(List methods) { + this.methods = methods; + } + + public Password getPassword() { + return password; + } + + public void setPassword(Password password) { + this.password = password; + } + + public Token getToken() { + return token; + } + + public void setToken(Token token) { + this.token = token; + } + + } + + private Identity identity; + + public static final class Scope { + + public static Scope project(String id) { + Scope scope = new Scope(); + Project project = new Project(); + project.setId(id); + scope.setProject(project); + return scope; + } + + public static Scope project(String domainName, String projectName) { + Scope scope = new Scope(); + com.woorea.openstack.keystone.v3.model.Authentication.Scope.Project.Domain domain = new com.woorea.openstack.keystone.v3.model.Authentication.Scope.Project.Domain(); + domain.setName(domainName); + Project project = new Project(); + project.setDomain(domain); + project.setName(projectName); + scope.setProject(project); + return scope; + } + + public static final class Project { + + public static final class Domain { + + private String id; + + private String name; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + } + + private String id; + + private Domain domain; + + private String name; + + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public Domain getDomain() { + return domain; + } + + public void setDomain(Domain domain) { + this.domain = domain; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + } + + private Project project; + + public Project getProject() { + return project; + } + + public void setProject(Project project) { + this.project = project; + } + + } + + private Scope scope; + + public Identity getIdentity() { + return identity; + } + + public void setIdentity(Identity identity) { + this.identity = identity; + } + + public Scope getScope() { + return scope; + } + + public void setScope(Scope scope) { + this.scope = scope; + } + +} diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Credential.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Credential.java index ef40a2a51..74bfb2812 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Credential.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Credential.java @@ -1,61 +1,61 @@ -package com.woorea.openstack.keystone.v3.model; - -import java.util.HashMap; -import java.util.Map; - -import org.codehaus.jackson.map.annotate.JsonRootName; - -@JsonRootName("credential") -public class Credential { - - private String id; - - private String projectId; - - private String type; - - private String userId; - - private Map blob = new HashMap(); - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getProjectId() { - return projectId; - } - - public void setProjectId(String projectId) { - this.projectId = projectId; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public String getUserId() { - return userId; - } - - public void setUserId(String userId) { - this.userId = userId; - } - - public Map getBlob() { - return blob; - } - - public void setBlob(Map blob) { - this.blob = blob; - } - -} +package com.woorea.openstack.keystone.v3.model; + +import java.util.HashMap; +import java.util.Map; + +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName("credential") +public class Credential { + + private String id; + + private String projectId; + + private String type; + + private String userId; + + private Map blob = new HashMap(); + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getProjectId() { + return projectId; + } + + public void setProjectId(String projectId) { + this.projectId = projectId; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getUserId() { + return userId; + } + + public void setUserId(String userId) { + this.userId = userId; + } + + public Map getBlob() { + return blob; + } + + public void setBlob(Map blob) { + this.blob = blob; + } + +} diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Credentials.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Credentials.java index 36eeda6ea..c629027a2 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Credentials.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Credentials.java @@ -1,34 +1,34 @@ -package com.woorea.openstack.keystone.v3.model; - -import java.io.Serializable; -import java.util.Iterator; -import java.util.List; - -import org.codehaus.jackson.annotate.JsonProperty; - -public class Credentials implements Iterable, Serializable { - - @JsonProperty("credentials") - private List list; - - /** - * @return the list - */ - public List getList() { - return list; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Credentials [list=" + list + "]"; - } - - @Override - public Iterator iterator() { - return list.iterator(); - } - -} +package com.woorea.openstack.keystone.v3.model; + +import java.io.Serializable; +import java.util.Iterator; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class Credentials implements Iterable, Serializable { + + @JsonProperty("credentials") + private List list; + + /** + * @return the list + */ + public List getList() { + return list; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Credentials [list=" + list + "]"; + } + + @Override + public Iterator iterator() { + return list.iterator(); + } + +} diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Domain.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Domain.java index 9df4fe2d7..86ae10950 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Domain.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Domain.java @@ -1,48 +1,48 @@ -package com.woorea.openstack.keystone.v3.model; - -import org.codehaus.jackson.map.annotate.JsonRootName; - -@JsonRootName("domain") -public class Domain { - - private String id; - - private String name; - - private String description; - - private Boolean enabled; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public Boolean getEnabled() { - return enabled; - } - - public void setEnabled(Boolean enabled) { - this.enabled = enabled; - } - -} +package com.woorea.openstack.keystone.v3.model; + +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName("domain") +public class Domain { + + private String id; + + private String name; + + private String description; + + private Boolean enabled; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public Boolean getEnabled() { + return enabled; + } + + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } + +} diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Domains.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Domains.java index e42a6c495..e92193c2c 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Domains.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Domains.java @@ -1,34 +1,34 @@ -package com.woorea.openstack.keystone.v3.model; - -import java.io.Serializable; -import java.util.Iterator; -import java.util.List; - -import org.codehaus.jackson.annotate.JsonProperty; - -public class Domains implements Iterable, Serializable { - - @JsonProperty("domains") - private List list; - - /** - * @return the list - */ - public List getList() { - return list; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Domains [list=" + list + "]"; - } - - @Override - public Iterator iterator() { - return list.iterator(); - } - -} +package com.woorea.openstack.keystone.v3.model; + +import java.io.Serializable; +import java.util.Iterator; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class Domains implements Iterable, Serializable { + + @JsonProperty("domains") + private List list; + + /** + * @return the list + */ + public List getList() { + return list; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Domains [list=" + list + "]"; + } + + @Override + public Iterator iterator() { + return list.iterator(); + } + +} diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Endpoint.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Endpoint.java index 213e6905b..32ea4813d 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Endpoint.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Endpoint.java @@ -1,51 +1,51 @@ -package com.woorea.openstack.keystone.v3.model; - -import org.codehaus.jackson.annotate.JsonProperty; -import org.codehaus.jackson.map.annotate.JsonRootName; - -@JsonRootName("endpoint") -public class Endpoint { - - private String id; - - @JsonProperty("interface") - private String iface; - - private String name; - - @JsonProperty("service_id") - private String serviceId; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getInterface() { - return iface; - } - - public void setInterface(String iface) { - this.iface = iface; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getServiceId() { - return serviceId; - } - - public void setServiceId(String serviceId) { - this.serviceId = serviceId; - } - -} +package com.woorea.openstack.keystone.v3.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName("endpoint") +public class Endpoint { + + private String id; + + @JsonProperty("interface") + private String iface; + + private String name; + + @JsonProperty("service_id") + private String serviceId; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getInterface() { + return iface; + } + + public void setInterface(String iface) { + this.iface = iface; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getServiceId() { + return serviceId; + } + + public void setServiceId(String serviceId) { + this.serviceId = serviceId; + } + +} diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Endpoints.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Endpoints.java index 146e88b5b..195890b26 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Endpoints.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Endpoints.java @@ -1,34 +1,34 @@ -package com.woorea.openstack.keystone.v3.model; - -import java.io.Serializable; -import java.util.Iterator; -import java.util.List; - -import org.codehaus.jackson.annotate.JsonProperty; - -public class Endpoints implements Iterable, Serializable { - - @JsonProperty("endpoints") - private List list; - - /** - * @return the list - */ - public List getList() { - return list; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Endpoints [list=" + list + "]"; - } - - @Override - public Iterator iterator() { - return list.iterator(); - } - -} +package com.woorea.openstack.keystone.v3.model; + +import java.io.Serializable; +import java.util.Iterator; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class Endpoints implements Iterable, Serializable { + + @JsonProperty("endpoints") + private List list; + + /** + * @return the list + */ + public List getList() { + return list; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Endpoints [list=" + list + "]"; + } + + @Override + public Iterator iterator() { + return list.iterator(); + } + +} diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Group.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Group.java index 5e718b536..cbe612516 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Group.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Group.java @@ -1,50 +1,50 @@ -package com.woorea.openstack.keystone.v3.model; - -import org.codehaus.jackson.annotate.JsonProperty; -import org.codehaus.jackson.map.annotate.JsonRootName; - -@JsonRootName("group") -public class Group { - - private String id; - - @JsonProperty("domain_id") - private String domainId; - - private String name; - - private String description; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getDomainId() { - return domainId; - } - - public void setDomainId(String domainId) { - this.domainId = domainId; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - -} +package com.woorea.openstack.keystone.v3.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName("group") +public class Group { + + private String id; + + @JsonProperty("domain_id") + private String domainId; + + private String name; + + private String description; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getDomainId() { + return domainId; + } + + public void setDomainId(String domainId) { + this.domainId = domainId; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + +} diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Groups.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Groups.java index cc7b276fa..75df5d79b 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Groups.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Groups.java @@ -1,34 +1,34 @@ -package com.woorea.openstack.keystone.v3.model; - -import java.io.Serializable; -import java.util.Iterator; -import java.util.List; - -import org.codehaus.jackson.annotate.JsonProperty; - -public class Groups implements Iterable, Serializable { - - @JsonProperty("groups") - private List list; - - /** - * @return the list - */ - public List getList() { - return list; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Groups [list=" + list + "]"; - } - - @Override - public Iterator iterator() { - return list.iterator(); - } - -} +package com.woorea.openstack.keystone.v3.model; + +import java.io.Serializable; +import java.util.Iterator; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class Groups implements Iterable, Serializable { + + @JsonProperty("groups") + private List list; + + /** + * @return the list + */ + public List getList() { + return list; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Groups [list=" + list + "]"; + } + + @Override + public Iterator iterator() { + return list.iterator(); + } + +} diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Policies.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Policies.java index 42da856d5..e2bae6e19 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Policies.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Policies.java @@ -1,34 +1,34 @@ -package com.woorea.openstack.keystone.v3.model; - -import java.io.Serializable; -import java.util.Iterator; -import java.util.List; - -import org.codehaus.jackson.annotate.JsonProperty; - -public class Policies implements Iterable, Serializable { - - @JsonProperty("policies") - private List list; - - /** - * @return the list - */ - public List getList() { - return list; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Policies [list=" + list + "]"; - } - - @Override - public Iterator iterator() { - return list.iterator(); - } - -} +package com.woorea.openstack.keystone.v3.model; + +import java.io.Serializable; +import java.util.Iterator; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class Policies implements Iterable, Serializable { + + @JsonProperty("policies") + private List list; + + /** + * @return the list + */ + public List getList() { + return list; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Policies [list=" + list + "]"; + } + + @Override + public Iterator iterator() { + return list.iterator(); + } + +} diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Policy.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Policy.java index 5abf84440..f7d1a5e2a 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Policy.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Policy.java @@ -1,61 +1,61 @@ -package com.woorea.openstack.keystone.v3.model; - -import java.util.HashMap; -import java.util.Map; - -import org.codehaus.jackson.map.annotate.JsonRootName; - -@JsonRootName("policy") -public class Policy { - - private String id; - - private String projectId; - - private String type; - - private String userId; - - private Map blob = new HashMap(); - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getProjectId() { - return projectId; - } - - public void setProjectId(String projectId) { - this.projectId = projectId; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public String getUserId() { - return userId; - } - - public void setUserId(String userId) { - this.userId = userId; - } - - public Map getBlob() { - return blob; - } - - public void setBlob(Map blob) { - this.blob = blob; - } - -} +package com.woorea.openstack.keystone.v3.model; + +import java.util.HashMap; +import java.util.Map; + +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName("policy") +public class Policy { + + private String id; + + private String projectId; + + private String type; + + private String userId; + + private Map blob = new HashMap(); + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getProjectId() { + return projectId; + } + + public void setProjectId(String projectId) { + this.projectId = projectId; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getUserId() { + return userId; + } + + public void setUserId(String userId) { + this.userId = userId; + } + + public Map getBlob() { + return blob; + } + + public void setBlob(Map blob) { + this.blob = blob; + } + +} diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Project.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Project.java index 070336eb1..89fc366c0 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Project.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Project.java @@ -1,50 +1,50 @@ -package com.woorea.openstack.keystone.v3.model; - -import org.codehaus.jackson.annotate.JsonProperty; -import org.codehaus.jackson.map.annotate.JsonRootName; - -@JsonRootName("project") -public class Project { - - private String id; - - @JsonProperty("domain_id") - private String domainId; - - private String name; - - private Boolean enabled; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getDomainId() { - return domainId; - } - - public void setDomainId(String domainId) { - this.domainId = domainId; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public Boolean getEnabled() { - return enabled; - } - - public void setEnabled(Boolean enabled) { - this.enabled = enabled; - } - -} +package com.woorea.openstack.keystone.v3.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName("project") +public class Project { + + private String id; + + @JsonProperty("domain_id") + private String domainId; + + private String name; + + private Boolean enabled; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getDomainId() { + return domainId; + } + + public void setDomainId(String domainId) { + this.domainId = domainId; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Boolean getEnabled() { + return enabled; + } + + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } + +} diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Projects.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Projects.java index fa390644a..7dd6cde26 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Projects.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Projects.java @@ -1,34 +1,34 @@ -package com.woorea.openstack.keystone.v3.model; - -import java.io.Serializable; -import java.util.Iterator; -import java.util.List; - -import org.codehaus.jackson.annotate.JsonProperty; - -public class Projects implements Iterable, Serializable { - - @JsonProperty("projects") - private List list; - - /** - * @return the list - */ - public List getList() { - return list; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Projects [list=" + list + "]"; - } - - @Override - public Iterator iterator() { - return list.iterator(); - } - -} +package com.woorea.openstack.keystone.v3.model; + +import java.io.Serializable; +import java.util.Iterator; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class Projects implements Iterable, Serializable { + + @JsonProperty("projects") + private List list; + + /** + * @return the list + */ + public List getList() { + return list; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Projects [list=" + list + "]"; + } + + @Override + public Iterator iterator() { + return list.iterator(); + } + +} diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Role.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Role.java index 09d47a110..b152209d6 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Role.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Role.java @@ -1,67 +1,67 @@ -package com.woorea.openstack.keystone.v3.model; - -import java.io.Serializable; - -import org.codehaus.jackson.map.annotate.JsonRootName; - -@JsonRootName("role") -public class Role implements Serializable { - - private String id; - - private String name; - - private String description; - - private String enabled; - - /** - * @return the id - */ - public String getId() { - return id; - } - - /** - * @return the name - */ - public String getName() { - return name; - } - - /** - * @param name the name to set - */ - public void setName(String name) { - this.name = name; - } - - /** - * @return the description - */ - public String getDescription() { - return description; - } - - /** - * @param description the description to set - */ - public void setDescription(String description) { - this.description = description; - } - - /** - * @return the enabled - */ - public String getEnabled() { - return enabled; - } - - /** - * @param enabled the enabled to set - */ - public void setEnabled(String enabled) { - this.enabled = enabled; - } - -} +package com.woorea.openstack.keystone.v3.model; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName("role") +public class Role implements Serializable { + + private String id; + + private String name; + + private String description; + + private String enabled; + + /** + * @return the id + */ + public String getId() { + return id; + } + + /** + * @return the name + */ + public String getName() { + return name; + } + + /** + * @param name the name to set + */ + public void setName(String name) { + this.name = name; + } + + /** + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * @param description the description to set + */ + public void setDescription(String description) { + this.description = description; + } + + /** + * @return the enabled + */ + public String getEnabled() { + return enabled; + } + + /** + * @param enabled the enabled to set + */ + public void setEnabled(String enabled) { + this.enabled = enabled; + } + +} diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Roles.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Roles.java index 5a4e3b41f..28d37f00d 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Roles.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Roles.java @@ -1,34 +1,34 @@ -package com.woorea.openstack.keystone.v3.model; - -import java.io.Serializable; -import java.util.Iterator; -import java.util.List; - -import org.codehaus.jackson.annotate.JsonProperty; - -public class Roles implements Iterable, Serializable { - - @JsonProperty("roles") - private List list; - - /** - * @return the list - */ - public List getList() { - return list; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Roles [list=" + list + "]"; - } - - @Override - public Iterator iterator() { - return list.iterator(); - } - -} +package com.woorea.openstack.keystone.v3.model; + +import java.io.Serializable; +import java.util.Iterator; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class Roles implements Iterable, Serializable { + + @JsonProperty("roles") + private List list; + + /** + * @return the list + */ + public List getList() { + return list; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Roles [list=" + list + "]"; + } + + @Override + public Iterator iterator() { + return list.iterator(); + } + +} diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Service.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Service.java index 578f2c181..dfd59c63c 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Service.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Service.java @@ -1,48 +1,48 @@ -package com.woorea.openstack.keystone.v3.model; - -import org.codehaus.jackson.map.annotate.JsonRootName; - -@JsonRootName("service") -public class Service { - - private String id; - - private String type; - - private String name; - - private String description; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - -} +package com.woorea.openstack.keystone.v3.model; + +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName("service") +public class Service { + + private String id; + + private String type; + + private String name; + + private String description; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + +} diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Services.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Services.java index 4383aeca2..562c527ac 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Services.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Services.java @@ -1,36 +1,35 @@ -package com.woorea.openstack.keystone.v3.model; - -import java.io.Serializable; -import java.util.Iterator; -import java.util.List; - -import org.codehaus.jackson.annotate.JsonProperty; - -import com.woorea.openstack.keystone.model.Service; - -public class Services implements Iterable, Serializable { - - @JsonProperty("services") - private List list; - - /** - * @return the list - */ - public List getList() { - return list; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Services [list=" + list + "]"; - } - - @Override - public Iterator iterator() { - return list.iterator(); - } - -} +package com.woorea.openstack.keystone.v3.model; + +import java.io.Serializable; +import java.util.Iterator; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.woorea.openstack.keystone.model.Service; + +public class Services implements Iterable, Serializable { + + @JsonProperty("services") + private List list; + + /** + * @return the list + */ + public List getList() { + return list; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Services [list=" + list + "]"; + } + + @Override + public Iterator iterator() { + return list.iterator(); + } + +} diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Token.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Token.java index 0876f4423..900b6417c 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Token.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Token.java @@ -1,232 +1,232 @@ -package com.woorea.openstack.keystone.v3.model; - -import java.io.Serializable; -import java.util.Calendar; -import java.util.List; - -import org.codehaus.jackson.annotate.JsonIgnoreProperties; -import org.codehaus.jackson.annotate.JsonProperty; -import org.codehaus.jackson.map.annotate.JsonRootName; - -@JsonRootName("token") -@JsonIgnoreProperties(ignoreUnknown=true) -public class Token implements Serializable { - - private String id; - - @JsonProperty("expires_at") - private Calendar expiresAt; - - @JsonProperty("issued_at") - private Calendar issuedAt; - - private List methods; - - @JsonIgnoreProperties(ignoreUnknown=true) - private static final class Domain { - - private String id; - - private String name; - - } - - @JsonIgnoreProperties(ignoreUnknown=true) - public static final class User { - - @JsonIgnoreProperties(ignoreUnknown=true) - private static final class Domain { - - private String id; - - private String name; - - } - - private String id; - - private String name; - - } - - private User user; - - @JsonIgnoreProperties(ignoreUnknown=true) - public static final class Role { - - private String id; - - private String name; - - } - - private List roles; - - public static final class Service { - - public static final class Endpoint { - - private String id; - - private String url; - - private String region; - - private Boolean enabled; - - @JsonProperty("legacy_endpoint_id") - private String legacyEndpointId; - - @JsonProperty("interface") - private String iface; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getUrl() { - return url; - } - - public void setUrl(String url) { - this.url = url; - } - - public String getRegion() { - return region; - } - - public void setRegion(String region) { - this.region = region; - } - - public Boolean getEnabled() { - return enabled; - } - - public void setEnabled(Boolean enabled) { - this.enabled = enabled; - } - - public String getLegacyEndpointId() { - return legacyEndpointId; - } - - public void setLegacyEndpointId(String legacyEndpointId) { - this.legacyEndpointId = legacyEndpointId; - } - - public String getInterface() { - return iface; - } - - public void setInterface(String iface) { - this.iface = iface; - } - - } - - private String id; - - private String type; - - private List endpoints; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public List getEndpoints() { - return endpoints; - } - - public void setEndpoints(List endpoints) { - this.endpoints = endpoints; - } - - } - - public List catalog; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public Calendar getExpiresAt() { - return expiresAt; - } - - public void setExpiresAt(Calendar expiresAt) { - this.expiresAt = expiresAt; - } - - public Calendar getIssuedAt() { - return issuedAt; - } - - public void setIssuedAt(Calendar issuedAt) { - this.issuedAt = issuedAt; - } - - public List getMethods() { - return methods; - } - - public void setMethods(List methods) { - this.methods = methods; - } - - public User getUser() { - return user; - } - - public void setUser(User user) { - this.user = user; - } - - public List getRoles() { - return roles; - } - - public void setRoles(List roles) { - this.roles = roles; - } - - public List getCatalog() { - return catalog; - } - - public void setCatalog(List catalog) { - this.catalog = catalog; - } - - @Override - public String toString() { - return "Token [id=" + id + ", expiresAt=" + expiresAt.getTime() + ", issuedAt=" - + issuedAt.getTime() + ", methods=" + methods + ", user=" + user - + ", roles=" + roles + ", catalog=" + catalog + "]"; - } - - - -} +package com.woorea.openstack.keystone.v3.model; + +import java.io.Serializable; +import java.util.Calendar; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName("token") +@JsonIgnoreProperties(ignoreUnknown=true) +public class Token implements Serializable { + + private String id; + + @JsonProperty("expires_at") + private Calendar expiresAt; + + @JsonProperty("issued_at") + private Calendar issuedAt; + + private List methods; + + @JsonIgnoreProperties(ignoreUnknown=true) + private static final class Domain { + + private String id; + + private String name; + + } + + @JsonIgnoreProperties(ignoreUnknown=true) + public static final class User { + + @JsonIgnoreProperties(ignoreUnknown=true) + private static final class Domain { + + private String id; + + private String name; + + } + + private String id; + + private String name; + + } + + private User user; + + @JsonIgnoreProperties(ignoreUnknown=true) + public static final class Role { + + private String id; + + private String name; + + } + + private List roles; + + public static final class Service { + + public static final class Endpoint { + + private String id; + + private String url; + + private String region; + + private Boolean enabled; + + @JsonProperty("legacy_endpoint_id") + private String legacyEndpointId; + + @JsonProperty("interface") + private String iface; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + public String getRegion() { + return region; + } + + public void setRegion(String region) { + this.region = region; + } + + public Boolean getEnabled() { + return enabled; + } + + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } + + public String getLegacyEndpointId() { + return legacyEndpointId; + } + + public void setLegacyEndpointId(String legacyEndpointId) { + this.legacyEndpointId = legacyEndpointId; + } + + public String getInterface() { + return iface; + } + + public void setInterface(String iface) { + this.iface = iface; + } + + } + + private String id; + + private String type; + + private List endpoints; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public List getEndpoints() { + return endpoints; + } + + public void setEndpoints(List endpoints) { + this.endpoints = endpoints; + } + + } + + public List catalog; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public Calendar getExpiresAt() { + return expiresAt; + } + + public void setExpiresAt(Calendar expiresAt) { + this.expiresAt = expiresAt; + } + + public Calendar getIssuedAt() { + return issuedAt; + } + + public void setIssuedAt(Calendar issuedAt) { + this.issuedAt = issuedAt; + } + + public List getMethods() { + return methods; + } + + public void setMethods(List methods) { + this.methods = methods; + } + + public User getUser() { + return user; + } + + public void setUser(User user) { + this.user = user; + } + + public List getRoles() { + return roles; + } + + public void setRoles(List roles) { + this.roles = roles; + } + + public List getCatalog() { + return catalog; + } + + public void setCatalog(List catalog) { + this.catalog = catalog; + } + + @Override + public String toString() { + return "Token [id=" + id + ", expiresAt=" + expiresAt.getTime() + ", issuedAt=" + + issuedAt.getTime() + ", methods=" + methods + ", user=" + user + + ", roles=" + roles + ", catalog=" + catalog + "]"; + } + + + +} diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/User.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/User.java index 3b1787ba3..bc8325c21 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/User.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/User.java @@ -1,91 +1,91 @@ -package com.woorea.openstack.keystone.v3.model; - -import org.codehaus.jackson.annotate.JsonProperty; -import org.codehaus.jackson.map.annotate.JsonRootName; - -@JsonRootName("user") -public class User { - - private String id; - - @JsonProperty("domain_id") - private String domainId; - - @JsonProperty("default_project_id") - private String defaultProjectId; - - private String name; - - private String password; - - private String email; - - private String description; - - private Boolean enabled; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getDomainId() { - return domainId; - } - - public void setDomainId(String domainId) { - this.domainId = domainId; - } - - public String getDefaultProjectId() { - return defaultProjectId; - } - - public void setDefaultProjectId(String defaultProjectId) { - this.defaultProjectId = defaultProjectId; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getPassword() { - return password; - } - - public void setPassword(String password) { - this.password = password; - } - - public String getEmail() { - return email; - } - - public void setEmail(String email) { - this.email = email; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public Boolean getEnabled() { - return enabled; - } - - public void setEnabled(Boolean enabled) { - this.enabled = enabled; - } - -} +package com.woorea.openstack.keystone.v3.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName("user") +public class User { + + private String id; + + @JsonProperty("domain_id") + private String domainId; + + @JsonProperty("default_project_id") + private String defaultProjectId; + + private String name; + + private String password; + + private String email; + + private String description; + + private Boolean enabled; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getDomainId() { + return domainId; + } + + public void setDomainId(String domainId) { + this.domainId = domainId; + } + + public String getDefaultProjectId() { + return defaultProjectId; + } + + public void setDefaultProjectId(String defaultProjectId) { + this.defaultProjectId = defaultProjectId; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public Boolean getEnabled() { + return enabled; + } + + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } + +} diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Users.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Users.java index fa3c6d4ac..b13a9e29c 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Users.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Users.java @@ -1,36 +1,35 @@ -package com.woorea.openstack.keystone.v3.model; - -import java.io.Serializable; -import java.util.Iterator; -import java.util.List; - -import org.codehaus.jackson.annotate.JsonProperty; - -import com.woorea.openstack.keystone.model.User; - -public class Users implements Iterable, Serializable { - - @JsonProperty("users") - private List list; - - /** - * @return the list - */ - public List getList() { - return list; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Users [list=" + list + "]"; - } - - @Override - public Iterator iterator() { - return list.iterator(); - } - -} +package com.woorea.openstack.keystone.v3.model; + +import java.io.Serializable; +import java.util.Iterator; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.woorea.openstack.keystone.model.User; + +public class Users implements Iterable, Serializable { + + @JsonProperty("users") + private List list; + + /** + * @return the list + */ + public List getList() { + return list; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Users [list=" + list + "]"; + } + + @Override + public Iterator iterator() { + return list.iterator(); + } + +} diff --git a/nova-client/src/main/java/com/woorea/openstack/nova/Nova.java b/nova-client/src/main/java/com/woorea/openstack/nova/Nova.java index f81de7d44..98daaf059 100644 --- a/nova-client/src/main/java/com/woorea/openstack/nova/Nova.java +++ b/nova-client/src/main/java/com/woorea/openstack/nova/Nova.java @@ -1,113 +1,113 @@ -package com.woorea.openstack.nova; - - -import com.woorea.openstack.base.client.OpenStackClient; -import com.woorea.openstack.base.client.OpenStackClientConnector; -import com.woorea.openstack.nova.api.ExtensionsResource; -import com.woorea.openstack.nova.api.FlavorsResource; -import com.woorea.openstack.nova.api.ImagesResource; -import com.woorea.openstack.nova.api.QuotaSetsResource; -import com.woorea.openstack.nova.api.ServersResource; -import com.woorea.openstack.nova.api.extensions.AggregatesExtension; -import com.woorea.openstack.nova.api.extensions.FloatingIpsExtension; -import com.woorea.openstack.nova.api.extensions.KeyPairsExtension; -import com.woorea.openstack.nova.api.extensions.SecurityGroupsExtension; -import com.woorea.openstack.nova.api.extensions.SnapshotsExtension; -import com.woorea.openstack.nova.api.extensions.VolumesExtension; -import com.woorea.openstack.nova.api.extensions.HostsExtension; - -public class Nova extends OpenStackClient { - - private final ExtensionsResource EXTENSIONS; - - private final ServersResource SERVERS; - - private final ImagesResource IMAGES; - - private final FlavorsResource FLAVORS; - - private final KeyPairsExtension KEY_PAIRS; - - private final FloatingIpsExtension FLOATING_IPS; - - private final SecurityGroupsExtension SECURITY_GROUPS; - - private final SnapshotsExtension SNAPSHOTS; - - private final VolumesExtension VOLUMES; - - private final AggregatesExtension AGGREGATES; - - private final QuotaSetsResource QUOTA_SETS; - - private final HostsExtension HOSTS; - - public Nova(String endpoint, OpenStackClientConnector connector) { - super(endpoint, connector); - EXTENSIONS = new ExtensionsResource(this); - SERVERS = new ServersResource(this); - IMAGES = new ImagesResource(this); - FLAVORS = new FlavorsResource(this); - KEY_PAIRS = new KeyPairsExtension(this); - FLOATING_IPS = new FloatingIpsExtension(this); - SECURITY_GROUPS = new SecurityGroupsExtension(this); - SNAPSHOTS = new SnapshotsExtension(this); - VOLUMES = new VolumesExtension(this); - AGGREGATES = new AggregatesExtension(this); - QUOTA_SETS = new QuotaSetsResource(this); - HOSTS = new HostsExtension(this); - } - - public Nova(String endpoint) { - this(endpoint, null); - } - - public ExtensionsResource extensions() { - return EXTENSIONS; - } - - public ServersResource servers() { - return SERVERS; - } - - public ImagesResource images() { - return IMAGES; - } - - public FlavorsResource flavors() { - return FLAVORS; - } - - public KeyPairsExtension keyPairs() { - return KEY_PAIRS; - } - - public FloatingIpsExtension floatingIps() { - return FLOATING_IPS; - } - - public SecurityGroupsExtension securityGroups() { - return SECURITY_GROUPS; - } - - public SnapshotsExtension snapshots() { - return SNAPSHOTS; - } - - public VolumesExtension volumes() { - return VOLUMES; - } - - public AggregatesExtension aggregates() { - return AGGREGATES; - } - - public QuotaSetsResource quotaSets() { - return QUOTA_SETS; - } - - public HostsExtension hosts() { - return HOSTS; - } - -} +package com.woorea.openstack.nova; + + +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.base.client.OpenStackClientConnector; +import com.woorea.openstack.nova.api.ExtensionsResource; +import com.woorea.openstack.nova.api.FlavorsResource; +import com.woorea.openstack.nova.api.ImagesResource; +import com.woorea.openstack.nova.api.QuotaSetsResource; +import com.woorea.openstack.nova.api.ServersResource; +import com.woorea.openstack.nova.api.extensions.AggregatesExtension; +import com.woorea.openstack.nova.api.extensions.FloatingIpsExtension; +import com.woorea.openstack.nova.api.extensions.HostsExtension; +import com.woorea.openstack.nova.api.extensions.KeyPairsExtension; +import com.woorea.openstack.nova.api.extensions.SecurityGroupsExtension; +import com.woorea.openstack.nova.api.extensions.SnapshotsExtension; +import com.woorea.openstack.nova.api.extensions.VolumesExtension; + +public class Nova extends OpenStackClient { + + private final ExtensionsResource EXTENSIONS; + + private final ServersResource SERVERS; + + private final ImagesResource IMAGES; + + private final FlavorsResource FLAVORS; + + private final KeyPairsExtension KEY_PAIRS; + + private final FloatingIpsExtension FLOATING_IPS; + + private final SecurityGroupsExtension SECURITY_GROUPS; + + private final SnapshotsExtension SNAPSHOTS; + + private final VolumesExtension VOLUMES; + + private final AggregatesExtension AGGREGATES; + + private final QuotaSetsResource QUOTA_SETS; + + private final HostsExtension HOSTS; + + public Nova(String endpoint, OpenStackClientConnector connector) { + super(endpoint, connector); + EXTENSIONS = new ExtensionsResource(this); + SERVERS = new ServersResource(this); + IMAGES = new ImagesResource(this); + FLAVORS = new FlavorsResource(this); + KEY_PAIRS = new KeyPairsExtension(this); + FLOATING_IPS = new FloatingIpsExtension(this); + SECURITY_GROUPS = new SecurityGroupsExtension(this); + SNAPSHOTS = new SnapshotsExtension(this); + VOLUMES = new VolumesExtension(this); + AGGREGATES = new AggregatesExtension(this); + QUOTA_SETS = new QuotaSetsResource(this); + HOSTS = new HostsExtension(this); + } + + public Nova(String endpoint) { + this(endpoint, null); + } + + public ExtensionsResource extensions() { + return EXTENSIONS; + } + + public ServersResource servers() { + return SERVERS; + } + + public ImagesResource images() { + return IMAGES; + } + + public FlavorsResource flavors() { + return FLAVORS; + } + + public KeyPairsExtension keyPairs() { + return KEY_PAIRS; + } + + public FloatingIpsExtension floatingIps() { + return FLOATING_IPS; + } + + public SecurityGroupsExtension securityGroups() { + return SECURITY_GROUPS; + } + + public SnapshotsExtension snapshots() { + return SNAPSHOTS; + } + + public VolumesExtension volumes() { + return VOLUMES; + } + + public AggregatesExtension aggregates() { + return AGGREGATES; + } + + public QuotaSetsResource quotaSets() { + return QUOTA_SETS; + } + + public HostsExtension hosts() { + return HOSTS; + } + +} diff --git a/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/AggregatesExtension.java b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/AggregatesExtension.java index fa757aff3..bcb787bc4 100644 --- a/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/AggregatesExtension.java +++ b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/AggregatesExtension.java @@ -1,163 +1,160 @@ -package com.woorea.openstack.nova.api.extensions; - -import java.util.Map; - - -import com.woorea.openstack.base.client.Entity; -import com.woorea.openstack.base.client.HttpMethod; -import com.woorea.openstack.base.client.OpenStackClient; -import com.woorea.openstack.base.client.OpenStackRequest; -import com.woorea.openstack.nova.model.HostAggregate; -import com.woorea.openstack.nova.model.HostAggregates; - -public class AggregatesExtension { - - private final OpenStackClient CLIENT; - - public AggregatesExtension(OpenStackClient client) { - CLIENT = client; - } - - public List list() { - return new List(); - } - - public ShowAggregate showAggregate(String id) { - return new ShowAggregate(id); - } - - public UpdateAggregateMetadata updateAggregateMetadata(String id, - String name, String availabilityZone) { - return new UpdateAggregateMetadata(id, name, availabilityZone); - } - - public CreateAggregate createAggregate(String aggregateName, - String availabilityZoneName) { - return new CreateAggregate(aggregateName, availabilityZoneName); - } - - public DeleteAggregate deleteAggregate(String id) { - return new DeleteAggregate(id); - } - - public AddHost addHost(String aggregateId, String hostId) { - return new AddHost(aggregateId, hostId); - } - - public RemoveHost removeHost(String aggregateId, String hostId) { - return new RemoveHost(hostId, aggregateId); - } - - public SetMetadata setMetadata(String aggregateId, - String key, String value) { - return new SetMetadata(aggregateId, key, value); - } - - public class List extends OpenStackRequest { - - public List() { - super(CLIENT, HttpMethod.GET, "/os-aggregates", - null, - HostAggregates.class); - } - - } - - public class ShowAggregate extends OpenStackRequest { - - public ShowAggregate(String id) { - super(CLIENT, HttpMethod.GET, - new StringBuffer("/os-aggregates/").append(id), - null, - HostAggregate.class); - } - - } - - public class UpdateAggregateMetadata extends OpenStackRequest { - public UpdateAggregateMetadata(String id, - String name, String availabilityZone) { - super(CLIENT, HttpMethod.PUT, - new StringBuffer("/os-aggregates/").append(id), - availabilityZone == null ? - Entity.json("{\"aggregate\": {\"name\": \"" + name + "\" }}") - : - Entity.json("{\"aggregate\": {\"name\": \"" + - name + - "\", \"availability_zone\": \"" + - availabilityZone + - "\" }}"), - HostAggregate.class); - } - - } - - public class CreateAggregate extends OpenStackRequest { - - public CreateAggregate(String name, String availabilityZone) { - super(CLIENT, HttpMethod.POST, - new StringBuffer("/os-aggregates"), - availabilityZone == null ? - Entity.json("{\"aggregate\": {\"name\": \"" + - name + - "\", \"availability_zone\": null }}") - : - Entity.json("{\"aggregate\": {\"name\": \"" + - name + - "\", \"availability_zone\": \"" + - availabilityZone + - "\" }}"), - HostAggregate.class); - } - - } - - public class DeleteAggregate extends OpenStackRequest { - - public DeleteAggregate(String id) { - super(CLIENT, HttpMethod.DELETE, - new StringBuffer("/os-aggregates/").append(id), - null, - null); - } - } - - public class AddHost extends OpenStackRequest { - - public AddHost(String aggregateId, String hostId) { - super(CLIENT, HttpMethod.POST, - new StringBuffer("/os-aggregates/") - .append(aggregateId).append("/action"), - Entity.json("{\"add_host\": {\"host\": \"" + - hostId + "\" }}"), - HostAggregate.class); - } - - } - - public class RemoveHost extends OpenStackRequest { - - public RemoveHost(String hostId, String aggregateId) { - super(CLIENT, HttpMethod.POST, - new StringBuffer("/os-aggregates/") - .append(aggregateId).append("/action"), - Entity.json("{\"remove_host\": {\"host\": \"" + - hostId + "\" }}"), - HostAggregate.class); - } - - } - - public class SetMetadata extends OpenStackRequest { - - public SetMetadata(String aggregateId, String key, String value) { - super(CLIENT, HttpMethod.POST, - new StringBuffer("/os-aggregates/") - .append(aggregateId).append("/action"), - Entity.json("{\"set_metadata\": {\"metadata\": { \"" + - key + "\": \"" + value + "\" }}}"), - HostAggregate.class); - } - } -} - +package com.woorea.openstack.nova.api.extensions; + +import com.woorea.openstack.base.client.Entity; +import com.woorea.openstack.base.client.HttpMethod; +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.base.client.OpenStackRequest; +import com.woorea.openstack.nova.model.HostAggregate; +import com.woorea.openstack.nova.model.HostAggregates; + +public class AggregatesExtension { + + private final OpenStackClient CLIENT; + + public AggregatesExtension(OpenStackClient client) { + CLIENT = client; + } + + public List list() { + return new List(); + } + + public ShowAggregate showAggregate(String id) { + return new ShowAggregate(id); + } + + public UpdateAggregateMetadata updateAggregateMetadata(String id, + String name, String availabilityZone) { + return new UpdateAggregateMetadata(id, name, availabilityZone); + } + + public CreateAggregate createAggregate(String aggregateName, + String availabilityZoneName) { + return new CreateAggregate(aggregateName, availabilityZoneName); + } + + public DeleteAggregate deleteAggregate(String id) { + return new DeleteAggregate(id); + } + + public AddHost addHost(String aggregateId, String hostId) { + return new AddHost(aggregateId, hostId); + } + + public RemoveHost removeHost(String aggregateId, String hostId) { + return new RemoveHost(hostId, aggregateId); + } + + public SetMetadata setMetadata(String aggregateId, + String key, String value) { + return new SetMetadata(aggregateId, key, value); + } + + public class List extends OpenStackRequest { + + public List() { + super(CLIENT, HttpMethod.GET, "/os-aggregates", + null, + HostAggregates.class); + } + + } + + public class ShowAggregate extends OpenStackRequest { + + public ShowAggregate(String id) { + super(CLIENT, HttpMethod.GET, + new StringBuffer("/os-aggregates/").append(id), + null, + HostAggregate.class); + } + + } + + public class UpdateAggregateMetadata extends OpenStackRequest { + public UpdateAggregateMetadata(String id, + String name, String availabilityZone) { + super(CLIENT, HttpMethod.PUT, + new StringBuffer("/os-aggregates/").append(id), + availabilityZone == null ? + Entity.json("{\"aggregate\": {\"name\": \"" + name + "\" }}") + : + Entity.json("{\"aggregate\": {\"name\": \"" + + name + + "\", \"availability_zone\": \"" + + availabilityZone + + "\" }}"), + HostAggregate.class); + } + + } + + public class CreateAggregate extends OpenStackRequest { + + public CreateAggregate(String name, String availabilityZone) { + super(CLIENT, HttpMethod.POST, + new StringBuffer("/os-aggregates"), + availabilityZone == null ? + Entity.json("{\"aggregate\": {\"name\": \"" + + name + + "\", \"availability_zone\": null }}") + : + Entity.json("{\"aggregate\": {\"name\": \"" + + name + + "\", \"availability_zone\": \"" + + availabilityZone + + "\" }}"), + HostAggregate.class); + } + + } + + public class DeleteAggregate extends OpenStackRequest { + + public DeleteAggregate(String id) { + super(CLIENT, HttpMethod.DELETE, + new StringBuffer("/os-aggregates/").append(id), + null, + null); + } + } + + public class AddHost extends OpenStackRequest { + + public AddHost(String aggregateId, String hostId) { + super(CLIENT, HttpMethod.POST, + new StringBuffer("/os-aggregates/") + .append(aggregateId).append("/action"), + Entity.json("{\"add_host\": {\"host\": \"" + + hostId + "\" }}"), + HostAggregate.class); + } + + } + + public class RemoveHost extends OpenStackRequest { + + public RemoveHost(String hostId, String aggregateId) { + super(CLIENT, HttpMethod.POST, + new StringBuffer("/os-aggregates/") + .append(aggregateId).append("/action"), + Entity.json("{\"remove_host\": {\"host\": \"" + + hostId + "\" }}"), + HostAggregate.class); + } + + } + + public class SetMetadata extends OpenStackRequest { + + public SetMetadata(String aggregateId, String key, String value) { + super(CLIENT, HttpMethod.POST, + new StringBuffer("/os-aggregates/") + .append(aggregateId).append("/action"), + Entity.json("{\"set_metadata\": {\"metadata\": { \"" + + key + "\": \"" + value + "\" }}}"), + HostAggregate.class); + } + } +} + diff --git a/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/FloatingIpsExtension.java b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/FloatingIpsExtension.java index 0923b7e81..9237b4acf 100644 --- a/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/FloatingIpsExtension.java +++ b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/FloatingIpsExtension.java @@ -1,67 +1,66 @@ -package com.woorea.openstack.nova.api.extensions; - -import java.util.HashMap; -import java.util.Map; - - -import com.woorea.openstack.base.client.Entity; -import com.woorea.openstack.base.client.HttpMethod; -import com.woorea.openstack.base.client.OpenStackClient; -import com.woorea.openstack.base.client.OpenStackRequest; -import com.woorea.openstack.nova.model.FloatingIp; -import com.woorea.openstack.nova.model.FloatingIps; - -public class FloatingIpsExtension { - - private final OpenStackClient CLIENT; - - public FloatingIpsExtension(OpenStackClient client) { - CLIENT = client; - } - - public class List extends OpenStackRequest { - - public List() { - super(CLIENT, HttpMethod.GET, "/os-floating-ips", null, FloatingIps.class); - } - - } - - public class Allocate extends OpenStackRequest { - - public Allocate(Entity entity) { - super(CLIENT, HttpMethod.POST, "/os-floating-ips", entity, FloatingIp.class); - } - - } - - public class Deallocate extends OpenStackRequest { - - public Deallocate(String id) { - super(CLIENT, HttpMethod.DELETE, new StringBuffer("/os-floating-ips/").append(id).toString(), null, Void.class); - } - - } - - public List list() { - return new List(); - } - - public Allocate allocate(String pool) { - Entity entity=null; - if(pool!=null) { - Map body = new HashMap(); - body.put("pool", pool); - entity=Entity.json(body); - } - return new Allocate(entity); - } - - public Deallocate deallocate(String id) { - return new Deallocate(id); - } - - - -} - +package com.woorea.openstack.nova.api.extensions; + +import java.util.HashMap; +import java.util.Map; + +import com.woorea.openstack.base.client.Entity; +import com.woorea.openstack.base.client.HttpMethod; +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.base.client.OpenStackRequest; +import com.woorea.openstack.nova.model.FloatingIp; +import com.woorea.openstack.nova.model.FloatingIps; + +public class FloatingIpsExtension { + + private final OpenStackClient CLIENT; + + public FloatingIpsExtension(OpenStackClient client) { + CLIENT = client; + } + + public class List extends OpenStackRequest { + + public List() { + super(CLIENT, HttpMethod.GET, "/os-floating-ips", null, FloatingIps.class); + } + + } + + public class Allocate extends OpenStackRequest { + + public Allocate(Entity entity) { + super(CLIENT, HttpMethod.POST, "/os-floating-ips", entity, FloatingIp.class); + } + + } + + public class Deallocate extends OpenStackRequest { + + public Deallocate(String id) { + super(CLIENT, HttpMethod.DELETE, new StringBuffer("/os-floating-ips/").append(id).toString(), null, Void.class); + } + + } + + public List list() { + return new List(); + } + + public Allocate allocate(String pool) { + Entity entity=null; + if(pool!=null) { + Map body = new HashMap(); + body.put("pool", pool); + entity=Entity.json(body); + } + return new Allocate(entity); + } + + public Deallocate deallocate(String id) { + return new Deallocate(id); + } + + + +} + diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/Certificate.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/Certificate.java index b69eb3c60..08a6c6aaf 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/Certificate.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/Certificate.java @@ -1,36 +1,36 @@ -package com.woorea.openstack.nova.model; - -import org.codehaus.jackson.annotate.JsonProperty; -import org.codehaus.jackson.map.annotate.JsonRootName; - -@JsonRootName("certificate") -public class Certificate { - - private String data; - - @JsonProperty("private_key") - private String privateKey; - - /** - * @return the data - */ - public String getData() { - return data; - } - - /** - * @return the privateKey - */ - public String getPrivateKey() { - return privateKey; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Certificate [data=" + data + ", privateKey=" + privateKey + "]"; - } - -} +package com.woorea.openstack.nova.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName("certificate") +public class Certificate { + + private String data; + + @JsonProperty("private_key") + private String privateKey; + + /** + * @return the data + */ + public String getData() { + return data; + } + + /** + * @return the privateKey + */ + public String getPrivateKey() { + return privateKey; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Certificate [data=" + data + ", privateKey=" + privateKey + "]"; + } + +} diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/Cloudpipe.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/Cloudpipe.java index 69d1b5a91..3a77a98bc 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/Cloudpipe.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/Cloudpipe.java @@ -1,134 +1,134 @@ -package com.woorea.openstack.nova.model; - -import java.io.Serializable; -import java.util.Calendar; - -import org.codehaus.jackson.map.annotate.JsonRootName; - -@JsonRootName("cloudpipe") -public class Cloudpipe implements Serializable { - - private String projectId; - - private String internalIp; - - private String publicIp; - - private String publicPort; - - private String state; - - private String instanceId; - - private Calendar createdAt; - - /** - * @return the projectId - */ - public String getProjectId() { - return projectId; - } - - /** - * @param projectId the projectId to set - */ - public void setProjectId(String projectId) { - this.projectId = projectId; - } - - /** - * @return the internalIp - */ - public String getInternalIp() { - return internalIp; - } - - /** - * @param internalIp the internalIp to set - */ - public void setInternalIp(String internalIp) { - this.internalIp = internalIp; - } - - /** - * @return the publicIp - */ - public String getPublicIp() { - return publicIp; - } - - /** - * @param publicIp the publicIp to set - */ - public void setPublicIp(String publicIp) { - this.publicIp = publicIp; - } - - /** - * @return the publicPort - */ - public String getPublicPort() { - return publicPort; - } - - /** - * @param publicPort the publicPort to set - */ - public void setPublicPort(String publicPort) { - this.publicPort = publicPort; - } - - /** - * @return the state - */ - public String getState() { - return state; - } - - /** - * @param state the state to set - */ - public void setState(String state) { - this.state = state; - } - - /** - * @return the instanceId - */ - public String getInstanceId() { - return instanceId; - } - - /** - * @param instanceId the instanceId to set - */ - public void setInstanceId(String instanceId) { - this.instanceId = instanceId; - } - - /** - * @return the createdAt - */ - public Calendar getCreatedAt() { - return createdAt; - } - - /** - * @param createdAt the createdAt to set - */ - public void setCreatedAt(Calendar createdAt) { - this.createdAt = createdAt; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "CloudPipe [projectId=" + projectId + ", internalIp=" - + internalIp + ", publicIp=" + publicIp + ", publicPort=" - + publicPort + ", state=" + state + ", instanceId=" - + instanceId + ", createdAt=" + createdAt + "]"; - } - -} +package com.woorea.openstack.nova.model; + +import java.io.Serializable; +import java.util.Calendar; + +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName("cloudpipe") +public class Cloudpipe implements Serializable { + + private String projectId; + + private String internalIp; + + private String publicIp; + + private String publicPort; + + private String state; + + private String instanceId; + + private Calendar createdAt; + + /** + * @return the projectId + */ + public String getProjectId() { + return projectId; + } + + /** + * @param projectId the projectId to set + */ + public void setProjectId(String projectId) { + this.projectId = projectId; + } + + /** + * @return the internalIp + */ + public String getInternalIp() { + return internalIp; + } + + /** + * @param internalIp the internalIp to set + */ + public void setInternalIp(String internalIp) { + this.internalIp = internalIp; + } + + /** + * @return the publicIp + */ + public String getPublicIp() { + return publicIp; + } + + /** + * @param publicIp the publicIp to set + */ + public void setPublicIp(String publicIp) { + this.publicIp = publicIp; + } + + /** + * @return the publicPort + */ + public String getPublicPort() { + return publicPort; + } + + /** + * @param publicPort the publicPort to set + */ + public void setPublicPort(String publicPort) { + this.publicPort = publicPort; + } + + /** + * @return the state + */ + public String getState() { + return state; + } + + /** + * @param state the state to set + */ + public void setState(String state) { + this.state = state; + } + + /** + * @return the instanceId + */ + public String getInstanceId() { + return instanceId; + } + + /** + * @param instanceId the instanceId to set + */ + public void setInstanceId(String instanceId) { + this.instanceId = instanceId; + } + + /** + * @return the createdAt + */ + public Calendar getCreatedAt() { + return createdAt; + } + + /** + * @param createdAt the createdAt to set + */ + public void setCreatedAt(Calendar createdAt) { + this.createdAt = createdAt; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "CloudPipe [projectId=" + projectId + ", internalIp=" + + internalIp + ", publicIp=" + publicIp + ", publicPort=" + + publicPort + ", state=" + state + ", instanceId=" + + instanceId + ", createdAt=" + createdAt + "]"; + } + +} diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/Cloudpipes.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/Cloudpipes.java index 3a3f13e01..831010e89 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/Cloudpipes.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/Cloudpipes.java @@ -1,28 +1,28 @@ -package com.woorea.openstack.nova.model; - -import java.io.Serializable; -import java.util.List; - -import org.codehaus.jackson.annotate.JsonProperty; - -public class Cloudpipes implements Serializable { - - @JsonProperty("cloudpipes") - private List list; - - /** - * @return the list - */ - public List getList() { - return list; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Flavors [list=" + list + "]"; - } - -} +package com.woorea.openstack.nova.model; + +import java.io.Serializable; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class Cloudpipes implements Serializable { + + @JsonProperty("cloudpipes") + private List list; + + /** + * @return the list + */ + public List getList() { + return list; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Flavors [list=" + list + "]"; + } + +} diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/Extension.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/Extension.java index 20892b78b..d507c176f 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/Extension.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/Extension.java @@ -1,75 +1,75 @@ -package com.woorea.openstack.nova.model; - -import java.io.Serializable; -import java.util.Calendar; -import java.util.List; - -import org.codehaus.jackson.map.annotate.JsonRootName; - -@JsonRootName("extension") -public class Extension implements Serializable { - - private String alias; - - private String description; - - private String name; - - private String namespace; - - private Calendar updated; - - private List links; - - /** - * @return the alias - */ - public String getAlias() { - return alias; - } - - /** - * @return the description - */ - public String getDescription() { - return description; - } - - /** - * @return the name - */ - public String getName() { - return name; - } - - /** - * @return the namespace - */ - public String getNamespace() { - return namespace; - } - - /** - * @return the updated - */ - public Calendar getUpdated() { - return updated; - } - - /** - * @return the links - */ - public List getLinks() { - return links; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Extension [alias=" + alias + ", description=" + description - + ", name=" + name + ", namespace=" + namespace + "]"; - } - -} +package com.woorea.openstack.nova.model; + +import java.io.Serializable; +import java.util.Calendar; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName("extension") +public class Extension implements Serializable { + + private String alias; + + private String description; + + private String name; + + private String namespace; + + private Calendar updated; + + private List links; + + /** + * @return the alias + */ + public String getAlias() { + return alias; + } + + /** + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * @return the name + */ + public String getName() { + return name; + } + + /** + * @return the namespace + */ + public String getNamespace() { + return namespace; + } + + /** + * @return the updated + */ + public Calendar getUpdated() { + return updated; + } + + /** + * @return the links + */ + public List getLinks() { + return links; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Extension [alias=" + alias + ", description=" + description + + ", name=" + name + ", namespace=" + namespace + "]"; + } + +} diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/Extensions.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/Extensions.java index 5d049d997..e84ee17d1 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/Extensions.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/Extensions.java @@ -1,34 +1,34 @@ -package com.woorea.openstack.nova.model; - -import java.io.Serializable; -import java.util.Iterator; -import java.util.List; - -import org.codehaus.jackson.annotate.JsonProperty; - -public class Extensions implements Iterable, Serializable { - - @JsonProperty("extensions") - private List list; - - /** - * @return the list - */ - public List getList() { - return list; - } - - @Override - public Iterator iterator() { - return list.iterator(); - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Extensions [list=" + list + "]"; - } - -} +package com.woorea.openstack.nova.model; + +import java.io.Serializable; +import java.util.Iterator; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class Extensions implements Iterable, Serializable { + + @JsonProperty("extensions") + private List list; + + /** + * @return the list + */ + public List getList() { + return list; + } + + @Override + public Iterator iterator() { + return list.iterator(); + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Extensions [list=" + list + "]"; + } + +} diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/Flavor.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/Flavor.java index b04472bf6..94ec40922 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/Flavor.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/Flavor.java @@ -1,239 +1,239 @@ -package com.woorea.openstack.nova.model; - -import java.io.Serializable; -import java.util.List; - -import org.codehaus.jackson.annotate.JsonProperty; -import org.codehaus.jackson.map.annotate.JsonRootName; - -@JsonRootName("flavor") -public class Flavor implements Serializable { - - private String id; - - private String name; - - private String vcpus; - - private Integer ram; - - private String disk; - - @JsonProperty("OS-FLV-EXT-DATA:ephemeral") - private Integer ephemeral; - - private String swap; - - @JsonProperty("rxtx_factor") - private Float rxtxFactor; - - @JsonProperty("OS-FLV-DISABLED:disabled") - private Boolean disabled; - - @JsonProperty("rxtx_quota") - private Integer rxtxQuota; - - @JsonProperty("rxtx_cap") - private Integer rxtxCap; - - private List links; - - @JsonProperty("os-flavor-access:is_public") - private Boolean isPublic; - - /** - * @return the id - */ - public String getId() { - return id; - } - - /** - * @param id the id to set - */ - public void setId(String id) { - this.id = id; - } - - /** - * @return the name - */ - public String getName() { - return name; - } - - /** - * @param name the name to set - */ - public void setName(String name) { - this.name = name; - } - - /** - * @return the vcpus - */ - public String getVcpus() { - return vcpus; - } - - /** - * @param vcpus the vcpus to set - */ - public void setVcpus(String vcpus) { - this.vcpus = vcpus; - } - - /** - * @return the ram - */ - public Integer getRam() { - return ram; - } - - /** - * @param ram the ram to set - */ - public void setRam(Integer ram) { - this.ram = ram; - } - - /** - * @return the disk - */ - public String getDisk() { - return disk; - } - - /** - * @param disk the disk to set - */ - public void setDisk(String disk) { - this.disk = disk; - } - - /** - * @return the ephemeral - */ - public Integer getEphemeral() { - return ephemeral; - } - - /** - * @param ephemeral the ephemeral to set - */ - public void setEphemeral(Integer ephemeral) { - this.ephemeral = ephemeral; - } - - /** - * @return the swap - */ - public String getSwap() { - return swap; - } - - /** - * @param swap the swap to set - */ - public void setSwap(String swap) { - this.swap = swap; - } - - /** - * @return the rxtxFactor - */ - public Float getRxtxFactor() { - return rxtxFactor; - } - - /** - * @param rxtxFactor the rxtxFactor to set - */ - public void setRxtxFactor(Float rxtxFactor) { - this.rxtxFactor = rxtxFactor; - } - - /** - * @return the rxtxQuota - */ - public Integer getRxtxQuota() { - return rxtxQuota; - } - - /** - * @param rxtxQuota the rxtxQuota to set - */ - public void setRxtxQuota(Integer rxtxQuota) { - this.rxtxQuota = rxtxQuota; - } - - /** - * @return the rxtxCap - */ - public Integer getRxtxCap() { - return rxtxCap; - } - - /** - * @param rxtxCap the rxtxCap to set - */ - public void setRxtxCap(Integer rxtxCap) { - this.rxtxCap = rxtxCap; - } - - /** - * @return the disabled - */ - public Boolean getDisabled() { - return disabled; - } - - /** - * @param disabled the disabled to set - */ - public void setDisabled(Boolean disabled) { - this.disabled = disabled; - } - - /** - * @return the isPublic - */ - public Boolean isPublic() { - return isPublic; - } - - /** - * @param isPublic the isPublic to set - */ - public void setPublic(Boolean isPublic) { - this.isPublic = isPublic; - } - - /** - * @return the links - */ - public List getLinks() { - return links; - } - - /** - * @param links the links to set - */ - public void setLinks(List links) { - this.links = links; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Flavor [id=" + id + ", name=" + name + ", vcpus=" + vcpus - + ", ram=" + ram + ", disk=" + disk + ", ephemeral=" - + ephemeral + ", swap=" + swap + ", rxtxFactor=" + rxtxFactor - + ", disabled=" + disabled + ", rxtxQuota=" + rxtxQuota - + ", rxtxCap=" + rxtxCap + ", links=" + links + ", isPublic=" - + isPublic + "]"; - } - -} +package com.woorea.openstack.nova.model; + +import java.io.Serializable; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName("flavor") +public class Flavor implements Serializable { + + private String id; + + private String name; + + private String vcpus; + + private Integer ram; + + private String disk; + + @JsonProperty("OS-FLV-EXT-DATA:ephemeral") + private Integer ephemeral; + + private String swap; + + @JsonProperty("rxtx_factor") + private Float rxtxFactor; + + @JsonProperty("OS-FLV-DISABLED:disabled") + private Boolean disabled; + + @JsonProperty("rxtx_quota") + private Integer rxtxQuota; + + @JsonProperty("rxtx_cap") + private Integer rxtxCap; + + private List links; + + @JsonProperty("os-flavor-access:is_public") + private Boolean isPublic; + + /** + * @return the id + */ + public String getId() { + return id; + } + + /** + * @param id the id to set + */ + public void setId(String id) { + this.id = id; + } + + /** + * @return the name + */ + public String getName() { + return name; + } + + /** + * @param name the name to set + */ + public void setName(String name) { + this.name = name; + } + + /** + * @return the vcpus + */ + public String getVcpus() { + return vcpus; + } + + /** + * @param vcpus the vcpus to set + */ + public void setVcpus(String vcpus) { + this.vcpus = vcpus; + } + + /** + * @return the ram + */ + public Integer getRam() { + return ram; + } + + /** + * @param ram the ram to set + */ + public void setRam(Integer ram) { + this.ram = ram; + } + + /** + * @return the disk + */ + public String getDisk() { + return disk; + } + + /** + * @param disk the disk to set + */ + public void setDisk(String disk) { + this.disk = disk; + } + + /** + * @return the ephemeral + */ + public Integer getEphemeral() { + return ephemeral; + } + + /** + * @param ephemeral the ephemeral to set + */ + public void setEphemeral(Integer ephemeral) { + this.ephemeral = ephemeral; + } + + /** + * @return the swap + */ + public String getSwap() { + return swap; + } + + /** + * @param swap the swap to set + */ + public void setSwap(String swap) { + this.swap = swap; + } + + /** + * @return the rxtxFactor + */ + public Float getRxtxFactor() { + return rxtxFactor; + } + + /** + * @param rxtxFactor the rxtxFactor to set + */ + public void setRxtxFactor(Float rxtxFactor) { + this.rxtxFactor = rxtxFactor; + } + + /** + * @return the rxtxQuota + */ + public Integer getRxtxQuota() { + return rxtxQuota; + } + + /** + * @param rxtxQuota the rxtxQuota to set + */ + public void setRxtxQuota(Integer rxtxQuota) { + this.rxtxQuota = rxtxQuota; + } + + /** + * @return the rxtxCap + */ + public Integer getRxtxCap() { + return rxtxCap; + } + + /** + * @param rxtxCap the rxtxCap to set + */ + public void setRxtxCap(Integer rxtxCap) { + this.rxtxCap = rxtxCap; + } + + /** + * @return the disabled + */ + public Boolean getDisabled() { + return disabled; + } + + /** + * @param disabled the disabled to set + */ + public void setDisabled(Boolean disabled) { + this.disabled = disabled; + } + + /** + * @return the isPublic + */ + public Boolean isPublic() { + return isPublic; + } + + /** + * @param isPublic the isPublic to set + */ + public void setPublic(Boolean isPublic) { + this.isPublic = isPublic; + } + + /** + * @return the links + */ + public List getLinks() { + return links; + } + + /** + * @param links the links to set + */ + public void setLinks(List links) { + this.links = links; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Flavor [id=" + id + ", name=" + name + ", vcpus=" + vcpus + + ", ram=" + ram + ", disk=" + disk + ", ephemeral=" + + ephemeral + ", swap=" + swap + ", rxtxFactor=" + rxtxFactor + + ", disabled=" + disabled + ", rxtxQuota=" + rxtxQuota + + ", rxtxCap=" + rxtxCap + ", links=" + links + ", isPublic=" + + isPublic + "]"; + } + +} diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/FlavorForCreate.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/FlavorForCreate.java index 295096d2a..19640b795 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/FlavorForCreate.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/FlavorForCreate.java @@ -1,142 +1,141 @@ -package com.woorea.openstack.nova.model; - -import java.io.Serializable; -import java.util.List; - -import org.codehaus.jackson.annotate.JsonProperty; -import org.codehaus.jackson.map.annotate.JsonRootName; - -@JsonRootName("flavor") -public class FlavorForCreate implements Serializable { - - private String id; - - private String name; - - private String vcpus; - - private Integer ram; - - private String disk; - - @JsonProperty("OS-FLV-EXT-DATA:ephemeral") - private Integer ephemeral; - - private String swap; - - @JsonProperty("rxtx_factor") - private Float rxtxFactor; - - /** - * @return the id - */ - public String getId() { - return id; - } - - /** - * @param id the id to set - */ - public void setId(String id) { - this.id = id; - } - - /** - * @return the name - */ - public String getName() { - return name; - } - - /** - * @param name the name to set - */ - public void setName(String name) { - this.name = name; - } - - /** - * @return the vcpus - */ - public String getVcpus() { - return vcpus; - } - - /** - * @param vcpus the vcpus to set - */ - public void setVcpus(String vcpus) { - this.vcpus = vcpus; - } - - /** - * @return the ram - */ - public Integer getRam() { - return ram; - } - - /** - * @param ram the ram to set - */ - public void setRam(Integer ram) { - this.ram = ram; - } - - /** - * @return the disk - */ - public String getDisk() { - return disk; - } - - /** - * @param disk the disk to set - */ - public void setDisk(String disk) { - this.disk = disk; - } - - /** - * @return the ephemeral - */ - public Integer getEphemeral() { - return ephemeral; - } - - /** - * @param ephemeral the ephemeral to set - */ - public void setEphemeral(Integer ephemeral) { - this.ephemeral = ephemeral; - } - - /** - * @return the swap - */ - public String getSwap() { - return swap; - } - - /** - * @param swap the swap to set - */ - public void setSwap(String swap) { - this.swap = swap; - } - - /** - * @return the rxtxFactor - */ - public Float getRxtxFactor() { - return rxtxFactor; - } - - /** - * @param rxtxFactor the rxtxFactor to set - */ - public void setRxtxFactor(Float rxtxFactor) { - this.rxtxFactor = rxtxFactor; - } - -} +package com.woorea.openstack.nova.model; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName("flavor") +public class FlavorForCreate implements Serializable { + + private String id; + + private String name; + + private String vcpus; + + private Integer ram; + + private String disk; + + @JsonProperty("OS-FLV-EXT-DATA:ephemeral") + private Integer ephemeral; + + private String swap; + + @JsonProperty("rxtx_factor") + private Float rxtxFactor; + + /** + * @return the id + */ + public String getId() { + return id; + } + + /** + * @param id the id to set + */ + public void setId(String id) { + this.id = id; + } + + /** + * @return the name + */ + public String getName() { + return name; + } + + /** + * @param name the name to set + */ + public void setName(String name) { + this.name = name; + } + + /** + * @return the vcpus + */ + public String getVcpus() { + return vcpus; + } + + /** + * @param vcpus the vcpus to set + */ + public void setVcpus(String vcpus) { + this.vcpus = vcpus; + } + + /** + * @return the ram + */ + public Integer getRam() { + return ram; + } + + /** + * @param ram the ram to set + */ + public void setRam(Integer ram) { + this.ram = ram; + } + + /** + * @return the disk + */ + public String getDisk() { + return disk; + } + + /** + * @param disk the disk to set + */ + public void setDisk(String disk) { + this.disk = disk; + } + + /** + * @return the ephemeral + */ + public Integer getEphemeral() { + return ephemeral; + } + + /** + * @param ephemeral the ephemeral to set + */ + public void setEphemeral(Integer ephemeral) { + this.ephemeral = ephemeral; + } + + /** + * @return the swap + */ + public String getSwap() { + return swap; + } + + /** + * @param swap the swap to set + */ + public void setSwap(String swap) { + this.swap = swap; + } + + /** + * @return the rxtxFactor + */ + public Float getRxtxFactor() { + return rxtxFactor; + } + + /** + * @param rxtxFactor the rxtxFactor to set + */ + public void setRxtxFactor(Float rxtxFactor) { + this.rxtxFactor = rxtxFactor; + } + +} diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/Flavors.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/Flavors.java index 0337a3bb5..e64323a14 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/Flavors.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/Flavors.java @@ -1,34 +1,34 @@ -package com.woorea.openstack.nova.model; - -import java.io.Serializable; -import java.util.Iterator; -import java.util.List; - -import org.codehaus.jackson.annotate.JsonProperty; - -public class Flavors implements Iterable, Serializable { - - @JsonProperty("flavors") - private List list; - - /** - * @return the list - */ - public List getList() { - return list; - } - - @Override - public Iterator iterator() { - return list.iterator(); - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Flavors [list=" + list + "]"; - } - -} +package com.woorea.openstack.nova.model; + +import java.io.Serializable; +import java.util.Iterator; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class Flavors implements Iterable, Serializable { + + @JsonProperty("flavors") + private List list; + + /** + * @return the list + */ + public List getList() { + return list; + } + + @Override + public Iterator iterator() { + return list.iterator(); + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Flavors [list=" + list + "]"; + } + +} diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/FloatingIp.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/FloatingIp.java index 3eda923f0..991a1ebe6 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/FloatingIp.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/FloatingIp.java @@ -1,67 +1,67 @@ -package com.woorea.openstack.nova.model; - -import java.io.Serializable; - -import org.codehaus.jackson.annotate.JsonProperty; -import org.codehaus.jackson.map.annotate.JsonRootName; - -@JsonRootName("floating_ip") -public class FloatingIp implements Serializable { - - private String id; - - private String pool; - - private String ip; - - @JsonProperty("fixed_ip") - private String fixedIp; - - @JsonProperty("instance_id") - private String instanceId; - - /** - * @return the id - */ - public String getId() { - return id; - } - - /** - * @return the pool - */ - public String getPool() { - return pool; - } - - /** - * @return the ip - */ - public String getIp() { - return ip; - } - - /** - * @return the fixedIp - */ - public String getFixedIp() { - return fixedIp; - } - - /** - * @return the instanceId - */ - public String getInstanceId() { - return instanceId; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "FloatingIp [id=" + id + ", pool=" + pool + ", ip=" + ip - + ", fixedIp=" + fixedIp + ", instanceId=" + instanceId + "]"; - } - -} +package com.woorea.openstack.nova.model; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName("floating_ip") +public class FloatingIp implements Serializable { + + private String id; + + private String pool; + + private String ip; + + @JsonProperty("fixed_ip") + private String fixedIp; + + @JsonProperty("instance_id") + private String instanceId; + + /** + * @return the id + */ + public String getId() { + return id; + } + + /** + * @return the pool + */ + public String getPool() { + return pool; + } + + /** + * @return the ip + */ + public String getIp() { + return ip; + } + + /** + * @return the fixedIp + */ + public String getFixedIp() { + return fixedIp; + } + + /** + * @return the instanceId + */ + public String getInstanceId() { + return instanceId; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "FloatingIp [id=" + id + ", pool=" + pool + ", ip=" + ip + + ", fixedIp=" + fixedIp + ", instanceId=" + instanceId + "]"; + } + +} diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/FloatingIpDomain.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/FloatingIpDomain.java index 4a6a280e6..5da4f6bd1 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/FloatingIpDomain.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/FloatingIpDomain.java @@ -1,58 +1,58 @@ -package com.woorea.openstack.nova.model; - -import java.io.Serializable; - -import org.codehaus.jackson.annotate.JsonProperty; -import org.codehaus.jackson.map.annotate.JsonRootName; - -@JsonRootName("floating-ip-pool") -public class FloatingIpDomain implements Serializable { - - private String domain; - - private String scope; - - private String project; - - @JsonProperty("availabilityZone") - private String availabilityZone; - - /** - * @return the domain - */ - public String getDomain() { - return domain; - } - - /** - * @return the scope - */ - public String getScope() { - return scope; - } - - /** - * @return the project - */ - public String getProject() { - return project; - } - - /** - * @return the availabilityZone - */ - public String getAvailabilityZone() { - return availabilityZone; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "FloatingIpDomain [domain=" + domain + ", scope=" + scope - + ", project=" + project + ", availabilityZone=" - + availabilityZone + "]"; - } - -} +package com.woorea.openstack.nova.model; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName("floating-ip-pool") +public class FloatingIpDomain implements Serializable { + + private String domain; + + private String scope; + + private String project; + + @JsonProperty("availabilityZone") + private String availabilityZone; + + /** + * @return the domain + */ + public String getDomain() { + return domain; + } + + /** + * @return the scope + */ + public String getScope() { + return scope; + } + + /** + * @return the project + */ + public String getProject() { + return project; + } + + /** + * @return the availabilityZone + */ + public String getAvailabilityZone() { + return availabilityZone; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "FloatingIpDomain [domain=" + domain + ", scope=" + scope + + ", project=" + project + ", availabilityZone=" + + availabilityZone + "]"; + } + +} diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/FloatingIpDomains.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/FloatingIpDomains.java index 292b59fb4..6b4de2521 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/FloatingIpDomains.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/FloatingIpDomains.java @@ -1,34 +1,34 @@ -package com.woorea.openstack.nova.model; - -import java.io.Serializable; -import java.util.Iterator; -import java.util.List; - -import org.codehaus.jackson.annotate.JsonProperty; - -public class FloatingIpDomains implements Iterable, Serializable { - - @JsonProperty("domain_entries") - private List list; - - /** - * @return the list - */ - public List getList() { - return list; - } - - @Override - public Iterator iterator() { - return list.iterator(); - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "FloatingIpDomains [list=" + list + "]"; - } - -} +package com.woorea.openstack.nova.model; + +import java.io.Serializable; +import java.util.Iterator; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class FloatingIpDomains implements Iterable, Serializable { + + @JsonProperty("domain_entries") + private List list; + + /** + * @return the list + */ + public List getList() { + return list; + } + + @Override + public Iterator iterator() { + return list.iterator(); + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "FloatingIpDomains [list=" + list + "]"; + } + +} diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/FloatingIpPools.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/FloatingIpPools.java index db1c0e3e2..b4cf66d84 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/FloatingIpPools.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/FloatingIpPools.java @@ -1,57 +1,56 @@ -package com.woorea.openstack.nova.model; - -import java.io.Serializable; -import java.util.Iterator; -import java.util.List; - -import org.codehaus.jackson.annotate.JsonProperty; - -import com.woorea.openstack.nova.model.FloatingIpPools.FloatingIpPool; - -public class FloatingIpPools implements Iterable, Serializable { - - public static class FloatingIpPool implements Serializable { - - private String name; - - /** - * @return the name - */ - public String getName() { - return name; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "FloatingIpPool [name=" + name + "]"; - } - - } - - @JsonProperty("floating_ip_pools") - private List list; - - /** - * @return the list - */ - public List getList() { - return list; - } - - @Override - public Iterator iterator() { - return list.iterator(); - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "FloatingIpPools [list=" + list + "]"; - } - -} +package com.woorea.openstack.nova.model; + +import java.io.Serializable; +import java.util.Iterator; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.woorea.openstack.nova.model.FloatingIpPools.FloatingIpPool; + +public class FloatingIpPools implements Iterable, Serializable { + + public static class FloatingIpPool implements Serializable { + + private String name; + + /** + * @return the name + */ + public String getName() { + return name; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "FloatingIpPool [name=" + name + "]"; + } + + } + + @JsonProperty("floating_ip_pools") + private List list; + + /** + * @return the list + */ + public List getList() { + return list; + } + + @Override + public Iterator iterator() { + return list.iterator(); + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "FloatingIpPools [list=" + list + "]"; + } + +} diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/FloatingIps.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/FloatingIps.java index 776c4ca8e..a39646efa 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/FloatingIps.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/FloatingIps.java @@ -1,34 +1,34 @@ -package com.woorea.openstack.nova.model; - -import java.io.Serializable; -import java.util.Iterator; -import java.util.List; - -import org.codehaus.jackson.annotate.JsonProperty; - -public class FloatingIps implements Iterable, Serializable { - - @JsonProperty("floating_ips") - private List list; - - /** - * @return the list - */ - public List getList() { - return list; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "FloatingIps [list=" + list + "]"; - } - - @Override - public Iterator iterator() { - return list.iterator(); - } - -} +package com.woorea.openstack.nova.model; + +import java.io.Serializable; +import java.util.Iterator; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class FloatingIps implements Iterable, Serializable { + + @JsonProperty("floating_ips") + private List list; + + /** + * @return the list + */ + public List getList() { + return list; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "FloatingIps [list=" + list + "]"; + } + + @Override + public Iterator iterator() { + return list.iterator(); + } + +} diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/Host.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/Host.java index 40509642f..25436999b 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/Host.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/Host.java @@ -1,109 +1,109 @@ -package com.woorea.openstack.nova.model; - -import java.io.Serializable; -import java.util.List; - -import org.codehaus.jackson.annotate.JsonProperty; - -public class Host implements Serializable { - - public static final class ResourceWrapper implements Serializable { - - public static final class Resource implements Serializable { - - private String project; - - @JsonProperty("memory_mb") - private Integer memoryMb; - - private String host; - - private Integer cpu; - - @JsonProperty("disk_gb") - private Integer diskGb; - - /** - * @return the project - */ - public String getProject() { - return project; - } - - /** - * @return the memoryMb - */ - public Integer getMemoryMb() { - return memoryMb; - } - - /** - * @return the host - */ - public String getHost() { - return host; - } - - /** - * @return the cpu - */ - public Integer getCpu() { - return cpu; - } - - /** - * @return the diskGb - */ - public Integer getDiskGb() { - return diskGb; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Resource [project=" + project + ", memoryMb=" - + memoryMb + ", host=" + host + ", cpu=" + cpu - + ", diskGb=" + diskGb + "]"; - } - - } - - private Resource resource; - - /** - * @return the resource - */ - public Resource getResource() { - return resource; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "ResourceWrapper [resource=" + resource + "]"; - } - - } - - private List host; - - /** - * @return the host - */ - public List getHost() { - return host; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Host [host=" + host + "]"; - } - -} +package com.woorea.openstack.nova.model; + +import java.io.Serializable; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class Host implements Serializable { + + public static final class ResourceWrapper implements Serializable { + + public static final class Resource implements Serializable { + + private String project; + + @JsonProperty("memory_mb") + private Integer memoryMb; + + private String host; + + private Integer cpu; + + @JsonProperty("disk_gb") + private Integer diskGb; + + /** + * @return the project + */ + public String getProject() { + return project; + } + + /** + * @return the memoryMb + */ + public Integer getMemoryMb() { + return memoryMb; + } + + /** + * @return the host + */ + public String getHost() { + return host; + } + + /** + * @return the cpu + */ + public Integer getCpu() { + return cpu; + } + + /** + * @return the diskGb + */ + public Integer getDiskGb() { + return diskGb; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Resource [project=" + project + ", memoryMb=" + + memoryMb + ", host=" + host + ", cpu=" + cpu + + ", diskGb=" + diskGb + "]"; + } + + } + + private Resource resource; + + /** + * @return the resource + */ + public Resource getResource() { + return resource; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "ResourceWrapper [resource=" + resource + "]"; + } + + } + + private List host; + + /** + * @return the host + */ + public List getHost() { + return host; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Host [host=" + host + "]"; + } + +} diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/HostAggregate.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/HostAggregate.java index ad68faab9..5bfd46c79 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/HostAggregate.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/HostAggregate.java @@ -1,110 +1,110 @@ -package com.woorea.openstack.nova.model; - -import java.io.Serializable; -import java.util.List; -import java.util.Map; - -import org.codehaus.jackson.annotate.JsonProperty; -import org.codehaus.jackson.map.annotate.JsonRootName; - -@JsonRootName("aggregate") -public class HostAggregate implements Serializable { - - private String id; - - private String name; - - @JsonProperty("availability_zone") - private String availabilityZone; - - @JsonProperty("created_at") - private String createdAt; - - @JsonProperty("updated_at") - private String updatedAt; - - @JsonProperty("deleted_at") - private String deletedAt; - - private Boolean deleted; - - private List hosts; - - private Map metadata; - - /** - * @return the id - */ - public String getId() { - return id; - } - - /** - * @return the name - */ - public String getName() { - return name; - } - - /** - * @return the availabilityZone - */ - public String getAvailabilityZone() { - return availabilityZone; - } - - /** - * @return the createdAt - */ - public String getCreatedAt() { - return createdAt; - } - - /** - * @return the updatedAt - */ - public String getUpdatedAt() { - return updatedAt; - } - - /** - * @return the deletedAt - */ - public String getDeletedAt() { - return deletedAt; - } - - /** - * @return the deleted - */ - public Boolean getDeleted() { - return deleted; - } - - /** - * @return the hosts - */ - public List getHosts() { - return hosts; - } - - /** - * @return the metadata - */ - public Map getMetadata() { - return metadata; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "HostAggregate [id=" + id + ", name=" + name - + ", availabilityZone=" + availabilityZone + ", createdAt=" - + createdAt + ", updatedAt=" + updatedAt + ", deletedAt=" - + deletedAt + ", deleted=" + deleted + ", hosts=" + hosts - + ", metadata=" + metadata + "]"; - } - -} +package com.woorea.openstack.nova.model; + +import java.io.Serializable; +import java.util.List; +import java.util.Map; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName("aggregate") +public class HostAggregate implements Serializable { + + private String id; + + private String name; + + @JsonProperty("availability_zone") + private String availabilityZone; + + @JsonProperty("created_at") + private String createdAt; + + @JsonProperty("updated_at") + private String updatedAt; + + @JsonProperty("deleted_at") + private String deletedAt; + + private Boolean deleted; + + private List hosts; + + private Map metadata; + + /** + * @return the id + */ + public String getId() { + return id; + } + + /** + * @return the name + */ + public String getName() { + return name; + } + + /** + * @return the availabilityZone + */ + public String getAvailabilityZone() { + return availabilityZone; + } + + /** + * @return the createdAt + */ + public String getCreatedAt() { + return createdAt; + } + + /** + * @return the updatedAt + */ + public String getUpdatedAt() { + return updatedAt; + } + + /** + * @return the deletedAt + */ + public String getDeletedAt() { + return deletedAt; + } + + /** + * @return the deleted + */ + public Boolean getDeleted() { + return deleted; + } + + /** + * @return the hosts + */ + public List getHosts() { + return hosts; + } + + /** + * @return the metadata + */ + public Map getMetadata() { + return metadata; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "HostAggregate [id=" + id + ", name=" + name + + ", availabilityZone=" + availabilityZone + ", createdAt=" + + createdAt + ", updatedAt=" + updatedAt + ", deletedAt=" + + deletedAt + ", deleted=" + deleted + ", hosts=" + hosts + + ", metadata=" + metadata + "]"; + } + +} diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/HostAggregates.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/HostAggregates.java index 6810e832e..c0f9f2c52 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/HostAggregates.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/HostAggregates.java @@ -1,34 +1,34 @@ -package com.woorea.openstack.nova.model; - -import java.io.Serializable; -import java.util.Iterator; -import java.util.List; - -import org.codehaus.jackson.annotate.JsonProperty; - -public class HostAggregates implements Iterable, Serializable { - - @JsonProperty("aggregates") - private List list; - - /** - * @return the list - */ - public List getList() { - return list; - } - - @Override - public Iterator iterator() { - return list.iterator(); - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "HostAggregates [list=" + list + "]"; - } - -} +package com.woorea.openstack.nova.model; + +import java.io.Serializable; +import java.util.Iterator; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class HostAggregates implements Iterable, Serializable { + + @JsonProperty("aggregates") + private List list; + + /** + * @return the list + */ + public List getList() { + return list; + } + + @Override + public Iterator iterator() { + return list.iterator(); + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "HostAggregates [list=" + list + "]"; + } + +} diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/Hosts.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/Hosts.java index 1bac38e32..a8ff4f553 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/Hosts.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/Hosts.java @@ -1,77 +1,77 @@ -package com.woorea.openstack.nova.model; - -import java.io.Serializable; -import java.util.Iterator; -import java.util.List; - -import org.codehaus.jackson.annotate.JsonProperty; - -public class Hosts implements Iterable, Serializable { - - public static final class Host { - - private String zone; - - @JsonProperty("host_name") - private String hostName; - - private String service; - - /** - * @return the hostName - */ - public String getHostName() { - return hostName; - } - - /** - * @return the service - */ - public String getService() { - return service; - } - - public String getZone() { - return zone; - } - - public void setZone(String zone) { - this.zone = zone; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Host [hostName=" + hostName + ", service=" + service + "]"; - } - - } - - @JsonProperty("hosts") - private List list; - - /** - * @return the list - */ - public List getList() { - return list; - } - - @Override - public Iterator iterator() { - return list.iterator(); - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Hosts [list=" + list + "]"; - } - - - -} +package com.woorea.openstack.nova.model; + +import java.io.Serializable; +import java.util.Iterator; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class Hosts implements Iterable, Serializable { + + public static final class Host { + + private String zone; + + @JsonProperty("host_name") + private String hostName; + + private String service; + + /** + * @return the hostName + */ + public String getHostName() { + return hostName; + } + + /** + * @return the service + */ + public String getService() { + return service; + } + + public String getZone() { + return zone; + } + + public void setZone(String zone) { + this.zone = zone; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Host [hostName=" + hostName + ", service=" + service + "]"; + } + + } + + @JsonProperty("hosts") + private List list; + + /** + * @return the list + */ + public List getList() { + return list; + } + + @Override + public Iterator iterator() { + return list.iterator(); + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Hosts [list=" + list + "]"; + } + + + +} diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/Image.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/Image.java index 93949f234..3807e960b 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/Image.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/Image.java @@ -1,232 +1,232 @@ -package com.woorea.openstack.nova.model; - -import java.io.Serializable; -import java.util.Calendar; -import java.util.List; -import java.util.Map; - -import org.codehaus.jackson.annotate.JsonProperty; -import org.codehaus.jackson.map.annotate.JsonRootName; - -@JsonRootName("image") -public class Image implements Serializable { - - public static final class Server implements Serializable { - - private String id; - - private List links; - - /** - * @return the id - */ - public String getId() { - return id; - } - - /** - * @return the links - */ - public List getLinks() { - return links; - } - - @Override - public String toString() { - return "Server [id=" + id + ", links=" + links + "]"; - } - - } - - private String id; - - private String status; - - private String name; - - private Integer progress; - - private Integer minRam; - - private Integer minDisk; - - private Calendar created; - - private Calendar updated; - - @JsonProperty("OS-EXT-IMG-SIZE:size") - private Long size; - - private Map metadata; - - private Server server; - - private List links; - - /** - * @return the id - */ - public String getId() { - return id; - } - - /** - * @param id the id to set - */ - public void setId(String id) { - this.id = id; - } - - /** - * @return the status - */ - public String getStatus() { - return status; - } - - /** - * @param status the status to set - */ - public void setStatus(String status) { - this.status = status; - } - - /** - * @return the name - */ - public String getName() { - return name; - } - - /** - * @param name the name to set - */ - public void setName(String name) { - this.name = name; - } - - /** - * @return the progress - */ - public Integer getProgress() { - return progress; - } - - /** - * @param progress the progress to set - */ - public void setProgress(Integer progress) { - this.progress = progress; - } - - /** - * @return the minRam - */ - public Integer getMinRam() { - return minRam; - } - - /** - * @param minRam the minRam to set - */ - public void setMinRam(Integer minRam) { - this.minRam = minRam; - } - - /** - * @return the minDisk - */ - public Integer getMinDisk() { - return minDisk; - } - - /** - * @param minDisk the minDisk to set - */ - public void setMinDisk(Integer minDisk) { - this.minDisk = minDisk; - } - - /** - * @return the created - */ - public Calendar getCreated() { - return created; - } - - /** - * @param created the created to set - */ - public void setCreated(Calendar created) { - this.created = created; - } - - /** - * @return the updated - */ - public Calendar getUpdated() { - return updated; - } - - /** - * @param updated the updated to set - */ - public void setUpdated(Calendar updated) { - this.updated = updated; - } - - /** - * @return the metadata - */ - public Map getMetadata() { - return metadata; - } - - /** - * @return the size - */ - public Long getSize() { - return size; - } - - /** - * @param metadata the metadata to set - */ - public void setMetadata(Map metadata) { - this.metadata = metadata; - } - - /** - * @return the server - */ - public Server getServer() { - return server; - } - - /** - * @return the links - */ - public List getLinks() { - return links; - } - - /** - * @param links the links to set - */ - public void setLinks(List links) { - this.links = links; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Image [id=" + id + ", status=" + status + ", name=" + name - + ", progress=" + progress + ", minRam=" + minRam - + ", minDisk=" + minDisk + ", created=" + (created != null ? created.getTime() : null) - + ", updated=" + (updated != null ? updated.getTime() : null) + ", size=" + size + ", metadata=" - + metadata + ", server="+server+", links=" + links + "]"; - } - -} +package com.woorea.openstack.nova.model; + +import java.io.Serializable; +import java.util.Calendar; +import java.util.List; +import java.util.Map; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName("image") +public class Image implements Serializable { + + public static final class Server implements Serializable { + + private String id; + + private List links; + + /** + * @return the id + */ + public String getId() { + return id; + } + + /** + * @return the links + */ + public List getLinks() { + return links; + } + + @Override + public String toString() { + return "Server [id=" + id + ", links=" + links + "]"; + } + + } + + private String id; + + private String status; + + private String name; + + private Integer progress; + + private Integer minRam; + + private Integer minDisk; + + private Calendar created; + + private Calendar updated; + + @JsonProperty("OS-EXT-IMG-SIZE:size") + private Long size; + + private Map metadata; + + private Server server; + + private List links; + + /** + * @return the id + */ + public String getId() { + return id; + } + + /** + * @param id the id to set + */ + public void setId(String id) { + this.id = id; + } + + /** + * @return the status + */ + public String getStatus() { + return status; + } + + /** + * @param status the status to set + */ + public void setStatus(String status) { + this.status = status; + } + + /** + * @return the name + */ + public String getName() { + return name; + } + + /** + * @param name the name to set + */ + public void setName(String name) { + this.name = name; + } + + /** + * @return the progress + */ + public Integer getProgress() { + return progress; + } + + /** + * @param progress the progress to set + */ + public void setProgress(Integer progress) { + this.progress = progress; + } + + /** + * @return the minRam + */ + public Integer getMinRam() { + return minRam; + } + + /** + * @param minRam the minRam to set + */ + public void setMinRam(Integer minRam) { + this.minRam = minRam; + } + + /** + * @return the minDisk + */ + public Integer getMinDisk() { + return minDisk; + } + + /** + * @param minDisk the minDisk to set + */ + public void setMinDisk(Integer minDisk) { + this.minDisk = minDisk; + } + + /** + * @return the created + */ + public Calendar getCreated() { + return created; + } + + /** + * @param created the created to set + */ + public void setCreated(Calendar created) { + this.created = created; + } + + /** + * @return the updated + */ + public Calendar getUpdated() { + return updated; + } + + /** + * @param updated the updated to set + */ + public void setUpdated(Calendar updated) { + this.updated = updated; + } + + /** + * @return the metadata + */ + public Map getMetadata() { + return metadata; + } + + /** + * @return the size + */ + public Long getSize() { + return size; + } + + /** + * @param metadata the metadata to set + */ + public void setMetadata(Map metadata) { + this.metadata = metadata; + } + + /** + * @return the server + */ + public Server getServer() { + return server; + } + + /** + * @return the links + */ + public List getLinks() { + return links; + } + + /** + * @param links the links to set + */ + public void setLinks(List links) { + this.links = links; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Image [id=" + id + ", status=" + status + ", name=" + name + + ", progress=" + progress + ", minRam=" + minRam + + ", minDisk=" + minDisk + ", created=" + (created != null ? created.getTime() : null) + + ", updated=" + (updated != null ? updated.getTime() : null) + ", size=" + size + ", metadata=" + + metadata + ", server="+server+", links=" + links + "]"; + } + +} diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/ImageFromVolume.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/ImageFromVolume.java index 30e38d8c6..492c0bf17 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/ImageFromVolume.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/ImageFromVolume.java @@ -1,112 +1,112 @@ -package com.woorea.openstack.nova.model; - -import java.io.Serializable; - -import org.codehaus.jackson.annotate.JsonProperty; -import org.codehaus.jackson.map.annotate.JsonRootName; - -@JsonRootName("os-volume_upload_image") -public class ImageFromVolume implements Serializable { - - @JsonProperty("id") - String id; - @JsonProperty("updates_at") - String updates_at; - @JsonProperty("status") - String status; - @JsonProperty("display_description") - String display_description; - @JsonProperty("size") - String size; - @JsonProperty("volume_type") - String volume_type; - @JsonProperty("image_id") - String image_id; - @JsonProperty("container_format") - String container_format; - @JsonProperty("disk_format") - String disk_format; - @JsonProperty("image_name") - String image_name; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getUpdates_at() { - return updates_at; - } - - public void setUpdates_at(String updates_at) { - this.updates_at = updates_at; - } - - public String getStatus() { - return status; - } - - public void setStatus(String status) { - this.status = status; - } - - public String getDisplay_description() { - return display_description; - } - - public void setDisplay_description(String display_description) { - this.display_description = display_description; - } - - public String getSize() { - return size; - } - - public void setSize(String size) { - this.size = size; - } - - public String getVolume_type() { - return volume_type; - } - - public void setVolume_type(String volume_type) { - this.volume_type = volume_type; - } - - public String getImage_id() { - return image_id; - } - - public void setImage_id(String image_id) { - this.image_id = image_id; - } - - public String getContainer_format() { - return container_format; - } - - public void setContainer_format(String container_format) { - this.container_format = container_format; - } - - public String getDisk_format() { - return disk_format; - } - - public void setDisk_format(String disk_format) { - this.disk_format = disk_format; - } - - public String getImage_name() { - return image_name; - } - - public void setImage_name(String image_name) { - this.image_name = image_name; - } - -} +package com.woorea.openstack.nova.model; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName("os-volume_upload_image") +public class ImageFromVolume implements Serializable { + + @JsonProperty("id") + String id; + @JsonProperty("updates_at") + String updates_at; + @JsonProperty("status") + String status; + @JsonProperty("display_description") + String display_description; + @JsonProperty("size") + String size; + @JsonProperty("volume_type") + String volume_type; + @JsonProperty("image_id") + String image_id; + @JsonProperty("container_format") + String container_format; + @JsonProperty("disk_format") + String disk_format; + @JsonProperty("image_name") + String image_name; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getUpdates_at() { + return updates_at; + } + + public void setUpdates_at(String updates_at) { + this.updates_at = updates_at; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getDisplay_description() { + return display_description; + } + + public void setDisplay_description(String display_description) { + this.display_description = display_description; + } + + public String getSize() { + return size; + } + + public void setSize(String size) { + this.size = size; + } + + public String getVolume_type() { + return volume_type; + } + + public void setVolume_type(String volume_type) { + this.volume_type = volume_type; + } + + public String getImage_id() { + return image_id; + } + + public void setImage_id(String image_id) { + this.image_id = image_id; + } + + public String getContainer_format() { + return container_format; + } + + public void setContainer_format(String container_format) { + this.container_format = container_format; + } + + public String getDisk_format() { + return disk_format; + } + + public void setDisk_format(String disk_format) { + this.disk_format = disk_format; + } + + public String getImage_name() { + return image_name; + } + + public void setImage_name(String image_name) { + this.image_name = image_name; + } + +} diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/Images.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/Images.java index e678e9782..aaf34b0af 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/Images.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/Images.java @@ -1,35 +1,35 @@ -package com.woorea.openstack.nova.model; - -import java.io.Serializable; -import java.util.Iterator; -import java.util.List; - -import org.codehaus.jackson.annotate.JsonProperty; - -public class Images implements Iterable, Serializable { - - @JsonProperty("images") - private List list; - - /** - * @return the list - */ - public List getList() { - return list; - } - - @Override - public Iterator iterator() { - return list.iterator(); - } - - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Images [list=" + list + "]"; - } - -} +package com.woorea.openstack.nova.model; + +import java.io.Serializable; +import java.util.Iterator; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class Images implements Iterable, Serializable { + + @JsonProperty("images") + private List list; + + /** + * @return the list + */ + public List getList() { + return list; + } + + @Override + public Iterator iterator() { + return list.iterator(); + } + + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Images [list=" + list + "]"; + } + +} diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/KeyPair.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/KeyPair.java index b2fdb3464..fd8335272 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/KeyPair.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/KeyPair.java @@ -1,98 +1,98 @@ -package com.woorea.openstack.nova.model; - -import java.io.Serializable; - -import org.codehaus.jackson.annotate.JsonProperty; -import org.codehaus.jackson.map.annotate.JsonRootName; - -@JsonRootName("keypair") -public class KeyPair implements Serializable { - - private String name; - - @JsonProperty("user_id") - private String userId; - - @JsonProperty("public_key") - private String publicKey; - - @JsonProperty("private_key") - private String privateKey; - - private String fingerprint; - - public KeyPair() { - super(); - } - - public KeyPair(String name) { - this.name = name; - } - - public KeyPair(String name, String publicKey) { - this(name); - this.publicKey = publicKey; - } - - /** - * @return the name - */ - public String getName() { - return name; - } - - /** - * @param name the name to set - */ - public void setName(String name) { - this.name = name; - } - - /** - * @return the userId - */ - public String getUserId() { - return userId; - } - - /** - * @return the publicKey - */ - public String getPublicKey() { - return publicKey; - } - - /** - * @param publicKey the publicKey to set - */ - public void setPublicKey(String publicKey) { - this.publicKey = publicKey; - } - - /** - * @return the privateKey - */ - public String getPrivateKey() { - return privateKey; - } - - /** - * @return the fingerprint - */ - public String getFingerprint() { - return fingerprint; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "KeyPair [name=" + name + ", userId=" + userId + ", publicKey=" - + publicKey + ", privateKey=" + privateKey + ", fingerprint=" - + fingerprint + "]"; - } - - - -} +package com.woorea.openstack.nova.model; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName("keypair") +public class KeyPair implements Serializable { + + private String name; + + @JsonProperty("user_id") + private String userId; + + @JsonProperty("public_key") + private String publicKey; + + @JsonProperty("private_key") + private String privateKey; + + private String fingerprint; + + public KeyPair() { + super(); + } + + public KeyPair(String name) { + this.name = name; + } + + public KeyPair(String name, String publicKey) { + this(name); + this.publicKey = publicKey; + } + + /** + * @return the name + */ + public String getName() { + return name; + } + + /** + * @param name the name to set + */ + public void setName(String name) { + this.name = name; + } + + /** + * @return the userId + */ + public String getUserId() { + return userId; + } + + /** + * @return the publicKey + */ + public String getPublicKey() { + return publicKey; + } + + /** + * @param publicKey the publicKey to set + */ + public void setPublicKey(String publicKey) { + this.publicKey = publicKey; + } + + /** + * @return the privateKey + */ + public String getPrivateKey() { + return privateKey; + } + + /** + * @return the fingerprint + */ + public String getFingerprint() { + return fingerprint; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "KeyPair [name=" + name + ", userId=" + userId + ", publicKey=" + + publicKey + ", privateKey=" + privateKey + ", fingerprint=" + + fingerprint + "]"; + } + + + +} diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/KeyPairs.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/KeyPairs.java index 62f158f73..4559b7502 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/KeyPairs.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/KeyPairs.java @@ -1,46 +1,46 @@ -package com.woorea.openstack.nova.model; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.codehaus.jackson.annotate.JsonProperty; - -public class KeyPairs implements Iterable, Serializable { - - public static final class KeyPairWrapper implements Serializable { - - @JsonProperty - private KeyPair keypair; - - } - - @JsonProperty("keypairs") - private List list; - - /** - * @return the list - */ - public List getList() { - List list = new ArrayList(); - for(KeyPairWrapper wrapper : this.list) { - list.add(wrapper.keypair); - } - return list; - } - - @Override - public Iterator iterator() { - return getList().iterator(); - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "KeyPairs [list=" + getList() + "]"; - } - -} +package com.woorea.openstack.nova.model; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class KeyPairs implements Iterable, Serializable { + + public static final class KeyPairWrapper implements Serializable { + + @JsonProperty + private KeyPair keypair; + + } + + @JsonProperty("keypairs") + private List list; + + /** + * @return the list + */ + public List getList() { + List list = new ArrayList(); + for(KeyPairWrapper wrapper : this.list) { + list.add(wrapper.keypair); + } + return list; + } + + @Override + public Iterator iterator() { + return getList().iterator(); + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "KeyPairs [list=" + getList() + "]"; + } + +} diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/Limits.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/Limits.java index 86e9acf3b..cfe8245f7 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/Limits.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/Limits.java @@ -1,394 +1,394 @@ -package com.woorea.openstack.nova.model; - -import java.io.Serializable; -import java.util.Calendar; -import java.util.List; - -import org.codehaus.jackson.annotate.JsonProperty; -import org.codehaus.jackson.map.annotate.JsonRootName; - -@JsonRootName("limits") -public class Limits implements Serializable { - - public static final class RateLimit implements Serializable { - - public static final class LimitEntry implements Serializable { - - @JsonProperty("next-available") - private Calendar nextAvailable; - - private String unit; - - private String verb; - - private Integer remaining; - - private Integer available; - - private Integer value; - - /** - * @return the nextAvailable - */ - public Calendar getNextAvailable() { - return nextAvailable; - } - - /** - * @return the unit - */ - public String getUnit() { - return unit; - } - - /** - * @return the verb - */ - public String getVerb() { - return verb; - } - - /** - * @return the remaining - */ - public Integer getRemaining() { - return remaining; - } - - /** - * @return the available - */ - public Integer getAvailable() { - return available; - } - - /** - * @return the value - */ - public Integer getValue() { - return value; - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "LimitEntry [nextAvailable=" + nextAvailable + ", unit=" - + unit + ", verb=" + verb + ", remaining=" + remaining - + ", available=" + available + ", value=" + value + "]"; - } - - } - - private String regex; - - private String uri; - - private List limit; - - /** - * @return the regex - */ - public String getRegex() { - return regex; - } - - /** - * @return the uri - */ - public String getUri() { - return uri; - } - - /** - * @return the limit - */ - public List getLimit() { - return limit; - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "RateLimit [regex=" + regex + ", uri=" + uri + ", limit=" - + limit + "]"; - } - - } - - public static final class AbsoluteLimit { - - private Integer maxServerMeta; - private Integer serverMetaUsed; - - private Integer maxPersonality; - private Integer personalityUsed; - - private Integer maxImageMeta; - private Integer imageMetaUsed; - - private Integer maxPersonalitySize; - private Integer personalitySizeUsed; - - private Integer maxTotalCores; - private Integer totalCoresUsed; - - private Integer maxTotalInstances; - private Integer totalInstancesUsed; - - private Integer maxTotalRAMSize; - private Integer totalRAMUsed; - - private Integer maxSecurityGroupRules; - private Integer securityGroupRulesUsed; - - private Integer maxTotalKeypairs; - private Integer totalKeyPairsUsed; - - private Integer maxTotalVolumes; - private Integer totalVolumesUsed; - - private Integer maxSecurityGroups; - private Integer totalSecurityGroupsUsed; - - private Integer maxTotalFloatingIps; - private Integer totalFloatingIpsUsed; - - private Integer maxTotalVolumeGigabytes; - private Integer totalVolumeGigabytesUsed; - - /** - * @return the maxServerMeta - */ - public Integer getMaxServerMeta() { - return maxServerMeta; - } - - /** - * @return the maxPersonality - */ - public Integer getMaxPersonality() { - return maxPersonality; - } - - /** - * @return the maxImageMeta - */ - public Integer getMaxImageMeta() { - return maxImageMeta; - } - - /** - * @return the maxPersonalitySize - */ - public Integer getMaxPersonalitySize() { - return maxPersonalitySize; - } - - /** - * @return the maxTotalCores - */ - public Integer getMaxTotalCores() { - return maxTotalCores; - } - - /** - * @return the maxTotalInstances - */ - public Integer getMaxTotalInstances() { - return maxTotalInstances; - } - - /** - * @return the maxTotalRAMSize - */ - public Integer getMaxTotalRAMSize() { - return maxTotalRAMSize; - } - - /** - * @return the totalVolumesUsed - */ - public Integer getTotalVolumesUsed() { - return totalVolumesUsed; - } - - /** - * @return the maxSecurityGroupRules - */ - public Integer getMaxSecurityGroupRules() { - return maxSecurityGroupRules; - } - - /** - * @return the maxTotalKeypairs - */ - public Integer getMaxTotalKeypairs() { - return maxTotalKeypairs; - } - - /** - * @return the totalCoresUsed - */ - public Integer getTotalCoresUsed() { - return totalCoresUsed; - } - - /** - * @return the maxTotalVolumes - */ - public Integer getMaxTotalVolumes() { - return maxTotalVolumes; - } - - /** - * @return the totalRAMUsed - */ - public Integer getTotalRAMUsed() { - return totalRAMUsed; - } - - /** - * @return the totalInstancesUsed - */ - public Integer getTotalInstancesUsed() { - return totalInstancesUsed; - } - - /** - * @return the maxSecurityGroups - */ - public Integer getMaxSecurityGroups() { - return maxSecurityGroups; - } - - /** - * @return the totalVolumeGigabytesUsed - */ - public Integer getTotalVolumeGigabytesUsed() { - return totalVolumeGigabytesUsed; - } - - /** - * @return the totalSecurityGroupsUsed - */ - public Integer getTotalSecurityGroupsUsed() { - return totalSecurityGroupsUsed; - } - - /** - * @return the maxTotalFloatingIps - */ - public Integer getMaxTotalFloatingIps() { - return maxTotalFloatingIps; - } - - /** - * @return the totalKeyPairsUsed - */ - public Integer getTotalKeyPairsUsed() { - return totalKeyPairsUsed; - } - - /** - * @return the maxTotalVolumeGigabytes - */ - public Integer getMaxTotalVolumeGigabytes() { - return maxTotalVolumeGigabytes; - } - - /** - * @return the serverMetaUsed - */ - public Integer getServerMetaUsed() { - return serverMetaUsed; - } - - /** - * @return the personalityUsed - */ - public Integer getPersonalityUsed() { - return personalityUsed; - } - - /** - * @return the imageMetaUsed - */ - public Integer getImageMetaUsed() { - return imageMetaUsed; - } - - /** - * @return the personalitySizeUsed - */ - public Integer getPersonalitySizeUsed() { - return personalitySizeUsed; - } - - /** - * @return the securityGroupRulesUsed - */ - public Integer getSecurityGroupRulesUsed() { - return securityGroupRulesUsed; - } - - /** - * @return the totalFloatingIpsUsed - */ - public Integer getTotalFloatingIpsUsed() { - return totalFloatingIpsUsed; - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "AbsoluteLimit [maxServerMeta=" + maxServerMeta - + ", maxPersonality=" + maxPersonality + ", maxImageMeta=" - + maxImageMeta + ", maxPersonalitySize=" - + maxPersonalitySize + ", maxTotalCores=" + maxTotalCores - + ", maxTotalInstances=" + maxTotalInstances - + ", maxTotalRAMSize=" + maxTotalRAMSize + "]"; - } - - } - - private List rate; - - private AbsoluteLimit absolute; - - /** - * @return the rate - */ - public List getRate() { - return rate; - } - - /** - * @return the absolute - */ - public AbsoluteLimit getAbsolute() { - return absolute; - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Limits [rate=" + rate + ", absolute=" + absolute + "]"; - } - -} +package com.woorea.openstack.nova.model; + +import java.io.Serializable; +import java.util.Calendar; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName("limits") +public class Limits implements Serializable { + + public static final class RateLimit implements Serializable { + + public static final class LimitEntry implements Serializable { + + @JsonProperty("next-available") + private Calendar nextAvailable; + + private String unit; + + private String verb; + + private Integer remaining; + + private Integer available; + + private Integer value; + + /** + * @return the nextAvailable + */ + public Calendar getNextAvailable() { + return nextAvailable; + } + + /** + * @return the unit + */ + public String getUnit() { + return unit; + } + + /** + * @return the verb + */ + public String getVerb() { + return verb; + } + + /** + * @return the remaining + */ + public Integer getRemaining() { + return remaining; + } + + /** + * @return the available + */ + public Integer getAvailable() { + return available; + } + + /** + * @return the value + */ + public Integer getValue() { + return value; + } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "LimitEntry [nextAvailable=" + nextAvailable + ", unit=" + + unit + ", verb=" + verb + ", remaining=" + remaining + + ", available=" + available + ", value=" + value + "]"; + } + + } + + private String regex; + + private String uri; + + private List limit; + + /** + * @return the regex + */ + public String getRegex() { + return regex; + } + + /** + * @return the uri + */ + public String getUri() { + return uri; + } + + /** + * @return the limit + */ + public List getLimit() { + return limit; + } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "RateLimit [regex=" + regex + ", uri=" + uri + ", limit=" + + limit + "]"; + } + + } + + public static final class AbsoluteLimit { + + private Integer maxServerMeta; + private Integer serverMetaUsed; + + private Integer maxPersonality; + private Integer personalityUsed; + + private Integer maxImageMeta; + private Integer imageMetaUsed; + + private Integer maxPersonalitySize; + private Integer personalitySizeUsed; + + private Integer maxTotalCores; + private Integer totalCoresUsed; + + private Integer maxTotalInstances; + private Integer totalInstancesUsed; + + private Integer maxTotalRAMSize; + private Integer totalRAMUsed; + + private Integer maxSecurityGroupRules; + private Integer securityGroupRulesUsed; + + private Integer maxTotalKeypairs; + private Integer totalKeyPairsUsed; + + private Integer maxTotalVolumes; + private Integer totalVolumesUsed; + + private Integer maxSecurityGroups; + private Integer totalSecurityGroupsUsed; + + private Integer maxTotalFloatingIps; + private Integer totalFloatingIpsUsed; + + private Integer maxTotalVolumeGigabytes; + private Integer totalVolumeGigabytesUsed; + + /** + * @return the maxServerMeta + */ + public Integer getMaxServerMeta() { + return maxServerMeta; + } + + /** + * @return the maxPersonality + */ + public Integer getMaxPersonality() { + return maxPersonality; + } + + /** + * @return the maxImageMeta + */ + public Integer getMaxImageMeta() { + return maxImageMeta; + } + + /** + * @return the maxPersonalitySize + */ + public Integer getMaxPersonalitySize() { + return maxPersonalitySize; + } + + /** + * @return the maxTotalCores + */ + public Integer getMaxTotalCores() { + return maxTotalCores; + } + + /** + * @return the maxTotalInstances + */ + public Integer getMaxTotalInstances() { + return maxTotalInstances; + } + + /** + * @return the maxTotalRAMSize + */ + public Integer getMaxTotalRAMSize() { + return maxTotalRAMSize; + } + + /** + * @return the totalVolumesUsed + */ + public Integer getTotalVolumesUsed() { + return totalVolumesUsed; + } + + /** + * @return the maxSecurityGroupRules + */ + public Integer getMaxSecurityGroupRules() { + return maxSecurityGroupRules; + } + + /** + * @return the maxTotalKeypairs + */ + public Integer getMaxTotalKeypairs() { + return maxTotalKeypairs; + } + + /** + * @return the totalCoresUsed + */ + public Integer getTotalCoresUsed() { + return totalCoresUsed; + } + + /** + * @return the maxTotalVolumes + */ + public Integer getMaxTotalVolumes() { + return maxTotalVolumes; + } + + /** + * @return the totalRAMUsed + */ + public Integer getTotalRAMUsed() { + return totalRAMUsed; + } + + /** + * @return the totalInstancesUsed + */ + public Integer getTotalInstancesUsed() { + return totalInstancesUsed; + } + + /** + * @return the maxSecurityGroups + */ + public Integer getMaxSecurityGroups() { + return maxSecurityGroups; + } + + /** + * @return the totalVolumeGigabytesUsed + */ + public Integer getTotalVolumeGigabytesUsed() { + return totalVolumeGigabytesUsed; + } + + /** + * @return the totalSecurityGroupsUsed + */ + public Integer getTotalSecurityGroupsUsed() { + return totalSecurityGroupsUsed; + } + + /** + * @return the maxTotalFloatingIps + */ + public Integer getMaxTotalFloatingIps() { + return maxTotalFloatingIps; + } + + /** + * @return the totalKeyPairsUsed + */ + public Integer getTotalKeyPairsUsed() { + return totalKeyPairsUsed; + } + + /** + * @return the maxTotalVolumeGigabytes + */ + public Integer getMaxTotalVolumeGigabytes() { + return maxTotalVolumeGigabytes; + } + + /** + * @return the serverMetaUsed + */ + public Integer getServerMetaUsed() { + return serverMetaUsed; + } + + /** + * @return the personalityUsed + */ + public Integer getPersonalityUsed() { + return personalityUsed; + } + + /** + * @return the imageMetaUsed + */ + public Integer getImageMetaUsed() { + return imageMetaUsed; + } + + /** + * @return the personalitySizeUsed + */ + public Integer getPersonalitySizeUsed() { + return personalitySizeUsed; + } + + /** + * @return the securityGroupRulesUsed + */ + public Integer getSecurityGroupRulesUsed() { + return securityGroupRulesUsed; + } + + /** + * @return the totalFloatingIpsUsed + */ + public Integer getTotalFloatingIpsUsed() { + return totalFloatingIpsUsed; + } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "AbsoluteLimit [maxServerMeta=" + maxServerMeta + + ", maxPersonality=" + maxPersonality + ", maxImageMeta=" + + maxImageMeta + ", maxPersonalitySize=" + + maxPersonalitySize + ", maxTotalCores=" + maxTotalCores + + ", maxTotalInstances=" + maxTotalInstances + + ", maxTotalRAMSize=" + maxTotalRAMSize + "]"; + } + + } + + private List rate; + + private AbsoluteLimit absolute; + + /** + * @return the rate + */ + public List getRate() { + return rate; + } + + /** + * @return the absolute + */ + public AbsoluteLimit getAbsolute() { + return absolute; + } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Limits [rate=" + rate + ", absolute=" + absolute + "]"; + } + +} diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/Network.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/Network.java index 6e82c1d64..c2e4b0078 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/Network.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/Network.java @@ -1,290 +1,290 @@ -package com.woorea.openstack.nova.model; - -import java.io.Serializable; - -import org.codehaus.jackson.annotate.JsonProperty; -import org.codehaus.jackson.map.annotate.JsonRootName; - -@JsonRootName("network") -public class Network implements Serializable { - - private String id; - - @JsonProperty("vpn_public_address") - private String vpnPublicAddress; - - @JsonProperty("vpn_private_address") - private String vpnPrivateAddress; - - @JsonProperty("vpn_public_port") - private String vpnPublicPort; - - @JsonProperty("dhcp_start") - private String dhcpStart; - - private String bridge; - - @JsonProperty("bridge_interface") - private String bridgeInterface; - - @JsonProperty("updated_at") - private String updatedAt; - - private Boolean deleted; - - private String vlan; - - private String broadcast; - - private String netmask; - - private Boolean injected; - - private String host; - - @JsonProperty("multi_host") - private Boolean multiHost; - - @JsonProperty("created_at") - private String createdAt; - - @JsonProperty("deleted_at") - private String deletedAt; - - private String cidr; - - @JsonProperty("cidr_v6") - private String cidrV6; - - private String gateway; - - @JsonProperty("gateway_v6") - private String gatewayV6; - - @JsonProperty("netmask_v6") - private String netmaskV6; - - @JsonProperty("project_id") - private String projectId; - - @JsonProperty("rxtx_base") - private String rxtxBase; - - private String dns1; - - private String dns2; - - private String label; - - private String priority; - - /** - * @return the id - */ - public String getId() { - return id; - } - - /** - * @return the vpnPublicAddress - */ - public String getVpnPublicAddress() { - return vpnPublicAddress; - } - - /** - * @return the vpnPublicPort - */ - public String getVpnPublicPort() { - return vpnPublicPort; - } - - /** - * @return the dhcpStart - */ - public String getDhcpStart() { - return dhcpStart; - } - - /** - * @return the bridge - */ - public String getBridge() { - return bridge; - } - - /** - * @return the bridgeInterface - */ - public String getBridgeInterface() { - return bridgeInterface; - } - - /** - * @return the updatedAt - */ - public String getUpdatedAt() { - return updatedAt; - } - - /** - * @return the deleted - */ - public Boolean getDeleted() { - return deleted; - } - - /** - * @return the vlan - */ - public String getVlan() { - return vlan; - } - - /** - * @return the broadcast - */ - public String getBroadcast() { - return broadcast; - } - - /** - * @return the netmask - */ - public String getNetmask() { - return netmask; - } - - /** - * @return the injected - */ - public Boolean getInjected() { - return injected; - } - - /** - * @return the host - */ - public String getHost() { - return host; - } - - /** - * @return the multiHost - */ - public Boolean getMultiHost() { - return multiHost; - } - - /** - * @return the createdAt - */ - public String getCreatedAt() { - return createdAt; - } - - /** - * @return the deletedAt - */ - public String getDeletedAt() { - return deletedAt; - } - - /** - * @return the cidr - */ - public String getCidr() { - return cidr; - } - - /** - * @return the cidrV6 - */ - public String getCidrV6() { - return cidrV6; - } - - /** - * @return the gateway - */ - public String getGateway() { - return gateway; - } - - /** - * @return the gatewayV6 - */ - public String getGatewayV6() { - return gatewayV6; - } - - /** - * @return the netmaskV6 - */ - public String getNetmaskV6() { - return netmaskV6; - } - - /** - * @return the projectId - */ - public String getProjectId() { - return projectId; - } - - /** - * @return the rxtxBase - */ - public String getRxtxBase() { - return rxtxBase; - } - - /** - * @return the dns1 - */ - public String getDns1() { - return dns1; - } - - /** - * @return the dns2 - */ - public String getDns2() { - return dns2; - } - - /** - * @return the label - */ - public String getLabel() { - return label; - } - - /** - * @return the priority - */ - public String getPriority() { - return priority; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Network [id=" + id + ", vpnPublicAddress=" + vpnPublicAddress - + ", vpnPublicPort=" + vpnPublicPort + ", dhcpStart=" - + dhcpStart + ", bridge=" + bridge + ", bridgeInterface=" - + bridgeInterface + ", updatedAt=" + updatedAt + ", deleted=" - + deleted + ", vlan=" + vlan + ", broadcast=" + broadcast - + ", netmask=" + netmask + ", injected=" + injected + ", host=" - + host + ", multiHost=" + multiHost + ", createdAt=" - + createdAt + ", deletedAt=" + deletedAt + ", cidr=" + cidr - + ", cidrV6=" + cidrV6 + ", gateway=" + gateway - + ", gatewayV6=" + gatewayV6 + ", netmaskV6=" + netmaskV6 - + ", projectId=" + projectId + ", rxtxBase=" + rxtxBase - + ", dns1=" + dns1 + ", dns2=" + dns2 + ", label=" + label - + ", priority=" + priority + "]"; - } - -} +package com.woorea.openstack.nova.model; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName("network") +public class Network implements Serializable { + + private String id; + + @JsonProperty("vpn_public_address") + private String vpnPublicAddress; + + @JsonProperty("vpn_private_address") + private String vpnPrivateAddress; + + @JsonProperty("vpn_public_port") + private String vpnPublicPort; + + @JsonProperty("dhcp_start") + private String dhcpStart; + + private String bridge; + + @JsonProperty("bridge_interface") + private String bridgeInterface; + + @JsonProperty("updated_at") + private String updatedAt; + + private Boolean deleted; + + private String vlan; + + private String broadcast; + + private String netmask; + + private Boolean injected; + + private String host; + + @JsonProperty("multi_host") + private Boolean multiHost; + + @JsonProperty("created_at") + private String createdAt; + + @JsonProperty("deleted_at") + private String deletedAt; + + private String cidr; + + @JsonProperty("cidr_v6") + private String cidrV6; + + private String gateway; + + @JsonProperty("gateway_v6") + private String gatewayV6; + + @JsonProperty("netmask_v6") + private String netmaskV6; + + @JsonProperty("project_id") + private String projectId; + + @JsonProperty("rxtx_base") + private String rxtxBase; + + private String dns1; + + private String dns2; + + private String label; + + private String priority; + + /** + * @return the id + */ + public String getId() { + return id; + } + + /** + * @return the vpnPublicAddress + */ + public String getVpnPublicAddress() { + return vpnPublicAddress; + } + + /** + * @return the vpnPublicPort + */ + public String getVpnPublicPort() { + return vpnPublicPort; + } + + /** + * @return the dhcpStart + */ + public String getDhcpStart() { + return dhcpStart; + } + + /** + * @return the bridge + */ + public String getBridge() { + return bridge; + } + + /** + * @return the bridgeInterface + */ + public String getBridgeInterface() { + return bridgeInterface; + } + + /** + * @return the updatedAt + */ + public String getUpdatedAt() { + return updatedAt; + } + + /** + * @return the deleted + */ + public Boolean getDeleted() { + return deleted; + } + + /** + * @return the vlan + */ + public String getVlan() { + return vlan; + } + + /** + * @return the broadcast + */ + public String getBroadcast() { + return broadcast; + } + + /** + * @return the netmask + */ + public String getNetmask() { + return netmask; + } + + /** + * @return the injected + */ + public Boolean getInjected() { + return injected; + } + + /** + * @return the host + */ + public String getHost() { + return host; + } + + /** + * @return the multiHost + */ + public Boolean getMultiHost() { + return multiHost; + } + + /** + * @return the createdAt + */ + public String getCreatedAt() { + return createdAt; + } + + /** + * @return the deletedAt + */ + public String getDeletedAt() { + return deletedAt; + } + + /** + * @return the cidr + */ + public String getCidr() { + return cidr; + } + + /** + * @return the cidrV6 + */ + public String getCidrV6() { + return cidrV6; + } + + /** + * @return the gateway + */ + public String getGateway() { + return gateway; + } + + /** + * @return the gatewayV6 + */ + public String getGatewayV6() { + return gatewayV6; + } + + /** + * @return the netmaskV6 + */ + public String getNetmaskV6() { + return netmaskV6; + } + + /** + * @return the projectId + */ + public String getProjectId() { + return projectId; + } + + /** + * @return the rxtxBase + */ + public String getRxtxBase() { + return rxtxBase; + } + + /** + * @return the dns1 + */ + public String getDns1() { + return dns1; + } + + /** + * @return the dns2 + */ + public String getDns2() { + return dns2; + } + + /** + * @return the label + */ + public String getLabel() { + return label; + } + + /** + * @return the priority + */ + public String getPriority() { + return priority; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Network [id=" + id + ", vpnPublicAddress=" + vpnPublicAddress + + ", vpnPublicPort=" + vpnPublicPort + ", dhcpStart=" + + dhcpStart + ", bridge=" + bridge + ", bridgeInterface=" + + bridgeInterface + ", updatedAt=" + updatedAt + ", deleted=" + + deleted + ", vlan=" + vlan + ", broadcast=" + broadcast + + ", netmask=" + netmask + ", injected=" + injected + ", host=" + + host + ", multiHost=" + multiHost + ", createdAt=" + + createdAt + ", deletedAt=" + deletedAt + ", cidr=" + cidr + + ", cidrV6=" + cidrV6 + ", gateway=" + gateway + + ", gatewayV6=" + gatewayV6 + ", netmaskV6=" + netmaskV6 + + ", projectId=" + projectId + ", rxtxBase=" + rxtxBase + + ", dns1=" + dns1 + ", dns2=" + dns2 + ", label=" + label + + ", priority=" + priority + "]"; + } + +} diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/NetworkForCreate.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/NetworkForCreate.java index f5785393b..04a680546 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/NetworkForCreate.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/NetworkForCreate.java @@ -1,29 +1,28 @@ -package com.woorea.openstack.nova.model; - -import org.codehaus.jackson.annotate.JsonProperty; -import org.codehaus.jackson.map.annotate.JsonRootName; - -public class NetworkForCreate { - - @JsonProperty("uuid") - private String id; - @JsonProperty("fixed_ip") - private String fixedIp; - - public String getId() { - return id; - } - - public String getFixedIp() { - return fixedIp; - } - - public void setId(String id) { - this.id = id; - } - - public void setFixedIp(String fixedIp) { - this.fixedIp = fixedIp; - } - -} +package com.woorea.openstack.nova.model; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class NetworkForCreate { + + @JsonProperty("uuid") + private String id; + @JsonProperty("fixed_ip") + private String fixedIp; + + public String getId() { + return id; + } + + public String getFixedIp() { + return fixedIp; + } + + public void setId(String id) { + this.id = id; + } + + public void setFixedIp(String fixedIp) { + this.fixedIp = fixedIp; + } + +} diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/Networks.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/Networks.java index 6e8a94150..7f7eb34b1 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/Networks.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/Networks.java @@ -1,34 +1,34 @@ -package com.woorea.openstack.nova.model; - -import java.io.Serializable; -import java.util.Iterator; -import java.util.List; - -import org.codehaus.jackson.annotate.JsonProperty; - -public class Networks implements Iterable, Serializable { - - @JsonProperty("networks") - private List list; - - /** - * @return the list - */ - public List getList() { - return list; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Servers [list=" + list + "]"; - } - - @Override - public Iterator iterator() { - return list.iterator(); - } - -} +package com.woorea.openstack.nova.model; + +import java.io.Serializable; +import java.util.Iterator; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class Networks implements Iterable, Serializable { + + @JsonProperty("networks") + private List list; + + /** + * @return the list + */ + public List getList() { + return list; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Servers [list=" + list + "]"; + } + + @Override + public Iterator iterator() { + return list.iterator(); + } + +} diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/QuotaSet.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/QuotaSet.java index 0a2f55dd7..568f2b47a 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/QuotaSet.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/QuotaSet.java @@ -1,156 +1,156 @@ -package com.woorea.openstack.nova.model; - -import org.codehaus.jackson.annotate.JsonProperty; -import org.codehaus.jackson.map.annotate.JsonRootName; - -@JsonRootName("quota_set") -public class QuotaSet { - - private String id; - - @JsonProperty("metadata_items") - private Integer metadataItems; - - @JsonProperty("injected_file_content_bytes") - private Integer injectedFileContentBytes; - - @JsonProperty("injected_files") - private Integer injectedFiles; - - private Integer gigabytes; - - private Integer ram; - - @JsonProperty("floating_ips") - private Integer floatingIps; - - private Integer instances; - - private Integer volumes; - - private Integer cores; - - @JsonProperty("security_groups") - private Integer securityGroups; - - @JsonProperty("security_group_rules") - private Integer securityGroupRules; - - @JsonProperty("injected_file_path_bytes") - private Integer injectedFilePathBytes; - - @JsonProperty("key_pairs") - private Integer keyPairs; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public Integer getMetadataItems() { - return metadataItems; - } - - public void setMetadataItems(Integer metadataItems) { - this.metadataItems = metadataItems; - } - - public Integer getInjectedFileContentBytes() { - return injectedFileContentBytes; - } - - public void setInjectedFileContentBytes(Integer injectedFileContentBytes) { - this.injectedFileContentBytes = injectedFileContentBytes; - } - - public Integer getInjectedFiles() { - return injectedFiles; - } - - public void setInjectedFiles(Integer injectedFiles) { - this.injectedFiles = injectedFiles; - } - - public Integer getGigabytes() { - return gigabytes; - } - - public void setGigabytes(Integer gigabytes) { - this.gigabytes = gigabytes; - } - - public Integer getRam() { - return ram; - } - - public void setRam(Integer ram) { - this.ram = ram; - } - - public Integer getFloatingIps() { - return floatingIps; - } - - public void setFloatingIps(Integer floatingIps) { - this.floatingIps = floatingIps; - } - - public Integer getInstances() { - return instances; - } - - public void setInstances(Integer instances) { - this.instances = instances; - } - - public Integer getVolumes() { - return volumes; - } - - public void setVolumes(Integer volumes) { - this.volumes = volumes; - } - - public Integer getCores() { - return cores; - } - - public void setCores(Integer cores) { - this.cores = cores; - } - - public Integer getSecurityGroups() { - return securityGroups; - } - - public void setSecurityGroups(Integer securityGroups) { - this.securityGroups = securityGroups; - } - - public Integer getSecurityGroupRules() { - return securityGroupRules; - } - - public void setSecurityGroupRules(Integer securityGroupRules) { - this.securityGroupRules = securityGroupRules; - } - - public Integer getKeyPairs() { - return keyPairs; - } - - public void setKeyPairs(Integer keyPairs) { - this.keyPairs = keyPairs; - } - - public Integer getInjectedFilePathBytes() { - return injectedFilePathBytes; - } - - public void setInjectedFilePathBytes(Integer injectedFilePathBytes) { - this.injectedFilePathBytes = injectedFilePathBytes; - } +package com.woorea.openstack.nova.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName("quota_set") +public class QuotaSet { + + private String id; + + @JsonProperty("metadata_items") + private Integer metadataItems; + + @JsonProperty("injected_file_content_bytes") + private Integer injectedFileContentBytes; + + @JsonProperty("injected_files") + private Integer injectedFiles; + + private Integer gigabytes; + + private Integer ram; + + @JsonProperty("floating_ips") + private Integer floatingIps; + + private Integer instances; + + private Integer volumes; + + private Integer cores; + + @JsonProperty("security_groups") + private Integer securityGroups; + + @JsonProperty("security_group_rules") + private Integer securityGroupRules; + + @JsonProperty("injected_file_path_bytes") + private Integer injectedFilePathBytes; + + @JsonProperty("key_pairs") + private Integer keyPairs; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public Integer getMetadataItems() { + return metadataItems; + } + + public void setMetadataItems(Integer metadataItems) { + this.metadataItems = metadataItems; + } + + public Integer getInjectedFileContentBytes() { + return injectedFileContentBytes; + } + + public void setInjectedFileContentBytes(Integer injectedFileContentBytes) { + this.injectedFileContentBytes = injectedFileContentBytes; + } + + public Integer getInjectedFiles() { + return injectedFiles; + } + + public void setInjectedFiles(Integer injectedFiles) { + this.injectedFiles = injectedFiles; + } + + public Integer getGigabytes() { + return gigabytes; + } + + public void setGigabytes(Integer gigabytes) { + this.gigabytes = gigabytes; + } + + public Integer getRam() { + return ram; + } + + public void setRam(Integer ram) { + this.ram = ram; + } + + public Integer getFloatingIps() { + return floatingIps; + } + + public void setFloatingIps(Integer floatingIps) { + this.floatingIps = floatingIps; + } + + public Integer getInstances() { + return instances; + } + + public void setInstances(Integer instances) { + this.instances = instances; + } + + public Integer getVolumes() { + return volumes; + } + + public void setVolumes(Integer volumes) { + this.volumes = volumes; + } + + public Integer getCores() { + return cores; + } + + public void setCores(Integer cores) { + this.cores = cores; + } + + public Integer getSecurityGroups() { + return securityGroups; + } + + public void setSecurityGroups(Integer securityGroups) { + this.securityGroups = securityGroups; + } + + public Integer getSecurityGroupRules() { + return securityGroupRules; + } + + public void setSecurityGroupRules(Integer securityGroupRules) { + this.securityGroupRules = securityGroupRules; + } + + public Integer getKeyPairs() { + return keyPairs; + } + + public void setKeyPairs(Integer keyPairs) { + this.keyPairs = keyPairs; + } + + public Integer getInjectedFilePathBytes() { + return injectedFilePathBytes; + } + + public void setInjectedFilePathBytes(Integer injectedFilePathBytes) { + this.injectedFilePathBytes = injectedFilePathBytes; + } } \ No newline at end of file diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/SecurityGroup.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/SecurityGroup.java index 1b8917b4c..9a67de303 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/SecurityGroup.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/SecurityGroup.java @@ -1,207 +1,207 @@ -package com.woorea.openstack.nova.model; - -import java.io.Serializable; -import java.util.List; - -import org.codehaus.jackson.annotate.JsonProperty; -import org.codehaus.jackson.map.annotate.JsonRootName; - -@JsonRootName("security_group") -public class SecurityGroup implements Serializable { - - @JsonRootName("security_group_rule") - public static final class Rule implements Serializable { - - public static final class Group implements Serializable { - - private String name; - - @JsonProperty("tenant_id") - private String tenantId; - - public String getName() { - return name; - } - - public String getTenantId() { - return tenantId; - } - - @Override - public String toString() { - return "Group [name=" + name + ", tenantId=" + tenantId + "]"; - } - - } - - public static final class IpRange implements Serializable { - - private String cidr; - - public String getCidr() { - return cidr; - } - - @Override - public String toString() { - return "IpRange [cidr=" + cidr + "]"; - } - - } - - private String id; - - private String name; - - @JsonProperty("parent_group_id") - private String parentGroupId; - - @JsonProperty("from_port") - private Integer fromPort; - - @JsonProperty("to_port") - private Integer toPort; - - @JsonProperty("ip_protocol") - private String ipProtocol; - - @JsonProperty("ip_range") - private IpRange ipRange = new IpRange(); - - private Group group; - - /** - * @return the id - */ - public String getId() { - return id; - } - - /** - * @return the name - */ - public String getName() { - return name; - } - - /** - * @return the parentGroupId - */ - public String getParentGroupId() { - return parentGroupId; - } - - /** - * @return the fromPort - */ - public Integer getFromPort() { - return fromPort; - } - - /** - * @return the toPort - */ - public Integer getToPort() { - return toPort; - } - - /** - * @return the ipProtocol - */ - public String getIpProtocol() { - return ipProtocol; - } - - /** - * @return the ipRange - */ - public IpRange getIpRange() { - return ipRange; - } - - /** - * @return the group - */ - public Group getGroup() { - return group; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Rule [id=" + id + ", name=" + name + ", parentGroupId=" - + parentGroupId + ", fromPort=" + fromPort + ", toPort=" - + toPort + ", ipProtocol=" + ipProtocol + ", ipRange=" - + ipRange + ", group=" + group + "]"; - } - - } - - private String id; - - private String name; - - private String description; - - @JsonProperty("tenant_id") - private String tenantId; - - private List rules; - - private List links; - - /** - * @return the id - */ - public String getId() { - return id; - } - - /** - * @return the name - */ - public String getName() { - return name; - } - - /** - * @return the description - */ - public String getDescription() { - return description; - } - - /** - * @return the tenantId - */ - public String getTenantId() { - return tenantId; - } - - /** - * @return the rules - */ - public List getRules() { - return rules; - } - - /** - * @return the links - */ - public List getLinks() { - return links; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "SecurityGroup [id=" + id + ", name=" + name + ", description=" - + description + ", tenantId=" + tenantId + ", rules=" + rules - + ", links=" + links + "]"; - } - -} +package com.woorea.openstack.nova.model; + +import java.io.Serializable; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName("security_group") +public class SecurityGroup implements Serializable { + + @JsonRootName("security_group_rule") + public static final class Rule implements Serializable { + + public static final class Group implements Serializable { + + private String name; + + @JsonProperty("tenant_id") + private String tenantId; + + public String getName() { + return name; + } + + public String getTenantId() { + return tenantId; + } + + @Override + public String toString() { + return "Group [name=" + name + ", tenantId=" + tenantId + "]"; + } + + } + + public static final class IpRange implements Serializable { + + private String cidr; + + public String getCidr() { + return cidr; + } + + @Override + public String toString() { + return "IpRange [cidr=" + cidr + "]"; + } + + } + + private String id; + + private String name; + + @JsonProperty("parent_group_id") + private String parentGroupId; + + @JsonProperty("from_port") + private Integer fromPort; + + @JsonProperty("to_port") + private Integer toPort; + + @JsonProperty("ip_protocol") + private String ipProtocol; + + @JsonProperty("ip_range") + private IpRange ipRange = new IpRange(); + + private Group group; + + /** + * @return the id + */ + public String getId() { + return id; + } + + /** + * @return the name + */ + public String getName() { + return name; + } + + /** + * @return the parentGroupId + */ + public String getParentGroupId() { + return parentGroupId; + } + + /** + * @return the fromPort + */ + public Integer getFromPort() { + return fromPort; + } + + /** + * @return the toPort + */ + public Integer getToPort() { + return toPort; + } + + /** + * @return the ipProtocol + */ + public String getIpProtocol() { + return ipProtocol; + } + + /** + * @return the ipRange + */ + public IpRange getIpRange() { + return ipRange; + } + + /** + * @return the group + */ + public Group getGroup() { + return group; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Rule [id=" + id + ", name=" + name + ", parentGroupId=" + + parentGroupId + ", fromPort=" + fromPort + ", toPort=" + + toPort + ", ipProtocol=" + ipProtocol + ", ipRange=" + + ipRange + ", group=" + group + "]"; + } + + } + + private String id; + + private String name; + + private String description; + + @JsonProperty("tenant_id") + private String tenantId; + + private List rules; + + private List links; + + /** + * @return the id + */ + public String getId() { + return id; + } + + /** + * @return the name + */ + public String getName() { + return name; + } + + /** + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * @return the tenantId + */ + public String getTenantId() { + return tenantId; + } + + /** + * @return the rules + */ + public List getRules() { + return rules; + } + + /** + * @return the links + */ + public List getLinks() { + return links; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "SecurityGroup [id=" + id + ", name=" + name + ", description=" + + description + ", tenantId=" + tenantId + ", rules=" + rules + + ", links=" + links + "]"; + } + +} diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/SecurityGroupForCreate.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/SecurityGroupForCreate.java index c3993bbec..3b9574b63 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/SecurityGroupForCreate.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/SecurityGroupForCreate.java @@ -1,64 +1,64 @@ -package com.woorea.openstack.nova.model; - -import java.io.Serializable; - -import org.codehaus.jackson.map.annotate.JsonRootName; - -@JsonRootName("security_group") -public class SecurityGroupForCreate implements Serializable { - - private String name; - - private String description; - - public SecurityGroupForCreate() { - super(); - } - - public SecurityGroupForCreate(String name) { - this.name = name; - } - - public SecurityGroupForCreate(String name, String description) { - this(name); - this.description = description; - } - - /** - * @return the name - */ - public String getName() { - return name; - } - - /** - * @param name the name to set - */ - public void setName(String name) { - this.name = name; - } - - /** - * @return the description - */ - public String getDescription() { - return description; - } - - /** - * @param description the description to set - */ - public void setDescription(String description) { - this.description = description; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "SecurityGroupForCreate [name=" + name + ", description=" - + description + "]"; - } - -} +package com.woorea.openstack.nova.model; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName("security_group") +public class SecurityGroupForCreate implements Serializable { + + private String name; + + private String description; + + public SecurityGroupForCreate() { + super(); + } + + public SecurityGroupForCreate(String name) { + this.name = name; + } + + public SecurityGroupForCreate(String name, String description) { + this(name); + this.description = description; + } + + /** + * @return the name + */ + public String getName() { + return name; + } + + /** + * @param name the name to set + */ + public void setName(String name) { + this.name = name; + } + + /** + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * @param description the description to set + */ + public void setDescription(String description) { + this.description = description; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "SecurityGroupForCreate [name=" + name + ", description=" + + description + "]"; + } + +} diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/SecurityGroupRuleForCreate.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/SecurityGroupRuleForCreate.java index 2f58da00c..5d86b019a 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/SecurityGroupRuleForCreate.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/SecurityGroupRuleForCreate.java @@ -1,198 +1,198 @@ -package com.woorea.openstack.nova.model; - -import java.io.Serializable; - -import javax.xml.bind.annotation.XmlElement; - -import org.codehaus.jackson.annotate.JsonProperty; -import org.codehaus.jackson.map.annotate.JsonRootName; - -@JsonRootName("security_group_rule") -public class SecurityGroupRuleForCreate implements Serializable { - - @JsonProperty("parent_group_id") - private String parentGroupId; - - @JsonProperty("ip_protocol") - private String ipProtocol; - - @JsonProperty("from_port") - private Integer fromPort; - - @JsonProperty("to_port") - private Integer toPort; - - @XmlElement - private String cidr; - - @JsonProperty("group_id") - private String groupId; - - public SecurityGroupRuleForCreate() { - - } - - /** - * - * @param parentSecurityGroupId - * @param ipProtocol - * @param fromPort - * @param toPort - * @param cidr - * @deprecated Ids in some installs have shown to use strings .Use {@link #SecurityGroupRuleForCreate(String, String, Integer, Integer, String)} - */ - @Deprecated - public SecurityGroupRuleForCreate(Integer parentSecurityGroupId, String ipProtocol, Integer fromPort,Integer toPort, String cidr) { - this.parentGroupId = String.valueOf(parentSecurityGroupId); - this.ipProtocol = ipProtocol; - this.fromPort = fromPort; - this.toPort = toPort; - this.cidr = cidr; - } - /** - * - * @param parentSecurityGroupId - * @param ipProtocol - * @param fromPort - * @param toPort - * @param cidr - * @deprecated Ids in some installs have shown to use strings .Use {@link #SecurityGroupRuleForCreate(String, String, String, Integer, Integer)} - */ - @Deprecated - public SecurityGroupRuleForCreate(Integer parentGroupId, String ipProtocol, Integer fromPort,Integer toPort, Integer sourceGroupId) { - this.parentGroupId = String.valueOf(parentGroupId); - this.ipProtocol = ipProtocol; - this.fromPort = fromPort; - this.toPort = toPort; - this.groupId = String.valueOf(sourceGroupId); - } - - public SecurityGroupRuleForCreate(String parentSecurityGroupId, String ipProtocol, Integer fromPort,Integer toPort, String cidr) { - this.parentGroupId = parentSecurityGroupId; - this.ipProtocol = ipProtocol; - this.fromPort = fromPort; - this.toPort = toPort; - this.cidr = cidr; - } - - public SecurityGroupRuleForCreate(String parentGroupId, String sourceGroupId, String ipProtocol, Integer fromPort,Integer toPort) { - this.parentGroupId = parentGroupId; - this.ipProtocol = ipProtocol; - this.fromPort = fromPort; - this.toPort = toPort; - this.groupId = sourceGroupId; - } - - /** - * @return the parentGroupId - */ - public String getParentGroupId() { - return parentGroupId; - } - - - /** - * @param parentGroupId the parentGroupId to set - * @deprecated Use {@link #setParentGroupId(String)} - */ - public void setParentGroupId(Integer parentGroupId) { - this.parentGroupId = String.valueOf(parentGroupId); - } - - /** - * @param parentGroupId the parentGroupId to set - */ - public void setParentGroupId(String parentGroupId) { - this.parentGroupId = parentGroupId; - } - - /** - * @return the fromPort - */ - public Integer getFromPort() { - return fromPort; - } - - /** - * @param fromPort the fromPort to set - */ - public void setFromPort(Integer fromPort) { - this.fromPort = fromPort; - } - - /** - * @return the toPort - */ - public Integer getToPort() { - return toPort; - } - - /** - * @param toPort the toPort to set - */ - public void setToPort(Integer toPort) { - this.toPort = toPort; - } - - /** - * @return the ipProtocol - */ - public String getIpProtocol() { - return ipProtocol; - } - - /** - * @param ipProtocol the ipProtocol to set - */ - public void setIpProtocol(String ipProtocol) { - this.ipProtocol = ipProtocol; - } - - /** - * @return the cidr - */ - public String getCidr() { - return cidr; - } - - /** - * @param cidr the cidr to set - */ - public void setCidr(String cidr) { - this.cidr = cidr; - } - - /** - * @return the groupId - */ - public String getGroupId() { - return groupId; - } - - /** - * @param groupId the groupId to set - * @deprecated Use {@link #setGroupId(String)} - */ - public void setGroupId(Integer groupId) { - this.groupId = String.valueOf(groupId); - } - - /** - * @param groupId the groupId to set - */ - public void setGroupId(String groupId) { - this.groupId = groupId; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "SecurityGroupRuleForCreate [parentGroupId=" + parentGroupId - + ", fromPort=" + fromPort + ", toPort=" + toPort - + ", ipProtocol=" + ipProtocol + ", cidr=" + cidr - + ", groupId=" + groupId + "]"; - } - -} +package com.woorea.openstack.nova.model; + +import java.io.Serializable; + +import javax.xml.bind.annotation.XmlElement; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName("security_group_rule") +public class SecurityGroupRuleForCreate implements Serializable { + + @JsonProperty("parent_group_id") + private String parentGroupId; + + @JsonProperty("ip_protocol") + private String ipProtocol; + + @JsonProperty("from_port") + private Integer fromPort; + + @JsonProperty("to_port") + private Integer toPort; + + @XmlElement + private String cidr; + + @JsonProperty("group_id") + private String groupId; + + public SecurityGroupRuleForCreate() { + + } + + /** + * + * @param parentSecurityGroupId + * @param ipProtocol + * @param fromPort + * @param toPort + * @param cidr + * @deprecated Ids in some installs have shown to use strings .Use {@link #SecurityGroupRuleForCreate(String, String, Integer, Integer, String)} + */ + @Deprecated + public SecurityGroupRuleForCreate(Integer parentSecurityGroupId, String ipProtocol, Integer fromPort,Integer toPort, String cidr) { + this.parentGroupId = String.valueOf(parentSecurityGroupId); + this.ipProtocol = ipProtocol; + this.fromPort = fromPort; + this.toPort = toPort; + this.cidr = cidr; + } + /** + * + * @param parentSecurityGroupId + * @param ipProtocol + * @param fromPort + * @param toPort + * @param cidr + * @deprecated Ids in some installs have shown to use strings .Use {@link #SecurityGroupRuleForCreate(String, String, String, Integer, Integer)} + */ + @Deprecated + public SecurityGroupRuleForCreate(Integer parentGroupId, String ipProtocol, Integer fromPort,Integer toPort, Integer sourceGroupId) { + this.parentGroupId = String.valueOf(parentGroupId); + this.ipProtocol = ipProtocol; + this.fromPort = fromPort; + this.toPort = toPort; + this.groupId = String.valueOf(sourceGroupId); + } + + public SecurityGroupRuleForCreate(String parentSecurityGroupId, String ipProtocol, Integer fromPort,Integer toPort, String cidr) { + this.parentGroupId = parentSecurityGroupId; + this.ipProtocol = ipProtocol; + this.fromPort = fromPort; + this.toPort = toPort; + this.cidr = cidr; + } + + public SecurityGroupRuleForCreate(String parentGroupId, String sourceGroupId, String ipProtocol, Integer fromPort,Integer toPort) { + this.parentGroupId = parentGroupId; + this.ipProtocol = ipProtocol; + this.fromPort = fromPort; + this.toPort = toPort; + this.groupId = sourceGroupId; + } + + /** + * @return the parentGroupId + */ + public String getParentGroupId() { + return parentGroupId; + } + + + /** + * @param parentGroupId the parentGroupId to set + * @deprecated Use {@link #setParentGroupId(String)} + */ + public void setParentGroupId(Integer parentGroupId) { + this.parentGroupId = String.valueOf(parentGroupId); + } + + /** + * @param parentGroupId the parentGroupId to set + */ + public void setParentGroupId(String parentGroupId) { + this.parentGroupId = parentGroupId; + } + + /** + * @return the fromPort + */ + public Integer getFromPort() { + return fromPort; + } + + /** + * @param fromPort the fromPort to set + */ + public void setFromPort(Integer fromPort) { + this.fromPort = fromPort; + } + + /** + * @return the toPort + */ + public Integer getToPort() { + return toPort; + } + + /** + * @param toPort the toPort to set + */ + public void setToPort(Integer toPort) { + this.toPort = toPort; + } + + /** + * @return the ipProtocol + */ + public String getIpProtocol() { + return ipProtocol; + } + + /** + * @param ipProtocol the ipProtocol to set + */ + public void setIpProtocol(String ipProtocol) { + this.ipProtocol = ipProtocol; + } + + /** + * @return the cidr + */ + public String getCidr() { + return cidr; + } + + /** + * @param cidr the cidr to set + */ + public void setCidr(String cidr) { + this.cidr = cidr; + } + + /** + * @return the groupId + */ + public String getGroupId() { + return groupId; + } + + /** + * @param groupId the groupId to set + * @deprecated Use {@link #setGroupId(String)} + */ + public void setGroupId(Integer groupId) { + this.groupId = String.valueOf(groupId); + } + + /** + * @param groupId the groupId to set + */ + public void setGroupId(String groupId) { + this.groupId = groupId; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "SecurityGroupRuleForCreate [parentGroupId=" + parentGroupId + + ", fromPort=" + fromPort + ", toPort=" + toPort + + ", ipProtocol=" + ipProtocol + ", cidr=" + cidr + + ", groupId=" + groupId + "]"; + } + +} diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/SecurityGroups.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/SecurityGroups.java index 1c8cc5533..0edc1f1f9 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/SecurityGroups.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/SecurityGroups.java @@ -1,34 +1,34 @@ -package com.woorea.openstack.nova.model; - -import java.io.Serializable; -import java.util.Iterator; -import java.util.List; - -import org.codehaus.jackson.annotate.JsonProperty; - -public class SecurityGroups implements Iterable, Serializable { - - @JsonProperty("security_groups") - private List list; - - /** - * @return the list - */ - public List getList() { - return list; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "SecurityGroups [list=" + list + "]"; - } - - @Override - public Iterator iterator() { - return list.iterator(); - } - -} +package com.woorea.openstack.nova.model; + +import java.io.Serializable; +import java.util.Iterator; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class SecurityGroups implements Iterable, Serializable { + + @JsonProperty("security_groups") + private List list; + + /** + * @return the list + */ + public List getList() { + return list; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "SecurityGroups [list=" + list + "]"; + } + + @Override + public Iterator iterator() { + return list.iterator(); + } + +} diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/Server.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/Server.java index 589ed540d..734d1f9b5 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/Server.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/Server.java @@ -1,514 +1,513 @@ -package com.woorea.openstack.nova.model; - -import java.io.Serializable; -import java.util.Calendar; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.codehaus.jackson.annotate.JsonAnySetter; -import org.codehaus.jackson.annotate.JsonIgnoreProperties; -import org.codehaus.jackson.annotate.JsonProperty; -import org.codehaus.jackson.map.annotate.JsonRootName; - -@JsonRootName("server") -public class Server implements Serializable { - - public static final class Addresses implements Serializable { - - public static final class Address implements Serializable { - - @JsonProperty("OS-EXT-IPS-MAC:mac_addr") - private String macAddr; - - private String version; - - private String addr; - - @JsonProperty("OS-EXT-IPS:type") - private String type; - - /** - * @return the macAddr - */ - public String getMacAddr() { - return macAddr; - } - - /** - * @return the version - */ - public String getVersion() { - return version; - } - - /** - * @return the addr - */ - public String getAddr() { - return addr; - } - - - /** - * @return the type - */ - public String getType() { - return type; - } - - /** - * @param version the version to set - */ - public void setVersion(String version) { - this.version = version; - } - - /** - * @param addr the addr to set - */ - public void setAddr(String addr) { - this.addr = addr; - } - - /** - * @param type the type to set - */ - public void setType(String type) { - this.type = type; - } - - /** - * @param macAddr the mac addr to set - */ - public void setMacAddr(String macAddr) { - this.macAddr= macAddr; - } - } - - private Map> addresses = new HashMap>(); - - @JsonAnySetter - public void add(String key, List
value) { - addresses.put(key, value); - } - /** - * @return the ip address List Map - */ - public Map> getAddresses() { - return addresses; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Addresses List Map [" + addresses + "]"; - } - - } - - public static final class Fault { - - private Integer code; - - private String message; - - private String details; - - private Calendar created; - - /** - * @return the code - */ - public Integer getCode() { - return code; - } - - /** - * @return the message - */ - public String getMessage() { - return message; - } - - /** - * @return the details - */ - public String getDetails() { - return details; - } - - /** - * @return the created - */ - public Calendar getCreated() { - return created; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Fault [code=" + code + ", message=" + message - + ", details=" + details + ", created=" + created + "]"; - } - - - } - - - private String id; - - private String name; - - private Addresses addresses; - - private List links; - - private Image image; - - private Flavor flavor; - - private String accessIPv4; - - private String accessIPv6; - - @JsonProperty("config_drive") - private String configDrive; - - private String status; - - private Integer progress; - - private Fault fault; - - @JsonProperty("tenant_id") - private String tenantId; - - @JsonProperty("user_id") - private String userId; - - @JsonProperty("key_name") - private String keyName; - - private String hostId; - - private String updated; - - private String created; - - private Map metadata; - - @JsonProperty("security_groups") - private List securityGroups; - - @JsonProperty("OS-EXT-STS:task_state") - private String taskState; - - @JsonProperty("OS-EXT-STS:power_state") - private String powerState; - - @JsonProperty("OS-EXT-STS:vm_state") - private String vmState; - - @JsonProperty("OS-EXT-SRV-ATTR:host") - private String host; - - @JsonProperty("OS-EXT-SRV-ATTR:instance_name") - private String instanceName; - - @JsonProperty("OS-EXT-SRV-ATTR:hypervisor_hostname") - private String hypervisorHostname; - - @JsonProperty("OS-DCF:diskConfig") - private String diskConfig; - - @JsonProperty("OS-EXT-AZ:availability_zone") - private String availabilityZone; - - @JsonProperty("OS-SRV-USG:launched_at") - private String launchedAt; - - @JsonProperty("OS-SRV-USG:terminated_at") - private String terminatedAt; - - @JsonProperty("os-extended-volumes:volumes_attached") - private List osExtendedVolumesAttached; - - private String uuid; - - private String adminPass; - - /** - * @return the id - */ - public String getId() { - return id; - } - - /** - * @return the name - */ - public String getName() { - return name; - } - - /** - * @return the addresses - */ - public Addresses getAddresses() { - return addresses; - } - - /** - * @return the links - */ - public List getLinks() { - return links; - } - - /** - * @return the image - */ - public Image getImage() { - return image; - } - - /** - * @param image the image to set - */ - public void setImage(Image image) { - this.image = image; - } - - /** - * @return the flavor - */ - public Flavor getFlavor() { - return flavor; - } - - /** - * @param flavor the flavor to set - */ - public void setFlavor(Flavor flavor) { - this.flavor = flavor; - } - - /** - * @return the accessIPv4 - */ - public String getAccessIPv4() { - return accessIPv4; - } - - /** - * @return the accessIPv6 - */ - public String getAccessIPv6() { - return accessIPv6; - } - - /** - * @return the configDrive - */ - public String getConfigDrive() { - return configDrive; - } - - /** - * @return the status - */ - public String getStatus() { - return status; - } - - /** - * @return the progress - */ - public Integer getProgress() { - return progress; - } - - /** - * @return the fault - */ - public Fault getFault() { - return fault; - } - - /** - * @return the tenantId - */ - public String getTenantId() { - return tenantId; - } - - /** - * @return the userId - */ - public String getUserId() { - return userId; - } - - /** - * @return the keyName - */ - public String getKeyName() { - return keyName; - } - - /** - * @return the hostId - */ - public String getHostId() { - return hostId; - } - - /** - * @return the updated - */ - public String getUpdated() { - return updated; - } - - /** - * @return the created - */ - public String getCreated() { - return created; - } - - /** - * @return the metadata - */ - public Map getMetadata() { - return metadata; - } - - /** - * @return the securityGroups - */ - public List getSecurityGroups() { - return securityGroups; - } - - /** - * @return the taskState - */ - public String getTaskState() { - return taskState; - } - - /** - * @return the powerState - */ - public String getPowerState() { - return powerState; - } - - /** - * @return the vmState - */ - public String getVmState() { - return vmState; - } - - /** - * @return the host - */ - public String getHost() { - return host; - } - - /** - * @return the instanceName - */ - public String getInstanceName() { - return instanceName; - } - - /** - * @return the hypervisorHostname - */ - public String getHypervisorHostname() { - return hypervisorHostname; - } - - /** - * @return the diskConfig - */ - public String getDiskConfig() { - return diskConfig; - } - - /** - * @return the availabilityZone - */ - public String getAvailabilityZone() { - return availabilityZone; - } - - /** - * @return the launchedAt - */ - public String getLaunchedAt() { - return launchedAt; - } - - /** - * @return the terminatedAt - */ - public String getTerminatedAt() { - return terminatedAt; - } - - /** - * @return the osExtendedVolumesAttached - */ - public List getOsExtendedVolumesAttached() { - return osExtendedVolumesAttached; - } - - /** - * @return the uuid - */ - public String getUuid() { - return uuid; - } - - /** - * @return the adminPass - */ - public String getAdminPass() { - return adminPass; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Server [id=" + id + ", name=" + name + ", addresses=" - + addresses + ", links=" + links + ", image=" + image - + ", flavor=" + flavor + ", accessIPv4=" + accessIPv4 - + ", accessIPv6=" + accessIPv6 + ", configDrive=" + configDrive - + ", status=" + status + ", progress=" + progress + ", fault=" - + fault + ", tenantId=" + tenantId + ", userId=" + userId - + ", keyName=" + keyName + ", hostId=" + hostId + ", updated=" - + updated + ", created=" + created + ", metadata=" + metadata - + ", securityGroups=" + securityGroups + ", taskState=" - + taskState + ", powerState=" + powerState + ", vmState=" - + vmState + ", host=" + host + ", instanceName=" + instanceName - + ", hypervisorHostname=" + hypervisorHostname - + ", diskConfig=" + diskConfig + ", availabilityZone=" - + availabilityZone + ", launchedAt=" + launchedAt + ", terminatedAt=" - + ", " + "osExtendedVolumesAttached=" + osExtendedVolumesAttached - + ", uuid=" + uuid + ", adminPass=" - + adminPass + "]"; - } - -} +package com.woorea.openstack.nova.model; + +import java.io.Serializable; +import java.util.Calendar; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName("server") +public class Server implements Serializable { + + public static final class Addresses implements Serializable { + + public static final class Address implements Serializable { + + @JsonProperty("OS-EXT-IPS-MAC:mac_addr") + private String macAddr; + + private String version; + + private String addr; + + @JsonProperty("OS-EXT-IPS:type") + private String type; + + /** + * @return the macAddr + */ + public String getMacAddr() { + return macAddr; + } + + /** + * @return the version + */ + public String getVersion() { + return version; + } + + /** + * @return the addr + */ + public String getAddr() { + return addr; + } + + + /** + * @return the type + */ + public String getType() { + return type; + } + + /** + * @param version the version to set + */ + public void setVersion(String version) { + this.version = version; + } + + /** + * @param addr the addr to set + */ + public void setAddr(String addr) { + this.addr = addr; + } + + /** + * @param type the type to set + */ + public void setType(String type) { + this.type = type; + } + + /** + * @param macAddr the mac addr to set + */ + public void setMacAddr(String macAddr) { + this.macAddr= macAddr; + } + } + + private Map> addresses = new HashMap>(); + + @JsonAnySetter + public void add(String key, List
value) { + addresses.put(key, value); + } + /** + * @return the ip address List Map + */ + public Map> getAddresses() { + return addresses; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Addresses List Map [" + addresses + "]"; + } + + } + + public static final class Fault { + + private Integer code; + + private String message; + + private String details; + + private Calendar created; + + /** + * @return the code + */ + public Integer getCode() { + return code; + } + + /** + * @return the message + */ + public String getMessage() { + return message; + } + + /** + * @return the details + */ + public String getDetails() { + return details; + } + + /** + * @return the created + */ + public Calendar getCreated() { + return created; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Fault [code=" + code + ", message=" + message + + ", details=" + details + ", created=" + created + "]"; + } + + + } + + + private String id; + + private String name; + + private Addresses addresses; + + private List links; + + private Image image; + + private Flavor flavor; + + private String accessIPv4; + + private String accessIPv6; + + @JsonProperty("config_drive") + private String configDrive; + + private String status; + + private Integer progress; + + private Fault fault; + + @JsonProperty("tenant_id") + private String tenantId; + + @JsonProperty("user_id") + private String userId; + + @JsonProperty("key_name") + private String keyName; + + private String hostId; + + private String updated; + + private String created; + + private Map metadata; + + @JsonProperty("security_groups") + private List securityGroups; + + @JsonProperty("OS-EXT-STS:task_state") + private String taskState; + + @JsonProperty("OS-EXT-STS:power_state") + private String powerState; + + @JsonProperty("OS-EXT-STS:vm_state") + private String vmState; + + @JsonProperty("OS-EXT-SRV-ATTR:host") + private String host; + + @JsonProperty("OS-EXT-SRV-ATTR:instance_name") + private String instanceName; + + @JsonProperty("OS-EXT-SRV-ATTR:hypervisor_hostname") + private String hypervisorHostname; + + @JsonProperty("OS-DCF:diskConfig") + private String diskConfig; + + @JsonProperty("OS-EXT-AZ:availability_zone") + private String availabilityZone; + + @JsonProperty("OS-SRV-USG:launched_at") + private String launchedAt; + + @JsonProperty("OS-SRV-USG:terminated_at") + private String terminatedAt; + + @JsonProperty("os-extended-volumes:volumes_attached") + private List osExtendedVolumesAttached; + + private String uuid; + + private String adminPass; + + /** + * @return the id + */ + public String getId() { + return id; + } + + /** + * @return the name + */ + public String getName() { + return name; + } + + /** + * @return the addresses + */ + public Addresses getAddresses() { + return addresses; + } + + /** + * @return the links + */ + public List getLinks() { + return links; + } + + /** + * @return the image + */ + public Image getImage() { + return image; + } + + /** + * @param image the image to set + */ + public void setImage(Image image) { + this.image = image; + } + + /** + * @return the flavor + */ + public Flavor getFlavor() { + return flavor; + } + + /** + * @param flavor the flavor to set + */ + public void setFlavor(Flavor flavor) { + this.flavor = flavor; + } + + /** + * @return the accessIPv4 + */ + public String getAccessIPv4() { + return accessIPv4; + } + + /** + * @return the accessIPv6 + */ + public String getAccessIPv6() { + return accessIPv6; + } + + /** + * @return the configDrive + */ + public String getConfigDrive() { + return configDrive; + } + + /** + * @return the status + */ + public String getStatus() { + return status; + } + + /** + * @return the progress + */ + public Integer getProgress() { + return progress; + } + + /** + * @return the fault + */ + public Fault getFault() { + return fault; + } + + /** + * @return the tenantId + */ + public String getTenantId() { + return tenantId; + } + + /** + * @return the userId + */ + public String getUserId() { + return userId; + } + + /** + * @return the keyName + */ + public String getKeyName() { + return keyName; + } + + /** + * @return the hostId + */ + public String getHostId() { + return hostId; + } + + /** + * @return the updated + */ + public String getUpdated() { + return updated; + } + + /** + * @return the created + */ + public String getCreated() { + return created; + } + + /** + * @return the metadata + */ + public Map getMetadata() { + return metadata; + } + + /** + * @return the securityGroups + */ + public List getSecurityGroups() { + return securityGroups; + } + + /** + * @return the taskState + */ + public String getTaskState() { + return taskState; + } + + /** + * @return the powerState + */ + public String getPowerState() { + return powerState; + } + + /** + * @return the vmState + */ + public String getVmState() { + return vmState; + } + + /** + * @return the host + */ + public String getHost() { + return host; + } + + /** + * @return the instanceName + */ + public String getInstanceName() { + return instanceName; + } + + /** + * @return the hypervisorHostname + */ + public String getHypervisorHostname() { + return hypervisorHostname; + } + + /** + * @return the diskConfig + */ + public String getDiskConfig() { + return diskConfig; + } + + /** + * @return the availabilityZone + */ + public String getAvailabilityZone() { + return availabilityZone; + } + + /** + * @return the launchedAt + */ + public String getLaunchedAt() { + return launchedAt; + } + + /** + * @return the terminatedAt + */ + public String getTerminatedAt() { + return terminatedAt; + } + + /** + * @return the osExtendedVolumesAttached + */ + public List getOsExtendedVolumesAttached() { + return osExtendedVolumesAttached; + } + + /** + * @return the uuid + */ + public String getUuid() { + return uuid; + } + + /** + * @return the adminPass + */ + public String getAdminPass() { + return adminPass; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Server [id=" + id + ", name=" + name + ", addresses=" + + addresses + ", links=" + links + ", image=" + image + + ", flavor=" + flavor + ", accessIPv4=" + accessIPv4 + + ", accessIPv6=" + accessIPv6 + ", configDrive=" + configDrive + + ", status=" + status + ", progress=" + progress + ", fault=" + + fault + ", tenantId=" + tenantId + ", userId=" + userId + + ", keyName=" + keyName + ", hostId=" + hostId + ", updated=" + + updated + ", created=" + created + ", metadata=" + metadata + + ", securityGroups=" + securityGroups + ", taskState=" + + taskState + ", powerState=" + powerState + ", vmState=" + + vmState + ", host=" + host + ", instanceName=" + instanceName + + ", hypervisorHostname=" + hypervisorHostname + + ", diskConfig=" + diskConfig + ", availabilityZone=" + + availabilityZone + ", launchedAt=" + launchedAt + ", terminatedAt=" + + ", " + "osExtendedVolumesAttached=" + osExtendedVolumesAttached + + ", uuid=" + uuid + ", adminPass=" + + adminPass + "]"; + } + +} diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/ServerAction.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/ServerAction.java index 26fa5a4a6..bde1c45d8 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/ServerAction.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/ServerAction.java @@ -1,610 +1,610 @@ -package com.woorea.openstack.nova.model; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.codehaus.jackson.annotate.JsonProperty; -import org.codehaus.jackson.map.annotate.JsonRootName; - -public interface ServerAction extends Serializable { - - @JsonRootName("changePassword") - public static final class ChangePassword implements ServerAction { - - private String adminPass; - - public ChangePassword() { - super(); - // TODO Auto-generated constructor stub - } - - public ChangePassword(String adminPass) { - this.adminPass = adminPass; - } - - /** - * @return the adminPass - */ - public String getAdminPass() { - return adminPass; - } - - /** - * @param adminPass the adminPass to set - */ - public void setAdminPass(String adminPass) { - this.adminPass = adminPass; - } - - } - - @JsonRootName("reboot") - public static final class Reboot implements ServerAction { - - private String type; - - /** - * @return the type - */ - public String getType() { - return type; - } - - /** - * @param type the type to set - */ - public void setType(String type) { - this.type = type; - } - - } - - @JsonRootName("rebuild") - public static final class Rebuild implements ServerAction { - - private String imageRef; - - private String name; - - private String adminPass; - - private String accessIPv4; - - private String accessIPv6; - - private Map metadata = new HashMap(); - - private List personality = new ArrayList(); - - @JsonProperty("OS-DCF:diskConfig") - private String diskConfig; - - /** - * @return the imageRef - */ - public String getImageRef() { - return imageRef; - } - - /** - * @param imageRef the imageRef to set - */ - public void setImageRef(String imageRef) { - this.imageRef = imageRef; - } - - /** - * @return the name - */ - public String getName() { - return name; - } - - /** - * @param name the name to set - */ - public void setName(String name) { - this.name = name; - } - - /** - * @return the adminPass - */ - public String getAdminPass() { - return adminPass; - } - - /** - * @param adminPass the adminPass to set - */ - public void setAdminPass(String adminPass) { - this.adminPass = adminPass; - } - - /** - * @return the accessIPv4 - */ - public String getAccessIPv4() { - return accessIPv4; - } - - /** - * @param accessIPv4 the accessIPv4 to set - */ - public void setAccessIPv4(String accessIPv4) { - this.accessIPv4 = accessIPv4; - } - - /** - * @return the accessIPv6 - */ - public String getAccessIPv6() { - return accessIPv6; - } - - /** - * @param accessIPv6 the accessIPv6 to set - */ - public void setAccessIPv6(String accessIPv6) { - this.accessIPv6 = accessIPv6; - } - - /** - * @return the metadata - */ - public Map getMetadata() { - return metadata; - } - - /** - * @param metadata the metadata to set - */ - public void setMetadata(Map metadata) { - this.metadata = metadata; - } - - /** - * @return the personality - */ - public List getPersonality() { - return personality; - } - - /** - * @param personality the personality to set - */ - public void setPersonality(List personality) { - this.personality = personality; - } - - /** - * @return the diskConfig - */ - public String getDiskConfig() { - return diskConfig; - } - - /** - * @param diskConfig the diskConfig to set - */ - public void setDiskConfig(String diskConfig) { - this.diskConfig = diskConfig; - } - - } - - @JsonRootName("resize") - public static final class Resize implements ServerAction { - - private String flavorRef; - - @JsonProperty("OS-DCF:diskConfig") - private String diskConfig; - - /** - * @return the flavorRef - */ - public String getFlavorRef() { - return flavorRef; - } - - /** - * @param flavorRef the flavorRef to set - */ - public void setFlavorRef(String flavorRef) { - this.flavorRef = flavorRef; - } - - /** - * @return the diskConfig - */ - public String getDiskConfig() { - return diskConfig; - } - - /** - * @param diskConfig the diskConfig to set - */ - public void setDiskConfig(String diskConfig) { - this.diskConfig = diskConfig; - } - - } - - @JsonRootName("confirmResize") - public static final class ConfirmResize implements ServerAction { - - } - - @JsonRootName("revertResize") - public static final class RevertResize implements ServerAction { - - } - - @JsonRootName("createImage") - public static final class CreateImage implements ServerAction { - - private String name; - - private Map metadata; - - /** - * @return the name - */ - public String getName() { - return name; - } - - /** - * @param name the name to set - */ - public void setName(String name) { - this.name = name; - } - - /** - * @return the metadata - */ - public Map getMetadata() { - return metadata; - } - - /** - * @param metadata the metadata to set - */ - public void setMetadata(Map metadata) { - this.metadata = metadata; - } - - } - - @JsonRootName("rescue") - public static final class Rescue implements ServerAction { - - private String adminPass; - - public Rescue() { - - } - - public Rescue(String adminPass) { - this.adminPass = adminPass; - } - - /** - * @return the adminPass - */ - public String getAdminPass() { - return adminPass; - } - - /** - * @param adminPass the adminPass to set - */ - public void setAdminPass(String adminPass) { - this.adminPass = adminPass; - } - - } - - public static final class RescueResponse implements ServerAction { - - private String adminPass; - - /** - * @return the adminPass - */ - public String getAdminPass() { - return adminPass; - } - - } - - @JsonRootName("unrescue") - public static final class Unrescue implements ServerAction { - - } - - @JsonRootName("unpause") - public static final class Unpause implements ServerAction { - - } - - @JsonRootName("pause") - public static final class Pause implements ServerAction { - - } - - @JsonRootName("suspend") - public static final class Suspend implements ServerAction { - - } - - @JsonRootName("resume") - public static final class Resume implements ServerAction { - - } - - @JsonRootName("lock") - public static final class Lock implements ServerAction { - - } - - @JsonRootName("unlock") - public static final class Unlock implements ServerAction { - - } - - @JsonRootName("os-getConsoleOutput") - public static final class GetConsoleOutput implements ServerAction { - - private Integer length; - - public GetConsoleOutput() { - - } - - public GetConsoleOutput(Integer length) { - this.length = length; - } - - /** - * @return the length - */ - public Integer getLength() { - return length; - } - - /** - * @param length the length to set - */ - public void setLength(Integer length) { - this.length = length; - } - - } - - public static final class ConsoleOutput implements ServerAction { - - private String output; - - /** - * @return the output - */ - public String getOutput() { - return output; - } - - } - - @JsonRootName("os-getVNCConsole") - public static final class GetVncConsole implements ServerAction { - - private String type; - - public GetVncConsole() { - super(); - // TODO Auto-generated constructor stub - } - - - public GetVncConsole(String type) { - super(); - this.type = type; - } - - /** - * @return the type - */ - public String getType() { - return type; - } - - /** - * @param type the type to set - */ - public void setType(String type) { - this.type = type; - } - - } - - @JsonRootName("console") - public static final class VncConsole implements ServerAction { - - private String type; - - private String url; - - /** - * @return the type - */ - public String getType() { - return type; - } - - /** - * @return the url - */ - public String getUrl() { - return url; - } - - } - - @JsonRootName("os-start") - public static final class Start implements ServerAction { - - } - - @JsonRootName("os-stop") - public static final class Stop implements ServerAction { - - } - - @JsonRootName("forceDelete") - public static final class ForceDelete implements ServerAction { - - } - - @JsonRootName("restore") - public static final class Restore implements ServerAction { - - } - - @JsonRootName("addFloatingIp") - public static final class AssociateFloatingIp implements ServerAction { - - private String address; - - public AssociateFloatingIp() { - super(); - // TODO Auto-generated constructor stub - } - - public AssociateFloatingIp(String address) { - super(); - this.address = address; - } - - /** - * @return the address - */ - public String getAddress() { - return address; - } - - /** - * @param address the address to set - */ - public void setAddress(String address) { - this.address = address; - } - - } - - @JsonRootName("removeFloatingIp") - public static final class DisassociateFloatingIp implements ServerAction { - - private String address; - - public DisassociateFloatingIp() { - super(); - // TODO Auto-generated constructor stub - } - - public DisassociateFloatingIp(String address) { - super(); - this.address = address; - } - - /** - * @return the address - */ - public String getAddress() { - return address; - } - - /** - * @param address the address to set - */ - public void setAddress(String address) { - this.address = address; - } - - } - - @JsonRootName("createBackup") - public static final class CreateBackup implements ServerAction { - - private String name; - - @JsonProperty("backup_type") - private String type; - - private String rotation; - - private Map metadata; - - /** - * @return the name - */ - public String getName() { - return name; - } - - /** - * @param name the name to set - */ - public void setName(String name) { - this.name = name; - } - - /** - * @return the type - */ - public String getType() { - return type; - } - - /** - * @param type the type to set - */ - public void setType(String type) { - this.type = type; - } - - /** - * @return the rotation - */ - public String getRotation() { - return rotation; - } - - /** - * @param rotation the rotation to set - */ - public void setRotation(String rotation) { - this.rotation = rotation; - } - - /** - * @return the metadata - */ - public Map getMetadata() { - return metadata; - } - - /** - * @param metadata the metadata to set - */ - public void setMetadata(Map metadata) { - this.metadata = metadata; - } - - } - -} +package com.woorea.openstack.nova.model; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; + +public interface ServerAction extends Serializable { + + @JsonRootName("changePassword") + public static final class ChangePassword implements ServerAction { + + private String adminPass; + + public ChangePassword() { + super(); + // TODO Auto-generated constructor stub + } + + public ChangePassword(String adminPass) { + this.adminPass = adminPass; + } + + /** + * @return the adminPass + */ + public String getAdminPass() { + return adminPass; + } + + /** + * @param adminPass the adminPass to set + */ + public void setAdminPass(String adminPass) { + this.adminPass = adminPass; + } + + } + + @JsonRootName("reboot") + public static final class Reboot implements ServerAction { + + private String type; + + /** + * @return the type + */ + public String getType() { + return type; + } + + /** + * @param type the type to set + */ + public void setType(String type) { + this.type = type; + } + + } + + @JsonRootName("rebuild") + public static final class Rebuild implements ServerAction { + + private String imageRef; + + private String name; + + private String adminPass; + + private String accessIPv4; + + private String accessIPv6; + + private Map metadata = new HashMap(); + + private List personality = new ArrayList(); + + @JsonProperty("OS-DCF:diskConfig") + private String diskConfig; + + /** + * @return the imageRef + */ + public String getImageRef() { + return imageRef; + } + + /** + * @param imageRef the imageRef to set + */ + public void setImageRef(String imageRef) { + this.imageRef = imageRef; + } + + /** + * @return the name + */ + public String getName() { + return name; + } + + /** + * @param name the name to set + */ + public void setName(String name) { + this.name = name; + } + + /** + * @return the adminPass + */ + public String getAdminPass() { + return adminPass; + } + + /** + * @param adminPass the adminPass to set + */ + public void setAdminPass(String adminPass) { + this.adminPass = adminPass; + } + + /** + * @return the accessIPv4 + */ + public String getAccessIPv4() { + return accessIPv4; + } + + /** + * @param accessIPv4 the accessIPv4 to set + */ + public void setAccessIPv4(String accessIPv4) { + this.accessIPv4 = accessIPv4; + } + + /** + * @return the accessIPv6 + */ + public String getAccessIPv6() { + return accessIPv6; + } + + /** + * @param accessIPv6 the accessIPv6 to set + */ + public void setAccessIPv6(String accessIPv6) { + this.accessIPv6 = accessIPv6; + } + + /** + * @return the metadata + */ + public Map getMetadata() { + return metadata; + } + + /** + * @param metadata the metadata to set + */ + public void setMetadata(Map metadata) { + this.metadata = metadata; + } + + /** + * @return the personality + */ + public List getPersonality() { + return personality; + } + + /** + * @param personality the personality to set + */ + public void setPersonality(List personality) { + this.personality = personality; + } + + /** + * @return the diskConfig + */ + public String getDiskConfig() { + return diskConfig; + } + + /** + * @param diskConfig the diskConfig to set + */ + public void setDiskConfig(String diskConfig) { + this.diskConfig = diskConfig; + } + + } + + @JsonRootName("resize") + public static final class Resize implements ServerAction { + + private String flavorRef; + + @JsonProperty("OS-DCF:diskConfig") + private String diskConfig; + + /** + * @return the flavorRef + */ + public String getFlavorRef() { + return flavorRef; + } + + /** + * @param flavorRef the flavorRef to set + */ + public void setFlavorRef(String flavorRef) { + this.flavorRef = flavorRef; + } + + /** + * @return the diskConfig + */ + public String getDiskConfig() { + return diskConfig; + } + + /** + * @param diskConfig the diskConfig to set + */ + public void setDiskConfig(String diskConfig) { + this.diskConfig = diskConfig; + } + + } + + @JsonRootName("confirmResize") + public static final class ConfirmResize implements ServerAction { + + } + + @JsonRootName("revertResize") + public static final class RevertResize implements ServerAction { + + } + + @JsonRootName("createImage") + public static final class CreateImage implements ServerAction { + + private String name; + + private Map metadata; + + /** + * @return the name + */ + public String getName() { + return name; + } + + /** + * @param name the name to set + */ + public void setName(String name) { + this.name = name; + } + + /** + * @return the metadata + */ + public Map getMetadata() { + return metadata; + } + + /** + * @param metadata the metadata to set + */ + public void setMetadata(Map metadata) { + this.metadata = metadata; + } + + } + + @JsonRootName("rescue") + public static final class Rescue implements ServerAction { + + private String adminPass; + + public Rescue() { + + } + + public Rescue(String adminPass) { + this.adminPass = adminPass; + } + + /** + * @return the adminPass + */ + public String getAdminPass() { + return adminPass; + } + + /** + * @param adminPass the adminPass to set + */ + public void setAdminPass(String adminPass) { + this.adminPass = adminPass; + } + + } + + public static final class RescueResponse implements ServerAction { + + private String adminPass; + + /** + * @return the adminPass + */ + public String getAdminPass() { + return adminPass; + } + + } + + @JsonRootName("unrescue") + public static final class Unrescue implements ServerAction { + + } + + @JsonRootName("unpause") + public static final class Unpause implements ServerAction { + + } + + @JsonRootName("pause") + public static final class Pause implements ServerAction { + + } + + @JsonRootName("suspend") + public static final class Suspend implements ServerAction { + + } + + @JsonRootName("resume") + public static final class Resume implements ServerAction { + + } + + @JsonRootName("lock") + public static final class Lock implements ServerAction { + + } + + @JsonRootName("unlock") + public static final class Unlock implements ServerAction { + + } + + @JsonRootName("os-getConsoleOutput") + public static final class GetConsoleOutput implements ServerAction { + + private Integer length; + + public GetConsoleOutput() { + + } + + public GetConsoleOutput(Integer length) { + this.length = length; + } + + /** + * @return the length + */ + public Integer getLength() { + return length; + } + + /** + * @param length the length to set + */ + public void setLength(Integer length) { + this.length = length; + } + + } + + public static final class ConsoleOutput implements ServerAction { + + private String output; + + /** + * @return the output + */ + public String getOutput() { + return output; + } + + } + + @JsonRootName("os-getVNCConsole") + public static final class GetVncConsole implements ServerAction { + + private String type; + + public GetVncConsole() { + super(); + // TODO Auto-generated constructor stub + } + + + public GetVncConsole(String type) { + super(); + this.type = type; + } + + /** + * @return the type + */ + public String getType() { + return type; + } + + /** + * @param type the type to set + */ + public void setType(String type) { + this.type = type; + } + + } + + @JsonRootName("console") + public static final class VncConsole implements ServerAction { + + private String type; + + private String url; + + /** + * @return the type + */ + public String getType() { + return type; + } + + /** + * @return the url + */ + public String getUrl() { + return url; + } + + } + + @JsonRootName("os-start") + public static final class Start implements ServerAction { + + } + + @JsonRootName("os-stop") + public static final class Stop implements ServerAction { + + } + + @JsonRootName("forceDelete") + public static final class ForceDelete implements ServerAction { + + } + + @JsonRootName("restore") + public static final class Restore implements ServerAction { + + } + + @JsonRootName("addFloatingIp") + public static final class AssociateFloatingIp implements ServerAction { + + private String address; + + public AssociateFloatingIp() { + super(); + // TODO Auto-generated constructor stub + } + + public AssociateFloatingIp(String address) { + super(); + this.address = address; + } + + /** + * @return the address + */ + public String getAddress() { + return address; + } + + /** + * @param address the address to set + */ + public void setAddress(String address) { + this.address = address; + } + + } + + @JsonRootName("removeFloatingIp") + public static final class DisassociateFloatingIp implements ServerAction { + + private String address; + + public DisassociateFloatingIp() { + super(); + // TODO Auto-generated constructor stub + } + + public DisassociateFloatingIp(String address) { + super(); + this.address = address; + } + + /** + * @return the address + */ + public String getAddress() { + return address; + } + + /** + * @param address the address to set + */ + public void setAddress(String address) { + this.address = address; + } + + } + + @JsonRootName("createBackup") + public static final class CreateBackup implements ServerAction { + + private String name; + + @JsonProperty("backup_type") + private String type; + + private String rotation; + + private Map metadata; + + /** + * @return the name + */ + public String getName() { + return name; + } + + /** + * @param name the name to set + */ + public void setName(String name) { + this.name = name; + } + + /** + * @return the type + */ + public String getType() { + return type; + } + + /** + * @param type the type to set + */ + public void setType(String type) { + this.type = type; + } + + /** + * @return the rotation + */ + public String getRotation() { + return rotation; + } + + /** + * @param rotation the rotation to set + */ + public void setRotation(String rotation) { + this.rotation = rotation; + } + + /** + * @return the metadata + */ + public Map getMetadata() { + return metadata; + } + + /** + * @param metadata the metadata to set + */ + public void setMetadata(Map metadata) { + this.metadata = metadata; + } + + } + +} diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/ServerForCreate.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/ServerForCreate.java index 9f28a8113..13e45c03a 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/ServerForCreate.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/ServerForCreate.java @@ -1,326 +1,326 @@ -package com.woorea.openstack.nova.model; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.codehaus.jackson.annotate.JsonProperty; -import org.codehaus.jackson.map.annotate.JsonRootName; - -@JsonRootName("server") -public class ServerForCreate implements Serializable { - - public static final class SecurityGroup implements Serializable { - - private String name; - - public SecurityGroup() { - } - - public SecurityGroup(String name) { - this.name = name; - } - - /** - * @return the name - */ - public String getName() { - return name; - } - - /** - * @param name - * the name to set - */ - public void setName(String name) { - this.name = name; - } - - } - - private String name; - - private String adminPass; - - private String imageRef; - - private String flavorRef; - - private String accessIPv4; - - private String accessIPv6; - - private Integer min; - - private Integer max; - - private String diskConfig; - - @JsonProperty("key_name") - private String keyName; - - private List personality = new ArrayList(); - - private Map metadata = new HashMap(); - - @JsonProperty("security_groups") - private List securityGroups; - - @JsonProperty("user_data") - private String userData; - - @JsonProperty("availability_zone") - private String availabilityZone; - - @JsonProperty("config_drive") - private boolean configDrive; - - @JsonProperty("networks") - private List networks = new ArrayList(); - - /** - * @return the name - */ - public String getName() { - return name; - } - - /** - * @param name - * the name to set - */ - public void setName(String name) { - this.name = name; - } - - /** - * @return the adminPass - */ - public String getAdminPass() { - return adminPass; - } - - /** - * @param adminPass - * the adminPass to set - */ - public void setAdminPass(String adminPass) { - this.adminPass = adminPass; - } - - /** - * @return the imageRef - */ - public String getImageRef() { - return imageRef; - } - - /** - * @param imageRef - * the imageRef to set - */ - public void setImageRef(String imageRef) { - this.imageRef = imageRef; - } - - /** - * @return the flavorRef - */ - public String getFlavorRef() { - return flavorRef; - } - - /** - * @param flavorRef - * the flavorRef to set - */ - public void setFlavorRef(String flavorRef) { - this.flavorRef = flavorRef; - } - - /** - * @return the accessIPv4 - */ - public String getAccessIPv4() { - return accessIPv4; - } - - /** - * @param accessIPv4 - * the accessIPv4 to set - */ - public void setAccessIPv4(String accessIPv4) { - this.accessIPv4 = accessIPv4; - } - - /** - * @return the accessIPv6 - */ - public String getAccessIPv6() { - return accessIPv6; - } - - /** - * @param accessIPv6 - * the accessIPv6 to set - */ - public void setAccessIPv6(String accessIPv6) { - this.accessIPv6 = accessIPv6; - } - - /** - * @return the min - */ - public Integer getMin() { - return min; - } - - /** - * @param min - * the min to set - */ - public void setMin(Integer min) { - this.min = min; - } - - /** - * @return the max - */ - public Integer getMax() { - return max; - } - - /** - * @param max - * the max to set - */ - public void setMax(Integer max) { - this.max = max; - } - - /** - * @return the diskConfig - */ - public String getDiskConfig() { - return diskConfig; - } - - /** - * @param diskConfig - * the diskConfig to set - */ - public void setDiskConfig(String diskConfig) { - this.diskConfig = diskConfig; - } - - /** - * @return the keyName - */ - public String getKeyName() { - return keyName; - } - - /** - * @param keyName - * the keyName to set - */ - public void setKeyName(String keyName) { - this.keyName = keyName; - } - - /** - * @return the personality - */ - public List getPersonality() { - return personality; - } - - /** - * @param personality - * the personality to set - */ - public void setPersonality(List personality) { - this.personality = personality; - } - - /** - * @return the metadata - */ - public Map getMetadata() { - return metadata; - } - - /** - * @param metadata - * the metadata to set - */ - public void setMetadata(Map metadata) { - this.metadata = metadata; - } - - /** - * @return the securityGroups - */ - public List getSecurityGroups() { - if (securityGroups == null) { - securityGroups = new ArrayList(); - } - return securityGroups; - } - - /** - * @return the userData - */ - public String getUserData() { - return userData; - } - - /** - * @param userData - * the userData to set - */ - public void setUserData(String userData) { - this.userData = userData; - } - - /** - * @return the availabilityZone - */ - public String getAvailabilityZone() { - return availabilityZone; - } - - /** - * @param availabilityZone - * the availabilityZone to set - */ - public void setAvailabilityZone(String availabilityZone) { - this.availabilityZone = availabilityZone; - } - - public boolean isConfigDrive() { - return configDrive; - } - - public void setConfigDrive(boolean configDrive) { - this.configDrive = configDrive; - } - - public List getNetworks() { - return networks; - } - - public void setNetworks(List networks) { - this.networks = networks; - } - - public void addNetworks(String id, String fixedIp) { - NetworkForCreate net = new NetworkForCreate(); - net.setId(id); - net.setFixedIp(fixedIp); - this.networks.add(net); - } - -} +package com.woorea.openstack.nova.model; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName("server") +public class ServerForCreate implements Serializable { + + public static final class SecurityGroup implements Serializable { + + private String name; + + public SecurityGroup() { + } + + public SecurityGroup(String name) { + this.name = name; + } + + /** + * @return the name + */ + public String getName() { + return name; + } + + /** + * @param name + * the name to set + */ + public void setName(String name) { + this.name = name; + } + + } + + private String name; + + private String adminPass; + + private String imageRef; + + private String flavorRef; + + private String accessIPv4; + + private String accessIPv6; + + private Integer min; + + private Integer max; + + private String diskConfig; + + @JsonProperty("key_name") + private String keyName; + + private List personality = new ArrayList(); + + private Map metadata = new HashMap(); + + @JsonProperty("security_groups") + private List securityGroups; + + @JsonProperty("user_data") + private String userData; + + @JsonProperty("availability_zone") + private String availabilityZone; + + @JsonProperty("config_drive") + private boolean configDrive; + + @JsonProperty("networks") + private List networks = new ArrayList(); + + /** + * @return the name + */ + public String getName() { + return name; + } + + /** + * @param name + * the name to set + */ + public void setName(String name) { + this.name = name; + } + + /** + * @return the adminPass + */ + public String getAdminPass() { + return adminPass; + } + + /** + * @param adminPass + * the adminPass to set + */ + public void setAdminPass(String adminPass) { + this.adminPass = adminPass; + } + + /** + * @return the imageRef + */ + public String getImageRef() { + return imageRef; + } + + /** + * @param imageRef + * the imageRef to set + */ + public void setImageRef(String imageRef) { + this.imageRef = imageRef; + } + + /** + * @return the flavorRef + */ + public String getFlavorRef() { + return flavorRef; + } + + /** + * @param flavorRef + * the flavorRef to set + */ + public void setFlavorRef(String flavorRef) { + this.flavorRef = flavorRef; + } + + /** + * @return the accessIPv4 + */ + public String getAccessIPv4() { + return accessIPv4; + } + + /** + * @param accessIPv4 + * the accessIPv4 to set + */ + public void setAccessIPv4(String accessIPv4) { + this.accessIPv4 = accessIPv4; + } + + /** + * @return the accessIPv6 + */ + public String getAccessIPv6() { + return accessIPv6; + } + + /** + * @param accessIPv6 + * the accessIPv6 to set + */ + public void setAccessIPv6(String accessIPv6) { + this.accessIPv6 = accessIPv6; + } + + /** + * @return the min + */ + public Integer getMin() { + return min; + } + + /** + * @param min + * the min to set + */ + public void setMin(Integer min) { + this.min = min; + } + + /** + * @return the max + */ + public Integer getMax() { + return max; + } + + /** + * @param max + * the max to set + */ + public void setMax(Integer max) { + this.max = max; + } + + /** + * @return the diskConfig + */ + public String getDiskConfig() { + return diskConfig; + } + + /** + * @param diskConfig + * the diskConfig to set + */ + public void setDiskConfig(String diskConfig) { + this.diskConfig = diskConfig; + } + + /** + * @return the keyName + */ + public String getKeyName() { + return keyName; + } + + /** + * @param keyName + * the keyName to set + */ + public void setKeyName(String keyName) { + this.keyName = keyName; + } + + /** + * @return the personality + */ + public List getPersonality() { + return personality; + } + + /** + * @param personality + * the personality to set + */ + public void setPersonality(List personality) { + this.personality = personality; + } + + /** + * @return the metadata + */ + public Map getMetadata() { + return metadata; + } + + /** + * @param metadata + * the metadata to set + */ + public void setMetadata(Map metadata) { + this.metadata = metadata; + } + + /** + * @return the securityGroups + */ + public List getSecurityGroups() { + if (securityGroups == null) { + securityGroups = new ArrayList(); + } + return securityGroups; + } + + /** + * @return the userData + */ + public String getUserData() { + return userData; + } + + /** + * @param userData + * the userData to set + */ + public void setUserData(String userData) { + this.userData = userData; + } + + /** + * @return the availabilityZone + */ + public String getAvailabilityZone() { + return availabilityZone; + } + + /** + * @param availabilityZone + * the availabilityZone to set + */ + public void setAvailabilityZone(String availabilityZone) { + this.availabilityZone = availabilityZone; + } + + public boolean isConfigDrive() { + return configDrive; + } + + public void setConfigDrive(boolean configDrive) { + this.configDrive = configDrive; + } + + public List getNetworks() { + return networks; + } + + public void setNetworks(List networks) { + this.networks = networks; + } + + public void addNetworks(String id, String fixedIp) { + NetworkForCreate net = new NetworkForCreate(); + net.setId(id); + net.setFixedIp(fixedIp); + this.networks.add(net); + } + +} diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/Servers.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/Servers.java index a144250dc..4cbeb64f5 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/Servers.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/Servers.java @@ -1,34 +1,34 @@ -package com.woorea.openstack.nova.model; - -import java.io.Serializable; -import java.util.Iterator; -import java.util.List; - -import org.codehaus.jackson.annotate.JsonProperty; - -public class Servers implements Iterable, Serializable { - - @JsonProperty("servers") - private List list; - - /** - * @return the list - */ - public List getList() { - return list; - } - - @Override - public Iterator iterator() { - return list.iterator(); - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Servers [list=" + list + "]"; - } - -} +package com.woorea.openstack.nova.model; + +import java.io.Serializable; +import java.util.Iterator; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class Servers implements Iterable, Serializable { + + @JsonProperty("servers") + private List list; + + /** + * @return the list + */ + public List getList() { + return list; + } + + @Override + public Iterator iterator() { + return list.iterator(); + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Servers [list=" + list + "]"; + } + +} diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/SimpleTenantUsage.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/SimpleTenantUsage.java index f75414d99..c4a3b304d 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/SimpleTenantUsage.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/SimpleTenantUsage.java @@ -1,232 +1,232 @@ -package com.woorea.openstack.nova.model; - -import java.io.Serializable; -import java.math.BigDecimal; -import java.util.List; - -import org.codehaus.jackson.annotate.JsonProperty; -import org.codehaus.jackson.map.annotate.JsonRootName; - -@JsonRootName("tenant_usage") -public class SimpleTenantUsage implements Serializable { - - @JsonProperty("total_memory_mb_usage") - private BigDecimal totalMemoryMbUsage; - - @JsonProperty("total_vcpus_usage") - private BigDecimal totalVcpusUsage; - - @JsonProperty("total_local_gb_usage") - private BigDecimal totalLocalGbUsage; - - private String start; - - private String stop; - - @JsonProperty("tenant_id") - private String tenantId; - - @JsonProperty("total_hours") - private String totalHours; - - @JsonProperty("server_usages") - private List serverUsages; - - /** - * @return the totalMemoryMbUsage - */ - public BigDecimal getTotalMemoryMbUsage() { - return totalMemoryMbUsage; - } - - /** - * @param totalMemoryMbUsage the totalMemoryMbUsage to set - */ - public void setTotalMemoryMbUsage(BigDecimal totalMemoryMbUsage) { - this.totalMemoryMbUsage = totalMemoryMbUsage; - } - - /** - * @return the totalVcpusUsage - */ - public BigDecimal getTotalVcpusUsage() { - return totalVcpusUsage; - } - - /** - * @param totalVcpusUsage the totalVcpusUsage to set - */ - public void setTotalVcpusUsage(BigDecimal totalVcpusUsage) { - this.totalVcpusUsage = totalVcpusUsage; - } - - /** - * @return the totalLocalGbUsage - */ - public BigDecimal getTotalLocalGbUsage() { - return totalLocalGbUsage; - } - - /** - * @param totalLocalGbUsage the totalLocalGbUsage to set - */ - public void setTotalLocalGbUsage(BigDecimal totalLocalGbUsage) { - this.totalLocalGbUsage = totalLocalGbUsage; - } - - /** - * @return the start - */ - public String getStart() { - return start; - } - - /** - * @param start the start to set - */ - public void setStart(String start) { - this.start = start; - } - - /** - * @return the stop - */ - public String getStop() { - return stop; - } - - /** - * @param stop the stop to set - */ - public void setStop(String stop) { - this.stop = stop; - } - - /** - * @return the tenantId - */ - public String getTenantId() { - return tenantId; - } - - /** - * @param tenantId the tenantId to set - */ - public void setTenantId(String tenantId) { - this.tenantId = tenantId; - } - - /** - * @return the totalHours - */ - public String getTotalHours() { - return totalHours; - } - - /** - * @param totalHours the totalHours to set - */ - public void setTotalHours(String totalHours) { - this.totalHours = totalHours; - } - - public List getServerUsages() { - return serverUsages; - } - - public void setServerUsages(List serverUsages) { - this.serverUsages = serverUsages; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "SimpleTenantUsage [totalMemoryMbUsage=" + totalMemoryMbUsage - + ", totalVcpusUsage=" + totalVcpusUsage - + ", totalLocalGbUsage=" + totalLocalGbUsage + ", start=" - + start + ", stop=" + stop + ", tenantId=" + tenantId - + ", totalHours=" + totalHours + "]"; - } - - public static final class ServerUsage implements Serializable { - @JsonProperty("instance_id") - private String instanceId; - - private Integer uptime; - - @JsonProperty("started_at") - private String startedAt; - - @JsonProperty("ended_at") - private String endedAt; - - @JsonProperty("memory_mb") - private Integer memoryMb; - - @JsonProperty("tenant_id") - private String tenantId; - - private String state; - - private Double hours; - - private Integer vcpus; - - private String flavor; - - @JsonProperty("local_gb") - private Integer localDiskSize; - - private String name; - - public String getInstanceId() { - return instanceId; - } - - public Integer getUptime() { - return uptime; - } - - public String getStartedAt() { - return startedAt; - } - - public String getEndedAt() { - return endedAt; - } - - public Integer getMemoryMb() { - return memoryMb; - } - - public String getTenantId() { - return tenantId; - } - - public String getState() { - return state; - } - - public Double getHours() { - return hours; - } - - public Integer getVcpus() { - return vcpus; - } - - public String getFlavor() { - return flavor; - } - - public Integer getLocalDiskSize() { - return localDiskSize; - } - - public String getName() { - return name; - } - } -} +package com.woorea.openstack.nova.model; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName("tenant_usage") +public class SimpleTenantUsage implements Serializable { + + @JsonProperty("total_memory_mb_usage") + private BigDecimal totalMemoryMbUsage; + + @JsonProperty("total_vcpus_usage") + private BigDecimal totalVcpusUsage; + + @JsonProperty("total_local_gb_usage") + private BigDecimal totalLocalGbUsage; + + private String start; + + private String stop; + + @JsonProperty("tenant_id") + private String tenantId; + + @JsonProperty("total_hours") + private String totalHours; + + @JsonProperty("server_usages") + private List serverUsages; + + /** + * @return the totalMemoryMbUsage + */ + public BigDecimal getTotalMemoryMbUsage() { + return totalMemoryMbUsage; + } + + /** + * @param totalMemoryMbUsage the totalMemoryMbUsage to set + */ + public void setTotalMemoryMbUsage(BigDecimal totalMemoryMbUsage) { + this.totalMemoryMbUsage = totalMemoryMbUsage; + } + + /** + * @return the totalVcpusUsage + */ + public BigDecimal getTotalVcpusUsage() { + return totalVcpusUsage; + } + + /** + * @param totalVcpusUsage the totalVcpusUsage to set + */ + public void setTotalVcpusUsage(BigDecimal totalVcpusUsage) { + this.totalVcpusUsage = totalVcpusUsage; + } + + /** + * @return the totalLocalGbUsage + */ + public BigDecimal getTotalLocalGbUsage() { + return totalLocalGbUsage; + } + + /** + * @param totalLocalGbUsage the totalLocalGbUsage to set + */ + public void setTotalLocalGbUsage(BigDecimal totalLocalGbUsage) { + this.totalLocalGbUsage = totalLocalGbUsage; + } + + /** + * @return the start + */ + public String getStart() { + return start; + } + + /** + * @param start the start to set + */ + public void setStart(String start) { + this.start = start; + } + + /** + * @return the stop + */ + public String getStop() { + return stop; + } + + /** + * @param stop the stop to set + */ + public void setStop(String stop) { + this.stop = stop; + } + + /** + * @return the tenantId + */ + public String getTenantId() { + return tenantId; + } + + /** + * @param tenantId the tenantId to set + */ + public void setTenantId(String tenantId) { + this.tenantId = tenantId; + } + + /** + * @return the totalHours + */ + public String getTotalHours() { + return totalHours; + } + + /** + * @param totalHours the totalHours to set + */ + public void setTotalHours(String totalHours) { + this.totalHours = totalHours; + } + + public List getServerUsages() { + return serverUsages; + } + + public void setServerUsages(List serverUsages) { + this.serverUsages = serverUsages; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "SimpleTenantUsage [totalMemoryMbUsage=" + totalMemoryMbUsage + + ", totalVcpusUsage=" + totalVcpusUsage + + ", totalLocalGbUsage=" + totalLocalGbUsage + ", start=" + + start + ", stop=" + stop + ", tenantId=" + tenantId + + ", totalHours=" + totalHours + "]"; + } + + public static final class ServerUsage implements Serializable { + @JsonProperty("instance_id") + private String instanceId; + + private Integer uptime; + + @JsonProperty("started_at") + private String startedAt; + + @JsonProperty("ended_at") + private String endedAt; + + @JsonProperty("memory_mb") + private Integer memoryMb; + + @JsonProperty("tenant_id") + private String tenantId; + + private String state; + + private Double hours; + + private Integer vcpus; + + private String flavor; + + @JsonProperty("local_gb") + private Integer localDiskSize; + + private String name; + + public String getInstanceId() { + return instanceId; + } + + public Integer getUptime() { + return uptime; + } + + public String getStartedAt() { + return startedAt; + } + + public String getEndedAt() { + return endedAt; + } + + public Integer getMemoryMb() { + return memoryMb; + } + + public String getTenantId() { + return tenantId; + } + + public String getState() { + return state; + } + + public Double getHours() { + return hours; + } + + public Integer getVcpus() { + return vcpus; + } + + public String getFlavor() { + return flavor; + } + + public Integer getLocalDiskSize() { + return localDiskSize; + } + + public String getName() { + return name; + } + } +} diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/SimpleTenantUsages.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/SimpleTenantUsages.java index 33c46254d..18c2aef44 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/SimpleTenantUsages.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/SimpleTenantUsages.java @@ -1,34 +1,34 @@ -package com.woorea.openstack.nova.model; - -import java.io.Serializable; -import java.util.Iterator; -import java.util.List; - -import org.codehaus.jackson.annotate.JsonProperty; - -public class SimpleTenantUsages implements Iterable, Serializable { - - @JsonProperty("tenant_usages") - private List list; - - /** - * @return the list - */ - public List getList() { - return list; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "SimpleTenantUsage [list=" + list + "]"; - } - - @Override - public Iterator iterator() { - return list.iterator(); - } - -} +package com.woorea.openstack.nova.model; + +import java.io.Serializable; +import java.util.Iterator; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class SimpleTenantUsages implements Iterable, Serializable { + + @JsonProperty("tenant_usages") + private List list; + + /** + * @return the list + */ + public List getList() { + return list; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "SimpleTenantUsage [list=" + list + "]"; + } + + @Override + public Iterator iterator() { + return list.iterator(); + } + +} diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/Snapshot.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/Snapshot.java index 06b9c4d76..6d945eac9 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/Snapshot.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/Snapshot.java @@ -1,87 +1,87 @@ -package com.woorea.openstack.nova.model; - -import java.io.Serializable; - -import org.codehaus.jackson.annotate.JsonProperty; -import org.codehaus.jackson.map.annotate.JsonRootName; - -@JsonRootName("snapshot") -public class Snapshot implements Serializable { - - private String id; - - private String status; - - @JsonProperty("displayName") - private String name; - - @JsonProperty("displayDescription") - private String description; - - private String volumeId; - - private Integer size; - - private String createdAt; - - /** - * @return the id - */ - public String getId() { - return id; - } - - /** - * @return the status - */ - public String getStatus() { - return status; - } - - /** - * @return the name - */ - public String getName() { - return name; - } - - /** - * @return the description - */ - public String getDescription() { - return description; - } - - /** - * @return the volumeId - */ - public String getVolumeId() { - return volumeId; - } - - /** - * @return the size - */ - public Integer getSize() { - return size; - } - - /** - * @return the createdAt - */ - public String getCreatedAt() { - return createdAt; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Snapshot [id=" + id + ", status=" + status + ", displayName=" - + name + ", displayDescription=" + description - + ", volumeId=" + volumeId + ", size=" + size + ", createdAt=" - + createdAt + "]"; - } - -} +package com.woorea.openstack.nova.model; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName("snapshot") +public class Snapshot implements Serializable { + + private String id; + + private String status; + + @JsonProperty("displayName") + private String name; + + @JsonProperty("displayDescription") + private String description; + + private String volumeId; + + private Integer size; + + private String createdAt; + + /** + * @return the id + */ + public String getId() { + return id; + } + + /** + * @return the status + */ + public String getStatus() { + return status; + } + + /** + * @return the name + */ + public String getName() { + return name; + } + + /** + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * @return the volumeId + */ + public String getVolumeId() { + return volumeId; + } + + /** + * @return the size + */ + public Integer getSize() { + return size; + } + + /** + * @return the createdAt + */ + public String getCreatedAt() { + return createdAt; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Snapshot [id=" + id + ", status=" + status + ", displayName=" + + name + ", displayDescription=" + description + + ", volumeId=" + volumeId + ", size=" + size + ", createdAt=" + + createdAt + "]"; + } + +} diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/SnapshotForCreate.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/SnapshotForCreate.java index 5db392e49..0dc123450 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/SnapshotForCreate.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/SnapshotForCreate.java @@ -1,87 +1,87 @@ -package com.woorea.openstack.nova.model; - -import java.io.Serializable; - -import org.codehaus.jackson.annotate.JsonProperty; -import org.codehaus.jackson.map.annotate.JsonRootName; - -@JsonRootName("snapshot") -public class SnapshotForCreate implements Serializable { - - @JsonProperty("volume_id") - private String volumeId; - - private Boolean force; - - @JsonProperty("display_name") - private String name; - - @JsonProperty("display_description") - private String description; - - /** - * @return the volumeId - */ - public String getVolumeId() { - return volumeId; - } - - /** - * @param volumeId the volumeId to set - */ - public void setVolumeId(String volumeId) { - this.volumeId = volumeId; - } - - /** - * @return the force - */ - public Boolean getForce() { - return force; - } - - /** - * @param force the force to set - */ - public void setForce(Boolean force) { - this.force = force; - } - - /** - * @return the name - */ - public String getName() { - return name; - } - - /** - * @param name the name to set - */ - public void setName(String name) { - this.name = name; - } - - /** - * @return the description - */ - public String getDescription() { - return description; - } - - /** - * @param description the description to set - */ - public void setDescription(String description) { - this.description = description; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "SnapshotForCreate [volumeId=" + volumeId + ", force=" + force - + ", name=" + name + ", description=" + description + "]"; - } - -} +package com.woorea.openstack.nova.model; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName("snapshot") +public class SnapshotForCreate implements Serializable { + + @JsonProperty("volume_id") + private String volumeId; + + private Boolean force; + + @JsonProperty("display_name") + private String name; + + @JsonProperty("display_description") + private String description; + + /** + * @return the volumeId + */ + public String getVolumeId() { + return volumeId; + } + + /** + * @param volumeId the volumeId to set + */ + public void setVolumeId(String volumeId) { + this.volumeId = volumeId; + } + + /** + * @return the force + */ + public Boolean getForce() { + return force; + } + + /** + * @param force the force to set + */ + public void setForce(Boolean force) { + this.force = force; + } + + /** + * @return the name + */ + public String getName() { + return name; + } + + /** + * @param name the name to set + */ + public void setName(String name) { + this.name = name; + } + + /** + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * @param description the description to set + */ + public void setDescription(String description) { + this.description = description; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "SnapshotForCreate [volumeId=" + volumeId + ", force=" + force + + ", name=" + name + ", description=" + description + "]"; + } + +} diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/Snapshots.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/Snapshots.java index 006d30cb4..bf11d2073 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/Snapshots.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/Snapshots.java @@ -1,34 +1,34 @@ -package com.woorea.openstack.nova.model; - -import java.io.Serializable; -import java.util.Iterator; -import java.util.List; - -import org.codehaus.jackson.annotate.JsonProperty; - -public class Snapshots implements Iterable, Serializable { - - @JsonProperty("snapshots") - private List list; - - /** - * @return the list - */ - public List getList() { - return list; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Snapshots [list=" + list + "]"; - } - - @Override - public Iterator iterator() { - return list.iterator(); - } - -} +package com.woorea.openstack.nova.model; + +import java.io.Serializable; +import java.util.Iterator; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class Snapshots implements Iterable, Serializable { + + @JsonProperty("snapshots") + private List list; + + /** + * @return the list + */ + public List getList() { + return list; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Snapshots [list=" + list + "]"; + } + + @Override + public Iterator iterator() { + return list.iterator(); + } + +} diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/Volume.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/Volume.java index d4b7e6e68..44b055a31 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/Volume.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/Volume.java @@ -1,116 +1,116 @@ -package com.woorea.openstack.nova.model; - -import java.io.Serializable; -import java.util.List; -import java.util.Map; - -import org.codehaus.jackson.annotate.JsonProperty; -import org.codehaus.jackson.map.annotate.JsonRootName; - -@JsonRootName("volume") -public class Volume implements Serializable { - - private String id; - - private String status; - - @JsonProperty("displayName") - private String name; - - @JsonProperty("displayDescription") - private String description; - - private String availabilityZone; - - private String volumeType; - - private String snapshotId; - - private List> attachments; - - private Map metadata; - - private String createdAt; - - private Integer size; - - /** - * @return the id - */ - public String getId() { - return id; - } - - /** - * @return the status - */ - public String getStatus() { - return status; - } - - /** - * @return the name - */ - public String getName() { - return name; - } - - /** - * @return the description - */ - public String getDescription() { - return description; - } - - /** - * @return the availabilityZone - */ - public String getAvailabilityZone() { - return availabilityZone; - } - - /** - * @return the volumeType - */ - public String getVolumeType() { - return volumeType; - } - - /** - * @return the snapshotId - */ - public String getSnapshotId() { - return snapshotId; - } - - /** - * @return the attachments - */ - public List> getAttachments() { - return attachments; - } - - /** - * @return the metadata - */ - public Map getMetadata() { - return metadata; - } - - /** - * @return the createdAt - */ - public String getCreatedAt() { - return createdAt; - } - - /** - * @return the size - */ - public Integer getSize() { - return size; - } - - - -} +package com.woorea.openstack.nova.model; + +import java.io.Serializable; +import java.util.List; +import java.util.Map; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName("volume") +public class Volume implements Serializable { + + private String id; + + private String status; + + @JsonProperty("displayName") + private String name; + + @JsonProperty("displayDescription") + private String description; + + private String availabilityZone; + + private String volumeType; + + private String snapshotId; + + private List> attachments; + + private Map metadata; + + private String createdAt; + + private Integer size; + + /** + * @return the id + */ + public String getId() { + return id; + } + + /** + * @return the status + */ + public String getStatus() { + return status; + } + + /** + * @return the name + */ + public String getName() { + return name; + } + + /** + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * @return the availabilityZone + */ + public String getAvailabilityZone() { + return availabilityZone; + } + + /** + * @return the volumeType + */ + public String getVolumeType() { + return volumeType; + } + + /** + * @return the snapshotId + */ + public String getSnapshotId() { + return snapshotId; + } + + /** + * @return the attachments + */ + public List> getAttachments() { + return attachments; + } + + /** + * @return the metadata + */ + public Map getMetadata() { + return metadata; + } + + /** + * @return the createdAt + */ + public String getCreatedAt() { + return createdAt; + } + + /** + * @return the size + */ + public Integer getSize() { + return size; + } + + + +} diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/VolumeAttachment.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/VolumeAttachment.java index 54abc9e82..1ed88b73a 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/VolumeAttachment.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/VolumeAttachment.java @@ -1,59 +1,59 @@ -package com.woorea.openstack.nova.model; - -import java.io.Serializable; - -import org.codehaus.jackson.map.annotate.JsonRootName; - -@JsonRootName("volumeAttachment") -public class VolumeAttachment implements Serializable { - - private String id; - - private String volumeId; - - private String serverId; - - private String device; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getVolumeId() { - return volumeId; - } - - public void setVolumeId(String volumeId) { - this.volumeId = volumeId; - } - - public String getServerId() { - return serverId; - } - - public void setServerId(String serverId) { - this.serverId = serverId; - } - - public String getDevice() { - return device; - } - - public void setDevice(String device) { - this.device = device; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "VolumeAttachment [id=" + id + ", volumeId=" + volumeId - + ", serverId=" + serverId + ", device=" + device + "]"; - } - -} +package com.woorea.openstack.nova.model; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName("volumeAttachment") +public class VolumeAttachment implements Serializable { + + private String id; + + private String volumeId; + + private String serverId; + + private String device; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getVolumeId() { + return volumeId; + } + + public void setVolumeId(String volumeId) { + this.volumeId = volumeId; + } + + public String getServerId() { + return serverId; + } + + public void setServerId(String serverId) { + this.serverId = serverId; + } + + public String getDevice() { + return device; + } + + public void setDevice(String device) { + this.device = device; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "VolumeAttachment [id=" + id + ", volumeId=" + volumeId + + ", serverId=" + serverId + ", device=" + device + "]"; + } + +} diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/VolumeAttachments.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/VolumeAttachments.java index be5ea8e33..53097db88 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/VolumeAttachments.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/VolumeAttachments.java @@ -1,34 +1,34 @@ -package com.woorea.openstack.nova.model; - -import java.io.Serializable; -import java.util.Iterator; -import java.util.List; - -import org.codehaus.jackson.annotate.JsonProperty; - -public class VolumeAttachments implements Iterable, Serializable { - - @JsonProperty("volumeAttachments") - private List list; - - /** - * @return the list - */ - public List getList() { - return list; - } - - @Override - public Iterator iterator() { - return list.iterator(); - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "VolumeAttachments [list=" + list + "]"; - } - -} +package com.woorea.openstack.nova.model; + +import java.io.Serializable; +import java.util.Iterator; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class VolumeAttachments implements Iterable, Serializable { + + @JsonProperty("volumeAttachments") + private List list; + + /** + * @return the list + */ + public List getList() { + return list; + } + + @Override + public Iterator iterator() { + return list.iterator(); + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "VolumeAttachments [list=" + list + "]"; + } + +} diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/VolumeForCreate.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/VolumeForCreate.java index c4a09a334..9f8ba2530 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/VolumeForCreate.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/VolumeForCreate.java @@ -1,123 +1,123 @@ -package com.woorea.openstack.nova.model; - -import java.io.Serializable; -import java.util.Map; - -import org.codehaus.jackson.annotate.JsonProperty; -import org.codehaus.jackson.map.annotate.JsonRootName; - -@JsonRootName("volume") -public class VolumeForCreate implements Serializable { - - private Integer size; - - @JsonProperty("availability_zone") - private String availabilityZone; - - @JsonProperty("display_name") - private String name; - - @JsonProperty("display_description") - private String description; - - @JsonProperty("snapshot_id") - private Integer snapshotId; - - private Map metadata; - - /** - * @return the size - */ - public Integer getSize() { - return size; - } - - /** - * @param size the size to set - */ - public void setSize(Integer size) { - this.size = size; - } - - /** - * @return the availabilityZone - */ - public String getAvailabilityZone() { - return availabilityZone; - } - - /** - * @param availabilityZone the availabilityZone to set - */ - public void setAvailabilityZone(String availabilityZone) { - this.availabilityZone = availabilityZone; - } - - /** - * @return the name - */ - public String getName() { - return name; - } - - /** - * @param name the name to set - */ - public void setName(String name) { - this.name = name; - } - - /** - * @return the description - */ - public String getDescription() { - return description; - } - - /** - * @param description the description to set - */ - public void setDescription(String description) { - this.description = description; - } - - /** - * @return the snapshotId - */ - public Integer getSnapshotId() { - return snapshotId; - } - - /** - * @param snapshotId the snapshotId to set - */ - public void setSnapshotId(Integer snapshotId) { - this.snapshotId = snapshotId; - } - - /** - * @return the metadata - */ - public Map getMetadata() { - return metadata; - } - - /** - * @param metadata the metadata to set - */ - public void setMetadata(Map metadata) { - this.metadata = metadata; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "VolumeForCreate [size=" + size + ", availabilityZone=" - + availabilityZone + ", name=" + name + ", description=" - + description + ", snapshotId=" + snapshotId + ", metadata=" - + metadata + "]"; - } - -} +package com.woorea.openstack.nova.model; + +import java.io.Serializable; +import java.util.Map; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName("volume") +public class VolumeForCreate implements Serializable { + + private Integer size; + + @JsonProperty("availability_zone") + private String availabilityZone; + + @JsonProperty("display_name") + private String name; + + @JsonProperty("display_description") + private String description; + + @JsonProperty("snapshot_id") + private Integer snapshotId; + + private Map metadata; + + /** + * @return the size + */ + public Integer getSize() { + return size; + } + + /** + * @param size the size to set + */ + public void setSize(Integer size) { + this.size = size; + } + + /** + * @return the availabilityZone + */ + public String getAvailabilityZone() { + return availabilityZone; + } + + /** + * @param availabilityZone the availabilityZone to set + */ + public void setAvailabilityZone(String availabilityZone) { + this.availabilityZone = availabilityZone; + } + + /** + * @return the name + */ + public String getName() { + return name; + } + + /** + * @param name the name to set + */ + public void setName(String name) { + this.name = name; + } + + /** + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * @param description the description to set + */ + public void setDescription(String description) { + this.description = description; + } + + /** + * @return the snapshotId + */ + public Integer getSnapshotId() { + return snapshotId; + } + + /** + * @param snapshotId the snapshotId to set + */ + public void setSnapshotId(Integer snapshotId) { + this.snapshotId = snapshotId; + } + + /** + * @return the metadata + */ + public Map getMetadata() { + return metadata; + } + + /** + * @param metadata the metadata to set + */ + public void setMetadata(Map metadata) { + this.metadata = metadata; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "VolumeForCreate [size=" + size + ", availabilityZone=" + + availabilityZone + ", name=" + name + ", description=" + + description + ", snapshotId=" + snapshotId + ", metadata=" + + metadata + "]"; + } + +} diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/VolumeForImageCreate.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/VolumeForImageCreate.java index 994d49a4d..2b7be7c33 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/VolumeForImageCreate.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/VolumeForImageCreate.java @@ -1,71 +1,71 @@ -package com.woorea.openstack.nova.model; - -import java.io.Serializable; - -import org.codehaus.jackson.annotate.JsonProperty; -import org.codehaus.jackson.map.annotate.JsonRootName; - -@JsonRootName("os-volume_upload_image") -public class VolumeForImageCreate implements Serializable { - String volumeId; - String tenantId; - - public String getTenantId() { - return tenantId; - } - - public void setTenantId(String tenantId) { - this.tenantId = tenantId; - } - - @JsonProperty("force") - private Boolean force; - - public Boolean getForce() { - return force; - } - - public void setForce(Boolean force) { - this.force = force; - } - - @JsonProperty("container_format") - String container_format; - @JsonProperty("disk_format") - String disk_format; - @JsonProperty("image_name") - String image_name; - - public String getVolumeId() { - return volumeId; - } - - public void setVolumeId(String volumeId) { - this.volumeId = volumeId; - } - - public String getContainer_format() { - return container_format; - } - - public void setContainer_format(String container_format) { - this.container_format = container_format; - } - - public String getDisk_format() { - return disk_format; - } - - public void setDisk_format(String disk_format) { - this.disk_format = disk_format; - } - - public String getImage_name() { - return image_name; - } - - public void setImage_name(String image_name) { - this.image_name = image_name; - } - -} +package com.woorea.openstack.nova.model; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName("os-volume_upload_image") +public class VolumeForImageCreate implements Serializable { + String volumeId; + String tenantId; + + public String getTenantId() { + return tenantId; + } + + public void setTenantId(String tenantId) { + this.tenantId = tenantId; + } + + @JsonProperty("force") + private Boolean force; + + public Boolean getForce() { + return force; + } + + public void setForce(Boolean force) { + this.force = force; + } + + @JsonProperty("container_format") + String container_format; + @JsonProperty("disk_format") + String disk_format; + @JsonProperty("image_name") + String image_name; + + public String getVolumeId() { + return volumeId; + } + + public void setVolumeId(String volumeId) { + this.volumeId = volumeId; + } + + public String getContainer_format() { + return container_format; + } + + public void setContainer_format(String container_format) { + this.container_format = container_format; + } + + public String getDisk_format() { + return disk_format; + } + + public void setDisk_format(String disk_format) { + this.disk_format = disk_format; + } + + public String getImage_name() { + return image_name; + } + + public void setImage_name(String image_name) { + this.image_name = image_name; + } + +} diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/VolumeType.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/VolumeType.java index 4c25e4b81..4d738e1a0 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/VolumeType.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/VolumeType.java @@ -1,10 +1,10 @@ -package com.woorea.openstack.nova.model; - -import java.io.Serializable; - -import org.codehaus.jackson.map.annotate.JsonRootName; - -@JsonRootName("volume-type") -public class VolumeType implements Serializable { - -} +package com.woorea.openstack.nova.model; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName("volume-type") +public class VolumeType implements Serializable { + +} diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/VolumeTypes.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/VolumeTypes.java index 42d8162d2..0be51a6fc 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/VolumeTypes.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/VolumeTypes.java @@ -1,34 +1,34 @@ -package com.woorea.openstack.nova.model; - -import java.io.Serializable; -import java.util.Iterator; -import java.util.List; - -import org.codehaus.jackson.annotate.JsonProperty; - -public class VolumeTypes implements Iterable, Serializable { - - @JsonProperty("volume-types") - private List list; - - /** - * @return the list - */ - public List getList() { - return list; - } - - @Override - public Iterator iterator() { - return list.iterator(); - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "VolumeTypes [list=" + list + "]"; - } - -} +package com.woorea.openstack.nova.model; + +import java.io.Serializable; +import java.util.Iterator; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class VolumeTypes implements Iterable, Serializable { + + @JsonProperty("volume-types") + private List list; + + /** + * @return the list + */ + public List getList() { + return list; + } + + @Override + public Iterator iterator() { + return list.iterator(); + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "VolumeTypes [list=" + list + "]"; + } + +} diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/Volumes.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/Volumes.java index 349ef874a..9294d8cac 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/Volumes.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/Volumes.java @@ -1,34 +1,34 @@ -package com.woorea.openstack.nova.model; - -import java.io.Serializable; -import java.util.Iterator; -import java.util.List; - -import org.codehaus.jackson.annotate.JsonProperty; - -public class Volumes implements Iterable, Serializable { - - @JsonProperty("volumes") - private List list; - - /** - * @return the list - */ - public List getList() { - return list; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Volumes [list=" + list + "]"; - } - - @Override - public Iterator iterator() { - return list.iterator(); - } - -} +package com.woorea.openstack.nova.model; + +import java.io.Serializable; +import java.util.Iterator; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class Volumes implements Iterable, Serializable { + + @JsonProperty("volumes") + private List list; + + /** + * @return the list + */ + public List getList() { + return list; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Volumes [list=" + list + "]"; + } + + @Override + public Iterator iterator() { + return list.iterator(); + } + +} diff --git a/openstack-client-connectors/jersey-connector/src/main/java/com/woorea/openstack/connector/JerseyConnector.java b/openstack-client-connectors/jersey-connector/src/main/java/com/woorea/openstack/connector/JerseyConnector.java index 416f5dda3..568b724a7 100644 --- a/openstack-client-connectors/jersey-connector/src/main/java/com/woorea/openstack/connector/JerseyConnector.java +++ b/openstack-client-connectors/jersey-connector/src/main/java/com/woorea/openstack/connector/JerseyConnector.java @@ -1,101 +1,104 @@ -package com.woorea.openstack.connector; - -import java.util.List; -import java.util.Map; -import java.util.logging.Logger; - -import javax.ws.rs.core.MultivaluedMap; -import javax.ws.rs.ext.ContextResolver; -import javax.ws.rs.ext.Provider; - -import org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider; -import org.codehaus.jackson.map.DeserializationConfig; -import org.codehaus.jackson.map.ObjectMapper; -import org.codehaus.jackson.map.SerializationConfig; -import org.codehaus.jackson.map.annotate.JsonRootName; -import org.codehaus.jackson.map.annotate.JsonSerialize.Inclusion; - -import com.sun.jersey.api.client.Client; -import com.sun.jersey.api.client.ClientResponse; -import com.sun.jersey.api.client.UniformInterfaceException; -import com.sun.jersey.api.client.WebResource; -import com.sun.jersey.api.client.config.ClientConfig; -import com.sun.jersey.api.client.config.DefaultClientConfig; -import com.sun.jersey.client.impl.ClientRequestImpl; -import com.sun.jersey.core.header.OutBoundHeaders; -import com.woorea.openstack.base.client.OpenStackClientConnector; -import com.woorea.openstack.base.client.OpenStackRequest; -import com.woorea.openstack.base.client.OpenStackResponse; -import com.woorea.openstack.base.client.OpenStackResponseException; - -public class JerseyConnector implements OpenStackClientConnector { - - protected Client client = null; - protected boolean logPassword; - private JerseyLoggingFilter logger = new JerseyLoggingFilter(Logger.getLogger("os")); - - public JerseyConnector() { - ClientConfig clientConfig = new DefaultClientConfig(); - clientConfig.getClasses().add(JacksonJaxbJsonProvider.class); - clientConfig.getClasses().add(OpenStackObjectMapper.class); - client = Client.create(clientConfig); - } - - @Override - public OpenStackResponse request(OpenStackRequest request) { - WebResource target = client.resource(request.endpoint()).path(request.path()); - for(Map.Entry > entry : request.queryParams().entrySet()) { - for (Object o : entry.getValue()) { - target = target.queryParam(entry.getKey(), String.valueOf(o)); - } - } - target.addFilter(logger); - MultivaluedMap headers = new OutBoundHeaders(); - for(Map.Entry> h : request.headers().entrySet()) { - for(Object v : h.getValue()) { - headers.add(h.getKey(), v); - } - } - if(request.entity() != null && request.entity().getContentType() != null) { - headers.add("Content-Type", request.entity().getContentType()); - } else { - headers.add("Content-Type", "application/json"); - } - try { - ClientResponse response = null; - if (request.entity() != null && request.entity().getEntity() != null) { - response = target.getHeadHandler().handle(new ClientRequestImpl(target.getURI(), request.method().name(), request.entity().getEntity(), headers)); - } else { - response = target.getHeadHandler().handle(new ClientRequestImpl(target.getURI(), request.method().name(), null, headers)); - } - return new JerseyResponse(response); - } catch (UniformInterfaceException e) { - throw new OpenStackResponseException(e.getResponse().getClientResponseStatus().getReasonPhrase(), e.getResponse().getStatus()); - } - } - - @Provider - public static class OpenStackObjectMapper implements ContextResolver { - static ObjectMapper DEFAULT_MAPPER; - static ObjectMapper WRAPPED_MAPPER; - static { - DEFAULT_MAPPER = new ObjectMapper(); - DEFAULT_MAPPER.setSerializationInclusion(Inclusion.NON_NULL); - DEFAULT_MAPPER.enable(SerializationConfig.Feature.INDENT_OUTPUT); - DEFAULT_MAPPER.enable(DeserializationConfig.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY); - DEFAULT_MAPPER.disable(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES); - WRAPPED_MAPPER = new ObjectMapper(); - WRAPPED_MAPPER.setSerializationInclusion(Inclusion.NON_NULL); - WRAPPED_MAPPER.enable(SerializationConfig.Feature.INDENT_OUTPUT); - WRAPPED_MAPPER.enable(SerializationConfig.Feature.WRAP_ROOT_VALUE); - WRAPPED_MAPPER.enable(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE); - WRAPPED_MAPPER.enable(DeserializationConfig.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY); - WRAPPED_MAPPER.disable(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES); - } - - @Override - public ObjectMapper getContext(Class type) { - return type.getAnnotation(JsonRootName.class) == null ? DEFAULT_MAPPER : WRAPPED_MAPPER; - } - } -} +package com.woorea.openstack.connector; + +import java.util.List; +import java.util.Map; +import java.util.logging.Logger; + +import javax.ws.rs.core.MultivaluedMap; +import javax.ws.rs.ext.ContextResolver; +import javax.ws.rs.ext.Provider; + +import org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider; + + + + +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.annotation.JsonRootName; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; +import com.sun.jersey.api.client.Client; +import com.sun.jersey.api.client.ClientResponse; +import com.sun.jersey.api.client.UniformInterfaceException; +import com.sun.jersey.api.client.WebResource; +import com.sun.jersey.api.client.config.ClientConfig; +import com.sun.jersey.api.client.config.DefaultClientConfig; +import com.sun.jersey.client.impl.ClientRequestImpl; +import com.sun.jersey.core.header.OutBoundHeaders; +import com.woorea.openstack.base.client.OpenStackClientConnector; +import com.woorea.openstack.base.client.OpenStackRequest; +import com.woorea.openstack.base.client.OpenStackResponse; +import com.woorea.openstack.base.client.OpenStackResponseException; + +public class JerseyConnector implements OpenStackClientConnector { + + protected Client client = null; + protected boolean logPassword; + private JerseyLoggingFilter logger = new JerseyLoggingFilter(Logger.getLogger("os")); + + public JerseyConnector() { + ClientConfig clientConfig = new DefaultClientConfig(); + clientConfig.getClasses().add(JacksonJaxbJsonProvider.class); + clientConfig.getClasses().add(OpenStackObjectMapper.class); + client = Client.create(clientConfig); + } + + @Override + public OpenStackResponse request(OpenStackRequest request) { + WebResource target = client.resource(request.endpoint()).path(request.path()); + for(Map.Entry > entry : request.queryParams().entrySet()) { + for (Object o : entry.getValue()) { + target = target.queryParam(entry.getKey(), String.valueOf(o)); + } + } + target.addFilter(logger); + MultivaluedMap headers = new OutBoundHeaders(); + for(Map.Entry> h : request.headers().entrySet()) { + for(Object v : h.getValue()) { + headers.add(h.getKey(), v); + } + } + if(request.entity() != null && request.entity().getContentType() != null) { + headers.add("Content-Type", request.entity().getContentType()); + } else { + headers.add("Content-Type", "application/json"); + } + try { + ClientResponse response = null; + if (request.entity() != null && request.entity().getEntity() != null) { + response = target.getHeadHandler().handle(new ClientRequestImpl(target.getURI(), request.method().name(), request.entity().getEntity(), headers)); + } else { + response = target.getHeadHandler().handle(new ClientRequestImpl(target.getURI(), request.method().name(), null, headers)); + } + return new JerseyResponse(response); + } catch (UniformInterfaceException e) { + throw new OpenStackResponseException(e.getResponse().getClientResponseStatus().getReasonPhrase(), e.getResponse().getStatus()); + } + } + + @Provider + public static class OpenStackObjectMapper implements ContextResolver { + static ObjectMapper DEFAULT_MAPPER; + static ObjectMapper WRAPPED_MAPPER; + static { + DEFAULT_MAPPER = new ObjectMapper(); + DEFAULT_MAPPER.setSerializationInclusion(Include.NON_NULL); + DEFAULT_MAPPER.enable(SerializationFeature.INDENT_OUTPUT); + DEFAULT_MAPPER.enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + DEFAULT_MAPPER.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES); + WRAPPED_MAPPER = new ObjectMapper(); + WRAPPED_MAPPER.setSerializationInclusion(Include.NON_NULL); + WRAPPED_MAPPER.enable(SerializationFeature.INDENT_OUTPUT); + WRAPPED_MAPPER.enable(SerializationFeature.WRAP_ROOT_VALUE); + WRAPPED_MAPPER.enable(DeserializationFeature.UNWRAP_ROOT_VALUE); + WRAPPED_MAPPER.enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + WRAPPED_MAPPER.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES); + } + + @Override + public ObjectMapper getContext(Class type) { + return type.getAnnotation(JsonRootName.class) == null ? DEFAULT_MAPPER : WRAPPED_MAPPER; + } + } +} diff --git a/openstack-client-connectors/jersey2-connector/src/main/java/com/woorea/openstack/connector/OpenStack.java b/openstack-client-connectors/jersey2-connector/src/main/java/com/woorea/openstack/connector/OpenStack.java index 879ce2cdb..ce64b2939 100644 --- a/openstack-client-connectors/jersey2-connector/src/main/java/com/woorea/openstack/connector/OpenStack.java +++ b/openstack-client-connectors/jersey2-connector/src/main/java/com/woorea/openstack/connector/OpenStack.java @@ -1,108 +1,109 @@ -package com.woorea.openstack.connector; - -import java.io.IOException; - -import javax.net.ssl.SSLContext; -import javax.ws.rs.client.Client; -import javax.ws.rs.client.ClientBuilder; -import javax.ws.rs.client.ClientRequestContext; -import javax.ws.rs.client.ClientRequestFilter; -import javax.ws.rs.ext.ContextResolver; - -import org.codehaus.jackson.map.DeserializationConfig; -import org.codehaus.jackson.map.ObjectMapper; -import org.codehaus.jackson.map.SerializationConfig; -import org.codehaus.jackson.map.annotate.JsonRootName; -import org.codehaus.jackson.map.annotate.JsonSerialize.Inclusion; -import org.glassfish.jersey.SslConfigurator; -import org.glassfish.jersey.jackson.JacksonFeature; - -public class OpenStack { - - public static Client CLIENT; - - public static ObjectMapper DEFAULT_MAPPER; - - public static ObjectMapper WRAPPED_MAPPER; - - static { - initialize(); - } - - private static void initialize() { - - /* - //class MyX509TrustManager implements X509TrustManager - TrustManager mytm[] = null; - KeyManager mykm[] = null; - - try { - mytm = new TrustManager[]{new MyX509TrustManager("./truststore_client", "asdfgh".toCharArray())}; - mykm = new KeyManager[]{new MyX509KeyManager("./keystore_client", "asdfgh".toCharArray())}; - } catch (Exception ex) { - - } - - SSLContext context = null; - context = SSLContext.getInstance("SSL"); - context.init(mykm, mytm, null); - - */ - - try { - - SSLContext context = null; - context = SSLContext.getInstance("SSL"); - context.init(null, null, null); - - SslConfigurator sslConfig = SslConfigurator.newInstance(); - /* - .trustStoreFile("./truststore_client") - .trustStorePassword("asdfgh") - - .keyStoreFile("./keystore_client") - .keyPassword("asdfgh"); - */ - //old: CLIENT.property(ClientProperties.SSL_CONFIG, new SslConfig(context)); - - CLIENT = ClientBuilder.newBuilder().sslContext(sslConfig.createSSLContext()).build(); - - DEFAULT_MAPPER = new ObjectMapper(); - - DEFAULT_MAPPER.setSerializationInclusion(Inclusion.NON_NULL); - DEFAULT_MAPPER.enable(SerializationConfig.Feature.INDENT_OUTPUT); - DEFAULT_MAPPER.enable(DeserializationConfig.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY); - DEFAULT_MAPPER.disable(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES); - - WRAPPED_MAPPER = new ObjectMapper(); - - WRAPPED_MAPPER.setSerializationInclusion(Inclusion.NON_NULL); - WRAPPED_MAPPER.enable(SerializationConfig.Feature.INDENT_OUTPUT); - WRAPPED_MAPPER.enable(SerializationConfig.Feature.WRAP_ROOT_VALUE); - WRAPPED_MAPPER.enable(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE); - WRAPPED_MAPPER.enable(DeserializationConfig.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY); - WRAPPED_MAPPER.disable(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES); - - CLIENT.register(new JacksonFeature()).register(new ContextResolver() { - - public ObjectMapper getContext(Class type) { - return type.getAnnotation(JsonRootName.class) == null ? DEFAULT_MAPPER : WRAPPED_MAPPER; - } - - }); - - CLIENT.register(new ClientRequestFilter() { - - public void filter(ClientRequestContext requestContext) throws IOException { - requestContext.getHeaders().remove("Content-Language"); - requestContext.getHeaders().remove("Content-Encoding"); - } - }); - - } catch(Exception e) { - throw new RuntimeException(e.getMessage(), e); - } - - } - -} +package com.woorea.openstack.connector; + +import java.io.IOException; + +import javax.net.ssl.SSLContext; +import javax.ws.rs.client.Client; +import javax.ws.rs.client.ClientBuilder; +import javax.ws.rs.client.ClientRequestContext; +import javax.ws.rs.client.ClientRequestFilter; +import javax.ws.rs.ext.ContextResolver; + +import org.glassfish.jersey.SslConfigurator; +import org.glassfish.jersey.jackson.JacksonFeature; + +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.annotation.JsonRootName; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; + +public class OpenStack { + + public static Client CLIENT; + + public static ObjectMapper DEFAULT_MAPPER; + + public static ObjectMapper WRAPPED_MAPPER; + + static { + initialize(); + } + + private static void initialize() { + + /* + //class MyX509TrustManager implements X509TrustManager + TrustManager mytm[] = null; + KeyManager mykm[] = null; + + try { + mytm = new TrustManager[]{new MyX509TrustManager("./truststore_client", "asdfgh".toCharArray())}; + mykm = new KeyManager[]{new MyX509KeyManager("./keystore_client", "asdfgh".toCharArray())}; + } catch (Exception ex) { + + } + + SSLContext context = null; + context = SSLContext.getInstance("SSL"); + context.init(mykm, mytm, null); + + */ + + try { + + SSLContext context = null; + context = SSLContext.getInstance("SSL"); + context.init(null, null, null); + + SslConfigurator sslConfig = SslConfigurator.newInstance(); + /* + .trustStoreFile("./truststore_client") + .trustStorePassword("asdfgh") + + .keyStoreFile("./keystore_client") + .keyPassword("asdfgh"); + */ + //old: CLIENT.property(ClientProperties.SSL_CONFIG, new SslConfig(context)); + + CLIENT = ClientBuilder.newBuilder().sslContext(sslConfig.createSSLContext()).build(); + + DEFAULT_MAPPER = new ObjectMapper(); + + DEFAULT_MAPPER.setSerializationInclusion(Include.NON_NULL); + DEFAULT_MAPPER.enable(SerializationFeature.INDENT_OUTPUT); + DEFAULT_MAPPER.enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + DEFAULT_MAPPER.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES); + + WRAPPED_MAPPER = new ObjectMapper(); + + WRAPPED_MAPPER.setSerializationInclusion(Include.NON_NULL); + WRAPPED_MAPPER.enable(SerializationFeature.INDENT_OUTPUT); + WRAPPED_MAPPER.enable(SerializationFeature.WRAP_ROOT_VALUE); + WRAPPED_MAPPER.enable(DeserializationFeature.UNWRAP_ROOT_VALUE); + WRAPPED_MAPPER.enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + WRAPPED_MAPPER.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES); + + CLIENT.register(new JacksonFeature()).register(new ContextResolver() { + + public ObjectMapper getContext(Class type) { + return type.getAnnotation(JsonRootName.class) == null ? DEFAULT_MAPPER : WRAPPED_MAPPER; + } + + }); + + CLIENT.register(new ClientRequestFilter() { + + public void filter(ClientRequestContext requestContext) throws IOException { + requestContext.getHeaders().remove("Content-Language"); + requestContext.getHeaders().remove("Content-Encoding"); + } + }); + + } catch(Exception e) { + throw new RuntimeException(e.getMessage(), e); + } + + } + +} diff --git a/openstack-client-connectors/resteasy-connector/src/main/java/com/woorea/openstack/connector/RESTEasyConnector.java b/openstack-client-connectors/resteasy-connector/src/main/java/com/woorea/openstack/connector/RESTEasyConnector.java index c70052b9f..625bb87dd 100644 --- a/openstack-client-connectors/resteasy-connector/src/main/java/com/woorea/openstack/connector/RESTEasyConnector.java +++ b/openstack-client-connectors/resteasy-connector/src/main/java/com/woorea/openstack/connector/RESTEasyConnector.java @@ -1,123 +1,123 @@ -package com.woorea.openstack.connector; - -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; - -import javax.ws.rs.core.UriBuilder; -import javax.ws.rs.ext.ContextResolver; - -import org.apache.commons.httpclient.HttpStatus; -import org.codehaus.jackson.jaxrs.JacksonJsonProvider; -import org.codehaus.jackson.map.DeserializationConfig; -import org.codehaus.jackson.map.ObjectMapper; -import org.codehaus.jackson.map.SerializationConfig; -import org.codehaus.jackson.map.annotate.JsonRootName; -import org.codehaus.jackson.map.annotate.JsonSerialize.Inclusion; -import org.jboss.resteasy.client.ClientRequest; -import org.jboss.resteasy.client.ClientResponse; -import org.jboss.resteasy.plugins.providers.InputStreamProvider; -import org.jboss.resteasy.spi.ResteasyProviderFactory; - -import com.woorea.openstack.base.client.OpenStackClientConnector; -import com.woorea.openstack.base.client.OpenStackRequest; -import com.woorea.openstack.base.client.OpenStackResponse; -import com.woorea.openstack.base.client.OpenStackResponseException; - -public class RESTEasyConnector implements OpenStackClientConnector { - - public static ObjectMapper DEFAULT_MAPPER; - - public static ObjectMapper WRAPPED_MAPPER; - - static class OpenStackProviderFactory extends ResteasyProviderFactory { - - private JacksonJsonProvider jsonProvider; - private InputStreamProvider streamProvider; - - public OpenStackProviderFactory() { - super(); - - addContextResolver(new ContextResolver() { - public ObjectMapper getContext(Class type) { - return type.getAnnotation(JsonRootName.class) == null ? DEFAULT_MAPPER : WRAPPED_MAPPER; - } - }); - - jsonProvider = new JacksonJsonProvider(); - addMessageBodyReader(jsonProvider); - addMessageBodyWriter(jsonProvider); - - streamProvider = new InputStreamProvider(); - addMessageBodyReader(streamProvider); - addMessageBodyWriter(streamProvider); - } - - } - - private static OpenStackProviderFactory providerFactory; - - static { - DEFAULT_MAPPER = new ObjectMapper(); - - DEFAULT_MAPPER.setSerializationInclusion(Inclusion.NON_NULL); - DEFAULT_MAPPER.enable(SerializationConfig.Feature.INDENT_OUTPUT); - DEFAULT_MAPPER.enable(DeserializationConfig.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY); - DEFAULT_MAPPER.disable(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES); - - WRAPPED_MAPPER = new ObjectMapper(); - - WRAPPED_MAPPER.setSerializationInclusion(Inclusion.NON_NULL); - WRAPPED_MAPPER.enable(SerializationConfig.Feature.INDENT_OUTPUT); - WRAPPED_MAPPER.enable(SerializationConfig.Feature.WRAP_ROOT_VALUE); - WRAPPED_MAPPER.enable(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE); - WRAPPED_MAPPER.enable(DeserializationConfig.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY); - WRAPPED_MAPPER.disable(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES); - - providerFactory = new OpenStackProviderFactory(); - } - - public OpenStackResponse request(OpenStackRequest request) { - ClientRequest client = new ClientRequest(UriBuilder.fromUri(request.endpoint() + "/" + request.path()), - ClientRequest.getDefaultExecutor(), providerFactory); - - for(Map.Entry > entry : request.queryParams().entrySet()) { - for (Object o : entry.getValue()) { - client = client.queryParameter(entry.getKey(), String.valueOf(o)); - } - } - - for (Entry> h : request.headers().entrySet()) { - StringBuilder sb = new StringBuilder(); - for (Object v : h.getValue()) { - sb.append(String.valueOf(v)); - } - client.header(h.getKey(), sb); - } - - if (request.entity() != null) { - client.body(request.entity().getContentType(), request.entity().getEntity()); - } - - ClientResponse response; - - try { - response = client.httpMethod(request.method().name(), request.returnType()); - } catch (Exception e) { - throw new RuntimeException("Unexpected client exception", e); - } - - if (response.getStatus() == HttpStatus.SC_OK - || response.getStatus() == HttpStatus.SC_CREATED - || response.getStatus() == HttpStatus.SC_NO_CONTENT - || response.getStatus() == HttpStatus.SC_ACCEPTED) { - return new RESTEasyResponse(client, response); - } - - response.releaseConnection(); - - throw new OpenStackResponseException(response.getResponseStatus() - .getReasonPhrase(), response.getStatus()); - } - -} +package com.woorea.openstack.connector; + +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import javax.ws.rs.core.UriBuilder; +import javax.ws.rs.ext.ContextResolver; + +import org.apache.commons.httpclient.HttpStatus; +import org.codehaus.jackson.jaxrs.JacksonJsonProvider; +import org.jboss.resteasy.client.ClientRequest; +import org.jboss.resteasy.client.ClientResponse; +import org.jboss.resteasy.plugins.providers.InputStreamProvider; +import org.jboss.resteasy.spi.ResteasyProviderFactory; + +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.annotation.JsonRootName; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; +import com.woorea.openstack.base.client.OpenStackClientConnector; +import com.woorea.openstack.base.client.OpenStackRequest; +import com.woorea.openstack.base.client.OpenStackResponse; +import com.woorea.openstack.base.client.OpenStackResponseException; + +public class RESTEasyConnector implements OpenStackClientConnector { + + public static ObjectMapper DEFAULT_MAPPER; + + public static ObjectMapper WRAPPED_MAPPER; + + static class OpenStackProviderFactory extends ResteasyProviderFactory { + + private JacksonJsonProvider jsonProvider; + private InputStreamProvider streamProvider; + + public OpenStackProviderFactory() { + super(); + + addContextResolver(new ContextResolver() { + public ObjectMapper getContext(Class type) { + return type.getAnnotation(JsonRootName.class) == null ? DEFAULT_MAPPER : WRAPPED_MAPPER; + } + }); + + jsonProvider = new JacksonJsonProvider(); + addMessageBodyReader(jsonProvider); + addMessageBodyWriter(jsonProvider); + + streamProvider = new InputStreamProvider(); + addMessageBodyReader(streamProvider); + addMessageBodyWriter(streamProvider); + } + + } + + private static OpenStackProviderFactory providerFactory; + + static { + DEFAULT_MAPPER = new ObjectMapper(); + + DEFAULT_MAPPER.setSerializationInclusion(Include.NON_NULL); + DEFAULT_MAPPER.enable(SerializationFeature.INDENT_OUTPUT); + DEFAULT_MAPPER.enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + DEFAULT_MAPPER.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES); + + WRAPPED_MAPPER = new ObjectMapper(); + + WRAPPED_MAPPER.setSerializationInclusion(Include.NON_NULL); + WRAPPED_MAPPER.enable(SerializationFeature.INDENT_OUTPUT); + WRAPPED_MAPPER.enable(SerializationFeature.WRAP_ROOT_VALUE); + WRAPPED_MAPPER.enable(DeserializationFeature.UNWRAP_ROOT_VALUE); + WRAPPED_MAPPER.enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + WRAPPED_MAPPER.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES); + + providerFactory = new OpenStackProviderFactory(); + } + + public OpenStackResponse request(OpenStackRequest request) { + ClientRequest client = new ClientRequest(UriBuilder.fromUri(request.endpoint() + "/" + request.path()), + ClientRequest.getDefaultExecutor(), providerFactory); + + for(Map.Entry > entry : request.queryParams().entrySet()) { + for (Object o : entry.getValue()) { + client = client.queryParameter(entry.getKey(), String.valueOf(o)); + } + } + + for (Entry> h : request.headers().entrySet()) { + StringBuilder sb = new StringBuilder(); + for (Object v : h.getValue()) { + sb.append(String.valueOf(v)); + } + client.header(h.getKey(), sb); + } + + if (request.entity() != null) { + client.body(request.entity().getContentType(), request.entity().getEntity()); + } + + ClientResponse response; + + try { + response = client.httpMethod(request.method().name(), request.returnType()); + } catch (Exception e) { + throw new RuntimeException("Unexpected client exception", e); + } + + if (response.getStatus() == HttpStatus.SC_OK + || response.getStatus() == HttpStatus.SC_CREATED + || response.getStatus() == HttpStatus.SC_NO_CONTENT + || response.getStatus() == HttpStatus.SC_ACCEPTED) { + return new RESTEasyResponse(client, response); + } + + response.releaseConnection(); + + throw new OpenStackResponseException(response.getResponseStatus() + .getReasonPhrase(), response.getStatus()); + } + +} diff --git a/openstack-client-connectors/resteasy-connector/src/main/java/com/woorea/openstack/connector/RESTEasyResponse.java b/openstack-client-connectors/resteasy-connector/src/main/java/com/woorea/openstack/connector/RESTEasyResponse.java index 269ae13c9..ca8fe937c 100644 --- a/openstack-client-connectors/resteasy-connector/src/main/java/com/woorea/openstack/connector/RESTEasyResponse.java +++ b/openstack-client-connectors/resteasy-connector/src/main/java/com/woorea/openstack/connector/RESTEasyResponse.java @@ -1,50 +1,52 @@ -package com.woorea.openstack.connector; - -import org.jboss.resteasy.client.ClientRequest; -import org.jboss.resteasy.client.ClientResponse; -import com.woorea.openstack.base.client.OpenStackResponse; - -import javax.ws.rs.core.MultivaluedMap; -import java.io.InputStream; -import java.util.HashMap; -import java.util.Map; - -public class RESTEasyResponse implements OpenStackResponse { - - private ClientRequest client; - - private ClientResponse response; - - public RESTEasyResponse(ClientRequest client, ClientResponse response) { - this.client = client; - this.response = response; - } - - @Override - public T getEntity(Class returnType) { - return (T) response.getEntity(returnType); - } - - @Override - public InputStream getInputStream() { - return new RESTEasyInputStream((InputStream) response.getEntity(InputStream.class), client.getExecutor()); - } - - @Override - public String header(String name) { - return response.getHeaders().getFirst(name).toString(); - } - - @Override - public Map headers() { - Map headers = new HashMap(); - MultivaluedMap responseHeaders = response.getHeaders(); - - for (String key : responseHeaders.keySet()) { - headers.put(key, responseHeaders.getFirst(key).toString()); - } - - return headers; - } - -} +package com.woorea.openstack.connector; + +import java.io.InputStream; +import java.util.HashMap; +import java.util.Map; + +import javax.ws.rs.core.MultivaluedMap; + +import org.jboss.resteasy.client.ClientRequest; +import org.jboss.resteasy.client.ClientResponse; + +import com.woorea.openstack.base.client.OpenStackResponse; + +public class RESTEasyResponse implements OpenStackResponse { + + private ClientRequest client; + + private ClientResponse response; + + public RESTEasyResponse(ClientRequest client, ClientResponse response) { + this.client = client; + this.response = response; + } + + @Override + public T getEntity(Class returnType) { + return (T) response.getEntity(returnType); + } + + @Override + public InputStream getInputStream() { + return new RESTEasyInputStream((InputStream) response.getEntity(InputStream.class), client.getExecutor()); + } + + @Override + public String header(String name) { + return response.getHeaders().getFirst(name).toString(); + } + + @Override + public Map headers() { + Map headers = new HashMap(); + MultivaluedMap responseHeaders = response.getHeaders(); + + for (String key : responseHeaders.keySet()) { + headers.put(key, responseHeaders.getFirst(key).toString()); + } + + return headers; + } + +} diff --git a/openstack-client/src/main/java/com/woorea/openstack/base/client/Entity.java b/openstack-client/src/main/java/com/woorea/openstack/base/client/Entity.java index 42eb5fd1e..0f3d51d40 100644 --- a/openstack-client/src/main/java/com/woorea/openstack/base/client/Entity.java +++ b/openstack-client/src/main/java/com/woorea/openstack/base/client/Entity.java @@ -1,54 +1,53 @@ -package com.woorea.openstack.base.client; - -import java.io.InputStream; - - -public class Entity { - - private T entity; - - private String contentType; - - public static Entity json(T entity) { - return new Entity(entity, "application/json"); - } - - public static Entity stream(T entity) { - return new Entity(entity, "application/octet-stream"); - } - - public Entity(T entity, String contentType) { - super(); - this.entity = entity; - this.contentType = contentType; - } - - /** - * @return the entity - */ - public T getEntity() { - return entity; - } - - /** - * @param entity the entity to set - */ - public void setEntity(T entity) { - this.entity = entity; - } - - /** - * @return the contentType - */ - public String getContentType() { - return contentType; - } - - /** - * @param contentType the contentType to set - */ - public void setContentType(String contentType) { - this.contentType = contentType; - } - -} +package com.woorea.openstack.base.client; + + + +public class Entity { + + private T entity; + + private String contentType; + + public static Entity json(T entity) { + return new Entity(entity, "application/json"); + } + + public static Entity stream(T entity) { + return new Entity(entity, "application/octet-stream"); + } + + public Entity(T entity, String contentType) { + super(); + this.entity = entity; + this.contentType = contentType; + } + + /** + * @return the entity + */ + public T getEntity() { + return entity; + } + + /** + * @param entity the entity to set + */ + public void setEntity(T entity) { + this.entity = entity; + } + + /** + * @return the contentType + */ + public String getContentType() { + return contentType; + } + + /** + * @param contentType the contentType to set + */ + public void setContentType(String contentType) { + this.contentType = contentType; + } + +} diff --git a/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackRequest.java b/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackRequest.java index 94a545f11..8b8b317f7 100644 --- a/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackRequest.java +++ b/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackRequest.java @@ -1,142 +1,142 @@ -package com.woorea.openstack.base.client; - -import java.util.Arrays; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.ArrayList; -import java.util.Map; - -public class OpenStackRequest { - - private OpenStackClient client; - - public OpenStackRequest() { - - } - - public OpenStackRequest(OpenStackClient client, HttpMethod method, CharSequence path, Entity entity, Class returnType) { - this.client = client; - this.method = method; - this.path = new StringBuilder(path); - this.entity = entity; - this.returnType = returnType; - header("Accept", "application/json"); - } - - private String endpoint; - - private HttpMethod method; - - private StringBuilder path = new StringBuilder(); - - private Map> headers = new HashMap>(); - - private Entity entity; - - private Class returnType; - - public OpenStackRequest endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - public String endpoint() { - return endpoint; - } - - public OpenStackRequest method(HttpMethod method) { - this.method = method; - return this; - } - - public HttpMethod method() { - return method; - } - - public OpenStackRequest path(String path) { - this.path.append(path); - return this; - } - - public String path() { - return path.toString(); - } - - public OpenStackRequest header(String name, Object value) { - if(value != null) { - headers.put(name, Arrays.asList(value)); - } - return this; - } - - public Map> headers() { - return headers; - } - - public Entity entity(T entity, String contentType) { - return new Entity(entity, contentType); - } - - public Entity entity() { - return entity; - } - - public Entity json(T entity) { - return entity(entity, "application/json"); - } - - public void returnType(Class returnType) { - this.returnType = returnType; - } - - public Class returnType() { - return returnType; - } - - public R execute() { - return client.execute(this); - } - - public OpenStackResponse request() { - return client.request(this); - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "OpenStackRequest [endpoint=" + endpoint + ", method=" + method - + ", path=" + path + ", headers=" + headers + ", entity=" - + entity + ", returnType=" + returnType + "]"; - } - - private Map > queryParams = new LinkedHashMap >(); - - public Map > queryParams() { - return queryParams; - } - - public OpenStackRequest queryParam(String key, Object value) { - if (queryParams.containsKey(key)) { - List values = queryParams.get(key); - values.add(value); - } else { - List values = new ArrayList(); - values.add(value); - queryParams.put(key, values); - } - - return this; - } - - protected static String buildPath(String ... elements) { - StringBuilder stringBuilder = new StringBuilder(); - for (String element : elements) { - stringBuilder.append(element); - } - - return stringBuilder.toString(); - } -} +package com.woorea.openstack.base.client; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +public class OpenStackRequest { + + private OpenStackClient client; + + public OpenStackRequest() { + + } + + public OpenStackRequest(OpenStackClient client, HttpMethod method, CharSequence path, Entity entity, Class returnType) { + this.client = client; + this.method = method; + this.path = new StringBuilder(path); + this.entity = entity; + this.returnType = returnType; + header("Accept", "application/json"); + } + + private String endpoint; + + private HttpMethod method; + + private StringBuilder path = new StringBuilder(); + + private Map> headers = new HashMap>(); + + private Entity entity; + + private Class returnType; + + public OpenStackRequest endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + public String endpoint() { + return endpoint; + } + + public OpenStackRequest method(HttpMethod method) { + this.method = method; + return this; + } + + public HttpMethod method() { + return method; + } + + public OpenStackRequest path(String path) { + this.path.append(path); + return this; + } + + public String path() { + return path.toString(); + } + + public OpenStackRequest header(String name, Object value) { + if(value != null) { + headers.put(name, Arrays.asList(value)); + } + return this; + } + + public Map> headers() { + return headers; + } + + public Entity entity(T entity, String contentType) { + return new Entity(entity, contentType); + } + + public Entity entity() { + return entity; + } + + public Entity json(T entity) { + return entity(entity, "application/json"); + } + + public void returnType(Class returnType) { + this.returnType = returnType; + } + + public Class returnType() { + return returnType; + } + + public R execute() { + return client.execute(this); + } + + public OpenStackResponse request() { + return client.request(this); + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "OpenStackRequest [endpoint=" + endpoint + ", method=" + method + + ", path=" + path + ", headers=" + headers + ", entity=" + + entity + ", returnType=" + returnType + "]"; + } + + private Map > queryParams = new LinkedHashMap >(); + + public Map > queryParams() { + return queryParams; + } + + public OpenStackRequest queryParam(String key, Object value) { + if (queryParams.containsKey(key)) { + List values = queryParams.get(key); + values.add(value); + } else { + List values = new ArrayList(); + values.add(value); + queryParams.put(key, values); + } + + return this; + } + + protected static String buildPath(String ... elements) { + StringBuilder stringBuilder = new StringBuilder(); + for (String element : elements) { + stringBuilder.append(element); + } + + return stringBuilder.toString(); + } +} diff --git a/openstack-console/src/main/java/com/woorea/openstack/console/Commands.java b/openstack-console/src/main/java/com/woorea/openstack/console/Commands.java index e8b39dc5c..ce1fd31f5 100644 --- a/openstack-console/src/main/java/com/woorea/openstack/console/Commands.java +++ b/openstack-console/src/main/java/com/woorea/openstack/console/Commands.java @@ -1,31 +1,29 @@ -package com.woorea.openstack.console; - -import java.util.Map; - -import org.apache.commons.cli.CommandLine; - -public class Commands { - - public static final Command EXIT = new Command("exit") { - - @Override - public void execute(Console console, CommandLine args) { - console.exit(); - } - - }; - - public static final Command SET = new Command("set") { - - @Override - public void execute(Console console, CommandLine args) { - if(args.getArgs().length == 2) { - console.setProperty(args.getArgs()[0], args.getArgs()[1]); - } else { - console.properties(); - } - } - - }; - -} +package com.woorea.openstack.console; + +import org.apache.commons.cli.CommandLine; + +public class Commands { + + public static final Command EXIT = new Command("exit") { + + @Override + public void execute(Console console, CommandLine args) { + console.exit(); + } + + }; + + public static final Command SET = new Command("set") { + + @Override + public void execute(Console console, CommandLine args) { + if(args.getArgs().length == 2) { + console.setProperty(args.getArgs()[0], args.getArgs()[1]); + } else { + console.properties(); + } + } + + }; + +} diff --git a/openstack-examples/src/main/java/com/woorea/openstack/examples/ExamplesConfiguration.java b/openstack-examples/src/main/java/com/woorea/openstack/examples/ExamplesConfiguration.java index 056eae52b..a7c36b720 100644 --- a/openstack-examples/src/main/java/com/woorea/openstack/examples/ExamplesConfiguration.java +++ b/openstack-examples/src/main/java/com/woorea/openstack/examples/ExamplesConfiguration.java @@ -1,34 +1,36 @@ -package com.woorea.openstack.examples; - - -import com.woorea.openstack.base.client.OpenStackSimpleTokenProvider; -import com.woorea.openstack.keystone.Keystone; -import com.woorea.openstack.keystone.model.Tenant; - -public class ExamplesConfiguration { - - public static final String KEYSTONE_AUTH_URL = "https://region-a.geo-1.identity.hpcloudsvc.com:35357/v3"; - - public static final String KEYSTONE_USERNAME = ""; - - public static final String KEYSTONE_PASSWORD = ""; - - public static final String KEYSTONE_ENDPOINT = "https://region-a.geo-1.identity.hpcloudsvc.com:35357/v3"; - - public static final String TENANT_NAME = "admin"; - - public static final String NOVA_ENDPOINT = "http://compute/v2"; - - public static final String CEILOMETER_ENDPOINT = ""; - - public static void main(String[] args) { - Keystone client = new Keystone(KEYSTONE_ENDPOINT); - client.setTokenProvider(new OpenStackSimpleTokenProvider("secret0")); - client.tenants().delete("36c481aec1d54fc49190c92c3ef6840a").execute(); - Tenant tenant = client.tenants().create(new Tenant("new_api")).execute(); - System.out.println(tenant); - System.out.println(client.tenants().list().execute()); - client.tenants().delete(tenant.getId()).execute(); - } - -} +package com.woorea.openstack.examples; + + +import com.woorea.openstack.base.client.OpenStackSimpleTokenProvider; +import com.woorea.openstack.keystone.Keystone; +import com.woorea.openstack.keystone.model.Tenant; + +public class ExamplesConfiguration { + + public static final String KEYSTONE_AUTH_URL = "https://region-a.geo-1.identity.hpcloudsvc.com:35357/v3"; + + public static final String KEYSTONE_ADMIN_AUTH_URL = "https://region-a.geo-1.identity.hpcloudsvc.com:35357/v3"; + + public static final String KEYSTONE_USERNAME = ""; + + public static final String KEYSTONE_PASSWORD = ""; + + public static final String KEYSTONE_ENDPOINT = "https://region-a.geo-1.identity.hpcloudsvc.com:35357/v3"; + + public static final String TENANT_NAME = "admin"; + + public static final String NOVA_ENDPOINT = "http://compute/v2"; + + public static final String CEILOMETER_ENDPOINT = ""; + + public static void main(String[] args) { + Keystone client = new Keystone(KEYSTONE_ENDPOINT); + client.setTokenProvider(new OpenStackSimpleTokenProvider("secret0")); + client.tenants().delete("36c481aec1d54fc49190c92c3ef6840a").execute(); + Tenant tenant = client.tenants().create(new Tenant("new_api")).execute(); + System.out.println(tenant); + System.out.println(client.tenants().list().execute()); + client.tenants().delete(tenant.getId()).execute(); + } + +} diff --git a/openstack-examples/src/main/java/com/woorea/openstack/examples/glance/GlanceListImages.java b/openstack-examples/src/main/java/com/woorea/openstack/examples/glance/GlanceListImages.java index ea687aaf8..7cd329e34 100644 --- a/openstack-examples/src/main/java/com/woorea/openstack/examples/glance/GlanceListImages.java +++ b/openstack-examples/src/main/java/com/woorea/openstack/examples/glance/GlanceListImages.java @@ -1,83 +1,82 @@ -package com.woorea.openstack.examples.glance; - -import com.woorea.openstack.glance.model.ImageDownload; -import com.woorea.openstack.glance.model.ImageUpload; -import com.woorea.openstack.keystone.utils.KeystoneTokenProvider; - -import com.woorea.openstack.examples.ExamplesConfiguration; -import com.woorea.openstack.glance.Glance; -import com.woorea.openstack.glance.model.Image; -import com.woorea.openstack.glance.model.Images; -import com.woorea.openstack.keystone.model.Access; -import com.woorea.openstack.keystone.model.Access.Service; -import com.woorea.openstack.keystone.model.Access.Service.Endpoint; - -import java.io.ByteArrayInputStream; -import java.io.IOException; - -public class GlanceListImages { - - protected static String IMAGE_CONTENT = "Hello World!"; - - /** - * @param args - */ - public static void main(String[] args) { - KeystoneTokenProvider keystone = new KeystoneTokenProvider( - ExamplesConfiguration.KEYSTONE_AUTH_URL, - ExamplesConfiguration.KEYSTONE_USERNAME, - ExamplesConfiguration.KEYSTONE_PASSWORD); - - Access access = keystone.getAccessByTenant(ExamplesConfiguration.TENANT_NAME); - - Service glanceService = null; - - for (Service service : access.getServiceCatalog()) { - if (service.getType().equals("image")) { - glanceService = service; - break; - } - } - - if (glanceService == null) { - throw new RuntimeException("Glance service not found"); - } - - for (Endpoint endpoint : glanceService.getEndpoints()) { - Glance glance = new Glance(endpoint.getPublicURL() + "/v1"); - glance.setTokenProvider(keystone - .getProviderByTenant(ExamplesConfiguration.TENANT_NAME)); - - // Creating a new image - Image newImage = new Image(); - newImage.setDiskFormat("raw"); - newImage.setContainerFormat("bare"); - newImage.setName("os-java-glance-test"); - newImage = glance.images().create(newImage).execute(); - - // Uploading image - ImageUpload uploadImage = new ImageUpload(newImage); - uploadImage.setInputStream(new ByteArrayInputStream(IMAGE_CONTENT.getBytes())); - glance.images().upload(newImage.getId(), uploadImage).execute(); - - // Downloading the image and displaying the image content - try { - byte[] imgContent = new byte[IMAGE_CONTENT.length()]; - ImageDownload downloadImage = glance.images().download(newImage.getId()).execute(); - downloadImage.getInputStream().read(imgContent, 0, imgContent.length); - System.out.println(new String(imgContent)); - } catch (IOException e) { - e.printStackTrace(); - } - - Images images = glance.images().list(false).execute(); - - for (Image image : images) { - System.out.println(glance.images().show(image.getId()).execute()); - } - - glance.images().delete(newImage.getId()).execute(); - } - } - -} +package com.woorea.openstack.examples.glance; + +import java.io.ByteArrayInputStream; +import java.io.IOException; + +import com.woorea.openstack.examples.ExamplesConfiguration; +import com.woorea.openstack.glance.Glance; +import com.woorea.openstack.glance.model.Image; +import com.woorea.openstack.glance.model.ImageDownload; +import com.woorea.openstack.glance.model.ImageUpload; +import com.woorea.openstack.glance.model.Images; +import com.woorea.openstack.keystone.model.Access; +import com.woorea.openstack.keystone.model.Access.Service; +import com.woorea.openstack.keystone.model.Access.Service.Endpoint; +import com.woorea.openstack.keystone.utils.KeystoneTokenProvider; + +public class GlanceListImages { + + protected static String IMAGE_CONTENT = "Hello World!"; + + /** + * @param args + */ + public static void main(String[] args) { + KeystoneTokenProvider keystone = new KeystoneTokenProvider( + ExamplesConfiguration.KEYSTONE_AUTH_URL, + ExamplesConfiguration.KEYSTONE_USERNAME, + ExamplesConfiguration.KEYSTONE_PASSWORD); + + Access access = keystone.getAccessByTenant(ExamplesConfiguration.TENANT_NAME); + + Service glanceService = null; + + for (Service service : access.getServiceCatalog()) { + if (service.getType().equals("image")) { + glanceService = service; + break; + } + } + + if (glanceService == null) { + throw new RuntimeException("Glance service not found"); + } + + for (Endpoint endpoint : glanceService.getEndpoints()) { + Glance glance = new Glance(endpoint.getPublicURL() + "/v1"); + glance.setTokenProvider(keystone + .getProviderByTenant(ExamplesConfiguration.TENANT_NAME)); + + // Creating a new image + Image newImage = new Image(); + newImage.setDiskFormat("raw"); + newImage.setContainerFormat("bare"); + newImage.setName("os-java-glance-test"); + newImage = glance.images().create(newImage).execute(); + + // Uploading image + ImageUpload uploadImage = new ImageUpload(newImage); + uploadImage.setInputStream(new ByteArrayInputStream(IMAGE_CONTENT.getBytes())); + glance.images().upload(newImage.getId(), uploadImage).execute(); + + // Downloading the image and displaying the image content + try { + byte[] imgContent = new byte[IMAGE_CONTENT.length()]; + ImageDownload downloadImage = glance.images().download(newImage.getId()).execute(); + downloadImage.getInputStream().read(imgContent, 0, imgContent.length); + System.out.println(new String(imgContent)); + } catch (IOException e) { + e.printStackTrace(); + } + + Images images = glance.images().list(false).execute(); + + for (Image image : images) { + System.out.println(glance.images().show(image.getId()).execute()); + } + + glance.images().delete(newImage.getId()).execute(); + } + } + +} diff --git a/openstack-examples/src/main/java/com/woorea/openstack/examples/heat/HeatListStacks.java b/openstack-examples/src/main/java/com/woorea/openstack/examples/heat/HeatListStacks.java index 75178c886..a7f3e2e60 100644 --- a/openstack-examples/src/main/java/com/woorea/openstack/examples/heat/HeatListStacks.java +++ b/openstack-examples/src/main/java/com/woorea/openstack/examples/heat/HeatListStacks.java @@ -1,72 +1,72 @@ -package com.woorea.openstack.examples.heat; - -import com.woorea.openstack.examples.ExamplesConfiguration; -import com.woorea.openstack.heat.Heat; -import com.woorea.openstack.heat.model.CreateStackParam; -import com.woorea.openstack.heat.model.Stack; -import com.woorea.openstack.keystone.model.Access; -import com.woorea.openstack.keystone.utils.KeystoneTokenProvider; -import com.woorea.openstack.keystone.utils.KeystoneUtils; - -import java.util.Collections; - -public class HeatListStacks { - - private static String TEMPLATE = "{\n" + - " \"HeatTemplateFormatVersion\": \"2012-12-12\",\n" + - " \"Parameters\": {},\n" + - " \"Mappings\": {},\n" + - " \"Resources\": {\n" + - " \"my-test-server\": {\n" + - " \"Type\": \"OS::Nova::Server\",\n" + - " \"Properties\": {\n" + - " \"flavor\": \"m1.small\",\n" + - " \"image\": \"centos:latest\"\n" + - " }\n" + - " }\n" + - " }\n" + - "}"; - - /** - * @param args - */ - public static void main(String[] args) throws InterruptedException { - KeystoneTokenProvider keystone = new KeystoneTokenProvider( - ExamplesConfiguration.KEYSTONE_ENDPOINT, - ExamplesConfiguration.KEYSTONE_USERNAME, - ExamplesConfiguration.KEYSTONE_PASSWORD - ); - - Access access = keystone.getAccessByTenant(ExamplesConfiguration.TENANT_NAME); - - String endpointURL = KeystoneUtils.findEndpointURL(access.getServiceCatalog(), "orchestration", null, "public"); - - - Heat heat = new Heat(endpointURL); - heat.setTokenProvider(keystone - .getProviderByTenant(ExamplesConfiguration.TENANT_NAME)); - - CreateStackParam param = new CreateStackParam(); - param.setStackName("helloWorld"); - param.setTimeoutMinutes(1); - param.setParameters(Collections.emptyMap()); - param.setTemplate(TEMPLATE); - - System.out.printf("Create: " + heat.getStacks().create(param).execute()); - Thread.sleep(3000); - - for (Stack s : heat.getStacks().list().execute()) { - System.out.println(s.getDescription()); - System.out.println(s.getId()); - System.out.println(s.getStackName()); - System.out.println(s.getStackStatus()); - System.out.println(s.getCreationTime()); - System.out.println(s.getUpdatedTime()); - System.out.println(s.getLinks()); - - System.out.println(heat.getStacks().byName(s.getStackName()).execute()); - - - } - } -} +package com.woorea.openstack.examples.heat; + +import java.util.Collections; + +import com.woorea.openstack.examples.ExamplesConfiguration; +import com.woorea.openstack.heat.Heat; +import com.woorea.openstack.heat.model.CreateStackParam; +import com.woorea.openstack.heat.model.Stack; +import com.woorea.openstack.keystone.model.Access; +import com.woorea.openstack.keystone.utils.KeystoneTokenProvider; +import com.woorea.openstack.keystone.utils.KeystoneUtils; + +public class HeatListStacks { + + private static String TEMPLATE = "{\n" + + " \"HeatTemplateFormatVersion\": \"2012-12-12\",\n" + + " \"Parameters\": {},\n" + + " \"Mappings\": {},\n" + + " \"Resources\": {\n" + + " \"my-test-server\": {\n" + + " \"Type\": \"OS::Nova::Server\",\n" + + " \"Properties\": {\n" + + " \"flavor\": \"m1.small\",\n" + + " \"image\": \"centos:latest\"\n" + + " }\n" + + " }\n" + + " }\n" + + "}"; + + /** + * @param args + */ + public static void main(String[] args) throws InterruptedException { + KeystoneTokenProvider keystone = new KeystoneTokenProvider( + ExamplesConfiguration.KEYSTONE_ENDPOINT, + ExamplesConfiguration.KEYSTONE_USERNAME, + ExamplesConfiguration.KEYSTONE_PASSWORD + ); + + Access access = keystone.getAccessByTenant(ExamplesConfiguration.TENANT_NAME); + + String endpointURL = KeystoneUtils.findEndpointURL(access.getServiceCatalog(), "orchestration", null, "public"); + + + Heat heat = new Heat(endpointURL); + heat.setTokenProvider(keystone + .getProviderByTenant(ExamplesConfiguration.TENANT_NAME)); + + CreateStackParam param = new CreateStackParam(); + param.setStackName("helloWorld"); + param.setTimeoutMinutes(1); + param.setParameters(Collections.emptyMap()); + param.setTemplate(TEMPLATE); + + System.out.printf("Create: " + heat.getStacks().create(param).execute()); + Thread.sleep(3000); + + for (Stack s : heat.getStacks().list().execute()) { + System.out.println(s.getDescription()); + System.out.println(s.getId()); + System.out.println(s.getStackName()); + System.out.println(s.getStackStatus()); + System.out.println(s.getCreationTime()); + System.out.println(s.getUpdatedTime()); + System.out.println(s.getLinks()); + + System.out.println(heat.getStacks().byName(s.getStackName()).execute()); + + + } + } +} diff --git a/openstack-examples/src/main/java/com/woorea/openstack/examples/hpcloud/Keystone3Authentication.java b/openstack-examples/src/main/java/com/woorea/openstack/examples/hpcloud/Keystone3Authentication.java index 5481a154a..414bd618d 100644 --- a/openstack-examples/src/main/java/com/woorea/openstack/examples/hpcloud/Keystone3Authentication.java +++ b/openstack-examples/src/main/java/com/woorea/openstack/examples/hpcloud/Keystone3Authentication.java @@ -1,34 +1,34 @@ -package com.woorea.openstack.examples.hpcloud; - - -import com.woorea.openstack.base.client.OpenStackResponse; -import com.woorea.openstack.examples.ExamplesConfiguration; -import com.woorea.openstack.keystone.v3.model.Authentication; -import com.woorea.openstack.keystone.v3.model.Authentication.Identity; -import com.woorea.openstack.keystone.v3.Keystone; -import com.woorea.openstack.keystone.v3.model.Token; - -public class Keystone3Authentication { - - /** - * @param args - */ - public static void main(String[] args) { - Keystone keystone = new Keystone(ExamplesConfiguration.KEYSTONE_AUTH_URL); - - Authentication auth = new Authentication(); - auth.setIdentity(Identity.password(ExamplesConfiguration.KEYSTONE_USERNAME, ExamplesConfiguration.KEYSTONE_PASSWORD)); - - OpenStackResponse response = keystone.tokens().authenticate(auth).request(); - - String tokenId = response.header("X-Subject-Token"); - - Token token = response.getEntity(Token.class); - - System.out.println(tokenId); - - System.out.println(token); - - } - -} +package com.woorea.openstack.examples.hpcloud; + + +import com.woorea.openstack.base.client.OpenStackResponse; +import com.woorea.openstack.examples.ExamplesConfiguration; +import com.woorea.openstack.keystone.v3.Keystone; +import com.woorea.openstack.keystone.v3.model.Authentication; +import com.woorea.openstack.keystone.v3.model.Authentication.Identity; +import com.woorea.openstack.keystone.v3.model.Token; + +public class Keystone3Authentication { + + /** + * @param args + */ + public static void main(String[] args) { + Keystone keystone = new Keystone(ExamplesConfiguration.KEYSTONE_AUTH_URL); + + Authentication auth = new Authentication(); + auth.setIdentity(Identity.password(ExamplesConfiguration.KEYSTONE_USERNAME, ExamplesConfiguration.KEYSTONE_PASSWORD)); + + OpenStackResponse response = keystone.tokens().authenticate(auth).request(); + + String tokenId = response.header("X-Subject-Token"); + + Token token = response.getEntity(Token.class); + + System.out.println(tokenId); + + System.out.println(token); + + } + +} diff --git a/openstack-examples/src/main/java/com/woorea/openstack/examples/metering/v2/TestAll.java b/openstack-examples/src/main/java/com/woorea/openstack/examples/metering/v2/TestAll.java index c9d0c1817..abf2b2a63 100644 --- a/openstack-examples/src/main/java/com/woorea/openstack/examples/metering/v2/TestAll.java +++ b/openstack-examples/src/main/java/com/woorea/openstack/examples/metering/v2/TestAll.java @@ -1,62 +1,57 @@ -package com.woorea.openstack.examples.metering.v2; - -import java.util.List; - - -import com.woorea.openstack.base.client.OpenStackSimpleTokenProvider; -import com.woorea.openstack.ceilometer.Ceilometer; -import com.woorea.openstack.ceilometer.v2.model.Meter; -import com.woorea.openstack.ceilometer.v2.model.Statistics; -import com.woorea.openstack.examples.ExamplesConfiguration; -import com.woorea.openstack.keystone.Keystone; -import com.woorea.openstack.keystone.model.Access; -import com.woorea.openstack.keystone.model.authentication.UsernamePassword; - -public class TestAll { - - /** - * @param args - */ - public static void main(String[] args) { - Keystone keystone = new Keystone(ExamplesConfiguration.KEYSTONE_AUTH_URL); - Access access = keystone.tokens() - .authenticate(new UsernamePassword(ExamplesConfiguration.KEYSTONE_USERNAME, ExamplesConfiguration.KEYSTONE_PASSWORD)) - .withTenantName("admin") - .execute(); - - Ceilometer ceilometer = new Ceilometer(ExamplesConfiguration.CEILOMETER_ENDPOINT); - ceilometer.setTokenProvider(new OpenStackSimpleTokenProvider(access.getToken().getId())); - - /* - List resources = ceilometer.execute(new ResourceList().eq("resource_id", "23b55841eedd41e99d5f3f32149ca086")); - - - for(Resource r : resources) { - Resource resource = ceilometer.execute(new ResourceShow().id(r.getResource())); - } - */ - - /* - //List meters = ceilometer.meters().list().execute(); //execute(new MeterList().eq("project_id", "948eeb593acd4223ad572c49e1ef5709")); - - - for(Meter m : meters) { - System.out.println(m); - -// List samples = ceilometer.execute(new MeterShow().name(m.getName())); -// for(Sample s : samples) { -// System.out.println("\t" + s); -// } - - List stats = ceilometer.meters().statistics().execute(); // (new MeterStatistics().name(m.getName())); - for(Statistics s : stats) { - System.out.println("\t\t" + s); - } - - - } - */ - - } - -} +package com.woorea.openstack.examples.metering.v2; + +import com.woorea.openstack.base.client.OpenStackSimpleTokenProvider; +import com.woorea.openstack.ceilometer.Ceilometer; +import com.woorea.openstack.examples.ExamplesConfiguration; +import com.woorea.openstack.keystone.Keystone; +import com.woorea.openstack.keystone.model.Access; +import com.woorea.openstack.keystone.model.authentication.UsernamePassword; + +public class TestAll { + + /** + * @param args + */ + public static void main(String[] args) { + Keystone keystone = new Keystone(ExamplesConfiguration.KEYSTONE_AUTH_URL); + Access access = keystone.tokens() + .authenticate(new UsernamePassword(ExamplesConfiguration.KEYSTONE_USERNAME, ExamplesConfiguration.KEYSTONE_PASSWORD)) + .withTenantName("admin") + .execute(); + + Ceilometer ceilometer = new Ceilometer(ExamplesConfiguration.CEILOMETER_ENDPOINT); + ceilometer.setTokenProvider(new OpenStackSimpleTokenProvider(access.getToken().getId())); + + /* + List resources = ceilometer.execute(new ResourceList().eq("resource_id", "23b55841eedd41e99d5f3f32149ca086")); + + + for(Resource r : resources) { + Resource resource = ceilometer.execute(new ResourceShow().id(r.getResource())); + } + */ + + /* + //List meters = ceilometer.meters().list().execute(); //execute(new MeterList().eq("project_id", "948eeb593acd4223ad572c49e1ef5709")); + + + for(Meter m : meters) { + System.out.println(m); + +// List samples = ceilometer.execute(new MeterShow().name(m.getName())); +// for(Sample s : samples) { +// System.out.println("\t" + s); +// } + + List stats = ceilometer.meters().statistics().execute(); // (new MeterStatistics().name(m.getName())); + for(Statistics s : stats) { + System.out.println("\t\t" + s); + } + + + } + */ + + } + +} diff --git a/openstack-examples/src/main/java/com/woorea/openstack/examples/network/QuantumListNetworks.java b/openstack-examples/src/main/java/com/woorea/openstack/examples/network/QuantumListNetworks.java index 8e218c25b..0be79ab3b 100644 --- a/openstack-examples/src/main/java/com/woorea/openstack/examples/network/QuantumListNetworks.java +++ b/openstack-examples/src/main/java/com/woorea/openstack/examples/network/QuantumListNetworks.java @@ -1,47 +1,46 @@ -package com.woorea.openstack.examples.network; - -import com.woorea.openstack.keystone.utils.KeystoneUtils; - -import com.woorea.openstack.base.client.OpenStackSimpleTokenProvider; -import com.woorea.openstack.examples.ExamplesConfiguration; -import com.woorea.openstack.keystone.Keystone; -import com.woorea.openstack.keystone.model.Access; -import com.woorea.openstack.keystone.model.Tenants; -import com.woorea.openstack.keystone.model.authentication.TokenAuthentication; -import com.woorea.openstack.keystone.model.authentication.UsernamePassword; -import com.woorea.openstack.quantum.Quantum; -import com.woorea.openstack.quantum.model.Network; -import com.woorea.openstack.quantum.model.Networks; - -public class QuantumListNetworks { - - /** - * @param args - */ - public static void main(String[] args) { - Keystone keystone = new Keystone(ExamplesConfiguration.KEYSTONE_AUTH_URL); - // access with unscoped token - Access access = keystone.tokens().authenticate( - new UsernamePassword(ExamplesConfiguration.KEYSTONE_USERNAME, ExamplesConfiguration.KEYSTONE_PASSWORD)) - .execute(); - // use the token in the following requests - keystone.setTokenProvider(new OpenStackSimpleTokenProvider(access.getToken().getId())); - - Tenants tenants = keystone.tenants().list().execute(); - // try to exchange token using the first tenant - if (tenants.getList().size() > 0) { - // access with tenant - access = keystone.tokens().authenticate(new TokenAuthentication(access.getToken().getId())).withTenantId(tenants.getList().get(0).getId()).execute(); - - Quantum quantum = new Quantum(KeystoneUtils.findEndpointURL(access.getServiceCatalog(), "network", null, "public")); - quantum.setTokenProvider(new OpenStackSimpleTokenProvider(access.getToken().getId())); - - Networks networks = quantum.networks().list().execute(); - for (Network network : networks) { - System.out.println(network); - } - } else { - System.out.println("No tenants found!"); - } - } -} +package com.woorea.openstack.examples.network; + +import com.woorea.openstack.base.client.OpenStackSimpleTokenProvider; +import com.woorea.openstack.examples.ExamplesConfiguration; +import com.woorea.openstack.keystone.Keystone; +import com.woorea.openstack.keystone.model.Access; +import com.woorea.openstack.keystone.model.Tenants; +import com.woorea.openstack.keystone.model.authentication.TokenAuthentication; +import com.woorea.openstack.keystone.model.authentication.UsernamePassword; +import com.woorea.openstack.keystone.utils.KeystoneUtils; +import com.woorea.openstack.quantum.Quantum; +import com.woorea.openstack.quantum.model.Network; +import com.woorea.openstack.quantum.model.Networks; + +public class QuantumListNetworks { + + /** + * @param args + */ + public static void main(String[] args) { + Keystone keystone = new Keystone(ExamplesConfiguration.KEYSTONE_AUTH_URL); + // access with unscoped token + Access access = keystone.tokens().authenticate( + new UsernamePassword(ExamplesConfiguration.KEYSTONE_USERNAME, ExamplesConfiguration.KEYSTONE_PASSWORD)) + .execute(); + // use the token in the following requests + keystone.setTokenProvider(new OpenStackSimpleTokenProvider(access.getToken().getId())); + + Tenants tenants = keystone.tenants().list().execute(); + // try to exchange token using the first tenant + if (tenants.getList().size() > 0) { + // access with tenant + access = keystone.tokens().authenticate(new TokenAuthentication(access.getToken().getId())).withTenantId(tenants.getList().get(0).getId()).execute(); + + Quantum quantum = new Quantum(KeystoneUtils.findEndpointURL(access.getServiceCatalog(), "network", null, "public")); + quantum.setTokenProvider(new OpenStackSimpleTokenProvider(access.getToken().getId())); + + Networks networks = quantum.networks().list().execute(); + for (Network network : networks) { + System.out.println(network); + } + } else { + System.out.println("No tenants found!"); + } + } +} diff --git a/openstack-examples/src/main/java/com/woorea/openstack/examples/network/QuantumNetworkCreate.java b/openstack-examples/src/main/java/com/woorea/openstack/examples/network/QuantumNetworkCreate.java index 7f4dff08c..5703254e4 100644 --- a/openstack-examples/src/main/java/com/woorea/openstack/examples/network/QuantumNetworkCreate.java +++ b/openstack-examples/src/main/java/com/woorea/openstack/examples/network/QuantumNetworkCreate.java @@ -1,108 +1,97 @@ -package com.woorea.openstack.examples.network; - -import java.util.ArrayList; -import java.util.List; -import java.util.Scanner; - -import com.woorea.openstack.keystone.utils.KeystoneUtils; - -import com.woorea.openstack.base.client.OpenStackSimpleTokenProvider; -import com.woorea.openstack.examples.ExamplesConfiguration; -import com.woorea.openstack.keystone.Keystone; -import com.woorea.openstack.keystone.model.Access; -import com.woorea.openstack.keystone.model.Tenant; -import com.woorea.openstack.keystone.model.Tenants; -import com.woorea.openstack.keystone.model.authentication.TokenAuthentication; -import com.woorea.openstack.keystone.model.authentication.UsernamePassword; -import com.woorea.openstack.quantum.Quantum; -import com.woorea.openstack.quantum.api.NetworksResource; -import com.woorea.openstack.quantum.api.NetworksResource.Create; -import com.woorea.openstack.quantum.model.Network; -import com.woorea.openstack.quantum.model.NetworkForCreate; -import com.woorea.openstack.quantum.model.Networks; -import com.woorea.openstack.quantum.model.Port; -import com.woorea.openstack.quantum.model.PortForCreate; -import com.woorea.openstack.quantum.model.Router; -import com.woorea.openstack.quantum.model.RouterForAddInterface; -import com.woorea.openstack.quantum.model.RouterForCreate; -import com.woorea.openstack.quantum.model.Subnet; -import com.woorea.openstack.quantum.model.SubnetForCreate; -import com.woorea.openstack.quantum.model.Subnets; - -public class QuantumNetworkCreate { - - /** - * @param args - */ - public static void main(String[] args) { - Keystone keystone = new Keystone( - ExamplesConfiguration.KEYSTONE_AUTH_URL); - // access with unscoped token - Access access = keystone - .tokens() - .authenticate( - new UsernamePassword( - ExamplesConfiguration.KEYSTONE_USERNAME, - ExamplesConfiguration.KEYSTONE_PASSWORD)) - .execute(); - // use the token in the following requests - keystone.setTokenProvider(new OpenStackSimpleTokenProvider(access - .getToken().getId())); - keystone.token(access.getToken().getId()); - Tenants tenants = keystone.tenants().list().execute(); - // try to exchange token using the first tenant - - if (tenants.getList().size() > 0) { - // access with tenant - Network network = new Network(); - access = keystone - .tokens() - .authenticate( - new TokenAuthentication(access.getToken().getId())) - .withTenantId("tenantId").execute(); - Quantum quantum = new Quantum(KeystoneUtils.findEndpointURL( - access.getServiceCatalog(), "network", null, "public")); - quantum.setTokenProvider(new OpenStackSimpleTokenProvider(access - .getToken().getId())); - NetworkForCreate netcreate = new NetworkForCreate(); - netcreate.setTenantId("tenantId"); - netcreate.setName("net2"); - netcreate.setAdminStateUp(true); - - network = quantum.networks().create(netcreate).execute(); - - // Creating Subnet - try { - Subnet sub = new Subnet(); - SubnetForCreate subnet = new SubnetForCreate(); - subnet.setCidr(""); - subnet.setName(""); - subnet.setNetworkId(network.getId()); - subnet.setIpVersion(4); - sub = quantum.subnets().create(subnet).execute(); - RouterForCreate routerForCreate = new RouterForCreate(); - routerForCreate.setName("routerName"); - routerForCreate.setTenantId("tenantId"); - Router router = quantum.routers().create(routerForCreate) - .execute(); - RouterForAddInterface routerForAdd = new RouterForAddInterface(); - routerForAdd.setSubnetId(sub.getId()); - routerForAdd.setRouterId(router.getId()); - quantum.routers().addInterface(routerForAdd).execute(); - - // System.out.println(sub); - } catch (Exception e) { - System.out.println(e.getMessage()); - } - - Networks networks = quantum.networks().list().execute(); - - for (Network network1 : networks) { - System.out.println(network1); - } - } else { - System.out.println("No tenants found!"); - } - - } -} +package com.woorea.openstack.examples.network; + +import com.woorea.openstack.base.client.OpenStackSimpleTokenProvider; +import com.woorea.openstack.examples.ExamplesConfiguration; +import com.woorea.openstack.keystone.Keystone; +import com.woorea.openstack.keystone.model.Access; +import com.woorea.openstack.keystone.model.Tenants; +import com.woorea.openstack.keystone.model.authentication.TokenAuthentication; +import com.woorea.openstack.keystone.model.authentication.UsernamePassword; +import com.woorea.openstack.keystone.utils.KeystoneUtils; +import com.woorea.openstack.quantum.Quantum; +import com.woorea.openstack.quantum.model.Network; +import com.woorea.openstack.quantum.model.NetworkForCreate; +import com.woorea.openstack.quantum.model.Networks; +import com.woorea.openstack.quantum.model.Router; +import com.woorea.openstack.quantum.model.RouterForAddInterface; +import com.woorea.openstack.quantum.model.RouterForCreate; +import com.woorea.openstack.quantum.model.Subnet; +import com.woorea.openstack.quantum.model.SubnetForCreate; + +public class QuantumNetworkCreate { + + /** + * @param args + */ + public static void main(String[] args) { + Keystone keystone = new Keystone( + ExamplesConfiguration.KEYSTONE_AUTH_URL); + // access with unscoped token + Access access = keystone + .tokens() + .authenticate( + new UsernamePassword( + ExamplesConfiguration.KEYSTONE_USERNAME, + ExamplesConfiguration.KEYSTONE_PASSWORD)) + .execute(); + // use the token in the following requests + keystone.setTokenProvider(new OpenStackSimpleTokenProvider(access + .getToken().getId())); + keystone.token(access.getToken().getId()); + Tenants tenants = keystone.tenants().list().execute(); + // try to exchange token using the first tenant + + if (tenants.getList().size() > 0) { + // access with tenant + Network network = new Network(); + access = keystone + .tokens() + .authenticate( + new TokenAuthentication(access.getToken().getId())) + .withTenantId("tenantId").execute(); + Quantum quantum = new Quantum(KeystoneUtils.findEndpointURL( + access.getServiceCatalog(), "network", null, "public")); + quantum.setTokenProvider(new OpenStackSimpleTokenProvider(access + .getToken().getId())); + NetworkForCreate netcreate = new NetworkForCreate(); + netcreate.setTenantId("tenantId"); + netcreate.setName("net2"); + netcreate.setAdminStateUp(true); + + network = quantum.networks().create(netcreate).execute(); + + // Creating Subnet + try { + Subnet sub = new Subnet(); + SubnetForCreate subnet = new SubnetForCreate(); + subnet.setCidr(""); + subnet.setName(""); + subnet.setNetworkId(network.getId()); + subnet.setIpVersion(4); + sub = quantum.subnets().create(subnet).execute(); + RouterForCreate routerForCreate = new RouterForCreate(); + routerForCreate.setName("routerName"); + routerForCreate.setTenantId("tenantId"); + Router router = quantum.routers().create(routerForCreate) + .execute(); + RouterForAddInterface routerForAdd = new RouterForAddInterface(); + routerForAdd.setSubnetId(sub.getId()); + routerForAdd.setRouterId(router.getId()); + quantum.routers().addInterface(routerForAdd).execute(); + + // System.out.println(sub); + } catch (Exception e) { + System.out.println(e.getMessage()); + } + + Networks networks = quantum.networks().list().execute(); + + for (Network network1 : networks) { + System.out.println(network1); + } + } else { + System.out.println("No tenants found!"); + } + + } +} diff --git a/openstack-examples/src/main/java/com/woorea/openstack/examples/network/QuantumQueryNetworks.java b/openstack-examples/src/main/java/com/woorea/openstack/examples/network/QuantumQueryNetworks.java index 1a427ea23..3864587c0 100644 --- a/openstack-examples/src/main/java/com/woorea/openstack/examples/network/QuantumQueryNetworks.java +++ b/openstack-examples/src/main/java/com/woorea/openstack/examples/network/QuantumQueryNetworks.java @@ -1,59 +1,58 @@ -package com.woorea.openstack.examples.network; - -import com.woorea.openstack.keystone.utils.KeystoneUtils; - -import com.woorea.openstack.base.client.OpenStackSimpleTokenProvider; -import com.woorea.openstack.examples.ExamplesConfiguration; -import com.woorea.openstack.keystone.Keystone; -import com.woorea.openstack.keystone.model.Access; -import com.woorea.openstack.keystone.model.Tenants; -import com.woorea.openstack.keystone.model.authentication.TokenAuthentication; -import com.woorea.openstack.keystone.model.authentication.UsernamePassword; -import com.woorea.openstack.quantum.Quantum; -import com.woorea.openstack.quantum.model.Network; - -public class QuantumQueryNetworks { - - /** - * @param args - */ - public static void main(String[] args) { - Keystone keystone = new Keystone(ExamplesConfiguration.KEYSTONE_AUTH_URL); - // access with unscoped token - Access access = keystone.tokens().authenticate( - new UsernamePassword(ExamplesConfiguration.KEYSTONE_USERNAME, ExamplesConfiguration.KEYSTONE_PASSWORD)) - .execute(); - // use the token in the following requests - keystone.setTokenProvider(new OpenStackSimpleTokenProvider(access.getToken().getId())); - - Tenants tenants = keystone.tenants().list().execute(); - // try to exchange token using the first tenant - if (tenants.getList().size() > 0) { - // access with tenant - access = keystone.tokens().authenticate(new TokenAuthentication(access.getToken().getId())).withTenantId(tenants.getList().get(0).getId()).execute(); - - Quantum quantumClient = new Quantum(KeystoneUtils.findEndpointURL(access.getServiceCatalog(), "network", null, "public")); - quantumClient.setTokenProvider(new OpenStackSimpleTokenProvider(access.getToken().getId())); - - Network networkQuery = new Network(); - networkQuery.setName("benn.cs"); - networkQuery.setAdminStateUp(true); - /* - Networks networks = quantumClient.execute(NetworkQuery.queryNetworks(networkQuery)); - - for (Network network : networks) { - System.out.println(network); - } - - Subnet subnetQuery = new Subnet(); - subnetQuery.setIpversion(Subnet.IpVersion.IPV4); - Subnets Subnets = quantumClient.execute(NetworkQuery.querySubnets(subnetQuery)); - for (Subnet subnet : Subnets) { - System.out.println(subnet); - } - */ - } else { - System.out.println("No tenants found!"); - } - } -} +package com.woorea.openstack.examples.network; + +import com.woorea.openstack.base.client.OpenStackSimpleTokenProvider; +import com.woorea.openstack.examples.ExamplesConfiguration; +import com.woorea.openstack.keystone.Keystone; +import com.woorea.openstack.keystone.model.Access; +import com.woorea.openstack.keystone.model.Tenants; +import com.woorea.openstack.keystone.model.authentication.TokenAuthentication; +import com.woorea.openstack.keystone.model.authentication.UsernamePassword; +import com.woorea.openstack.keystone.utils.KeystoneUtils; +import com.woorea.openstack.quantum.Quantum; +import com.woorea.openstack.quantum.model.Network; + +public class QuantumQueryNetworks { + + /** + * @param args + */ + public static void main(String[] args) { + Keystone keystone = new Keystone(ExamplesConfiguration.KEYSTONE_AUTH_URL); + // access with unscoped token + Access access = keystone.tokens().authenticate( + new UsernamePassword(ExamplesConfiguration.KEYSTONE_USERNAME, ExamplesConfiguration.KEYSTONE_PASSWORD)) + .execute(); + // use the token in the following requests + keystone.setTokenProvider(new OpenStackSimpleTokenProvider(access.getToken().getId())); + + Tenants tenants = keystone.tenants().list().execute(); + // try to exchange token using the first tenant + if (tenants.getList().size() > 0) { + // access with tenant + access = keystone.tokens().authenticate(new TokenAuthentication(access.getToken().getId())).withTenantId(tenants.getList().get(0).getId()).execute(); + + Quantum quantumClient = new Quantum(KeystoneUtils.findEndpointURL(access.getServiceCatalog(), "network", null, "public")); + quantumClient.setTokenProvider(new OpenStackSimpleTokenProvider(access.getToken().getId())); + + Network networkQuery = new Network(); + networkQuery.setName("benn.cs"); + networkQuery.setAdminStateUp(true); + /* + Networks networks = quantumClient.execute(NetworkQuery.queryNetworks(networkQuery)); + + for (Network network : networks) { + System.out.println(network); + } + + Subnet subnetQuery = new Subnet(); + subnetQuery.setIpversion(Subnet.IpVersion.IPV4); + Subnets Subnets = quantumClient.execute(NetworkQuery.querySubnets(subnetQuery)); + for (Subnet subnet : Subnets) { + System.out.println(subnet); + } + */ + } else { + System.out.println("No tenants found!"); + } + } +} diff --git a/openstack-examples/src/main/java/com/woorea/openstack/examples/objectstore/SwiftExample.java b/openstack-examples/src/main/java/com/woorea/openstack/examples/objectstore/SwiftExample.java index 089163c66..6a25cfba5 100644 --- a/openstack-examples/src/main/java/com/woorea/openstack/examples/objectstore/SwiftExample.java +++ b/openstack-examples/src/main/java/com/woorea/openstack/examples/objectstore/SwiftExample.java @@ -1,90 +1,89 @@ -package com.woorea.openstack.examples.objectstore; - -import java.io.BufferedOutputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; - -import com.woorea.openstack.keystone.utils.KeystoneUtils; - -import com.woorea.openstack.base.client.OpenStackSimpleTokenProvider; -import com.woorea.openstack.examples.ExamplesConfiguration; -import com.woorea.openstack.keystone.Keystone; -import com.woorea.openstack.keystone.model.Access; -import com.woorea.openstack.keystone.model.Tenants; -import com.woorea.openstack.keystone.model.authentication.TokenAuthentication; -import com.woorea.openstack.keystone.model.authentication.UsernamePassword; -import com.woorea.openstack.swift.Swift; -import com.woorea.openstack.swift.model.ObjectDownload; -import com.woorea.openstack.swift.model.ObjectForUpload; - -public class SwiftExample { - - private static final File TEST_FILE = new File("pom.xml"); - - /** - * @param args - */ - public static void main(String[] args) throws Exception { - Keystone keystone = new Keystone(ExamplesConfiguration.KEYSTONE_AUTH_URL); - //access with unscoped token - Access access = keystone.tokens().authenticate( - new UsernamePassword(ExamplesConfiguration.KEYSTONE_USERNAME, ExamplesConfiguration.KEYSTONE_PASSWORD)) - .execute(); - - //use the token in the following requests - keystone.setTokenProvider(new OpenStackSimpleTokenProvider(access.getToken().getId())); - - Tenants tenants = keystone.tenants().list().execute(); - - //try to exchange token using the first tenant - if(tenants.getList().size() > 0) { - - access = keystone.tokens().authenticate(new TokenAuthentication(access.getToken().getId())).withTenantId(tenants.getList().get(0).getId()).execute(); - - Swift swift = new Swift(KeystoneUtils.findEndpointURL(access.getServiceCatalog(), "object-store", null, "public")); - swift.setTokenProvider(new OpenStackSimpleTokenProvider(access.getToken().getId())); - - //swiftClient.execute(new DeleteContainer("navidad2")); - - swift.containers().create("navidad2").execute(); - - System.out.println(swift.containers().list()); - - ObjectForUpload upload = new ObjectForUpload(); - upload.setContainer("navidad2"); - upload.setName("example2"); - upload.setInputStream(new FileInputStream(TEST_FILE)); - swift.containers().container("navidad2").upload(upload).execute(); - -// System.out.println(swiftClient.execute(new ListObjects("navidad2", new HashMap() {{ -// put("path", ""); -// }})).get(0).getContentType()); - - - ObjectDownload download = swift.containers().container("navidad").download("example2").execute(); - write(download.getInputStream(), "example2"); - } - - } - - private static void write(InputStream is, String path) { - try { - OutputStream stream = new BufferedOutputStream(new FileOutputStream(path)); - int bufferSize = 1024; - byte[] buffer = new byte[bufferSize]; - int len = 0; - while ((len = is.read(buffer)) != -1) { - stream.write(buffer, 0, len); - } - stream.close(); - } catch(IOException e) { - throw new RuntimeException(e.getMessage(), e); - } - - } - -} +package com.woorea.openstack.examples.objectstore; + +import java.io.BufferedOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; + +import com.woorea.openstack.base.client.OpenStackSimpleTokenProvider; +import com.woorea.openstack.examples.ExamplesConfiguration; +import com.woorea.openstack.keystone.Keystone; +import com.woorea.openstack.keystone.model.Access; +import com.woorea.openstack.keystone.model.Tenants; +import com.woorea.openstack.keystone.model.authentication.TokenAuthentication; +import com.woorea.openstack.keystone.model.authentication.UsernamePassword; +import com.woorea.openstack.keystone.utils.KeystoneUtils; +import com.woorea.openstack.swift.Swift; +import com.woorea.openstack.swift.model.ObjectDownload; +import com.woorea.openstack.swift.model.ObjectForUpload; + +public class SwiftExample { + + private static final File TEST_FILE = new File("pom.xml"); + + /** + * @param args + */ + public static void main(String[] args) throws Exception { + Keystone keystone = new Keystone(ExamplesConfiguration.KEYSTONE_AUTH_URL); + //access with unscoped token + Access access = keystone.tokens().authenticate( + new UsernamePassword(ExamplesConfiguration.KEYSTONE_USERNAME, ExamplesConfiguration.KEYSTONE_PASSWORD)) + .execute(); + + //use the token in the following requests + keystone.setTokenProvider(new OpenStackSimpleTokenProvider(access.getToken().getId())); + + Tenants tenants = keystone.tenants().list().execute(); + + //try to exchange token using the first tenant + if(tenants.getList().size() > 0) { + + access = keystone.tokens().authenticate(new TokenAuthentication(access.getToken().getId())).withTenantId(tenants.getList().get(0).getId()).execute(); + + Swift swift = new Swift(KeystoneUtils.findEndpointURL(access.getServiceCatalog(), "object-store", null, "public")); + swift.setTokenProvider(new OpenStackSimpleTokenProvider(access.getToken().getId())); + + //swiftClient.execute(new DeleteContainer("navidad2")); + + swift.containers().create("navidad2").execute(); + + System.out.println(swift.containers().list()); + + ObjectForUpload upload = new ObjectForUpload(); + upload.setContainer("navidad2"); + upload.setName("example2"); + upload.setInputStream(new FileInputStream(TEST_FILE)); + swift.containers().container("navidad2").upload(upload).execute(); + +// System.out.println(swiftClient.execute(new ListObjects("navidad2", new HashMap() {{ +// put("path", ""); +// }})).get(0).getContentType()); + + + ObjectDownload download = swift.containers().container("navidad").download("example2").execute(); + write(download.getInputStream(), "example2"); + } + + } + + private static void write(InputStream is, String path) { + try { + OutputStream stream = new BufferedOutputStream(new FileOutputStream(path)); + int bufferSize = 1024; + byte[] buffer = new byte[bufferSize]; + int len = 0; + while ((len = is.read(buffer)) != -1) { + stream.write(buffer, 0, len); + } + stream.close(); + } catch(IOException e) { + throw new RuntimeException(e.getMessage(), e); + } + + } + +} diff --git a/pom.xml b/pom.xml index 6a86b84ab..3172ad6c4 100644 --- a/pom.xml +++ b/pom.xml @@ -1,148 +1,149 @@ - - 4.0.0 - com.woorea - openstack-java-sdk - 3.2.2-SNAPSHOT - pom - OpenStack Java SDK - OpenStack Java SDK - - - false - - - - org.sonatype.oss - oss-parent - 7 - - - - - nova-client - glance-client - keystone-client - swift-client - quantum-client - openstack-client - heat-client - nova-model - glance-model - keystone-model - swift-model - quantum-model - ceilometer-model - ceilometer-client - openstack-client-connectors - heat-model - - - - - console - - true - - - openstack-console - - - - examples - - true - - - openstack-examples - - - - - - - Apache2 - http://www.apache.org/licenses/LICENSE-2.0.txt - - - - 2012 - - - - woorea - Luis Gervaso - luis@woorea.es - +1 - - - - - scm:git:https://github.com/woorea/openstack-java-sdk.git - scm:git:https://github.com/woorea/openstack-java-sdk.git - http://github.com/woorea/openstack-java-sdk.git - - - - - org.codehaus.jackson - jackson-mapper-asl - 1.9.13 - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.0 - - 1.6 - 1.6 - UTF-8 - - - - org.apache.maven.plugins - maven-gpg-plugin - 1.4 - - ${skip.sign} - - - - sign-artifacts - verify - - sign - - - - - - org.apache.maven.plugins - maven-eclipse-plugin - 2.9 - - - org.apache.maven.plugins - maven-resources-plugin - 2.6 - - - org.apache.maven.plugins - maven-source-plugin - 2.2.1 - - - attach-sources - verify - - jar-no-fork - - - - - - + + 4.0.0 + com.woorea + openstack-java-sdk + 3.2.2-SNAPSHOT + pom + OpenStack Java SDK + OpenStack Java SDK + + + true + + + + org.sonatype.oss + oss-parent + 7 + + + + + nova-client + glance-client + keystone-client + swift-client + quantum-client + openstack-client + heat-client + nova-model + glance-model + keystone-model + swift-model + quantum-model + ceilometer-model + ceilometer-client + openstack-client-connectors + heat-model + + + + + console + + true + + + openstack-console + + + + examples + + true + + + openstack-examples + + + + + + + Apache2 + http://www.apache.org/licenses/LICENSE-2.0.txt + + + + 2012 + + + + woorea + Luis Gervaso + luis@woorea.es + +1 + + + + + scm:git:https://github.com/woorea/openstack-java-sdk.git + scm:git:https://github.com/woorea/openstack-java-sdk.git + http://github.com/woorea/openstack-java-sdk.git + + + + + com.fasterxml.jackson.core + jackson-databind + 2.3.1 + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.0 + + 1.6 + 1.6 + UTF-8 + + + + org.apache.maven.plugins + maven-gpg-plugin + 1.4 + + ${skip.sign} + + + + sign-artifacts + verify + + sign + + + + + + org.apache.maven.plugins + maven-eclipse-plugin + 2.9 + + + org.apache.maven.plugins + maven-resources-plugin + 2.6 + + + org.apache.maven.plugins + maven-source-plugin + 2.2.1 + + + attach-sources + verify + + jar-no-fork + + + + + + \ No newline at end of file diff --git a/quantum-client/src/main/java/com/woorea/openstack/quantum/api/query/AbsOpenStackCmd.java b/quantum-client/src/main/java/com/woorea/openstack/quantum/api/query/AbsOpenStackCmd.java index 8de5abf48..d64800a41 100644 --- a/quantum-client/src/main/java/com/woorea/openstack/quantum/api/query/AbsOpenStackCmd.java +++ b/quantum-client/src/main/java/com/woorea/openstack/quantum/api/query/AbsOpenStackCmd.java @@ -1,80 +1,79 @@ -package com.woorea.openstack.quantum.api.query; - -import java.lang.reflect.Field; -import java.util.HashMap; -import java.util.Map; - -import org.codehaus.jackson.annotate.JsonProperty; - -import com.woorea.openstack.base.client.OpenStackRequest; - -public class AbsOpenStackCmd extends OpenStackRequest { - - private T query; - - protected AbsOpenStackCmd(T query) - { - this.setQuery(query); - } - - /** - * @param query the query to set - */ - public void setQuery(T query) { - this.query = query; - } - - /** - * @return the query - */ - public T getQuery() { - return query; - } - - private String getFieldValue(Field field, T target) - { - try { - field.setAccessible(true); - Object obj = field.get(target); - if (obj == null) - return null; - return obj.toString(); - } catch (Exception e) { - throw new RuntimeException(e); - } - } - - private Map getObjectParamMap(T target) - { - Map resultMap = new HashMap(); - if (target == null) - return resultMap; - - Field[] paramMap = target.getClass().getDeclaredFields(); - for (Field field : paramMap) { - String resultName = field.getName(); - String value = getFieldValue(field, target); - if (value != null) { - JsonProperty prop = field.getAnnotation(JsonProperty.class); - if (prop != null) { - resultMap.put(prop.value(), getFieldValue(field, target)); - } else { - resultMap.put(resultName, getFieldValue(field, target)); - } - } - } - - return resultMap; - } - - /* - public WebTarget queryParam(WebTarget target) { - Map map = getObjectParamMap(this.query); - for (String fieldName : map.keySet()) { - target = target.queryParam(fieldName, map.get(fieldName)); - } - return target; - } - */ - -} +package com.woorea.openstack.quantum.api.query; + +import java.lang.reflect.Field; +import java.util.HashMap; +import java.util.Map; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.woorea.openstack.base.client.OpenStackRequest; + +public class AbsOpenStackCmd extends OpenStackRequest { + + private T query; + + protected AbsOpenStackCmd(T query) + { + this.setQuery(query); + } + + /** + * @param query the query to set + */ + public void setQuery(T query) { + this.query = query; + } + + /** + * @return the query + */ + public T getQuery() { + return query; + } + + private String getFieldValue(Field field, T target) + { + try { + field.setAccessible(true); + Object obj = field.get(target); + if (obj == null) + return null; + return obj.toString(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + private Map getObjectParamMap(T target) + { + Map resultMap = new HashMap(); + if (target == null) + return resultMap; + + Field[] paramMap = target.getClass().getDeclaredFields(); + for (Field field : paramMap) { + String resultName = field.getName(); + String value = getFieldValue(field, target); + if (value != null) { + JsonProperty prop = field.getAnnotation(JsonProperty.class); + if (prop != null) { + resultMap.put(prop.value(), getFieldValue(field, target)); + } else { + resultMap.put(resultName, getFieldValue(field, target)); + } + } + } + + return resultMap; + } + + /* + public WebTarget queryParam(WebTarget target) { + Map map = getObjectParamMap(this.query); + for (String fieldName : map.keySet()) { + target = target.queryParam(fieldName, map.get(fieldName)); + } + return target; + } + */ + +} diff --git a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/GatewayInfo.java b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/GatewayInfo.java index 2a7766f75..0cef305ec 100644 --- a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/GatewayInfo.java +++ b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/GatewayInfo.java @@ -1,24 +1,23 @@ -package com.woorea.openstack.quantum.model; - -import java.util.List; -import java.io.Serializable; - -import org.codehaus.jackson.annotate.JsonProperty; - -public class GatewayInfo implements Serializable { - - @JsonProperty("network_id") - private String networkId; - - public String getNetworkId() { - return networkId; - } - - public void setNetworkId(String id) { - this.networkId = id; - } - - @Override public String toString() { - return "[networkId=" + networkId + "]"; - } -} +package com.woorea.openstack.quantum.model; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class GatewayInfo implements Serializable { + + @JsonProperty("network_id") + private String networkId; + + public String getNetworkId() { + return networkId; + } + + public void setNetworkId(String id) { + this.networkId = id; + } + + @Override public String toString() { + return "[networkId=" + networkId + "]"; + } +} diff --git a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Network.java b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Network.java index 4490911e2..67ace8c73 100644 --- a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Network.java +++ b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Network.java @@ -1,275 +1,275 @@ -package com.woorea.openstack.quantum.model; - -import java.io.Serializable; -import java.util.List; - -import org.codehaus.jackson.annotate.JsonIgnore; -import org.codehaus.jackson.annotate.JsonIgnoreProperties; -import org.codehaus.jackson.annotate.JsonProperty; -import org.codehaus.jackson.map.annotate.JsonRootName; - -@SuppressWarnings("serial") -@JsonRootName("network") -@JsonIgnoreProperties(ignoreUnknown = true) -public class Network implements Serializable { - - private String status; - - private List subnets; - - private String name; - - @JsonProperty("admin_state_up") - private Boolean adminStateUp; - - @JsonProperty("tenant_id") - private String tenantId; - - @JsonProperty("provider:physical_network") - private String providerPhysicalNetwork; - - @JsonProperty("provider:network_type") - private String providerNetworkType; - - @JsonProperty("provider:segmentation_id") - private Integer providerSegmentationId; - - @JsonProperty("router:external") - private String routerExternal; - - private String id; - - private String shared; - - /** - * @return the status - */ - @JsonIgnore - public String getStatus() { - return status; - } - - /** - * @param status - * the status to set - */ - @JsonProperty - public void setStatus(String status) { - this.status = status; - } - - /** - * @return the subnets - */ - @JsonIgnore - public List getSubnets() { - return subnets; - } - - /** - * @param subnets - * the subnets to set - */ - @JsonProperty - public void setSubnets(List subnets) { - this.subnets = subnets; - } - - /** - * @return the name - */ - public String getName() { - return name; - } - - /** - * @param name - * the name to set - */ - public void setName(String name) { - this.name = name; - } - - /** - * @return the providerPhyNet - * @deprecated - */ - @Deprecated - @JsonIgnore - public String getProviderPhyNet() { - return getProviderPhysicalNetwork(); - } - - /** - * @param providerPhyNet - * the providerPhyNet to set - * @deprecated - */ - @Deprecated - @JsonIgnore - public void setProviderPhyNet(String providerPhyNet) { - setProviderPhysicalNetwork(providerPhyNet); - } - - /** - * @return the adminStateUp - */ - @JsonIgnore - public boolean isAdminStateUp() { - return adminStateUp; - } - - public Boolean getAdminStateUp() { - return adminStateUp; - } - - /** - * @param adminStateUp - * the adminStateUp to set - */ - public void setAdminStateUp(Boolean adminStateUp) { - this.adminStateUp = adminStateUp; - } - - /** - * @return the tenantId - */ - public String getTenantId() { - return tenantId; - } - - /** - * @param tenantId - * the tenantId to set - */ - public void setTenantId(String tenantId) { - this.tenantId = tenantId; - } - - /** - * @return the netType - * @deprecated - */ - @Deprecated - @JsonIgnore - public String getNetType() { - return getProviderNetworkType(); - } - - /** - * @param netType - * the netType to set - * @deprecated - */ - @Deprecated - @JsonIgnore - public void setNetType(String netType) { - setProviderNetworkType(netType); - } - - /** - * @return the routerExternal - */ - public String getRouterExternal() { - return routerExternal; - } - - /** - * @param routerExternal - * the routerExternal to set - */ - public void setRouterExternal(String routerExternal) { - this.routerExternal = routerExternal; - } - - /** - * @return the id - */ - @JsonIgnore - public String getId() { - return id; - } - - /** - * @param id - * the id to set - */ - @JsonProperty - public void setId(String id) { - this.id = id; - } - - /** - * @return the shared - */ - public String getShared() { - return shared; - } - - /** - * @param shared - * the shared to set - */ - public void setShared(String shared) { - this.shared = shared; - } - - /** - * @return the providerSegID - * @deprecated - */ - @Deprecated - @JsonIgnore - public String getProviderSegID() { - return getProviderSegmentationId() == null ? null : Integer.toString(getProviderSegmentationId()); - } - - /** - * @param providerSegID - * the providerSegID to set - * @deprecated - */ - @Deprecated - @JsonIgnore - public void setProviderSegID(String providerSegID) { - setProviderSegmentationId(providerSegID == null ? null : Integer.parseInt(providerSegID)); - } - - public String getProviderNetworkType() { - return providerNetworkType; - } - - public void setProviderNetworkType(String providerNetworkType) { - this.providerNetworkType = providerNetworkType; - } - - public String getProviderPhysicalNetwork() { - return providerPhysicalNetwork; - } - - public void setProviderPhysicalNetwork(String providerPhysicalNetwork) { - this.providerPhysicalNetwork = providerPhysicalNetwork; - } - - public Integer getProviderSegmentationId() { - return providerSegmentationId; - } - - public void setProviderSegmentationId(Integer providerSegmentationId) { - this.providerSegmentationId = providerSegmentationId; - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Network [id=" + id + ", name=" + name + ", subnets=" - + subnets + ", status=" + status + ", admin_state_up=" + adminStateUp + ", tenant_id=" + - tenantId + ", shared=" + shared + ", provider:physical_network=" + providerPhysicalNetwork + - ", provider:network_type=" + providerNetworkType + ", router:external=" + routerExternal + - ", provider:segmentation_id=" + providerSegmentationId + "]"; - } -} +package com.woorea.openstack.quantum.model; + +import java.io.Serializable; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; + +@SuppressWarnings("serial") +@JsonRootName("network") +@JsonIgnoreProperties(ignoreUnknown = true) +public class Network implements Serializable { + + private String status; + + private List subnets; + + private String name; + + @JsonProperty("admin_state_up") + private Boolean adminStateUp; + + @JsonProperty("tenant_id") + private String tenantId; + + @JsonProperty("provider:physical_network") + private String providerPhysicalNetwork; + + @JsonProperty("provider:network_type") + private String providerNetworkType; + + @JsonProperty("provider:segmentation_id") + private Integer providerSegmentationId; + + @JsonProperty("router:external") + private String routerExternal; + + private String id; + + private String shared; + + /** + * @return the status + */ + @JsonIgnore + public String getStatus() { + return status; + } + + /** + * @param status + * the status to set + */ + @JsonProperty + public void setStatus(String status) { + this.status = status; + } + + /** + * @return the subnets + */ + @JsonIgnore + public List getSubnets() { + return subnets; + } + + /** + * @param subnets + * the subnets to set + */ + @JsonProperty + public void setSubnets(List subnets) { + this.subnets = subnets; + } + + /** + * @return the name + */ + public String getName() { + return name; + } + + /** + * @param name + * the name to set + */ + public void setName(String name) { + this.name = name; + } + + /** + * @return the providerPhyNet + * @deprecated + */ + @Deprecated + @JsonIgnore + public String getProviderPhyNet() { + return getProviderPhysicalNetwork(); + } + + /** + * @param providerPhyNet + * the providerPhyNet to set + * @deprecated + */ + @Deprecated + @JsonIgnore + public void setProviderPhyNet(String providerPhyNet) { + setProviderPhysicalNetwork(providerPhyNet); + } + + /** + * @return the adminStateUp + */ + @JsonIgnore + public boolean isAdminStateUp() { + return adminStateUp; + } + + public Boolean getAdminStateUp() { + return adminStateUp; + } + + /** + * @param adminStateUp + * the adminStateUp to set + */ + public void setAdminStateUp(Boolean adminStateUp) { + this.adminStateUp = adminStateUp; + } + + /** + * @return the tenantId + */ + public String getTenantId() { + return tenantId; + } + + /** + * @param tenantId + * the tenantId to set + */ + public void setTenantId(String tenantId) { + this.tenantId = tenantId; + } + + /** + * @return the netType + * @deprecated + */ + @Deprecated + @JsonIgnore + public String getNetType() { + return getProviderNetworkType(); + } + + /** + * @param netType + * the netType to set + * @deprecated + */ + @Deprecated + @JsonIgnore + public void setNetType(String netType) { + setProviderNetworkType(netType); + } + + /** + * @return the routerExternal + */ + public String getRouterExternal() { + return routerExternal; + } + + /** + * @param routerExternal + * the routerExternal to set + */ + public void setRouterExternal(String routerExternal) { + this.routerExternal = routerExternal; + } + + /** + * @return the id + */ + @JsonIgnore + public String getId() { + return id; + } + + /** + * @param id + * the id to set + */ + @JsonProperty + public void setId(String id) { + this.id = id; + } + + /** + * @return the shared + */ + public String getShared() { + return shared; + } + + /** + * @param shared + * the shared to set + */ + public void setShared(String shared) { + this.shared = shared; + } + + /** + * @return the providerSegID + * @deprecated + */ + @Deprecated + @JsonIgnore + public String getProviderSegID() { + return getProviderSegmentationId() == null ? null : Integer.toString(getProviderSegmentationId()); + } + + /** + * @param providerSegID + * the providerSegID to set + * @deprecated + */ + @Deprecated + @JsonIgnore + public void setProviderSegID(String providerSegID) { + setProviderSegmentationId(providerSegID == null ? null : Integer.parseInt(providerSegID)); + } + + public String getProviderNetworkType() { + return providerNetworkType; + } + + public void setProviderNetworkType(String providerNetworkType) { + this.providerNetworkType = providerNetworkType; + } + + public String getProviderPhysicalNetwork() { + return providerPhysicalNetwork; + } + + public void setProviderPhysicalNetwork(String providerPhysicalNetwork) { + this.providerPhysicalNetwork = providerPhysicalNetwork; + } + + public Integer getProviderSegmentationId() { + return providerSegmentationId; + } + + public void setProviderSegmentationId(Integer providerSegmentationId) { + this.providerSegmentationId = providerSegmentationId; + } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Network [id=" + id + ", name=" + name + ", subnets=" + + subnets + ", status=" + status + ", admin_state_up=" + adminStateUp + ", tenant_id=" + + tenantId + ", shared=" + shared + ", provider:physical_network=" + providerPhysicalNetwork + + ", provider:network_type=" + providerNetworkType + ", router:external=" + routerExternal + + ", provider:segmentation_id=" + providerSegmentationId + "]"; + } +} diff --git a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/NetworkForCreate.java b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/NetworkForCreate.java index 507e39b05..224fbdb55 100644 --- a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/NetworkForCreate.java +++ b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/NetworkForCreate.java @@ -1,9 +1,9 @@ -package com.woorea.openstack.quantum.model; - -import org.codehaus.jackson.map.annotate.JsonRootName; - -@SuppressWarnings("serial") -@JsonRootName("network") -@Deprecated -public class NetworkForCreate extends Network { -} +package com.woorea.openstack.quantum.model; + +import com.fasterxml.jackson.annotation.JsonRootName; + +@SuppressWarnings("serial") +@JsonRootName("network") +@Deprecated +public class NetworkForCreate extends Network { +} diff --git a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Networks.java b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Networks.java index a4fd330de..b1233edd0 100644 --- a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Networks.java +++ b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Networks.java @@ -1,38 +1,39 @@ -package com.woorea.openstack.quantum.model; - -import java.io.Serializable; -import java.util.Iterator; -import java.util.List; -import org.codehaus.jackson.annotate.JsonProperty; - -public class Networks implements Iterable, Serializable{ - - @JsonProperty("networks") - private List list; - - /** - * @return the list - */ - public List getList() { - return list; - } - - - /** - * @param list the list to set - */ - public void setList(List list) { - this.list = list; - } - - - public String toString() { - return "Networks [list=" + list + "]"; - } - - - public Iterator iterator() { - return list.iterator(); - } - -} +package com.woorea.openstack.quantum.model; + +import java.io.Serializable; +import java.util.Iterator; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class Networks implements Iterable, Serializable{ + + @JsonProperty("networks") + private List list; + + /** + * @return the list + */ + public List getList() { + return list; + } + + + /** + * @param list the list to set + */ + public void setList(List list) { + this.list = list; + } + + + public String toString() { + return "Networks [list=" + list + "]"; + } + + + public Iterator iterator() { + return list.iterator(); + } + +} diff --git a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Port.java b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Port.java index e878b300f..fe8f85d3f 100644 --- a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Port.java +++ b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Port.java @@ -1,269 +1,269 @@ -package com.woorea.openstack.quantum.model; - -import java.io.Serializable; -import java.util.List; - -import org.codehaus.jackson.annotate.JsonIgnore; -import org.codehaus.jackson.annotate.JsonIgnoreProperties; -import org.codehaus.jackson.annotate.JsonProperty; -import org.codehaus.jackson.map.annotate.JsonRootName; - -@SuppressWarnings("serial") -@JsonRootName("port") -@JsonIgnoreProperties(ignoreUnknown = true) -public class Port implements Serializable { - - public static final class Ip implements Serializable { - - @JsonProperty("ip_address") - private String address; - - @JsonProperty("subnet_id") - private String subnetId; - - /** - * @return the address - */ - public String getAddress() { - return address; - } - - /** - * @param address - * the address to set - */ - public void setAddress(String address) { - this.address = address; - } - - /** - * @return the subnetId - */ - public String getSubnetId() { - return subnetId; - } - - /** - * @param subnetId - * the subnetId to set - */ - public void setSubnetId(String subnetId) { - this.subnetId = subnetId; - } - - @Override - public String toString() { - return "ip_addresses [ip_address=" + address + ", subnet_id=" + subnetId + "]"; - } - - } - - @JsonProperty("admin_state_up") - private Boolean adminStateUp; - - @JsonProperty("device_id") - private String deviceId; - - @JsonProperty("device_owner") - private String deviceOwner; - - @JsonProperty("fixed_ips") - private List list; - - private String id; - - @JsonProperty("mac_address") - private String macAddress; - - private String name; - - @JsonProperty("network_id") - private String networkId; - - private String status; - - @JsonProperty("tenant_id") - private String tenantId; - - @JsonProperty("security_groups") - private List securityGroups; - - /** - * @return the adminStateUp - */ - public Boolean getAdminStateUp() { - return adminStateUp; - } - - /** - * @param adminStateUp - * the adminStateUp to set - */ - public void setAdminStateUp(Boolean adminStateUp) { - this.adminStateUp = adminStateUp; - } - - /** - * @return the deviceId - */ - public String getDeviceId() { - return deviceId; - } - - /** - * @param deviceId - * the deviceId to set - */ - public void setDeviceId(String deviceId) { - this.deviceId = deviceId; - } - - /** - * @return the deviceOwner - */ - public String getDeviceOwner() { - return deviceOwner; - } - - /** - * @param deviceOwner - * the deviceOwner to set - */ - public void setDeviceOwner(String deviceOwner) { - this.deviceOwner = deviceOwner; - } - - /** - * @return the list - */ - public List getList() { - return list; - } - - /** - * @param list - * the list to set - */ - public void setList(List list) { - this.list = list; - } - - /** - * @return the id - */ - @JsonIgnore - public String getId() { - return id; - } - - /** - * @param id - * the id to set - */ - @JsonProperty - public void setId(String id) { - this.id = id; - } - - /** - * @return the macAddress - */ - public String getMacAddress() { - return macAddress; - } - - /** - * @param macAddress - * the macAddress to set - */ - public void setMacAddress(String macAddress) { - this.macAddress = macAddress; - } - - /** - * @return the name - */ - public String getName() { - return name; - } - - /** - * @param name - * the name to set - */ - public void setName(String name) { - this.name = name; - } - - /** - * @return the networkId - */ - public String getNetworkId() { - return networkId; - } - - /** - * @param networkId - * the networkId to set - */ - public void setNetworkId(String networkId) { - this.networkId = networkId; - } - - /** - * @return the status - */ - @JsonIgnore - public String getStatus() { - return status; - } - - /** - * @param status - * the status to set - */ - @JsonProperty - public void setStatus(String status) { - this.status = status; - } - - /** - * @return the tenantId - */ - public String getTenantId() { - return tenantId; - } - - /** - * @param tenantId - * the tenantId to set - */ - public void setTenantId(String tenantId) { - this.tenantId = tenantId; - } - - /** - * @return the associated security group IDs - */ - public List getSecurityGroups() { - return securityGroups; - } - - /** - * @param securityGroups - * IDs of security groups to associate to the port - */ - public void setSecurityGroups(List securityGroups) { - this.securityGroups = securityGroups; - } - - @Override - public String toString() { - return "Port [id=" + id + ", name=" + name + ", mac_address=" - + macAddress + ", admin_state_up=" + adminStateUp + ", device_id=" + deviceId - + ", device_owner=" + deviceOwner + ", fixed_ips=" + list - + ", network_id=" + networkId + ", status=" + status - + ", tenant_id=" + tenantId - + ", securityGroups=" + securityGroups + "]"; - } -} +package com.woorea.openstack.quantum.model; + +import java.io.Serializable; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; + +@SuppressWarnings("serial") +@JsonRootName("port") +@JsonIgnoreProperties(ignoreUnknown = true) +public class Port implements Serializable { + + public static final class Ip implements Serializable { + + @JsonProperty("ip_address") + private String address; + + @JsonProperty("subnet_id") + private String subnetId; + + /** + * @return the address + */ + public String getAddress() { + return address; + } + + /** + * @param address + * the address to set + */ + public void setAddress(String address) { + this.address = address; + } + + /** + * @return the subnetId + */ + public String getSubnetId() { + return subnetId; + } + + /** + * @param subnetId + * the subnetId to set + */ + public void setSubnetId(String subnetId) { + this.subnetId = subnetId; + } + + @Override + public String toString() { + return "ip_addresses [ip_address=" + address + ", subnet_id=" + subnetId + "]"; + } + + } + + @JsonProperty("admin_state_up") + private Boolean adminStateUp; + + @JsonProperty("device_id") + private String deviceId; + + @JsonProperty("device_owner") + private String deviceOwner; + + @JsonProperty("fixed_ips") + private List list; + + private String id; + + @JsonProperty("mac_address") + private String macAddress; + + private String name; + + @JsonProperty("network_id") + private String networkId; + + private String status; + + @JsonProperty("tenant_id") + private String tenantId; + + @JsonProperty("security_groups") + private List securityGroups; + + /** + * @return the adminStateUp + */ + public Boolean getAdminStateUp() { + return adminStateUp; + } + + /** + * @param adminStateUp + * the adminStateUp to set + */ + public void setAdminStateUp(Boolean adminStateUp) { + this.adminStateUp = adminStateUp; + } + + /** + * @return the deviceId + */ + public String getDeviceId() { + return deviceId; + } + + /** + * @param deviceId + * the deviceId to set + */ + public void setDeviceId(String deviceId) { + this.deviceId = deviceId; + } + + /** + * @return the deviceOwner + */ + public String getDeviceOwner() { + return deviceOwner; + } + + /** + * @param deviceOwner + * the deviceOwner to set + */ + public void setDeviceOwner(String deviceOwner) { + this.deviceOwner = deviceOwner; + } + + /** + * @return the list + */ + public List getList() { + return list; + } + + /** + * @param list + * the list to set + */ + public void setList(List list) { + this.list = list; + } + + /** + * @return the id + */ + @JsonIgnore + public String getId() { + return id; + } + + /** + * @param id + * the id to set + */ + @JsonProperty + public void setId(String id) { + this.id = id; + } + + /** + * @return the macAddress + */ + public String getMacAddress() { + return macAddress; + } + + /** + * @param macAddress + * the macAddress to set + */ + public void setMacAddress(String macAddress) { + this.macAddress = macAddress; + } + + /** + * @return the name + */ + public String getName() { + return name; + } + + /** + * @param name + * the name to set + */ + public void setName(String name) { + this.name = name; + } + + /** + * @return the networkId + */ + public String getNetworkId() { + return networkId; + } + + /** + * @param networkId + * the networkId to set + */ + public void setNetworkId(String networkId) { + this.networkId = networkId; + } + + /** + * @return the status + */ + @JsonIgnore + public String getStatus() { + return status; + } + + /** + * @param status + * the status to set + */ + @JsonProperty + public void setStatus(String status) { + this.status = status; + } + + /** + * @return the tenantId + */ + public String getTenantId() { + return tenantId; + } + + /** + * @param tenantId + * the tenantId to set + */ + public void setTenantId(String tenantId) { + this.tenantId = tenantId; + } + + /** + * @return the associated security group IDs + */ + public List getSecurityGroups() { + return securityGroups; + } + + /** + * @param securityGroups + * IDs of security groups to associate to the port + */ + public void setSecurityGroups(List securityGroups) { + this.securityGroups = securityGroups; + } + + @Override + public String toString() { + return "Port [id=" + id + ", name=" + name + ", mac_address=" + + macAddress + ", admin_state_up=" + adminStateUp + ", device_id=" + deviceId + + ", device_owner=" + deviceOwner + ", fixed_ips=" + list + + ", network_id=" + networkId + ", status=" + status + + ", tenant_id=" + tenantId + + ", securityGroups=" + securityGroups + "]"; + } +} diff --git a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/PortForCreate.java b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/PortForCreate.java index 3c1af5060..bfc4f18d8 100644 --- a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/PortForCreate.java +++ b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/PortForCreate.java @@ -1,12 +1,12 @@ -package com.woorea.openstack.quantum.model; - -import org.codehaus.jackson.map.annotate.JsonRootName; - -/** - * @deprecated Please use {@link Port} directly. - */ -@SuppressWarnings("serial") -@JsonRootName("port") -@Deprecated -public class PortForCreate extends Port { -} +package com.woorea.openstack.quantum.model; + +import com.fasterxml.jackson.annotation.JsonRootName; + +/** + * @deprecated Please use {@link Port} directly. + */ +@SuppressWarnings("serial") +@JsonRootName("port") +@Deprecated +public class PortForCreate extends Port { +} diff --git a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Ports.java b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Ports.java index 5f10d35dd..1b2b4186d 100644 --- a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Ports.java +++ b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Ports.java @@ -1,40 +1,40 @@ -package com.woorea.openstack.quantum.model; - -import java.io.Serializable; -import java.util.Iterator; -import java.util.List; - -import org.codehaus.jackson.annotate.JsonProperty; - -@SuppressWarnings("serial") -public class Ports implements Iterable, Serializable { - - @JsonProperty("ports") - private List list; - - /** - * @return the list - */ - public List getList() { - return list; - } - - /** - * @param list - * the list to set - */ - public void setList(List list) { - this.list = list; - } - - @Override - public Iterator iterator() { - return list.iterator(); - } - - @Override - public String toString() { - return "Ports [list=" + list + "]"; - } - -} +package com.woorea.openstack.quantum.model; + +import java.io.Serializable; +import java.util.Iterator; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; + +@SuppressWarnings("serial") +public class Ports implements Iterable, Serializable { + + @JsonProperty("ports") + private List list; + + /** + * @return the list + */ + public List getList() { + return list; + } + + /** + * @param list + * the list to set + */ + public void setList(List list) { + this.list = list; + } + + @Override + public Iterator iterator() { + return list.iterator(); + } + + @Override + public String toString() { + return "Ports [list=" + list + "]"; + } + +} diff --git a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Router.java b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Router.java index a94afd5e4..fadc17d4b 100644 --- a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Router.java +++ b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Router.java @@ -1,77 +1,77 @@ -package com.woorea.openstack.quantum.model; - -import java.util.List; -import java.io.Serializable; - -import org.codehaus.jackson.annotate.JsonProperty; -import org.codehaus.jackson.map.annotate.JsonRootName; - -@JsonRootName("router") -public class Router implements Serializable { - - @JsonProperty("status") - private String status; - - @JsonProperty("external_gateway_info") - private GatewayInfo externalGatewayInfo; - - @JsonProperty("name") - private String name; - - @JsonProperty("admin_state_up") - private String admin_state_up; - - @JsonProperty("tenant_id") - private String tenantId; - - @JsonProperty("id") - private String id; - - @JsonProperty("routes") - private List routes; - - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } - public List getRoutes() { - return routes; - } - public void setRoutes(List routes) { - this.routes = routes; - } - public String getAdmin_state_up() { - return admin_state_up; - } - public void setAdmin_state_up(String admin_state_up) { - this.admin_state_up = admin_state_up; - } - public String getStatus() { - return status; - } - public void setStatus(String status) { - this.status = status; - } - public GatewayInfo getExternalGatewayInfo() { - return externalGatewayInfo; - } - public void setExternalGatewayInfo(GatewayInfo externalGatewayInfo) { - this.externalGatewayInfo = externalGatewayInfo; - } - public String getTenantId() { - return tenantId; - } - public void setTenantId(String tenantId) { - this.tenantId = tenantId; - } - public String getId() { - return id; - } - public void setId(String id) { - this.id = id; - } - - -} +package com.woorea.openstack.quantum.model; + +import java.io.Serializable; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName("router") +public class Router implements Serializable { + + @JsonProperty("status") + private String status; + + @JsonProperty("external_gateway_info") + private GatewayInfo externalGatewayInfo; + + @JsonProperty("name") + private String name; + + @JsonProperty("admin_state_up") + private String admin_state_up; + + @JsonProperty("tenant_id") + private String tenantId; + + @JsonProperty("id") + private String id; + + @JsonProperty("routes") + private List routes; + + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + public List getRoutes() { + return routes; + } + public void setRoutes(List routes) { + this.routes = routes; + } + public String getAdmin_state_up() { + return admin_state_up; + } + public void setAdmin_state_up(String admin_state_up) { + this.admin_state_up = admin_state_up; + } + public String getStatus() { + return status; + } + public void setStatus(String status) { + this.status = status; + } + public GatewayInfo getExternalGatewayInfo() { + return externalGatewayInfo; + } + public void setExternalGatewayInfo(GatewayInfo externalGatewayInfo) { + this.externalGatewayInfo = externalGatewayInfo; + } + public String getTenantId() { + return tenantId; + } + public void setTenantId(String tenantId) { + this.tenantId = tenantId; + } + public String getId() { + return id; + } + public void setId(String id) { + this.id = id; + } + + +} diff --git a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/RouterForAddInterface.java b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/RouterForAddInterface.java index 62ec3025a..ab15f14e6 100644 --- a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/RouterForAddInterface.java +++ b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/RouterForAddInterface.java @@ -1,28 +1,28 @@ -package com.woorea.openstack.quantum.model; - -import java.io.Serializable; - -import org.codehaus.jackson.annotate.JsonProperty; - -public class RouterForAddInterface implements Serializable { - - @JsonProperty("subnet_id") - String subnetId; - String routerId; - - public String getSubnetId() { - return subnetId; - } - - public void setSubnetId(String subnetId) { - this.subnetId = subnetId; - } - - public String getRouterId() { - return routerId; - } - - public void setRouterId(String routerId) { - this.routerId = routerId; - } - } +package com.woorea.openstack.quantum.model; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class RouterForAddInterface implements Serializable { + + @JsonProperty("subnet_id") + String subnetId; + String routerId; + + public String getSubnetId() { + return subnetId; + } + + public void setSubnetId(String subnetId) { + this.subnetId = subnetId; + } + + public String getRouterId() { + return routerId; + } + + public void setRouterId(String routerId) { + this.routerId = routerId; + } + } diff --git a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/RouterForCreate.java b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/RouterForCreate.java index b8c92912d..e1959e483 100644 --- a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/RouterForCreate.java +++ b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/RouterForCreate.java @@ -1,75 +1,75 @@ -package com.woorea.openstack.quantum.model; - -import java.util.List; -import java.io.Serializable; - -import org.codehaus.jackson.annotate.JsonProperty; -import org.codehaus.jackson.map.annotate.JsonRootName; - -@JsonRootName("router") -public class RouterForCreate implements Serializable { - - @JsonProperty("name") - private String name; - - private List routes; - - @JsonProperty("admin_state_up") - private String admin_state_up; - - @JsonProperty("status") - private String status; - - @JsonProperty("external_gateway_info") - private GatewayInfo externalGatewayInfo; - - @JsonProperty("tenant_id") - private String tenantId; - - @JsonProperty("id") - private String id; - - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } - public List getRoutes() { - return routes; - } - public void setRoutes(List routes) { - this.routes = routes; - } - public String getAdmin_state_up() { - return admin_state_up; - } - public void setAdmin_state_up(String admin_state_up) { - this.admin_state_up = admin_state_up; - } - public String getStatus() { - return status; - } - public void setStatus(String status) { - this.status = status; - } - public GatewayInfo getExternalGatewayInfo() { - return externalGatewayInfo; - } - public void setExternalGatewayInfo(GatewayInfo externalGatewayInfo) { - this.externalGatewayInfo = externalGatewayInfo; - } - public String getTenantId() { - return tenantId; - } - public void setTenantId(String tenantId) { - this.tenantId = tenantId; - } - public String getId() { - return id; - } - public void setId(String id) { - this.id = id; - } - -} +package com.woorea.openstack.quantum.model; + +import java.io.Serializable; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName("router") +public class RouterForCreate implements Serializable { + + @JsonProperty("name") + private String name; + + private List routes; + + @JsonProperty("admin_state_up") + private String admin_state_up; + + @JsonProperty("status") + private String status; + + @JsonProperty("external_gateway_info") + private GatewayInfo externalGatewayInfo; + + @JsonProperty("tenant_id") + private String tenantId; + + @JsonProperty("id") + private String id; + + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + public List getRoutes() { + return routes; + } + public void setRoutes(List routes) { + this.routes = routes; + } + public String getAdmin_state_up() { + return admin_state_up; + } + public void setAdmin_state_up(String admin_state_up) { + this.admin_state_up = admin_state_up; + } + public String getStatus() { + return status; + } + public void setStatus(String status) { + this.status = status; + } + public GatewayInfo getExternalGatewayInfo() { + return externalGatewayInfo; + } + public void setExternalGatewayInfo(GatewayInfo externalGatewayInfo) { + this.externalGatewayInfo = externalGatewayInfo; + } + public String getTenantId() { + return tenantId; + } + public void setTenantId(String tenantId) { + this.tenantId = tenantId; + } + public String getId() { + return id; + } + public void setId(String id) { + this.id = id; + } + +} diff --git a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/RouterInterface.java b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/RouterInterface.java index 2d7551fbb..ca68c73dd 100644 --- a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/RouterInterface.java +++ b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/RouterInterface.java @@ -1,19 +1,18 @@ -package com.woorea.openstack.quantum.model; - -import java.io.Serializable; - -import org.codehaus.jackson.annotate.JsonProperty; -import org.codehaus.jackson.map.annotate.JsonRootName; - -public class RouterInterface implements Serializable { - - @JsonProperty("subnet_id") - String subnetId; - @JsonProperty("port_id") - String portId; - @JsonProperty("tenant_id") - String tenantId; - @JsonProperty("id") - String id; - -} +package com.woorea.openstack.quantum.model; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class RouterInterface implements Serializable { + + @JsonProperty("subnet_id") + String subnetId; + @JsonProperty("port_id") + String portId; + @JsonProperty("tenant_id") + String tenantId; + @JsonProperty("id") + String id; + +} diff --git a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Routers.java b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Routers.java index e2a56b2bc..397155ca5 100644 --- a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Routers.java +++ b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Routers.java @@ -1,38 +1,39 @@ -package com.woorea.openstack.quantum.model; - -import java.io.Serializable; -import java.util.Iterator; -import java.util.List; -import org.codehaus.jackson.annotate.JsonProperty; - -public class Routers implements Iterable, Serializable{ - - @JsonProperty("routers") - private List list; - - /** - * @return the list - */ - public List getList() { - return list; - } - - - /** - * @param list the list to set - */ - public void setList(List list) { - this.list = list; - } - - - public String toString() { - return "Routers [list=" + list + "]"; - } - - - public Iterator iterator() { - return list.iterator(); - } - -} +package com.woorea.openstack.quantum.model; + +import java.io.Serializable; +import java.util.Iterator; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class Routers implements Iterable, Serializable{ + + @JsonProperty("routers") + private List list; + + /** + * @return the list + */ + public List getList() { + return list; + } + + + /** + * @param list the list to set + */ + public void setList(List list) { + this.list = list; + } + + + public String toString() { + return "Routers [list=" + list + "]"; + } + + + public Iterator iterator() { + return list.iterator(); + } + +} diff --git a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Subnet.java b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Subnet.java index 73015146b..0bb74a0df 100644 --- a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Subnet.java +++ b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Subnet.java @@ -1,264 +1,264 @@ -package com.woorea.openstack.quantum.model; - -import java.io.Serializable; -import java.util.List; - -import org.codehaus.jackson.annotate.JsonCreator; -import org.codehaus.jackson.annotate.JsonIgnore; -import org.codehaus.jackson.annotate.JsonIgnoreProperties; -import org.codehaus.jackson.annotate.JsonProperty; -import org.codehaus.jackson.annotate.JsonValue; -import org.codehaus.jackson.map.annotate.JsonRootName; - -@SuppressWarnings("serial") -@JsonRootName("subnet") -@JsonIgnoreProperties(ignoreUnknown = true) -public class Subnet implements Serializable { - - private String name; - - @JsonProperty("enable_dhcp") - private Boolean enableDHCP; - - @JsonProperty("network_id") - private String networkId; - - @JsonProperty("tenant_id") - private String tenantId; - - @JsonProperty("dns_nameservers") - private List dnsNames; - - @JsonProperty("allocation_pools") - private List list; - - @JsonProperty("host_routes") - private List hostRoutes; - - @JsonProperty("ip_version") - private IpVersion ipversion; - - @JsonProperty("gateway_ip") - private String gw; - - private String cidr; - - private String id; - - public static enum IpVersion implements Serializable { - IPV4(4), - IPV6(6); - private int code; - - IpVersion(int code) { - this.code = code; - } - - @JsonValue - public int code() { - return code; - } - - @JsonCreator - public static IpVersion valueOf(int value) { - for (IpVersion ipVersion : IpVersion.values()) { - if (ipVersion.code() == value) { - return ipVersion; - } - } - return IPV4; - } - - @Override - public String toString() { - return String.valueOf(code); - } - } - - /** - * @return the name - */ - public String getName() { - return name; - } - - /** - * @param name - * the name to set - */ - public void setName(String name) { - this.name = name; - } - - /** - * @return the enableDHCP - */ - @JsonIgnore - public boolean isEnableDHCP() { - return enableDHCP; - } - - public Boolean getEnableDHCP() { - return enableDHCP; - } - - /** - * @param enableDHCP - * the enableDHCP to set - */ - public void setEnableDHCP(Boolean enableDHCP) { - this.enableDHCP = enableDHCP; - } - - /** - * @return the networkId - */ - public String getNetworkId() { - return networkId; - } - - /** - * @param networkId - * the networkId to set - */ - public void setNetworkId(String networkId) { - this.networkId = networkId; - } - - /** - * @return the tenantId - */ - public String getTenantId() { - return tenantId; - } - - /** - * @param tenantId - * the tenantId to set - */ - public void setTenantId(String tenantId) { - this.tenantId = tenantId; - } - - /** - * @return the dnsNames - */ - public List getDnsNames() { - return dnsNames; - } - - /** - * @param dnsNames - * the dnsNames to set - */ - public void setDnsNames(List dnsNames) { - this.dnsNames = dnsNames; - } - - /** - * @return the list - */ - public List getList() { - return list; - } - - /** - * @param list - * the list to set - */ - public void setList(List list) { - this.list = list; - } - - /** - * @return the hostRoutes - */ - public List getHostRoutes() { - return hostRoutes; - } - - /** - * @param hostRoutes - * the hostRoutes to set - */ - public void setHostRoutes(List hostRoutes) { - this.hostRoutes = hostRoutes; - } - - /** - * @return the ipversion - */ - public IpVersion getIpversion() { - return ipversion; - } - - /** - * @param ipversion - * the ipversion to set - */ - public void setIpversion(IpVersion ipversion) { - this.ipversion = ipversion; - } - - /** - * @return the gw - */ - public String getGw() { - return gw; - } - - /** - * @param gw - * the gw to set - */ - public void setGw(String gw) { - this.gw = gw; - } - - /** - * @return the cidr - */ - public String getCidr() { - return cidr; - } - - /** - * @param cidr - * the cidr to set - */ - public void setCidr(String cidr) { - this.cidr = cidr; - } - - /** - * @return the id - */ - @JsonIgnore - public String getId() { - return id; - } - - /** - * @param id - * the id to set - */ - @JsonProperty - public void setId(String id) { - this.id = id; - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Subnet [id=" + id + ", name=" + name + ", network_id=" - + networkId + ", tenant_id=" + tenantId + ", allocation_pools=" + list - + ", gateway_ip=" + gw + ", ip_version=" + ipversion - + ", cidr=" + cidr + ", enable_dhcp=" + enableDHCP + ", dns_nameservers=" - + dnsNames + ", host_routes=" + hostRoutes + "]"; - } - -} +package com.woorea.openstack.quantum.model; + +import java.io.Serializable; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; +import com.fasterxml.jackson.annotation.JsonValue; + +@SuppressWarnings("serial") +@JsonRootName("subnet") +@JsonIgnoreProperties(ignoreUnknown = true) +public class Subnet implements Serializable { + + private String name; + + @JsonProperty("enable_dhcp") + private Boolean enableDHCP; + + @JsonProperty("network_id") + private String networkId; + + @JsonProperty("tenant_id") + private String tenantId; + + @JsonProperty("dns_nameservers") + private List dnsNames; + + @JsonProperty("allocation_pools") + private List list; + + @JsonProperty("host_routes") + private List hostRoutes; + + @JsonProperty("ip_version") + private IpVersion ipversion; + + @JsonProperty("gateway_ip") + private String gw; + + private String cidr; + + private String id; + + public static enum IpVersion implements Serializable { + IPV4(4), + IPV6(6); + private int code; + + IpVersion(int code) { + this.code = code; + } + + @JsonValue + public int code() { + return code; + } + + @JsonCreator + public static IpVersion valueOf(int value) { + for (IpVersion ipVersion : IpVersion.values()) { + if (ipVersion.code() == value) { + return ipVersion; + } + } + return IPV4; + } + + @Override + public String toString() { + return String.valueOf(code); + } + } + + /** + * @return the name + */ + public String getName() { + return name; + } + + /** + * @param name + * the name to set + */ + public void setName(String name) { + this.name = name; + } + + /** + * @return the enableDHCP + */ + @JsonIgnore + public boolean isEnableDHCP() { + return enableDHCP; + } + + public Boolean getEnableDHCP() { + return enableDHCP; + } + + /** + * @param enableDHCP + * the enableDHCP to set + */ + public void setEnableDHCP(Boolean enableDHCP) { + this.enableDHCP = enableDHCP; + } + + /** + * @return the networkId + */ + public String getNetworkId() { + return networkId; + } + + /** + * @param networkId + * the networkId to set + */ + public void setNetworkId(String networkId) { + this.networkId = networkId; + } + + /** + * @return the tenantId + */ + public String getTenantId() { + return tenantId; + } + + /** + * @param tenantId + * the tenantId to set + */ + public void setTenantId(String tenantId) { + this.tenantId = tenantId; + } + + /** + * @return the dnsNames + */ + public List getDnsNames() { + return dnsNames; + } + + /** + * @param dnsNames + * the dnsNames to set + */ + public void setDnsNames(List dnsNames) { + this.dnsNames = dnsNames; + } + + /** + * @return the list + */ + public List getList() { + return list; + } + + /** + * @param list + * the list to set + */ + public void setList(List list) { + this.list = list; + } + + /** + * @return the hostRoutes + */ + public List getHostRoutes() { + return hostRoutes; + } + + /** + * @param hostRoutes + * the hostRoutes to set + */ + public void setHostRoutes(List hostRoutes) { + this.hostRoutes = hostRoutes; + } + + /** + * @return the ipversion + */ + public IpVersion getIpversion() { + return ipversion; + } + + /** + * @param ipversion + * the ipversion to set + */ + public void setIpversion(IpVersion ipversion) { + this.ipversion = ipversion; + } + + /** + * @return the gw + */ + public String getGw() { + return gw; + } + + /** + * @param gw + * the gw to set + */ + public void setGw(String gw) { + this.gw = gw; + } + + /** + * @return the cidr + */ + public String getCidr() { + return cidr; + } + + /** + * @param cidr + * the cidr to set + */ + public void setCidr(String cidr) { + this.cidr = cidr; + } + + /** + * @return the id + */ + @JsonIgnore + public String getId() { + return id; + } + + /** + * @param id + * the id to set + */ + @JsonProperty + public void setId(String id) { + this.id = id; + } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Subnet [id=" + id + ", name=" + name + ", network_id=" + + networkId + ", tenant_id=" + tenantId + ", allocation_pools=" + list + + ", gateway_ip=" + gw + ", ip_version=" + ipversion + + ", cidr=" + cidr + ", enable_dhcp=" + enableDHCP + ", dns_nameservers=" + + dnsNames + ", host_routes=" + hostRoutes + "]"; + } + +} diff --git a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/SubnetForCreate.java b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/SubnetForCreate.java index 2c07ab255..4ac0917b6 100644 --- a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/SubnetForCreate.java +++ b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/SubnetForCreate.java @@ -1,34 +1,34 @@ -package com.woorea.openstack.quantum.model; - -import org.codehaus.jackson.annotate.JsonIgnore; -import org.codehaus.jackson.map.annotate.JsonRootName; - -/** - * Please use {@link Subnet} directly. - */ -@SuppressWarnings("serial") -@JsonRootName("subnet") -@Deprecated -public class SubnetForCreate extends Subnet { - - /** - * @return the ipVersion - * @deprecated - */ - @Deprecated - @JsonIgnore - public int getIpVersion() { - return getIpversion().code(); - } - - /** - * @param ipVersion - * the ipVersion to set - * @deprecated - */ - @Deprecated - @JsonIgnore - public void setIpVersion(int ipVersion) { - setIpversion(IpVersion.valueOf(ipVersion)); - } -} +package com.woorea.openstack.quantum.model; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonRootName; + +/** + * Please use {@link Subnet} directly. + */ +@SuppressWarnings("serial") +@JsonRootName("subnet") +@Deprecated +public class SubnetForCreate extends Subnet { + + /** + * @return the ipVersion + * @deprecated + */ + @Deprecated + @JsonIgnore + public int getIpVersion() { + return getIpversion().code(); + } + + /** + * @param ipVersion + * the ipVersion to set + * @deprecated + */ + @Deprecated + @JsonIgnore + public void setIpVersion(int ipVersion) { + setIpversion(IpVersion.valueOf(ipVersion)); + } +} diff --git a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Subnets.java b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Subnets.java index e9b21f47e..85cccf732 100644 --- a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Subnets.java +++ b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Subnets.java @@ -1,36 +1,36 @@ -package com.woorea.openstack.quantum.model; - -import java.io.Serializable; -import java.util.Iterator; -import java.util.List; - -import org.codehaus.jackson.annotate.JsonProperty; - -public class Subnets implements Serializable, Iterable { - - @JsonProperty("subnets") - private List list; - - /** - * @return the list - */ - public List getList() { - return list; - } - - /** - * @param list the list to set - */ - public void setList(List list) { - this.list = list; - } - - public String toString() { - return "Subnets [list=" + list + "]"; - } - - public Iterator iterator() { - return list.iterator(); - } - -} +package com.woorea.openstack.quantum.model; + +import java.io.Serializable; +import java.util.Iterator; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class Subnets implements Serializable, Iterable { + + @JsonProperty("subnets") + private List list; + + /** + * @return the list + */ + public List getList() { + return list; + } + + /** + * @param list the list to set + */ + public void setList(List list) { + this.list = list; + } + + public String toString() { + return "Subnets [list=" + list + "]"; + } + + public Iterator iterator() { + return list.iterator(); + } + +} diff --git a/quantum-model/src/test/java/com/woorea/openstack/quantum/model/NetworkTest.java b/quantum-model/src/test/java/com/woorea/openstack/quantum/model/NetworkTest.java index 7bee7049f..855115340 100644 --- a/quantum-model/src/test/java/com/woorea/openstack/quantum/model/NetworkTest.java +++ b/quantum-model/src/test/java/com/woorea/openstack/quantum/model/NetworkTest.java @@ -1,119 +1,120 @@ -package com.woorea.openstack.quantum.model; - -import static org.hamcrest.CoreMatchers.equalTo; -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.CoreMatchers.not; -import static org.junit.Assert.assertThat; -import static org.junit.matchers.JUnitMatchers.containsString; -import static org.junit.matchers.JUnitMatchers.hasItem; - -import java.util.Arrays; - -import org.codehaus.jackson.map.ObjectMapper; -import org.junit.Before; -import org.junit.Test; - -public class NetworkTest { - - private static final String ID = "testId"; - - private static final boolean ADMIN_STATE_UP = true; - - private static final String NAME = "name"; - - private static final String TENANT_ID = "tenantId"; - - private static final String SHARED = "shared"; - - private static final String STATUS = "status"; - - private static final String SUBNET = "subnet"; - - private static final String PROVIDER_NETWORK_TYPE = "vlan"; - - private static final String PROVIDER_PHYSICAL_NETWORK = "physicalNetwork"; - - private static final int PROVIDER_SEGMENTATION_ID = 100; - - private static final String ROUTER_EXTERNAL = "routerExternal"; - - /** - * JSON with read only attributes. - */ - private static final String NETWORK_JSON = "{" - + " \"network\" : {" - + " \"id\" : \"" + ID + "\"," - + " \"status\" : \"" + STATUS + "\"," - + " \"subnets\" : [ \"" + SUBNET + "\" ]" - + " }" - + "}"; - - private ObjectMapper objectMapper; - - private String serializedNetwork; - - @Before - public void setUp() throws Exception { - objectMapper = PortTest.initializeObjectMapper(); - } - - @Test - public void testSerialization() throws Exception { - Network network = new Network(); - network.setId(ID); - network.setProviderNetworkType(PROVIDER_NETWORK_TYPE); - network.setProviderPhysicalNetwork(PROVIDER_PHYSICAL_NETWORK); - network.setProviderSegmentationId(PROVIDER_SEGMENTATION_ID); - network.setAdminStateUp(ADMIN_STATE_UP); - network.setSubnets(Arrays.asList(SUBNET)); - network.setRouterExternal(ROUTER_EXTERNAL); - network.setName(NAME); - network.setShared(SHARED); - network.setTenantId(TENANT_ID); - - serializedNetwork = objectMapper.writeValueAsString(network); - assertThat(serializedNetwork, not(containsString(ID))); - assertThat(serializedNetwork, not(containsString(STATUS))); - assertThat(serializedNetwork, not(containsString(SUBNET))); - assertThat(serializedNetwork, containsString("\"admin_state_up\" : " + ADMIN_STATE_UP)); - assertThat(serializedNetwork, containsString(NAME)); - assertThat(serializedNetwork, containsString(SHARED)); - assertThat(serializedNetwork, containsString(TENANT_ID)); - assertThat(serializedNetwork, containsString(ROUTER_EXTERNAL)); - assertThat(serializedNetwork, containsString(PROVIDER_NETWORK_TYPE)); - assertThat(serializedNetwork, containsString(PROVIDER_PHYSICAL_NETWORK)); - assertThat(serializedNetwork, containsString(Integer.toString(PROVIDER_SEGMENTATION_ID))); - } - - @Test - public void testSerializationEmpty() throws Exception { - Network network = new Network(); - serializedNetwork = objectMapper.writeValueAsString(network); - - assertThat(serializedNetwork, containsString("\"network\" : { }")); - } - - @Test - public void testDeserializationReadOnlyFields() throws Exception { - Network network = objectMapper.readValue(NETWORK_JSON, Network.class); - - assertThat(network.getId(), is(equalTo(ID))); - assertThat(network.getSubnets(), hasItem(equalTo(SUBNET))); - assertThat(network.getStatus(), is(equalTo(STATUS))); - } - - @Test - public void testDeserialization() throws Exception { - testSerialization(); - Network network = objectMapper.readValue(serializedNetwork, Network.class); - - assertThat(network.getName(), is(equalTo(NAME))); - assertThat(network.isAdminStateUp(), is(equalTo(ADMIN_STATE_UP))); - assertThat(network.getShared(), is(equalTo(SHARED))); - assertThat(network.getTenantId(), is(equalTo(TENANT_ID))); - assertThat(network.getRouterExternal(), is(equalTo(ROUTER_EXTERNAL))); - assertThat(network.getProviderNetworkType(), is(equalTo(PROVIDER_NETWORK_TYPE))); - assertThat(network.getProviderPhysicalNetwork(), is(equalTo(PROVIDER_PHYSICAL_NETWORK))); - assertThat(network.getProviderSegmentationId(), is(equalTo(PROVIDER_SEGMENTATION_ID))); - } -} +package com.woorea.openstack.quantum.model; + +import static org.hamcrest.CoreMatchers.equalTo; +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.CoreMatchers.not; +import static org.junit.Assert.assertThat; +import static org.junit.matchers.JUnitMatchers.containsString; +import static org.junit.matchers.JUnitMatchers.hasItem; + +import java.util.Arrays; + +import org.junit.Before; +import org.junit.Test; + +import com.fasterxml.jackson.databind.ObjectMapper; + +public class NetworkTest { + + private static final String ID = "testId"; + + private static final boolean ADMIN_STATE_UP = true; + + private static final String NAME = "name"; + + private static final String TENANT_ID = "tenantId"; + + private static final String SHARED = "shared"; + + private static final String STATUS = "status"; + + private static final String SUBNET = "subnet"; + + private static final String PROVIDER_NETWORK_TYPE = "vlan"; + + private static final String PROVIDER_PHYSICAL_NETWORK = "physicalNetwork"; + + private static final int PROVIDER_SEGMENTATION_ID = 100; + + private static final String ROUTER_EXTERNAL = "routerExternal"; + + /** + * JSON with read only attributes. + */ + private static final String NETWORK_JSON = "{" + + " \"network\" : {" + + " \"id\" : \"" + ID + "\"," + + " \"status\" : \"" + STATUS + "\"," + + " \"subnets\" : [ \"" + SUBNET + "\" ]" + + " }" + + "}"; + + private ObjectMapper objectMapper; + + private String serializedNetwork; + + @Before + public void setUp() throws Exception { + objectMapper = PortTest.initializeObjectMapper(); + } + + @Test + public void testSerialization() throws Exception { + Network network = new Network(); + network.setId(ID); + network.setProviderNetworkType(PROVIDER_NETWORK_TYPE); + network.setProviderPhysicalNetwork(PROVIDER_PHYSICAL_NETWORK); + network.setProviderSegmentationId(PROVIDER_SEGMENTATION_ID); + network.setAdminStateUp(ADMIN_STATE_UP); + network.setSubnets(Arrays.asList(SUBNET)); + network.setRouterExternal(ROUTER_EXTERNAL); + network.setName(NAME); + network.setShared(SHARED); + network.setTenantId(TENANT_ID); + + serializedNetwork = objectMapper.writeValueAsString(network); + assertThat(serializedNetwork, not(containsString(ID))); + assertThat(serializedNetwork, not(containsString(STATUS))); + assertThat(serializedNetwork, not(containsString(SUBNET))); + assertThat(serializedNetwork, containsString("\"admin_state_up\" : " + ADMIN_STATE_UP)); + assertThat(serializedNetwork, containsString(NAME)); + assertThat(serializedNetwork, containsString(SHARED)); + assertThat(serializedNetwork, containsString(TENANT_ID)); + assertThat(serializedNetwork, containsString(ROUTER_EXTERNAL)); + assertThat(serializedNetwork, containsString(PROVIDER_NETWORK_TYPE)); + assertThat(serializedNetwork, containsString(PROVIDER_PHYSICAL_NETWORK)); + assertThat(serializedNetwork, containsString(Integer.toString(PROVIDER_SEGMENTATION_ID))); + } + + @Test + public void testSerializationEmpty() throws Exception { + Network network = new Network(); + serializedNetwork = objectMapper.writeValueAsString(network); + + assertThat(serializedNetwork, containsString("\"network\" : { }")); + } + + @Test + public void testDeserializationReadOnlyFields() throws Exception { + Network network = objectMapper.readValue(NETWORK_JSON, Network.class); + + assertThat(network.getId(), is(equalTo(ID))); + assertThat(network.getSubnets(), hasItem(equalTo(SUBNET))); + assertThat(network.getStatus(), is(equalTo(STATUS))); + } + + @Test + public void testDeserialization() throws Exception { + testSerialization(); + Network network = objectMapper.readValue(serializedNetwork, Network.class); + + assertThat(network.getName(), is(equalTo(NAME))); + assertThat(network.isAdminStateUp(), is(equalTo(ADMIN_STATE_UP))); + assertThat(network.getShared(), is(equalTo(SHARED))); + assertThat(network.getTenantId(), is(equalTo(TENANT_ID))); + assertThat(network.getRouterExternal(), is(equalTo(ROUTER_EXTERNAL))); + assertThat(network.getProviderNetworkType(), is(equalTo(PROVIDER_NETWORK_TYPE))); + assertThat(network.getProviderPhysicalNetwork(), is(equalTo(PROVIDER_PHYSICAL_NETWORK))); + assertThat(network.getProviderSegmentationId(), is(equalTo(PROVIDER_SEGMENTATION_ID))); + } +} diff --git a/quantum-model/src/test/java/com/woorea/openstack/quantum/model/PortTest.java b/quantum-model/src/test/java/com/woorea/openstack/quantum/model/PortTest.java index 04b2e9650..8ebc65684 100644 --- a/quantum-model/src/test/java/com/woorea/openstack/quantum/model/PortTest.java +++ b/quantum-model/src/test/java/com/woorea/openstack/quantum/model/PortTest.java @@ -1,164 +1,164 @@ -package com.woorea.openstack.quantum.model; - -import static org.hamcrest.CoreMatchers.equalTo; -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.CoreMatchers.not; -import static org.junit.Assert.assertThat; -import static org.junit.matchers.JUnitMatchers.containsString; -import static org.junit.matchers.JUnitMatchers.hasItem; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import org.codehaus.jackson.map.DeserializationConfig; -import org.codehaus.jackson.map.ObjectMapper; -import org.codehaus.jackson.map.SerializationConfig; -import org.codehaus.jackson.map.annotate.JsonSerialize.Inclusion; -import org.hamcrest.BaseMatcher; -import org.hamcrest.Description; -import org.junit.Before; -import org.junit.Test; - -import com.woorea.openstack.quantum.model.Port.Ip; - -public class PortTest { - - private static final String TENANT_ID = "tenantId"; - - private static final String STATUS = "status"; - - private static final String NETWORK_ID = "networkId"; - - private static final String NAME = "name"; - - private static final String MAC_ADDRESS = "macAddress"; - - private static final String DEVICE_OWNER = "deviceOwner"; - - private static final String DEVICE_ID = "deviceId"; - - private static final String IP_SUBNET_ID = "ipSubnetId"; - - private static final String IP_ADDRESS = "10.0.0.1"; - - private static final boolean ADMIN_STATE_UP = true; - - private static final String SEC_GROUP = "secGroup"; - - private static final String ID = "testId"; - - /** - * JSON with read only attributes. - */ - private static final String PORT_JSON = "{" - + " \"port\" : {" - + " \"id\" : \"" + ID + "\"," - + " \"status\" : \"" + STATUS + "\"" - + " }" - + "}"; - - private ObjectMapper objectMapper; - - private String serializedPort; - - @Before - public void setUp() throws Exception { - objectMapper = initializeObjectMapper(); - } - - public static ObjectMapper initializeObjectMapper() { - ObjectMapper objectMapper = new ObjectMapper(); - objectMapper.setSerializationInclusion(Inclusion.NON_NULL) - .enable(SerializationConfig.Feature.INDENT_OUTPUT) - .enable(SerializationConfig.Feature.WRAP_ROOT_VALUE) - .enable(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE) - .enable(DeserializationConfig.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY); - return objectMapper; - } - - @Test - public void testSerialization() throws Exception { - Port port = new Port(); - port.setId(ID); - port.setAdminStateUp(ADMIN_STATE_UP); - port.setSecurityGroups(Arrays.asList(SEC_GROUP)); - port.setDeviceId(DEVICE_ID); - port.setDeviceOwner(DEVICE_OWNER); - port.setMacAddress(MAC_ADDRESS); - port.setName(NAME); - port.setNetworkId(NETWORK_ID); - port.setStatus(STATUS); - port.setTenantId(TENANT_ID); - - List ips = new ArrayList(); - Ip ip = new Ip(); - ip.setAddress(IP_ADDRESS); - ip.setSubnetId(IP_SUBNET_ID); - ips.add(ip); - port.setList(ips); - - serializedPort = objectMapper.writeValueAsString(port); - assertThat(serializedPort, not(containsString(ID))); - assertThat(serializedPort, not(containsString(STATUS))); - assertThat(serializedPort, containsString("\"admin_state_up\" : " + ADMIN_STATE_UP)); - assertThat(serializedPort, containsString(SEC_GROUP)); - assertThat(serializedPort, containsString(IP_ADDRESS)); - assertThat(serializedPort, containsString(DEVICE_ID)); - assertThat(serializedPort, containsString(DEVICE_OWNER)); - assertThat(serializedPort, containsString(MAC_ADDRESS)); - assertThat(serializedPort, containsString(NAME)); - assertThat(serializedPort, containsString(NETWORK_ID)); - assertThat(serializedPort, containsString(TENANT_ID)); - } - - @Test - public void testSerializationEmpty() throws Exception { - Port port = new Port(); - serializedPort = objectMapper.writeValueAsString(port); - - assertThat(serializedPort, containsString("\"port\" : { }")); - } - - @Test - public void testDeserializationReadOnlyFields() throws Exception { - Port port = objectMapper.readValue(PORT_JSON, Port.class); - - assertThat(port.getId(), is(equalTo(ID))); - assertThat(port.getStatus(), is(equalTo(STATUS))); - } - - @Test - public void testDeserializationAfterSerialization() throws Exception { - testSerialization(); - Port port = objectMapper.readValue(serializedPort, Port.class); - - assertThat(port.getAdminStateUp(), is(equalTo(ADMIN_STATE_UP))); - assertThat(port.getDeviceId(), is(equalTo(DEVICE_ID))); - assertThat(port.getDeviceOwner(), is(equalTo(DEVICE_OWNER))); - assertThat(port.getMacAddress(), is(equalTo(MAC_ADDRESS))); - assertThat(port.getName(), is(equalTo(NAME))); - assertThat(port.getNetworkId(), is(equalTo(NETWORK_ID))); - assertThat(port.getTenantId(), is(equalTo(TENANT_ID))); - - assertThat(port.getSecurityGroups(), hasItem(equalTo(SEC_GROUP))); - assertThat(port.getList(), hasItem(new IpMatcher())); - } - - private final class IpMatcher extends BaseMatcher { - @Override - public boolean matches(Object item) { - assertThat(item, is(Ip.class)); - Ip ip = (Ip) item; - return IP_ADDRESS.equals(ip.getAddress()) && IP_SUBNET_ID.equals(ip.getSubnetId()); - } - - @Override - public void describeTo(Description description) { - description.appendText("an Ip object with address "); - description.appendValue(IP_ADDRESS); - description.appendText(" and subnet id "); - description.appendValue(IP_SUBNET_ID); - } - } -} +package com.woorea.openstack.quantum.model; + +import static org.hamcrest.CoreMatchers.equalTo; +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.CoreMatchers.not; +import static org.junit.Assert.assertThat; +import static org.junit.matchers.JUnitMatchers.containsString; +import static org.junit.matchers.JUnitMatchers.hasItem; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import org.hamcrest.BaseMatcher; +import org.hamcrest.Description; +import org.junit.Before; +import org.junit.Test; + +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; +import com.woorea.openstack.quantum.model.Port.Ip; + +public class PortTest { + + private static final String TENANT_ID = "tenantId"; + + private static final String STATUS = "status"; + + private static final String NETWORK_ID = "networkId"; + + private static final String NAME = "name"; + + private static final String MAC_ADDRESS = "macAddress"; + + private static final String DEVICE_OWNER = "deviceOwner"; + + private static final String DEVICE_ID = "deviceId"; + + private static final String IP_SUBNET_ID = "ipSubnetId"; + + private static final String IP_ADDRESS = "10.0.0.1"; + + private static final boolean ADMIN_STATE_UP = true; + + private static final String SEC_GROUP = "secGroup"; + + private static final String ID = "testId"; + + /** + * JSON with read only attributes. + */ + private static final String PORT_JSON = "{" + + " \"port\" : {" + + " \"id\" : \"" + ID + "\"," + + " \"status\" : \"" + STATUS + "\"" + + " }" + + "}"; + + private ObjectMapper objectMapper; + + private String serializedPort; + + @Before + public void setUp() throws Exception { + objectMapper = initializeObjectMapper(); + } + + public static ObjectMapper initializeObjectMapper() { + ObjectMapper objectMapper = new ObjectMapper(); + objectMapper.setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT) + .enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + return objectMapper; + } + + @Test + public void testSerialization() throws Exception { + Port port = new Port(); + port.setId(ID); + port.setAdminStateUp(ADMIN_STATE_UP); + port.setSecurityGroups(Arrays.asList(SEC_GROUP)); + port.setDeviceId(DEVICE_ID); + port.setDeviceOwner(DEVICE_OWNER); + port.setMacAddress(MAC_ADDRESS); + port.setName(NAME); + port.setNetworkId(NETWORK_ID); + port.setStatus(STATUS); + port.setTenantId(TENANT_ID); + + List ips = new ArrayList(); + Ip ip = new Ip(); + ip.setAddress(IP_ADDRESS); + ip.setSubnetId(IP_SUBNET_ID); + ips.add(ip); + port.setList(ips); + + serializedPort = objectMapper.writeValueAsString(port); + assertThat(serializedPort, not(containsString(ID))); + assertThat(serializedPort, not(containsString(STATUS))); + assertThat(serializedPort, containsString("\"admin_state_up\" : " + ADMIN_STATE_UP)); + assertThat(serializedPort, containsString(SEC_GROUP)); + assertThat(serializedPort, containsString(IP_ADDRESS)); + assertThat(serializedPort, containsString(DEVICE_ID)); + assertThat(serializedPort, containsString(DEVICE_OWNER)); + assertThat(serializedPort, containsString(MAC_ADDRESS)); + assertThat(serializedPort, containsString(NAME)); + assertThat(serializedPort, containsString(NETWORK_ID)); + assertThat(serializedPort, containsString(TENANT_ID)); + } + + @Test + public void testSerializationEmpty() throws Exception { + Port port = new Port(); + serializedPort = objectMapper.writeValueAsString(port); + + assertThat(serializedPort, containsString("\"port\" : { }")); + } + + @Test + public void testDeserializationReadOnlyFields() throws Exception { + Port port = objectMapper.readValue(PORT_JSON, Port.class); + + assertThat(port.getId(), is(equalTo(ID))); + assertThat(port.getStatus(), is(equalTo(STATUS))); + } + + @Test + public void testDeserializationAfterSerialization() throws Exception { + testSerialization(); + Port port = objectMapper.readValue(serializedPort, Port.class); + + assertThat(port.getAdminStateUp(), is(equalTo(ADMIN_STATE_UP))); + assertThat(port.getDeviceId(), is(equalTo(DEVICE_ID))); + assertThat(port.getDeviceOwner(), is(equalTo(DEVICE_OWNER))); + assertThat(port.getMacAddress(), is(equalTo(MAC_ADDRESS))); + assertThat(port.getName(), is(equalTo(NAME))); + assertThat(port.getNetworkId(), is(equalTo(NETWORK_ID))); + assertThat(port.getTenantId(), is(equalTo(TENANT_ID))); + + assertThat(port.getSecurityGroups(), hasItem(equalTo(SEC_GROUP))); + assertThat(port.getList(), hasItem(new IpMatcher())); + } + + private final class IpMatcher extends BaseMatcher { + @Override + public boolean matches(Object item) { + assertThat(item, is(Ip.class)); + Ip ip = (Ip) item; + return IP_ADDRESS.equals(ip.getAddress()) && IP_SUBNET_ID.equals(ip.getSubnetId()); + } + + @Override + public void describeTo(Description description) { + description.appendText("an Ip object with address "); + description.appendValue(IP_ADDRESS); + description.appendText(" and subnet id "); + description.appendValue(IP_SUBNET_ID); + } + } +} diff --git a/quantum-model/src/test/java/com/woorea/openstack/quantum/model/SubnetTest.java b/quantum-model/src/test/java/com/woorea/openstack/quantum/model/SubnetTest.java index aa8651406..5852249a8 100644 --- a/quantum-model/src/test/java/com/woorea/openstack/quantum/model/SubnetTest.java +++ b/quantum-model/src/test/java/com/woorea/openstack/quantum/model/SubnetTest.java @@ -1,148 +1,148 @@ -package com.woorea.openstack.quantum.model; - -import static org.hamcrest.CoreMatchers.equalTo; -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.CoreMatchers.not; -import static org.junit.Assert.assertThat; -import static org.junit.matchers.JUnitMatchers.containsString; -import static org.junit.matchers.JUnitMatchers.hasItem; - -import java.util.Arrays; - -import org.codehaus.jackson.map.ObjectMapper; -import org.hamcrest.BaseMatcher; -import org.hamcrest.Description; -import org.junit.Before; -import org.junit.Test; - -import com.woorea.openstack.quantum.model.Subnet.IpVersion; - -public class SubnetTest { - - private static final String POOL_END = "poolEnd"; - - private static final String POOL_START = "poolStart"; - - private static final String TENANT_ID = "tenantId"; - - private static final String NETWORK_ID = "networkId"; - - private static final String NAME = "name"; - - private static final String HOST_ROUTE = "hostRoute"; - - private static final String GATEWAY = "gw"; - - private static final boolean ENABLE_DHCP = true; - - private static final String ID = "testId"; - - private static final String CIDR = "10.0.0.0/8"; - - private static final String DNS_SERVER = "dnsServer"; - - private static final IpVersion IP_VERSION = IpVersion.IPV4; - - /** - * JSON with read only attributes. - */ - private static final String SUBNET_JSON = "{" - + " \"subnet\" : {" - + " \"id\" : \"" + ID + "\"" - + " }" - + "}"; - - private ObjectMapper objectMapper; - - private String serializedSubnet; - - @Before - public void setUp() throws Exception { - objectMapper = PortTest.initializeObjectMapper(); - } - - @Test - public void testSerialization() throws Exception { - Subnet subnet = new Subnet(); - subnet.setId(ID); - subnet.setCidr(CIDR); - subnet.setDnsNames(Arrays.asList(DNS_SERVER)); - subnet.setEnableDHCP(ENABLE_DHCP); - subnet.setIpversion(IP_VERSION); - subnet.setGw(GATEWAY); - subnet.setHostRoutes(Arrays.asList(HOST_ROUTE)); - subnet.setName(NAME); - subnet.setNetworkId(NETWORK_ID); - subnet.setTenantId(TENANT_ID); - - Pool pool = new Pool(); - pool.setStart(POOL_START); - pool.setEnd(POOL_END); - subnet.setList(Arrays.asList(pool)); - - serializedSubnet = objectMapper.writeValueAsString(subnet); - assertThat(serializedSubnet, not(containsString(ID))); - assertThat(serializedSubnet, containsString(CIDR)); - assertThat(serializedSubnet, containsString(DNS_SERVER)); - assertThat(serializedSubnet, containsString("\"enable_dhcp\" : " + ENABLE_DHCP)); - assertThat(serializedSubnet, containsString(Integer.toString(IP_VERSION.code()))); - assertThat(serializedSubnet, containsString(GATEWAY)); - assertThat(serializedSubnet, containsString(HOST_ROUTE)); - assertThat(serializedSubnet, containsString(NAME)); - assertThat(serializedSubnet, containsString(NETWORK_ID)); - assertThat(serializedSubnet, containsString(TENANT_ID)); - assertThat(serializedSubnet, containsString(POOL_START)); - assertThat(serializedSubnet, containsString(POOL_END)); - } - - @Test - public void testSerializationEmpty() throws Exception { - Subnet subnet = new Subnet(); - serializedSubnet = objectMapper.writeValueAsString(subnet); - - assertThat(serializedSubnet, containsString("\"subnet\" : { }")); - } - - @Test - public void testDeserializationReadOnlyFields() throws Exception { - Subnet subnet = objectMapper.readValue(SUBNET_JSON, Subnet.class); - - assertThat(subnet.getId(), is(equalTo(ID))); - } - - @Test - public void testDeserializationAfterSerialization() throws Exception { - testSerialization(); - Subnet subnet = objectMapper.readValue(serializedSubnet, Subnet.class); - - assertThat(subnet.getCidr(), is(equalTo(CIDR))); - assertThat(subnet.getDnsNames(), hasItem(equalTo(DNS_SERVER))); - assertThat(subnet.isEnableDHCP(), is(equalTo(ENABLE_DHCP))); - assertThat(subnet.getIpversion(), is(equalTo(IP_VERSION))); - assertThat(subnet.getGw(), is(equalTo(GATEWAY))); - assertThat(subnet.getHostRoutes(), hasItem(equalTo(HOST_ROUTE))); - assertThat(subnet.getName(), is(equalTo(NAME))); - assertThat(subnet.getNetworkId(), is(equalTo(NETWORK_ID))); - assertThat(subnet.getTenantId(), is(equalTo(TENANT_ID))); - assertThat(subnet.getList(), hasItem(new PoolMatcher())); - } - - private class PoolMatcher extends BaseMatcher { - - @Override - public void describeTo(Description description) { - description.appendText("a Pool object with start "); - description.appendValue(POOL_START); - description.appendText(" and end "); - description.appendValue(POOL_END); - } - - @Override - public boolean matches(Object item) { - assertThat(item, is(Pool.class)); - Pool pool = (Pool) item; - return POOL_START.equals(pool.getStart()) && POOL_END.equals(pool.getEnd()); - } - - } -} +package com.woorea.openstack.quantum.model; + +import static org.hamcrest.CoreMatchers.equalTo; +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.CoreMatchers.not; +import static org.junit.Assert.assertThat; +import static org.junit.matchers.JUnitMatchers.containsString; +import static org.junit.matchers.JUnitMatchers.hasItem; + +import java.util.Arrays; + +import org.hamcrest.BaseMatcher; +import org.hamcrest.Description; +import org.junit.Before; +import org.junit.Test; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.woorea.openstack.quantum.model.Subnet.IpVersion; + +public class SubnetTest { + + private static final String POOL_END = "poolEnd"; + + private static final String POOL_START = "poolStart"; + + private static final String TENANT_ID = "tenantId"; + + private static final String NETWORK_ID = "networkId"; + + private static final String NAME = "name"; + + private static final String HOST_ROUTE = "hostRoute"; + + private static final String GATEWAY = "gw"; + + private static final boolean ENABLE_DHCP = true; + + private static final String ID = "testId"; + + private static final String CIDR = "10.0.0.0/8"; + + private static final String DNS_SERVER = "dnsServer"; + + private static final IpVersion IP_VERSION = IpVersion.IPV4; + + /** + * JSON with read only attributes. + */ + private static final String SUBNET_JSON = "{" + + " \"subnet\" : {" + + " \"id\" : \"" + ID + "\"" + + " }" + + "}"; + + private ObjectMapper objectMapper; + + private String serializedSubnet; + + @Before + public void setUp() throws Exception { + objectMapper = PortTest.initializeObjectMapper(); + } + + @Test + public void testSerialization() throws Exception { + Subnet subnet = new Subnet(); + subnet.setId(ID); + subnet.setCidr(CIDR); + subnet.setDnsNames(Arrays.asList(DNS_SERVER)); + subnet.setEnableDHCP(ENABLE_DHCP); + subnet.setIpversion(IP_VERSION); + subnet.setGw(GATEWAY); + subnet.setHostRoutes(Arrays.asList(HOST_ROUTE)); + subnet.setName(NAME); + subnet.setNetworkId(NETWORK_ID); + subnet.setTenantId(TENANT_ID); + + Pool pool = new Pool(); + pool.setStart(POOL_START); + pool.setEnd(POOL_END); + subnet.setList(Arrays.asList(pool)); + + serializedSubnet = objectMapper.writeValueAsString(subnet); + assertThat(serializedSubnet, not(containsString(ID))); + assertThat(serializedSubnet, containsString(CIDR)); + assertThat(serializedSubnet, containsString(DNS_SERVER)); + assertThat(serializedSubnet, containsString("\"enable_dhcp\" : " + ENABLE_DHCP)); + assertThat(serializedSubnet, containsString(Integer.toString(IP_VERSION.code()))); + assertThat(serializedSubnet, containsString(GATEWAY)); + assertThat(serializedSubnet, containsString(HOST_ROUTE)); + assertThat(serializedSubnet, containsString(NAME)); + assertThat(serializedSubnet, containsString(NETWORK_ID)); + assertThat(serializedSubnet, containsString(TENANT_ID)); + assertThat(serializedSubnet, containsString(POOL_START)); + assertThat(serializedSubnet, containsString(POOL_END)); + } + + @Test + public void testSerializationEmpty() throws Exception { + Subnet subnet = new Subnet(); + serializedSubnet = objectMapper.writeValueAsString(subnet); + + assertThat(serializedSubnet, containsString("\"subnet\" : { }")); + } + + @Test + public void testDeserializationReadOnlyFields() throws Exception { + Subnet subnet = objectMapper.readValue(SUBNET_JSON, Subnet.class); + + assertThat(subnet.getId(), is(equalTo(ID))); + } + + @Test + public void testDeserializationAfterSerialization() throws Exception { + testSerialization(); + Subnet subnet = objectMapper.readValue(serializedSubnet, Subnet.class); + + assertThat(subnet.getCidr(), is(equalTo(CIDR))); + assertThat(subnet.getDnsNames(), hasItem(equalTo(DNS_SERVER))); + assertThat(subnet.isEnableDHCP(), is(equalTo(ENABLE_DHCP))); + assertThat(subnet.getIpversion(), is(equalTo(IP_VERSION))); + assertThat(subnet.getGw(), is(equalTo(GATEWAY))); + assertThat(subnet.getHostRoutes(), hasItem(equalTo(HOST_ROUTE))); + assertThat(subnet.getName(), is(equalTo(NAME))); + assertThat(subnet.getNetworkId(), is(equalTo(NETWORK_ID))); + assertThat(subnet.getTenantId(), is(equalTo(TENANT_ID))); + assertThat(subnet.getList(), hasItem(new PoolMatcher())); + } + + private class PoolMatcher extends BaseMatcher { + + @Override + public void describeTo(Description description) { + description.appendText("a Pool object with start "); + description.appendValue(POOL_START); + description.appendText(" and end "); + description.appendValue(POOL_END); + } + + @Override + public boolean matches(Object item) { + assertThat(item, is(Pool.class)); + Pool pool = (Pool) item; + return POOL_START.equals(pool.getStart()) && POOL_END.equals(pool.getEnd()); + } + + } +} diff --git a/swift-client/src/main/java/com/woorea/openstack/swift/api/ContainerResource.java b/swift-client/src/main/java/com/woorea/openstack/swift/api/ContainerResource.java index c55babe95..df15d8b1a 100644 --- a/swift-client/src/main/java/com/woorea/openstack/swift/api/ContainerResource.java +++ b/swift-client/src/main/java/com/woorea/openstack/swift/api/ContainerResource.java @@ -1,143 +1,101 @@ package com.woorea.openstack.swift.api; +import java.io.InputStream; import java.util.Map; - +import com.woorea.openstack.base.client.Entity; +import com.woorea.openstack.base.client.HttpMethod; import com.woorea.openstack.base.client.OpenStackClient; import com.woorea.openstack.base.client.OpenStackRequest; import com.woorea.openstack.base.client.OpenStackResponse; import com.woorea.openstack.swift.model.ObjectDownload; import com.woorea.openstack.swift.model.ObjectForUpload; +import com.woorea.openstack.swift.model.Objects; -public class ContainerResource { - - private final OpenStackClient CLIENT; - - private String container; - - public ContainerResource(OpenStackClient client, String container) { - CLIENT = client; - this.container = container; - } - - public List list() { - return new List(container, null); - } - - public CreateDirectory createDirectory(String path) { - return new CreateDirectory(container, path); - } - - public Show show(String path) { - return new Show(container, path); - } - - public Upload upload(ObjectForUpload objectForUpload) { - return new Upload(objectForUpload); - } - - public Download download(String path) { - return new Download(container, path); - } - - public Delete delete(String path) { - return new Delete(container, path); - } - - public class List extends OpenStackRequest> { - - private String containerName; - - private Map filters; - - public List(String containerName, Map filters) { - this.containerName = containerName; - this.filters = filters; - //returnType(new TypeToken>(){}); -// target = target.path(containerName); -// for(String filter : new String[]{"prefix","delimiter","path","marker"}) { -// if(filters.get(filter) != null) { -// target = target.queryParam(filter, filters.get(filter)); -// } -// } -// return target.request(MediaType.APPLICATION_JSON).get(new GenericType>(){}); - } - - } - - public class CreateDirectory extends OpenStackRequest { - - private String container; - - private String path; - - public CreateDirectory(String container, String path) { - this.container = container; - this.path = path; -// endpoint.path(container).path(path).request().put(Entity.entity(new byte[1],"application/directory")); - } - - } - - public class Show extends OpenStackRequest { - - private String containerName; - - private String objectName; - - public Show(String containerName, String objectName) { - this.containerName = containerName; - this.objectName = objectName; -// return target.path(containerName).path(objectName).request(MediaType.APPLICATION_JSON).head(); - } - - } - - public class Upload extends OpenStackRequest { - - private ObjectForUpload objectForUpload; - - public Upload(ObjectForUpload objectForUpload) { - this.objectForUpload = objectForUpload; -// Invocation.Builder invocationBuilder = target.path(objectForUpload.getContainer()).path(objectForUpload.getName()).request(MediaType.APPLICATION_JSON); -// for(String key : objectForUpload.getProperties().keySet()) { -// invocationBuilder.header("x-object-meta-" + key, objectForUpload.getProperties().get(key)); -// } -// return invocationBuilder.put(Entity.entity(objectForUpload.getInputStream(), MediaType.APPLICATION_OCTET_STREAM), Response.class); - } - - } - - public class Download extends OpenStackRequest { - - private String containerName; - - private String objectName; - - public Download(String containerName, String objectName) { - this.containerName = containerName; - this.objectName = objectName; -// Response response = target.path(containerName).path(objectName).request(MediaType.APPLICATION_JSON).get(); -// ObjectDownload objectDownload = new ObjectDownload(); -// objectDownload.setInputStream((InputStream) response.getEntity()); -// return objectDownload; - } - - } - - - public class Delete extends OpenStackRequest { - - private String containerName; - - private String objectName; - - public Delete(String containerName, String objectName) { - this.containerName = containerName; - this.objectName = objectName; - //return target.path(containerName).path(objectName).request(MediaType.APPLICATION_JSON).delete(); - } - - } +public class ContainerResource { + private final OpenStackClient CLIENT; + private String container; + + public ContainerResource(OpenStackClient client, String container) { + CLIENT = client; + this.container = container; + } + + public List list() { + return new List(container, null); + } + + public CreateDirectory createDirectory(String path) { + return new CreateDirectory(container, path); + } + + public Show show(String path) { + return new Show(container, path); + } + + public Upload upload(ObjectForUpload objectForUpload) { + return new Upload(objectForUpload); + } + + public Download download(String path) { + return new Download(container, path); + } + + public Delete delete(String path) { + return new Delete(container, path); + } + + public class List extends OpenStackRequest { + public List(String containerName, Map filters) { + super(CLIENT, HttpMethod.GET, "/" + container + "/", null, + Objects.class); + } + } + + public class CreateDirectory extends OpenStackRequest { + public CreateDirectory(String container, String path) { + super(CLIENT, HttpMethod.PUT, buildPath(container, "/", path), + Entity.json("*"), null); + } + } + + public class Show extends OpenStackRequest { + public Show(String containerName, String objectName) { + super(CLIENT, HttpMethod.GET, + buildPath(containerName, "/", objectName), Entity.json("*"), + Object.class); + } + } + + public class Upload extends OpenStackRequest { + public Upload(ObjectForUpload objectForUpload) { + super(CLIENT, HttpMethod.PUT, + buildPath(objectForUpload.getContainer(), "/", + objectForUpload.getName()), + new Entity(objectForUpload.getInputStream(), + objectForUpload.getProperties().get("Content-Type") + .toString()), null); + + for (String key : objectForUpload.getProperties().keySet()) { + header("x-object-meta-" + key, + objectForUpload.getProperties().get(key)); + } + } + } + + public class Download extends OpenStackRequest { + public Download(String containerName, String objectName) { + super(CLIENT, HttpMethod.GET, + buildPath(containerName, "/", objectName), null, + ObjectDownload.class); + } + } + + public class Delete extends OpenStackRequest { + public Delete(String containerName, String objectName) { + super(CLIENT, HttpMethod.DELETE, + buildPath(containerName, "/", objectName), null, null); + } + } } diff --git a/swift-client/src/main/java/com/woorea/openstack/swift/api/ContainersResource.java b/swift-client/src/main/java/com/woorea/openstack/swift/api/ContainersResource.java index aedcc3ff9..41bd59090 100644 --- a/swift-client/src/main/java/com/woorea/openstack/swift/api/ContainersResource.java +++ b/swift-client/src/main/java/com/woorea/openstack/swift/api/ContainersResource.java @@ -1,74 +1,118 @@ package com.woorea.openstack.swift.api; +import java.util.HashMap; +import java.util.Map; +import com.woorea.openstack.base.client.Entity; +import com.woorea.openstack.base.client.HttpMethod; import com.woorea.openstack.base.client.OpenStackClient; import com.woorea.openstack.base.client.OpenStackRequest; import com.woorea.openstack.swift.model.Container; +import com.woorea.openstack.swift.model.Containers; + public class ContainersResource { - - private final OpenStackClient CLIENT; - - public ContainersResource(OpenStackClient client) { - CLIENT = client; - } - - public List list() { - return new List(); - } - - public Create create(String name) { - return new Create(name); - } - - public Show show(String name) { - return new Show(name); - } - - public Delete delete(String name) { - return new Delete(name); - } - - public ContainerResource container(String name) { - return new ContainerResource(CLIENT, name); - } - - public class List extends OpenStackRequest> { - - public List() { - //return target.request(MediaType.APPLICATION_JSON).get(new GenericType>(){}); - } - - } - - - public class Create extends OpenStackRequest { - - public Create(String containerName) { - //return target.path(containerName).request().method("PUT",Entity.text("*")); - } - - } - - public class Show extends OpenStackRequest { - - private String containerName; - - public Show(String containerName) { -// return target.path(containerName).request(MediaType.APPLICATION_JSON).head(); - } - - } - - public class Delete extends OpenStackRequest { - - private String containerName; - - public Delete(String containerName) { - this.containerName = containerName; - //return target.path(containerName).request(MediaType.APPLICATION_JSON).delete(); - } - - } - + private final OpenStackClient CLIENT; + + public ContainersResource(OpenStackClient client) { + CLIENT = client; + } + + public List list() { + return new List(); + } + + public Create create(String name) { + return new Create(name, null); + } + + public Create create(String name, boolean isPublic) { + Map props = new HashMap(); + + if (isPublic) { + props.put("X-Container-Read", ".r:*,.rlistings"); + props.put("X-Container-Write", "*"); + } + + return create(name, props); + } + + public Create create(String name, Map props) { + return new Create(name, props); + } + + public Update update(String name, boolean isPublic) { + Map props = new HashMap(); + + if (isPublic) { + props.put("X-Container-Read", ".r:*,.rlistings"); + props.put("X-Container-Write", "*"); + } + + return update(name, props); + } + + public Update update(String name, Map props) { + return new Update(name, props); + } + + public Show show(String name) { + return new Show(name); + } + + public Delete delete(String name) { + return new Delete(name); + } + + public ContainerResource container(String name) { + return new ContainerResource(CLIENT, name); + } + + public class List extends OpenStackRequest { + public List() { + super(CLIENT, HttpMethod.GET, "/", null, Containers.class); + + //return target.request(MediaType.APPLICATION_JSON).get(new GenericType>(){}); + } + } + + public class Create extends OpenStackRequest { + public Create(String containerName, Map properties) { + super(CLIENT, HttpMethod.PUT, buildPath(containerName), + Entity.json("*"), null); + + if (properties != null) { + for (String key : properties.keySet()) { + header(key, properties.get(key)); + } + } + } + } + + public class Update extends OpenStackRequest { + public Update(String containerName, Map properties) { + super(CLIENT, HttpMethod.POST, buildPath(containerName), + Entity.json("*"), null); + + if (properties != null) { + for (String key : properties.keySet()) { + header(key, properties.get(key)); + } + } + } + } + + public class Show extends OpenStackRequest { + public Show(String containerName) { + super(CLIENT, HttpMethod.GET, buildPath(containerName), + Entity.json("*"), Container.class); + } + } + + public class Delete extends OpenStackRequest { + public Delete(String containerName) { + super(CLIENT, HttpMethod.DELETE, buildPath(containerName), null, + null); + } + } } diff --git a/swift-model/src/main/java/com/woorea/openstack/swift/model/Container.java b/swift-model/src/main/java/com/woorea/openstack/swift/model/Container.java index 62a002ade..f61c435b2 100644 --- a/swift-model/src/main/java/com/woorea/openstack/swift/model/Container.java +++ b/swift-model/src/main/java/com/woorea/openstack/swift/model/Container.java @@ -2,7 +2,7 @@ import java.io.Serializable; -import org.codehaus.jackson.annotate.JsonProperty; +import com.fasterxml.jackson.annotation.JsonProperty; public class Container implements Serializable { diff --git a/swift-model/src/main/java/com/woorea/openstack/swift/model/Object.java b/swift-model/src/main/java/com/woorea/openstack/swift/model/Object.java index d53ee65d6..39d366e33 100644 --- a/swift-model/src/main/java/com/woorea/openstack/swift/model/Object.java +++ b/swift-model/src/main/java/com/woorea/openstack/swift/model/Object.java @@ -3,107 +3,110 @@ import java.io.Serializable; import java.util.Calendar; -import org.codehaus.jackson.annotate.JsonProperty; +import com.fasterxml.jackson.annotation.JsonProperty; public class Object implements Serializable { - - private String subdir; - - private String name; - - private String hash; - - private int bytes; - - @JsonProperty("content_type") - private String contentType; - - @JsonProperty("last_modified") - private Calendar lastModified; - - /** - * @return the subdir - */ - public String getSubdir() { - return subdir; - } - - /** - * @param subdir the subdir to set - */ - public void setSubdir(String subdir) { - this.subdir = subdir; - } - - /** - * @return the name - */ - public String getName() { - return name; - } - - /** - * @param name the name to set - */ - public void setName(String name) { - this.name = name; - } - - /** - * @return the hash - */ - public String getHash() { - return hash; - } - - /** - * @param hash the hash to set - */ - public void setHash(String hash) { - this.hash = hash; - } - - /** - * @return the bytes - */ - public int getBytes() { - return bytes; - } - - /** - * @param bytes the bytes to set - */ - public void setBytes(int bytes) { - this.bytes = bytes; - } - - /** - * @return the contentType - */ - public String getContentType() { - return contentType; - } - - /** - * @param contentType the contentType to set - */ - public void setContentType(String contentType) { - this.contentType = contentType; - } - - /** - * @return the lastModified - */ - public Calendar getLastModified() { - return lastModified; - } - - /** - * @param lastModified the lastModified to set - */ - public void setLastModified(Calendar lastModified) { - this.lastModified = lastModified; - } - + private String subdir; + private String name; + private String hash; + private int bytes; + @JsonProperty("content_type") + private String contentType; + @JsonProperty("last_modified") + private Calendar lastModified; + + /** + * @return the subdir + */ + public String getSubdir() { + return subdir; + } + + /** + * @param subdir the subdir to set + */ + public void setSubdir(String subdir) { + this.subdir = subdir; + } + + /** + * @return the name + */ + public String getName() { + return name; + } + + /** + * @param name the name to set + */ + public void setName(String name) { + this.name = name; + } + + /** + * @return the hash + */ + public String getHash() { + return hash; + } + + /** + * @param hash the hash to set + */ + public void setHash(String hash) { + this.hash = hash; + } + + /** + * @return the bytes + */ + public int getBytes() { + return bytes; + } + + /** + * @param bytes the bytes to set + */ + public void setBytes(int bytes) { + this.bytes = bytes; + } + + /** + * @return the contentType + */ + public String getContentType() { + return contentType; + } + + /** + * @param contentType the contentType to set + */ + public void setContentType(String contentType) { + this.contentType = contentType; + } + + /** + * @return the lastModified + */ + public Calendar getLastModified() { + return lastModified; + } + + /** + * @param lastModified the lastModified to set + */ + public void setLastModified(Calendar lastModified) { + this.lastModified = lastModified; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Object [name=" + name + ", bytes=" + bytes + + ", content_type=" + contentType + ", last_modified=" + lastModified + + ", hash=" + hash + "]"; + } } From 565f1b79a052c9a67006d8660aca122d7a08ce4f Mon Sep 17 00:00:00 2001 From: Daniele Date: Sat, 15 Mar 2014 01:33:14 +0100 Subject: [PATCH 2/6] tested version --- .gitignore | 42 +- .travis.yml | 4 +- LICENSE.txt | 404 +++--- README.textile | 282 ++--- bundle.sh | 2 +- ceilometer-client/pom.xml | 46 +- .../openstack/ceilometer/Ceilometer.java | 68 +- .../QueriableCeilometerCommand.java | 116 +- .../ceilometer/v2/api/ResourcesResource.java | 90 +- ceilometer-model/pom.xml | 22 +- glance-client/pom.xml | 46 +- .../com/woorea/openstack/glance/Glance.java | 60 +- glance-model/pom.xml | 20 +- .../openstack/glance/model/ImageDownload.java | 78 +- .../openstack/glance/model/ImageUpload.java | 134 +- .../openstack/glance/model/SharedImage.java | 8 +- heat-client/pom.xml | 46 +- .../java/com/woorea/openstack/heat/Heat.java | 62 +- .../openstack/heat/ResourcesResource.java | 62 +- .../woorea/openstack/heat/StackResource.java | 122 +- heat-model/pom.xml | 20 +- keystone-client/.gitignore | 1 + keystone-client/pom.xml | 44 +- .../keystone/api/EndpointsResource.java | 142 +-- .../openstack/keystone/api/RolesResource.java | 116 +- .../keystone/api/ServicesResource.java | 140 +-- .../keystone/api/TenantsResource.java | 270 ++-- .../keystone/api/TokensResource.java | 148 +-- .../keystone/utils/KeystoneTokenProvider.java | 112 +- .../keystone/utils/KeystoneUtils.java | 56 +- .../keystone/v3/api/CredentialsResources.java | 26 +- .../v3/api/DomainGroupRolesResource.java | 26 +- .../v3/api/DomainUserRolesResource.java | 48 +- .../keystone/v3/api/DomainsResource.java | 42 +- .../keystone/v3/api/EndpointsResource.java | 26 +- .../keystone/v3/api/GenericResource.java | 88 +- .../keystone/v3/api/GroupUsersResource.java | 28 +- .../keystone/v3/api/GroupsResource.java | 34 +- .../v3/api/ProjectGroupRolesResource.java | 68 +- .../keystone/v3/api/ProjectRolesResource.java | 54 +- .../v3/api/ProjectUserRolesResource.java | 26 +- .../keystone/v3/api/ProjectsResource.java | 54 +- .../keystone/v3/api/RolesResource.java | 38 +- .../keystone/v3/api/ServicesResource.java | 26 +- .../keystone/v3/api/TokensResource.java | 84 +- .../keystone/v3/api/UsersResource.java | 54 +- keystone-model/.gitignore | 2 + keystone-model/pom.xml | 20 +- .../openstack/keystone/model/Extra.java | 27 + .../woorea/openstack/keystone/model/Link.java | 84 +- .../openstack/keystone/model/Token.java | 102 +- nova-client/pom.xml | 44 +- .../nova/api/ExtensionsResource.java | 60 +- .../openstack/nova/api/FlavorsResource.java | 170 +-- .../openstack/nova/api/ImagesResource.java | 170 +-- .../openstack/nova/api/QuotaSetsResource.java | 122 +- .../openstack/nova/api/ServersResource.java | 1082 ++++++++--------- .../api/extensions/CloudpipesExtension.java | 98 +- .../api/extensions/CredentialsExtension.java | 86 +- .../extensions/FloatingIpDnsExtension.java | 178 +-- .../extensions/FloatingIpPoolsExtension.java | 62 +- .../nova/api/extensions/HostsExtension.java | 88 +- .../api/extensions/HypervisorsExtension.java | 10 +- .../api/extensions/KeyPairsExtension.java | 130 +- .../api/extensions/NetworksExtension.java | 164 +-- .../extensions/SecurityGroupsExtension.java | 368 +++--- .../api/extensions/SnapshotsExtension.java | 172 +-- .../nova/api/extensions/VolumesExtension.java | 212 ++-- nova-model/pom.xml | 20 +- .../com/woorea/openstack/nova/model/Link.java | 84 +- .../woorea/openstack/nova/model/Metadata.java | 52 +- .../openstack/nova/model/PersonalityFile.java | 78 +- .../jersey-connector/pom.xml | 46 +- .../connector/JerseyLoggingFilter.java | 556 ++++----- .../jersey2-connector/pom.xml | 66 +- .../openstack/connector/JaxRs20Connector.java | 130 +- .../openstack/connector/JaxRs20Response.java | 96 +- openstack-client-connectors/pom.xml | 94 +- .../resteasy-connector/pom.xml | 54 +- .../connector/RESTEasyInputStream.java | 74 +- openstack-client/.gitignore | 2 + openstack-client/pom.xml | 20 +- .../openstack/base/client/HttpMethod.java | 10 +- .../base/client/OpenStackClient.java | 172 +-- .../base/client/OpenStackClientConnector.java | 16 +- .../base/client/OpenStackCommand.java | 16 +- .../base/client/OpenStackResponse.java | 32 +- .../client/OpenStackResponseException.java | 48 +- .../base/client/OpenStackResponseStatus.java | 22 +- .../client/OpenStackSimpleTokenProvider.java | 40 +- .../base/client/OpenStackTokenProvider.java | 18 +- .../client/AbstractOpenStackClient.java | 250 ++-- .../common/session/OpenStackSession.java | 214 ++-- .../session/OpenStackSessionHolder.java | 32 +- openstack-console/pom.xml | 152 +-- .../com/woorea/openstack/console/Command.java | 42 +- .../openstack/console/CommandLineHelper.java | 142 +-- .../com/woorea/openstack/console/Console.java | 222 ++-- .../woorea/openstack/console/Environment.java | 60 +- .../com/woorea/openstack/console/Main.java | 54 +- .../console/keystone/KeystoneCommand.java | 48 +- .../console/keystone/KeystoneEnvironment.java | 126 +- .../console/keystone/KeystoneRoleCreate.java | 138 +-- .../console/keystone/KeystoneRoleDelete.java | 50 +- .../console/keystone/KeystoneRoleList.java | 96 +- .../console/keystone/KeystoneServiceList.java | 96 +- .../keystone/KeystoneTenantCreate.java | 138 +-- .../keystone/KeystoneTenantDelete.java | 50 +- .../console/keystone/KeystoneTenantList.java | 96 +- .../console/keystone/KeystoneUserCreate.java | 150 +-- .../console/keystone/KeystoneUserDelete.java | 50 +- .../console/keystone/KeystoneUserList.java | 100 +- .../console/keystone/KeystoneUserShow.java | 106 +- .../openstack/console/nova/NovaCommand.java | 50 +- .../console/nova/NovaEnvironment.java | 130 +- .../console/nova/NovaServerList.java | 88 +- .../openstack/console/utils/Column.java | 130 +- .../openstack/console/utils/ConsoleUtils.java | 94 +- .../woorea/openstack/console/utils/Table.java | 162 +-- .../openstack/console/utils/TableModel.java | 50 +- .../src/main/resources/console.properties | 10 +- openstack-examples/logging.properties | 8 + openstack-examples/pom.xml | 164 +-- .../examples/compute/NovaCreateServer.java | 180 +-- .../examples/compute/NovaListFlavors.java | 102 +- .../examples/compute/NovaListImages.java | 104 +- .../examples/compute/NovaListServers.java | 76 +- .../examples/compute/NovaStopStartServer.java | 80 +- .../hpcloud/KeystoneAuthentication.java | 58 +- .../keystone/KeystoneCreateTenant.java | 72 +- .../examples/keystone/KeystoneCreateUser.java | 76 +- .../ContainersMessageBodyReader.java | 59 + .../ObjectDownloadMessageBodyReader.java | 47 + .../objectstore/PseudoFileSystem.java | 121 ++ .../examples/objectstore/SwiftExample2.java | 97 ++ .../simple/OpenStackSimpleClient.java | 30 +- quantum-client/pom.xml | 46 +- .../com/woorea/openstack/quantum/Quantum.java | 102 +- .../quantum/api/NetworksResource.java | 168 +-- .../openstack/quantum/api/PortsResource.java | 170 +-- .../quantum/api/RoutersResource.java | 204 ++-- .../quantum/api/SubnetsResource.java | 168 +-- quantum-model/pom.xml | 38 +- .../openstack/quantum/model/HostRoute.java | 54 +- .../woorea/openstack/quantum/model/Pool.java | 80 +- swift-client/.gitignore | 1 + swift-client/pom.xml | 44 +- .../com/woorea/openstack/swift/Swift.java | 66 +- swift-model/.gitignore | 2 + swift-model/pom.xml | 20 +- .../deserializer/ContainersDeserializer.java | 21 + .../deserializer/ObjectsDeserializer.java | 20 + .../openstack/swift/model/Containers.java | 48 + .../woorea/openstack/swift/model/Objects.java | 48 + 154 files changed, 7443 insertions(+), 6939 deletions(-) create mode 100644 keystone-client/.gitignore create mode 100644 keystone-model/.gitignore create mode 100644 keystone-model/src/main/java/com/woorea/openstack/keystone/model/Extra.java create mode 100644 openstack-client/.gitignore create mode 100644 openstack-examples/logging.properties create mode 100644 openstack-examples/src/main/java/com/woorea/openstack/examples/objectstore/ContainersMessageBodyReader.java create mode 100644 openstack-examples/src/main/java/com/woorea/openstack/examples/objectstore/ObjectDownloadMessageBodyReader.java create mode 100644 openstack-examples/src/main/java/com/woorea/openstack/examples/objectstore/PseudoFileSystem.java create mode 100644 openstack-examples/src/main/java/com/woorea/openstack/examples/objectstore/SwiftExample2.java create mode 100644 swift-client/.gitignore create mode 100644 swift-model/.gitignore create mode 100644 swift-model/src/main/java/com/woorea/openstack/swift/deserializer/ContainersDeserializer.java create mode 100644 swift-model/src/main/java/com/woorea/openstack/swift/deserializer/ObjectsDeserializer.java create mode 100644 swift-model/src/main/java/com/woorea/openstack/swift/model/Containers.java create mode 100644 swift-model/src/main/java/com/woorea/openstack/swift/model/Objects.java diff --git a/.gitignore b/.gitignore index a9ddaa685..db1f55091 100644 --- a/.gitignore +++ b/.gitignore @@ -1,22 +1,22 @@ -*~ -*.iml -.idea/ -.settings/ -.classpath -.project -.settings/ -target/ -bin/logs/ - - -openstack-api/test-output/ -openstack-ui/src/main/webapp/META-INF/ -openstack-ui/src/main/webapp/WEB-INF/deploy/ -openstack-ui/src/main/webapp/WEB-INF/classes/ -openstack-ui/src/main/gwt-unitCache/ -openstack-ui/src/main/webapp/ui/ -openstack-ui/src/main/webapp/WEB-INF/lib/ -openstack-ui/.gwt/ -openstack-ui/deploy.sh -test-output/ +*~ +*.iml +.idea/ +.settings/ +.classpath +.project +.settings/ +target/ +bin/logs/ + + +openstack-api/test-output/ +openstack-ui/src/main/webapp/META-INF/ +openstack-ui/src/main/webapp/WEB-INF/deploy/ +openstack-ui/src/main/webapp/WEB-INF/classes/ +openstack-ui/src/main/gwt-unitCache/ +openstack-ui/src/main/webapp/ui/ +openstack-ui/src/main/webapp/WEB-INF/lib/ +openstack-ui/.gwt/ +openstack-ui/deploy.sh +test-output/ bin \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index f2ad391ed..dee18f982 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,3 @@ -language: java - +language: java + install: mvn clean package -DskipTests=true \ No newline at end of file diff --git a/LICENSE.txt b/LICENSE.txt index d64569567..75b52484e 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,202 +1,202 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed 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. diff --git a/README.textile b/README.textile index ff07ffab2..ee73c947e 100644 --- a/README.textile +++ b/README.textile @@ -1,142 +1,142 @@ -h1. OpenStack Java SDK v2.0 - -h1. Important - -You can continue using the latest source from v1.x essex branch - -h2. Maven - -|groupId|artifactId|version| -|com.woorea|keystone-client|3.0.0-SNAPSHOT| -|com.woorea|nova-client|3.0.0-SNAPSHOT| -|com.woorea|glance-client|3.0.0-SNAPSHOT| -|com.woorea|swift-client|3.0.0-SNAPSHOT| - -h3. Maven Repositories - -https://maven.java.net/content/repositories/snapshots -https://raw.github.com/woorea/maven/master/snapshots - -h1. Available artifacts - -h2. OpenStack Identity Service - -OpenStack Keystone Model - -OpenStack Keystone Client - -
-KeystoneClient keystone = new KeystoneClient(KEYSTONE_AUTH_URL);
-Authentication authentication = new Authentication();
-PasswordCredentials passwordCredentials = new PasswordCredentials();
-passwordCredentials.setUsername(KEYSTONE_USERNAME);
-passwordCredentials.setPassword(KEYSTONE_PASSWORD);
-authentication.setPasswordCredentials(passwordCredentials);
-
-//access with unscoped token
-Access access = keystone.execute(new Authenticate(authentication));
-
-//use the token in the following requests
-keystone.setToken(access.getToken().getId());
-
-Tenants tenants = keystone.execute(new ListTenants());
-
-//try to exchange token using the first tenant
-if(tenants.getList().size() > 0) {
-	
-	authentication = new Authentication();
-	Token token = new Token();
-	token.setId(access.getToken().getId());
-	authentication.setToken(token);
-	authentication.setTenantId(tenants.getList().get(0).getId());
-	
-	access = keystone.execute(new Authenticate(authentication));
-	
-	...
-
- -h2. OpenStack Compute Service - -OpenStack Nova Model - -OpenStack Nova Client - -
-NovaClient novaClient = new NovaClient(KeystoneUtils.findEndpointURL(access.getServiceCatalog(), "compute", null, "public"), access.getToken().getId());
-			
-Servers servers = novaClient.execute(ServersCore.listServers());
-for(Server server : servers) {
-	System.out.println(server);
-}
-
- -h2. OpenStack Image Store Service - -OpenStack Glance Model - -OpenStack Glance Client - -h2. OpenStack Object Store Service - -OpenStack Swift Model - -OpenStack Swift Client - -h2. OpenStack Ceilometer Service - -h3. MongoDB Installation - -OpenStack Ceilometer Service uses MongoDB as storage. - -h3. Ceilometer Compute Agent Installation - -OpenStack Ceilometer Compute Agent - -This artefact should be installed on each compute node - -
-mvn clean compile assembly:assembly
-Properties can be configured in /etc/ceilometer/ceilometer-agent.properties
-java -jar ceilometer-compute-agent-jar-with-dependencies.jar 
-
- -h3. Ceilometer Collector Installation - -OpenStack Ceilometer Collector - -
-mvn clean compile assembly:assembly
-Properties can be configured in /etc/ceilometer/ceilometer-collector.properties
-java -jar ceilometer-collector.jar 
-
- -h3. OpenStack Ceilometer API Installation - -OpenStack Ceilometer API - -
-mvn clean compile assembly:assembly
-Properties can be configured in /etc/ceilometer/ceilometer-api.properties
-java -jar ceilometer-api.jar 
-
-OpenStack Ceilometer Client - -h1. License - -
-This software is licensed under the Apache 2 license, quoted below.
-
-Copyright 2012 Luis Gervaso and OpenStack Java SDK
-
-Licensed 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.
+h1. OpenStack Java SDK v2.0
+
+h1. Important
+
+You can continue using the latest source from v1.x essex branch
+
+h2. Maven
+
+|groupId|artifactId|version|
+|com.woorea|keystone-client|3.0.0-SNAPSHOT|
+|com.woorea|nova-client|3.0.0-SNAPSHOT|
+|com.woorea|glance-client|3.0.0-SNAPSHOT|
+|com.woorea|swift-client|3.0.0-SNAPSHOT|
+
+h3. Maven Repositories
+
+https://maven.java.net/content/repositories/snapshots
+https://raw.github.com/woorea/maven/master/snapshots
+
+h1. Available artifacts
+
+h2. OpenStack Identity Service
+
+OpenStack Keystone Model
+
+OpenStack Keystone Client
+
+
+KeystoneClient keystone = new KeystoneClient(KEYSTONE_AUTH_URL);
+Authentication authentication = new Authentication();
+PasswordCredentials passwordCredentials = new PasswordCredentials();
+passwordCredentials.setUsername(KEYSTONE_USERNAME);
+passwordCredentials.setPassword(KEYSTONE_PASSWORD);
+authentication.setPasswordCredentials(passwordCredentials);
+
+//access with unscoped token
+Access access = keystone.execute(new Authenticate(authentication));
+
+//use the token in the following requests
+keystone.setToken(access.getToken().getId());
+
+Tenants tenants = keystone.execute(new ListTenants());
+
+//try to exchange token using the first tenant
+if(tenants.getList().size() > 0) {
+	
+	authentication = new Authentication();
+	Token token = new Token();
+	token.setId(access.getToken().getId());
+	authentication.setToken(token);
+	authentication.setTenantId(tenants.getList().get(0).getId());
+	
+	access = keystone.execute(new Authenticate(authentication));
+	
+	...
+
+ +h2. OpenStack Compute Service + +OpenStack Nova Model + +OpenStack Nova Client + +
+NovaClient novaClient = new NovaClient(KeystoneUtils.findEndpointURL(access.getServiceCatalog(), "compute", null, "public"), access.getToken().getId());
+			
+Servers servers = novaClient.execute(ServersCore.listServers());
+for(Server server : servers) {
+	System.out.println(server);
+}
+
+ +h2. OpenStack Image Store Service + +OpenStack Glance Model + +OpenStack Glance Client + +h2. OpenStack Object Store Service + +OpenStack Swift Model + +OpenStack Swift Client + +h2. OpenStack Ceilometer Service + +h3. MongoDB Installation + +OpenStack Ceilometer Service uses MongoDB as storage. + +h3. Ceilometer Compute Agent Installation + +OpenStack Ceilometer Compute Agent + +This artefact should be installed on each compute node + +
+mvn clean compile assembly:assembly
+Properties can be configured in /etc/ceilometer/ceilometer-agent.properties
+java -jar ceilometer-compute-agent-jar-with-dependencies.jar 
+
+ +h3. Ceilometer Collector Installation + +OpenStack Ceilometer Collector + +
+mvn clean compile assembly:assembly
+Properties can be configured in /etc/ceilometer/ceilometer-collector.properties
+java -jar ceilometer-collector.jar 
+
+ +h3. OpenStack Ceilometer API Installation + +OpenStack Ceilometer API + +
+mvn clean compile assembly:assembly
+Properties can be configured in /etc/ceilometer/ceilometer-api.properties
+java -jar ceilometer-api.jar 
+
+OpenStack Ceilometer Client + +h1. License + +
+This software is licensed under the Apache 2 license, quoted below.
+
+Copyright 2012 Luis Gervaso and OpenStack Java SDK
+
+Licensed 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.
 
\ No newline at end of file diff --git a/bundle.sh b/bundle.sh index bae51557d..abdd172f9 100644 --- a/bundle.sh +++ b/bundle.sh @@ -1,2 +1,2 @@ -#!/bin/sh +#!/bin/sh mvn source:jar javadoc:jar package gpg:sign repository:bundle-create -Dgpg.passphrase=$1 \ No newline at end of file diff --git a/ceilometer-client/pom.xml b/ceilometer-client/pom.xml index f8a9a3fe1..8893fb0ef 100644 --- a/ceilometer-client/pom.xml +++ b/ceilometer-client/pom.xml @@ -1,23 +1,23 @@ - - 4.0.0 - - com.woorea - openstack-java-sdk - 3.2.2-SNAPSHOT - - ceilometer-client - OpenStack Ceilometer Client - OpenStack Ceilometer Client - - - com.woorea - openstack-client - 3.2.2-SNAPSHOT - - - com.woorea - ceilometer-model - 3.2.2-SNAPSHOT - - - + + 4.0.0 + + com.woorea + openstack-java-sdk + 3.2.2-SNAPSHOT + + ceilometer-client + OpenStack Ceilometer Client + OpenStack Ceilometer Client + + + com.woorea + openstack-client + 3.2.2-SNAPSHOT + + + com.woorea + ceilometer-model + 3.2.2-SNAPSHOT + + + diff --git a/ceilometer-client/src/main/java/com/woorea/openstack/ceilometer/Ceilometer.java b/ceilometer-client/src/main/java/com/woorea/openstack/ceilometer/Ceilometer.java index 05cda3551..999144b10 100644 --- a/ceilometer-client/src/main/java/com/woorea/openstack/ceilometer/Ceilometer.java +++ b/ceilometer-client/src/main/java/com/woorea/openstack/ceilometer/Ceilometer.java @@ -1,34 +1,34 @@ -package com.woorea.openstack.ceilometer; - - -import com.woorea.openstack.base.client.OpenStackClient; -import com.woorea.openstack.base.client.OpenStackClientConnector; -import com.woorea.openstack.ceilometer.v2.api.MetersResource; -import com.woorea.openstack.ceilometer.v2.api.ResourcesResource; - -public class Ceilometer extends OpenStackClient { - - private final MetersResource METERS; - - private final ResourcesResource RESOURCES; - - public Ceilometer(String endpoint, OpenStackClientConnector connector) { - super(endpoint, connector); - METERS = new MetersResource(this); - RESOURCES = new ResourcesResource(this); - } - - public Ceilometer(String endpoint) { - this(endpoint, null); - - } - - public ResourcesResource resources() { - return RESOURCES; - } - - public MetersResource meters() { - return METERS; - } - -} +package com.woorea.openstack.ceilometer; + + +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.base.client.OpenStackClientConnector; +import com.woorea.openstack.ceilometer.v2.api.MetersResource; +import com.woorea.openstack.ceilometer.v2.api.ResourcesResource; + +public class Ceilometer extends OpenStackClient { + + private final MetersResource METERS; + + private final ResourcesResource RESOURCES; + + public Ceilometer(String endpoint, OpenStackClientConnector connector) { + super(endpoint, connector); + METERS = new MetersResource(this); + RESOURCES = new ResourcesResource(this); + } + + public Ceilometer(String endpoint) { + this(endpoint, null); + + } + + public ResourcesResource resources() { + return RESOURCES; + } + + public MetersResource meters() { + return METERS; + } + +} diff --git a/ceilometer-client/src/main/java/com/woorea/openstack/ceilometer/QueriableCeilometerCommand.java b/ceilometer-client/src/main/java/com/woorea/openstack/ceilometer/QueriableCeilometerCommand.java index 444c052cb..7a27dbeb3 100644 --- a/ceilometer-client/src/main/java/com/woorea/openstack/ceilometer/QueriableCeilometerCommand.java +++ b/ceilometer-client/src/main/java/com/woorea/openstack/ceilometer/QueriableCeilometerCommand.java @@ -1,58 +1,58 @@ -package com.woorea.openstack.ceilometer; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; - -import com.woorea.openstack.base.client.OpenStackRequest; - -public abstract class QueriableCeilometerCommand extends OpenStackRequest { - - protected List fields = new ArrayList(); - - protected List ops = new ArrayList(); - - protected List values = new ArrayList(); - - private T filter(String field, String op, Serializable value) { - fields.add(field); - ops.add(op); - values.add(value); - return (T) this; - } - - public T lt(String field, Serializable value) { - return filter(field, "lt", value); - } - - public T le(String field, Serializable value) { - return filter(field, "le", value); - } - - public T eq(String field, Serializable value) { - return filter(field, "eq", value); - } - - public T ne(String field, Serializable value) { - return filter(field, "ne", value); - } - - public T ge(String field, Serializable value) { - return filter(field, "ge", value); - } - - public T gt(String field, Serializable value) { - return filter(field, "gt", value); - } - - /* - public WebTarget query(WebTarget target) { - if(fields.size() > 0) { - target = target.queryParam("q.field", fields.toArray()); - target = target.queryParam("q.op", ops.toArray()); - target = target.queryParam("q.value", values.toArray()); - } - return target; - } - */ -} +package com.woorea.openstack.ceilometer; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +import com.woorea.openstack.base.client.OpenStackRequest; + +public abstract class QueriableCeilometerCommand extends OpenStackRequest { + + protected List fields = new ArrayList(); + + protected List ops = new ArrayList(); + + protected List values = new ArrayList(); + + private T filter(String field, String op, Serializable value) { + fields.add(field); + ops.add(op); + values.add(value); + return (T) this; + } + + public T lt(String field, Serializable value) { + return filter(field, "lt", value); + } + + public T le(String field, Serializable value) { + return filter(field, "le", value); + } + + public T eq(String field, Serializable value) { + return filter(field, "eq", value); + } + + public T ne(String field, Serializable value) { + return filter(field, "ne", value); + } + + public T ge(String field, Serializable value) { + return filter(field, "ge", value); + } + + public T gt(String field, Serializable value) { + return filter(field, "gt", value); + } + + /* + public WebTarget query(WebTarget target) { + if(fields.size() > 0) { + target = target.queryParam("q.field", fields.toArray()); + target = target.queryParam("q.op", ops.toArray()); + target = target.queryParam("q.value", values.toArray()); + } + return target; + } + */ +} diff --git a/ceilometer-client/src/main/java/com/woorea/openstack/ceilometer/v2/api/ResourcesResource.java b/ceilometer-client/src/main/java/com/woorea/openstack/ceilometer/v2/api/ResourcesResource.java index 900168719..31ada7adb 100644 --- a/ceilometer-client/src/main/java/com/woorea/openstack/ceilometer/v2/api/ResourcesResource.java +++ b/ceilometer-client/src/main/java/com/woorea/openstack/ceilometer/v2/api/ResourcesResource.java @@ -1,45 +1,45 @@ -package com.woorea.openstack.ceilometer.v2.api; - -import java.util.List; - -import com.woorea.openstack.base.client.OpenStackClient; -import com.woorea.openstack.base.client.OpenStackRequest; -import com.woorea.openstack.ceilometer.QueriableCeilometerCommand; -import com.woorea.openstack.ceilometer.v2.model.Resource; - -public class ResourcesResource { - - private final OpenStackClient CLIENT; - - public ResourcesResource(OpenStackClient client) { - CLIENT = client; - } - - public class ResourceList extends QueriableCeilometerCommand> { - - public ResourceList() { - OpenStackRequest request = new OpenStackRequest(); - //return query(target.path("resources")).request(MediaType.APPLICATION_JSON).get(new GenericType>() {}); - } - - } - - public class ResourceShow extends OpenStackRequest { - - private String id; - - public ResourceShow id(String id) { - this.id = id; - return this; - } - - public ResourceShow(OpenStackClient client) { -// if(id == null) { -// throw new UnsupportedOperationException("resource id is mandatory"); -// } -// return target.path("resources").path(id).request(MediaType.APPLICATION_JSON).get(Resource.class); - } - - } - -} +package com.woorea.openstack.ceilometer.v2.api; + +import java.util.List; + +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.base.client.OpenStackRequest; +import com.woorea.openstack.ceilometer.QueriableCeilometerCommand; +import com.woorea.openstack.ceilometer.v2.model.Resource; + +public class ResourcesResource { + + private final OpenStackClient CLIENT; + + public ResourcesResource(OpenStackClient client) { + CLIENT = client; + } + + public class ResourceList extends QueriableCeilometerCommand> { + + public ResourceList() { + OpenStackRequest request = new OpenStackRequest(); + //return query(target.path("resources")).request(MediaType.APPLICATION_JSON).get(new GenericType>() {}); + } + + } + + public class ResourceShow extends OpenStackRequest { + + private String id; + + public ResourceShow id(String id) { + this.id = id; + return this; + } + + public ResourceShow(OpenStackClient client) { +// if(id == null) { +// throw new UnsupportedOperationException("resource id is mandatory"); +// } +// return target.path("resources").path(id).request(MediaType.APPLICATION_JSON).get(Resource.class); + } + + } + +} diff --git a/ceilometer-model/pom.xml b/ceilometer-model/pom.xml index 2718bdbe8..c4800f828 100644 --- a/ceilometer-model/pom.xml +++ b/ceilometer-model/pom.xml @@ -1,11 +1,11 @@ - - 4.0.0 - - com.woorea - openstack-java-sdk - 3.2.2-SNAPSHOT - - ceilometer-model - OpenStack Ceilometer Model - OpenStack Ceilometer Model - + + 4.0.0 + + com.woorea + openstack-java-sdk + 3.2.2-SNAPSHOT + + ceilometer-model + OpenStack Ceilometer Model + OpenStack Ceilometer Model + diff --git a/glance-client/pom.xml b/glance-client/pom.xml index 6eb537e1c..6dcd52275 100644 --- a/glance-client/pom.xml +++ b/glance-client/pom.xml @@ -1,24 +1,24 @@ - - 4.0.0 - - com.woorea - openstack-java-sdk - 3.2.2-SNAPSHOT - - glance-client - OpenStack Glance Client - OpenStack Glance Client - - - com.woorea - openstack-client - 3.2.2-SNAPSHOT - - - - com.woorea - glance-model - 3.2.2-SNAPSHOT - - + + 4.0.0 + + com.woorea + openstack-java-sdk + 3.2.2-SNAPSHOT + + glance-client + OpenStack Glance Client + OpenStack Glance Client + + + com.woorea + openstack-client + 3.2.2-SNAPSHOT + + + + com.woorea + glance-model + 3.2.2-SNAPSHOT + + \ No newline at end of file diff --git a/glance-client/src/main/java/com/woorea/openstack/glance/Glance.java b/glance-client/src/main/java/com/woorea/openstack/glance/Glance.java index 67714e7f8..ac3c404a7 100644 --- a/glance-client/src/main/java/com/woorea/openstack/glance/Glance.java +++ b/glance-client/src/main/java/com/woorea/openstack/glance/Glance.java @@ -1,30 +1,30 @@ -package com.woorea.openstack.glance; - -import com.woorea.openstack.base.client.OpenStackClient; -import com.woorea.openstack.base.client.OpenStackClientConnector; - -public class Glance extends OpenStackClient { - - private final ImagesResource IMAGES; - - private final SharedImagesResource SHARED_IMAGES; - - public Glance(String endpoint, OpenStackClientConnector connector) { - super(endpoint, connector); - IMAGES = new ImagesResource(this); - SHARED_IMAGES = new SharedImagesResource(this); - } - - public Glance(String endpoint) { - this(endpoint, null); - } - - public final ImagesResource images() { - return IMAGES; - } - - public final SharedImagesResource sharedImages() { - return SHARED_IMAGES; - } - -} +package com.woorea.openstack.glance; + +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.base.client.OpenStackClientConnector; + +public class Glance extends OpenStackClient { + + private final ImagesResource IMAGES; + + private final SharedImagesResource SHARED_IMAGES; + + public Glance(String endpoint, OpenStackClientConnector connector) { + super(endpoint, connector); + IMAGES = new ImagesResource(this); + SHARED_IMAGES = new SharedImagesResource(this); + } + + public Glance(String endpoint) { + this(endpoint, null); + } + + public final ImagesResource images() { + return IMAGES; + } + + public final SharedImagesResource sharedImages() { + return SHARED_IMAGES; + } + +} diff --git a/glance-model/pom.xml b/glance-model/pom.xml index 2efc98be8..d5f7f238b 100644 --- a/glance-model/pom.xml +++ b/glance-model/pom.xml @@ -1,11 +1,11 @@ - - 4.0.0 - - com.woorea - openstack-java-sdk - 3.2.2-SNAPSHOT - - glance-model - OpenStack Glance Model - OpenStack Glance Model + + 4.0.0 + + com.woorea + openstack-java-sdk + 3.2.2-SNAPSHOT + + glance-model + OpenStack Glance Model + OpenStack Glance Model \ No newline at end of file diff --git a/glance-model/src/main/java/com/woorea/openstack/glance/model/ImageDownload.java b/glance-model/src/main/java/com/woorea/openstack/glance/model/ImageDownload.java index d7c575cf2..9d63019b9 100644 --- a/glance-model/src/main/java/com/woorea/openstack/glance/model/ImageDownload.java +++ b/glance-model/src/main/java/com/woorea/openstack/glance/model/ImageDownload.java @@ -1,39 +1,39 @@ -package com.woorea.openstack.glance.model; - -import java.io.InputStream; - -public class ImageDownload { - - private Image image; - - private InputStream inputStream; - - /** - * @return the image - */ - public Image getImage() { - return image; - } - - /** - * @param image the image to set - */ - public void setImage(Image image) { - this.image = image; - } - - /** - * @return the inputStream - */ - public InputStream getInputStream() { - return inputStream; - } - - /** - * @param inputStream the inputStream to set - */ - public void setInputStream(InputStream inputStream) { - this.inputStream = inputStream; - } - -} +package com.woorea.openstack.glance.model; + +import java.io.InputStream; + +public class ImageDownload { + + private Image image; + + private InputStream inputStream; + + /** + * @return the image + */ + public Image getImage() { + return image; + } + + /** + * @param image the image to set + */ + public void setImage(Image image) { + this.image = image; + } + + /** + * @return the inputStream + */ + public InputStream getInputStream() { + return inputStream; + } + + /** + * @param inputStream the inputStream to set + */ + public void setInputStream(InputStream inputStream) { + this.inputStream = inputStream; + } + +} diff --git a/glance-model/src/main/java/com/woorea/openstack/glance/model/ImageUpload.java b/glance-model/src/main/java/com/woorea/openstack/glance/model/ImageUpload.java index 326f5e006..c41125b8a 100644 --- a/glance-model/src/main/java/com/woorea/openstack/glance/model/ImageUpload.java +++ b/glance-model/src/main/java/com/woorea/openstack/glance/model/ImageUpload.java @@ -1,67 +1,67 @@ -package com.woorea.openstack.glance.model; - -import java.io.InputStream; -import java.util.HashMap; -import java.util.Map; - -public class ImageUpload { - - private Image image; - - private String store; - - private Map properties; - - private InputStream inputStream; - - public ImageUpload(Image image) { - setImage(image); - } - - public Image getImage() { - return image; - } - - public void setImage(Image image) { - this.image = image; - } - - /** - * @return the store - */ - public String getStore() { - return store; - } - - /** - * @param store the store to set - */ - public void setStore(String store) { - this.store = store; - } - - /** - * @return the properties - */ - public Map getProperties() { - if(properties == null) { - properties = new HashMap(); - } - return properties; - } - - /** - * @return the inputStream - */ - public InputStream getInputStream() { - return inputStream; - } - - /** - * @param inputStream the inputStream to set - */ - public void setInputStream(InputStream inputStream) { - this.inputStream = inputStream; - } - -} +package com.woorea.openstack.glance.model; + +import java.io.InputStream; +import java.util.HashMap; +import java.util.Map; + +public class ImageUpload { + + private Image image; + + private String store; + + private Map properties; + + private InputStream inputStream; + + public ImageUpload(Image image) { + setImage(image); + } + + public Image getImage() { + return image; + } + + public void setImage(Image image) { + this.image = image; + } + + /** + * @return the store + */ + public String getStore() { + return store; + } + + /** + * @param store the store to set + */ + public void setStore(String store) { + this.store = store; + } + + /** + * @return the properties + */ + public Map getProperties() { + if(properties == null) { + properties = new HashMap(); + } + return properties; + } + + /** + * @return the inputStream + */ + public InputStream getInputStream() { + return inputStream; + } + + /** + * @param inputStream the inputStream to set + */ + public void setInputStream(InputStream inputStream) { + this.inputStream = inputStream; + } + +} diff --git a/glance-model/src/main/java/com/woorea/openstack/glance/model/SharedImage.java b/glance-model/src/main/java/com/woorea/openstack/glance/model/SharedImage.java index ae23a6688..508579f22 100644 --- a/glance-model/src/main/java/com/woorea/openstack/glance/model/SharedImage.java +++ b/glance-model/src/main/java/com/woorea/openstack/glance/model/SharedImage.java @@ -1,5 +1,5 @@ -package com.woorea.openstack.glance.model; - -public class SharedImage { - +package com.woorea.openstack.glance.model; + +public class SharedImage { + } \ No newline at end of file diff --git a/heat-client/pom.xml b/heat-client/pom.xml index 7c63daf12..535598a59 100644 --- a/heat-client/pom.xml +++ b/heat-client/pom.xml @@ -1,24 +1,24 @@ - - 4.0.0 - - com.woorea - openstack-java-sdk - 3.2.2-SNAPSHOT - - heat-client - OpenStack Heat Client - OpenStack Heat Client - - - com.woorea - openstack-client - 3.2.2-SNAPSHOT - - - - com.woorea - heat-model - 3.2.2-SNAPSHOT - - + + 4.0.0 + + com.woorea + openstack-java-sdk + 3.2.2-SNAPSHOT + + heat-client + OpenStack Heat Client + OpenStack Heat Client + + + com.woorea + openstack-client + 3.2.2-SNAPSHOT + + + + com.woorea + heat-model + 3.2.2-SNAPSHOT + + \ No newline at end of file diff --git a/heat-client/src/main/java/com/woorea/openstack/heat/Heat.java b/heat-client/src/main/java/com/woorea/openstack/heat/Heat.java index 96e9cd78b..3e4ea1e78 100644 --- a/heat-client/src/main/java/com/woorea/openstack/heat/Heat.java +++ b/heat-client/src/main/java/com/woorea/openstack/heat/Heat.java @@ -1,31 +1,31 @@ -package com.woorea.openstack.heat; - -import com.woorea.openstack.base.client.OpenStackClient; -import com.woorea.openstack.base.client.OpenStackClientConnector; - -/** - * Reference: http://api.openstack.org/api-ref-orchestration.html - */ -public class Heat extends OpenStackClient { - - private final StackResource stacks; - private final ResourcesResource resources; - - public Heat(String endpoint, OpenStackClientConnector connector) { - super(endpoint, connector); - stacks = new StackResource(this); - resources = new ResourcesResource(this); - } - - public Heat(String endpoint) { - this(endpoint, null); - } - - public StackResource getStacks() { - return stacks; - } - - public ResourcesResource getResources() { - return resources; - } -} +package com.woorea.openstack.heat; + +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.base.client.OpenStackClientConnector; + +/** + * Reference: http://api.openstack.org/api-ref-orchestration.html + */ +public class Heat extends OpenStackClient { + + private final StackResource stacks; + private final ResourcesResource resources; + + public Heat(String endpoint, OpenStackClientConnector connector) { + super(endpoint, connector); + stacks = new StackResource(this); + resources = new ResourcesResource(this); + } + + public Heat(String endpoint) { + this(endpoint, null); + } + + public StackResource getStacks() { + return stacks; + } + + public ResourcesResource getResources() { + return resources; + } +} diff --git a/heat-client/src/main/java/com/woorea/openstack/heat/ResourcesResource.java b/heat-client/src/main/java/com/woorea/openstack/heat/ResourcesResource.java index c3635bcbe..20ffd7801 100644 --- a/heat-client/src/main/java/com/woorea/openstack/heat/ResourcesResource.java +++ b/heat-client/src/main/java/com/woorea/openstack/heat/ResourcesResource.java @@ -1,31 +1,31 @@ -package com.woorea.openstack.heat; - -import com.woorea.openstack.base.client.HttpMethod; -import com.woorea.openstack.base.client.OpenStackClient; -import com.woorea.openstack.base.client.OpenStackRequest; -import com.woorea.openstack.heat.model.Resources; - - -/** - * v1/​{tenant_id}​/stacks/​{stack_name}​/resources - */ -public class ResourcesResource { - private final OpenStackClient client; - - public ResourcesResource(OpenStackClient client) { - this.client = client; - } - - public ListResources listResources(String name) { - return new ListResources(name); - } - - /** - * v1/​{tenant_id}​/stacks/​{stack_name}​/resources - */ - public class ListResources extends OpenStackRequest { - public ListResources(String name) { - super(client, HttpMethod.GET, "/stacks/" + name + "/resources", null, Resources.class); - } - } -} +package com.woorea.openstack.heat; + +import com.woorea.openstack.base.client.HttpMethod; +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.base.client.OpenStackRequest; +import com.woorea.openstack.heat.model.Resources; + + +/** + * v1/​{tenant_id}​/stacks/​{stack_name}​/resources + */ +public class ResourcesResource { + private final OpenStackClient client; + + public ResourcesResource(OpenStackClient client) { + this.client = client; + } + + public ListResources listResources(String name) { + return new ListResources(name); + } + + /** + * v1/​{tenant_id}​/stacks/​{stack_name}​/resources + */ + public class ListResources extends OpenStackRequest { + public ListResources(String name) { + super(client, HttpMethod.GET, "/stacks/" + name + "/resources", null, Resources.class); + } + } +} diff --git a/heat-client/src/main/java/com/woorea/openstack/heat/StackResource.java b/heat-client/src/main/java/com/woorea/openstack/heat/StackResource.java index de4577d3c..f30f9f129 100644 --- a/heat-client/src/main/java/com/woorea/openstack/heat/StackResource.java +++ b/heat-client/src/main/java/com/woorea/openstack/heat/StackResource.java @@ -1,61 +1,61 @@ -package com.woorea.openstack.heat; - -import com.woorea.openstack.base.client.Entity; -import com.woorea.openstack.base.client.HttpMethod; -import com.woorea.openstack.base.client.OpenStackClient; -import com.woorea.openstack.base.client.OpenStackRequest; -import com.woorea.openstack.heat.model.CreateStackParam; -import com.woorea.openstack.heat.model.Stack; -import com.woorea.openstack.heat.model.Stacks; - -public class StackResource { - - private final OpenStackClient client; - - public StackResource(OpenStackClient client) { - this.client = client; - } - - public CreateStack create(CreateStackParam param) { - return new CreateStack(param); - } - - public List list() { - return new List(); - } - - public GetStack byName(String name) { - return new GetStack(name); - } - - public DeleteStack deleteByName(String name) { - return new DeleteStack(name); - } - - public class CreateStack extends OpenStackRequest { - public CreateStack(CreateStackParam params) { - super(client, HttpMethod.POST, "/stacks", Entity.json(params), Stack.class); - } - } - - public class DeleteStack extends OpenStackRequest { - public DeleteStack(String name) { - super(client, HttpMethod.DELETE, "/stacks/" + name, null, Void.class); - } - } - - - public class GetStack extends OpenStackRequest { - public GetStack(String name) { - super(client, HttpMethod.GET, "/stacks/" + name, null, Stack.class); - } - } - - public class List extends OpenStackRequest { - public List() { - super(client, HttpMethod.GET, "/stacks", null, Stacks.class); - } - } - - -} +package com.woorea.openstack.heat; + +import com.woorea.openstack.base.client.Entity; +import com.woorea.openstack.base.client.HttpMethod; +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.base.client.OpenStackRequest; +import com.woorea.openstack.heat.model.CreateStackParam; +import com.woorea.openstack.heat.model.Stack; +import com.woorea.openstack.heat.model.Stacks; + +public class StackResource { + + private final OpenStackClient client; + + public StackResource(OpenStackClient client) { + this.client = client; + } + + public CreateStack create(CreateStackParam param) { + return new CreateStack(param); + } + + public List list() { + return new List(); + } + + public GetStack byName(String name) { + return new GetStack(name); + } + + public DeleteStack deleteByName(String name) { + return new DeleteStack(name); + } + + public class CreateStack extends OpenStackRequest { + public CreateStack(CreateStackParam params) { + super(client, HttpMethod.POST, "/stacks", Entity.json(params), Stack.class); + } + } + + public class DeleteStack extends OpenStackRequest { + public DeleteStack(String name) { + super(client, HttpMethod.DELETE, "/stacks/" + name, null, Void.class); + } + } + + + public class GetStack extends OpenStackRequest { + public GetStack(String name) { + super(client, HttpMethod.GET, "/stacks/" + name, null, Stack.class); + } + } + + public class List extends OpenStackRequest { + public List() { + super(client, HttpMethod.GET, "/stacks", null, Stacks.class); + } + } + + +} diff --git a/heat-model/pom.xml b/heat-model/pom.xml index d7fb92148..cfdb182f6 100644 --- a/heat-model/pom.xml +++ b/heat-model/pom.xml @@ -1,11 +1,11 @@ - - 4.0.0 - - com.woorea - openstack-java-sdk - 3.2.2-SNAPSHOT - - heat-model - OpenStack Heat Model - OpenStack Heat Model + + 4.0.0 + + com.woorea + openstack-java-sdk + 3.2.2-SNAPSHOT + + heat-model + OpenStack Heat Model + OpenStack Heat Model \ No newline at end of file diff --git a/keystone-client/.gitignore b/keystone-client/.gitignore new file mode 100644 index 000000000..ea8c4bf7f --- /dev/null +++ b/keystone-client/.gitignore @@ -0,0 +1 @@ +/target diff --git a/keystone-client/pom.xml b/keystone-client/pom.xml index 69a46ed43..89ca9fedf 100644 --- a/keystone-client/pom.xml +++ b/keystone-client/pom.xml @@ -1,23 +1,23 @@ - - 4.0.0 - - com.woorea - openstack-java-sdk - 3.2.2-SNAPSHOT - - keystone-client - OpenStack Keystone Client - OpenStack Keystone Client - - - com.woorea - openstack-client - 3.2.2-SNAPSHOT - - - com.woorea - keystone-model - 3.2.2-SNAPSHOT - - + + 4.0.0 + + com.woorea + openstack-java-sdk + 3.2.2-SNAPSHOT + + keystone-client + OpenStack Keystone Client + OpenStack Keystone Client + + + com.woorea + openstack-client + 3.2.2-SNAPSHOT + + + com.woorea + keystone-model + 3.2.2-SNAPSHOT + + \ No newline at end of file diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/api/EndpointsResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/api/EndpointsResource.java index acc128b89..a1600b7f5 100644 --- a/keystone-client/src/main/java/com/woorea/openstack/keystone/api/EndpointsResource.java +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/api/EndpointsResource.java @@ -1,71 +1,71 @@ -package com.woorea.openstack.keystone.api; - - -import com.woorea.openstack.base.client.Entity; -import com.woorea.openstack.base.client.HttpMethod; -import com.woorea.openstack.base.client.OpenStackClient; -import com.woorea.openstack.base.client.OpenStackRequest; -import com.woorea.openstack.keystone.model.Endpoint; -import com.woorea.openstack.keystone.model.Endpoints; - -public class EndpointsResource { - - private OpenStackClient client; - - public EndpointsResource(OpenStackClient client) { - this.client = client; - } - - public List list() { - return new List(); - } - - public Create create(Endpoint endpoint) { - return new Create(endpoint); - } - - public Show show(String id) { - return new Show(id); - } - - - public Delete delete(String id) { - return new Delete(id); - } - - public class List extends OpenStackRequest { - - public List() { - super(client, HttpMethod.GET, "/endpoints", null, Endpoints.class); - } - - } - - public class Create extends OpenStackRequest { - - private Endpoint endpoint; - - public Create(Endpoint endpoint) { - super(client, HttpMethod.POST, "/endpoints", Entity.json(endpoint), Endpoint.class); - this.endpoint = endpoint; - } - - } - - public class Show extends OpenStackRequest { - - public Show(String id) { - super(client, HttpMethod.GET, new StringBuilder("/endpoints/").append(id).toString(), null, Endpoint.class); - } - - } - - public class Delete extends OpenStackRequest { - - public Delete(String id) { - super(client, HttpMethod.DELETE, new StringBuilder("/endpoints/").append(id).toString(), null, Void.class); - } - - } - -} +package com.woorea.openstack.keystone.api; + + +import com.woorea.openstack.base.client.Entity; +import com.woorea.openstack.base.client.HttpMethod; +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.base.client.OpenStackRequest; +import com.woorea.openstack.keystone.model.Endpoint; +import com.woorea.openstack.keystone.model.Endpoints; + +public class EndpointsResource { + + private OpenStackClient client; + + public EndpointsResource(OpenStackClient client) { + this.client = client; + } + + public List list() { + return new List(); + } + + public Create create(Endpoint endpoint) { + return new Create(endpoint); + } + + public Show show(String id) { + return new Show(id); + } + + + public Delete delete(String id) { + return new Delete(id); + } + + public class List extends OpenStackRequest { + + public List() { + super(client, HttpMethod.GET, "/endpoints", null, Endpoints.class); + } + + } + + public class Create extends OpenStackRequest { + + private Endpoint endpoint; + + public Create(Endpoint endpoint) { + super(client, HttpMethod.POST, "/endpoints", Entity.json(endpoint), Endpoint.class); + this.endpoint = endpoint; + } + + } + + public class Show extends OpenStackRequest { + + public Show(String id) { + super(client, HttpMethod.GET, new StringBuilder("/endpoints/").append(id).toString(), null, Endpoint.class); + } + + } + + public class Delete extends OpenStackRequest { + + public Delete(String id) { + super(client, HttpMethod.DELETE, new StringBuilder("/endpoints/").append(id).toString(), null, Void.class); + } + + } + +} diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/api/RolesResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/api/RolesResource.java index d39dc770e..94593bb43 100644 --- a/keystone-client/src/main/java/com/woorea/openstack/keystone/api/RolesResource.java +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/api/RolesResource.java @@ -1,58 +1,58 @@ -package com.woorea.openstack.keystone.api; - - -import com.woorea.openstack.base.client.Entity; -import com.woorea.openstack.base.client.HttpMethod; -import com.woorea.openstack.base.client.OpenStackClient; -import com.woorea.openstack.base.client.OpenStackRequest; -import com.woorea.openstack.keystone.model.Role; -import com.woorea.openstack.keystone.model.Roles; - -public class RolesResource { - - private OpenStackClient client; - - public RolesResource(OpenStackClient client) { - this.client = client; - } - - public List list() { - return new List(); - } - - public Create create(Role role) { - return new Create(role); - } - - public Delete delete(String id) { - return new Delete(id); - } - - public class List extends OpenStackRequest { - - public List() { - super(client, HttpMethod.GET, "/OS-KSADM/roles", null, Roles.class); - } - - } - - public class Create extends OpenStackRequest { - - private Role role; - - public Create(Role role) { - super(client, HttpMethod.POST, "/OS-KSADM/roles", Entity.json(role), Role.class); - this.role = role; - } - - } - - public class Delete extends OpenStackRequest { - - public Delete(String id) { - super(client, HttpMethod.DELETE, new StringBuilder("/OS-KSADM/roles/").append(id).toString(), null, Void.class); - } - - } - -} +package com.woorea.openstack.keystone.api; + + +import com.woorea.openstack.base.client.Entity; +import com.woorea.openstack.base.client.HttpMethod; +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.base.client.OpenStackRequest; +import com.woorea.openstack.keystone.model.Role; +import com.woorea.openstack.keystone.model.Roles; + +public class RolesResource { + + private OpenStackClient client; + + public RolesResource(OpenStackClient client) { + this.client = client; + } + + public List list() { + return new List(); + } + + public Create create(Role role) { + return new Create(role); + } + + public Delete delete(String id) { + return new Delete(id); + } + + public class List extends OpenStackRequest { + + public List() { + super(client, HttpMethod.GET, "/OS-KSADM/roles", null, Roles.class); + } + + } + + public class Create extends OpenStackRequest { + + private Role role; + + public Create(Role role) { + super(client, HttpMethod.POST, "/OS-KSADM/roles", Entity.json(role), Role.class); + this.role = role; + } + + } + + public class Delete extends OpenStackRequest { + + public Delete(String id) { + super(client, HttpMethod.DELETE, new StringBuilder("/OS-KSADM/roles/").append(id).toString(), null, Void.class); + } + + } + +} diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/api/ServicesResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/api/ServicesResource.java index 5b1893974..a3a6a27d4 100644 --- a/keystone-client/src/main/java/com/woorea/openstack/keystone/api/ServicesResource.java +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/api/ServicesResource.java @@ -1,70 +1,70 @@ -package com.woorea.openstack.keystone.api; - - -import com.woorea.openstack.base.client.Entity; -import com.woorea.openstack.base.client.HttpMethod; -import com.woorea.openstack.base.client.OpenStackClient; -import com.woorea.openstack.base.client.OpenStackRequest; -import com.woorea.openstack.keystone.model.Service; -import com.woorea.openstack.keystone.model.Services; - -public class ServicesResource { - - private OpenStackClient client; - - public ServicesResource(OpenStackClient client) { - this.client = client; - } - - public List list() { - return new List(); - } - - public Create create(Service service) { - return new Create(service); - } - - public Show show(String id) { - return new Show(id); - } - - public Delete delete(String id) { - return new Delete(id); - } - - public class List extends OpenStackRequest { - - public List() { - super(client, HttpMethod.GET, "/OS-KSADM/services", null, Services.class); - } - - } - - public class Create extends OpenStackRequest { - - private Service service; - - public Create(Service service) { - super(client, HttpMethod.POST, "/OS-KSADM/services", Entity.json(service), Service.class); - this.service = service; - } - - } - - public class Show extends OpenStackRequest { - - public Show(String id) { - super(client, HttpMethod.GET, new StringBuilder("/OS-KSADM/services/").append(id).toString(), null, Service.class); - } - - } - - public class Delete extends OpenStackRequest { - - public Delete(String id) { - super(client, HttpMethod.DELETE, new StringBuilder("/OS-KSADM/services/").append(id).toString(), null, Void.class); - } - - } - -} +package com.woorea.openstack.keystone.api; + + +import com.woorea.openstack.base.client.Entity; +import com.woorea.openstack.base.client.HttpMethod; +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.base.client.OpenStackRequest; +import com.woorea.openstack.keystone.model.Service; +import com.woorea.openstack.keystone.model.Services; + +public class ServicesResource { + + private OpenStackClient client; + + public ServicesResource(OpenStackClient client) { + this.client = client; + } + + public List list() { + return new List(); + } + + public Create create(Service service) { + return new Create(service); + } + + public Show show(String id) { + return new Show(id); + } + + public Delete delete(String id) { + return new Delete(id); + } + + public class List extends OpenStackRequest { + + public List() { + super(client, HttpMethod.GET, "/OS-KSADM/services", null, Services.class); + } + + } + + public class Create extends OpenStackRequest { + + private Service service; + + public Create(Service service) { + super(client, HttpMethod.POST, "/OS-KSADM/services", Entity.json(service), Service.class); + this.service = service; + } + + } + + public class Show extends OpenStackRequest { + + public Show(String id) { + super(client, HttpMethod.GET, new StringBuilder("/OS-KSADM/services/").append(id).toString(), null, Service.class); + } + + } + + public class Delete extends OpenStackRequest { + + public Delete(String id) { + super(client, HttpMethod.DELETE, new StringBuilder("/OS-KSADM/services/").append(id).toString(), null, Void.class); + } + + } + +} diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/api/TenantsResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/api/TenantsResource.java index 24a91f62f..443e111ad 100644 --- a/keystone-client/src/main/java/com/woorea/openstack/keystone/api/TenantsResource.java +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/api/TenantsResource.java @@ -1,135 +1,135 @@ -package com.woorea.openstack.keystone.api; - - -import com.woorea.openstack.base.client.Entity; -import com.woorea.openstack.base.client.HttpMethod; -import com.woorea.openstack.base.client.OpenStackClient; -import com.woorea.openstack.base.client.OpenStackRequest; -import com.woorea.openstack.keystone.model.Roles; -import com.woorea.openstack.keystone.model.Tenant; -import com.woorea.openstack.keystone.model.Tenants; -import com.woorea.openstack.keystone.model.Users; - -public class TenantsResource { - - private OpenStackClient client; - - public TenantsResource(OpenStackClient client) { - this.client = client; - } - - public List list() { - return new List(); - } - - public Create create(Tenant tenant) { - return new Create(tenant); - } - - public Show show(String id) { - return new Show(id); - } - - public Update update(String id, Tenant tenant) { - return new Update(id, tenant); - } - - public Delete delete(String id) { - return new Delete(id); - } - - public ListUsers listUsers(String tenantId) { - return new ListUsers(tenantId); - } - - public AddUser addUser(String tenantId, String userId, String roleId) { - return new AddUser(tenantId, userId, roleId); - } - - public RemoveUser removeUser(String tenantId, String userId, String roleId) { - return new RemoveUser(tenantId, userId, roleId); - } - - public ListUserRoles listUserRoles(String tenantId, String userId) { - return new ListUserRoles(tenantId, userId); - } - - public class List extends OpenStackRequest { - - public List() { - super(client, HttpMethod.GET, "/tenants", null, Tenants.class); - } - - } - - public class Create extends OpenStackRequest { - - private Tenant tenant; - - public Create(Tenant tenant) { - super(client, HttpMethod.POST, "/tenants", Entity.json(tenant), Tenant.class); - this.tenant = tenant; - } - - } - - public class Show extends OpenStackRequest { - - public Show(String id) { - super(client, HttpMethod.GET, new StringBuilder("/tenants/").append(id).toString(), null, Tenant.class); - } - - } - - public class Update extends OpenStackRequest { - - private Tenant tenant; - - public Update(String id, Tenant tenant) { - super(client, HttpMethod.PUT, new StringBuilder("/tenants/").append(id).toString(), Entity.json(tenant), Tenant.class); - this.tenant = tenant; - } - - } - - public class Delete extends OpenStackRequest { - - public Delete(String id) { - super(client, HttpMethod.DELETE, new StringBuilder("/tenants/").append(id).toString(), null, Void.class); - } - - } - - public class ListUsers extends OpenStackRequest { - - public ListUsers(String tenantId) { - super(client, HttpMethod.GET, new StringBuilder("/tenants/").append(tenantId).append("/users").toString(), null, Users.class); - } - - } - - public class AddUser extends OpenStackRequest { - - public AddUser(String tenantId, String userId, String roleId) { - super(client, HttpMethod.PUT, new StringBuilder("/tenants/").append(tenantId).append("/users/").append(userId).append("/roles/OS-KSADM/").append(roleId).toString(), null, Void.class); - } - - } - - public class RemoveUser extends OpenStackRequest { - - public RemoveUser(String tenantId, String userId, String roleId) { - super(client, HttpMethod.DELETE, new StringBuilder("/tenants/").append(tenantId).append("/users/").append(userId).append("/roles/OS-KSADM/").append(roleId).toString(), null, Void.class); - } - - } - - public class ListUserRoles extends OpenStackRequest { - - public ListUserRoles(String tenantId, String userId) { - super(client, HttpMethod.GET, new StringBuilder("/tenants/").append(tenantId).append("/users/").append(userId).append("/roles").toString(), null, Roles.class); - } - - } - -} +package com.woorea.openstack.keystone.api; + + +import com.woorea.openstack.base.client.Entity; +import com.woorea.openstack.base.client.HttpMethod; +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.base.client.OpenStackRequest; +import com.woorea.openstack.keystone.model.Roles; +import com.woorea.openstack.keystone.model.Tenant; +import com.woorea.openstack.keystone.model.Tenants; +import com.woorea.openstack.keystone.model.Users; + +public class TenantsResource { + + private OpenStackClient client; + + public TenantsResource(OpenStackClient client) { + this.client = client; + } + + public List list() { + return new List(); + } + + public Create create(Tenant tenant) { + return new Create(tenant); + } + + public Show show(String id) { + return new Show(id); + } + + public Update update(String id, Tenant tenant) { + return new Update(id, tenant); + } + + public Delete delete(String id) { + return new Delete(id); + } + + public ListUsers listUsers(String tenantId) { + return new ListUsers(tenantId); + } + + public AddUser addUser(String tenantId, String userId, String roleId) { + return new AddUser(tenantId, userId, roleId); + } + + public RemoveUser removeUser(String tenantId, String userId, String roleId) { + return new RemoveUser(tenantId, userId, roleId); + } + + public ListUserRoles listUserRoles(String tenantId, String userId) { + return new ListUserRoles(tenantId, userId); + } + + public class List extends OpenStackRequest { + + public List() { + super(client, HttpMethod.GET, "/tenants", null, Tenants.class); + } + + } + + public class Create extends OpenStackRequest { + + private Tenant tenant; + + public Create(Tenant tenant) { + super(client, HttpMethod.POST, "/tenants", Entity.json(tenant), Tenant.class); + this.tenant = tenant; + } + + } + + public class Show extends OpenStackRequest { + + public Show(String id) { + super(client, HttpMethod.GET, new StringBuilder("/tenants/").append(id).toString(), null, Tenant.class); + } + + } + + public class Update extends OpenStackRequest { + + private Tenant tenant; + + public Update(String id, Tenant tenant) { + super(client, HttpMethod.PUT, new StringBuilder("/tenants/").append(id).toString(), Entity.json(tenant), Tenant.class); + this.tenant = tenant; + } + + } + + public class Delete extends OpenStackRequest { + + public Delete(String id) { + super(client, HttpMethod.DELETE, new StringBuilder("/tenants/").append(id).toString(), null, Void.class); + } + + } + + public class ListUsers extends OpenStackRequest { + + public ListUsers(String tenantId) { + super(client, HttpMethod.GET, new StringBuilder("/tenants/").append(tenantId).append("/users").toString(), null, Users.class); + } + + } + + public class AddUser extends OpenStackRequest { + + public AddUser(String tenantId, String userId, String roleId) { + super(client, HttpMethod.PUT, new StringBuilder("/tenants/").append(tenantId).append("/users/").append(userId).append("/roles/OS-KSADM/").append(roleId).toString(), null, Void.class); + } + + } + + public class RemoveUser extends OpenStackRequest { + + public RemoveUser(String tenantId, String userId, String roleId) { + super(client, HttpMethod.DELETE, new StringBuilder("/tenants/").append(tenantId).append("/users/").append(userId).append("/roles/OS-KSADM/").append(roleId).toString(), null, Void.class); + } + + } + + public class ListUserRoles extends OpenStackRequest { + + public ListUserRoles(String tenantId, String userId) { + super(client, HttpMethod.GET, new StringBuilder("/tenants/").append(tenantId).append("/users/").append(userId).append("/roles").toString(), null, Roles.class); + } + + } + +} diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/api/TokensResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/api/TokensResource.java index b9f1cfc88..fd72ccb9f 100644 --- a/keystone-client/src/main/java/com/woorea/openstack/keystone/api/TokensResource.java +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/api/TokensResource.java @@ -1,74 +1,74 @@ -package com.woorea.openstack.keystone.api; - - -import com.woorea.openstack.base.client.Entity; -import com.woorea.openstack.base.client.HttpMethod; -import com.woorea.openstack.base.client.OpenStackClient; -import com.woorea.openstack.base.client.OpenStackRequest; -import com.woorea.openstack.keystone.model.Access; -import com.woorea.openstack.keystone.model.Authentication; -import com.woorea.openstack.keystone.model.authentication.AccessKey; -import com.woorea.openstack.keystone.model.authentication.TokenAuthentication; -import com.woorea.openstack.keystone.model.authentication.UsernamePassword; - -public class TokensResource { - - private final OpenStackClient CLIENT; - - public TokensResource(OpenStackClient client) { - CLIENT = client; - } - - public Authenticate.Builder authenticate() { - return new Authenticate().new Builder(); - } - - public Authenticate authenticate(Authentication authentication) { - return new Authenticate(authentication); - } - - public class Authenticate extends OpenStackRequest { - - private Authentication authentication; - - public Authenticate() { - - } - - public Authenticate(Authentication authentication) { - super(CLIENT, HttpMethod.POST, "/tokens", Entity.json(authentication), Access.class); - this.authentication = authentication; - } - - public Authenticate withTenantId(String tenantId) { - authentication.setTenantId(tenantId); - return this; - } - - public Authenticate withTenantName(String tenantName) { - authentication.setTenantName(tenantName); - return this; - } - - public class Builder { - - public Authenticate withUsernamePassword(String username, String password) { - Authentication authentication = new UsernamePassword(username, password); - return new Authenticate(authentication); - } - - public Authenticate withToken(String token) { - Authentication authentication = new TokenAuthentication(token); - return new Authenticate(authentication); - } - - public Authenticate withAccessKey(String accessKey, String secretKey) { - Authentication authentication = new AccessKey(accessKey, secretKey); - return new Authenticate(authentication); - } - - } - - } - -} +package com.woorea.openstack.keystone.api; + + +import com.woorea.openstack.base.client.Entity; +import com.woorea.openstack.base.client.HttpMethod; +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.base.client.OpenStackRequest; +import com.woorea.openstack.keystone.model.Access; +import com.woorea.openstack.keystone.model.Authentication; +import com.woorea.openstack.keystone.model.authentication.AccessKey; +import com.woorea.openstack.keystone.model.authentication.TokenAuthentication; +import com.woorea.openstack.keystone.model.authentication.UsernamePassword; + +public class TokensResource { + + private final OpenStackClient CLIENT; + + public TokensResource(OpenStackClient client) { + CLIENT = client; + } + + public Authenticate.Builder authenticate() { + return new Authenticate().new Builder(); + } + + public Authenticate authenticate(Authentication authentication) { + return new Authenticate(authentication); + } + + public class Authenticate extends OpenStackRequest { + + private Authentication authentication; + + public Authenticate() { + + } + + public Authenticate(Authentication authentication) { + super(CLIENT, HttpMethod.POST, "/tokens", Entity.json(authentication), Access.class); + this.authentication = authentication; + } + + public Authenticate withTenantId(String tenantId) { + authentication.setTenantId(tenantId); + return this; + } + + public Authenticate withTenantName(String tenantName) { + authentication.setTenantName(tenantName); + return this; + } + + public class Builder { + + public Authenticate withUsernamePassword(String username, String password) { + Authentication authentication = new UsernamePassword(username, password); + return new Authenticate(authentication); + } + + public Authenticate withToken(String token) { + Authentication authentication = new TokenAuthentication(token); + return new Authenticate(authentication); + } + + public Authenticate withAccessKey(String accessKey, String secretKey) { + Authentication authentication = new AccessKey(accessKey, secretKey); + return new Authenticate(authentication); + } + + } + + } + +} diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/utils/KeystoneTokenProvider.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/utils/KeystoneTokenProvider.java index fb5127abe..e7e1deae0 100644 --- a/keystone-client/src/main/java/com/woorea/openstack/keystone/utils/KeystoneTokenProvider.java +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/utils/KeystoneTokenProvider.java @@ -1,56 +1,56 @@ -package com.woorea.openstack.keystone.utils; - -import java.util.concurrent.ConcurrentHashMap; - -import com.woorea.openstack.base.client.OpenStackTokenProvider; -import com.woorea.openstack.keystone.Keystone; -import com.woorea.openstack.keystone.model.Access; -import com.woorea.openstack.keystone.model.authentication.UsernamePassword; - -public class KeystoneTokenProvider { - - protected Keystone keystone; - - protected String username; - - protected String password; - - ConcurrentHashMap hashTenantAccess; - - public KeystoneTokenProvider(String endpoint, String username, String password) { - this.keystone = new Keystone(endpoint); - this.username = username; - this.password = password; - this.hashTenantAccess = new ConcurrentHashMap(); - } - - public Access getAccessByTenant(String tenantName) { - Access access = hashTenantAccess.get(tenantName); - if (access == null) { - access = keystone.tokens().authenticate(new UsernamePassword(username, password)) - .withTenantName(tenantName) - .execute(); - hashTenantAccess.put(tenantName, access); - } - return access; - } - - public void expireAccessByTenant(String tenantName) { - hashTenantAccess.remove(tenantName); - } - - public OpenStackTokenProvider getProviderByTenant(final String tenantName) { - final KeystoneTokenProvider keystoneTokenProvider = this; - return new OpenStackTokenProvider() { - @Override - public String getToken() { - return keystoneTokenProvider.getAccessByTenant(tenantName) - .getToken().getId(); - } - @Override - public void expireToken() { - keystoneTokenProvider.expireAccessByTenant(tenantName); - } - }; - } -} +package com.woorea.openstack.keystone.utils; + +import java.util.concurrent.ConcurrentHashMap; + +import com.woorea.openstack.base.client.OpenStackTokenProvider; +import com.woorea.openstack.keystone.Keystone; +import com.woorea.openstack.keystone.model.Access; +import com.woorea.openstack.keystone.model.authentication.UsernamePassword; + +public class KeystoneTokenProvider { + + protected Keystone keystone; + + protected String username; + + protected String password; + + ConcurrentHashMap hashTenantAccess; + + public KeystoneTokenProvider(String endpoint, String username, String password) { + this.keystone = new Keystone(endpoint); + this.username = username; + this.password = password; + this.hashTenantAccess = new ConcurrentHashMap(); + } + + public Access getAccessByTenant(String tenantName) { + Access access = hashTenantAccess.get(tenantName); + if (access == null) { + access = keystone.tokens().authenticate(new UsernamePassword(username, password)) + .withTenantName(tenantName) + .execute(); + hashTenantAccess.put(tenantName, access); + } + return access; + } + + public void expireAccessByTenant(String tenantName) { + hashTenantAccess.remove(tenantName); + } + + public OpenStackTokenProvider getProviderByTenant(final String tenantName) { + final KeystoneTokenProvider keystoneTokenProvider = this; + return new OpenStackTokenProvider() { + @Override + public String getToken() { + return keystoneTokenProvider.getAccessByTenant(tenantName) + .getToken().getId(); + } + @Override + public void expireToken() { + keystoneTokenProvider.expireAccessByTenant(tenantName); + } + }; + } +} diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/utils/KeystoneUtils.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/utils/KeystoneUtils.java index 8269597db..e679af6d6 100644 --- a/keystone-client/src/main/java/com/woorea/openstack/keystone/utils/KeystoneUtils.java +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/utils/KeystoneUtils.java @@ -1,28 +1,28 @@ -package com.woorea.openstack.keystone.utils; - -import java.util.List; - -import com.woorea.openstack.keystone.model.Access.Service; - -public class KeystoneUtils { - - public static String findEndpointURL(List serviceCatalog, String type, String region, String facing) { - for(Service service : serviceCatalog) { - if(type.equals(service.getType())) { - for(Service.Endpoint endpoint : service.getEndpoints()) { - if(region == null || region.equals(endpoint.getRegion())) { - if(endpoint.getPublicURL() != null && facing.equals("public")) { - return endpoint.getPublicURL(); - } else if(endpoint.getInternalURL() != null && facing.equals("internal")) { - return endpoint.getInternalURL(); - } else if(endpoint.getAdminURL() != null && facing.equals("admin")) { - return endpoint.getAdminURL(); - } - } - } - } - } - throw new RuntimeException("endpoint url not found"); - } - -} +package com.woorea.openstack.keystone.utils; + +import java.util.List; + +import com.woorea.openstack.keystone.model.Access.Service; + +public class KeystoneUtils { + + public static String findEndpointURL(List serviceCatalog, String type, String region, String facing) { + for(Service service : serviceCatalog) { + if(type.equals(service.getType())) { + for(Service.Endpoint endpoint : service.getEndpoints()) { + if(region == null || region.equals(endpoint.getRegion())) { + if(endpoint.getPublicURL() != null && facing.equals("public")) { + return endpoint.getPublicURL(); + } else if(endpoint.getInternalURL() != null && facing.equals("internal")) { + return endpoint.getInternalURL(); + } else if(endpoint.getAdminURL() != null && facing.equals("admin")) { + return endpoint.getAdminURL(); + } + } + } + } + } + throw new RuntimeException("endpoint url not found"); + } + +} diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/CredentialsResources.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/CredentialsResources.java index 7be2620da..01356f683 100644 --- a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/CredentialsResources.java +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/CredentialsResources.java @@ -1,13 +1,13 @@ -package com.woorea.openstack.keystone.v3.api; - -import com.woorea.openstack.base.client.OpenStackClient; -import com.woorea.openstack.keystone.v3.model.Credential; -import com.woorea.openstack.keystone.v3.model.Credentials; - -public class CredentialsResources extends GenericResource { - - public CredentialsResources(OpenStackClient client) { - super(client, "/credentials", Credential.class, Credentials.class); - } - -} +package com.woorea.openstack.keystone.v3.api; + +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.keystone.v3.model.Credential; +import com.woorea.openstack.keystone.v3.model.Credentials; + +public class CredentialsResources extends GenericResource { + + public CredentialsResources(OpenStackClient client) { + super(client, "/credentials", Credential.class, Credentials.class); + } + +} diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/DomainGroupRolesResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/DomainGroupRolesResource.java index a041ba20b..6c0e14093 100644 --- a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/DomainGroupRolesResource.java +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/DomainGroupRolesResource.java @@ -1,13 +1,13 @@ -package com.woorea.openstack.keystone.v3.api; - -import com.woorea.openstack.base.client.OpenStackClient; -import com.woorea.openstack.keystone.v3.model.Role; -import com.woorea.openstack.keystone.v3.model.Roles; - -public class DomainGroupRolesResource extends GenericResource { - - public DomainGroupRolesResource(OpenStackClient client, String path) { - super(client, path, Role.class, Roles.class); - } - -} +package com.woorea.openstack.keystone.v3.api; + +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.keystone.v3.model.Role; +import com.woorea.openstack.keystone.v3.model.Roles; + +public class DomainGroupRolesResource extends GenericResource { + + public DomainGroupRolesResource(OpenStackClient client, String path) { + super(client, path, Role.class, Roles.class); + } + +} diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/DomainUserRolesResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/DomainUserRolesResource.java index 9a6e8e566..854609293 100644 --- a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/DomainUserRolesResource.java +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/DomainUserRolesResource.java @@ -1,24 +1,24 @@ -package com.woorea.openstack.keystone.v3.api; - -import com.woorea.openstack.base.client.Entity; -import com.woorea.openstack.base.client.HttpMethod; -import com.woorea.openstack.base.client.OpenStackClient; -import com.woorea.openstack.base.client.OpenStackRequest; -import com.woorea.openstack.keystone.model.Role; -import com.woorea.openstack.keystone.model.Roles; - -public class DomainUserRolesResource extends GenericResource { - - public DomainUserRolesResource(OpenStackClient client, String path) { - super(client, path, Role.class, Roles.class); - } - - public OpenStackRequest add(String roleId) { - return new OpenStackRequest(CLIENT, HttpMethod.PUT, new StringBuilder(path).append("/").append(roleId).toString(), Entity.json(""), Void.class); - } - - public OpenStackRequest remove(String roleId) { - return new OpenStackRequest(CLIENT, HttpMethod.DELETE, new StringBuilder(path).append("/").append(roleId).toString(), null, Void.class); - } - -} +package com.woorea.openstack.keystone.v3.api; + +import com.woorea.openstack.base.client.Entity; +import com.woorea.openstack.base.client.HttpMethod; +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.base.client.OpenStackRequest; +import com.woorea.openstack.keystone.model.Role; +import com.woorea.openstack.keystone.model.Roles; + +public class DomainUserRolesResource extends GenericResource { + + public DomainUserRolesResource(OpenStackClient client, String path) { + super(client, path, Role.class, Roles.class); + } + + public OpenStackRequest add(String roleId) { + return new OpenStackRequest(CLIENT, HttpMethod.PUT, new StringBuilder(path).append("/").append(roleId).toString(), Entity.json(""), Void.class); + } + + public OpenStackRequest remove(String roleId) { + return new OpenStackRequest(CLIENT, HttpMethod.DELETE, new StringBuilder(path).append("/").append(roleId).toString(), null, Void.class); + } + +} diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/DomainsResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/DomainsResource.java index 28015eec4..d7a405d61 100644 --- a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/DomainsResource.java +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/DomainsResource.java @@ -1,21 +1,21 @@ -package com.woorea.openstack.keystone.v3.api; - -import com.woorea.openstack.base.client.OpenStackClient; -import com.woorea.openstack.keystone.v3.model.Domain; -import com.woorea.openstack.keystone.v3.model.Domains; - -public class DomainsResource extends GenericResource { - - public DomainsResource(OpenStackClient client) { - super(client, "/domains", Domain.class, Domains.class); - } - - public DomainUserRolesResource userRoles(String domainId, String userId) { - return new DomainUserRolesResource(CLIENT, new StringBuilder(path).append("/").append(domainId).append("/users/").append(userId).append("/roles").toString()); - } - - public DomainUserRolesResource groupRoles(String domainId, String groupId) { - return new DomainUserRolesResource(CLIENT, new StringBuilder(path).append("/").append(domainId).append("/groups/").append(groupId).append("/roles").toString()); - } - -} +package com.woorea.openstack.keystone.v3.api; + +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.keystone.v3.model.Domain; +import com.woorea.openstack.keystone.v3.model.Domains; + +public class DomainsResource extends GenericResource { + + public DomainsResource(OpenStackClient client) { + super(client, "/domains", Domain.class, Domains.class); + } + + public DomainUserRolesResource userRoles(String domainId, String userId) { + return new DomainUserRolesResource(CLIENT, new StringBuilder(path).append("/").append(domainId).append("/users/").append(userId).append("/roles").toString()); + } + + public DomainUserRolesResource groupRoles(String domainId, String groupId) { + return new DomainUserRolesResource(CLIENT, new StringBuilder(path).append("/").append(domainId).append("/groups/").append(groupId).append("/roles").toString()); + } + +} diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/EndpointsResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/EndpointsResource.java index d1db88a14..a68f1ae18 100644 --- a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/EndpointsResource.java +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/EndpointsResource.java @@ -1,13 +1,13 @@ -package com.woorea.openstack.keystone.v3.api; - -import com.woorea.openstack.base.client.OpenStackClient; -import com.woorea.openstack.keystone.v3.model.Endpoint; -import com.woorea.openstack.keystone.v3.model.Endpoints; - -public class EndpointsResource extends GenericResource { - - public EndpointsResource(OpenStackClient client) { - super(client, "/endpoints", Endpoint.class, Endpoints.class); - } - -} +package com.woorea.openstack.keystone.v3.api; + +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.keystone.v3.model.Endpoint; +import com.woorea.openstack.keystone.v3.model.Endpoints; + +public class EndpointsResource extends GenericResource { + + public EndpointsResource(OpenStackClient client) { + super(client, "/endpoints", Endpoint.class, Endpoints.class); + } + +} diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/GenericResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/GenericResource.java index 117e941df..40551f498 100644 --- a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/GenericResource.java +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/GenericResource.java @@ -1,44 +1,44 @@ -package com.woorea.openstack.keystone.v3.api; - -import com.woorea.openstack.base.client.Entity; -import com.woorea.openstack.base.client.HttpMethod; -import com.woorea.openstack.base.client.OpenStackClient; -import com.woorea.openstack.base.client.OpenStackRequest; - -public class GenericResource { - - protected final OpenStackClient CLIENT; - - protected CharSequence path; - - protected Class oneClass; - protected Class manyClass; - - public GenericResource(OpenStackClient client, CharSequence path, Class oneClass, Class manyClass) { - CLIENT = client; - this.path = path; - this.oneClass = oneClass; - this.manyClass = manyClass; - } - - public OpenStackRequest list() { - return new OpenStackRequest(CLIENT, HttpMethod.GET, path, null, manyClass); - } - - public OpenStackRequest create(One one) { - return new OpenStackRequest(CLIENT, HttpMethod.POST, path, Entity.json(one), oneClass); - } - - public OpenStackRequest show(String id) { - return new OpenStackRequest(CLIENT, HttpMethod.GET, new StringBuilder(path).append("/").append(id).toString(), null, oneClass); - } - - public OpenStackRequest update(String id, One one) { - return new OpenStackRequest(CLIENT, HttpMethod.PATCH, new StringBuilder(path).append("/").append(id).toString(), Entity.json(one), oneClass); - } - - public OpenStackRequest delete(String id) { - return new OpenStackRequest(CLIENT, HttpMethod.DELETE, new StringBuilder(path).append("/").append(id).toString(), null, oneClass); - } - -} +package com.woorea.openstack.keystone.v3.api; + +import com.woorea.openstack.base.client.Entity; +import com.woorea.openstack.base.client.HttpMethod; +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.base.client.OpenStackRequest; + +public class GenericResource { + + protected final OpenStackClient CLIENT; + + protected CharSequence path; + + protected Class oneClass; + protected Class manyClass; + + public GenericResource(OpenStackClient client, CharSequence path, Class oneClass, Class manyClass) { + CLIENT = client; + this.path = path; + this.oneClass = oneClass; + this.manyClass = manyClass; + } + + public OpenStackRequest list() { + return new OpenStackRequest(CLIENT, HttpMethod.GET, path, null, manyClass); + } + + public OpenStackRequest create(One one) { + return new OpenStackRequest(CLIENT, HttpMethod.POST, path, Entity.json(one), oneClass); + } + + public OpenStackRequest show(String id) { + return new OpenStackRequest(CLIENT, HttpMethod.GET, new StringBuilder(path).append("/").append(id).toString(), null, oneClass); + } + + public OpenStackRequest update(String id, One one) { + return new OpenStackRequest(CLIENT, HttpMethod.PATCH, new StringBuilder(path).append("/").append(id).toString(), Entity.json(one), oneClass); + } + + public OpenStackRequest delete(String id) { + return new OpenStackRequest(CLIENT, HttpMethod.DELETE, new StringBuilder(path).append("/").append(id).toString(), null, oneClass); + } + +} diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/GroupUsersResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/GroupUsersResource.java index 60cce41c4..7a7464149 100644 --- a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/GroupUsersResource.java +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/GroupUsersResource.java @@ -1,14 +1,14 @@ -package com.woorea.openstack.keystone.v3.api; - -import com.woorea.openstack.base.client.OpenStackClient; -import com.woorea.openstack.keystone.v3.model.User; -import com.woorea.openstack.keystone.v3.model.Users; - - -public class GroupUsersResource extends GenericResource { - - public GroupUsersResource(OpenStackClient client, String path) { - super(client, path, User.class, Users.class); - } - -} +package com.woorea.openstack.keystone.v3.api; + +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.keystone.v3.model.User; +import com.woorea.openstack.keystone.v3.model.Users; + + +public class GroupUsersResource extends GenericResource { + + public GroupUsersResource(OpenStackClient client, String path) { + super(client, path, User.class, Users.class); + } + +} diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/GroupsResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/GroupsResource.java index be380cc87..bbdbe67e2 100644 --- a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/GroupsResource.java +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/GroupsResource.java @@ -1,17 +1,17 @@ -package com.woorea.openstack.keystone.v3.api; - -import com.woorea.openstack.base.client.OpenStackClient; -import com.woorea.openstack.keystone.v3.model.Group; -import com.woorea.openstack.keystone.v3.model.Groups; - -public class GroupsResource extends GenericResource { - - public GroupsResource(OpenStackClient client) { - super(client, "/groups", Group.class, Groups.class); - } - - public DomainUserRolesResource userRoles(String domainId, String userId) { - return new DomainUserRolesResource(CLIENT, new StringBuilder(path).append("/").append(domainId).append("/users/").append(userId).append("/roles").toString()); - } - -} +package com.woorea.openstack.keystone.v3.api; + +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.keystone.v3.model.Group; +import com.woorea.openstack.keystone.v3.model.Groups; + +public class GroupsResource extends GenericResource { + + public GroupsResource(OpenStackClient client) { + super(client, "/groups", Group.class, Groups.class); + } + + public DomainUserRolesResource userRoles(String domainId, String userId) { + return new DomainUserRolesResource(CLIENT, new StringBuilder(path).append("/").append(domainId).append("/users/").append(userId).append("/roles").toString()); + } + +} diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/ProjectGroupRolesResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/ProjectGroupRolesResource.java index caed8acd7..ce6005fc9 100644 --- a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/ProjectGroupRolesResource.java +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/ProjectGroupRolesResource.java @@ -1,34 +1,34 @@ -package com.woorea.openstack.keystone.v3.api; - -import com.woorea.openstack.base.client.OpenStackClient; -import com.woorea.openstack.base.client.OpenStackRequest; -import com.woorea.openstack.keystone.model.Role; -import com.woorea.openstack.keystone.model.Roles; - -public class ProjectGroupRolesResource extends GenericResource { - - public ProjectGroupRolesResource(OpenStackClient client, String path) { - super(client, path, Role.class, Roles.class); - } - - @Override - public OpenStackRequest create(Role one) { - throw new UnsupportedOperationException(); - } - - @Override - public OpenStackRequest show(String id) { - throw new UnsupportedOperationException(); - } - - @Override - public OpenStackRequest update(String id, Role one) { - throw new UnsupportedOperationException(); - } - - @Override - public OpenStackRequest delete(String id) { - throw new UnsupportedOperationException(); - } - -} +package com.woorea.openstack.keystone.v3.api; + +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.base.client.OpenStackRequest; +import com.woorea.openstack.keystone.model.Role; +import com.woorea.openstack.keystone.model.Roles; + +public class ProjectGroupRolesResource extends GenericResource { + + public ProjectGroupRolesResource(OpenStackClient client, String path) { + super(client, path, Role.class, Roles.class); + } + + @Override + public OpenStackRequest create(Role one) { + throw new UnsupportedOperationException(); + } + + @Override + public OpenStackRequest show(String id) { + throw new UnsupportedOperationException(); + } + + @Override + public OpenStackRequest update(String id, Role one) { + throw new UnsupportedOperationException(); + } + + @Override + public OpenStackRequest delete(String id) { + throw new UnsupportedOperationException(); + } + +} diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/ProjectRolesResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/ProjectRolesResource.java index 7e7e2fa30..baa0a8e5b 100644 --- a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/ProjectRolesResource.java +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/ProjectRolesResource.java @@ -1,27 +1,27 @@ -package com.woorea.openstack.keystone.v3.api; - -import com.woorea.openstack.base.client.Entity; -import com.woorea.openstack.base.client.HttpMethod; -import com.woorea.openstack.base.client.OpenStackClient; -import com.woorea.openstack.base.client.OpenStackRequest; - -public class ProjectRolesResource { - - private final OpenStackClient CLIENT; - - private final String PATH; - - public ProjectRolesResource(OpenStackClient client, String path) { - this.CLIENT = client; - this.PATH = path; - } - - public OpenStackRequest add(String roleId) { - return new OpenStackRequest(CLIENT, HttpMethod.PUT, new StringBuilder(PATH).append("/").append(roleId).toString(), Entity.json(""), Void.class); - } - - public OpenStackRequest remove(String roleId) { - return new OpenStackRequest(CLIENT, HttpMethod.DELETE, new StringBuilder(PATH).append("/").append(roleId).toString(), null, Void.class); - } - -} +package com.woorea.openstack.keystone.v3.api; + +import com.woorea.openstack.base.client.Entity; +import com.woorea.openstack.base.client.HttpMethod; +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.base.client.OpenStackRequest; + +public class ProjectRolesResource { + + private final OpenStackClient CLIENT; + + private final String PATH; + + public ProjectRolesResource(OpenStackClient client, String path) { + this.CLIENT = client; + this.PATH = path; + } + + public OpenStackRequest add(String roleId) { + return new OpenStackRequest(CLIENT, HttpMethod.PUT, new StringBuilder(PATH).append("/").append(roleId).toString(), Entity.json(""), Void.class); + } + + public OpenStackRequest remove(String roleId) { + return new OpenStackRequest(CLIENT, HttpMethod.DELETE, new StringBuilder(PATH).append("/").append(roleId).toString(), null, Void.class); + } + +} diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/ProjectUserRolesResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/ProjectUserRolesResource.java index 9e314b937..663a1063f 100644 --- a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/ProjectUserRolesResource.java +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/ProjectUserRolesResource.java @@ -1,13 +1,13 @@ -package com.woorea.openstack.keystone.v3.api; - -import com.woorea.openstack.base.client.OpenStackClient; -import com.woorea.openstack.keystone.model.Role; -import com.woorea.openstack.keystone.model.Roles; - -public class ProjectUserRolesResource extends GenericResource { - - public ProjectUserRolesResource(OpenStackClient client, String path) { - super(client, path, Role.class, Roles.class); - } - -} +package com.woorea.openstack.keystone.v3.api; + +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.keystone.model.Role; +import com.woorea.openstack.keystone.model.Roles; + +public class ProjectUserRolesResource extends GenericResource { + + public ProjectUserRolesResource(OpenStackClient client, String path) { + super(client, path, Role.class, Roles.class); + } + +} diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/ProjectsResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/ProjectsResource.java index 9e23563e4..8e05b1054 100644 --- a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/ProjectsResource.java +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/ProjectsResource.java @@ -1,27 +1,27 @@ -package com.woorea.openstack.keystone.v3.api; - -import com.woorea.openstack.base.client.OpenStackClient; -import com.woorea.openstack.base.client.OpenStackRequest; -import com.woorea.openstack.keystone.model.Users; -import com.woorea.openstack.keystone.v3.model.Project; -import com.woorea.openstack.keystone.v3.model.Projects; - -public class ProjectsResource extends GenericResource { - - public ProjectsResource(OpenStackClient client) { - super(client, "/projects", Project.class, Projects.class); - } - - public OpenStackRequest users(String projectId) { - return CLIENT.get(new StringBuilder(path).append("/").append(projectId).append("/users/").toString(), Users.class); - } - - public DomainUserRolesResource userRoles(String projectId, String userId) { - return new DomainUserRolesResource(CLIENT, new StringBuilder(path).append("/").append(projectId).append("/users/").append(userId).append("/roles").toString()); - } - - public DomainUserRolesResource groupRoles(String projectId, String groupId) { - return new DomainUserRolesResource(CLIENT, new StringBuilder(path).append("/").append(projectId).append("/groups/").append(groupId).append("/roles").toString()); - } - -} +package com.woorea.openstack.keystone.v3.api; + +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.base.client.OpenStackRequest; +import com.woorea.openstack.keystone.model.Users; +import com.woorea.openstack.keystone.v3.model.Project; +import com.woorea.openstack.keystone.v3.model.Projects; + +public class ProjectsResource extends GenericResource { + + public ProjectsResource(OpenStackClient client) { + super(client, "/projects", Project.class, Projects.class); + } + + public OpenStackRequest users(String projectId) { + return CLIENT.get(new StringBuilder(path).append("/").append(projectId).append("/users/").toString(), Users.class); + } + + public DomainUserRolesResource userRoles(String projectId, String userId) { + return new DomainUserRolesResource(CLIENT, new StringBuilder(path).append("/").append(projectId).append("/users/").append(userId).append("/roles").toString()); + } + + public DomainUserRolesResource groupRoles(String projectId, String groupId) { + return new DomainUserRolesResource(CLIENT, new StringBuilder(path).append("/").append(projectId).append("/groups/").append(groupId).append("/roles").toString()); + } + +} diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/RolesResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/RolesResource.java index 2c28a1bfa..a4c0aaf4b 100644 --- a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/RolesResource.java +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/RolesResource.java @@ -1,19 +1,19 @@ -package com.woorea.openstack.keystone.v3.api; - -import com.woorea.openstack.base.client.OpenStackClient; -import com.woorea.openstack.base.client.OpenStackRequest; -import com.woorea.openstack.keystone.v3.model.Role; -import com.woorea.openstack.keystone.v3.model.Roles; -import com.woorea.openstack.keystone.v3.model.Users; - -public class RolesResource extends GenericResource { - - public RolesResource(OpenStackClient client) { - super(client, "/roles", Role.class, Roles.class); - } - - public OpenStackRequest users(String domainId, String userId) { - return CLIENT.get(new StringBuilder(path).append("/").append(domainId).append("/users/").append(userId).append("/roles").toString(), Users.class); - } - -} +package com.woorea.openstack.keystone.v3.api; + +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.base.client.OpenStackRequest; +import com.woorea.openstack.keystone.v3.model.Role; +import com.woorea.openstack.keystone.v3.model.Roles; +import com.woorea.openstack.keystone.v3.model.Users; + +public class RolesResource extends GenericResource { + + public RolesResource(OpenStackClient client) { + super(client, "/roles", Role.class, Roles.class); + } + + public OpenStackRequest users(String domainId, String userId) { + return CLIENT.get(new StringBuilder(path).append("/").append(domainId).append("/users/").append(userId).append("/roles").toString(), Users.class); + } + +} diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/ServicesResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/ServicesResource.java index 4742a2f04..08bc27226 100644 --- a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/ServicesResource.java +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/ServicesResource.java @@ -1,13 +1,13 @@ -package com.woorea.openstack.keystone.v3.api; - -import com.woorea.openstack.base.client.OpenStackClient; -import com.woorea.openstack.keystone.model.Service; -import com.woorea.openstack.keystone.model.Services; - -public class ServicesResource extends GenericResource { - - public ServicesResource(OpenStackClient client) { - super(client, "/services", Service.class, Services.class); - } - -} +package com.woorea.openstack.keystone.v3.api; + +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.keystone.model.Service; +import com.woorea.openstack.keystone.model.Services; + +public class ServicesResource extends GenericResource { + + public ServicesResource(OpenStackClient client) { + super(client, "/services", Service.class, Services.class); + } + +} diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/TokensResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/TokensResource.java index c2d53b300..a0cbdf6d5 100644 --- a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/TokensResource.java +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/TokensResource.java @@ -1,42 +1,42 @@ -package com.woorea.openstack.keystone.v3.api; - -import com.woorea.openstack.base.client.Entity; -import com.woorea.openstack.base.client.HttpMethod; -import com.woorea.openstack.base.client.OpenStackClient; -import com.woorea.openstack.base.client.OpenStackRequest; -import com.woorea.openstack.keystone.v3.model.Authentication; -import com.woorea.openstack.keystone.v3.model.Token; - -public class TokensResource { - - private final OpenStackClient CLIENT; - - public TokensResource(OpenStackClient client) { - CLIENT = client; - } - - public Authenticate authenticate(Authentication authentication) { - return new Authenticate(authentication); - } - - public OpenStackRequest show() { - return CLIENT.get("/auth/tokens", Token.class); - } - - public class Authenticate extends OpenStackRequest { - - private Authentication authentication; - - public Authenticate() { - - } - - public Authenticate(Authentication authentication) { - super(CLIENT, HttpMethod.POST, "/auth/tokens", Entity.json(authentication), Token.class); - this.authentication = authentication; - } - - } - -} - +package com.woorea.openstack.keystone.v3.api; + +import com.woorea.openstack.base.client.Entity; +import com.woorea.openstack.base.client.HttpMethod; +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.base.client.OpenStackRequest; +import com.woorea.openstack.keystone.v3.model.Authentication; +import com.woorea.openstack.keystone.v3.model.Token; + +public class TokensResource { + + private final OpenStackClient CLIENT; + + public TokensResource(OpenStackClient client) { + CLIENT = client; + } + + public Authenticate authenticate(Authentication authentication) { + return new Authenticate(authentication); + } + + public OpenStackRequest show() { + return CLIENT.get("/auth/tokens", Token.class); + } + + public class Authenticate extends OpenStackRequest { + + private Authentication authentication; + + public Authenticate() { + + } + + public Authenticate(Authentication authentication) { + super(CLIENT, HttpMethod.POST, "/auth/tokens", Entity.json(authentication), Token.class); + this.authentication = authentication; + } + + } + +} + diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/UsersResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/UsersResource.java index d6a6d1400..233898e1c 100644 --- a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/UsersResource.java +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/UsersResource.java @@ -1,27 +1,27 @@ -package com.woorea.openstack.keystone.v3.api; - -import com.woorea.openstack.base.client.OpenStackClient; -import com.woorea.openstack.base.client.OpenStackRequest; -import com.woorea.openstack.keystone.model.Services; -import com.woorea.openstack.keystone.v3.model.User; -import com.woorea.openstack.keystone.v3.model.Users; - -public class UsersResource extends GenericResource { - - public UsersResource(OpenStackClient client) { - super(client, "/users", User.class, Users.class); - } - - public OpenStackRequest groups(String userId) { - return CLIENT.get(new StringBuilder(path).append("/").append(userId).append("/groups").toString(), Services.class); - } - - public OpenStackRequest projects(String userId) { - return CLIENT.get(new StringBuilder(path).append("/").append(userId).append("/projects").toString(), Services.class); - } - - public OpenStackRequest roles(String userId) { - return CLIENT.get(new StringBuilder(path).append("/").append(userId).append("/roles").toString(), Services.class); - } - -} +package com.woorea.openstack.keystone.v3.api; + +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.base.client.OpenStackRequest; +import com.woorea.openstack.keystone.model.Services; +import com.woorea.openstack.keystone.v3.model.User; +import com.woorea.openstack.keystone.v3.model.Users; + +public class UsersResource extends GenericResource { + + public UsersResource(OpenStackClient client) { + super(client, "/users", User.class, Users.class); + } + + public OpenStackRequest groups(String userId) { + return CLIENT.get(new StringBuilder(path).append("/").append(userId).append("/groups").toString(), Services.class); + } + + public OpenStackRequest projects(String userId) { + return CLIENT.get(new StringBuilder(path).append("/").append(userId).append("/projects").toString(), Services.class); + } + + public OpenStackRequest roles(String userId) { + return CLIENT.get(new StringBuilder(path).append("/").append(userId).append("/roles").toString(), Services.class); + } + +} diff --git a/keystone-model/.gitignore b/keystone-model/.gitignore new file mode 100644 index 000000000..19f2e002c --- /dev/null +++ b/keystone-model/.gitignore @@ -0,0 +1,2 @@ +/target +/target diff --git a/keystone-model/pom.xml b/keystone-model/pom.xml index 0c8794192..464535064 100644 --- a/keystone-model/pom.xml +++ b/keystone-model/pom.xml @@ -1,11 +1,11 @@ - - 4.0.0 - - com.woorea - openstack-java-sdk - 3.2.2-SNAPSHOT - - keystone-model - OpenStack Keystone Model - OpenStack Keystone Model + + 4.0.0 + + com.woorea + openstack-java-sdk + 3.2.2-SNAPSHOT + + keystone-model + OpenStack Keystone Model + OpenStack Keystone Model \ No newline at end of file diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Extra.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Extra.java new file mode 100644 index 000000000..3d0f21493 --- /dev/null +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Extra.java @@ -0,0 +1,27 @@ +package com.woorea.openstack.keystone.model; + +import java.io.Serializable; +import java.util.HashMap; +import java.util.Map; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; + +public class Extra implements Serializable { + + Map map = new HashMap(); + + @JsonAnyGetter + public Map any() { + return map; + } + + @JsonAnySetter + public void set(String name, String value) { + map.put(name, value); + } + + public String toString() { + return "extra=" + map.toString(); + } +} diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Link.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Link.java index a673bcaea..5377f7c50 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Link.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Link.java @@ -1,42 +1,42 @@ -package com.woorea.openstack.keystone.model; - -import java.io.Serializable; - -public class Link implements Serializable { - - private String rel; - - private String href; - - private String type; - - /** - * @return the rel - */ - public String getRel() { - return rel; - } - - /** - * @return the href - */ - public String getHref() { - return href; - } - - /** - * @return the type - */ - public String getType() { - return type; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Link [rel=" + rel + ", href=" + href + ", type=" + type + "]"; - } - -} +package com.woorea.openstack.keystone.model; + +import java.io.Serializable; + +public class Link implements Serializable { + + private String rel; + + private String href; + + private String type; + + /** + * @return the rel + */ + public String getRel() { + return rel; + } + + /** + * @return the href + */ + public String getHref() { + return href; + } + + /** + * @return the type + */ + public String getType() { + return type; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Link [rel=" + rel + ", href=" + href + ", type=" + type + "]"; + } + +} diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Token.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Token.java index 92d34ee61..d2943106c 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Token.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Token.java @@ -1,52 +1,52 @@ -package com.woorea.openstack.keystone.model; - -import java.util.Calendar; - -public final class Token { - - private String id; - - private Calendar issued_at; - - private Calendar expires; - - private Tenant tenant; - - /** - * @return the id - */ - public String getId() { - return id; - } - - /** - * @return the issued_at - */ - public Calendar getIssued_at() { - return issued_at; - } - - /** - * @return the expires - */ - public Calendar getExpires() { - return expires; - } - - /** - * @return the tenant - */ - public Tenant getTenant() { - return tenant; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Token [id=" + id + ", Issued_at=" + issued_at + ", expires=" + expires + ", tenant=" - + tenant + "]"; - } - +package com.woorea.openstack.keystone.model; + +import java.util.Calendar; + +public final class Token { + + private String id; + + private Calendar issued_at; + + private Calendar expires; + + private Tenant tenant; + + /** + * @return the id + */ + public String getId() { + return id; + } + + /** + * @return the issued_at + */ + public Calendar getIssued_at() { + return issued_at; + } + + /** + * @return the expires + */ + public Calendar getExpires() { + return expires; + } + + /** + * @return the tenant + */ + public Tenant getTenant() { + return tenant; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Token [id=" + id + ", Issued_at=" + issued_at + ", expires=" + expires + ", tenant=" + + tenant + "]"; + } + } \ No newline at end of file diff --git a/nova-client/pom.xml b/nova-client/pom.xml index f967af043..2b8cc2f9b 100644 --- a/nova-client/pom.xml +++ b/nova-client/pom.xml @@ -1,23 +1,23 @@ - - 4.0.0 - - com.woorea - openstack-java-sdk - 3.2.2-SNAPSHOT - - nova-client - OpenStack Nova Client - OpenStack Nova Client - - - com.woorea - openstack-client - 3.2.2-SNAPSHOT - - - com.woorea - nova-model - 3.2.2-SNAPSHOT - - + + 4.0.0 + + com.woorea + openstack-java-sdk + 3.2.2-SNAPSHOT + + nova-client + OpenStack Nova Client + OpenStack Nova Client + + + com.woorea + openstack-client + 3.2.2-SNAPSHOT + + + com.woorea + nova-model + 3.2.2-SNAPSHOT + + \ No newline at end of file diff --git a/nova-client/src/main/java/com/woorea/openstack/nova/api/ExtensionsResource.java b/nova-client/src/main/java/com/woorea/openstack/nova/api/ExtensionsResource.java index 46e16c440..af5e1616e 100644 --- a/nova-client/src/main/java/com/woorea/openstack/nova/api/ExtensionsResource.java +++ b/nova-client/src/main/java/com/woorea/openstack/nova/api/ExtensionsResource.java @@ -1,30 +1,30 @@ -package com.woorea.openstack.nova.api; - - -import com.woorea.openstack.base.client.HttpMethod; -import com.woorea.openstack.base.client.OpenStackClient; -import com.woorea.openstack.base.client.OpenStackRequest; -import com.woorea.openstack.nova.model.Extensions; - -public class ExtensionsResource { - - private final OpenStackClient CLIENT; - - public ExtensionsResource(OpenStackClient client) { - CLIENT = client; - } - - public List list(boolean detail) { - return new List(detail); - } - - public class List extends OpenStackRequest { - - public List(boolean detail) { - super(CLIENT, HttpMethod.GET, detail ? "extensions/detail" : "extensions", null, Extensions.class); - } - - } - -} - +package com.woorea.openstack.nova.api; + + +import com.woorea.openstack.base.client.HttpMethod; +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.base.client.OpenStackRequest; +import com.woorea.openstack.nova.model.Extensions; + +public class ExtensionsResource { + + private final OpenStackClient CLIENT; + + public ExtensionsResource(OpenStackClient client) { + CLIENT = client; + } + + public List list(boolean detail) { + return new List(detail); + } + + public class List extends OpenStackRequest { + + public List(boolean detail) { + super(CLIENT, HttpMethod.GET, detail ? "extensions/detail" : "extensions", null, Extensions.class); + } + + } + +} + diff --git a/nova-client/src/main/java/com/woorea/openstack/nova/api/FlavorsResource.java b/nova-client/src/main/java/com/woorea/openstack/nova/api/FlavorsResource.java index c3e2256e0..ebd380c68 100644 --- a/nova-client/src/main/java/com/woorea/openstack/nova/api/FlavorsResource.java +++ b/nova-client/src/main/java/com/woorea/openstack/nova/api/FlavorsResource.java @@ -1,85 +1,85 @@ -package com.woorea.openstack.nova.api; - - -import com.woorea.openstack.base.client.Entity; -import com.woorea.openstack.base.client.HttpMethod; -import com.woorea.openstack.base.client.OpenStackClient; -import com.woorea.openstack.base.client.OpenStackRequest; -import com.woorea.openstack.nova.model.Flavor; -import com.woorea.openstack.nova.model.Flavors; -import com.woorea.openstack.nova.model.Metadata; - -public class FlavorsResource { - - private final OpenStackClient CLIENT; - - public FlavorsResource(OpenStackClient client) { - CLIENT = client; - } - - public List list(boolean detail) { - return new List(detail); - } - - public Create create(Flavor flavor) { - return new Create(flavor); - } - - public Show show(String id) { - return new Show(id); - } - - public ShowMetadata showMetadata(String id) { - return new ShowMetadata(id); - } - - - public Delete delete(String id) { - return new Delete(id); - } - - public class List extends OpenStackRequest { - - public List(boolean detail) { - super(CLIENT, HttpMethod.GET, detail ? "/flavors/detail" : "/flavors", null, Flavors.class); - } - - } - - public class Create extends OpenStackRequest { - - private Flavor flavor; - - public Create(Flavor flavor) { - super(CLIENT, HttpMethod.POST, "/flavors", Entity.json(flavor), Flavor.class); - this.flavor = flavor; - } - - } - - public class Show extends OpenStackRequest { - - public Show(String id) { - super(CLIENT, HttpMethod.GET, new StringBuilder("/flavors/").append(id).toString(), null, Flavor.class); - } - - } - - public class ShowMetadata extends OpenStackRequest { - - public ShowMetadata(String id) { - super(CLIENT, HttpMethod.GET, new StringBuilder("/flavors/").append(id).append("/metadata").toString(), null, Metadata.class); - } - - } - - public class Delete extends OpenStackRequest { - - public Delete(String id) { - super(CLIENT, HttpMethod.DELETE, new StringBuilder("/flavors/").append(id).toString(), null, Void.class); - } - - } - -} - +package com.woorea.openstack.nova.api; + + +import com.woorea.openstack.base.client.Entity; +import com.woorea.openstack.base.client.HttpMethod; +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.base.client.OpenStackRequest; +import com.woorea.openstack.nova.model.Flavor; +import com.woorea.openstack.nova.model.Flavors; +import com.woorea.openstack.nova.model.Metadata; + +public class FlavorsResource { + + private final OpenStackClient CLIENT; + + public FlavorsResource(OpenStackClient client) { + CLIENT = client; + } + + public List list(boolean detail) { + return new List(detail); + } + + public Create create(Flavor flavor) { + return new Create(flavor); + } + + public Show show(String id) { + return new Show(id); + } + + public ShowMetadata showMetadata(String id) { + return new ShowMetadata(id); + } + + + public Delete delete(String id) { + return new Delete(id); + } + + public class List extends OpenStackRequest { + + public List(boolean detail) { + super(CLIENT, HttpMethod.GET, detail ? "/flavors/detail" : "/flavors", null, Flavors.class); + } + + } + + public class Create extends OpenStackRequest { + + private Flavor flavor; + + public Create(Flavor flavor) { + super(CLIENT, HttpMethod.POST, "/flavors", Entity.json(flavor), Flavor.class); + this.flavor = flavor; + } + + } + + public class Show extends OpenStackRequest { + + public Show(String id) { + super(CLIENT, HttpMethod.GET, new StringBuilder("/flavors/").append(id).toString(), null, Flavor.class); + } + + } + + public class ShowMetadata extends OpenStackRequest { + + public ShowMetadata(String id) { + super(CLIENT, HttpMethod.GET, new StringBuilder("/flavors/").append(id).append("/metadata").toString(), null, Metadata.class); + } + + } + + public class Delete extends OpenStackRequest { + + public Delete(String id) { + super(CLIENT, HttpMethod.DELETE, new StringBuilder("/flavors/").append(id).toString(), null, Void.class); + } + + } + +} + diff --git a/nova-client/src/main/java/com/woorea/openstack/nova/api/ImagesResource.java b/nova-client/src/main/java/com/woorea/openstack/nova/api/ImagesResource.java index 780cb12ae..c25cc1213 100644 --- a/nova-client/src/main/java/com/woorea/openstack/nova/api/ImagesResource.java +++ b/nova-client/src/main/java/com/woorea/openstack/nova/api/ImagesResource.java @@ -1,85 +1,85 @@ -package com.woorea.openstack.nova.api; - - -import com.woorea.openstack.base.client.Entity; -import com.woorea.openstack.base.client.HttpMethod; -import com.woorea.openstack.base.client.OpenStackClient; -import com.woorea.openstack.base.client.OpenStackRequest; -import com.woorea.openstack.nova.model.Image; -import com.woorea.openstack.nova.model.Images; -import com.woorea.openstack.nova.model.Metadata; - -public class ImagesResource { - - private final OpenStackClient CLIENT; - - public ImagesResource(OpenStackClient client) { - CLIENT = client; - } - - public List list(boolean detail) { - return new List(detail); - } - - public Create create(Image image) { - return new Create(image); - } - - public Show show(String id) { - return new Show(id); - } - - public ShowMetadata showMetadata(String id) { - return new ShowMetadata(id); - } - - - public Delete delete(String id) { - return new Delete(id); - } - - public class List extends OpenStackRequest { - - public List(boolean detail) { - super(CLIENT, HttpMethod.GET, detail ? "/images/detail" : "/images", null, Images.class); - } - - } - - public class Create extends OpenStackRequest { - - private Image image; - - public Create(Image image) { - super(CLIENT, HttpMethod.POST, "/images", Entity.json(image), Image.class); - this.image = image; - } - - } - - public class Show extends OpenStackRequest { - - public Show(String id) { - super(CLIENT, HttpMethod.GET, new StringBuilder("/images/").append(id).toString(), null, Image.class); - } - - } - - public class ShowMetadata extends OpenStackRequest { - - public ShowMetadata(String id) { - super(CLIENT, HttpMethod.GET, new StringBuilder("/images/").append(id).append("/metadata").toString(), null, Metadata.class); - } - - } - - public class Delete extends OpenStackRequest { - - public Delete(String id) { - super(CLIENT, HttpMethod.DELETE, new StringBuilder("/images/").append(id).toString(), null, Void.class); - } - - } - -} - +package com.woorea.openstack.nova.api; + + +import com.woorea.openstack.base.client.Entity; +import com.woorea.openstack.base.client.HttpMethod; +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.base.client.OpenStackRequest; +import com.woorea.openstack.nova.model.Image; +import com.woorea.openstack.nova.model.Images; +import com.woorea.openstack.nova.model.Metadata; + +public class ImagesResource { + + private final OpenStackClient CLIENT; + + public ImagesResource(OpenStackClient client) { + CLIENT = client; + } + + public List list(boolean detail) { + return new List(detail); + } + + public Create create(Image image) { + return new Create(image); + } + + public Show show(String id) { + return new Show(id); + } + + public ShowMetadata showMetadata(String id) { + return new ShowMetadata(id); + } + + + public Delete delete(String id) { + return new Delete(id); + } + + public class List extends OpenStackRequest { + + public List(boolean detail) { + super(CLIENT, HttpMethod.GET, detail ? "/images/detail" : "/images", null, Images.class); + } + + } + + public class Create extends OpenStackRequest { + + private Image image; + + public Create(Image image) { + super(CLIENT, HttpMethod.POST, "/images", Entity.json(image), Image.class); + this.image = image; + } + + } + + public class Show extends OpenStackRequest { + + public Show(String id) { + super(CLIENT, HttpMethod.GET, new StringBuilder("/images/").append(id).toString(), null, Image.class); + } + + } + + public class ShowMetadata extends OpenStackRequest { + + public ShowMetadata(String id) { + super(CLIENT, HttpMethod.GET, new StringBuilder("/images/").append(id).append("/metadata").toString(), null, Metadata.class); + } + + } + + public class Delete extends OpenStackRequest { + + public Delete(String id) { + super(CLIENT, HttpMethod.DELETE, new StringBuilder("/images/").append(id).toString(), null, Void.class); + } + + } + +} + diff --git a/nova-client/src/main/java/com/woorea/openstack/nova/api/QuotaSetsResource.java b/nova-client/src/main/java/com/woorea/openstack/nova/api/QuotaSetsResource.java index 166fb42e3..4d5165a69 100644 --- a/nova-client/src/main/java/com/woorea/openstack/nova/api/QuotaSetsResource.java +++ b/nova-client/src/main/java/com/woorea/openstack/nova/api/QuotaSetsResource.java @@ -1,61 +1,61 @@ -package com.woorea.openstack.nova.api; - - -import com.woorea.openstack.base.client.Entity; -import com.woorea.openstack.base.client.HttpMethod; -import com.woorea.openstack.base.client.OpenStackClient; -import com.woorea.openstack.base.client.OpenStackRequest; -import com.woorea.openstack.nova.model.Limits; -import com.woorea.openstack.nova.model.QuotaSet; -import com.woorea.openstack.nova.model.SimpleTenantUsage; - -public class QuotaSetsResource { - - private final OpenStackClient CLIENT; - - public QuotaSetsResource(OpenStackClient client) { - CLIENT = client; - } - - public ShowQuota showQuota(String tenantId) { - return new ShowQuota(tenantId); - } - - public UpdateQuota updateQuota(String tenantId, QuotaSet quotaSet) { - return new UpdateQuota(tenantId, quotaSet); - } - - public ShowUsage showUsage(String tenantId) { - return new ShowUsage(tenantId); - } - - public ShowUsedLimits showUsedLimits() { - return new ShowUsedLimits(); - } - - public class ShowQuota extends OpenStackRequest { - public ShowQuota(String tenantId) { - super(CLIENT, HttpMethod.GET, new StringBuilder("/os-quota-sets/").append(tenantId), null, QuotaSet.class); - } - - } - - public class UpdateQuota extends OpenStackRequest { - public UpdateQuota(String tenantId, QuotaSet quotaSet) { - super(CLIENT, HttpMethod.PUT, new StringBuilder("/os-quota-sets/").append(tenantId), Entity.json(quotaSet), QuotaSet.class); - } - } - - public class ShowUsage extends OpenStackRequest { - public ShowUsage(String tenantId) { - super(CLIENT, HttpMethod.GET, new StringBuilder("/os-simple-tenant-usage/").append(tenantId), null, SimpleTenantUsage.class); - } - } - - public class ShowUsedLimits extends OpenStackRequest { - public ShowUsedLimits() { - super(CLIENT, HttpMethod.GET, new StringBuilder("/limits"), null, Limits.class); - } - } -} - +package com.woorea.openstack.nova.api; + + +import com.woorea.openstack.base.client.Entity; +import com.woorea.openstack.base.client.HttpMethod; +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.base.client.OpenStackRequest; +import com.woorea.openstack.nova.model.Limits; +import com.woorea.openstack.nova.model.QuotaSet; +import com.woorea.openstack.nova.model.SimpleTenantUsage; + +public class QuotaSetsResource { + + private final OpenStackClient CLIENT; + + public QuotaSetsResource(OpenStackClient client) { + CLIENT = client; + } + + public ShowQuota showQuota(String tenantId) { + return new ShowQuota(tenantId); + } + + public UpdateQuota updateQuota(String tenantId, QuotaSet quotaSet) { + return new UpdateQuota(tenantId, quotaSet); + } + + public ShowUsage showUsage(String tenantId) { + return new ShowUsage(tenantId); + } + + public ShowUsedLimits showUsedLimits() { + return new ShowUsedLimits(); + } + + public class ShowQuota extends OpenStackRequest { + public ShowQuota(String tenantId) { + super(CLIENT, HttpMethod.GET, new StringBuilder("/os-quota-sets/").append(tenantId), null, QuotaSet.class); + } + + } + + public class UpdateQuota extends OpenStackRequest { + public UpdateQuota(String tenantId, QuotaSet quotaSet) { + super(CLIENT, HttpMethod.PUT, new StringBuilder("/os-quota-sets/").append(tenantId), Entity.json(quotaSet), QuotaSet.class); + } + } + + public class ShowUsage extends OpenStackRequest { + public ShowUsage(String tenantId) { + super(CLIENT, HttpMethod.GET, new StringBuilder("/os-simple-tenant-usage/").append(tenantId), null, SimpleTenantUsage.class); + } + } + + public class ShowUsedLimits extends OpenStackRequest { + public ShowUsedLimits() { + super(CLIENT, HttpMethod.GET, new StringBuilder("/limits"), null, Limits.class); + } + } +} + diff --git a/nova-client/src/main/java/com/woorea/openstack/nova/api/ServersResource.java b/nova-client/src/main/java/com/woorea/openstack/nova/api/ServersResource.java index ca48b6fc4..dcbca0858 100644 --- a/nova-client/src/main/java/com/woorea/openstack/nova/api/ServersResource.java +++ b/nova-client/src/main/java/com/woorea/openstack/nova/api/ServersResource.java @@ -1,541 +1,541 @@ -package com.woorea.openstack.nova.api; - - -import java.util.Map; - -import com.woorea.openstack.base.client.Entity; -import com.woorea.openstack.base.client.HttpMethod; -import com.woorea.openstack.base.client.OpenStackClient; -import com.woorea.openstack.base.client.OpenStackRequest; -import com.woorea.openstack.nova.model.Metadata; -import com.woorea.openstack.nova.model.Server; -import com.woorea.openstack.nova.model.Server.Addresses; -import com.woorea.openstack.nova.model.ServerAction.ChangePassword; -import com.woorea.openstack.nova.model.ServerAction.ConfirmResize; -import com.woorea.openstack.nova.model.ServerAction.ConsoleOutput; -import com.woorea.openstack.nova.model.ServerAction.CreateBackup; -import com.woorea.openstack.nova.model.ServerAction.CreateImage; -import com.woorea.openstack.nova.model.ServerAction.GetConsoleOutput; -import com.woorea.openstack.nova.model.ServerAction.GetVncConsole; -import com.woorea.openstack.nova.model.ServerAction.Lock; -import com.woorea.openstack.nova.model.ServerAction.Pause; -import com.woorea.openstack.nova.model.ServerAction.Reboot; -import com.woorea.openstack.nova.model.ServerAction.Rebuild; -import com.woorea.openstack.nova.model.ServerAction.Rescue; -import com.woorea.openstack.nova.model.ServerAction.Resize; -import com.woorea.openstack.nova.model.ServerAction.Resume; -import com.woorea.openstack.nova.model.ServerAction.RevertResize; -import com.woorea.openstack.nova.model.ServerAction.Start; -import com.woorea.openstack.nova.model.ServerAction.Stop; -import com.woorea.openstack.nova.model.ServerAction.Suspend; -import com.woorea.openstack.nova.model.ServerAction.Unlock; -import com.woorea.openstack.nova.model.ServerAction.Unpause; -import com.woorea.openstack.nova.model.ServerAction.Unrescue; -import com.woorea.openstack.nova.model.ServerAction.VncConsole; -import com.woorea.openstack.nova.model.ServerForCreate; -import com.woorea.openstack.nova.model.Servers; -import com.woorea.openstack.nova.model.VolumeAttachment; -import com.woorea.openstack.nova.model.VolumeAttachments; - -public class ServersResource { - - private final OpenStackClient CLIENT; - - public ServersResource(OpenStackClient client) { - CLIENT = client; - } - - public List list(boolean detail) { - return new List(detail); - } - - public Boot boot(ServerForCreate server) { - return new Boot(server); - } - - public Show show(String id) { - return new Show(id); - } - - public ShowMetadata showMetadata(String id) { - return new ShowMetadata(id); - } - - public CreateOrUpdateMetadata createOrUpdateMetadata(String id,Metadata metadata) { - return new CreateOrUpdateMetadata(id,metadata); - } - - public ReplaceMetadata replaceMetadata(String id,Metadata metadata) { - return new ReplaceMetadata(id,metadata); - } - public DeleteMetadata deleteMetadata(String id, String key) { - return new DeleteMetadata(id,key); - } - - public Delete delete(String id) { - return new Delete(id); - } - - public class List extends OpenStackRequest { - - public List(boolean detail) { - super(CLIENT, HttpMethod.GET, detail ? "/servers/detail" : "/servers", null, Servers.class); - } - - } - - public class Boot extends OpenStackRequest { - - private ServerForCreate server; - - public Boot(ServerForCreate server) { - super(CLIENT, HttpMethod.POST, "/servers", Entity.json(server), Server.class); - this.server = server; - } - - } - - public class Show extends OpenStackRequest { - - public Show(String id) { - super(CLIENT, HttpMethod.GET, new StringBuilder("/servers/").append(id), null, Server.class); - } - - } - - public class ShowMetadata extends OpenStackRequest { - - public ShowMetadata(String id) { - super(CLIENT, HttpMethod.GET, new StringBuilder("/servers/").append(id).append("/metadata"), null, Metadata.class); - } - - } - - public class CreateOrUpdateMetadata extends OpenStackRequest { - - public CreateOrUpdateMetadata(String id,Metadata metadata) { - super(CLIENT, HttpMethod.POST, new StringBuilder("/servers/").append(id).append("/metadata"), Entity.json(metadata), Metadata.class); - } - - } - public class ReplaceMetadata extends OpenStackRequest { - - public ReplaceMetadata(String id,Metadata metadata) { - super(CLIENT, HttpMethod.PUT, new StringBuilder("/servers/").append(id).append("/metadata"), Entity.json(metadata), Metadata.class); - } - - } - - public class DeleteMetadata extends OpenStackRequest { - - public DeleteMetadata(String id,String key) { - super(CLIENT, HttpMethod.DELETE, new StringBuilder("/servers/").append(id).append("/metadata/").append(key), null, Void.class); - } - - } - - - public class Delete extends OpenStackRequest { - - public Delete(String id) { - super(CLIENT, HttpMethod.DELETE, new StringBuilder("/servers/").append(id), null, Void.class); - } - - } - - public class ShowServerAddresses extends OpenStackRequest { - - public ShowServerAddresses(String id) { - super(CLIENT, HttpMethod.GET, new StringBuilder("/servers/").append(id).append("/ips"), null, Addresses.class); - } - - } - - public class UpdateServer extends OpenStackRequest { - - private Server server; - - public UpdateServer(String id, Server server) { - super(CLIENT, HttpMethod.PUT, new StringBuilder("/servers/").append(id), Entity.json(server), Server.class); - this.server = server; - } - - } - - public UpdateServer update(String serverId, String name, String accessIPv4, String accessIPv6) { - Server server = new Server(); - //server.setName(name); - //server.setAccessIPv4(accessIPv4); - //server.setAccessIPv6(accessIPv6); - return new UpdateServer(serverId, server); - } - - public abstract class Action extends OpenStackRequest { - - public Action(String id, Entity entity, Class returnType) { - super(CLIENT, HttpMethod.POST, new StringBuilder("/servers/").append(id).append("/action"), entity, returnType); - } - - } - - public class ChangePasswordAction extends Action { - - private ChangePassword action; - - public ChangePasswordAction(String id, ChangePassword action) { - super(id, Entity.json(action), Server.class); - } - - } - - public ChangePasswordAction changePassword(String serverId, String adminPass) { - ChangePassword changePassword = new ChangePassword(); - changePassword.setAdminPass(adminPass); - return new ChangePasswordAction(serverId, changePassword); - } - - public class RebootAction extends Action { - - private Reboot action; - - public RebootAction(String id, Reboot action) { - super(id, Entity.json(action), Void.class); - } - - } - - public RebootAction reboot(String serverId, String rebootType) { - Reboot reboot = new Reboot(); - reboot.setType(rebootType); - return new RebootAction(serverId, reboot); - } - - public class RebuildAction extends Action { - - private Rebuild action; - - public RebuildAction(String id, Rebuild action) { - super(id, Entity.json(action), Server.class); - } - - } - - public RebuildAction rebuild(String serverId, Rebuild rebuild) { - return new RebuildAction(serverId, rebuild); - } - - public class ResizeAction extends Action { - - private Resize action; - - public ResizeAction(String id, Resize action) { - super(id, Entity.json(action), Server.class); - } - - } - - public ResizeAction resize(String serverId, String flavorId, String diskConfig) { - Resize resize = new Resize(); - resize.setFlavorRef(flavorId); - resize.setDiskConfig(diskConfig); - return new ResizeAction(serverId, resize); - } - - public class ConfirmResizeAction extends Action { - - public ConfirmResizeAction(String id) { - super(id, Entity.json(new ConfirmResize()), Server.class); - } - - } - - public ConfirmResizeAction confirmResize(String serverId) { - return new ConfirmResizeAction(serverId); - } - - public class RevertResizeAction extends Action { - - public RevertResizeAction(String id) { - super(id, Entity.json(new RevertResize()), Server.class); - } - - } - - public RevertResizeAction revertResize(String serverId) { - return new RevertResizeAction(serverId); - } - - public class CreateImageAction extends Action { - - public CreateImageAction(String id, CreateImage createImage) { - super(id, Entity.json(createImage), Void.class); - } - - } - - public CreateImageAction createImage(String serverId, String name, Map metadata) { - CreateImage createImage = new CreateImage(); - createImage.setName(name); - createImage.setMetadata(metadata); - return new CreateImageAction(serverId, createImage); - } - - public class StartServer extends OpenStackRequest { - - private Start action; - - private String id; - - public StartServer(String id) { - super(CLIENT, HttpMethod.POST, new StringBuilder("/servers/").append(id).append("/action"), Entity.json(new Start()), Void.class); - } - - } - - public class StopServer extends OpenStackRequest { - - private Stop action; - - private String id; - - public StopServer(String id) { - super(CLIENT, HttpMethod.POST, new StringBuilder("/servers/").append(id).append("/action"), Entity.json(new Stop()), Void.class); - } - - } - - public StartServer start(String id) { - return new StartServer(id); - } - - public StopServer stop(String id) { - return new StopServer(id); - } - - public class GetVncConsoleServer extends OpenStackRequest { - - private GetVncConsole action; - - private String id; - - public GetVncConsoleServer(String id, GetVncConsole action) { - super(CLIENT, HttpMethod.POST, new StringBuilder("/servers/").append(id).append("/action"), Entity.json(action), VncConsole.class); - } - - } - - public GetVncConsoleServer getVncConsole(String id, String type) { - GetVncConsole action = new GetVncConsole(type); - return new GetVncConsoleServer(id, action); - } - - public class GetConsoleOutputServer extends OpenStackRequest { - - public GetConsoleOutputServer(String id, GetConsoleOutput action) { - super(CLIENT, HttpMethod.POST, new StringBuilder("/servers/").append(id).append("/action"), Entity.json(action), ConsoleOutput.class); - } - - } - - public GetConsoleOutputServer getConsoleOutput(String id, int length) { - GetConsoleOutput action = new GetConsoleOutput(length); - return new GetConsoleOutputServer(id, action); - } - - public class PauseServer extends OpenStackRequest { - - public PauseServer(String id) { - super(CLIENT, HttpMethod.POST, new StringBuilder("/servers/").append(id).append("/action"), Entity.json(new Pause()), Void.class); - } - - } - - public class UnpauseServer extends OpenStackRequest { - - public UnpauseServer(String id) { - super(CLIENT, HttpMethod.POST, new StringBuilder("/servers/").append(id).append("/action"), Entity.json(new Unpause()), Void.class); - } - - - } - - public class LockServer extends OpenStackRequest { - - private Lock action; - - private String id; - - public LockServer(String id) { - super(CLIENT, HttpMethod.POST, new StringBuilder("/servers/").append(id).append("/action"), Entity.json(new Lock()), Void.class); - } - - } - - public class UnlockServer extends OpenStackRequest { - - private Unlock action; - - private String id; - - public UnlockServer(String id) { - super(CLIENT, HttpMethod.POST, new StringBuilder("/servers/").append(id).append("/action"), Entity.json(new Unlock()), Void.class); - } - - } - - public class SuspendServer extends OpenStackRequest { - - public SuspendServer(String id) { - super(CLIENT, HttpMethod.POST, new StringBuilder("/servers/").append(id).append("/action"), Entity.json(new Suspend()), Void.class); - } - - } - - public class ResumeServer extends OpenStackRequest { - - public ResumeServer(String id) { - super(CLIENT, HttpMethod.POST, new StringBuilder("/servers/").append(id).append("/action"), Entity.json(new Resume()), Void.class); - } - - } - - public class CreateBackupServer extends OpenStackRequest { - - public CreateBackupServer(String id, CreateBackup action) { - super(CLIENT, HttpMethod.POST, new StringBuilder("/servers/").append(id).append("/action"), Entity.json(action), Void.class); - } - - } - - public PauseServer pause(String serverId) { - return new PauseServer(serverId); - } - - public UnpauseServer unpause(String serverId) { - return new UnpauseServer(serverId); - } - - public LockServer lock(String serverId) { - return new LockServer(serverId); - } - - public UnlockServer unlock(String serverId) { - return new UnlockServer(serverId); - } - - public SuspendServer suspend(String serverId) { - return new SuspendServer(serverId); - } - - public ResumeServer resume(String serverId) { - return new ResumeServer(serverId); - } - - public CreateBackupServer createBackup(String serverId, CreateBackup action) { - return new CreateBackupServer(serverId, action); - } - - public class RescueServer extends OpenStackRequest { - - public RescueServer(String id, Rescue action) { - super(CLIENT, HttpMethod.POST, new StringBuilder("/servers/").append(id).append("/action"), Entity.json(action), Void.class); - } - - } - - public class UnrescueServer extends OpenStackRequest { - - public UnrescueServer(String id) { - super(CLIENT, HttpMethod.POST, new StringBuilder("/servers/").append(id).append("/action"), Entity.json(new Unrescue()), Void.class); - } - - } - - public RescueServer rescue(String serverId, String adminPass) { - Rescue action = new Rescue(adminPass); - return new RescueServer(serverId, action); - } - - public UnrescueServer unrescue(String serverId) { - return new UnrescueServer(serverId); - } - - public class AssociateFloatingIp extends OpenStackRequest { - - public AssociateFloatingIp(String id, com.woorea.openstack.nova.model.ServerAction.AssociateFloatingIp action) { - super(CLIENT, HttpMethod.POST, new StringBuilder("/servers/").append(id).append("/action"), Entity.json(action), Void.class); - } - - } - - public class DisassociateFloatingIp extends OpenStackRequest { - - public DisassociateFloatingIp(String id, com.woorea.openstack.nova.model.ServerAction.DisassociateFloatingIp action) { - super(CLIENT, HttpMethod.POST, new StringBuilder("/servers/").append(id).append("/action"), Entity.json(action), Void.class); - } - - } - - public AssociateFloatingIp associateFloatingIp(String serverId, String floatingIpAddress) { - com.woorea.openstack.nova.model.ServerAction.AssociateFloatingIp action = new com.woorea.openstack.nova.model.ServerAction.AssociateFloatingIp(floatingIpAddress); - return new AssociateFloatingIp(serverId, action); - } - - public DisassociateFloatingIp disassociateFloatingIp(String serverId, String floatingIpAddress) { - com.woorea.openstack.nova.model.ServerAction.DisassociateFloatingIp action = new com.woorea.openstack.nova.model.ServerAction.DisassociateFloatingIp(floatingIpAddress); - return new DisassociateFloatingIp(serverId, action); - } - - public class AttachVolume extends OpenStackRequest { - - public AttachVolume(String serverId, final VolumeAttachment volumeAttachment) { - super(CLIENT, HttpMethod.POST, new StringBuilder("/servers/").append(serverId).append("/os-volume_attachments"), Entity.json(volumeAttachment), Void.class); - } - - } - - public class DetachVolume extends OpenStackRequest { - - public DetachVolume(String serverId, String volumeId) { - super(CLIENT, HttpMethod.DELETE, new StringBuilder("/servers/").append(serverId).append("/os-volume_attachments/").append(volumeId), null, Void.class); - } - - } - - public class ListVolumeAttachments extends OpenStackRequest { - - public ListVolumeAttachments(String serverId) { - super(CLIENT, HttpMethod.GET, new StringBuilder("/servers/").append(serverId).append("/os-volume_attachments"), null, VolumeAttachments.class); - } - - } - - public class ShowVolumeAttachment extends OpenStackRequest { - - public ShowVolumeAttachment(String serverId, String volumeAttachmentId) { - super(CLIENT, HttpMethod.GET, new StringBuilder("/servers/").append(serverId).append("/os-volume_attachments/").append(volumeAttachmentId), null, VolumeAttachment.class); - } - - } - - public AttachVolume attachVolume(String serverId, String volumeId, String device) { - VolumeAttachment volumeAttachment = new VolumeAttachment(); - volumeAttachment.setVolumeId(volumeId); - volumeAttachment.setDevice(device); - return new AttachVolume(serverId, volumeAttachment); - } - - public DetachVolume detachVolume(String serverId, String volumeId) { - return new DetachVolume(serverId, volumeId); - } - - public ListVolumeAttachments listVolumeAttachments(String serverId) { - return new ListVolumeAttachments(serverId); - } - - public ShowVolumeAttachment showVolumeAttachment(String serverId, String volumeAttachmentId) { - return new ShowVolumeAttachment(serverId, volumeAttachmentId); - } - -} - +package com.woorea.openstack.nova.api; + + +import java.util.Map; + +import com.woorea.openstack.base.client.Entity; +import com.woorea.openstack.base.client.HttpMethod; +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.base.client.OpenStackRequest; +import com.woorea.openstack.nova.model.Metadata; +import com.woorea.openstack.nova.model.Server; +import com.woorea.openstack.nova.model.Server.Addresses; +import com.woorea.openstack.nova.model.ServerAction.ChangePassword; +import com.woorea.openstack.nova.model.ServerAction.ConfirmResize; +import com.woorea.openstack.nova.model.ServerAction.ConsoleOutput; +import com.woorea.openstack.nova.model.ServerAction.CreateBackup; +import com.woorea.openstack.nova.model.ServerAction.CreateImage; +import com.woorea.openstack.nova.model.ServerAction.GetConsoleOutput; +import com.woorea.openstack.nova.model.ServerAction.GetVncConsole; +import com.woorea.openstack.nova.model.ServerAction.Lock; +import com.woorea.openstack.nova.model.ServerAction.Pause; +import com.woorea.openstack.nova.model.ServerAction.Reboot; +import com.woorea.openstack.nova.model.ServerAction.Rebuild; +import com.woorea.openstack.nova.model.ServerAction.Rescue; +import com.woorea.openstack.nova.model.ServerAction.Resize; +import com.woorea.openstack.nova.model.ServerAction.Resume; +import com.woorea.openstack.nova.model.ServerAction.RevertResize; +import com.woorea.openstack.nova.model.ServerAction.Start; +import com.woorea.openstack.nova.model.ServerAction.Stop; +import com.woorea.openstack.nova.model.ServerAction.Suspend; +import com.woorea.openstack.nova.model.ServerAction.Unlock; +import com.woorea.openstack.nova.model.ServerAction.Unpause; +import com.woorea.openstack.nova.model.ServerAction.Unrescue; +import com.woorea.openstack.nova.model.ServerAction.VncConsole; +import com.woorea.openstack.nova.model.ServerForCreate; +import com.woorea.openstack.nova.model.Servers; +import com.woorea.openstack.nova.model.VolumeAttachment; +import com.woorea.openstack.nova.model.VolumeAttachments; + +public class ServersResource { + + private final OpenStackClient CLIENT; + + public ServersResource(OpenStackClient client) { + CLIENT = client; + } + + public List list(boolean detail) { + return new List(detail); + } + + public Boot boot(ServerForCreate server) { + return new Boot(server); + } + + public Show show(String id) { + return new Show(id); + } + + public ShowMetadata showMetadata(String id) { + return new ShowMetadata(id); + } + + public CreateOrUpdateMetadata createOrUpdateMetadata(String id,Metadata metadata) { + return new CreateOrUpdateMetadata(id,metadata); + } + + public ReplaceMetadata replaceMetadata(String id,Metadata metadata) { + return new ReplaceMetadata(id,metadata); + } + public DeleteMetadata deleteMetadata(String id, String key) { + return new DeleteMetadata(id,key); + } + + public Delete delete(String id) { + return new Delete(id); + } + + public class List extends OpenStackRequest { + + public List(boolean detail) { + super(CLIENT, HttpMethod.GET, detail ? "/servers/detail" : "/servers", null, Servers.class); + } + + } + + public class Boot extends OpenStackRequest { + + private ServerForCreate server; + + public Boot(ServerForCreate server) { + super(CLIENT, HttpMethod.POST, "/servers", Entity.json(server), Server.class); + this.server = server; + } + + } + + public class Show extends OpenStackRequest { + + public Show(String id) { + super(CLIENT, HttpMethod.GET, new StringBuilder("/servers/").append(id), null, Server.class); + } + + } + + public class ShowMetadata extends OpenStackRequest { + + public ShowMetadata(String id) { + super(CLIENT, HttpMethod.GET, new StringBuilder("/servers/").append(id).append("/metadata"), null, Metadata.class); + } + + } + + public class CreateOrUpdateMetadata extends OpenStackRequest { + + public CreateOrUpdateMetadata(String id,Metadata metadata) { + super(CLIENT, HttpMethod.POST, new StringBuilder("/servers/").append(id).append("/metadata"), Entity.json(metadata), Metadata.class); + } + + } + public class ReplaceMetadata extends OpenStackRequest { + + public ReplaceMetadata(String id,Metadata metadata) { + super(CLIENT, HttpMethod.PUT, new StringBuilder("/servers/").append(id).append("/metadata"), Entity.json(metadata), Metadata.class); + } + + } + + public class DeleteMetadata extends OpenStackRequest { + + public DeleteMetadata(String id,String key) { + super(CLIENT, HttpMethod.DELETE, new StringBuilder("/servers/").append(id).append("/metadata/").append(key), null, Void.class); + } + + } + + + public class Delete extends OpenStackRequest { + + public Delete(String id) { + super(CLIENT, HttpMethod.DELETE, new StringBuilder("/servers/").append(id), null, Void.class); + } + + } + + public class ShowServerAddresses extends OpenStackRequest { + + public ShowServerAddresses(String id) { + super(CLIENT, HttpMethod.GET, new StringBuilder("/servers/").append(id).append("/ips"), null, Addresses.class); + } + + } + + public class UpdateServer extends OpenStackRequest { + + private Server server; + + public UpdateServer(String id, Server server) { + super(CLIENT, HttpMethod.PUT, new StringBuilder("/servers/").append(id), Entity.json(server), Server.class); + this.server = server; + } + + } + + public UpdateServer update(String serverId, String name, String accessIPv4, String accessIPv6) { + Server server = new Server(); + //server.setName(name); + //server.setAccessIPv4(accessIPv4); + //server.setAccessIPv6(accessIPv6); + return new UpdateServer(serverId, server); + } + + public abstract class Action extends OpenStackRequest { + + public Action(String id, Entity entity, Class returnType) { + super(CLIENT, HttpMethod.POST, new StringBuilder("/servers/").append(id).append("/action"), entity, returnType); + } + + } + + public class ChangePasswordAction extends Action { + + private ChangePassword action; + + public ChangePasswordAction(String id, ChangePassword action) { + super(id, Entity.json(action), Server.class); + } + + } + + public ChangePasswordAction changePassword(String serverId, String adminPass) { + ChangePassword changePassword = new ChangePassword(); + changePassword.setAdminPass(adminPass); + return new ChangePasswordAction(serverId, changePassword); + } + + public class RebootAction extends Action { + + private Reboot action; + + public RebootAction(String id, Reboot action) { + super(id, Entity.json(action), Void.class); + } + + } + + public RebootAction reboot(String serverId, String rebootType) { + Reboot reboot = new Reboot(); + reboot.setType(rebootType); + return new RebootAction(serverId, reboot); + } + + public class RebuildAction extends Action { + + private Rebuild action; + + public RebuildAction(String id, Rebuild action) { + super(id, Entity.json(action), Server.class); + } + + } + + public RebuildAction rebuild(String serverId, Rebuild rebuild) { + return new RebuildAction(serverId, rebuild); + } + + public class ResizeAction extends Action { + + private Resize action; + + public ResizeAction(String id, Resize action) { + super(id, Entity.json(action), Server.class); + } + + } + + public ResizeAction resize(String serverId, String flavorId, String diskConfig) { + Resize resize = new Resize(); + resize.setFlavorRef(flavorId); + resize.setDiskConfig(diskConfig); + return new ResizeAction(serverId, resize); + } + + public class ConfirmResizeAction extends Action { + + public ConfirmResizeAction(String id) { + super(id, Entity.json(new ConfirmResize()), Server.class); + } + + } + + public ConfirmResizeAction confirmResize(String serverId) { + return new ConfirmResizeAction(serverId); + } + + public class RevertResizeAction extends Action { + + public RevertResizeAction(String id) { + super(id, Entity.json(new RevertResize()), Server.class); + } + + } + + public RevertResizeAction revertResize(String serverId) { + return new RevertResizeAction(serverId); + } + + public class CreateImageAction extends Action { + + public CreateImageAction(String id, CreateImage createImage) { + super(id, Entity.json(createImage), Void.class); + } + + } + + public CreateImageAction createImage(String serverId, String name, Map metadata) { + CreateImage createImage = new CreateImage(); + createImage.setName(name); + createImage.setMetadata(metadata); + return new CreateImageAction(serverId, createImage); + } + + public class StartServer extends OpenStackRequest { + + private Start action; + + private String id; + + public StartServer(String id) { + super(CLIENT, HttpMethod.POST, new StringBuilder("/servers/").append(id).append("/action"), Entity.json(new Start()), Void.class); + } + + } + + public class StopServer extends OpenStackRequest { + + private Stop action; + + private String id; + + public StopServer(String id) { + super(CLIENT, HttpMethod.POST, new StringBuilder("/servers/").append(id).append("/action"), Entity.json(new Stop()), Void.class); + } + + } + + public StartServer start(String id) { + return new StartServer(id); + } + + public StopServer stop(String id) { + return new StopServer(id); + } + + public class GetVncConsoleServer extends OpenStackRequest { + + private GetVncConsole action; + + private String id; + + public GetVncConsoleServer(String id, GetVncConsole action) { + super(CLIENT, HttpMethod.POST, new StringBuilder("/servers/").append(id).append("/action"), Entity.json(action), VncConsole.class); + } + + } + + public GetVncConsoleServer getVncConsole(String id, String type) { + GetVncConsole action = new GetVncConsole(type); + return new GetVncConsoleServer(id, action); + } + + public class GetConsoleOutputServer extends OpenStackRequest { + + public GetConsoleOutputServer(String id, GetConsoleOutput action) { + super(CLIENT, HttpMethod.POST, new StringBuilder("/servers/").append(id).append("/action"), Entity.json(action), ConsoleOutput.class); + } + + } + + public GetConsoleOutputServer getConsoleOutput(String id, int length) { + GetConsoleOutput action = new GetConsoleOutput(length); + return new GetConsoleOutputServer(id, action); + } + + public class PauseServer extends OpenStackRequest { + + public PauseServer(String id) { + super(CLIENT, HttpMethod.POST, new StringBuilder("/servers/").append(id).append("/action"), Entity.json(new Pause()), Void.class); + } + + } + + public class UnpauseServer extends OpenStackRequest { + + public UnpauseServer(String id) { + super(CLIENT, HttpMethod.POST, new StringBuilder("/servers/").append(id).append("/action"), Entity.json(new Unpause()), Void.class); + } + + + } + + public class LockServer extends OpenStackRequest { + + private Lock action; + + private String id; + + public LockServer(String id) { + super(CLIENT, HttpMethod.POST, new StringBuilder("/servers/").append(id).append("/action"), Entity.json(new Lock()), Void.class); + } + + } + + public class UnlockServer extends OpenStackRequest { + + private Unlock action; + + private String id; + + public UnlockServer(String id) { + super(CLIENT, HttpMethod.POST, new StringBuilder("/servers/").append(id).append("/action"), Entity.json(new Unlock()), Void.class); + } + + } + + public class SuspendServer extends OpenStackRequest { + + public SuspendServer(String id) { + super(CLIENT, HttpMethod.POST, new StringBuilder("/servers/").append(id).append("/action"), Entity.json(new Suspend()), Void.class); + } + + } + + public class ResumeServer extends OpenStackRequest { + + public ResumeServer(String id) { + super(CLIENT, HttpMethod.POST, new StringBuilder("/servers/").append(id).append("/action"), Entity.json(new Resume()), Void.class); + } + + } + + public class CreateBackupServer extends OpenStackRequest { + + public CreateBackupServer(String id, CreateBackup action) { + super(CLIENT, HttpMethod.POST, new StringBuilder("/servers/").append(id).append("/action"), Entity.json(action), Void.class); + } + + } + + public PauseServer pause(String serverId) { + return new PauseServer(serverId); + } + + public UnpauseServer unpause(String serverId) { + return new UnpauseServer(serverId); + } + + public LockServer lock(String serverId) { + return new LockServer(serverId); + } + + public UnlockServer unlock(String serverId) { + return new UnlockServer(serverId); + } + + public SuspendServer suspend(String serverId) { + return new SuspendServer(serverId); + } + + public ResumeServer resume(String serverId) { + return new ResumeServer(serverId); + } + + public CreateBackupServer createBackup(String serverId, CreateBackup action) { + return new CreateBackupServer(serverId, action); + } + + public class RescueServer extends OpenStackRequest { + + public RescueServer(String id, Rescue action) { + super(CLIENT, HttpMethod.POST, new StringBuilder("/servers/").append(id).append("/action"), Entity.json(action), Void.class); + } + + } + + public class UnrescueServer extends OpenStackRequest { + + public UnrescueServer(String id) { + super(CLIENT, HttpMethod.POST, new StringBuilder("/servers/").append(id).append("/action"), Entity.json(new Unrescue()), Void.class); + } + + } + + public RescueServer rescue(String serverId, String adminPass) { + Rescue action = new Rescue(adminPass); + return new RescueServer(serverId, action); + } + + public UnrescueServer unrescue(String serverId) { + return new UnrescueServer(serverId); + } + + public class AssociateFloatingIp extends OpenStackRequest { + + public AssociateFloatingIp(String id, com.woorea.openstack.nova.model.ServerAction.AssociateFloatingIp action) { + super(CLIENT, HttpMethod.POST, new StringBuilder("/servers/").append(id).append("/action"), Entity.json(action), Void.class); + } + + } + + public class DisassociateFloatingIp extends OpenStackRequest { + + public DisassociateFloatingIp(String id, com.woorea.openstack.nova.model.ServerAction.DisassociateFloatingIp action) { + super(CLIENT, HttpMethod.POST, new StringBuilder("/servers/").append(id).append("/action"), Entity.json(action), Void.class); + } + + } + + public AssociateFloatingIp associateFloatingIp(String serverId, String floatingIpAddress) { + com.woorea.openstack.nova.model.ServerAction.AssociateFloatingIp action = new com.woorea.openstack.nova.model.ServerAction.AssociateFloatingIp(floatingIpAddress); + return new AssociateFloatingIp(serverId, action); + } + + public DisassociateFloatingIp disassociateFloatingIp(String serverId, String floatingIpAddress) { + com.woorea.openstack.nova.model.ServerAction.DisassociateFloatingIp action = new com.woorea.openstack.nova.model.ServerAction.DisassociateFloatingIp(floatingIpAddress); + return new DisassociateFloatingIp(serverId, action); + } + + public class AttachVolume extends OpenStackRequest { + + public AttachVolume(String serverId, final VolumeAttachment volumeAttachment) { + super(CLIENT, HttpMethod.POST, new StringBuilder("/servers/").append(serverId).append("/os-volume_attachments"), Entity.json(volumeAttachment), Void.class); + } + + } + + public class DetachVolume extends OpenStackRequest { + + public DetachVolume(String serverId, String volumeId) { + super(CLIENT, HttpMethod.DELETE, new StringBuilder("/servers/").append(serverId).append("/os-volume_attachments/").append(volumeId), null, Void.class); + } + + } + + public class ListVolumeAttachments extends OpenStackRequest { + + public ListVolumeAttachments(String serverId) { + super(CLIENT, HttpMethod.GET, new StringBuilder("/servers/").append(serverId).append("/os-volume_attachments"), null, VolumeAttachments.class); + } + + } + + public class ShowVolumeAttachment extends OpenStackRequest { + + public ShowVolumeAttachment(String serverId, String volumeAttachmentId) { + super(CLIENT, HttpMethod.GET, new StringBuilder("/servers/").append(serverId).append("/os-volume_attachments/").append(volumeAttachmentId), null, VolumeAttachment.class); + } + + } + + public AttachVolume attachVolume(String serverId, String volumeId, String device) { + VolumeAttachment volumeAttachment = new VolumeAttachment(); + volumeAttachment.setVolumeId(volumeId); + volumeAttachment.setDevice(device); + return new AttachVolume(serverId, volumeAttachment); + } + + public DetachVolume detachVolume(String serverId, String volumeId) { + return new DetachVolume(serverId, volumeId); + } + + public ListVolumeAttachments listVolumeAttachments(String serverId) { + return new ListVolumeAttachments(serverId); + } + + public ShowVolumeAttachment showVolumeAttachment(String serverId, String volumeAttachmentId) { + return new ShowVolumeAttachment(serverId, volumeAttachmentId); + } + +} + diff --git a/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/CloudpipesExtension.java b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/CloudpipesExtension.java index 90450c805..7ee614e58 100644 --- a/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/CloudpipesExtension.java +++ b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/CloudpipesExtension.java @@ -1,49 +1,49 @@ -package com.woorea.openstack.nova.api.extensions; - - -import com.woorea.openstack.base.client.Entity; -import com.woorea.openstack.base.client.HttpMethod; -import com.woorea.openstack.base.client.OpenStackClient; -import com.woorea.openstack.base.client.OpenStackRequest; -import com.woorea.openstack.nova.model.Cloudpipe; -import com.woorea.openstack.nova.model.Cloudpipes; - -public class CloudpipesExtension { - - private final OpenStackClient CLIENT; - - public CloudpipesExtension(OpenStackClient client) { - CLIENT = client; - } - - public List list() { - return new List(); - } - - public Create create(Cloudpipe cloudpipe) { - return new Create(cloudpipe); - } - - public class List extends OpenStackRequest { - - - public List() { - super(CLIENT, HttpMethod.GET, "/os-cloudpipes", null, Cloudpipes.class); - } - - } - - public class Create extends OpenStackRequest { - - private Cloudpipe cloudpipe; - - public Create(Cloudpipe cloudpipe) { - super(CLIENT, HttpMethod.POST, "/os-cloudpipes", Entity.json(cloudpipe), Cloudpipe.class); - this.cloudpipe = cloudpipe; - } - - } - - - -} +package com.woorea.openstack.nova.api.extensions; + + +import com.woorea.openstack.base.client.Entity; +import com.woorea.openstack.base.client.HttpMethod; +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.base.client.OpenStackRequest; +import com.woorea.openstack.nova.model.Cloudpipe; +import com.woorea.openstack.nova.model.Cloudpipes; + +public class CloudpipesExtension { + + private final OpenStackClient CLIENT; + + public CloudpipesExtension(OpenStackClient client) { + CLIENT = client; + } + + public List list() { + return new List(); + } + + public Create create(Cloudpipe cloudpipe) { + return new Create(cloudpipe); + } + + public class List extends OpenStackRequest { + + + public List() { + super(CLIENT, HttpMethod.GET, "/os-cloudpipes", null, Cloudpipes.class); + } + + } + + public class Create extends OpenStackRequest { + + private Cloudpipe cloudpipe; + + public Create(Cloudpipe cloudpipe) { + super(CLIENT, HttpMethod.POST, "/os-cloudpipes", Entity.json(cloudpipe), Cloudpipe.class); + this.cloudpipe = cloudpipe; + } + + } + + + +} diff --git a/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/CredentialsExtension.java b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/CredentialsExtension.java index b689fd6b1..79213812c 100644 --- a/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/CredentialsExtension.java +++ b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/CredentialsExtension.java @@ -1,43 +1,43 @@ -package com.woorea.openstack.nova.api.extensions; - - -import com.woorea.openstack.base.client.HttpMethod; -import com.woorea.openstack.base.client.OpenStackClient; -import com.woorea.openstack.base.client.OpenStackRequest; -import com.woorea.openstack.nova.model.Certificate; - -public class CredentialsExtension { - - private final OpenStackClient CLIENT; - - public CredentialsExtension(OpenStackClient client) { - CLIENT = client; - } - - public Create createCertificate(String id) { - return new Create(id); - } - - public Show showCertificate(String id) { - return new Show(); - } - - public class Create extends OpenStackRequest { - - public Create(String id) { - super(CLIENT, HttpMethod.GET, new StringBuffer("/os-certificates").append(id).toString(), null, Certificate.class); - } - - } - - public class Show extends OpenStackRequest { - - public Show() { - super(CLIENT, HttpMethod.GET, "/os-certificates", null, Certificate.class); - } - - } - - - -} +package com.woorea.openstack.nova.api.extensions; + + +import com.woorea.openstack.base.client.HttpMethod; +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.base.client.OpenStackRequest; +import com.woorea.openstack.nova.model.Certificate; + +public class CredentialsExtension { + + private final OpenStackClient CLIENT; + + public CredentialsExtension(OpenStackClient client) { + CLIENT = client; + } + + public Create createCertificate(String id) { + return new Create(id); + } + + public Show showCertificate(String id) { + return new Show(); + } + + public class Create extends OpenStackRequest { + + public Create(String id) { + super(CLIENT, HttpMethod.GET, new StringBuffer("/os-certificates").append(id).toString(), null, Certificate.class); + } + + } + + public class Show extends OpenStackRequest { + + public Show() { + super(CLIENT, HttpMethod.GET, "/os-certificates", null, Certificate.class); + } + + } + + + +} diff --git a/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/FloatingIpDnsExtension.java b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/FloatingIpDnsExtension.java index e2a399a32..b40564e7c 100644 --- a/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/FloatingIpDnsExtension.java +++ b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/FloatingIpDnsExtension.java @@ -1,89 +1,89 @@ -package com.woorea.openstack.nova.api.extensions; - - -import com.woorea.openstack.base.client.Entity; -import com.woorea.openstack.base.client.HttpMethod; -import com.woorea.openstack.base.client.OpenStackClient; -import com.woorea.openstack.base.client.OpenStackRequest; -import com.woorea.openstack.nova.model.FloatingIpDomain; -import com.woorea.openstack.nova.model.FloatingIpDomains; - -public class FloatingIpDnsExtension { - - private final OpenStackClient CLIENT; - - public FloatingIpDnsExtension(OpenStackClient client) { - CLIENT = client; - } - - public ListDomains listFloatingIpDomains() { - return new ListDomains(); - } - - public CreateDomain create(FloatingIpDomain floatingIpDomain) { - return new CreateDomain(floatingIpDomain); - } - - public ShowDomain show(String id) { - return new ShowDomain(id); - } - - public UpdateDomain update(FloatingIpDomain floatingIpDomain) { - return new UpdateDomain(floatingIpDomain); - } - - public DeleteDomain delete(String id) { - return new DeleteDomain(id); - } - - public class ListDomains extends OpenStackRequest { - - public ListDomains() { - super(CLIENT, HttpMethod.GET, "/os-floating-ip-dns", null, FloatingIpDomains.class); - } - - } - - public class CreateDomain extends OpenStackRequest { - - private FloatingIpDomain floatingIpDomain; - - public CreateDomain(FloatingIpDomain floatingIpDomain) { - super(CLIENT, HttpMethod.POST, "/os-floating-ip-dns", Entity.json(floatingIpDomain), FloatingIpDomain.class); - this.floatingIpDomain = floatingIpDomain; - } - - } - - public class ShowDomain extends OpenStackRequest { - - public ShowDomain(String id) { - super(CLIENT, HttpMethod.GET, new StringBuffer("/os-floating-ip-dns/").append(id).toString(), null, FloatingIpDomain.class); - } - - } - - - public static class UpdateDomain extends OpenStackRequest { - - private FloatingIpDomain floatingIpDomain; - - public UpdateDomain(FloatingIpDomain floatingIpDomain) { - //super(CLIENT, HttpMethod.PUT, new StringBuffer("/os-floating-ip-dns/").append(id).toString(), Entity.json(floatingIpDomain), FloatingIpDomain.class); - this.floatingIpDomain = floatingIpDomain; - } - - } - - - public class DeleteDomain extends OpenStackRequest { - - public DeleteDomain(String id) { - super(CLIENT, HttpMethod.DELETE, new StringBuffer("/os-floating-ip-dns/").append(id).toString(), null, Void.class); - } - - } - - - -} +package com.woorea.openstack.nova.api.extensions; + + +import com.woorea.openstack.base.client.Entity; +import com.woorea.openstack.base.client.HttpMethod; +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.base.client.OpenStackRequest; +import com.woorea.openstack.nova.model.FloatingIpDomain; +import com.woorea.openstack.nova.model.FloatingIpDomains; + +public class FloatingIpDnsExtension { + + private final OpenStackClient CLIENT; + + public FloatingIpDnsExtension(OpenStackClient client) { + CLIENT = client; + } + + public ListDomains listFloatingIpDomains() { + return new ListDomains(); + } + + public CreateDomain create(FloatingIpDomain floatingIpDomain) { + return new CreateDomain(floatingIpDomain); + } + + public ShowDomain show(String id) { + return new ShowDomain(id); + } + + public UpdateDomain update(FloatingIpDomain floatingIpDomain) { + return new UpdateDomain(floatingIpDomain); + } + + public DeleteDomain delete(String id) { + return new DeleteDomain(id); + } + + public class ListDomains extends OpenStackRequest { + + public ListDomains() { + super(CLIENT, HttpMethod.GET, "/os-floating-ip-dns", null, FloatingIpDomains.class); + } + + } + + public class CreateDomain extends OpenStackRequest { + + private FloatingIpDomain floatingIpDomain; + + public CreateDomain(FloatingIpDomain floatingIpDomain) { + super(CLIENT, HttpMethod.POST, "/os-floating-ip-dns", Entity.json(floatingIpDomain), FloatingIpDomain.class); + this.floatingIpDomain = floatingIpDomain; + } + + } + + public class ShowDomain extends OpenStackRequest { + + public ShowDomain(String id) { + super(CLIENT, HttpMethod.GET, new StringBuffer("/os-floating-ip-dns/").append(id).toString(), null, FloatingIpDomain.class); + } + + } + + + public static class UpdateDomain extends OpenStackRequest { + + private FloatingIpDomain floatingIpDomain; + + public UpdateDomain(FloatingIpDomain floatingIpDomain) { + //super(CLIENT, HttpMethod.PUT, new StringBuffer("/os-floating-ip-dns/").append(id).toString(), Entity.json(floatingIpDomain), FloatingIpDomain.class); + this.floatingIpDomain = floatingIpDomain; + } + + } + + + public class DeleteDomain extends OpenStackRequest { + + public DeleteDomain(String id) { + super(CLIENT, HttpMethod.DELETE, new StringBuffer("/os-floating-ip-dns/").append(id).toString(), null, Void.class); + } + + } + + + +} diff --git a/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/FloatingIpPoolsExtension.java b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/FloatingIpPoolsExtension.java index cfcba237d..5c1ba7cc5 100644 --- a/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/FloatingIpPoolsExtension.java +++ b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/FloatingIpPoolsExtension.java @@ -1,31 +1,31 @@ -package com.woorea.openstack.nova.api.extensions; - - -import com.woorea.openstack.base.client.HttpMethod; -import com.woorea.openstack.base.client.OpenStackClient; -import com.woorea.openstack.base.client.OpenStackRequest; -import com.woorea.openstack.nova.model.FloatingIpPools; - -public class FloatingIpPoolsExtension { - - private final OpenStackClient CLIENT; - - public FloatingIpPoolsExtension(OpenStackClient client) { - CLIENT = client; - } - - public List list() { - return new List(); - } - - public class List extends OpenStackRequest { - - public List() { - super(CLIENT, HttpMethod.GET, "/os-floating-ip-pools", null, FloatingIpPools.class); - } - - } - - - -} +package com.woorea.openstack.nova.api.extensions; + + +import com.woorea.openstack.base.client.HttpMethod; +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.base.client.OpenStackRequest; +import com.woorea.openstack.nova.model.FloatingIpPools; + +public class FloatingIpPoolsExtension { + + private final OpenStackClient CLIENT; + + public FloatingIpPoolsExtension(OpenStackClient client) { + CLIENT = client; + } + + public List list() { + return new List(); + } + + public class List extends OpenStackRequest { + + public List() { + super(CLIENT, HttpMethod.GET, "/os-floating-ip-pools", null, FloatingIpPools.class); + } + + } + + + +} diff --git a/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/HostsExtension.java b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/HostsExtension.java index 9a4814dfc..b2b6d66fa 100644 --- a/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/HostsExtension.java +++ b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/HostsExtension.java @@ -1,44 +1,44 @@ -package com.woorea.openstack.nova.api.extensions; - - -import com.woorea.openstack.base.client.HttpMethod; -import com.woorea.openstack.base.client.OpenStackClient; -import com.woorea.openstack.base.client.OpenStackRequest; -import com.woorea.openstack.nova.model.Host; -import com.woorea.openstack.nova.model.Hosts; - -public class HostsExtension { - - private final OpenStackClient CLIENT; - - public HostsExtension(OpenStackClient client) { - CLIENT = client; - } - - public List list() { - return new List(); - } - - public Show show(String id) { - return new Show(id); - } - - public class List extends OpenStackRequest { - - public List() { - super(CLIENT, HttpMethod.GET, "/os-hosts", null, Hosts.class); - } - - } - - public class Show extends OpenStackRequest { - - public Show(String id) { - super(CLIENT, HttpMethod.GET, new StringBuffer("/os-hosts/").append(id).toString(), null, Host.class); - } - - } - - - -} +package com.woorea.openstack.nova.api.extensions; + + +import com.woorea.openstack.base.client.HttpMethod; +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.base.client.OpenStackRequest; +import com.woorea.openstack.nova.model.Host; +import com.woorea.openstack.nova.model.Hosts; + +public class HostsExtension { + + private final OpenStackClient CLIENT; + + public HostsExtension(OpenStackClient client) { + CLIENT = client; + } + + public List list() { + return new List(); + } + + public Show show(String id) { + return new Show(id); + } + + public class List extends OpenStackRequest { + + public List() { + super(CLIENT, HttpMethod.GET, "/os-hosts", null, Hosts.class); + } + + } + + public class Show extends OpenStackRequest { + + public Show(String id) { + super(CLIENT, HttpMethod.GET, new StringBuffer("/os-hosts/").append(id).toString(), null, Host.class); + } + + } + + + +} diff --git a/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/HypervisorsExtension.java b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/HypervisorsExtension.java index ed1ad100b..77beb72d7 100644 --- a/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/HypervisorsExtension.java +++ b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/HypervisorsExtension.java @@ -1,5 +1,5 @@ -package com.woorea.openstack.nova.api.extensions; - -public class HypervisorsExtension { - -} +package com.woorea.openstack.nova.api.extensions; + +public class HypervisorsExtension { + +} diff --git a/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/KeyPairsExtension.java b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/KeyPairsExtension.java index 5e2c55586..c378bd626 100644 --- a/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/KeyPairsExtension.java +++ b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/KeyPairsExtension.java @@ -1,65 +1,65 @@ -package com.woorea.openstack.nova.api.extensions; - - -import com.woorea.openstack.base.client.Entity; -import com.woorea.openstack.base.client.HttpMethod; -import com.woorea.openstack.base.client.OpenStackClient; -import com.woorea.openstack.base.client.OpenStackRequest; -import com.woorea.openstack.nova.model.KeyPair; -import com.woorea.openstack.nova.model.KeyPairs; - -public class KeyPairsExtension { - - private final OpenStackClient CLIENT; - - public KeyPairsExtension(OpenStackClient client) { - CLIENT = client; - } - - public List list() { - return new List(); - } - - public Create create(String name, String publicKey) { - KeyPair keyPairForCreate = new KeyPair(name, publicKey); - return new Create(keyPairForCreate); - } - - public Create create(String name) { - return create(name, null); - } - - public Delete delete(String name) { - return new Delete(name); - } - - public class Create extends OpenStackRequest { - - private KeyPair keyPairForCreate; - - public Create(KeyPair keyPairForCreate) { - super(CLIENT, HttpMethod.POST, "/os-keypairs", Entity.json(keyPairForCreate), KeyPair.class); - this.keyPairForCreate = keyPairForCreate; - } - - } - - public class Delete extends OpenStackRequest { - - private String name; - - public Delete(String name) { - super(CLIENT, HttpMethod.DELETE, new StringBuilder("/os-keypairs/").append(name).toString(), null, Void.class); - } - - } - - public class List extends OpenStackRequest { - - public List() { - super(CLIENT, HttpMethod.GET, "/os-keypairs", null, KeyPairs.class); - } - - } - -} +package com.woorea.openstack.nova.api.extensions; + + +import com.woorea.openstack.base.client.Entity; +import com.woorea.openstack.base.client.HttpMethod; +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.base.client.OpenStackRequest; +import com.woorea.openstack.nova.model.KeyPair; +import com.woorea.openstack.nova.model.KeyPairs; + +public class KeyPairsExtension { + + private final OpenStackClient CLIENT; + + public KeyPairsExtension(OpenStackClient client) { + CLIENT = client; + } + + public List list() { + return new List(); + } + + public Create create(String name, String publicKey) { + KeyPair keyPairForCreate = new KeyPair(name, publicKey); + return new Create(keyPairForCreate); + } + + public Create create(String name) { + return create(name, null); + } + + public Delete delete(String name) { + return new Delete(name); + } + + public class Create extends OpenStackRequest { + + private KeyPair keyPairForCreate; + + public Create(KeyPair keyPairForCreate) { + super(CLIENT, HttpMethod.POST, "/os-keypairs", Entity.json(keyPairForCreate), KeyPair.class); + this.keyPairForCreate = keyPairForCreate; + } + + } + + public class Delete extends OpenStackRequest { + + private String name; + + public Delete(String name) { + super(CLIENT, HttpMethod.DELETE, new StringBuilder("/os-keypairs/").append(name).toString(), null, Void.class); + } + + } + + public class List extends OpenStackRequest { + + public List() { + super(CLIENT, HttpMethod.GET, "/os-keypairs", null, KeyPairs.class); + } + + } + +} diff --git a/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/NetworksExtension.java b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/NetworksExtension.java index ad316e087..e5fe4f1eb 100644 --- a/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/NetworksExtension.java +++ b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/NetworksExtension.java @@ -1,82 +1,82 @@ -package com.woorea.openstack.nova.api.extensions; - - -import com.woorea.openstack.base.client.Entity; -import com.woorea.openstack.base.client.HttpMethod; -import com.woorea.openstack.base.client.OpenStackClient; -import com.woorea.openstack.base.client.OpenStackRequest; -import com.woorea.openstack.nova.model.Network; -import com.woorea.openstack.nova.model.Networks; - -public class NetworksExtension { - - private final OpenStackClient CLIENT; - - public NetworksExtension(OpenStackClient client) { - CLIENT = client; - } - - public List list() { - return new List(); - } - - public Show show(String id) { - return new Show(id); - } - - public Delete delete(String id) { - return new Delete(id); - } - - public Disassociate disassociate(String id) { - return new Disassociate(id); - } - - public class List extends OpenStackRequest { - - - public List() { - super(CLIENT, HttpMethod.GET, "/os-networks", null, Networks.class); - } - - } - - public class Create extends OpenStackRequest { - - private Network network; - - public Create(Network network) { - super(CLIENT, HttpMethod.POST, "/os-networks", Entity.json(network), Network.class); - this.network = network; - } - - } - - public class Show extends OpenStackRequest { - - public Show(String id) { - super(CLIENT, HttpMethod.GET, new StringBuilder("/os-networks/").append(id).toString(), null, Network.class); - } - - } - - public class Disassociate extends OpenStackRequest { - - public Disassociate(String id) { - super(CLIENT, HttpMethod.POST, new StringBuilder("/os-networks/").append(id).toString(), Entity.json("{\"action\":\"disassociate\"}"), Void.class); - ; - } - - } - - public class Delete extends OpenStackRequest { - - public Delete(String id) { - super(CLIENT, HttpMethod.DELETE, new StringBuilder("/os-networks/").append(id).toString(), null, Void.class); - } - - } - - - -} +package com.woorea.openstack.nova.api.extensions; + + +import com.woorea.openstack.base.client.Entity; +import com.woorea.openstack.base.client.HttpMethod; +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.base.client.OpenStackRequest; +import com.woorea.openstack.nova.model.Network; +import com.woorea.openstack.nova.model.Networks; + +public class NetworksExtension { + + private final OpenStackClient CLIENT; + + public NetworksExtension(OpenStackClient client) { + CLIENT = client; + } + + public List list() { + return new List(); + } + + public Show show(String id) { + return new Show(id); + } + + public Delete delete(String id) { + return new Delete(id); + } + + public Disassociate disassociate(String id) { + return new Disassociate(id); + } + + public class List extends OpenStackRequest { + + + public List() { + super(CLIENT, HttpMethod.GET, "/os-networks", null, Networks.class); + } + + } + + public class Create extends OpenStackRequest { + + private Network network; + + public Create(Network network) { + super(CLIENT, HttpMethod.POST, "/os-networks", Entity.json(network), Network.class); + this.network = network; + } + + } + + public class Show extends OpenStackRequest { + + public Show(String id) { + super(CLIENT, HttpMethod.GET, new StringBuilder("/os-networks/").append(id).toString(), null, Network.class); + } + + } + + public class Disassociate extends OpenStackRequest { + + public Disassociate(String id) { + super(CLIENT, HttpMethod.POST, new StringBuilder("/os-networks/").append(id).toString(), Entity.json("{\"action\":\"disassociate\"}"), Void.class); + ; + } + + } + + public class Delete extends OpenStackRequest { + + public Delete(String id) { + super(CLIENT, HttpMethod.DELETE, new StringBuilder("/os-networks/").append(id).toString(), null, Void.class); + } + + } + + + +} diff --git a/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/SecurityGroupsExtension.java b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/SecurityGroupsExtension.java index 5a80a10aa..789286746 100644 --- a/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/SecurityGroupsExtension.java +++ b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/SecurityGroupsExtension.java @@ -1,184 +1,184 @@ -package com.woorea.openstack.nova.api.extensions; - - -import com.woorea.openstack.base.client.Entity; -import com.woorea.openstack.base.client.HttpMethod; -import com.woorea.openstack.base.client.OpenStackClient; -import com.woorea.openstack.base.client.OpenStackRequest; -import com.woorea.openstack.nova.model.SecurityGroup; -import com.woorea.openstack.nova.model.SecurityGroupForCreate; -import com.woorea.openstack.nova.model.SecurityGroupRuleForCreate; -import com.woorea.openstack.nova.model.SecurityGroups; - -public class SecurityGroupsExtension { - - private final OpenStackClient CLIENT; - - public SecurityGroupsExtension(OpenStackClient client) { - CLIENT = client; - } - - public class List extends OpenStackRequest { - - public List() { - super(CLIENT, HttpMethod.GET, "/os-security-groups", null, SecurityGroups.class); - } - - } - - public class Create extends OpenStackRequest { - - private SecurityGroupForCreate securityGroupForCreate; - - public Create(SecurityGroupForCreate securityGroupForCreate) { - super(CLIENT, HttpMethod.POST, "/os-security-groups", Entity.json(securityGroupForCreate), SecurityGroup.class); - this.securityGroupForCreate = securityGroupForCreate; - } - - } - - public class Show extends OpenStackRequest { - - /** - * @deprecated - * @param id - */ - public Show(Integer id) { - super(CLIENT, HttpMethod.GET, new StringBuilder("/os-security-groups/").append(id).toString(), null, SecurityGroup.class); - } - public Show(String id) { - super(CLIENT, HttpMethod.GET, new StringBuilder("/os-security-groups/").append(id).toString(), null, SecurityGroup.class); - } - - } - - public class Delete extends OpenStackRequest { - - /** - * - * @param id - * @deprecated - */ - public Delete(Integer id) { - super(CLIENT, HttpMethod.DELETE, new StringBuilder("/os-security-groups/").append(String.valueOf(id)).toString(), null, Void.class); - } - public Delete(String id) { - super(CLIENT, HttpMethod.DELETE, new StringBuilder("/os-security-groups/").append(id).toString(), null, Void.class); - } - - } - - public class CreateRule extends OpenStackRequest { - - private SecurityGroupRuleForCreate securityGroupRuleForCreate; - - public CreateRule(SecurityGroupRuleForCreate securityGroupRuleForCreate) { - super(CLIENT, HttpMethod.POST, "/os-security-group-rules", Entity.json(securityGroupRuleForCreate), SecurityGroup.Rule.class); - this.securityGroupRuleForCreate = securityGroupRuleForCreate; - } - } - - public class DeleteRule extends OpenStackRequest { - - /** - * - * @param id - * @deprecated - */ - public DeleteRule(Integer id) { - super(CLIENT, HttpMethod.DELETE, new StringBuilder("/os-security-group-rules/").append(String.valueOf(id)).toString(), null, Void.class); - } - - public DeleteRule(String id) { - super(CLIENT, HttpMethod.DELETE, new StringBuilder("/os-security-group-rules/").append(String.valueOf(id)).toString(), null, Void.class); - } - } - - public List listSecurityGroups() { - return new List(); - } - - public Create createSecurityGroup(String name, - String description) { - return new Create(new SecurityGroupForCreate(name, description)); - } - - public Create createSecurityGroup(String name) { - return createSecurityGroup(name, null); - } - - public Show showSecurityGroup(Integer id) { - return new Show(String.valueOf(id)); - } - - public Show showSecurityGroup(String id) { - return new Show(id); - } - public Delete deleteSecurityGroup(Integer id) { - return new Delete(String.valueOf(id)); - } - - public Delete deleteSecurityGroup(String id) { - return new Delete(id); - } - - /** - * - * @param parentSecurityGroupId - * @param ipProtocol - * @param fromPort - * @param toPort - * @param cidr - * @return - * @deprecated Use {@link #createSecurityGroupRule(String, String, Integer, Integer, String)} - */ - public CreateRule createSecurityGroupRule( - Integer parentSecurityGroupId, String ipProtocol, Integer fromPort, - Integer toPort, String cidr) { - SecurityGroupRuleForCreate securityGroupRuleForCreate = new SecurityGroupRuleForCreate( - parentSecurityGroupId, ipProtocol, fromPort, toPort, cidr); - return new CreateRule(securityGroupRuleForCreate); - } - /** - * - * @param parentSecurityGroupId - * @param ipProtocol - * @param fromPort - * @param toPort - * @param cidr - * @return - * @deprecated Use {@link #createSecurityGroupRule(String, String, String, Integer, Integer)} - */ - public CreateRule createSecurityGroupRule( - Integer parentSecurityGroupId, String ipProtocol, Integer fromPort, - Integer toPort, Integer sourceGroupId) { - SecurityGroupRuleForCreate securityGroupRuleForCreate = new SecurityGroupRuleForCreate( - parentSecurityGroupId, ipProtocol, fromPort, toPort, - sourceGroupId); - return new CreateRule(securityGroupRuleForCreate); - } - - public CreateRule createSecurityGroupRule( - String parentSecurityGroupId, String ipProtocol, Integer fromPort, - Integer toPort, String cidr) { - SecurityGroupRuleForCreate securityGroupRuleForCreate = new SecurityGroupRuleForCreate( - parentSecurityGroupId, ipProtocol, fromPort, toPort, cidr); - return new CreateRule(securityGroupRuleForCreate); - } - - public CreateRule createSecurityGroupRule( - String parentSecurityGroupId,String sourceGroupId,String ipProtocol, Integer fromPort, - Integer toPort) { - SecurityGroupRuleForCreate securityGroupRuleForCreate = new SecurityGroupRuleForCreate( - parentSecurityGroupId, sourceGroupId,ipProtocol, fromPort, toPort - ); - return new CreateRule(securityGroupRuleForCreate); - } - public DeleteRule deleteSecurityGroupRule(String id) { - return new DeleteRule(id); - } - public DeleteRule deleteSecurityGroupRule(Integer id) { - return new DeleteRule(String.valueOf(id)); - } - -} +package com.woorea.openstack.nova.api.extensions; + + +import com.woorea.openstack.base.client.Entity; +import com.woorea.openstack.base.client.HttpMethod; +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.base.client.OpenStackRequest; +import com.woorea.openstack.nova.model.SecurityGroup; +import com.woorea.openstack.nova.model.SecurityGroupForCreate; +import com.woorea.openstack.nova.model.SecurityGroupRuleForCreate; +import com.woorea.openstack.nova.model.SecurityGroups; + +public class SecurityGroupsExtension { + + private final OpenStackClient CLIENT; + + public SecurityGroupsExtension(OpenStackClient client) { + CLIENT = client; + } + + public class List extends OpenStackRequest { + + public List() { + super(CLIENT, HttpMethod.GET, "/os-security-groups", null, SecurityGroups.class); + } + + } + + public class Create extends OpenStackRequest { + + private SecurityGroupForCreate securityGroupForCreate; + + public Create(SecurityGroupForCreate securityGroupForCreate) { + super(CLIENT, HttpMethod.POST, "/os-security-groups", Entity.json(securityGroupForCreate), SecurityGroup.class); + this.securityGroupForCreate = securityGroupForCreate; + } + + } + + public class Show extends OpenStackRequest { + + /** + * @deprecated + * @param id + */ + public Show(Integer id) { + super(CLIENT, HttpMethod.GET, new StringBuilder("/os-security-groups/").append(id).toString(), null, SecurityGroup.class); + } + public Show(String id) { + super(CLIENT, HttpMethod.GET, new StringBuilder("/os-security-groups/").append(id).toString(), null, SecurityGroup.class); + } + + } + + public class Delete extends OpenStackRequest { + + /** + * + * @param id + * @deprecated + */ + public Delete(Integer id) { + super(CLIENT, HttpMethod.DELETE, new StringBuilder("/os-security-groups/").append(String.valueOf(id)).toString(), null, Void.class); + } + public Delete(String id) { + super(CLIENT, HttpMethod.DELETE, new StringBuilder("/os-security-groups/").append(id).toString(), null, Void.class); + } + + } + + public class CreateRule extends OpenStackRequest { + + private SecurityGroupRuleForCreate securityGroupRuleForCreate; + + public CreateRule(SecurityGroupRuleForCreate securityGroupRuleForCreate) { + super(CLIENT, HttpMethod.POST, "/os-security-group-rules", Entity.json(securityGroupRuleForCreate), SecurityGroup.Rule.class); + this.securityGroupRuleForCreate = securityGroupRuleForCreate; + } + } + + public class DeleteRule extends OpenStackRequest { + + /** + * + * @param id + * @deprecated + */ + public DeleteRule(Integer id) { + super(CLIENT, HttpMethod.DELETE, new StringBuilder("/os-security-group-rules/").append(String.valueOf(id)).toString(), null, Void.class); + } + + public DeleteRule(String id) { + super(CLIENT, HttpMethod.DELETE, new StringBuilder("/os-security-group-rules/").append(String.valueOf(id)).toString(), null, Void.class); + } + } + + public List listSecurityGroups() { + return new List(); + } + + public Create createSecurityGroup(String name, + String description) { + return new Create(new SecurityGroupForCreate(name, description)); + } + + public Create createSecurityGroup(String name) { + return createSecurityGroup(name, null); + } + + public Show showSecurityGroup(Integer id) { + return new Show(String.valueOf(id)); + } + + public Show showSecurityGroup(String id) { + return new Show(id); + } + public Delete deleteSecurityGroup(Integer id) { + return new Delete(String.valueOf(id)); + } + + public Delete deleteSecurityGroup(String id) { + return new Delete(id); + } + + /** + * + * @param parentSecurityGroupId + * @param ipProtocol + * @param fromPort + * @param toPort + * @param cidr + * @return + * @deprecated Use {@link #createSecurityGroupRule(String, String, Integer, Integer, String)} + */ + public CreateRule createSecurityGroupRule( + Integer parentSecurityGroupId, String ipProtocol, Integer fromPort, + Integer toPort, String cidr) { + SecurityGroupRuleForCreate securityGroupRuleForCreate = new SecurityGroupRuleForCreate( + parentSecurityGroupId, ipProtocol, fromPort, toPort, cidr); + return new CreateRule(securityGroupRuleForCreate); + } + /** + * + * @param parentSecurityGroupId + * @param ipProtocol + * @param fromPort + * @param toPort + * @param cidr + * @return + * @deprecated Use {@link #createSecurityGroupRule(String, String, String, Integer, Integer)} + */ + public CreateRule createSecurityGroupRule( + Integer parentSecurityGroupId, String ipProtocol, Integer fromPort, + Integer toPort, Integer sourceGroupId) { + SecurityGroupRuleForCreate securityGroupRuleForCreate = new SecurityGroupRuleForCreate( + parentSecurityGroupId, ipProtocol, fromPort, toPort, + sourceGroupId); + return new CreateRule(securityGroupRuleForCreate); + } + + public CreateRule createSecurityGroupRule( + String parentSecurityGroupId, String ipProtocol, Integer fromPort, + Integer toPort, String cidr) { + SecurityGroupRuleForCreate securityGroupRuleForCreate = new SecurityGroupRuleForCreate( + parentSecurityGroupId, ipProtocol, fromPort, toPort, cidr); + return new CreateRule(securityGroupRuleForCreate); + } + + public CreateRule createSecurityGroupRule( + String parentSecurityGroupId,String sourceGroupId,String ipProtocol, Integer fromPort, + Integer toPort) { + SecurityGroupRuleForCreate securityGroupRuleForCreate = new SecurityGroupRuleForCreate( + parentSecurityGroupId, sourceGroupId,ipProtocol, fromPort, toPort + ); + return new CreateRule(securityGroupRuleForCreate); + } + public DeleteRule deleteSecurityGroupRule(String id) { + return new DeleteRule(id); + } + public DeleteRule deleteSecurityGroupRule(Integer id) { + return new DeleteRule(String.valueOf(id)); + } + +} diff --git a/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/SnapshotsExtension.java b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/SnapshotsExtension.java index 62c2542b6..cb937579a 100644 --- a/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/SnapshotsExtension.java +++ b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/SnapshotsExtension.java @@ -1,86 +1,86 @@ -package com.woorea.openstack.nova.api.extensions; - - -import com.woorea.openstack.base.client.Entity; -import com.woorea.openstack.base.client.HttpMethod; -import com.woorea.openstack.base.client.OpenStackClient; -import com.woorea.openstack.base.client.OpenStackRequest; -import com.woorea.openstack.nova.model.Metadata; -import com.woorea.openstack.nova.model.Snapshot; -import com.woorea.openstack.nova.model.SnapshotForCreate; -import com.woorea.openstack.nova.model.Snapshots; - -public class SnapshotsExtension { - - private final OpenStackClient CLIENT; - - public SnapshotsExtension(OpenStackClient client) { - CLIENT = client; - } - - public List list(boolean detail) { - return new List(detail); - } - - public Create create(SnapshotForCreate snapshotForCreate) { - return new Create(snapshotForCreate); - } - - public Show show(String id) { - return new Show(id); - } - - public ShowMetadata showMetadata(String id) { - return new ShowMetadata(id); - } - - - public Delete delete(String id) { - return new Delete(id); - } - - public class List extends OpenStackRequest { - - public List(boolean detail) { - super(CLIENT, HttpMethod.GET, detail ? "/os-snapshots/detail" : "/os-snapshots", null, Snapshots.class); - } - - } - - public class Create extends OpenStackRequest { - - private SnapshotForCreate snapshotForCreate; - - public Create(SnapshotForCreate snapshotForCreate) { - super(CLIENT, HttpMethod.POST, "/os-snapshots", Entity.json(snapshotForCreate), SnapshotForCreate.class); - this.snapshotForCreate = snapshotForCreate; - } - - } - - public class Show extends OpenStackRequest { - - public Show(String id) { - super(CLIENT, HttpMethod.GET, new StringBuilder("/os-snapshots/").append(id).toString(), null, Snapshot.class); - } - - } - - public class ShowMetadata extends OpenStackRequest { - - public ShowMetadata(String id) { - super(CLIENT, HttpMethod.GET, new StringBuilder("/os-snapshots/").append(id).append("/metadata").toString(), null, Metadata.class); - } - - } - - public class Delete extends OpenStackRequest { - - public Delete(String id) { - super(CLIENT, HttpMethod.DELETE, new StringBuilder("/os-snapshots/").append(id).toString(), null, Void.class); - } - - } - -} - +package com.woorea.openstack.nova.api.extensions; + + +import com.woorea.openstack.base.client.Entity; +import com.woorea.openstack.base.client.HttpMethod; +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.base.client.OpenStackRequest; +import com.woorea.openstack.nova.model.Metadata; +import com.woorea.openstack.nova.model.Snapshot; +import com.woorea.openstack.nova.model.SnapshotForCreate; +import com.woorea.openstack.nova.model.Snapshots; + +public class SnapshotsExtension { + + private final OpenStackClient CLIENT; + + public SnapshotsExtension(OpenStackClient client) { + CLIENT = client; + } + + public List list(boolean detail) { + return new List(detail); + } + + public Create create(SnapshotForCreate snapshotForCreate) { + return new Create(snapshotForCreate); + } + + public Show show(String id) { + return new Show(id); + } + + public ShowMetadata showMetadata(String id) { + return new ShowMetadata(id); + } + + + public Delete delete(String id) { + return new Delete(id); + } + + public class List extends OpenStackRequest { + + public List(boolean detail) { + super(CLIENT, HttpMethod.GET, detail ? "/os-snapshots/detail" : "/os-snapshots", null, Snapshots.class); + } + + } + + public class Create extends OpenStackRequest { + + private SnapshotForCreate snapshotForCreate; + + public Create(SnapshotForCreate snapshotForCreate) { + super(CLIENT, HttpMethod.POST, "/os-snapshots", Entity.json(snapshotForCreate), SnapshotForCreate.class); + this.snapshotForCreate = snapshotForCreate; + } + + } + + public class Show extends OpenStackRequest { + + public Show(String id) { + super(CLIENT, HttpMethod.GET, new StringBuilder("/os-snapshots/").append(id).toString(), null, Snapshot.class); + } + + } + + public class ShowMetadata extends OpenStackRequest { + + public ShowMetadata(String id) { + super(CLIENT, HttpMethod.GET, new StringBuilder("/os-snapshots/").append(id).append("/metadata").toString(), null, Metadata.class); + } + + } + + public class Delete extends OpenStackRequest { + + public Delete(String id) { + super(CLIENT, HttpMethod.DELETE, new StringBuilder("/os-snapshots/").append(id).toString(), null, Void.class); + } + + } + +} + diff --git a/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/VolumesExtension.java b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/VolumesExtension.java index de3557731..c96174796 100644 --- a/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/VolumesExtension.java +++ b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/VolumesExtension.java @@ -1,106 +1,106 @@ -package com.woorea.openstack.nova.api.extensions; - -import com.woorea.openstack.base.client.Entity; -import com.woorea.openstack.base.client.HttpMethod; -import com.woorea.openstack.base.client.OpenStackClient; -import com.woorea.openstack.base.client.OpenStackRequest; -import com.woorea.openstack.nova.model.Metadata; -import com.woorea.openstack.nova.model.Volume; -import com.woorea.openstack.nova.model.VolumeForCreate; -import com.woorea.openstack.nova.model.VolumeForImageCreate; -import com.woorea.openstack.nova.model.Volumes; - -public class VolumesExtension { - - private final OpenStackClient CLIENT; - - public VolumesExtension(OpenStackClient client) { - CLIENT = client; - } - - public List list(boolean detail) { - return new List(detail); - } - - public Create create(VolumeForCreate volume) { - return new Create(volume); - } - - public UploadToImage uploadToImage(VolumeForImageCreate volumeForImage) { - return new UploadToImage(volumeForImage); - } - - public Show show(String id) { - return new Show(id); - } - - public ShowMetadata showMetadata(String id) { - return new ShowMetadata(id); - } - - public Delete delete(String id) { - return new Delete(id); - } - - public class List extends OpenStackRequest { - - public List(boolean detail) { - super(CLIENT, HttpMethod.GET, detail ? "/os-volumes/detail" - : "/os-volumes", null, Volumes.class); - } - - } - - public class Create extends OpenStackRequest { - - // private Volume volume; - - public Create(VolumeForCreate volume) { - super(CLIENT, HttpMethod.POST, "/os-volumes", Entity.json(volume), - Volume.class); - // this.volume = volume; - } - - } - - // Upload volume to image service as image - - public class UploadToImage extends OpenStackRequest { - - public UploadToImage(VolumeForImageCreate volumeForImageCreate) { - super(CLIENT, HttpMethod.POST, new StringBuilder("/volumes/") - .append(volumeForImageCreate.getVolumeId() + "/action"), - Entity.json(volumeForImageCreate), Void.class); - } - - } - - public class Show extends OpenStackRequest { - - public Show(String id) { - super(CLIENT, HttpMethod.GET, new StringBuilder("/os-volumes/") - .append(id).toString(), null, Volume.class); - } - - } - - public class ShowMetadata extends OpenStackRequest { - - public ShowMetadata(String id) { - super(CLIENT, HttpMethod.GET, new StringBuilder("/os-volumes/") - .append(id).append("/metadata").toString(), null, - Metadata.class); - } - - } - - public class Delete extends OpenStackRequest { - - public Delete(String id) { - super(CLIENT, HttpMethod.DELETE, new StringBuilder("/os-volumes/") - .append(id).toString(), null, Void.class); - } - - } - -} +package com.woorea.openstack.nova.api.extensions; + +import com.woorea.openstack.base.client.Entity; +import com.woorea.openstack.base.client.HttpMethod; +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.base.client.OpenStackRequest; +import com.woorea.openstack.nova.model.Metadata; +import com.woorea.openstack.nova.model.Volume; +import com.woorea.openstack.nova.model.VolumeForCreate; +import com.woorea.openstack.nova.model.VolumeForImageCreate; +import com.woorea.openstack.nova.model.Volumes; + +public class VolumesExtension { + + private final OpenStackClient CLIENT; + + public VolumesExtension(OpenStackClient client) { + CLIENT = client; + } + + public List list(boolean detail) { + return new List(detail); + } + + public Create create(VolumeForCreate volume) { + return new Create(volume); + } + + public UploadToImage uploadToImage(VolumeForImageCreate volumeForImage) { + return new UploadToImage(volumeForImage); + } + + public Show show(String id) { + return new Show(id); + } + + public ShowMetadata showMetadata(String id) { + return new ShowMetadata(id); + } + + public Delete delete(String id) { + return new Delete(id); + } + + public class List extends OpenStackRequest { + + public List(boolean detail) { + super(CLIENT, HttpMethod.GET, detail ? "/os-volumes/detail" + : "/os-volumes", null, Volumes.class); + } + + } + + public class Create extends OpenStackRequest { + + // private Volume volume; + + public Create(VolumeForCreate volume) { + super(CLIENT, HttpMethod.POST, "/os-volumes", Entity.json(volume), + Volume.class); + // this.volume = volume; + } + + } + + // Upload volume to image service as image + + public class UploadToImage extends OpenStackRequest { + + public UploadToImage(VolumeForImageCreate volumeForImageCreate) { + super(CLIENT, HttpMethod.POST, new StringBuilder("/volumes/") + .append(volumeForImageCreate.getVolumeId() + "/action"), + Entity.json(volumeForImageCreate), Void.class); + } + + } + + public class Show extends OpenStackRequest { + + public Show(String id) { + super(CLIENT, HttpMethod.GET, new StringBuilder("/os-volumes/") + .append(id).toString(), null, Volume.class); + } + + } + + public class ShowMetadata extends OpenStackRequest { + + public ShowMetadata(String id) { + super(CLIENT, HttpMethod.GET, new StringBuilder("/os-volumes/") + .append(id).append("/metadata").toString(), null, + Metadata.class); + } + + } + + public class Delete extends OpenStackRequest { + + public Delete(String id) { + super(CLIENT, HttpMethod.DELETE, new StringBuilder("/os-volumes/") + .append(id).toString(), null, Void.class); + } + + } + +} diff --git a/nova-model/pom.xml b/nova-model/pom.xml index e7cfec5c3..40d11250b 100644 --- a/nova-model/pom.xml +++ b/nova-model/pom.xml @@ -1,11 +1,11 @@ - - 4.0.0 - - com.woorea - openstack-java-sdk - 3.2.2-SNAPSHOT - - nova-model - OpenStack Nova Model - OpenStack Nova Model + + 4.0.0 + + com.woorea + openstack-java-sdk + 3.2.2-SNAPSHOT + + nova-model + OpenStack Nova Model + OpenStack Nova Model \ No newline at end of file diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/Link.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/Link.java index f973bec55..a11fbfc60 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/Link.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/Link.java @@ -1,42 +1,42 @@ -package com.woorea.openstack.nova.model; - -import java.io.Serializable; - -public class Link implements Serializable { - - private String rel; - - private String href; - - private String type; - - /** - * @return the rel - */ - public String getRel() { - return rel; - } - - /** - * @return the href - */ - public String getHref() { - return href; - } - - /** - * @return the type - */ - public String getType() { - return type; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Link [rel=" + rel + ", href=" + href + ", type=" + type + "]"; - } - -} +package com.woorea.openstack.nova.model; + +import java.io.Serializable; + +public class Link implements Serializable { + + private String rel; + + private String href; + + private String type; + + /** + * @return the rel + */ + public String getRel() { + return rel; + } + + /** + * @return the href + */ + public String getHref() { + return href; + } + + /** + * @return the type + */ + public String getType() { + return type; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Link [rel=" + rel + ", href=" + href + ", type=" + type + "]"; + } + +} diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/Metadata.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/Metadata.java index a3dbffb77..4b1b71094 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/Metadata.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/Metadata.java @@ -1,26 +1,26 @@ -package com.woorea.openstack.nova.model; - -import java.util.Map; - -public class Metadata { - - private Map metadata; - - /** - * @return the metadata - */ - public Map getMetadata() { - return metadata; - } - - /** - * Set the metadata - * @param metadata - */ - public void setMetadata(Map metadata) { - this.metadata = metadata; - } - - - -} +package com.woorea.openstack.nova.model; + +import java.util.Map; + +public class Metadata { + + private Map metadata; + + /** + * @return the metadata + */ + public Map getMetadata() { + return metadata; + } + + /** + * Set the metadata + * @param metadata + */ + public void setMetadata(Map metadata) { + this.metadata = metadata; + } + + + +} diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/PersonalityFile.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/PersonalityFile.java index c4ff30715..3e6aba389 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/PersonalityFile.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/PersonalityFile.java @@ -1,39 +1,39 @@ -package com.woorea.openstack.nova.model; - -import java.io.Serializable; - -public final class PersonalityFile implements Serializable { - - private String path; - - private String contents; - - /** - * @return the path - */ - public String getPath() { - return path; - } - - /** - * @param path the path to set - */ - public void setPath(String path) { - this.path = path; - } - - /** - * @return the contents - */ - public String getContents() { - return contents; - } - - /** - * @param contents the contents to set - */ - public void setContents(String contents) { - this.contents = contents; - } - -} +package com.woorea.openstack.nova.model; + +import java.io.Serializable; + +public final class PersonalityFile implements Serializable { + + private String path; + + private String contents; + + /** + * @return the path + */ + public String getPath() { + return path; + } + + /** + * @param path the path to set + */ + public void setPath(String path) { + this.path = path; + } + + /** + * @return the contents + */ + public String getContents() { + return contents; + } + + /** + * @param contents the contents to set + */ + public void setContents(String contents) { + this.contents = contents; + } + +} diff --git a/openstack-client-connectors/jersey-connector/pom.xml b/openstack-client-connectors/jersey-connector/pom.xml index b9b95c496..7c4a92c61 100644 --- a/openstack-client-connectors/jersey-connector/pom.xml +++ b/openstack-client-connectors/jersey-connector/pom.xml @@ -1,23 +1,23 @@ - - 4.0.0 - - com.woorea - openstack-client-connectors - 3.2.2-SNAPSHOT - - jersey-connector - OpenStack Jersey Connector - OpenStack Jersey Connector - - - com.sun.jersey - jersey-client - 1.17.1 - - - org.codehaus.jackson - jackson-jaxrs - 1.9.12 - - - + + 4.0.0 + + com.woorea + openstack-client-connectors + 3.2.2-SNAPSHOT + + jersey-connector + OpenStack Jersey Connector + OpenStack Jersey Connector + + + com.sun.jersey + jersey-client + 1.17.1 + + + org.codehaus.jackson + jackson-jaxrs + 1.9.12 + + + diff --git a/openstack-client-connectors/jersey-connector/src/main/java/com/woorea/openstack/connector/JerseyLoggingFilter.java b/openstack-client-connectors/jersey-connector/src/main/java/com/woorea/openstack/connector/JerseyLoggingFilter.java index c1877c3df..aed0e5ecb 100644 --- a/openstack-client-connectors/jersey-connector/src/main/java/com/woorea/openstack/connector/JerseyLoggingFilter.java +++ b/openstack-client-connectors/jersey-connector/src/main/java/com/woorea/openstack/connector/JerseyLoggingFilter.java @@ -1,279 +1,279 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 2010-2011 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * http://glassfish.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - */ -package com.woorea.openstack.connector; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.io.PrintStream; -import java.util.List; -import java.util.Map; -import java.util.logging.Logger; - -import javax.ws.rs.core.MultivaluedMap; - -import com.sun.jersey.api.client.AbstractClientRequestAdapter; -import com.sun.jersey.api.client.ClientHandlerException; -import com.sun.jersey.api.client.ClientRequest; -import com.sun.jersey.api.client.ClientRequestAdapter; -import com.sun.jersey.api.client.ClientResponse; -import com.sun.jersey.api.client.filter.ClientFilter; -import com.sun.jersey.api.client.filter.LoggingFilter; -import com.sun.jersey.core.util.ReaderWriter; - -/** - * A logging filter. - * - */ -public class JerseyLoggingFilter extends ClientFilter { - - private static final Logger LOGGER = Logger.getLogger(LoggingFilter.class.getName()); - - private static final String NOTIFICATION_PREFIX = "* "; - - private static final String REQUEST_PREFIX = "> "; - - private static final String RESPONSE_PREFIX = "< "; - - private static final String PASSWORD_PATTERN = "\"password\".*:.*\"(.*)\""; - - private final class Adapter extends AbstractClientRequestAdapter { - private final StringBuilder b; - - Adapter(ClientRequestAdapter cra, StringBuilder b) { - super(cra); - this.b = b; - } - - public OutputStream adapt(ClientRequest request, OutputStream out) throws IOException { - return new LoggingOutputStream(getAdapter().adapt(request, out), b); - } - - } - - private final class LoggingOutputStream extends OutputStream { - private final OutputStream out; - - private final ByteArrayOutputStream baos = new ByteArrayOutputStream(); - - private final StringBuilder b; - - LoggingOutputStream(OutputStream out, StringBuilder b) { - this.out = out; - this.b = b; - } - - @Override - public void write(byte[] b) throws IOException { - baos.write(b); - out.write(b); - } - - @Override - public void write(byte[] b, int off, int len) throws IOException { - baos.write(b, off, len); - out.write(b, off, len); - } - - @Override - public void write(int b) throws IOException { - baos.write(b); - out.write(b); - } - - @Override - public void close() throws IOException { - printEntity(b, baos.toByteArray()); - log(b); - out.close(); - } - } - - private final PrintStream loggingStream; - - private final Logger logger; - - private long _id = 0; - - /** - * Create a logging filter logging the request and response to - * a default JDK logger, named as the fully qualified class name of this - * class. - */ - public JerseyLoggingFilter() { - this(LOGGER); - } - - /** - * Create a logging filter logging the request and response to - * a JDK logger. - * - * @param logger the logger to log requests and responses. - */ - public JerseyLoggingFilter(Logger logger) { - this.loggingStream = null; - this.logger = logger; - } - - /** - * Create a logging filter logging the request and response to - * print stream. - * - * @param loggingStream the print stream to log requests and responses. - */ - public JerseyLoggingFilter(PrintStream loggingStream) { - this.loggingStream = loggingStream; - this.logger = null; - } - - private void log(StringBuilder b) { - if (logger != null) { - logger.info(b.toString()); - } else { - loggingStream.print(b); - } - } - - private StringBuilder prefixId(StringBuilder b, long id) { - b.append(Long.toString(id)).append(" "); - return b; - } - - @Override - public ClientResponse handle(ClientRequest request) throws ClientHandlerException { - long id = ++this._id; - - logRequest(id, request); - - ClientResponse response = getNext().handle(request); - - logResponse(id, response); - - return response; - } - - private void logRequest(long id, ClientRequest request) { - StringBuilder b = new StringBuilder(); - - printRequestLine(b, id, request); - printRequestHeaders(b, id, request.getHeaders()); - - if (request.getEntity() != null) { - request.setAdapter(new Adapter(request.getAdapter(), b)); - } else { - log(b); - } - } - - private void printRequestLine(StringBuilder b, long id, ClientRequest request) { - prefixId(b, id).append(NOTIFICATION_PREFIX).append("Client out-bound request").append("\n"); - prefixId(b, id).append(REQUEST_PREFIX).append(request.getMethod()).append(" "). - append(request.getURI().toASCIIString()).append("\n"); - } - - private void printRequestHeaders(StringBuilder b, long id, MultivaluedMap headers) { - for (Map.Entry> e : headers.entrySet()) { - List val = e.getValue(); - String header = e.getKey(); - - if(val.size() == 1) { - prefixId(b, id).append(REQUEST_PREFIX).append(header).append(": ").append(ClientRequest.getHeaderValue(val.get(0))).append("\n"); - } else { - StringBuilder sb = new StringBuilder(); - boolean add = false; - for(Object o : val) { - if(add) sb.append(','); - add = true; - sb.append(ClientRequest.getHeaderValue(o)); - } - prefixId(b, id).append(REQUEST_PREFIX).append(header).append(": ").append(sb.toString()).append("\n"); - } - } - } - - private void logResponse(long id, ClientResponse response) { - StringBuilder b = new StringBuilder(); - - printResponseLine(b, id, response); - printResponseHeaders(b, id, response.getHeaders()); - - ByteArrayOutputStream out = new ByteArrayOutputStream(); - InputStream in = response.getEntityInputStream(); - try { - ReaderWriter.writeTo(in, out); - - byte[] requestEntity = out.toByteArray(); - printEntity(b, requestEntity); - response.setEntityInputStream(new ByteArrayInputStream(requestEntity)); - } catch (IOException ex) { - throw new ClientHandlerException(ex); - } - log(b); - } - - private void printResponseLine(StringBuilder b, long id, ClientResponse response) { - prefixId(b, id).append(NOTIFICATION_PREFIX). - append("Client in-bound response").append("\n"); - prefixId(b, id).append(RESPONSE_PREFIX). - append(Integer.toString(response.getStatus())). - append("\n"); - } - - private void printResponseHeaders(StringBuilder b, long id, MultivaluedMap headers) { - for (Map.Entry> e : headers.entrySet()) { - String header = e.getKey(); - for (String value : e.getValue()) { - prefixId(b, id).append(RESPONSE_PREFIX).append(header).append(": "). - append(value).append("\n"); - } - } - prefixId(b, id).append(RESPONSE_PREFIX).append("\n"); - } - - private void printEntity(StringBuilder b, byte[] entity) throws IOException { - if (entity.length == 0) - return; - String entityString = new String(entity); - entityString = entityString.replaceAll(PASSWORD_PATTERN, "\"password\" : \"******\""); - b.append(entityString).append("\n"); - } +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 2010-2011 Oracle and/or its affiliates. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common Development + * and Distribution License("CDDL") (collectively, the "License"). You + * may not use this file except in compliance with the License. You can + * obtain a copy of the License at + * http://glassfish.java.net/public/CDDL+GPL_1_1.html + * or packager/legal/LICENSE.txt. See the License for the specific + * language governing permissions and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file at packager/legal/LICENSE.txt. + * + * GPL Classpath Exception: + * Oracle designates this particular file as subject to the "Classpath" + * exception as provided by Oracle in the GPL Version 2 section of the License + * file that accompanied this code. + * + * Modifications: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + * + * Contributor(s): + * If you wish your version of this file to be governed by only the CDDL or + * only the GPL Version 2, indicate your decision by adding "[Contributor] + * elects to include this software in this distribution under the [CDDL or GPL + * Version 2] license." If you don't indicate a single choice of license, a + * recipient has the option to distribute your version of this file under + * either the CDDL, the GPL Version 2 or to extend the choice of license to + * its licensees as provided above. However, if you add GPL Version 2 code + * and therefore, elected the GPL Version 2 license, then the option applies + * only if the new code is made subject to such option by the copyright + * holder. + */ +package com.woorea.openstack.connector; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.io.PrintStream; +import java.util.List; +import java.util.Map; +import java.util.logging.Logger; + +import javax.ws.rs.core.MultivaluedMap; + +import com.sun.jersey.api.client.AbstractClientRequestAdapter; +import com.sun.jersey.api.client.ClientHandlerException; +import com.sun.jersey.api.client.ClientRequest; +import com.sun.jersey.api.client.ClientRequestAdapter; +import com.sun.jersey.api.client.ClientResponse; +import com.sun.jersey.api.client.filter.ClientFilter; +import com.sun.jersey.api.client.filter.LoggingFilter; +import com.sun.jersey.core.util.ReaderWriter; + +/** + * A logging filter. + * + */ +public class JerseyLoggingFilter extends ClientFilter { + + private static final Logger LOGGER = Logger.getLogger(LoggingFilter.class.getName()); + + private static final String NOTIFICATION_PREFIX = "* "; + + private static final String REQUEST_PREFIX = "> "; + + private static final String RESPONSE_PREFIX = "< "; + + private static final String PASSWORD_PATTERN = "\"password\".*:.*\"(.*)\""; + + private final class Adapter extends AbstractClientRequestAdapter { + private final StringBuilder b; + + Adapter(ClientRequestAdapter cra, StringBuilder b) { + super(cra); + this.b = b; + } + + public OutputStream adapt(ClientRequest request, OutputStream out) throws IOException { + return new LoggingOutputStream(getAdapter().adapt(request, out), b); + } + + } + + private final class LoggingOutputStream extends OutputStream { + private final OutputStream out; + + private final ByteArrayOutputStream baos = new ByteArrayOutputStream(); + + private final StringBuilder b; + + LoggingOutputStream(OutputStream out, StringBuilder b) { + this.out = out; + this.b = b; + } + + @Override + public void write(byte[] b) throws IOException { + baos.write(b); + out.write(b); + } + + @Override + public void write(byte[] b, int off, int len) throws IOException { + baos.write(b, off, len); + out.write(b, off, len); + } + + @Override + public void write(int b) throws IOException { + baos.write(b); + out.write(b); + } + + @Override + public void close() throws IOException { + printEntity(b, baos.toByteArray()); + log(b); + out.close(); + } + } + + private final PrintStream loggingStream; + + private final Logger logger; + + private long _id = 0; + + /** + * Create a logging filter logging the request and response to + * a default JDK logger, named as the fully qualified class name of this + * class. + */ + public JerseyLoggingFilter() { + this(LOGGER); + } + + /** + * Create a logging filter logging the request and response to + * a JDK logger. + * + * @param logger the logger to log requests and responses. + */ + public JerseyLoggingFilter(Logger logger) { + this.loggingStream = null; + this.logger = logger; + } + + /** + * Create a logging filter logging the request and response to + * print stream. + * + * @param loggingStream the print stream to log requests and responses. + */ + public JerseyLoggingFilter(PrintStream loggingStream) { + this.loggingStream = loggingStream; + this.logger = null; + } + + private void log(StringBuilder b) { + if (logger != null) { + logger.info(b.toString()); + } else { + loggingStream.print(b); + } + } + + private StringBuilder prefixId(StringBuilder b, long id) { + b.append(Long.toString(id)).append(" "); + return b; + } + + @Override + public ClientResponse handle(ClientRequest request) throws ClientHandlerException { + long id = ++this._id; + + logRequest(id, request); + + ClientResponse response = getNext().handle(request); + + logResponse(id, response); + + return response; + } + + private void logRequest(long id, ClientRequest request) { + StringBuilder b = new StringBuilder(); + + printRequestLine(b, id, request); + printRequestHeaders(b, id, request.getHeaders()); + + if (request.getEntity() != null) { + request.setAdapter(new Adapter(request.getAdapter(), b)); + } else { + log(b); + } + } + + private void printRequestLine(StringBuilder b, long id, ClientRequest request) { + prefixId(b, id).append(NOTIFICATION_PREFIX).append("Client out-bound request").append("\n"); + prefixId(b, id).append(REQUEST_PREFIX).append(request.getMethod()).append(" "). + append(request.getURI().toASCIIString()).append("\n"); + } + + private void printRequestHeaders(StringBuilder b, long id, MultivaluedMap headers) { + for (Map.Entry> e : headers.entrySet()) { + List val = e.getValue(); + String header = e.getKey(); + + if(val.size() == 1) { + prefixId(b, id).append(REQUEST_PREFIX).append(header).append(": ").append(ClientRequest.getHeaderValue(val.get(0))).append("\n"); + } else { + StringBuilder sb = new StringBuilder(); + boolean add = false; + for(Object o : val) { + if(add) sb.append(','); + add = true; + sb.append(ClientRequest.getHeaderValue(o)); + } + prefixId(b, id).append(REQUEST_PREFIX).append(header).append(": ").append(sb.toString()).append("\n"); + } + } + } + + private void logResponse(long id, ClientResponse response) { + StringBuilder b = new StringBuilder(); + + printResponseLine(b, id, response); + printResponseHeaders(b, id, response.getHeaders()); + + ByteArrayOutputStream out = new ByteArrayOutputStream(); + InputStream in = response.getEntityInputStream(); + try { + ReaderWriter.writeTo(in, out); + + byte[] requestEntity = out.toByteArray(); + printEntity(b, requestEntity); + response.setEntityInputStream(new ByteArrayInputStream(requestEntity)); + } catch (IOException ex) { + throw new ClientHandlerException(ex); + } + log(b); + } + + private void printResponseLine(StringBuilder b, long id, ClientResponse response) { + prefixId(b, id).append(NOTIFICATION_PREFIX). + append("Client in-bound response").append("\n"); + prefixId(b, id).append(RESPONSE_PREFIX). + append(Integer.toString(response.getStatus())). + append("\n"); + } + + private void printResponseHeaders(StringBuilder b, long id, MultivaluedMap headers) { + for (Map.Entry> e : headers.entrySet()) { + String header = e.getKey(); + for (String value : e.getValue()) { + prefixId(b, id).append(RESPONSE_PREFIX).append(header).append(": "). + append(value).append("\n"); + } + } + prefixId(b, id).append(RESPONSE_PREFIX).append("\n"); + } + + private void printEntity(StringBuilder b, byte[] entity) throws IOException { + if (entity.length == 0) + return; + String entityString = new String(entity); + entityString = entityString.replaceAll(PASSWORD_PATTERN, "\"password\" : \"******\""); + b.append(entityString).append("\n"); + } } \ No newline at end of file diff --git a/openstack-client-connectors/jersey2-connector/pom.xml b/openstack-client-connectors/jersey2-connector/pom.xml index 1738128d4..a7468fa13 100644 --- a/openstack-client-connectors/jersey2-connector/pom.xml +++ b/openstack-client-connectors/jersey2-connector/pom.xml @@ -1,33 +1,33 @@ - - - 4.0.0 - - com.woorea - openstack-client-connectors - 3.2.2-SNAPSHOT - - jersey2-connector - OpenStack Jersey2 Connector - OpenStack Jersey2 Connector - http://maven.apache.org - - UTF-8 - - - - org.glassfish.jersey.core - jersey-client - 2.6 - - - org.glassfish.jersey.media - jersey-media-json-jackson - 2.6 - - - com.woorea - openstack-client - 3.2.2-SNAPSHOT - - - + + + 4.0.0 + + com.woorea + openstack-client-connectors + 3.2.2-SNAPSHOT + + jersey2-connector + OpenStack Jersey2 Connector + OpenStack Jersey2 Connector + http://maven.apache.org + + UTF-8 + + + + org.glassfish.jersey.core + jersey-client + 2.6 + + + org.glassfish.jersey.media + jersey-media-json-jackson + 2.6 + + + com.woorea + openstack-client + 3.2.2-SNAPSHOT + + + diff --git a/openstack-client-connectors/jersey2-connector/src/main/java/com/woorea/openstack/connector/JaxRs20Connector.java b/openstack-client-connectors/jersey2-connector/src/main/java/com/woorea/openstack/connector/JaxRs20Connector.java index 2171beacf..1bda0102b 100644 --- a/openstack-client-connectors/jersey2-connector/src/main/java/com/woorea/openstack/connector/JaxRs20Connector.java +++ b/openstack-client-connectors/jersey2-connector/src/main/java/com/woorea/openstack/connector/JaxRs20Connector.java @@ -1,65 +1,65 @@ -package com.woorea.openstack.connector; - -import java.util.List; -import java.util.Map; -import java.util.logging.Logger; - -import javax.ws.rs.ClientErrorException; -import javax.ws.rs.client.Client; -import javax.ws.rs.client.Entity; -import javax.ws.rs.client.Invocation; -import javax.ws.rs.client.WebTarget; -import javax.ws.rs.core.MediaType; - -import org.glassfish.jersey.filter.LoggingFilter; - -import com.woorea.openstack.base.client.HttpMethod; -import com.woorea.openstack.base.client.OpenStackClientConnector; -import com.woorea.openstack.base.client.OpenStackRequest; -import com.woorea.openstack.base.client.OpenStackResponse; -import com.woorea.openstack.base.client.OpenStackResponseException; - -public class JaxRs20Connector implements OpenStackClientConnector { - - protected Client client = OpenStack.CLIENT; - private LoggingFilter logger = new LoggingFilter(Logger.getLogger("os"), 10000); - - @Override - public OpenStackResponse request(OpenStackRequest request) { - WebTarget target = client.target(request.endpoint()).path(request.path()); - - for(Map.Entry > entry : request.queryParams().entrySet()) { - for (Object o : entry.getValue()) { - target = target.queryParam(entry.getKey(), o); - } - } - target.register(logger); - Invocation.Builder invocation = target.request(); - - for(Map.Entry> h : request.headers().entrySet()) { - StringBuilder sb = new StringBuilder(); - for(Object v : h.getValue()) { - sb.append(String.valueOf(v)); - } - invocation.header(h.getKey(), sb); - } - - Entity entity = (request.entity() == null) ? null : - Entity.entity(request.entity().getEntity(), request.entity().getContentType()); - - try { - if (entity != null) { - return new JaxRs20Response(invocation.method(request.method().name(), entity)); - } else { - if(HttpMethod.PUT == request.method()) { - return new JaxRs20Response(invocation.method(request.method().name(), Entity.entity("", MediaType.APPLICATION_JSON))); - } else { - return new JaxRs20Response(invocation.method(request.method().name())); - } - } - } catch (ClientErrorException e) { - throw new OpenStackResponseException(e.getResponse() - .getStatusInfo().toString(), e.getResponse().getStatus()); - } - } -} +package com.woorea.openstack.connector; + +import java.util.List; +import java.util.Map; +import java.util.logging.Logger; + +import javax.ws.rs.ClientErrorException; +import javax.ws.rs.client.Client; +import javax.ws.rs.client.Entity; +import javax.ws.rs.client.Invocation; +import javax.ws.rs.client.WebTarget; +import javax.ws.rs.core.MediaType; + +import org.glassfish.jersey.filter.LoggingFilter; + +import com.woorea.openstack.base.client.HttpMethod; +import com.woorea.openstack.base.client.OpenStackClientConnector; +import com.woorea.openstack.base.client.OpenStackRequest; +import com.woorea.openstack.base.client.OpenStackResponse; +import com.woorea.openstack.base.client.OpenStackResponseException; + +public class JaxRs20Connector implements OpenStackClientConnector { + + protected Client client = OpenStack.CLIENT; + private LoggingFilter logger = new LoggingFilter(Logger.getLogger("os"), 10000); + + @Override + public OpenStackResponse request(OpenStackRequest request) { + WebTarget target = client.target(request.endpoint()).path(request.path()); + + for(Map.Entry > entry : request.queryParams().entrySet()) { + for (Object o : entry.getValue()) { + target = target.queryParam(entry.getKey(), o); + } + } + target.register(logger); + Invocation.Builder invocation = target.request(); + + for(Map.Entry> h : request.headers().entrySet()) { + StringBuilder sb = new StringBuilder(); + for(Object v : h.getValue()) { + sb.append(String.valueOf(v)); + } + invocation.header(h.getKey(), sb); + } + + Entity entity = (request.entity() == null) ? null : + Entity.entity(request.entity().getEntity(), request.entity().getContentType()); + + try { + if (entity != null) { + return new JaxRs20Response(invocation.method(request.method().name(), entity)); + } else { + if(HttpMethod.PUT == request.method()) { + return new JaxRs20Response(invocation.method(request.method().name(), Entity.entity("", MediaType.APPLICATION_JSON))); + } else { + return new JaxRs20Response(invocation.method(request.method().name())); + } + } + } catch (ClientErrorException e) { + throw new OpenStackResponseException(e.getResponse() + .getStatusInfo().toString(), e.getResponse().getStatus()); + } + } +} diff --git a/openstack-client-connectors/jersey2-connector/src/main/java/com/woorea/openstack/connector/JaxRs20Response.java b/openstack-client-connectors/jersey2-connector/src/main/java/com/woorea/openstack/connector/JaxRs20Response.java index ebddd0771..920b1bd15 100644 --- a/openstack-client-connectors/jersey2-connector/src/main/java/com/woorea/openstack/connector/JaxRs20Response.java +++ b/openstack-client-connectors/jersey2-connector/src/main/java/com/woorea/openstack/connector/JaxRs20Response.java @@ -1,48 +1,48 @@ -package com.woorea.openstack.connector; - -import java.io.InputStream; -import java.util.HashMap; -import java.util.Map; - -import javax.ws.rs.core.Response; - -import com.woorea.openstack.base.client.OpenStackResponse; -import com.woorea.openstack.base.client.OpenStackResponseException; - -public class JaxRs20Response implements OpenStackResponse { - - private Response response; - - public JaxRs20Response(Response response) { - this.response = response; - } - - @Override - public T getEntity(Class returnType) { - if(response.getStatus() >= 400) { - throw new OpenStackResponseException(response.getStatusInfo().getReasonPhrase(), - response.getStatusInfo().getStatusCode()); - } - return response.readEntity(returnType); - } - - @Override - public InputStream getInputStream() { - return (InputStream) response.getEntity(); - } - - @Override - public String header(String name) { - return response.getHeaderString(name); - } - - @Override - public Map headers() { - Map headers = new HashMap(); - for(String k : response.getHeaders().keySet()) { - headers.put(k, response.getHeaderString(k)); - } - return headers; - } - -} +package com.woorea.openstack.connector; + +import java.io.InputStream; +import java.util.HashMap; +import java.util.Map; + +import javax.ws.rs.core.Response; + +import com.woorea.openstack.base.client.OpenStackResponse; +import com.woorea.openstack.base.client.OpenStackResponseException; + +public class JaxRs20Response implements OpenStackResponse { + + private Response response; + + public JaxRs20Response(Response response) { + this.response = response; + } + + @Override + public T getEntity(Class returnType) { + if(response.getStatus() >= 400) { + throw new OpenStackResponseException(response.getStatusInfo().getReasonPhrase(), + response.getStatusInfo().getStatusCode()); + } + return response.readEntity(returnType); + } + + @Override + public InputStream getInputStream() { + return (InputStream) response.getEntity(); + } + + @Override + public String header(String name) { + return response.getHeaderString(name); + } + + @Override + public Map headers() { + Map headers = new HashMap(); + for(String k : response.getHeaders().keySet()) { + headers.put(k, response.getHeaderString(k)); + } + return headers; + } + +} diff --git a/openstack-client-connectors/pom.xml b/openstack-client-connectors/pom.xml index b5f29f241..f230a4df9 100644 --- a/openstack-client-connectors/pom.xml +++ b/openstack-client-connectors/pom.xml @@ -1,48 +1,48 @@ - - 4.0.0 - - com.woorea - openstack-java-sdk - 3.2.2-SNAPSHOT - - openstack-client-connectors - OpenStack Client Connectors - OpenStack Client Connectors - pom - - - jersey - - true - - - jersey-connector - - - - jersey2 - - true - - - jersey2-connector - - - - resteasy - - true - - - resteasy-connector - - - - - - com.woorea - openstack-client - 3.2.2-SNAPSHOT - - + + 4.0.0 + + com.woorea + openstack-java-sdk + 3.2.2-SNAPSHOT + + openstack-client-connectors + OpenStack Client Connectors + OpenStack Client Connectors + pom + + + jersey + + true + + + jersey-connector + + + + jersey2 + + true + + + jersey2-connector + + + + resteasy + + true + + + resteasy-connector + + + + + + com.woorea + openstack-client + 3.2.2-SNAPSHOT + + \ No newline at end of file diff --git a/openstack-client-connectors/resteasy-connector/pom.xml b/openstack-client-connectors/resteasy-connector/pom.xml index 6cbea9dc8..366cad0df 100644 --- a/openstack-client-connectors/resteasy-connector/pom.xml +++ b/openstack-client-connectors/resteasy-connector/pom.xml @@ -1,28 +1,28 @@ - - 4.0.0 - - com.woorea - openstack-client-connectors - 3.2.2-SNAPSHOT - - resteasy-connector - OpenStack RESTEasy Connector - OpenStack RESTEasy Connector - - - org.jboss.resteasy - resteasy-jaxrs - 2.3.2.Final - - - org.codehaus.jackson - jackson-jaxrs - 1.9.4 - - - commons-httpclient - commons-httpclient - 3.1 - - + + 4.0.0 + + com.woorea + openstack-client-connectors + 3.2.2-SNAPSHOT + + resteasy-connector + OpenStack RESTEasy Connector + OpenStack RESTEasy Connector + + + org.jboss.resteasy + resteasy-jaxrs + 2.3.2.Final + + + org.codehaus.jackson + jackson-jaxrs + 1.9.4 + + + commons-httpclient + commons-httpclient + 3.1 + + \ No newline at end of file diff --git a/openstack-client-connectors/resteasy-connector/src/main/java/com/woorea/openstack/connector/RESTEasyInputStream.java b/openstack-client-connectors/resteasy-connector/src/main/java/com/woorea/openstack/connector/RESTEasyInputStream.java index 913a5000d..3e964c260 100644 --- a/openstack-client-connectors/resteasy-connector/src/main/java/com/woorea/openstack/connector/RESTEasyInputStream.java +++ b/openstack-client-connectors/resteasy-connector/src/main/java/com/woorea/openstack/connector/RESTEasyInputStream.java @@ -1,37 +1,37 @@ -package com.woorea.openstack.connector; - -import java.io.FilterInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.net.SocketException; - -import org.jboss.resteasy.client.ClientExecutor; - - -public class RESTEasyInputStream extends FilterInputStream { - - protected ClientExecutor clientExecutor; - - public RESTEasyInputStream(InputStream inputStream, ClientExecutor clientExecutor) { - super(inputStream); - this.clientExecutor = clientExecutor; - } - - @Override - public void close() throws IOException { - try { - clientExecutor.close(); - } catch (Exception e) { - // Silently skip errors in the socket close errors - } - - try { - super.close(); - } catch (SocketException e) { - // We expect this exception because the socket is closed - } catch (IllegalStateException e) { - // We expect this exception because the socket is closed (httpclient 4.2) - } - } - -} +package com.woorea.openstack.connector; + +import java.io.FilterInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.net.SocketException; + +import org.jboss.resteasy.client.ClientExecutor; + + +public class RESTEasyInputStream extends FilterInputStream { + + protected ClientExecutor clientExecutor; + + public RESTEasyInputStream(InputStream inputStream, ClientExecutor clientExecutor) { + super(inputStream); + this.clientExecutor = clientExecutor; + } + + @Override + public void close() throws IOException { + try { + clientExecutor.close(); + } catch (Exception e) { + // Silently skip errors in the socket close errors + } + + try { + super.close(); + } catch (SocketException e) { + // We expect this exception because the socket is closed + } catch (IllegalStateException e) { + // We expect this exception because the socket is closed (httpclient 4.2) + } + } + +} diff --git a/openstack-client/.gitignore b/openstack-client/.gitignore new file mode 100644 index 000000000..19f2e002c --- /dev/null +++ b/openstack-client/.gitignore @@ -0,0 +1,2 @@ +/target +/target diff --git a/openstack-client/pom.xml b/openstack-client/pom.xml index c3fcf3510..bedfd0ccc 100644 --- a/openstack-client/pom.xml +++ b/openstack-client/pom.xml @@ -1,11 +1,11 @@ - - 4.0.0 - - com.woorea - openstack-java-sdk - 3.2.2-SNAPSHOT - - openstack-client - OpenStack Client - OpenStack Client + + 4.0.0 + + com.woorea + openstack-java-sdk + 3.2.2-SNAPSHOT + + openstack-client + OpenStack Client + OpenStack Client \ No newline at end of file diff --git a/openstack-client/src/main/java/com/woorea/openstack/base/client/HttpMethod.java b/openstack-client/src/main/java/com/woorea/openstack/base/client/HttpMethod.java index 6c62ffb7b..c5fda129c 100644 --- a/openstack-client/src/main/java/com/woorea/openstack/base/client/HttpMethod.java +++ b/openstack-client/src/main/java/com/woorea/openstack/base/client/HttpMethod.java @@ -1,5 +1,5 @@ -package com.woorea.openstack.base.client; - -public enum HttpMethod { - HEAD, GET, POST, PUT, PATCH, DELETE, OPTIONS, TRACE -} +package com.woorea.openstack.base.client; + +public enum HttpMethod { + HEAD, GET, POST, PUT, PATCH, DELETE, OPTIONS, TRACE +} diff --git a/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackClient.java b/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackClient.java index 3c8b6cac3..8cd697ec1 100644 --- a/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackClient.java +++ b/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackClient.java @@ -1,86 +1,86 @@ -package com.woorea.openstack.base.client; - -import java.util.Properties; -import java.util.ServiceLoader; - -public class OpenStackClient { - - protected String endpoint; - - protected OpenStackTokenProvider tokenProvider; - - protected static int AUTHENTICATION_RETRIES = 1; - - protected OpenStackClientConnector connector; - - protected Properties properties = new Properties(); - - protected static OpenStackClientConnector DEFAULT_CONNECTOR; - - static { - ServiceLoader connectorLoader; - connectorLoader = ServiceLoader.load(OpenStackClientConnector.class); - - for (OpenStackClientConnector clientConnector : connectorLoader) { - DEFAULT_CONNECTOR = clientConnector; - break; - } - } - - public OpenStackClient(String endpoint) { - this.endpoint = endpoint; - this.connector = DEFAULT_CONNECTOR; - } - - public OpenStackClient(String endpoint, OpenStackClientConnector connector) { - this.endpoint = endpoint; - this.connector = (connector == null) ? DEFAULT_CONNECTOR : connector; - } - - public OpenStackResponse request(OpenStackRequest request) { - OpenStackResponseException authException = null; - - for (int i = 0; i <= AUTHENTICATION_RETRIES; i++) { - request.endpoint(endpoint); - - if (tokenProvider != null) { - request.header("X-Auth-Token", tokenProvider.getToken()); - } - - try { - return connector.request(request); - } catch (OpenStackResponseException e) { - if (e.getStatus() != OpenStackResponseStatus.NOT_AUTHORIZED - || tokenProvider == null) { - throw e; - } - authException = e; - tokenProvider.expireToken(); - } - } - - throw authException; - } - - public T execute(OpenStackRequest request) { - OpenStackResponse response = request(request); - return (request.returnType() != null && request.returnType() != Void.class) ? response.getEntity(request.returnType()) : null; - } - - public void property(String property, String value) { - properties.put(property, value); - } - - public void setTokenProvider(OpenStackTokenProvider tokenProvider) { - this.tokenProvider = tokenProvider; - } - - public void token(String token) { - setTokenProvider(new OpenStackSimpleTokenProvider(token)); - } - - public OpenStackRequest get(String path, Class returnType) { - return new OpenStackRequest(this, HttpMethod.GET, path, null, returnType); - } - -} +package com.woorea.openstack.base.client; + +import java.util.Properties; +import java.util.ServiceLoader; + +public class OpenStackClient { + + protected String endpoint; + + protected OpenStackTokenProvider tokenProvider; + + protected static int AUTHENTICATION_RETRIES = 1; + + protected OpenStackClientConnector connector; + + protected Properties properties = new Properties(); + + protected static OpenStackClientConnector DEFAULT_CONNECTOR; + + static { + ServiceLoader connectorLoader; + connectorLoader = ServiceLoader.load(OpenStackClientConnector.class); + + for (OpenStackClientConnector clientConnector : connectorLoader) { + DEFAULT_CONNECTOR = clientConnector; + break; + } + } + + public OpenStackClient(String endpoint) { + this.endpoint = endpoint; + this.connector = DEFAULT_CONNECTOR; + } + + public OpenStackClient(String endpoint, OpenStackClientConnector connector) { + this.endpoint = endpoint; + this.connector = (connector == null) ? DEFAULT_CONNECTOR : connector; + } + + public OpenStackResponse request(OpenStackRequest request) { + OpenStackResponseException authException = null; + + for (int i = 0; i <= AUTHENTICATION_RETRIES; i++) { + request.endpoint(endpoint); + + if (tokenProvider != null) { + request.header("X-Auth-Token", tokenProvider.getToken()); + } + + try { + return connector.request(request); + } catch (OpenStackResponseException e) { + if (e.getStatus() != OpenStackResponseStatus.NOT_AUTHORIZED + || tokenProvider == null) { + throw e; + } + authException = e; + tokenProvider.expireToken(); + } + } + + throw authException; + } + + public T execute(OpenStackRequest request) { + OpenStackResponse response = request(request); + return (request.returnType() != null && request.returnType() != Void.class) ? response.getEntity(request.returnType()) : null; + } + + public void property(String property, String value) { + properties.put(property, value); + } + + public void setTokenProvider(OpenStackTokenProvider tokenProvider) { + this.tokenProvider = tokenProvider; + } + + public void token(String token) { + setTokenProvider(new OpenStackSimpleTokenProvider(token)); + } + + public OpenStackRequest get(String path, Class returnType) { + return new OpenStackRequest(this, HttpMethod.GET, path, null, returnType); + } + +} diff --git a/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackClientConnector.java b/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackClientConnector.java index 417b84440..7411a8ebb 100644 --- a/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackClientConnector.java +++ b/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackClientConnector.java @@ -1,8 +1,8 @@ -package com.woorea.openstack.base.client; - - -public interface OpenStackClientConnector { - - public OpenStackResponse request(OpenStackRequest request); - -} +package com.woorea.openstack.base.client; + + +public interface OpenStackClientConnector { + + public OpenStackResponse request(OpenStackRequest request); + +} diff --git a/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackCommand.java b/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackCommand.java index 5ef291f5e..00cf0a607 100644 --- a/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackCommand.java +++ b/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackCommand.java @@ -1,8 +1,8 @@ -package com.woorea.openstack.base.client; -//package org.openstack.base.client; -// -//public interface OpenStackCommand { -// -// OpenStackRequest createRequest(OpenStackClient connector); -// -//} +package com.woorea.openstack.base.client; +//package org.openstack.base.client; +// +//public interface OpenStackCommand { +// +// OpenStackRequest createRequest(OpenStackClient connector); +// +//} diff --git a/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackResponse.java b/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackResponse.java index 024e21005..bc2a2b260 100644 --- a/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackResponse.java +++ b/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackResponse.java @@ -1,16 +1,16 @@ -package com.woorea.openstack.base.client; - -import java.io.InputStream; -import java.util.Map; - -public interface OpenStackResponse { - - public T getEntity(Class returnType); - - public InputStream getInputStream(); - - public String header(String name); - - public Map headers(); - -} +package com.woorea.openstack.base.client; + +import java.io.InputStream; +import java.util.Map; + +public interface OpenStackResponse { + + public T getEntity(Class returnType); + + public InputStream getInputStream(); + + public String header(String name); + + public Map headers(); + +} diff --git a/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackResponseException.java b/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackResponseException.java index 5c15b171f..c58e956fd 100644 --- a/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackResponseException.java +++ b/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackResponseException.java @@ -1,24 +1,24 @@ -package com.woorea.openstack.base.client; - -public class OpenStackResponseException extends RuntimeException { - - private static final long serialVersionUID = 7294957362769575271L; - - protected String message; - - protected int status; - - public OpenStackResponseException(String message, int status) { - this.message = message; - this.status = status; - } - - public String getMessage() { - return message; - } - - public int getStatus() { - return status; - } - -} +package com.woorea.openstack.base.client; + +public class OpenStackResponseException extends RuntimeException { + + private static final long serialVersionUID = 7294957362769575271L; + + protected String message; + + protected int status; + + public OpenStackResponseException(String message, int status) { + this.message = message; + this.status = status; + } + + public String getMessage() { + return message; + } + + public int getStatus() { + return status; + } + +} diff --git a/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackResponseStatus.java b/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackResponseStatus.java index 032a51154..3d8e2ed20 100644 --- a/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackResponseStatus.java +++ b/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackResponseStatus.java @@ -1,11 +1,11 @@ -package com.woorea.openstack.base.client; - -public class OpenStackResponseStatus { - - public static final int OK = 200; - - public static final int NOT_AUTHORIZED = 401; - - public static final int CONFLICT = 409; - -} +package com.woorea.openstack.base.client; + +public class OpenStackResponseStatus { + + public static final int OK = 200; + + public static final int NOT_AUTHORIZED = 401; + + public static final int CONFLICT = 409; + +} diff --git a/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackSimpleTokenProvider.java b/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackSimpleTokenProvider.java index 5ea8d7667..dcc0ceb72 100644 --- a/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackSimpleTokenProvider.java +++ b/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackSimpleTokenProvider.java @@ -1,20 +1,20 @@ -package com.woorea.openstack.base.client; - -public class OpenStackSimpleTokenProvider implements OpenStackTokenProvider { - - String token; - - public OpenStackSimpleTokenProvider(String token) { - this.token = token; - } - - @Override - public String getToken() { - return this.token; - } - - @Override - public void expireToken() { - } - -} +package com.woorea.openstack.base.client; + +public class OpenStackSimpleTokenProvider implements OpenStackTokenProvider { + + String token; + + public OpenStackSimpleTokenProvider(String token) { + this.token = token; + } + + @Override + public String getToken() { + return this.token; + } + + @Override + public void expireToken() { + } + +} diff --git a/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackTokenProvider.java b/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackTokenProvider.java index 0a8f1bfbd..5fc301209 100644 --- a/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackTokenProvider.java +++ b/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackTokenProvider.java @@ -1,9 +1,9 @@ -package com.woorea.openstack.base.client; - -public interface OpenStackTokenProvider { - - String getToken(); - - void expireToken(); - -} +package com.woorea.openstack.base.client; + +public interface OpenStackTokenProvider { + + String getToken(); + + void expireToken(); + +} diff --git a/openstack-client/src/main/java/com/woorea/openstack/common/client/AbstractOpenStackClient.java b/openstack-client/src/main/java/com/woorea/openstack/common/client/AbstractOpenStackClient.java index e48ec0b2b..8f15d9aed 100644 --- a/openstack-client/src/main/java/com/woorea/openstack/common/client/AbstractOpenStackClient.java +++ b/openstack-client/src/main/java/com/woorea/openstack/common/client/AbstractOpenStackClient.java @@ -1,125 +1,125 @@ -package com.woorea.openstack.common.client; -//package org.openstack.common.client; -// -//import java.io.IOException; -//import java.util.logging.Logger; -// -//import javax.ws.rs.client.ClientRequestContext; -//import javax.ws.rs.client.ClientRequestFilter; -//import javax.ws.rs.client.Entity; -//import javax.ws.rs.client.Invocation.Builder; -//import javax.ws.rs.client.WebTarget; -//import javax.ws.rs.core.MediaType; -// -//import org.glassfish.jersey.filter.LoggingFilter; -//import org.openstack.connector.OpenStack; -// -//public class AbstractOpenStackClient { -// -// protected String endpointURL; -// -// protected String token; -// -// protected LoggingFilter loggingFilter; -// -// protected ClientRequestFilter tokenFilter = new ClientRequestFilter() { -// -// @Override -// public void filter(ClientRequestContext requestContext) throws IOException { -// requestContext.getHeaders().putSingle("X-Auth-Token", token); -// } -// }; -// -// public AbstractOpenStackClient(String endpointURL, String token) { -// this.endpointURL = endpointURL; -// this.token = token; -// } -// -// public AbstractOpenStackClient(String endpointURL) { -// this(endpointURL, null); -// } -// -// /** -// * @param token the token to set -// */ -// public void setToken(String token) { -// this.token = token; -// } -// -// public OpenStackRequest request(String uri, String... mediaTypes) { -// WebTarget endpoint = OpenStack.CLIENT.target(endpointURL); -// if(token != null) { -// endpoint.register(tokenFilter); -// } -// return new OpenStackRequest(endpoint.path(uri).request(mediaTypes)); -// } -// -// public OpenStackRequest request(String uri) { -// return request(uri, MediaType.APPLICATION_JSON); -// } -// -// protected WebTarget create(String endpoint) { -// WebTarget target = OpenStack.CLIENT.target(endpoint); -// if(loggingFilter != null) { -// target.register(loggingFilter); -// } -// if(token != null) { -// target.register(tokenFilter); -// } -// return target; -// } -// -// public void enableLogging(Logger logger, int entitySize) { -// loggingFilter = new LoggingFilter(logger, entitySize); -// } -// -// public void disableLogging() { -// loggingFilter = null; -// } -// -// public static class OpenStackRequest { -// -// private Builder builder; -// -// private OpenStackRequest(Builder builder) { -// this.builder = builder; -// } -// -// public ResponseType execute(String method, Class type) { -// return builder.method(method, type); -// } -// -// public ResponseType execute(String method, Entity data, Class type) { -// return builder.method(method, data, type); -// } -// -// public void execute(String method) { -// builder.method(method); -// } -// -// public void execute(String method, Entity data) { -// builder.method(method, data, Void.class); -// } -// -// public ResponseType get(Class type) { -// return execute("GET", type); -// } -// -// public ResponseType postJson(Object data, Class type) { -// return execute("POST", Entity.json(data), type); -// } -// -// public ResponseType putJson(Object data, Class type) { -// return execute("PUT", Entity.json(data), type); -// } -// -// public ResponseType patchJson(Object data, Class type) { -// return execute("PATCH", Entity.json(data), type); -// } -// -// public void delete() { -// execute("DELETE", Void.class); -// } -// } -// -//} +package com.woorea.openstack.common.client; +//package org.openstack.common.client; +// +//import java.io.IOException; +//import java.util.logging.Logger; +// +//import javax.ws.rs.client.ClientRequestContext; +//import javax.ws.rs.client.ClientRequestFilter; +//import javax.ws.rs.client.Entity; +//import javax.ws.rs.client.Invocation.Builder; +//import javax.ws.rs.client.WebTarget; +//import javax.ws.rs.core.MediaType; +// +//import org.glassfish.jersey.filter.LoggingFilter; +//import org.openstack.connector.OpenStack; +// +//public class AbstractOpenStackClient { +// +// protected String endpointURL; +// +// protected String token; +// +// protected LoggingFilter loggingFilter; +// +// protected ClientRequestFilter tokenFilter = new ClientRequestFilter() { +// +// @Override +// public void filter(ClientRequestContext requestContext) throws IOException { +// requestContext.getHeaders().putSingle("X-Auth-Token", token); +// } +// }; +// +// public AbstractOpenStackClient(String endpointURL, String token) { +// this.endpointURL = endpointURL; +// this.token = token; +// } +// +// public AbstractOpenStackClient(String endpointURL) { +// this(endpointURL, null); +// } +// +// /** +// * @param token the token to set +// */ +// public void setToken(String token) { +// this.token = token; +// } +// +// public OpenStackRequest request(String uri, String... mediaTypes) { +// WebTarget endpoint = OpenStack.CLIENT.target(endpointURL); +// if(token != null) { +// endpoint.register(tokenFilter); +// } +// return new OpenStackRequest(endpoint.path(uri).request(mediaTypes)); +// } +// +// public OpenStackRequest request(String uri) { +// return request(uri, MediaType.APPLICATION_JSON); +// } +// +// protected WebTarget create(String endpoint) { +// WebTarget target = OpenStack.CLIENT.target(endpoint); +// if(loggingFilter != null) { +// target.register(loggingFilter); +// } +// if(token != null) { +// target.register(tokenFilter); +// } +// return target; +// } +// +// public void enableLogging(Logger logger, int entitySize) { +// loggingFilter = new LoggingFilter(logger, entitySize); +// } +// +// public void disableLogging() { +// loggingFilter = null; +// } +// +// public static class OpenStackRequest { +// +// private Builder builder; +// +// private OpenStackRequest(Builder builder) { +// this.builder = builder; +// } +// +// public ResponseType execute(String method, Class type) { +// return builder.method(method, type); +// } +// +// public ResponseType execute(String method, Entity data, Class type) { +// return builder.method(method, data, type); +// } +// +// public void execute(String method) { +// builder.method(method); +// } +// +// public void execute(String method, Entity data) { +// builder.method(method, data, Void.class); +// } +// +// public ResponseType get(Class type) { +// return execute("GET", type); +// } +// +// public ResponseType postJson(Object data, Class type) { +// return execute("POST", Entity.json(data), type); +// } +// +// public ResponseType putJson(Object data, Class type) { +// return execute("PUT", Entity.json(data), type); +// } +// +// public ResponseType patchJson(Object data, Class type) { +// return execute("PATCH", Entity.json(data), type); +// } +// +// public void delete() { +// execute("DELETE", Void.class); +// } +// } +// +//} diff --git a/openstack-client/src/main/java/com/woorea/openstack/common/session/OpenStackSession.java b/openstack-client/src/main/java/com/woorea/openstack/common/session/OpenStackSession.java index a56a3afcb..c791dba64 100644 --- a/openstack-client/src/main/java/com/woorea/openstack/common/session/OpenStackSession.java +++ b/openstack-client/src/main/java/com/woorea/openstack/common/session/OpenStackSession.java @@ -1,107 +1,107 @@ -package com.woorea.openstack.common.session; -//package org.openstack.common.session; -// -//import java.io.Serializable; -// -//import org.openstack.keystone.model.Access; -//import org.openstack.keystone.model.Authentication; -// -//public class OpenStackSession implements Serializable { -// -// private String authenticationURL; -// -// private Authentication authentication; -// -// private String identityAdministrationURL; -// -// private String identityAdministrationToken; -// -// private Access access; -// -// private boolean admin; -// -// /** -// * @return the authenticationURL -// */ -// public String getAuthenticationURL() { -// return authenticationURL; -// } -// -// /** -// * @param authenticationURL the authenticationURL to set -// */ -// public void setAuthenticationURL(String authenticationURL) { -// this.authenticationURL = authenticationURL; -// } -// -// /** -// * @return the authentication -// */ -// public Authentication getAuthentication() { -// return authentication; -// } -// -// /** -// * @param authentication the authentication to set -// */ -// public void setAuthentication(Authentication authentication) { -// this.authentication = authentication; -// } -// -// /** -// * @return the identityAdministrationURL -// */ -// public String getIdentityAdministrationURL() { -// return identityAdministrationURL; -// } -// -// /** -// * @param identityAdministrationURL the identityAdministrationURL to set -// */ -// public void setIdentityAdministrationURL(String identityAdministrationURL) { -// this.identityAdministrationURL = identityAdministrationURL; -// } -// -// /** -// * @return the identityAdministrationToken -// */ -// public String getIdentityAdministrationToken() { -// return identityAdministrationToken; -// } -// -// /** -// * @param identityAdministrationToken the identityAdministrationToken to set -// */ -// public void setIdentityAdministrationToken(String identityAdministrationToken) { -// this.identityAdministrationToken = identityAdministrationToken; -// } -// -// /** -// * @return the access -// */ -// public Access getAccess() { -// return access; -// } -// -// /** -// * @param access the access to set -// */ -// public void setAccess(Access access) { -// this.access = access; -// } -// -// /** -// * @return the admin -// */ -// public boolean isAdmin() { -// return admin; -// } -// -// /** -// * @param admin the admin to set -// */ -// public void setAdmin(boolean admin) { -// this.admin = admin; -// } -// -//} +package com.woorea.openstack.common.session; +//package org.openstack.common.session; +// +//import java.io.Serializable; +// +//import org.openstack.keystone.model.Access; +//import org.openstack.keystone.model.Authentication; +// +//public class OpenStackSession implements Serializable { +// +// private String authenticationURL; +// +// private Authentication authentication; +// +// private String identityAdministrationURL; +// +// private String identityAdministrationToken; +// +// private Access access; +// +// private boolean admin; +// +// /** +// * @return the authenticationURL +// */ +// public String getAuthenticationURL() { +// return authenticationURL; +// } +// +// /** +// * @param authenticationURL the authenticationURL to set +// */ +// public void setAuthenticationURL(String authenticationURL) { +// this.authenticationURL = authenticationURL; +// } +// +// /** +// * @return the authentication +// */ +// public Authentication getAuthentication() { +// return authentication; +// } +// +// /** +// * @param authentication the authentication to set +// */ +// public void setAuthentication(Authentication authentication) { +// this.authentication = authentication; +// } +// +// /** +// * @return the identityAdministrationURL +// */ +// public String getIdentityAdministrationURL() { +// return identityAdministrationURL; +// } +// +// /** +// * @param identityAdministrationURL the identityAdministrationURL to set +// */ +// public void setIdentityAdministrationURL(String identityAdministrationURL) { +// this.identityAdministrationURL = identityAdministrationURL; +// } +// +// /** +// * @return the identityAdministrationToken +// */ +// public String getIdentityAdministrationToken() { +// return identityAdministrationToken; +// } +// +// /** +// * @param identityAdministrationToken the identityAdministrationToken to set +// */ +// public void setIdentityAdministrationToken(String identityAdministrationToken) { +// this.identityAdministrationToken = identityAdministrationToken; +// } +// +// /** +// * @return the access +// */ +// public Access getAccess() { +// return access; +// } +// +// /** +// * @param access the access to set +// */ +// public void setAccess(Access access) { +// this.access = access; +// } +// +// /** +// * @return the admin +// */ +// public boolean isAdmin() { +// return admin; +// } +// +// /** +// * @param admin the admin to set +// */ +// public void setAdmin(boolean admin) { +// this.admin = admin; +// } +// +//} diff --git a/openstack-client/src/main/java/com/woorea/openstack/common/session/OpenStackSessionHolder.java b/openstack-client/src/main/java/com/woorea/openstack/common/session/OpenStackSessionHolder.java index ea81f7c41..f3945780c 100644 --- a/openstack-client/src/main/java/com/woorea/openstack/common/session/OpenStackSessionHolder.java +++ b/openstack-client/src/main/java/com/woorea/openstack/common/session/OpenStackSessionHolder.java @@ -1,16 +1,16 @@ -package com.woorea.openstack.common.session; -//package org.openstack.common.session; -// -//public class OpenStackSessionHolder { -// -// private static final ThreadLocal HOLDER = new ThreadLocal(); -// -// public static OpenStackSession getSession() { -// return HOLDER.get(); -// } -// -// public static void setSession(OpenStackSession session) { -// HOLDER.set(session); -// } -// -//} +package com.woorea.openstack.common.session; +//package org.openstack.common.session; +// +//public class OpenStackSessionHolder { +// +// private static final ThreadLocal HOLDER = new ThreadLocal(); +// +// public static OpenStackSession getSession() { +// return HOLDER.get(); +// } +// +// public static void setSession(OpenStackSession session) { +// HOLDER.set(session); +// } +// +//} diff --git a/openstack-console/pom.xml b/openstack-console/pom.xml index 2f462ec81..4b40d9e90 100644 --- a/openstack-console/pom.xml +++ b/openstack-console/pom.xml @@ -1,77 +1,77 @@ - - 4.0.0 - - com.woorea - openstack-java-sdk - 3.2.2-SNAPSHOT - - openstack-console - OpenStack Console - OpenStack Console - - - commons-cli - commons-cli - 1.2 - - - jline - jline - 2.10 - - - com.woorea - keystone-client - 3.2.2-SNAPSHOT - - - com.woorea - nova-client - 3.2.2-SNAPSHOT - - - - - jersey - - - com.woorea - jersey-connector - 3.0.0-SNAPSHOT - - - - - jersey2 - - - com.woorea - jersey2-connector - 3.0.0-SNAPSHOT - - - - - resteasy - - - com.woorea - resteasy-connector - 3.0.0-SNAPSHOT - - - - - - - - org.codehaus.mojo - exec-maven-plugin - 1.2.1 - - com.woorea.openstack.console.Main - - - - + + 4.0.0 + + com.woorea + openstack-java-sdk + 3.2.2-SNAPSHOT + + openstack-console + OpenStack Console + OpenStack Console + + + commons-cli + commons-cli + 1.2 + + + jline + jline + 2.10 + + + com.woorea + keystone-client + 3.2.2-SNAPSHOT + + + com.woorea + nova-client + 3.2.2-SNAPSHOT + + + + + jersey + + + com.woorea + jersey-connector + 3.0.0-SNAPSHOT + + + + + jersey2 + + + com.woorea + jersey2-connector + 3.0.0-SNAPSHOT + + + + + resteasy + + + com.woorea + resteasy-connector + 3.0.0-SNAPSHOT + + + + + + + + org.codehaus.mojo + exec-maven-plugin + 1.2.1 + + com.woorea.openstack.console.Main + + + + \ No newline at end of file diff --git a/openstack-console/src/main/java/com/woorea/openstack/console/Command.java b/openstack-console/src/main/java/com/woorea/openstack/console/Command.java index 4c96e2509..3d96d9f16 100644 --- a/openstack-console/src/main/java/com/woorea/openstack/console/Command.java +++ b/openstack-console/src/main/java/com/woorea/openstack/console/Command.java @@ -1,21 +1,21 @@ -package com.woorea.openstack.console; - -import org.apache.commons.cli.CommandLine; -import org.apache.commons.cli.Options; - - -public abstract class Command { - - protected String name; - - public Command(String name) { - this.name = name; - } - - public abstract void execute(Console console, CommandLine args); - - public Options getOptions() { - return new Options(); - } - -} +package com.woorea.openstack.console; + +import org.apache.commons.cli.CommandLine; +import org.apache.commons.cli.Options; + + +public abstract class Command { + + protected String name; + + public Command(String name) { + this.name = name; + } + + public abstract void execute(Console console, CommandLine args); + + public Options getOptions() { + return new Options(); + } + +} diff --git a/openstack-console/src/main/java/com/woorea/openstack/console/CommandLineHelper.java b/openstack-console/src/main/java/com/woorea/openstack/console/CommandLineHelper.java index 6e148ce5d..5012d0308 100644 --- a/openstack-console/src/main/java/com/woorea/openstack/console/CommandLineHelper.java +++ b/openstack-console/src/main/java/com/woorea/openstack/console/CommandLineHelper.java @@ -1,71 +1,71 @@ -package com.woorea.openstack.console; - -import java.util.StringTokenizer; -import java.util.Vector; - -public class CommandLineHelper { - - public static String[] parse(String input) { - if (input == null || input.length() == 0) { - //no command? no string - return new String[0]; - } - // parse with a simple finite state machine - - final int normal = 0; - final int inQuote = 1; - final int inDoubleQuote = 2; - int state = normal; - StringTokenizer tok = new StringTokenizer(input, "\"\' ", true); - Vector v = new Vector(); - StringBuffer current = new StringBuffer(); - boolean lastTokenHasBeenQuoted = false; - - while (tok.hasMoreTokens()) { - String nextTok = tok.nextToken(); - switch (state) { - case inQuote: - if ("\'".equals(nextTok)) { - lastTokenHasBeenQuoted = true; - state = normal; - } else { - current.append(nextTok); - } - break; - case inDoubleQuote: - if ("\"".equals(nextTok)) { - lastTokenHasBeenQuoted = true; - state = normal; - } else { - current.append(nextTok); - } - break; - default: - if ("\'".equals(nextTok)) { - state = inQuote; - } else if ("\"".equals(nextTok)) { - state = inDoubleQuote; - } else if (" ".equals(nextTok)) { - if (lastTokenHasBeenQuoted || current.length() != 0) { - v.addElement(current.toString()); - current = new StringBuffer(); - } - } else { - current.append(nextTok); - } - lastTokenHasBeenQuoted = false; - break; - } - } - if (lastTokenHasBeenQuoted || current.length() != 0) { - v.addElement(current.toString()); - } - if (state == inQuote || state == inDoubleQuote) { - throw new RuntimeException("unbalanced quotes in " + input); - } - String[] args = new String[v.size()]; - v.copyInto(args); - return args; - } - -} +package com.woorea.openstack.console; + +import java.util.StringTokenizer; +import java.util.Vector; + +public class CommandLineHelper { + + public static String[] parse(String input) { + if (input == null || input.length() == 0) { + //no command? no string + return new String[0]; + } + // parse with a simple finite state machine + + final int normal = 0; + final int inQuote = 1; + final int inDoubleQuote = 2; + int state = normal; + StringTokenizer tok = new StringTokenizer(input, "\"\' ", true); + Vector v = new Vector(); + StringBuffer current = new StringBuffer(); + boolean lastTokenHasBeenQuoted = false; + + while (tok.hasMoreTokens()) { + String nextTok = tok.nextToken(); + switch (state) { + case inQuote: + if ("\'".equals(nextTok)) { + lastTokenHasBeenQuoted = true; + state = normal; + } else { + current.append(nextTok); + } + break; + case inDoubleQuote: + if ("\"".equals(nextTok)) { + lastTokenHasBeenQuoted = true; + state = normal; + } else { + current.append(nextTok); + } + break; + default: + if ("\'".equals(nextTok)) { + state = inQuote; + } else if ("\"".equals(nextTok)) { + state = inDoubleQuote; + } else if (" ".equals(nextTok)) { + if (lastTokenHasBeenQuoted || current.length() != 0) { + v.addElement(current.toString()); + current = new StringBuffer(); + } + } else { + current.append(nextTok); + } + lastTokenHasBeenQuoted = false; + break; + } + } + if (lastTokenHasBeenQuoted || current.length() != 0) { + v.addElement(current.toString()); + } + if (state == inQuote || state == inDoubleQuote) { + throw new RuntimeException("unbalanced quotes in " + input); + } + String[] args = new String[v.size()]; + v.copyInto(args); + return args; + } + +} diff --git a/openstack-console/src/main/java/com/woorea/openstack/console/Console.java b/openstack-console/src/main/java/com/woorea/openstack/console/Console.java index 13b7fbfde..1d4991150 100644 --- a/openstack-console/src/main/java/com/woorea/openstack/console/Console.java +++ b/openstack-console/src/main/java/com/woorea/openstack/console/Console.java @@ -1,111 +1,111 @@ -package com.woorea.openstack.console; - -import java.io.IOException; -import java.util.Arrays; -import java.util.HashSet; -import java.util.Map; -import java.util.Properties; -import java.util.Set; - -import jline.UnsupportedTerminal; -import jline.console.ConsoleReader; -import jline.console.completer.Completer; -import jline.console.completer.StringsCompleter; - -import org.apache.commons.cli.CommandLine; -import org.apache.commons.cli.CommandLineParser; -import org.apache.commons.cli.GnuParser; -import org.apache.commons.cli.HelpFormatter; - -public class Console { - - private Properties properties; - - private ConsoleReader reader; - - private Environment environment; - - private HelpFormatter helpFormatter = new HelpFormatter(); - - private static final CommandLineParser PARSER = new GnuParser(); - - public Console(Environment environment, Properties properties) { - this.properties = properties; - this.environment = environment; - } - - public void start() throws IOException { - if(System.console() == null) { - reader = new ConsoleReader(System.in, System.out, new UnsupportedTerminal()); - } else { - reader = new ConsoleReader(); - } - do { - String line = reader.readLine(environment.getPrompt()); - execute(line); - } while(true); - } - - public void execute(String line) { - String[] tokens = CommandLineHelper.parse(line); - if(tokens.length > 0) { - Command command = environment.commands.get(tokens[0]); - if(command != null) { - try { - CommandLine args = Console.PARSER.parse(command.getOptions(), Arrays.copyOfRange(tokens, 1, tokens.length)); - command.execute(this, args); - } catch (Exception e) { - e.printStackTrace(); - helpFormatter.printHelp(command.name, command.getOptions()); - } - } - } - } - - public void setEnvironment(Environment environment) { - Set completers = new HashSet(reader.getCompleters()); - for(Completer c : completers) { - reader.removeCompleter(c); - } - Set commands = new HashSet(); - for(Map.Entry c : environment.commands.entrySet()) { - commands.add(c.getKey()); - } - reader.addCompleter(new StringsCompleter(commands)); - this.environment = environment; - } - - public Environment getEnvironment() { - return this.environment; - } - - /** - * @return the properties - */ - public String getProperty(String name) { - return properties.getProperty(name); - } - - /** - * @return the properties - */ - public void setProperty(String name, Object value) { - properties.put(name, value); - } - - public void properties() { - for(Map.Entry entry : properties.entrySet()) { - System.out.printf("%25s = %55s",entry.getKey(), entry.getValue()); - } - } - - public void exit() { - if(environment.parent == null) { - System.out.println("Goodbye"); - System.exit(1); - } else { - environment = environment.parent; - } - } - -} +package com.woorea.openstack.console; + +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Map; +import java.util.Properties; +import java.util.Set; + +import jline.UnsupportedTerminal; +import jline.console.ConsoleReader; +import jline.console.completer.Completer; +import jline.console.completer.StringsCompleter; + +import org.apache.commons.cli.CommandLine; +import org.apache.commons.cli.CommandLineParser; +import org.apache.commons.cli.GnuParser; +import org.apache.commons.cli.HelpFormatter; + +public class Console { + + private Properties properties; + + private ConsoleReader reader; + + private Environment environment; + + private HelpFormatter helpFormatter = new HelpFormatter(); + + private static final CommandLineParser PARSER = new GnuParser(); + + public Console(Environment environment, Properties properties) { + this.properties = properties; + this.environment = environment; + } + + public void start() throws IOException { + if(System.console() == null) { + reader = new ConsoleReader(System.in, System.out, new UnsupportedTerminal()); + } else { + reader = new ConsoleReader(); + } + do { + String line = reader.readLine(environment.getPrompt()); + execute(line); + } while(true); + } + + public void execute(String line) { + String[] tokens = CommandLineHelper.parse(line); + if(tokens.length > 0) { + Command command = environment.commands.get(tokens[0]); + if(command != null) { + try { + CommandLine args = Console.PARSER.parse(command.getOptions(), Arrays.copyOfRange(tokens, 1, tokens.length)); + command.execute(this, args); + } catch (Exception e) { + e.printStackTrace(); + helpFormatter.printHelp(command.name, command.getOptions()); + } + } + } + } + + public void setEnvironment(Environment environment) { + Set completers = new HashSet(reader.getCompleters()); + for(Completer c : completers) { + reader.removeCompleter(c); + } + Set commands = new HashSet(); + for(Map.Entry c : environment.commands.entrySet()) { + commands.add(c.getKey()); + } + reader.addCompleter(new StringsCompleter(commands)); + this.environment = environment; + } + + public Environment getEnvironment() { + return this.environment; + } + + /** + * @return the properties + */ + public String getProperty(String name) { + return properties.getProperty(name); + } + + /** + * @return the properties + */ + public void setProperty(String name, Object value) { + properties.put(name, value); + } + + public void properties() { + for(Map.Entry entry : properties.entrySet()) { + System.out.printf("%25s = %55s",entry.getKey(), entry.getValue()); + } + } + + public void exit() { + if(environment.parent == null) { + System.out.println("Goodbye"); + System.exit(1); + } else { + environment = environment.parent; + } + } + +} diff --git a/openstack-console/src/main/java/com/woorea/openstack/console/Environment.java b/openstack-console/src/main/java/com/woorea/openstack/console/Environment.java index ca0eee467..1e23c9509 100644 --- a/openstack-console/src/main/java/com/woorea/openstack/console/Environment.java +++ b/openstack-console/src/main/java/com/woorea/openstack/console/Environment.java @@ -1,30 +1,30 @@ -package com.woorea.openstack.console; -import java.util.Map; -import java.util.TreeMap; - - -public class Environment { - - protected final Environment parent; - - protected Map commands = new TreeMap(); - - public Environment(Environment parent) { - register(Commands.EXIT); - register(Commands.SET); - this.parent = parent; - } - - public Environment() { - this(null); - } - - public void register(Command command) { - commands.put(command.name, command); - } - - public String getPrompt() { - return "> "; - } - -} +package com.woorea.openstack.console; +import java.util.Map; +import java.util.TreeMap; + + +public class Environment { + + protected final Environment parent; + + protected Map commands = new TreeMap(); + + public Environment(Environment parent) { + register(Commands.EXIT); + register(Commands.SET); + this.parent = parent; + } + + public Environment() { + this(null); + } + + public void register(Command command) { + commands.put(command.name, command); + } + + public String getPrompt() { + return "> "; + } + +} diff --git a/openstack-console/src/main/java/com/woorea/openstack/console/Main.java b/openstack-console/src/main/java/com/woorea/openstack/console/Main.java index d469e5446..a9f66207a 100644 --- a/openstack-console/src/main/java/com/woorea/openstack/console/Main.java +++ b/openstack-console/src/main/java/com/woorea/openstack/console/Main.java @@ -1,27 +1,27 @@ -package com.woorea.openstack.console; - -import java.io.FileInputStream; -import java.io.IOException; -import java.util.Properties; - -import com.woorea.openstack.console.keystone.KeystoneEnvironment; -import com.woorea.openstack.console.nova.NovaEnvironment; - -public class Main { - - /** - * @param args - */ - public static void main(String[] args) throws IOException { - Environment environment = new Environment(); - environment.register(KeystoneEnvironment.KEYSTONE); - environment.register(NovaEnvironment.NOVA); - - Properties properties = new Properties(); - properties.load(new FileInputStream("src/main/resources/console.properties")); - - Console console = new Console(environment, properties); - console.start(); - } - -} +package com.woorea.openstack.console; + +import java.io.FileInputStream; +import java.io.IOException; +import java.util.Properties; + +import com.woorea.openstack.console.keystone.KeystoneEnvironment; +import com.woorea.openstack.console.nova.NovaEnvironment; + +public class Main { + + /** + * @param args + */ + public static void main(String[] args) throws IOException { + Environment environment = new Environment(); + environment.register(KeystoneEnvironment.KEYSTONE); + environment.register(NovaEnvironment.NOVA); + + Properties properties = new Properties(); + properties.load(new FileInputStream("src/main/resources/console.properties")); + + Console console = new Console(environment, properties); + console.start(); + } + +} diff --git a/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneCommand.java b/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneCommand.java index f15ad247d..a996eb716 100644 --- a/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneCommand.java +++ b/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneCommand.java @@ -1,24 +1,24 @@ -package com.woorea.openstack.console.keystone; - -import org.apache.commons.cli.CommandLine; - -import com.woorea.openstack.console.Command; -import com.woorea.openstack.console.Console; -import com.woorea.openstack.keystone.Keystone; - -public abstract class KeystoneCommand extends Command { - - public KeystoneCommand(String name) { - super(name); - } - - @Override - public void execute(Console console, CommandLine args) { - KeystoneEnvironment environment = (KeystoneEnvironment) console.getEnvironment(); - execute(environment.CLIENT, args); - - } - - protected abstract void execute(Keystone keystone, CommandLine args); - -} +package com.woorea.openstack.console.keystone; + +import org.apache.commons.cli.CommandLine; + +import com.woorea.openstack.console.Command; +import com.woorea.openstack.console.Console; +import com.woorea.openstack.keystone.Keystone; + +public abstract class KeystoneCommand extends Command { + + public KeystoneCommand(String name) { + super(name); + } + + @Override + public void execute(Console console, CommandLine args) { + KeystoneEnvironment environment = (KeystoneEnvironment) console.getEnvironment(); + execute(environment.CLIENT, args); + + } + + protected abstract void execute(Keystone keystone, CommandLine args); + +} diff --git a/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneEnvironment.java b/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneEnvironment.java index 0d0a6a21b..d0ae13126 100644 --- a/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneEnvironment.java +++ b/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneEnvironment.java @@ -1,63 +1,63 @@ -package com.woorea.openstack.console.keystone; - -import org.apache.commons.cli.CommandLine; - -import com.woorea.openstack.base.client.OpenStackSimpleTokenProvider; -import com.woorea.openstack.console.Command; -import com.woorea.openstack.console.Console; -import com.woorea.openstack.console.Environment; -import com.woorea.openstack.keystone.Keystone; -import com.woorea.openstack.keystone.model.Access; -import com.woorea.openstack.keystone.model.authentication.UsernamePassword; - -public class KeystoneEnvironment extends Environment { - - public final Keystone CLIENT; - - public static final Command KEYSTONE = new Command("keystone") { - - @Override - public void execute(Console console, CommandLine args) { - - Keystone client = new Keystone(console.getProperty("keystone.endpoint")); - - Access access = client.tokens() - .authenticate(new UsernamePassword( - console.getProperty("keystone.username"), - console.getProperty("keystone.password") - )) - .withTenantName(console.getProperty("keystone.tenant_name")) - .execute(); - - client.setTokenProvider(new OpenStackSimpleTokenProvider(access.getToken().getId())); - - KeystoneEnvironment environment = new KeystoneEnvironment(console.getEnvironment(), client); - - environment.register(new KeystoneTenantList()); - environment.register(new KeystoneTenantCreate()); - environment.register(new KeystoneTenantDelete()); - environment.register(new KeystoneUserList()); - environment.register(new KeystoneUserCreate()); - environment.register(new KeystoneUserDelete()); - environment.register(new KeystoneRoleList()); - environment.register(new KeystoneRoleDelete()); - environment.register(new KeystoneServiceList()); - console.setEnvironment(environment); - } - - }; - - public KeystoneEnvironment(Environment parent, Keystone client) { - super(parent); - CLIENT = client; - } - - /* (non-Javadoc) - * @see org.woorea.wsh.Environment#getPrompt() - */ - @Override - public String getPrompt() { - return "keystone> "; - } - -} +package com.woorea.openstack.console.keystone; + +import org.apache.commons.cli.CommandLine; + +import com.woorea.openstack.base.client.OpenStackSimpleTokenProvider; +import com.woorea.openstack.console.Command; +import com.woorea.openstack.console.Console; +import com.woorea.openstack.console.Environment; +import com.woorea.openstack.keystone.Keystone; +import com.woorea.openstack.keystone.model.Access; +import com.woorea.openstack.keystone.model.authentication.UsernamePassword; + +public class KeystoneEnvironment extends Environment { + + public final Keystone CLIENT; + + public static final Command KEYSTONE = new Command("keystone") { + + @Override + public void execute(Console console, CommandLine args) { + + Keystone client = new Keystone(console.getProperty("keystone.endpoint")); + + Access access = client.tokens() + .authenticate(new UsernamePassword( + console.getProperty("keystone.username"), + console.getProperty("keystone.password") + )) + .withTenantName(console.getProperty("keystone.tenant_name")) + .execute(); + + client.setTokenProvider(new OpenStackSimpleTokenProvider(access.getToken().getId())); + + KeystoneEnvironment environment = new KeystoneEnvironment(console.getEnvironment(), client); + + environment.register(new KeystoneTenantList()); + environment.register(new KeystoneTenantCreate()); + environment.register(new KeystoneTenantDelete()); + environment.register(new KeystoneUserList()); + environment.register(new KeystoneUserCreate()); + environment.register(new KeystoneUserDelete()); + environment.register(new KeystoneRoleList()); + environment.register(new KeystoneRoleDelete()); + environment.register(new KeystoneServiceList()); + console.setEnvironment(environment); + } + + }; + + public KeystoneEnvironment(Environment parent, Keystone client) { + super(parent); + CLIENT = client; + } + + /* (non-Javadoc) + * @see org.woorea.wsh.Environment#getPrompt() + */ + @Override + public String getPrompt() { + return "keystone> "; + } + +} diff --git a/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneRoleCreate.java b/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneRoleCreate.java index 2acdd7649..0ead74f79 100644 --- a/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneRoleCreate.java +++ b/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneRoleCreate.java @@ -1,69 +1,69 @@ -package com.woorea.openstack.console.keystone; - -import java.util.Arrays; - -import org.apache.commons.cli.CommandLine; -import org.apache.commons.cli.Options; - -import com.woorea.openstack.console.utils.Column; -import com.woorea.openstack.console.utils.Table; -import com.woorea.openstack.console.utils.TableModel; -import com.woorea.openstack.keystone.Keystone; -import com.woorea.openstack.keystone.model.Role; - -public class KeystoneRoleCreate extends KeystoneCommand { - - public KeystoneRoleCreate() { - super( "role-create"); - } - - @Override - public void execute(Keystone keystone, CommandLine cmd) { - - Role role = new Role(); - role.setName(cmd.getOptionValue("name")); - role.setDescription(cmd.getOptionValue("description")); - if(cmd.getOptionValue("enabled") != null) { - role.setEnabled("True"); - } - - role = keystone.roles().create(role).execute(); - - Table t = new Table(new TableModel(Arrays.asList(role)) { - - @Override - public Column[] getHeaders() { - return new Column[]{ - new Column("id", 32, Column.ALIGN_LEFT), - new Column("name", 10, Column.ALIGN_LEFT), - new Column("description", 32, Column.ALIGN_LEFT), - new Column("enabled", 7, Column.ALIGN_LEFT) - }; - } - - @Override - public String[] getRow(Role tenant) { - return new String[]{ - tenant.getId(), - tenant.getName(), - tenant.getDescription(), - tenant.getEnabled().toString() - }; - } - }); - System.out.println(t.render()); - } - - /* (non-Javadoc) - * @see com.billingstack.commands.Command#getOptions() - */ - @Override - public Options getOptions() { - Options opts = super.getOptions(); - opts.addOption(null, "name", true, "tenant name"); - opts.addOption(null, "description", true, "tenant description"); - opts.addOption(null, "enabled", false, "enabled"); - return opts; - } - -} +package com.woorea.openstack.console.keystone; + +import java.util.Arrays; + +import org.apache.commons.cli.CommandLine; +import org.apache.commons.cli.Options; + +import com.woorea.openstack.console.utils.Column; +import com.woorea.openstack.console.utils.Table; +import com.woorea.openstack.console.utils.TableModel; +import com.woorea.openstack.keystone.Keystone; +import com.woorea.openstack.keystone.model.Role; + +public class KeystoneRoleCreate extends KeystoneCommand { + + public KeystoneRoleCreate() { + super( "role-create"); + } + + @Override + public void execute(Keystone keystone, CommandLine cmd) { + + Role role = new Role(); + role.setName(cmd.getOptionValue("name")); + role.setDescription(cmd.getOptionValue("description")); + if(cmd.getOptionValue("enabled") != null) { + role.setEnabled("True"); + } + + role = keystone.roles().create(role).execute(); + + Table t = new Table(new TableModel(Arrays.asList(role)) { + + @Override + public Column[] getHeaders() { + return new Column[]{ + new Column("id", 32, Column.ALIGN_LEFT), + new Column("name", 10, Column.ALIGN_LEFT), + new Column("description", 32, Column.ALIGN_LEFT), + new Column("enabled", 7, Column.ALIGN_LEFT) + }; + } + + @Override + public String[] getRow(Role tenant) { + return new String[]{ + tenant.getId(), + tenant.getName(), + tenant.getDescription(), + tenant.getEnabled().toString() + }; + } + }); + System.out.println(t.render()); + } + + /* (non-Javadoc) + * @see com.billingstack.commands.Command#getOptions() + */ + @Override + public Options getOptions() { + Options opts = super.getOptions(); + opts.addOption(null, "name", true, "tenant name"); + opts.addOption(null, "description", true, "tenant description"); + opts.addOption(null, "enabled", false, "enabled"); + return opts; + } + +} diff --git a/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneRoleDelete.java b/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneRoleDelete.java index d3977b73f..a76cfd028 100644 --- a/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneRoleDelete.java +++ b/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneRoleDelete.java @@ -1,25 +1,25 @@ -package com.woorea.openstack.console.keystone; - -import org.apache.commons.cli.CommandLine; - -import com.woorea.openstack.console.utils.ConsoleUtils; -import com.woorea.openstack.keystone.Keystone; - -public class KeystoneRoleDelete extends KeystoneCommand { - - public KeystoneRoleDelete() { - super("role-delete"); - } - - @Override - public void execute(Keystone keystone, CommandLine cmd) { - - String[] args = cmd.getArgs(); - if(args.length == 1) { - keystone.roles().delete(args[0]).execute(); - System.out.println(new ConsoleUtils().green("OK")); - } - - } - -} +package com.woorea.openstack.console.keystone; + +import org.apache.commons.cli.CommandLine; + +import com.woorea.openstack.console.utils.ConsoleUtils; +import com.woorea.openstack.keystone.Keystone; + +public class KeystoneRoleDelete extends KeystoneCommand { + + public KeystoneRoleDelete() { + super("role-delete"); + } + + @Override + public void execute(Keystone keystone, CommandLine cmd) { + + String[] args = cmd.getArgs(); + if(args.length == 1) { + keystone.roles().delete(args[0]).execute(); + System.out.println(new ConsoleUtils().green("OK")); + } + + } + +} diff --git a/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneRoleList.java b/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneRoleList.java index 13b7175bf..da44a1f23 100644 --- a/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneRoleList.java +++ b/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneRoleList.java @@ -1,48 +1,48 @@ -package com.woorea.openstack.console.keystone; - -import org.apache.commons.cli.CommandLine; - -import com.woorea.openstack.console.utils.Column; -import com.woorea.openstack.console.utils.Table; -import com.woorea.openstack.console.utils.TableModel; -import com.woorea.openstack.keystone.Keystone; -import com.woorea.openstack.keystone.model.Role; -import com.woorea.openstack.keystone.model.Roles; - -public class KeystoneRoleList extends KeystoneCommand { - - public KeystoneRoleList() { - super("role-list"); - } - - @Override - public void execute(Keystone keystone, CommandLine cmd) { - - final Roles roles = keystone.roles().list().execute(); - - Table t = new Table(new TableModel(roles.getList()) { - - @Override - public Column[] getHeaders() { - return new Column[]{ - new Column("id", 32, Column.ALIGN_LEFT), - new Column("name", 10, Column.ALIGN_LEFT), - new Column("description", 32, Column.ALIGN_LEFT), - new Column("enabled", 7, Column.ALIGN_LEFT), - }; - } - - @Override - public String[] getRow(Role role) { - return new String[]{ - role.getId(), - role.getName(), - role.getDescription(), - role.getEnabled() - }; - } - }); - System.out.println(t.render()); - } - -} +package com.woorea.openstack.console.keystone; + +import org.apache.commons.cli.CommandLine; + +import com.woorea.openstack.console.utils.Column; +import com.woorea.openstack.console.utils.Table; +import com.woorea.openstack.console.utils.TableModel; +import com.woorea.openstack.keystone.Keystone; +import com.woorea.openstack.keystone.model.Role; +import com.woorea.openstack.keystone.model.Roles; + +public class KeystoneRoleList extends KeystoneCommand { + + public KeystoneRoleList() { + super("role-list"); + } + + @Override + public void execute(Keystone keystone, CommandLine cmd) { + + final Roles roles = keystone.roles().list().execute(); + + Table t = new Table(new TableModel(roles.getList()) { + + @Override + public Column[] getHeaders() { + return new Column[]{ + new Column("id", 32, Column.ALIGN_LEFT), + new Column("name", 10, Column.ALIGN_LEFT), + new Column("description", 32, Column.ALIGN_LEFT), + new Column("enabled", 7, Column.ALIGN_LEFT), + }; + } + + @Override + public String[] getRow(Role role) { + return new String[]{ + role.getId(), + role.getName(), + role.getDescription(), + role.getEnabled() + }; + } + }); + System.out.println(t.render()); + } + +} diff --git a/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneServiceList.java b/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneServiceList.java index 27542c13c..87622d13e 100644 --- a/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneServiceList.java +++ b/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneServiceList.java @@ -1,48 +1,48 @@ -package com.woorea.openstack.console.keystone; - -import org.apache.commons.cli.CommandLine; - -import com.woorea.openstack.console.utils.Column; -import com.woorea.openstack.console.utils.Table; -import com.woorea.openstack.console.utils.TableModel; -import com.woorea.openstack.keystone.Keystone; -import com.woorea.openstack.keystone.model.Service; -import com.woorea.openstack.keystone.model.Services; - -public class KeystoneServiceList extends KeystoneCommand { - - public KeystoneServiceList() { - super("service-list"); - } - - @Override - public void execute(Keystone keystone, CommandLine cmd) { - - final Services services = keystone.services().list().execute(); - - Table t = new Table(new TableModel(services.getList()) { - - @Override - public Column[] getHeaders() { - return new Column[]{ - new Column("id", 32, Column.ALIGN_LEFT), - new Column("type", 10, Column.ALIGN_LEFT), - new Column("name", 10, Column.ALIGN_LEFT), - new Column("description", 32, Column.ALIGN_LEFT) - }; - } - - @Override - public String[] getRow(Service service) { - return new String[]{ - service.getId(), - service.getType(), - service.getName(), - service.getDescription() - }; - } - }); - System.out.println(t.render()); - } - -} +package com.woorea.openstack.console.keystone; + +import org.apache.commons.cli.CommandLine; + +import com.woorea.openstack.console.utils.Column; +import com.woorea.openstack.console.utils.Table; +import com.woorea.openstack.console.utils.TableModel; +import com.woorea.openstack.keystone.Keystone; +import com.woorea.openstack.keystone.model.Service; +import com.woorea.openstack.keystone.model.Services; + +public class KeystoneServiceList extends KeystoneCommand { + + public KeystoneServiceList() { + super("service-list"); + } + + @Override + public void execute(Keystone keystone, CommandLine cmd) { + + final Services services = keystone.services().list().execute(); + + Table t = new Table(new TableModel(services.getList()) { + + @Override + public Column[] getHeaders() { + return new Column[]{ + new Column("id", 32, Column.ALIGN_LEFT), + new Column("type", 10, Column.ALIGN_LEFT), + new Column("name", 10, Column.ALIGN_LEFT), + new Column("description", 32, Column.ALIGN_LEFT) + }; + } + + @Override + public String[] getRow(Service service) { + return new String[]{ + service.getId(), + service.getType(), + service.getName(), + service.getDescription() + }; + } + }); + System.out.println(t.render()); + } + +} diff --git a/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneTenantCreate.java b/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneTenantCreate.java index a8336ead4..bbd46a906 100644 --- a/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneTenantCreate.java +++ b/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneTenantCreate.java @@ -1,69 +1,69 @@ -package com.woorea.openstack.console.keystone; - -import java.util.Arrays; - -import org.apache.commons.cli.CommandLine; -import org.apache.commons.cli.Options; - -import com.woorea.openstack.console.utils.Column; -import com.woorea.openstack.console.utils.Table; -import com.woorea.openstack.console.utils.TableModel; -import com.woorea.openstack.keystone.Keystone; -import com.woorea.openstack.keystone.model.Tenant; - -public class KeystoneTenantCreate extends KeystoneCommand { - - public KeystoneTenantCreate() { - super("tenant-create"); - } - - @Override - public void execute(Keystone keystone, CommandLine cmd) { - - Tenant tenant = new Tenant(); - tenant.setName(cmd.getOptionValue("name")); - tenant.setDescription(cmd.getOptionValue("description")); - if(cmd.getOptionValue("enabled") != null) { - tenant.setEnabled(Boolean.TRUE); - } - - tenant = keystone.tenants().create(tenant).execute(); - - Table t = new Table(new TableModel(Arrays.asList(tenant)) { - - @Override - public Column[] getHeaders() { - return new Column[]{ - new Column("id", 32, Column.ALIGN_LEFT), - new Column("name", 10, Column.ALIGN_LEFT), - new Column("description", 32, Column.ALIGN_LEFT), - new Column("enabled", 7, Column.ALIGN_LEFT) - }; - } - - @Override - public String[] getRow(Tenant tenant) { - return new String[]{ - tenant.getId(), - tenant.getName(), - tenant.getDescription(), - tenant.getEnabled().toString() - }; - } - }); - System.out.println(t.render()); - } - - /* (non-Javadoc) - * @see com.billingstack.commands.Command#getOptions() - */ - @Override - public Options getOptions() { - Options opts = super.getOptions(); - opts.addOption(null, "name", true, "tenant name"); - opts.addOption(null, "description", true, "tenant description"); - opts.addOption(null, "enabled", false, "enabled"); - return opts; - } - -} +package com.woorea.openstack.console.keystone; + +import java.util.Arrays; + +import org.apache.commons.cli.CommandLine; +import org.apache.commons.cli.Options; + +import com.woorea.openstack.console.utils.Column; +import com.woorea.openstack.console.utils.Table; +import com.woorea.openstack.console.utils.TableModel; +import com.woorea.openstack.keystone.Keystone; +import com.woorea.openstack.keystone.model.Tenant; + +public class KeystoneTenantCreate extends KeystoneCommand { + + public KeystoneTenantCreate() { + super("tenant-create"); + } + + @Override + public void execute(Keystone keystone, CommandLine cmd) { + + Tenant tenant = new Tenant(); + tenant.setName(cmd.getOptionValue("name")); + tenant.setDescription(cmd.getOptionValue("description")); + if(cmd.getOptionValue("enabled") != null) { + tenant.setEnabled(Boolean.TRUE); + } + + tenant = keystone.tenants().create(tenant).execute(); + + Table t = new Table(new TableModel(Arrays.asList(tenant)) { + + @Override + public Column[] getHeaders() { + return new Column[]{ + new Column("id", 32, Column.ALIGN_LEFT), + new Column("name", 10, Column.ALIGN_LEFT), + new Column("description", 32, Column.ALIGN_LEFT), + new Column("enabled", 7, Column.ALIGN_LEFT) + }; + } + + @Override + public String[] getRow(Tenant tenant) { + return new String[]{ + tenant.getId(), + tenant.getName(), + tenant.getDescription(), + tenant.getEnabled().toString() + }; + } + }); + System.out.println(t.render()); + } + + /* (non-Javadoc) + * @see com.billingstack.commands.Command#getOptions() + */ + @Override + public Options getOptions() { + Options opts = super.getOptions(); + opts.addOption(null, "name", true, "tenant name"); + opts.addOption(null, "description", true, "tenant description"); + opts.addOption(null, "enabled", false, "enabled"); + return opts; + } + +} diff --git a/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneTenantDelete.java b/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneTenantDelete.java index a79da6a26..6b2a55819 100644 --- a/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneTenantDelete.java +++ b/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneTenantDelete.java @@ -1,25 +1,25 @@ -package com.woorea.openstack.console.keystone; - -import org.apache.commons.cli.CommandLine; - -import com.woorea.openstack.console.utils.ConsoleUtils; -import com.woorea.openstack.keystone.Keystone; - -public class KeystoneTenantDelete extends KeystoneCommand { - - public KeystoneTenantDelete() { - super("tenant-delete"); - } - - @Override - public void execute(Keystone keystone, CommandLine cmd) { - - String[] args = cmd.getArgs(); - if(args.length == 1) { - keystone.tenants().delete(args[0]).execute(); - System.out.println(new ConsoleUtils().green("OK")); - } - - } - -} +package com.woorea.openstack.console.keystone; + +import org.apache.commons.cli.CommandLine; + +import com.woorea.openstack.console.utils.ConsoleUtils; +import com.woorea.openstack.keystone.Keystone; + +public class KeystoneTenantDelete extends KeystoneCommand { + + public KeystoneTenantDelete() { + super("tenant-delete"); + } + + @Override + public void execute(Keystone keystone, CommandLine cmd) { + + String[] args = cmd.getArgs(); + if(args.length == 1) { + keystone.tenants().delete(args[0]).execute(); + System.out.println(new ConsoleUtils().green("OK")); + } + + } + +} diff --git a/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneTenantList.java b/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneTenantList.java index 24ff73bf9..d498f7df3 100644 --- a/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneTenantList.java +++ b/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneTenantList.java @@ -1,48 +1,48 @@ -package com.woorea.openstack.console.keystone; - -import org.apache.commons.cli.CommandLine; - -import com.woorea.openstack.console.utils.Column; -import com.woorea.openstack.console.utils.Table; -import com.woorea.openstack.console.utils.TableModel; -import com.woorea.openstack.keystone.Keystone; -import com.woorea.openstack.keystone.model.Tenant; -import com.woorea.openstack.keystone.model.Tenants; - -public class KeystoneTenantList extends KeystoneCommand { - - public KeystoneTenantList() { - super("tenant-list"); - } - - @Override - public void execute(Keystone keystone, CommandLine args) { - - final Tenants tenants = keystone.tenants().list().execute(); - - Table t = new Table(new TableModel(tenants.getList()) { - - @Override - public Column[] getHeaders() { - return new Column[]{ - new Column("id", 32, Column.ALIGN_LEFT), - new Column("name", 32, Column.ALIGN_LEFT), - new Column("description", 32, Column.ALIGN_LEFT), - new Column("enabled", 7, Column.ALIGN_LEFT) - }; - } - - @Override - public String[] getRow(Tenant tenant) { - return new String[]{ - tenant.getId(), - tenant.getName(), - tenant.getDescription(), - tenant.getEnabled().toString() - }; - } - }); - System.out.println(t.render()); - } - -} +package com.woorea.openstack.console.keystone; + +import org.apache.commons.cli.CommandLine; + +import com.woorea.openstack.console.utils.Column; +import com.woorea.openstack.console.utils.Table; +import com.woorea.openstack.console.utils.TableModel; +import com.woorea.openstack.keystone.Keystone; +import com.woorea.openstack.keystone.model.Tenant; +import com.woorea.openstack.keystone.model.Tenants; + +public class KeystoneTenantList extends KeystoneCommand { + + public KeystoneTenantList() { + super("tenant-list"); + } + + @Override + public void execute(Keystone keystone, CommandLine args) { + + final Tenants tenants = keystone.tenants().list().execute(); + + Table t = new Table(new TableModel(tenants.getList()) { + + @Override + public Column[] getHeaders() { + return new Column[]{ + new Column("id", 32, Column.ALIGN_LEFT), + new Column("name", 32, Column.ALIGN_LEFT), + new Column("description", 32, Column.ALIGN_LEFT), + new Column("enabled", 7, Column.ALIGN_LEFT) + }; + } + + @Override + public String[] getRow(Tenant tenant) { + return new String[]{ + tenant.getId(), + tenant.getName(), + tenant.getDescription(), + tenant.getEnabled().toString() + }; + } + }); + System.out.println(t.render()); + } + +} diff --git a/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneUserCreate.java b/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneUserCreate.java index 262876763..4409becfb 100644 --- a/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneUserCreate.java +++ b/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneUserCreate.java @@ -1,75 +1,75 @@ -package com.woorea.openstack.console.keystone; - -import java.util.Arrays; - -import org.apache.commons.cli.CommandLine; -import org.apache.commons.cli.Options; - -import com.woorea.openstack.console.utils.Column; -import com.woorea.openstack.console.utils.Table; -import com.woorea.openstack.console.utils.TableModel; -import com.woorea.openstack.keystone.Keystone; -import com.woorea.openstack.keystone.model.User; - -public class KeystoneUserCreate extends KeystoneCommand { - - public KeystoneUserCreate() { - super("user-create"); - } - - @Override - public void execute(Keystone keystone, CommandLine cmd) { - - User user = new User(); - user.setName(cmd.getOptionValue("name")); - user.setPassword(cmd.getOptionValue("password")); - user.setEmail(cmd.getOptionValue("email")); - user.setTenantId(cmd.getOptionValue("tenant")); - if(cmd.getOptionValue("enabled") != null) { - user.setEnabled(Boolean.TRUE); - } - - user = keystone.users().create(user).execute(); - - Table t = new Table(new TableModel(Arrays.asList(user)) { - - @Override - public Column[] getHeaders() { - return new Column[]{ - new Column("id", 32, Column.ALIGN_LEFT), - new Column("name", 10, Column.ALIGN_LEFT), - new Column("email", 22, Column.ALIGN_LEFT), - new Column("tenant", 32, Column.ALIGN_LEFT), - new Column("enabled", 7, Column.ALIGN_LEFT) - }; - } - - @Override - public String[] getRow(User user) { - return new String[]{ - user.getId(), - user.getName(), - user.getEmail(), - user.getTenantId(), - user.getEnabled().toString() - }; - } - }); - System.out.println(t.render()); - } - - /* (non-Javadoc) - * @see com.billingstack.commands.Command#getOptions() - */ - @Override - public Options getOptions() { - Options opts = super.getOptions(); - opts.addOption(null, "name", true, "user name"); - opts.addOption(null, "password", true, "user password"); - opts.addOption(null, "email", true, "user email"); - opts.addOption(null, "tenant", true, "tenant id"); - opts.addOption(null, "enabled", false, "enabled"); - return opts; - } - -} +package com.woorea.openstack.console.keystone; + +import java.util.Arrays; + +import org.apache.commons.cli.CommandLine; +import org.apache.commons.cli.Options; + +import com.woorea.openstack.console.utils.Column; +import com.woorea.openstack.console.utils.Table; +import com.woorea.openstack.console.utils.TableModel; +import com.woorea.openstack.keystone.Keystone; +import com.woorea.openstack.keystone.model.User; + +public class KeystoneUserCreate extends KeystoneCommand { + + public KeystoneUserCreate() { + super("user-create"); + } + + @Override + public void execute(Keystone keystone, CommandLine cmd) { + + User user = new User(); + user.setName(cmd.getOptionValue("name")); + user.setPassword(cmd.getOptionValue("password")); + user.setEmail(cmd.getOptionValue("email")); + user.setTenantId(cmd.getOptionValue("tenant")); + if(cmd.getOptionValue("enabled") != null) { + user.setEnabled(Boolean.TRUE); + } + + user = keystone.users().create(user).execute(); + + Table t = new Table(new TableModel(Arrays.asList(user)) { + + @Override + public Column[] getHeaders() { + return new Column[]{ + new Column("id", 32, Column.ALIGN_LEFT), + new Column("name", 10, Column.ALIGN_LEFT), + new Column("email", 22, Column.ALIGN_LEFT), + new Column("tenant", 32, Column.ALIGN_LEFT), + new Column("enabled", 7, Column.ALIGN_LEFT) + }; + } + + @Override + public String[] getRow(User user) { + return new String[]{ + user.getId(), + user.getName(), + user.getEmail(), + user.getTenantId(), + user.getEnabled().toString() + }; + } + }); + System.out.println(t.render()); + } + + /* (non-Javadoc) + * @see com.billingstack.commands.Command#getOptions() + */ + @Override + public Options getOptions() { + Options opts = super.getOptions(); + opts.addOption(null, "name", true, "user name"); + opts.addOption(null, "password", true, "user password"); + opts.addOption(null, "email", true, "user email"); + opts.addOption(null, "tenant", true, "tenant id"); + opts.addOption(null, "enabled", false, "enabled"); + return opts; + } + +} diff --git a/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneUserDelete.java b/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneUserDelete.java index 77deff4b2..882ddd124 100644 --- a/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneUserDelete.java +++ b/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneUserDelete.java @@ -1,25 +1,25 @@ -package com.woorea.openstack.console.keystone; - -import org.apache.commons.cli.CommandLine; - -import com.woorea.openstack.console.utils.ConsoleUtils; -import com.woorea.openstack.keystone.Keystone; - -public class KeystoneUserDelete extends KeystoneCommand { - - public KeystoneUserDelete() { - super("user-delete"); - } - - @Override - public void execute(Keystone keystone, CommandLine cmd) { - - String[] args = cmd.getArgs(); - if(args.length == 1) { - keystone.users().delete(args[0]).execute(); - System.out.println(new ConsoleUtils().green("OK")); - } - - } - -} +package com.woorea.openstack.console.keystone; + +import org.apache.commons.cli.CommandLine; + +import com.woorea.openstack.console.utils.ConsoleUtils; +import com.woorea.openstack.keystone.Keystone; + +public class KeystoneUserDelete extends KeystoneCommand { + + public KeystoneUserDelete() { + super("user-delete"); + } + + @Override + public void execute(Keystone keystone, CommandLine cmd) { + + String[] args = cmd.getArgs(); + if(args.length == 1) { + keystone.users().delete(args[0]).execute(); + System.out.println(new ConsoleUtils().green("OK")); + } + + } + +} diff --git a/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneUserList.java b/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneUserList.java index 90bcde427..27054d47d 100644 --- a/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneUserList.java +++ b/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneUserList.java @@ -1,50 +1,50 @@ -package com.woorea.openstack.console.keystone; - -import org.apache.commons.cli.CommandLine; - -import com.woorea.openstack.console.utils.Column; -import com.woorea.openstack.console.utils.Table; -import com.woorea.openstack.console.utils.TableModel; -import com.woorea.openstack.keystone.Keystone; -import com.woorea.openstack.keystone.model.User; -import com.woorea.openstack.keystone.model.Users; - -public class KeystoneUserList extends KeystoneCommand { - - public KeystoneUserList() { - super("user-list"); - } - - @Override - public void execute(Keystone keystone, CommandLine cmd) { - - final Users users = keystone.users().list().execute(); - - Table t = new Table(new TableModel(users.getList()) { - - @Override - public Column[] getHeaders() { - return new Column[]{ - new Column("id", 32, Column.ALIGN_LEFT), - new Column("name", 10, Column.ALIGN_LEFT), - new Column("email", 22, Column.ALIGN_LEFT), - new Column("tenant", 32, Column.ALIGN_LEFT), - new Column("enabled", 7, Column.ALIGN_LEFT) - }; - } - - @Override - public String[] getRow(User user) { - return new String[]{ - user.getId(), - user.getName(), - user.getEmail(), - user.getTenantId(), - user.getEnabled().toString() - }; - } - }); - System.out.println(t.render()); - } - -} +package com.woorea.openstack.console.keystone; + +import org.apache.commons.cli.CommandLine; + +import com.woorea.openstack.console.utils.Column; +import com.woorea.openstack.console.utils.Table; +import com.woorea.openstack.console.utils.TableModel; +import com.woorea.openstack.keystone.Keystone; +import com.woorea.openstack.keystone.model.User; +import com.woorea.openstack.keystone.model.Users; + +public class KeystoneUserList extends KeystoneCommand { + + public KeystoneUserList() { + super("user-list"); + } + + @Override + public void execute(Keystone keystone, CommandLine cmd) { + + final Users users = keystone.users().list().execute(); + + Table t = new Table(new TableModel(users.getList()) { + + @Override + public Column[] getHeaders() { + return new Column[]{ + new Column("id", 32, Column.ALIGN_LEFT), + new Column("name", 10, Column.ALIGN_LEFT), + new Column("email", 22, Column.ALIGN_LEFT), + new Column("tenant", 32, Column.ALIGN_LEFT), + new Column("enabled", 7, Column.ALIGN_LEFT) + }; + } + + @Override + public String[] getRow(User user) { + return new String[]{ + user.getId(), + user.getName(), + user.getEmail(), + user.getTenantId(), + user.getEnabled().toString() + }; + } + }); + System.out.println(t.render()); + } + +} diff --git a/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneUserShow.java b/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneUserShow.java index 29a447f4e..130832eee 100644 --- a/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneUserShow.java +++ b/openstack-console/src/main/java/com/woorea/openstack/console/keystone/KeystoneUserShow.java @@ -1,53 +1,53 @@ -package com.woorea.openstack.console.keystone; - -import java.util.Arrays; - -import org.apache.commons.cli.CommandLine; - -import com.woorea.openstack.console.utils.Column; -import com.woorea.openstack.console.utils.Table; -import com.woorea.openstack.console.utils.TableModel; -import com.woorea.openstack.keystone.Keystone; -import com.woorea.openstack.keystone.model.User; - -public class KeystoneUserShow extends KeystoneCommand { - - public KeystoneUserShow() { - super("user-show"); - } - - @Override - public void execute(Keystone keystone, CommandLine cmd) { - - String[] args = cmd.getArgs(); - if(args.length == 1) { - User user = keystone.users().show(args[0]).execute(); - Table t = new Table(new TableModel(Arrays.asList(user)) { - - @Override - public Column[] getHeaders() { - return new Column[]{ - new Column("id", 32, Column.ALIGN_LEFT), - new Column("name", 10, Column.ALIGN_LEFT), - new Column("email", 22, Column.ALIGN_LEFT), - new Column("tenant", 32, Column.ALIGN_LEFT), - new Column("enabled", 7, Column.ALIGN_LEFT) - }; - } - - @Override - public String[] getRow(User user) { - return new String[]{ - user.getId(), - user.getName(), - user.getEmail(), - user.getTenantId(), - user.getEnabled().toString() - }; - } - }); - System.out.println(t.render()); - } - } - -} +package com.woorea.openstack.console.keystone; + +import java.util.Arrays; + +import org.apache.commons.cli.CommandLine; + +import com.woorea.openstack.console.utils.Column; +import com.woorea.openstack.console.utils.Table; +import com.woorea.openstack.console.utils.TableModel; +import com.woorea.openstack.keystone.Keystone; +import com.woorea.openstack.keystone.model.User; + +public class KeystoneUserShow extends KeystoneCommand { + + public KeystoneUserShow() { + super("user-show"); + } + + @Override + public void execute(Keystone keystone, CommandLine cmd) { + + String[] args = cmd.getArgs(); + if(args.length == 1) { + User user = keystone.users().show(args[0]).execute(); + Table t = new Table(new TableModel(Arrays.asList(user)) { + + @Override + public Column[] getHeaders() { + return new Column[]{ + new Column("id", 32, Column.ALIGN_LEFT), + new Column("name", 10, Column.ALIGN_LEFT), + new Column("email", 22, Column.ALIGN_LEFT), + new Column("tenant", 32, Column.ALIGN_LEFT), + new Column("enabled", 7, Column.ALIGN_LEFT) + }; + } + + @Override + public String[] getRow(User user) { + return new String[]{ + user.getId(), + user.getName(), + user.getEmail(), + user.getTenantId(), + user.getEnabled().toString() + }; + } + }); + System.out.println(t.render()); + } + } + +} diff --git a/openstack-console/src/main/java/com/woorea/openstack/console/nova/NovaCommand.java b/openstack-console/src/main/java/com/woorea/openstack/console/nova/NovaCommand.java index b406fbcbc..e4f5806a8 100644 --- a/openstack-console/src/main/java/com/woorea/openstack/console/nova/NovaCommand.java +++ b/openstack-console/src/main/java/com/woorea/openstack/console/nova/NovaCommand.java @@ -1,25 +1,25 @@ -package com.woorea.openstack.console.nova; - -import org.apache.commons.cli.CommandLine; - -import com.woorea.openstack.console.Command; -import com.woorea.openstack.console.Console; -import com.woorea.openstack.nova.Nova; - - -public abstract class NovaCommand extends Command { - - public NovaCommand(String name) { - super(name); - } - - @Override - public void execute(Console console, CommandLine args) { - NovaEnvironment environment = (NovaEnvironment) console.getEnvironment(); - execute(environment.CLIENT, args); - - } - - protected abstract void execute(Nova nova, CommandLine args); - -} +package com.woorea.openstack.console.nova; + +import org.apache.commons.cli.CommandLine; + +import com.woorea.openstack.console.Command; +import com.woorea.openstack.console.Console; +import com.woorea.openstack.nova.Nova; + + +public abstract class NovaCommand extends Command { + + public NovaCommand(String name) { + super(name); + } + + @Override + public void execute(Console console, CommandLine args) { + NovaEnvironment environment = (NovaEnvironment) console.getEnvironment(); + execute(environment.CLIENT, args); + + } + + protected abstract void execute(Nova nova, CommandLine args); + +} diff --git a/openstack-console/src/main/java/com/woorea/openstack/console/nova/NovaEnvironment.java b/openstack-console/src/main/java/com/woorea/openstack/console/nova/NovaEnvironment.java index bb2e5c4bd..987212fd3 100644 --- a/openstack-console/src/main/java/com/woorea/openstack/console/nova/NovaEnvironment.java +++ b/openstack-console/src/main/java/com/woorea/openstack/console/nova/NovaEnvironment.java @@ -1,65 +1,65 @@ -package com.woorea.openstack.console.nova; - -import org.apache.commons.cli.CommandLine; - -import com.woorea.openstack.base.client.OpenStackSimpleTokenProvider; -import com.woorea.openstack.console.Command; -import com.woorea.openstack.console.Console; -import com.woorea.openstack.console.Environment; -import com.woorea.openstack.keystone.Keystone; -import com.woorea.openstack.keystone.model.Access; -import com.woorea.openstack.keystone.model.authentication.UsernamePassword; -import com.woorea.openstack.nova.Nova; - -public class NovaEnvironment extends Environment { - - public final Nova CLIENT; - - public static final Command NOVA = new Command("nova") { - - @Override - public void execute(Console console, CommandLine args) { - - if(args.getArgs().length == 1) { - Keystone keystone = new Keystone((String) console.getProperty("keystone.endpoint")); - - Access access = keystone.tokens().authenticate( - new UsernamePassword( - console.getProperty("keystone.username"), - console.getProperty("keystone.password") - ) - ) - .withTenantName(console.getProperty("keystone.tenant_name")) - .execute(); - - System.out.println(console.getProperty("nova.endpoint")); - - Nova client = new Nova(console.getProperty("nova.endpoint")+args.getArgs()[0]); - client.setTokenProvider(new OpenStackSimpleTokenProvider(access.getToken().getId())); - - NovaEnvironment environment = new NovaEnvironment(console.getEnvironment(), client); - - environment.register(new NovaServerList()); - - console.setEnvironment(environment); - - } - - } - - }; - - public NovaEnvironment(Environment parent, Nova client) { - super(parent); - CLIENT = client; - } - - /* (non-Javadoc) - * @see org.woorea.wsh.Environment#getPrompt() - */ - @Override - public String getPrompt() { - return "nova> "; - } - -} +package com.woorea.openstack.console.nova; + +import org.apache.commons.cli.CommandLine; + +import com.woorea.openstack.base.client.OpenStackSimpleTokenProvider; +import com.woorea.openstack.console.Command; +import com.woorea.openstack.console.Console; +import com.woorea.openstack.console.Environment; +import com.woorea.openstack.keystone.Keystone; +import com.woorea.openstack.keystone.model.Access; +import com.woorea.openstack.keystone.model.authentication.UsernamePassword; +import com.woorea.openstack.nova.Nova; + +public class NovaEnvironment extends Environment { + + public final Nova CLIENT; + + public static final Command NOVA = new Command("nova") { + + @Override + public void execute(Console console, CommandLine args) { + + if(args.getArgs().length == 1) { + Keystone keystone = new Keystone((String) console.getProperty("keystone.endpoint")); + + Access access = keystone.tokens().authenticate( + new UsernamePassword( + console.getProperty("keystone.username"), + console.getProperty("keystone.password") + ) + ) + .withTenantName(console.getProperty("keystone.tenant_name")) + .execute(); + + System.out.println(console.getProperty("nova.endpoint")); + + Nova client = new Nova(console.getProperty("nova.endpoint")+args.getArgs()[0]); + client.setTokenProvider(new OpenStackSimpleTokenProvider(access.getToken().getId())); + + NovaEnvironment environment = new NovaEnvironment(console.getEnvironment(), client); + + environment.register(new NovaServerList()); + + console.setEnvironment(environment); + + } + + } + + }; + + public NovaEnvironment(Environment parent, Nova client) { + super(parent); + CLIENT = client; + } + + /* (non-Javadoc) + * @see org.woorea.wsh.Environment#getPrompt() + */ + @Override + public String getPrompt() { + return "nova> "; + } + +} diff --git a/openstack-console/src/main/java/com/woorea/openstack/console/nova/NovaServerList.java b/openstack-console/src/main/java/com/woorea/openstack/console/nova/NovaServerList.java index 515ca2b19..5b17e7083 100644 --- a/openstack-console/src/main/java/com/woorea/openstack/console/nova/NovaServerList.java +++ b/openstack-console/src/main/java/com/woorea/openstack/console/nova/NovaServerList.java @@ -1,44 +1,44 @@ -package com.woorea.openstack.console.nova; - -import org.apache.commons.cli.CommandLine; - -import com.woorea.openstack.console.utils.Column; -import com.woorea.openstack.console.utils.Table; -import com.woorea.openstack.console.utils.TableModel; -import com.woorea.openstack.nova.Nova; -import com.woorea.openstack.nova.model.Server; -import com.woorea.openstack.nova.model.Servers; - -public class NovaServerList extends NovaCommand { - - public NovaServerList() { - super("list"); - } - - @Override - public void execute(Nova nova, CommandLine cmd) { - - final Servers servers = nova.servers().list(true).execute(); - - Table t = new Table(new TableModel(servers.getList()) { - - @Override - public Column[] getHeaders() { - return new Column[]{ - new Column("id", 32, Column.ALIGN_LEFT), - new Column("name", 10, Column.ALIGN_LEFT) - }; - } - - @Override - public String[] getRow(Server server) { - return new String[]{ - server.getId(), - server.getName() - }; - } - }); - System.out.println(t.render()); - } - -} +package com.woorea.openstack.console.nova; + +import org.apache.commons.cli.CommandLine; + +import com.woorea.openstack.console.utils.Column; +import com.woorea.openstack.console.utils.Table; +import com.woorea.openstack.console.utils.TableModel; +import com.woorea.openstack.nova.Nova; +import com.woorea.openstack.nova.model.Server; +import com.woorea.openstack.nova.model.Servers; + +public class NovaServerList extends NovaCommand { + + public NovaServerList() { + super("list"); + } + + @Override + public void execute(Nova nova, CommandLine cmd) { + + final Servers servers = nova.servers().list(true).execute(); + + Table t = new Table(new TableModel(servers.getList()) { + + @Override + public Column[] getHeaders() { + return new Column[]{ + new Column("id", 32, Column.ALIGN_LEFT), + new Column("name", 10, Column.ALIGN_LEFT) + }; + } + + @Override + public String[] getRow(Server server) { + return new String[]{ + server.getId(), + server.getName() + }; + } + }); + System.out.println(t.render()); + } + +} diff --git a/openstack-console/src/main/java/com/woorea/openstack/console/utils/Column.java b/openstack-console/src/main/java/com/woorea/openstack/console/utils/Column.java index 08ffa19e0..210d3713a 100644 --- a/openstack-console/src/main/java/com/woorea/openstack/console/utils/Column.java +++ b/openstack-console/src/main/java/com/woorea/openstack/console/utils/Column.java @@ -1,65 +1,65 @@ -package com.woorea.openstack.console.utils; - -public class Column { - - public static final int ALIGN_LEFT = -1; - public static final int ALIGN_RIGHT = 1; - - private String name; - - private int size; - - private int align; - - public Column(String name, int size, int align) { - super(); - this.name = name; - this.size = size; - this.align = align; - } - - /** - * @return the name - */ - public String getName() { - return name; - } - - /** - * @param name the name to set - */ - public void setName(String name) { - this.name = name; - } - - /** - * @return the size - */ - public int getSize() { - return size; - } - - /** - * @param size the size to set - */ - public void setSize(int size) { - this.size = size; - } - - /** - * @return the align - */ - public int getAlign() { - return align; - } - - /** - * @param align the align to set - */ - public void setAlign(int align) { - this.align = align; - } - - - -} +package com.woorea.openstack.console.utils; + +public class Column { + + public static final int ALIGN_LEFT = -1; + public static final int ALIGN_RIGHT = 1; + + private String name; + + private int size; + + private int align; + + public Column(String name, int size, int align) { + super(); + this.name = name; + this.size = size; + this.align = align; + } + + /** + * @return the name + */ + public String getName() { + return name; + } + + /** + * @param name the name to set + */ + public void setName(String name) { + this.name = name; + } + + /** + * @return the size + */ + public int getSize() { + return size; + } + + /** + * @param size the size to set + */ + public void setSize(int size) { + this.size = size; + } + + /** + * @return the align + */ + public int getAlign() { + return align; + } + + /** + * @param align the align to set + */ + public void setAlign(int align) { + this.align = align; + } + + + +} diff --git a/openstack-console/src/main/java/com/woorea/openstack/console/utils/ConsoleUtils.java b/openstack-console/src/main/java/com/woorea/openstack/console/utils/ConsoleUtils.java index 8212db693..8faf152b4 100644 --- a/openstack-console/src/main/java/com/woorea/openstack/console/utils/ConsoleUtils.java +++ b/openstack-console/src/main/java/com/woorea/openstack/console/utils/ConsoleUtils.java @@ -1,47 +1,47 @@ -package com.woorea.openstack.console.utils; - -public class ConsoleUtils { - - public static final String RED = "\u001B[31m"; - - public static final String GREEN = "\u001B[32m"; - - public static final String YELLOW = "\u001B[33m"; - - public static final String END = "\u001B[0m"; - - private StringBuilder sb = new StringBuilder(); - - public ConsoleUtils append(String text) { - sb.append(text); - return this; - } - - public ConsoleUtils red(String text) { - sb.append(ConsoleUtils.RED).append(text).append(END); - return this; - } - - public ConsoleUtils green(String text) { - sb.append(ConsoleUtils.GREEN).append(text).append(END); - return this; - } - - public ConsoleUtils yellow(String text) { - sb.append(ConsoleUtils.YELLOW).append(text).append(END); - return this; - } - - public static void log(String text) { - System.out.println(new ConsoleUtils().yellow("| ").append(text)); - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return sb.toString(); - } - -} +package com.woorea.openstack.console.utils; + +public class ConsoleUtils { + + public static final String RED = "\u001B[31m"; + + public static final String GREEN = "\u001B[32m"; + + public static final String YELLOW = "\u001B[33m"; + + public static final String END = "\u001B[0m"; + + private StringBuilder sb = new StringBuilder(); + + public ConsoleUtils append(String text) { + sb.append(text); + return this; + } + + public ConsoleUtils red(String text) { + sb.append(ConsoleUtils.RED).append(text).append(END); + return this; + } + + public ConsoleUtils green(String text) { + sb.append(ConsoleUtils.GREEN).append(text).append(END); + return this; + } + + public ConsoleUtils yellow(String text) { + sb.append(ConsoleUtils.YELLOW).append(text).append(END); + return this; + } + + public static void log(String text) { + System.out.println(new ConsoleUtils().yellow("| ").append(text)); + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return sb.toString(); + } + +} diff --git a/openstack-console/src/main/java/com/woorea/openstack/console/utils/Table.java b/openstack-console/src/main/java/com/woorea/openstack/console/utils/Table.java index b49ede581..2eca0294a 100644 --- a/openstack-console/src/main/java/com/woorea/openstack/console/utils/Table.java +++ b/openstack-console/src/main/java/com/woorea/openstack/console/utils/Table.java @@ -1,81 +1,81 @@ -package com.woorea.openstack.console.utils; - - -public class Table { - - private StringBuilder sb = new StringBuilder(); - - private TableModel model; - - public Table(TableModel model) { - this.model = model; - } - - public StringBuilder render() { - header(); - for(String[] row : model.getRows()) { - int i = 0; - for(String column : row) { - Column columnModel = model.getHeaders()[i]; - sb.append("| "); - if(column != null) { - if(Column.ALIGN_RIGHT == columnModel.getAlign()) { - for(int j = 0; j < columnModel.getSize() - column.length(); j++) { - sb.append(" "); - } - } - sb.append(column.length() <= columnModel.getSize() ? column : column.substring(0, columnModel.getSize())); - if(Column.ALIGN_LEFT == columnModel.getAlign()) { - for(int j = 0; j < columnModel.getSize() - column.length(); j++) { - sb.append(" "); - } - } - } else { - for(int k = 0; k < columnModel.getSize(); k++) { - sb.append(" "); - } - } - sb.append(" "); - i++; - } - sb.append("|\n"); - } - for(Column c : model.getHeaders()) { - sb.append("+"); - for(int i = 0; i < c.getSize() + 2; i++) { - sb.append("-"); - } - } - sb.append("+\n"); - return sb; - } - - public void header() { - for(Column c : model.getHeaders()) { - sb.append("+"); - for(int i = 0; i < c.getSize() + 2; i++) { - sb.append("-"); - } - } - sb.append("+\n"); - - for(Column c : model.getHeaders()) { - sb.append("| "); - sb.append(c.getName()); - for(int i = 0; i < c.getSize() - c.getName().length(); i++) { - sb.append(" "); - } - sb.append(" "); - } - sb.append("|\n"); - - for(Column c : model.getHeaders()) { - sb.append("+"); - for(int i = 0; i < c.getSize() + 2; i++) { - sb.append("-"); - } - } - sb.append("+\n"); - } - -} +package com.woorea.openstack.console.utils; + + +public class Table { + + private StringBuilder sb = new StringBuilder(); + + private TableModel model; + + public Table(TableModel model) { + this.model = model; + } + + public StringBuilder render() { + header(); + for(String[] row : model.getRows()) { + int i = 0; + for(String column : row) { + Column columnModel = model.getHeaders()[i]; + sb.append("| "); + if(column != null) { + if(Column.ALIGN_RIGHT == columnModel.getAlign()) { + for(int j = 0; j < columnModel.getSize() - column.length(); j++) { + sb.append(" "); + } + } + sb.append(column.length() <= columnModel.getSize() ? column : column.substring(0, columnModel.getSize())); + if(Column.ALIGN_LEFT == columnModel.getAlign()) { + for(int j = 0; j < columnModel.getSize() - column.length(); j++) { + sb.append(" "); + } + } + } else { + for(int k = 0; k < columnModel.getSize(); k++) { + sb.append(" "); + } + } + sb.append(" "); + i++; + } + sb.append("|\n"); + } + for(Column c : model.getHeaders()) { + sb.append("+"); + for(int i = 0; i < c.getSize() + 2; i++) { + sb.append("-"); + } + } + sb.append("+\n"); + return sb; + } + + public void header() { + for(Column c : model.getHeaders()) { + sb.append("+"); + for(int i = 0; i < c.getSize() + 2; i++) { + sb.append("-"); + } + } + sb.append("+\n"); + + for(Column c : model.getHeaders()) { + sb.append("| "); + sb.append(c.getName()); + for(int i = 0; i < c.getSize() - c.getName().length(); i++) { + sb.append(" "); + } + sb.append(" "); + } + sb.append("|\n"); + + for(Column c : model.getHeaders()) { + sb.append("+"); + for(int i = 0; i < c.getSize() + 2; i++) { + sb.append("-"); + } + } + sb.append("+\n"); + } + +} diff --git a/openstack-console/src/main/java/com/woorea/openstack/console/utils/TableModel.java b/openstack-console/src/main/java/com/woorea/openstack/console/utils/TableModel.java index f1ae84abf..64114615f 100644 --- a/openstack-console/src/main/java/com/woorea/openstack/console/utils/TableModel.java +++ b/openstack-console/src/main/java/com/woorea/openstack/console/utils/TableModel.java @@ -1,25 +1,25 @@ -package com.woorea.openstack.console.utils; - -import java.util.List; - -public abstract class TableModel { - - protected List data; - - public TableModel(List data) { - this.data = data; - } - - public abstract Column[] getHeaders(); - - public final String[][] getRows() { - String[][] rows = new String[data.size()][]; - for(int i = 0; i < data.size(); i++) { - rows[i] = getRow(data.get(i)); - } - return rows; - } - - public abstract String[] getRow(T data); - -} +package com.woorea.openstack.console.utils; + +import java.util.List; + +public abstract class TableModel { + + protected List data; + + public TableModel(List data) { + this.data = data; + } + + public abstract Column[] getHeaders(); + + public final String[][] getRows() { + String[][] rows = new String[data.size()][]; + for(int i = 0; i < data.size(); i++) { + rows[i] = getRow(data.get(i)); + } + return rows; + } + + public abstract String[] getRow(T data); + +} diff --git a/openstack-console/src/main/resources/console.properties b/openstack-console/src/main/resources/console.properties index 01902e4d9..ea58dd125 100644 --- a/openstack-console/src/main/resources/console.properties +++ b/openstack-console/src/main/resources/console.properties @@ -1,6 +1,6 @@ -keystone.endpoint=http://keystone.stacksherpa.org/v2.0 -keystone.username=admin -keystone.password=secret0 -keystone.tenant_name=admin - +keystone.endpoint=http://keystone.stacksherpa.org/v2.0 +keystone.username=admin +keystone.password=secret0 +keystone.tenant_name=admin + nova.endpoint=http://compute/v2/ \ No newline at end of file diff --git a/openstack-examples/logging.properties b/openstack-examples/logging.properties new file mode 100644 index 000000000..77769e0fa --- /dev/null +++ b/openstack-examples/logging.properties @@ -0,0 +1,8 @@ +.level = INFO + +handlers=java.util.logging.ConsoleHandler +java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter +java.util.logging.ConsoleHandler.level = ALL + +org.apache.http.level = FINEST +org.apache.http.wire.level = FINEST \ No newline at end of file diff --git a/openstack-examples/pom.xml b/openstack-examples/pom.xml index 30d401437..08c1db716 100644 --- a/openstack-examples/pom.xml +++ b/openstack-examples/pom.xml @@ -1,83 +1,83 @@ - - 4.0.0 - - com.woorea - openstack-java-sdk - 3.2.2-SNAPSHOT - - openstack-examples - OpenStack Examples - OpenStack Examples - - - com.woorea - keystone-client - 3.2.2-SNAPSHOT - - - com.woorea - nova-client - 3.2.2-SNAPSHOT - - - com.woorea - heat-client - 3.2.2-SNAPSHOT - - - com.woorea - swift-client - 3.2.2-SNAPSHOT - - - com.woorea - quantum-client - 3.2.2-SNAPSHOT - - - com.woorea - ceilometer-client - 3.2.2-SNAPSHOT - - - com.woorea - glance-client - 3.2.2-SNAPSHOT - - - - - jersey - - - com.woorea - jersey-connector - 3.0.0-SNAPSHOT - - - - - jersey2 - - true - - - - com.woorea - jersey2-connector - 3.1.0-SNAPSHOT - - - - - resteasy - - - com.woorea - resteasy-connector - 3.1.0-SNAPSHOT - - - - + + 4.0.0 + + com.woorea + openstack-java-sdk + 3.2.2-SNAPSHOT + + openstack-examples + OpenStack Examples + OpenStack Examples + + + com.woorea + keystone-client + 3.2.2-SNAPSHOT + + + com.woorea + nova-client + 3.2.2-SNAPSHOT + + + com.woorea + heat-client + 3.2.2-SNAPSHOT + + + com.woorea + swift-client + 3.2.2-SNAPSHOT + + + com.woorea + quantum-client + 3.2.2-SNAPSHOT + + + com.woorea + ceilometer-client + 3.2.2-SNAPSHOT + + + com.woorea + glance-client + 3.2.2-SNAPSHOT + + + + + jersey + + + com.woorea + jersey-connector + 3.0.0-SNAPSHOT + + + + + jersey2 + + true + + + + com.woorea + jersey2-connector + 3.1.0-SNAPSHOT + + + + + resteasy + + + com.woorea + resteasy-connector + 3.1.0-SNAPSHOT + + + + \ No newline at end of file diff --git a/openstack-examples/src/main/java/com/woorea/openstack/examples/compute/NovaCreateServer.java b/openstack-examples/src/main/java/com/woorea/openstack/examples/compute/NovaCreateServer.java index 643f14b9e..e1459fb75 100644 --- a/openstack-examples/src/main/java/com/woorea/openstack/examples/compute/NovaCreateServer.java +++ b/openstack-examples/src/main/java/com/woorea/openstack/examples/compute/NovaCreateServer.java @@ -1,90 +1,90 @@ -package com.woorea.openstack.examples.compute; - - -import com.woorea.openstack.base.client.OpenStackSimpleTokenProvider; -import com.woorea.openstack.examples.ExamplesConfiguration; -import com.woorea.openstack.keystone.Keystone; -import com.woorea.openstack.keystone.model.Access; -import com.woorea.openstack.keystone.model.Tenants; -import com.woorea.openstack.nova.Nova; -import com.woorea.openstack.nova.model.Flavors; -import com.woorea.openstack.nova.model.Images; -import com.woorea.openstack.nova.model.KeyPairs; -import com.woorea.openstack.nova.model.Server; -import com.woorea.openstack.nova.model.ServerForCreate; - -public class NovaCreateServer { - - /** - * @param args - */ - public static void main(String[] args) { - Keystone keystone = new Keystone(ExamplesConfiguration.KEYSTONE_AUTH_URL); - // access with unscoped token - Access access = keystone - .tokens() - .authenticate() - .withUsernamePassword(ExamplesConfiguration.KEYSTONE_USERNAME, ExamplesConfiguration.KEYSTONE_PASSWORD) - .execute(); - - // use the token in the following requests - keystone.token(access.getToken().getId()); - - Tenants tenants = keystone.tenants().list().execute(); - - // try to exchange token using the first tenant - if (tenants.getList().size() > 0) { - - access = keystone.tokens().authenticate() - .withToken(access.getToken().getId()) - .withTenantId(tenants.getList().get(0).getId()).execute(); - - // NovaClient novaClient = new - // NovaClient(KeystoneUtils.findEndpointURL(access.getServiceCatalog(), - // "compute", null, "public"), access.getToken().getId()); - Nova nova = new Nova(ExamplesConfiguration.NOVA_ENDPOINT.concat(tenants - .getList().get(0).getId())); - nova.setTokenProvider(new OpenStackSimpleTokenProvider(access.getToken() - .getId())); - // novaClient.enableLogging(Logger.getLogger("nova"), 100 * 1024); - // create a new keypair - // KeyPair keyPair = - // novaClient.execute(KeyPairsExtension.createKeyPair("mykeypair")); - // System.out.println(keyPair.getPrivateKey()); - - // create security group - // SecurityGroup securityGroup = - // novaClient.execute(SecurityGroupsExtension.createSecurityGroup("mysecuritygroup", - // "description")); - - // novaClient.execute(SecurityGroupsExtension.createSecurityGroupRule(securityGroup.getId(), - // "UDP", 9090, 9092, "0.0.0.0/0")); - // novaClient.execute(SecurityGroupsExtension.createSecurityGroupRule(securityGroup.getId(), - // "TCP", 8080, 8080, "0.0.0.0/0")); - - KeyPairs keysPairs = nova.keyPairs().list().execute(); - - Images images = nova.images().list(true).execute(); - - Flavors flavors = nova.flavors().list(true).execute(); - - ServerForCreate serverForCreate = new ServerForCreate(); - serverForCreate.setName("woorea"); - serverForCreate.setFlavorRef(flavors.getList().get(0).getId()); - serverForCreate.setImageRef(images.getList().get(1).getId()); - serverForCreate.setKeyName(keysPairs.getList().get(0).getName()); - serverForCreate.getSecurityGroups() - .add(new ServerForCreate.SecurityGroup("default")); - // serverForCreate.getSecurityGroups().add(new - // ServerForCreate.SecurityGroup(securityGroup.getName())); - - Server server = nova.servers().boot(serverForCreate).execute(); - System.out.println(server); - - } else { - System.out.println("No tenants found!"); - } - - } - -} +package com.woorea.openstack.examples.compute; + + +import com.woorea.openstack.base.client.OpenStackSimpleTokenProvider; +import com.woorea.openstack.examples.ExamplesConfiguration; +import com.woorea.openstack.keystone.Keystone; +import com.woorea.openstack.keystone.model.Access; +import com.woorea.openstack.keystone.model.Tenants; +import com.woorea.openstack.nova.Nova; +import com.woorea.openstack.nova.model.Flavors; +import com.woorea.openstack.nova.model.Images; +import com.woorea.openstack.nova.model.KeyPairs; +import com.woorea.openstack.nova.model.Server; +import com.woorea.openstack.nova.model.ServerForCreate; + +public class NovaCreateServer { + + /** + * @param args + */ + public static void main(String[] args) { + Keystone keystone = new Keystone(ExamplesConfiguration.KEYSTONE_AUTH_URL); + // access with unscoped token + Access access = keystone + .tokens() + .authenticate() + .withUsernamePassword(ExamplesConfiguration.KEYSTONE_USERNAME, ExamplesConfiguration.KEYSTONE_PASSWORD) + .execute(); + + // use the token in the following requests + keystone.token(access.getToken().getId()); + + Tenants tenants = keystone.tenants().list().execute(); + + // try to exchange token using the first tenant + if (tenants.getList().size() > 0) { + + access = keystone.tokens().authenticate() + .withToken(access.getToken().getId()) + .withTenantId(tenants.getList().get(0).getId()).execute(); + + // NovaClient novaClient = new + // NovaClient(KeystoneUtils.findEndpointURL(access.getServiceCatalog(), + // "compute", null, "public"), access.getToken().getId()); + Nova nova = new Nova(ExamplesConfiguration.NOVA_ENDPOINT.concat(tenants + .getList().get(0).getId())); + nova.setTokenProvider(new OpenStackSimpleTokenProvider(access.getToken() + .getId())); + // novaClient.enableLogging(Logger.getLogger("nova"), 100 * 1024); + // create a new keypair + // KeyPair keyPair = + // novaClient.execute(KeyPairsExtension.createKeyPair("mykeypair")); + // System.out.println(keyPair.getPrivateKey()); + + // create security group + // SecurityGroup securityGroup = + // novaClient.execute(SecurityGroupsExtension.createSecurityGroup("mysecuritygroup", + // "description")); + + // novaClient.execute(SecurityGroupsExtension.createSecurityGroupRule(securityGroup.getId(), + // "UDP", 9090, 9092, "0.0.0.0/0")); + // novaClient.execute(SecurityGroupsExtension.createSecurityGroupRule(securityGroup.getId(), + // "TCP", 8080, 8080, "0.0.0.0/0")); + + KeyPairs keysPairs = nova.keyPairs().list().execute(); + + Images images = nova.images().list(true).execute(); + + Flavors flavors = nova.flavors().list(true).execute(); + + ServerForCreate serverForCreate = new ServerForCreate(); + serverForCreate.setName("woorea"); + serverForCreate.setFlavorRef(flavors.getList().get(0).getId()); + serverForCreate.setImageRef(images.getList().get(1).getId()); + serverForCreate.setKeyName(keysPairs.getList().get(0).getName()); + serverForCreate.getSecurityGroups() + .add(new ServerForCreate.SecurityGroup("default")); + // serverForCreate.getSecurityGroups().add(new + // ServerForCreate.SecurityGroup(securityGroup.getName())); + + Server server = nova.servers().boot(serverForCreate).execute(); + System.out.println(server); + + } else { + System.out.println("No tenants found!"); + } + + } + +} diff --git a/openstack-examples/src/main/java/com/woorea/openstack/examples/compute/NovaListFlavors.java b/openstack-examples/src/main/java/com/woorea/openstack/examples/compute/NovaListFlavors.java index 893192d2a..56b07eef2 100644 --- a/openstack-examples/src/main/java/com/woorea/openstack/examples/compute/NovaListFlavors.java +++ b/openstack-examples/src/main/java/com/woorea/openstack/examples/compute/NovaListFlavors.java @@ -1,51 +1,51 @@ -package com.woorea.openstack.examples.compute; - - -import com.woorea.openstack.examples.ExamplesConfiguration; -import com.woorea.openstack.keystone.Keystone; -import com.woorea.openstack.keystone.model.Access; -import com.woorea.openstack.keystone.model.Tenants; -import com.woorea.openstack.keystone.model.authentication.TokenAuthentication; -import com.woorea.openstack.keystone.model.authentication.UsernamePassword; -import com.woorea.openstack.nova.Nova; -import com.woorea.openstack.nova.model.Flavor; -import com.woorea.openstack.nova.model.Flavors; - -public class NovaListFlavors { - - /** - * @param args - */ - public static void main(String[] args) { - Keystone keystone = new Keystone(ExamplesConfiguration.KEYSTONE_AUTH_URL); - Access access = keystone.tokens().authenticate( - new UsernamePassword(ExamplesConfiguration.KEYSTONE_USERNAME, ExamplesConfiguration.KEYSTONE_PASSWORD)) - .execute(); - - //use the token in the following requests - keystone.token(access.getToken().getId()); - - Tenants tenants = keystone.tenants().list().execute(); - - //try to exchange token using the first tenant - if(tenants.getList().size() > 0) { - - access = keystone.tokens().authenticate(new TokenAuthentication(access.getToken().getId())).withTenantId(tenants.getList().get(0).getId()).execute(); - - //NovaClient novaClient = new NovaClient(KeystoneUtils.findEndpointURL(access.getServiceCatalog(), "compute", null, "public"), access.getToken().getId()); - Nova novaClient = new Nova(ExamplesConfiguration.NOVA_ENDPOINT.concat("/").concat(tenants.getList().get(0).getId())); - novaClient.token(access.getToken().getId()); - //novaClient.enableLogging(Logger.getLogger("nova"), 100 * 1024); - - Flavors flavors = novaClient.flavors().list(true).execute(); - for(Flavor flavor : flavors) { - System.out.println(flavor); - } - - } else { - System.out.println("No tenants found!"); - } - - } - -} +package com.woorea.openstack.examples.compute; + + +import com.woorea.openstack.examples.ExamplesConfiguration; +import com.woorea.openstack.keystone.Keystone; +import com.woorea.openstack.keystone.model.Access; +import com.woorea.openstack.keystone.model.Tenants; +import com.woorea.openstack.keystone.model.authentication.TokenAuthentication; +import com.woorea.openstack.keystone.model.authentication.UsernamePassword; +import com.woorea.openstack.nova.Nova; +import com.woorea.openstack.nova.model.Flavor; +import com.woorea.openstack.nova.model.Flavors; + +public class NovaListFlavors { + + /** + * @param args + */ + public static void main(String[] args) { + Keystone keystone = new Keystone(ExamplesConfiguration.KEYSTONE_AUTH_URL); + Access access = keystone.tokens().authenticate( + new UsernamePassword(ExamplesConfiguration.KEYSTONE_USERNAME, ExamplesConfiguration.KEYSTONE_PASSWORD)) + .execute(); + + //use the token in the following requests + keystone.token(access.getToken().getId()); + + Tenants tenants = keystone.tenants().list().execute(); + + //try to exchange token using the first tenant + if(tenants.getList().size() > 0) { + + access = keystone.tokens().authenticate(new TokenAuthentication(access.getToken().getId())).withTenantId(tenants.getList().get(0).getId()).execute(); + + //NovaClient novaClient = new NovaClient(KeystoneUtils.findEndpointURL(access.getServiceCatalog(), "compute", null, "public"), access.getToken().getId()); + Nova novaClient = new Nova(ExamplesConfiguration.NOVA_ENDPOINT.concat("/").concat(tenants.getList().get(0).getId())); + novaClient.token(access.getToken().getId()); + //novaClient.enableLogging(Logger.getLogger("nova"), 100 * 1024); + + Flavors flavors = novaClient.flavors().list(true).execute(); + for(Flavor flavor : flavors) { + System.out.println(flavor); + } + + } else { + System.out.println("No tenants found!"); + } + + } + +} diff --git a/openstack-examples/src/main/java/com/woorea/openstack/examples/compute/NovaListImages.java b/openstack-examples/src/main/java/com/woorea/openstack/examples/compute/NovaListImages.java index edf2f63d1..67a540b02 100644 --- a/openstack-examples/src/main/java/com/woorea/openstack/examples/compute/NovaListImages.java +++ b/openstack-examples/src/main/java/com/woorea/openstack/examples/compute/NovaListImages.java @@ -1,52 +1,52 @@ -package com.woorea.openstack.examples.compute; - - -import com.woorea.openstack.examples.ExamplesConfiguration; -import com.woorea.openstack.keystone.Keystone; -import com.woorea.openstack.keystone.model.Access; -import com.woorea.openstack.keystone.model.Tenants; -import com.woorea.openstack.keystone.model.authentication.TokenAuthentication; -import com.woorea.openstack.keystone.model.authentication.UsernamePassword; -import com.woorea.openstack.nova.Nova; -import com.woorea.openstack.nova.model.Image; -import com.woorea.openstack.nova.model.Images; - -public class NovaListImages { - - /** - * @param args - */ - public static void main(String[] args) { - - Keystone keystone = new Keystone(ExamplesConfiguration.KEYSTONE_AUTH_URL); - Access access = keystone.tokens().authenticate(new UsernamePassword(ExamplesConfiguration.KEYSTONE_USERNAME, ExamplesConfiguration.KEYSTONE_PASSWORD)).execute(); - - //use the token in the following requests - keystone.token(access.getToken().getId()); - - Tenants tenants = keystone.tenants().list().execute(); - - //try to exchange token using the first tenant - if(tenants.getList().size() > 0) { - - access = keystone.tokens().authenticate(new TokenAuthentication(access.getToken().getId())) - .withTenantId(tenants.getList().get(0).getId()) - .execute(); - - //NovaClient novaClient = new NovaClient(KeystoneUtils.findEndpointURL(access.getServiceCatalog(), "compute", null, "public"), access.getToken().getId()); - Nova novaClient = new Nova(ExamplesConfiguration.NOVA_ENDPOINT.concat("/").concat(tenants.getList().get(0).getId())); - novaClient.token(access.getToken().getId()); - //novaClient.enableLogging(Logger.getLogger("nova"), 100 * 1024); - - Images images = novaClient.images().list(true).execute(); - for(Image image : images) { - System.out.println(image); - } - - } else { - System.out.println("No tenants found!"); - } - - } - -} +package com.woorea.openstack.examples.compute; + + +import com.woorea.openstack.examples.ExamplesConfiguration; +import com.woorea.openstack.keystone.Keystone; +import com.woorea.openstack.keystone.model.Access; +import com.woorea.openstack.keystone.model.Tenants; +import com.woorea.openstack.keystone.model.authentication.TokenAuthentication; +import com.woorea.openstack.keystone.model.authentication.UsernamePassword; +import com.woorea.openstack.nova.Nova; +import com.woorea.openstack.nova.model.Image; +import com.woorea.openstack.nova.model.Images; + +public class NovaListImages { + + /** + * @param args + */ + public static void main(String[] args) { + + Keystone keystone = new Keystone(ExamplesConfiguration.KEYSTONE_AUTH_URL); + Access access = keystone.tokens().authenticate(new UsernamePassword(ExamplesConfiguration.KEYSTONE_USERNAME, ExamplesConfiguration.KEYSTONE_PASSWORD)).execute(); + + //use the token in the following requests + keystone.token(access.getToken().getId()); + + Tenants tenants = keystone.tenants().list().execute(); + + //try to exchange token using the first tenant + if(tenants.getList().size() > 0) { + + access = keystone.tokens().authenticate(new TokenAuthentication(access.getToken().getId())) + .withTenantId(tenants.getList().get(0).getId()) + .execute(); + + //NovaClient novaClient = new NovaClient(KeystoneUtils.findEndpointURL(access.getServiceCatalog(), "compute", null, "public"), access.getToken().getId()); + Nova novaClient = new Nova(ExamplesConfiguration.NOVA_ENDPOINT.concat("/").concat(tenants.getList().get(0).getId())); + novaClient.token(access.getToken().getId()); + //novaClient.enableLogging(Logger.getLogger("nova"), 100 * 1024); + + Images images = novaClient.images().list(true).execute(); + for(Image image : images) { + System.out.println(image); + } + + } else { + System.out.println("No tenants found!"); + } + + } + +} diff --git a/openstack-examples/src/main/java/com/woorea/openstack/examples/compute/NovaListServers.java b/openstack-examples/src/main/java/com/woorea/openstack/examples/compute/NovaListServers.java index cab24e1ca..6bcc10c0f 100644 --- a/openstack-examples/src/main/java/com/woorea/openstack/examples/compute/NovaListServers.java +++ b/openstack-examples/src/main/java/com/woorea/openstack/examples/compute/NovaListServers.java @@ -1,38 +1,38 @@ -package com.woorea.openstack.examples.compute; - - -import com.woorea.openstack.examples.ExamplesConfiguration; -import com.woorea.openstack.keystone.Keystone; -import com.woorea.openstack.keystone.model.Access; -import com.woorea.openstack.keystone.model.authentication.UsernamePassword; -import com.woorea.openstack.nova.Nova; -import com.woorea.openstack.nova.model.Server; -import com.woorea.openstack.nova.model.Servers; - -public class NovaListServers { - - /** - * @param args - */ - public static void main(String[] args) { - Keystone keystone = new Keystone(ExamplesConfiguration.KEYSTONE_AUTH_URL); - Access access = keystone.tokens().authenticate(new UsernamePassword(ExamplesConfiguration.KEYSTONE_USERNAME, ExamplesConfiguration.KEYSTONE_PASSWORD)) - .withTenantName("demo") - .execute(); - - //use the token in the following requests - keystone.token(access.getToken().getId()); - - //NovaClient novaClient = new NovaClient(KeystoneUtils.findEndpointURL(access.getServiceCatalog(), "compute", null, "public"), access.getToken().getId()); - Nova novaClient = new Nova(ExamplesConfiguration.NOVA_ENDPOINT.concat("/").concat(access.getToken().getTenant().getId())); - novaClient.token(access.getToken().getId()); - //novaClient.enableLogging(Logger.getLogger("nova"), 100 * 1024); - - Servers servers = novaClient.servers().list(true).execute(); - for(Server server : servers) { - System.out.println(server); - } - - } - -} +package com.woorea.openstack.examples.compute; + + +import com.woorea.openstack.examples.ExamplesConfiguration; +import com.woorea.openstack.keystone.Keystone; +import com.woorea.openstack.keystone.model.Access; +import com.woorea.openstack.keystone.model.authentication.UsernamePassword; +import com.woorea.openstack.nova.Nova; +import com.woorea.openstack.nova.model.Server; +import com.woorea.openstack.nova.model.Servers; + +public class NovaListServers { + + /** + * @param args + */ + public static void main(String[] args) { + Keystone keystone = new Keystone(ExamplesConfiguration.KEYSTONE_AUTH_URL); + Access access = keystone.tokens().authenticate(new UsernamePassword(ExamplesConfiguration.KEYSTONE_USERNAME, ExamplesConfiguration.KEYSTONE_PASSWORD)) + .withTenantName("demo") + .execute(); + + //use the token in the following requests + keystone.token(access.getToken().getId()); + + //NovaClient novaClient = new NovaClient(KeystoneUtils.findEndpointURL(access.getServiceCatalog(), "compute", null, "public"), access.getToken().getId()); + Nova novaClient = new Nova(ExamplesConfiguration.NOVA_ENDPOINT.concat("/").concat(access.getToken().getTenant().getId())); + novaClient.token(access.getToken().getId()); + //novaClient.enableLogging(Logger.getLogger("nova"), 100 * 1024); + + Servers servers = novaClient.servers().list(true).execute(); + for(Server server : servers) { + System.out.println(server); + } + + } + +} diff --git a/openstack-examples/src/main/java/com/woorea/openstack/examples/compute/NovaStopStartServer.java b/openstack-examples/src/main/java/com/woorea/openstack/examples/compute/NovaStopStartServer.java index df4d44b7c..483ba6359 100644 --- a/openstack-examples/src/main/java/com/woorea/openstack/examples/compute/NovaStopStartServer.java +++ b/openstack-examples/src/main/java/com/woorea/openstack/examples/compute/NovaStopStartServer.java @@ -1,40 +1,40 @@ -package com.woorea.openstack.examples.compute; - -import com.woorea.openstack.examples.ExamplesConfiguration; -import com.woorea.openstack.keystone.Keystone; -import com.woorea.openstack.keystone.model.Access; -import com.woorea.openstack.keystone.model.authentication.UsernamePassword; -import com.woorea.openstack.nova.Nova; -import com.woorea.openstack.nova.api.ServersResource; -import com.woorea.openstack.nova.model.Servers; - -public class NovaStopStartServer { - public static void main(String[] args) throws InterruptedException { - Keystone keystone = new Keystone(ExamplesConfiguration.KEYSTONE_AUTH_URL); - Access access = keystone.tokens().authenticate(new UsernamePassword(ExamplesConfiguration.KEYSTONE_USERNAME, ExamplesConfiguration.KEYSTONE_PASSWORD)) - .withTenantName(ExamplesConfiguration.TENANT_NAME) - .execute(); - - //use the token in the following requests - keystone.token(access.getToken().getId()); - - Nova novaClient = new Nova(ExamplesConfiguration.NOVA_ENDPOINT.concat("/").concat(access.getToken().getTenant().getId())); - novaClient.token(access.getToken().getId()); - - Servers servers = novaClient.servers().list(true).execute(); - if(servers.getList().size() > 0) { - - // Server has to be in activated state. - ServersResource.StopServer stopServer = novaClient.servers().stop(servers.getList().get(0).getId()); - stopServer.endpoint(ExamplesConfiguration.NOVA_ENDPOINT); - stopServer.execute(); - - // Wait until server shutdown. Or 400 error occurs. - Thread.sleep(5000); - - ServersResource.StartServer startServer = novaClient.servers().start(servers.getList().get(0).getId()); - startServer.endpoint(ExamplesConfiguration.NOVA_ENDPOINT); - startServer.execute(); - } - } -} +package com.woorea.openstack.examples.compute; + +import com.woorea.openstack.examples.ExamplesConfiguration; +import com.woorea.openstack.keystone.Keystone; +import com.woorea.openstack.keystone.model.Access; +import com.woorea.openstack.keystone.model.authentication.UsernamePassword; +import com.woorea.openstack.nova.Nova; +import com.woorea.openstack.nova.api.ServersResource; +import com.woorea.openstack.nova.model.Servers; + +public class NovaStopStartServer { + public static void main(String[] args) throws InterruptedException { + Keystone keystone = new Keystone(ExamplesConfiguration.KEYSTONE_AUTH_URL); + Access access = keystone.tokens().authenticate(new UsernamePassword(ExamplesConfiguration.KEYSTONE_USERNAME, ExamplesConfiguration.KEYSTONE_PASSWORD)) + .withTenantName(ExamplesConfiguration.TENANT_NAME) + .execute(); + + //use the token in the following requests + keystone.token(access.getToken().getId()); + + Nova novaClient = new Nova(ExamplesConfiguration.NOVA_ENDPOINT.concat("/").concat(access.getToken().getTenant().getId())); + novaClient.token(access.getToken().getId()); + + Servers servers = novaClient.servers().list(true).execute(); + if(servers.getList().size() > 0) { + + // Server has to be in activated state. + ServersResource.StopServer stopServer = novaClient.servers().stop(servers.getList().get(0).getId()); + stopServer.endpoint(ExamplesConfiguration.NOVA_ENDPOINT); + stopServer.execute(); + + // Wait until server shutdown. Or 400 error occurs. + Thread.sleep(5000); + + ServersResource.StartServer startServer = novaClient.servers().start(servers.getList().get(0).getId()); + startServer.endpoint(ExamplesConfiguration.NOVA_ENDPOINT); + startServer.execute(); + } + } +} diff --git a/openstack-examples/src/main/java/com/woorea/openstack/examples/hpcloud/KeystoneAuthentication.java b/openstack-examples/src/main/java/com/woorea/openstack/examples/hpcloud/KeystoneAuthentication.java index 1caffea6e..99ad50d84 100644 --- a/openstack-examples/src/main/java/com/woorea/openstack/examples/hpcloud/KeystoneAuthentication.java +++ b/openstack-examples/src/main/java/com/woorea/openstack/examples/hpcloud/KeystoneAuthentication.java @@ -1,29 +1,29 @@ -package com.woorea.openstack.examples.hpcloud; - - -import com.woorea.openstack.examples.ExamplesConfiguration; -import com.woorea.openstack.keystone.Keystone; -import com.woorea.openstack.keystone.model.Access; - -public class KeystoneAuthentication { - - private static final String KEYSTONE_AUTH_URL = "https://region-a.geo-1.identity.hpcloudsvc.com:35357/v2.0"; - - /** - * @param args - */ - public static void main(String[] args) { - Keystone keystone = new Keystone(KEYSTONE_AUTH_URL); - - // access with unscoped token - Access access = keystone - .tokens() - .authenticate() - .withUsernamePassword(ExamplesConfiguration.KEYSTONE_USERNAME, ExamplesConfiguration.KEYSTONE_PASSWORD) - .execute(); - - System.out.println(access); - - } - -} +package com.woorea.openstack.examples.hpcloud; + + +import com.woorea.openstack.examples.ExamplesConfiguration; +import com.woorea.openstack.keystone.Keystone; +import com.woorea.openstack.keystone.model.Access; + +public class KeystoneAuthentication { + + private static final String KEYSTONE_AUTH_URL = "https://region-a.geo-1.identity.hpcloudsvc.com:35357/v2.0"; + + /** + * @param args + */ + public static void main(String[] args) { + Keystone keystone = new Keystone(KEYSTONE_AUTH_URL); + + // access with unscoped token + Access access = keystone + .tokens() + .authenticate() + .withUsernamePassword(ExamplesConfiguration.KEYSTONE_USERNAME, ExamplesConfiguration.KEYSTONE_PASSWORD) + .execute(); + + System.out.println(access); + + } + +} diff --git a/openstack-examples/src/main/java/com/woorea/openstack/examples/keystone/KeystoneCreateTenant.java b/openstack-examples/src/main/java/com/woorea/openstack/examples/keystone/KeystoneCreateTenant.java index 9bd33990b..e8259f0f2 100644 --- a/openstack-examples/src/main/java/com/woorea/openstack/examples/keystone/KeystoneCreateTenant.java +++ b/openstack-examples/src/main/java/com/woorea/openstack/examples/keystone/KeystoneCreateTenant.java @@ -1,36 +1,36 @@ -package com.woorea.openstack.examples.keystone; - - -import com.woorea.openstack.examples.ExamplesConfiguration; -import com.woorea.openstack.keystone.Keystone; -import com.woorea.openstack.keystone.model.Access; -import com.woorea.openstack.keystone.model.Tenant; -import com.woorea.openstack.keystone.model.authentication.TokenAuthentication; -import com.woorea.openstack.keystone.model.authentication.UsernamePassword; - -public class KeystoneCreateTenant { - - /** - * @param args - */ - public static void main(String[] args) { - Keystone keystone = new Keystone(ExamplesConfiguration.KEYSTONE_AUTH_URL); - //access with unscoped token - Access access = keystone.tokens().authenticate( - new UsernamePassword(ExamplesConfiguration.KEYSTONE_USERNAME, ExamplesConfiguration.KEYSTONE_PASSWORD)) - .execute(); - - access = keystone.tokens().authenticate(new TokenAuthentication(access.getToken().getId())).withTenantName("admin").execute(); - - Tenant tenant = new Tenant(); - tenant.setName("benn.cs"); - tenant.setDescription("benn.cs"); - tenant.setEnabled(true); - //Get the adminURL client and use the token got above - keystone = new Keystone("http://keystone.x.org/v2.0"); - keystone.token(access.getToken().getId()); - tenant = keystone.tenants().create(tenant).execute(); - System.out.println(tenant); - keystone.tenants().delete(tenant.getId()); - } -} +package com.woorea.openstack.examples.keystone; + + +import com.woorea.openstack.examples.ExamplesConfiguration; +import com.woorea.openstack.keystone.Keystone; +import com.woorea.openstack.keystone.model.Access; +import com.woorea.openstack.keystone.model.Tenant; +import com.woorea.openstack.keystone.model.authentication.TokenAuthentication; +import com.woorea.openstack.keystone.model.authentication.UsernamePassword; + +public class KeystoneCreateTenant { + + /** + * @param args + */ + public static void main(String[] args) { + Keystone keystone = new Keystone(ExamplesConfiguration.KEYSTONE_AUTH_URL); + //access with unscoped token + Access access = keystone.tokens().authenticate( + new UsernamePassword(ExamplesConfiguration.KEYSTONE_USERNAME, ExamplesConfiguration.KEYSTONE_PASSWORD)) + .execute(); + + access = keystone.tokens().authenticate(new TokenAuthentication(access.getToken().getId())).withTenantName("admin").execute(); + + Tenant tenant = new Tenant(); + tenant.setName("benn.cs"); + tenant.setDescription("benn.cs"); + tenant.setEnabled(true); + //Get the adminURL client and use the token got above + keystone = new Keystone("http://keystone.x.org/v2.0"); + keystone.token(access.getToken().getId()); + tenant = keystone.tenants().create(tenant).execute(); + System.out.println(tenant); + keystone.tenants().delete(tenant.getId()); + } +} diff --git a/openstack-examples/src/main/java/com/woorea/openstack/examples/keystone/KeystoneCreateUser.java b/openstack-examples/src/main/java/com/woorea/openstack/examples/keystone/KeystoneCreateUser.java index bde24407a..05bf5ebd2 100644 --- a/openstack-examples/src/main/java/com/woorea/openstack/examples/keystone/KeystoneCreateUser.java +++ b/openstack-examples/src/main/java/com/woorea/openstack/examples/keystone/KeystoneCreateUser.java @@ -1,38 +1,38 @@ -package com.woorea.openstack.examples.keystone; - - -import com.woorea.openstack.base.client.OpenStackSimpleTokenProvider; -import com.woorea.openstack.examples.ExamplesConfiguration; -import com.woorea.openstack.keystone.Keystone; -import com.woorea.openstack.keystone.model.Access; -import com.woorea.openstack.keystone.model.User; -import com.woorea.openstack.keystone.model.authentication.UsernamePassword; - -public class KeystoneCreateUser { - - /** - * @param args - */ - public static void main(String[] args) { - Keystone keystone = new Keystone(ExamplesConfiguration.KEYSTONE_AUTH_URL); - //access with unscoped token - Access access = keystone.tokens() - .authenticate(new UsernamePassword(ExamplesConfiguration.KEYSTONE_USERNAME, ExamplesConfiguration.KEYSTONE_PASSWORD)) - .withTenantName("admin") - .execute(); - - User user = new User(); - user.setEmail("luis@woorea.es"); - user.setUsername("luis.gervaso"); - user.setPassword("password.0"); - user.setName("Luis"); - user.setEnabled(Boolean.TRUE); - - keystone = new Keystone("http://keystone.x.org/v2.0"); - keystone.setTokenProvider(new OpenStackSimpleTokenProvider(access.getToken().getId())); - //keystone.enableLogging(Logger.getLogger("keystone"), 10000); - user = keystone.users().create(user).execute(); - System.out.println(user); - keystone.users().delete(user.getId()).execute(); - } -} +package com.woorea.openstack.examples.keystone; + + +import com.woorea.openstack.base.client.OpenStackSimpleTokenProvider; +import com.woorea.openstack.examples.ExamplesConfiguration; +import com.woorea.openstack.keystone.Keystone; +import com.woorea.openstack.keystone.model.Access; +import com.woorea.openstack.keystone.model.User; +import com.woorea.openstack.keystone.model.authentication.UsernamePassword; + +public class KeystoneCreateUser { + + /** + * @param args + */ + public static void main(String[] args) { + Keystone keystone = new Keystone(ExamplesConfiguration.KEYSTONE_AUTH_URL); + //access with unscoped token + Access access = keystone.tokens() + .authenticate(new UsernamePassword(ExamplesConfiguration.KEYSTONE_USERNAME, ExamplesConfiguration.KEYSTONE_PASSWORD)) + .withTenantName("admin") + .execute(); + + User user = new User(); + user.setEmail("luis@woorea.es"); + user.setUsername("luis.gervaso"); + user.setPassword("password.0"); + user.setName("Luis"); + user.setEnabled(Boolean.TRUE); + + keystone = new Keystone("http://keystone.x.org/v2.0"); + keystone.setTokenProvider(new OpenStackSimpleTokenProvider(access.getToken().getId())); + //keystone.enableLogging(Logger.getLogger("keystone"), 10000); + user = keystone.users().create(user).execute(); + System.out.println(user); + keystone.users().delete(user.getId()).execute(); + } +} diff --git a/openstack-examples/src/main/java/com/woorea/openstack/examples/objectstore/ContainersMessageBodyReader.java b/openstack-examples/src/main/java/com/woorea/openstack/examples/objectstore/ContainersMessageBodyReader.java new file mode 100644 index 000000000..a8fc3508e --- /dev/null +++ b/openstack-examples/src/main/java/com/woorea/openstack/examples/objectstore/ContainersMessageBodyReader.java @@ -0,0 +1,59 @@ +package com.woorea.openstack.examples.objectstore; + +import java.io.BufferedInputStream; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.lang.annotation.Annotation; +import java.lang.reflect.Type; + +import javax.ws.rs.WebApplicationException; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.MultivaluedMap; +import javax.ws.rs.ext.MessageBodyReader; + +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; +import com.woorea.openstack.swift.model.Container; +import com.woorea.openstack.swift.model.Containers; +public class ContainersMessageBodyReader implements MessageBodyReader { + + @Override + public boolean isReadable(Class type, Type genericType, + Annotation[] annotations, MediaType mediaType) { + return type == Containers.class; + } + + @Override + public Containers readFrom(Class type, + Type genericType, + Annotation[] annotations, MediaType mediaType, + MultivaluedMap httpHeaders, + InputStream entityStream) + throws IOException, WebApplicationException { + ObjectMapper DEFAULT_MAPPER = new ObjectMapper(); + DEFAULT_MAPPER.setSerializationInclusion(Include.NON_NULL); + DEFAULT_MAPPER.enable(SerializationFeature.INDENT_OUTPUT); + DEFAULT_MAPPER.enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + Container[] containersArray = DEFAULT_MAPPER.readValue(entityStream, Container[].class); + return new Containers(containersArray); + + } + + private InputStream copyStream(InputStream stream) throws IOException { + if (!stream.markSupported()) { + stream = new BufferedInputStream(stream); + } + byte[] entity = new byte[4096]; + int entitySize = 0; + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + while ((entitySize = stream.read(entity)) != -1) { + baos.write(entity, 0, entitySize); + } + stream.reset(); + return new ByteArrayInputStream(baos.toByteArray()); + } +} diff --git a/openstack-examples/src/main/java/com/woorea/openstack/examples/objectstore/ObjectDownloadMessageBodyReader.java b/openstack-examples/src/main/java/com/woorea/openstack/examples/objectstore/ObjectDownloadMessageBodyReader.java new file mode 100644 index 000000000..e7761f408 --- /dev/null +++ b/openstack-examples/src/main/java/com/woorea/openstack/examples/objectstore/ObjectDownloadMessageBodyReader.java @@ -0,0 +1,47 @@ +package com.woorea.openstack.examples.objectstore; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.lang.annotation.Annotation; +import java.lang.reflect.Type; + +import javax.ws.rs.WebApplicationException; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.MultivaluedMap; +import javax.ws.rs.ext.MessageBodyReader; + +import com.woorea.openstack.swift.model.ObjectDownload; + +public class ObjectDownloadMessageBodyReader implements MessageBodyReader { + + @Override + public boolean isReadable(Class type, Type genericType, + Annotation[] annotations, MediaType mediaType) { + return type == ObjectDownload.class; + } + + @Override + public ObjectDownload readFrom(Class type, + Type genericType, + Annotation[] annotations, MediaType mediaType, + MultivaluedMap httpHeaders, + InputStream entityStream) + throws IOException, WebApplicationException { + ObjectDownload objectDownload = new ObjectDownload(); + objectDownload.setInputStream(copyStream(entityStream)); + return objectDownload; + + } + + private InputStream copyStream(InputStream stream) throws IOException { + byte[] entity = new byte[4096]; + int entitySize = 0; + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + while ((entitySize = stream.read(entity)) != -1) { + baos.write(entity, 0, entitySize); + } + return new ByteArrayInputStream(baos.toByteArray()); + } +} diff --git a/openstack-examples/src/main/java/com/woorea/openstack/examples/objectstore/PseudoFileSystem.java b/openstack-examples/src/main/java/com/woorea/openstack/examples/objectstore/PseudoFileSystem.java new file mode 100644 index 000000000..53e6bd13f --- /dev/null +++ b/openstack-examples/src/main/java/com/woorea/openstack/examples/objectstore/PseudoFileSystem.java @@ -0,0 +1,121 @@ +package com.woorea.openstack.examples.objectstore; + +import java.util.LinkedHashMap; +import java.util.Map; + +import com.woorea.openstack.swift.model.Objects; + +public class PseudoFileSystem { + + private Map directories = new LinkedHashMap(); + private Map files = new LinkedHashMap(); + private com.woorea.openstack.swift.model.Object metaData; + private PseudoFileSystem parent; + + public PseudoFileSystem(PseudoFileSystem parent, String childPath) { + this.parent = parent; + com.woorea.openstack.swift.model.Object object = new com.woorea.openstack.swift.model.Object(); + object.setName(childPath); + this.setMetaData(object); + } + + public Map getDirectories() { + return directories; + } + + public Map getFiles() { + return files; + } + + public static PseudoFileSystem readFromObjects(Objects objects) { + PseudoFileSystem fs = new PseudoFileSystem(null, ""); + for (com.woorea.openstack.swift.model.Object object : objects) { + String name = object.getName(); + if (!name.contains("/")) { + fs.getFiles().put(name, object); + } else { + if (name.endsWith("/")) { + PseudoFileSystem targetDirectory = findOrCreateChild(fs, + name); + targetDirectory.setMetaData(object); + } else { + String[] path = name.split("/"); + String directory = ""; + for (int i = 0; i < path.length - 1; i++) { + directory += path[i] + "/"; + } + PseudoFileSystem targetDirectory = findChild(fs, directory); + targetDirectory.files.put(path[path.length - 1], object); + } + } + } + return fs; + } + + public static PseudoFileSystem findOrCreateChild(PseudoFileSystem root, + String childPath) { + PseudoFileSystem currentLevel = root; + String[] path = childPath.split("/"); + for (int i = 0; i < path.length; i++) { + if (!currentLevel.directories.containsKey(path[i])) { + currentLevel.directories.put(path[i], new PseudoFileSystem( + currentLevel, childPath)); + } + currentLevel = currentLevel.directories.get(path[i]); + } + return currentLevel; + } + + public static PseudoFileSystem findChild(PseudoFileSystem root, + String childPath) { + PseudoFileSystem currentLevel = root; + String[] path = childPath.split("/"); + for (int i = 0; i < path.length; i++) { + if (!currentLevel.directories.containsKey(path[i])) { + return null; + } + currentLevel = currentLevel.directories.get(path[i]); + } + return currentLevel; + } + + public com.woorea.openstack.swift.model.Object getMetaData() { + return metaData; + } + + public void setMetaData(com.woorea.openstack.swift.model.Object metaData) { + this.metaData = metaData; + } + + public String toString() { + return toString(" "); + } + + public String toString(String ident) { + StringBuilder builder = new StringBuilder(); + builder.append(getMetaData()).append("\n"); + for (Map.Entry entry : getFiles() + .entrySet()) { + builder.append(ident).append("file ").append(entry.getValue()) + .append("\n"); + } + for (Map.Entry children : getDirectories() + .entrySet()) { + builder.append(ident).append("dir ") + .append(children.getValue().toString(ident + " ")); + } + return builder.toString(); + } + + public PseudoFileSystem getParent() { + return parent; + } + + public PseudoFileSystem getRoot() { + PseudoFileSystem p = this; + while (p.getParent() != null) { + p = p.getParent(); + } + return p; + } +} \ No newline at end of file diff --git a/openstack-examples/src/main/java/com/woorea/openstack/examples/objectstore/SwiftExample2.java b/openstack-examples/src/main/java/com/woorea/openstack/examples/objectstore/SwiftExample2.java new file mode 100644 index 000000000..ea3167ba1 --- /dev/null +++ b/openstack-examples/src/main/java/com/woorea/openstack/examples/objectstore/SwiftExample2.java @@ -0,0 +1,97 @@ +package com.woorea.openstack.examples.objectstore; + +import java.util.HashMap; +import java.util.Map; +import java.util.logging.Logger; + +import com.woorea.openstack.base.client.OpenStackSimpleTokenProvider; +import com.woorea.openstack.examples.ExamplesConfiguration; +import com.woorea.openstack.keystone.Keystone; +import com.woorea.openstack.keystone.model.Access; +import com.woorea.openstack.keystone.model.Role; +import com.woorea.openstack.keystone.model.Roles; +import com.woorea.openstack.keystone.model.Tenant; +import com.woorea.openstack.keystone.model.User; +import com.woorea.openstack.keystone.model.authentication.TokenAuthentication; +import com.woorea.openstack.keystone.model.authentication.UsernamePassword; + +public class SwiftExample2 { + + private static Logger logger = Logger.getLogger(SwiftExample2.class + .getName()); + + public static void main(String[] args) throws Exception { + Map roles = new HashMap(); + Keystone keystone = new Keystone( + ExamplesConfiguration.KEYSTONE_AUTH_URL); + Keystone adminKeystone = new Keystone( + ExamplesConfiguration.KEYSTONE_ADMIN_AUTH_URL); + // access with unscoped token + Access access = keystone.tokens() + .authenticate(new UsernamePassword("admin", "adminPassword")) + .execute(); + + Access adminAccess = keystone + .tokens() + .authenticate( + new TokenAuthentication(access.getToken().getId())) + .withTenantName("admin").execute(); + + // use the token in the following requests + keystone.setTokenProvider(new OpenStackSimpleTokenProvider(access + .getToken().getId())); + adminKeystone.token(adminAccess.getToken().getId()); + + + logger.info(adminKeystone.users().show("d07fca2858ba4774ab5076614100d353").execute().toString()); + + Roles rolesList = adminKeystone.roles().list().execute(); + for (Role role : rolesList) { + roles.put(role.getName(), role); + } + + User user = new User(); + user.setUsername("daniele2"); + user.setName("daniele2"); + user.setPassword("clown123"); + user.setEmail("daniele.ulrich@niceneasy.ch"); + user.setEnabled(true); + user = adminKeystone.users().create(user).execute(); + Tenant tenant = new Tenant(); + tenant.setName(user.getUsername()); + tenant.setEnabled(true); + tenant.setDescription("tenant for user " + user.getName()); + tenant = adminKeystone.tenants().create(tenant).execute(); + user.setTenantId(tenant.getId()); + try { + adminKeystone + .tenants() + .addUser(tenant.getId(), user.getId(), + roles.get("admin").getId()).execute(); + adminKeystone + .tenants() + .addUser(tenant.getId(), user.getId(), + roles.get("Member").getId()).execute(); + + logger.info(user.toString()); + + user = adminKeystone.users().update(user.getId(), user).execute(); + user = adminKeystone.users().update(user.getId(), user).execute(); + logger.info(user.toString()); + Access adminAccess2 = keystone + .tokens() + .authenticate( + new UsernamePassword(user.getName(), user + .getPassword())) + .withTenantName(user.getName()).execute(); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + adminKeystone.tenants().delete(tenant.getId()).execute(); + adminKeystone.users().delete(user.getId()).execute(); + + } + +} diff --git a/openstack-examples/src/main/java/com/woorea/openstack/examples/simple/OpenStackSimpleClient.java b/openstack-examples/src/main/java/com/woorea/openstack/examples/simple/OpenStackSimpleClient.java index c2e8023ae..22eb87bb1 100644 --- a/openstack-examples/src/main/java/com/woorea/openstack/examples/simple/OpenStackSimpleClient.java +++ b/openstack-examples/src/main/java/com/woorea/openstack/examples/simple/OpenStackSimpleClient.java @@ -1,15 +1,15 @@ -package com.woorea.openstack.examples.simple; - - -public class OpenStackSimpleClient { - - /** - * @param args - */ - public static void main(String[] args) { -// OpenStackClient client = new OpenStackClient(ExamplesConfiguration.KEYSTONE_AUTH_URL); -// Access access = client.request("/tokens").execute("POST", Entity.json("{\"auth\":{\"passwordCredentials\":{\"username\":\"\",\"password\":\"\"}}}"), Access.class); -// System.out.println(access); - } - -} +package com.woorea.openstack.examples.simple; + + +public class OpenStackSimpleClient { + + /** + * @param args + */ + public static void main(String[] args) { +// OpenStackClient client = new OpenStackClient(ExamplesConfiguration.KEYSTONE_AUTH_URL); +// Access access = client.request("/tokens").execute("POST", Entity.json("{\"auth\":{\"passwordCredentials\":{\"username\":\"\",\"password\":\"\"}}}"), Access.class); +// System.out.println(access); + } + +} diff --git a/quantum-client/pom.xml b/quantum-client/pom.xml index 0f3426f02..47a9e1409 100644 --- a/quantum-client/pom.xml +++ b/quantum-client/pom.xml @@ -1,23 +1,23 @@ - - 4.0.0 - - com.woorea - openstack-java-sdk - 3.2.2-SNAPSHOT - - quantum-client - OpenStack Quantum Client - OpenStack Quantum Client - - - com.woorea - openstack-client - 3.2.2-SNAPSHOT - - - com.woorea - quantum-model - 3.2.2-SNAPSHOT - - - + + 4.0.0 + + com.woorea + openstack-java-sdk + 3.2.2-SNAPSHOT + + quantum-client + OpenStack Quantum Client + OpenStack Quantum Client + + + com.woorea + openstack-client + 3.2.2-SNAPSHOT + + + com.woorea + quantum-model + 3.2.2-SNAPSHOT + + + diff --git a/quantum-client/src/main/java/com/woorea/openstack/quantum/Quantum.java b/quantum-client/src/main/java/com/woorea/openstack/quantum/Quantum.java index ec9c40f97..8e59c1919 100644 --- a/quantum-client/src/main/java/com/woorea/openstack/quantum/Quantum.java +++ b/quantum-client/src/main/java/com/woorea/openstack/quantum/Quantum.java @@ -1,51 +1,51 @@ -package com.woorea.openstack.quantum; - - -import com.woorea.openstack.base.client.OpenStackClient; -import com.woorea.openstack.base.client.OpenStackClientConnector; -import com.woorea.openstack.quantum.api.NetworksResource; -import com.woorea.openstack.quantum.api.PortsResource; -import com.woorea.openstack.quantum.api.RoutersResource; -import com.woorea.openstack.quantum.api.SubnetsResource; - - -public class Quantum extends OpenStackClient { - - private final NetworksResource NETWORKS; - - private final PortsResource PORTS; - - private final SubnetsResource SUBNETS; - private final RoutersResource ROUTERS; - - public Quantum(String endpoint, OpenStackClientConnector connector) { - super(endpoint, connector); - NETWORKS = new NetworksResource(this); - PORTS = new PortsResource(this); - SUBNETS = new SubnetsResource(this); - ROUTERS=new RoutersResource(this); - - } - - public Quantum(String endpoint) { - this(endpoint, null); - } - - public NetworksResource networks() { - return NETWORKS; - } - - public PortsResource ports() { - return PORTS; - } - - public SubnetsResource subnets() { - return SUBNETS; - } - public RoutersResource routers() - { - return ROUTERS; - } - - -} +package com.woorea.openstack.quantum; + + +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.base.client.OpenStackClientConnector; +import com.woorea.openstack.quantum.api.NetworksResource; +import com.woorea.openstack.quantum.api.PortsResource; +import com.woorea.openstack.quantum.api.RoutersResource; +import com.woorea.openstack.quantum.api.SubnetsResource; + + +public class Quantum extends OpenStackClient { + + private final NetworksResource NETWORKS; + + private final PortsResource PORTS; + + private final SubnetsResource SUBNETS; + private final RoutersResource ROUTERS; + + public Quantum(String endpoint, OpenStackClientConnector connector) { + super(endpoint, connector); + NETWORKS = new NetworksResource(this); + PORTS = new PortsResource(this); + SUBNETS = new SubnetsResource(this); + ROUTERS=new RoutersResource(this); + + } + + public Quantum(String endpoint) { + this(endpoint, null); + } + + public NetworksResource networks() { + return NETWORKS; + } + + public PortsResource ports() { + return PORTS; + } + + public SubnetsResource subnets() { + return SUBNETS; + } + public RoutersResource routers() + { + return ROUTERS; + } + + +} diff --git a/quantum-client/src/main/java/com/woorea/openstack/quantum/api/NetworksResource.java b/quantum-client/src/main/java/com/woorea/openstack/quantum/api/NetworksResource.java index 97a919aba..30461aef1 100644 --- a/quantum-client/src/main/java/com/woorea/openstack/quantum/api/NetworksResource.java +++ b/quantum-client/src/main/java/com/woorea/openstack/quantum/api/NetworksResource.java @@ -1,84 +1,84 @@ -package com.woorea.openstack.quantum.api; - - -import com.woorea.openstack.base.client.Entity; -import com.woorea.openstack.base.client.HttpMethod; -import com.woorea.openstack.base.client.OpenStackClient; -import com.woorea.openstack.base.client.OpenStackRequest; -import com.woorea.openstack.quantum.model.Network; -import com.woorea.openstack.quantum.model.Networks; - -public class NetworksResource { - - private final OpenStackClient CLIENT; - - public NetworksResource(OpenStackClient client) { - CLIENT = client; - } - - public List list() { - return new List(); - } - - public Create create(Network net) { - return new Create(net); - } - - public Update update(Network net) { - return new Update(net); - } - - public Delete delete(String netId){ - return new Delete(netId); - } - - public Show show(String netId){ - return new Show(netId); - } - - public class List extends OpenStackRequest { - - public List() { - super(CLIENT, HttpMethod.GET, "networks", null, Networks.class); - } - } - - public class Query extends OpenStackRequest { - - public Query(Network network) { - //super(network); -// target = target.path("v2.0").path("networks"); -// target = queryParam(target); -// return target.request(MediaType.APPLICATION_JSON).get(Networks.class); - } - } - - - public class Create extends OpenStackRequest { - - public Create(Network net) { - super(CLIENT, HttpMethod.POST, "networks", Entity.json(net), Network.class); - } - } - - public class Update extends OpenStackRequest { - - public Update(Network net) { - super(CLIENT, HttpMethod.PUT, buildPath("networks/", net.getId()), Entity.json(net), Network.class); - } - } - - public class Show extends OpenStackRequest { - - public Show(String id) { - super(CLIENT, HttpMethod.GET, buildPath("networks/", id), null, Network.class); - } - } - - public class Delete extends OpenStackRequest { - - public Delete(String id){ - super(CLIENT, HttpMethod.DELETE, buildPath("networks/", id), null, Void.class); - } - } -} +package com.woorea.openstack.quantum.api; + + +import com.woorea.openstack.base.client.Entity; +import com.woorea.openstack.base.client.HttpMethod; +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.base.client.OpenStackRequest; +import com.woorea.openstack.quantum.model.Network; +import com.woorea.openstack.quantum.model.Networks; + +public class NetworksResource { + + private final OpenStackClient CLIENT; + + public NetworksResource(OpenStackClient client) { + CLIENT = client; + } + + public List list() { + return new List(); + } + + public Create create(Network net) { + return new Create(net); + } + + public Update update(Network net) { + return new Update(net); + } + + public Delete delete(String netId){ + return new Delete(netId); + } + + public Show show(String netId){ + return new Show(netId); + } + + public class List extends OpenStackRequest { + + public List() { + super(CLIENT, HttpMethod.GET, "networks", null, Networks.class); + } + } + + public class Query extends OpenStackRequest { + + public Query(Network network) { + //super(network); +// target = target.path("v2.0").path("networks"); +// target = queryParam(target); +// return target.request(MediaType.APPLICATION_JSON).get(Networks.class); + } + } + + + public class Create extends OpenStackRequest { + + public Create(Network net) { + super(CLIENT, HttpMethod.POST, "networks", Entity.json(net), Network.class); + } + } + + public class Update extends OpenStackRequest { + + public Update(Network net) { + super(CLIENT, HttpMethod.PUT, buildPath("networks/", net.getId()), Entity.json(net), Network.class); + } + } + + public class Show extends OpenStackRequest { + + public Show(String id) { + super(CLIENT, HttpMethod.GET, buildPath("networks/", id), null, Network.class); + } + } + + public class Delete extends OpenStackRequest { + + public Delete(String id){ + super(CLIENT, HttpMethod.DELETE, buildPath("networks/", id), null, Void.class); + } + } +} diff --git a/quantum-client/src/main/java/com/woorea/openstack/quantum/api/PortsResource.java b/quantum-client/src/main/java/com/woorea/openstack/quantum/api/PortsResource.java index d14e860b6..d7c0c2f18 100644 --- a/quantum-client/src/main/java/com/woorea/openstack/quantum/api/PortsResource.java +++ b/quantum-client/src/main/java/com/woorea/openstack/quantum/api/PortsResource.java @@ -1,85 +1,85 @@ -package com.woorea.openstack.quantum.api; - - -import com.woorea.openstack.base.client.Entity; -import com.woorea.openstack.base.client.HttpMethod; -import com.woorea.openstack.base.client.OpenStackClient; -import com.woorea.openstack.base.client.OpenStackRequest; -import com.woorea.openstack.quantum.model.Port; -import com.woorea.openstack.quantum.model.Ports; - -public class PortsResource { - - private final OpenStackClient CLIENT; - - public PortsResource(OpenStackClient client) { - CLIENT = client; - } - - public List list() { - return new List(); - } - - public Create create(Port port){ - return new Create(port); - } - - public Update update(Port port){ - return new Update(port); - } - - public Delete delete(String portId){ - return new Delete(portId); - } - - public Show show(String portId){ - return new Show(portId); - } - - public class List extends OpenStackRequest { - - public List() { - super(CLIENT, HttpMethod.GET, "ports", null, Ports.class); - } - } - - public class Query extends OpenStackRequest { - - public Query(Port port) { - //super(port); -// target = target.path("v2.0").path("ports"); -// target = queryParam(target); -// return target.request(MediaType.APPLICATION_JSON).get(Ports.class); - } - - } - - - public class Create extends OpenStackRequest { - - public Create(Port port){ - super(CLIENT, HttpMethod.POST, "ports", Entity.json(port), Port.class); - } - } - - public class Update extends OpenStackRequest { - - public Update(Port port){ - super(CLIENT, HttpMethod.PUT, buildPath("ports/", port.getId()), Entity.json(port), Port.class); - } - } - - public class Show extends OpenStackRequest { - - public Show(String id) { - super(CLIENT, HttpMethod.GET, buildPath("ports/", id), null, Port.class); - } - } - - public class Delete extends OpenStackRequest { - - public Delete(String id){ - super(CLIENT, HttpMethod.DELETE, buildPath("ports/", id), null, Void.class); - } - } -} +package com.woorea.openstack.quantum.api; + + +import com.woorea.openstack.base.client.Entity; +import com.woorea.openstack.base.client.HttpMethod; +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.base.client.OpenStackRequest; +import com.woorea.openstack.quantum.model.Port; +import com.woorea.openstack.quantum.model.Ports; + +public class PortsResource { + + private final OpenStackClient CLIENT; + + public PortsResource(OpenStackClient client) { + CLIENT = client; + } + + public List list() { + return new List(); + } + + public Create create(Port port){ + return new Create(port); + } + + public Update update(Port port){ + return new Update(port); + } + + public Delete delete(String portId){ + return new Delete(portId); + } + + public Show show(String portId){ + return new Show(portId); + } + + public class List extends OpenStackRequest { + + public List() { + super(CLIENT, HttpMethod.GET, "ports", null, Ports.class); + } + } + + public class Query extends OpenStackRequest { + + public Query(Port port) { + //super(port); +// target = target.path("v2.0").path("ports"); +// target = queryParam(target); +// return target.request(MediaType.APPLICATION_JSON).get(Ports.class); + } + + } + + + public class Create extends OpenStackRequest { + + public Create(Port port){ + super(CLIENT, HttpMethod.POST, "ports", Entity.json(port), Port.class); + } + } + + public class Update extends OpenStackRequest { + + public Update(Port port){ + super(CLIENT, HttpMethod.PUT, buildPath("ports/", port.getId()), Entity.json(port), Port.class); + } + } + + public class Show extends OpenStackRequest { + + public Show(String id) { + super(CLIENT, HttpMethod.GET, buildPath("ports/", id), null, Port.class); + } + } + + public class Delete extends OpenStackRequest { + + public Delete(String id){ + super(CLIENT, HttpMethod.DELETE, buildPath("ports/", id), null, Void.class); + } + } +} diff --git a/quantum-client/src/main/java/com/woorea/openstack/quantum/api/RoutersResource.java b/quantum-client/src/main/java/com/woorea/openstack/quantum/api/RoutersResource.java index bcd646d09..6a1a8a696 100644 --- a/quantum-client/src/main/java/com/woorea/openstack/quantum/api/RoutersResource.java +++ b/quantum-client/src/main/java/com/woorea/openstack/quantum/api/RoutersResource.java @@ -1,102 +1,102 @@ -package com.woorea.openstack.quantum.api; - -import com.woorea.openstack.base.client.Entity; -import com.woorea.openstack.base.client.HttpMethod; -import com.woorea.openstack.base.client.OpenStackClient; -import com.woorea.openstack.base.client.OpenStackRequest; -import com.woorea.openstack.quantum.model.Router; -import com.woorea.openstack.quantum.model.RouterForAddInterface; -import com.woorea.openstack.quantum.model.RouterForCreate; -import com.woorea.openstack.quantum.model.RouterInterface; -import com.woorea.openstack.quantum.model.Routers; - -public class RoutersResource { - - private final OpenStackClient CLIENT; - - public RoutersResource(OpenStackClient client) { - CLIENT = client; - } - - public List list() { - return new List(); - } - - public Create create(RouterForCreate router){ - return new Create(router); - } - - public Delete delete(String netId){ - return new Delete(netId); - } - - public Show show(String netId){ - return new Show(netId); - } - - public class List extends OpenStackRequest { - - public List() { - super(CLIENT, HttpMethod.GET, "routers", null, Routers.class); - } - } - - public class Query extends OpenStackRequest { - - public Query(Router router) { - //super(network); -// target = target.path("v2.0").path("networks"); -// target = queryParam(target); -// return target.request(MediaType.APPLICATION_JSON).get(Networks.class); - } - } - public class Create extends OpenStackRequest { - - public Create(RouterForCreate router){ - super(CLIENT, HttpMethod.POST, "routers", Entity.json(router), Router.class); - } - } - - - - public class Show extends OpenStackRequest { - - public Show(String id) { - super(CLIENT, HttpMethod.GET, buildPath("routers/", id), null, Router.class); - } - } - - public class Delete extends OpenStackRequest { - - public Delete(String id){ - super(CLIENT, HttpMethod.DELETE, buildPath("routers/", id), null, Void.class); - } - } - public Attach addInterface(RouterForAddInterface interfaceToAdd){ - return new Attach(interfaceToAdd); - } - public class Attach extends OpenStackRequest { - - public Attach(RouterForAddInterface interfaceToAdd){ - super(CLIENT, HttpMethod.PUT, buildPath("routers/",interfaceToAdd.getRouterId(),"/add_router_interface"), Entity.json(interfaceToAdd),RouterInterface.class); - } - - } - public Detach deleteInterface(RouterForAddInterface interfaceRouter) { - return new Detach(interfaceRouter); - } - - public class Detach extends OpenStackRequest { - - public Detach(RouterForAddInterface interfaceToAdd) { - super(CLIENT, HttpMethod.PUT, buildPath("routers/", - interfaceToAdd.getRouterId(), "/remove_router_interface"), - Entity.json(interfaceToAdd), RouterInterface.class); - } - - } - - - - -} +package com.woorea.openstack.quantum.api; + +import com.woorea.openstack.base.client.Entity; +import com.woorea.openstack.base.client.HttpMethod; +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.base.client.OpenStackRequest; +import com.woorea.openstack.quantum.model.Router; +import com.woorea.openstack.quantum.model.RouterForAddInterface; +import com.woorea.openstack.quantum.model.RouterForCreate; +import com.woorea.openstack.quantum.model.RouterInterface; +import com.woorea.openstack.quantum.model.Routers; + +public class RoutersResource { + + private final OpenStackClient CLIENT; + + public RoutersResource(OpenStackClient client) { + CLIENT = client; + } + + public List list() { + return new List(); + } + + public Create create(RouterForCreate router){ + return new Create(router); + } + + public Delete delete(String netId){ + return new Delete(netId); + } + + public Show show(String netId){ + return new Show(netId); + } + + public class List extends OpenStackRequest { + + public List() { + super(CLIENT, HttpMethod.GET, "routers", null, Routers.class); + } + } + + public class Query extends OpenStackRequest { + + public Query(Router router) { + //super(network); +// target = target.path("v2.0").path("networks"); +// target = queryParam(target); +// return target.request(MediaType.APPLICATION_JSON).get(Networks.class); + } + } + public class Create extends OpenStackRequest { + + public Create(RouterForCreate router){ + super(CLIENT, HttpMethod.POST, "routers", Entity.json(router), Router.class); + } + } + + + + public class Show extends OpenStackRequest { + + public Show(String id) { + super(CLIENT, HttpMethod.GET, buildPath("routers/", id), null, Router.class); + } + } + + public class Delete extends OpenStackRequest { + + public Delete(String id){ + super(CLIENT, HttpMethod.DELETE, buildPath("routers/", id), null, Void.class); + } + } + public Attach addInterface(RouterForAddInterface interfaceToAdd){ + return new Attach(interfaceToAdd); + } + public class Attach extends OpenStackRequest { + + public Attach(RouterForAddInterface interfaceToAdd){ + super(CLIENT, HttpMethod.PUT, buildPath("routers/",interfaceToAdd.getRouterId(),"/add_router_interface"), Entity.json(interfaceToAdd),RouterInterface.class); + } + + } + public Detach deleteInterface(RouterForAddInterface interfaceRouter) { + return new Detach(interfaceRouter); + } + + public class Detach extends OpenStackRequest { + + public Detach(RouterForAddInterface interfaceToAdd) { + super(CLIENT, HttpMethod.PUT, buildPath("routers/", + interfaceToAdd.getRouterId(), "/remove_router_interface"), + Entity.json(interfaceToAdd), RouterInterface.class); + } + + } + + + + +} diff --git a/quantum-client/src/main/java/com/woorea/openstack/quantum/api/SubnetsResource.java b/quantum-client/src/main/java/com/woorea/openstack/quantum/api/SubnetsResource.java index 1864604b2..e8d976178 100644 --- a/quantum-client/src/main/java/com/woorea/openstack/quantum/api/SubnetsResource.java +++ b/quantum-client/src/main/java/com/woorea/openstack/quantum/api/SubnetsResource.java @@ -1,84 +1,84 @@ -package com.woorea.openstack.quantum.api; - - -import com.woorea.openstack.base.client.Entity; -import com.woorea.openstack.base.client.HttpMethod; -import com.woorea.openstack.base.client.OpenStackClient; -import com.woorea.openstack.base.client.OpenStackRequest; -import com.woorea.openstack.quantum.model.Subnet; -import com.woorea.openstack.quantum.model.Subnets; - -public class SubnetsResource { - - private final OpenStackClient CLIENT; - - public SubnetsResource(OpenStackClient client) { - CLIENT = client; - } - - public List list() { - return new List(); - } - - public Create create(Subnet net) { - return new Create(net); - } - - public Update update(Subnet net) { - return new Update(net); - } - - public Delete delete(String netId){ - return new Delete(netId); - } - - public Show show(String netId){ - return new Show(netId); - } - - public class List extends OpenStackRequest { - - public List() { - super(CLIENT, HttpMethod.GET, "subnets", null, Subnets.class); - } - } - - public class Query extends OpenStackRequest { - - public Query(Subnet subnet) { - //super(subnet); -// target = target.path("v2.0").path("subnets"); -// target = queryParam(target); -// return target.request(MediaType.APPLICATION_JSON).get(Subnets.class); - } - } - - - public class Create extends OpenStackRequest { - - public Create(Subnet subnet) { - super(CLIENT, HttpMethod.POST, "subnets", Entity.json(subnet), Subnet.class); - } - } - - public class Update extends OpenStackRequest { - - public Update(Subnet subnet) { - super(CLIENT, HttpMethod.PUT, buildPath("subnets/", subnet.getId()), Entity.json(subnet), Subnet.class); - } - } - - public class Show extends OpenStackRequest { - - public Show(String id) { - super(CLIENT, HttpMethod.GET, buildPath("subnets/", id), null, Subnet.class); - } - } - - public class Delete extends OpenStackRequest { - - public Delete(String id){ - super(CLIENT, HttpMethod.DELETE, buildPath("subnets/", id), null, Void.class); - } - } -} +package com.woorea.openstack.quantum.api; + + +import com.woorea.openstack.base.client.Entity; +import com.woorea.openstack.base.client.HttpMethod; +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.base.client.OpenStackRequest; +import com.woorea.openstack.quantum.model.Subnet; +import com.woorea.openstack.quantum.model.Subnets; + +public class SubnetsResource { + + private final OpenStackClient CLIENT; + + public SubnetsResource(OpenStackClient client) { + CLIENT = client; + } + + public List list() { + return new List(); + } + + public Create create(Subnet net) { + return new Create(net); + } + + public Update update(Subnet net) { + return new Update(net); + } + + public Delete delete(String netId){ + return new Delete(netId); + } + + public Show show(String netId){ + return new Show(netId); + } + + public class List extends OpenStackRequest { + + public List() { + super(CLIENT, HttpMethod.GET, "subnets", null, Subnets.class); + } + } + + public class Query extends OpenStackRequest { + + public Query(Subnet subnet) { + //super(subnet); +// target = target.path("v2.0").path("subnets"); +// target = queryParam(target); +// return target.request(MediaType.APPLICATION_JSON).get(Subnets.class); + } + } + + + public class Create extends OpenStackRequest { + + public Create(Subnet subnet) { + super(CLIENT, HttpMethod.POST, "subnets", Entity.json(subnet), Subnet.class); + } + } + + public class Update extends OpenStackRequest { + + public Update(Subnet subnet) { + super(CLIENT, HttpMethod.PUT, buildPath("subnets/", subnet.getId()), Entity.json(subnet), Subnet.class); + } + } + + public class Show extends OpenStackRequest { + + public Show(String id) { + super(CLIENT, HttpMethod.GET, buildPath("subnets/", id), null, Subnet.class); + } + } + + public class Delete extends OpenStackRequest { + + public Delete(String id){ + super(CLIENT, HttpMethod.DELETE, buildPath("subnets/", id), null, Void.class); + } + } +} diff --git a/quantum-model/pom.xml b/quantum-model/pom.xml index c03038e8f..6c32c61a2 100644 --- a/quantum-model/pom.xml +++ b/quantum-model/pom.xml @@ -1,19 +1,19 @@ - - 4.0.0 - - com.woorea - openstack-java-sdk - 3.2.2-SNAPSHOT - - quantum-model - OpenStack Quantum Model - OpenStack Quantum Model - - - junit - junit - 4.10 - test - - - + + 4.0.0 + + com.woorea + openstack-java-sdk + 3.2.2-SNAPSHOT + + quantum-model + OpenStack Quantum Model + OpenStack Quantum Model + + + junit + junit + 4.10 + test + + + diff --git a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/HostRoute.java b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/HostRoute.java index 979add34b..4b6fc37af 100644 --- a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/HostRoute.java +++ b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/HostRoute.java @@ -1,27 +1,27 @@ -package com.woorea.openstack.quantum.model; - -import java.io.Serializable; - -public class HostRoute implements Serializable { - - private String destination; - private String nexthop; - - public String getDestination() { - return destination; - } - public void setDestination(String destination) { - this.destination = destination; - } - - public String getNexthop() { - return nexthop; - } - public void setNexthop(String nexthop) { - this.nexthop = nexthop; - } - - @Override public String toString() { - return "[destination=" + destination + ", nexthop=" + nexthop + "]"; - } -} +package com.woorea.openstack.quantum.model; + +import java.io.Serializable; + +public class HostRoute implements Serializable { + + private String destination; + private String nexthop; + + public String getDestination() { + return destination; + } + public void setDestination(String destination) { + this.destination = destination; + } + + public String getNexthop() { + return nexthop; + } + public void setNexthop(String nexthop) { + this.nexthop = nexthop; + } + + @Override public String toString() { + return "[destination=" + destination + ", nexthop=" + nexthop + "]"; + } +} diff --git a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Pool.java b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Pool.java index d25bafe8e..26a6a2730 100644 --- a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Pool.java +++ b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Pool.java @@ -1,40 +1,40 @@ -package com.woorea.openstack.quantum.model; - -import java.io.Serializable; - -public class Pool implements Serializable{ - - private String start; - private String end; - - /** - * @return the start - */ - public String getStart() { - return start; - } - /** - * @param start the start to set - */ - public void setStart(String start) { - this.start = start; - } - /** - * @return the end - */ - public String getEnd() { - return end; - } - /** - * @param end the end to set - */ - public void setEnd(String end) { - this.end = end; - } - - @Override - public String toString() { - return "Allocation_pool [start=" + start + ", end=" + end + "]"; - } - -} +package com.woorea.openstack.quantum.model; + +import java.io.Serializable; + +public class Pool implements Serializable{ + + private String start; + private String end; + + /** + * @return the start + */ + public String getStart() { + return start; + } + /** + * @param start the start to set + */ + public void setStart(String start) { + this.start = start; + } + /** + * @return the end + */ + public String getEnd() { + return end; + } + /** + * @param end the end to set + */ + public void setEnd(String end) { + this.end = end; + } + + @Override + public String toString() { + return "Allocation_pool [start=" + start + ", end=" + end + "]"; + } + +} diff --git a/swift-client/.gitignore b/swift-client/.gitignore new file mode 100644 index 000000000..ea8c4bf7f --- /dev/null +++ b/swift-client/.gitignore @@ -0,0 +1 @@ +/target diff --git a/swift-client/pom.xml b/swift-client/pom.xml index c0aafe7c1..ae5936e34 100644 --- a/swift-client/pom.xml +++ b/swift-client/pom.xml @@ -1,23 +1,23 @@ - - 4.0.0 - - com.woorea - openstack-java-sdk - 3.2.2-SNAPSHOT - - swift-client - OpenStack Swift Client - OpenStack Swift Client - - - com.woorea - openstack-client - 3.2.2-SNAPSHOT - - - com.woorea - swift-model - 3.2.2-SNAPSHOT - - + + 4.0.0 + + com.woorea + openstack-java-sdk + 3.2.2-SNAPSHOT + + swift-client + OpenStack Swift Client + OpenStack Swift Client + + + com.woorea + openstack-client + 3.2.2-SNAPSHOT + + + com.woorea + swift-model + 3.2.2-SNAPSHOT + + \ No newline at end of file diff --git a/swift-client/src/main/java/com/woorea/openstack/swift/Swift.java b/swift-client/src/main/java/com/woorea/openstack/swift/Swift.java index 0629853b8..3f9111522 100644 --- a/swift-client/src/main/java/com/woorea/openstack/swift/Swift.java +++ b/swift-client/src/main/java/com/woorea/openstack/swift/Swift.java @@ -1,33 +1,33 @@ -package com.woorea.openstack.swift; - - -import com.woorea.openstack.base.client.OpenStackClient; -import com.woorea.openstack.base.client.OpenStackClientConnector; -import com.woorea.openstack.swift.api.AccountResource; -import com.woorea.openstack.swift.api.ContainersResource; - -public class Swift extends OpenStackClient { - - private final AccountResource ACCOUNT; - - private final ContainersResource CONTAINERS; - - public Swift(String endpoint, OpenStackClientConnector connector) { - super(endpoint, connector); - CONTAINERS = new ContainersResource(this); - ACCOUNT = new AccountResource(this); - } - - public Swift(String endpoint) { - this(endpoint, null); - } - - public ContainersResource containers() { - return CONTAINERS; - } - - public AccountResource account() { - return ACCOUNT; - } - -} +package com.woorea.openstack.swift; + + +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.base.client.OpenStackClientConnector; +import com.woorea.openstack.swift.api.AccountResource; +import com.woorea.openstack.swift.api.ContainersResource; + +public class Swift extends OpenStackClient { + + private final AccountResource ACCOUNT; + + private final ContainersResource CONTAINERS; + + public Swift(String endpoint, OpenStackClientConnector connector) { + super(endpoint, connector); + CONTAINERS = new ContainersResource(this); + ACCOUNT = new AccountResource(this); + } + + public Swift(String endpoint) { + this(endpoint, null); + } + + public ContainersResource containers() { + return CONTAINERS; + } + + public AccountResource account() { + return ACCOUNT; + } + +} diff --git a/swift-model/.gitignore b/swift-model/.gitignore new file mode 100644 index 000000000..19f2e002c --- /dev/null +++ b/swift-model/.gitignore @@ -0,0 +1,2 @@ +/target +/target diff --git a/swift-model/pom.xml b/swift-model/pom.xml index ebf618b56..2d9c00d2e 100644 --- a/swift-model/pom.xml +++ b/swift-model/pom.xml @@ -1,11 +1,11 @@ - - 4.0.0 - - com.woorea - openstack-java-sdk - 3.2.2-SNAPSHOT - - swift-model - OpenStack Swift Model - OpenStack Swift Model + + 4.0.0 + + com.woorea + openstack-java-sdk + 3.2.2-SNAPSHOT + + swift-model + OpenStack Swift Model + OpenStack Swift Model \ No newline at end of file diff --git a/swift-model/src/main/java/com/woorea/openstack/swift/deserializer/ContainersDeserializer.java b/swift-model/src/main/java/com/woorea/openstack/swift/deserializer/ContainersDeserializer.java new file mode 100644 index 000000000..cf30333f5 --- /dev/null +++ b/swift-model/src/main/java/com/woorea/openstack/swift/deserializer/ContainersDeserializer.java @@ -0,0 +1,21 @@ +package com.woorea.openstack.swift.deserializer; + +import java.io.IOException; + +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonDeserializer; +import com.woorea.openstack.swift.model.Container; +import com.woorea.openstack.swift.model.Containers; + +public class ContainersDeserializer extends JsonDeserializer { + + @Override + public Containers deserialize(JsonParser jp, DeserializationContext ctxt) + throws IOException, JsonProcessingException { + Container[] containersArray = jp.readValueAs(Container[].class); + return new Containers(containersArray); + } + +} diff --git a/swift-model/src/main/java/com/woorea/openstack/swift/deserializer/ObjectsDeserializer.java b/swift-model/src/main/java/com/woorea/openstack/swift/deserializer/ObjectsDeserializer.java new file mode 100644 index 000000000..43b12df64 --- /dev/null +++ b/swift-model/src/main/java/com/woorea/openstack/swift/deserializer/ObjectsDeserializer.java @@ -0,0 +1,20 @@ +package com.woorea.openstack.swift.deserializer; + +import java.io.IOException; + +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonDeserializer; +import com.woorea.openstack.swift.model.Objects; + +public class ObjectsDeserializer extends JsonDeserializer { + + @Override + public Objects deserialize(JsonParser jp, DeserializationContext ctxt) + throws IOException, JsonProcessingException { + com.woorea.openstack.swift.model.Object[] containersArray = jp.readValueAs(com.woorea.openstack.swift.model.Object[].class); + return new Objects(containersArray); + } + +} diff --git a/swift-model/src/main/java/com/woorea/openstack/swift/model/Containers.java b/swift-model/src/main/java/com/woorea/openstack/swift/model/Containers.java new file mode 100644 index 000000000..a5825e8c7 --- /dev/null +++ b/swift-model/src/main/java/com/woorea/openstack/swift/model/Containers.java @@ -0,0 +1,48 @@ +package com.woorea.openstack.swift.model; + +import java.io.Serializable; +import java.util.Arrays; +import java.util.Iterator; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.woorea.openstack.swift.deserializer.ContainersDeserializer; + +@JsonDeserialize(using = ContainersDeserializer.class) +public class Containers implements Iterable, Serializable { + + /** + * + */ + private static final long serialVersionUID = 1L; + @JsonProperty("containers") + private List list; + + public Containers(Container[] containersArray) { + list = Arrays.asList(containersArray); + } + + /** + * @return the list + */ + public List getList() { + return list; + } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Containers [list=" + list + "]"; + } + + @Override + public Iterator iterator() { + return list.iterator(); + } + +} diff --git a/swift-model/src/main/java/com/woorea/openstack/swift/model/Objects.java b/swift-model/src/main/java/com/woorea/openstack/swift/model/Objects.java new file mode 100644 index 000000000..758ba9598 --- /dev/null +++ b/swift-model/src/main/java/com/woorea/openstack/swift/model/Objects.java @@ -0,0 +1,48 @@ +package com.woorea.openstack.swift.model; + +import java.io.Serializable; +import java.util.Arrays; +import java.util.Iterator; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.woorea.openstack.swift.deserializer.ObjectsDeserializer; + +@JsonDeserialize(using = ObjectsDeserializer.class) +public class Objects implements Iterable, Serializable { + + /** + * + */ + private static final long serialVersionUID = 1L; + @JsonProperty("objects") + private List list; + + public Objects(com.woorea.openstack.swift.model.Object[] objectsArray) { + list = Arrays.asList(objectsArray); + } + + /** + * @return the list + */ + public List getList() { + return list; + } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "Objects [list=" + list + "]"; + } + + @Override + public Iterator iterator() { + return list.iterator(); + } + +} From 35ddb928ada5954be09de4774e0d58aba601d304 Mon Sep 17 00:00:00 2001 From: Daniele Date: Sat, 15 Mar 2014 13:54:46 +0100 Subject: [PATCH 3/6] complete refactoring and successfully tested with JBoss EAP 6.2.0.GA (AS 7.3.0.Final-redhat-14) and Jackson 2.3.1 --- .../woorea/openstack/keystone/model/User.java | 282 +++++++++--------- .../resteasy-connector/pom.xml | 62 ++-- .../connector/RESTEasyConnector.java | 2 +- 3 files changed, 177 insertions(+), 169 deletions(-) diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/User.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/User.java index 47f32a124..9cf853b67 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/User.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/User.java @@ -2,145 +2,145 @@ import java.io.Serializable; +import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; - - -@JsonRootName("user") -public class User implements Serializable { - private String id; - private String username; - private String OS_KSADM_password; - private String password; - private String tenantId; - private String name; - private String email; - - //@JsonProperty("extra") - private Extra extra; - private Boolean enabled; - - /** - * @return the id - */ - public String getId() { - return id; - } - - /** - * @param id the id to set - */ - public void setId(String id) { - this.id = id; - } - - /** - * @return the username - */ - public String getUsername() { - return username; - } - - /** - * @param username the username to set - */ - public void setUsername(String username) { - this.username = username; - } - - /** - * @return the password - */ - public String getPassword() { - return password; - } - - /** - * @param password the password to set - */ - public void setPassword(String password) { - this.password = password; - } - - /** - * @return the tenantId - */ - public String getTenantId() { - return tenantId; - } - - /** - * @param tenantId the tenantId to set - */ - public void setTenantId(String tenantId) { - this.tenantId = tenantId; - } - - /** - * @return the name - */ - public String getName() { - return name; - } - - /** - * @param name the name to set - */ - public void setName(String name) { - this.name = name; - } - - /** - * @return the email - */ - public String getEmail() { - return email; - } - - /** - * @param email the email to set - */ - public void setEmail(String email) { - this.email = email; - } - - /** - * @return the enabled - */ - public Boolean getEnabled() { - return enabled; - } - - /** - * @param enabled the enabled to set - */ - public void setEnabled(Boolean enabled) { - this.enabled = enabled; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "User [id=" + id + ", username=" + username + ", password=" + - password + ", tenantId=" + tenantId + ", name=" + name + ", email=" + - email + ", enabled=" + enabled + - ((extra != null) ? (", " + extra.toString()) : "") + "]"; - } - - public String getOS_KSADM_password() { - return password; - } - - public void setOS_KSADM_password(String oS_KSADM_password) { - password = oS_KSADM_password; - } - - public Extra getExtra() { - return extra; - } - - public void setExtra(Extra extra) { - this.extra = extra; - } -} + +@JsonRootName("user") +public class User implements Serializable { + + private String id; + + private String username; + + @JsonProperty("OS_KSADM_password") + private String password; + + private String tenantId; + + private String name; + + private String email; + + @JsonProperty("extra") + private Extra extra; + + private Boolean enabled; + + /** + * @return the id + */ + public String getId() { + return id; + } + + /** + * @param id the id to set + */ + public void setId(String id) { + this.id = id; + } + + /** + * @return the username + */ + public String getUsername() { + return username; + } + + /** + * @param username the username to set + */ + public void setUsername(String username) { + this.username = username; + } + + /** + * @return the password + */ + public String getPassword() { + return password; + } + + /** + * @param password the password to set + */ + public void setPassword(String password) { + this.password = password; + } + + /** + * @return the tenantId + */ + public String getTenantId() { + return tenantId; + } + + /** + * @param tenantId the tenantId to set + */ + public void setTenantId(String tenantId) { + this.tenantId = tenantId; + } + + /** + * @return the name + */ + public String getName() { + return name; + } + + /** + * @param name the name to set + */ + public void setName(String name) { + this.name = name; + } + + /** + * @return the email + */ + public String getEmail() { + return email; + } + + /** + * @param email the email to set + */ + public void setEmail(String email) { + this.email = email; + } + + /** + * @return the enabled + */ + public Boolean getEnabled() { + return enabled; + } + + /** + * @param enabled the enabled to set + */ + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } + + public Extra getExtra() { + return extra; + } + + public void setExtra(Extra extra) { + this.extra = extra; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "User [id=" + id + ", username=" + username + ", password=" + + password + ", tenantId=" + tenantId + ", name=" + name + + ", email=" + email + ", enabled=" + enabled + "]"; + } + +} + diff --git a/openstack-client-connectors/resteasy-connector/pom.xml b/openstack-client-connectors/resteasy-connector/pom.xml index 366cad0df..ac7296947 100644 --- a/openstack-client-connectors/resteasy-connector/pom.xml +++ b/openstack-client-connectors/resteasy-connector/pom.xml @@ -1,28 +1,36 @@ - - 4.0.0 - - com.woorea - openstack-client-connectors - 3.2.2-SNAPSHOT - - resteasy-connector - OpenStack RESTEasy Connector - OpenStack RESTEasy Connector - - - org.jboss.resteasy - resteasy-jaxrs - 2.3.2.Final - - - org.codehaus.jackson - jackson-jaxrs - 1.9.4 - - - commons-httpclient - commons-httpclient - 3.1 - - + + 4.0.0 + + com.woorea + openstack-client-connectors + 3.2.2-SNAPSHOT + + resteasy-connector + OpenStack RESTEasy Connector + OpenStack RESTEasy Connector + + + org.jboss.resteasy + resteasy-jackson2-provider + 3.0.2.Final + + + org.jboss.resteasy + resteasy-jaxrs + 2.3.6.Final + + + + commons-httpclient + commons-httpclient + 3.1 + + \ No newline at end of file diff --git a/openstack-client-connectors/resteasy-connector/src/main/java/com/woorea/openstack/connector/RESTEasyConnector.java b/openstack-client-connectors/resteasy-connector/src/main/java/com/woorea/openstack/connector/RESTEasyConnector.java index 625bb87dd..ca0567b16 100644 --- a/openstack-client-connectors/resteasy-connector/src/main/java/com/woorea/openstack/connector/RESTEasyConnector.java +++ b/openstack-client-connectors/resteasy-connector/src/main/java/com/woorea/openstack/connector/RESTEasyConnector.java @@ -8,7 +8,6 @@ import javax.ws.rs.ext.ContextResolver; import org.apache.commons.httpclient.HttpStatus; -import org.codehaus.jackson.jaxrs.JacksonJsonProvider; import org.jboss.resteasy.client.ClientRequest; import org.jboss.resteasy.client.ClientResponse; import org.jboss.resteasy.plugins.providers.InputStreamProvider; @@ -19,6 +18,7 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; +import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider; import com.woorea.openstack.base.client.OpenStackClientConnector; import com.woorea.openstack.base.client.OpenStackRequest; import com.woorea.openstack.base.client.OpenStackResponse; From b3453ff182bf3618687f3e60dd02ea26afcec6c8 Mon Sep 17 00:00:00 2001 From: Daniele Date: Tue, 18 Mar 2014 22:46:18 +0100 Subject: [PATCH 4/6] fixed --- .../openstack/connector/RESTEasyConnector.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/openstack-client-connectors/resteasy-connector/src/main/java/com/woorea/openstack/connector/RESTEasyConnector.java b/openstack-client-connectors/resteasy-connector/src/main/java/com/woorea/openstack/connector/RESTEasyConnector.java index ca0567b16..43d56d4ab 100644 --- a/openstack-client-connectors/resteasy-connector/src/main/java/com/woorea/openstack/connector/RESTEasyConnector.java +++ b/openstack-client-connectors/resteasy-connector/src/main/java/com/woorea/openstack/connector/RESTEasyConnector.java @@ -4,6 +4,7 @@ import java.util.Map; import java.util.Map.Entry; +import javax.ws.rs.core.MediaType; import javax.ws.rs.core.UriBuilder; import javax.ws.rs.ext.ContextResolver; @@ -11,13 +12,16 @@ import org.jboss.resteasy.client.ClientRequest; import org.jboss.resteasy.client.ClientResponse; import org.jboss.resteasy.plugins.providers.InputStreamProvider; +import org.jboss.resteasy.plugins.providers.jackson.ResteasyJackson2Provider; import org.jboss.resteasy.spi.ResteasyProviderFactory; import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonRootName; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.ObjectReader; import com.fasterxml.jackson.databind.SerializationFeature; +import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider; import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider; import com.woorea.openstack.base.client.OpenStackClientConnector; import com.woorea.openstack.base.client.OpenStackRequest; @@ -29,22 +33,21 @@ public class RESTEasyConnector implements OpenStackClientConnector { public static ObjectMapper DEFAULT_MAPPER; public static ObjectMapper WRAPPED_MAPPER; - + static class OpenStackProviderFactory extends ResteasyProviderFactory { - private JacksonJsonProvider jsonProvider; + private JacksonJaxbJsonProvider jsonProvider; private InputStreamProvider streamProvider; public OpenStackProviderFactory() { super(); - addContextResolver(new ContextResolver() { public ObjectMapper getContext(Class type) { - return type.getAnnotation(JsonRootName.class) == null ? DEFAULT_MAPPER : WRAPPED_MAPPER; + return type.getAnnotation(JsonRootName.class) == null ? DEFAULT_MAPPER : WRAPPED_MAPPER; } }); + jsonProvider = new ResteasyJackson2Provider(); - jsonProvider = new JacksonJsonProvider(); addMessageBodyReader(jsonProvider); addMessageBodyWriter(jsonProvider); @@ -73,7 +76,7 @@ public ObjectMapper getContext(Class type) { WRAPPED_MAPPER.enable(DeserializationFeature.UNWRAP_ROOT_VALUE); WRAPPED_MAPPER.enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); WRAPPED_MAPPER.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES); - + providerFactory = new OpenStackProviderFactory(); } From 8a4c264725c156f2ed0a90d1ff51e6d174390223 Mon Sep 17 00:00:00 2001 From: Daniele Date: Tue, 18 Mar 2014 23:34:35 +0100 Subject: [PATCH 5/6] Workaround to use the same class in both situations... --- .../woorea/openstack/keystone/model/User.java | 281 +++++++++--------- 1 file changed, 141 insertions(+), 140 deletions(-) diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/User.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/User.java index 9cf853b67..86f8a019b 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/User.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/User.java @@ -4,143 +4,144 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; - -@JsonRootName("user") -public class User implements Serializable { - - private String id; - - private String username; - - @JsonProperty("OS_KSADM_password") - private String password; - - private String tenantId; - - private String name; - - private String email; - - @JsonProperty("extra") - private Extra extra; - - private Boolean enabled; - - /** - * @return the id - */ - public String getId() { - return id; - } - - /** - * @param id the id to set - */ - public void setId(String id) { - this.id = id; - } - - /** - * @return the username - */ - public String getUsername() { - return username; - } - - /** - * @param username the username to set - */ - public void setUsername(String username) { - this.username = username; - } - - /** - * @return the password - */ - public String getPassword() { - return password; - } - - /** - * @param password the password to set - */ - public void setPassword(String password) { - this.password = password; - } - - /** - * @return the tenantId - */ - public String getTenantId() { - return tenantId; - } - - /** - * @param tenantId the tenantId to set - */ - public void setTenantId(String tenantId) { - this.tenantId = tenantId; - } - - /** - * @return the name - */ - public String getName() { - return name; - } - - /** - * @param name the name to set - */ - public void setName(String name) { - this.name = name; - } - - /** - * @return the email - */ - public String getEmail() { - return email; - } - - /** - * @param email the email to set - */ - public void setEmail(String email) { - this.email = email; - } - - /** - * @return the enabled - */ - public Boolean getEnabled() { - return enabled; - } - - /** - * @param enabled the enabled to set - */ - public void setEnabled(Boolean enabled) { - this.enabled = enabled; - } - - public Extra getExtra() { - return extra; - } - - public void setExtra(Extra extra) { - this.extra = extra; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "User [id=" + id + ", username=" + username + ", password=" - + password + ", tenantId=" + tenantId + ", name=" + name - + ", email=" + email + ", enabled=" + enabled + "]"; - } - -} - + + +@JsonRootName("user") +public class User implements Serializable { + private String id; + private String username; + private String OS_KSADM_password; + private String password; + private String tenantId; + private String name; + private String email; + + @JsonProperty("extra") + private Extra extra; + private Boolean enabled; + + /** + * @return the id + */ + public String getId() { + return id; + } + + /** + * @param id the id to set + */ + public void setId(String id) { + this.id = id; + } + + /** + * @return the username + */ + public String getUsername() { + return username; + } + + /** + * @param username the username to set + */ + public void setUsername(String username) { + this.username = username; + } + + /** + * @return the password + */ + public String getPassword() { + return password; + } + + /** + * @param password the password to set + */ + public void setPassword(String password) { + this.password = password; + } + + /** + * @return the tenantId + */ + public String getTenantId() { + return tenantId; + } + + /** + * @param tenantId the tenantId to set + */ + public void setTenantId(String tenantId) { + this.tenantId = tenantId; + } + + /** + * @return the name + */ + public String getName() { + return name; + } + + /** + * @param name the name to set + */ + public void setName(String name) { + this.name = name; + } + + /** + * @return the email + */ + public String getEmail() { + return email; + } + + /** + * @param email the email to set + */ + public void setEmail(String email) { + this.email = email; + } + + /** + * @return the enabled + */ + public Boolean getEnabled() { + return enabled; + } + + /** + * @param enabled the enabled to set + */ + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "User [id=" + id + ", username=" + username + ", password=" + + password + ", tenantId=" + tenantId + ", name=" + name + ", email=" + + email + ", enabled=" + enabled + + ((extra != null) ? (", " + extra.toString()) : "") + "]"; + } + + public String getOS_KSADM_password() { + return password; + } + + public void setOS_KSADM_password(String oS_KSADM_password) { + password = oS_KSADM_password; + } + + public Extra getExtra() { + return extra; + } + + public void setExtra(Extra extra) { + this.extra = extra; + } +} From d8197a3b7d5ae44d85b1525c066a1206f1407d51 Mon Sep 17 00:00:00 2001 From: Daniele Date: Tue, 8 Apr 2014 19:07:17 +0200 Subject: [PATCH 6/6] fixes for javafx client --- .../connector/RESTEasyConnector.java | 28 +++++++++++++++++-- .../openstack/connector/RESTEasyResponse.java | 3 +- .../swift/api/ContainerResource.java | 2 +- 3 files changed, 28 insertions(+), 5 deletions(-) diff --git a/openstack-client-connectors/resteasy-connector/src/main/java/com/woorea/openstack/connector/RESTEasyConnector.java b/openstack-client-connectors/resteasy-connector/src/main/java/com/woorea/openstack/connector/RESTEasyConnector.java index 43d56d4ab..821fda472 100644 --- a/openstack-client-connectors/resteasy-connector/src/main/java/com/woorea/openstack/connector/RESTEasyConnector.java +++ b/openstack-client-connectors/resteasy-connector/src/main/java/com/woorea/openstack/connector/RESTEasyConnector.java @@ -9,6 +9,7 @@ import javax.ws.rs.ext.ContextResolver; import org.apache.commons.httpclient.HttpStatus; +import org.jboss.resteasy.client.ClientExecutor; import org.jboss.resteasy.client.ClientRequest; import org.jboss.resteasy.client.ClientResponse; import org.jboss.resteasy.plugins.providers.InputStreamProvider; @@ -34,11 +35,26 @@ public class RESTEasyConnector implements OpenStackClientConnector { public static ObjectMapper WRAPPED_MAPPER; - static class OpenStackProviderFactory extends ResteasyProviderFactory { + public static ClientExecutor clientExecutor = ClientRequest.getDefaultExecutor(); + + public RESTEasyConnector() {} + + public RESTEasyConnector(ClientExecutor ce) { + clientExecutor = ce; + } + + public static class OpenStackProviderFactory extends ResteasyProviderFactory { private JacksonJaxbJsonProvider jsonProvider; private InputStreamProvider streamProvider; + + public OpenStackProviderFactory(ClientExecutor ce) { + this(); + clientExecutor=ce; + } + + public OpenStackProviderFactory() { super(); addContextResolver(new ContextResolver() { @@ -55,7 +71,6 @@ public ObjectMapper getContext(Class type) { addMessageBodyReader(streamProvider); addMessageBodyWriter(streamProvider); } - } private static OpenStackProviderFactory providerFactory; @@ -81,8 +96,11 @@ public ObjectMapper getContext(Class type) { } public OpenStackResponse request(OpenStackRequest request) { + + //executor!! ApacheHttpClient4Executor + ClientRequest client = new ClientRequest(UriBuilder.fromUri(request.endpoint() + "/" + request.path()), - ClientRequest.getDefaultExecutor(), providerFactory); + clientExecutor, providerFactory); for(Map.Entry > entry : request.queryParams().entrySet()) { for (Object o : entry.getValue()) { @@ -123,4 +141,8 @@ public OpenStackResponse request(OpenStackRequest request) { .getReasonPhrase(), response.getStatus()); } + public static OpenStackProviderFactory getProviderFactory() { + return providerFactory; + } + } diff --git a/openstack-client-connectors/resteasy-connector/src/main/java/com/woorea/openstack/connector/RESTEasyResponse.java b/openstack-client-connectors/resteasy-connector/src/main/java/com/woorea/openstack/connector/RESTEasyResponse.java index ca8fe937c..d5e1f0565 100644 --- a/openstack-client-connectors/resteasy-connector/src/main/java/com/woorea/openstack/connector/RESTEasyResponse.java +++ b/openstack-client-connectors/resteasy-connector/src/main/java/com/woorea/openstack/connector/RESTEasyResponse.java @@ -22,7 +22,8 @@ public RESTEasyResponse(ClientRequest client, ClientResponse response) { this.response = response; } - @Override + @SuppressWarnings("unchecked") + @Override public T getEntity(Class returnType) { return (T) response.getEntity(returnType); } diff --git a/swift-client/src/main/java/com/woorea/openstack/swift/api/ContainerResource.java b/swift-client/src/main/java/com/woorea/openstack/swift/api/ContainerResource.java index df15d8b1a..c371b14d0 100644 --- a/swift-client/src/main/java/com/woorea/openstack/swift/api/ContainerResource.java +++ b/swift-client/src/main/java/com/woorea/openstack/swift/api/ContainerResource.java @@ -48,7 +48,7 @@ public Delete delete(String path) { public class List extends OpenStackRequest { public List(String containerName, Map filters) { - super(CLIENT, HttpMethod.GET, "/" + container + "/", null, + super(CLIENT, HttpMethod.GET, container + "/", null, Objects.class); } }