AppManager
2.20.0The Application Management API provides a way to manage Glue42 Core applications. It offers abstractions for:
Application - a web app as a logical entity, registered in Glue42 Core with some metadata (name, title, version, etc.) and with all the configuration needed to spawn one or more instances of it. The Application Management API provides facilities for retrieving application metadata and for detecting when an application has been started;
Instance - a running copy of an application. The Application Management API provides facilities for starting/stopping application instances and tracking application and instance related events;
The Application Management API is accessible through the glue.appManager
object.
APIobject
Description
Application Management API.
Properties
Property | Type | Default | Required | Description |
---|---|---|---|---|
inMemory | InMemory | An object, through which applications definitions stored in-memory can be programmatically imported or removed. |
||
myInstance | Instance | The instance of the application. |
Methods
applicationmethod
Signature
(name: string) => Application
Description
Returns an application by name.
Parameters
Name | Type | Required | Description |
---|---|---|---|
name | string | Name of the desired application. |
applicationsmethod
instancesmethod
onAppAddedmethod
Signature
(callback: (app: Application) => any) => UnsubscribeFunction
Description
Notifies when an application is registered in the environment. Replays the already added applications.
Parameters
Name | Type | Required | Description |
---|---|---|---|
callback | (app: Application) => any | Callback function to handle the event. Receives the added application as a parameter. |
onAppChangedmethod
Signature
(callback: (app: Application) => any) => UnsubscribeFunction
Description
Notifies when the configuration for an application has changed.
Parameters
Name | Type | Required | Description |
---|---|---|---|
callback | (app: Application) => any | Callback function to handle the event. Receives the changed application as a parameter. |
onAppRemovedmethod
Signature
(callback: (app: Application) => any) => UnsubscribeFunction
Description
Notifies when the application is removed from the environment.
Parameters
Name | Type | Required | Description |
---|---|---|---|
callback | (app: Application) => any | Callback function to handle the event. Receives the removed application as a parameter. |
onInstanceStartedmethod
Signature
(callback: (instance: Instance) => any) => UnsubscribeFunction
Description
Notifies when a new application instance has been started. Replays the already started instances.
Parameters
Name | Type | Required | Description |
---|---|---|---|
callback | (instance: Instance) => any | Callback function to handle the event. Receives the started application instance as a parameter. |
onInstanceStoppedmethod
Signature
(callback: (instance: Instance) => any) => UnsubscribeFunction
Description
Notifies when an application instance has been stopped.
Parameters
Name | Type | Required | Description |
---|---|---|---|
callback | (instance: Instance) => any | Callback function to handle the event. Receives the stopped application instance as a parameter. |
Applicationobject
Description
Object describing an application.
Properties
Property | Type | Default | Required | Description |
---|---|---|---|---|
caption | string | Application caption. |
||
icon | string | Application icon. |
||
instances | Instance[] | Instances of that app. |
||
name | string | Application name. |
||
title | string | Application title. |
||
userProperties | PropertiesObject | Generic object for passing properties, settings, etc., in the for of key/value pairs. |
||
version | string | Application version. |
Methods
onInstanceStartedmethod
Signature
(callback: (instance: Instance) => any) => UnsubscribeFunction
Description
Subscribes for the event which fires when an application instance is started.
Note: unlike the API's onInstanceStarted()
the Application's onInstanceStarted()
method doesn't replay the already started instances.
Parameters
Name | Type | Required | Description |
---|---|---|---|
callback | (instance: Instance) => any | Callback function to handle the newly started instance. |
onInstanceStoppedmethod
startmethod
Signature
(context?: object, options?: ApplicationStartOptions) => Promise<Instance>
Description
Returns the newly started application instance.
Parameters
Name | Type | Required | Description |
---|---|---|---|
context | object | The initial context of the application. |
|
options | ApplicationStartOptions | Options object in which you can specify window setting (that will override the default configuration settings), as well as other additional options. |
ApplicationStartOptionsobject
Description
Object with options for starting an application.
Properties
Property | Type | Default | Required | Description |
---|---|---|---|---|
height | number | 400 | Window height. |
|
left | number | 0 | Distance of the top left window corner from the left edge of the screen. |
|
relativeDirection | RelativeDirection | "right" | Direction ( |
|
relativeTo | string | The ID of the window that will be used to relatively position the new window.
Can be combined with |
||
top | number | 0 | Distance of the top left window corner from the top edge of the screen. |
|
waitForAGMReady | boolean | |||
width | number | 400 | Window width. |
Definitionobject
Properties
Property | Type | Default | Required | Description |
---|---|---|---|---|
caption | string | Application caption. |
||
customProperties | PropertiesObject | Generic object for passing properties, settings, etc., in the for of key/value pairs. Accessed using the app.userProperties property. |
||
details | DefinitionDetails | Detailed configuration. |
||
hidden | boolean | If set to true, the application will not be listed in the Glue42 Core Extension UI. Defaults to false. |
||
icon | string | Application icon. |
||
intents | Intent[] | The list of intents implemented by the Application |
||
name | string | Application name. Should be unique. |
||
title | string | The title of the application. Sets the window's title. |
||
type | string | Type of the application - the only supported type in Glue42 Core is "window". More complex types are available in Glue42 Enterprise. |
||
version | string | Application version. |
DefinitionDetailsobject
Properties
Property | Type | Default | Required | Description |
---|---|---|---|---|
height | number | 400 | Window height. |
|
left | number | 0 | Distance of the top left window corner from the left edge of the screen. |
|
top | number | 0 | Distance of the top left window corner from the top edge of the screen. |
|
url | string | |||
width | number | 400 | Window width. |
ImportResultobject
Properties
Property | Type | Default | Required | Description |
---|---|---|---|---|
errors | { app: string; error: string; }[] | A list of application names and errors of all the unsuccessful imports |
||
imported | string[] | A list of names of the successfully imported application definitions |
InMemoryobject
Description
An object, through which applications definitions stored in-memory can be programmatically imported or removed.
Methods
clearmethod
Signature
() => Promise<void>
Description
Removes all applications from the memory
exportmethod
importmethod
Signature
(definitions: Definition[], mode?: ImportMode) => Promise<ImportResult>
Description
Imports the provided collection of application definitions. Returns an import result object, which contains the names of the successfully imported apps and a list of errors if any.
Parameters
Name | Type | Required | Description |
---|---|---|---|
definitions | Definition[] | A collection of application definition objects to be imported. |
|
mode | ImportMode | Import mode, by default it is "replace". "replace" mode replaces all existing definitions with the provided collection, "merge" mode adds (if new) or updates (if already existing) the provided definitions. |
removemethod
Signature
(name: string) => Promise<void>
Description
Removed an application definition. This method will fire onAppRemoved if a definition was removed and it will do nothing if an app with this was was not found.
Parameters
Name | Type | Required | Description |
---|---|---|---|
name | string | The name of the definition to be removed. |
Instanceobject
Description
Object describing an application instance.
Properties
Property | Type | Default | Required | Description |
---|---|---|---|---|
agm | Instance | Interop instance. Use this to invoke Interop methods for that instance. |
||
application | Application | |||
id | string | Instance ID. |
Methods
getContextmethod
Signature
() => Promise<object>
Description
The starting context of the instance.
stopmethod
Signature
() => Promise<void>
Description
Stops the instance.
Intentobject
Description
An intent definition.
Properties
Property | Type | Default | Required | Description |
---|---|---|---|---|
contexts | string[] | A comma separated list of the types of contexts the intent offered by the application can process, here the first part of the context type is the namespace e.g."fdc3.contact, org.symphony.contact". |
||
customConfig | object | Custom configuration for the intent that may be required for a particular desktop agent. |
||
displayName | string | An optional display name for the intent that may be used in UI instead of the name. |
||
name | string | The name of the intent to 'launch'. In this case the name of an Intent supported by an Application. |
||
resultType | string | Result type may be a type name, the string "channel" (which indicates that the app will return a channel) or a string indicating a channel that returns a specific type, e.g. "channel<fdc3.instrument>" |
PropertiesObjectobject
Description
Generic object for passing properties, settings, etc., in the for of key/value pairs.