Atoti Server Extension reference page
Introduction
This feature was developed to be used in association with Atoti Python SDK, it helps user define complex components that cannot be defined using Python alone. You can find the reference documentation for Atoti Python SDK here.
The Atoti Server Extension allows you to extend the basic Atoti application by defining new components and functionalities—such as custom measures, post-processors, and REST endpoints with custom security—that can be used in your applications.
Configuration
To use
, the first step is to create a new Maven project with the atoti-runtime-plugin-parent
as the parent POM. This can be done by using the Atoti Maven Archetype:
<parent>
<groupId>io.atoti</groupId>
<artifactId>atoti-runtime-plugin-parent</artifactId>
</parent>
You can use 6.1.10-SNAPSHOT to specify the version of Atoti Server Extension you want to use.
Child POMs using atoti-runtime-plugin-parent
as their parent inherit:
- Standard Atoti Server Extension dependencies with managed versions and provided scope, ready for plugin development.
- Java 21 compiler settings for consistent builds.
- Maven Compiler Plugin configuration, including annotation processors (Lombok, Spring Boot).
- Assembly profile for packaging plugins using the Atoti assembly descriptor.
- Distribution management setup for publishing artifacts.
- Best practices for plugin structure and build, reducing boilerplate and ensuring compatibility with Atoti Runtime.
Features
In this section, you can find the features that are available through Atoti Server Extension.
Beans provided by Atoti Server Extension
When using Atoti Server Extension, you are guaranteed to have access to the following beans:
IActivePivotManager
IDatabase
IDatastore
IContentService
IPluginSetup
which is used to register custom measures and post-processors see.
Those Beans can prove useful when you want to create post-processors or want to interact with the Atoti application in a more advanced way in a custom REST controller.
Custom Measures and Post-processors
Atoti Server Extension allows you to create custom measures and post-processors that can be used in your Atoti applications.
A detailed guide on how to create custom measures and post-processors can be found in the custom measures and post-processors page.
Something not mentioned in the how-to is that you can specify a formatter when creating your custom measure formula by overriding IFormulaFactory.computeFormatter()
Example
/** Arguments class for multiply by two measure. */
public record MultiplyByTwoArguments(String underlyingMeasureName, LevelIdentifier perLevel)
implements IMeasureDefinition {
public static final String PLUGIN_KEY = "INCREMENT_BY_ONE";
@Override
public String getPluginKey() {
return PLUGIN_KEY;
}
}
private MeasureRegistration<MultiplyByTwoArguments> createMultiplyByTwoRegistration() {
return MeasureRegistration.<MultiplyByTwoArguments>builder()
.measureKey(MultiplyByTwoArguments.PLUGIN_KEY)
.definitionClass(MultiplyByTwoArguments.class)
.factory(
new IFormulaFactory<>() {
@Override
public CopperMeasure buildFormula(
final MultiplyByTwoArguments definition,
final IFormulaFactoryEnvironment environment) {
return environment
.getMeasure(definition.underlyingMeasureName())
.getFormula()
.multiply(Copper.constant(2))
.per(Copper.level(definition.perLevel()))
.sum();
}
@Override
public Optional<String> computeFormatter(
final MultiplyByTwoArguments definition, final IFieldType outputType) {
if (outputType.isPrimitive() && outputType.getContentType() == ContentType.DOUBLE) {
return Optional.of("DOUBLE[#,###.###]");
} else {
throw new IllegalStateException(
"Underlying value should be of type double, but got " + outputType);
}
}
})
.build();
}
The arguments passed to the custom measures inside a IMeasureDefinition
from Python are of the following types:
- Any Java primitive type (e.g.
int
,double
,boolean
, etc.) LevelIdentifier
HierarchyIdentifier
StoreField
- Measure name as a
String
- Column name as a
String
- Dimension name as a
String
- Any array/tuple and map of the above types
Custom REST Endpoints
Atoti Server Extension allows you to create custom REST endpoints that can be used in your Atoti applications.
A detailed guide on how to apply your custom security with DSLs provided by Atoti Runtime to your REST endpoints can be found in the custom REST security page.
About Python SDK
This feature is supposed to be used in association with the Atoti Python SDK, once the jar for your plugin is created on build, you can provide it to the Python session config as an extra_jars
.