Class AbstractRxPep<T>
java.lang.Object
de.fraunhofer.iese.mydata.reactive.AbstractRxPep<T>
- Type Parameters:
T
-
- All Implemented Interfaces:
RxPep<T>
- Direct Known Subclasses:
ReactivePep
Base Implementation of a RxPep.
-
Field Summary
Modifier and TypeFieldDescriptionThe documentation API.protected final AtomicReference<RxPepState>
The pep state.protected final IPolicyEnforcementPoint
The policy enforcement point. -
Constructor Summary
ConstructorDescriptionAbstractRxPep
(IPolicyEnforcementPoint policyEnforcementPoint, Class<T> pepInterfaceDescription) Instantiates a new Rx Pep. -
Method Summary
Modifier and TypeMethodDescriptionrx.Observable<Boolean>
Registers the Pep at PMP.protected abstract Object
enforceDecision
(Method method, Object[] args) It returns a valid instance ofIPolicyEnforcementPoint
getState()
Returns one of the following RxPep states: REGISTRATION_DONE_SUCCESSFULLY: Pep is already registered at PMP. REGISTRATION_FAILED: Pep failed to register at PMP. REGISTRATION_NOT_STARTED: Registration has not been started yet and Pep needs to be initialized for the registration to be started. REGISTRATION_UNDER_PROCESS: Registration is being processed.protected abstract void
protected Event
readAndCreateEvent
(Method method, Object[] methodArguments) Gets the action id from the given method and creates a new event with specific UUID and parameters set.protected ActionId
readEventDescription
(Method method) Gets the platform, context and action values from the event specification of the given method and creates the action id and returns it.protected ParameterList
readParameterList
(Class<?>[] parametersType, Annotation[][] parametersAnnotations, Object[] methodArguments) Returns the annotations of type PepParamKey with their corresponding method argument.
-
Field Details
-
pepState
The pep state. -
policyEnforcementPoint
The policy enforcement point. -
pepInterfaceDescription
The documentation API.
-
-
Constructor Details
-
AbstractRxPep
public AbstractRxPep(IPolicyEnforcementPoint policyEnforcementPoint, Class<T> pepInterfaceDescription) Instantiates a new Rx Pep.- Parameters:
pepInterfaceDescription
- the documentation APIpolicyEnforcementPoint
- the policy enforcement point
-
-
Method Details
-
createInstanceAPI
- Specified by:
createInstanceAPI
in interfaceRxPep<T>
- Returns:
- the generic type
-
doRegisterAtPMP
Description copied from interface:RxPep
Registers the Pep at PMP.- Specified by:
doRegisterAtPMP
in interfaceRxPep<T>
- Returns:
- true if Pep is registered at PMP and returns false if Pep had been registered before or registration is failed.
-
enforceDecision
-
getPolicyEnforcementPoint
Description copied from interface:RxPep
It returns a valid instance ofIPolicyEnforcementPoint
- Specified by:
getPolicyEnforcementPoint
in interfaceRxPep<T>
- Returns:
IPolicyEnforcementPoint
-
getState
Description copied from interface:RxPep
Returns one of the following RxPep states:- REGISTRATION_DONE_SUCCESSFULLY: Pep is already registered at PMP.
- REGISTRATION_FAILED: Pep failed to register at PMP.
- REGISTRATION_NOT_STARTED: Registration has not been started yet and Pep needs to be initialized for the registration to be started.
- REGISTRATION_UNDER_PROCESS: Registration is being processed.
-
postSuccessfulRegistration
protected abstract void postSuccessfulRegistration() -
readAndCreateEvent
protected Event readAndCreateEvent(Method method, Object[] methodArguments) throws IncorrectPepDescriptionError Gets the action id from the given method and creates a new event with specific UUID and parameters set.- Parameters:
method
- the methodmethodArguments
- the method arguments- Returns:
- the event
- Throws:
IncorrectPepDescriptionError
- the incorrect Pep description error
-
readEventDescription
Gets the platform, context and action values from the event specification of the given method and creates the action id and returns it.- Parameters:
method
- the method- Returns:
- the action id
-
readParameterList
protected ParameterList readParameterList(Class<?>[] parametersType, Annotation[][] parametersAnnotations, Object[] methodArguments) Returns the annotations of type PepParamKey with their corresponding method argument.- Parameters:
parametersType
- parameter typeparametersAnnotations
- the parameters annotationsmethodArguments
- the method arguments- Returns:
- the parameter list
-