Class: EntityManagerFactory

EntityManagerFactory(optionsopt)

new EntityManagerFactory(optionsopt)

Creates a new EntityManagerFactory connected to the given destination

Parameters:
Name Type Attributes Description
options string | Object <optional>

The destination to connect with, or an options object

Properties
Name Type Attributes Default Description
host string <optional>

The destination to connect with

port number <optional>
80|443

The optional destination port to connect with

secure boolean <optional>
false

true To use a secure ssl encrypted connection

basePath string <optional>
"/v1"

The base path of the api

schema Object <optional>
null

The serialized schema as json used to initialize the metamodel

tokenStorage util.TokenStorage <optional>

The tokenStorage which should be used by this emf

tokenStorageFactory util.TokenStorageFactory <optional>

The tokenStorage factory implementation which
should be used for token storage

staleness number <optional>
60

The maximum staleness of objects that are acceptable while reading cached
data

Source:

Extends

Members

code :util.Code

Type:
Source:

connection :connector.Connector

Type:
Source:

isReady :boolean

Indicates if there is currently no exclusive operation executed
true If no exclusive lock is hold

Type:
  • boolean
Inherited From:
Source:

metamodel :metamodel.Metamodel

Type:
Source:

staleness :number

Type:
  • number
Source:

tokenStorage :util.TokenStorage

Type:
Source:

tokenStorageFactory :util.TokenStorageFactory

Type:
Source:

Methods

configure(options) → {void}

Apply additional configurations to this EntityManagerFactory

Parameters:
Name Type Description
options Object

The additional configuration options

Properties
Name Type Attributes Default Description
tokenStorage util.TokenStorage <optional>

The tokenStorage which should be used by this emf

tokenStorageFactory util.TokenStorageFactory <optional>

The tokenStorage factory implementation which
should be used for token storage

staleness number <optional>
60

The maximum staleness of objects that are acceptable while reading cached
data, 0 to always bypass the browser cache

Source:
Returns:
Type
void

connect(hostOrApp, secureopt) → {Promise.<this>}

Connects this EntityManager to the given destination

Parameters:
Name Type Attributes Default Description
hostOrApp string

The host or the app name to connect with

secure boolean <optional>
false

true To use a secure connection

Source:
Returns:
Type
Promise.<this>

connect(hostOrApp, portopt, secureopt, basePathopt) → {Promise.<this>}

Connects this EntityManager to the given destination

Parameters:
Name Type Attributes Default Description
hostOrApp string

The host or the app name to connect with

port number <optional>
80|443

The port to connect to

secure boolean <optional>
false

true To use a secure connection

basePath string <optional>
"/v1"

The base path of the api

Source:
Returns:
Type
Promise.<this>

createEntityManager(useSharedTokenStorageopt) → {EntityManager}

Create a new application-managed EntityManager.

Parameters:
Name Type Attributes Description
useSharedTokenStorage boolean <optional>

The token storage to persist the authorization token, or
true To use the shared token storage of the emf.
false To use a instance based storage.

Source:
Returns:

a new entityManager

Type
EntityManager

createMetamodel() → {metamodel.Metamodel}

Creates a new Metamodel instance, which is not connected

Source:
Returns:

A new Metamodel instance

Type
metamodel.Metamodel

ready(doneCallbackopt, failCallbackopt) → {Promise.<this>}

Waits on the previously requested operation and calls the doneCallback if the operation is fulfilled

Parameters:
Name Type Attributes Description
doneCallback util.Lockable~doneCallback <optional>

The callback which will be invoked when the previously
operations on this object is completed.

failCallback util.Lockable~failCallback <optional>

When the lock can't be released caused by a none
recoverable error

Inherited From:
Source:
Returns:

A promise which completes successfully, when the previously requested
operation completes

Type
Promise.<this>

(protected) withLock(callback, criticalopt) → {Promise.<T>}

Try to aquire an exclusive lock and executes the given callback.

Parameters:
Name Type Attributes Default Description
callback util.Lockable~callback

The exclusive operation to execute

critical boolean <optional>
false

Indicates if the operation is critical. If the operation is critical and the
operation fails, then the lock will not be released

Inherited From:
  • util.Lockable#withLock<T>
Source:
Throws:

If the lock can't be aquired

Type
Error
Returns:

A promise

Type
Promise.<T>