OpenNMS API 1.2.9

## org.opennms.netmgt.config
Class UserManager

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

Direct Known Subclasses:
  MockUserManager, UserFactory

public abstract class UserManager
extends java.lang.Object

Author:
  david hustace <david@opennms.org>

Field Summary
`protected java.util.HashMap` `m_dutySchedules` The duty schedules for each user
`protected GroupManager` `m_groupManager`
`protected java.util.HashMap` `m_users` A mapping of user ids to the User objects
`private Header` `oldHeader`

Constructor Summary
`protected` `UserManager(GroupManager groupManager)`

Method Summary
`private void` `buildDutySchedules(java.util.Map users)` Builds a mapping between user ids and duty schedules.
`boolean` `comparePasswords(java.lang.String userID, java.lang.String aPassword)` This method compares two encrypted strings for equality.
`void` `deleteUser(java.lang.String name)` Removes the user from the list of users.
`java.lang.String` `encryptedPassword(java.lang.String aPassword)`
`java.lang.String` `getContactInfo(java.lang.String userID, java.lang.String command)` Get the contact info given a command string
`java.lang.String` `getEmail(java.lang.String userid)` Get a email by name
`java.lang.String` `getNumericPage(java.lang.String userid)` Get a numeric service provider
`java.lang.String` `getNumericPin(java.lang.String userid)` Get a numeric pin
`java.lang.String` `getPagerEmail(java.lang.String userid)` Get a pager email by name
`java.lang.String` `getTextPage(java.lang.String userid)` Get a Text Page Service Provider
`java.lang.String` `getTextPin(java.lang.String userid)` Get a text pin
`User` `getUser(java.lang.String name)` Get a user by name
`java.util.List` `getUserNames()`
`java.util.Map` `getUsers()` Return a `Map` of usernames to user instances.
`java.lang.String` `getXMPPAddress(java.lang.String userid)` Get an XMPP address by name
`boolean` `hasUser(java.lang.String userName)` Returns a boolean indicating if the user name appears in the xml file
`private java.lang.String` `hexToString(byte[] data)`
`boolean` `isUserOnDuty(java.lang.String user, java.util.Calendar time)` Determines if a user is on duty at a given time.
`void` `parseXML(java.io.Reader reader)`
`void` `renameUser(java.lang.String oldName, java.lang.String newName)` When this method is called users name is changed, so also is the username belonging to the group and the view.
`private void` `saveCurrent()` Saves into "users.xml" file
`void` `saveUser(java.lang.String name, User details)` Adds a new user and overwrites the "users.xml"
`void` `saveUsers(java.util.Collection usersList)`
`protected abstract void` `saveXML(java.lang.String writerString)`
`void` `setEncryptedPassword(java.lang.String userID, java.lang.String aPassword)` Sets the password for this user, assuming that the value passed in is already encrypted properly
`void` `setUnencryptedPassword(java.lang.String userID, java.lang.String aPassword)` Sets the password for this user, first encrypting it
`protected abstract void` `update()`

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

Field Detail

### m_groupManager

    protected GroupManager m_groupManager

### m_users

    protected java.util.HashMap m_users

  A mapping of user ids to the User objects

### m_dutySchedules

    protected java.util.HashMap m_dutySchedules

  The duty schedules for each user

### oldHeader

    private Header oldHeader

Constructor Detail

### UserManager

    protected UserManager(GroupManager groupManager)

Method Detail

### parseXML

    public 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`

### saveUser

    public void saveUser(java.lang.String name,
                         User details)
                  throws java.lang.Exception

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

  Throws:
    `java.lang.Exception`

### buildDutySchedules

    private void buildDutySchedules(java.util.Map users)

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

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

### isUserOnDuty

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

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

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

### getUsers

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

  Return a `Map` of usernames to user instances.

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

### hasUser

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

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

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

### getUserNames

    public java.util.List getUserNames()
                                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`

### getUser

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

  Get a user by name

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

### getContactInfo

    public java.lang.String getContactInfo(java.lang.String userID,
                                           java.lang.String command)
                                    throws java.io.IOException,
                                           org.exolab.castor.xml.MarshalException,
                                           org.exolab.castor.xml.ValidationException

  Get the contact info given a command string

  Parameters:
    `userID` - the name of the user
    `command` - the command to look up the contact info for
  Returns:
    the contact information
  Throws:
    `java.io.IOException`
    `org.exolab.castor.xml.MarshalException`
    `org.exolab.castor.xml.ValidationException`

### getEmail

    public java.lang.String getEmail(java.lang.String userid)
                              throws java.io.IOException,
                                     org.exolab.castor.xml.MarshalException,
                                     org.exolab.castor.xml.ValidationException

  Get a email by name

  Parameters:
    `userid` - the userid of the user to return
  Returns:
    String the email specified by name
  Throws:
    `java.io.IOException`
    `org.exolab.castor.xml.MarshalException`
    `org.exolab.castor.xml.ValidationException`

