net.sf.asterisk.fastagi.reply.impl
Class AGIReplyImpl

java.lang.Object
  extended by net.sf.asterisk.fastagi.reply.impl.AGIReplyImpl
All Implemented Interfaces:
java.io.Serializable, AGIReply

public class AGIReplyImpl
extends java.lang.Object
implements java.io.Serializable, AGIReply

Default implementation of the AGIReply interface.

Version:
$Id: AGIReplyImpl.java,v 1.2 2005/05/03 21:07:52 srt Exp $
Author:
srt
See Also:
Serialized Form

Field Summary
 
Fields inherited from interface net.sf.asterisk.fastagi.reply.AGIReply
SC_INVALID_COMMAND_SYNTAX, SC_INVALID_OR_UNKNOWN_COMMAND, SC_SUCCESS
 
Constructor Summary
AGIReplyImpl()
           
AGIReplyImpl(java.util.List lines)
           
 
Method Summary
 java.lang.String getAttribute(java.lang.String name)
          Returns an additional attribute contained in the reply.
For example the reply to the StreamFileCommand contains an additional endpos attribute indicating the frame where the playback was stopped.
 java.lang.String getExtra()
          Returns the text in parenthesis contained in this reply.
The meaning of this property depends on the command sent.
 java.lang.String getFirstLine()
          Returns the first line of the raw reply.
 java.util.List getLines()
          Returns a List containing the lines of the raw reply.
 java.lang.String getResult()
          Returns the result, that is the part directly following the "result=" string.
 int getResultCode()
          Returns the return code (the result as int).
 char getResultCodeAsChar()
          Returns the return code as character.
 int getStatus()
          Returns the status code.
Supported status codes are: 200 Success 510 Invalid or unknown command 520 Invalid command syntax
 java.lang.String getSynopsis()
          Returns the synopsis of the command sent if Asterisk expected a different syntax (getStatus() == SC_INVALID_COMMAND_SYNTAX).
 java.lang.String getUsage()
          Returns the usage of the command sent if Asterisk expected a different syntax (getStatus() == SC_INVALID_COMMAND_SYNTAX).
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AGIReplyImpl

public AGIReplyImpl()

AGIReplyImpl

public AGIReplyImpl(java.util.List lines)
Method Detail

getFirstLine

public java.lang.String getFirstLine()
Description copied from interface: AGIReply
Returns the first line of the raw reply.

Specified by:
getFirstLine in interface AGIReply
Returns:
the first line of the raw reply.

getLines

public java.util.List getLines()
Description copied from interface: AGIReply
Returns a List containing the lines of the raw reply.

Specified by:
getLines in interface AGIReply
Returns:
a List containing the lines of the raw reply.

getResultCode

public int getResultCode()
Returns the return code (the result as int).

Specified by:
getResultCode in interface AGIReply
Returns:
the return code or -1 if the result is not an int.

getResultCodeAsChar

public char getResultCodeAsChar()
Returns the return code as character.

Specified by:
getResultCodeAsChar in interface AGIReply
Returns:
the return code as character.

getResult

public java.lang.String getResult()
Returns the result, that is the part directly following the "result=" string.

Specified by:
getResult in interface AGIReply
Returns:
the result.

getStatus

public int getStatus()
Returns the status code.
Supported status codes are:

Specified by:
getStatus in interface AGIReply
Returns:
the status code.

getAttribute

public java.lang.String getAttribute(java.lang.String name)
Returns an additional attribute contained in the reply.
For example the reply to the StreamFileCommand contains an additional endpos attribute indicating the frame where the playback was stopped. This can be retrieved by calling getAttribute("endpos") on the corresponding reply.

Specified by:
getAttribute in interface AGIReply
Parameters:
name - the name of the attribute to retrieve. The name is case insensitive.
Returns:
the value of the attribute or null if it is not set.

getExtra

public java.lang.String getExtra()
Returns the text in parenthesis contained in this reply.
The meaning of this property depends on the command sent. Sometimes it contains a flag like "timeout" or "hangup" or - in case of the GetVariableCommand - the value of the variable.

Specified by:
getExtra in interface AGIReply
Returns:
the text in the parenthesis or null if not set.

getSynopsis

public java.lang.String getSynopsis()
Returns the synopsis of the command sent if Asterisk expected a different syntax (getStatus() == SC_INVALID_COMMAND_SYNTAX).

Specified by:
getSynopsis in interface AGIReply
Returns:
the synopsis of the command sent, null if there were no syntax errors.

getUsage

public java.lang.String getUsage()
Returns the usage of the command sent if Asterisk expected a different syntax (getStatus() == SC_INVALID_COMMAND_SYNTAX).

Specified by:
getUsage in interface AGIReply
Returns:
the usage of the command sent, null if there were no syntax errors.

toString

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


Copyright © 2004-2005 Stefan Reuter. All Rights Reserved.