Class RuntimeContext


  • public final class RuntimeContext
    extends Object
    The Ceres Runtime class provides access to the system module, which can be used to access the runtime's configuration and all of its current modules.
    • Constructor Detail

      • RuntimeContext

        public RuntimeContext()
    • Method Detail

      • isAvailable

        public static boolean isAvailable()
        Checks the status of the runtime's one and only system module.
        Returns:
        true if the runtime is available.
      • getConfig

        public static RuntimeConfig getConfig()
        Gets the runtime configuration. The method returns null if the runtime is not available.
        Returns:
        The runtime configuration, or null.
      • getModuleContext

        public static ModuleContext getModuleContext()
        Gets the context of the runtime's one and only system module. The method returns null if the runtime is not available. This is the case if the Ceres runtime is either not used at all or the system module has not yet been started or it has already been stopped.
        Returns:
        The runtime's system module context, or null.
      • getResources

        public static Enumeration<URL> getResources​(String resourceName)
                                             throws IOException
        Finds all the resources within all runtime modules with the given name. A resource is some data (images, audio, text, etc) that can be accessed by class code in a way that is independent of the location of the code.

        The name of a resource is a /-separated path name that identifies the resource.

        Parameters:
        resourceName - The resource name
        Returns:
        An enumeration of URL objects for the resource. If no resources could be found, the enumeration will be empty. Resources that the module runtime doesn't have access to will not be in the enumeration.
        Throws:
        IOException - If I/O errors occur
        Since:
        0.14
        See Also:
        ClassLoader.getResources(String)