Class AMClientCapData

  • All Implemented Interfaces:
    IDSEventListener, EventListener

    public class AMClientCapData
    extends Object
    implements IDSEventListener
    The abstraction to get/set the clients stored in the DSAME. The Client is stored as a DIT in directory server with the properties as attributes.
    • Method Detail

      • getServiceName

        public String getServiceName()
        Returns:
        the serviceName. Used by the console plug-in to get to the resource bundle.
      • getProperties

        public Map getProperties​(String clientType)
        Get a Map of all the properties for the Client. The Map contains key of property names and a Set for the values.
        Parameters:
        clientType - Client Type Name.
        Returns:
        Map of the properties or null if client not found
      • loadMinimalClient

        public Map loadMinimalClient​(String clientType)
        Gets the minimal client info for the specified client.
      • getProfileManagerXML

        public String getProfileManagerXML()
        Gets the profile manager xlob as a string. Used by the MAPClientDetector.
        Returns:
        ProfileManager.xml
      • getPropertyNames

        public Set getPropertyNames​(String classification)
        Get a Set of all the Property names for the classification. Valid classifications are:
        1. generalPropertyNames
        2. hardwarePlatformNames
        3. softwarePlatformNames
        4. networkCharacteristicsNames
        5. browserUANames
        6. wapCharacteristicsNames
        7. pushCharacteristicsNames
        8. additionalPropertiesNames
        Returns:
        Set of PropertyNames belonging to classification or null if nothing exists.
      • isClientPresent

        public boolean isClientPresent​(String clientType)
        Checks if the clientType exists in the db.
        Returns:
        true if present, false otherwise
      • addClient

        public int addClient​(SSOToken token,
                             Map props)
                      throws AMClientCapException
        Add a client. For every property in the Map, it looks up the schema to check if the property is known, if not known adds it to the additionalProperties schema element.
        Note: To add a property in the external db to mask the corresponding property value in internal db, add the property with a " " ("<space>") not an empty "" string. This is required because, when dsame fetches the value from directory and sees it has no value, it returns an empty set. (And we discard empty sets internally - bcos dsame stores values for every property defined in the schema).
        Parameters:
        token - SSOToken to validate the user
        props - Map of profiles known to ClientCap. The Map "must" have a property "clientType"
        Returns:
        0 on success
        Throws:
        AMClientCapException - if Client could not be added - permission problems or if the clientType property is mising in the Map.
      • modifyClient

        public int modifyClient​(SSOToken token,
                                Map props)
                         throws AMClientCapException
        Modify the properties of the Client instance in externalDB. Valid only with instance of externalDB.
        Note: To add a property in the external db to mask the corresponding property value in internal db, add the property with a " " ("<space>") not an empty "" string. This is required because, when dsame fetches the value from directory and sees it has no value, it returns an empty set. (And we discard empty sets internally - bcos dsame stores values for every property defined in the schema). Also, if the additionalProperties are being modified, it should contain both the modified and the unmodified ones. This is required since all the additionalProperties are stored in a single Attribute "additionalProperties".
        Parameters:
        token - SSOToken to validate the user.
        props - Map of profiles known to ClientCapabilities. The Map contains key of property name(s) and Set for the values. It wont overwrite the property names not in the Map. A key with an empty Set for the values will delete the property (DSAME cannot handle null values - throws NullPointerExcptn). The Map "must" have a property "clientType"
        Returns:
        0 on success
        Throws:
        AMClientCapException - if Client could not be modified - permission problems OR if the clientType property is mising in the Map.
      • removeClient

        public int removeClient​(SSOToken token,
                                String clientType)
                         throws AMClientCapException
        Remove a Client - removes the client from the externalDB. Valid only with instance of externalDB.
        Parameters:
        token - SSOToken to validate the user
        clientType - Client Type Name.
        Returns:
        0 on success
        Throws:
        AMClientCapException - if Client could not be removed - permission problems
      • getSchemaElements

        public static Set getSchemaElements()
        This method returns the name of the "defined" client properties in the Schema. To get the AttributeSchema of these elements, iterate through each of these names and call the getAttributeSchema() on it. Can be used with internal/external instance (since they share the same schema).
        Returns:
        a Set of "defined" property names.
      • getAttributeSchema

        public AttributeSchema getAttributeSchema​(String propName)
        Returns the schema for an property given the name. Can be used with internal/external instance (since they share the same schema).
        Parameters:
        propName - Name of the property
        Returns:
        com.sun.identity.sm.AttributeSchema Look at OpenSSO API
        See Also:
        AttributeSchema
      • canCreateInternalClients

        public boolean canCreateInternalClients()
        Checks the enableClientCliention attr in Service. Used by the ClientTypesManager when creating new Clients in the internal DB.
        Returns:
        true/false
      • addListener

        public void addListener​(AMClientDataListener cdl)
        register for listening to Client data changes
      • eventError

        public void eventError​(String err)
        Description copied from interface: IDSEventListener
        This callback method is called by the EventService when an error is encountered after setting a Persistent Search request in the Directory Server
        Specified by:
        eventError in interface IDSEventListener
      • entryChanged

        public void entryChanged​(DSEvent event)
        Description copied from interface: IDSEventListener
        This callback method is called by the EventService when the Directory Server triggers a PersistentSearch notification
        Specified by:
        entryChanged in interface IDSEventListener
      • allEntriesChanged

        public void allEntriesChanged()
        Description copied from interface: IDSEventListener
        This callback notifies listeners that EventService is restarting the Persistent Search connections due to connection errors, and there is no guarantee of what could have changed in the directory so mark all entries as modified.
        Specified by:
        allEntriesChanged in interface IDSEventListener
      • getClassifications

        public String[] getClassifications()
        Returns:
        the valid classifications.
      • getMinimalClientInfo

        public Set getMinimalClientInfo()
        Gets a minimal set of client properties for all clients.
        Returns:
        Set of Maps. Each Map has the propertyNames for the Key and Value is Set of Property values. By default, the keys returned are clientType, userAgent & parentID.