Source Code Cross Referenced for DialogState.java in  » 6.0-JDK-Modules » Java-Advanced-Imaging » javax » sip » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » 6.0 JDK Modules » Java Advanced Imaging » javax.sip 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
003:         * Unpublished - rights reserved under the Copyright Laws of the United States.
004:         * Copyright © 2003 Sun Microsystems, Inc. All rights reserved.
005:         * Copyright © 2005 BEA Systems, Inc. All rights reserved.
006:         *
007:         * Use is subject to license terms.
008:         *
009:         * This distribution may include materials developed by third parties. 
010:         *
011:         * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
012:         *
013:         * Module Name   : JSIP Specification
014:         * File Name     : DialogState.java
015:         * Author        : Phelim O'Doherty
016:         *
017:         *  HISTORY
018:         *  Version   Date      Author              Comments
019:         *  1.1     08/10/2002  Phelim O'Doherty    Initial version
020:         *  1.2     07/07/2005  Phelim O'Doherty    Deprecated the completed state.
021:         *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
022:         */package javax.sip;
023:
024:        import java.io.*;
025:
026:        /**
027:         * This class contains the enumerations that define the underlying state of an 
028:         * existing dialog. 
029:         *
030:         * There are three explicit states for a dialog, namely:
031:         * <ul>
032:         * <li> Early - A dialog is in the "early" state, which occurs when it is 
033:         * created when a provisional response is recieved to the INVITE Request.
034:         * <li> Confirmed - A dialog transitions to the "confirmed" state when a 2xx 
035:         * final response is received to the INVITE Request.
036:         * <li> Terminated - A dialog transitions to the "terminated" state for all 
037:         * other reasons or if no response arrives at all on the dialog.
038:         * </ul>
039:         *
040:         * @author BEA Systems, NIST 
041:         * @version 1.2
042:         */
043:        public final class DialogState implements  Serializable {
044:
045:            /**
046:             * Constructor for the DialogState
047:             *
048:             * @param dialogState  The integer value for the DialogueState
049:             */
050:            private DialogState(int dialogState) {
051:                m_dialogState = dialogState;
052:                m_dialogStateArray[m_dialogState] = this ;
053:            }
054:
055:            /**
056:             * This method returns the object value of the DialogState
057:             *
058:             * @return  The DialogState Object
059:             * @param dialogState The integer value of the DialogState
060:             */
061:            public static DialogState getObject(int dialogState) {
062:                if (dialogState >= 0 && dialogState < m_size) {
063:                    return m_dialogStateArray[dialogState];
064:                } else {
065:                    throw new IllegalArgumentException(
066:                            "Invalid dialogState value");
067:                }
068:            }
069:
070:            /**
071:             * This method returns the integer value of the DialogState
072:             *
073:             * @return The integer value of the DialogState
074:             */
075:            public int getValue() {
076:                return m_dialogState;
077:            }
078:
079:            /**
080:             * Returns the designated type as an alternative object to be used when
081:             * writing an object to a stream.
082:             *
083:             * This method would be used when for example serializing DialogState.EARLY
084:             * and deserializing it afterwards results again in DialogState.EARLY.
085:             * If you do not implement readResolve(), you would not get
086:             * DialogState.EARLY but an instance with similar content.
087:             *
088:             * @return the DialogState
089:             * @exception ObjectStreamException
090:             */
091:            private Object readResolve() throws ObjectStreamException {
092:                return m_dialogStateArray[m_dialogState];
093:            }
094:
095:            /**
096:             * Compare this dialog state for equality with another.
097:             * 
098:             * @since 1.2
099:             * @param obj the object to compare this with.
100:             * @return <code>true</code> if <code>obj</code> is an instance of this class
101:             * representing the same dialog state as this, <code>false</code> otherwise.
102:             */
103:            public boolean equals(Object obj) {
104:                if (obj == this )
105:                    return true;
106:
107:                return (obj instanceof  DialogState)
108:                        && ((DialogState) obj).m_dialogState == m_dialogState;
109:            }
110:
111:            /**
112:             * Get a hash code value for this dialog state.
113:             * 
114:             * @since 1.2
115:             * @return a hash code value.
116:             */
117:            public int hashCode() {
118:                return m_dialogState;
119:            }
120:
121:            /**
122:             * This method returns a string version of this class.
123:             * @return The string version of the DialogState
124:             */
125:            public String toString() {
126:                String text = "";
127:                switch (m_dialogState) {
128:                case _EARLY:
129:                    text = "Early Dialog";
130:                    break;
131:                case _CONFIRMED:
132:                    text = "Confirmed Dialog";
133:                    break;
134:                case _COMPLETED:
135:                    text = "Completed Dialog";
136:                    break;
137:                case _TERMINATED:
138:                    text = "Terminated Dialog";
139:                    break;
140:                default:
141:                    text = "Error while printing Dialog State";
142:                    break;
143:                }
144:                return text;
145:            }
146:
147:            // internal variables
148:            private int m_dialogState;
149:            private static int m_size = 4;
150:            private static DialogState[] m_dialogStateArray = new DialogState[m_size];
151:
152:            /**
153:             * This constant value indicates the internal value of the "Early" 
154:             * constant.
155:             * <br>This constant has an integer value of 0.
156:             */
157:            public static final int _EARLY = 0;
158:
159:            /**
160:             * This constant value indicates that the dialog state is "Early".
161:             */
162:            public final static DialogState EARLY = new DialogState(_EARLY);
163:
164:            /**
165:             * This constant value indicates the internal value of the "Confirmed" 
166:             * constant.
167:             * <br>This constant has an integer value of 1.
168:             */
169:            public static final int _CONFIRMED = 1;
170:
171:            /**
172:             * This constant value indicates that the dialog state is "Confirmed".
173:             */
174:            public final static DialogState CONFIRMED = new DialogState(
175:                    _CONFIRMED);
176:
177:            /**
178:             * This constant value indicates the internal value of the "Completed" 
179:             * constant.
180:             * <br>This constant has an integer value of 2.
181:             * @deprecated Since v1.2. This state does not exist in a dialog.
182:             */
183:            public static final int _COMPLETED = 2;
184:
185:            /**
186:             * This constant value indicates that the dialog state is "Completed".
187:             * @deprecated Since v1.2. This state does not exist in a dialog.
188:             */
189:            public final static DialogState COMPLETED = new DialogState(
190:                    _COMPLETED);
191:
192:            /**
193:             * This constant value indicates the internal value of the "Terminated" 
194:             * constant.
195:             * <br>This constant has an integer value of 3.
196:             */
197:            public static final int _TERMINATED = 3;
198:
199:            /**
200:             * This constant value indicates that the dialog state is "Terminated".
201:             */
202:            public final static DialogState TERMINATED = new DialogState(
203:                    _TERMINATED);
204:
205:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.