Nitido Inc.

com.nitido.nimx.nuggets.helpdesk.dirpool
Class HelpDeskNuggetImpl

java.lang.Object
  extended by com.nitido.nim.Nugget
      extended by com.nitido.nim.NonCachableNugget
          extended by com.nitido.nimx.nuggets.iplanetset.IPlanetSettingsNugget
              extended by com.nitido.nimx.nuggets.helpdesk.HelpDeskNugget
                  extended by com.nitido.nimx.nuggets.helpdesk.dirpool.HelpDeskNuggetImpl
All Implemented Interfaces:
CredentialConstants, java.io.Serializable

public class HelpDeskNuggetImpl
extends HelpDeskNugget

HelpDeskNugget is responsible for accessing and modifying the personal preferences of other users for iPlanet/SunONE Web Technologies Servers that have been stored in a backend LDAP server.

This nugget implementation is based on the DirPool implementation of IPlanetSettingsNugget. However, unlike the IPlanetSettingsNugget, this implementation allows the user to access the personal preferences of other users. As a result, only privileged users can be granted access to this nugget.

Although it was designed mainly for the Calendar Server and Message Server, it can be used to support all other services that utilizes the LDAP to store user preferences.

This nugget utilizes the com.nitido.nimx.services.dirpool.mozilla.DirPoolServiceImpl for obtaining the connections to the backend LDAP servers. Therefore, it does not contain any directory connection pool management logic. If a deployer want to adjust the connection pool settings, he/she should modify the settings for the DirPoolService instead.

Under most circumstances, a developer should use the user space implementation of the iPlanetSettingsNugget instead of this implementation. This implementation is designed to be used only for situations where the IMS settings and the regular user profiles are not stored in the same set of LDAP servers.

When using this nugget, the developer should pay attention to the replication issue described in the class descriptor JavaDoc of com.nitido.nimx.nuggets.ipset.IPlanetSettingsNugget.

Settings The settings used by HelpDeskNugget are:

Name Constant Type Description
readpool KEY_READ_POOL String The name of the directory connection pool to be used for read only access.
writepool KEY_WRITE_POOL String The name of the directory connection pool to be used for write access. If this name is the same as the one specified in the KEY_READ_POOL, both read and write access will share the same instance of Directory object.
adminbasedn KEY_ADMIN_BASE_DN String The admin base DN for nugget. This base DN is used to construct the login DN for the administrator that creates this nugget. For example, If this value is set to "o=admin,o=my.company", the user profile's LDAP entry will be "uid=userid,o=admin,o=my.company".
userbasedn KEY_USER_BASE_DN String The user base DN for the user profile LDAP entry. For example, If this value is set to "o=user,o=my.company", the user profile's LDAP entry will be "uid=userid,o=user,o=my.company".

See Also:
Serialized Form

Field Summary
protected  java.lang.String _adminBaseDN
           
protected  java.util.HashMap _cachedAttr
           
protected  java.lang.String _loginDN
           
protected  OpenHash _modifyAttr
           
protected  DirectoryImpl _readDir
           
protected  java.lang.String _readPoolName
           
protected  java.util.HashSet _removeAttr
           
protected  int _transactionLevel
           
protected  java.lang.String _userBaseDN
           
protected  java.lang.String _userDN
           
protected  DirectoryImpl _writeDir
           
protected  java.lang.String _writePoolName
           
static java.lang.String KEY_ADMIN_BASE_DN
           
static java.lang.String KEY_READ_POOL
           
static java.lang.String KEY_USER_BASE_DN
           
static java.lang.String KEY_WRITE_POOL
           
 
Fields inherited from class com.nitido.nimx.nuggets.helpdesk.HelpDeskNugget
DEFAULT_DIRECTORY_FACTORY, KEY_ADMINBASE, KEY_DIRECTORY_FACTORY, KEY_DM_PASSWORD, KEY_DM_USERID, KEY_HOST, KEY_PORT, KEY_USERBASE
 
Fields inherited from class com.nitido.nim.Nugget
_entity, _nim, _nuggetName, _settings
 
Fields inherited from interface com.nitido.nim.CredentialConstants
CRED_ADMIN, CRED_CONTAINER, CRED_HELPDESK, CRED_SYSTEM, CRED_USER, KEY_PASSWORD
 
