org.jboss.system.server.profileservice.repository.clustered.metadata
Class RepositoryItemMetadata

java.lang.Object
  extended by org.jboss.system.server.profileservice.repository.clustered.metadata.RepositoryItemMetadata
All Implemented Interfaces:
Serializable, Comparable<RepositoryItemMetadata>, Identifiable<List<String>>

public class RepositoryItemMetadata
extends Object
implements Identifiable<List<String>>, Serializable, Comparable<RepositoryItemMetadata>

Description of an individual item (i.e. file) in a clustered repository.

Author:
Brian Stansberry
See Also:
Serialized Form

Field Summary
static String NOW
          Marker value to pass to setTimestampAsString(String) that will generate a timestamp equal to System.currentTimeMillis().
 
Constructor Summary
RepositoryItemMetadata()
          Constructor for XML parser.
RepositoryItemMetadata(List<String> pathElements, long timestamp, String originatingNode, boolean directory, boolean removed)
           
RepositoryItemMetadata(RepositoryItemMetadata toCopy)
          Copy constructor.
 
Method Summary
 int compareTo(RepositoryItemMetadata o)
           
 boolean equals(Object obj)
           
 List<String> getId()
           
 String getOriginatingNode()
          The name of the cluster node that propagated this version of the item to the cluster.
static List<String> getPathElements(String path)
           
 String getRelativePath()
           
 List<String> getRelativePathElements()
           
 String getRootName()
           
 long getTimestamp()
           
 String getTimestampAsString()
           
 int hashCode()
           
 boolean isChildOf(RepositoryItemMetadata other)
          Gets whether this item is a child of another item.
 boolean isDirectory()
           
 boolean isRemoved()
           
 void setDirectory(boolean directory)
           
 void setOriginatingNode(String originatingNode)
           
 void setRelativePath(String path)
           
 void setRelativePathElements(List<String> pathElements)
           
 void setRemoved(boolean removed)
           
 void setRootName(String rootName)
           
 void setTimestamp(long timestamp)
           
 void setTimestampAsString(String timestamp)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

NOW

public static String NOW
Marker value to pass to setTimestampAsString(String) that will generate a timestamp equal to System.currentTimeMillis(). Useful for testing.

Constructor Detail

RepositoryItemMetadata

public RepositoryItemMetadata()
Constructor for XML parser.


RepositoryItemMetadata

public RepositoryItemMetadata(List<String> pathElements,
                              long timestamp,
                              String originatingNode,
                              boolean directory,
                              boolean removed)

RepositoryItemMetadata

public RepositoryItemMetadata(RepositoryItemMetadata toCopy)
Copy constructor. Performs a deep copy of the path element list.

Parameters:
toCopy - the item to copy
Throws:
NullPointerException - if toCopy is null
Method Detail

getPathElements

public static List<String> getPathElements(String path)

getId

public List<String> getId()
Specified by:
getId in interface Identifiable<List<String>>

getRootName

public String getRootName()

setRootName

public void setRootName(String rootName)

getRelativePath

public String getRelativePath()

setRelativePath

public void setRelativePath(String path)

isDirectory

public boolean isDirectory()

setDirectory

public void setDirectory(boolean directory)

getTimestamp

public long getTimestamp()

setTimestamp

public void setTimestamp(long timestamp)

getTimestampAsString

public String getTimestampAsString()

setTimestampAsString

public void setTimestampAsString(String timestamp)

getRelativePathElements

public List<String> getRelativePathElements()

setRelativePathElements

public void setRelativePathElements(List<String> pathElements)

getOriginatingNode

public String getOriginatingNode()
The name of the cluster node that propagated this version of the item to the cluster.

Returns:

setOriginatingNode

public void setOriginatingNode(String originatingNode)

isRemoved

public boolean isRemoved()

setRemoved

public void setRemoved(boolean removed)

isChildOf

public boolean isChildOf(RepositoryItemMetadata other)
Gets whether this item is a child of another item.

Parameters:
other - the other item. Can be null in which case this method will return false
Returns:
true if other is not null, is a directory and this items path starts with other's path.

compareTo

public int compareTo(RepositoryItemMetadata o)
Specified by:
compareTo in interface Comparable<RepositoryItemMetadata>

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2009 JBoss, a division of Red Hat, Inc.. All Rights Reserved.