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 Details

    • pepState

      protected final AtomicReference<RxPepState> pepState
      The pep state.
    • policyEnforcementPoint

      protected final IPolicyEnforcementPoint policyEnforcementPoint
      The policy enforcement point.
    • pepInterfaceDescription

      protected final Class<T> pepInterfaceDescription
      The documentation API.
  • Constructor Details

    • AbstractRxPep

      public AbstractRxPep(IPolicyEnforcementPoint policyEnforcementPoint, Class<T> pepInterfaceDescription)
      Instantiates a new Rx Pep.
      Parameters:
      pepInterfaceDescription - the documentation API
      policyEnforcementPoint - the policy enforcement point
  • Method Details

    • createInstanceAPI

      public T createInstanceAPI()
      Specified by:
      createInstanceAPI in interface RxPep<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 interface RxPep<T>
      Returns:
      true if Pep is registered at PMP and returns false if Pep had been registered before or registration is failed.
    • enforceDecision

      protected abstract Object enforceDecision(Method method, Object[] args)
    • getPolicyEnforcementPoint

      public IPolicyEnforcementPoint getPolicyEnforcementPoint()
      Description copied from interface: RxPep
      It returns a valid instance of IPolicyEnforcementPoint
      Specified by:
      getPolicyEnforcementPoint in interface RxPep<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.
      Specified by:
      getState in interface RxPep<T>
      Returns:
      the current RxPep state
    • 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 method
      methodArguments - the method arguments
      Returns:
      the event
      Throws:
      IncorrectPepDescriptionError - the incorrect Pep description error
    • readEventDescription

      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.
      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 type
      parametersAnnotations - the parameters annotations
      methodArguments - the method arguments
      Returns:
      the parameter list