diff --git a/sandbox-providers/softlayer/src/main/java/org/jclouds/softlayer/domain/OperatingSystem.java b/sandbox-providers/softlayer/src/main/java/org/jclouds/softlayer/domain/OperatingSystem.java
new file mode 100644
index 0000000000..053c740e36
--- /dev/null
+++ b/sandbox-providers/softlayer/src/main/java/org/jclouds/softlayer/domain/OperatingSystem.java
@@ -0,0 +1,137 @@
+/**
+ * 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.softlayer.domain;
+
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Sets;
+
+import java.util.Set;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+/**
+ * Extends the SoftLayer_Software_Component data type to include operating system specific properties.
+ *
+ * @author Jason King
+ * @see
+ */
+public class OperatingSystem implements Comparable {
+
+ // There are other properties
+
+ public static Builder builder() {
+ return new Builder();
+ }
+
+ public static class Builder {
+ private int id = -1;
+ private Set passwords = Sets.newLinkedHashSet();
+
+ public Builder id(int id) {
+ this.id = id;
+ return this;
+ }
+
+ public Builder password(Password password) {
+ this.passwords.add(checkNotNull(password, "password"));
+ return this;
+ }
+
+ public Builder passwords(Iterable passwords) {
+ this.passwords = ImmutableSet. copyOf(checkNotNull(passwords, "passwords"));
+ return this;
+ }
+
+ public OperatingSystem build() {
+ return new OperatingSystem(id, passwords);
+ }
+
+ public static Builder fromOperatingSystem(OperatingSystem in) {
+ return OperatingSystem.builder()
+ .id(in.getId())
+ .passwords(in.getPasswords());
+ }
+ }
+
+ private int id = -1;
+ private Set passwords = Sets.newLinkedHashSet();
+
+ // for deserializer
+ OperatingSystem() {
+
+ }
+
+ public OperatingSystem(int id,Iterable passwords) {
+ this.id = id;
+ this.passwords = ImmutableSet. copyOf(checkNotNull(passwords, "passwords"));
+ }
+
+ @Override
+ public int compareTo(OperatingSystem arg0) {
+ return new Integer(id).compareTo(arg0.getId());
+ }
+
+ /**
+ * @return An ID number identifying this Software Component (Software Installation)
+ */
+ public int getId() {
+ return id;
+ }
+
+ /**
+ *
+ * @return Username/Password pairs used for access to this Software Installation.
+ */
+ public Set getPasswords() {
+ return passwords;
+ }
+
+ public Builder toBuilder() {
+ return Builder.fromOperatingSystem(this);
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + (id ^ (id >>> 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;
+ OperatingSystem other = (OperatingSystem) obj;
+ if (id != other.id)
+ return false;
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return "OperatingSystem [id=" + id + ", passwords=" + passwords + "]";
+ }
+}
diff --git a/sandbox-providers/softlayer/src/main/java/org/jclouds/softlayer/domain/Password.java b/sandbox-providers/softlayer/src/main/java/org/jclouds/softlayer/domain/Password.java
new file mode 100644
index 0000000000..bb28d29574
--- /dev/null
+++ b/sandbox-providers/softlayer/src/main/java/org/jclouds/softlayer/domain/Password.java
@@ -0,0 +1,141 @@
+/**
+ * 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.softlayer.domain;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import static com.google.common.base.Strings.emptyToNull;
+
+/**
+ *
+ * Contains a password for a specific software component instance
+ *
+ * @author Jason King
+ * @see
+ */
+public class Password implements Comparable {
+ public static Builder builder() {
+ return new Builder();
+ }
+
+ public static class Builder {
+ private int id = -1;
+ private String username;
+ private String password;
+
+ public Builder id(int id) {
+ this.id = id;
+ return this;
+ }
+
+ public Builder username(String username) {
+ this.username = username;
+ return this;
+ }
+
+ public Builder password(String password) {
+ this.password = password;
+ return this;
+ }
+
+ public Password build() {
+ return new Password(id, username, password);
+ }
+
+ public static Builder fromPassword(Password in) {
+ return Password.builder().id(in.getId())
+ .username(in.getUsername())
+ .password(in.getPassword());
+ }
+ }
+
+ private int id = -1;
+ private String username;
+ private String password;
+
+ // for deserializer
+ Password() {
+
+ }
+
+ public Password(int id, String username, String password) {
+ this.id = id;
+ this.username = checkNotNull(emptyToNull(username),"username cannot be null or empty:"+username);
+ this.password = password;
+ }
+
+ @Override
+ public int compareTo(Password arg0) {
+ return new Integer(id).compareTo(arg0.getId());
+ }
+
+ /**
+ * @return An id number for this specific username/password pair.
+ */
+ public int getId() {
+ return id;
+ }
+
+ /**
+ * @return The username part of the username/password pair.
+ */
+ public String getUsername() {
+ return username;
+ }
+
+ /**
+ * @return The password part of the username/password pair.
+ */
+ public String getPassword() {
+ return password;
+ }
+
+ public Builder toBuilder() {
+ return Builder.fromPassword(this);
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + (id ^ (id >>> 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;
+ Password other = (Password) obj;
+ if (id != other.id)
+ return false;
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return "Password [id=" + id + ", username=" + username + ", password=**********]";
+ }
+
+
+}
diff --git a/sandbox-providers/softlayer/src/main/java/org/jclouds/softlayer/domain/VirtualGuest.java b/sandbox-providers/softlayer/src/main/java/org/jclouds/softlayer/domain/VirtualGuest.java
index 05855c761b..fb5b98253d 100644
--- a/sandbox-providers/softlayer/src/main/java/org/jclouds/softlayer/domain/VirtualGuest.java
+++ b/sandbox-providers/softlayer/src/main/java/org/jclouds/softlayer/domain/VirtualGuest.java
@@ -64,6 +64,7 @@ public class VirtualGuest implements Comparable {
private String primaryBackendIpAddress;
private String primaryIpAddress;
private BillingItemVirtualGuest billingItem;
+ private OperatingSystem operatingSystem;
public Builder id(int id) {
this.id = id;
@@ -170,12 +171,17 @@ public class VirtualGuest implements Comparable {
return this;
}
+ public Builder operatingSystem(OperatingSystem operatingSystem) {
+ this.operatingSystem = operatingSystem;
+ return this;
+ }
+
public VirtualGuest build() {
return new VirtualGuest(accountId, createDate, dedicatedAccountHostOnly, domain,
fullyQualifiedDomainName, hostname, id, lastVerifiedDate, maxCpu,
maxCpuUnits, maxMemory, metricPollDate, modifyDate, notes,
privateNetworkOnly, startCpus, statusId, uuid, primaryBackendIpAddress,
- primaryIpAddress,billingItem);
+ primaryIpAddress,billingItem,operatingSystem);
}
public static Builder fromVirtualGuest(VirtualGuest in) {
@@ -200,7 +206,9 @@ public class VirtualGuest implements Comparable {
.uuid(in.getUuid())
.primaryBackendIpAddress(in.getPrimaryBackendIpAddress())
.primaryIpAddress(in.getPrimaryIpAddress())
- .billingItem(in.getBillingItem());
+ .billingItem(in.getBillingItem())
+ .operatingSystem(in.getOperatingSystem());
+
}
}
@@ -252,6 +260,7 @@ public class VirtualGuest implements Comparable {
private String primaryIpAddress;
private BillingItemVirtualGuest billingItem;
+ private OperatingSystem operatingSystem;
// for deserializer
VirtualGuest() {
@@ -262,7 +271,7 @@ public class VirtualGuest implements Comparable {
String fullyQualifiedDomainName, String hostname, int id, Date lastVerifiedDate, int maxCpu,
String maxCpuUnits, int maxMemory, Date metricPollDate, Date modifyDate, String notes,
boolean privateNetworkOnly, int startCpus, int statusId, String uuid, String primaryBackendIpAddress,
- String primaryIpAddress,BillingItemVirtualGuest billingItem) {
+ String primaryIpAddress,BillingItemVirtualGuest billingItem, OperatingSystem operatingSystem) {
this.accountId = accountId;
this.createDate = createDate;
this.dedicatedAccountHostOnly = dedicatedAccountHostOnly;
@@ -284,6 +293,7 @@ public class VirtualGuest implements Comparable {
this.primaryBackendIpAddress = primaryBackendIpAddress;
this.primaryIpAddress = primaryIpAddress;
this.billingItem = billingItem;
+ this.operatingSystem = operatingSystem;
}
@Override
@@ -441,6 +451,13 @@ public class VirtualGuest implements Comparable {
return billingItem;
}
+ /**
+ * @return A guest's operating system.
+ */
+ public OperatingSystem getOperatingSystem() {
+ return operatingSystem;
+ }
+
@Override
public int hashCode() {
final int prime = 31;
@@ -466,6 +483,7 @@ public class VirtualGuest implements Comparable {
result = prime * result + statusId;
result = prime * result + ((uuid == null) ? 0 : uuid.hashCode());
result = prime * result + ((billingItem == null) ? 0 : billingItem.hashCode());
+ result = prime * result + ((operatingSystem == null) ? 0 : operatingSystem.hashCode());
return result;
}
@@ -559,6 +577,11 @@ public class VirtualGuest implements Comparable {
return false;
} else if (!billingItem.equals(other.billingItem))
return false;
+ if (operatingSystem == null) {
+ if (other.operatingSystem != null)
+ return false;
+ } else if (!operatingSystem.equals(other.operatingSystem))
+ return false;
return true;
}
@@ -571,7 +594,7 @@ public class VirtualGuest implements Comparable {
+ ", metricPollDate=" + metricPollDate + ", modifyDate=" + modifyDate + ", notes=" + notes
+ ", primaryBackendIpAddress=" + primaryBackendIpAddress + ", primaryIpAddress=" + primaryIpAddress
+ ", privateNetworkOnly=" + privateNetworkOnly + ", startCpus=" + startCpus + ", statusId=" + statusId
- + ", uuid=" + uuid + ", billingItem="+billingItem+"]";
+ + ", uuid=" + uuid + ", billingItem="+billingItem+", operatingSystem="+operatingSystem+"]";
}
}