Class ExtensionIndexService

java.lang.Object
org.jboss.as.server.moduleservice.ExtensionIndexService
All Implemented Interfaces:
ExtensionIndex, org.jboss.msc.Service, org.jboss.msc.service.Service<ExtensionIndex>, org.jboss.msc.value.Value<ExtensionIndex>

public final class ExtensionIndexService extends Object implements org.jboss.msc.service.Service<ExtensionIndex>, ExtensionIndex
An MSC Service that provides an ExtensionIndex. See Jakarta EE Platform Specification, Library Support

This service is responsible for scanning a set of directories for JAR files that contain extensions. By default, lib/ext under the server base directory is scanned. Users can specify additional directories using java.ext.dirs system property, ServerEnvironment.JAVA_EXT_DIRS. For each discovered extension, a module spec service is registered with the MSC container.

In addition to scanning directories, this service also allows the addition and removal of extensions provided by deployed applications. Those extensions are discovered by ManifestExtensionNameProcessor, which inspects the manifest file of the deployment. Those discovered extensions are added to this extension index by ModuleExtensionNameProcessor deployment processor.

Using this mechanism a Jakarta EE application can reference utility classes or other shared classes or resources packaged in a separate .jar file or directory that is included in the same Jakarta EE application package, or that has been previously installed in the Jakarta EE containers.

Author:
David M. Lloyd, Stuart Douglas
  • Field Details

  • Constructor Details

    • ExtensionIndexService

      public ExtensionIndexService(File... roots)
      Construct a new service instance.
      Parameters:
      roots - The directories that will be scanned for JAR files that will be treated as Jakarta EE extensions.
  • Method Details

    • start

      public void start(org.jboss.msc.service.StartContext context) throws org.jboss.msc.service.StartException
      Specified by:
      start in interface org.jboss.msc.Service
      Throws:
      org.jboss.msc.service.StartException
    • stop

      public void stop(org.jboss.msc.service.StopContext context)
      Specified by:
      stop in interface org.jboss.msc.Service
    • addDeployedExtension

      public void addDeployedExtension(String identifier, ExtensionInfo extensionInfo)
      Description copied from interface: ExtensionIndex
      Adds an extension that has been deployed to the server
      Specified by:
      addDeployedExtension in interface ExtensionIndex
      Parameters:
      identifier - The module identifier of the extension
      extensionInfo - The extension data
    • removeDeployedExtension

      public boolean removeDeployedExtension(String name, String identifier)
      Description copied from interface: ExtensionIndex
      Removes extension information that has been deployed to the server
      Specified by:
      removeDeployedExtension in interface ExtensionIndex
      Parameters:
      name - The extension name
      identifier - The extension identifier to remove
      Returns:
      true if the extension was found and removed
    • findExtensionAsString

      public String findExtensionAsString(String name, String minSpecVersion, String minImplVersion, String requiredVendorId)
      Description copied from interface: ExtensionIndex
      Find the identifier of an extension module, returning null if no matching extension is available.
      Specified by:
      findExtensionAsString in interface ExtensionIndex
      Parameters:
      name - the extension name
      minSpecVersion - the minimum spec version to match, or null to match any
      minImplVersion - the minimum implementation version to match, or null to match any
      requiredVendorId - the vendor ID to require, or null to match any
      Returns:
      the module identifier of the extension found.
    • getValue

      Specified by:
      getValue in interface org.jboss.msc.value.Value<ExtensionIndex>
      Throws:
      IllegalStateException
      IllegalArgumentException