Source Code Cross Referenced for URIWrapper.java in  » Content-Management-System » harmonise » org » openharmonise » commons » net » 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 » Content Management System » harmonise » org.openharmonise.commons.net 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * The contents of this file are subject to the 
003:         * Mozilla Public License Version 1.1 (the "License"); 
004:         * you may not use this file except in compliance with the License. 
005:         * You may obtain a copy of the License at http://www.mozilla.org/MPL/
006:         *
007:         * Software distributed under the License is distributed on an "AS IS"
008:         * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. 
009:         * See the License for the specific language governing rights and 
010:         * limitations under the License.
011:         *
012:         * The Initial Developer of the Original Code is Simulacra Media Ltd.
013:         * Portions created by Simulacra Media Ltd are Copyright (C) Simulacra Media Ltd, 2004.
014:         *
015:         * All Rights Reserved.
016:         *
017:         * Contributor(s):
018:         */
019:        package org.openharmonise.commons.net;
020:
021:        import java.net.*;
022:        import java.util.*;
023:        import java.util.logging.*;
024:
025:        /**
026:         * Wraps the <code>java.net.URI</code> implementation and adds some useful
027:         * utility methods.
028:         * 
029:         * @author Matthew Large
030:         * @version $Revision: 1.1 $
031:         *
032:         */
033:        public class URIWrapper {
034:
035:            /**
036:             * Wrapped URI.
037:             */
038:            private URI m_uri = null;
039:
040:            /**
041:             * List of segments in URI.
042:             */
043:            private ArrayList m_aSegments = new ArrayList();
044:
045:            /**
046:             * Logger for this class.
047:             */
048:            private static final Logger m_logger = Logger
049:                    .getLogger(URIWrapper.class.getName());
050:
051:            /**
052:             * Constructs an object representing the given URI.
053:             * 
054:             * @param uri URI to be represented
055:             */
056:            public URIWrapper(String uri) {
057:                try {
058:                    this .m_uri = new URI(uri);
059:                } catch (URISyntaxException e) {
060:                    m_logger.log(Level.WARNING, e.getLocalizedMessage(), e);
061:                }
062:                this .setup();
063:            }
064:
065:            /**
066:             * Constructs a URI from the given components.
067:             * 
068:             * @param scheme Scheme name
069:             * @param ssp Scheme-specific part
070:             * @param fragment Fragment
071:             */
072:            public URIWrapper(String scheme, String ssp, String fragment) {
073:                try {
074:                    this .m_uri = new URI(scheme, ssp, fragment);
075:                } catch (URISyntaxException e) {
076:                    m_logger.log(Level.WARNING, e.getLocalizedMessage(), e);
077:                }
078:                this .setup();
079:            }
080:
081:            /**
082:             * Constructs a URI from the given components.
083:             * 
084:             * @param   scheme    Scheme name
085:             * @param   userInfo  User name and authorization information
086:             * @param   host      Host name
087:             * @param   port      Port number
088:             * @param   path      Path
089:             * @param   query     Query
090:             * @param   fragment  Fragment
091:             */
092:            public URIWrapper(String scheme, String userInfo, String host,
093:                    int port, String path, String query, String fragment) {
094:                try {
095:                    this .m_uri = new URI(scheme, userInfo, host, port, path,
096:                            query, fragment);
097:                } catch (URISyntaxException e) {
098:                    m_logger.log(Level.WARNING, e.getLocalizedMessage(), e);
099:                }
100:                this .setup();
101:            }
102:
103:            /**
104:             * Constructs a hierarchical URI from the given components.
105:             * 
106:             * @param   scheme    Scheme name
107:             * @param   host      Host name
108:             * @param   path      Path
109:             * @param   fragment  Fragment
110:             */
111:            public URIWrapper(String scheme, String host, String path,
112:                    String fragment) {
113:                try {
114:                    this .m_uri = new URI(scheme, host, path, fragment);
115:                } catch (URISyntaxException e) {
116:                    m_logger.log(Level.WARNING, e.getLocalizedMessage(), e);
117:                }
118:                this .setup();
119:            }
120:
121:            /**
122:             * 
123:             * Constructs a hierarchical URI from the given components.
124:             * 
125:             * @param   scheme     Scheme name
126:             * @param   authority  Authority
127:             * @param   path       Path
128:             * @param   query      Query
129:             * @param   fragment   Fragment
130:             */
131:            public URIWrapper(String scheme, String authority, String path,
132:                    String query, String fragment) {
133:                try {
134:                    this .m_uri = new URI(scheme, authority, path, query,
135:                            fragment);
136:                } catch (URISyntaxException e) {
137:                    m_logger.log(Level.WARNING, e.getLocalizedMessage(), e);
138:                }
139:                this .setup();
140:            }
141:
142:            /**
143:             * Sets up the member variables using the path of the URI.
144:             *
145:             */
146:            private void setup() {
147:                StringTokenizer sTok = new StringTokenizer(this .getPath(), "/",
148:                        false);
149:                while (sTok.hasMoreElements()) {
150:                    this .m_aSegments.add((String) sTok.nextElement());
151:                }
152:            }
153:
154:            /**
155:             * Delegate method.
156:             * 
157:             * @see java.net.URI#create(String)
158:             */
159:            public static URI create(String arg0) {
160:                return URI.create(arg0);
161:            }
162:
163:            /**
164:             * Delegate method.
165:             * 
166:             * @see java.net.URI#compareTo(Object)
167:             */
168:            public int compareTo(Object arg0) {
169:                return m_uri.compareTo(arg0);
170:            }
171:
172:            /* (non-Javadoc)
173:             * @see java.lang.Object#equals(java.lang.Object)
174:             */
175:            public boolean equals(Object arg0) {
176:                return m_uri.equals(arg0);
177:            }
178:
179:            /**
180:             * Delegate method.
181:             * 
182:             * @see java.net.URI#getAuthority()
183:             */
184:            public String getAuthority() {
185:                return m_uri.getAuthority();
186:            }
187:
188:            /**
189:             * Delegate method.
190:             * 
191:             * @see java.net.URI#getFragment()
192:             */
193:            public String getFragment() {
194:                return m_uri.getFragment();
195:            }
196:
197:            /**
198:             * Delegate method.
199:             * 
200:             * @see java.net.URI#getHost()
201:             */
202:            public String getHost() {
203:                return m_uri.getHost();
204:            }
205:
206:            /**
207:             * Delegate method.
208:             * 
209:             * @see java.net.URI#getPath()
210:             */
211:            public String getPath() {
212:                return m_uri.getPath();
213:            }
214:
215:            /**
216:             * Returns a list of the path segments for this URI
217:             * 
218:             * @return list of <code>String</code>s
219:             */
220:            public List getPathSegments() {
221:                return (List) m_aSegments.clone();
222:            }
223:
224:            /**
225:             * Delegate method.
226:             * 
227:             * @see java.net.URI#getPort()
228:             */
229:            public int getPort() {
230:                return m_uri.getPort();
231:            }
232:
233:            /**
234:             * Delegate method.
235:             * 
236:             * @see java.net.URI#getQuery()
237:             */
238:            public String getQuery() {
239:                return m_uri.getQuery();
240:            }
241:
242:            /**
243:             * Delegate method.
244:             * 
245:             * @see java.net.URI#getRawAuthority()
246:             */
247:            public String getRawAuthority() {
248:                return m_uri.getRawAuthority();
249:            }
250:
251:            /**
252:             * Delegate method.
253:             * 
254:             * @see java.net.URI#getRawFragment()
255:             */
256:            public String getRawFragment() {
257:                return m_uri.getRawFragment();
258:            }
259:
260:            /**
261:             * Delegate method.
262:             * 
263:             * @see java.net.URI#getRawPath()
264:             */
265:            public String getRawPath() {
266:                return m_uri.getRawPath();
267:            }
268:
269:            /**
270:             * Delegate method.
271:             * 
272:             * @see java.net.URI#getRawQuery()
273:             */
274:            public String getRawQuery() {
275:                return m_uri.getRawQuery();
276:            }
277:
278:            /**
279:             * Delegate method.
280:             * 
281:             * @see java.net.URI#getRawSchemeSpecificPart()
282:             */
283:            public String getRawSchemeSpecificPart() {
284:                return m_uri.getRawSchemeSpecificPart();
285:            }
286:
287:            /**
288:             * Delegate method.
289:             * 
290:             * @see java.net.URI#getRawUserInfo()
291:             */
292:            public String getRawUserInfo() {
293:                return m_uri.getRawUserInfo();
294:            }
295:
296:            /**
297:             * Delegate method.
298:             * 
299:             * @see java.net.URI#getScheme()
300:             */
301:            public String getScheme() {
302:                return m_uri.getScheme();
303:            }
304:
305:            /**
306:             * Delegate method.
307:             * 
308:             * @see java.net.URI#getSchemeSpecificPart()
309:             */
310:            public String getSchemeSpecificPart() {
311:                return m_uri.getSchemeSpecificPart();
312:            }
313:
314:            /**
315:             * Delegate method.
316:             * 
317:             * @see java.net.URI#getUserInfo()
318:             */
319:            public String getUserInfo() {
320:                return m_uri.getUserInfo();
321:            }
322:
323:            /* (non-Javadoc)
324:             * @see java.lang.Object#hashCode()
325:             */
326:            public int hashCode() {
327:                return m_uri.hashCode();
328:            }
329:
330:            /**
331:             * Delegate method.
332:             * 
333:             * @see java.net.URI#isAbsolute()
334:             */
335:            public boolean isAbsolute() {
336:                return m_uri.isAbsolute();
337:            }
338:
339:            /**
340:             * Delegate method.
341:             * 
342:             * @see java.net.URI#isOpaque()
343:             */
344:            public boolean isOpaque() {
345:                return m_uri.isOpaque();
346:            }
347:
348:            /**
349:             * Delegate method.
350:             * 
351:             * @see java.net.URI#normalize()
352:             */
353:            public URI normalize() {
354:                return m_uri.normalize();
355:            }
356:
357:            /**
358:             * Delegate method.
359:             * 
360:             * @see java.net.URI#parseServerAuthority()
361:             */
362:            public URI parseServerAuthority() throws URISyntaxException {
363:                return m_uri.parseServerAuthority();
364:            }
365:
366:            /**
367:             * Delegate method.
368:             * 
369:             * @see java.net.URI#relativize(URI)
370:             */
371:            public URI relativize(URI arg0) {
372:                return m_uri.relativize(arg0);
373:            }
374:
375:            /**
376:             * Delegate method.
377:             * 
378:             * @see java.net.URI#resolve(String)
379:             */
380:            public URI resolve(String arg0) {
381:                return m_uri.resolve(arg0);
382:            }
383:
384:            /**
385:             * Delegate method.
386:             * 
387:             * @see java.net.URI#resolve(URI)
388:             */
389:            public URI resolve(URI arg0) {
390:                return m_uri.resolve(arg0);
391:            }
392:
393:            /**
394:             * Delegate method.
395:             * 
396:             * @see java.net.URI#toASCIIString()
397:             */
398:            public String toASCIIString() {
399:                return m_uri.toASCIIString();
400:            }
401:
402:            /* (non-Javadoc)
403:             * @see java.lang.Object#toString()
404:             */
405:            public String toString() {
406:                return m_uri.toString();
407:            }
408:
409:            /**
410:             * Delegate method.
411:             * 
412:             * @see java.net.URI#toURL()
413:             */
414:            public URL toURL() throws MalformedURLException {
415:                return m_uri.toURL();
416:            }
417:
418:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.