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 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, LICENSE_PUBLIC_KEY, PROD_KEY, RT_TYPE_KEYModifier and TypeFieldDescriptionstatic final Stringautumo products license server address from 'base.ifc'.static final Stringautumo products license server API key from 'base.ifc'.static final StringBase config file.static final StringBase config jar.static final StringDefault config file.static final StringInterface config path.static final StringLicense registration file with temporary extension.static final StringInline checks key from 'base.ifc'.static final StringAllowed lic key chars.static final StringLicense info file.static final StringLicense path.static final StringLicense type key from 'base.ifc'.static final Stringlicense public key from 'base.ifc'.static final StringProduct key from 'base.ifc'.static final StringRuntime type key from 'base.ifc'.Fields inherited from interface SecureApplication
SEC_KEY_SEEDModifier and TypeFieldDescriptionstatic final StringSecurity key seed configuration parameter name. -
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.final StringGet a configuration parameter/value.Overwrite if inline-checks are used!Overwrite if you want to use an own internal security key.static StringGet the date the internal security key was last changed (ISO-8601), read from theISK_RESOURCEresource.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.The pass phrase theEncoderasks for when a value is decoded on the console: the second half of the internal security key.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'.Get public key.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
-
-
Method Details
-
getConfigurationParameter
-
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.The default implementation reads the key from the resource
autumo.isk, which is looked up relative to this class. The resource is read lazily on the first call and then kept in memory; it is also found when the library is packaged inside a JAR. The resource must carry a validkey(16 hex bytes) and adateentry, otherwise anIllegalStateExceptionis thrown.- 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
The pass phrase theEncoderasks for when a value is decoded on the console: the second half of the internal security key.- 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 initialization 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
-
getPublicKey
Description copied from interface:LicensedApplicationGet public key.- Specified by:
getPublicKeyin interfaceLicensedApplication- Returns:
- public key
-
getLicSrvUrl
Description copied from interface:LicensedApplicationGet license server URL.- Specified by:
getLicSrvUrlin interfaceLicensedApplication- Returns:
- license server 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
-
getInternalSecurityKeyDate
Get the date the internal security key was last changed (ISO-8601), read from theISK_RESOURCEresource.- Returns:
- the ISK date
-