Class Profiles


  • public class Profiles
    extends java.lang.Object
    Maintains profiles for different namespaces.
    Version:
    $Revision$
    Author:
    Karan Vahi
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  Profiles.NAMESPACES
      The enumeration of valid namespaces.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.EnumMap<Profiles.NAMESPACES,​Namespace> mProfileMap
      An enum map that associates the enum keys with the corresponding namespace objects.
    • Constructor Summary

      Constructors 
      Constructor Description
      Profiles()
      The default constructor.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addProfile​(Profiles.NAMESPACES namespace, java.lang.String key, java.lang.String value)
      Add a profile.
      void addProfile​(Profile p)
      Adds a profile.
      void addProfile​(java.lang.String namespace, java.lang.String key, java.lang.String value)
      Add a profile.
      void addProfileDirectly​(Profiles.NAMESPACES namespace, java.lang.String key, java.lang.String value)
      Add a profile.
      void addProfileDirectly​(Profile p)
      Adds a profile directly to namespace bypassing any underlying namespace specific checks.
      void addProfileDirectly​(java.lang.String namespace, java.lang.String key, java.lang.String value)
      Add a profile.
      void addProfiles​(Profiles profiles)
      Adds multiple profiles.
      void addProfiles​(java.util.List<Profile> profiles)
      Adds multiple profiles.
      void addProfilesDirectly​(Profiles profiles)
      Adds multiple profiles .
      void addProfilesDirectly​(java.util.List<Profile> profiles)
      Adds multiple profiles to namespace bypassing any underlying namespace specific checks.
      java.lang.Object clone()
      Returns the clone of the object.
      Namespace get​(Profiles.NAMESPACES n)
      Returns the namespace object corresponding to a namespace
      private int getIndex​(Profiles.NAMESPACES u)
      Returns the index for the namespace.
      java.util.Iterator getProfileKeyIterator​(Profiles.NAMESPACES n)
      Returns a iterator over the profile keys corresponding to a particular namespace.
      java.util.List<Profile> getProfiles()
      Returns the list of profiles for all namespaces.
      java.util.List<Profile> getProfiles​(Profiles.NAMESPACES namespace)
      Returns the list of profiles corresponding to a single namespace
      java.util.List<Profile> getProfiles​(Namespace namespace)
      Returns the list of profiles corresponding to a single namespace
      java.util.List<Profile> getProfiles​(java.lang.String namespace)
      Returns the list of profiles corresponding to a single namespace
      boolean isEmpty()
      Returns a boolean indicating if the object is empty.
      static void main​(java.lang.String[] args)  
      java.lang.String toString()
      Returns the string description of the object.
      void toString​(java.io.Writer writer, java.lang.String indent)
      Writes out the contents of the object as a String
      java.lang.String toXML()
      Returns the xml description of the object.
      void toXML​(java.io.Writer writer, java.lang.String indent)
      Writes out the xml description of the object.
      void writeAttribute​(java.io.Writer writer, java.lang.String key, java.lang.String value)
      Writes an attribute to the stream.
      • Methods inherited from class java.lang.Object

        equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • mProfileMap

        private java.util.EnumMap<Profiles.NAMESPACES,​Namespace> mProfileMap
        An enum map that associates the enum keys with the corresponding namespace objects.
    • Constructor Detail

      • Profiles

        public Profiles()
        The default constructor.
    • Method Detail

      • addProfiles

        public void addProfiles​(Profiles profiles)
        Adds multiple profiles.
        Parameters:
        profiles - the profiles object
      • addProfiles

        public void addProfiles​(java.util.List<Profile> profiles)
        Adds multiple profiles.
        Parameters:
        profiles - List of Profile objects.
      • addProfilesDirectly

        public void addProfilesDirectly​(Profiles profiles)
        Adds multiple profiles . to namespace bypassing any underlying namespace specific checks. The catalog parsers should use this function
        Parameters:
        profiles - the profiles object
      • addProfilesDirectly

        public void addProfilesDirectly​(java.util.List<Profile> profiles)
        Adds multiple profiles to namespace bypassing any underlying namespace specific checks. The catalog parsers should use this function.
        Parameters:
        profiles - List of Profile objects.
      • addProfileDirectly

        public void addProfileDirectly​(Profile p)
        Adds a profile directly to namespace bypassing any underlying namespace specific checks. The catalog parsers should use this function.
        Parameters:
        p - the profile to be added
      • addProfile

        public void addProfile​(Profile p)
        Adds a profile.
        Parameters:
        p - the profile to be added
      • addProfileDirectly

        public void addProfileDirectly​(Profiles.NAMESPACES namespace,
                                       java.lang.String key,
                                       java.lang.String value)
        Add a profile. Convenience method
        Parameters:
        namespace -
        key -
        value -
      • addProfileDirectly

        public void addProfileDirectly​(java.lang.String namespace,
                                       java.lang.String key,
                                       java.lang.String value)
        Add a profile. Convenience method
        Parameters:
        namespace -
        key -
        value -
      • addProfile

        public void addProfile​(Profiles.NAMESPACES namespace,
                               java.lang.String key,
                               java.lang.String value)
        Add a profile. Convenience method
        Parameters:
        namespace -
        key -
        value -
      • addProfile

        public void addProfile​(java.lang.String namespace,
                               java.lang.String key,
                               java.lang.String value)
        Add a profile. Convenience method
        Parameters:
        namespace -
        key -
        value -
      • getProfiles

        public java.util.List<Profile> getProfiles()
        Returns the list of profiles for all namespaces.
        Returns:
        List of Profiles
      • getProfiles

        public java.util.List<Profile> getProfiles​(java.lang.String namespace)
        Returns the list of profiles corresponding to a single namespace
        Parameters:
        namespace - the namespace
        Returns:
        List of Profiles
      • getProfiles

        public java.util.List<Profile> getProfiles​(Profiles.NAMESPACES namespace)
        Returns the list of profiles corresponding to a single namespace
        Parameters:
        namespace - the namespace
        Returns:
        List of Profiles
      • getProfiles

        public java.util.List<Profile> getProfiles​(Namespace namespace)
        Returns the list of profiles corresponding to a single namespace
        Parameters:
        namespace - the namespace
        Returns:
        List of Profiles
      • getProfileKeyIterator

        public java.util.Iterator getProfileKeyIterator​(Profiles.NAMESPACES n)
        Returns a iterator over the profile keys corresponding to a particular namespace.
        Parameters:
        n - the namespace
        Returns:
        iterator
      • get

        public Namespace get​(Profiles.NAMESPACES n)
        Returns the namespace object corresponding to a namespace
        Parameters:
        n - the namespace
        Returns:
        Namespace
      • isEmpty

        public boolean isEmpty()
        Returns a boolean indicating if the object is empty. The object is empty if all the underlying profile maps are empty.
        Returns:
      • toXML

        public void toXML​(java.io.Writer writer,
                          java.lang.String indent)
                   throws java.io.IOException
        Writes out the xml description of the object.
        Parameters:
        writer - is a Writer opened and ready for writing. This can also be a StringWriter for efficient output.
        indent - the indent to be used.
        Throws:
        java.io.IOException - if something fishy happens to the stream.
      • toString

        public java.lang.String toString()
        Returns the string description of the object.
        Overrides:
        toString in class java.lang.Object
        Returns:
        String containing the object in XML.
        Throws:
        java.lang.RuntimeException - if something fishy happens to the stream.
      • toString

        public void toString​(java.io.Writer writer,
                             java.lang.String indent)
                      throws java.io.IOException
        Writes out the contents of the object as a String
        Parameters:
        writer - is a Writer opened and ready for writing. This can also be a StringWriter for efficient output.
        indent - the indent to be used.
        Throws:
        java.io.IOException - if something fishy happens to the stream.
      • clone

        public java.lang.Object clone()
        Returns the clone of the object.
        Overrides:
        clone in class java.lang.Object
        Returns:
        the clone
      • toXML

        public java.lang.String toXML()
                               throws java.io.IOException
        Returns the xml description of the object. This is used for generating the partition graph. That is no longer done.
        Returns:
        String containing the object in XML.
        Throws:
        java.io.IOException - if something fishy happens to the stream.
      • writeAttribute

        public void writeAttribute​(java.io.Writer writer,
                                   java.lang.String key,
                                   java.lang.String value)
                            throws java.io.IOException
        Writes an attribute to the stream. Wraps the value in quotes as required by XML.
        Parameters:
        writer -
        key -
        value -
        Throws:
        java.io.IOException - if something fishy happens to the stream.
      • getIndex

        private int getIndex​(Profiles.NAMESPACES u)
        Returns the index for the namespace.
        Parameters:
        u - the unit
        Returns:
        the index.
      • main

        public static void main​(java.lang.String[] args)
        Parameters:
        args -