edu.isi.pegasus.planner.catalog.classes
Class Profiles

java.lang.Object
  extended by edu.isi.pegasus.planner.catalog.classes.Profiles

public class Profiles
extends Object

Maintains profiles for different namespaces.

Version:
$Revision: 2572 $
Author:
Karan Vahi

Nested Class Summary
static class Profiles.NAMESPACES
          The enumeration of valid namespaces.
 
Field Summary
private  EnumMap<Profiles.NAMESPACES,Namespace> mProfileMap
          An enum map that associates the enum keys with the corresponding namespace objects.
 
Constructor Summary
Profiles()
          The default constructor.
 
Method Summary
 void addProfile(Profile p)
          Adds a profile.
 void addProfile(Profiles.NAMESPACES namespace, String key, String value)
          Add a profile.
 void addProfile(String namespace, String key, String value)
          Add a profile.
 void addProfileDirectly(Profile p)
          Adds a profile directly to namespace bypassing any underlying namespace specific checks.
 void addProfileDirectly(Profiles.NAMESPACES namespace, String key, String value)
          Add a profile.
 void addProfileDirectly(String namespace, String key, String value)
          Add a profile.
 void addProfiles(List<Profile> profiles)
          Adds multiple profiles.
 void addProfiles(Profiles profiles)
          Adds multiple profiles.
 void addProfilesDirectly(List<Profile> profiles)
          Adds multiple profiles to namespace bypassing any underlying namespace specific checks.
 void addProfilesDirectly(Profiles profiles)
          Adds multiple profiles .
 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.
 Iterator getProfileKeyIterator(Profiles.NAMESPACES n)
          Returns a iterator over the profile keys corresponding to a particular namespace.
 List<Profile> getProfiles()
          Returns the list of profiles for all namespaces.
 List<Profile> getProfiles(Namespace namespace)
          Returns the list of profiles corresponding to a single namespace
 List<Profile> getProfiles(Profiles.NAMESPACES namespace)
          Returns the list of profiles corresponding to a single namespace
 List<Profile> getProfiles(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(String[] args)
           
 String toString()
          Returns the string description of the object.
 void toString(Writer writer, String indent)
          Writes out the contents of the object as a String
 String toXML()
          Returns the xml description of the object.
 void toXML(Writer writer, String indent)
          Writes out the xml description of the object.
 void writeAttribute(Writer writer, String key, 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 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(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(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,
                               String key,
                               String value)
Add a profile. Convenience method

Parameters:
namespace -
key -
value -

addProfileDirectly

public void addProfileDirectly(String namespace,
                               String key,
                               String value)
Add a profile. Convenience method

Parameters:
namespace -
key -
value -

addProfile

public void addProfile(Profiles.NAMESPACES namespace,
                       String key,
                       String value)
Add a profile. Convenience method

Parameters:
namespace -
key -
value -

addProfile

public void addProfile(String namespace,
                       String key,
                       String value)
Add a profile. Convenience method

Parameters:
namespace -
key -
value -

getProfiles

public List<Profile> getProfiles()
Returns the list of profiles for all namespaces.

Returns:
List of Profiles

getProfiles

public List<Profile> getProfiles(String namespace)
Returns the list of profiles corresponding to a single namespace

Parameters:
namespace - the namespace
Returns:
List of Profiles

getProfiles

public 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 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 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(Writer writer,
                  String indent)
           throws 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:
IOException - if something fishy happens to the stream.

toString

public String toString()
Returns the string description of the object.

Overrides:
toString in class Object
Returns:
String containing the object in XML.
Throws:
RuntimeException - if something fishy happens to the stream.

toString

public void toString(Writer writer,
                     String indent)
              throws 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:
IOException - if something fishy happens to the stream.

clone

public Object clone()
Returns the clone of the object.

Overrides:
clone in class Object
Returns:
the clone

toXML

public String toXML()
             throws 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:
IOException - if something fishy happens to the stream.

writeAttribute

public void writeAttribute(Writer writer,
                           String key,
                           String value)
                    throws IOException
Writes an attribute to the stream. Wraps the value in quotes as required by XML.

Parameters:
writer -
key -
value -
Throws:
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(String[] args)
Parameters:
args -


Copyright © 2011 The University of Southern California. All Rights Reserved.