-
- All Implemented Interfaces:
public abstract class ExtensionApiClass that defines all the public methods an
Extensionmay call to interface with the AEP SDK.
-
-
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() Object 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() Object 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. abstract <T extends ExtensionListener> booleanregisterEventListener(String eventType, String eventSource, Class<T> extensionListenerClass, ExtensionErrorCallback<ExtensionError> errorCallback)Registers a new event listener for current extension for the provided event type and source. abstract <T extends ExtensionListener> booleanregisterWildcardListener(Class<T> extensionListenerClass, ExtensionErrorCallback<ExtensionError> errorCallback)Registers a new wildcard event listener for the current extension. abstract booleansetSharedEventState(Map<String, Object> state, Event event, ExtensionErrorCallback<ExtensionError> errorCallback)Called by extension to set a shared state for itself. abstract booleansetXDMSharedEventState(Map<String, Object> state, Event event, ExtensionErrorCallback<ExtensionError> errorCallback)Called by extension to set an XDM shared state for itself. abstract Map<String, Object>getSharedEventState(String stateName, Event event, ExtensionErrorCallback<ExtensionError> errorCallback)Called by extension to get another extension's shared state. abstract Map<String, Object>getXDMSharedEventState(String stateName, Event event, ExtensionErrorCallback<ExtensionError> errorCallback)Called by extension to get another extension's XDM shared state. abstract booleanclearXDMSharedEventStates(ExtensionErrorCallback<ExtensionError> errorCallback)Called by extension to clear XDM shared state it has previously set. abstract booleanclearSharedEventStates(ExtensionErrorCallback<ExtensionError> errorCallback)Called by extension to clear all shared state it has previously set. -
-
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.
-
getSharedState
@Nullable() abstract SharedStateResult getSharedState(@NonNull() String extensionName, @Nullable() Event event, boolean barrier, @NonNull() Object 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.
-
getXDMSharedState
@Nullable() abstract SharedStateResult getXDMSharedState(@NonNull() String extensionName, @Nullable() Event event, boolean barrier, @NonNull() Object 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
-
registerEventListener
@Deprecated() abstract <T extends ExtensionListener> boolean registerEventListener(String eventType, String eventSource, Class<T> extensionListenerClass, ExtensionErrorCallback<ExtensionError> errorCallback)
Registers a new event listener for current extension for the provided event type and source.
This method executes asynchronously, returning immediately and registering the provided listener on the event hub thread. The provided ExtensionListener's constructor will be called when the registration is completed.
- 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)extensionListenerClass- required parameter, the listener class which extends the parent classerrorCallback- optional ExtensionErrorCallback which will be called if any error occurs during registration
-
registerWildcardListener
@Deprecated() abstract <T extends ExtensionListener> boolean registerWildcardListener(Class<T> extensionListenerClass, ExtensionErrorCallback<ExtensionError> errorCallback)
Registers a new wildcard event listener for the current extension. This listener will receive all events that are dispatched by the event hub.
You can register only one wildcard listener for your extension. If this method is called multiple times, the the existing wildcard listener will be unregistered before the new listener is registered.
This method executes asynchronously, returning immediately and registering the provided listener on the event hub thread. The provided ExtensionListener's constructor will be called when the registration is completed.
A wildcard listener is intended for debugging purposes only and it is strongly recommended to not use it in a production environment.
- Parameters:
extensionListenerClass- required parameter, the listener class which extends the parent classerrorCallback- optional ExtensionErrorCallback which will be called if any error occurs during registration
-
setSharedEventState
@Deprecated() abstract boolean setSharedEventState(Map<String, Object> state, Event event, ExtensionErrorCallback<ExtensionError> errorCallback)
Called by extension to set a shared state for itself. Usually called from a listener during event processing.
- Parameters:
state-Map<String, Object>representing current state of this extension.event- The Event for which the state is being set.errorCallback- optional ExtensionErrorCallback which will be called if an error occurred
-
setXDMSharedEventState
@Deprecated() abstract boolean setXDMSharedEventState(Map<String, Object> state, Event event, ExtensionErrorCallback<ExtensionError> errorCallback)
Called by extension to set an XDM shared state for itself. Usually called from a listener during event processing. 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.
- Parameters:
state-Map<String, Object>representing current XDM state of this extension.event- The Event for which the state is being set.errorCallback- optional ExtensionErrorCallback which will be called if an error occurred
-
getSharedEventState
@Deprecated() abstract Map<String, Object> getSharedEventState(String stateName, Event event, ExtensionErrorCallback<ExtensionError> errorCallback)
Called by extension to get another extension's shared state. Usually called from a listener during event processing.
- Parameters:
stateName- extension name for which to retrieve data.event- the Event for which the state is being requested.errorCallback- optional ExtensionErrorCallback which will be called if an error occurred or ifstateNameis null
-
getXDMSharedEventState
@Deprecated() abstract Map<String, Object> getXDMSharedEventState(String stateName, Event event, ExtensionErrorCallback<ExtensionError> errorCallback)
Called by extension to get another extension's XDM shared state. Usually called from a listener during event processing. If the
stateNameextension populates multiple mixins in their shared state, all the data will be returned at once and it can be accessed using path discovery.- Parameters:
stateName- extension name for which to retrieve data.event- the Event for which the state is being requested.errorCallback- optional ExtensionErrorCallback which will be called if an error occurred or ifstateNameis null
-
clearXDMSharedEventStates
@Deprecated() abstract boolean clearXDMSharedEventStates(ExtensionErrorCallback<ExtensionError> errorCallback)
Called by extension to clear XDM shared state it has previously set. Usually called during
Extension.onUnregistered().- Parameters:
errorCallback- optional ExtensionErrorCallback which will be called if an error occurred
-
clearSharedEventStates
@Deprecated() abstract boolean clearSharedEventStates(ExtensionErrorCallback<ExtensionError> errorCallback)
Called by extension to clear all shared state it has previously set. Usually called during
Extension.onUnregistered().- Parameters:
errorCallback- optional ExtensionErrorCallback which will be called if an error occurred
-
-
-
-