| Elektra 0.11.0

Public Member Functions | Static Public Attributes | List of all members
org.libelektra.Plugin Interface Reference

Java representation of an Elektra plugin. More...

Inheritance diagram for org.libelektra.Plugin:

## Public Member Functions
String | getName ()
int | open (KeySet config, Key errorKey)
| Calls the plugin's open function.
int | get (KeySet keySet, Key parentKey) throws KDBException
| Calls the plugin's get function.
int | set (KeySet keySet, Key parentKey) throws KDBException
| Calls the set function of the plugin.
int | error (KeySet keySet, Key parentKey)
| Calls the error function of the plugin.
int | close (Key parentKey)
| Calls the close function of the plugin.

## Static Public Attributes
static final String | JNI_MODULE_CONTRACT_ROOT = "system:/elektra/modules/jni"
| This is the root key of the JNI plugin wrapping a Java plugin for use by Elektra.
static final String | PROCESS_CONTRACT_ROOT = "system:/elektra/modules/java"
| This is the root key of the process plugin wrapping a Java plugin for use by Elektra.
static final int | STATUS_ERROR = -1
| Return value for plugin methods: An error occurred inside the plugin function.
static final int | STATUS_SUCCESS = 1
| Return value for plugin methods: Everything went fine.
static final int | STATUS_NO_UPDATE = 0
| Return value for plugin methods: Everything went fine and the function did not update the given key set / configuration.

## Detailed Description

Java representation of an Elektra plugin.

@implNote because of interface inheritance, it is required that all methods (open, get, set, error, close) are implemented, even if they are not supported. Whether or not a method is supported, must be defined via the correspoding `exports/has` key of the contract. Any method that is not supported, should simply be implemented as `throw new UnsupportedOperationException()`. If get isn't supported, you must still implement it and return the contract, when the parent key is below (or the same as) PROCESS_CONTRACT_ROOT. For other parent keys, you can safely throw UnsupportedOperationException.

## Member Function Documentation

## ◆ close()

int org.libelektra.Plugin.close | ( | Key | parentKey | ) |

Calls the close function of the plugin.

Parameters

  parentKey | a key

Returns
  the plugin's return value for close

Implemented in org.libelektra.NativePlugin.

## ◆ error()

int org.libelektra.Plugin.error | ( | KeySet | keySet,
|  | Key | parentKey
| ) |  |

Calls the error function of the plugin.

Parameters

  keySet | a keyset
  parentKey | a key

Returns
  the plugin's return value for error

## ◆ get()

int org.libelektra.Plugin.get | ( | KeySet | keySet,
|  | Key | parentKey
| ) |  | throws KDBException

Calls the plugin's get function.

Parameters

  keySet | Key set to store the retrieved keys in
  parentKey | Parent key for retrieval

Exceptions

  KDBException | if Elektra could not set the key set

Returns
  the plugin's return value for get

See also
  #STATUS_SUCCESS
  #STATUS_ERROR

## ◆ getName()

String org.libelektra.Plugin.getName | ( |  | ) |

Returns
  Name of the plugin

## ◆ open()

int org.libelektra.Plugin.open | ( | KeySet | config,
|  | Key | errorKey
| ) |  |

Calls the plugin's open function.

Parameters

  config | Plugin configuration key set
  errorKey | Used to store warnings and error information

Returns
  Plugin's return value for open

See also
  #STATUS_SUCCESS
  #STATUS_ERROR

Implemented in org.libelektra.NativePlugin.

## ◆ set()

int org.libelektra.Plugin.set | ( | KeySet | keySet,
|  | Key | parentKey
| ) |  | throws KDBException

Calls the set function of the plugin.

Parameters

  keySet | a keyset
  parentKey | a key

Exceptions

  KDBException | when Elektra could not set the keyset

Returns
  the plugin's return value for set

Implemented in org.libelektra.NativePlugin.

The documentation for this interface was generated from the following file:

- Plugin.java