Class AppService
- All Implemented Interfaces:
CtxEventListener
,ContextHandleAware
,HandleAware
,Ready
,ReadyListener
- Since:
- 1.0
- Version:
- 2023-03-06
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptiongetApps()
Return the list of discovered applications in the manifest.Return the list of auto-started applications from the manifest.loadApp
(KabFile kab, ResolvedManifestSection section, Application<?> parent) Attempts to load the specified application with the specified manifest section.loadApp
(KabFile kab, Application<?> parent) Attempts to load the specified application.loadApp
(ResolvedManifestSection section, Application<?> parent) Attempts to load an application contained in the specified manifest section.loadApp
(LoadableApp app, Application<?> parent) Attempts to load the specifiedLoadableApp
.void
Override of theReadyListener
interface.void
Unloads the application associated with the given loader.Methods inherited from class com.tccc.kos.commons.core.service.AbstractService
getHandle, getHandlePrefix
Methods inherited from class com.tccc.kos.commons.util.ready.ReadyBean
getReady, onBeanReady
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.tccc.kos.commons.core.context.CtxEventListener
onCtxAutowiringCompleted, onCtxDestroyed, onCtxPhaseCompleted
Methods inherited from interface com.tccc.kos.commons.core.service.handle.HandleAware
addHandleChild, getName, getPath
Methods inherited from interface com.tccc.kos.commons.util.ready.ReadyListener
onDependenciesGroupReady
-
Field Details
-
SYSTEM_SECTION
- See Also:
-
SECTION_PREFIX_APP
- See Also:
-
SECTION_PREFIX_AUTOSTART
- See Also:
-
SYSTEM_APP_ID
- See Also:
-
-
Method Details
-
onDependenciesReady
public void onDependenciesReady()Description copied from class:ReadyBean
Override of theReadyListener
interface. This will callonBeanReady()
and returning true will cause this bean to be marked ready. OverridingonBeanReady
is much safer as it explicitly indicates ready or not whereas overriding this method requires the caller to remember to callsuper.onDependenciesReady()
or explicitly callsetReady()
which is error prone.- Specified by:
onDependenciesReady
in interfaceReadyListener
- Overrides:
onDependenciesReady
in classReadyBean
-
loadApp
Attempts to load the specified application. The specified KAB must contain a properly formedkos.app
section in the descriptor. Typically applications are packaged in kabs of type "kos.app" but this is not required unless they are part ofkos.app.*
orkos.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 KABparent
- optional parent application- Returns:
AppLoader
used to start the app
-
loadApp
Attempts to load the specifiedLoadableApp
.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 loadparent
- optional parent application- Returns:
AppLoader
used to start the app
-
loadApp
Attempts to load an application contained in the specified manifest section. This searches the section for a KAB file of typekos.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 KABparent
- optional parent application- Returns:
AppLoader
used to start the app
-
loadApp
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 KABsection
- the section to bind to the applicationparent
- optional parent application- Returns:
AppLoader
used to start the app
-
unloadApp
Unloads the application associated with the given loader. -
getAutostartApps
Return the list of auto-started applications from the manifest. These are defined in sections with a "kos.autostart." prefix. -
getApps
Return the list of discovered applications in the manifest. These are defined in sections with a "kos.app." prefix.
-