Elektra  0.9.7
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
org.libelektra.KDB Class Reference

Represents a session with the Elektra key database. More...

Inherits AutoCloseable.

Public Member Functions

void close () throws KDBException
 Closes the KDB session and frees native resources associated with it. More...
 
void close (Key errorKey) throws KDBException
 Closes the KDB session and frees native resources associated with it. More...
 
KeySet get (Key parentKey) throws KDBException
 Fetches at least all keys that are sub-keys or children of sub-keys of the supplied parent key. More...
 
KDB get (KeySet keySet, Key parentKey) throws KDBException
 Fetches at least all keys that are sub-keys or children of sub-keys of the supplied parent key. More...
 
KDB set (KeySet keySet, Key errorKey) throws KDBException
 Will update changed keys of the given key set in the backend. More...
 

Static Public Member Functions

static KDB open () throws KDBException
 Opens a new KDB session. More...
 
static KDB open (Key errorKey) throws KDBException
 Opens a new KDB session using the specified. More...
 
static KDB open (KeySet contract) throws KDBException
 Opens KDB session using the specified. More...
 
static KDB open (KeySet contract, Key errorKey) throws KDBException
 Opens KDB session using the specified. More...
 
static KeySet goptsContract (String[] args, String[] env, Key parentKey, KeySet goptsConfig)
 Creates a contract for use with KDB#open(KeySet, Key) that mounts and configures the. More...
 
static void goptsContract (KeySet contract, String[] args, String[] env, Key parentKey, KeySet goptsConfig)
 Creates a contract for use with KDB#open(KeySet, Key) that mounts and configures the. More...
 

Protected Member Functions

Pointer getPointer ()
 

Detailed Description

Represents a session with the Elektra key database.

@apiNote Close after usage, or simply use a try-with-resources statement

Member Function Documentation

◆ close() [1/2]

void org.libelektra.KDB.close ( ) throws KDBException
inline

Closes the KDB session and frees native resources associated with it.

Exceptions
KDBExceptionif opening the session fails - see specialization of KDBException
KDBClosedExceptionif this session has already been closed

◆ close() [2/2]

void org.libelektra.KDB.close ( Key  errorKey) throws KDBException
inline

Closes the KDB session and frees native resources associated with it.

Parameters
errorKeyKey holding error and warning information
Exceptions
KDBExceptionif opening the session fails - see specialization of KDBException
KDBClosedExceptionif this session has already been closed
KeyReleasedExceptionif
parentKey
has already been released
IllegalArgumentExceptionif
errorKey
is
null
See also
Key::createNameless()

◆ get() [1/2]

KeySet org.libelektra.KDB.get ( Key  parentKey) throws KDBException
inline

Fetches at least all keys that are sub-keys or children of sub-keys of the supplied parent key.

Parameters
parentKeyRoot key which name is used to fetch keys below it
Returns
New KeySet containing the fetched keys
Exceptions
KDBExceptionif loading keys fails - see specialization of KDBException
KDBClosedExceptionif this session has already been closed
KeyReleasedExceptionif
parentKey
has already been released
IllegalArgumentException

◆ get() [2/2]

KDB org.libelektra.KDB.get ( KeySet  keySet,
Key  parentKey 
) throws KDBException
inline

Fetches at least all keys that are sub-keys or children of sub-keys of the supplied parent key.

Parameters
keySetKeySet used to store the fetched keys
parentKeyRoot key which name is used to fetch keys below it
Returns
This KDB session, enabling a fluent interface
Exceptions
KDBExceptionif loading keys fails - see specialization of KDBException
KDBClosedExceptionif this session has already been closed
KeySetReleasedExceptionif
keySet
has already been released
KeyReleasedExceptionif
parentKey
has already been released
IllegalArgumentExceptionif
keySet
or
parentKey
is
null

◆ getPointer()

Pointer org.libelektra.KDB.getPointer ( )
inlineprotected
Returns
JNA pointer to the native pointer for this key set
Exceptions
KDBClosedExceptionif this KDB session has already been closed

◆ goptsContract() [1/2]

static void org.libelektra.KDB.goptsContract ( KeySet  contract,
String[]  args,
String[]  env,
Key  parentKey,
KeySet  goptsConfig 
)
inlinestatic

