Class ExtensionIndexService
- All Implemented Interfaces:
ExtensionIndex,org.jboss.msc.Service,org.jboss.msc.service.Service<ExtensionIndex>,org.jboss.msc.value.Value<ExtensionIndex>
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 Summary
FieldsFields inherited from interface org.jboss.msc.service.Service
NULL -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddDeployedExtension(String identifier, ExtensionInfo extensionInfo) Adds an extension that has been deployed to the serverfindExtensionAsString(String name, String minSpecVersion, String minImplVersion, String requiredVendorId) Find the identifier of an extension module, returningnullif no matching extension is available.getValue()booleanremoveDeployedExtension(String name, String identifier) Removes extension information that has been deployed to the servervoidstart(org.jboss.msc.service.StartContext context) voidstop(org.jboss.msc.service.StopContext context)
-
Field Details
-
MODULE_PREFIX
- See Also:
-
-
Constructor Details
-
ExtensionIndexService
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:
startin interfaceorg.jboss.msc.Service- Throws:
org.jboss.msc.service.StartException
-
stop
public void stop(org.jboss.msc.service.StopContext context) - Specified by:
stopin interfaceorg.jboss.msc.Service
-
addDeployedExtension
Description copied from interface:ExtensionIndexAdds an extension that has been deployed to the server- Specified by:
addDeployedExtensionin interfaceExtensionIndex- Parameters:
identifier- The module identifier of the extensionextensionInfo- The extension data
-
removeDeployedExtension
Description copied from interface:ExtensionIndexRemoves extension information that has been deployed to the server- Specified by:
removeDeployedExtensionin interfaceExtensionIndex- Parameters:
name- The extension nameidentifier- 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:ExtensionIndexFind the identifier of an extension module, returningnullif no matching extension is available.- Specified by:
findExtensionAsStringin interfaceExtensionIndex- Parameters:
name- the extension nameminSpecVersion- the minimum spec version to match, ornullto match anyminImplVersion- the minimum implementation version to match, ornullto match anyrequiredVendorId- the vendor ID to require, ornullto match any- Returns:
- the module identifier of the extension found.
-
getValue
- Specified by:
getValuein interfaceorg.jboss.msc.value.Value<ExtensionIndex>- Throws:
IllegalStateExceptionIllegalArgumentException
-