OpenNMS API 1.1.3

org.opennms.netmgt.config
Class GroupFactory

java.lang.Object
  extended byorg.opennms.netmgt.config.GroupFactory

public class GroupFactory
extends java.lang.Object


Field Summary
protected static java.io.InputStream configIn
          An input stream for the groups configuration file
protected static java.io.File groupFile
          File path of groups.xml
private static boolean initialized
          Boolean indicating if the init() method has been called
private static GroupFactory instance
          The static singleton instance object
protected static java.util.Map m_groups
          A mapping of Group object by name
private static java.io.File m_groupsConfFile
           
private static long m_lastModified
           
private static Header oldHeader
           
 
Constructor Summary
private GroupFactory()
          Constructor which parses the file
 
Method Summary
 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
static GroupFactory getInstance()
          Singleton static call to get the only instance that should exist for the GroupFactory
 boolean hasGroup(java.lang.String groupName)
          Returns a boolean indicating if the group name appears in the xml file
static void init()
           
static void reload()
          Parses the groups.xml via the Castor classes
 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()
           
 void setGroups(java.util.Map grp)
          Set the groups data
private static void updateFromFile()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

instance

private static GroupFactory instance
The static singleton instance object


groupFile

protected static java.io.File groupFile
File path of groups.xml


m_groups

protected static java.util.Map m_groups
A mapping of Group object by name


configIn

protected static java.io.InputStream configIn
An input stream for the groups configuration file


initialized

private static boolean initialized
Boolean indicating if the init() method has been called


oldHeader

private static Header oldHeader

m_groupsConfFile

private static java.io.File m_groupsConfFile

m_lastModified

private static long m_lastModified
Constructor Detail

GroupFactory

private GroupFactory()
Constructor which parses the file

Method Detail

init

public static void init()
                 throws java.io.IOException,
                        java.io.FileNotFoundException,
                        org.exolab.castor.xml.MarshalException,
                        org.exolab.castor.xml.ValidationException
Throws:
java.io.IOException
java.io.FileNotFoundException
org.exolab.castor.xml.MarshalException
org.exolab.castor.xml.ValidationException

getInstance

public static GroupFactory getInstance()
Singleton static call to get the only instance that should exist for the GroupFactory

Returns:
the single group factory instance

reload

public static void reload()
                   throws java.io.IOException,
                          java.io.FileNotFoundException,
                          org.exolab.castor.xml.MarshalException,
                          org.exolab.castor.xml.ValidationException
Parses the groups.xml via the Castor classes

Throws:
java.io.IOException
java.io.FileNotFoundException
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

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

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

updateFromFile

private static void updateFromFile()
                            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

OpenNMS API 1.1.3

Generated by root on August 18 2004 0350.