|
OpenNMS API 1.1.4 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.opennms.netmgt.config.UserFactory
Field Summary | |
protected static java.io.InputStream |
configIn
An input stream for the users configuration file |
private static GroupFactory |
groupFactory
|
private static boolean |
initialized
Boolean indicating if the init() method has been called |
private static UserFactory |
instance
The static singleton instance of the UserFactory |
protected static java.util.HashMap |
m_dutySchedules
The duty schedules for each user |
private static long |
m_lastModified
|
protected static java.util.HashMap |
m_users
A mapping of user ids to the User objects |
private static java.io.File |
m_usersConfFile
|
private static Header |
oldHeader
|
protected static java.io.File |
usersFile
File path of users.xml |
Constructor Summary | |
UserFactory()
Initializes the factory |
Method Summary | |
private static 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. |
static java.lang.String |
encryptPassword(java.lang.String aPassword)
This method encrypts the password using MD5 hashing. |
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 |
static UserFactory |
getInstance()
Singleton static call to get the only instance that should exist for the UserFactory |
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. |
boolean |
hasUser(java.lang.String userName)
Returns a boolean indicating if the user name appears in the xml file |
private static java.lang.String |
hexToString(byte[] data)
Converts a byte array into a hexadecimal String representation. |
static void |
init()
|
boolean |
isUserOnDuty(java.lang.String user,
java.util.Calendar time)
Determines if a user is on duty at a given time. |
static void |
reload()
Parses the users.xml via the Castor classes |
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)
|
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 |
private static void |
updateFromFile()
|
static boolean |
updateNeeded()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static UserFactory instance
private static GroupFactory groupFactory
protected static java.io.File usersFile
protected static java.io.InputStream configIn
protected static java.util.HashMap m_users
protected static java.util.HashMap m_dutySchedules
private static boolean initialized
private static Header oldHeader
private static java.io.File m_usersConfFile
private static long m_lastModified
Constructor Detail |
public UserFactory()
Method Detail |
public static void init() throws java.io.IOException, java.io.FileNotFoundException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
java.io.IOException
java.io.FileNotFoundException
org.exolab.castor.xml.MarshalException
org.exolab.castor.xml.ValidationException
public static UserFactory getInstance()
public static void reload() throws java.io.IOException, java.io.FileNotFoundException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
java.io.IOException
java.io.FileNotFoundException
org.exolab.castor.xml.MarshalException
org.exolab.castor.xml.ValidationException
public void saveUser(java.lang.String name, User details) throws java.lang.Exception
java.lang.Exception
private static void buildDutySchedules(java.util.Map users)
users
- the map of users parsed from the xml config filepublic boolean isUserOnDuty(java.lang.String user, java.util.Calendar time) throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
user
- the user idtime
- the time to check for a duty schedule
java.io.IOException
org.exolab.castor.xml.MarshalException
org.exolab.castor.xml.ValidationException
public java.util.Map getUsers() throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
Map
of usernames to user instances.
java.io.IOException
org.exolab.castor.xml.MarshalException
org.exolab.castor.xml.ValidationException
public boolean hasUser(java.lang.String userName) throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
java.io.IOException
org.exolab.castor.xml.MarshalException
org.exolab.castor.xml.ValidationException
public java.util.List getUserNames() throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
java.io.IOException
org.exolab.castor.xml.MarshalException
org.exolab.castor.xml.ValidationException
public User getUser(java.lang.String name) throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
name
- the name of the user to return
java.io.IOException
org.exolab.castor.xml.MarshalException
org.exolab.castor.xml.ValidationException
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
userID
- the name of the usercommand
- the command to look up the contact info for
java.io.IOException
org.exolab.castor.xml.MarshalException
org.exolab.castor.xml.ValidationException
public java.lang.String getEmail(java.lang.String userid) throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
userid
- the userid of the user to return
java.io.IOException
org.exolab.castor.xml.MarshalException
org.exolab.castor.xml.ValidationException
public java.lang.String getPagerEmail(java.lang.String userid) throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
userid
- the userid of the user to return
java.io.IOException
org.exolab.castor.xml.MarshalException
org.exolab.castor.xml.ValidationException
public java.lang.String getNumericPage(java.lang.String userid) throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
userid
- the userid of the user to return
java.io.IOException
org.exolab.castor.xml.MarshalException
org.exolab.castor.xml.ValidationException
public java.lang.String getTextPin(java.lang.String userid) throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
userid
- the userid of the user to return
java.io.IOException
org.exolab.castor.xml.MarshalException
org.exolab.castor.xml.ValidationException
public java.lang.String getTextPage(java.lang.String userid) throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
userid
- the userid of the user to return
java.io.IOException
org.exolab.castor.xml.MarshalException
org.exolab.castor.xml.ValidationException
public java.lang.String getNumericPin(java.lang.String userid) throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
userid
- the userid of the user to return
java.io.IOException
org.exolab.castor.xml.MarshalException
org.exolab.castor.xml.ValidationException
public void saveUsers(java.util.Collection usersList) throws java.lang.Exception
java.lang.Exception
public void deleteUser(java.lang.String name) throws java.lang.Exception
java.lang.Exception
private void saveCurrent() throws java.lang.Exception
java.lang.Exception
public void renameUser(java.lang.String oldName, java.lang.String newName) throws java.lang.Exception
java.lang.Exception
public void setEncryptedPassword(java.lang.String userID, java.lang.String aPassword) throws java.lang.Exception
userID
- the user ID to change the pasword foraPassword
- the encrypted password
java.lang.Exception
public void setUnencryptedPassword(java.lang.String userID, java.lang.String aPassword) throws java.lang.Exception
userID
- the user ID to change the pasword foraPassword
- the password
java.lang.Exception
public static java.lang.String encryptPassword(java.lang.String aPassword) throws java.lang.IllegalStateException
aPassword
- the password to encrypt
java.lang.IllegalStateException
private static java.lang.String hexToString(byte[] data)
data
- containing the bytes to convert
public boolean comparePasswords(java.lang.String userID, java.lang.String aPassword)
userID
- the user ID to check against.aPassword
- the password to check for equality
public static boolean updateNeeded()
private static void updateFromFile() throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
java.io.IOException
org.exolab.castor.xml.MarshalException
org.exolab.castor.xml.ValidationException
|
OpenNMS API 1.1.4 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |