edu.isi.pegasus.planner.selector

## Interface ReplicaSelector

All Known Implementing Classes:
  Default, Local, Regex, Restricted

    public interface ReplicaSelector

A prototypical interface for a replica selector. It would be changed when Pegasus interfaces with the new RC API.

Version:
  $Revision$
Author:
  Karan Vahi, Gaurang Mehta

### Field Summary

Fields
`static java.lang.String` `LOCAL_SITE_HANDLE` The local site handle.
`static java.lang.String` `VERSION` The version of this API.

### Method Summary

All Methods Instance Methods Abstract Methods
`java.lang.String` `description()` Returns a short description of the replica selector, that is being implemented by the implementing class.
`ReplicaCatalogEntry` `selectReplica(ReplicaLocation rl, java.lang.String prefferedSite, boolean allowLocalFileURLs)` Selects a single replica amongst all the replicas returned by the implementing Replica Mechanism.
`ReplicaLocation` `selectReplicas(ReplicaLocation rl, java.lang.String prefferedSite, boolean allowLocalFileURLs)` Selects a replica amongst all the replicas returned by the implementing Replica Mechanism.

### Field Detail

#### VERSION

    static final java.lang.String VERSION

The version of this API.

See Also:
  Constant Field Values

#### LOCAL_SITE_HANDLE

    static final java.lang.String LOCAL_SITE_HANDLE

The local site handle.

See Also:
  Constant Field Values

### Method Detail

#### selectReplicas

    ReplicaLocation selectReplicas(ReplicaLocation rl,
                                   java.lang.String prefferedSite,
                                   boolean allowLocalFileURLs)

Selects a replica amongst all the replicas returned by the implementing Replica Mechanism. It should select all the locations for which the site attribute matches to the preffered site passed. If no match on the preffered site is found, it is upto the implementation to select a replica and return it. This function is called to determine if a file does exist on the output pool or not beforehand. We need all the locations to ensure that we are able to make a match if it so exists.

Parameters:
  `rl` - the `ReplicaLocation` object containing all the pfn's associated with that LFN.
  `prefferedSite` - 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`

#### selectReplica

    ReplicaCatalogEntry selectReplica(ReplicaLocation rl,
                                      java.lang.String prefferedSite,
                                      boolean allowLocalFileURLs)

Selects a single replica amongst all the replicas returned by the implementing Replica Mechanism. If more than one replica is found to be matching the preffered site, a random replica is picked up from the matching replicas. Else, in case of no match any replica maybe returned.

Parameters:
  `rl` - the `ReplicaLocation` object containing all the pfn's associated with that LFN.
  `prefferedSite` - 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`

#### description

    java.lang.String description()

Returns a short description of the replica selector, that is being implemented by the implementing class.

Returns:
  string corresponding to the description.