Constructor Summary
HelpDeskNuggetImpl(NuggetVisa visa)
          Default Nugget constructor.
 
Method Summary
 void abortTransaction()
          Abort a batch of settings change.
 void activate()
          Used by NiM Nugget mechanism.
 void commitTransaction()
          Commits a batch of settings change.
protected  void connectRead()
           
protected  void connectWrite()
           
 void deactivate()
          Used by NiM Nugget mechnanism.
protected  void disconnectRead()
           
protected  void disconnectWrite()
           
 java.lang.String getDescriptor()
          Used by NiM Nugget mechnanism.
 java.lang.String[] getMultiValues(java.lang.String attribute)
          Returns all values of the attribute in the user's entry.
protected  void initImpl()
          This method is called by the init() method after the member variables _nuggetName, _entity and _settings are assigned.
protected  void removeMultiValues(java.lang.String attribute)
          Removes the specified attribute from the user's entry.
 java.util.Vector search(java.lang.String filter)
          Search for an entry and retrieve ALL attributes associated to the matched entry.
 java.util.Vector search(java.lang.String filter, java.lang.String[] attributes)
          Search for an entry and retrieve the specified attributes of the matched entry.
 void selectUser(java.lang.String uid)
          Select the user id for the search.
 void setMultiValues(java.lang.String attribute, java.lang.String[] values)
          Sets the attribute/value for the user's entry in the Directory.
 void setSingleValue(java.lang.String attribute, java.lang.String value)
          Sets the attribute/value pair for the user's entry in the Directory.
 void startTransaction()
          Starts a batch of settings change.
 
Methods inherited from class com.nitido.nimx.nuggets.iplanetset.IPlanetSettingsNugget
addFilter, arrayToVector, checkInt, checkNonNull, containsValue, createUniqueArray, getCommonName, getComposeTextSize, getComposeWidth, getCopyForward, getCopyForwardEnabled, getCopySend, getExtendedCalendarPref, getExtendedMailPref, getExtendedPref, getExternalMailSetting, getFilters, getNotificationEmailAddress, getNotificationFrom, getNotificationListOption, getNotificationOption, getNotificationPhoneFrom, getNotificationPhoneListOption, getNotificationPhoneNumber, getNotificationPhoneOption, getNotificationPhoneUrgentOption, getNotificationUrgentOption, getPaginationSize, getReplyInclude, getReplyTo, getSignature, getSignatureEnabled, getSingleValue, getVacationMessageEnabled, getVacationMessageEndDate, getVacationMessageExternal, getVacationMessageInternal, getVacationMessageRepeatDays, getVacationMessageStartDate, getVacationMessageSubject, getVCard, getVCardEnabled, isExtendedMailPrefTrue, isLegalNotificationOption, removeExtendedPref, removeStringFromArray, replaceStringInArray, setBooleanExtendedMailPref, setCommonName, setComposeTextSize, setComposeWidth, setCopyForward, setCopyForwardEnabled, setCopySend, setExtendedCalendarPref, setExtendedMailPref, setExtendedPref, setExternalMailSetting, setFilters, setNotificationEmailAddress, setNotificationFrom, setNotificationListOption, setNotificationOption, setNotificationPhoneFrom, setNotificationPhoneListOption, setNotificationPhoneOption, setNotificationPhoneUrgentOption, setNotificationUrgentOption, setPaginationSize, setReplyInclude, setReplyTo, setSignature, setSignatureEnabled, setVacationMessageEnabled, setVacationMessageExternal, setVacationMessageInternal, setVacationMessageRepeatDays, setVacationMessageSubject, setVCard, setVCardEnabled, vectorToArray
 
Methods inherited from class com.nitido.nim.NonCachableNugget
isCachable
 
Methods inherited from class com.nitido.nim.Nugget
destroy, destroyImpl, getEntity, getNuggetName, getSetting, getSettings, init, requestBegin, requestEnd
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

KEY_READ_POOL

public static final java.lang.String KEY_READ_POOL
See Also:
Constant Field Values

KEY_WRITE_POOL

public static final java.lang.String KEY_WRITE_POOL
See Also:
Constant Field Values

KEY_ADMIN_BASE_DN

