Source Code Cross Referenced for OriginField.java in  » 6.0-JDK-Modules » j2me » gov » nist » javax » sdp » fields » 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 » j2me » gov.nist.javax.sdp.fields 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Portions Copyright  2000-2007 Sun Microsystems, Inc. All Rights
003:         * Reserved.  Use is subject to license terms.
004:         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
005:         * 
006:         * This program is free software; you can redistribute it and/or
007:         * modify it under the terms of the GNU General Public License version
008:         * 2 only, as published by the Free Software Foundation.
009:         * 
010:         * This program is distributed in the hope that it will be useful, but
011:         * WITHOUT ANY WARRANTY; without even the implied warranty of
012:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
013:         * General Public License version 2 for more details (a copy is
014:         * included at /legal/license.txt).
015:         * 
016:         * You should have received a copy of the GNU General Public License
017:         * version 2 along with this work; if not, write to the Free Software
018:         * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
019:         * 02110-1301 USA
020:         * 
021:         * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
022:         * Clara, CA 95054 or visit www.sun.com if you need additional
023:         * information or have any questions.
024:         */
025:        /*
026:         */
027:        package gov.nist.javax.sdp.fields;
028:
029:        import gov.nist.core.*;
030:        import gov.nist.javax.sdp.*;
031:
032:        /**
033:         * Origin Field SDP header
034:         *
035:         *
036:         * <a href="{@docRoot}/uncopyright.html">This code is in the public domain.</a>
037:         *
038:         */
039:        public class OriginField extends SDPField {
040:            /** User name. */
041:            protected String username;
042:            /** Session identifier. */
043:            protected long sessId;
044:            /** Session version number. */
045:            protected long sessVersion;
046:            /** Network type. */
047:            protected String nettype; // INT
048:            /** Address type. */
049:            protected String addrtype; // IPV4/6
050:            /** Target host address. */
051:            protected Host address;
052:
053:            /**
054:             * Copies the current instance.
055:             * @return the copy of this object
056:             */
057:            public Object clone() {
058:                OriginField retval = new OriginField();
059:                retval.username = this .username;
060:                retval.sessId = this .sessId;
061:                retval.sessVersion = this .sessVersion;
062:                retval.nettype = this .nettype;
063:                retval.addrtype = this .addrtype;
064:                if (this .address != null)
065:                    retval.address = (Host) this .address.clone();
066:                return retval;
067:            }
068:
069:            /** Default constructor. */
070:            public OriginField() {
071:                super (ORIGIN_FIELD);
072:            }
073:
074:            /**
075:             * Returns the name of the session originator.
076:             * @throws SdpParseException
077:             * @return the string username.
078:             */
079:            public String getUsername() throws SdpParseException {
080:                return username;
081:            }
082:
083:            /**
084:             * Gets the session identifier member.
085:             * @return the session identifier
086:             */
087:            public long getSessId() {
088:                return sessId;
089:            }
090:
091:            /**
092:             * Gets the session version member.
093:             * @return the session version number
094:             */
095:            public long getSessVersion() {
096:                return sessVersion;
097:            }
098:
099:            /**
100:             * Gets the network type member.
101:             * @return the network type
102:             */
103:            public String getNettype() {
104:                return nettype;
105:            }
106:
107:            /**
108:             * Gets the address type member.
109:             * @return the target address
110:             */
111:            public String getAddrtype() {
112:                return addrtype;
113:            }
114:
115:            /**
116:             * Gets the host member.
117:             * @return the host
118:             */
119:            public Host getHost() {
120:                return address;
121:            }
122:
123:            /**
124:             * Sets the session identifier member.
125:             * @param s the new session identifier
126:             */
127:            public void setSessId(long s) {
128:                sessId = s;
129:            }
130:
131:            /**
132:             * Sets the session version member.
133:             * @param s the new session version number
134:             */
135:            public void setSessVersion(long s) {
136:                sessVersion = s;
137:            }
138:
139:            /**
140:             * Sets the network type member.
141:             * @param n the new network type
142:             */
143:            public void setNettype(String n) {
144:                nettype = n;
145:            }
146:
147:            /**
148:             * Sets the address type member.
149:             * @param a the new address type
150:             */
151:            public void setAddrtype(String a) {
152:                addrtype = a;
153:            }
154:
155:            /**
156:             * Sets the address member.
157:             * @param a the new address
158:             */
159:            public void setAddress(Host a) {
160:                address = a;
161:            }
162:
163:            /**
164:             * Sets the name of the session originator.
165:             * @param user the string username.
166:             * @throws SdpException if the parameter is null
167:             */
168:            public void setUsername(String user) throws SdpException {
169:                if (user == null)
170:                    throw new SdpException("The user parameter is null");
171:                else {
172:                    this .username = user;
173:                }
174:            }
175:
176:            /**
177:             * Returns the unique identity of the session.
178:             * @throws SdpParseException if a parsing error occurs
179:             * @return the session id.
180:             */
181:            public long getSessionId() throws SdpParseException {
182:                return getSessId();
183:            }
184:
185:            /**
186:             * Sets the unique identity of the session.
187:             * @param id the session id.
188:             * @throws SdpException if the id is less than 0
189:             */
190:            public void setSessionId(long id) throws SdpException {
191:                if (id < 0)
192:                    throw new SdpException("The is parameter is < 0");
193:                else
194:                    setSessId(id);
195:            }
196:
197:            /**
198:             * Returns the unique version of the session.
199:             * @throws SdpException if the session version is not set
200:             * @return the session version.
201:             */
202:            public long getSessionVersion() throws SdpParseException {
203:                return getSessVersion();
204:            }
205:
206:            /**
207:             * Sets the unique version of the session.
208:             * @param version the session version.
209:             * @throws SdpException if the version is  less than 0
210:             */
211:            public void setSessionVersion(long version) throws SdpException {
212:                if (version < 0)
213:                    throw new SdpException("The version parameter is < 0");
214:                else
215:                    setSessVersion(version);
216:            }
217:
218:            /**
219:             * Returns the type of the network for this Connection.
220:             * @throws SdpParseException if a parsing error occurs
221:             * @return the string network type.
222:             */
223:            public String getAddress() throws SdpParseException {
224:                Host addr = getHost();
225:                if (addr == null)
226:                    return null;
227:                else
228:                    return addr.getAddress();
229:            }
230:
231:            /**
232:             * Returns the type of the address for this Connection.
233:             * @throws SdpParseException if a parsing error occurs
234:             * @return the string address type.
235:             */
236:            public String getAddressType() throws SdpParseException {
237:                return getAddrtype();
238:            }
239:
240:            /** 
241:             * Returns the type of the network for this Connection
242:             * @throws SdpParseException if a parsing error occurs
243:             * @return the string network type.
244:             */
245:            public String getNetworkType() throws SdpParseException {
246:                return getNettype();
247:            }
248:
249:            /**
250:             * Sets the type of the address for this Connection.
251:             * @param addr string address type.
252:             * @throws SdpException if the addr is null
253:             */
254:            public void setAddress(String addr) throws SdpException {
255:                if (addr == null)
256:                    throw new SdpException("The addr parameter is null");
257:                else {
258:                    Host host = getHost();
259:                    if (host == null)
260:                        host = new Host();
261:                    host.setAddress(addr);
262:                    setAddress(host);
263:                }
264:            }
265:
266:            /**
267:             * Returns the type of the network for this Connection.
268:             * @param type the string network type.
269:             * @throws SdpException if the type is null
270:             */
271:            public void setAddressType(String type) throws SdpException {
272:                if (type == null)
273:                    throw new SdpException("The type parameter is < 0");
274:                else
275:                    setAddrtype(type);
276:            }
277:
278:            /**
279:             * Sets the type of the network for this Connection.
280:             * @param type the string network type.
281:             * @throws SdpException if the type is null
282:             */
283:            public void setNetworkType(String type) throws SdpException {
284:                if (type == null)
285:                    throw new SdpException("The type parameter is < 0");
286:                else
287:                    setNettype(type);
288:            }
289:
290:            /**
291:             * Gets the string encoded version of this object.
292:             * @return encode string of object contents
293:             * @since v1.0
294:             */
295:            public String encode() {
296:                return ORIGIN_FIELD + username + Separators.SP + sessId
297:                        + Separators.SP + sessVersion + Separators.SP + nettype
298:                        + Separators.SP + addrtype + Separators.SP
299:                        + address.encode() + Separators.NEWLINE;
300:            }
301:
302:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.