Class PlurlImpl
- All Implemented Interfaces:
Plurl
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclass
static interface
class
class
class
class
-
Field Summary
Fields inherited from interface org.eclipse.equinox.plurl.Plurl
PLURL_ADD_CONTENT_HANDLER_FACTORY, PLURL_ADD_URL_STREAM_HANDLER_FACTORY, PLURL_FORBID_NOTHING, PLURL_OP, PLURL_PROTOCOL, PLURL_REGISTER_IMPLEMENTATION, PLURL_REMOVE_CONTENT_HANDLER_FACTORY, PLURL_REMOVE_URL_STREAM_HANDLER_FACTORY, PLURL_UNREGISTER_IMPLEMENTATION
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetStaticField
(Class<?> clazz, Class<?> type) void
Installs the plurl factories into the JVM singletons.void
If this plurl instance is the primordial factory for the JVM then uninstall is a no-op and the plurl instance will remain set with the JVM for the lifetime of the JVM instance.
-
Constructor Details
-
PlurlImpl
public PlurlImpl()
-
-
Method Details
-
install
Description copied from interface:Plurl
Installs the plurl factories into the JVM singletons. If plurl factories are already installed then this plurl instance isregistered
with the existing plurl instance set with the JVM by using something like the following:((Consumer<Object>) ("plurl://op/plurlRegisterImplementation").getContent()).accept(this);
If the plurl factories cannot be installed then anIllegalStateException
is thrown.If the JVM singletons are already set with other factories that are not plurl then an attempt is made to override the JVM singletons with this plurl instance. This may only be possible if the implementation is allowed to do deep reflection on the
java.net
package. If the JVM singletons are overriden then the original singleton factory instances must be used as parent factories of the plurl instance until the plurl instance isuninstalled
. if overriding the JVM singletons is not possible then anIllegalStateException
is thrown.If the JVM singletons were not overriden then this plurl instance is considered the primordial singleton factory for the JVM. Such a plurl instance cannot be
uninstalled
and will live the lifetime of the JVM.When this method returns without throwing an exception then the following will be true:
- The singleton
URL.setURLStreamHandlerFactory(URLStreamHandlerFactory)
is set with a plurl implementation which delegates to thePlurlStreamHandlerFactory
objects that have beenadded
. - The singleton
URLConnection.setContentHandlerFactory(ContentHandlerFactory)
is set with a plurl implementation which delegates to thePlurlContentHandlerFactory
objects that have beenadded
. - The
plurl
protocol is available for creatingURL
objects. - If plurl factories are already installed then this plurl implementation is registered as a delegate with the already installed plurl instance.
- Specified by:
install
in interfacePlurl
- Parameters:
forbidden
- builtin JVM protocols that cannot be overridden by plurl. If no forbidden protocols are specified then the default forbidden protocols are 'jar', 'jmod', 'file', and 'jrt'. To forbid no protocols then use the valuePlurl.PLURL_FORBID_NOTHING
- The singleton
-
uninstall
public void uninstall()Description copied from interface:Plurl
If this plurl instance is the primordial factory for the JVM then uninstall is a no-op and the plurl instance will remain set with the JVM for the lifetime of the JVM instance.If this plurl is not the primordial factory and is the current plurl set with the JVM singletons then this plurl instance must do the following:
- Reset the original parent factories as the singleton factories of the JVM
- If there are any other plurl instances that got
registered
with this plurl instance then one of the registered plurl instances must be selected to be the next delegate plurl instance toinstall
. - If a delegate plurl instance gets installed then any existing factories
that were added to this plurl instance must be added to the new delegate
plurl instance and any
registered
plurl instances must be registered with the new delegate plurl instance. - This plurl instance must release all references to other factories or plurl instances.
registered
with the existing plurl instance set with the JVM by using something like the following:((Consumer<Object>) ("plurl://op/plurlRegisterImplementation").getContent()).accept(this);
-
getStaticField
-