public abstract class

AbstractClientContext

extends AbstractContext
implements IClientContext
java.lang.Object
   ↳ com.pnfsoftware.jeb.util.events.EventSource
     ↳ com.pnfsoftware.jeb.client.AbstractContext
       ↳ com.pnfsoftware.jeb.client.AbstractClientContext
Known Direct Subclasses

Class Overview

The base context for official JEB clients. Currently used by the RCP client context and the Controller (floating) context.

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[])
- start()
- stop()

Summary

Constants
String defaultClientConfigPath
String defaultEnginesConfigPath
String defaultPluginsFolderName
String defaultScriptsFolderName
String defaultTelemetryDatabasePath
[Expand]
Inherited Constants
From class com.pnfsoftware.jeb.client.AbstractContext
Fields
protected String[] args
protected boolean basicChecksPassed
protected CoreOptions coreOptions A reference to core options that will be used when the JEB core context is instantiated in start().
protected String inputpath
[Expand]
Inherited Fields
From class com.pnfsoftware.jeb.client.AbstractContext
Protected Constructors
AbstractClientContext()
Public Methods
abstract boolean checkUpdate()
Not called locally: it is entirely up to the client to implement and decide who calls this method.
boolean closeMainProject()
Convenience method used to close the main project (if any), that is, the first project of the first engines context managed by the JEB back-end.
final boolean closeOpenedProject()
abstract void displayDemoInformation(String demoInfo)
Called from start().
abstract boolean displayEula(String eula)
Called from start().
final void dumpUpdateToDisk(byte[] data, String password)
static String formatMemoryUsage()
final static String generateLicenseInformation()
String[] getArguments()
Get the input arguments provided to this client context.
Configuration getConfiguration()
String getControllerInterface()
String getControllerMessage()
int getControllerPort()
int getControllerProtocol()
final ICoreContext getCoreContext()
Get the JEB core instance.
final IEnginesContext getEnginesContext()
Get the JEB engines instance.
String getInputpath()
final int getLastPublicAnnouncementId()
IRuntimeProject getMainProject()
Convenience method used to retrieve the main project (if any), that is, the first project of the first engines context managed by the JEB back-end.
long getMaxMemory()
Get the theoretical maximum amount of memory that JEB can allocate and use.
Net getNetworkUtility()
final IRuntimeProject getOpenedProject()
final String getPreferredLanguage()
IPropertyDefinitionManager getPropertyDefinitionManager()
IPropertyManager getPropertyManager()
final String getProxyString()
final String getScriptsDirectory()
Retrieve the JEB scripts directory path.
final File getScriptsDirfile()
Retrieve and if necessary create the JEB scripts directory.
ITelemetryDatabase getTelemetry()
Map<Object, Object> getTransientStore()
Retrieve a reference to the transient store provided by this context.
long getUsedMemory()
Get the amount of memory currently used by JEB.
final long getUuid()
final boolean hasOpenedProject()
void initialize(String[] argv)
boolean isDevelopmentMode()
boolean isHeadless()
final void logMemoryUsage()
abstract void notifyFloatingClient(ControllerNotification notification)
May be called from anywhere, any thread.
abstract void notifySupportExpired()
Called from start().
abstract void onUpdatedSoftware(String changelist, Version oldVersion)
Notify a concrete client that a new version of JEB is being run for the first time.
IUnit open(String path)
Convenience method used to create a JEB project (or retrieve the current project if one is opened), load a file artifact into the project, process it, and return the resulting top-level unit.
final int ping(boolean downloadUpdatePackage, int maxChannel, SoftwareBuildInfo sbi, IProgressCallback progressCallback)
Ping the JEB update server, and drop update to JEB folder if possible.
final PublicAnnouncement retrieveLatestPublicAnnouncement()
abstract String retrieveLicenseKey(String licdata)
Called from start().
void setControllerInterface(String iface)
void setControllerPort(int port)
void setControllerProtocol(int protocol)
void setDevelopmentMode(boolean enabled)
final void setLastPublicAnnouncementId(int id)
final void setPreferredLanguage(String language)
final void setProxyString(String strProxyinfo)
final void setScriptsDirectory(String folder)
abstract boolean setupController()
Called from start().
final boolean shouldCheckPublicAnnouncements()
final boolean shouldCheckUpdates()
void start()
Install update, if any.
void stop()
Protected Methods
final void initializeEngines()
Initialize the core context and an engines context.
[Expand]
Inherited Methods
From class com.pnfsoftware.jeb.client.AbstractContext
From class com.pnfsoftware.jeb.util.events.EventSource
From class java.lang.Object
From interface com.pnfsoftware.jeb.client.api.IClientContext
From interface com.pnfsoftware.jeb.util.events.IEventSource

Constants

public static final String defaultClientConfigPath

Constant Value: "jeb-client.cfg"

public static final String defaultEnginesConfigPath

Constant Value: "jeb-engines.cfg"

public static final String defaultPluginsFolderName

Constant Value: "coreplugins"

public static final String defaultScriptsFolderName

Constant Value: "scripts"

public static final String defaultTelemetryDatabasePath

Constant Value: "jt.db"

Fields

protected String[] args

protected boolean basicChecksPassed

protected CoreOptions coreOptions

A reference to core options that will be used when the JEB core context is instantiated in start(). Clients which decide to provide non-standard options should set this field before calling start().

protected String inputpath

Protected Constructors

protected AbstractClientContext ()

Public Methods

public abstract boolean checkUpdate ()

