1 package org.simantics.structural2.scl.procedural;
5 import org.simantics.db.ReadGraph;
6 import org.simantics.db.Resource;
7 import org.simantics.db.common.procedure.adapter.TransientCacheListener;
8 import org.simantics.db.common.request.IndexRoot;
9 import org.simantics.db.common.request.UnaryRead;
10 import org.simantics.db.exception.DatabaseException;
11 import org.simantics.db.layer0.util.RuntimeEnvironmentRequest;
12 import org.simantics.scl.compiler.environment.specification.EnvironmentSpecification;
13 import org.simantics.scl.compiler.runtime.RuntimeEnvironment;
14 import org.simantics.structural2.scl.ComponentTypeProperty;
15 import org.simantics.structural2.scl.ReadComponentTypeConnectionsRequest;
16 import org.simantics.structural2.scl.ReadComponentTypeInterfaceRequest;
18 public class ProceduralComponentTypeCompilationContextRequest extends UnaryRead<Resource,ProceduralComponentTypeCompilationContext> {
20 public ProceduralComponentTypeCompilationContextRequest(Resource parameter) {
25 public ProceduralComponentTypeCompilationContext perform(ReadGraph graph)
26 throws DatabaseException {
27 Resource indexRoot = graph.syncRequest(new IndexRoot(parameter));
28 RuntimeEnvironment runtimeEnvironment = graph.syncRequest(new RuntimeEnvironmentRequest(indexRoot) {
30 protected void fillEnvironmentSpecification(
31 EnvironmentSpecification environmentSpecification) {
32 environmentSpecification.importModule("Structural/Procedural", "");
35 Map<String, ComponentTypeProperty> propertyMap =
36 graph.syncRequest(new ReadComponentTypeInterfaceRequest(parameter, runtimeEnvironment.getEnvironment()),
37 TransientCacheListener.<Map<String, ComponentTypeProperty>>instance());
38 Map<String, Resource> connectionPointMap =
39 graph.syncRequest(new ReadComponentTypeConnectionsRequest(parameter),
40 TransientCacheListener.<Map<String, Resource>>instance());
41 return new ProceduralComponentTypeCompilationContext(runtimeEnvironment, propertyMap, connectionPointMap);