Shared Samples

Build, modify and run workflows on geospatial data using Spatial Modeler SDK. Build complex algorithms or run routine tasks, and build add-ons to ERDAS IMAGINE and GeoMedia.
Showing results for 
Search instead for 
Do you mean 

Client Storage

by Technical Evangelist ‎09-30-2019 02:57 AM - edited ‎09-30-2019 06:22 AM (67 Views)


The client storage sample shows different storage options on the client side. 

Bitbucket Link


MAE Client offers several ways to store information on the client side. In this sample the following storage options are shown:

  • Temporary Storage
  • Session Warehouse
  • Settings Warehouse

Temporary Storage

The StoragePlugin offers one action (addGeometryToStorage) to add a polygon to a temporary storage. The geometry is captured using a GeometryCapture instance. 
The storage is created as TemporaryStorage and is only available during the current session.


@Action(actionLocation = ActionLocation.PluginTab.class)
  public void addGeometryToStorage() {
    TemporaryStorage storage = getOrCreateStorage();

    GeometryCaptureListener<Polygon> geometryCaptureListener =
        new GeometryCaptureListener<>() {


          public void onGeometriesCaptured(GeometryCapture source, Stream<Polygon> geometries) {

            try {
            } catch (StorageException e) {
              Log.getLogger().log(Level.SEVERE, "", e);


  private TemporaryStorage getOrCreateStorage() {
    if (storage == null) {
      storage = ApplicationContext.getStorages().getTemporaryStorage("MyTemporaryStorage",
          RedlineMapInterpreter.class, STYLE);

    return storage;

When the storage is created, a new layer is added to the legend similar to the redlining or measurement layers. 



MAE Client offers a SessionCache to temporarily add values in case they are needed several times during the current session. 

The SessionWarehousePlugin offers one action (addSelectedElementToSession) that adds the id of the active layer and the id of the selected element to the SessionCache so that it might be displayed if the user clicks on showSessionValue.


private static final String LAYER = "LastSelectionLayer";
  private static final String ELEMENTID = "LastSelection";

  @Action(actionLocation = ActionLocation.PluginTab.class, activeLayerRequired = true,
      minSelection = 1, maxSelection = 1)
  public void addSelectedElementToSession() {

    SessionCache.put(LAYER, browser.getActiveLayer().orElseThrow().getId());


    SessionValueDialog dialog =
        new SessionValueDialog(SessionCache.get(LAYER), SessionCache.get(ELEMENTID));



MAE Client offers a SettingWarehouse to persist additional information on the client side so that the information does not get lost between different sessions. SettingWarehouse may only deal with simple datatypes.

The SettingWarehousePlugin offers one action that lets the user decide whether to show some additional user information in a dock panel by clicking on Show/Hide Stored Info or not.


public class SettingWarehousePlugin implements Plugin {

  public void onUiReady() {
    SettingWarehouse.put("StoredInfo", "MyUserName");

  @Action(actionLocation = ActionLocation.PluginTab.class)
  public void handleStoredInfo() {
    if (userDock == null) {
      userDock = getUserDock();

      SwingUi.addDock(userDock, DockConstraint.TOP);
    } else {
      userDock = null;