http://git-wip-us.apache.org/repos/asf/jclouds/blob/f7aea987/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/compute/options/CloudSigmaTemplateOptions.java ---------------------------------------------------------------------- diff --git a/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/compute/options/CloudSigmaTemplateOptions.java b/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/compute/options/CloudSigmaTemplateOptions.java deleted file mode 100644 index eac1343..0000000 --- a/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/compute/options/CloudSigmaTemplateOptions.java +++ /dev/null @@ -1,323 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF 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.cloudsigma.compute.options; - -import org.jclouds.cloudsigma.domain.AffinityType; -import org.jclouds.compute.options.TemplateOptions; -import org.jclouds.domain.LoginCredentials; -import org.jclouds.scriptbuilder.domain.Statement; - -import java.util.Map; - -public class CloudSigmaTemplateOptions extends TemplateOptions implements Cloneable { - - public static final CloudSigmaTemplateOptions NONE = new CloudSigmaTemplateOptions(); - - private AffinityType diskDriveAffinity = AffinityType.HDD; - - public CloudSigmaTemplateOptions diskDriveAffinity(AffinityType diskDriveAffinity) { - this.diskDriveAffinity = diskDriveAffinity; - return this; - } - - public AffinityType getDiskDriveAffinity() { - return diskDriveAffinity; - } - - @Override - public CloudSigmaTemplateOptions clone() { - CloudSigmaTemplateOptions options = new CloudSigmaTemplateOptions(); - copyTo(options); - return options; - } - - @Override - public void copyTo(TemplateOptions to) { - super.copyTo(to); - if (to instanceof CloudSigmaTemplateOptions) { - CloudSigmaTemplateOptions cTo = CloudSigmaTemplateOptions.class.cast(to); - cTo.diskDriveAffinity(getDiskDriveAffinity()); - } - } - - public static class Builder { - - /** - * @see CloudSigmaTemplateOptions#diskDriveAffinity - */ - public static CloudSigmaTemplateOptions diskDriveAffinity(AffinityType diskDriveAffinity) { - CloudSigmaTemplateOptions options = new CloudSigmaTemplateOptions(); - return options.diskDriveAffinity(diskDriveAffinity); - } - - // methods that only facilitate returning the correct object type - - /** - * @see TemplateOptions#inboundPorts - */ - public static CloudSigmaTemplateOptions inboundPorts(int... ports) { - CloudSigmaTemplateOptions options = new CloudSigmaTemplateOptions(); - return CloudSigmaTemplateOptions.class.cast(options.inboundPorts(ports)); - } - - /** - * @see TemplateOptions#port - */ - public static CloudSigmaTemplateOptions blockOnPort(int port, int seconds) { - CloudSigmaTemplateOptions options = new CloudSigmaTemplateOptions(); - return CloudSigmaTemplateOptions.class.cast(options.blockOnPort(port, seconds)); - } - - /** - * @see TemplateOptions#installPrivateKey - */ - public static CloudSigmaTemplateOptions installPrivateKey(String rsaKey) { - CloudSigmaTemplateOptions options = new CloudSigmaTemplateOptions(); - return CloudSigmaTemplateOptions.class.cast(options.installPrivateKey(rsaKey)); - } - - /** - * @see TemplateOptions#authorizePublicKey - */ - public static CloudSigmaTemplateOptions authorizePublicKey(String rsaKey) { - CloudSigmaTemplateOptions options = new CloudSigmaTemplateOptions(); - return CloudSigmaTemplateOptions.class.cast(options.authorizePublicKey(rsaKey)); - } - - /** - * @see TemplateOptions#userMetadata(Map) - */ - public static CloudSigmaTemplateOptions userMetadata(Map<String, String> userMetadata) { - CloudSigmaTemplateOptions options = new CloudSigmaTemplateOptions(); - return CloudSigmaTemplateOptions.class.cast(options.userMetadata(userMetadata)); - } - - /** - * @see TemplateOptions#nodeNames(Iterable) - */ - public static CloudSigmaTemplateOptions nodeNames(Iterable<String> nodeNames) { - CloudSigmaTemplateOptions options = new CloudSigmaTemplateOptions(); - return CloudSigmaTemplateOptions.class.cast(options.nodeNames(nodeNames)); - } - - /** - * @see TemplateOptions#nodeNames(Iterable) - */ - public static CloudSigmaTemplateOptions networks(Iterable<String> networks) { - CloudSigmaTemplateOptions options = new CloudSigmaTemplateOptions(); - return CloudSigmaTemplateOptions.class.cast(options.networks(networks)); - } - - public static CloudSigmaTemplateOptions overrideLoginUser(String user) { - CloudSigmaTemplateOptions options = new CloudSigmaTemplateOptions(); - return options.overrideLoginUser(user); - } - - public static CloudSigmaTemplateOptions overrideLoginPassword(String password) { - CloudSigmaTemplateOptions options = new CloudSigmaTemplateOptions(); - return options.overrideLoginPassword(password); - } - - public static CloudSigmaTemplateOptions overrideLoginPrivateKey(String privateKey) { - CloudSigmaTemplateOptions options = new CloudSigmaTemplateOptions(); - return options.overrideLoginPrivateKey(privateKey); - } - - public static CloudSigmaTemplateOptions overrideAuthenticateSudo(boolean authenticateSudo) { - CloudSigmaTemplateOptions options = new CloudSigmaTemplateOptions(); - return options.overrideAuthenticateSudo(authenticateSudo); - } - - public static CloudSigmaTemplateOptions overrideLoginCredentials(LoginCredentials credentials) { - CloudSigmaTemplateOptions options = new CloudSigmaTemplateOptions(); - return options.overrideLoginCredentials(credentials); - } - } - - // methods that only facilitate returning the correct object type - - /** - * {@inheritDoc} - */ - @Override - public CloudSigmaTemplateOptions blockOnPort(int port, int seconds) { - return CloudSigmaTemplateOptions.class.cast(super.blockOnPort(port, seconds)); - } - - /** - * {@inheritDoc} - */ - @Override - public CloudSigmaTemplateOptions inboundPorts(int... ports) { - return CloudSigmaTemplateOptions.class.cast(super.inboundPorts(ports)); - } - - /** - * {@inheritDoc} - */ - @Override - public CloudSigmaTemplateOptions authorizePublicKey(String publicKey) { - return CloudSigmaTemplateOptions.class.cast(super.authorizePublicKey(publicKey)); - } - - /** - * {@inheritDoc} - */ - @Override - public CloudSigmaTemplateOptions installPrivateKey(String privateKey) { - return CloudSigmaTemplateOptions.class.cast(super.installPrivateKey(privateKey)); - } - - /** - * {@inheritDoc} - */ - @Override - public CloudSigmaTemplateOptions blockUntilRunning(boolean blockUntilRunning) { - return CloudSigmaTemplateOptions.class.cast(super.blockUntilRunning(blockUntilRunning)); - } - - /** - * {@inheritDoc} - */ - @Override - public CloudSigmaTemplateOptions dontAuthorizePublicKey() { - return CloudSigmaTemplateOptions.class.cast(super.dontAuthorizePublicKey()); - } - - /** - * {@inheritDoc} - */ - @Override - public CloudSigmaTemplateOptions nameTask(String name) { - return CloudSigmaTemplateOptions.class.cast(super.nameTask(name)); - } - - /** - * {@inheritDoc} - */ - @Override - public CloudSigmaTemplateOptions runAsRoot(boolean runAsRoot) { - return CloudSigmaTemplateOptions.class.cast(super.runAsRoot(runAsRoot)); - } - - /** - * {@inheritDoc} - */ - @Override - public CloudSigmaTemplateOptions runScript(Statement script) { - return CloudSigmaTemplateOptions.class.cast(super.runScript(script)); - } - - /** - * {@inheritDoc} - */ - @Override - public CloudSigmaTemplateOptions overrideLoginCredentials(LoginCredentials overridingCredentials) { - return CloudSigmaTemplateOptions.class.cast(super.overrideLoginCredentials(overridingCredentials)); - } - - /** - * {@inheritDoc} - */ - @Override - public CloudSigmaTemplateOptions overrideLoginPassword(String password) { - return CloudSigmaTemplateOptions.class.cast(super.overrideLoginPassword(password)); - } - - /** - * {@inheritDoc} - */ - @Override - public CloudSigmaTemplateOptions overrideLoginPrivateKey(String privateKey) { - return CloudSigmaTemplateOptions.class.cast(super.overrideLoginPrivateKey(privateKey)); - } - - /** - * {@inheritDoc} - */ - @Override - public CloudSigmaTemplateOptions overrideLoginUser(String loginUser) { - return CloudSigmaTemplateOptions.class.cast(super.overrideLoginUser(loginUser)); - } - - /** - * {@inheritDoc} - */ - @Override - public CloudSigmaTemplateOptions overrideAuthenticateSudo(boolean authenticateSudo) { - return CloudSigmaTemplateOptions.class.cast(super.overrideAuthenticateSudo(authenticateSudo)); - } - - /** - * {@inheritDoc} - */ - @Override - public CloudSigmaTemplateOptions userMetadata(Map<String, String> userMetadata) { - return CloudSigmaTemplateOptions.class.cast(super.userMetadata(userMetadata)); - } - - /** - * {@inheritDoc} - */ - @Override - public CloudSigmaTemplateOptions userMetadata(String key, String value) { - return CloudSigmaTemplateOptions.class.cast(super.userMetadata(key, value)); - } - - /** - * {@inheritDoc} - */ - @Override - public CloudSigmaTemplateOptions nodeNames(Iterable<String> nodeNames) { - return CloudSigmaTemplateOptions.class.cast(super.nodeNames(nodeNames)); - } - - /** - * {@inheritDoc} - */ - @Override - public CloudSigmaTemplateOptions networks(Iterable<String> networks) { - return CloudSigmaTemplateOptions.class.cast(super.networks(networks)); - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - if (!super.equals(o)) return false; - - CloudSigmaTemplateOptions that = (CloudSigmaTemplateOptions) o; - - if (diskDriveAffinity != that.diskDriveAffinity) return false; - - return true; - } - - @Override - public int hashCode() { - int result = super.hashCode(); - result = 31 * result + (diskDriveAffinity != null ? diskDriveAffinity.hashCode() : 0); - return result; - } - - @Override - public String toString() { - return "CloudSigmaTemplateOptions{" + - "diskDriveAffinity=" + diskDriveAffinity + - '}'; - } -}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/f7aea987/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/config/CloudSigmaRestClientModule.java ---------------------------------------------------------------------- diff --git a/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/config/CloudSigmaRestClientModule.java b/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/config/CloudSigmaRestClientModule.java deleted file mode 100644 index 6532fcf..0000000 --- a/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/config/CloudSigmaRestClientModule.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF 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.cloudsigma.config; - -import java.util.List; -import java.util.Map; - -import org.jclouds.cloudsigma.CloudSigmaApi; -import org.jclouds.cloudsigma.domain.Device; -import org.jclouds.cloudsigma.domain.Drive; -import org.jclouds.cloudsigma.domain.DriveData; -import org.jclouds.cloudsigma.domain.DriveMetrics; -import org.jclouds.cloudsigma.domain.NIC; -import org.jclouds.cloudsigma.domain.Server; -import org.jclouds.cloudsigma.domain.ServerMetrics; -import org.jclouds.cloudsigma.functions.BaseDriveToMap; -import org.jclouds.cloudsigma.functions.DriveDataToMap; -import org.jclouds.cloudsigma.functions.MapToDevices; -import org.jclouds.cloudsigma.functions.MapToDevices.DeviceToId; -import org.jclouds.cloudsigma.functions.MapToDriveMetrics; -import org.jclouds.cloudsigma.functions.MapToNICs; -import org.jclouds.cloudsigma.functions.MapToServerMetrics; -import org.jclouds.cloudsigma.functions.ServerToMap; -import org.jclouds.cloudsigma.handlers.CloudSigmaErrorHandler; -import org.jclouds.http.HttpErrorHandler; -import org.jclouds.http.annotation.ClientError; -import org.jclouds.http.annotation.Redirection; -import org.jclouds.http.annotation.ServerError; -import org.jclouds.rest.ConfiguresRestClient; -import org.jclouds.rest.config.HttpApiModule; - -import com.google.common.base.Function; -import com.google.inject.TypeLiteral; - -/** - * Configures the CloudSigma connection. - */ -@ConfiguresRestClient -public class CloudSigmaRestClientModule extends HttpApiModule<CloudSigmaApi> { - - @Override - protected void bindErrorHandlers() { - bind(HttpErrorHandler.class).annotatedWith(Redirection.class).to(CloudSigmaErrorHandler.class); - bind(HttpErrorHandler.class).annotatedWith(ClientError.class).to(CloudSigmaErrorHandler.class); - bind(HttpErrorHandler.class).annotatedWith(ServerError.class).to(CloudSigmaErrorHandler.class); - } - - @Override - protected void configure() { - super.configure(); - bind(new TypeLiteral<Function<Drive, Map<String, String>>>() { - }).to(BaseDriveToMap.class); - bind(new TypeLiteral<Function<DriveData, Map<String, String>>>() { - }).to(DriveDataToMap.class); - bind(new TypeLiteral<Function<Map<String, String>, List<NIC>>>() { - }).to(MapToNICs.class); - bind(new TypeLiteral<Function<Map<String, String>, Map<String, ? extends Device>>>() { - }).to(MapToDevices.class); - bind(new TypeLiteral<Function<Map<String, String>, Map<String, ? extends DriveMetrics>>>() { - }).to(MapToDriveMetrics.class); - bind(new TypeLiteral<Function<Map<String, String>, ServerMetrics>>() { - }).to(MapToServerMetrics.class); - bind(new TypeLiteral<Function<Device, String>>() { - }).to(DeviceToId.class); - bind(new TypeLiteral<Function<Server, Map<String, String>>>() { - }).to(ServerToMap.class); - } - - @Override - protected void bindRetryHandlers() { - // TODO - } - -} http://git-wip-us.apache.org/repos/asf/jclouds/blob/f7aea987/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/domain/AffinityType.java ---------------------------------------------------------------------- diff --git a/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/domain/AffinityType.java b/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/domain/AffinityType.java deleted file mode 100644 index ea0f27b..0000000 --- a/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/domain/AffinityType.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF 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.cloudsigma.domain; - -import static com.google.common.base.Preconditions.checkNotNull; - -/** - * Option for the cloneDrive operation. - * 'HDD' to specifies a regular "spinning oxide" disk; 'SSD' specifies a solid-state drive. - */ -public enum AffinityType { - HDD, - SSD, - UNRECOGNIZED; - - public String value() { - return name().toLowerCase(); - } - - @Override - public String toString() { - return value(); - } - - public static AffinityType fromValue(String affinity) { - try { - return valueOf(checkNotNull(affinity, "affinity").toUpperCase()); - } catch (IllegalArgumentException e) { - return UNRECOGNIZED; - } - } - -} http://git-wip-us.apache.org/repos/asf/jclouds/blob/f7aea987/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/domain/BlockDevice.java ---------------------------------------------------------------------- diff --git a/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/domain/BlockDevice.java b/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/domain/BlockDevice.java deleted file mode 100644 index d4baeca..0000000 --- a/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/domain/BlockDevice.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF 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.cloudsigma.domain; - -import static com.google.common.base.Preconditions.checkArgument; - -public class BlockDevice extends Device { - public static class Builder extends Device.Builder { - private final int index; - - public Builder(int index) { - this.index = index; - } - - @Override - public Device build() { - return new BlockDevice(uuid, mediaType, index); - } - - } - - private final int index; - - public BlockDevice(String driveUuid, MediaType mediaType, int index) { - super(driveUuid, mediaType); - checkArgument(index >= 0 && index < 8, "index must be between 0 and 7"); - this.index = index; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + index; - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - BlockDevice other = (BlockDevice) obj; - if (index != other.index) - return false; - return true; - } - - @Override - public String getId() { - return String.format("block:%d", index); - } - - public int getIndex() { - return index; - } - - @Override - public String toString() { - return "[id=" + getId() + ", driveUuid=" + driveUuid + ", mediaType=" + mediaType + "]"; - } -} http://git-wip-us.apache.org/repos/asf/jclouds/blob/f7aea987/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/domain/ClaimType.java ---------------------------------------------------------------------- diff --git a/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/domain/ClaimType.java b/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/domain/ClaimType.java deleted file mode 100644 index c8fbcaf..0000000 --- a/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/domain/ClaimType.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF 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.cloudsigma.domain; - -import static com.google.common.base.Preconditions.checkNotNull; - -/** - * either 'exclusive' (the default) or 'shared' to allow multiple servers to access a drive - * simultaneously - */ -public enum ClaimType { - /** - * - */ - EXCLUSIVE, - /** - * allow multiple servers to access a drive simultaneously - */ - SHARED, UNRECOGNIZED; - - public String value() { - return name().toLowerCase(); - } - - @Override - public String toString() { - return value(); - } - - public static ClaimType fromValue(String claim) { - try { - return valueOf(checkNotNull(claim, "claim").toUpperCase()); - } catch (IllegalArgumentException e) { - return UNRECOGNIZED; - } - } - -} http://git-wip-us.apache.org/repos/asf/jclouds/blob/f7aea987/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/domain/CreateDriveRequest.java ---------------------------------------------------------------------- diff --git a/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/domain/CreateDriveRequest.java b/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/domain/CreateDriveRequest.java deleted file mode 100644 index 316f021..0000000 --- a/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/domain/CreateDriveRequest.java +++ /dev/null @@ -1,164 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF 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.cloudsigma.domain; - -import static com.google.common.base.Preconditions.checkNotNull; - -import java.util.Set; - -import org.jclouds.javax.annotation.Nullable; - -import com.google.common.collect.ImmutableSet; - -public class CreateDriveRequest extends Drive { - public static class Builder extends Drive.Builder { - - private Set<String> avoid = ImmutableSet.of(); - - @Nullable - private String encryptionCipher; - - public Builder avoid(Iterable<String> avoid) { - this.avoid = ImmutableSet.copyOf(checkNotNull(avoid, "avoid")); - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public Builder claimType(ClaimType claimType) { - return Builder.class.cast(super.claimType(claimType)); - } - - public Builder encryptionCipher(String encryptionCipher) { - this.encryptionCipher = encryptionCipher; - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public Builder name(String name) { - return Builder.class.cast(super.name(name)); - } - - /** - * {@inheritDoc} - */ - @Override - public Builder tags(Iterable<String> tags) { - return Builder.class.cast(super.tags(tags)); - } - - /** - * {@inheritDoc} - */ - @Override - public Builder readers(Iterable<String> readers) { - return Builder.class.cast(super.readers(readers)); - } - - /** - * {@inheritDoc} - */ - @Override - public Builder size(long size) { - return Builder.class.cast(super.size(size)); - } - - /** - * {@inheritDoc} - */ - @Override - public Builder use(Iterable<String> use) { - return Builder.class.cast(super.use(use)); - } - - public CreateDriveRequest build() { - return new CreateDriveRequest(name, size, claimType, tags, readers, use, encryptionCipher, avoid); - } - } - - private final Set<String> avoid; - @Nullable - private final String encryptionCipher; - - public CreateDriveRequest(String name, long size, @Nullable ClaimType claimType, Iterable<String> tags, - Iterable<String> readers, Iterable<String> use, @Nullable String encryptionCipher, Iterable<String> avoid) { - super(null, name, size, claimType, tags, readers, use); - this.encryptionCipher = encryptionCipher; - this.avoid = ImmutableSet.copyOf(checkNotNull(avoid, "avoid")); - } - - /** - * - * @return list of existing drives to ensure this new drive is created on physical different - * hardware than those existing drives - */ - public Set<String> getAvoid() { - return avoid; - } - - /** - * - * @return either 'none' or 'aes-xts-plain' (the default) - */ - @Nullable - public String getEncryptionCipher() { - return encryptionCipher; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = super.hashCode(); - result = prime * result + ((avoid == null) ? 0 : avoid.hashCode()); - result = prime * result + ((encryptionCipher == null) ? 0 : encryptionCipher.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (!super.equals(obj)) - return false; - if (getClass() != obj.getClass()) - return false; - CreateDriveRequest other = (CreateDriveRequest) obj; - if (avoid == null) { - if (other.avoid != null) - return false; - } else if (!avoid.equals(other.avoid)) - return false; - if (encryptionCipher == null) { - if (other.encryptionCipher != null) - return false; - } else if (!encryptionCipher.equals(other.encryptionCipher)) - return false; - return true; - } - - @Override - public String toString() { - return "[name=" + name + ", size=" + size + ", claimType=" + claimType + ", tags=" + tags - + ", readers=" + readers + ", use=" + use + ", avoid=" + avoid - + ", encryptionCipher=" + encryptionCipher + "]"; - } -} http://git-wip-us.apache.org/repos/asf/jclouds/blob/f7aea987/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/domain/Device.java ---------------------------------------------------------------------- diff --git a/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/domain/Device.java b/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/domain/Device.java deleted file mode 100644 index d60b9b9..0000000 --- a/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/domain/Device.java +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF 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.cloudsigma.domain; - -import static com.google.common.base.Preconditions.checkNotNull; - -public abstract class Device { - public abstract static class Builder { - protected String uuid; - protected MediaType mediaType = MediaType.DISK; - - public Builder mediaType(MediaType mediaType) { - this.mediaType = mediaType; - return this; - } - - public Builder uuid(String uuid) { - this.uuid = uuid; - return this; - } - - public abstract Device build(); - } - - protected final String driveUuid; - protected final MediaType mediaType; - - public Device(String driveUuid, MediaType mediaType) { - this.driveUuid = checkNotNull(driveUuid, "driveUuid"); - this.mediaType = checkNotNull(mediaType, "mediaType"); - } - - /** - * id generated based on the device bus, unit, and/or index numbers; - */ - public abstract String getId(); - - /** - * - * @return Drive UUID to connect as specified device. - */ - public String getDriveUuid() { - return driveUuid; - } - - /** - * - * @return set to 'cdrom' to simulate a cdrom, set to 'disk' or leave unset to simulate a hard - * disk. - */ - public MediaType getMediaType() { - return mediaType; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((driveUuid == null) ? 0 : driveUuid.hashCode()); - result = prime * result + ((mediaType == null) ? 0 : mediaType.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; - Device other = (Device) obj; - if (driveUuid == null) { - if (other.driveUuid != null) - return false; - } else if (!driveUuid.equals(other.driveUuid)) - return false; - if (mediaType != other.mediaType) - return false; - return true; - } - - @Override - public String toString() { - return "[driveUuid=" + driveUuid + ", mediaType=" + mediaType + "]"; - } -} http://git-wip-us.apache.org/repos/asf/jclouds/blob/f7aea987/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/domain/Drive.java ---------------------------------------------------------------------- diff --git a/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/domain/Drive.java b/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/domain/Drive.java deleted file mode 100644 index 6ced120..0000000 --- a/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/domain/Drive.java +++ /dev/null @@ -1,209 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF 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.cloudsigma.domain; - -import static com.google.common.base.Preconditions.checkNotNull; - -import java.util.Set; - -import org.jclouds.javax.annotation.Nullable; - -import com.google.common.base.Objects; -import com.google.common.collect.ImmutableSet; - -public class Drive extends Item { - public static class Builder extends Item.Builder { - protected long size; - protected ClaimType claimType = ClaimType.EXCLUSIVE; - protected Set<String> tags = ImmutableSet.of(); - protected Set<String> readers = ImmutableSet.of(); - - public Builder claimType(ClaimType claimType) { - this.claimType = claimType; - return this; - } - - public Builder tags(Iterable<String> tags) { - this.tags = ImmutableSet.copyOf(checkNotNull(tags, "tags")); - return this; - } - - public Builder readers(Iterable<String> readers) { - this.readers = ImmutableSet.copyOf(checkNotNull(readers, "readers")); - return this; - } - - public Builder size(long size) { - this.size = size; - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public Builder uuid(String uuid) { - return Builder.class.cast(super.uuid(uuid)); - } - - /** - * {@inheritDoc} - */ - @Override - public Builder name(String name) { - return Builder.class.cast(super.name(name)); - } - - /** - * {@inheritDoc} - */ - @Override - public Builder use(Iterable<String> use) { - return Builder.class.cast(super.use(use)); - } - - public Drive build() { - return new Drive(uuid, name, size, claimType, tags, readers, use); - } - - @Override - public int hashCode() { - final int prime = 31; - int result = super.hashCode(); - result = prime * result + ((claimType == null) ? 0 : claimType.hashCode()); - result = prime * result + ((tags == null) ? 0 : tags.hashCode()); - result = prime * result + ((readers == null) ? 0 : readers.hashCode()); - result = prime * result + (int) (size ^ (size >>> 32)); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (!super.equals(obj)) - return false; - if (getClass() != obj.getClass()) - return false; - Builder other = (Builder) obj; - if (claimType != other.claimType) - return false; - if (!Objects.equal(tags, other.tags)) - return false; - if (!Objects.equal(readers, other.readers)) - return false; - if (size != other.size) - return false; - return true; - } - } - - protected final long size; - protected final ClaimType claimType; - protected final Set<String> tags; - protected final Set<String> readers; - - public Drive(@Nullable String uuid, String name, long size, @Nullable ClaimType claimType, - Iterable<String> tags, Iterable<String> readers, Iterable<String> use) { - super(uuid, name, use); - this.size = size; - this.claimType = checkNotNull(claimType, "set claimType to exclusive, not null"); - this.tags = ImmutableSet.copyOf(checkNotNull(tags, "tags")); - this.readers = ImmutableSet.copyOf(checkNotNull(readers, "readers")); - } - - /** - * - * @return either 'exclusive' (the default) or 'shared' to allow multiple servers to access a - * drive simultaneously - */ - @Nullable - public ClaimType getClaimType() { - return claimType; - } - - /** - * @return all tags associated with this drive, both user-specified and "system" tags (e.g. "affinity:ssd") - */ - public Set<String> getTags() { - return tags; - } - - /** - * - * @return list of users allowed to read from a drive or 'ffffffff-ffff-ffff-ffff-ffffffffffff' - * for all users - */ - public Set<String> getReaders() { - return readers; - } - - /** - * - * @return size of drive in bytes - */ - public long getSize() { - return size; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((claimType == null) ? 0 : claimType.hashCode()); - result = prime * result + ((tags == null) ? 0 : tags.hashCode()); - result = prime * result + ((name == null) ? 0 : name.hashCode()); - result = prime * result + ((readers == null) ? 0 : readers.hashCode()); - result = prime * result + (int) (size ^ (size >>> 32)); - result = prime * result + ((use == null) ? 0 : use.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; - Drive other = (Drive) obj; - if (claimType != other.claimType) - return false; - if (!Objects.equal(tags, other.tags)) - return false; - if (!Objects.equal(name, other.name)) - return false; - if (!Objects.equal(readers, other.readers)) - return false; - if (size != other.size) - return false; - if (use == null) { - if (other.use != null) - return false; - } else if (!use.equals(other.use)) - return false; - return true; - } - - @Override - public String toString() { - return "[uuid=" + uuid + ", name=" + name + ", use=" + use + ", size=" + size + ", claimType=" + claimType - + ", tags=" + tags + ", readers=" + readers + "]"; - } - -} http://git-wip-us.apache.org/repos/asf/jclouds/blob/f7aea987/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/domain/DriveData.java ---------------------------------------------------------------------- diff --git a/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/domain/DriveData.java b/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/domain/DriveData.java deleted file mode 100644 index 550d87a..0000000 --- a/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/domain/DriveData.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF 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.cloudsigma.domain; - -import org.jclouds.javax.annotation.Nullable; - -public class DriveData extends Drive { - public static class Builder extends Drive.Builder { - - /** - * {@inheritDoc} - */ - @Override - public Builder claimType(ClaimType claimType) { - return Builder.class.cast(super.claimType(claimType)); - } - - /** - * {@inheritDoc} - */ - @Override - public Builder name(String name) { - return Builder.class.cast(super.name(name)); - } - - /** - * {@inheritDoc} - */ - @Override - public Builder tags(Iterable<String> tags) { - return Builder.class.cast(super.tags(tags)); - } - - /** - * {@inheritDoc} - */ - @Override - public Builder readers(Iterable<String> readers) { - return Builder.class.cast(super.readers(readers)); - } - - /** - * {@inheritDoc} - */ - @Override - public Builder size(long size) { - return Builder.class.cast(super.size(size)); - } - - /** - * {@inheritDoc} - */ - @Override - public Builder use(Iterable<String> use) { - return Builder.class.cast(super.use(use)); - } - - public DriveData build() { - return new DriveData(uuid, name, size, claimType, tags, readers, use); - } - } - - public DriveData(@Nullable String uuid, String name, long size, @Nullable ClaimType claimType, - Iterable<String> tags, Iterable<String> readers, Iterable<String> use) { - super(uuid, name, size, claimType, tags, readers, use); - } -} http://git-wip-us.apache.org/repos/asf/jclouds/blob/f7aea987/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/domain/DriveInfo.java ---------------------------------------------------------------------- diff --git a/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/domain/DriveInfo.java b/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/domain/DriveInfo.java deleted file mode 100644 index a335a38..0000000 --- a/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/domain/DriveInfo.java +++ /dev/null @@ -1,466 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF 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.cloudsigma.domain; - -import static com.google.common.base.Preconditions.checkNotNull; - -import java.net.URI; -import java.util.Set; - -import org.jclouds.javax.annotation.Nullable; - -import com.google.common.collect.ImmutableSet; - -public class DriveInfo extends Drive { - public static class Builder extends Drive.Builder { - - protected DriveStatus status; - protected String user; - protected Set<String> claimed = ImmutableSet.of(); - @Nullable - protected String encryptionCipher; - @Nullable - protected String imaging; - protected DriveMetrics metrics; - private Boolean autoexpanding; - private Integer bits; - private String description; - private Set<String> driveType = ImmutableSet.of(); - private String encryptionKey; - private Boolean free; - private String installNotes; - private String os; - private DriveType type; - private URI url; - - public Builder status(DriveStatus status) { - this.status = status; - return this; - } - - public Builder user(String user) { - this.user = user; - return this; - } - - public Builder claimed(Iterable<String> claimed) { - this.claimed = ImmutableSet.copyOf(checkNotNull(claimed, "claimed")); - return this; - } - - public Builder imaging(String imaging) { - this.imaging = imaging; - return this; - } - - public Builder metrics(DriveMetrics metrics) { - this.metrics = metrics; - return this; - } - - public Builder encryptionCipher(String encryptionCipher) { - this.encryptionCipher = encryptionCipher; - return this; - } - - public Builder autoexpanding(Boolean autoexpanding) { - this.autoexpanding = autoexpanding; - return this; - } - - public Builder bits(Integer bits) { - this.bits = bits; - return this; - } - - public Builder description(String description) { - this.description = description; - return this; - } - - public Builder driveType(Iterable<String> driveType) { - this.driveType = ImmutableSet.copyOf(checkNotNull(driveType, "driveType")); - return this; - } - - public Builder encryptionKey(String encryptionKey) { - this.encryptionKey = encryptionKey; - return this; - } - - public Builder free(Boolean free) { - this.free = free; - return this; - } - - public Builder installNotes(String installNotes) { - this.installNotes = installNotes; - return this; - } - - public Builder os(String os) { - this.os = os; - return this; - } - - public Builder type(DriveType type) { - this.type = type; - return this; - } - - public Builder url(URI url) { - this.url = url; - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public Builder claimType(ClaimType claimType) { - return Builder.class.cast(super.claimType(claimType)); - } - - /** - * {@inheritDoc} - */ - @Override - public Builder tags(Iterable<String> tags) { - return Builder.class.cast(super.tags(tags)); - } - - /** - * {@inheritDoc} - */ - @Override - public Builder readers(Iterable<String> readers) { - return Builder.class.cast(super.readers(readers)); - } - - /** - * {@inheritDoc} - */ - @Override - public Builder size(long size) { - return Builder.class.cast(super.size(size)); - } - - /** - * {@inheritDoc} - */ - @Override - public Builder uuid(String uuid) { - return Builder.class.cast(super.uuid(uuid)); - } - - /** - * {@inheritDoc} - */ - @Override - public Builder name(String name) { - return Builder.class.cast(super.name(name)); - } - - /** - * {@inheritDoc} - */ - @Override - public Builder use(Iterable<String> use) { - return Builder.class.cast(super.use(use)); - } - - public static Builder fromDriveInfo(DriveInfo in) { - return new Builder().uuid(in.getUuid()).name(in.getName()).size(in.getSize()).claimType(in.getClaimType()) - .readers(in.getReaders()).use(in.getUse()).status(in.getStatus()).user(in.getUser()) - .claimed(in.getClaimed()).encryptionCipher(in.getEncryptionCipher()).imaging(in.getImaging()) - .metrics(in.getMetrics()).autoexpanding(in.getAutoexpanding()).bits(in.getBits()) - .description(in.getDescription()).encryptionKey(in.getEncryptionKey()).free(in.getFree()) - .installNotes(in.getInstallNotes()).type(in.getType()).url(in.getUrl()); - } - - /** - * {@inheritDoc} - */ - @Override - public DriveInfo build() { - return new DriveInfo(uuid, name, size, claimType, tags, readers, use, status, user, claimed, encryptionCipher, - imaging, metrics, autoexpanding, bits, description, driveType, encryptionKey, free, installNotes, os, - type, url); - } - - } - - protected final DriveStatus status; - protected final String user; - protected final Set<String> claimed; - @Nullable - protected final String encryptionCipher; - @Nullable - protected final String imaging; - protected final DriveMetrics metrics; - private final Boolean autoexpanding; - private final Integer bits; - private final String description; - private final ImmutableSet<String> driveType; - private final String encryptionKey; - private final Boolean free; - private final String installNotes; - private final String os; - private final DriveType type; - private final URI url; - - public DriveInfo(String uuid, String name, long size, ClaimType claimType, Iterable<String> tags, Iterable<String> readers, - Iterable<String> use, DriveStatus status, String user, Set<String> claimed, String encryptionCipher, - String imaging, DriveMetrics metrics, Boolean autoexpanding, Integer bits, String description, - Iterable<String> driveType, String encryptionKey, Boolean free, String installNotes, String os, - DriveType type, URI url) { - super(uuid, name, size, claimType, tags, readers, use); - this.status = status; - this.user = user; - this.claimed = ImmutableSet.copyOf(checkNotNull(claimed, "claimed")); - this.encryptionCipher = encryptionCipher; - this.imaging = imaging; - this.metrics = checkNotNull(metrics, "metrics"); - this.autoexpanding = autoexpanding; - this.bits = bits; - this.description = description; - this.driveType = ImmutableSet.copyOf(driveType); - this.encryptionKey = encryptionKey; - this.free = free; - this.installNotes = installNotes; - this.os = os; - this.type = type; - this.url = url; - } - - /** - * - * @return current status of the drive - */ - public DriveStatus getStatus() { - return status; - } - - /** - * - * @return owner of the drive - */ - public String getUser() { - return user; - } - - /** - * - * @return if drive is in use by a server, values are the server uuids - */ - public Set<String> getClaimed() { - return claimed; - } - - /** - * - * @return either 'none' or 'aes-xts-plain' (the default) - */ - @Nullable - public String getEncryptionCipher() { - return encryptionCipher; - } - - /** - * - * @return percentage completed of drive imaging if this is underway, or 'queued' if waiting for - * another imaging operation to complete first - */ - public String getImaging() { - return imaging; - } - - /** - * - * @return i/o and request metrics for read and write ops - */ - public DriveMetrics getMetrics() { - return metrics; - } - - // TODO - public Boolean getAutoexpanding() { - return autoexpanding; - } - - // TODO - public Integer getBits() { - return bits; - } - - // TODO undocumented - public String getDescription() { - return description; - } - - // TODO - public Set<String> getDriveType() { - return driveType; - } - - // TODO - public String getEncryptionKey() { - return encryptionKey; - } - - // TODO - public Boolean getFree() { - return free; - } - - // TODO - public String getInstallNotes() { - return installNotes; - } - - // TODO - public String getOs() { - return os; - } - - // TODO - public DriveType getType() { - return type; - } - - public URI getUrl() { - return url; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = super.hashCode(); - result = prime * result + ((autoexpanding == null) ? 0 : autoexpanding.hashCode()); - result = prime * result + ((bits == null) ? 0 : bits.hashCode()); - result = prime * result + ((claimed == null) ? 0 : claimed.hashCode()); - result = prime * result + ((description == null) ? 0 : description.hashCode()); - result = prime * result + ((driveType == null) ? 0 : driveType.hashCode()); - result = prime * result + ((encryptionCipher == null) ? 0 : encryptionCipher.hashCode()); - result = prime * result + ((encryptionKey == null) ? 0 : encryptionKey.hashCode()); - result = prime * result + ((free == null) ? 0 : free.hashCode()); - result = prime * result + ((imaging == null) ? 0 : imaging.hashCode()); - result = prime * result + ((installNotes == null) ? 0 : installNotes.hashCode()); - result = prime * result + ((metrics == null) ? 0 : metrics.hashCode()); - result = prime * result + ((os == null) ? 0 : os.hashCode()); - result = prime * result + ((status == null) ? 0 : status.hashCode()); - result = prime * result + ((type == null) ? 0 : type.hashCode()); - result = prime * result + ((url == null) ? 0 : url.hashCode()); - result = prime * result + ((user == null) ? 0 : user.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (!super.equals(obj)) - return false; - if (getClass() != obj.getClass()) - return false; - DriveInfo other = (DriveInfo) obj; - if (autoexpanding == null) { - if (other.autoexpanding != null) - return false; - } else if (!autoexpanding.equals(other.autoexpanding)) - return false; - if (bits == null) { - if (other.bits != null) - return false; - } else if (!bits.equals(other.bits)) - return false; - if (claimed == null) { - if (other.claimed != null) - return false; - } else if (!claimed.equals(other.claimed)) - return false; - if (description == null) { - if (other.description != null) - return false; - } else if (!description.equals(other.description)) - return false; - if (driveType == null) { - if (other.driveType != null) - return false; - } else if (!driveType.equals(other.driveType)) - return false; - if (encryptionCipher == null) { - if (other.encryptionCipher != null) - return false; - } else if (!encryptionCipher.equals(other.encryptionCipher)) - return false; - if (encryptionKey == null) { - if (other.encryptionKey != null) - return false; - } else if (!encryptionKey.equals(other.encryptionKey)) - return false; - if (free == null) { - if (other.free != null) - return false; - } else if (!free.equals(other.free)) - return false; - if (imaging == null) { - if (other.imaging != null) - return false; - } else if (!imaging.equals(other.imaging)) - return false; - if (installNotes == null) { - if (other.installNotes != null) - return false; - } else if (!installNotes.equals(other.installNotes)) - return false; - if (metrics == null) { - if (other.metrics != null) - return false; - } else if (!metrics.equals(other.metrics)) - return false; - if (os == null) { - if (other.os != null) - return false; - } else if (!os.equals(other.os)) - return false; - if (status != other.status) - return false; - if (type != other.type) - return false; - if (url == null) { - if (other.url != null) - return false; - } else if (!url.equals(other.url)) - return false; - if (user == null) { - if (other.user != null) - return false; - } else if (!user.equals(other.user)) - return false; - return true; - } - - @Override - public String toString() { - return "[size=" + size + ", claimType=" + claimType + ", tags=" + tags + ", readers=" + readers - + ", uuid=" + uuid + ", name=" + name + ", use=" + use + ", status=" + status - + ", user=" + user + ", claimed=" + claimed + ", encryptionCipher=" + encryptionCipher - + ", imaging=" + imaging + ", metrics=" + metrics + "]"; - } - -} http://git-wip-us.apache.org/repos/asf/jclouds/blob/f7aea987/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/domain/DriveMetrics.java ---------------------------------------------------------------------- diff --git a/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/domain/DriveMetrics.java b/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/domain/DriveMetrics.java deleted file mode 100644 index 768cf54..0000000 --- a/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/domain/DriveMetrics.java +++ /dev/null @@ -1,132 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF 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.cloudsigma.domain; - - -public class DriveMetrics { - public static class Builder { - protected long readBytes; - protected long readRequests; - protected long writeBytes; - protected long writeRequests; - - public Builder readBytes(long readBytes) { - this.readBytes = readBytes; - return this; - } - - public Builder readRequests(long readRequests) { - this.readRequests = readRequests; - return this; - } - - public Builder writeBytes(long writeBytes) { - this.writeBytes = writeBytes; - return this; - } - - public Builder writeRequests(long writeRequests) { - this.writeRequests = writeRequests; - return this; - } - - public DriveMetrics build() { - return new DriveMetrics(readBytes, readRequests, writeBytes, writeRequests); - } - } - - protected final long readBytes; - protected final long readRequests; - protected final long writeBytes; - protected final long writeRequests; - - public DriveMetrics(long readBytes, long readRequests, long writeBytes, long writeRequests) { - this.readBytes = readBytes; - this.readRequests = readRequests; - this.writeBytes = writeBytes; - this.writeRequests = writeRequests; - } - - /** - * - * @return Cumulative i/o byte/request count for each drive - */ - public long getReadBytes() { - return readBytes; - } - - /** - * - * @return Cumulative i/o byte/request count for each drive - */ - public long getReadRequests() { - return readRequests; - } - - /** - * - * @return Cumulative i/o byte/request count for each drive - */ - public long getWriteBytes() { - return writeBytes; - } - - /** - * - * @return Cumulative i/o byte/request count for each drive - */ - public long getWriteRequests() { - return writeRequests; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + (int) (readBytes ^ (readBytes >>> 32)); - result = prime * result + (int) (readRequests ^ (readRequests >>> 32)); - result = prime * result + (int) (writeBytes ^ (writeBytes >>> 32)); - result = prime * result + (int) (writeRequests ^ (writeRequests >>> 32)); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - DriveMetrics other = (DriveMetrics) obj; - if (readBytes != other.readBytes) - return false; - if (readRequests != other.readRequests) - return false; - if (writeBytes != other.writeBytes) - return false; - if (writeRequests != other.writeRequests) - return false; - return true; - } - - @Override - public String toString() { - return "[readBytes=" + readBytes + ", readRequests=" + readRequests + ", writeBytes=" + writeBytes - + ", writeRequests=" + writeRequests + "]"; - } -} http://git-wip-us.apache.org/repos/asf/jclouds/blob/f7aea987/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/domain/DriveStatus.java ---------------------------------------------------------------------- diff --git a/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/domain/DriveStatus.java b/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/domain/DriveStatus.java deleted file mode 100644 index 118b6e9..0000000 --- a/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/domain/DriveStatus.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF 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.cloudsigma.domain; - -import static com.google.common.base.Preconditions.checkNotNull; - -public enum DriveStatus { - ACTIVE, INACTIVE, COPYING, IMAGING, UNRECOGNIZED; - - public String value() { - return name().toLowerCase(); - } - - @Override - public String toString() { - return value(); - } - - public static DriveStatus fromValue(String status) { - try { - return valueOf(checkNotNull(status, "status").toUpperCase()); - } catch (IllegalArgumentException e) { - return UNRECOGNIZED; - } - } - -} http://git-wip-us.apache.org/repos/asf/jclouds/blob/f7aea987/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/domain/DriveType.java ---------------------------------------------------------------------- diff --git a/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/domain/DriveType.java b/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/domain/DriveType.java deleted file mode 100644 index 4015745..0000000 --- a/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/domain/DriveType.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF 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.cloudsigma.domain; - -import static com.google.common.base.Preconditions.checkNotNull; - -public enum DriveType { - DISK, CDROM, SHARED, UNRECOGNIZED; - - public String value() { - return name().toLowerCase(); - } - - @Override - public String toString() { - return value(); - } - - public static DriveType fromValue(String type) { - try { - return valueOf(checkNotNull(type, "type").toUpperCase()); - } catch (IllegalArgumentException e) { - return UNRECOGNIZED; - } - } - -} http://git-wip-us.apache.org/repos/asf/jclouds/blob/f7aea987/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/domain/IDEDevice.java ---------------------------------------------------------------------- diff --git a/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/domain/IDEDevice.java b/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/domain/IDEDevice.java deleted file mode 100644 index 690b0c8..0000000 --- a/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/domain/IDEDevice.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF 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.cloudsigma.domain; - -import static com.google.common.base.Preconditions.checkArgument; - -public class IDEDevice extends Device { - public static class Builder extends Device.Builder { - private final int bus; - private final int unit; - - public Builder(int bus, int unit) { - this.bus = bus; - this.unit = unit; - } - - @Override - public Device build() { - return new IDEDevice(uuid, mediaType, bus, unit); - } - - } - - private final int bus; - private final int unit; - - public IDEDevice(String driveUuid, MediaType mediaType, int bus, int unit) { - super(driveUuid, mediaType); - checkArgument(bus == 0 || bus == 1, "bus must be 0 or 1"); - checkArgument(unit == 0 || unit == 1, "unit must be 0 or 1"); - this.bus = bus; - this.unit = unit; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + bus; - result = prime * result + unit; - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - IDEDevice other = (IDEDevice) obj; - if (bus != other.bus) - return false; - if (unit != other.unit) - return false; - return true; - } - - @Override - public String getId() { - return String.format("ide:%d:%d", bus, unit); - } - - public int getBus() { - return bus; - } - - public int getUnit() { - return unit; - } - - @Override - public String toString() { - return "[id=" + getId() + ", driveUuid=" + driveUuid + ", mediaType=" + mediaType + "]"; - } -} http://git-wip-us.apache.org/repos/asf/jclouds/blob/f7aea987/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/domain/Item.java ---------------------------------------------------------------------- diff --git a/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/domain/Item.java b/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/domain/Item.java deleted file mode 100644 index 8f74ff9..0000000 --- a/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/domain/Item.java +++ /dev/null @@ -1,163 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF 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.cloudsigma.domain; - -import static com.google.common.base.Preconditions.checkNotNull; - -import java.util.Set; - -import org.jclouds.javax.annotation.Nullable; - -import com.google.common.collect.ImmutableSet; - -public class Item { - public static class Builder { - protected String uuid; - protected String name; - protected Set<String> use = ImmutableSet.of(); - - public Builder uuid(String uuid) { - this.uuid = uuid; - return this; - } - - public Builder name(String name) { - this.name = name; - return this; - } - - public Builder use(Iterable<String> use) { - this.use = ImmutableSet.copyOf(checkNotNull(use, "use")); - return this; - } - - public Item build() { - return new Item(uuid, name, use); - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((name == null) ? 0 : name.hashCode()); - result = prime * result + ((use == null) ? 0 : use.hashCode()); - result = prime * result + ((uuid == null) ? 0 : uuid.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; - Builder other = (Builder) obj; - if (name == null) { - if (other.name != null) - return false; - } else if (!name.equals(other.name)) - return false; - if (use == null) { - if (other.use != null) - return false; - } else if (!use.equals(other.use)) - return false; - if (uuid == null) { - if (other.uuid != null) - return false; - } else if (!uuid.equals(other.uuid)) - return false; - return true; - } - } - - @Nullable - protected final String uuid; - protected final String name; - protected final Set<String> use; - - public Item(@Nullable String uuid, String name, Iterable<String> use) { - this.uuid = uuid; - this.name = checkNotNull(name, "name"); - this.use = ImmutableSet.copyOf(checkNotNull(use, "use")); - } - - /** - * - * @return uuid of the item. - */ - @Nullable - public String getUuid() { - return uuid; - } - - /** - * - * @return name of the item - */ - public String getName() { - return name; - } - - /** - * - * @return list of use - */ - public Set<String> getUse() { - return use; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((name == null) ? 0 : name.hashCode()); - result = prime * result + ((use == null) ? 0 : use.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; - Item other = (Item) obj; - if (name == null) { - if (other.name != null) - return false; - } else if (!name.equals(other.name)) - return false; - if (use == null) { - if (other.use != null) - return false; - } else if (!use.equals(other.use)) - return false; - - return true; - } - - @Override - public String toString() { - return "[uuid=" + uuid + ", name=" + name + ", use=" + use + "]"; - } - -} http://git-wip-us.apache.org/repos/asf/jclouds/blob/f7aea987/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/domain/MediaType.java ---------------------------------------------------------------------- diff --git a/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/domain/MediaType.java b/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/domain/MediaType.java deleted file mode 100644 index a04b2ad..0000000 --- a/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/domain/MediaType.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF 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.cloudsigma.domain; - -import static com.google.common.base.Preconditions.checkNotNull; - -/** - * Media type - set to 'cdrom' to simulate a cdrom, set to 'disk' or leave unset to simulate a hard - * disk. - */ -public enum MediaType { - DISK, CDROM, UNRECOGNIZED; - - public String value() { - return name().toLowerCase(); - } - - @Override - public String toString() { - return value(); - } - - public static MediaType fromValue(String type) { - try { - return valueOf(checkNotNull(type, "type").toUpperCase()); - } catch (IllegalArgumentException e) { - return UNRECOGNIZED; - } - } - -} http://git-wip-us.apache.org/repos/asf/jclouds/blob/f7aea987/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/domain/Model.java ---------------------------------------------------------------------- diff --git a/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/domain/Model.java b/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/domain/Model.java deleted file mode 100644 index 28a2d75..0000000 --- a/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/domain/Model.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF 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.cloudsigma.domain; - -import static com.google.common.base.Preconditions.checkNotNull; - -public enum Model { - E1000, RTl8139, VIRTIO, UNRECOGNIZED; - - public String value() { - return name().toLowerCase(); - } - - @Override - public String toString() { - return value(); - } - - public static Model fromValue(String model) { - try { - return valueOf(checkNotNull(model, "model").toUpperCase()); - } catch (IllegalArgumentException e) { - return UNRECOGNIZED; - } - } -} http://git-wip-us.apache.org/repos/asf/jclouds/blob/f7aea987/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/domain/NIC.java ---------------------------------------------------------------------- diff --git a/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/domain/NIC.java b/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/domain/NIC.java deleted file mode 100644 index 46f6b29..0000000 --- a/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/domain/NIC.java +++ /dev/null @@ -1,170 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF 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.cloudsigma.domain; - -import static com.google.common.base.Preconditions.checkNotNull; - -import java.util.Set; - -import org.jclouds.javax.annotation.Nullable; - -import com.google.common.collect.ImmutableSet; - -public class NIC { - public static class Builder { - private String dhcp; - private Model model; - private String vlan; - private String mac; - // TODO cloudsigma specific - private Set<String> block = ImmutableSet.of(); - - public Builder dhcp(String dhcp) { - this.dhcp = dhcp; - return this; - } - - public Builder model(Model model) { - this.model = model; - return this; - } - - public Builder vlan(String vlan) { - this.vlan = vlan; - return this; - } - - public Builder mac(String mac) { - this.mac = mac; - return this; - } - - public Builder block(Iterable<String> block) { - this.block = ImmutableSet.copyOf(checkNotNull(block, "block")); - return this; - } - - public NIC build() { - return new NIC(dhcp, model, vlan, mac, block); - } - } - - private final String dhcp; - private final Model model; - private final String vlan; - private final String mac; - private final Set<String> block; - - public NIC(@Nullable String dhcp, Model model, @Nullable String vlan, @Nullable String mac, Iterable<String> block) { - this.dhcp = dhcp; - this.model = checkNotNull(model, "model"); - this.vlan = vlan; - this.mac = mac; - this.block = ImmutableSet.copyOf(checkNotNull(block, "block")); - } - - /** - * - * @return The IP address offered by DHCP to network interface 0. If unset, no address is - * offered. Set to 'auto' to allocate a temporary IP at boot. - */ - public String getDhcp() { - return dhcp; - } - - /** - * - * @return Create network interface with given type (use 'e1000' as default value; 'rtl8139' or - * 'virtio' are also available). - */ - public Model getModel() { - return model; - } - - /** - * - * @return The VLAN to which the network interface is attached. - */ - public String getVlan() { - return vlan; - } - - /** - * - * @return The MAC address of the network interface. If unset, a randomly generated address is - * used. If set, should be unique on the VLAN. - */ - public String getMac() { - return mac; - } - - // TODO undocumented - public Set<String> getBlock() { - return block; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((block == null) ? 0 : block.hashCode()); - result = prime * result + ((dhcp == null) ? 0 : dhcp.hashCode()); - result = prime * result + ((mac == null) ? 0 : mac.hashCode()); - result = prime * result + ((model == null) ? 0 : model.hashCode()); - result = prime * result + ((vlan == null) ? 0 : vlan.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; - NIC other = (NIC) obj; - if (block == null) { - if (other.block != null) - return false; - } else if (!block.equals(other.block)) - return false; - if (dhcp == null) { - if (other.dhcp != null) - return false; - } else if (!dhcp.equals(other.dhcp)) - return false; - if (mac == null) { - if (other.mac != null) - return false; - } else if (!mac.equals(other.mac)) - return false; - if (model != other.model) - return false; - if (vlan == null) { - if (other.vlan != null) - return false; - } else if (!vlan.equals(other.vlan)) - return false; - return true; - } - - @Override - public String toString() { - return "[dhcp=" + dhcp + ", model=" + model + ", vlan=" + vlan + ", mac=" + mac + ", block=" + block + "]"; - } -} http://git-wip-us.apache.org/repos/asf/jclouds/blob/f7aea987/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/domain/ProfileInfo.java ---------------------------------------------------------------------- diff --git a/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/domain/ProfileInfo.java b/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/domain/ProfileInfo.java deleted file mode 100644 index 377df39..0000000 --- a/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/domain/ProfileInfo.java +++ /dev/null @@ -1,191 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF 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.cloudsigma.domain; - -import static com.google.common.base.Preconditions.checkNotNull; - -public class ProfileInfo { - - public static class Builder { - protected String uuid; - protected String email; - protected String firstName; - protected String lastName; - protected String nickName; - protected ProfileType type = ProfileType.REGULAR; - - public Builder uuid(String uuid) { - this.uuid = uuid; - return this; - } - - public Builder email(String email) { - this.email = email; - return this; - } - - public Builder firstName(String firstName) { - this.firstName = firstName; - return this; - } - - public Builder lastName(String lastName) { - this.lastName = lastName; - return this; - } - - public Builder nickName(String nickName) { - this.nickName = nickName; - return this; - } - - public Builder type(ProfileType type) { - this.type = type; - return this; - } - - public ProfileInfo build() { - return new ProfileInfo(uuid, email, firstName, lastName, nickName, type); - } - - } - - protected final String uuid; - protected final String email; - protected final String firstName; - protected final String lastName; - protected final String nickName; - protected final ProfileType type; - - public ProfileInfo(String uuid, String email, String firstName, String lastName, String nickName, ProfileType type) { - this.uuid = checkNotNull(uuid, "uuid"); - this.email = checkNotNull(email, "email"); - this.firstName = checkNotNull(firstName, "firstName"); - this.lastName = checkNotNull(lastName, "lastName"); - this.nickName = checkNotNull(nickName, "nickName"); - this.type = checkNotNull(type, "type"); - } - - /** - * - * @return uuid of the profile. - */ - public String getUuid() { - return uuid; - } - - /** - * Checks for valid email address - * - * @return email of the profile. - */ - public String getEmail() { - return email; - } - - /** - * - * @return firstName of the profile. - */ - protected String getFirstName() { - return firstName; - } - - /** - * - * @return lastName of the profile. - */ - protected String getLastName() { - return lastName; - } - - /** - * Used in phpBB nick name - * - * @return nickName of the profile. - */ - protected String getNickName() { - return nickName; - } - - /** - * - * @return type of the profile. - */ - protected ProfileType getType() { - return type; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((email == null) ? 0 : email.hashCode()); - result = prime * result + ((firstName == null) ? 0 : firstName.hashCode()); - result = prime * result + ((lastName == null) ? 0 : lastName.hashCode()); - result = prime * result + ((nickName == null) ? 0 : nickName.hashCode()); - result = prime * result + ((type == null) ? 0 : type.hashCode()); - result = prime * result + ((uuid == null) ? 0 : uuid.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; - ProfileInfo other = (ProfileInfo) obj; - if (email == null) { - if (other.email != null) - return false; - } else if (!email.equals(other.email)) - return false; - if (firstName == null) { - if (other.firstName != null) - return false; - } else if (!firstName.equals(other.firstName)) - return false; - if (lastName == null) { - if (other.lastName != null) - return false; - } else if (!lastName.equals(other.lastName)) - return false; - if (nickName == null) { - if (other.nickName != null) - return false; - } else if (!nickName.equals(other.nickName)) - return false; - if (type != other.type) - return false; - if (uuid == null) { - if (other.uuid != null) - return false; - } else if (!uuid.equals(other.uuid)) - return false; - return true; - } - - @Override - public String toString() { - return "[uuid=" + uuid + ", email=" + email + ", firstName=" + firstName + ", lastName=" + lastName - + ", nickName=" + nickName + ", type=" + type + "]"; - } - -}
