Class BaseApp

java.lang.Object
ch.autumo.commons.application.BaseApp
All Implemented Interfaces:
LicensedApplication, SecureApplication

public abstract class BaseApp extends Object implements LicensedApplication
A console application. For a server use the autumo beetRoot-library (Class: BaseServer). In any case you always can use the getters from the ConfigurationManager to retrieve any configuration parameter.
See Also:
  • Field Details

    • LOG

      protected static final org.slf4j.Logger LOG
      Logger.
    • rootPath

      protected static String rootPath
      Root path of application.
    • ansiName

      protected static String ansiName
      ANSI colored application name.
    • ansiErrName

      protected static String ansiErrName
      ANSI colored application name for errors.
    • baseCfgFile

      protected String baseCfgFile
      Base configuration file ('cfg/app.cfg').
    • baseProps

      protected Properties baseProps
      Base configuration properties.
  • Constructor Details

    • BaseApp

      public BaseApp()
      Because of SecureApplication and when console tools such as the Encoder are used.
    • BaseApp

      public BaseApp(RegistrationVersion regVersion)
      Because of LicensedApplication and when console tools such as the Register are used.
      Parameters:
      regVersion - injected registration version
    • BaseApp

      public BaseApp(String[] params)
      Create the application.
      Parameters:
      params - console arguments
  • Method Details

    • getConfigurationParameter

      public final String getConfigurationParameter(String key)
      Get a configuration parameter/value.
      Parameters:
      key - key
      Returns:
      value or null
    • licenseAccepted

      public final void licenseAccepted()
      Set license accepted flag.
    • isLicenseAccepted

      public final boolean isLicenseAccepted()
      Is license accepted flag set?
      Returns:
      true, if so
    • initialize

      protected abstract void initialize(String[] params)
      Initialization.
      Parameters:
      params - program arguments (from console)
    • getAppVersion

      public abstract String getAppVersion()
      Get application version. It is also used for online upgrade checks, if applied.
      Specified by:
      getAppVersion in interface LicensedApplication
      Returns:
      application version
    • getAppTitle

      public abstract String getAppTitle()
      Get application title. Part of the online license check, if applied.
      Specified by:
      getAppTitle in interface LicensedApplication
      Returns:
      application title
    • initializeLogging

      protected void initializeLogging(String logCfgFile)
      Initialize logging.
      Parameters:
      logCfgFile - logging configuration file (usually 'cfg/logging.cml').
    • getBaseProperties

      protected final Properties getBaseProperties()
      Get base properties (properties from 'cfg/base.ifc'). Used for optional runtime checks.
      Returns:
      base properties
    • getBasePropertiesFile

      protected final String getBasePropertiesFile()
      Get base properties file ('cfg/base.ifc') for possible modifications; e.g. trial period, etc. Used for optional runtime checks.
      Returns:
      base properties
    • getInternalSecurityKey

      public String getInternalSecurityKey()
      Overwrite if you want to use an own internal security key. It is only used when this application is licensed through autumo's licensing mechanism that involves an autumo license server. Contact autumo for more information.
      Specified by:
      getInternalSecurityKey in interface SecureApplication
      Returns:
      internal security key
      See Also:
    • getUniqueSecurityKey

      public final String getUniqueSecurityKey()
      Description copied from interface: SecureApplication
      Returns an unique security key, which should different for every app. It is used for general encryption (transport and other secrets) in the app. Must be a HEX, 32 Bit long.
      Specified by:
      getUniqueSecurityKey in interface SecureApplication
      Returns:
      security key
      See Also:
    • getPassphrase

      public String getPassphrase()
      Description copied from interface: SecureApplication
      Get a pass phrase; used to unlock console tools for special operations if such tools are in place, otherwise return null; The Encoder uses this pass-phrase for decoding!
      Specified by:
      getPassphrase in interface SecureApplication
      Returns:
      pass-phrase
      See Also:
    • initializeBaseConfig

      public void initializeBaseConfig(String rootFolder) throws Exception
      Description copied from interface: LicensedApplication
      Initializes the base configuration if any ('base.ifc'). The root folder is usually base application configuration path where the file application configuration 'app.cfg' lies. It is given as a parameter, because the base configuration will possibly be loaded on demand in different context (e.g. registration tool, GUI desktop, etc.). In some cases you might want to overwrite this method to get access to more encrypted base configuration values. The encrypted values follow the encryption scheme of Encoder. Use this encoder with the 'internal'-option to get such values.
      Specified by:
      initializeBaseConfig in interface LicensedApplication
      Parameters:
      rootFolder - base configuration root folder or null when the configuration context must be resolved differently, e.g. within a desktop application.
      Throws:
      Exception - if initializarion fails
    • getLicensePath

      public final String getLicensePath()
      Description copied from interface: LicensedApplication
      Get local path to license.
      Specified by:
      getLicensePath in interface LicensedApplication
      Returns:
      license path
    • getLicInfoTitle

      public final String getLicInfoTitle()
      Description copied from interface: LicensedApplication
      Get license info title - unique for every application.
      Specified by:
      getLicInfoTitle in interface LicensedApplication
      Returns:
      license info title
    • isAllowed2ReadEnvData

      public final boolean isAllowed2ReadEnvData()
      Description copied from interface: LicensedApplication
      Identifies if this application is allowed to read environment data during online registration.
      Specified by:
      isAllowed2ReadEnvData in interface LicensedApplication
      Returns:
      true if so
    • setAllowed2ReadEnvData

      public final void setAllowed2ReadEnvData(boolean allow)
      Description copied from interface: LicensedApplication
      Set application to allow to read user's environment data through online registration process.
      Specified by:
      setAllowed2ReadEnvData in interface LicensedApplication
      Parameters:
      allow - allow to read client environment data
    • getRuntimeType

      public String getRuntimeType()
      Overwrite if there's a specific runtime version; e.g. Trial, Full version.
      Specified by:
      getRuntimeType in interface LicensedApplication
      Returns:
      RT type
      See Also:
    • getLicType

      public String getLicType()
      Overwrite if there's a specific license version; e.g. Basic, Professional, Enterprise.
      Specified by:
      getLicType in interface LicensedApplication
      Returns:
      lic type
    • getInlineChecks

      public InlineChecks getInlineChecks()
      Overwrite if inline-checks are used!
      Specified by:
      getInlineChecks in interface LicensedApplication
      Returns:
      inline checks
    • getApiKey

      public String getApiKey()
      Description copied from interface: LicensedApplication
      Get API key for online license server.
      Specified by:
      getApiKey in interface LicensedApplication
      Returns:
      API key
    • getLicSrvUrl

      public String getLicSrvUrl()
      Description copied from interface: LicensedApplication
      Get license server URL.
      Specified by:
      getLicSrvUrl in interface LicensedApplication
      Returns:
      license serevr URL
    • getProductKey

      public String getProductKey()
      You most likely want to overwrite this method if your application can be registered or is registered and product key is not read and decrypted from 'base.ifc'. Must match the product key configured at the autumo product license server. Part of the online license check, if applied.
      Specified by:
      getProductKey in interface LicensedApplication
      Returns:
      product key
    • getRegVersion

      public RegistrationVersion getRegVersion()
      You most likely want to overwrite this method if your application can be registered or is registered. Part of the whole licensing mechanism, if applied.
      Specified by:
      getRegVersion in interface LicensedApplication
      Returns:
      registration version