Class Default

  • All Implemented Interfaces:
    ReplicaSelector
    Direct Known Subclasses:
    Regex, Restricted

    public class Default
    extends java.lang.Object
    implements ReplicaSelector
    The default replica selector that is used if non is specifed by the user. This gives preference to a replica residing on the same site as the site, where it is required to be staged to. If there is no such replica, then a random replica is selected.

    In order to use the replica selector implemented by this class,

            - the property pegasus.selector.replica must be set to value Default, or
              the property should be left undefined in the properties.
     
    Version:
    $Revision$
    Author:
    Karan Vahi
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static java.lang.String mDescription
      A short description of the replica selector.
      protected LogManager mLogger
      The handle to the logging object that is used to log the various debug messages.
      protected PegasusProperties mProps
      The properties object containing the properties passed to the planner.
    • Constructor Summary

      Constructors 
      Constructor Description
      Default​(PegasusProperties properties)
      The overloaded constructor, that is called by load method.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String description()
      Returns a short description of the replica selector.
      boolean removeFileURL​(ReplicaCatalogEntry rce, java.lang.String preferredSite, boolean allowLocalFileURLs)
      A convenience function that determines whether we should be removing a file URL from replica selection or not.
      protected boolean removeFileURL​(java.lang.String pfn, java.lang.String site, java.lang.String preferredSite, boolean allowLocalFileURLs)
      A convenience function that determines whether we should be removing a file URL from replica selection or not.
      ReplicaCatalogEntry selectReplica​(ReplicaLocation rl, java.lang.String preferredSite, boolean allowLocalFileURLs)
      This chooses a location amongst all the locations returned by the replica location service.
      ReplicaLocation selectReplicas​(ReplicaLocation rl, java.lang.String preferredSite, boolean allowLocalFileURLs)
      This chooses a location amongst all the locations returned by the Replica Mechanism.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • mDescription

        private static java.lang.String mDescription
        A short description of the replica selector.
      • mLogger

        protected LogManager mLogger
        The handle to the logging object that is used to log the various debug messages.
      • mProps

        protected PegasusProperties mProps
        The properties object containing the properties passed to the planner.
    • Constructor Detail

      • Default

        public Default​(PegasusProperties properties)
        The overloaded constructor, that is called by load method.
        Parameters:
        properties - the PegasusProperties object containing all the properties required by Pegasus.
    • Method Detail

      • selectReplica

        public ReplicaCatalogEntry selectReplica​(ReplicaLocation rl,
                                                 java.lang.String preferredSite,
                                                 boolean allowLocalFileURLs)
        This chooses a location amongst all the locations returned by the replica location service. If a location is found with re attribute same as the preference pool, it is taken. Else a random location is selected and returned. If more than one location for the lfn is found at the preference pool, then also a random location amongst the ones at the preference pool is selected.
        Specified by:
        selectReplica in interface ReplicaSelector
        Parameters:
        rl - the ReplicaLocation object containing all the pfn's associated with that LFN.
        preferredSite - the preffered site for picking up the replicas.
        allowLocalFileURLs - indicates whether Replica Selector can select a replica on the local site / submit host.
        Returns:
        ReplicaCatalogEntry corresponding to the location selected.
        See Also:
        org.griphyn.cPlanner.classes.ReplicaLocation
      • selectReplicas

        public ReplicaLocation selectReplicas​(ReplicaLocation rl,
                                              java.lang.String preferredSite,
                                              boolean allowLocalFileURLs)
        This chooses a location amongst all the locations returned by the Replica Mechanism. If a location is found with re/pool attribute same as the preference pool, it is taken. This returns all the locations which match to the preference pool. This function is called to determine if a file does exist on the output pool or not beforehand. We need all the location to ensure that we are able to make a match if it so exists. Else a random location is selected and returned
        Specified by:
        selectReplicas in interface ReplicaSelector
        Parameters:
        rl - the ReplicaLocation object containing all the pfn's associated with that LFN.
        preferredSite - the preffered site for picking up the replicas.
        allowLocalFileURLs - indicates whether Replica Selector can select a replica on the local site / submit host.
        Returns:
        ReplicaLocation corresponding to the replicas selected.
        See Also:
        org.griphyn.cPlanner.classes.ReplicaLocation
      • removeFileURL

        public boolean removeFileURL​(ReplicaCatalogEntry rce,
                                     java.lang.String preferredSite,
                                     boolean allowLocalFileURLs)
        A convenience function that determines whether we should be removing a file URL from replica selection or not. The file urls make sense only
              - if associated with the preference site or
              - if local File URL are allowed and rce is associated
                with local site
         
        Parameters:
        rce - the ReplicaCatalogEntry object.
        preferredSite - the preferred site.
        allowLocalFileURLs - indicates whether Replica Selector can select a replica on the local site / submit host.
        Returns:
        boolean
      • removeFileURL

        protected boolean removeFileURL​(java.lang.String pfn,
                                        java.lang.String site,
                                        java.lang.String preferredSite,
                                        boolean allowLocalFileURLs)
        A convenience function that determines whether we should be removing a file URL from replica selection or not. The file urls make sense only
              - if associated with the preference site or
              - if local File URL are allowed and rce is associated
                with local site
         
        Parameters:
        pfn - the file url
        site - the site associated with the pfn.
        preferredSite - the preferred site.
        allowLocalFileURLs - indicates whether Replica Selector can select a replica on the local site / submit host.
        Returns:
        boolean
      • description

        public java.lang.String description()
        Returns a short description of the replica selector.
        Specified by:
        description in interface ReplicaSelector
        Returns:
        string corresponding to the description.