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>pepInterfaceDescriptionThe documentation API.protected java.util.concurrent.atomic.AtomicReference<RxPepState>pepStateThe pep state.protected de.fraunhofer.iese.mydata.component.interfaces.IPolicyEnforcementPointpolicyEnforcementPointThe 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 TcreateInstanceAPI()rx.Observable<Boolean>doRegisterAtPMP()Registers the Pep at PMP.protected abstract ObjectenforceDecision(Method method, Object[] args)de.fraunhofer.iese.mydata.component.interfaces.IPolicyEnforcementPointgetPolicyEnforcementPoint()It returns a valid instance ofIPolicyEnforcementPointRxPepStategetState()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 voidpostSuccessfulRegistration()protected de.fraunhofer.iese.mydata.policy.event.EventreadAndCreateEvent(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.ActionIdreadEventDescription(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.ParameterListreadParameterList(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:
createInstanceAPIin interfaceRxPep<T>- Returns:
- the generic type
-
doRegisterAtPMP
public rx.Observable<Boolean> doRegisterAtPMP()
Description copied from interface:RxPepRegisters the Pep at PMP.- Specified by:
doRegisterAtPMPin 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:RxPepIt returns a valid instance ofIPolicyEnforcementPoint- Specified by:
getPolicyEnforcementPointin interfaceRxPep<T>- Returns:
IPolicyEnforcementPoint
-
getState
public RxPepState getState()
Description copied from interface:RxPepReturns 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
-
-