org.griphyn.cPlanner.code.generator.condor.style
Class CondorStyleFactory

java.lang.Object
  extended by org.griphyn.cPlanner.code.generator.condor.style.CondorStyleFactory

public class CondorStyleFactory
extends Object

A factory class to load the appropriate type of Condor Style impelementations. This factory class is different from other factories, in the sense that it must be instantiated first and intialized first before calling out to any of the Factory methods.

Version:
$Revision: 50 $
Author:
Karan Vahi

Field Summary
private static String CONDOR_STYLE_IMPLEMENTING_CLASS
          The name of the class implementing the Condor Style.
static String DEFAULT_PACKAGE_NAME
          The default package where the all the implementing classes are supposed to reside.
private static String GLIDEIN_STYLE_IMPLEMENTING_CLASS
          The name of the class implementing the Condor GlideIN Style.
private static String GLOBUS_STYLE_IMPLEMENTING_CLASS
          The name of the class implementing the CondorG Style.
private static Map mImplementingClassNameTable
          A table that maps, VDS style keys to the names of the corresponding classes implementing the CondorStyle interface.
private  Map mImplementingClassTable
          A table that maps, VDS style keys to appropriate classes implementing the CondorStyle interface
private  boolean mInitialized
          A boolean indicating that the factory has been initialized.
 
Constructor Summary
CondorStyleFactory()
          The default constructor.
 
Method Summary
private  Object get(String style)
          Returns the implementation from the implementing class table.
private static Map implementingClassNameTable()
          Returns a table that maps, the VDS style keys to the names of implementing classes.
 void initialize(PegasusProperties properties, PoolInfoProvider siteCatalog)
          Initializes the Factory.
private  CondorStyle loadInstance(PegasusProperties properties, PoolInfoProvider siteCatalog, String className)
          This method loads the appropriate Condor Style using reflection.
 CondorStyle loadInstance(SubInfo job)
          This method loads the appropriate implementing CondorStyle as specified by the user at runtime.
private  void put(String style, 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

DEFAULT_PACKAGE_NAME

public static final String DEFAULT_PACKAGE_NAME
The default package where the all the implementing classes are supposed to reside.

See Also:
Constant Field Values

CONDOR_STYLE_IMPLEMENTING_CLASS

private static final String CONDOR_STYLE_IMPLEMENTING_CLASS
The name of the class implementing the Condor Style.

See Also:
Constant Field Values

GLIDEIN_STYLE_IMPLEMENTING_CLASS

private static final String GLIDEIN_STYLE_IMPLEMENTING_CLASS
The name of the class implementing the Condor GlideIN Style.

See Also:
Constant Field Values

GLOBUS_STYLE_IMPLEMENTING_CLASS

private static final String GLOBUS_STYLE_IMPLEMENTING_CLASS
The name of the class implementing the CondorG Style.

See Also:
Constant Field Values

mImplementingClassNameTable

private static Map mImplementingClassNameTable
A table that maps, VDS style keys to the names of the corresponding classes implementing the CondorStyle interface.


mImplementingClassTable

private Map mImplementingClassTable
A table that maps, VDS style keys to appropriate classes implementing the CondorStyle interface


mInitialized

private boolean mInitialized
A boolean indicating that the factory has been initialized.

Constructor Detail

CondorStyleFactory

public CondorStyleFactory()
The default constructor.

Method Detail

initialize

public void initialize(PegasusProperties properties,
                       PoolInfoProvider siteCatalog)
                throws CondorStyleFactoryException
Initializes the Factory. Loads all the implementations just once.

Parameters:
properties - the PegasusProperties object containing all the properties required by Pegasus.
siteCatalog - a handle to the Site Catalog being used.
Throws:
CondorStyleFactoryException - that nests any error that might occur during the instantiation of the implementation.

loadInstance

public CondorStyle loadInstance(SubInfo job)
                         throws CondorStyleFactoryException
This method loads the appropriate implementing CondorStyle as specified by the user at runtime. The CondorStyle is initialized and returned.

Parameters:
job - the job for which the corresponding style is required.
Throws:
CondorStyleFactoryException - that nests any error that might occur during the instantiation of the implementation.

loadInstance

private CondorStyle loadInstance(PegasusProperties properties,
                                 PoolInfoProvider siteCatalog,
                                 String className)
                          throws CondorStyleFactoryException
This method loads the appropriate Condor Style using reflection.

Parameters:
properties - the PegasusProperties object containing all the properties required by Pegasus.
siteCatalog - a handle to the Site Catalog being used.
className - the name of the implementing class.
Returns:
the instance of the class implementing this interface.
Throws:
CondorStyleFactoryException - that nests any error that might occur during the instantiation of the implementation.
See Also:
DEFAULT_PACKAGE_NAME

get

private Object get(String style)
Returns the implementation from the implementing class table.

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

put

private void put(String style,
                 Object implementation)
Inserts an entry into the implementing class table.

Parameters:
style - the VDS style
implementation - the class implementing that style.

implementingClassNameTable

private static Map implementingClassNameTable()
Returns a table that maps, the VDS style keys to the names of implementing classes.

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


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