Class ExtensionApi
-
- All Implemented Interfaces:
public abstract class ExtensionApiClass that defines all the public methods an
Extensionmay call to interface with the AEP SDK.
-
-
Constructor Summary
Constructors Constructor Description ExtensionApi()
-
Method Summary
Modifier and Type Method Description abstract voidregisterEventListener(@NonNull() String eventType, @NonNull() String eventSource, @NonNull() ExtensionEventListener eventListener)Registers a new event listener for current extension for the provided event type and source. abstract voiddispatch(@NonNull() Event event)Dispatches an `Event` to the `EventHub` abstract voidstartEvents()Starts the `Event` queue for this extension abstract voidstopEvents()Stops the `Event` queue for this extension abstract voidcreateSharedState(@NonNull() Map<String, Object> state, @Nullable() Event event)Creates a new shared state for this extension. abstract SharedStateResolvercreatePendingSharedState(@Nullable() Event event)Creates a pending shared state for this extension. abstract SharedStateResultgetSharedState(@NonNull() String extensionName, @Nullable() Event event, boolean barrier, @NonNull() SharedStateResolution resolution)Gets the shared state data for a specified extension. abstract voidcreateXDMSharedState(@NonNull() Map<String, Object> state, @Nullable() Event event)Creates a new XDM shared state for this extension. abstract SharedStateResolvercreatePendingXDMSharedState(@Nullable() Event event)Creates a pending XDM shared state for this extension. abstract SharedStateResultgetXDMSharedState(@NonNull() String extensionName, @Nullable() Event event, boolean barrier, @NonNull() SharedStateResolution resolution)Gets the XDM shared state data for a specified extension. abstract voidunregisterExtension()Unregisters current extension. abstract voidgetHistoricalEvents(@NonNull() Array<EventHistoryRequest> eventHistoryRequests, boolean enforceOrder, @NonNull() EventHistoryResultHandler<Integer> handler)Retrieves a count of historical events matching the provided requests. -
-
Method Detail
-
registerEventListener
abstract void registerEventListener(@NonNull() String eventType, @NonNull() String eventSource, @NonNull() ExtensionEventListener eventListener)
Registers a new event listener for current extension for the provided event type and source.
- Parameters:
eventType- required parameter, the event type as a valid string (not null or empty)eventSource- required parameter, the event source as a valid string (not null or empty)eventListener- required parameter, the listener which extends the interface
-
dispatch
abstract void dispatch(@NonNull() Event event)
Dispatches an `Event` to the `EventHub`
- Parameters:
event- An Event to be dispatched to theEventHub
-
startEvents
abstract void startEvents()
Starts the `Event` queue for this extension
-
stopEvents
abstract void stopEvents()
Stops the `Event` queue for this extension
-
createSharedState
abstract void createSharedState(@NonNull() Map<String, Object> state, @Nullable() Event event)
Creates a new shared state for this extension. If event is null, one of two behaviors will be observed:
- If this extension has not previously published a shared state, shared state will be versioned at 0
- If this extension has previously published a shared state, shared state will be versioned at the latest
- Parameters:
state-Map<String, Object>representing current state of this extensionevent- The Event for which the state is being set.
-
createPendingSharedState
@Nullable() abstract SharedStateResolver createPendingSharedState(@Nullable() Event event)
Creates a pending shared state for this extension.
- If this extension has not previously published a shared state, shared state will be versioned at 0
- If this extension has previously published a shared state, shared state will be versioned at the latest
- Parameters:
event- The Event for which pending shared state is being set.- Returns:
SharedStateResolver that should be called with the shared state data when it is ready
-
getSharedState
@Nullable() abstract SharedStateResult getSharedState(@NonNull() String extensionName, @Nullable() Event event, boolean barrier, @NonNull() SharedStateResolution resolution)
Gets the shared state data for a specified extension.
- Parameters:
extensionName- extension name for which to retrieve data.event- the Event for which the state is being requested.barrier- If true, theEventHubwill only returnsetif extensionName has moved past event.resolution- the SharedStateResolution to resolve for returnSharedStateResultfor the requested extensionName and event
-
createXDMSharedState
abstract void createXDMSharedState(@NonNull() Map<String, Object> state, @Nullable() Event event)
Creates a new XDM shared state for this extension. The state passed to this API needs to be mapped to known XDM mixins. If an extension uses multiple mixins, the current data for all of them should be provided when the XDM shared state is set. If event is null, one of two behaviors will be observed:
- If this extension has not previously published a shared state, shared state will be versioned at 0
- If this extension has previously published a shared state, shared state will be versioned at the latest
- Parameters:
state-Map<String, Object>representing current state of this extensionevent- The Event for which the state is being set.
-
createPendingXDMSharedState
@Nullable() abstract SharedStateResolver createPendingXDMSharedState(@Nullable() Event event)
Creates a pending XDM shared state for this extension.
- If this extension has not previously published a shared state, shared state will be versioned at 0
- If this extension has previously published a shared state, shared state will be versioned at the latest
- Parameters:
event- The Event for which pending shared state is being set.- Returns:
SharedStateResolver that should be called with the shared state data when it is ready
-
getXDMSharedState
@Nullable() abstract SharedStateResult getXDMSharedState(@NonNull() String extensionName, @Nullable() Event event, boolean barrier, @NonNull() SharedStateResolution resolution)
Gets the XDM shared state data for a specified extension. If the stateName extension populates multiple mixins in their shared state, all the data will be returned at once and it can be accessed using path discovery.
- Parameters:
extensionName- extension name for which to retrieve data.event- the Event for which the state is being requested.barrier- If true, theEventHubwill only returnsetif extensionName has moved past event.resolution- the SharedStateResolution to resolve for returnSharedStateResultfor the requested extensionName and event
-
unregisterExtension
abstract void unregisterExtension()
Unregisters current extension. This method executes asynchronously, unregistering the extension on the event hub thread. onUnregistered method will be called at the end of this operation.
-
getHistoricalEvents
abstract void getHistoricalEvents(@NonNull() Array<EventHistoryRequest> eventHistoryRequests, boolean enforceOrder, @NonNull() EventHistoryResultHandler<Integer> handler)
Retrieves a count of historical events matching the provided requests.
- Parameters:
eventHistoryRequests- an array of EventHistoryRequests used to generate the hash and timeframe for the event lookupenforceOrder- if `true`, consecutive lookups will use the oldest timestamp from the previous event as their from datehandler- the EventHistoryResultHandler for each provided request
-
-
-
-