[Asterisk-java-cvs] CVS: asterisk-java/src/java/net/sf/asterisk/manager/response ManagerResponse.jav
Brought to you by:
srt
From: Stefan R. <sr...@us...> - 2005-02-23 12:45:33
|
Update of /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/manager/response In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11816/src/java/net/sf/asterisk/manager/response Added Files: ManagerResponse.java MailboxStatusResponse.java CommandResponse.java ChallengeResponse.java ManagerError.java ExtensionStateResponse.java MailboxCountResponse.java Log Message: moved src and test to src/java and src/test first steps to introduce maven --- NEW FILE: ManagerResponse.java --- /* * (c) 2004 Stefan Reuter * * Created on Apr 22, 2004 */ package net.sf.asterisk.manager.response; import java.io.Serializable; import java.util.Date; import org.apache.commons.lang.builder.EqualsBuilder; import org.apache.commons.lang.builder.HashCodeBuilder; import org.apache.commons.lang.builder.ToStringBuilder; /** * Represents a response received from the Asterisk server as the result of a previously sent * ManagerAction.<br> * The response can be linked with the action that caused it by looking the action id * attribute that will match the action id of the corresponding action. * * @see net.sf.asterisk.manager.action.ManagerAction * @author srt * @version $Id: ManagerResponse.java,v 1.1 2005/02/23 12:45:22 srt Exp $ */ public class ManagerResponse implements Serializable { static final long serialVersionUID = -935845815108584292L; private Date dateReceived; private String actionId; private String response; private String message; private String uniqueId; /** * Returns the point in time this response was received from the asterisk server. */ public Date getDateReceived() { return dateReceived; } /** * Sets the point in time this response was received from the asterisk server. */ public void setDateReceived(Date dateReceived) { this.dateReceived = dateReceived; } /** * Returns the action id received with this response referencing the action * that generated this response. */ public String getActionId() { return actionId; } /** * Sets the action id. */ public void setActionId(String actionId) { this.actionId = actionId; } /** * Returns the message received with this response. * The content depends on the action that generated this response. */ public String getMessage() { return message; } /** * Sets the message. */ public void setMessage(String message) { this.message = message; } /** * Returns the value of the "Response:" line. * This typically a String like "Success" or "Error" but depends on the action that * generated this response. */ public String getResponse() { return response; } /** * Sets the response. */ public void setResponse(String response) { this.response = response; } /** * Returns the unique id received with this response. * The unique id is used to keep track of channels created by the action sent, * for example an OriginateAction. */ public String getUniqueId() { return uniqueId; } /** * Sets the unique id received with this response. */ public void setUniqueId(String uniqueId) { this.uniqueId = uniqueId; } final public String toString() { return ToStringBuilder.reflectionToString(this); } public boolean equals(Object o) { return EqualsBuilder.reflectionEquals(this, o); } public int hashCode() { return HashCodeBuilder.reflectionHashCode(this); } } --- NEW FILE: MailboxStatusResponse.java --- /* * (c) 2004 Stefan Reuter * * Created on Sep 29, 2004 */ package net.sf.asterisk.manager.response; /** * A MailboxStatusResponse is sent in response to a MailboxStatusAction * and indicates if a mailbox contains waiting messages. * * @see net.sf.asterisk.manager.action.MailboxStatusAction * * @author srt * @version $Id: MailboxStatusResponse.java,v 1.1 2005/02/23 12:45:22 srt Exp $ */ public class MailboxStatusResponse extends ManagerResponse { private static final long serialVersionUID = -7193581424292429279L; private String mailbox; private Integer waiting; /** * Returns the name of the mailbox. */ public String getMailbox() { return mailbox; } /** * Sets the name of the mailbox. */ public void setMailbox(String mailbox) { this.mailbox = mailbox; } /** * Returns 1 if the mailbox has waiting messages; 0 otherwise. */ public Integer getWaiting() { return waiting; } /** * Set to 1 if the mailbox has waiting messages; 0 otherwise. */ public void setWaiting(Integer waiting) { this.waiting = waiting; } } --- NEW FILE: CommandResponse.java --- /* * (c) 2004 Stefan Reuter * * Created on Apr 25, 2004 */ package net.sf.asterisk.manager.response; import java.util.List; /** * Corresponds to a CommandAction.<br> * * Asterisk's handling of the command action is generelly quite hairy. It sends a "Response: Follows" * line followed by the raw output of the command including empty lines. At the end of the command * output a line containing "--END COMMAND--" is sent. The reader parses this response into a * CommandResponse object to hide these details. * * @see net.sf.asterisk.manager.action.CommandAction * * @author srt * @version $Id: CommandResponse.java,v 1.1 2005/02/23 12:45:22 srt Exp $ */ public class CommandResponse extends ManagerResponse { static final long serialVersionUID = -350763332794275049L; protected List result; /** * Returns a List containing strings representing the lines returned by * the CLI command. */ public List getResult() { return result; } /** * Sets the result. */ public void setResult(List result) { this.result = result; } } --- NEW FILE: ChallengeResponse.java --- /* * (c) 2004 Stefan Reuter * * Created on Apr 22, 2004 */ package net.sf.asterisk.manager.response; /** * Corresponds to a ChallengeAction and contains the challenge needed to log in * using challenge/response. * * @see net.sf.asterisk.manager.action.ChallengeAction * @see net.sf.asterisk.manager.action.LoginAction * * @author srt * @version $Id: ChallengeResponse.java,v 1.1 2005/02/23 12:45:22 srt Exp $ */ public class ChallengeResponse extends ManagerResponse { static final long serialVersionUID = -7253724086340850957L; private String challenge; /** * Returns the challenge to use when creating the key for log in. * * @see net.sf.asterisk.manager.action.LoginAction#key */ public String getChallenge() { return challenge; } /** * Sets the challenge to use when creating the key for log in. */ public void setChallenge(String challenge) { this.challenge = challenge; } } --- NEW FILE: ManagerError.java --- /* * (c) 2004 Stefan Reuter * * Created on Apr 23, 2004 */ package net.sf.asterisk.manager.response; import org.apache.commons.lang.builder.EqualsBuilder; import org.apache.commons.lang.builder.HashCodeBuilder; /** * Represents an "Response: Error" response received from the asterisk server. * The cause for the error is given in the message attribute. * * @author srt * @version $Id: ManagerError.java,v 1.1 2005/02/23 12:45:22 srt Exp $ */ public class ManagerError extends ManagerResponse { static final long serialVersionUID = -8753149536715547476L; /** * */ public ManagerError() { } public boolean equals(Object o) { return EqualsBuilder.reflectionEquals(this, o); } public int hashCode() { return HashCodeBuilder.reflectionHashCode(this); } } --- NEW FILE: ExtensionStateResponse.java --- /* * (c) 2004 Stefan Reuter * * Created on Sep 29, 2004 */ package net.sf.asterisk.manager.response; /** * @author srt * @version $Id: ExtensionStateResponse.java,v 1.1 2005/02/23 12:45:22 srt Exp $ */ public class ExtensionStateResponse extends ManagerResponse { private static final long serialVersionUID = -2044248427247227390L; private String exten; private String context; private String hint; private Integer status; public String getExten() { return exten; } public void setExten(String exten) { this.exten = exten; } public String getContext() { return context; } public void setContext(String context) { this.context = context; } public String getHint() { return hint; } public void setHint(String hint) { this.hint = hint; } public Integer getStatus() { return status; } public void setStatus(Integer status) { this.status = status; } } --- NEW FILE: MailboxCountResponse.java --- /* * (c) 2004 Stefan Reuter * * Created on Sep 29, 2004 */ package net.sf.asterisk.manager.response; /** * A MailboxCountResponse is sent in response to a MailboxCountAction * and contains the number of old and new messages in a mailbox. * * @see net.sf.asterisk.manager.action.MailboxCountAction * * @author srt * @version $Id: MailboxCountResponse.java,v 1.1 2005/02/23 12:45:22 srt Exp $ */ public class MailboxCountResponse extends ManagerResponse { private static final long serialVersionUID = 7820598941277275838L; private String mailbox; private Integer newMessages; private Integer oldMessages; /** * Returns the name of the mailbox. */ public String getMailbox() { return mailbox; } /** * Sets the name of the mailbox. */ public void setMailbox(String mailbox) { this.mailbox = mailbox; } /** * Returns the number of new messages in the mailbox. */ public Integer getNewMessages() { return newMessages; } /** * Sets the number of new messages in the mailbox. */ public void setNewMessages(Integer newMessages) { this.newMessages = newMessages; } /** * Returns the number of old messages in the mailbox. */ public Integer getOldMessages() { return oldMessages; } /** * Sets the number of old messages in the mailbox. */ public void setOldMessages(Integer oldMessages) { this.oldMessages = oldMessages; } } |