com.sun.management.snmp.usm
Class SnmpUsmPasswordLcd

java.lang.Object
  extended by com.sun.management.snmp.usm.SnmpUsmPasswordLcd
All Implemented Interfaces:
com.sun.management.internal.snmp.SnmpModelLcd, SnmpUsmLcd

public class SnmpUsmPasswordLcd
extends Object
implements SnmpUsmLcd

FOR INTERNAL USE ONLY. This is the default implementation of the Usm Lcd. Its job is to read the configuration file, store the configuration and manage SnmpUsmSecureUser objects.

Since:
Java DMK 5.1

Field Summary
 
Fields inherited from interface com.sun.management.snmp.usm.SnmpUsmLcd
NON_VOLATILE, VOLATILE
 
Constructor Summary
SnmpUsmPasswordLcd(SnmpEngine engine, com.sun.management.internal.snmp.SnmpSubSystem subsys, com.sun.management.internal.snmp.SnmpLcd snmplcd, String file)
          Constructor.
 
Method Summary
 void addEngine(SnmpEngineId engineId)
          Does nothing in our case.
 void addUser(SnmpEngineId engineId, String userName, String securityName, String authProtocol, String authPassword, String privProtocol, String privPassword, int storage, boolean template)
          See SnmpUsmLcd interface doc for details.
 void addUser(SnmpUsmSecureUser user, boolean notifyMIB)
          See SnmpUsmLcd interface doc for details.
 SnmpUsmSecureUser createNewUser(byte[] engineId, String name)
          See SnmpUsmLcd interface doc for details.
 void enableStrictParsing(boolean b)
          Call this method in order to change the file parsing behavior.
 SnmpUsmAlgorithmManager getAlgorithmManager()
          See SnmpUsmLcd interface doc for details.
 Enumeration getAllUsers()
          See SnmpUsmLcd interface doc for details.
 int getStorageType()
          See SnmpUsmLcd interface doc for details.
 SnmpUsmSecureUser getUser(SnmpEngineId engineId, String userName)
          Gets the SnmpUsmSecureUser for the passed user name and authoritative engine Id.
 SnmpUsmAuthPair getUserAuthPair(SnmpEngineId engineId, String userName)
          See SnmpUsmLcd interface doc for details.
 SnmpUsmPrivPair getUserPrivPair(SnmpEngineId engineId, String userName)
          See SnmpUsmLcd interface doc for details.
 void removeUser(SnmpEngineId engineId, String userName, boolean notifyMIB)
          Removes a user form the Lcd.
 void setAlgorithmManager(SnmpUsmAlgorithmManager algos)
          See SnmpUsmLcd interface doc for details.
 void setMibTable(SnmpUsmMibTable table)
          See SnmpUsmLcd interface doc for details.
 void setUserAuthKeyChange(SnmpUsmSecureUser u, byte[] keyChange)
          See SnmpUsmLcd interface doc for details.
 void setUserPrivKeyChange(SnmpUsmSecureUser u, byte[] keyChange)
          See SnmpUsmLcd interface doc for details.
 void syncDataSource()
          See SnmpUsmLcd interface doc for details.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SnmpUsmPasswordLcd

public SnmpUsmPasswordLcd(SnmpEngine engine,
                          com.sun.management.internal.snmp.SnmpSubSystem subsys,
                          com.sun.management.internal.snmp.SnmpLcd snmplcd,
                          String file)
                   throws IllegalArgumentException
Constructor.

Throws:
IllegalArgumentException
Method Detail

enableStrictParsing

public void enableStrictParsing(boolean b)
Call this method in order to change the file parsing behavior. Default behavior is throwing an exception when parsing a bad configured userEntry.

Parameters:
b - True, throws an IllegalArgumentException, false the line is skipped.

setUserAuthKeyChange

public void setUserAuthKeyChange(SnmpUsmSecureUser u,
                                 byte[] keyChange)
See SnmpUsmLcd interface doc for details.

Specified by:
setUserAuthKeyChange in interface SnmpUsmLcd
Parameters:
u - The user that has its key changed.
keyChange - The value to use at key compute time.

setUserPrivKeyChange

public void setUserPrivKeyChange(SnmpUsmSecureUser u,
                                 byte[] keyChange)
See SnmpUsmLcd interface doc for details.

Specified by:
setUserPrivKeyChange in interface SnmpUsmLcd
Parameters:
u - The user that has its key changed.
keyChange - The value to use at key compute time.

addUser

public void addUser(SnmpUsmSecureUser user,
                    boolean notifyMIB)
See SnmpUsmLcd interface doc for details.

Specified by:
addUser in interface SnmpUsmLcd
Parameters:
user - The user to add.
notifyMIB - True will notify the MIB.

createNewUser

public SnmpUsmSecureUser createNewUser(byte[] engineId,
                                       String name)
