@Override public void initFeatures(Resource<?> resource) { SchemaManagement schema = resource.getFeature(SchemaManagement.class); String applicationName = resource.getFeature(KirraApplication.class).getName(); resource.setFeature( INodeStoreCatalog.class, new InMemoryNodeStoreCatalog(applicationName, schema)); }
@Override public void activateContext(Resource<?> resource) { InMemoryNodeStoreCatalog contextCatalog = (InMemoryNodeStoreCatalog) resource.getFeature(INodeStoreCatalog.class); TaskModeSelector taskModeSelector = resource.getFeature(TaskModeSelector.class); boolean readOnly = taskModeSelector.getMode() == Mode.ReadOnly; String environment = taskModeSelector.getEnvironment().toLowerCase(); contextCatalog.setReadOnly(readOnly); contextCatalog.setEnvironment(environment); }
@Override public void deactivateContext(Resource<?> resource, boolean operationSucceeded) { InMemoryNodeStoreCatalog contextCatalog = (InMemoryNodeStoreCatalog) resource.getFeature(INodeStoreCatalog.class); contextCatalog.setEnvironment(null); }