org.opennms.netmgt.config
Class ViewFactory

java.lang.Object
  extended by org.opennms.netmgt.config.ViewFactory

public class ViewFactory
extends Object


Field Summary
protected static InputStream configIn
          An input stream for the views configuration file
protected static HashMap<String,View> m_views
          A mapping of views ids to the View objects
protected static File usersFile
          File path of views.xml
 
Method Summary
 void deleteUser(String name)
          Removes the user from the list of users.
 void deleteView(String name)
          When this method is called view is to be deleted.
 String getCategoryComments(String viewName, String categoryName)
           
static ViewFactory getInstance()
          Singleton static call to get the only instance that should exist for the ViewFactory
 View getView(String name)
          Return a Map of usernames to user instances.
 Map<String,View> getViews()
          Return a Map of usernames to user instances.
static void init()
           
static void reload()
          Parses the views.xml via the Castor classes
 void renameUser(String oldName, String newName)
          When this method is called users name is changed, so also is the username belonging to the group and the view.
 void renameView(String oldName, String newName)
          When this method is called views name is changed.
 void saveView(String name, View details)
          Adds a new user and overwrites the "users.xml"
 void saveViews(Views views)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

usersFile

protected static File usersFile
File path of views.xml


configIn

protected static InputStream configIn
An input stream for the views configuration file


m_views

protected static HashMap<String,View> m_views
A mapping of views ids to the View objects

Method Detail

init

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

getInstance

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

Returns:
the single view factory instance

reload

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

Throws:
IOException
org.exolab.castor.xml.MarshalException
org.exolab.castor.xml.ValidationException

saveView

public void saveView(String name,
                     View details)
              throws Exception
Adds a new user and overwrites the "users.xml"

Throws:
Exception

deleteUser

public void deleteUser(String name)
                throws Exception
Removes the user from the list of users. Then overwrites to the "users.xml"

Throws:
Exception

renameUser

public void renameUser(String oldName,
                       String newName)
                throws Exception
When this method is called users name is changed, so also is the username belonging to the group and the view. Also overwrites the "users.xml" file

Throws:
Exception

renameView

public void renameView(String oldName,
                       String newName)
                throws Exception
When this method is called views name is changed. Also overwrites the "views.xml" file

Throws:
Exception

deleteView

public void deleteView(String name)
                throws Exception
When this method is called view is to be deleted. Also overwrites the "views.xml" file

Throws:
Exception

saveViews

public void saveViews(Views views)
               throws IOException,
                      org.exolab.castor.xml.MarshalException,
                      org.exolab.castor.xml.ValidationException
Throws:
IOException
org.exolab.castor.xml.MarshalException
org.exolab.castor.xml.ValidationException

getCategoryComments

public String getCategoryComments(String viewName,
                                  String categoryName)

getView

public View getView(String name)
Return a Map of usernames to user instances.


getViews

public Map<String,View> getViews()
Return a Map of usernames to user instances.



Copyright © 2009. All Rights Reserved.