ucar.unidata.idv.chooser.adde
Class AddeServer

java.lang.Object
  extended by ucar.unidata.util.NamedThing
      extended by ucar.unidata.idv.chooser.adde.AddeServer
All Implemented Interfaces:
NamedObject

public class AddeServer
extends NamedThing

Holds information about the available adde servers

Version:
$Revision: 1.4 $Date: 2007/07/19 18:11:33 $
Author:
IDV development team

Nested Class Summary
static class AddeServer.Group
          Class Group represents an adde group
 
Field Summary
static String TYPE_ANY
          group type
static String TYPE_IMAGE
          image type
static String TYPE_NONE
          group type
static String TYPE_POINT
          point type
static String TYPE_RADAR
          radar type
static String TYPE_WXTEXT
          text type
 
Constructor Summary
AddeServer()
          ctor
AddeServer(String name)
          ctor
AddeServer(String name, String description)
          ctor
 
Method Summary
 void addGroup(AddeServer.Group group)
          Add the group to me
 void addGroups(List groupsToAdd)
          Add the list of groups
static List coalesce(List servers)
          Merge all of the similarly named servers in the list
 boolean equals(Object o)
          equals
 AddeServer.Group findGroup(String name)
          Find the group with the given name
static AddeServer findServer(List servers, String name)
          Find the server with the given name in the given list
 boolean getActive()
          Get the Active property.
 List getGroups()
          Get the Groups property.
 List getGroupsWithType(String type)
          Get the groups with the given type
 List getGroupsWithType(String type, boolean onlyActive)
          Get the groups with the given type
 boolean getIsLocal()
          Get the IsLocal property.
static List getServersWithType(String type, List servers)
          Find the list of servers that have at least one group with the given type
 boolean hasType(String type)
          Does this server have a group with the given type
static void main(String[] args)
          test
static List processXml(Element root)
          process the xml root
 void setActive(boolean value)
          Set the Active property.
 void setGroups(List value)
          Set the Groups property.
 void setIsLocal(boolean value)
          Set the IsLocal property.
static Element toXml(List servers, boolean localOnly)
          Create the xml tree for all of the given servers
 
Methods inherited from class ucar.unidata.util.NamedThing
getDescription, getName, hashCode, setDescription, setName, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

TYPE_NONE

public static final String TYPE_NONE
group type

See Also:
Constant Field Values

TYPE_ANY

public static final String TYPE_ANY
group type

See Also:
Constant Field Values

TYPE_IMAGE

public static final String TYPE_IMAGE
image type

See Also:
Constant Field Values

TYPE_RADAR

public static final String TYPE_RADAR
radar type

See Also:
Constant Field Values

TYPE_POINT

public static final String TYPE_POINT
point type

See Also:
Constant Field Values

TYPE_WXTEXT

public static final String TYPE_WXTEXT
text type

See Also:
Constant Field Values
Constructor Detail

AddeServer

public AddeServer()
ctor


AddeServer

public AddeServer(String name)
ctor

Parameters:
name - my name

AddeServer

public AddeServer(String name,
                  String description)
ctor

Parameters:
name - my name
description - my description
Method Detail

toXml

public static Element toXml(List servers,
                            boolean localOnly)
                     throws Exception
Create the xml tree for all of the given servers

Parameters:
servers - List of servers
localOnly - Only include servers and groups that are marked as local
Returns:
xml root
Throws:
Exception - On badness

coalesce

public static List coalesce(List servers)
Merge all of the similarly named servers in the list

Parameters:
servers - list of servers
Returns:
merged servers

processXml

public static List processXml(Element root)
process the xml root

Parameters:
root - The xml node
Returns:
List of servers

findServer

public static AddeServer findServer(List servers,
                                    String name)
Find the server with the given name in the given list

Parameters:
servers - List of servers
name - name
Returns:
The found server or null

getServersWithType

public static List getServersWithType(String type,
                                      List servers)
Find the list of servers that have at least one group with the given type

Parameters:
type - group type
servers - servers
Returns:
servers with group of type type

setIsLocal

public void setIsLocal(boolean value)
Set the IsLocal property.

Parameters:
value - The new value for IsLocal

getIsLocal

public boolean getIsLocal()
Get the IsLocal property.

Returns:
The IsLocal

setActive

public void setActive(boolean value)
Set the Active property.

Parameters:
value - The new value for Active

getActive

public boolean getActive()
Get the Active property.

Returns:
The Active

hasType

public boolean hasType(String type)
Does this server have a group with the given type

Parameters:
type - group type
Returns:
has type

addGroup

public void addGroup(AddeServer.Group group)
Add the group to me

Parameters:
group - new group

addGroups

public void addGroups(List groupsToAdd)
Add the list of groups

Parameters:
groupsToAdd - list of groups

setGroups

public void setGroups(List value)
Set the Groups property.

Parameters:
value - The new value for Groups

getGroups

public List getGroups()
Get the Groups property.

Returns:
The Groups

findGroup

public AddeServer.Group findGroup(String name)
Find the group with the given name

Parameters:
name - group name
Returns:
The group with name or null

getGroupsWithType

public List getGroupsWithType(String type)
Get the groups with the given type

Parameters:
type - group type
Returns:
List of groups

getGroupsWithType

public List getGroupsWithType(String type,
                              boolean onlyActive)
Get the groups with the given type

Parameters:
type - group type
onlyActive - If true then only get the active groups
Returns:
List of groups

equals

public boolean equals(Object o)
equals

Overrides:
equals in class NamedThing
Parameters:
o - object
Returns:
equals

main

public static void main(String[] args)
test

Parameters:
args - args