]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.simulation/src/org/simantics/simulation/experiment/IExperiment.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.simulation / src / org / simantics / simulation / experiment / IExperiment.java
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
8  *\r
9  * Contributors:\r
10  *     VTT Technical Research Centre of Finland - initial API and implementation\r
11  *******************************************************************************/\r
12 package org.simantics.simulation.experiment;\r
13 \r
14 import java.util.concurrent.locks.Lock;\r
15 \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
23 \r
24 public interface IExperiment {\r
25 \r
26         <T> T getService(Class<T> clazz);\r
27         \r
28     String getIdentifier();\r
29 \r
30     ExperimentState getState();\r
31     ExperimentState getState(ReadGraph graph) throws DatabaseException;\r
32     void changeState(ExperimentState state);\r
33 \r
34     Resource getResource();\r
35     Resource getModel();\r
36 \r
37     /**\r
38      * @param monitor\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
44      */\r
45     void shutdown(IProgressMonitor monitor);\r
46 \r
47     void addListener(IExperimentListener listener);\r
48     void removeListener(IExperimentListener listener);\r
49 \r
50     void addStatusListener(IExperimentStatusListener listener);\r
51     void removeStatusListener(IExperimentStatusListener listener);\r
52 \r
53     //Historian getDataSession();\r
54     \r
55     /**\r
56      * Get the lock object to the datasource. Lock must be acquired\r
57      * for write operations.  \r
58      */\r
59     Lock getDatasourceLock();\r
60     \r
61     /**\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
65      * \r
66      * @return valuation accessor\r
67      */\r
68     Accessor getAccessor();\r
69 \r
70     /**\r
71      * Synchronizes the running experiment with configuration.\r
72      */\r
73     public void refresh(Session session);\r
74     public void refresh(RequestProcessor session);\r
75     \r
76 }\r