org.ops4j.pax.runner.handler.internal
Class URLStreamHandlerExtender

java.lang.Object
  extended by org.ops4j.pax.runner.handler.internal.URLStreamHandlerExtender
All Implemented Interfaces:
java.net.URLStreamHandlerFactory

public class URLStreamHandlerExtender
extends java.lang.Object
implements java.net.URLStreamHandlerFactory

An extender that implements URLStreamHandlerFactory. Registers/unregisters URLStreamHandlerService as URLStreamHandler's. Note that this is not full proven URL Handler Service implementation. It does just enough to be used in runner.

Since:
August 28, 2007
Author:
Alin Dreghiciu
See Also:
URLStreamHandlerFactory

Constructor Summary
URLStreamHandlerExtender()
          Creates a new extender.
 
Method Summary
 java.net.URLStreamHandler createURLStreamHandler(java.lang.String protocol)
          If there is a registred URLStreamHandlerService for the protocol the URLStreamHandlerService is returned, otherwise will return null, so the JVM will handle as defaut.
 void register(java.lang.String[] protocols, org.osgi.service.url.URLStreamHandlerService urlStreamHandlerService)
          Registres the URLStreamHandlerService as URLStreamHandler.
 void start()
          Registres itself to URL as URLStreamHandlerFactory.
 void unregister(java.lang.String[] protocols)
          Unregistres the URLStreamHandlerService as URLStreamHandler.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

URLStreamHandlerExtender

public URLStreamHandlerExtender()
Creates a new extender.

Method Detail

start

public void start()
Registres itself to URL as URLStreamHandlerFactory. This is not in the constructor as only once per JVM this could be set so we could not do unit tests.


register

public void register(java.lang.String[] protocols,
                     org.osgi.service.url.URLStreamHandlerService urlStreamHandlerService)
Registres the URLStreamHandlerService as URLStreamHandler.

Parameters:
protocols - an array of protocols handled by URLStreamHandlerService
urlStreamHandlerService - an URLStreamHandlerService

unregister

public void unregister(java.lang.String[] protocols)
Unregistres the URLStreamHandlerService as URLStreamHandler.

Parameters:
protocols - an array of protocols handled by URLStreamHandlerService

createURLStreamHandler

public java.net.URLStreamHandler createURLStreamHandler(java.lang.String protocol)
If there is a registred URLStreamHandlerService for the protocol the URLStreamHandlerService is returned, otherwise will return null, so the JVM will handle as defaut.

Specified by:
createURLStreamHandler in interface java.net.URLStreamHandlerFactory
See Also:
URLStreamHandlerFactory.createURLStreamHandler(String)


Copyright © 2006-2011 OPS4J - Open Participation Software for Java. All Rights Reserved.