* in Industry THTH ry.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* in Industry THTH ry.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
import org.simantics.project.management.ServerManager;
import org.simantics.project.management.ServerManagerFactory;
import org.simantics.project.management.WorkspaceUtil;
import org.simantics.project.management.ServerManager;
import org.simantics.project.management.ServerManagerFactory;
import org.simantics.project.management.WorkspaceUtil;
import org.simantics.utils.strings.EString;
import org.simantics.utils.threads.ExecutorWorker;
import org.simantics.utils.threads.ThreadUtils;
import org.simantics.utils.strings.EString;
import org.simantics.utils.threads.ExecutorWorker;
import org.simantics.utils.threads.ThreadUtils;
sb.append("Conflict with "+problem.first+" and "+problem.second+".\n");
}
throw new PlatformException(sb.toString());
sb.append("Conflict with "+problem.first+" and "+problem.second+".\n");
}
throw new PlatformException(sb.toString());
Collection<IdentityNode> unsatisfiedDependencies = analyzer.getUnsatisfiedDependencies();
StringBuilder sb = new StringBuilder();
for (IdentityNode dep: unsatisfiedDependencies) {
Collection<IdentityNode> unsatisfiedDependencies = analyzer.getUnsatisfiedDependencies();
StringBuilder sb = new StringBuilder();
for (IdentityNode dep: unsatisfiedDependencies) {
LOGGER.info("Beginning of SimanticsPlatform.startUp");
SubMonitor monitor = SubMonitor.convert(progressMonitor, 1000);
LOGGER.info("Beginning of SimanticsPlatform.startUp");
SubMonitor monitor = SubMonitor.convert(progressMonitor, 1000);
// 0. Consult all startup extensions before doing anything with the workspace.
StartupExtensions.consultStartupExtensions();
// 0. Consult all startup extensions before doing anything with the workspace.
StartupExtensions.consultStartupExtensions();
// 0.2 Clear VariableRepository.repository static map which holds references to SessionImplDb
VariableRepository.clear();
// 0.2 Clear VariableRepository.repository static map which holds references to SessionImplDb
VariableRepository.clear();
// 0.3 Handle baseline database before opening db
@SuppressWarnings("unused")
boolean usingBaseline = handleBaselineDatabase();
// 0.3 Handle baseline database before opening db
@SuppressWarnings("unused")
boolean usingBaseline = handleBaselineDatabase();
// 1. Assert there is a database at <workspace>/db
SessionDescriptor sessionDescriptor = setupDatabase(databaseDriverId, monitor.newChild(200, SubMonitor.SUPPRESS_NONE), workspacePolicy, userAgent);
session = sessionDescriptor.getSession();
// 1. Assert there is a database at <workspace>/db
SessionDescriptor sessionDescriptor = setupDatabase(databaseDriverId, monitor.newChild(200, SubMonitor.SUPPRESS_NONE), workspacePolicy, userAgent);
session = sessionDescriptor.getSession();
// 2. Delete all indexes if we cannot be certain they are up-to-date
// A full index rebuild will be done later, before project activation.
XSupport support = session.getService(XSupport.class);
// 2. Delete all indexes if we cannot be certain they are up-to-date
// A full index rebuild will be done later, before project activation.
XSupport support = session.getService(XSupport.class);
// 3. Assert all graphs, and correct versions, are installed to the database
synchronizeOntologies(monitor.newChild(400, SubMonitor.SUPPRESS_NONE), ontologyPolicy, requireSynchronize);
// 3. Assert all graphs, and correct versions, are installed to the database
synchronizeOntologies(monitor.newChild(400, SubMonitor.SUPPRESS_NONE), ontologyPolicy, requireSynchronize);
// 4. Assert simantics.cfg exists
boolean installProject = assertConfiguration(monitor.newChild(25, SubMonitor.SUPPRESS_NONE),workspacePolicy);
// 4. Assert simantics.cfg exists
boolean installProject = assertConfiguration(monitor.newChild(25, SubMonitor.SUPPRESS_NONE),workspacePolicy);
// 6. Install all features into project, if in debug mode
updateInstalledGroups(monitor.newChild(25), true); //installProject);
// 6. Install all features into project, if in debug mode
updateInstalledGroups(monitor.newChild(25), true); //installProject);
// 7. Assert L0.Session in database for this session
assertSessionModel(monitor.newChild(25, SubMonitor.SUPPRESS_NONE));
// 7. Assert L0.Session in database for this session
assertSessionModel(monitor.newChild(25, SubMonitor.SUPPRESS_NONE));
} catch (DatabaseException e) {
LOGGER.error("Flushing queries failed.", e);
}
boolean loadProject = true;
try {
} catch (DatabaseException e) {
LOGGER.error("Flushing queries failed.", e);
}
boolean loadProject = true;
try {
sessionContext = SimanticsPlatform.INSTANCE.createSessionContext(true);
// This must be before setSessionContext since some listeners might query this
sessionContext.setHint(SimanticsKeys.KEY_PROJECT, SimanticsPlatform.INSTANCE.projectResource);
sessionContext = SimanticsPlatform.INSTANCE.createSessionContext(true);
// This must be before setSessionContext since some listeners might query this
sessionContext.setHint(SimanticsKeys.KEY_PROJECT, SimanticsPlatform.INSTANCE.projectResource);
Simantics.setSessionContext(sessionContext);
// 1. Put ResourceBinding that throws an exception to General Bindings
Simantics.setSessionContext(sessionContext);
// 1. Put ResourceBinding that throws an exception to General Bindings
simanticsBindings = new SimanticsBindings();
Bindings.classBindingFactory.addFactory( simanticsBindings );
simanticsBindings = new SimanticsBindings();
Bindings.classBindingFactory.addFactory( simanticsBindings );
session.registerService(Databoard.class, Bindings.databoard);
// Register datatype bindings
session.registerService(Databoard.class, Bindings.databoard);
// Register datatype bindings
Bindings.defaultBindingFactory.getRepository().put(RGB.Integer.BINDING.type(), RGB.Integer.BINDING);
Bindings.defaultBindingFactory.getRepository().put(Font.BINDING.type(), Font.BINDING);
if (support.rolledback() || sessionDescriptor.isFreshDatabase()) {
Bindings.defaultBindingFactory.getRepository().put(RGB.Integer.BINDING.type(), RGB.Integer.BINDING);
Bindings.defaultBindingFactory.getRepository().put(Font.BINDING.type(), Font.BINDING);
if (support.rolledback() || sessionDescriptor.isFreshDatabase()) {
try {
session.getService(IndexedRelations.class).fullRebuild(monitor.newChild(100), session);
} catch (IndexException e) {
try {
session.getService(IndexedRelations.class).fullRebuild(monitor.newChild(100), session);
} catch (IndexException e) {
project = Projects.loadProject(sessionContext.getSession(), SimanticsPlatform.INSTANCE.projectResource);
sessionContext.setHint(ProjectKeys.KEY_PROJECT, project);
monitor.worked(100);
project = Projects.loadProject(sessionContext.getSession(), SimanticsPlatform.INSTANCE.projectResource);
sessionContext.setHint(ProjectKeys.KEY_PROJECT, project);
monitor.worked(100);
// the user from undoing any initialization operations performed
// by the platform startup.
SimanticsPlatform.INSTANCE.discardSessionUndoHistory();
// the user from undoing any initialization operations performed
// by the platform startup.
SimanticsPlatform.INSTANCE.discardSessionUndoHistory();
try {
// Construct and initialize SessionContext from Session.
SessionContext sessionContext = SessionContext.create(session, init);
try {
// Construct and initialize SessionContext from Session.
SessionContext sessionContext = SessionContext.create(session, init);