Package com.tccc.kos.core.app
Class KosCore
java.lang.Object
com.tccc.kos.core.app.KosCore
Static accessor for a number of core KOS components that are so common
it's inefficient to inject them everywhere they're needed.
Usage Example
Mode mode = KosCore.getMode();
BeanContext ctx = KosCore.getCtx();
- Version:
- 2022-08-31
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringformatISO8601(long ms) Format the epoch time in ms as an ISO-8601 string with fractional second resolution and timezone offset.static AnalyticsServiceReturn theAnalyticsServicein order to log analytic data.static StringgetArch()Returns the arch of this node.static StringReturns the board type of this node.static BeanContextgetCtx()Returns the context for KOS.static StringReturns the device type of the overall device the node is part of.static StringReturns the manufacturer authority of this node.static FileReturn the manufacturer data directory.static FilegetMfgFile(String path) Return aFilefor the specified path in the manufacturer data directory.static ModegetMode()Returns the current operational mode.static NodeIdReturns the ID of the node we're running on.static intgetPort()Returns the port number that KOS is running on.static NodeIdReturns the nodeId of the primary node.static SystemApplication<?>Return the system application.static BeanContextReturns the context for the system app.static StringReturns the vendor authority of this node.static booleanhasProfile(String profile) Returns true if the specified profile is active.static booleanReturns true if we're running on the system's primary node.static booleanisProd()Returns true if the current operational mode is PROD (production).static booleanReturns true if we're running inside the Studio simulator.static booleanisTest()Returns true if the current operational mode is TEST.
-
Method Details
-
hasProfile
Returns true if the specified profile is active.- Parameters:
profile- the profile to check
-
getMode
Returns the current operational mode. -
isTest
public static boolean isTest()Returns true if the current operational mode is TEST. -
isProd
public static boolean isProd()Returns true if the current operational mode is PROD (production). -
isSimulator
public static boolean isSimulator()Returns true if we're running inside the Studio simulator. -
isPrimary
public static boolean isPrimary()Returns true if we're running on the system's primary node. -
getPrimaryNodeId
Returns the nodeId of the primary node. -
getDeviceType
Returns the device type of the overall device the node is part of. -
getVendorAuthority
Returns the vendor authority of this node. -
getMfgAuthority
Returns the manufacturer authority of this node. -
getBoardType
Returns the board type of this node. -
getArch
Returns the arch of this node. -
getCtx
Returns the context for KOS. -
getSystemCtx
Returns the context for the system app. -
getSystemApp
Return the system application. -
getPort
public static int getPort()Returns the port number that KOS is running on. It defaults to 8081. -
getNodeId
Returns the ID of the node we're running on. -
getMfgDir
Return the manufacturer data directory. -
getMfgFile
Return aFilefor the specified path in the manufacturer data directory. -
getAnalytics
Return theAnalyticsServicein order to log analytic data. This avoids the need to autowire the service everywhere. -
formatISO8601
Format the epoch time in ms as an ISO-8601 string with fractional second resolution and timezone offset. This preserves the timezone information such that external systems have the benefit of localtime as well as the ability to normalize the time using the timezone offset.- Parameters:
ms- the time in ms
-