001/* 002 * This file is part of McIDAS-V 003 * 004 * Copyright 2007-2016 005 * Space Science and Engineering Center (SSEC) 006 * University of Wisconsin - Madison 007 * 1225 W. Dayton Street, Madison, WI 53706, USA 008 * https://www.ssec.wisc.edu/mcidas 009 * 010 * All Rights Reserved 011 * 012 * McIDAS-V is built on Unidata's IDV and SSEC's VisAD libraries, and 013 * some McIDAS-V source code is based on IDV and VisAD source code. 014 * 015 * McIDAS-V is free software; you can redistribute it and/or modify 016 * it under the terms of the GNU Lesser Public License as published by 017 * the Free Software Foundation; either version 3 of the License, or 018 * (at your option) any later version. 019 * 020 * McIDAS-V is distributed in the hope that it will be useful, 021 * but WITHOUT ANY WARRANTY; without even the implied warranty of 022 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 023 * GNU Lesser Public License for more details. 024 * 025 * You should have received a copy of the GNU Lesser Public License 026 * along with this program. If not, see http://www.gnu.org/licenses. 027 */ 028 029package edu.wisc.ssec.mcidasv.chooser; 030 031 032/** 033 * Holds the state of server components from {@code servers.xml}. 034 */ 035public class ServerDescriptor { 036 037 /** Is the server active */ 038 private boolean isActive; 039 040 /** Server name or IP address */ 041 private String serverName; 042 043 /** Group name */ 044 private String groupName; 045 046 /** Data type */ 047 private String dataType; 048 049 /** 050 * Create a new server descriptor object. 051 * 052 * @param type Data type. Should be one of {@literal "image", "point", 053 * "grid", "text", "nav"}. 054 * @param name ADDE server name. 055 * @param group ADDE group name. 056 * @param active {@code "true"} if this descriptor should be active. 057 */ 058 public ServerDescriptor(String type, String name, String group, String active) { 059 this.serverName = name; 060 this.groupName = group; 061 this.dataType = type; 062 this.isActive = active.equals("true"); 063 } 064 065 /** 066 * Get the isActive property. 067 * 068 * @return Value of the {@link #isActive} property. 069 */ 070 public boolean getIsActive() { 071 return this.isActive; 072 } 073 074 /** 075 * Get the data type property. 076 * 077 * @return Value of the {@link #dataType} property. 078 */ 079 public String getDataType() { 080 return this.dataType; 081 } 082 083 084 /** 085 * Determine whether or not this server supports data of the given type. 086 * 087 * @param type Data type. Should be one of {@literal "image", "point", 088 * "grid", "text", "nav"}. 089 * 090 * @return {@code true} if {@code type} is supported, {@code false} 091 * otherwise. 092 */ 093 public boolean isDataType(String type) { 094 return this.dataType.equals(type); 095 } 096 097 /** 098 * Get the serverName property. 099 * 100 * @return Value of the {@link #serverName} property. 101 */ 102 public String getServerName() { 103 return this.serverName; 104 } 105 106 107 /** 108 * Get the groupName property. 109 * 110 * @return Value of the {@link #groupName} property. 111 */ 112 public String getGroupName() { 113 return this.groupName; 114 } 115 116 117 /** 118 * Set the isActive property. 119 * 120 * @param newValue The new vaue for the {@link #isActive} property. 121 */ 122 public void setIsActive(boolean newValue) { 123 this.isActive = newValue; 124 } 125 126 /** 127 * Set the dataType property. 128 * 129 * @param newValue The new vaue for the {@link #dataType} property. 130 */ 131 public void setDataType(String newValue) { 132 this.dataType = newValue; 133 } 134 135 /** 136 * Set the serverName property. 137 * 138 * @param newValue The new vaue for the {@link #serverName} property. 139 */ 140 public void setServerName(String newValue) { 141 this.serverName = newValue; 142 } 143 144 145 /** 146 * Set the groupName property. 147 * 148 * @param newValue The new vaue for the {@link #groupName} property. 149 */ 150 public void setGroupName(String newValue) { 151 this.groupName = newValue; 152 } 153 154 155 /** 156 * Get a String representation of this object. 157 * 158 * @return String representation that generally looks like {@literal 159 * "SERVERNAME/GROUPNAME"}. 160 */ 161 public String toString() { 162 StringBuffer buf = new StringBuffer(); 163 buf.append(this.serverName); 164 buf.append("/"); 165 buf.append(this.groupName); 166 return buf.toString(); 167 } 168}