Class 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
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      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 moduleName, org.jboss.msc.service.ServiceRegistry serviceRegistry, org.jboss.msc.service.ServiceTarget serviceTarget)
      Prepares and install a new ModuleIdentifier and ExternalModuleSpecService to manage this module.
      static void addService​(org.jboss.msc.service.ServiceTarget serviceTarget, org.jboss.msc.service.ServiceName externalModuleServiceName)  
      ExternalModuleService getValue()  
      boolean isValidFile​(String path)
      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)  
    • Method Detail

      • 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 moduleName,
                                                                    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:
        moduleName - 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.
      • 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.
      • 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
      • addService

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