Creates a contract for use with KDB#open(KeySet, Key) that mounts and configures the.

gopts

plugin

Parameters
contractthe KeySet into which the contract is written
argsthe arguments that will be converted into argc and argv for gopts
envthe environment variables that gopts will use
parentKeythe parent key that gopts will use
goptsConfigthe config KeySet used for mounting gopts
Exceptions
IllegalArgumentExceptionif any of the arguments are
null
KeySetReleasedExceptionif
contract
or
goptsConfig
has already been released
KeyReleasedExceptionif
parentKey
has already been released
IllegalArgumentExceptionif any of the specified parameters is
null

◆ goptsContract() [2/2]

static KeySet org.libelektra.KDB.goptsContract ( String[]  args,
String[]  env,
Key  parentKey,
KeySet  goptsConfig 
)
inlinestatic

Creates a contract for use with KDB#open(KeySet, Key) that mounts and configures the.

gopts

plugin

Parameters
argsthe arguments that will be converted into argc and argv for gopts
envthe environment variables that gopts will use
parentKeythe parent key that gopts will use
goptsConfigthe config KeySet used for mounting gopts
Returns
new KeySet containing the contract
Exceptions
IllegalArgumentExceptionif any of the arguments are
null
KeySetReleasedExceptionif
goptsConfig
has already been released
KeyReleasedExceptionif
parentKey
has already been released
IllegalArgumentExceptionif any of the specified parameters is
null
See also
KeySet::release()

◆ open() [1/4]

static KDB org.libelektra.KDB.open ( ) throws KDBException
inlinestatic

Opens a new KDB session.

Returns
New KDB session
Exceptions
KDBExceptionif opening the session fails - see specialization of KDBException

◆ open() [2/4]

static KDB org.libelektra.KDB.open ( Key  errorKey) throws KDBException
inlinestatic

Opens a new KDB session using the specified.

errorKey

to store possible warnings and error information

Parameters
errorKeyUsed to store warnings and error information
Returns
New KDB session
Exceptions
KDBExceptionif opening the session fails - see specialization of KDBException
KeyReleasedExceptionif
errorKey
has already been released
IllegalArgumentExceptionif
errorKey
is
null
See also
Key::createNameless()

◆ open() [3/4]

static KDB org.libelektra.KDB.open ( KeySet  contract) throws KDBException
inlinestatic

Opens KDB session using the specified.

errorKey

to store possible warnings and error information

Parameters
contractContract that will be ensured by Elektra#kdbOpen(Pointer, Pointer)
Returns
New KDB session
Exceptions
KDBExceptionif opening the session fails - see specialization of KDBException
KeySetReleasedExceptionif
contract
has already been released
IllegalArgumentExceptionif
contract
or
errorKey
is
null

◆ open() [4/4]

static KDB org.libelektra.KDB.open ( KeySet  contract,
Key  errorKey 
) throws KDBException
inlinestatic

Opens KDB session using the specified.

errorKey

to store possible warnings and error information

Parameters
contractContract that will be ensured by Elektra#kdbOpen(Pointer, Pointer)
errorKeyUsed to store warnings and error information
Returns
New KDB session
Exceptions
KDBExceptionif opening the session fails - see specialization of KDBException
KeySetReleasedExceptionif
contract
has already been released
KeyReleasedExceptionif
errorKey
has already been released
IllegalArgumentExceptionif
contract
or
errorKey
is
null
See also
Key::createNameless()

◆ set()

KDB org.libelektra.KDB.set ( KeySet  keySet,
Key  errorKey 
) throws KDBException
inline

Will update changed keys of the given key set in the backend.

get() has to be called before this function may be executed.

Parameters
keySetKeySet which contains keys to be updated in the backend
errorKeyUsed to store warnings and error information
Returns
This KDB session, enabling a fluent interface
Exceptions
KDBExceptionif storing keys fails - see specialization of KDBException
KDBClosedExceptionif this session has already been closed
KeySetReleasedExceptionif
keySet
has already been released
KeyReleasedExceptionif
errorKey
has already been released
See also
Key::createNameless()

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