OpenNMS API 1.2.9

## org.opennms.netmgt.config
Class GroupManager

    java.lang.Object
      org.opennms.netmgt.config.GroupManager

Direct Known Subclasses:
  GroupFactory, MockGroupManager

public abstract class GroupManager
extends java.lang.Object

Author:
  david TODO To change the template for this generated type comment go to Window - Preferences - Java - Code Style - Code Templates

Field Summary
`protected static java.util.HashMap` `m_dutySchedules` The duty schedules for each group
`private java.util.Map` `m_groups` A mapping of Group object by name
`private Header` `m_oldHeader`

Constructor Summary
`GroupManager()`

Method Summary
`private static void` `buildDutySchedules(java.util.Map groups)` Builds a mapping between groups and duty schedules.
`void` `deleteGroup(java.lang.String name)` Removes the group from the list of groups.
`void` `deleteUser(java.lang.String name)` Removes the user from the list of groups.
`Group` `getGroup(java.lang.String name)` Get a group using its name
`java.util.List` `getGroupNames()`
`java.util.Map` `getGroups()` Get the groups
`long` `groupNextOnDuty(java.lang.String group, java.util.Calendar time)` Determines when a group is next on duty.
`boolean` `hasGroup(java.lang.String groupName)` Returns a boolean indicating if the group name appears in the xml file
`boolean` `isGroupOnDuty(java.lang.String group, java.util.Calendar time)` Determines if a group is on duty at a given time.
`protected void` `parseXml(java.io.Reader reader)`
`void` `renameGroup(java.lang.String oldName, java.lang.String newName)` Renames the group from the list of groups.
`void` `renameUser(java.lang.String oldName, java.lang.String newName)` When this method is called group name is changed, so also is the groupname belonging to the view.
`void` `saveGroup(java.lang.String name, Group details)` Adds a new user and overwrites the "groups.xml"
`void` `saveGroups()`
`protected abstract void` `saveXml(java.lang.String data)`
`void` `setGroups(java.util.Map grp)` Set the groups data
`protected abstract void` `updateFromFile()`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### m_dutySchedules

    protected static java.util.HashMap m_dutySchedules

  The duty schedules for each group

### m_groups

    private java.util.Map m_groups

  A mapping of Group object by name

### m_oldHeader

    private Header m_oldHeader

Constructor Detail

### GroupManager

    public GroupManager()

Method Detail

### parseXml

    protected void parseXml(java.io.Reader reader)
                     throws org.exolab.castor.xml.MarshalException,
                            org.exolab.castor.xml.ValidationException

  Parameters:
    `reader` -
  Throws:
    `org.exolab.castor.xml.MarshalException`
    `org.exolab.castor.xml.ValidationException`

### setGroups

    public void setGroups(java.util.Map grp)

  Set the groups data

### getGroups

    public java.util.Map getGroups()
                            throws java.io.IOException,
                                   org.exolab.castor.xml.MarshalException,
                                   org.exolab.castor.xml.ValidationException

  Get the groups

  Throws:
    `java.io.IOException`
    `org.exolab.castor.xml.MarshalException`
    `org.exolab.castor.xml.ValidationException`

### updateFromFile

    protected abstract void updateFromFile()
                                    throws java.io.IOException,
                                           org.exolab.castor.xml.MarshalException,
                                           org.exolab.castor.xml.ValidationException

  Throws:
    `org.exolab.castor.xml.ValidationException`
    `org.exolab.castor.xml.MarshalException`
    `java.io.IOException`

### hasGroup

    public boolean hasGroup(java.lang.String groupName)
                     throws java.io.IOException,
                            org.exolab.castor.xml.MarshalException,
                            org.exolab.castor.xml.ValidationException

  Returns a boolean indicating if the group name appears in the xml file

  Returns:
    true if the group exists in the xml file, false otherwise
  Throws:
    `java.io.IOException`
    `org.exolab.castor.xml.MarshalException`
    `org.exolab.castor.xml.ValidationException`

