Class CachedRemoteServicesImpl

    • Field Detail

      • NSROLEDN_ATTR

        protected static String NSROLEDN_ATTR
      • NSROLE_ATTR

        protected static String NSROLE_ATTR
    • Method Detail

      • getSize

        public int getSize()
        Method to get the current cache size
        Specified by:
        getSize in interface ICachedDirectoryServices
        Returns:
        the size of the SDK LRU cache
      • 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
        Overrides:
        toString in class Object
      • dirtyCache

        public void dirtyCache​(String dn,
                               int eventType,
                               boolean cosType,
                               boolean aciChange,
                               Set attrNames)
        This method will be called by AMIdRepoListener. 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:
        dirtyCache in interface ICachedDirectoryServices
        Parameters:
        dn - name of entity being modified
        eventType - type of modification
        cosType - true if it is cos related. false otherwise
        aciChange - true if it is aci related. false otherwise
        attrNames - 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:
        clearCache in interface ICachedDirectoryServices
      • 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:
        getOrganizationDN in interface IDirectoryServices
        Overrides:
        getOrganizationDN in class RemoteServicesImpl
        Parameters:
        token - a valid SSOToken
        entryDN - 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
      • getExternalAttributes

        public Map getExternalAttributes​(SSOToken token,
                                         String entryDN,
                                         Set attrNames,
                                         int profileType)
                                  throws AMException
        Returns attributes from an external data store.
        Specified by:
        getExternalAttributes in interface IDirectoryServices
        Overrides:
        getExternalAttributes in class RemoteServicesImpl
        Parameters:
        token - Single sign on token of user
        entryDN - DN of the entry user is trying to read
        attrNames - Set of attributes to be read
        profileType - 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,
                                 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:
        getAttributes in interface IDirectoryServices
        Overrides:
        getAttributes in class RemoteServicesImpl
        Parameters:
        token - a valid SSOToken
        entryDN - the DN of the entry whose attributes need to retrieved
        ignoreCompliance - 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 attributes
        SSOException - 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:
        getAttributes in interface IDirectoryServices
        Overrides:
        getAttributes in class RemoteServicesImpl
        Parameters:
        token - a valid SSOToken
        entryDN - the DN of the entry whose attributes need to retrieved
        attrNames - a Set of names of the attributes that need to be retrieved. The attrNames should not be null
        ignoreCompliance - 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 attributes
        SSOException - 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:
        renameEntry in interface IDirectoryServices
        Overrides:
        renameEntry in class RemoteServicesImpl
        Parameters:
        token - the sso token
        objectType - the type of entry
        entryDN - the entry DN
        newName - 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 DN of 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:
        setAttributes in interface IDirectoryServices
        Overrides:
        setAttributes in class RemoteServicesImpl
        Parameters:
        token - SSOToken
        entryDN - DN of the profile whose template is to be set
        objectType - profile type
        stringAttributes - a AMHashMap of attributes to be set
        byteAttributes - a AMHashMap of attributes to be set
        isAdd - true add to existing value; otherwise replace the existing value
        Throws:
        AMException
        SSOException
      • 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:
        removeEntry in interface IDirectoryServices
        Overrides:
        removeEntry in class RemoteServicesImpl
        Parameters:
        token - SSOToken
        entryDN - dn of the profile to be removed
        objectType - profile type
        recursive - if true, remove all sub entries & the object
        softDelete - 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:
        AMException
        SSOException
      • createAMTemplate

        public String createAMTemplate​(SSOToken token,
                                       String entryDN,
                                       int objectType,
                                       String serviceName,
                                       Map attributes,
                                       int priority)
                                throws AMException
        Create an AMTemplate (COSTemplate)
        Specified by:
        createAMTemplate in interface IDirectoryServices
        Overrides:
        createAMTemplate in class RemoteServicesImpl
        Parameters:
        token - token
        entryDN - DN of the profile whose template is to be set
        objectType - the object type
        serviceName - Service Name
        attributes - attributes to be set
        priority - template priority
        Returns:
        String DN of the newly created template
        Throws:
        AMException