Class ExternalModuleService
java.lang.Object
org.jboss.as.server.moduleservice.ExternalModuleService
- All Implemented Interfaces:
ExternalModule,org.jboss.msc.Service,org.jboss.msc.service.Service<ExternalModuleService>,org.jboss.msc.value.Value<ExternalModuleService>
public class ExternalModuleService
extends Object
implements org.jboss.msc.service.Service<ExternalModuleService>, ExternalModule
Service that manages external modules.
Once external modules are installed there is currently no way to safely remove the module spec service, however as they are
on-demand services if all dependent services are stopped then the actual Module will be unloaded.
TODO: support removing modules when msc can tell us that nothing depends on the service.
- Author:
- Stuart Douglas, Ales Justin
-
Field Summary
Fields inherited from interface org.jboss.as.server.moduleservice.ExternalModule
EXTERNAL_MODULE_PREFIXFields inherited from interface org.jboss.msc.service.Service
NULL -
Method Summary
Modifier and TypeMethodDescriptionaddExternalModuleAsString(String moduleName, String path, org.jboss.msc.service.ServiceRegistry serviceRegistry, org.jboss.msc.service.ServiceTarget serviceTarget) Prepares and install a new Module Identifier string andExternalModuleSpecServiceto manage this module.addExternalModuleAsString(String path, org.jboss.msc.service.ServiceRegistry serviceRegistry, org.jboss.msc.service.ServiceTarget serviceTarget) Prepares and install a new module andExternalModuleSpecServiceto manage this module.static voidaddService(org.jboss.msc.service.ServiceTarget serviceTarget, org.jboss.msc.service.ServiceName externalModuleServiceName) getValue()booleanisValidFile(String path) Checks if the path argument refers to a file and the file is valid to be used as a class-path entry.voidstart(org.jboss.msc.service.StartContext context) voidstop(org.jboss.msc.service.StopContext context)
-
Method Details
-
isValidFile
Description copied from interface:ExternalModuleChecks if the path argument refers to a file and the file is valid to be used as a class-path entry.- Specified by:
isValidFilein interfaceExternalModule- Parameters:
path- value to test.- Returns:
trueif and only if the path refers to a file and the file is considered valid as a class-path entry, otherwise returnsfalse.
-
addExternalModuleAsString
public String addExternalModuleAsString(String path, org.jboss.msc.service.ServiceRegistry serviceRegistry, org.jboss.msc.service.ServiceTarget serviceTarget) Description copied from interface:ExternalModulePrepares and install a new module andExternalModuleSpecServiceto manage this module.This method does not use a specific module name, instead the module name is derived from the given path. This method prevents the creation of duplicate external module spec services for the given path looking at the service registry, so it can be called multiple times using the same path.
- Specified by:
addExternalModuleAsStringin interfaceExternalModule- Parameters:
path- An absolute path pointing out to a directory or jar file that will be used as source for the resources backed by the given module name we want to install. Cannot benullserviceRegistry- The MSC service registry which will be used to find if there is already anExternalModuleSpecServicecreated for the given path. Cannot benull.serviceTarget- TheServiceTargetto use to install the service. Cannot benull.- Returns:
- The string representing the Module Identifier created for the given path.
-
addExternalModuleAsString
public String addExternalModuleAsString(String moduleName, String path, org.jboss.msc.service.ServiceRegistry serviceRegistry, org.jboss.msc.service.ServiceTarget serviceTarget) Description copied from interface:ExternalModulePrepares and install a new Module Identifier string andExternalModuleSpecServiceto manage this module. This method prevents the creation of duplicate external module spec services for the given module name looking at the service registry, so it can be called multiple times for the same module name.- Specified by:
addExternalModuleAsStringin interfaceExternalModule- Parameters:
moduleName- The module name to add.path- An absolute path pointing out to a directory or jar file that will be used as source for the resources backed by the given module name we want to install. Cannot benullserviceRegistry- The MSC service registry which will be used to find if there is already anExternalModuleSpecServicecreated for the given module name. Cannot benull.serviceTarget- TheServiceTargetto use to install the service. Cannot benull.- Returns:
- The Module Identifier as a String of the module created for the given path.
-
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
-
getValue
- Specified by:
getValuein interfaceorg.jboss.msc.value.Value<ExternalModuleService>- Throws:
IllegalStateExceptionIllegalArgumentException
-
addService
public static void addService(org.jboss.msc.service.ServiceTarget serviceTarget, org.jboss.msc.service.ServiceName externalModuleServiceName)
-