edu.isi.pegasus.planner.cluster.aggregator

## Class JobAggregatorInstanceFactory

- java.lang.Object
- - edu.isi.pegasus.planner.cluster.aggregator.JobAggregatorInstanceFactory

    public class JobAggregatorInstanceFactory
    extends java.lang.Object

A JobAggergator factory that caches up the loaded implementations. It loads a new implementation only if it has not loaded it earlier. However, it is different from a Singleton Factory, as the implementations are not stored in static instances. Hence, two different instances of this Factory can load different instances of the same implementation.

Version:
  $Revision$
Author:
  Karan Vahi
See Also:
  `JobAggregatorFactory`

### Field Summary

Fields
`private PegasusBag` `mBag` The bag of initialization objects
`private ADag` `mDAG` ADag object containing the jobs that have been scheduled by the site selector.
`private static java.util.Map` `mImplementingClassNameTable` A table that maps, Pegasus style keys to the names of the corresponding classes implementing the CondorStyle interface.
`private java.util.Map` `mImplementingClassTable` A table that maps, Pegasus style keys to appropriate classes implementing the JobAggregator interface
`private boolean` `mInitialized` A boolean indicating that the factory has been initialized.
`protected PegasusProperties` `mProps` The handle to the properties object holding all the properties.

### Constructor Summary

Constructors
Constructor and Description
`JobAggregatorInstanceFactory()` The default constructor.

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`private java.lang.Object` `get(java.lang.String style)` Returns the implementation from the implementing class table.
`private static java.util.Map` `implementingClassNameTable()` Returns a table that maps, the Pegasus style keys to the names of implementing classes.
`void` `initialize(ADag dag, PegasusBag bag)` Initializes the Factory.
`JobAggregator` `loadInstance(Job job)` Returns the appropriate handle to the JobAggregator that is to be used for a particular type of job.
`private void` `put(java.lang.String style, java.lang.Object implementation)` Inserts an entry into the implementing class table.

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

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

### Field Detail

#### mImplementingClassNameTable

    private static java.util.Map mImplementingClassNameTable

A table that maps, Pegasus style keys to the names of the corresponding classes implementing the CondorStyle interface.

#### mImplementingClassTable

    private java.util.Map mImplementingClassTable

A table that maps, Pegasus style keys to appropriate classes implementing the JobAggregator interface

#### mProps

    protected PegasusProperties mProps

The handle to the properties object holding all the properties.

#### mDAG

    private ADag mDAG

ADag object containing the jobs that have been scheduled by the site selector.

#### mInitialized

    private boolean mInitialized

A boolean indicating that the factory has been initialized.

#### mBag

    private PegasusBag mBag

The bag of initialization objects

### Constructor Detail

#### JobAggregatorInstanceFactory

    public JobAggregatorInstanceFactory()

The default constructor.

### Method Detail

#### initialize

    public void initialize(ADag dag,
                           PegasusBag bag)
                    throws JobAggregatorFactoryException

Initializes the Factory. Loads all the implementations just once.

Parameters:
  `dag` - the workflow that is being clustered.
  `bag` - the bag of initialization objects.
Throws:
  `JobAggregatorFactoryException` - that nests any error that might occur during the instantiation of the implementation.

#### loadInstance

    public JobAggregator loadInstance(Job job)
                               throws JobAggregatorFactoryException

Returns the appropriate handle to the JobAggregator that is to be used for a particular type of job. Aggregators for mpiexec and seqexec are already loaded in the constructor, and just the reference is returned. For any other aggregator it is dynamically loaded.

Parameters:
  `job` - the job corresponding to which the aggregator is to be loaded.
Returns:
  the appropriate JobAggregator
Throws:
  `JobAggregatorFactoryException` - that nests any error that might occur during the instantiation

#### get

    private java.lang.Object get(java.lang.String style)

Returns the implementation from the implementing class table.

Parameters:
  `style` - the aggregator style
Returns:
  implementation the class implementing that style, else null

#### put

    private void put(java.lang.String style,
                     java.lang.Object implementation)

Inserts an entry into the implementing class table.

Parameters:
  `style` - the aggregator style
  `implementation` - the class implementing that aggregator.

#### implementingClassNameTable

    private static java.util.Map implementingClassNameTable()

Returns a table that maps, the Pegasus style keys to the names of implementing classes.

Returns:
  a Map indexed by Pegasus styles, and values as names of implementing classes.