org.foray.common.url
Class FactoryProtocolRegistration

java.lang.Object
  extended by org.foray.common.url.AbstractProtocolRegistration
      extended by org.foray.common.url.FactoryProtocolRegistration
All Implemented Interfaces:
ProtocolRegistrationStrategy

public class FactoryProtocolRegistration
extends AbstractProtocolRegistration

An implementation of {#link ProtocolHandlerRegistry} which does not attempt to use the "java.protocol.handler.pkgs" property to register new URLStreamHandlers, but instead attempts to use only a URLStreamHandlerFactory.


Constructor Summary
FactoryProtocolRegistration()
          Package-private constructor.
 
Method Summary
 void doRegister(String protocol, URLStreamHandler handler)
          Actually does the registration.
 URLStreamHandler getURLStreamHandler(String protocol)
          Finds the registered URLStreamHandler for a given protocol.
 boolean isValid()
          Indicates whether the factory protocol registration is usable.
 
Methods inherited from class org.foray.common.url.AbstractProtocolRegistration
registerProtocolHandler
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FactoryProtocolRegistration

public FactoryProtocolRegistration()
Package-private constructor. Use ProtocolRegistrationBroker.setStandardRegistrationStrategy(int) to use this standard registration scheme.

Method Detail

doRegister

public void doRegister(String protocol,
                       URLStreamHandler handler)
Description copied from class: AbstractProtocolRegistration
Actually does the registration. This is a hook for subclasses so that they perform what is needed for their particular implementations.

Parameters:
protocol - The protocol to be registered.
handler - The stream handler for the registered protocol.

isValid

public boolean isValid()
Indicates whether the factory protocol registration is usable.

Returns:
True iff The factory protocal registration is usable.

getURLStreamHandler

public URLStreamHandler getURLStreamHandler(String protocol)
Description copied from interface: ProtocolRegistrationStrategy
Finds the registered URLStreamHandler for a given protocol.

Parameters:
protocol - The protocol for which a URLStreamHandler is desired.
Returns:
The URLStreamHandler registered with this registration scheme, or null if the protocol has not been registered.


Copyright © 2017. All rights reserved.