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