Package ch.autumo.commons.application
Class BaseApp
java.lang.Object
ch.autumo.commons.application.BaseApp
- All Implemented Interfaces:
LicensedApplication,SecureApplication
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 Summary
FieldsModifier and TypeFieldDescriptionprotected static StringANSI colored application name for errors.protected static StringANSI colored application name.protected StringBase configuration file ('cfg/app.cfg').protected PropertiesBase configuration properties.protected static final org.slf4j.LoggerLogger.protected static StringRoot path of application.Fields inherited from interface ch.autumo.commons.application.LicensedApplication
AP_LS_AD_KEY, AP_LS_AK_KEY, BASE_CFG_FILE, BASE_CFG_JAR, CONFIG_DEFAULT_FILE, CONFIG_PATH, FILE_REG_SOURCE, INLINE_CHECKS_KEY, LIC_CHARS, LIC_INFO_FILE, LIC_PATH, LIC_TYPE_KEY, PROD_KEY, RT_TYPE_KEYFields inherited from interface ch.autumo.commons.security.SecureApplication
SEC_KEY_SEED -
Constructor Summary
ConstructorsConstructorDescriptionBaseApp()Because ofSecureApplicationand when console tools such as theEncoderare used.BaseApp(RegistrationVersion regVersion) Because ofLicensedApplicationand when console tools such as theRegisterare used.Create the application. -
Method Summary
Modifier and TypeMethodDescriptionGet API key for online license server.abstract StringGet application title.abstract StringGet application version.protected final PropertiesGet base properties (properties from 'cfg/base.ifc').protected final StringGet base properties file ('cfg/base.ifc') for possible modifications; e.g. trial period, etc.final StringGet a configuration parameter/value.Overwrite if inline-checks are used!Overwrite if you want to use an own internal security key.final StringGet local path to license.final StringGet license info title - unique for every application.Get license server URL.Overwrite if there's a specific license version; e.g.Get a pass phrase; used to unlock console tools for special operations if such tools are in place, otherwise return null; TheEncoderuses this pass-phrase for decoding!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'.You most likely want to overwrite this method if your application can be registered or is registered.Overwrite if there's a specific runtime version; e.g.final StringReturns an unique security key, which should different for every app.protected abstract voidinitialize(String[] params) Initialization.voidinitializeBaseConfig(String rootFolder) Initializes the base configuration if any ('base.ifc').protected voidinitializeLogging(String logCfgFile) Initialize logging.final booleanIdentifies if this application is allowed to read environment data during online registration.final booleanIs license accepted flag set?final voidSet license accepted flag.final voidsetAllowed2ReadEnvData(boolean allow) Set application to allow to read user's environment data through online registration process.
-
Field Details
-
LOG
protected static final org.slf4j.Logger LOGLogger. -
rootPath
Root path of application. -
ansiName
ANSI colored application name. -
ansiErrName
ANSI colored application name for errors. -
baseCfgFile
Base configuration file ('cfg/app.cfg'). -
baseProps
Base configuration properties.
-
-
Constructor Details
-
BaseApp
public BaseApp()Because ofSecureApplicationand when console tools such as theEncoderare used. -
BaseApp
Because ofLicensedApplicationand when console tools such as theRegisterare used.- Parameters:
regVersion- injected registration version
-
BaseApp
Create the application.- Parameters:
params- console arguments
-
-
Method Details
-
getConfigurationParameter
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
Initialization.- Parameters:
params- program arguments (from console)
-
getAppVersion
Get application version. It is also used for online upgrade checks, if applied.- Specified by:
getAppVersionin interfaceLicensedApplication- Returns:
- application version
-
getAppTitle
Get application title. Part of the online license check, if applied.- Specified by:
getAppTitlein interfaceLicensedApplication- Returns:
- application title
-
initializeLogging
Initialize logging.- Parameters:
logCfgFile- logging configuration file (usually 'cfg/logging.cml').
-
getBaseProperties
Get base properties (properties from 'cfg/base.ifc'). Used for optional runtime checks.- Returns:
- base properties
-
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
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:
getInternalSecurityKeyin interfaceSecureApplication- Returns:
- internal security key
- See Also:
-
getUniqueSecurityKey
Description copied from interface:SecureApplicationReturns 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:
getUniqueSecurityKeyin interfaceSecureApplication- Returns:
- security key
- See Also:
-
getPassphrase
Description copied from interface:SecureApplicationGet a pass phrase; used to unlock console tools for special operations if such tools are in place, otherwise return null; TheEncoderuses this pass-phrase for decoding!- Specified by:
getPassphrasein interfaceSecureApplication- Returns:
- pass-phrase
- See Also:
-
initializeBaseConfig
Description copied from interface:LicensedApplicationInitializes 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 ofEncoder. Use this encoder with the 'internal'-option to get such values.- Specified by:
initializeBaseConfigin interfaceLicensedApplication- 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
Description copied from interface:LicensedApplicationGet local path to license.- Specified by:
getLicensePathin interfaceLicensedApplication- Returns:
- license path
-
getLicInfoTitle
Description copied from interface:LicensedApplicationGet license info title - unique for every application.- Specified by:
getLicInfoTitlein interfaceLicensedApplication- Returns:
- license info title
-
isAllowed2ReadEnvData
public final boolean isAllowed2ReadEnvData()Description copied from interface:LicensedApplicationIdentifies if this application is allowed to read environment data during online registration.- Specified by:
isAllowed2ReadEnvDatain interfaceLicensedApplication- Returns:
- true if so
-
setAllowed2ReadEnvData
public final void setAllowed2ReadEnvData(boolean allow) Description copied from interface:LicensedApplicationSet application to allow to read user's environment data through online registration process.- Specified by:
setAllowed2ReadEnvDatain interfaceLicensedApplication- Parameters:
allow- allow to read client environment data
-
getRuntimeType
Overwrite if there's a specific runtime version; e.g. Trial, Full version.- Specified by:
getRuntimeTypein interfaceLicensedApplication- Returns:
- RT type
- See Also:
-
getLicType
Overwrite if there's a specific license version; e.g. Basic, Professional, Enterprise.- Specified by:
getLicTypein interfaceLicensedApplication- Returns:
- lic type
-
getInlineChecks
Overwrite if inline-checks are used!- Specified by:
getInlineChecksin interfaceLicensedApplication- Returns:
- inline checks
-
getApiKey
Description copied from interface:LicensedApplicationGet API key for online license server.- Specified by:
getApiKeyin interfaceLicensedApplication- Returns:
- API key
-
getLicSrvUrl
Description copied from interface:LicensedApplicationGet license server URL.- Specified by:
getLicSrvUrlin interfaceLicensedApplication- Returns:
- license serevr URL
-
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:
getProductKeyin interfaceLicensedApplication- Returns:
- product key
-
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:
getRegVersionin interfaceLicensedApplication- Returns:
- registration version
-