Class PlurlImpl

java.lang.Object
org.eclipse.equinox.plurl.impl.PlurlImpl
All Implemented Interfaces:
Plurl

public final class PlurlImpl extends Object implements Plurl
  • Constructor Details

    • PlurlImpl

      public PlurlImpl()
  • Method Details

    • install

      public void install(String... forbidden)
      Description copied from interface: Plurl
      Installs the plurl factories into the JVM singletons. If plurl factories are already installed then this plurl instance is registered 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 an IllegalStateException 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 is uninstalled. if overriding the JVM singletons is not possible then an IllegalStateException 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:

      1. The singleton URL.setURLStreamHandlerFactory(URLStreamHandlerFactory) is set with a plurl implementation which delegates to the PlurlStreamHandlerFactory objects that have been added.
      2. The singleton URLConnection.setContentHandlerFactory(ContentHandlerFactory) is set with a plurl implementation which delegates to the PlurlContentHandlerFactory objects that have been added.
      3. The plurl protocol is available for creating URL objects.
      4. 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 interface Plurl
      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 value Plurl.PLURL_FORBID_NOTHING
    • 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:

      1. Reset the original parent factories as the singleton factories of the JVM
      2. 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 to install.
      3. 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.
      4. This plurl instance must release all references to other factories or plurl instances.
      If this plurl instance is not the current plurl set with JVM then this plurl registered with the existing plurl instance set with the JVM by using something like the following:
       ((Consumer<Object>) ("plurl://op/plurlRegisterImplementation").getContent()).accept(this);
       
      Specified by:
      uninstall in interface Plurl
    • getStaticField

      public Field getStaticField(Class<?> clazz, Class<?> type)