### getPagerEmail

    public java.lang.String getPagerEmail(java.lang.String userid)
                                   throws java.io.IOException,
                                          org.exolab.castor.xml.MarshalException,
                                          org.exolab.castor.xml.ValidationException

  Get a pager email by name

  Parameters:
    `userid` - the userid of the user to return
  Returns:
    String the pager email
  Throws:
    `java.io.IOException`
    `org.exolab.castor.xml.MarshalException`
    `org.exolab.castor.xml.ValidationException`

### getXMPPAddress

    public java.lang.String getXMPPAddress(java.lang.String userid)
                                    throws java.io.IOException,
                                           org.exolab.castor.xml.MarshalException,
                                           org.exolab.castor.xml.ValidationException

  Get an XMPP address by name

  Parameters:
    `userid` - the userid of the user to return
  Returns:
    String the XMPP address
  Throws:
    `java.io.IOException`
    `org.exolab.castor.xml.MarshalException`
    `org.exolab.castor.xml.ValidationException`

### getNumericPage

    public java.lang.String getNumericPage(java.lang.String userid)
                                    throws java.io.IOException,
                                           org.exolab.castor.xml.MarshalException,
                                           org.exolab.castor.xml.ValidationException

  Get a numeric service provider

  Parameters:
    `userid` - the userid of the user to return
  Returns:
    String the service provider
  Throws:
    `java.io.IOException`
    `org.exolab.castor.xml.MarshalException`
    `org.exolab.castor.xml.ValidationException`

### getTextPin

    public java.lang.String getTextPin(java.lang.String userid)
                                throws java.io.IOException,
                                       org.exolab.castor.xml.MarshalException,
                                       org.exolab.castor.xml.ValidationException

  Get a text pin

  Parameters:
    `userid` - the userid of the user to return
  Returns:
    String the text pin
  Throws:
    `java.io.IOException`
    `org.exolab.castor.xml.MarshalException`
    `org.exolab.castor.xml.ValidationException`

### getTextPage

    public java.lang.String getTextPage(java.lang.String userid)
                                 throws java.io.IOException,
                                        org.exolab.castor.xml.MarshalException,
                                        org.exolab.castor.xml.ValidationException

  Get a Text Page Service Provider

  Parameters:
    `userid` - the userid of the user to return
  Returns:
    String the text page service provider.
  Throws:
    `java.io.IOException`
    `org.exolab.castor.xml.MarshalException`
    `org.exolab.castor.xml.ValidationException`

### getNumericPin

    public java.lang.String getNumericPin(java.lang.String userid)
                                   throws java.io.IOException,
                                          org.exolab.castor.xml.MarshalException,
                                          org.exolab.castor.xml.ValidationException

  Get a numeric pin

  Parameters:
    `userid` - the userid of the user to return
  Returns:
    String the numeric pin
  Throws:
    `java.io.IOException`
    `org.exolab.castor.xml.MarshalException`
    `org.exolab.castor.xml.ValidationException`

### saveUsers

    public void saveUsers(java.util.Collection usersList)
                   throws java.lang.Exception

  Throws:
    `java.lang.Exception`

### deleteUser

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

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

  Throws:
    `java.lang.Exception`

### saveCurrent

    private void saveCurrent()
                      throws java.lang.Exception

  Saves into "users.xml" file

  Throws:
    `java.lang.Exception`

### saveXML

    protected abstract void saveXML(java.lang.String writerString)
                             throws java.io.IOException

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

### renameUser

    public void renameUser(java.lang.String oldName,
                           java.lang.String newName)
                    throws java.lang.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:
    `java.lang.Exception`

### setEncryptedPassword

    public void setEncryptedPassword(java.lang.String userID,
                                     java.lang.String aPassword)
                              throws java.lang.Exception

  Sets the password for this user, assuming that the value passed in is already encrypted properly

  Parameters:
    `userID` - the user ID to change the pasword for
    `aPassword` - the encrypted password
  Throws:
    `java.lang.Exception`

### setUnencryptedPassword

    public void setUnencryptedPassword(java.lang.String userID,
                                       java.lang.String aPassword)
                                throws java.lang.Exception

  Sets the password for this user, first encrypting it

  Parameters:
    `userID` - the user ID to change the pasword for
    `aPassword` - the password
  Throws:
    `java.lang.Exception`

### encryptedPassword

    public java.lang.String encryptedPassword(java.lang.String aPassword)

  Parameters:
    `aPassword` -
  Returns:

### hexToString

    private java.lang.String hexToString(byte[] data)

  Parameters:
    `data` -
  Returns:

### comparePasswords

    public boolean comparePasswords(java.lang.String userID,
                                    java.lang.String aPassword)

  This method compares two encrypted strings for equality.

  Parameters:
    `userID` - the user ID to check against.
    `aPassword` - the password to check for equality
  Returns:
    true if the two passwords are equal (after encryption), false otherwise

### update

    protected abstract void update()
                            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`

OpenNMS API 1.2.9

Generated by ranger on May 19 2007 2335.