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
public abstract class AbstractRxPep<T> extends Object implements RxPep<T>
Base Implementation of a RxPep.
-
-
Field Summary
Fields Modifier and Type Field Description protected Class<T>
pepInterfaceDescription
The documentation API.protected java.util.concurrent.atomic.AtomicReference<RxPepState>
pepState
The pep state.protected de.fraunhofer.iese.mydata.component.interfaces.IPolicyEnforcementPoint
policyEnforcementPoint
The policy enforcement point.
-
Constructor Summary
Constructors Constructor Description AbstractRxPep(de.fraunhofer.iese.mydata.component.interfaces.IPolicyEnforcementPoint policyEnforcementPoint, Class<T> pepInterfaceDescription)
Instantiates a new Rx Pep.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description T
createInstanceAPI()
rx.Observable<Boolean>
doRegisterAtPMP()
Registers the Pep at PMP.protected abstract Object
enforceDecision(Method method, Object[] args)
de.fraunhofer.iese.mydata.component.interfaces.IPolicyEnforcementPoint
getPolicyEnforcementPoint()
It returns a valid instance ofIPolicyEnforcementPoint
RxPepState
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
postSuccessfulRegistration()
protected de.fraunhofer.iese.mydata.policy.event.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 de.fraunhofer.iese.mydata.policy.event.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 de.fraunhofer.iese.mydata.policy.parameter.ParameterList
readParameterList(Class<?>[] parametersType, java.lang.annotation.Annotation[][] parametersAnnotations, Object[] methodArguments)
Returns the annotations of type PepParamKey with their corresponding method argument.
-
-
-
Field Detail
-
pepState
protected final java.util.concurrent.atomic.AtomicReference<RxPepState> pepState
The pep state.
-
policyEnforcementPoint
protected final de.fraunhofer.iese.mydata.component.interfaces.IPolicyEnforcementPoint policyEnforcementPoint
The policy enforcement point.
-
-
Constructor Detail
-
AbstractRxPep
public AbstractRxPep(de.fraunhofer.iese.mydata.component.interfaces.IPolicyEnforcementPoint policyEnforcementPoint, Class<T> pepInterfaceDescription)
Instantiates a new Rx Pep.- Parameters:
pepInterfaceDescription
- the documentation APIpolicyEnforcementPoint
- the policy enforcement point
-
-
Method Detail
-
createInstanceAPI
public T createInstanceAPI()
- Specified by:
createInstanceAPI
in interfaceRxPep<T>
- Returns:
- the generic type
-
doRegisterAtPMP
public rx.Observable<Boolean> 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.
-
getPolicyEnforcementPoint
public de.fraunhofer.iese.mydata.component.interfaces.IPolicyEnforcementPoint getPolicyEnforcementPoint()
Description copied from interface:RxPep
It returns a valid instance ofIPolicyEnforcementPoint
- Specified by:
getPolicyEnforcementPoint
in interfaceRxPep<T>
- Returns:
IPolicyEnforcementPoint
-
getState
public RxPepState 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 de.fraunhofer.iese.mydata.policy.event.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
protected de.fraunhofer.iese.mydata.policy.event.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.- Parameters:
method
- the method- Returns:
- the action id
-
readParameterList
protected de.fraunhofer.iese.mydata.policy.parameter.ParameterList readParameterList(Class<?>[] parametersType, java.lang.annotation.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
-
-