The storage

The novomind iSHOP installation provides multiple storages for each plugin.

A storage is returned by the com.novomind.ishop.api.modules.storage.service.StorageFactory, which Spring will inject for you. The StorageFactory works, just like every service, in a plugin specific application context. No other plugin will have access to your storage, nor will you have access to other plugin storages.

@Inject StorageFactory storageFactory;

public Storage getHistoryStorageForUser(String userId) {
  return storageFactory.getStorage("history_"+userId);
}

This storage is a simple key value store and works similar to a java map or other key value data stores.

storage.put("lastChanged", lastChangedStr);
storage.put("history", history);

boolean userHasHistory = storage.containsKey("history");

Optional<String> lastChanged = storage.get("lastChanged");
Optional<String> history = storage.get("history");

Complex data types need to be converted to json before they can be stored.