aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2014-07-21 14:56:24 -0700
committerScott Jackson <daneren2005@gmail.com>2014-07-21 14:56:24 -0700
commitced0c1db4fef12173c0b65cb394dcb410aae8007 (patch)
tree5993366c44cd24d64069699a445b77e8e76327db
parent4718fa8172ba230dbf0cbb7a786a01514d688992 (diff)
downloaddsub-ced0c1db4fef12173c0b65cb394dcb410aae8007.tar.gz
dsub-ced0c1db4fef12173c0b65cb394dcb410aae8007.tar.bz2
dsub-ced0c1db4fef12173c0b65cb394dcb410aae8007.zip
Add type information for ServerInfo
Add ability to differentiate between a stock Subsonic installation and a Madsonic installation
-rw-r--r--src/github/daneren2005/dsub/domain/ServerInfo.java45
1 files changed, 43 insertions, 2 deletions
diff --git a/src/github/daneren2005/dsub/domain/ServerInfo.java b/src/github/daneren2005/dsub/domain/ServerInfo.java
index 43c7319a..806d4df5 100644
--- a/src/github/daneren2005/dsub/domain/ServerInfo.java
+++ b/src/github/daneren2005/dsub/domain/ServerInfo.java
@@ -23,10 +23,17 @@ package github.daneren2005.dsub.domain;
*
* @author Sindre Mehus
*/
-public class ServerInfo {
-
+public class ServerInfo implements Serializable {
+ public static final int TYPE_SUBSONIC = 1;
+ public static final int TYPE_MADSONIC = 2;
+
private boolean isLicenseValid;
private Version restVersion;
+ private int type;
+
+ public ServerInfo() {
+ type = TYPE_SUBSONIC;
+ }
public boolean isLicenseValid() {
return isLicenseValid;
@@ -43,4 +50,38 @@ public class ServerInfo {
public void setRestVersion(Version restVersion) {
this.restVersion = restVersion;
}
+
+ public int getRestType() {
+ return type;
+ }
+ public void setRestType(int type) {
+ this.type = type;
+ }
+
+ public boolean isStockSubsonic() {
+ return type == TYPE_SUBSONIC;
+ }
+ public boolean isMadsonic() {
+ return type == TYPE_MADSONIC;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if(this == 0) {
+ return true;
+ } else if(o == null || getClass() != o.getClass()) {
+ return false;
+ }
+
+ final ServerInfo info = (ServerInfo) o;
+
+ if(this.type != info.type) {
+ return false;
+ } else if(this.restVersion == null || info.restVersion == null) {
+ // Should never be null unless just starting up
+ return false;
+ } else {
+ return this.restVersion.equals(info.restVersion);
+ }
+ }
}