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_PREFIX

    Fields inherited from interface org.jboss.msc.service.Service

    NULL
  • Method Summary

    Modifier and Type
    Method
    Description
    org.jboss.modules.ModuleIdentifier
    addExternalModule(String moduleName, String path, org.jboss.msc.service.ServiceRegistry serviceRegistry, org.jboss.msc.service.ServiceTarget serviceTarget)
    Prepares and install a new ModuleIdentifier and ExternalModuleSpecService to manage this module.
    org.jboss.modules.ModuleIdentifier
    addExternalModule(String path, org.jboss.msc.service.ServiceRegistry serviceRegistry, org.jboss.msc.service.ServiceTarget serviceTarget)
    Prepares and install a new ModuleIdentifier and ExternalModuleSpecService to manage this module.
    addExternalModuleAsString(String moduleName, String path, org.jboss.msc.service.ServiceRegistry serviceRegistry, org.jboss.msc.service.ServiceTarget serviceTarget)
    Prepares and install a new Module Identifier string and ExternalModuleSpecService to manage this module.
    addExternalModuleAsString(String path, org.jboss.msc.service.ServiceRegistry serviceRegistry, org.jboss.msc.service.ServiceTarget serviceTarget)
    Prepares and install a new module and ExternalModuleSpecService to manage this module.
    static void
    addService(org.jboss.msc.service.ServiceTarget serviceTarget, org.jboss.msc.service.ServiceName externalModuleServiceName)
     
     
    boolean
    Checks if the path argument refers to a file and the file is valid to be used as a class-path entry.
    void
    start(org.jboss.msc.service.StartContext context)
     
    void
    stop(org.jboss.msc.service.StopContext context)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • isValidFile

      public boolean isValidFile(String path)
      Description copied from interface: ExternalModule
      Checks if the path argument refers to a file and the file is valid to be used as a class-path entry.
      Specified by:
      isValidFile in interface ExternalModule
      Parameters:
      path - value to test.
      Returns:
      true if and only if the path refers to a file and the file is considered valid as a class-path entry, otherwise returns false.
    • addExternalModule

      public org.jboss.modules.ModuleIdentifier addExternalModule(String path, org.jboss.msc.service.ServiceRegistry serviceRegistry, org.jboss.msc.service.ServiceTarget serviceTarget)
      Description copied from interface: ExternalModule
      Prepares and install a new ModuleIdentifier and ExternalModuleSpecService to 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:
      addExternalModule in interface ExternalModule
      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 be null
      serviceRegistry - The MSC service registry which will be used to find if there is already an ExternalModuleSpecService created for the given path. Cannot be null.
      serviceTarget - The ServiceTarget to use to install the service. Cannot be null.
      Returns:
      The ModuleIdentifier created for the given path.
    • addExternalModuleAsString

      public String addExternalModuleAsString(String path, org.jboss.msc.service.ServiceRegistry serviceRegistry, org.jboss.msc.service.ServiceTarget serviceTarget)
      Description copied from interface: ExternalModule
      Prepares and install a new module and ExternalModuleSpecService to 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:
      addExternalModuleAsString in interface ExternalModule
      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 be null
      serviceRegistry - The MSC service registry which will be used to find if there is already an ExternalModuleSpecService created for the given path. Cannot be null.
      serviceTarget - The ServiceTarget to use to install the service. Cannot be null.
      Returns:
      The string representing the Module Identifier created for the given path.
    • addExternalModule

      public org.jboss.modules.ModuleIdentifier addExternalModule(String moduleName, String path, org.jboss.msc.service.ServiceRegistry serviceRegistry, org.jboss.msc.service.ServiceTarget serviceTarget)
      Description copied from interface: ExternalModule
      Prepares and install a new ModuleIdentifier and ExternalModuleSpecService to 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:
      addExternalModule in interface ExternalModule
      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 be null
      serviceRegistry - The MSC service registry which will be used to find if there is already an ExternalModuleSpecService created for the given module name. Cannot be null.
      serviceTarget - The ServiceTarget to use to install the service. Cannot be null.
      Returns:
      The ModuleIdentifier created for the given module name.
    • addExternalModuleAsString

      public String addExternalModuleAsString(String moduleName, String path, org.jboss.msc.service.ServiceRegistry serviceRegistry, org.jboss.msc.service.ServiceTarget serviceTarget)
      Description copied from interface: ExternalModule
      Prepares and install a new Module Identifier string and ExternalModuleSpecService to 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:
      addExternalModuleAsString in interface ExternalModule
      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 be null
      serviceRegistry - The MSC service registry which will be used to find if there is already an ExternalModuleSpecService created for the given module name. Cannot be null.
      serviceTarget - The ServiceTarget to use to install the service. Cannot be null.
      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:
      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
    • getValue

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

      public static void addService(org.jboss.msc.service.ServiceTarget serviceTarget, org.jboss.msc.service.ServiceName externalModuleServiceName)