--- /dev/null
+package org.simantics.acorn;
+
+import java.nio.file.Path;
+import java.util.Properties;
+
+import org.simantics.db.Database;
+import org.simantics.db.Driver.Management;
+import org.simantics.db.exception.DatabaseException;
+import org.simantics.db.server.ProCoreException;
+
+public class AcornManagement implements Management {
+
+ private final Database db;
+ private final Properties properties;
+
+ AcornManagement(Path dbFolder, Properties properties) throws ProCoreException {
+ db = AcornDatabaseManager.getDatabase(dbFolder);
+ this.properties = properties;
+ }
+
+ @Override
+ public boolean exist() throws DatabaseException {
+ return db.isFolderOk();
+ }
+
+ @Override
+ public void delete() throws DatabaseException {
+ db.deleteFiles();
+ if (exist())
+ throw new DatabaseException("Failed to delete database. folder=" + db.getFolder());
+ }
+
+ @Override
+ public void create() throws DatabaseException {
+ db.initFolder(properties);
+ if (!exist())
+ throw new DatabaseException("Failed to create ProCore database. folder=" + db.getFolder());
+ }
+
+ @Override
+ public void purge() throws DatabaseException {
+ db.purgeDatabase();
+ }
+
+ @Override
+ public void shutdown() throws DatabaseException {
+ db.tryToStop();
+ db.disconnect();
+ }
+
+}