From ced0c1db4fef12173c0b65cb394dcb410aae8007 Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Mon, 21 Jul 2014 14:56:24 -0700 Subject: Add type information for ServerInfo Add ability to differentiate between a stock Subsonic installation and a Madsonic installation --- src/github/daneren2005/dsub/domain/ServerInfo.java | 45 +++++++++++++++++++++- 1 file changed, 43 insertions(+), 2 deletions(-) (limited to 'src/github') 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); + } + } } -- cgit v1.2.3