Class URLHandlersStreamHandlerProxy
- java.lang.Object
-
- java.net.URLStreamHandler
-
- org.apache.felix.framework.URLHandlersStreamHandlerProxy
-
- All Implemented Interfaces:
java.lang.reflect.InvocationHandler,URLStreamHandlerSetter
public class URLHandlersStreamHandlerProxy extends java.net.URLStreamHandler implements URLStreamHandlerSetter, java.lang.reflect.InvocationHandler
This class implements a stream handler proxy. When the stream handler proxy instance is created, it is associated with a particular protocol and will answer all future requests for handling of that stream type. It does not directly handle the stream handler requests, but delegates the requests to an underlying stream handler service.
The proxy instance for a particular protocol is used for all framework instances that may contain their own stream handler services. When performing a stream handler operation, the proxy retrieves the handler service from the framework instance associated with the current call stack and delegates the call to the handler service.
The proxy will create simple stream handler service trackers for each framework instance. The trackers will listen to service events in its respective framework instance to maintain a reference to the "best" stream handler service at any given time.
-
-
Constructor Summary
Constructors Constructor Description URLHandlersStreamHandlerProxy(java.lang.String protocol, SecureAction action, java.net.URLStreamHandler builtIn, java.net.URL builtInURL)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleanequals(java.net.URL url1, java.net.URL url2)protected intgetDefaultPort()protected java.net.InetAddressgetHostAddress(java.net.URL url)protected inthashCode(java.net.URL url)protected booleanhostsEqual(java.net.URL url1, java.net.URL url2)java.lang.Objectinvoke(java.lang.Object obj, java.lang.reflect.Method method, java.lang.Object[] params)protected java.net.URLConnectionopenConnection(java.net.URL url)protected java.net.URLConnectionopenConnection(java.net.URL url, java.net.Proxy proxy)protected voidparseURL(java.net.URL url, java.lang.String spec, int start, int limit)protected booleansameFile(java.net.URL url1, java.net.URL url2)voidsetURL(java.net.URL url, java.lang.String protocol, java.lang.String host, int port, java.lang.String file, java.lang.String ref)voidsetURL(java.net.URL url, java.lang.String protocol, java.lang.String host, int port, java.lang.String authority, java.lang.String userInfo, java.lang.String path, java.lang.String query, java.lang.String ref)protected java.lang.StringtoExternalForm(java.net.URL url)
-
-
-
Constructor Detail
-
URLHandlersStreamHandlerProxy
public URLHandlersStreamHandlerProxy(java.lang.String protocol, SecureAction action, java.net.URLStreamHandler builtIn, java.net.URL builtInURL)
-
-
Method Detail
-
equals
protected boolean equals(java.net.URL url1, java.net.URL url2)- Overrides:
equalsin classjava.net.URLStreamHandler
-
getDefaultPort
protected int getDefaultPort()
- Overrides:
getDefaultPortin classjava.net.URLStreamHandler
-
getHostAddress
protected java.net.InetAddress getHostAddress(java.net.URL url)
- Overrides:
getHostAddressin classjava.net.URLStreamHandler
-
hashCode
protected int hashCode(java.net.URL url)
- Overrides:
hashCodein classjava.net.URLStreamHandler
-
hostsEqual
protected boolean hostsEqual(java.net.URL url1, java.net.URL url2)- Overrides:
hostsEqualin classjava.net.URLStreamHandler
-
openConnection
protected java.net.URLConnection openConnection(java.net.URL url) throws java.io.IOException- Specified by:
openConnectionin classjava.net.URLStreamHandler- Throws:
java.io.IOException
-
openConnection
protected java.net.URLConnection openConnection(java.net.URL url, java.net.Proxy proxy) throws java.io.IOException- Overrides:
openConnectionin classjava.net.URLStreamHandler- Throws:
java.io.IOException
-
parseURL
protected void parseURL(java.net.URL url, java.lang.String spec, int start, int limit)- Overrides:
parseURLin classjava.net.URLStreamHandler
-
sameFile
protected boolean sameFile(java.net.URL url1, java.net.URL url2)- Overrides:
sameFilein classjava.net.URLStreamHandler
-
setURL
public void setURL(java.net.URL url, java.lang.String protocol, java.lang.String host, int port, java.lang.String authority, java.lang.String userInfo, java.lang.String path, java.lang.String query, java.lang.String ref)- Specified by:
setURLin interfaceURLStreamHandlerSetter- Overrides:
setURLin classjava.net.URLStreamHandler- See Also:
- "java.net.URLStreamHandler.setURL(URL,String,String,int,String,String,String,String)"
-
setURL
public void setURL(java.net.URL url, java.lang.String protocol, java.lang.String host, int port, java.lang.String file, java.lang.String ref)- Specified by:
setURLin interfaceURLStreamHandlerSetter- Overrides:
setURLin classjava.net.URLStreamHandler- See Also:
- "java.net.URLStreamHandler.setURL(URL,String,String,int,String,String)"
-
toExternalForm
protected java.lang.String toExternalForm(java.net.URL url)
- Overrides:
toExternalFormin classjava.net.URLStreamHandler
-
invoke
public java.lang.Object invoke(java.lang.Object obj, java.lang.reflect.Method method, java.lang.Object[] params) throws java.lang.Throwable- Specified by:
invokein interfacejava.lang.reflect.InvocationHandler- Throws:
java.lang.Throwable
-
-