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