### getGroupNames

    public java.util.List getGroupNames()
                                 throws java.io.IOException,
                                        org.exolab.castor.xml.MarshalException,
                                        org.exolab.castor.xml.ValidationException

  Throws:
    `java.io.IOException`
    `org.exolab.castor.xml.MarshalException`
    `org.exolab.castor.xml.ValidationException`

### getGroup

    public Group getGroup(java.lang.String name)
                   throws java.io.IOException,
                          org.exolab.castor.xml.MarshalException,
                          org.exolab.castor.xml.ValidationException

  Get a group using its name

  Parameters:
    `name` - the name of the group to return
  Returns:
    Group, the group specified by name
  Throws:
    `java.io.IOException`
    `org.exolab.castor.xml.MarshalException`
    `org.exolab.castor.xml.ValidationException`

### saveGroups

    public void saveGroups()
                    throws java.lang.Exception

  Throws:
    `java.lang.Exception`

### buildDutySchedules

    private static void buildDutySchedules(java.util.Map groups)

  Builds a mapping between groups and duty schedules. These are used when determining to send a notice to a given group. This helps speed up the decision process.

  Parameters:
    `groups` - the map of groups parsed from the xml config file

### isGroupOnDuty

    public boolean isGroupOnDuty(java.lang.String group,
                                 java.util.Calendar time)
                          throws java.io.IOException,
                                 org.exolab.castor.xml.MarshalException,
                                 org.exolab.castor.xml.ValidationException

  Determines if a group is on duty at a given time. If a group has no duty schedules listed in the config file, that group is assumed to always be on duty.

  Parameters:
    `group` - the group whose duty schedule we want
    `time` - the time to check for a duty schedule
  Returns:
    boolean, true if the group is on duty, false otherwise.
  Throws:
    `java.io.IOException`
    `org.exolab.castor.xml.MarshalException`
    `org.exolab.castor.xml.ValidationException`

### groupNextOnDuty

    public long groupNextOnDuty(java.lang.String group,
                                java.util.Calendar time)
                         throws java.io.IOException,
                                org.exolab.castor.xml.MarshalException,
                                org.exolab.castor.xml.ValidationException

  Determines when a group is next on duty. If a group has no duty schedules listed in the config file, that group is assumed to always be on duty.

  Parameters:
    `group` - the group whose duty schedule we want
    `time` - the time to check for a duty schedule
  Returns:
    long, the time in millisec until the group is next on duty
  Throws:
    `java.io.IOException`
    `org.exolab.castor.xml.MarshalException`
    `org.exolab.castor.xml.ValidationException`

### saveXml

    protected abstract void saveXml(java.lang.String data)
                             throws java.io.IOException

  Parameters:
    `data` -
  Throws:
    `java.io.IOException`

### saveGroup

    public void saveGroup(java.lang.String name,
                          Group details)
                   throws java.lang.Exception

  Adds a new user and overwrites the "groups.xml"

  Throws:
    `java.lang.Exception`

### deleteUser

    public void deleteUser(java.lang.String name)
                    throws java.lang.Exception

  Removes the user from the list of groups. Then overwrites to the "groups.xml"

  Throws:
    `java.lang.Exception`

### deleteGroup

    public void deleteGroup(java.lang.String name)
                     throws java.lang.Exception

  Removes the group from the list of groups. Then overwrites to the "groups.xml"

  Throws:
    `java.lang.Exception`

### renameGroup

    public void renameGroup(java.lang.String oldName,
                            java.lang.String newName)
                     throws java.lang.Exception

  Renames the group from the list of groups. Then overwrites to the "groups.xml"

  Throws:
    `java.lang.Exception`

### renameUser

    public void renameUser(java.lang.String oldName,
                           java.lang.String newName)
                    throws java.lang.Exception

  When this method is called group name is changed, so also is the groupname belonging to the view. Also overwrites the "groups.xml" file

  Throws:
    `java.lang.Exception`

OpenNMS API 1.2.9

Generated by ranger on May 19 2007 2335.