edu.isi.pegasus.planner.namespace

## Class Namespace

- java.lang.Object
- - edu.isi.pegasus.planner.namespace.Namespace

Direct Known Subclasses:
  Condor, Dagman, ENV, Globus, Hints, Pegasus, Selector, Stat

    public abstract class Namespace
    extends java.lang.Object

The base namespace class that all the othernamepsace handling classes extend. Some constants are defined.

Version:
  $Revision$
Author:
  Karan Vahi, Gaurang Mehta

### Nested Class Summary

Nested Classes
`protected class` `Namespace.EmptyIterator` An empty iterator that allows me to traverse in case of null objects.

### Field Summary

Fields
`static int` `DEPRECATED_KEY` The key is deprecated.
`static int` `EMPTY_KEY` The key value is empty .
`static int` `MALFORMED_KEY` Either the key or the value specified is null or malformed.
`LogManager` `mLogger` The LogManager object which is used to log all the messages.
`protected java.util.Map` `mProfileMap` The Map object that contains the profiles for a particular namespace.
`static int` `NOT_PERMITTED_KEY` The key is not permitted in as it clashes with default Pegasus constructs.
`static int` `UNKNOWN_KEY` The key is unknown.
`static int` `VALID_KEY` The key is a valid key and can be put in the profiles.
`static java.lang.String` `VERSION` The version number associated with this API of Profile Namespaces.

### Constructor Summary

Constructors
Constructor and Description
`Namespace()`

### Method Summary

All Methods Static Methods Instance Methods Abstract Methods Concrete Methods
`void` `assimilate(PegasusProperties properties, Profiles.NAMESPACES namespace)` Assimilate the profiles in the namespace in a controlled manner.
`abstract int` `checkKey(java.lang.String key, java.lang.String value)` This checks the whether a key value pair specified is valid in the current namespace or not, and whether it clashes with other key value pairs that might have been set by Pegasus internally.
`void` `checkKeyInNS(java.util.List vars)` It takes in a list of profiles and puts them into the namespace after checking if they are valid or not.
`void` `checkKeyInNS(Namespace nm)` It puts in the namespaces keys from another namespace instance.
`abstract void` `checkKeyInNS(PegasusProperties properties, java.lang.String pool)` It puts in the namespace specific information specified in the properties file into the namespace.
`void` `checkKeyInNS(Profile profile)` It takes in a Profiles object and puts them into the namespace after checking if the namespace in the Profile object is same as the namepsace implementation.
`void` `checkKeyInNS(java.lang.String key, java.lang.String value)` This checks the whether a key value pair specified is valid in the current namespace or not by calling the checkKey function and then on the basis of the values returned puts them into the associated map in the class.
`void` `checkKeyInNS(TransformationCatalogEntry entry)` It puts in the namespace specific information from the Transformation Catalog into the namespace.
`java.lang.Object` `clone()` Returns the clone of the object.
`void` `construct(java.lang.String key, java.lang.String value)` Constructs a new element of the format (key=value).
`boolean` `containsKey(java.lang.Object key)` Returns true if the namespace contains a mapping for the specified key.
`void` `deprecatedKey(java.lang.String key, java.lang.String value)` Warns about a deprecated profile key.
`java.util.Map` `deprecatedTable()` Singleton access to the deprecated table that holds the deprecated keys, and the keys that replace them.
`void` `emptyKey(java.lang.String key)` Deletes the key from the namespace.
`java.lang.Object` `get(java.lang.Object key)` Returns the value to which this namespace maps the specified key.
`java.util.Iterator` `getProfileKeyIterator()` Provides an iterator to traverse the profiles by their keys.
`boolean` `isEmpty()` Returns a boolean indicating if the object is empty.
`static boolean` `isNamespaceValid(java.lang.String namespace)` Checks if the namespace specified is valid or not.
`java.util.Set` `keySet()` Returns the key set associated with the namespace.
`void` `malformedKey(java.lang.String key, java.lang.String value)` Warns about a namespace profile key-value pair that is malformed.
`abstract void` `merge(Namespace profiles)` Merge the profiles in the namespace in a controlled manner.
`abstract java.lang.String` `namespaceName()` Returns the name of the namespace associated with the profile implementations.
`void` `notPermitted(java.lang.String key)` Warns about a namespace profile key that cannot be permitted.
`java.lang.Object` `removeKey(java.lang.Object key)` Removes the key from the namespace.
`abstract java.lang.String` `toCondor()` Returns a condor description that can be used to put the contents of the namespace into the condor submit file during code generation.
`java.lang.String` `toString()` Returns the contents as String.
`void` `unknownKey(java.lang.String key, java.lang.String value)` Warns about an unknown profile key and constructs it anyway.

