Source Code Cross Referenced for Protocol.java in  » Web-Services » restlet-1.0.8 » org » restlet » data » 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 » Web Services » restlet 1.0.8 » org.restlet.data 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2005-2007 Noelios Consulting.
003:         * 
004:         * The contents of this file are subject to the terms of the Common Development
005:         * and Distribution License (the "License"). You may not use this file except in
006:         * compliance with the License.
007:         * 
008:         * You can obtain a copy of the license at
009:         * http://www.opensource.org/licenses/cddl1.txt See the License for the specific
010:         * language governing permissions and limitations under the License.
011:         * 
012:         * When distributing Covered Code, include this CDDL HEADER in each file and
013:         * include the License file at http://www.opensource.org/licenses/cddl1.txt If
014:         * applicable, add the following below this CDDL HEADER, with the fields
015:         * enclosed by brackets "[]" replaced with your own identifying information:
016:         * Portions Copyright [yyyy] [name of copyright owner]
017:         */
018:
019:        package org.restlet.data;
020:
021:        /**
022:         * Protocol used by client and server connectors. Connectors enable the
023:         * communication between components by implementing standard protocols.
024:         * 
025:         * @author Jerome Louvel (contact@noelios.com)
026:         */
027:        public final class Protocol extends Metadata {
028:
029:            /** Indicates that the port number is undefined. */
030:            public static final int UNKNOWN_PORT = -1;
031:
032:            /** All protocols wildcard. */
033:            public static final Protocol ALL = new Protocol("all", "ALL",
034:                    "Wildcard for all protocols", UNKNOWN_PORT);
035:
036:            /**
037:             * AJP 1.3 protocol to communicate with Apache HTTP server or Microsoft IIS.
038:             */
039:            public static final Protocol AJP = new Protocol("ajp", "AJP",
040:                    "Apache Jakarta Protocol", 8009);
041:
042:            /**
043:             * CLAP (ClassLoader Access Protocol) is a custom scheme to access to
044:             * representations via classloaders. Example URI:
045:             * "clap://thread/org/restlet/Restlet.class".<br>
046:             * <br>
047:             * In order to work, CLAP requires a client connector provided by the core
048:             * Restlet engine.
049:             * 
050:             * @see org.restlet.data.LocalReference
051:             */
052:            public static final Protocol CLAP = new Protocol("clap", "CLAP",
053:                    "Class Loader Access Protocol", UNKNOWN_PORT);
054:
055:            /** Local Web Archive access protocol. */
056:            public static final Protocol WAR = new Protocol("war", "WAR",
057:                    "Web Archive Access Protocol", UNKNOWN_PORT);
058:
059:            /** Local file system access protocol. */
060:            public static final Protocol FILE = new Protocol("file", "FILE",
061:                    "Local File System Protocol", UNKNOWN_PORT);
062:
063:            /**
064:             * FILE is a standard scheme to access to representations stored in the file
065:             * system (locally most of the time). Example URI:
066:             * "file:///D/root/index.html".<br>
067:             * <br>
068:             * In order to work, FILE requires a client connector provided by the core
069:             * Restlet engine.
070:             * 
071:             * @see org.restlet.data.LocalReference
072:             */
073:            public static final Protocol FTP = new Protocol("ftp", "FTP",
074:                    "File Transfer Protocol", 21);
075:
076:            /** HTTP protocol. */
077:            public static final Protocol HTTP = new Protocol("http", "HTTP",
078:                    "HyperText Transport Protocol", 80);
079:
080:            /** HTTPS protocol (via SSL socket). */
081:            public static final Protocol HTTPS = new Protocol("https", "HTTPS",
082:                    "HyperText Transport Protocol (Secure)", 443);
083:
084:            /**
085:             * JAR (Java ARchive) is a common scheme to access to representations inside
086:             * archive files. Example URI:
087:             * "jar:http://www.foo.com/bar/baz.jar!/COM/foo/Quux.class".
088:             * 
089:             * @see org.restlet.data.LocalReference
090:             */
091:            public static final Protocol JAR = new Protocol("jar", "JAR",
092:                    "Java ARchive", UNKNOWN_PORT);
093:
094:            /** JDBC protocol. */
095:            public static final Protocol JDBC = new Protocol("jdbc", "JDBC",
096:                    "Java DataBase Connectivity", UNKNOWN_PORT);
097:
098:            /** SMTP protocol. */
099:            public static final Protocol SMTP = new Protocol("smtp", "SMTP",
100:                    "Simple Mail Transfer Protocol", 25);
101:
102:            /** SMTP with STARTTLS protocol (started with a plain socket). */
103:            public static final Protocol SMTP_STARTTLS = new Protocol(
104:                    "smtp",
105:                    "SMTP_STARTTLS",
106:                    "Simple Mail Transfer Protocol (starting a TLS encryption)",
107:                    25);
108:
109:            /** SMTPS protocol (via SSL/TLS socket). */
110:            public static final Protocol SMTPS = new Protocol("smtps", "SMTPS",
111:                    "Simple Mail Transfer Protocol (Secure)", 465);
112:
113:            /**
114:             * Creates the protocol associated to a URI scheme name. If an existing
115:             * constant exists then it is returned, otherwise a new instance is created.
116:             * 
117:             * @param schemeName
118:             *                The scheme name.
119:             * @return The associated protocol.
120:             */
121:            public static Protocol valueOf(final String schemeName) {
122:                Protocol result = null;
123:
124:                if (schemeName != null) {
125:                    if (schemeName.equalsIgnoreCase(AJP.getSchemeName()))
126:                        result = AJP;
127:                    else if (schemeName.equalsIgnoreCase(WAR.getSchemeName()))
128:                        result = WAR;
129:                    else if (schemeName.equalsIgnoreCase(FILE.getSchemeName()))
130:                        result = FILE;
131:                    else if (schemeName.equalsIgnoreCase(HTTP.getSchemeName()))
132:                        result = HTTP;
133:                    else if (schemeName.equalsIgnoreCase(HTTPS.getSchemeName()))
134:                        result = HTTPS;
135:                    else if (schemeName.equalsIgnoreCase(JDBC.getSchemeName()))
136:                        result = JDBC;
137:                    else if (schemeName.equalsIgnoreCase(SMTP.getSchemeName()))
138:                        result = SMTP;
139:                    else if (schemeName.equalsIgnoreCase(SMTPS.getSchemeName()))
140:                        result = SMTPS;
141:                    else
142:                        result = new Protocol(schemeName);
143:                }
144:
145:                return result;
146:            }
147:
148:            /** The scheme name. */
149:            private String schemeName;
150:
151:            /** The default port if known or -1. */
152:            private int defaultPort;
153:
154:            /**
155:             * Constructor.
156:             * 
157:             * @param schemeName
158:             *                The scheme name.
159:             */
160:            public Protocol(final String schemeName) {
161:                this (schemeName, schemeName.toUpperCase(), schemeName
162:                        .toUpperCase()
163:                        + " Protocol", UNKNOWN_PORT);
164:            }
165:
166:            /**
167:             * Constructor.
168:             * 
169:             * @param schemeName
170:             *                The scheme name.
171:             * @param name
172:             *                The unique name.
173:             * @param description
174:             *                The description.
175:             * @param defaultPort
176:             *                The default port.
177:             */
178:            public Protocol(final String schemeName, final String name,
179:                    final String description, int defaultPort) {
180:                super (name, description);
181:                this .schemeName = schemeName;
182:                this .defaultPort = defaultPort;
183:            }
184:
185:            /** {@inheritDoc} */
186:            @Override
187:            public boolean equals(final Object object) {
188:                return (object instanceof  Protocol)
189:                        && getName().equalsIgnoreCase(
190:                                ((Protocol) object).getName());
191:            }
192:
193:            /**
194:             * Returns the default port number.
195:             * 
196:             * @return The default port number.
197:             */
198:            public int getDefaultPort() {
199:                return this .defaultPort;
200:            }
201:
202:            /**
203:             * Returns the URI scheme name.
204:             * 
205:             * @return The URI scheme name.
206:             */
207:            public String getSchemeName() {
208:                return this .schemeName;
209:            }
210:
211:            /** {@inheritDoc} */
212:            @Override
213:            public int hashCode() {
214:                return (getName() == null) ? 0 : getName().toLowerCase()
215:                        .hashCode();
216:            }
217:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.