Class AppService

All Implemented Interfaces:
CtxEventListener, ContextHandleAware, HandleAware, Ready, ReadyListener

public final class AppService extends AbstractService
Service that manages applications within kOS.
Since:
1.0
Version:
2023-03-06
  • Field Details

  • Method Details

    • onDependenciesReady

      public void onDependenciesReady()
      Description copied from class: ReadyBean
      Override of the ReadyListener interface. This will call onBeanReady() and returning true will cause this bean to be marked ready. Overriding onBeanReady is much safer as it explicitly indicates ready or not whereas overriding this method requires the caller to remember to call super.onDependenciesReady() or explicitly call setReady() which is error prone.
      Specified by:
      onDependenciesReady in interface ReadyListener
      Overrides:
      onDependenciesReady in class ReadyBean
    • loadApp

      public AppLoader loadApp(KabFile kab, Application<?> parent)
      Attempts to load the specified application. The specified KAB must contain a properly formed kos.app section in the descriptor. Typically applications are packaged in kabs of type "kos.app" but this is not required unless they are part of kos.app.* or kos.autostart.* sections.

      If a parent application is specified, the new application class loader and bean context will use the parent application class loader and bean context as parents. This allows the new application to access classes and beans from the parent application.

      The resulting loader can be used to start the app by calling loader.start() . This allows the application context to be modified before the application is started, which is an effective way to pass data to an application.

      Parameters:
      kab - the application KAB
      parent - optional parent application
      Returns:
      AppLoader used to start the app
    • loadApp

      public AppLoader loadApp(LoadableApp app, Application<?> parent)
      Attempts to load the specified LoadableApp .

      If a parent application is specified, the new application class loader and bean context will use the parent application class loader and bean context as parents. This allows the new application to access classes and beans from the parent application.

      The resulting loader can be used to start the app by calling loader.start() . This allows the application context to be modified before the application is started, which is an effective way to pass data to an application.

      Parameters:
      app - the app to load
      parent - optional parent application
      Returns:
      AppLoader used to start the app
    • loadApp

      public AppLoader loadApp(ResolvedManifestSection section, Application<?> parent)
      Attempts to load an application contained in the specified manifest section. This searches the section for a KAB file of type kos.app , and then loads that application using the supplied section as the section bound to the application.

      If a parent application is specified, the new application class loader and bean context will use the parent application class loader and bean context as parents. This allows the new application to access classes and beans from the parent application.

      The resulting loader can be used to start the app by calling loader.start() . This allows the application context to be modified before the application is started, which is an effective way to pass data to an application.

      Parameters:
      section - the section containing an application KAB
      parent - optional parent application
      Returns:
      AppLoader used to start the app
    • loadApp

      public AppLoader loadApp(KabFile kab, ResolvedManifestSection section, Application<?> parent)
      Attempts to load the specified application with the specified manifest section. The application will have access to this section to search for other artifacts which may be required by the application. Typically, the section is the section the application is contained in, but it is possible to pass a different section, allowing external logic to bind an application with data contained in a different section.

      If a parent application is specified, the new application class loader and bean context will use the parent application class loader and bean context as parents. This allows the new application to access classes and beans from the parent application.

      The specified KAB file must have a properly formed kos.app section in the descriptor.

      The resulting loader can be used to start the app by calling loader.start() . This allows the application context to be modified before the application is started, which is an effective way to pass data to an application.

      Parameters:
      kab - the application KAB
      section - the section to bind to the application
      parent - optional parent application
      Returns:
      AppLoader used to start the app
    • unloadApp

      public void unloadApp(AppLoader loader)
      Unloads the application associated with the given loader.
    • getAutostartApps

      public Collection<LoadableApp> getAutostartApps()
      Return the list of auto-started applications from the manifest. These are defined in sections with a "kos.autostart." prefix.
    • getApps

      public Collection<LoadableApp> getApps()
      Return the list of discovered applications in the manifest. These are defined in sections with a "kos.app." prefix.