public final class D3NodeFactory extends Object
To avoid an IllegalArgumentException
, verify that the node type is correct before instantiating engines.
This can be checked in the property ebx.d3.mode
in the ebx.properties
file, or
using the methods isMasterNode()
and isSlaveNode()
.
Depending on the type of the node, only some methods may be accessible.
master
node, only createForMasterFromSession(Session)
is accessible.
slave
node, only createForSlaveFromSession(Session)
is accessible.
hub
, both methods are accessible.
single
node, that is, if D3 is deactivated, none of the methods are accessible.
Modifier and Type | Method and Description |
---|---|
D3NodeAsMaster |
createForMasterFromSession(Session aSession)
Creates a primary D3 engine to offer primary administrative functionalities.
|
D3NodeAsSlave |
createForSlaveFromSession(Session aSession)
Creates a replica D3 engine to offer replica administrative functionalities.
|
D3Node |
getCurrentD3Node()
Returns current
D3Node of the EBX® instance. |
static D3NodeFactory |
getInstance(Repository aRepository)
Get a D3 engine factory.
|
boolean |
isMasterNode()
Returns whether the current node is a primary node.
|
boolean |
isSlaveNode()
Returns whether the current node is a replica node.
|
public static D3NodeFactory getInstance(Repository aRepository)
aRepository
- repository in which D3 is runningNullPointerException
- if no repository is defined.public D3NodeAsMaster createForMasterFromSession(Session aSession)
aSession
- current user sessionIllegalStateException
- if called within a Batch
or if not in master
or
hub
node.public D3NodeAsSlave createForSlaveFromSession(Session aSession)
aSession
- current user sessionIllegalStateException
- if called within a Batch
or if not in slave
or
hub
node.public D3Node getCurrentD3Node()
D3Node
of the EBX® instance. This can be invoked
to perform read-only operations without a Session
.
If D3 mode is defined as single
, then null
is returned.
D3NodeAsMaster
,
D3NodeAsSlave
public boolean isMasterNode()
If true
, a primary engine can be created using the method
createForMasterFromSession(Session)
.
public boolean isSlaveNode()
If true
, a replica engine can be created using the method
createForSlaveFromSession(Session)
.