com.echomine.jabber
Class JIDType

java.lang.Object
  extended by com.echomine.jabber.JIDType

public class JIDType
extends java.lang.Object

a jid-type is similar to a mime-type. It contains a category and then a subtype in the form of "category/subtype" (ie. text/html). This is the way that jabber uses to identify types when browsing. You need to work with this class to retrieve information returned from a browse result.

A list of JID Types are available online at

http://docs.jabber.org/draft-proto/html/browsing.html

This object is not reusable once instantiated. It is basically immutable.


Constructor Summary
JIDType(java.lang.String type)
          the constructor takes a category/subtype pair string and will parse it into its distinctive parts.
JIDType(java.lang.String category, java.lang.String subtype)
           
 
Method Summary
 void addChild(JIDType child)
          adds a child to the type.
 void addNS(Namespace ns)
          adds a namespace that the JID type recognizes on how to process.
 java.lang.String getCategory()
           
 java.util.List getChildren()
          retrieves the children that are contained inside this JID.
 Element getDOM()
          Creates a DOM structure that represents all the data contained within this type
 JID getJID()
           
 java.lang.String getJIDType()
          retrieves the entire JID type in the form of "category/subtype"
 java.lang.String getName()
           
 java.util.List getNSList()
          retrieves the namespaces that the type supports.
 java.lang.String getSubtype()
           
 void parse(Element browse)
          parses the incoming message for the data.
 void setCategory(java.lang.String category)
          sets the category for the type.
 void setJID(JID jid)
          sets the JID of the type.
 void setName(java.lang.String name)
          sets the common name for the JID type for easier recognition.
 void setSubtype(java.lang.String subtype)
          sets the subtype for the type.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JIDType

public JIDType(java.lang.String type)
        throws ParseException
the constructor takes a category/subtype pair string and will parse it into its distinctive parts. The types are listed in JIDTypeCode.

Throws:
ParseException - if the parsing of the category/subtype errored

JIDType

public JIDType(java.lang.String category,
               java.lang.String subtype)
Method Detail

getJIDType

public java.lang.String getJIDType()
retrieves the entire JID type in the form of "category/subtype"


getCategory

public java.lang.String getCategory()
Returns:
the primary category of the type

setCategory

public void setCategory(java.lang.String category)
sets the category for the type. The type is in the format of category/subtype.


getSubtype

public java.lang.String getSubtype()
Returns:
the subtype for the type, null if there is none

setSubtype

public void setSubtype(java.lang.String subtype)
sets the subtype for the type.


getJID

public JID getJID()
Returns:
the JID of the type, null if empty

setJID

public void setJID(JID jid)
sets the JID of the type. This will override any types that were previously set. Normally the JID should be exactly the same as the To/From of the IQ. You should only change this to something different from the To Field if you know what you're doing.


getName

public java.lang.String getName()
Returns:
the common user-recognizable name for the type if there is one, null otherwise

setName

public void setName(java.lang.String name)
sets the common name for the JID type for easier recognition.


addChild

public void addChild(JIDType child)
adds a child to the type. This will be under the type


addNS

public void addNS(Namespace ns)
adds a namespace that the JID type recognizes on how to process. For user replies, this is normally used to advertise what features the client support (ie. xhtml, pgp/encryption, oob file transfers, etc). The transports use this to advertise what type of services it supports (ie. search, register, gateway, etc).


getChildren

public java.util.List getChildren()
retrieves the children that are contained inside this JID. If there are no children, then the returned value will be null.


getNSList

public java.util.List getNSList()
retrieves the namespaces that the type supports. If there are no namespaces, then the returned value will be null.


parse

public void parse(Element browse)
           throws ParseException
parses the incoming message for the data. The element passed in should be the beginning of the JID Type element (ie. the , , etc elements). It will recursively parse any internal children that are also of JID Type.

Throws:
ParseException

getDOM

public Element getDOM()
               throws ParseException
Creates a DOM structure that represents all the data contained within this type

Throws:
ParseException

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2001-2005 Echomine. All Rights Reserved.