# Class: com.pnfsoftware.jeb.client.AbstractClientContext
- Super class: `com.pnfsoftware.jeb.client.AbstractContext`
- Super interfaces: `com.pnfsoftware.jeb.client.api.IClientContext`

Base context for official JEB clients. It is used by the RCP client context \(GUI\), the Controller  \(floating\) context, as well as the headless runner.  

  On top of the abstract methods, which must be implemented, client code that override the  following method must call the super\-class method:
  \- [#initialize(String[])](#initialize(String[]))
  \- [#start()](#start())
  \- [#stop()](#stop())

## Protected Constructor: AbstractClientContext (no-arg)

Description: Create a base client context.

## Protected Field: args
Type: `java.lang.String[]`
Description: Command\-line arguments remaining after client option parsing.

## Protected Field: basicChecksPassed
Type: `boolean`
Description: True when startup checks completed successfully.

## Protected Field: coreOptions
Type: `com.pnfsoftware.jeb.core.CoreOptions`
Description: A reference to core options that will be used when the JEB core context is instantiated in  [#start()](#start()). Clients which decide to provide non\-standard options should set this field  **before** calling [#start()](#start()).

## Protected Field: inputpath
Type: `java.lang.String`
Description: Optional input path parsed from command\-line arguments.

## Protected Field: scriptpath
Type: `java.lang.String`
Description: Optional script path parsed from command\-line arguments.

## Protected Field: ugerrstr
Type: `java.lang.String`
Description: Last user or license generation error string reported during startup.

## Static Final Field: CLIENT_RUNNING_FILENAME_PREFIX
Type: `java.lang.String`

Constant value: `.jebc_ts`
Description: Prefix used for lock files indicating that at least one JEB client is running.

## Static Final Field: INSTALLER_LOCK_FILENAME
Type: `java.lang.String`

Constant value: `.jebi_lock`
Description: Filename used by the installer to prevent client startup during updates.

## Static Final Field: defaultClientConfigPath
Type: `java.lang.String`

Constant value: `jeb-client.cfg`
Description: Default client configuration filename.

## Static Final Field: defaultEnginesConfigPath
Type: `java.lang.String`

Constant value: `jeb-engines.cfg`
Description: Default engines configuration filename.

## Static Final Field: defaultPluginsFolderName
Type: `java.lang.String`

Constant value: `coreplugins`
Description: Default plugins directory name.

## Static Final Field: defaultProgramFolderName
Type: `java.lang.String`

Constant value: `bin`
Description: Default program directory name.

## Static Final Field: defaultScriptsFolderName
Type: `java.lang.String`

Constant value: `scripts`
Description: Default scripts directory name.

## Static Final Field: defaultTelemetryDatabasePath
Type: `java.lang.String`

Constant value: `jt.db`
Description: Default telemetry database filename.

## Protected Method: assignCommandlineArguments
- parameter: `argv`, type: `java.lang.String[]`

Description: Assigns [#args](#args) and [#inputpath](#inputpath). May overwrite [#configpath](#configpath) and  [#engconfigpath](#engconfigpath). May assign [#scriptpath](#scriptpath).
parameter: argv: command\-line arguments

## Method: checkRunningInstaller
- return type: `boolean`

Description: Determine whether the installer appears to be running.
return: true if the installer lock is present and recent

## Abstract Method: checkUpdate
- return type: `boolean`

Description: Not called locally: it is entirely up to the client to implement and decide who calls this  method.
return: true if an update was downloaded and should be applied

## Method: closeMainProject
- return type: `boolean`

Description: Same as [#closeOpenedProject()](#closeOpenedProject()).
return: true if a project was open and closed

## Final Method: closeOpenedProject
- return type: `boolean`

Description: Close the currently opened project, if any.
return: true if a project was open and closed

## Abstract Method: displayDemoInformation
- parameter: `demoInfo`, type: `java.lang.String`

Description: Display information about demo restrictions.  

  Called from [#start()](#start()).
parameter: demoInfo: demo information text

## Abstract Method: displayEula
- parameter: `eula`, type: `java.lang.String`
- return type: `boolean`

Description: Display the end\-user license agreement.  

  Called from [#start()](#start()).
parameter: eula: EULA text
return: true if the user accepted the EULA

## Protected Method: dumpProgramError
- parameter: `str`, type: `java.lang.String`
- return type: `boolean`

Description: Replace the program error log content.
parameter: str: content to write
return: true if the error log was written successfully

## Final Method: dumpUpdateToDisk
- parameter: `data`, type: `byte[]`
- parameter: `password`, type: `java.lang.String`
- throws: `java.io.IOException`

Description: Persist a downloaded update archive and its optional password to disk.
parameter: data: update archive data
parameter: password: optional archive password
throws: on write error

## Method: getArguments
- return type: `java.lang.String[]`


## Final Method: getConfigDirectory
- return type: `java.lang.String`

Description: 
return: 

## Method: getConfiguration
- return type: `org.apache.commons.configuration2.Configuration`

Description: Get the raw client configuration object.
return: configuration object

## Method: getControllerAllowedPins
- return type: `java.lang.String`


## Method: getControllerInterface
- return type: `java.lang.String`

Description: Get the floating\-controller interface or hostname.
return: controller interface or hostname

## Method: getControllerKeystoreKeyAlias
- return type: `java.lang.String`


## Method: getControllerKeystoreKeyPassword
- return type: `java.lang.String`


## Method: getControllerKeystorePassword
- return type: `java.lang.String`


## Method: getControllerKeystorePath
- return type: `java.lang.String`


## Method: getControllerMessage
- return type: `java.lang.String`

Description: Get the optional floating\-controller message configured for this client.
return: controller message

## Method: getControllerPort
- return type: `int`

Description: Get the floating\-controller port.
return: controller port

## Method: getControllerProtocol
- return type: `int`

Description: Get the floating\-controller protocol identifier.
return: controller protocol identifier

## Final Method: getCoreContext
- return type: `com.pnfsoftware.jeb.core.ICoreContext`

Description: Get the JEB core instance. Should never be null unless an error happened in [#start()](#start())  or the context is one of a floating controller.
return: the core context, or null if unavailable

## Final Method: getEnginesContext
- return type: `com.pnfsoftware.jeb.core.IEnginesContext`

Description: Get the JEB engines instance. Should never be null unless an error happened in  [#start()](#start()) or the context is one of a floating controller.
return: the engines context, or null if unavailable

## Method: getInputpath
- return type: `java.lang.String`

Description: Get the current input path parsed from the command line, if any.
return: the input path, or null if none was provided

## Method: getInternalObject
- parameter: `oid`, type: `int`
- return type: `java.lang.Object`


## Final Method: getLastPublicAnnouncementId
- return type: `int`

Description: Get the identifier of the last seen public announcement.
return: last announcement id

## Final Method: getLatestAvailableUpdate
- return type: `com.pnfsoftware.jeb.core.Version`

Description: Get the latest available update recorded in the client settings.
return: latest available version, or null if none is recorded

## Method: getLogLevel
- return type: `int`

Description: Get the configured global log level.
return: log level

## Method: getMainProject
- return type: `com.pnfsoftware.jeb.core.IRuntimeProject`

Description: Same as [#getOpenedProject()](#getOpenedProject()).
return: the main project, or null if none is open

## Method: getMaxMemory
- return type: `long`


## Method: getNetworkUtility
- return type: `com.pnfsoftware.jeb.util.net.Net`

Description: Get the shared network helper used by this client context.
return: network helper

## Final Method: getOpenedProject
- return type: `com.pnfsoftware.jeb.core.IRuntimeProject`

Description: Retrieve the current project, if any. Same as [#getMainProject()](#getMainProject()).
return: may be null

## Final Method: getPreferredLanguage
- return type: `java.lang.String`

Description: Get the preferred UI language code.
return: preferred language code

## Method: getProcessId
- return type: `long`


## Method: getPropertyDefinitionManager
- return type: `com.pnfsoftware.jeb.core.properties.IPropertyDefinitionManager`

Description: Get the property definition manager.
return: property definition manager

## Method: getPropertyManager
- return type: `com.pnfsoftware.jeb.core.properties.IPropertyManager`


## Final Method: getProxyString
- return type: `java.lang.String`

Description: Get the configured network proxy string.
return: proxy settings string

## Method: getScriptpath
- return type: `java.lang.String`

Description: Get the script path parsed from the command line, if any.
return: the script path, or null if none was provided

## Final Method: getScriptsDirectory
- return type: `java.lang.String`

Description: Retrieve the JEB scripts directory path.
return: never null, however, the path returned may not reference an existing directory

## Final Method: getScriptsDirfile
- return type: `java.io.File`

Description: Retrieve and if necessary create the JEB scripts directory.
return: the script directory

## Final Method: getStartupTimestamp
- return type: `int`


## Method: getTelemetry
- return type: `com.pnfsoftware.jeb.client.telemetry.ITelemetryDatabase`

Description: Get the telemetry database handle.
return: telemetry database handle

## Method: getTransientStore
- return type: `java.util.Map<java.lang.Object,java.lang.Object>`


## Final Method: getUpdateChannel
- return type: `int`

Description: Get the configured update channel.
return: update channel

## Method: getUsedMemory
- return type: `long`


## Final Method: getUuid
- return type: `long`

Description: Get the generated UUID associated with this client installation.
return: UUID value, or 0 if unavailable

## Final Method: hasOpenedProject
- return type: `boolean`

Description: Determine whether a project is currently open.
return: true if a project is open

## Method: initialize
- parameter: `argv`, type: `java.lang.String[]`

Description: Initialize the client context from command\-line arguments and configuration files.
parameter: argv: command\-line arguments

## Protected Final Method: initializeEngines
- throws: `com.pnfsoftware.jeb.core.exceptions.JebException`

Description: Initialize the core context and an engines context.
throws: on core or engines initialization error

## Method: isDevelopmentMode
- return type: `boolean`

Description: Determine whether development mode is enabled.
return: true if development mode is enabled

## Method: isHeadless
- return type: `boolean`

Description: Determine whether this client context is headless.
return: true if this context is headless

## Final Method: isSharedProgram
- return type: `boolean`


## Final Method: logMemoryUsage

Description: Log the current process memory usage.

## Abstract Method: notifyFloatingClient
- parameter: `notification`, type: `com.pnfsoftware.jeb.core.events.ControllerNotification`

Description: Notify the client of a floating\-controller event.  

  May be called from any thread.
parameter: notification: controller notification

## Abstract Method: notifySupportExpired

Description: Notify the client that support or subscription benefits expired.  

  Called from [#start()](#start()).

## Abstract Method: onUpdatedSoftware
- parameter: `changelist`, type: `java.lang.String`
- parameter: `oldVersion`, type: `com.pnfsoftware.jeb.core.Version`

Description: Notify a concrete client that a new version of JEB is being run for the first time.  

  Called from [#start()](#start()).
parameter: changelist: an optional change log
parameter: oldVersion: the last version of JEB that was run \(note: the current version is always             available as a [static public field](AbstractContext#app_ver)\)

## Method: open
- parameter: `path`, type: `java.lang.String`
- return type: `com.pnfsoftware.jeb.core.units.IUnit`
- throws: `java.io.IOException`


## Final Method: ping
- parameter: `downloadOrder`, type: `int`
- parameter: `clientChannel`, type: `int`
- parameter: `sbi`, type: `com.pnfsoftware.jeb.client.SoftwareBuildInfo`
- parameter: `progressCallback`, type: `com.pnfsoftware.jeb.util.base.IProgressCallback`
- parameter: `verbose`, type: `boolean`
- return type: `int`

Description: Ping the JEB update server, and optionally download a JEB update on a compatible update  channel.
parameter: downloadOrder: orders:             
             
- 0= no download \(pure ping\)             
- 1=soft download \(download only if not a major version bump; else a code 3 may             be returned if an update is available; the client must call this method once more             with downloadOrder=2 to download the files\)             
- 2= always download
parameter: clientChannel: current client channel, ie maximum allowed channel a build must confirm             to; see [Version](com.pnfsoftware.jeb.core.Version.md) for a list of available channels
parameter: sbi: optional information about the update
parameter: progressCallback: optional callback, used if the update package is to be downloaded
parameter: verbose: if true, messages are logged; if false, only important messages are logged
return: return values are:          
          
- \-3: error, an update is ready but will be downloaded nor installed because JEB is          running in shared\-mode          
- \-2: error, corrupt update          
- \-1: error, unknown          
- 0: up to date          
- 1: update available, but caller does not want to download          
- 2: update available and downloaded          
- 3: update available, not downloaded, \(currently: the only reason is, it is a          major update, eg v3 to v4\) \- use downloadOrder=2 to force the download and          install

## Final Method: retrieveLatestPublicAnnouncement
- return type: `com.pnfsoftware.jeb.client.PublicAnnouncement`

Description: Retrieve the latest public announcement from the JEB server.
return: the latest announcement object, or null on failure

## Abstract Method: retrieveLicenseKey
- parameter: `licdata`, type: `java.lang.String`
- return type: `java.lang.String`

Description: Retrieve a license key from the user.  

  Called from [#start()](#start()).
parameter: licdata: license data blob
return: the license key entered by the user

## Method: setControllerAllowedPins
- parameter: `pins`, type: `java.lang.String`


## Method: setControllerInterface
- parameter: `iface`, type: `java.lang.String`

Description: Set the floating\-controller interface or hostname.
parameter: iface: controller interface or hostname

## Method: setControllerKeystoreKeyAlias
- parameter: `alias`, type: `java.lang.String`


## Method: setControllerKeystoreKeyPassword
- parameter: `password`, type: `java.lang.String`


## Method: setControllerKeystorePassword
- parameter: `password`, type: `java.lang.String`


## Method: setControllerKeystorePath
- parameter: `path`, type: `java.lang.String`


## Method: setControllerPort
- parameter: `port`, type: `int`

Description: Set the floating\-controller port.
parameter: port: controller port

## Method: setControllerProtocol
- parameter: `protocol`, type: `int`

Description: Set the floating\-controller protocol identifier.
parameter: protocol: controller protocol identifier

## Method: setDevelopmentMode
- parameter: `enabled`, type: `boolean`

Description: Enable or disable development mode.
parameter: enabled: true to enable development mode

## Final Method: setLastPublicAnnouncementId
- parameter: `id`, type: `int`

Description: Set the identifier of the last seen public announcement.
parameter: id: last announcement id

## Final Method: setLatestAvailableUpdate
- parameter: `version`, type: `com.pnfsoftware.jeb.core.Version`

Description: Record the latest available update version in the client settings.
parameter: version: latest available version

## Method: setLogLevel
- parameter: `level`, type: `int`

Description: Set the configured global log level.
parameter: level: log level

## Final Method: setPreferredLanguage
- parameter: `langcode`, type: `java.lang.String`

Description: Set the preferred UI language code.
parameter: langcode: language code

## Final Method: setProxyString
- parameter: `strProxyinfo`, type: `java.lang.String`

Description: Set the network proxy string.
parameter: strProxyinfo: proxy settings string

## Final Method: setScriptsDirectory
- parameter: `folder`, type: `java.lang.String`

Description: Set the JEB scripts directory path.
parameter: folder: scripts directory path

## Final Method: setUpdateChannel
- parameter: `channel`, type: `int`

Description: Set the accepted update channel.
parameter: channel: update channel

## Abstract Method: setupController
- return type: `boolean`

Description: Ask the client to configure floating\-controller settings if needed.  

  Called from [#start()](#start()).
return: true if the controller was configured successfully

## Final Method: shouldCheckPublicAnnouncements
- return type: `boolean`

Description: Determine whether public announcement checks should be performed.
return: true if announcement checks are enabled

## Final Method: shouldCheckUpdates
- return type: `boolean`

Description: Determine whether automatic update checks should be performed.
return: true if update checks are enabled

## Method: start
- throws: `com.pnfsoftware.jeb.core.exceptions.JebException`

Description: Install update, if any. Allow the display of client\-specific material such as: EULA,  changelog, etc. If floating, initialize the floating client. Performs a license check for  release builds. If not a controller, initialize a JEB [core](#corectx) and  [engines](#engctx).
throws: on initialization or licensing error

## Method: stop

Description: Stop the client context and release telemetry and core resources.

## Static Method: formatMemoryUsage
- return type: `java.lang.String`

Description: Format the current process memory usage.
return: formatted memory usage string

## Static Method: formatProcessInfo
- parameter: `inclPid`, type: `boolean`
- parameter: `inclMeminfo`, type: `boolean`
- parameter: `inclTimes`, type: `boolean`
- parameter: `inclCmdline`, type: `boolean`
- return type: `java.lang.String`

Description: Format various process information bits. Each bit is formatted on a single line.
parameter: inclPid: true to include process identifier information
parameter: inclMeminfo: true to include memory usage information
parameter: inclTimes: true to include start time and CPU time information
parameter: inclCmdline: true to include the full command line
return: formatted process information

## Static Final Method: generateLicenseInformation
- return type: `java.lang.String`

Description: Format the current license information for display.
return: formatted license information