### Methods inherited from class java.lang.Object

`equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Field Detail

#### mLogger

    public LogManager mLogger

The LogManager object which is used to log all the messages.

#### VERSION

    public static final java.lang.String VERSION

The version number associated with this API of Profile Namespaces.

See Also:
  Constant Field Values

#### MALFORMED_KEY

    public static final int MALFORMED_KEY

Either the key or the value specified is null or malformed.

See Also:
  Constant Field Values

#### VALID_KEY

    public static final int VALID_KEY

The key is a valid key and can be put in the profiles.

See Also:
  Constant Field Values

#### UNKNOWN_KEY

    public static final int UNKNOWN_KEY

The key is unknown. Upto the profile namespace implementation whether to use it or not.

See Also:
  Constant Field Values

#### NOT_PERMITTED_KEY

    public static final int NOT_PERMITTED_KEY

The key is not permitted in as it clashes with default Pegasus constructs.

See Also:
  Constant Field Values

#### DEPRECATED_KEY

    public static final int DEPRECATED_KEY

The key is deprecated. Support is for a limited time.

See Also:
  Constant Field Values

#### EMPTY_KEY

    public static final int EMPTY_KEY

The key value is empty .

See Also:
  Constant Field Values

#### mProfileMap

    protected java.util.Map mProfileMap

The Map object that contains the profiles for a particular namespace. The Map is indexed by profile key. Each value, is a profile value.

### Constructor Detail

#### Namespace

    public Namespace()

### Method Detail

#### isNamespaceValid

    public static boolean isNamespaceValid(java.lang.String namespace)

Checks if the namespace specified is valid or not.

Parameters:
  `namespace` - The namespace you want to check

#### checkKey

    public abstract int checkKey(java.lang.String key,
                                 java.lang.String value)

This checks the whether a key value pair specified is valid in the current namespace or not, and whether it clashes with other key value pairs that might have been set by Pegasus internally.

Returns:
  MALFORMED_KEY VALID_KEY UNKNOWN_KEY NOT_PERMITTED_KEY

#### merge

    public abstract void merge(Namespace profiles)

Merge the profiles in the namespace in a controlled manner. The profiles should be merged only if the namespace object containing them matches to the current namespace.

Parameters:
  `profiles` - the `Namespace` object containing the profiles.

#### namespaceName

    public abstract java.lang.String namespaceName()

Returns the name of the namespace associated with the profile implementations.

Returns:
  the namespace name.

#### toString

    public java.lang.String toString()

Returns the contents as String. Currently, it returns condor compatible string that can be put in the condor submit file

Overrides:
  `toString` in class `java.lang.Object`
Returns:
  textual description

#### toCondor

    public abstract java.lang.String toCondor()

Returns a condor description that can be used to put the contents of the namespace into the condor submit file during code generation.

Returns:
  String

#### getProfileKeyIterator

    public java.util.Iterator getProfileKeyIterator()

Provides an iterator to traverse the profiles by their keys.

Returns:
  an iterator over the keys to walk the profile list.

#### deprecatedTable

    public java.util.Map deprecatedTable()

Singleton access to the deprecated table that holds the deprecated keys, and the keys that replace them. It should be overriden in the namespaces, that have deprecated keys.

Returns:
  Map

#### checkKeyInNS

    public void checkKeyInNS(Namespace nm)

It puts in the namespaces keys from another namespace instance.

Parameters:
  `nm` - the namespace to be assimilated

#### checkKeyInNS

    public void checkKeyInNS(TransformationCatalogEntry entry)

It puts in the namespace specific information from the Transformation Catalog into the namespace.

Parameters:
  `entry` - the `TCEntry` object containing the result from the Transformation Catalog.

#### checkKeyInNS

    public void checkKeyInNS(Profile profile)
                      throws java.lang.IllegalArgumentException

It takes in a Profiles object and puts them into the namespace after checking if the namespace in the Profile object is same as the namepsace implementation.

Parameters:
  `profile` - the `Profile` object containing the key and value.
Throws:
  `java.lang.IllegalArgumentException` - if the namespace in the profile is not the same as the profile namepsace in which the profile is being incorporated.
See Also:
  `org.griphyn.cPlanner.classes.Profile`

#### checkKeyInNS

    public void checkKeyInNS(java.util.List vars)

It takes in a list of profiles and puts them into the namespace after checking if they are valid or not. Note, there are no checks on the namespace however. The user should ensure that each Profile object in the list is of the same namespace type.

Parameters:
  `vars` - List of `Profile` objects, each referring to a key value for the profile.
See Also:
  `org.griphyn.cPlanner.classes.Profile`

#### checkKeyInNS

    public abstract void checkKeyInNS(PegasusProperties properties,
                                      java.lang.String pool)

It puts in the namespace specific information specified in the properties file into the namespace. The name of the pool is also passed, as many of the properties specified in the properties file are on a per pool basis.

Parameters:
  `properties` - the `PegasusProperties` object containing all the properties that the user specified at various places (like .chimerarc, properties file, command line).
  `pool` - the pool name where the job is scheduled to run.

#### checkKeyInNS

    public void checkKeyInNS(java.lang.String key,
                             java.lang.String value)

This checks the whether a key value pair specified is valid in the current namespace or not by calling the checkKey function and then on the basis of the values returned puts them into the associated map in the class.

Parameters:
  `key` - key that needs to be checked in the namespace for validity.
  `value` - value of the key

#### assimilate

    public void assimilate(PegasusProperties properties,
                           Profiles.NAMESPACES namespace)

Assimilate the profiles in the namespace in a controlled manner. In case of intersection, the new profile value overrides, the existing profile value.

Parameters:
  `profiles` - the `Namespace` object containing the profiles.
  `namespace` - the namespace for which the profiles need to be assimilated.

#### containsKey

    public boolean containsKey(java.lang.Object key)

Returns true if the namespace contains a mapping for the specified key. More formally, returns true if and only if this map contains at a mapping for a key k such that (key==null ? k==null : key.equals(k)). (There can be at most one such mapping.)

Parameters:
  `key` - The key that you want to search for in the namespace.

#### construct

    public void construct(java.lang.String key,
                          java.lang.String value)

Constructs a new element of the format (key=value).

Parameters:
  `key` - is the left-hand-side
  `value` - is the right hand side

#### removeKey

    public java.lang.Object removeKey(java.lang.Object key)

Removes the key from the namespace.

Parameters:
  `key` - The key you want to remove.
Returns:
  the value object if it exists. null if the key does not exist in the namespace.

#### keySet

    public java.util.Set keySet()

Returns the key set associated with the namespace.

Returns:
  key set if the mProfileMap is populated. null if the associated mProfileMap is not populated.

#### isEmpty

    public boolean isEmpty()

Returns a boolean indicating if the object is empty. The object is empty if the underlying map's key set is empty.

Returns:

#### get

    public java.lang.Object get(java.lang.Object key)

Returns the value to which this namespace maps the specified key. Returns null if the map contains no mapping for this key. A return value of null does not necessarily indicate that the map contains no mapping for the key; it's also possible that the map explicitly maps the key to null. The containsKey operation may be used to distinguish these two cases.

Parameters:
  `key` - The key whose value you want.

#### unknownKey

    public void unknownKey(java.lang.String key,
                           java.lang.String value)

Warns about an unknown profile key and constructs it anyway. Constructs a new RSL element of the format (key=value).

Parameters:
  `key` - is the left-hand-side
  `value` - is the right hand side

#### deprecatedKey

    public void deprecatedKey(java.lang.String key,
                              java.lang.String value)

Warns about a deprecated profile key. It constructs the corresponding replacement key.

Parameters:
  `key` - is the left-hand-side
  `value` - is the right hand side
See Also:
  `deprecatedTable()`

#### notPermitted

    public void notPermitted(java.lang.String key)

Warns about a namespace profile key that cannot be permitted.

Parameters:
  `key` - is the key that induced the warning.

#### emptyKey

    public void emptyKey(java.lang.String key)

Deletes the key from the namespace.

Parameters:
  `key` - the key with empty value

#### malformedKey

    public void malformedKey(java.lang.String key,
                             java.lang.String value)

Warns about a namespace profile key-value pair that is malformed.

Parameters:
  `key` - is the key that induced the warning.
  `value` - is the corresponding value of the key.

#### clone

    public java.lang.Object clone()

Returns the clone of the object.

Overrides:
  `clone` in class `java.lang.Object`
Returns:
  the clone