public static final java.lang.String KEY_ADMIN_BASE_DN
See Also:
Constant Field Values

KEY_USER_BASE_DN

public static final java.lang.String KEY_USER_BASE_DN
See Also:
Constant Field Values

_readDir

protected transient DirectoryImpl _readDir

_writeDir

protected transient DirectoryImpl _writeDir

_userDN

protected java.lang.String _userDN

_loginDN

protected transient java.lang.String _loginDN

_readPoolName

protected java.lang.String _readPoolName

_writePoolName

protected java.lang.String _writePoolName

_adminBaseDN

protected java.lang.String _adminBaseDN

_userBaseDN

protected java.lang.String _userBaseDN

_modifyAttr

protected transient OpenHash _modifyAttr

_removeAttr

protected transient java.util.HashSet _removeAttr

_cachedAttr

protected transient java.util.HashMap _cachedAttr

_transactionLevel

protected transient int _transactionLevel
Constructor Detail

HelpDeskNuggetImpl

public HelpDeskNuggetImpl(NuggetVisa visa)
Default Nugget constructor.

Method Detail

activate

public void activate()
              throws ActivationException
Used by NiM Nugget mechanism. An application developer should never invoke this.

Overrides:
activate in class IPlanetSettingsNugget
Throws:
ActivationException - If unable to activate the Nugget

deactivate

public void deactivate()
                throws ActivationException
Used by NiM Nugget mechnanism. An application developer should never invoke this.

Overrides:
deactivate in class IPlanetSettingsNugget
Throws:
ActivationException - If unable to deactivate the Nugget

initImpl

protected void initImpl()
                 throws InitializationFailedException,
                        InvalidSettingException
Description copied from class: Nugget
This method is called by the init() method after the member variables _nuggetName, _entity and _settings are assigned. This method allows nugget implementations to put in code for initializing itself.

Specified by:
initImpl in class Nugget
Throws:
InitializationFailedException - If unable to initialize the nugget with the given parameters.
InvalidSettingException - If any of the expected initialization settings are null.

getDescriptor

public java.lang.String getDescriptor()
Used by NiM Nugget mechnanism. An application developer should never invoke this.

Overrides:
getDescriptor in class IPlanetSettingsNugget
Returns:
The string with the description of the Nugget.

connectRead

protected void connectRead()
                    throws IPlanetServerException
Throws:
IPlanetServerException

disconnectRead

protected void disconnectRead()

connectWrite

protected void connectWrite()
                     throws IPlanetServerException
Throws:
IPlanetServerException

disconnectWrite

protected void disconnectWrite()

selectUser

public void selectUser(java.lang.String uid)
Description copied from class: HelpDeskNugget
Select the user id for the search. After this method has been invoked, all following methods will access the ldap entry with DN "uid=uid, base dn specified by configuration property helpdesk.userbase" This behaviour will be stop when another user id has been selected. In other words,

This method is used to select the user to perform the action on. The user that create this Nugget must have been given the access privilege to the specified entries by the LDAP administrator. This Nugget will not attempt to manage the access privilege.

The default ldap configuration of iplanet allow the data to be readable by all valid user. Therefore, you will have no problem to access the user's information. You will only encounter the insufficient access rights problem when you tries to update it.

Due to performance concern, this method does not need to check if the LDAP server actually contains the specified user. This means that you can't guarantee the existence of uid until you access the attributes.

Specified by:
selectUser in class HelpDeskNugget
Parameters:
uid - The user id for the user to be selected.

search

public java.util.Vector search(java.lang.String filter,
                               java.lang.String[] attributes)
                        throws IPlanetServerException
Description copied from class: HelpDeskNugget
Search for an entry and retrieve the specified attributes of the matched entry.

This method will return a single value for each attribute. If the attribute contains more than one value, this method will return the first one that it encounters

The search is performed against the base specified by helpdesk.userbase in the configuration setting.

Specified by:
search in class HelpDeskNugget
Parameters:
filter - the standard LDAP filter

attributes - a String array that contains the name of the attribute you want to fetch from the server. If this paramter is null or set to a 0-size array, this method will assume it's the String array {"uid"}.

Returns:
a vector of String[] with the values of the attributes specified.
Throws:
IPlanetServerException

