org.jdesktop.wonderland.common.modules
Class ModuleInfo

java.lang.Object
  extended by org.jdesktop.wonderland.common.modules.ModuleInfo
All Implemented Interfaces:
java.io.Serializable

public class ModuleInfo
extends java.lang.Object
implements java.io.Serializable

The ModuleInfo class represents the basic information about a module: its unique name, its major.minor version, and a string description.

This class is annotation with JAXB XML elements and supports encoding and decoding to/from XML via the encode() and decode() methods, respectively.

Author:
Jordan Slott
See Also:
Serialized Form

Nested Class Summary
static class ModuleInfo.Attribute
          The Attribute inner class stores a string key-value pair
static class ModuleInfo.Version
          The Version static inner class simply stores the major, minor, and mini version numbers
 
Field Summary
static int VERSION_UNSET
           
 
Constructor Summary
ModuleInfo()
          Default constructor
ModuleInfo(java.lang.String name, int major, int minor, int mini)
          Constructor which takes major/minor version number
ModuleInfo(java.lang.String name, int major, int minor, int mini, java.lang.String description)
          Constructor which takes major/minor version number and description
 
Method Summary
static ModuleInfo decode(java.io.Reader r)
          Takes the input reader of the XML file and instantiates an instance of the ModuleInfo class
 void encode(java.io.OutputStream os)
          Writes the ModuleInfo class to an output stream.
 void encode(java.io.Writer w)
          Writes the ModuleInfo class to an output writer.
 boolean equals(java.lang.Object object)
          Returns true if both the module name and version matches, false if not
 java.lang.String getAttribute(java.lang.String key)
          Returns an attribute givens it key, or null if it does not exist
 java.util.Map<java.lang.String,java.lang.String> getAttributes()
          Returns a copy of the map of key-value pairs of attributes
 ChecksumList getChecksumList()
           
 java.lang.String getDescription()
           
 int getMajor()
           
 int getMini()
           
 int getMinor()
           
 java.lang.String getName()
           
 ModuleRepository getRepository()
           
 int hashCode()
           
 void putAttibutes(java.util.Map<java.lang.String,java.lang.String> attributes)
          Adds a map of key-value attribute pairs to the attribute map.
 void putAttribute(java.lang.String key, java.lang.String value)
          Adds a key-value attribute pair to the attribute map
 void removeAttribute(java.lang.String key)
          Removes an attribute given its key.
 void setChecksumList(ChecksumList checksumList)
           
 void setDescription(java.lang.String description)
           
 void setMajor(int major)
           
 void setMini(int mini)
           
 void setMinor(int minor)
           
 void setName(java.lang.String name)
           
 void setRepository(ModuleRepository repository)
           
 java.lang.String toString()
          Returns the version as a string: .
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

VERSION_UNSET

public static final int VERSION_UNSET
See Also:
Constant Field Values
Constructor Detail

ModuleInfo

public ModuleInfo()
Default constructor


ModuleInfo

public ModuleInfo(java.lang.String name,
                  int major,
                  int minor,
                  int mini,
                  java.lang.String description)
Constructor which takes major/minor version number and description


ModuleInfo

public ModuleInfo(java.lang.String name,
                  int major,
                  int minor,
                  int mini)
Constructor which takes major/minor version number

Method Detail

getName

public java.lang.String getName()

setName

public void setName(java.lang.String name)

getMajor

public int getMajor()

setMajor

public void setMajor(int major)

getMinor

public int getMinor()

setMinor

public void setMinor(int minor)

getMini

public int getMini()

setMini

public void setMini(int mini)

getDescription

public java.lang.String getDescription()

setDescription

public void setDescription(java.lang.String description)

getChecksumList

public ChecksumList getChecksumList()

setChecksumList

public void setChecksumList(ChecksumList checksumList)

getRepository

public ModuleRepository getRepository()

setRepository

public void setRepository(ModuleRepository repository)

getAttributes

public java.util.Map<java.lang.String,java.lang.String> getAttributes()
Returns a copy of the map of key-value pairs of attributes


putAttribute

public void putAttribute(java.lang.String key,
                         java.lang.String value)
Adds a key-value attribute pair to the attribute map


putAttibutes

public void putAttibutes(java.util.Map<java.lang.String,java.lang.String> attributes)
Adds a map of key-value attribute pairs to the attribute map.

Parameters:
attributes -

getAttribute

public java.lang.String getAttribute(java.lang.String key)
Returns an attribute givens it key, or null if it does not exist


removeAttribute

public void removeAttribute(java.lang.String key)
Removes an attribute given its key. Does nothing if the attribute does not exist


toString

public java.lang.String toString()
Returns the version as a string: .

Overrides:
toString in class java.lang.Object

decode

public static ModuleInfo decode(java.io.Reader r)
                         throws javax.xml.bind.JAXBException
Takes the input reader of the XML file and instantiates an instance of the ModuleInfo class

Parameters:
r - The input reader of the version XML file
Throws:
javax.xml.bind.JAXBException

encode

public void encode(java.io.Writer w)
            throws javax.xml.bind.JAXBException
Writes the ModuleInfo class to an output writer.

Parameters:
w - The output writer to write to
Throws:
javax.xml.bind.JAXBException

encode

public void encode(java.io.OutputStream os)
            throws javax.xml.bind.JAXBException
Writes the ModuleInfo class to an output stream.

Parameters:
os - The output stream to write to
Throws:
javax.xml.bind.JAXBException

equals

public boolean equals(java.lang.Object object)
Returns true if both the module name and version matches, false if not

Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object


Open Wonderland - http://openwonderland.org