Package com.iplanet.am.sdk.remote
Class CachedRemoteServicesImpl
- java.lang.Object
-
- com.iplanet.am.sdk.remote.RemoteServicesImpl
-
- com.iplanet.am.sdk.remote.CachedRemoteServicesImpl
-
- All Implemented Interfaces:
ICachedDirectoryServices,IDirectoryServices
public class CachedRemoteServicesImpl extends RemoteServicesImpl implements ICachedDirectoryServices
-
-
Field Summary
Fields Modifier and Type Field Description protected static StringNSROLE_ATTRprotected static StringNSROLEDN_ATTR-
Fields inherited from class com.iplanet.am.sdk.remote.RemoteServicesImpl
AM_SDK_DEBUG_FILE, AMSR_ATTRS, AMSR_CODE, AMSR_COUNT, AMSR_RESULTS, callBackHelperBase, complianceServicesImpl, dcTreeServicesImpl, debug, IDREPO_SERVICE, SDK_SERVICE
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclearCache()This method is used to clear the entire SDK cache in the event that EventService notifies that all entries have been modified (or should be marked dirty).StringcreateAMTemplate(SSOToken token, String entryDN, int objectType, String serviceName, Map attributes, int priority)Create an AMTemplate (COSTemplate)voidcreateEntry(SSOToken token, String entryName, int objectType, String parentDN, Map attributes)Create an entry in the DirectoryvoiddirtyCache(String dn, int eventType, boolean cosType, boolean aciChange, Set attrNames)This method will be called byAMIdRepoListener.booleandoesEntryExists(SSOToken token, String entryDN)Checks if the entry exists in the directory.MapgetAttributes(SSOToken token, String entryDN, boolean ignoreCompliance, boolean byteValues, int profileType)Gets all attributes corresponding to the entryDN.MapgetAttributes(SSOToken token, String entryDN, int profileType)Returns a Map with attribute-values requested from the directory.MapgetAttributes(SSOToken token, String entryDN, Set attrNames, boolean ignoreCompliance, boolean byteValues, int profileType)Gets the specific attributes corresponding to the entryDN.MapgetAttributes(SSOToken token, String entryDN, Set attrNames, int profileType)Returns a Map with attribute-values requested from the directory.MapgetAttributesByteValues(SSOToken token, String entryDN, int profileType)Returns a map of attribute-values for binary attributes.MapgetAttributesByteValues(SSOToken token, String entryDN, Set attrNames, int profileType)Returns a map of attribute-values for binary attributes.MapgetExternalAttributes(SSOToken token, String entryDN, Set attrNames, int profileType)Returns attributes from an external data store.protected static IDirectoryServicesgetInstance()protected static intgetMaxSize()Method to get the maximum size of the Cache.intgetObjectType(SSOToken token, String dn)Gets the type of the object given its DN.StringgetOrganizationDN(SSOToken token, String entryDN)Gets the Organization DN for the specified entryDN.intgetSize()Method to get the current cache sizevoidremoveEntry(SSOToken token, String entryDN, int objectType, boolean recursive, boolean softDelete)Remove an entry from the directory.StringrenameEntry(SSOToken token, int objectType, String entryDN, String newName, boolean deleteOldName)Renames an entry.voidsetAttributes(SSOToken token, String entryDN, int objectType, Map stringAttributes, Map byteAttributes, boolean isAdd)Method Set the attributes of an entry.voidsetGroupFilter(SSOToken token, String entryDN, String filter)Sets the filter for a dynamic group in the datastore.StringtoString()Prints the contents of the cache.voidupdateUserAttribute(SSOToken token, Set members, String staticGroupDN, boolean toAdd)Adds or remove static group DN to or from member attribute 'iplanet-am-static-group-dn'-
Methods inherited from class com.iplanet.am.sdk.remote.RemoteServicesImpl
addListener, changePassword, convertException, getAMTemplateDN, getAttributesForSchema, getAttributesFromDS, getComplianceServicesImpl, getCreationTemplateName, getDCTreeAttributes, getDCTreeServicesImpl, getDebug, getGroupFilterAndScope, getMembers, getNamingAttribute, getObjectClass, getObjectType, getOrgSearchFilter, getRegisteredServiceNames, getSearchFilterFromTemplate, getSOAPClient, getTopLevelContainers, modifyMemberShip, registerService, removeAdminRole, search, search, unRegisterService, verifyAndGetOrgDN
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.iplanet.am.sdk.common.IDirectoryServices
addListener, changePassword, getAMTemplateDN, getAttributesForSchema, getAttributesFromDS, getComplianceServicesImpl, getCreationTemplateName, getDCTreeAttributes, getDCTreeServicesImpl, getGroupFilterAndScope, getMembers, getNamingAttribute, getObjectClass, getObjectType, getOrgSearchFilter, getRegisteredServiceNames, getSearchFilterFromTemplate, getTopLevelContainers, modifyMemberShip, registerService, removeAdminRole, search, search, unRegisterService, verifyAndGetOrgDN
-
-
-
-
Method Detail
-
getSize
public int getSize()
Method to get the current cache size- Specified by:
getSizein interfaceICachedDirectoryServices- Returns:
- the size of the SDK LRU cache
-
getInstance
protected static IDirectoryServices getInstance()
-
getMaxSize
protected static int getMaxSize()
Method to get the maximum size of the Cache. To be called by all other LRU Caches that are created in AM SDK- Returns:
- the maximum cache size for a LRU cache
-
toString
public String toString()
Prints the contents of the cache. For getDebug() purpose only
-
dirtyCache
public void dirtyCache(String dn, int eventType, boolean cosType, boolean aciChange, Set attrNames)
This method will be called byAMIdRepoListener. This method will update the cache by removing all the entires which are affected as a result of an event notification caused because of changes/deletions/renaming of entries with and without aci's.NOTE: The event could have been caused either by changes to an aci entry or a costemplate or a cosdefinition or changes to a normal entry
- Specified by:
dirtyCachein interfaceICachedDirectoryServices- Parameters:
dn- name of entity being modifiedeventType- type of modificationcosType- true if it is cos related. false otherwiseaciChange- true if it is aci related. false otherwiseattrNames- Set of attribute Names which should be removed from the CacheEntry in the case of COS change
-
clearCache
public void clearCache()
This method is used to clear the entire SDK cache in the event that EventService notifies that all entries have been modified (or should be marked dirty).- Specified by:
clearCachein interfaceICachedDirectoryServices
-
createEntry
public void createEntry(SSOToken token, String entryName, int objectType, String parentDN, Map attributes) throws AMEntryExistsException, AMException, SSOException
Description copied from class:RemoteServicesImplCreate an entry in the Directory- Specified by:
createEntryin interfaceIDirectoryServices- Overrides:
createEntryin classRemoteServicesImpl- Parameters:
token- SSOTokenentryName- name of the entry (naming value), e.g. "sun.com", "manager"objectType- Profile Type, ORGANIZATION, AMObject.ROLE, AMObject.USER, etc.parentDN- the parent DNattributes- the initial attribute set for creation- Throws:
AMEntryExistsExceptionAMExceptionSSOException
-
doesEntryExists
public boolean doesEntryExists(SSOToken token, String entryDN)
Description copied from class:RemoteServicesImplChecks if the entry exists in the directory.- Specified by:
doesEntryExistsin interfaceIDirectoryServices- Overrides:
doesEntryExistsin classRemoteServicesImpl- Parameters:
token- a valid SSOTokenentryDN- The DN of the entry that needs to be checked- Returns:
- true if the entryDN exists in the directory, false otherwise
-
updateUserAttribute
public void updateUserAttribute(SSOToken token, Set members, String staticGroupDN, boolean toAdd) throws AMException
Description copied from class:RemoteServicesImplAdds or remove static group DN to or from member attribute 'iplanet-am-static-group-dn'- Specified by:
updateUserAttributein interfaceIDirectoryServices- Overrides:
updateUserAttributein classRemoteServicesImpl- Parameters:
token- SSOTokenmembers- set of user DN'sstaticGroupDN- DN of the static grouptoAdd- true to add, false to remove- Throws:
AMException- if there is an internal problem with AM Store.
-
getOrganizationDN
public String getOrganizationDN(SSOToken token, String entryDN) throws AMException
Gets the Organization DN for the specified entryDN. If the entry itself is an org, then same DN is returned.NOTE: This method will involve serveral directory searches, hence be cautious of Performance hit.
This method does not call its base classes method unlike the rest of the overriden methods to obtain the organization DN, as it requires special processing requirements.
- Specified by:
getOrganizationDNin interfaceIDirectoryServices- Overrides:
getOrganizationDNin classRemoteServicesImpl- Parameters:
token- a valid SSOTokenentryDN- the entry whose parent Organization is to be obtained- Returns:
- the DN String of the parent Organization
- Throws:
AMException- if an error occured while obtaining the parent Organization
-
getObjectType
public int getObjectType(SSOToken token, String dn) throws AMException, SSOException
Gets the type of the object given its DN.- Specified by:
getObjectTypein interfaceIDirectoryServices- Overrides:
getObjectTypein classRemoteServicesImpl- Parameters:
token- token a valid SSOTokendn- DN of the object whose type is to be known.- Returns:
- Integer type of the entry.
- Throws:
AMException- if the data store is unavailable or if the objecttype is unknownSSOException- if ssoToken is invalid or expired.
-
getExternalAttributes
public Map getExternalAttributes(SSOToken token, String entryDN, Set attrNames, int profileType) throws AMException
Returns attributes from an external data store.- Specified by:
getExternalAttributesin interfaceIDirectoryServices- Overrides:
getExternalAttributesin classRemoteServicesImpl- Parameters:
token- Single sign on token of userentryDN- DN of the entry user is trying to readattrNames- Set of attributes to be readprofileType- Integer determining the type of profile being read- Returns:
- A Map of attribute-value pairs
- Throws:
AMException- if an error occurs when trying to read external datastore
-
getAttributes
public Map getAttributes(SSOToken token, String entryDN, int profileType) throws AMException, SSOException
Description copied from interface:IDirectoryServicesReturns a Map with attribute-values requested from the directory.- Specified by:
getAttributesin interfaceIDirectoryServices- Overrides:
getAttributesin classRemoteServicesImpl- Parameters:
token- User's single sign on tokenentryDN-DNof the entry.profileType- Integer representing type of the object.- Returns:
- Map of attribute-values.
- Throws:
AMException- If unable to access datastoreSSOException- If user's single sign on token is invalid.
-
getAttributes
public Map getAttributes(SSOToken token, String entryDN, Set attrNames, int profileType) throws AMException, SSOException
Description copied from interface:IDirectoryServicesReturns a Map with attribute-values requested from the directory.- Specified by:
getAttributesin interfaceIDirectoryServices- Overrides:
getAttributesin classRemoteServicesImpl- Parameters:
token- User's single sign on tokenentryDN-DNof the entry.attrNames- Set of attributes to be read.profileType- Integer representing type of the object.- Returns:
- Map of attribute-values.
- Throws:
AMException- If unable to access datastoreSSOException- If user's single sign on token is invalid.
-
getAttributesByteValues
public Map getAttributesByteValues(SSOToken token, String entryDN, int profileType) throws AMException, SSOException
Description copied from interface:IDirectoryServicesReturns a map of attribute-values for binary attributes.- Specified by:
getAttributesByteValuesin interfaceIDirectoryServices- Overrides:
getAttributesByteValuesin classRemoteServicesImpl- Parameters:
token- User's single sign on tokenentryDN-DNof the entry.profileType- Integer representing type of the object.- Returns:
- Map of attribute-values.
- Throws:
AMException- If unable to access datastoreSSOException- If user's single sign on token is invalid.
-
getAttributesByteValues
public Map getAttributesByteValues(SSOToken token, String entryDN, Set attrNames, int profileType) throws AMException, SSOException
Description copied from interface:IDirectoryServicesReturns a map of attribute-values for binary attributes.- Specified by:
getAttributesByteValuesin interfaceIDirectoryServices- Overrides:
getAttributesByteValuesin classRemoteServicesImpl- Parameters:
token- User's single sign on tokenentryDN-DNof the entry.attrNames- Names of the attributes to be read.profileType- Integer representing type of the object.- Returns:
- Map of attribute-values.
- Throws:
AMException- If unable to access datastoreSSOException- If user's single sign on token is invalid.
-
getAttributes
public Map getAttributes(SSOToken token, String entryDN, boolean ignoreCompliance, boolean byteValues, int profileType) throws AMException, SSOException
Gets all attributes corresponding to the entryDN. This method obtains the DC Tree node attributes and also performs compliance related verification checks in compliance mode. Note: In compliance mode you can skip the compliance checks by setting ignoreCompliance to "false".- Specified by:
getAttributesin interfaceIDirectoryServices- Overrides:
getAttributesin classRemoteServicesImpl- Parameters:
token- a valid SSOTokenentryDN- the DN of the entry whose attributes need to retrievedignoreCompliance- a boolean value specificying if compliance related entries need to ignored or not. Ignored if true.byteValues- if false StringValues are fetched, if true byte values are fetched.profileType- the oject type of entryDN- Returns:
- a Map containing attribute names as keys and Set of values corresponding to each key.
- Throws:
AMException- if an error is encountered in fetching the attributesSSOException- If user's single sign on token is invalid.
-
getAttributes
public Map getAttributes(SSOToken token, String entryDN, Set attrNames, boolean ignoreCompliance, boolean byteValues, int profileType) throws AMException, SSOException
Gets the specific attributes corresponding to the entryDN. This method obtains the DC Tree node attributes and also performs compliance related verification checks in compliance mode. Note: In compliance mode you can skip the compliance checks by setting ignoreCompliance to "false".- Specified by:
getAttributesin interfaceIDirectoryServices- Overrides:
getAttributesin classRemoteServicesImpl- Parameters:
token- a valid SSOTokenentryDN- the DN of the entry whose attributes need to retrievedattrNames- a Set of names of the attributes that need to be retrieved. The attrNames should not be nullignoreCompliance- a boolean value specificying if compliance related entries need to ignored or not. Ignored if true.byteValues- Return binary attributes, if true.profileType- Integer representing type of the object.- Returns:
- a Map containing attribute names as keys and Set of values corresponding to each key.
- Throws:
AMException- if an error is encountered in fetching the attributesSSOException- If user's single sign on token is invalid.
-
renameEntry
public String renameEntry(SSOToken token, int objectType, String entryDN, String newName, boolean deleteOldName) throws AMException
Renames an entry. Currently used for only user renaming.- Specified by:
renameEntryin interfaceIDirectoryServices- Overrides:
renameEntryin classRemoteServicesImpl- Parameters:
token- the sso tokenobjectType- the type of entryentryDN- the entry DNnewName- the new name (i.e., if RDN is cn=John, the value passed should be "John"deleteOldName- if true the old name is deleted otherwise it is retained.- Returns:
- new
DNof the renamed entry - Throws:
AMException- if the operation was not successful
-
setAttributes
public void setAttributes(SSOToken token, String entryDN, int objectType, Map stringAttributes, Map byteAttributes, boolean isAdd) throws AMException, SSOException
Method Set the attributes of an entry.- Specified by:
setAttributesin interfaceIDirectoryServices- Overrides:
setAttributesin classRemoteServicesImpl- Parameters:
token- SSOTokenentryDN- DN of the profile whose template is to be setobjectType- profile typestringAttributes- a AMHashMap of attributes to be setbyteAttributes- a AMHashMap of attributes to be setisAdd-trueadd to existing value; otherwise replace the existing value- Throws:
AMExceptionSSOException
-
removeEntry
public void removeEntry(SSOToken token, String entryDN, int objectType, boolean recursive, boolean softDelete) throws AMException, SSOException
Remove an entry from the directory.- Specified by:
removeEntryin interfaceIDirectoryServices- Overrides:
removeEntryin classRemoteServicesImpl- Parameters:
token- SSOTokenentryDN- dn of the profile to be removedobjectType- profile typerecursive- if true, remove all sub entries & the objectsoftDelete- Used to let pre/post callback plugins know that this delete is either a soft delete (marked for deletion) or a purge/hard delete itself, otherwise, remove the object only- Throws:
AMExceptionSSOException
-
createAMTemplate
public String createAMTemplate(SSOToken token, String entryDN, int objectType, String serviceName, Map attributes, int priority) throws AMException
Create an AMTemplate (COSTemplate)- Specified by:
createAMTemplatein interfaceIDirectoryServices- Overrides:
createAMTemplatein classRemoteServicesImpl- Parameters:
token- tokenentryDN- DN of the profile whose template is to be setobjectType- the object typeserviceName- Service Nameattributes- attributes to be setpriority- template priority- Returns:
- String DN of the newly created template
- Throws:
AMException
-
setGroupFilter
public void setGroupFilter(SSOToken token, String entryDN, String filter) throws AMException, SSOException
Description copied from class:RemoteServicesImplSets the filter for a dynamic group in the datastore.- Specified by:
setGroupFilterin interfaceIDirectoryServices- Overrides:
setGroupFilterin classRemoteServicesImpl- Parameters:
token- Single sign on tokenentryDN-DNof group entryfilter- Search filter- Throws:
AMException- If there is a datastore exception.SSOException- If user's single sign on token is invalid.
-
-