public class ReplicaCatalogEntry extends Object implements CatalogEntry, Cloneable
The resource handle is the most frequently used attribute. In reality, the resource handle may be a relational attribute of the mapping relation between an LFN and a PFN - there is disagreement among the developers on this issue. For simplicity purposes, it appears to be sufficient to make the resource handle a regular PFN attribute.
Modifier and Type | Field and Description |
---|---|
private Map |
m_attributeMap
Any optional attributes associated with the PFN.
|
private String |
m_pfn
The physical filename.
|
static String |
RESOURCE_HANDLE
The (reserved) attribute name used for the resource handle.
|
Constructor and Description |
---|
ReplicaCatalogEntry()
Default constructor for arrays.
|
ReplicaCatalogEntry(String pfn)
Convenience constructor initializes the PFN.
|
ReplicaCatalogEntry(String pfn,
Map attributes)
Standard constructor initializes the PFN and arbitrary attributes.
|
ReplicaCatalogEntry(String pfn,
String handle)
Convenience constructor initializes the PFN and the resource
handle.
|
Modifier and Type | Method and Description |
---|---|
void |
addAttribute(Map attributes)
Adds attributes to the existing attributes.
|
void |
addAttribute(String key,
Object value)
Adds an attribute to the set of attributes.
|
Object |
clone() |
boolean |
equals(Object obj)
Matches two ReplicaCatalogEntry objects.
|
Object |
getAttribute(String key)
Obtains the attribute value for a given key.
|
int |
getAttributeCount()
Counts the number of attributes known for the PFN.
|
Iterator |
getAttributeIterator()
Provides an iterator to traverse the attributes by their keys.
|
String |
getPFN()
Accessor: Obtains the PFN portion from this entry.
|
String |
getResourceHandle()
Obtains the resource handle from the attributes map.
|
boolean |
hasAttribute(String key)
Checks for the existence of an attribute key.
|
boolean |
merge(ReplicaCatalogEntry rce,
boolean overwrite)
Merges the attribute maps in a controlled fashion.
|
static ReplicaCatalogEntry |
merge(ReplicaCatalogEntry a,
ReplicaCatalogEntry b,
boolean overwrite)
Merges the attribute maps of two entries in a controlled fashion.
|
void |
removeAllAttribute()
Removes all attributes associated with a PFN.
|
Object |
removeAttribute(String name)
Removes a specific attribute.
|
void |
setAttribute(Map attributes)
Replaces all existing attributes with new attributes.
|
void |
setAttribute(String key,
Object value)
Adds a new or overwrites an existing attribute.
|
void |
setPFN(String pfn)
Accessor: Sets a new PFN to remember.
|
void |
setResourceHandle(String handle)
Sets a new resource handle to remember as PFN attribute.
|
String |
toString()
Converts the contents into a string.
|
public static final String RESOURCE_HANDLE
private String m_pfn
private Map m_attributeMap
public ReplicaCatalogEntry()
null, and thus must be explicitly set later. The map
of attributes associated with the PFN is initialized to be empty.
Thus, no resource handle is available.
public ReplicaCatalogEntry(String pfn)
pfn
- is the PFN to remember.public ReplicaCatalogEntry(String pfn, String handle)
pfn
- is the PFN to remember.handle
- is the resource handle to remember.public void addAttribute(String key, Object value)
setAttribute( String, Object )
method of the same
signature.key
- is the key denoting an attribute.value
- is a value object to store.public void addAttribute(Map attributes)
attributes
- is a map of attributes to add.setAttribute(Map)
,
Map.putAll( Map )
public Object getAttribute(String key)
key
- is the key to look upMap.get( Object )
public boolean hasAttribute(String key)
key
- is the key to look uppublic int getAttributeCount()
Map.size()
public Iterator getAttributeIterator()
public static ReplicaCatalogEntry merge(ReplicaCatalogEntry a, ReplicaCatalogEntry b, boolean overwrite)
a
- is one replica catalog entry to merge.b
- is the other replica catalog entry to merge.overwrite
- resolves intersections. If true, uses rce's
attribute to remain, if false, the original attribute remains.null
if the PFN mismatched.public boolean merge(ReplicaCatalogEntry rce, boolean overwrite)
rce
- is another replica catalog entry to merge with.overwrite
- resolves intersections. If true, uses rce's
attribute to remain, if false, the original attribute remains.public void removeAllAttribute()
removeAttribute( String )
public Object removeAttribute(String name)
name
- is the name of the attribute to remove.null
,
if the key was not in the map.removeAllAttribute()
public void setAttribute(String key, Object value)
addAttribute( String, Object)
method of
the same signature.key
- is the name of the attributevalue
- is the value object associated with the attribute.public void setAttribute(Map attributes)
attributes
- is the map of new attributes to remember.addAttribute(Map)
public String getResourceHandle()
null
if unset.setResourceHandle( String )
public void setResourceHandle(String handle)
handle
- is the new resource handle.getResourceHandle()
public String getPFN()
null
if unset.setPFN( String )
public void setPFN(String pfn)
pfn
- is a new physical filename.getPFN()
public String toString()
public boolean equals(Object obj)
public Object clone() throws CloneNotSupportedException
clone
in class Object
CloneNotSupportedException