public class ParaViewProxyFactory extends java.lang.Object implements IParaViewProxyFactory
IParaViewProxyFactory
.
This implementation provides an additional feature: If multiple builders
support the same extensions, then for each shared extension, the most
recently registered builder will be returned in #getProxyBuilder(URI)
. Furthermore, when that builder is unregistered, its supported extensions
will fall back to the previously registered builder for that extension.
Constructor and Description |
---|
ParaViewProxyFactory()
The default constructor.
|
Modifier and Type | Method and Description |
---|---|
IParaViewProxy |
createProxy(java.net.URI uri)
Gets a proxy for the provided file based on its extension.
|
java.util.Set<java.lang.String> |
getExtensions()
Gets the set of supported extensions for all registered proxy builders.
|
boolean |
registerProxyBuilder(IParaViewProxyBuilder builder)
Registers a new proxy builder using the builder's supported extensions.
|
boolean |
unregisterProxyBuilder(IParaViewProxyBuilder builder)
Unregisters the specified proxy builder.
|
public ParaViewProxyFactory()
Note: This class should be instantiated by OSGi!
public IParaViewProxy createProxy(java.net.URI uri) throws java.lang.NullPointerException, java.lang.IllegalArgumentException
IParaViewProxyFactory
createProxy
in interface IParaViewProxyFactory
uri
- The file for which a proxy will be created.java.lang.NullPointerException
- If the specified URI is null.java.lang.IllegalArgumentException
- If the specified URI's extension is not supported.public java.util.Set<java.lang.String> getExtensions()
IParaViewProxyFactory
getExtensions
in interface IParaViewProxyFactory
null
, and should not change throughout
the factory's lifecycle, as builders will be registered via OSGi.public boolean registerProxyBuilder(IParaViewProxyBuilder builder)
IParaViewProxyFactory
This method will usually be called by OSGi.
registerProxyBuilder
in interface IParaViewProxyFactory
builder
- The builder to register. If null
, nothing is
registered.public boolean unregisterProxyBuilder(IParaViewProxyBuilder builder)
IParaViewProxyFactory
This method will usually be called by OSGi.
unregisterProxyBuilder
in interface IParaViewProxyFactory
builder
- The builder to unregister. If null
, nothing is
unregistered.