KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > osgi > service > url > AbstractURLStreamHandlerService


1 /*
2  * $Header: /cvshome/build/org.osgi.service.url/src/org/osgi/service/url/AbstractURLStreamHandlerService.java,v 1.8 2006/06/16 16:31:31 hargrave Exp $
3  *
4  * Copyright (c) OSGi Alliance (2002, 2006). All Rights Reserved.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */

18
19 package org.osgi.service.url;
20
21 import java.net.*;
22
23 /**
24  * Abstract implementation of the <code>URLStreamHandlerService</code> interface.
25  * All the methods simply invoke the corresponding methods on
26  * <code>java.net.URLStreamHandler</code> except for <code>parseURL</code> and
27  * <code>setURL</code>, which use the <code>URLStreamHandlerSetter</code>
28  * parameter. Subclasses of this abstract class should not need to override the
29  * <code>setURL</code> and <code>parseURL(URLStreamHandlerSetter,...)</code>
30  * methods.
31  *
32  * @version $Revision: 1.8 $
33  */

34 public abstract class AbstractURLStreamHandlerService extends URLStreamHandler
35         implements URLStreamHandlerService {
36     /**
37      * @see "java.net.URLStreamHandler.openConnection"
38      */

39     public abstract URLConnection openConnection(URL u)
40             throws java.io.IOException JavaDoc;
41
42     /**
43      * The <code>URLStreamHandlerSetter</code> object passed to the parseURL
44      * method.
45      */

46     protected URLStreamHandlerSetter realHandler;
47
48     /**
49      * Parse a URL using the <code>URLStreamHandlerSetter</code> object. This
50      * method sets the <code>realHandler</code> field with the specified
51      * <code>URLStreamHandlerSetter</code> object and then calls
52      * <code>parseURL(URL,String,int,int)</code>.
53      *
54      * @param realHandler The object on which the <code>setURL</code> method must
55      * be invoked for the specified URL.
56      * @see "java.net.URLStreamHandler.parseURL"
57      */

58     public void parseURL(URLStreamHandlerSetter realHandler, URL u,
59             String JavaDoc spec, int start, int limit) {
60         this.realHandler = realHandler;
61         parseURL(u, spec, start, limit);
62     }
63
64     /**
65      * This method calls <code>super.toExternalForm</code>.
66      *
67      * @see "java.net.URLStreamHandler.toExternalForm"
68      */

69     public String JavaDoc toExternalForm(URL u) {
70         return super.toExternalForm(u);
71     }
72
73     /**
74      * This method calls <code>super.equals(URL,URL)</code>.
75      *
76      * @see "java.net.URLStreamHandler.equals(URL,URL)"
77      */

78     public boolean equals(URL u1, URL u2) {
79         return super.equals(u1, u2);
80     }
81
82     /**
83      * This method calls <code>super.getDefaultPort</code>.
84      *
85      * @see "java.net.URLStreamHandler.getDefaultPort"
86      */

87     public int getDefaultPort() {
88         return super.getDefaultPort();
89     }
90
91     /**
92      * This method calls <code>super.getHostAddress</code>.
93      *
94      * @see "java.net.URLStreamHandler.getHostAddress"
95      */

96     public InetAddress getHostAddress(URL u) {
97         return super.getHostAddress(u);
98     }
99
100     /**
101      * This method calls <code>super.hashCode(URL)</code>.
102      *
103      * @see "java.net.URLStreamHandler.hashCode(URL)"
104      */

105     public int hashCode(URL u) {
106         return super.hashCode(u);
107     }
108
109     /**
110      * This method calls <code>super.hostsEqual</code>.
111      *
112      * @see "java.net.URLStreamHandler.hostsEqual"
113      */

114     public boolean hostsEqual(URL u1, URL u2) {
115         return super.hostsEqual(u1, u2);
116     }
117
118     /**
119      * This method calls <code>super.sameFile</code>.
120      *
121      * @see "java.net.URLStreamHandler.sameFile"
122      */

123     public boolean sameFile(URL u1, URL u2) {
124         return super.sameFile(u1, u2);
125     }
126
127     /**
128      * This method calls
129      * <code>realHandler.setURL(URL,String,String,int,String,String)</code>.
130      *
131      * @see "java.net.URLStreamHandler.setURL(URL,String,String,int,String,String)"
132      * @deprecated This method is only for compatibility with handlers written
133      * for JDK 1.1.
134      */

135     protected void setURL(URL u, String JavaDoc proto, String JavaDoc host, int port,
136             String JavaDoc file, String JavaDoc ref) {
137         realHandler.setURL(u, proto, host, port, file, ref);
138     }
139
140     /**
141      * This method calls
142      * <code>realHandler.setURL(URL,String,String,int,String,String,String,String)</code>.
143      *
144      * @see "java.net.URLStreamHandler.setURL(URL,String,String,int,String,String,String,String)"
145      */

146     protected void setURL(URL u, String JavaDoc proto, String JavaDoc host, int port,
147             String JavaDoc auth, String JavaDoc user, String JavaDoc path, String JavaDoc query, String JavaDoc ref) {
148         realHandler.setURL(u, proto, host, port, auth, user, path, query, ref);
149     }
150 }
151
Popular Tags