You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jclouds.apache.org by ab...@apache.org on 2013/05/10 23:53:15 UTC
[06/18] JCLOUDS-25. Remove oprhaned sandbox-* from repo
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/23d9d901/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/suppliers/IBMSmartCloudLocationSupplier.java
----------------------------------------------------------------------
diff --git a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/suppliers/IBMSmartCloudLocationSupplier.java b/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/suppliers/IBMSmartCloudLocationSupplier.java
deleted file mode 100644
index cac22bc..0000000
--- a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/compute/suppliers/IBMSmartCloudLocationSupplier.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.jclouds.ibm.smartcloud.compute.suppliers;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.net.URI;
-import java.util.Map;
-import java.util.Set;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import org.jclouds.domain.Location;
-import org.jclouds.domain.LocationBuilder;
-import org.jclouds.domain.LocationScope;
-import org.jclouds.ibm.smartcloud.IBMSmartCloudClient;
-import org.jclouds.ibm.smartcloud.domain.Location.State;
-import org.jclouds.location.Iso3166;
-import org.jclouds.location.Provider;
-import org.jclouds.location.suppliers.JustProvider;
-
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.ImmutableSet.Builder;
-
-/**
- *
- * @author Adrian Cole
- */
-@Singleton
-public class IBMSmartCloudLocationSupplier extends JustProvider {
-
- private final IBMSmartCloudClient sync;
- private final Map<String, Set<String>> isoCodesById;
-
- @Inject
- IBMSmartCloudLocationSupplier(@Iso3166 Set<String> isoCodes, @Provider String providerName, @Provider URI endpoint,
- IBMSmartCloudClient sync, @Iso3166 Map<String, Set<String>> isoCodesById) {
- super(isoCodes, providerName, endpoint);
- this.sync = checkNotNull(sync, "sync");
- this.isoCodesById = checkNotNull(isoCodesById, "isoCodesById");
- }
-
- @Override
- public Set<? extends Location> get() {
- Builder<Location> locations = ImmutableSet.builder();
- Set<? extends org.jclouds.ibm.smartcloud.domain.Location> list = sync.listLocations();
- Location provider = Iterables.getOnlyElement(super.get());
- if (list.size() == 0)
- locations.add(provider);
- else
- for (org.jclouds.ibm.smartcloud.domain.Location from : list) {
- if (from.getState() != State.OFFLINE) {
- LocationBuilder builder = new LocationBuilder().scope(LocationScope.ZONE).id(from.getId() + "")
- .description(from.getName()).parent(provider);
- if (isoCodesById.containsKey(from.getId() + ""))
- builder.iso3166Codes(isoCodesById.get(from.getId() + ""));
- locations.add(builder.build());
- }
- }
- return locations.build();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/23d9d901/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/config/IBMSmartCloudParserModule.java
----------------------------------------------------------------------
diff --git a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/config/IBMSmartCloudParserModule.java b/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/config/IBMSmartCloudParserModule.java
deleted file mode 100644
index 4c318fe..0000000
--- a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/config/IBMSmartCloudParserModule.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.jclouds.ibm.smartcloud.config;
-
-import java.lang.reflect.Type;
-import java.net.URI;
-import java.util.Map;
-
-import javax.inject.Singleton;
-
-import org.jclouds.http.HttpUtils;
-import org.jclouds.json.config.GsonModule.DateAdapter;
-import org.jclouds.json.config.GsonModule.LongDateAdapter;
-
-import com.google.common.collect.ImmutableMap;
-import com.google.gson.JsonDeserializationContext;
-import com.google.gson.JsonDeserializer;
-import com.google.gson.JsonElement;
-import com.google.gson.JsonParseException;
-import com.google.inject.AbstractModule;
-import com.google.inject.Provides;
-
-/**
- *
- *
- * @author Adrian Cole
- */
-public class IBMSmartCloudParserModule extends AbstractModule {
- @Singleton
- public static class CurlyBraceCapableURIAdapter implements JsonDeserializer<URI> {
- @Override
- public URI deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext context)
- throws JsonParseException {
- String toParse = jsonElement.getAsJsonPrimitive().getAsString();
- URI toReturn = HttpUtils.createUri(toParse);
- return toReturn;
- }
- }
-
- @Provides
- @Singleton
- public Map<Type, Object> provideCustomAdapterBindings(CurlyBraceCapableURIAdapter adapter) {
- return ImmutableMap.<Type, Object> of(URI.class, adapter);
- }
-
- @Override
- protected void configure() {
- bind(DateAdapter.class).to(LongDateAdapter.class);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/23d9d901/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/config/IBMSmartCloudRestClientModule.java
----------------------------------------------------------------------
diff --git a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/config/IBMSmartCloudRestClientModule.java b/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/config/IBMSmartCloudRestClientModule.java
deleted file mode 100644
index d9fc016..0000000
--- a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/config/IBMSmartCloudRestClientModule.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.jclouds.ibm.smartcloud.config;
-
-import org.jclouds.http.HttpErrorHandler;
-import org.jclouds.http.RequiresHttp;
-import org.jclouds.http.annotation.ClientError;
-import org.jclouds.http.annotation.Redirection;
-import org.jclouds.http.annotation.ServerError;
-import org.jclouds.ibm.smartcloud.IBMSmartCloudAsyncClient;
-import org.jclouds.ibm.smartcloud.IBMSmartCloudClient;
-import org.jclouds.ibm.smartcloud.handlers.IBMSmartCloudErrorHandler;
-import org.jclouds.rest.ConfiguresRestClient;
-import org.jclouds.rest.config.RestClientModule;
-
-/**
- * Configures the IBMSmartCloud connection.
- *
- * @author Adrian Cole
- */
-@RequiresHttp
-@ConfiguresRestClient
-public class IBMSmartCloudRestClientModule extends
- RestClientModule<IBMSmartCloudClient, IBMSmartCloudAsyncClient> {
-
- public IBMSmartCloudRestClientModule() {
- super(IBMSmartCloudClient.class, IBMSmartCloudAsyncClient.class);
- }
-
- @Override
- protected void bindErrorHandlers() {
- bind(HttpErrorHandler.class).annotatedWith(Redirection.class).to(
- IBMSmartCloudErrorHandler.class);
- bind(HttpErrorHandler.class).annotatedWith(ClientError.class).to(
- IBMSmartCloudErrorHandler.class);
- bind(HttpErrorHandler.class).annotatedWith(ServerError.class).to(
- IBMSmartCloudErrorHandler.class);
- }
-
- @Override
- protected void configure() {
- install(new IBMSmartCloudParserModule());
- super.configure();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/23d9d901/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/domain/Address.java
----------------------------------------------------------------------
diff --git a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/domain/Address.java b/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/domain/Address.java
deleted file mode 100644
index 10b21b5..0000000
--- a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/domain/Address.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.jclouds.ibm.smartcloud.domain;
-
-import javax.annotation.Nullable;
-
-/**
- *
- * The current state of a Address
- *
- * @author Adrian Cole
- */
-public class Address implements Comparable<Address> {
-
- public static enum State {
- NEW, ALLOCATING, FREE, ATTACHED, RELEASING, RELEASED, FAILED, RELEASE_PENDING;
- public static State fromValue(int v) {
- switch (v) {
- case 0:
- return NEW;
- case 1:
- return ALLOCATING;
- case 2:
- return FREE;
- case 3:
- return ATTACHED;
- case 4:
- return RELEASING;
- case 5:
- return RELEASED;
- case 6:
- return FAILED;
- case 7:
- return RELEASE_PENDING;
- default:
- throw new IllegalArgumentException("invalid state:" + v);
- }
- }
- }
-
- private int state;
- private String location;
- private String ip;
- private String id;
- @Nullable
- private String instanceId;
-
- public Address(int state, String location, String ip, String id, String instanceId) {
- this.state = state;
- this.location = location;
- this.ip = ip;
- this.id = id;
- this.instanceId = instanceId;
- }
-
- Address() {
-
- }
-
- public State getState() {
- return State.fromValue(state);
- }
-
- public String getLocation() {
- return location;
- }
-
- public String getIP() {
- return "".equals(ip.trim()) ? null : ip.trim();
- }
-
- public String getId() {
- return id;
- }
-
- public String getInstanceId() {
- return instanceId;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((id == null) ? 0 : id.hashCode());
- result = prime * result + ((instanceId == null) ? 0 : instanceId.hashCode());
- result = prime * result + ((ip == null) ? 0 : ip.hashCode());
- result = prime * result + ((location == null) ? 0 : location.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- Address other = (Address) obj;
- if (id == null) {
- if (other.id != null)
- return false;
- } else if (!id.equals(other.id))
- return false;
- if (instanceId == null) {
- if (other.instanceId != null)
- return false;
- } else if (!instanceId.equals(other.instanceId))
- return false;
- if (ip == null) {
- if (other.ip != null)
- return false;
- } else if (!ip.equals(other.ip))
- return false;
- if (location == null) {
- if (other.location != null)
- return false;
- } else if (!location.equals(other.location))
- return false;
- return true;
- }
-
- @Override
- public String toString() {
- return "[id=" + id + ", ip=" + ip + ", location=" + location + ", state=" + getState() + ", instanceId="
- + instanceId + "]";
- }
-
- @Override
- public int compareTo(Address arg0) {
- return id.compareTo(arg0.getId());
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/23d9d901/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/domain/IP.java
----------------------------------------------------------------------
diff --git a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/domain/IP.java b/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/domain/IP.java
deleted file mode 100644
index 1b7da88..0000000
--- a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/domain/IP.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.jclouds.ibm.smartcloud.domain;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import com.google.common.annotations.Beta;
-
-/**
- *
- *
- * @author Adrian Cole
- */
-public class IP {
- public static Builder builder() {
- return new Builder();
- }
-
- public static class Builder {
- private String ip;
- private String hostname;
- private int type;
-
- public Builder ip(String ip) {
- this.ip = ip;
- return this;
- }
-
- public Builder hostname(String hostname) {
- this.hostname = hostname;
- return this;
- }
-
- public Builder type(int type) {
- this.type = type;
- return this;
- }
-
- public IP build() {
- return new IP(ip, hostname, type);
- }
- }
-
- private String ip;
- private String hostname;
- @Beta
- private int type;
-
- IP() {
-
- }
-
- public IP(String ip, String hostname, int type) {
- this.ip = checkNotNull(ip, "ip");
- this.hostname = checkNotNull(hostname, "hostname");
- this.type = type;
- }
-
- // TODO custom parser to do this once
- public String getHostname() {
- return "".equals(hostname.trim()) ? null : hostname.trim();
- }
-
- public String getIP() {
- return "".equals(ip.trim()) ? null : ip.trim();
- }
-
- public int getType() {
- return type;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((hostname == null) ? 0 : hostname.hashCode());
- result = prime * result + ((ip == null) ? 0 : ip.hashCode());
- result = prime * result + type;
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- IP other = (IP) obj;
- if (hostname == null) {
- if (other.hostname != null)
- return false;
- } else if (!hostname.equals(other.hostname))
- return false;
- if (ip == null) {
- if (other.ip != null)
- return false;
- } else if (!ip.equals(other.ip))
- return false;
- if (type != other.type)
- return false;
- return true;
- }
-
- @Override
- public String toString() {
- return String.format("[hostname=%s, ip=%s, type=%s]", hostname, ip, type);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/23d9d901/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/domain/Image.java
----------------------------------------------------------------------
diff --git a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/domain/Image.java b/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/domain/Image.java
deleted file mode 100644
index e6deb04..0000000
--- a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/domain/Image.java
+++ /dev/null
@@ -1,221 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.jclouds.ibm.smartcloud.domain;
-
-import java.net.URI;
-import java.util.Date;
-import java.util.Set;
-import java.util.SortedSet;
-
-import com.google.common.collect.ImmutableSortedSet;
-import com.google.common.collect.Sets;
-
-/**
- *
- * The current state of the image.
- *
- * @author Adrian Cole
- */
-public class Image implements Comparable<Image> {
-
- public static enum State {
- NEW, AVAILABLE, UNAVAILABLE, DELETED, CAPTURING, UNRECOGNIZED;
- public static State fromValue(String v) {
- switch (Integer.parseInt(v)) {
- case 0:
- return NEW;
- case 1:
- return AVAILABLE;
- case 2:
- return UNAVAILABLE;
- case 3:
- return DELETED;
- case 4:
- return CAPTURING;
- default:
- return UNRECOGNIZED;
- }
- }
- }
-
- public static enum Visibility {
-
- PUBLIC,
-
- SHARED,
-
- PRIVATE;
- }
-
- public static enum Architecture {
- I386, X86_64, UNRECOGNIZED;
- public String value() {
- return name().toLowerCase();
- }
-
- public static Architecture fromValue(String v) {
- try {
- return valueOf(v.toUpperCase());
- } catch (IllegalArgumentException e) {
- return UNRECOGNIZED;
- }
- }
- }
-
- private String name;
-
- private URI manifest;
- private State state;
- private Visibility visibility;
- private String owner;
- private String platform;
- private Architecture architecture;
- private Date createdTime;
- private String location;
- // for testing to be the same order each time
- private SortedSet<InstanceType> supportedInstanceTypes = Sets.newTreeSet();
- private SortedSet<String> productCodes = Sets.newTreeSet();
- private URI documentation;
- private String id;
- private String description;
-
- Image() {
-
- }
-
- public Image(String name, URI manifest, State state, Visibility visibility, String owner, String platform,
- Architecture architecture, Date createdTime, String location, Set<InstanceType> supportedInstanceTypes,
- Set<String> productCodes, URI documentation, String id, String description) {
- this.name = name;
- this.manifest = manifest;
- this.state = state;
- this.visibility = visibility;
- this.owner = owner;
- this.platform = platform;
- this.architecture = architecture;
- this.createdTime = createdTime;
- this.location = location;
- this.supportedInstanceTypes = ImmutableSortedSet.copyOf(supportedInstanceTypes);
- this.productCodes = ImmutableSortedSet.copyOf(productCodes);
- this.documentation = documentation;
- this.id = id;
- this.description = description;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((id == null) ? 0 : id.hashCode());
- result = prime * result + ((location == null) ? 0 : location.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- Image other = (Image) obj;
- if (id == null) {
- if (other.id != null)
- return false;
- } else if (!id.equals(other.id))
- return false;
- if (location == null) {
- if (other.location != null)
- return false;
- } else if (!location.equals(other.location))
- return false;
- return true;
- }
-
- @Override
- public String toString() {
- return String
- .format(
- "[id=%s, name=%s, architecture=%s, createdTime=%s, description=%s, documentation=%s, location=%s, manifest=%s, owner=%s, platform=%s, productCodes=%s, state=%s, supportedInstanceTypes=%s, visibility=%s]",
- id, name, architecture, createdTime, description, documentation, location, manifest, owner,
- platform, productCodes, state, supportedInstanceTypes, visibility);
- }
-
- public String getName() {
- return name;
- }
-
- public URI getManifest() {
- return manifest;
- }
-
- public State getState() {
- return state;
- }
-
- public Visibility getVisibility() {
- return visibility;
- }
-
- public String getOwner() {
- return owner;
- }
-
- public String getPlatform() {
- return platform;
- }
-
- public Architecture getArchitecture() {
- return architecture;
- }
-
- public Date getCreatedTime() {
- return createdTime;
- }
-
- public String getLocation() {
- return location;
- }
-
- public Set<InstanceType> getSupportedInstanceTypes() {
- return supportedInstanceTypes;
- }
-
- public Set<String> getProductCodes() {
- return productCodes;
- }
-
- public URI getDocumentation() {
- return documentation;
- }
-
- public String getId() {
- return id;
- }
-
- public String getDescription() {
- return description;
- }
-
- @Override
- public int compareTo(Image arg0) {
- return id.compareTo(arg0.getId());
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/23d9d901/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/domain/Instance.java
----------------------------------------------------------------------
diff --git a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/domain/Instance.java b/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/domain/Instance.java
deleted file mode 100644
index 2c885ad..0000000
--- a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/domain/Instance.java
+++ /dev/null
@@ -1,449 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.jclouds.ibm.smartcloud.domain;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.Date;
-import java.util.Set;
-
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Sets;
-import com.google.gson.annotations.SerializedName;
-
-/**
- *
- * The current state of the instance.
- *
- * @author Adrian Cole
- */
-public class Instance implements Comparable<Instance> {
- public static Builder builder() {
- return new Builder();
- }
-
- public static class Builder {
- private Date launchTime;
- private Set<Software> software = Sets.newLinkedHashSet();
- private IP primaryIP;
- private Set<IP> secondaryIPs = Sets.newLinkedHashSet();
- private String requestId;
- private String keyName;
- private String name;
- private String instanceType;
- private Status status;
- private String owner;
- private String location;
- private String imageId;
- private Set<String> productCodes = Sets.newLinkedHashSet();
- private String requestName;
- private String id;
- private Date expirationTime;
- private Vlan vlan;
- private int diskSize;
-
- private boolean rootOnly;
- private String antiCollocationInstance;
-
- public Builder launchTime(Date launchTime) {
- this.launchTime = launchTime;
- return this;
- }
-
- public Builder software(Iterable<Software> software) {
- this.software = ImmutableSet.<Software> copyOf(checkNotNull(software, "software"));
- return this;
- }
-
- public Builder primaryIP(IP primaryIP) {
- this.primaryIP = primaryIP;
- return this;
- }
-
- public Builder secondaryIPs(Iterable<IP> secondaryIPs) {
- this.secondaryIPs = ImmutableSet.<IP> copyOf(checkNotNull(secondaryIPs, "secondaryIPs"));
- return this;
- }
-
- public Builder requestId(String requestId) {
- this.requestId = requestId;
- return this;
- }
-
- public Builder keyName(String keyName) {
- this.keyName = keyName;
- return this;
- }
-
- public Builder name(String name) {
- this.name = name;
- return this;
- }
-
- public Builder instanceType(String instanceType) {
- this.instanceType = instanceType;
- return this;
- }
-
- public Builder status(Status status) {
- this.status = status;
- return this;
- }
-
- public Builder owner(String owner) {
- this.owner = owner;
- return this;
- }
-
- public Builder location(String location) {
- this.location = location;
- return this;
- }
-
- public Builder imageId(String imageId) {
- this.imageId = imageId;
- return this;
- }
-
- public Builder productCodes(Iterable<String> productCodes) {
- this.productCodes = ImmutableSet.<String> copyOf(checkNotNull(productCodes, "productCodes"));
- return this;
- }
-
- public Builder requestName(String requestName) {
- this.requestName = requestName;
- return this;
- }
-
- public Builder id(String id) {
- this.id = id;
- return this;
- }
-
- public Builder expirationTime(Date expirationTime) {
- this.expirationTime = expirationTime;
- return this;
- }
-
- public Builder vlan(Vlan vlan) {
- this.vlan = vlan;
- return this;
- }
-
- public Builder diskSize(int diskSize) {
- this.diskSize = diskSize;
- return this;
- }
-
- public Builder rootOnly(boolean rootOnly) {
- this.rootOnly = rootOnly;
- return this;
- }
-
- public Builder antiCollocationInstance(String antiCollocationInstance) {
- this.antiCollocationInstance = antiCollocationInstance;
- return this;
- }
-
- public Instance build() {
- return new Instance(launchTime, software, primaryIP, secondaryIPs, requestId, keyName, name, instanceType,
- status, owner, location, imageId, productCodes, requestName, id, expirationTime, vlan, diskSize,
- rootOnly, antiCollocationInstance);
- }
- }
-
- public static enum Status {
- NEW, PROVISIONING, FAILED, REMOVED, REJECTED, ACTIVE, UNKNOWN, DEPROVISIONING, RESTARTING, STARTING, STOPPING, STOPPED, DEPROVISION_PENDING, UNRECOGNIZED;
-
- public static Status fromValue(String v) {
- switch (Integer.parseInt(v)) {
- case 0:
- return NEW;
- case 1:
- return PROVISIONING;
- case 2:
- return FAILED;
- case 3:
- return REMOVED;
- case 4:
- return REJECTED;
- case 5:
- return ACTIVE;
- case 6:
- return UNKNOWN;
- case 7:
- return DEPROVISIONING;
- case 8:
- return RESTARTING;
- case 9:
- return STARTING;
- case 10:
- return STOPPING;
- case 11:
- return STOPPED;
- case 12:
- return DEPROVISION_PENDING;
- default:
- return UNRECOGNIZED;
- }
- }
- }
-
- public static class Software {
- private String version;
- private String type;
- private String name;
-
- public Software(String name, String type, String version) {
- this.version = version;
- this.type = type;
- this.name = name;
- }
-
- public Software() {
-
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((name == null) ? 0 : name.hashCode());
- result = prime * result + ((type == null) ? 0 : type.hashCode());
- result = prime * result + ((version == null) ? 0 : version.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- Software other = (Software) obj;
- if (name == null) {
- if (other.name != null)
- return false;
- } else if (!name.equals(other.name))
- return false;
- if (type == null) {
- if (other.type != null)
- return false;
- } else if (!type.equals(other.type))
- return false;
- if (version == null) {
- if (other.version != null)
- return false;
- } else if (!version.equals(other.version))
- return false;
- return true;
- }
-
- public String getVersion() {
- return version;
- }
-
- public String getType() {
- return type;
- }
-
- public String getName() {
- return name;
- }
-
- @Override
- public String toString() {
- return "[name=" + name + ", type=" + type + ", version=" + version + "]";
- }
- }
-
- private Date launchTime;
- private Set<Software> software = Sets.newLinkedHashSet();
- private IP primaryIP;
- @SerializedName("secondaryIP")
- private Set<IP> secondaryIPs = Sets.newLinkedHashSet();
- private String requestId;
- private String keyName;
- private String name;
- private String instanceType;
- private Status status;
- private String owner;
- private String location;
- private String imageId;
- private Set<String> productCodes = Sets.newLinkedHashSet();
- private String requestName;
- private String id;
- private Date expirationTime;
- private Vlan vlan;
- private int diskSize;
- @SerializedName("root-only")
- private boolean rootOnly;
- private String antiCollocationInstance;
-
- Instance() {
- }
-
- public Instance(Date launchTime, Iterable<Software> software, IP primaryIP, Iterable<IP> secondaryIPs,
- String requestId, String keyName, String name, String instanceType, Status status, String owner,
- String location, String imageId, Iterable<String> productCodes, String requestName, String id,
- Date expirationTime, Vlan vlan, int diskSize, boolean rootOnly, String antiCollocationInstance) {
- this.launchTime = launchTime;
- this.software = ImmutableSet.copyOf(software);
- this.primaryIP = primaryIP;
- this.secondaryIPs = ImmutableSet.copyOf(secondaryIPs);
- this.requestId = requestId;
- this.keyName = keyName;
- this.name = name;
- this.instanceType = instanceType;
- this.status = status;
- this.owner = owner;
- this.location = location;
- this.imageId = imageId;
- this.productCodes = ImmutableSet.copyOf(productCodes);
- this.requestName = requestName;
- this.id = id;
- this.expirationTime = expirationTime;
- this.vlan = vlan;
- this.diskSize = diskSize;
- this.rootOnly = rootOnly;
- this.antiCollocationInstance = antiCollocationInstance;
- }
-
- public Date getLaunchTime() {
- return launchTime;
- }
-
- public Set<Software> getSoftware() {
- return software;
- }
-
- public IP getPrimaryIP() {
- return primaryIP;
- }
-
- public Set<IP> getSecondaryIPs() {
- return secondaryIPs;
- }
-
- public String getRequestId() {
- return requestId;
- }
-
- public String getKeyName() {
- return keyName;
- }
-
- public String getName() {
- return name;
- }
-
- public String getInstanceType() {
- return instanceType;
- }
-
- public Status getStatus() {
- return status;
- }
-
- public String getOwner() {
- return owner;
- }
-
- public String getLocation() {
- return location;
- }
-
- public String getImageId() {
- return imageId;
- }
-
- public Set<String> getProductCodes() {
- return productCodes;
- }
-
- public String getRequestName() {
- return requestName;
- }
-
- public String getId() {
- return id;
- }
-
- public Date getExpirationTime() {
- return expirationTime;
- }
-
- public Vlan getVlan() {
- return vlan;
- }
-
- public int getDiskSize() {
- return diskSize;
- }
-
- public boolean isRootOnly() {
- return rootOnly;
- }
-
- public String getAntiCollocationInstance() {
- return antiCollocationInstance;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((id == null) ? 0 : id.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- Instance other = (Instance) obj;
- if (id == null) {
- if (other.id != null)
- return false;
- } else if (!id.equals(other.id))
- return false;
- return true;
- }
-
- @Override
- public String toString() {
- return String
- .format(
- "[id=%s, instanceType=%s, owner=%s, name=%s, location=%s, status=%s, imageId=%s, primaryIP=%s, secondaryIPs=%s, diskSize=%s, keyName=%s, launchTime=%s, rootOnly=%s, vlan=%s, software=%s, expirationTime=%s, antiCollocationInstance=%s, requestId=%s, requestName=%s, productCodes=%s]",
- id, instanceType, owner, name, location, status, imageId, primaryIP, secondaryIPs, diskSize,
- keyName, launchTime, rootOnly, vlan, software, expirationTime, antiCollocationInstance,
- requestId, requestName, productCodes);
- }
-
- @Override
- public int compareTo(Instance arg0) {
- return id.compareTo(arg0.getId());
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/23d9d901/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/domain/InstanceType.java
----------------------------------------------------------------------
diff --git a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/domain/InstanceType.java b/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/domain/InstanceType.java
deleted file mode 100644
index 4edd5ae..0000000
--- a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/domain/InstanceType.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.jclouds.ibm.smartcloud.domain;
-
-import com.google.common.collect.ComparisonChain;
-
-/**
- *
- *
- * @author Adrian Cole
- */
-public class InstanceType implements Comparable<InstanceType> {
-
- protected String label;
- protected Price price;
- protected String id;
-
- public InstanceType(String label, Price price, String id) {
- super();
- this.label = label;
- this.price = price;
- this.id = id;
- }
-
- InstanceType() {
- super();
- }
-
- public String getLabel() {
- return label;
- }
-
- public Price getPrice() {
- return price;
- }
-
- public String getId() {
- return id;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((id == null) ? 0 : id.hashCode());
- result = prime * result + ((label == null) ? 0 : label.hashCode());
- result = prime * result + ((price == null) ? 0 : price.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- InstanceType other = (InstanceType) obj;
- if (id == null) {
- if (other.id != null)
- return false;
- } else if (!id.equals(other.id))
- return false;
- if (label == null) {
- if (other.label != null)
- return false;
- } else if (!label.equals(other.label))
- return false;
- if (price == null) {
- if (other.price != null)
- return false;
- } else if (!price.equals(other.price))
- return false;
- return true;
- }
-
- @Override
- public String toString() {
- return "[id=" + id + ", label=" + label + ", price=" + price + "]";
- }
-
- @Override
- public int compareTo(InstanceType o) {
- return ComparisonChain.start().compare(this.getPrice().getRate(), o.getPrice().getRate()).result();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/23d9d901/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/domain/Key.java
----------------------------------------------------------------------
diff --git a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/domain/Key.java b/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/domain/Key.java
deleted file mode 100644
index a4a9db9..0000000
--- a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/domain/Key.java
+++ /dev/null
@@ -1,151 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.jclouds.ibm.smartcloud.domain;
-
-import java.util.Date;
-import java.util.Set;
-
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Sets;
-import com.google.gson.annotations.SerializedName;
-
-/**
- *
- * The current state of a public or private key.
- *
- * @author Adrian Cole
- */
-public class Key implements Comparable<Key> {
- @SerializedName("default")
- private boolean isDefault;
- private Set<String> instanceIds = Sets.newLinkedHashSet();
- private String keyMaterial;
- @SerializedName("keyName")
- private String name;
- private Date lastModifiedTime;
-
- public Key(boolean isDefault, Iterable<String> instanceIds, String keyMaterial, String name, Date lastModifiedTime) {
- this.isDefault = isDefault;
- Iterables.addAll(this.instanceIds, instanceIds);
- this.keyMaterial = keyMaterial;
- this.name = name;
- this.lastModifiedTime = lastModifiedTime;
- }
-
- public Key() {
-
- }
-
- public boolean isDefault() {
- return isDefault;
- }
-
- public void setDefault(boolean isDefault) {
- this.isDefault = isDefault;
- }
-
- public String getKeyMaterial() {
- return keyMaterial;
- }
-
- public void setKeyMaterial(String keyMaterial) {
- this.keyMaterial = keyMaterial;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public Date getLastModifiedTime() {
- return lastModifiedTime;
- }
-
- public void setLastModifiedTime(Date lastModifiedTime) {
- this.lastModifiedTime = lastModifiedTime;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((instanceIds == null) ? 0 : instanceIds.hashCode());
- result = prime * result + (isDefault ? 1231 : 1237);
- result = prime * result + ((keyMaterial == null) ? 0 : keyMaterial.hashCode());
- result = prime * result + ((name == null) ? 0 : name.hashCode());
- result = prime * result + ((lastModifiedTime == null) ? 0 : lastModifiedTime.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- Key other = (Key) obj;
- if (instanceIds == null) {
- if (other.instanceIds != null)
- return false;
- } else if (!instanceIds.equals(other.instanceIds))
- return false;
- if (isDefault != other.isDefault)
- return false;
- if (keyMaterial == null) {
- if (other.keyMaterial != null)
- return false;
- } else if (!keyMaterial.equals(other.keyMaterial))
- return false;
- if (name == null) {
- if (other.name != null)
- return false;
- } else if (!name.equals(other.name))
- return false;
- if (lastModifiedTime == null) {
- if (other.lastModifiedTime != null)
- return false;
- } else if (!lastModifiedTime.equals(other.lastModifiedTime))
- return false;
- return true;
- }
-
- @Override
- public String toString() {
- return "Key [isDefault=" + isDefault + ", instanceIds=" + instanceIds + ", name=" + name + ", keyMaterial="
- + keyMaterial + ", lastModifiedTime=" + lastModifiedTime + "]";
- }
-
- public Set<String> getInstanceIds() {
- return instanceIds;
- }
-
- public void setInstanceIds(Set<String> instanceIds) {
- this.instanceIds = instanceIds;
- }
-
- @Override
- public int compareTo(Key arg0) {
- return name.compareTo(arg0.name);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/23d9d901/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/domain/Location.java
----------------------------------------------------------------------
diff --git a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/domain/Location.java b/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/domain/Location.java
deleted file mode 100644
index dd1ce52..0000000
--- a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/domain/Location.java
+++ /dev/null
@@ -1,174 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.jclouds.ibm.smartcloud.domain;
-
-import java.util.Map;
-
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Maps;
-
-/**
- *
- * The current state of a location (datacenter)
- *
- * @author Adrian Cole
- */
-public class Location {
- public static Builder builder() {
- return new Builder();
- }
-
- public static class Builder {
- private String id;
- private String name;
- private String description;
- private String location;
- private State state;
- private Map<String, Map<String, String>> capabilities = Maps.newLinkedHashMap();
-
- public Builder id(String id) {
- this.id = id;
- return this;
- }
-
- public Builder name(String name) {
- this.name = name;
- return this;
- }
-
- public Builder description(String description) {
- this.description = description;
- return this;
- }
-
- public Builder location(String location) {
- this.location = location;
- return this;
- }
-
- public Builder state(State state) {
- this.state = state;
- return this;
- }
-
- public Builder capabilities(Map<String, Map<String, String>> capabilities) {
- this.capabilities = ImmutableMap.copyOf(capabilities);
- return this;
- }
-
- public Builder capability(String id) {
- return capability(id, ImmutableMap.<String, String> of());
- }
-
- public Builder capability(String id, Map<String, String> entries) {
- this.capabilities.put(id, entries);
- return this;
- }
-
- public Location build() {
- return new Location(id, name, description, location, state, capabilities);
- }
- }
-
- public static enum State {
- OFFLINE, ONLINE;
- @Override
- public String toString() {
- return this == OFFLINE ? "-1" : "1";
- }
-
- public static State fromValue(int state) {
- return state == -1 ? OFFLINE : ONLINE;
- }
-
- }
-
- private final String id;
- private final String name;
- private final String description;
- private final String location;
- private final State state;
- private final Map<String, Map<String, String>> capabilities;
-
- public Location(String id, String name, String description, String location, State state,
- Map<String, Map<String, String>> capabilities) {
- this.id = id;
- this.name = name;
- this.description = description;
- this.location = location;
- this.state = state;
- this.capabilities = ImmutableMap.copyOf(capabilities);
- }
-
- public String getId() {
- return id;
- }
-
- public String getName() {
- return name;
- }
-
- public State getState() {
- return state;
- }
-
- public String getDescription() {
- return description;
- }
-
- public String getLocation() {
- return location;
- }
-
- public Map<String, Map<String, String>> getCapabilities() {
- return capabilities;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((id == null) ? 0 : id.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- Location other = (Location) obj;
- if (id == null) {
- if (other.id != null)
- return false;
- } else if (!id.equals(other.id))
- return false;
- return true;
- }
-
- @Override
- public String toString() {
- return "[id=" + id + ", name=" + name + ", description=" + description + ", location=" + location + ", state="
- + state + ", capabilities=" + capabilities + "]";
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/23d9d901/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/domain/Offering.java
----------------------------------------------------------------------
diff --git a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/domain/Offering.java b/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/domain/Offering.java
deleted file mode 100644
index 5134cf7..0000000
--- a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/domain/Offering.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.jclouds.ibm.smartcloud.domain;
-
-/**
- *
- *
- * @author Adrian Cole
- */
-public class Offering implements Comparable<Offering> {
-
- protected String location;
- protected Price price;
- protected String id;
-
- Offering() {
- }
-
- public String getLocation() {
- return location;
- }
-
- public Price getPrice() {
- return price;
- }
-
- public String getId() {
- return id;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((id == null) ? 0 : id.hashCode());
- result = prime * result + ((location == null) ? 0 : location.hashCode());
- result = prime * result + ((price == null) ? 0 : price.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- Offering other = (Offering) obj;
- if (id == null) {
- if (other.id != null)
- return false;
- } else if (!id.equals(other.id))
- return false;
- if (location == null) {
- if (other.location != null)
- return false;
- } else if (!location.equals(other.location))
- return false;
- if (price == null) {
- if (other.price != null)
- return false;
- } else if (!price.equals(other.price))
- return false;
- return true;
- }
-
- @Override
- public String toString() {
- return "[id=" + id + ", location=" + location + ", price=" + price + "]";
- }
-
- @Override
- public int compareTo(Offering arg0) {
- return id.compareTo(arg0.id);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/23d9d901/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/domain/Price.java
----------------------------------------------------------------------
diff --git a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/domain/Price.java b/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/domain/Price.java
deleted file mode 100644
index a942a30..0000000
--- a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/domain/Price.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.jclouds.ibm.smartcloud.domain;
-
-import java.util.Date;
-
-/**
- *
- *
- * @author Adrian Cole
- */
-public class Price {
-
- private double rate;
- private String unitOfMeasure;
- private String countryCode;
- private Date effectiveDate;
- private String currencyCode;
- private double pricePerQuantity;
-
- Price() {
-
- }
-
- public Price(double rate, String unitOfMeasure, String countryCode, Date effectiveDate, String currencyCode,
- double pricePerQuantity) {
- this.rate = rate;
- this.unitOfMeasure = unitOfMeasure;
- this.countryCode = countryCode;
- this.effectiveDate = effectiveDate;
- this.currencyCode = currencyCode;
- this.pricePerQuantity = pricePerQuantity;
- }
-
- public double getRate() {
- return rate;
- }
-
- public String getUnitOfMeasure() {
- return unitOfMeasure;
- }
-
- public String getCountryCode() {
- return countryCode;
- }
-
- public Date getEffectiveDate() {
- return effectiveDate;
- }
-
- public String getCurrencyCode() {
- return currencyCode;
- }
-
- public double getPricePerQuantity() {
- return pricePerQuantity;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((countryCode == null) ? 0 : countryCode.hashCode());
- result = prime * result + ((currencyCode == null) ? 0 : currencyCode.hashCode());
- result = prime * result + ((effectiveDate == null) ? 0 : effectiveDate.hashCode());
- long temp;
- temp = Double.doubleToLongBits(pricePerQuantity);
- result = prime * result + (int) (temp ^ (temp >>> 32));
- temp = Double.doubleToLongBits(rate);
- result = prime * result + (int) (temp ^ (temp >>> 32));
- result = prime * result + ((unitOfMeasure == null) ? 0 : unitOfMeasure.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- Price other = (Price) obj;
- if (countryCode == null) {
- if (other.countryCode != null)
- return false;
- } else if (!countryCode.equals(other.countryCode))
- return false;
- if (currencyCode == null) {
- if (other.currencyCode != null)
- return false;
- } else if (!currencyCode.equals(other.currencyCode))
- return false;
- if (effectiveDate == null) {
- if (other.effectiveDate != null)
- return false;
- } else if (!effectiveDate.equals(other.effectiveDate))
- return false;
- if (Double.doubleToLongBits(pricePerQuantity) != Double.doubleToLongBits(other.pricePerQuantity))
- return false;
- if (Double.doubleToLongBits(rate) != Double.doubleToLongBits(other.rate))
- return false;
- if (unitOfMeasure == null) {
- if (other.unitOfMeasure != null)
- return false;
- } else if (!unitOfMeasure.equals(other.unitOfMeasure))
- return false;
- return true;
- }
-
- @Override
- public String toString() {
- return "[countryCode=" + countryCode + ", currencyCode=" + currencyCode + ", effectiveDate=" + effectiveDate
- + ", pricePerQuantity=" + pricePerQuantity + ", rate=" + rate + ", unitOfMeasure=" + unitOfMeasure + "]";
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/23d9d901/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/domain/StorageOffering.java
----------------------------------------------------------------------
diff --git a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/domain/StorageOffering.java b/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/domain/StorageOffering.java
deleted file mode 100644
index 6f71442..0000000
--- a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/domain/StorageOffering.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.jclouds.ibm.smartcloud.domain;
-
-import java.util.Set;
-
-import com.google.common.collect.Sets;
-
-/**
- *
- * An Offering for Storage
- *
- * @author Adrian Cole
- */
-public class StorageOffering extends Offering {
- public static class Format {
- private String label;
- private String id;
-
- Format() {
-
- }
-
- public Format(String label, String id) {
- this.label = label;
- this.id = id;
- }
-
- public String getLabel() {
- return label;
- }
-
- public String getId() {
- return id;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((id == null) ? 0 : id.hashCode());
- result = prime * result + ((label == null) ? 0 : label.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- Format other = (Format) obj;
- if (id == null) {
- if (other.id != null)
- return false;
- } else if (!id.equals(other.id))
- return false;
- if (label == null) {
- if (other.label != null)
- return false;
- } else if (!label.equals(other.label))
- return false;
- return true;
- }
-
- @Override
- public String toString() {
- return "[id=" + id + ", label=" + label + "]";
- }
- }
-
- private long capacity;
- private String name;
- private Set<Format> formats = Sets.newLinkedHashSet();
-
- StorageOffering() {
-
- }
-
- public StorageOffering(String location, Price price, long capacity, String name, String id, Set<Format> formats) {
- this.location = location;
- this.price = price;
- this.capacity = capacity;
- this.name = name;
- this.id = id;
- this.formats = formats;
- }
-
- public long getCapacity() {
- return capacity;
- }
-
- public String getName() {
- return name;
- }
-
- public Set<? extends Format> getFormats() {
- return formats;
- }
-
- @Override
- public String toString() {
- return "[capacity=" + capacity + ", formats=" + formats + ", id=" + id + ", location=" + location + ", name="
- + name + ", price=" + price + "]";
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/23d9d901/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/domain/Vlan.java
----------------------------------------------------------------------
diff --git a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/domain/Vlan.java b/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/domain/Vlan.java
deleted file mode 100644
index 19c36cc..0000000
--- a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/domain/Vlan.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.jclouds.ibm.smartcloud.domain;
-
-
-/**
- *
- *
- * @author Adrian Cole
- */
-public class Vlan {
- public static Builder builder() {
- return new Builder();
- }
-
- public static class Builder {
- private String id;
- private String name;
- private String location;
-
- public Builder id(String id) {
- this.id = id;
- return this;
- }
-
- public Builder name(String name) {
- this.name = name;
- return this;
- }
-
- public Builder location(String location) {
- this.location = location;
- return this;
- }
-
- public Vlan build() {
- return new Vlan(location, name, id);
- }
- }
-
- private String location;
- private String name;
- private String id;
-
- Vlan() {
-
- }
-
- public Vlan(String location, String name, String id) {
- this.location = location;
- this.name = name;
- this.id = id;
- }
-
- public String getLocation() {
- return location;
- }
-
- public String getName() {
- return name;
- }
-
- public String getId() {
- return id;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((id == null) ? 0 : id.hashCode());
- result = prime * result + ((location == null) ? 0 : location.hashCode());
- result = prime * result + ((name == null) ? 0 : name.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- Vlan other = (Vlan) obj;
- if (id == null) {
- if (other.id != null)
- return false;
- } else if (!id.equals(other.id))
- return false;
- if (location == null) {
- if (other.location != null)
- return false;
- } else if (!location.equals(other.location))
- return false;
- if (name == null) {
- if (other.name != null)
- return false;
- } else if (!name.equals(other.name))
- return false;
- return true;
- }
-
- @Override
- public String toString() {
- return "[id=" + id + ", location=" + location + ", name=" + name + "]";
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/23d9d901/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/domain/Volume.java
----------------------------------------------------------------------
diff --git a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/domain/Volume.java b/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/domain/Volume.java
deleted file mode 100644
index b277f3c..0000000
--- a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/domain/Volume.java
+++ /dev/null
@@ -1,250 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.jclouds.ibm.smartcloud.domain;
-
-import java.util.Date;
-import java.util.Set;
-
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Sets;
-
-/**
- *
- * The current state of a Volume
- *
- * @author Adrian Cole
- */
-public class Volume implements Comparable<Volume> {
-
- public static enum State {
- NEW, CREATING, DELETING, DELETED, UNMOUNTED, MOUNTED, FAILED;
- public static State fromValue(int v) {
- switch (v) {
- case 0:
- return NEW;
- case 1:
- return CREATING;
- case 2:
- return DELETING;
- case 3:
- return DELETED;
- case 4:
- return UNMOUNTED;
- case 5:
- return MOUNTED;
- case 6:
- return FAILED;
- default:
- throw new IllegalArgumentException("invalid state:" + v);
- }
- }
- }
-
- private String instanceId;
- private int state;
- private int size;
- private String owner;
- private Date createdTime;
- private String location;
- private Set<String> productCodes = Sets.newLinkedHashSet();
- private String format;
- private String name;
- private String id;
-
- public Volume(String instanceId, int state, int size, String owner, Date createdTime,
- String location, Iterable<String> productCodes, String format, String name, String id) {
- this.instanceId = instanceId;
- this.state = state;
- this.size = size;
- this.owner = owner;
- this.createdTime = createdTime;
- this.location = location;
- Iterables.addAll(this.productCodes, productCodes);
- this.format = format;
- this.name = name;
- this.id = id;
- }
-
- public Volume() {
-
- }
-
- public String getInstanceId() {
- return instanceId;
- }
-
- public void setInstanceId(String instanceId) {
- this.instanceId = instanceId;
- }
-
- public State getState() {
- return State.fromValue(state);
- }
-
- public void setState(int state) {
- this.state = state;
- }
-
- public int getSize() {
- return size;
- }
-
- public void setSize(int size) {
- this.size = size;
- }
-
- public String getOwner() {
- return owner;
- }
-
- public void setOwner(String owner) {
- this.owner = owner;
- }
-
- public Date getCreatedTime() {
- return createdTime;
- }
-
- public void setCreatedTime(Date createdTime) {
- this.createdTime = createdTime;
- }
-
- public String getLocation() {
- return location;
- }
-
- public void setLocation(String location) {
- this.location = location;
- }
-
- public Set<String> getProductCodes() {
- return productCodes;
- }
-
- public void setProductCodes(Set<String> productCodes) {
- this.productCodes = productCodes;
- }
-
- public String getFormat() {
- return format;
- }
-
- public void setFormat(String format) {
- this.format = format;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((createdTime == null) ? 0 : createdTime.hashCode());
- result = prime * result + ((format == null) ? 0 : format.hashCode());
- result = prime * result + ((id == null) ? 0 : id.hashCode());
- result = prime * result + ((instanceId == null) ? 0 : instanceId.hashCode());
- result = prime * result + ((location == null) ? 0 : location.hashCode());
- result = prime * result + ((name == null) ? 0 : name.hashCode());
- result = prime * result + ((owner == null) ? 0 : owner.hashCode());
- result = prime * result + ((productCodes == null) ? 0 : productCodes.hashCode());
- result = prime * result + size;
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- Volume other = (Volume) obj;
- if (createdTime == null) {
- if (other.createdTime != null)
- return false;
- } else if (!createdTime.equals(other.createdTime))
- return false;
- if (format == null) {
- if (other.format != null)
- return false;
- } else if (!format.equals(other.format))
- return false;
- if (id == null) {
- if (other.id != null)
- return false;
- } else if (!id.equals(other.id))
- return false;
- if (instanceId == null) {
- if (other.instanceId != null)
- return false;
- } else if (!instanceId.equals(other.instanceId))
- return false;
- if (location == null) {
- if (other.location != null)
- return false;
- } else if (!location.equals(other.location))
- return false;
- if (name == null) {
- if (other.name != null)
- return false;
- } else if (!name.equals(other.name))
- return false;
- if (owner == null) {
- if (other.owner != null)
- return false;
- } else if (!owner.equals(other.owner))
- return false;
- if (productCodes == null) {
- if (other.productCodes != null)
- return false;
- } else if (!productCodes.equals(other.productCodes))
- return false;
- if (size != other.size)
- return false;
- return true;
- }
-
- @Override
- public String toString() {
- return "[id=" + id + ", name=" + name + ", size=" + size + ", state=" + getState()
- + ", instanceId=" + instanceId + ", location=" + location + ", format=" + format
- + ", owner=" + owner + ", createdTime=" + createdTime + ", productCodes="
- + productCodes + "]";
- }
-
- @Override
- public int compareTo(Volume arg0) {
- return id.compareTo(arg0.getId());
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/23d9d901/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/functions/ParseLongFromDate.java
----------------------------------------------------------------------
diff --git a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/functions/ParseLongFromDate.java b/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/functions/ParseLongFromDate.java
deleted file mode 100644
index 6119db7..0000000
--- a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/functions/ParseLongFromDate.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.jclouds.ibm.smartcloud.functions;
-
-import static com.google.common.base.Preconditions.checkArgument;
-
-import java.util.Date;
-
-import com.google.common.base.Function;
-
-/**
- *
- * @author Adrian Cole
- *
- */
-public class ParseLongFromDate implements Function<Object, String> {
-
- @Override
- public String apply(Object from) {
- checkArgument(from instanceof Date, "this binder is only valid for Date!");
- return Date.class.cast(from).getTime()+"";
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/23d9d901/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/handlers/IBMSmartCloudErrorHandler.java
----------------------------------------------------------------------
diff --git a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/handlers/IBMSmartCloudErrorHandler.java b/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/handlers/IBMSmartCloudErrorHandler.java
deleted file mode 100644
index b95416f..0000000
--- a/sandbox-providers/ibm-smartcloud/src/main/java/org/jclouds/ibm/smartcloud/handlers/IBMSmartCloudErrorHandler.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. jclouds licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.jclouds.ibm.smartcloud.handlers;
-
-import static org.jclouds.http.HttpUtils.releasePayload;
-
-import java.io.IOException;
-
-import javax.annotation.Resource;
-import javax.inject.Singleton;
-
-import org.jclouds.http.HttpCommand;
-import org.jclouds.http.HttpErrorHandler;
-import org.jclouds.http.HttpResponse;
-import org.jclouds.http.HttpResponseException;
-import org.jclouds.logging.Logger;
-import org.jclouds.rest.AuthorizationException;
-import org.jclouds.rest.ResourceNotFoundException;
-import org.jclouds.util.Strings2;
-
-/**
- * This will parse and set an appropriate exception on the command object.
- *
- * @author Adrian Cole
- *
- */
-@Singleton
-public class IBMSmartCloudErrorHandler implements HttpErrorHandler {
- @Resource
- protected Logger logger = Logger.NULL;
-
- public void handleError(HttpCommand command, HttpResponse response) {
- Exception exception = new HttpResponseException(command, response);
- try {
- // it is important to always read fully and close streams
- String message = parseMessage(response);
- exception = message != null ? new HttpResponseException(command, response, message) : exception;
- message = message != null ? message : String.format("%s -> %s", command.getCurrentRequest().getRequestLine(),
- response.getStatusLine());
- switch (response.getStatusCode()) {
- case 401:
- exception = new AuthorizationException(exception.getMessage(), exception);
- break;
- case 402:
- case 403:
- exception = new AuthorizationException(message, exception);
- break;
- case 404:
- if (!command.getCurrentRequest().getMethod().equals("DELETE")) {
- exception = new ResourceNotFoundException(message, exception);
- }
- break;
- case 406:
- case 409:
- case 412:
- exception = new IllegalStateException(message, exception);
- break;
- case 500:
- if (message != null && message.indexOf("There is already a BlockStorageDevice object with name") != 1)
- exception = new IllegalStateException(message, exception);
- break;
- }
- } catch (IOException e) {
- } finally {
- releasePayload(response);
- command.setException(exception);
- }
- }
-
- public String parseMessage(HttpResponse response) throws IOException {
- if (response.getPayload() == null)
- return null;
- return Strings2.toString(response.getPayload());
- }
-}