public class ReplicaCatalogEntry extends java.lang.Object implements CatalogEntry, java.lang.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 java.util.Map |
m_attributeMap
Any optional attributes associated with the PFN.
|
private java.lang.String |
m_pfn
The physical filename.
|
static java.lang.String |
RESOURCE_HANDLE
The (reserved) attribute name used for the resource handle.
|
Constructor and Description |
---|
ReplicaCatalogEntry()
Default constructor for arrays.
|
ReplicaCatalogEntry(java.lang.String pfn)
Convenience constructor initializes the PFN.
|
ReplicaCatalogEntry(java.lang.String pfn,
java.util.Map attributes)
Standard constructor initializes the PFN and arbitrary attributes.
|
ReplicaCatalogEntry(java.lang.String pfn,
java.lang.String handle)
Convenience constructor initializes the PFN and the resource
handle.
|
Modifier and Type | Method and Description |
---|---|
void |
addAttribute(java.util.Map attributes)
Adds attributes to the existing attributes.
|
void |
addAttribute(java.lang.String key,
java.lang.Object value)
Adds an attribute to the set of attributes.
|
java.lang.Object |
clone() |
boolean |
equals(java.lang.Object obj)
Matches two ReplicaCatalogEntry objects.
|
java.lang.Object |
getAttribute(java.lang.String key)
Obtains the attribute value for a given key.
|
int |
getAttributeCount()
Counts the number of attributes known for the PFN.
|
java.util.Iterator |
getAttributeIterator()
Provides an iterator to traverse the attributes by their keys.
|
java.lang.String |
getPFN()
Accessor: Obtains the PFN portion from this entry.
|
java.lang.String |
getResourceHandle()
Obtains the resource handle from the attributes map.
|
boolean |
hasAttribute(java.lang.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.
|
java.lang.Object |
removeAttribute(java.lang.String name)
Removes a specific attribute.
|
void |
setAttribute(java.util.Map attributes)
Replaces all existing attributes with new attributes.
|
void |
setAttribute(java.lang.String key,
java.lang.Object value)
Adds a new or overwrites an existing attribute.
|
void |
setPFN(java.lang.String pfn)
Accessor: Sets a new PFN to remember.
|
void |
setResourceHandle(java.lang.String handle)
Sets a new resource handle to remember as PFN attribute.
|
java.lang.String |
toString()
Converts the contents into a string.
|
public static final java.lang.String RESOURCE_HANDLE
private java.lang.String m_pfn
private java.util.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(java.lang.String pfn)
pfn
- is the PFN to remember.public ReplicaCatalogEntry(java.lang.String pfn, java.lang.String handle)
pfn
- is the PFN to remember.handle
- is the resource handle to remember.public ReplicaCatalogEntry(java.lang.String pfn, java.util.Map attributes)
pfn
- is the PFN to remember.attributes
- is a map of arbitrary attributes related to the
PFN.public void addAttribute(java.lang.String key, java.lang.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(java.util.Map attributes)
attributes
- is a map of attributes to add.setAttribute(Map)
,
Map.putAll( Map )
public java.lang.Object getAttribute(java.lang.String key)
key
- is the key to look upMap.get( Object )
public boolean hasAttribute(java.lang.String key)
key
- is the key to look uppublic int getAttributeCount()
Map.size()
public java.util.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 java.lang.Object removeAttribute(java.lang.String name)
name
- is the name of the attribute to remove.null
,
if the key was not in the map.removeAllAttribute()
public void setAttribute(java.lang.String key, java.lang.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(java.util.Map attributes)
attributes
- is the map of new attributes to remember.addAttribute(Map)
public java.lang.String getResourceHandle()
null
if unset.setResourceHandle( String )
public void setResourceHandle(java.lang.String handle)
handle
- is the new resource handle.getResourceHandle()
public java.lang.String getPFN()
null
if unset.setPFN( String )
public void setPFN(java.lang.String pfn)
pfn
- is a new physical filename.getPFN()
public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone
in class java.lang.Object
java.lang.CloneNotSupportedException