Class ImplementationFactory


  • public class ImplementationFactory
    extends java.lang.Object
    The factory class that loads an appropriate Transfer Immplementation class, as specified by the properties.
    Version:
    $Revision$
    Author:
    Karan Vahi
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String DEFAULT_PACKAGE_NAME
      The default package where the implementations reside, which this factory loads.
      static java.lang.String DEFAULT_SETUP_TRANSFER_IMPLEMENTATION  
      static java.lang.String DEFAULT_TRANSFER_IMPLEMENTATION  
      static int TYPE_SETUP
      The constant designating the implementation to be loaded for setup tx jobs.
      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.
      static int TYPE_SYMLINK_STAGE_IN
      The constant designating the implementation to be loaded for symbolic tx jobs.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      private static java.lang.String getPropertyKey​(int type)
      Returns the name of the property that needs to be loaded for a particular type.
      static Implementation loadInstance​(PegasusBag bag, int type)
      Loads the implementing class corresponding to the type specified by the user.
      private static Implementation loadInstance​(java.lang.String className, PegasusBag bag)
      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 java.lang.String DEFAULT_PACKAGE_NAME
        The default package where the implementations reside, which this factory loads.
        See Also:
        Constant Field Values
      • DEFAULT_TRANSFER_IMPLEMENTATION

        public static final java.lang.String DEFAULT_TRANSFER_IMPLEMENTATION
        See Also:
        Constant Field Values
      • DEFAULT_SETUP_TRANSFER_IMPLEMENTATION

        public static final java.lang.String DEFAULT_SETUP_TRANSFER_IMPLEMENTATION
        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
      • TYPE_SETUP

        public static final int TYPE_SETUP
        The constant designating the implementation to be loaded for setup tx jobs.
        See Also:
        Constant Field Values
      • TYPE_SYMLINK_STAGE_IN

        public static final int TYPE_SYMLINK_STAGE_IN
        The constant designating the implementation to be loaded for symbolic tx jobs.
        See Also:
        Constant Field Values
    • Constructor Detail

      • ImplementationFactory

        public ImplementationFactory()
    • Method Detail

      • loadInstance

        public static Implementation loadInstance​(PegasusBag bag,
                                                  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:
        bag - the bag of initialization objects.
        type - the type.
        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​(java.lang.String className,
                                                   PegasusBag bag)
                                            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. Can be null to get the factory to load the default implementation
        bag - the bag of initialization objects.
        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
      • getPropertyKey

        private static java.lang.String getPropertyKey​(int type)
                                                throws java.lang.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:
        java.lang.IllegalArgumentException