Package com.pnfsoftware.jeb.core
Class JebCoreService
java.lang.Object
com.pnfsoftware.jeb.core.JebCoreService
Service class used to create or retrieve a reference to the JEB core context. The core context
provides verified access to the engines.
Typically, it is the responsibility of client implementations (eg, the official RCP client), not plugins, to instantiate the core and a single engines context.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic IConfigurationgetConfiguration(File file, boolean createIfNotExist, boolean saveChanges) Create a configuration object for a JEB configuration file, such asjeb-engines.cfg.static IEnginesContextConvenience method used to retrieve the primary (default) engines context managed by an initialized JEB core back-end.static ICoreContextRetrieve an existing core context (= JEB back-end) if one exists.static ICoreContextRetrieve an instance of the previously instantiated core.static ICoreContextgetInstance(File baseFolder) Retrieve or create a core instance using a JEB installation folder.static ICoreContextgetInstance(File baseFolder, CoreOptions options) Retrieve or create a core instance using a JEB installation folder.static ICoreContextgetInstance(String licenseKey) Retrieve or create an instance of a core.static ICoreContextgetInstance(String licenseKey, CoreOptions options) Retrieve or create an instance of a core.static voidnotifyExceptionToClient(Throwable throwable) static voidConvenience method to "forward" (via an event) a throwable to the client for processing.static voidnotifySilentExceptionToClient(Throwable throwable) static voidnotifySilentExceptionToClient(Throwable throwable, IUnit unit) static voidnotifySilentExceptionToClient(Throwable throwable, Map<String, Object> extradata) static voidnotifyTelemetryToClient(String eventName) Forward a telemetry notification with no properties to the client.static voidnotifyTelemetryToClient(String eventName, String key0, String value0) Forward a telemetry notification with a single property to the client.static voidForward a telemetry notification with two properties to the client.static voidnotifyTelemetryToClient(String eventName, Map<String, String> properties) Forward a telemetry notification to the client.static voidsilentExcept(Throwable throwable) Internal method reserved for debug builds.
-
Constructor Details
-
JebCoreService
public JebCoreService()
-
-
Method Details
-
getExistingInstance
Retrieve an existing core context (= JEB back-end) if one exists. If none exist, null is returned.- Returns:
- the unique JEB context or null if none was created
-
getInstance
Retrieve an instance of the previously instantiated core.- Returns:
- the unique JEB context
- Throws:
JebException- on error
-
getInstance
Retrieve or create an instance of a core.- Parameters:
licenseKey- a valid JEB license key- Returns:
- the unique JEB context
- Throws:
JebException- on error
-
getInstance
Retrieve or create an instance of a core.- Parameters:
licenseKey- a valid JEB license keyoptions- optional core options- Returns:
- the unique JEB context
- Throws:
JebException- on error
-
getInstance
Retrieve or create a core instance using a JEB installation folder.- Parameters:
baseFolder- JEB installation folderoptions- optional core options; if one is provided, its base folder attribute must match the providedbaseFolderparameter- Returns:
- the unique JEB context
- Throws:
JebException- on core initialization error
-
getInstance
Retrieve or create a core instance using a JEB installation folder.- Parameters:
baseFolder- JEB installation folder- Returns:
- the unique JEB context
- Throws:
JebException- on core initialization error
-
getDefaultEnginesContext
Convenience method used to retrieve the primary (default) engines context managed by an initialized JEB core back-end.- Returns:
- the default engines context, or null if no engines context is available
-
notifyExceptionToClient
public static void notifyExceptionToClient(Throwable throwable, int flags, Map<String, Object> extradata, IUnit unit) Convenience method to "forward" (via an event) a throwable to the client for processing. The client may decide to ignore, display, or further process (eg, report or log) the exception.- Parameters:
throwable- an error or exceptionflags- internal flagsextradata- optionalunit- optional unit object from which the exception originated
-
notifyExceptionToClient
- Parameters:
throwable- an error or exception
-
notifySilentExceptionToClient
- Parameters:
throwable- an error or exception
-
notifySilentExceptionToClient
- Parameters:
throwable- an error or exceptionunit- optional unit object from which the exception originated
-
notifySilentExceptionToClient
- Parameters:
throwable- an error or exceptionextradata- optional
-
silentExcept
Internal method reserved for debug builds.- Parameters:
throwable- exception to rethrow in debug builds or report silently in release builds
-
notifyTelemetryToClient
Forward a telemetry notification to the client.- Parameters:
eventName- telemetry event nameproperties- optional event properties
-
notifyTelemetryToClient
Forward a telemetry notification with no properties to the client.- Parameters:
eventName- telemetry event name
-
notifyTelemetryToClient
Forward a telemetry notification with a single property to the client.- Parameters:
eventName- telemetry event namekey0- property namevalue0- property value
-
notifyTelemetryToClient
public static void notifyTelemetryToClient(String eventName, String key0, String value0, String key1, String value1) Forward a telemetry notification with two properties to the client.- Parameters:
eventName- telemetry event namekey0- first property namevalue0- first property valuekey1- second property namevalue1- second property value
-
getConfiguration
public static IConfiguration getConfiguration(File file, boolean createIfNotExist, boolean saveChanges) throws IOException Create a configuration object for a JEB configuration file, such asjeb-engines.cfg.- Parameters:
file- a JEB configuration filecreateIfNotExist- create a new configuration file if it does not exist alreadysaveChanges- if true, changes made to the configuration file will be saved to disk; else, the changes will not be recorded- Returns:
- the configuration object, set up for reading and writing
- Throws:
IOException- if the configuration file cannot be created or loaded
-