search

public java.util.Vector search(java.lang.String filter)
                        throws IPlanetServerException
Description copied from class: HelpDeskNugget
Search for an entry and retrieve ALL attributes associated to the matched entry.

This method will return a single value for each attribute. If the attribute contains more than one value, this method will return the first one that it encounters

The search is performed against the base specified by helpdesk.userbase in the configuration setting.

Specified by:
search in class HelpDeskNugget
Parameters:
filter - the standard LDAP filter

Returns:
a vector of Hashtable objects that contains the attributes of the matched entry. Each attribute name in the hashtable are mapped to only one value. These hashtables may contain different set of names, as what would happened in the actual LDAP directory.
Throws:
IPlanetServerException

setSingleValue

public void setSingleValue(java.lang.String attribute,
                           java.lang.String value)
                    throws IPlanetServerException
Description copied from class: IPlanetSettingsNugget
Sets the attribute/value pair for the user's entry in the Directory. Any existing values will be removed (i.e. this is a "replace" instead of "add".)

Specified by:
setSingleValue in class IPlanetSettingsNugget
Parameters:
attribute - The attribute name

value - The new value.

Throws:
IPlanetServerException - If there is a connection problem with the Directory object.

getMultiValues

public java.lang.String[] getMultiValues(java.lang.String attribute)
                                  throws IPlanetServerException
Description copied from class: IPlanetSettingsNugget
Returns all values of the attribute in the user's entry.

Note: if the attribute has only one value stored, it simply returns an array of size one no matter whether the underlying attribute is single-value or multi-values.

Specified by:
getMultiValues in class IPlanetSettingsNugget
Returns:
values Array of values associated with attribute. If the attribute has no value, it will return a String array of size 0.

Throws:
IPlanetServerException - If there is a connection problem with the Directory object.

setMultiValues

public void setMultiValues(java.lang.String attribute,
                           java.lang.String[] values)
                    throws IPlanetServerException
Description copied from class: IPlanetSettingsNugget
Sets the attribute/value for the user's entry in the Directory. Any existing values will be removed (i.e. this is a "replace" instead of "add".)

Specified by:
setMultiValues in class IPlanetSettingsNugget
Parameters:
attribute - The attribute name

values - The new values.

Throws:
IPlanetServerException - If there is a connection problem with the Directory object.

removeMultiValues

protected void removeMultiValues(java.lang.String attribute)
                          throws IPlanetServerException
Description copied from class: IPlanetSettingsNugget
Removes the specified attribute from the user's entry.

Specified by:
removeMultiValues in class IPlanetSettingsNugget
Throws:
IPlanetServerException - If there is a connection problem with the Directory object.

startTransaction

public void startTransaction()
                      throws IPlanetServerException
Description copied from class: IPlanetSettingsNugget
Starts a batch of settings change. If you need to set/get a number of attributes in a row, you should invoke this method before the calls.

Please see the class description for more details on why and when to use these transaction methods.

Specified by:
startTransaction in class IPlanetSettingsNugget
Throws:
IPlanetServerException

commitTransaction

public void commitTransaction()
                       throws IPlanetServerException
Description copied from class: IPlanetSettingsNugget
Commits a batch of settings change. If you need to set/get a number of attributes in a row, you should use this method after the calls.

Please see the class description for more details on why and when to use these transaction methods.

Specified by:
commitTransaction in class IPlanetSettingsNugget
Throws:
IPlanetServerException

abortTransaction

public void abortTransaction()
                      throws IPlanetServerException
Description copied from class: IPlanetSettingsNugget
Abort a batch of settings change. This method will drop the transaction and LDAP connection. All setXXX changes after the startTransaction() method call will be lost. This method is is usually called when the application encountered an exception and need to drop the transaction.

If no transaction was in process when this method is called, this method will not do anything and no exception will be thrown.

Please see the class description for more details on why and when to use these transaction methods.

Specified by:
abortTransaction in class IPlanetSettingsNugget
Throws:
IPlanetServerException

Nitido NiM 2.5 Java API

These JavaDoc pages are generated for release/nim_2_5-2.5.44

Copyright © 1999-2009 Nitido Inc.    Proprietary and Confidential.    All Rights Reserved.