edu.isi.pegasus.planner.selector.replica
Class ReplicaSelectorFactory

java.lang.Object
  extended by edu.isi.pegasus.planner.selector.replica.ReplicaSelectorFactory

public class ReplicaSelectorFactory
extends Object

A factory class to load the appropriate type of Replica Selector, as specified by the user at runtime in properties. Each invocation of the factory results in a ReplicaSelector being instantiated.

Version:
$Revision: 2567 $
Author:
Karan Vahi

Field Summary
static String DEFAULT_PACKAGE_NAME
          The default package where the all the implementing classes provided with the VDS reside.
static String DEFAULT_REPLICA_SELECTOR
          The name of the class in the DEFAULT package, that corresponds to the default replica selector.
 
Constructor Summary
ReplicaSelectorFactory()
           
 
Method Summary
static ReplicaSelector loadInstance()
          A no hassle factory method that loads the replica selector specified in the properties.
static ReplicaSelector loadInstance(PegasusProperties properties)
          Loads the implementing class corresponding to the mode specified by the user at runtime in the properties file.
static ReplicaSelector loadInstance(PegasusProperties properties, String className)
          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 all the implementing classes provided with the VDS reside.

See Also:
Constant Field Values

DEFAULT_REPLICA_SELECTOR

public static final String DEFAULT_REPLICA_SELECTOR
The name of the class in the DEFAULT package, that corresponds to the default replica selector.

See Also:
Constant Field Values
Constructor Detail

ReplicaSelectorFactory

public ReplicaSelectorFactory()
Method Detail

loadInstance

public static ReplicaSelector loadInstance()
                                    throws ReplicaSelectorFactoryException
A no hassle factory method that loads the replica selector specified in the properties. The properties are obtained from the property singleton. A default replica selector is loaded if property is not specified in the properties.

Returns:
the instance of the class implementing this interface.
Throws:
ReplicaSelectorFactoryException - that chains any error that might occur during the instantiation
See Also:
DEFAULT_PACKAGE_NAME, DEFAULT_REPLICA_SELECTOR

loadInstance

public static ReplicaSelector loadInstance(PegasusProperties properties)
                                    throws ReplicaSelectorFactoryException
Loads the implementing class corresponding to the mode specified by the user at runtime in the properties file. A default replica selector is loaded if property is not specified in the properties.

Parameters:
properties - the PegasusProperties object containing all the properties required by Pegasus.
Returns:
the instance of the class implementing this interface.
Throws:
ReplicaSelectorFactoryException - that chains any error that might occur during the instantiation
See Also:
DEFAULT_PACKAGE_NAME, DEFAULT_REPLICA_SELECTOR

loadInstance

public static ReplicaSelector loadInstance(PegasusProperties properties,
                                           String className)
                                    throws ReplicaSelectorFactoryException
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 is the name of the class, not the complete name with package. That is added by itself.
properties - the PegasusProperties object containing all the properties required by Pegasus.
Returns:
the instance of the class implementing this interface.
Throws:
ReplicaSelectorFactoryException - that chains any error that might occur during the instantiation
See Also:
DEFAULT_PACKAGE_NAME


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