public interface ExtensionService
DataExtension
s.
Obtaining instance:
- Obtain instance with getInstance()
.
- Make sure to catch a possible NoClassDefFoundError in case Plan is not installed
- Catch IllegalStateException in case ExtensionService is not enabled
Registering DataExtension
:
- Register your DataExtension
with register(DataExtension)
- Catch a possible IllegalArgumentException in case the DataExtension implementation is invalid.
Modifier and Type | Interface and Description |
---|---|
static class |
ExtensionService.Holder |
Modifier and Type | Method and Description |
---|---|
static ExtensionService |
getInstance()
Obtain instance of ExtensionService.
|
java.util.Optional<Caller> |
register(DataExtension extension)
Register your
DataExtension implementation. |
void |
unregister(DataExtension extension)
Unregister your
DataExtension implementation. |
static ExtensionService getInstance()
java.lang.NoClassDefFoundError
- If Plan is not installed and this class can not be found or if older Plan version is installed.java.lang.IllegalStateException
- If Plan is installed, but not enabled.java.util.Optional<Caller> register(DataExtension extension)
DataExtension
implementation.
You can use ExtensionExtractor.validateAnnotations()
in your Unit Tests to prevent IllegalArgumentExceptions here at runtime.
extension
- Your DataExtension implementation, see DataExtension
for requirements.Caller
that can be used to call for data update in Plan database manually - If the Optional is not present the user has disabled the extension in Plan config.java.lang.IllegalArgumentException
- If an implementation violation is found.void unregister(DataExtension extension)
DataExtension
implementation.
This method should be used if calling methods on the DataExtension suddenly becomes unavailable, due to plugin disable for example.
extension
- Your DataExtension implementation that was registered before.