Class AgentConfiguration


  • public class AgentConfiguration
    extends Object
    This class provides agent configuration utilities.
    • Method Detail

      • createAgentGroup

        public static void createAgentGroup​(SSOToken ssoToken,
                                            String realm,
                                            String agentGroupName,
                                            String agentType,
                                            Map attrValues)
                                     throws IdRepoException,
                                            SSOException,
                                            SMSException,
                                            ConfigurationException
        Creates an agent group.
        Parameters:
        ssoToken - Single Sign On token that is to be used for creation.
        realm - Realm where group resides.
        agentGroupName - Name of agent group.
        agentType - Type of agent group.
        attrValues - Map of attribute name to its values.
        Throws:
        IdRepoException - if there are Id Repository related errors.
        SSOException - if the Single Sign On token is invalid or has expired.
        SMSException - if there are errors in service management layers.
        ConfigurationException - if there are missing information in server or agent URL; or invalid agent type.
      • createAgent

        public static void createAgent​(SSOToken ssoToken,
                                       String realm,
                                       String agentName,
                                       String agentType,
                                       Map attrValues,
                                       String serverURL,
                                       String agentURL)
                                throws IdRepoException,
                                       SSOException,
                                       SMSException,
                                       ConfigurationException
        Creates an agent.
        Parameters:
        ssoToken - Single Sign On token that is to be used for creation.
        realm - Realm where agent resides.
        agentName - Name of agent.
        agentType - Type of agent.
        attrValues - Map of attribute name to its values.
        serverURL - Server URL.
        agentURL - Agent URL.
        Throws:
        IdRepoException - if there are Id Repository related errors.
        SSOException - if the Single Sign On token is invalid or has expired.
        SMSException - if there are errors in service management layers.
        ConfigurationException - if there are missing information in server or agent URL; or invalid agent type.
      • removeDefaultDuplicates

        public static void removeDefaultDuplicates​(Map<String,​Set<String>> attributeValues,
                                                   Map<String,​Set<String>> finalAttributes)
        For the given map of user supplied attributeValues, use the keys to find duplicate default values and remove them from the finalAttributes which will end up being used to create the actual agent configuration.
        For example:
         com.sun.identity.agents.config.notenforced.url=[[0]=] from defaults is transformed into
         com.sun.identity.agents.config.notenforced.url[0]= which then clashes with any supplied values like
         com.sun.identity.agents.config.notenforced.url[0]=[*.gif]
         
        Parameters:
        attributeValues - a map of values supplied when configuring the agent
        finalAttributes - a map of values that will be used to create the agent configuration.
      • updateAgent

        public static void updateAgent​(SSOToken ssoToken,
                                       String realm,
                                       String agentName,
                                       Map attrValues,
                                       boolean bSet)
                                throws IdRepoException,
                                       SSOException,
                                       SMSException,
                                       ConfigurationException
        Updates agent attribute values.
        Parameters:
        ssoToken - Single Sign On token that is to be used for creation.
        realm - Name of realm where agent resides.
        agentName - Name of agent.
        attrValues - Map of attribute name to its values.
        bSet - true to overwrite the values for the attribute.
        Throws:
        IdRepoException - if there are Id Repository related errors.
        SSOException - if the Single Sign On token is invalid or has expired.
        SMSException - if there are errors in service management layers.
        ConfigurationException - if agent does not exist.
      • updateAgentGroup

        public static void updateAgentGroup​(SSOToken ssoToken,
                                            String realm,
                                            String agentGroupName,
                                            Map attrValues)
                                     throws IdRepoException,
                                            SSOException,
                                            SMSException,
                                            ConfigurationException
        Updates agent group attribute values.
        Parameters:
        ssoToken - Single Sign On token that is to be used for creation.
        realm - Realm where group resides.
        agentGroupName - Name group of agent.
        attrValues - Map of attribute name to its values.
        Throws:
        IdRepoException - if there are Id Repository related errors.
        SSOException - if the Single Sign On token is invalid or has expired.
        SMSException - if there are errors in service management layers.
        ConfigurationException - if attribute values map contains invalid values.
      • updateAgentGroup

        public static void updateAgentGroup​(SSOToken ssoToken,
                                            String realm,
                                            String agentGroupName,
                                            Map attrValues,
                                            boolean bSet)
                                     throws IdRepoException,
                                            SSOException,
                                            SMSException,
                                            ConfigurationException
        Updates agent group attribute values.
        Parameters:
        ssoToken - Single Sign On token that is to be used for creation.
        realm - Name of realm where agent resides.
        agentGroupName - Name of agent group.
        attrValues - Map of attribute name to its values.
        bSet - true to overwrite the values for the attribute.
        Throws:
        IdRepoException - if there are Id Repository related errors.
        SSOException - if the Single Sign On token is invalid or has expired.
        SMSException - if there are errors in service management layers.
        ConfigurationException - if attribute values map contains invalid values.
      • getAgentAttributeSchemas

        public static Set getAgentAttributeSchemas​(String agentTypeName)
                                            throws SMSException,
                                                   SSOException
        Returns a set of attribute schemas of a given agent type.
        Parameters:
        agentTypeName - Name of agent type.
        Returns:
        a set of attribute schemas of a given agent type.
        Throws:
        SSOException - if the Single Sign On token is invalid or has expired.
        SMSException - if there are errors in service management layers.
      • getAgentGroupAttributes

        public static Map getAgentGroupAttributes​(SSOToken ssoToken,
                                                  String realm,
                                                  String agentGroupName)
                                           throws IdRepoException,
                                                  SMSException,
                                                  SSOException
        Returns agent group's attribute values.
        Parameters:
        ssoToken - Single Sign On token that is to be used for query.
        realm - Name of realm where agent group resides.
        agentGroupName - Name of agent group.
        Returns:
        agent group's attribute values.
        Throws:
        IdRepoException - if there are Id Repository related errors.
        SSOException - if the Single Sign On token is invalid or has expired.
        SMSException - if there are errors in service management layers.
      • getAgentAttributes

        public static Map getAgentAttributes​(SSOToken ssoToken,
                                             String realm,
                                             String agentName)
                                      throws IdRepoException,
                                             SMSException,
                                             SSOException
        Returns agent's attribute values.
        Parameters:
        ssoToken - Single Sign On token that is to be used for query.
        realm - Realm where agent resides.
        agentName - Name of agent.
        Returns:
        agent's attribute values.
        Throws:
        IdRepoException - if there are Id Repository related errors.
        SSOException - if the Single Sign On token is invalid or has expired.
        SMSException - if there are errors in service management layers.
      • getAgentAttributes

        public static Map getAgentAttributes​(SSOToken ssoToken,
                                             String realm,
                                             String agentName,
                                             boolean bInherit)
                                      throws IdRepoException,
                                             SMSException,
                                             SSOException
        Returns agent's attribute values.
        Parameters:
        ssoToken - Single Sign On token that is to be used for query.
        realm - Realm where agent resides.
        agentName - Name of agent.
        bInherit - true to inherit from group.
        Returns:
        agent's attribute values.
        Throws:
        IdRepoException - if there are Id Repository related errors.
        SSOException - if the Single Sign On token is invalid or has expired.
        SMSException - if there are errors in service management layers.
      • getAgentAttributes

        public static Map getAgentAttributes​(AMIdentity amid,
                                             boolean reformat)
                                      throws IdRepoException,
                                             SMSException,
                                             SSOException
        Returns agent's attribute values.
        Parameters:
        amid - Identity object.
        reformat - true to reformat the values.
        Returns:
        agent's attribute values.
        Throws:
        IdRepoException - if there are Id Repository related errors.
        SSOException - if the Single Sign On token is invalid or has expired.
        SMSException - if there are errors in service management layers.
      • getAgentType

        public static String getAgentType​(AMIdentity amid)
                                   throws IdRepoException,
                                          SSOException
        For the given Agent identity, return the value that represents the agent type.
        Parameters:
        amid - Identity object containing value.
        Returns:
        agent type or empty string if not found.
        Throws:
        IdRepoException - if there are Id Repository related errors.
        SSOException - if the Single Sign On token is invalid or has expired.
      • getAttributesSchemaNames

        public static Set getAttributesSchemaNames​(AMIdentity amid,
                                                   AttributeSchema.Syntax syntax)
                                            throws SMSException,
                                                   SSOException,
                                                   IdRepoException
        Returns a set of attribute schema names whose schema match a given syntax.
        Parameters:
        amid - Identity Object. Agent Type is to be gotten from it.
        syntax - Syntax.
        Returns:
        a set of attribute schema names whose schema match a given syntax.
        Throws:
        IdRepoException - if there are Id Repository related errors.
        SSOException - if the Single Sign On token is invalid or has expired.
        SMSException - if there are errors in service management layers.
      • getAttributesSchemaNames

        public static Set getAttributesSchemaNames​(String agentType,
                                                   AttributeSchema.Type type)
                                            throws SMSException,
                                                   SSOException
        Returns a set of attribute schema names whose schema match a given type.
        Parameters:
        agentType - Agent type
        type - AttributeSchema type
        Returns:
        a set of attribute schema names whose schema match a given type.
        Throws:
        IdRepoException - if there are Id Repository related errors.
        SSOException - if the Single Sign On token is invalid or has expired.
        SMSException - if there are errors in service management layers.
      • getResourceBundleName

        public static String getResourceBundleName()
                                            throws SMSException,
                                                   SSOException
        Returns resource bundle name of agent service.
        Returns:
        resource bundle name of agent service.
        Throws:
        SMSException - if Service Schema cannot be located.
        SSOException - if admin single sign on token has expired.
      • getDefaultValues

        public static Map getDefaultValues​(String agentType,
                                           boolean bGroup)
                                    throws SMSException,
                                           SSOException
        Returns the default values of attribute schemas of a given agent type.
        Parameters:
        agentType - Type of agent.
        bGroup - true if this is for a group.
        Throws:
        SSOException - if the Single Sign On token is invalid or has expired.
        SMSException - if there are errors in service management layers.
      • getChoiceValues

        public static Map getChoiceValues​(String name,
                                          String agentType)
                                   throws SMSException,
                                          SSOException
        Returns choice values of an attribute schema.
        Parameters:
        name - Name of attribute schema.
        agentType - Type of agent.
        Returns:
        choice values of an attribute schema.
        Throws:
        SSOException - if the Single Sign On token is invalid or has expired.
        SMSException - if there are errors in service management layers.
      • getAgentAttributeSchema

        public static AttributeSchema getAgentAttributeSchema​(String name,
                                                              String agentTypeName)
                                                       throws SMSException,
                                                              SSOException
        Returns attribute schema of a given agent type.
        Parameters:
        name - Name of attribute schema.
        agentTypeName - Name of agent type.
        Returns:
        attribute schema of a given agent type.
        Throws:
        SSOException - if the Single Sign On token is invalid or has expired.
        SMSException - if there are errors in service management layers.
      • getAttributeSchemas

        public static Map getAttributeSchemas​(String agentType,
                                              Collection names)
                                       throws SMSException,
                                              SSOException
        Returns attribute schema for a given set of attribute names.
        Parameters:
        agentType - Agent type.
        names - Set of attribute names.
        Returns:
        localized names for a given set of attribute names.
        Throws:
        SMSException
        SSOException
      • supportLocalProperties

        public static boolean supportLocalProperties​(String agentType)
        Returns true if an agent type support local properties.
        Parameters:
        agentType - Agent Type.
        Returns:
        true if an agent type support local properties.
      • getLocalPropertyNames

        public static Set getLocalPropertyNames​(String agentType)
        Returns a set of local property name if an agent type. Returns null if agent type does not support local properties.
        Parameters:
        agentType - Agent Type.
        Returns:
        a set of local property name if an agent type.
      • deleteAgentGroups

        public static void deleteAgentGroups​(SSOToken ssoToken,
                                             String realm,
                                             Set agentGroups)
                                      throws IdRepoException,
                                             SSOException,
                                             SMSException
        Deletes agent groups.
        Parameters:
        ssoToken - Single Sign On token that is to be used for deletion.
        realm - Realm where agent groups reside.
        agentGroups - Set of Agent Group object.
        Throws:
        IdRepoException - if unable to delete groups.
        SSOException - if the Single Sign On token is invalid or has expired.
        SMSException - if there are errors in service management layers.
      • setAgentGroup

        public static boolean setAgentGroup​(SSOToken ssoToken,
                                            String realm,
                                            String universalId,
                                            String groupName)
                                     throws IdRepoException,
                                            SSOException,
                                            SMSException
        Set agent group. Returns true if group is set.
        Parameters:
        ssoToken - Single Sign On token that is to be used for this operation.
        realm - Realm name where agent and group reside.
        universalId - Universal ID of Agent.
        groupName - Name of Group object to be set.
        Returns:
        true if group is set.
        Throws:
        IdRepoException - if group cannot be set.
        SSOException - if the Single Sign On token is invalid or has expired.
        SMSException - if there are errors in service management layers
      • setAgentGroup

        public static boolean setAgentGroup​(SSOToken ssoToken,
                                            String realm,
                                            AMIdentity amid,
                                            String groupName)
                                     throws IdRepoException,
                                            SSOException,
                                            SMSException
        Set agent group. Returns true if group is set.
        Parameters:
        ssoToken - Single Sign On token that is to be used for this operation.
        realm - Realm name where agent and group reside.
        amid - Agent object.
        groupName - Name of Group object to be set.
        Returns:
        true if group is set.
        Throws:
        IdRepoException - if group cannot be set.
        SSOException - if the Single Sign On token is invalid or has expired.
        SMSException - if there are errors in service management layers
      • removeAgentGroup

        public static boolean removeAgentGroup​(AMIdentity amid,
                                               AMIdentity groupToRemove)
                                        throws IdRepoException,
                                               SSOException,
                                               SMSException
        Removes agent from it group. Returns true if group is removed.
        Parameters:
        amid - Agent object.
        groupToRemove - Group object to be removed.
        Returns:
        true if group is removed.
        Throws:
        IdRepoException - if group cannot be removed.
        SSOException - if the Single Sign On token is invalid or has expired.
        SMSException - if there are errors in service management layers