org.apache.felix.framework
Class URLHandlersStreamHandlerProxy

java.lang.Object
  extended by java.net.URLStreamHandler
      extended by org.apache.felix.framework.URLHandlersStreamHandlerProxy
All Implemented Interfaces:
InvocationHandler, URLStreamHandlerSetter

public class URLHandlersStreamHandlerProxy
extends URLStreamHandler
implements URLStreamHandlerSetter, 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
URLHandlersStreamHandlerProxy(String protocol, SecureAction action, URLStreamHandler builtIn, URL builtInURL)
           
 
Method Summary
protected  boolean equals(URL url1, URL url2)
           
protected  int getDefaultPort()
           
protected  InetAddress getHostAddress(URL url)
           
protected  int hashCode(URL url)
           
protected  boolean hostsEqual(URL url1, URL url2)
           
 Object invoke(Object obj, Method method, Object[] params)
           
protected  URLConnection openConnection(URL url)
           
protected  URLConnection openConnection(URL url, Proxy proxy)
           
protected  void parseURL(URL url, String spec, int start, int limit)
           
protected  boolean sameFile(URL url1, URL url2)
           
 void setURL(URL url, String protocol, String host, int port, String file, String ref)
           
 void setURL(URL url, String protocol, String host, int port, String authority, String userInfo, String path, String query, String ref)
           
protected  String toExternalForm(URL url)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

URLHandlersStreamHandlerProxy

public URLHandlersStreamHandlerProxy(String protocol,
                                     SecureAction action,
                                     URLStreamHandler builtIn,
                                     URL builtInURL)
Method Detail

equals

protected boolean equals(URL url1,
                         URL url2)
Overrides:
equals in class URLStreamHandler

getDefaultPort

protected int getDefaultPort()
Overrides:
getDefaultPort in class URLStreamHandler

getHostAddress

protected InetAddress getHostAddress(URL url)
Overrides:
getHostAddress in class URLStreamHandler

hashCode

protected int hashCode(URL url)
Overrides:
hashCode in class URLStreamHandler

hostsEqual

protected boolean hostsEqual(URL url1,
                             URL url2)
Overrides:
hostsEqual in class URLStreamHandler

openConnection

protected URLConnection openConnection(URL url)
                                throws IOException
Specified by:
openConnection in class URLStreamHandler
Throws:
IOException

openConnection

protected URLConnection openConnection(URL url,
                                       Proxy proxy)
                                throws IOException
Throws:
IOException

parseURL

protected void parseURL(URL url,
                        String spec,
                        int start,
                        int limit)
Overrides:
parseURL in class URLStreamHandler

sameFile

protected boolean sameFile(URL url1,
                           URL url2)
Overrides:
sameFile in class URLStreamHandler

setURL

public void setURL(URL url,
                   String protocol,
                   String host,
                   int port,
                   String authority,
                   String userInfo,
                   String path,
                   String query,
                   String ref)
Specified by:
setURL in interface URLStreamHandlerSetter
Overrides:
setURL in class URLStreamHandler
See Also:
"java.net.URLStreamHandler.setURL(URL,String,String,int,String,String,String,String)"

setURL

public void setURL(URL url,
                   String protocol,
                   String host,
                   int port,
                   String file,
                   String ref)
Specified by:
setURL in interface URLStreamHandlerSetter
See Also:
"java.net.URLStreamHandler.setURL(URL,String,String,int,String,String)"

toExternalForm

protected String toExternalForm(URL url)
Overrides:
toExternalForm in class URLStreamHandler

invoke

public Object invoke(Object obj,
                     Method method,
                     Object[] params)
              throws Throwable
Specified by:
invoke in interface InvocationHandler
Throws:
Throwable


Copyright © 2013 The Apache Software Foundation. All Rights Reserved.