1 /*******************************************************************************
2 * Copyright (c) 2007, 2010 Association for Decentralized Information Management
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * VTT Technical Research Centre of Finland - initial API and implementation
11 *******************************************************************************/
12 package org.simantics.simulation.experiment;
14 import java.util.concurrent.locks.Lock;
16 import org.eclipse.core.runtime.IProgressMonitor;
17 import org.simantics.databoard.accessor.Accessor;
18 import org.simantics.db.ReadGraph;
19 import org.simantics.db.RequestProcessor;
20 import org.simantics.db.Resource;
21 import org.simantics.db.Session;
22 import org.simantics.db.exception.DatabaseException;
24 public interface IExperiment {
26 <T> T getService(Class<T> clazz);
28 String getIdentifier();
30 ExperimentState getState();
31 ExperimentState getState(ReadGraph graph) throws DatabaseException;
32 void changeState(ExperimentState state);
34 Resource getResource();
39 * the progress monitor to use for reporting progress to the user
40 * during the operation. It is the caller's responsibility to
41 * call done() on the given monitor. Accepts null, indicating
42 * that no progress should be reported and that the operation
43 * cannot be cancelled.
45 void shutdown(IProgressMonitor monitor);
47 void addListener(IExperimentListener listener);
48 void removeListener(IExperimentListener listener);
50 void addStatusListener(IExperimentStatusListener listener);
51 void removeStatusListener(IExperimentStatusListener listener);
53 //Historian getDataSession();
56 * Get the lock object to the datasource. Lock must be acquired
57 * for write operations.
59 Lock getDatasourceLock();
62 * Get an accessor to the experiment.
63 * The returned accessor follows Datasource Contract.
64 * https://www.simantics.org/wiki/index.php/Databoard_Specification#Datasource_Contract
66 * @return valuation accessor
68 Accessor getAccessor();
71 * Synchronizes the running experiment with configuration.
73 public void refresh(Session session);
74 public void refresh(RequestProcessor session);