Package beepy :: Package profiles :: Module message :: Class Message
[show private | hide private]
[frames | no frames]

Class Message


The Message class defines a BEEP Management message object. This is used by the BEEPManagementProfile to coordinate channel and session management operations.

See Also: beepmgmtprofile

Method Summary
  __init__(self, type, doc)
  __del__(self)
In order to remove all references to a Message object we need to specifically unlink the XML document self.doc
  __str__(self)
Print the XML DOM out for debugging purposes.
  getCloseChannelNum(self)
If this is a close message, find the channel number that the close message refers to.
  getErrorCode(self)
If this is an error message, get the error code from the message.
  getErrorDescription(self)
If this is an error message, get the error description from the message.
  getProfileURI(self)
Returns the uri attribute of the first profile element found.
  getProfileURIList(self)
Finds all the uri attributes of any profile elements and places them in a sequence, which is returned.
  getStartChannelNum(self)
If this is a start message, find the channel number that the start message refers to.
  getStartProfileBlob(self)
getStartProfileBlob() gets the contents of the CDATA element within a <start> message profile, which should be a <blob></blob> section to be passed to the profile.
  isClose(self)
Is this Message a close message?
  isError(self)
Is this Message an error message?
  isGreeting(self)
Is this Message a greeting message?
  isOK(self)
Is this Message an ok message?
  isProfile(self)
Messages of type profile are replies to a channel start MSG that was successful.
  isStart(self)
Is this Message a greeting message?
  validate(self)
This is a hack because I can't be bothered integrating a validating XML parser into the core just yet.

Method Details

__init__(self, type, doc)
(Constructor)

Parameters:
type - type, the message type
           (type=a valid BEEP management message type)
doc - an XML document
           (type=an xml.dom.minidom.doc document)

__del__(self)
(Destructor)

In order to remove all references to a Message object we need to specifically unlink the XML document self.doc

__str__(self)
(Informal representation operator)

Print the XML DOM out for debugging purposes.

getCloseChannelNum(self)

If this is a close message, find the channel number that the close message refers to.
Returns:
the channel number to close.

getErrorCode(self)

If this is an error message, get the error code from the message.
Returns:
the error code

getErrorDescription(self)

If this is an error message, get the error description from the message.
Returns:
a string containing the error description

getProfileURI(self)

Returns the uri attribute of the first profile element found.
Returns:
a string containing the URI for the profile

Warning: getProfileURI may be broken. It depends on how getElementsByTagName processes the DOM structure I've hacked together to get around the lack of CDATA functionality in minidom. It appears to work so far, but there are no guarantees.

getProfileURIList(self)

Finds all the uri attributes of any profile elements and places them in a sequence, which is returned.
Returns:
a sequence of uri strings

Warning: getProfileURIList may be broken. It depends on how getElementsByTagName processes the DOM structure I've hacked together to get around the lack of CDATA functionality in minidom. It appears to work so far, but there are no guarantees.

getStartChannelNum(self)

If this is a start message, find the channel number that the start message refers to.
Returns:
the channel number to start.

getStartProfileBlob(self)

getStartProfileBlob() gets the contents of the CDATA element within a <start> message profile, which should be a <blob></blob> section to be passed to the profile.
Returns:
a string containing the CDATA

isClose(self)

Is this Message a close message?
Returns:
1, if Message is a greeting

isError(self)

Is this Message an error message?
Returns:
1, if Message is a greeting

isGreeting(self)

Is this Message a greeting message?
Returns:
1, if Message is a greeting

isOK(self)

Is this Message an ok message?
Returns:
1, if Message is a greeting

isProfile(self)

Messages of type profile are replies to a channel start MSG that was successful.
Returns:
1, if Message is a profile

isStart(self)

Is this Message a greeting message?
Returns:
1, if Message is a greeting

validate(self)

This is a hack because I can't be bothered integrating a validating XML parser into the core just yet. Maybe later. All this does is validate the message against the BEEP management profile DTD.
Returns:
1 if valid.
Raises:
MessageException - if message is invalid

Generated by Epydoc 2.0 on Thu Sep 30 14:39:25 2004 http://epydoc.sf.net