Source Code Cross Referenced for ConnectionField.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:         * Connectin Field of the SDP request.
034:         *
035:         * @version JSR141-PUBLIC-REVIEW (subject to change).
036:         *
037:         *
038:         * <a href="{@docRoot}/uncopyright.html">This code is in the public domain.</a>
039:         *
040:         */
041:        public class ConnectionField extends SDPField {
042:            /** Network type. */
043:            protected String nettype;
044:            /** Address type. */
045:            protected String addrtype;
046:            /** Connection address. */
047:            protected ConnectionAddress address;
048:
049:            /**
050:             * Copies the current instance.
051:             * @return the copy of this object
052:             */
053:            public Object clone() {
054:                ConnectionField retval = new ConnectionField();
055:                retval.nettype = this .nettype;
056:                retval.addrtype = this .addrtype;
057:                if (this .address != null)
058:                    retval.address = (ConnectionAddress) this .address.clone();
059:                return retval;
060:            }
061:
062:            /** Default constructor. */
063:
064:            public ConnectionField() {
065:                super (SDPFieldNames.CONNECTION_FIELD);
066:            }
067:
068:            /**
069:             * Gets the network type.
070:             * @return the network type
071:             */
072:            public String getNettype() {
073:                return nettype;
074:            }
075:
076:            /**
077:             * Gets the address type.
078:             * @return the address type
079:             */
080:            public String getAddrtype() {
081:                return addrtype;
082:            }
083:
084:            /**
085:             * Gets the network connection address.
086:             * @return the connection address
087:             */
088:            public ConnectionAddress getConnectionAddress() {
089:                return address;
090:            }
091:
092:            /**
093:             * Sets the network type member.
094:             * @param n the new network type
095:             */
096:            public void setNettype(String n) {
097:                nettype = n;
098:            }
099:
100:            /**
101:             * Sets the address type member.
102:             * @param a the new address type
103:             */
104:            public void setAddrType(String a) {
105:                addrtype = a;
106:            }
107:
108:            /**
109:             * Sets the address member.
110:             * @param a the new connectio address
111:             */
112:            public void setAddress(ConnectionAddress a) {
113:                address = a;
114:            }
115:
116:            /**
117:             * Gets the string encoded version of this object.
118:             * @return the encoded text string of this object contents
119:             * @since v1.0
120:             */
121:            public String encode() {
122:                String encoded_string = CONNECTION_FIELD;
123:                if (nettype != null)
124:                    encoded_string += nettype;
125:                if (addrtype != null)
126:                    encoded_string += Separators.SP + addrtype;
127:                if (address != null)
128:                    encoded_string += Separators.SP + address.encode();
129:                return encoded_string += Separators.NEWLINE;
130:            }
131:
132:            /**
133:             * Encodes contents as a textstring.
134:             * @return encoded string of object contents
135:             */
136:            public String toString() {
137:                return this .encode();
138:            }
139:
140:            /**
141:             * Returns the type of the network for this Connection.
142:             * @throws SdpParseException if a parsing error occurs
143:             * @return the type of the network
144:             */
145:            public String getAddress() throws SdpParseException {
146:                ConnectionAddress connectionAddress = getConnectionAddress();
147:                if (connectionAddress == null)
148:                    return null;
149:                else {
150:                    Host host = connectionAddress.getAddress();
151:                    if (host == null)
152:                        return null;
153:                    else
154:                        return host.getAddress();
155:                }
156:            }
157:
158:            /**
159:             * Returns the type of the address for this Connection.
160:             * @throws SdpParseException if a parsing error occurs
161:             * @return the type of the address
162:             */
163:            public String getAddressType() throws SdpParseException {
164:                return getAddrtype();
165:            }
166:
167:            /**
168:             * Returns the type of the network for this Connection.
169:             * @throws SdpParseException if a parsing error occurs
170:             * @return the type of the network
171:             */
172:            public String getNetworkType() throws SdpParseException {
173:                return getNettype();
174:            }
175:
176:            /**
177:             * Sets the type of the address for this Connection.
178:             * @param addr to set
179:             * @throws SdpException if the type is null
180:             */
181:            public void setAddress(String addr) throws SdpException {
182:                if (addr == null)
183:                    throw new SdpException("the addr is null");
184:                else {
185:                    if (address == null) {
186:                        address = new ConnectionAddress();
187:                        Host host = new Host(addr);
188:                        address.setAddress(host);
189:                    } else {
190:                        Host host = address.getAddress();
191:                        if (host == null) {
192:                            host = new Host(addr);
193:                            address.setAddress(host);
194:                        } else
195:                            host.setAddress(addr);
196:                    }
197:                    setAddress(address);
198:                }
199:            }
200:
201:            /**
202:             * Returns the type of the network for this Connection.
203:             * @param type to set
204:             * @throws SdpException if the type is null
205:             */
206:            public void setAddressType(String type) throws SdpException {
207:                if (type == null)
208:                    throw new SdpException("the type is null");
209:                this .addrtype = type;
210:            }
211:
212:            /**
213:             * Sets the type of the network for this Connection.
214:             * @param type to set
215:             * @throws SdpException if the type is null
216:             */
217:            public void setNetworkType(String type) throws SdpException {
218:                if (type == null)
219:                    throw new SdpException("the type is null");
220:                else
221:                    setNettype(type);
222:            }
223:
224:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.