001    /*
002     * This file is part of McIDAS-V
003     *
004     * Copyright 2007-2013
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    
029    package edu.wisc.ssec.mcidasv.chooser;
030    
031    
032    /**
033     * Class ServerDescriptor Holds the state of
034     * server components from servers.xml
035     */
036    public class ServerDescriptor {
037    
038        /** Is the server active */
039        private boolean isActive;
040    
041        /** Server name or IP address */
042        private String serverName;
043    
044        /** Group name */
045        private String groupName;
046    
047        /** Data type */
048        private String dataType;
049    
050        /**
051         * Constructor
052         *
053         *
054         */
055        public ServerDescriptor(String type, String name, String group, String active) {
056            this.serverName = name;
057            this.groupName = group;
058            this.dataType = type;
059            this.isActive = active.equals("true");
060        }
061    
062        /**
063         * Get the isActive property.
064         *
065         * @return The isActive property.
066         */
067        public boolean getIsActive() {
068            return this.isActive;
069        }
070    
071        /**
072         * Get the data type
073         *
074         * @return The dataType property.
075         */
076        public String getDataType() {
077            return this.dataType;
078        }
079    
080    
081        /**
082         * Does this server contain data of specified type
083         *
084         * @return true or false.
085         */
086        public boolean isDataType(String type) {
087            return this.dataType.equals(type);
088        }
089    
090        /**
091         * Get the serverName property.
092         *
093         * @return The serverName property.
094         */
095        public String getServerName() {
096            return this.serverName;
097        }
098    
099    
100        /**
101         * Get the groupName property.
102         *
103         * @return The groupName property.
104         */
105        public String getGroupName() {
106            return this.groupName;
107        }
108    
109    
110        /**
111         * Set the isActive property.
112         *
113         * @param newValue The new vaue for the isActive property.
114         */
115        public void setIsActive(boolean newValue) {
116            this.isActive = newValue;
117        }
118    
119        /**
120         * Set the dataType property.
121         *
122         * @param newValue The new vaue for the dataType property.
123         */
124        public void setDataType(String newValue) {
125            this.dataType = newValue;
126        }
127    
128        /**
129         * Set the serverName property.
130         *
131         * @param newValue The new vaue for the serverName property.
132         */
133        public void setServerName(String newValue) {
134            this.serverName = newValue;
135        }
136    
137    
138        /**
139         * Set the groupName property.
140         *
141         * @param newValue The new vaue for the groupName property.
142         */
143        public void setGroupName(String newValue) {
144            this.groupName = newValue;
145        }
146    
147    
148        /**
149         * Get a String representation of this object
150         * @return a string representation
151         */
152        public String toString() {
153            StringBuffer buf = new StringBuffer();
154            buf.append(this.serverName);
155            buf.append("/");
156            buf.append(this.groupName);
157            return buf.toString();
158        }
159    }