* Removed static map from org.simantics.acorn.FileIO.
Moved the map into a session service as org.simantics.acorn.FileCache
* Changed org.simantics.db.testing.common.Tests utilities to use Acorn
instead of ProCore (AcornTestHandler). Did not introduce abstraction
for this for now.
refs #7855
Change-Id: I92fdce70a1e436cc13af3cf0738a7e227fddd682
private ArrayList<String> currentChanges = new ArrayList<String>();
public final Path dbFolder;
- public Path lastSessionDirectory;
- public Path workingDirectory;
+ private FileCache fileCache;
+ Path lastSessionDirectory;
+ Path workingDirectory;
public LRU<String, ClusterStreamChunk> streamLRU;
public LRU<Long, ChangeSetInfo> csLRU;
*
*/
- public ClusterManager(Path dbFolder) {
+ public ClusterManager(Path dbFolder, FileCache fileCache) {
this.dbFolder = dbFolder;
+ this.fileCache = fileCache;
}
public ArrayList<String> getChanges(long changeSetId) throws AcornAccessVerificationException, IllegalAcornStateException {
Path readDir = dbFolder.resolve(parts[1]);
int offset = Integer.parseInt(parts[2]);
int length = Integer.parseInt(parts[3]);
- FileInfo info = new FileInfo(fileLRU, readDir, parts[0], offset, length);
+ FileInfo info = new FileInfo(fileLRU, fileCache, readDir, parts[0], offset, length);
fileLRU.map(info);
}
// Update chunks
Long revisionId = Long.parseLong(parts[0]);
int offset = Integer.parseInt(parts[2]);
int length = Integer.parseInt(parts[3]);
- ChangeSetInfo info = new ChangeSetInfo(csLRU, readDir, revisionId, offset, length);
+ ChangeSetInfo info = new ChangeSetInfo(csLRU, fileCache, readDir, revisionId, offset, length);
csLRU.map(info);
}
try {
ArrayList<String> csids = new ArrayList<String>(currentChanges);
currentChanges = new ArrayList<String>();
- new ChangeSetInfo(csLRU, changeSetId, data, csids);
+ new ChangeSetInfo(csLRU, fileCache, changeSetId, data, csids);
} catch (Throwable t) {
throw new IllegalAcornStateException(t);
} finally {
try {
info = fileLRU.get(key);
if (info == null) {
- info = new FileInfo(fileLRU, key, (int) (offset + size));
+ info = new FileInfo(fileLRU, fileCache, key, (int) (offset + size));
}
} catch (Throwable t) {
throw new IllegalAcornStateException(t);
public long getTailChangeSetId() {
return state.tailChangeSetId;
}
-
+
+ public FileCache getFileCache() {
+ return fileCache;
+ }
+
}
--- /dev/null
+package org.simantics.acorn;
+
+import java.nio.file.Path;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.simantics.db.Disposable;
+
+/**
+ * @author Tuukka Lehtonen
+ * @since 1.32.0
+ */
+public class FileCache implements Disposable {
+
+ private Map<Path, FileIO> map = new HashMap<>();
+
+ public FileIO get(Path path) {
+ synchronized (map) {
+ return map.computeIfAbsent(path, FileIO::new);
+ }
+ }
+
+ @Override
+ public void dispose() {
+ map = new HashMap<>();
+ }
+
+}
import java.nio.file.Paths;
import java.nio.file.StandardOpenOption;
import java.nio.file.attribute.FileAttribute;
-import java.util.HashMap;
import java.util.HashSet;
-import java.util.Map;
import java.util.Set;
import org.simantics.databoard.file.RuntimeIOException;
public class FileIO {
-
- private static final FileAttribute<?>[] NO_ATTRIBUTES = new FileAttribute[0];
-
+
+ private static final FileAttribute<?>[] NO_ATTRIBUTES = {};
+
private static final Set<OpenOption> CREATE_OPTIONS = new HashSet<>(2);
private static final Set<OpenOption> APPEND_OPTIONS = new HashSet<>(1);
-
+
static {
CREATE_OPTIONS.add(StandardOpenOption.WRITE);
CREATE_OPTIONS.add(StandardOpenOption.CREATE);
-
+
APPEND_OPTIONS.add(StandardOpenOption.APPEND);
}
-
+
private Path path;
private int writePosition = 0;
- private FileIO(Path path) {
+ public FileIO(Path path) {
this.path = path;
}
-
- private static Map<Path, FileIO> map = new HashMap<Path, FileIO>();
-
- public static FileIO get(Path path) {
- synchronized(map) {
- FileIO existing = map.get(path);
- if(existing == null) {
- existing = new FileIO(path);
- map.put(path, existing);
- }
- return existing;
- }
- }
-
+
//private static final boolean TRACE_SWAP = false;
private static final boolean TRACE_PERF = false;
private Path dbFolder;
private final Database database;
private ServiceLocator locator;
+ private FileCache fileCache;
private MainProgram mainProgram;
static class ClientThreadFactory implements ThreadFactory {
this.database = database;
this.dbFolder = dbFolder;
this.locator = locator;
- this.clusters = new ClusterManager(dbFolder);
+ this.fileCache = new FileCache();
+ // This disposes the cache when the session is shut down
+ locator.registerService(FileCache.class, fileCache);
+ this.clusters = new ClusterManager(dbFolder, fileCache);
load();
ClusterSetsSupport cssi = locator.getService(ClusterSetsSupport.class);
cssi.setReadDirectory(clusters.lastSessionDirectory);
import java.nio.file.attribute.BasicFileAttributes;
import java.util.EnumSet;
import java.util.Properties;
+import java.util.stream.Stream;
import org.simantics.acorn.GraphClientImpl2;
import org.simantics.db.Database;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import fi.vtt.simantics.procore.internal.StaticSessionProperties;
+
/**
* @author Tuukka Lehtonen
*/
@Override
public void deleteFiles() throws ProCoreException {
deleteTree(folder);
+ File vgPath = StaticSessionProperties.virtualGraphStoragePath;
+ if (vgPath != null) {
+ try (Stream<Path> vgs = Files.list(vgPath.toPath())) {
+ for (Path p : vgs.toArray(Path[]::new))
+ deleteTree(p);
+ } catch (IOException e) {
+ throw new ProCoreException(e);
+ }
+ }
}
@Override
raLockFile = null;
Files.deleteIfExists(lockFile);
isRunning = false;
+ safeLoggingClose(currentClient, currentClient.getDbFolder());
+ currentClient = null;
} catch (IOException e) {
LOGGER.error("Failed to start database at " + folder.toAbsolutePath(), e);
}
throw new UnsupportedOperationException();
}
- private static void deleteTree(Path path) throws ProCoreException {
- if (!Files.exists(path))
- return;
-
- class Visitor extends SimpleFileVisitor<Path> {
- @Override
- public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
+ static class Visitor extends SimpleFileVisitor<Path> {
+ @Override
+ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
+ try {
+ Files.delete(file);
+ } catch (IOException ioe) {
+ LOGGER.error("Failed to delete file {}", file, ioe);
+ throw ioe;
+ }
+ return FileVisitResult.CONTINUE;
+ }
+ @Override
+ public FileVisitResult postVisitDirectory(Path dir, IOException e) throws IOException {
+ if (e == null) {
try {
- Files.delete(file);
+ Files.delete(dir);
} catch (IOException ioe) {
- ioe.printStackTrace();
+ LOGGER.error("Failed to delete directory {}", dir, ioe);
throw ioe;
}
return FileVisitResult.CONTINUE;
}
- @Override
- public FileVisitResult postVisitDirectory(Path dir, IOException e) throws IOException {
- if (e == null) {
- try {
- Files.delete(dir);
- } catch (IOException ioe) {
- ioe.printStackTrace();
- throw ioe;
- }
- return FileVisitResult.CONTINUE;
- }
- throw e;
- }
+ throw e;
}
+ }
+
+ private static void deleteTree(Path path) throws ProCoreException {
+ if (!Files.exists(path))
+ return;
try {
- Visitor v = new Visitor();
- EnumSet<FileVisitOption> opts = EnumSet.noneOf(FileVisitOption.class);
- Files.walkFileTree(path, opts, Integer.MAX_VALUE, v);
+ Files.walkFileTree(path, EnumSet.noneOf(FileVisitOption.class), Integer.MAX_VALUE, new Visitor());
} catch (IOException e) {
throw new ProCoreException("Could not delete " + path, e);
}
return;
try (AutoCloseable c = closeable) {
} catch (Exception e) {
- LOGGER.error("Failed to close " + closeable.getClass() + " of " + file.toAbsolutePath());
+ LOGGER.error("Failed to close " + closeable.getClass() + " of " + file.toAbsolutePath(), e);
+ }
+ }
+
+ private static void safeLoggingClose(Database.Session session, Path file) {
+ if (session == null)
+ return;
+ try {
+ session.close();
+ } catch (Exception e) {
+ LOGGER.error("Failed to close " + session.getClass() + " of " + file.toAbsolutePath(), e);
}
}
import java.util.ArrayList;
import java.util.Arrays;
+import org.simantics.acorn.FileCache;
import org.simantics.acorn.exception.AcornAccessVerificationException;
import org.simantics.acorn.exception.IllegalAcornStateException;
import org.simantics.db.service.Bytes;
private ArrayList<String> clusterChangeSetIds;
// Stub
- public ChangeSetInfo(LRU<Long, ChangeSetInfo> LRU, Path readDir, Long revision, int offset, int length) throws AcornAccessVerificationException {
- super(LRU, revision, readDir, "clusterStream", offset, length, false, false);
+ public ChangeSetInfo(LRU<Long, ChangeSetInfo> LRU, FileCache fileCache, Path readDir, Long revision, int offset, int length) throws AcornAccessVerificationException {
+ super(LRU, fileCache, revision, readDir, "clusterStream", offset, length, false, false);
LRU.map(this);
}
// New
- public ChangeSetInfo(LRU<Long, ChangeSetInfo> LRU, Long revision, byte[] bytes, ArrayList<String> clusterChangeSetIds) throws AcornAccessVerificationException {
- super(LRU, revision, LRU.getDirectory(), "clusterStream", true, true);
+ public ChangeSetInfo(LRU<Long, ChangeSetInfo> LRU, FileCache fileCache, Long revision, byte[] bytes, ArrayList<String> clusterChangeSetIds) throws AcornAccessVerificationException {
+ super(LRU, fileCache, revision, LRU.getDirectory(), "clusterStream", true, true);
this.metadataBytes = bytes;
this.metadataBytes = bytes;
this.clusterChangeSetIds = clusterChangeSetIds;
// Stub
public ClusterInfo(ClusterManager manager, LRU<ClusterUID, ClusterInfo> LRU, Path readDirectory, ClusterUID uid, int offset, int length) throws AcornAccessVerificationException {
- super(LRU, uid, readDirectory, uid.toString() + ".cluster", offset, length, false, false);
+ super(LRU, manager.getFileCache(), uid, readDirectory, uid.toString() + ".cluster", offset, length, false, false);
this.manager = manager;
this.cluster = null;
LRU.map(this);
// New
public ClusterInfo(ClusterManager manager, LRU<ClusterUID, ClusterInfo> LRU, ClusterImpl cluster) throws AcornAccessVerificationException, IllegalAcornStateException {
- super(LRU, cluster.getClusterUID(), LRU.getDirectory(), cluster.getClusterUID().toString() + ".cluster", true, true);
+ super(LRU, manager.getFileCache(), cluster.getClusterUID(), LRU.getDirectory(), cluster.getClusterUID().toString() + ".cluster", true, true);
this.manager = manager;
this.cluster = cluster;
LRU.insert(this, accessTime);
// Stub
public ClusterStreamChunk(ClusterManager manager, LRU<String, ClusterStreamChunk> LRU, Path readDir, String id, int offset, int length) throws AcornAccessVerificationException {
- super(LRU, id, readDir, "clusterStream", offset, length, false, false);
+ super(LRU, manager.getFileCache(), id, readDir, "clusterStream", offset, length, false, false);
this.manager = manager;
LRU.map(this);
}
// Creation
public ClusterStreamChunk(ClusterManager manager, LRU<String, ClusterStreamChunk> LRU, String id) throws AcornAccessVerificationException {
- super(LRU, id, LRU.getDirectory(), "clusterStream", true, true);
+ super(LRU, manager.getFileCache(), id, LRU.getDirectory(), "clusterStream", true, true);
this.manager = manager;
LRU.insert(this, accessTime);
}
import java.nio.file.Path;
+import org.simantics.acorn.FileCache;
import org.simantics.acorn.exception.AcornAccessVerificationException;
import org.simantics.acorn.exception.IllegalAcornStateException;
import org.simantics.db.Database.Session.ResourceSegment;
private TByteArrayList bytes;
// Stub
- public FileInfo(LRU<String, FileInfo> LRU, Path readDir, String id, int offset, int length) throws AcornAccessVerificationException {
- super(LRU, id, readDir, id.toString() + ".extFile", offset, length, false, false);
+ public FileInfo(LRU<String, FileInfo> LRU, FileCache fileCache, Path readDir, String id, int offset, int length) throws AcornAccessVerificationException {
+ super(LRU, fileCache, id, readDir, id.toString() + ".extFile", offset, length, false, false);
LRU.map(this);
}
// New
- public FileInfo(LRU<String, FileInfo> LRU, String id, int size) throws AcornAccessVerificationException {
- super(LRU, id, LRU.getDirectory(), id.toString() + ".extFile", true, true);
+ public FileInfo(LRU<String, FileInfo> LRU, FileCache fileCache, String id, int size) throws AcornAccessVerificationException {
+ super(LRU, fileCache, id, LRU.getDirectory(), id.toString() + ".extFile", true, true);
this.bytes = new TByteArrayList(size);
LRU.insert(this, accessTime);
}
import java.util.concurrent.Semaphore;
import java.util.concurrent.TimeUnit;
+import org.simantics.acorn.FileCache;
import org.simantics.acorn.FileIO;
import org.simantics.acorn.Persistable;
import org.simantics.acorn.exception.AcornAccessVerificationException;
// Final stuff
final protected LRU<MapKey, MapValue> LRU;
+ final protected FileCache fileCache;
final private Semaphore mutex = new Semaphore(1);
final private MapKey key;
final private String fileName;
private Thread mutexOwner;
// for loading
- public LRUObject(LRU<MapKey, MapValue> LRU, MapKey key, Path readDirectory, String fileName, int offset, int length, boolean dirty, boolean resident) {
+ public LRUObject(LRU<MapKey, MapValue> LRU, FileCache fileCache, MapKey key, Path readDirectory, String fileName, int offset, int length, boolean dirty, boolean resident) {
this.LRU = LRU;
+ this.fileCache = fileCache;
this.key = key;
this.fileName = fileName;
this.offset = offset;
}
// for creating
- public LRUObject(LRU<MapKey, MapValue> LRU, MapKey key, Path readDirectory, String fileName, boolean dirty, boolean resident) {
- this(LRU, key, readDirectory, fileName, -1, -1, dirty, resident);
+ public LRUObject(LRU<MapKey, MapValue> LRU, FileCache fileCache, MapKey key, Path readDirectory, String fileName, boolean dirty, boolean resident) {
+ this(LRU, fileCache, key, readDirectory, fileName, -1, -1, dirty, resident);
}
/*
Pair<byte[], Integer> pair = toBytes();
byte[] data = pair.first;
int length = pair.second;
- FileIO fio = FileIO.get(bytes);
+ FileIO fio = fileCache.get(bytes);
int offset = fio.saveBytes(data, length, overwrite());
setPosition(offset, length);
} catch (AcornAccessVerificationException | IllegalAcornStateException e) {
if(VERIFY) verifyAccess();
Path dir = getDirectory();
Path f = dir.resolve(getFileName());
- FileIO fio = FileIO.get(f);
+ FileIO fio = fileCache.get(f);
return fio.readBytes(getOffset(), getLength());
}
import org.simantics.acorn.exception.InvalidHeadStateException;
+/**
+ * @deprecated exists only for backwards compatibility
+ */
+@Deprecated
public class HeadState implements Serializable {
private static final long serialVersionUID = -4135031566499790077L;
String databaseId = serverInfo.getDatabaseId();
String serverId = serverInfo.getServerId();
- virtualGraphServerSupport.connect(databaseId + "." + serverId);
- clusterSetsSupport.connect(databaseId + "." + serverId);
+ String id = databaseId + "." + serverId;
+ virtualGraphServerSupport.connect(id);
+ clusterSetsSupport.connect(id);
}
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
-org.eclipse.jdt.core.compiler.compliance=1.7
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.7
+org.eclipse.jdt.core.compiler.source=1.8
import org.simantics.databoard.binding.error.BindingConstructionException;
import org.simantics.db.Session;
import org.simantics.db.exception.DatabaseException;
-import org.simantics.db.layer0.util.RuntimeEnvironmentRequest;
import org.simantics.db.management.ISessionContextProvider;
import org.simantics.db.management.ISessionContextProviderSource;
import org.simantics.db.management.SessionContext;
import org.simantics.db.management.SessionContextProvider;
import org.simantics.db.management.SingleSessionContextProviderSource;
import org.simantics.db.service.LifecycleSupport;
-import org.simantics.db.service.VirtualGraphSupport;
import org.simantics.db.testing.impl.Configuration;
import org.simantics.graph.db.TransferableGraphs;
import org.simantics.graph.representation.TransferableGraph1;
public static void freshDatabase() throws Exception {
DatabaseState state = freshWorkspace(Configuration.get().coreDir, null);
- AcornTests.shutdown(state);
+ shutdown(state);
}
public static DatabaseState existingDatabase() throws Exception {
AcornTestHandler testHandler = AcornTests.getTestHandler(testSettings, address);
testHandler.initNew();
initSimanticsStuff();
- SessionContext sessionContext = SimanticsPlatform.INSTANCE.startUp("acorn", null, RecoveryPolicy.FixError,
- OntologyRecoveryPolicy.Merge, true, new DefaultChoiceUserAgent());
+ SessionContext sessionContext = SimanticsPlatform.INSTANCE.startUp("acorn", null, RecoveryPolicy.FixError, OntologyRecoveryPolicy.Merge, true, new DefaultChoiceUserAgent());
return new DatabaseState(address, sessionContext);
}
SCLOsgi.SOURCE_REPOSITORY = null;
SCLOsgi.MODULE_REPOSITORY = null;
SCLOsgi.TEST_REPOSITORY = null;
-
-// VirtualGraphSupport vsupport;
-// if (state != null) {
-// vsupport = state.getSession().getService(VirtualGraphSupport.class);
-// vsupport.discard();
-// }
if (Platform.isRunning()) {
SimanticsPlatform.INSTANCE.shutdown(null);
session = null;
} catch (Exception e) {
session = null;
- throw new DatabaseException("Sessuion did not close cleanly.");
+ throw new DatabaseException("Session did not close cleanly.");
}
}
import org.simantics.db.Session;
import org.simantics.db.Statement;
import org.simantics.db.exception.DatabaseException;
-import org.simantics.db.layer0.util.RuntimeEnvironmentRequest;
import org.simantics.db.management.ISessionContextProvider;
import org.simantics.db.management.ISessionContextProviderSource;
import org.simantics.db.management.SessionContext;
import org.simantics.scl.osgi.SCLOsgi;
public class Tests {
- private static TestHandler testHandler;
+
+ private static AcornTestHandler testHandler;
+
public static boolean contains(Collection<Statement> stms, Resource predicate, Resource object) {
for(Statement stm : stms) {
if(stm.getPredicate().equals(predicate) && stm.getObject().equals(object)) return true;
}
return false;
}
+
public static DatabaseState freshWorkspace(String CORE_DIR, ArrayList<String> fileFilter) throws Exception {
SimanticsPlatform.INSTANCE.resetWorkspace(null, fileFilter);
return newSimanticsWorkspace(null, CORE_DIR);
}
+
public static void freshDatabase() throws Exception {
DatabaseState state = freshWorkspace(Configuration.get().coreDir, null);
- Tests.shutdown(state);
+ shutdown(state);
}
+
public static DatabaseState existingDatabase() throws Exception {
return oldSimanticsWorkspace(null, Configuration.get().coreDir);
}
+
private static void initSimanticsStuff() {
// Set session context provider.
final ISessionContextProvider provider = new SessionContextProvider(null);
Simantics.setSessionContextProviderSource(source);
org.simantics.db.layer0.internal.SimanticsInternal.setSessionContextProviderSource(source);
}
+
public static DatabaseState newSimanticsWorkspace(TestSettings testSettings, String address) throws Exception {
- TestHandler testHandler = Tests.getTestHandler(testSettings, address);
+ AcornTestHandler testHandler = getTestHandler(testSettings, address);
testHandler.initNew();
initSimanticsStuff();
SessionContext sessionContext = SimanticsPlatform.INSTANCE.startUp(Simantics.getDefaultDatabaseDriver(), null, RecoveryPolicy.FixError, OntologyRecoveryPolicy.Merge, true, new DefaultChoiceUserAgent());
- return new DatabaseState(address, sessionContext);
+ return new DatabaseState(address, sessionContext);
}
+
public static DatabaseState oldSimanticsWorkspace(TestSettings testSettings, String address) throws Exception {
- Tests.getTestHandler(testSettings, address);
+ getTestHandler(testSettings, address);
initSimanticsStuff();
SessionContext sessionContext = SimanticsPlatform.INSTANCE.startUp(Simantics.getDefaultDatabaseDriver(), null, RecoveryPolicy.FixError, OntologyRecoveryPolicy.Merge, false, null);
return new DatabaseState(address, sessionContext);
}
-// for (String ontology : testSettings.getOntologies()) {
-// initOntology(session, ontology);
-// }
-// String[] adapters = testSettings.getAdapters();
-// if(adapters != null) {
-// File[] files = new File[adapters.length];
-// for(int i=0;i<adapters.length;i++)
-// files[i] = new File(testSettings.getWorkspace(), adapters[i]);
-// System.err.println("Loading adapters: " + Arrays.toString(files));
-// AdapterRegistry2.getInstance().initialize(testSettings.getClass().getClassLoader(), null, files);
-// new AdaptionServiceInitializer().initialize(session);
-// }
-// return new DatabaseState(testHandler.getServer(), SessionContext.create(session, false));
-// }
-// @SuppressWarnings("deprecation")
-// private static DatabaseState initPlatform(TestHandler testHandler, boolean fresh) throws Exception {
-// // Starts database server.
-// SimanticsPlatform.INSTANCE.startUpExisting(null, RecoveryPolicy.ThrowError, true);
-// return new DatabaseState(SimanticsPlatform.INSTANCE.server, SimanticsPlatform.INSTANCE.sessionContext);
-// }
-// }
-// private static DatabaseState initDatabase(TestHandler testHandler, boolean fresh) throws DatabaseException {
-// TestSettings settings = TestSettings.getInstance();
-// if (fresh)
-// testHandler.initNew();
-// else
-// testHandler.initOld();
-// Session session = testHandler.getSession();
-// if (fresh) {
-// for(String ontology : settings.getOntologies()) {
-// initOntology(session, ontology);
-// }
-// }
-// String[] adapters = settings.getAdapters();
-// if(adapters != null) {
-// File[] files = new File[adapters.length];
-// for(int i=0;i<adapters.length;i++)
-// files[i] = new File(settings.getWorkspace(), adapters[i]);
-// System.err.println("Loading adapters: " + Arrays.toString(files));
-// AdapterRegistry2.getInstance().initialize(settings.getClass().getClassLoader(), null, files);
-// new AdaptionServiceInitializer().initialize(session);
-// }
-// return new DatabaseState(testHandler.getServer(), SessionContext.create(session, false));
-// }
-// private static DatabaseState initDatabaseDep(TestHandler testHandler, boolean fresh) throws Exception {
-// if (Platform.isRunning())
-// return initPlatform(testHandler, fresh);
-// else
-// return initDatabase(testHandler, fresh);
-// }
public static void shutdown(DatabaseState state) throws Exception {
if (SCLOsgi.MODULE_REPOSITORY != null)
SCLOsgi.MODULE_REPOSITORY.flush();
SCLOsgi.SOURCE_REPOSITORY = null;
SCLOsgi.MODULE_REPOSITORY = null;
SCLOsgi.TEST_REPOSITORY = null;
-
+
if (Platform.isRunning()) {
SimanticsPlatform.INSTANCE.shutdown(null);
return;
}
}
- public static void initOntology(Session session, String relative)
- throws DatabaseException {
+ public static void initOntology(Session session, String relative) throws DatabaseException {
// Open transferable graph file for layer0.
Binding binding;
try {
// public static TestHandler newTestHandler(TestSettings testSettings, String dbFolderName) throws DatabaseException {
// return new TestHandler(testSettings, dbFolderName);
// }
- public static TestHandler getTestHandler() throws DatabaseException {
+
+ public static AcornTestHandler getTestHandler() throws DatabaseException {
return getTestHandler(null, null);
}
- public static TestHandler getTestHandler(TestSettings testSettings, String address) throws DatabaseException {
+
+ public static AcornTestHandler getTestHandler(TestSettings testSettings, String address) throws DatabaseException {
if (null == testHandler)
- testHandler = new TestHandler(testSettings, address);
+ testHandler = new AcornTestHandler(testSettings, address);
return testHandler;
}
+
public static void closeSession(Session session) throws DatabaseException {
try {
LifecycleSupport support = session.getService(LifecycleSupport.class);
session = null;
} catch (Exception e) {
session = null;
- throw new DatabaseException("Sessuion did not close cleanly.");
+ throw new DatabaseException("Session did not close cleanly.");
}
}
- public static void killCore() throws DatabaseException {
+ public static void killCore() throws DatabaseException {
}
+
}