See SnmpUsmLcd interface doc for details.

Specified by:
createNewUser in interface SnmpUsmLcd
Parameters:
engineId - The authoritative engine Id the user is associated to.
name - The user name.
Returns:
The newly created user.

getStorageType

public int getStorageType()
See SnmpUsmLcd interface doc for details.

Specified by:
getStorageType in interface SnmpUsmLcd
Returns:
The storage type.

setMibTable

public void setMibTable(SnmpUsmMibTable table)
See SnmpUsmLcd interface doc for details.

Specified by:
setMibTable in interface SnmpUsmLcd
Parameters:
table - The MIB table.

addEngine

public void addEngine(SnmpEngineId engineId)
Does nothing in our case. Compliant with RFC 2574.

Specified by:
addEngine in interface SnmpUsmLcd
Parameters:
engineId - The unknown engine Id.

setAlgorithmManager

public void setAlgorithmManager(SnmpUsmAlgorithmManager algos)
See SnmpUsmLcd interface doc for details.

Specified by:
setAlgorithmManager in interface SnmpUsmLcd
Parameters:
algos - The algorithm manager.

getUser

public SnmpUsmSecureUser getUser(SnmpEngineId engineId,
                                 String userName)
                          throws SnmpUsmEngineIdException,
                                 SnmpUsmUserNameException
Gets the SnmpUsmSecureUser for the passed user name and authoritative engine Id.

Specified by:
getUser in interface SnmpUsmLcd
Parameters:
engineId - The authoritative engine Id.
userName - The user name.
Throws:
SnmpUsmEngineIdException
SnmpUsmUserNameException

syncDataSource

public void syncDataSource()
                    throws IllegalArgumentException
See SnmpUsmLcd interface doc for details.

Specified by:
syncDataSource in interface SnmpUsmLcd
Throws:
IllegalArgumentException

getAlgorithmManager

public SnmpUsmAlgorithmManager getAlgorithmManager()
See SnmpUsmLcd interface doc for details.

Specified by:
getAlgorithmManager in interface SnmpUsmLcd
Returns:
The algorithm manager.

getUserPrivPair

public SnmpUsmPrivPair getUserPrivPair(SnmpEngineId engineId,
                                       String userName)
                                throws SnmpUsmPrivAlgorithmException,
                                       SnmpUsmEngineIdException,
                                       SnmpUsmUserNameException
See SnmpUsmLcd interface doc for details.

Specified by:
getUserPrivPair in interface SnmpUsmLcd
Parameters:
engineId - The authoritative engine Id.
userName - The user name.
Throws:
SnmpUsmPrivAlgorithmException
SnmpUsmEngineIdException
SnmpUsmUserNameException

getUserAuthPair

public SnmpUsmAuthPair getUserAuthPair(SnmpEngineId engineId,
                                       String userName)
                                throws SnmpUsmAuthAlgorithmException,
                                       SnmpUsmEngineIdException,
                                       SnmpUsmUserNameException
See SnmpUsmLcd interface doc for details.

Specified by:
getUserAuthPair in interface SnmpUsmLcd
Parameters:
engineId - The authoritative engine Id.
userName - The user name.
Throws:
SnmpUsmAuthAlgorithmException
SnmpUsmEngineIdException
SnmpUsmUserNameException

addUser

public void addUser(SnmpEngineId engineId,
                    String userName,
                    String securityName,
                    String authProtocol,
                    String authPassword,
                    String privProtocol,
                    String privPassword,
                    int storage,
                    boolean template)
             throws SnmpUsmException
See SnmpUsmLcd interface doc for details.

Specified by:
addUser in interface SnmpUsmLcd
Parameters:
engineId - The authoritative engine Id.
userName - The user name.
securityName - The security user name.
authProtocol - The authentication algorithm name.
authPassword - The authentication password.
privProtocol - The privacy algorithm name.
privPassword - The privacy key. No password translation. This String must start with 0x.
storage - The storage type (PERMANENT or VOLATILE).
template - True, the user is a template. A template is not registered in the USM MIB.
Throws:
SnmpUsmException

getAllUsers

public Enumeration getAllUsers()
See SnmpUsmLcd interface doc for details.

Specified by:
getAllUsers in interface SnmpUsmLcd
Returns:
The enumeration of users.

removeUser

public void removeUser(SnmpEngineId engineId,
                       String userName,
                       boolean notifyMIB)
Description copied from interface: SnmpUsmLcd
Removes a user form the Lcd. It will be removed only if it exists.

Specified by:
removeUser in interface SnmpUsmLcd
Parameters:
engineId - The engine Id to which the user is associated.
userName - The user name.
notifyMIB - True will notify the MIB.

Open Source build 02
opendmk-1.0-b02 2007.10.01_19:17:46_MEST

Copyright 1998-2007 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.