public class Sirius extends Object
This can be considered the stage2 when booting the framework, as it is responsible to discover and
initialize all components. Call start(Setup)
to initialize the framework.
To make a jar or other classpath-root visible to SIRIUS an empty file called "component.marker" must be placed in its root directory.
Modifier and Type | Field and Description |
---|---|
static Log |
DEBUG
This debug logger will be logging all messages when
isDev() is true. |
protected static Log |
LOG |
static String |
SIRIUS_TEST_SCENARIO_PROPERTY
Contains the name of the system property which is used to select which scenario to execute.
|
Modifier and Type | Method and Description |
---|---|
static int |
compareCustomizations(String configA,
String configB)
Compares the two given customizations according to the order given in the system config.
|
static List<String> |
getActiveConfigurations()
Returns a list of all active customer configurations.
|
static Classpath |
getClasspath()
Provides access to the classpath used to load the framework.
|
static String |
getCustomizationName(String resource)
Extracts the customization name from a resource.
|
static ExtendedSettings |
getSettings()
Returns the system config based on the current instance.conf (file system), application.conf (classpath) and
all component-XXX.conf wrapped as Settings
|
static Setup |
getSetup()
Provides access to the setup instance which was used to configure Sirius.
|
static long |
getUptimeInMilliseconds()
Returns the up time of the system in milliseconds.
|
static boolean |
isActiveCustomization(String configName)
Determines if the given config is active (or null which is considered active)
|
static boolean |
isCustomizationResource(String resource)
Determines if the given resource is part of a customization.
|
static boolean |
isDev()
Determines if the framework is running in development or in production mode.
|
static boolean |
isFrameworkEnabled(String framework)
Determines if the framework with the given name is enabled.
|
static boolean |
isProd()
Determines if the framework is running in development or in production mode.
|
static boolean |
isStartedAsTest()
Determines if the framework was started as test run (JUNIT or the like).
|
static void |
start(Setup setup)
Initializes the framework.
|
static void |
stop()
Stops the framework.
|
public static final String SIRIUS_TEST_SCENARIO_PROPERTY
protected static final Log LOG
public static boolean isDev()
true
is the framework runs in development mode, false otherwise.public static boolean isStartedAsTest()
public static boolean isProd()
true
is the framework runs in production mode, false otherwise.public static Classpath getClasspath()
public static void stop()
public static void start(Setup setup)
This is called by IPL.main once the class loader is fully populated.
setup
- the setup class used to configure the frameworkpublic static boolean isFrameworkEnabled(String framework)
Frameworks can be enabled or disabled using the config path sirius.framework.[name]. This is intensively used by the app part, as it provides a lot of basic frameworks which can be turned off or on as required.
framework
- the framework to checkpublic static List<String> getActiveConfigurations()
A customer configuration can be used to override basic functionality with more specialized classes or resources which were adapted based on customer needs.
As often groups of customers share the same requirements, not only a single configuration can be activated but a list. Within this list each configuration may override classes and resources of all former configurations. Therefore the last configuration will always "win".
Note that classes must be placed in the package: configuration.[name] (with arbitrary sub packages). Also resources must be placed in: configuration/[name]/resource-path.
public static boolean isActiveCustomization(@Nullable String configName)
configName
- the name of the config to check. null will be considered as activepublic static boolean isCustomizationResource(@Nullable String resource)
resource
- the resource path to check@Nullable public static String getCustomizationName(@Nullable String resource)
Valid names are paths like "customizations/[name]/..." or classes like "customizations.[name]...".
resource
- the name of the resourcepublic static int compareCustomizations(@Nullable String configA, @Nullable String configB)
configA
- the name of the first customizationconfigB
- the name of the second customizationpublic static ExtendedSettings getSettings()
public static Setup getSetup()
public static long getUptimeInMilliseconds()
Copyright © 2018. All rights reserved.