org.griphyn.cPlanner.transfer.implementation
Class ImplementationFactory

java.lang.Object
  extended by org.griphyn.cPlanner.transfer.implementation.ImplementationFactory

public class ImplementationFactory
extends Object

The factory class that loads an appropriate Transfer Immplementation class, as specified by the properties.

Version:
$Revision: 50 $
Author:
Karan Vahi

Field Summary
static String DEFAULT_PACKAGE_NAME
          The default package where the implementations reside, which this factory loads.
static int TYPE_STAGE_IN
          The constant designating the implementation be loaded for stage in jobs.
static int TYPE_STAGE_INTER
          The constant designating the implementation be loaded for inter pool jobs.
static int TYPE_STAGE_OUT
          The constant designating the implementation be loaded for stage out jobs.
 
Constructor Summary
ImplementationFactory()
           
 
Method Summary
private static String getProperty(int type)
          Returns the name of the property that needs to be loaded for a particular type.
static Implementation loadInstance(PegasusProperties properties, PlannerOptions options)
          Loads the implementing class corresponding to the mode specified by the user at runtime in the properties file.
static Implementation loadInstance(PegasusProperties properties, PlannerOptions options, int type)
          Loads the implementing class corresponding to the type specified by the user.
private static Implementation loadInstance(String className, PegasusProperties properties, PlannerOptions options)
          Loads the implementing class corresponding to the class.
 
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 implementations reside, which this factory loads.

See Also:
Constant Field Values

TYPE_STAGE_IN

public static final int TYPE_STAGE_IN
The constant designating the implementation be loaded for stage in jobs.

See Also:
Constant Field Values

TYPE_STAGE_INTER

public static final int TYPE_STAGE_INTER
The constant designating the implementation be loaded for inter pool jobs.

See Also:
Constant Field Values

TYPE_STAGE_OUT

public static final int TYPE_STAGE_OUT
The constant designating the implementation be loaded for stage out jobs.

See Also:
Constant Field Values
Constructor Detail

ImplementationFactory

public ImplementationFactory()
Method Detail

loadInstance

public static Implementation loadInstance(PegasusProperties properties,
                                          PlannerOptions options,
                                          int type)
                                   throws TransferImplementationFactoryException
Loads the implementing class corresponding to the type specified by the user. The type is used to determine what property to be picked up from the properties file. The properties object passed should not be null.

Parameters:
properties - the PegasusProperties object containing all the properties required by Pegasus.
options - the options passed to the planner at runtime.
type - the type for which implementation needs to be loaded.
Returns:
the instance of the class implementing this interface.
Throws:
TransferImplementationFactoryException - that nests any error that might occur during the instantiation.
See Also:
DEFAULT_PACKAGE_NAME

loadInstance

public static Implementation loadInstance(PegasusProperties properties,
                                          PlannerOptions options)
                                   throws TransferImplementationFactoryException
Loads the implementing class corresponding to the mode specified by the user at runtime in the properties file. The properties object passed should not be null.

Parameters:
properties - the PegasusProperties object containing all the properties required by Pegasus.
options - the options passed to the planner at runtime.
Returns:
the instance of the class implementing this interface.
Throws:
TransferImplementationFactoryException - that nests any error that might occur during the instantiation.
See Also:
DEFAULT_PACKAGE_NAME

loadInstance

private static Implementation loadInstance(String className,
                                           PegasusProperties properties,
                                           PlannerOptions options)
                                    throws TransferImplementationFactoryException
Loads the implementing class corresponding to the class. If the package name is not specified with the class, then class is assumed to be in the DEFAULT_PACKAGE. The properties object passed should not be null.

Parameters:
className - the name of the class that implements the mode.It can or cannot be with the package name.
properties - the PegasusProperties object containing all the properties required by Pegasus.
options - the options passed to the planner at runtime.
Returns:
the instance of the class implementing this interface.
Throws:
TransferImplementationFactoryException - that nests any error that might occur during the instantiation.
See Also:
DEFAULT_PACKAGE_NAME

getProperty

private static String getProperty(int type)
                           throws IllegalArgumentException
Returns the name of the property that needs to be loaded for a particular type.

Parameters:
type - the type of implementation to be loaded.
Returns:
the name of the property
Throws:
IllegalArgumentException


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