Class KosCore

java.lang.Object
com.tccc.kos.core.app.KosCore

public final class KosCore extends Object
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 Details

    • hasProfile

      public static boolean hasProfile(String profile)
      Returns true if the specified profile is active.
      Parameters:
      profile - the profile to check
    • getMode

      public static Mode 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

      public static NodeId getPrimaryNodeId()
      Returns the nodeId of the primary node.
    • getDeviceType

      public static String getDeviceType()
      Returns the device type of the overall device the node is part of.
    • getVendorAuthority

      public static String getVendorAuthority()
      Returns the vendor authority of this node.
    • getMfgAuthority

      public static String getMfgAuthority()
      Returns the manufacturer authority of this node.
    • getBoardType

      public static String getBoardType()
      Returns the board type of this node.
    • getArch

      public static String getArch()
      Returns the arch of this node.
    • getCtx

      public static BeanContext getCtx()
      Returns the context for kOS.
    • getSystemCtx

      public static BeanContext getSystemCtx()
      Returns the context for the system app.
    • getSystemApp

      public static SystemApplication<?> getSystemApp()
      Return the system application.
    • getPort

      public static int getPort()
      Returns the port number that kOS is running on. It defaults to 8081.
    • getNodeId

      public static NodeId getNodeId()
      Returns the ID of the node we're running on.
    • getMfgDir

      public static File getMfgDir()
      Return the manufacturer data directory.
    • getMfgFile

      public static File getMfgFile(String path)
      Return a File for the specified path in the manufacturer data directory.
    • formatISO8601

      public static String formatISO8601(long ms)
      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
    • getAnalytics

      public static AnalyticsService getAnalytics()