org.media.mn8.protocol.jabber
Class JabberDataBlock

java.lang.Object
  |
  +--org.media.mn8.protocol.jabber.JabberDataBlock
Direct Known Subclasses:
Iq, Login, Message, Presence

public class JabberDataBlock
extends java.lang.Object

The base class for Jabber datablocks objects in the datablock sub package


Field Summary
protected  java.util.Hashtable attributes
          The list of attributes in this tag
protected  java.util.Vector childBlocks
          The list of child blocks inside this block
protected  JabberDataBlock parent
          This blocks' parent
protected  java.lang.StringBuffer textData
          A string representing all the text within the data block
 
Constructor Summary
JabberDataBlock()
          Constructor
JabberDataBlock(JabberDataBlock _parent)
          Constructor
JabberDataBlock(JabberDataBlock _parent, java.util.Hashtable _attributes)
          Constructor including an Attribute list
JabberDataBlock(java.lang.String _tagName, JabberDataBlock _parent, java.util.Hashtable _attributes)
          Constructor including an Attribute list
 
Method Summary
protected  void addAttributeToStringBuffer(java.lang.StringBuffer buffer)
          Method to add all the attributes to a string buffer
 void addChild(JabberDataBlock newData)
          Method to add a child to the list of child blocks
 void addText(java.lang.String text)
          Method to add some text to the text buffer for this block
protected  void constructReply(JabberDataBlock container)
          Method to construct a reply to this block.
 java.lang.String getAttribute(java.lang.String attributeName)
          Method to get an attribute
 byte[] getBytes()
          Method to return the data as a byte stream ready to send over the wire
 java.util.Vector getChildBlocks()
          Returns a vector holding all of the children of this block
 JabberDataBlock getParent()
          Method to get the parent of this block
 java.lang.String getTagEnd()
          Method to return the end of tag string as a string
 java.lang.String getTagName()
          Method to return the tag name
 java.lang.String getTagStart()
          Method to return the start of tag string as a string
 java.lang.String getText()
          Method to get the text element of this block
 void setAttribute(java.lang.String attributeName, java.lang.String value)
          Method to set an attribute value
 java.lang.String toString()
          Method to convert this into a String
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

childBlocks

protected java.util.Vector childBlocks
The list of child blocks inside this block

textData

protected java.lang.StringBuffer textData
A string representing all the text within the data block

parent

protected JabberDataBlock parent
This blocks' parent

attributes

protected java.util.Hashtable attributes
The list of attributes in this tag
Constructor Detail

JabberDataBlock

public JabberDataBlock()
Constructor

JabberDataBlock

public JabberDataBlock(JabberDataBlock _parent)
Constructor
Parameters:
parent - The parent of this data block

JabberDataBlock

public JabberDataBlock(JabberDataBlock _parent,
                       java.util.Hashtable _attributes)
Constructor including an Attribute list
Parameters:
_parent - The parent of this datablock
_attributes - The list of element attributes

JabberDataBlock

public JabberDataBlock(java.lang.String _tagName,
                       JabberDataBlock _parent,
                       java.util.Hashtable _attributes)
Constructor including an Attribute list
Parameters:
_tagName - The name of the block
_parent - The parent of this datablock
_attributes - The list of element attributes
Method Detail

addChild

public void addChild(JabberDataBlock newData)
Method to add a child to the list of child blocks
Parameters:
newData - The child block to add

addText

public void addText(java.lang.String text)
Method to add some text to the text buffer for this block
Parameters:
text - The text to add

getParent

public JabberDataBlock getParent()
Method to get the parent of this block
Returns:
This blocks parent

getBytes

public byte[] getBytes()
Method to return the data as a byte stream ready to send over the wire
Returns:
The data to send as a byte array

getText

public java.lang.String getText()
Method to get the text element of this block
Returns:
The text contained in this block

getAttribute

public java.lang.String getAttribute(java.lang.String attributeName)
Method to get an attribute
Parameters:
attributeName - The name of the attribute to get
Returns:
The value of the attribute

setAttribute

public void setAttribute(java.lang.String attributeName,
                         java.lang.String value)
Method to set an attribute value
Parameters:
attributeName - The name of the attribute to set
value - The value of the attribute

getChildBlocks

public java.util.Vector getChildBlocks()
Returns a vector holding all of the children of this block
Parameters:
Vector - holding all the children

toString

public java.lang.String toString()
Method to convert this into a String
Overrides:
toString in class java.lang.Object
Returns:
The element as an XML string

addAttributeToStringBuffer

protected void addAttributeToStringBuffer(java.lang.StringBuffer buffer)
Method to add all the attributes to a string buffer
Parameters:
buffer - The string buffer to which all the attributes will be added

getTagStart

public java.lang.String getTagStart()
Method to return the start of tag string as a string
Returns:
The start tag string

getTagEnd

public java.lang.String getTagEnd()
Method to return the end of tag string as a string
Returns:
The end tag string

getTagName

public java.lang.String getTagName()
Method to return the tag name
Returns:
The tag name

constructReply

protected void constructReply(JabberDataBlock container)
Method to construct a reply to this block. Copies the user ID and sets the correct recipient address.
Parameters:
containet - The block in which the reply will be sent.


"Copyright © 2001 Internet Multicasting Services & media.org. All Rights Reserved."