Not called locally: it is entirely up to the client to implement and decide who calls this method.

public boolean closeMainProject ()

Convenience method used to close the main project (if any), that is, the first project of the first engines context managed by the JEB back-end. If no project is opened, this method will return false.

Returns
  • success indicator

public final boolean closeOpenedProject ()

public abstract void displayDemoInformation (String demoInfo)

Called from start().

public abstract boolean displayEula (String eula)

Called from start().

public final void dumpUpdateToDisk (byte[] data, String password)

Throws
IOException

public static String formatMemoryUsage ()

public static final String generateLicenseInformation ()

public String[] getArguments ()

Get the input arguments provided to this client context. The returned array depends on how the context was instantiated and called.

Returns
  • an array (possibly empty) or null if arguments are irrelevant in the current context

public Configuration getConfiguration ()

public String getControllerInterface ()

public String getControllerMessage ()

public int getControllerPort ()

public int getControllerProtocol ()

public final ICoreContext getCoreContext ()

Get the JEB core instance. Should never be null unless an error happened in start() or the context is one of a floating controller.

public final IEnginesContext getEnginesContext ()

Get the JEB engines instance. Should never be null unless an error happened in start() or the context is one of a floating controller.

Returns
  • the primary engines context, possibly null if none was initialized

public String getInputpath ()

public final int getLastPublicAnnouncementId ()

public IRuntimeProject getMainProject ()

Convenience method used to retrieve the main project (if any), that is, the first project of the first engines context managed by the JEB back-end. If no project is opened, this method will return null.

Returns
  • the main project or null

public long getMaxMemory ()

Get the theoretical maximum amount of memory that JEB can allocate and use.

Returns
  • total theoretical memory that JEB could use, in bytes

public Net getNetworkUtility ()

public final IRuntimeProject getOpenedProject ()

public final String getPreferredLanguage ()

public IPropertyDefinitionManager getPropertyDefinitionManager ()

public IPropertyManager getPropertyManager ()

public final String getProxyString ()

public final String getScriptsDirectory ()

Retrieve the JEB scripts directory path.

Returns
  • never null, however, the path returned may not reference an existing directory

public final File getScriptsDirfile ()

Retrieve and if necessary create the JEB scripts directory.

Returns
  • the script directory

public ITelemetryDatabase getTelemetry ()

public Map<Object, Object> getTransientStore ()

Retrieve a reference to the transient store provided by this context. Clients may use this map to store context-level global objects. The store and its objects are not persisted with a project JDB2 database.

Interface specifications for implementations:
- Null keys are forbidden, null values are allowed
- Insertion, retrieval and deletion are thread-safe
- Iterating is not thread-safe
- The insertion order is not guaranteed during iteration

Returns
  • a non-null read-write map

public long getUsedMemory ()

Get the amount of memory currently used by JEB.

Returns
  • used memory in bytes

public final long getUuid ()

public final boolean hasOpenedProject ()

public void initialize (String[] argv)

public boolean isDevelopmentMode ()

public boolean isHeadless ()

public final void logMemoryUsage ()

public abstract void notifyFloatingClient (ControllerNotification notification)

May be called from anywhere, any thread.

public abstract void notifySupportExpired ()

Called from start().

public abstract void onUpdatedSoftware (String changelist, Version oldVersion)

Notify a concrete client that a new version of JEB is being run for the first time.

Called from start().

Parameters
changelist an optional change log
oldVersion the last version of JEB that was run (note: the current version is always available as a static public field)

public IUnit open (String path)

Convenience method used to create a JEB project (or retrieve the current project if one is opened), load a file artifact into the project, process it, and return the resulting top-level unit.

If the input file is a JDB2 saved project, that project is opened and returned. The method will throw IllegalStateException if a project is already opened.

Parameters
path input file to be analyzed, or an existing project saved as a JDB2 database (*.jdb2)
Returns
  • the top-level unit yielded from the analysis of the provided artifact; if the input path was a JDB2 project, the top-level unit of the first project's artifact is returned
Throws
IOException

public final int ping (boolean downloadUpdatePackage, int maxChannel, SoftwareBuildInfo sbi, IProgressCallback progressCallback)

Ping the JEB update server, and drop update to JEB folder if possible.

Parameters
downloadUpdatePackage if false, will just ping the server, no download will be initiated if there is an update available
maxChannel maximum requested channel (0=RC, 1=RC|beta, 2=RC|beta|alpha)
sbi optional information about the update
progressCallback optional callback, used if the update package is to be downloaded
Returns
  • return values are:
    • -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

public final PublicAnnouncement retrieveLatestPublicAnnouncement ()

public abstract String retrieveLicenseKey (String licdata)

Called from start().

public void setControllerInterface (String iface)

public void setControllerPort (int port)

public void setControllerProtocol (int protocol)

public void setDevelopmentMode (boolean enabled)

public final void setLastPublicAnnouncementId (int id)

public final void setPreferredLanguage (String language)

public final void setProxyString (String strProxyinfo)

public final void setScriptsDirectory (String folder)

public abstract boolean setupController ()

Called from start().

public final boolean shouldCheckPublicAnnouncements ()

public final boolean shouldCheckUpdates ()

public void start ()

Install update, if any. Allow the display of client-specific material such as: EULA, changelog, etc. If loating, initialize the floating client. Performs a license check for release builds. If not a controller, initialize a JEB #corectx core and #engctx engines.

Throws
JebException

public void stop ()

Protected Methods

protected final void initializeEngines ()

Initialize the core context and an engines context.

Throws
JebException