Interface | Description |
---|---|
Killable |
Classes implementing this interface get notified once the framework is being shut down.
|
Startable |
Classes implementing this interface get notified once the framework is started.
|
Stoppable |
Classes implementing this interface get notified once the framework is being shut down.
|
Class | Description |
---|---|
Classpath |
Retrieves a filtered list of resources in the classpath.
|
DockerHelper |
Initializes Docker Composer if requested by the framework.
|
Setup |
Used to configure the setup of the SIRIUS framework.
|
Sirius |
Loads and initializes the framework.
|
Enum | Description |
---|---|
Setup.Mode |
Determines the mode in which the framework should run.
|
In order to start and stop the SIRIUS framework, Sirius.start(sirius.kernel.Setup)
and
Sirius.stop()
can be invoked. Setup
can be subclassed to
provide further tweaking of the framework behaviour.
The Classpath
is responsible for discovering all classes and resources within the
classpath of the application. It will scan all classpath roots which contain a component.marker
file.
An example is the Timers
which calls components in regular intervals.
In order to use this service, an appropriate interface like EveryMinute
has be implemented. Everything else is take care of be the framework.
In order to support discovery for an implementation the class has to wear a Register
annotation. To provide your own services utilizing discovery, fields can be annotated with
Parts
which is then automatically filled with all components implementing the given
interface.
Note that the Part/Register mechanism can also be used for classic Dependency Injection (Filling a single dependency at runtime just referring to it by an interface.)
Also note that the annotations Part, Parts and Register are itself extensions
to the IoC (inversion of control) micro kernel (see sirius.kernel.di.std
).
Therefore own annotations can be easily added.
Sirius.getSettings()
. Also the annotation ConfigValue
can be
placed on a field of a registered component to automatically fill it with the appropriate config value.
Extensions provide a way to have several config files contribute to one section which is then consumed by a service.
An example of this would be the CacheManager
which permits to define caches used
throughout the application. To declare the behaviour of a Cache
an extension
has to be placed in any config file which contributes to cache.[name]:
cache {
my-cache {
maxSize = 100
ttl = 1 hour
}
}
If a value is omitted the default value (in this case defined in component-kernel.conf) will be applied.
The order in which the configs are loaded is the following (can be customized by overriding
Setup
) - config files can always redefine values of their predecessors:
Using this layout, all default values can be declared in the appropriate component-[name].conf rather than be buried somewhere in the Java code. This makes maintaining and discovering them quite easy.
sirius.frameworks.kernel.timer = false
. By default this the timer is
active (see component-kernel.conf). To provide custom frameworks which can be dis- or enabled a default value
has to be defined in the component-[name].conf). Then it can be used as
Register.framework()
in the appropriate components. If the framework is not enabled,
these component will be ignored by SIRIUS.
A customization is defined by putting all classes into a package named customizations.[name]. All
resources for this customization have to be placed in the folder customizations/[name]. Now analog to
frameworks the config property sirius.customizations
- which is a list, so that several
customizations can be active at once.
Now if a customization is active, all resources present override the default resources and all classes
wearing a Register
annotation are loaded. Note that a customization can even
re-register and therefore replace a default component registered for the same type. Finally, the
settings.conf within the customization is loaded (overriding application.conf, but not instance.conf).
Copyright © 2018. All rights reserved.