T
- Class of Requestpublic abstract class AsyncDominoJNX<T> extends java.lang.Object implements AsyncDominoBase<T>, io.reactivex.ObservableOnSubscribe<T>
Interaction with the Domino backend to execute requests based on DominoJNX
AsyncDominoBase.RequestType
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
apiName |
protected java.util.List<io.micrometer.core.instrument.Tag> |
appTags |
protected static org.slf4j.Logger |
logger |
protected io.vertx.core.json.JsonObject |
requestParams |
static java.lang.String |
UNNEEDED_CALL |
protected KeepUser |
user |
protected io.vertx.core.Vertx |
vertx |
Modifier | Constructor and Description |
---|---|
protected |
AsyncDominoJNX()
Default constructor for easy object creation
|
Modifier and Type | Method and Description |
---|---|
void |
accessControlCheck(KeepJnxSession session,
com.hcl.domino.data.Database db)
Checks if the current user has the required access to perform the operation on a given database
|
protected void |
dontCallProcessPayload() |
protected io.reactivex.Observer<T> |
emitterToObserver(io.reactivex.ObservableEmitter<T> oe) |
protected io.vertx.core.Future<java.lang.String> |
getActualDatabaseName(KeepUser actualUser,
io.vertx.core.json.JsonObject payloadData) |
java.lang.String |
getApiName() |
java.util.List<io.micrometer.core.instrument.Tag> |
getAppTags() |
TheBarbican |
getBarbican() |
java.lang.String |
getEventbusId() |
protected KeepDbInfo |
getKeepDbInfo() |
AsyncDominoBase.RequestType |
getRequestType() |
protected io.reactivex.ObservableEmitter<T> |
getSubscriber() |
KeepUser |
getUser() |
protected java.lang.String |
getUserForMetrics() |
boolean |
isProcessPayloadRequired()
Check if we need to execute processPayload or everything was done in preflight asynchronously
|
boolean |
isWorkInProgress()
Is the implementation of the (sub)class still work in progress? Needs to be overwritten by subclasses
|
protected void |
processDominoRequest(io.vertx.core.eventbus.Message<io.vertx.core.json.JsonObject> incoming)
The processDominoRequest method provides the EventBusResponseSubscriber that listens to the result of the database operation.
|
protected void |
recordAppMetrics(java.lang.String appId)
Records the use of this API for an application
|
void |
setApiName(java.lang.String apiName)
Sets the OperationId / APIName the implementing class is reacting to typically matched the class name
|
void |
setBarbican(TheBarbican barbican)
Setter for TheBarbican, allowing a mock TheBarbican to be used in tests
|
void |
setDbFileName(java.lang.String dbFileName)
Overwrite the physical file name for the database to act on.
|
void |
setKeepDbInfo(KeepDbInfo keepDbInfo)
Provides the database information like path and configured forms to the method.
|
void |
setProcessPayloadRequired(boolean processPayloadRequired)
When set to false no code in process incoming is executed usually added when everything is done async in preflight
|
void |
setRequestParams(io.vertx.core.json.JsonObject source)
Updates the parameter object coming in from the request
|
AsyncDominoBase<T> |
setRequestType(AsyncDominoBase.RequestType requestType) |
void |
setSubscriber(io.reactivex.ObservableEmitter<T> subscriber)
Sets the subscriber receiving the events that the class generates from interacting with the database.
|
void |
setUser(KeepUser user)
Overwrite the user to act upon.
|
void |
setVertx(io.vertx.core.Vertx vertx)
Inject the runtime into the request
|
void |
subscribe(io.reactivex.ObservableEmitter<T> newSubscriber)
Execution of the request inside a vert.x execute Blocking to ensure we don’t block the event loop Loads user and apiName (?db= query string param) from the observer
|
protected void |
validateDqlAccess(KeepJnxSession s,
com.hcl.domino.data.Database db)
Validate the user has access to run DQL, according to the DQL access formula in the KeepConfig
|
protected void |
validateOpenAccess() |
protected boolean |
validationCheck(boolean status,
java.lang.String message,
java.lang.Object... params)
Helper class to log failures to local onError method of subscriber used in custom validator
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
customValidator, getDbRequestParameters, preflight, process
public static final java.lang.String UNNEEDED_CALL
protected static final org.slf4j.Logger logger
protected io.vertx.core.json.JsonObject requestParams
protected io.vertx.core.Vertx vertx
protected final java.util.List<io.micrometer.core.instrument.Tag> appTags
protected KeepUser user
protected java.lang.String apiName
protected AsyncDominoJNX()
Default constructor for easy object creation
public boolean isWorkInProgress()
Is the implementation of the (sub)class still work in progress? Needs to be overwritten by subclasses
public void accessControlCheck(KeepJnxSession session, com.hcl.domino.data.Database db) throws KeepException
Checks if the current user has the required access to perform the operation on a given database
session
- Keep Sessiondb
- Domino databaseKeepException
public java.lang.String getApiName()
getApiName
in interface AsyncDominoBase<T>
getApiName
in interface KeepSubscriberInfo
public java.util.List<io.micrometer.core.instrument.Tag> getAppTags()
getAppTags
in interface AsyncDominoBase<T>
public TheBarbican getBarbican()
getBarbican
in interface AsyncDominoBase<T>
public java.lang.String getEventbusId()
public AsyncDominoBase.RequestType getRequestType()
getRequestType
in interface AsyncDominoBase<T>
public KeepUser getUser()
getUser
in interface AsyncDominoBase<T>
getUser
in interface KeepSubscriberInfo
public boolean isProcessPayloadRequired()
Check if we need to execute processPayload or everything was done in preflight asynchronously
isProcessPayloadRequired
in interface AsyncDominoBase<T>
public void setApiName(java.lang.String apiName)
AsyncDominoBase
Sets the OperationId / APIName the implementing class is reacting to typically matched the class name
setApiName
in interface AsyncDominoBase<T>
apiName
- the apiName to setpublic void setBarbican(TheBarbican barbican)
Setter for TheBarbican, allowing a mock TheBarbican to be used in tests
barbican
- public void setDbFileName(java.lang.String dbFileName)
AsyncDominoBase
Overwrite the physical file name for the database to act on. Used in mail and testing scenarios
setDbFileName
in interface AsyncDominoBase<T>
dbFileName
- the dbFileName to setpublic void setKeepDbInfo(KeepDbInfo keepDbInfo)
AsyncDominoBase
Provides the database information like path and configured forms to the method. Important for subrequest handling
setKeepDbInfo
in interface AsyncDominoBase<T>
keepDbInfo
- KeepDbInfo object for the database to be queriedpublic void setProcessPayloadRequired(boolean processPayloadRequired)
When set to false no code in process incoming is executed usually added when everything is done async in preflight
setProcessPayloadRequired
in interface AsyncDominoBase<T>
processPayloadRequired
- the processPayloadRequired to setpublic void setRequestParams(io.vertx.core.json.JsonObject source)
AsyncDominoBase
Updates the parameter object coming in from the request
setRequestParams
in interface AsyncDominoBase<T>
public AsyncDominoBase<T> setRequestType(AsyncDominoBase.RequestType requestType)
setRequestType
in interface AsyncDominoBase<T>
requestType
- used for metricspublic void setSubscriber(io.reactivex.ObservableEmitter<T> subscriber)
AsyncDominoBase
Sets the subscriber receiving the events that the class generates from interacting with the database. Could be and EventbusResponseSubscriber or a SubTask or a KeepTestSubscriber
setSubscriber
in interface AsyncDominoBase<T>
subscriber
- the subscriber to setpublic void setUser(KeepUser user)
AsyncDominoBase
Overwrite the user to act upon. Used in delegation scenarios or for test environments (doesn’t bypass security)
setUser
in interface AsyncDominoBase<T>
user
- the user to setpublic void setVertx(io.vertx.core.Vertx vertx)
AsyncDominoBase
Inject the runtime into the request
setVertx
in interface AsyncDominoBase<T>
vertx
- public void subscribe(io.reactivex.ObservableEmitter<T> newSubscriber)
Execution of the request inside a vert.x execute Blocking to ensure we don’t block the event loop Loads user and apiName (?db= query string param) from the observer
subscribe
in interface io.reactivex.ObservableOnSubscribe<T>
protected void dontCallProcessPayload() throws KeepExceptionServer
KeepExceptionServer
protected io.reactivex.Observer<T> emitterToObserver(io.reactivex.ObservableEmitter<T> oe)
oe
- Observable emitterprotected io.vertx.core.Future<java.lang.String> getActualDatabaseName(KeepUser actualUser, io.vertx.core.json.JsonObject payloadData)
protected KeepDbInfo getKeepDbInfo()
protected io.reactivex.ObservableEmitter<T> getSubscriber()
protected java.lang.String getUserForMetrics()
protected void processDominoRequest(@Nonnull io.vertx.core.eventbus.Message<io.vertx.core.json.JsonObject> incoming)
The processDominoRequest method provides the EventBusResponseSubscriber that listens to the result of the database operation. Most operations return JSON, but some (Attachments, MIME content) use Buffers. This default method uses JSON responses, overwrite this method in your extension to AsyncDominoJNX with an EventBusResponseSubscriber expecting your data type
incoming
- protected void recordAppMetrics(java.lang.String appId)
Records the use of this API for an application
appId
- protected void validateDqlAccess(KeepJnxSession s, com.hcl.domino.data.Database db) throws KeepException
Validate the user has access to run DQL, according to the DQL access formula in the KeepConfig
s
- db
- KeepException
- error, e.g. not enough access or failure parsing formulaprotected void validateOpenAccess() throws KeepExceptionOpenAccessBlocked
KeepExceptionOpenAccessBlocked
protected boolean validationCheck(boolean status, java.lang.String message, java.lang.Object... params)
Helper class to log failures to local onError method of subscriber used in custom validator
status
- condition if false triggers onErrormessage
- the error messageparams
- Parameters to format the message