Class ResponseProviders


  • public class ResponseProviders
    extends Object
    The class ResponseProviders provides methods to maintain a collection of ResponseProvider objects that apply to a policy. This class provides methods to add, replace and remove ResponseProvider objects from this ResponseProviders. The Policy object provides methods to set ResponseProviders, which identifies response attributes that apply to the policy.
    • Constructor Detail

      • ResponseProviders

        public ResponseProviders​(String name,
                                 String description)
        Constructor to obtain an instance of ResponseProviders to hold collection of responseProviders represented as ResponseProvider
        Parameters:
        name - name for the collection of ResponseProvider
        description - user friendly description for the collection of ResponseProvider
    • Method Detail

      • getName

        public String getName()
        Returns the name of this object
        Returns:
        name of this object
      • getDescription

        public String getDescription()
        Returns the description of this object
        Returns:
        description of this object
      • setName

        public void setName​(String name)
        Sets the name of this object
        Parameters:
        name - name for this object
      • setDescription

        public void setDescription​(String description)
        Sets the description of this object
        Parameters:
        description - description for this object
      • getResponseProviderNames

        public Set getResponseProviderNames()
        Returns the names of ResponseProvider objects contained in this object.
        Returns:
        names of ResponseProvider contained in this object
      • getResponseProvider

        public ResponseProvider getResponseProvider​(String responseProviderName)
                                             throws NameNotFoundException
        Returns the ResponseProvider object associated with the given responseProvider name.
        Parameters:
        responseProviderName - name of the ResponseProvider object
        Returns:
        ResponseProvider object corresponding to responseProvider name
        Throws:
        NameNotFoundException - if a ResponseProvider with the given name is not present
      • addResponseProvider

        public void addResponseProvider​(ResponseProvider responseProvider)
                                 throws NameAlreadyExistsException
        Adds a ResponseProvider object to this instance of ResponseProviders. Since the name is not provided it will be dynamically assigned such that it is unique within this instance of the ResponseProviders . However if a ResponseProvider entry with the same name already exists in the ResponseProviders, NameAlreadyExistsException will be thrown.
        Parameters:
        responseProvider - instance of the ResponseProvider object to be added
        Throws:
        NameAlreadyExistsException - if a ResponseProvider object is present with the same name
      • addResponseProvider

        public void addResponseProvider​(String responseProviderName,
                                        ResponseProvider responseProvider)
                                 throws NameAlreadyExistsException
        Adds a ResponseProvider object to this instance of ResponseProviders. If another ResponseProvider with the same name already exists in this object NameAlreadyExistsException will be thrown.
        Parameters:
        responseProviderName - name for the ResponseProvider instance
        responseProvider - instance of the ResponseProvider object to be added
        Throws:
        NameAlreadyExistsException - if a ResponseProvider object is present with the same name
      • replaceResponseProvider

        public void replaceResponseProvider​(String responseProviderName,
                                            ResponseProvider responseProvider)
                                     throws NameNotFoundException
        Replaces an existing responseProvider object having the same name with the new one. If a ResponseProvider with the given name does not exist, NameNotFoundException will be thrown.
        Parameters:
        responseProviderName - name for the responseProvider instance
        responseProvider - instance of the responseProvider object that will replace another responseProvider object having the given name
        Throws:
        NameNotFoundException - if a responseProvider instance with the given name is not present
      • removeResponseProvider

        public ResponseProvider removeResponseProvider​(String responseProviderName)
        Removes the ResponseProvider object identified by responseProvider's name. If a responseProvider instance with the given name does not exist, the method will return silently.
        Parameters:
        responseProviderName - name of the responseProvider instance that will be removed from the responseProviders collection
        Returns:
        the responseProvider that was just removed
      • removeResponseProvider

        public ResponseProvider removeResponseProvider​(ResponseProvider responseProvider)
        Removes the ResponseProvider object identified by object's equals method. If a responseProvider instance does not exist, the method will return silently.
        Parameters:
        responseProvider - responseProvider object that will be removed from the responseProviders collection
        Returns:
        the responseProvider that was just removed
      • getResponseProviderName

        public String getResponseProviderName​(ResponseProvider responseProvider)
        Returns the name associated with the given responseProvider object. It uses the equals method on the responseProvider to determine equality. If a responseProvider instance that matches the given responseProvider object is not present, the method returns null.
        Parameters:
        responseProvider - responseProvider object for which this method will return its associated name
        Returns:
        user friendly name given to the responseProvider object; null if not present
      • equals

        public boolean equals​(Object o)
        Checks if two ResponseProviders are identical. Two responseProviders (or responseProviders collections) are identical only if both have the same set of ResponseProvider objects.
        Overrides:
        equals in class Object
        Parameters:
        o - object against which this responseProviders object will be checked for equality
        Returns:
        true if all the responseProviders match, false otherwise
      • clone

        public Object clone()
        Returns a deep copy of this object with the identical set of ResponseProvider objects
        Overrides:
        clone in class Object
        Returns:
        a deep copy of this object
      • toString

        public String toString()
        Returns XML string representation of this object
        Overrides:
        toString in class Object
        Returns:
        xml string representation of this object
      • toXML

        protected String toXML()