From: kalajainen Date: Wed, 11 Aug 2010 09:54:29 +0000 (+0000) Subject: Removed old .bat based ResourceFile X-Git-Tag: simantics-1.2.0~121 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=53fbcb8b2736ea05c35bddb89b6fb717e0966f53;p=simantics%2Fsysdyn.git Removed old .bat based ResourceFile git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@17089 ac1ea38d-2e2b-0410-8846-a27921b304fc --- diff --git a/org.simantics.sysdyn/META-INF/MANIFEST.MF b/org.simantics.sysdyn/META-INF/MANIFEST.MF index 1fe0f848..77f3f4df 100644 --- a/org.simantics.sysdyn/META-INF/MANIFEST.MF +++ b/org.simantics.sysdyn/META-INF/MANIFEST.MF @@ -15,7 +15,8 @@ Require-Bundle: org.simantics.objmap;bundle-version="0.1.0", org.eclipse.jface;bundle-version="3.5.2", org.simantics.project;bundle-version="1.0.0", org.simantics.layer0.utils;bundle-version="0.8.0", - org.simantics.structural.stubs;bundle-version="1.0.0" + org.simantics.structural.stubs;bundle-version="1.0.0", + org.simantics.sysdyn.ontology;bundle-version="1.0.0" Export-Package: org.simantics.sysdyn, org.simantics.sysdyn.expressionParser, org.simantics.sysdyn.manager, diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/SysdynResource.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/SysdynResource.java deleted file mode 100644 index 1794aa36..00000000 --- a/org.simantics.sysdyn/src/org/simantics/sysdyn/SysdynResource.java +++ /dev/null @@ -1,324 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Association for Decentralized Information Management - * 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 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * VTT Technical Research Centre of Finland - initial API and implementation - *******************************************************************************/ -package org.simantics.sysdyn; - - -import org.simantics.db.Resource; -import org.simantics.db.ReadGraph; -import org.simantics.db.request.Read; -import org.simantics.db.Session; -import org.simantics.db.exception.DatabaseException; - -public class SysdynResource { - - public final Resource Admin1; - public final Resource Admin1CM; - public final Resource Admin2; - public final Resource Admin2CM; - public final Resource Auxiliary; - public final Resource AuxiliarySymbol; - public final Resource BasicExperiment; - public final Resource CapacityModuleConfigurationDiagram; - public final Resource CapacitySymbol; - public final Resource Cloud; - public final Resource CloudSymbol; - public final Resource Configuration; - public final Resource ConfigurationDiagram; - public final Resource ConstantExpression; - public final Resource CustomerModuleConfigurationDiagram; - public final Resource CustomersSymbol; - public final Resource DefaultRealization; - public final Resource DelayExpression; - public final Resource Dependency; - public final Resource DependencyConnection; - public final Resource DiagramToCompositeMapping; - public final Resource Experiment; - public final Resource Expression; - public final Resource Flow; - public final Resource FlowConnection; - public final Resource GameExperiment; - public final Resource HasDefaultInputValue; - public final Resource HasEquation; - public final Resource HasExpression; - public final Resource HasHead; - public final Resource HasHeadTerminal; - public final Resource HasInitialEquation; - public final Resource HasLookup; - public final Resource HasMaxX; - public final Resource HasMaxY; - public final Resource HasMinX; - public final Resource HasMinY; - public final Resource HasParameterFile; - public final Resource HasRangeEnd; - public final Resource HasRangeStart; - public final Resource HasRangeStep; - public final Resource HasResult; - public final Resource HasResultFile; - public final Resource HasStartTime; - public final Resource HasStopTime; - public final Resource HasTail; - public final Resource HasTailTerminal; - public final Resource HasTolerance; - public final Resource HasUnit; - public final Resource HasX; - public final Resource HasY; - public final Resource HistoryRealization; - public final Resource IndependentVariable; - public final Resource Input; - public final Resource InputSymbol; - public final Resource IsHeadOf; - public final Resource IsHeadOfTerminal; - public final Resource IsOutput; - public final Resource IsTailOf; - public final Resource IsTailOfTerminal; - public final Resource LookupExpression; - public final Resource Module; - public final Resource ModuleSymbol; - public final Resource NormalExpression; - public final Resource ParameterExpression; - public final Resource RefersTo; - public final Resource Result; - public final Resource RootConfigurationDiagram; - public final Resource SimulateOnChangeExperiment; - public final Resource Stock; - public final Resource StockExpression; - public final Resource StockSymbol; - public final Resource SysdynConnectionType; - public final Resource SysdynModel; - public final Resource SysdynModelManager; - public final Resource SysdynProject; - public final Resource SysdynTerminal; - public final Resource Valve; - public final Resource ValveSymbol; - public final Resource Variable; - public final Resource WithLookupExpression; - public final Resource WorkModelConfigurationDiagram; - public final Resource WorkModuleConfigurationDiagram; - public final Resource WorkSymbol; - public final Resource WorkforceModuleConfigurationDiagram; - public final Resource WorkforceSymbol; - public final Resource angle; - - public static class URIs { - public static final String Admin1 = "http://www.simantics.org/Sysdyn-1.0/Admin1"; - public static final String Admin1CM = "http://www.simantics.org/Sysdyn-1.0/Admin1CM"; - public static final String Admin2 = "http://www.simantics.org/Sysdyn-1.0/Admin2"; - public static final String Admin2CM = "http://www.simantics.org/Sysdyn-1.0/Admin2CM"; - public static final String Auxiliary = "http://www.simantics.org/Sysdyn-1.0/Auxiliary"; - public static final String AuxiliarySymbol = "http://www.simantics.org/Sysdyn-1.0/AuxiliarySymbol"; - public static final String BasicExperiment = "http://www.simantics.org/Sysdyn-1.0/BasicExperiment"; - public static final String CapacityModuleConfigurationDiagram = "http://www.simantics.org/Sysdyn-1.0/CapacityModuleConfigurationDiagram"; - public static final String CapacitySymbol = "http://www.simantics.org/Sysdyn-1.0/CapacitySymbol"; - public static final String Cloud = "http://www.simantics.org/Sysdyn-1.0/Cloud"; - public static final String CloudSymbol = "http://www.simantics.org/Sysdyn-1.0/CloudSymbol"; - public static final String Configuration = "http://www.simantics.org/Sysdyn-1.0/Configuration"; - public static final String ConfigurationDiagram = "http://www.simantics.org/Sysdyn-1.0/ConfigurationDiagram"; - public static final String ConstantExpression = "http://www.simantics.org/Sysdyn-1.0/ConstantExpression"; - public static final String CustomerModuleConfigurationDiagram = "http://www.simantics.org/Sysdyn-1.0/CustomerModuleConfigurationDiagram"; - public static final String CustomersSymbol = "http://www.simantics.org/Sysdyn-1.0/CustomersSymbol"; - public static final String DefaultRealization = "http://www.simantics.org/Sysdyn-1.0/DefaultRealization"; - public static final String DelayExpression = "http://www.simantics.org/Sysdyn-1.0/DelayExpression"; - public static final String Dependency = "http://www.simantics.org/Sysdyn-1.0/Dependency"; - public static final String DependencyConnection = "http://www.simantics.org/Sysdyn-1.0/DependencyConnection"; - public static final String DiagramToCompositeMapping = "http://www.simantics.org/Sysdyn-1.0/DiagramToCompositeMapping"; - public static final String Experiment = "http://www.simantics.org/Sysdyn-1.0/Experiment"; - public static final String Expression = "http://www.simantics.org/Sysdyn-1.0/Expression"; - public static final String Flow = "http://www.simantics.org/Sysdyn-1.0/Flow"; - public static final String FlowConnection = "http://www.simantics.org/Sysdyn-1.0/FlowConnection"; - public static final String GameExperiment = "http://www.simantics.org/Sysdyn-1.0/GameExperiment"; - public static final String HasDefaultInputValue = "http://www.simantics.org/Sysdyn-1.0/HasDefaultInputValue"; - public static final String HasEquation = "http://www.simantics.org/Sysdyn-1.0/HasEquation"; - public static final String HasExpression = "http://www.simantics.org/Sysdyn-1.0/HasExpression"; - public static final String HasHead = "http://www.simantics.org/Sysdyn-1.0/HasHead"; - public static final String HasHeadTerminal = "http://www.simantics.org/Sysdyn-1.0/HasHeadTerminal"; - public static final String HasInitialEquation = "http://www.simantics.org/Sysdyn-1.0/HasInitialEquation"; - public static final String HasLookup = "http://www.simantics.org/Sysdyn-1.0/HasLookup"; - public static final String HasMaxX = "http://www.simantics.org/Sysdyn-1.0/HasMaxX"; - public static final String HasMaxY = "http://www.simantics.org/Sysdyn-1.0/HasMaxY"; - public static final String HasMinX = "http://www.simantics.org/Sysdyn-1.0/HasMinX"; - public static final String HasMinY = "http://www.simantics.org/Sysdyn-1.0/HasMinY"; - public static final String HasParameterFile = "http://www.simantics.org/Sysdyn-1.0/HasParameterFile"; - public static final String HasRangeEnd = "http://www.simantics.org/Sysdyn-1.0/HasRangeEnd"; - public static final String HasRangeStart = "http://www.simantics.org/Sysdyn-1.0/HasRangeStart"; - public static final String HasRangeStep = "http://www.simantics.org/Sysdyn-1.0/HasRangeStep"; - public static final String HasResult = "http://www.simantics.org/Sysdyn-1.0/HasResult"; - public static final String HasResultFile = "http://www.simantics.org/Sysdyn-1.0/HasResultFile"; - public static final String HasStartTime = "http://www.simantics.org/Sysdyn-1.0/HasStartTime"; - public static final String HasStopTime = "http://www.simantics.org/Sysdyn-1.0/HasStopTime"; - public static final String HasTail = "http://www.simantics.org/Sysdyn-1.0/HasTail"; - public static final String HasTailTerminal = "http://www.simantics.org/Sysdyn-1.0/HasTailTerminal"; - public static final String HasTolerance = "http://www.simantics.org/Sysdyn-1.0/HasTolerance"; - public static final String HasUnit = "http://www.simantics.org/Sysdyn-1.0/HasUnit"; - public static final String HasX = "http://www.simantics.org/Sysdyn-1.0/HasX"; - public static final String HasY = "http://www.simantics.org/Sysdyn-1.0/HasY"; - public static final String HistoryRealization = "http://www.simantics.org/Sysdyn-1.0/HistoryRealization"; - public static final String IndependentVariable = "http://www.simantics.org/Sysdyn-1.0/IndependentVariable"; - public static final String Input = "http://www.simantics.org/Sysdyn-1.0/Input"; - public static final String InputSymbol = "http://www.simantics.org/Sysdyn-1.0/InputSymbol"; - public static final String IsHeadOf = "http://www.simantics.org/Sysdyn-1.0/IsHeadOf"; - public static final String IsHeadOfTerminal = "http://www.simantics.org/Sysdyn-1.0/IsHeadOfTerminal"; - public static final String IsOutput = "http://www.simantics.org/Sysdyn-1.0/IsOutput"; - public static final String IsTailOf = "http://www.simantics.org/Sysdyn-1.0/IsTailOf"; - public static final String IsTailOfTerminal = "http://www.simantics.org/Sysdyn-1.0/IsTailOfTerminal"; - public static final String LookupExpression = "http://www.simantics.org/Sysdyn-1.0/LookupExpression"; - public static final String Module = "http://www.simantics.org/Sysdyn-1.0/Module"; - public static final String ModuleSymbol = "http://www.simantics.org/Sysdyn-1.0/ModuleSymbol"; - public static final String NormalExpression = "http://www.simantics.org/Sysdyn-1.0/NormalExpression"; - public static final String ParameterExpression = "http://www.simantics.org/Sysdyn-1.0/ParameterExpression"; - public static final String RefersTo = "http://www.simantics.org/Sysdyn-1.0/RefersTo"; - public static final String Result = "http://www.simantics.org/Sysdyn-1.0/Result"; - public static final String RootConfigurationDiagram = "http://www.simantics.org/Sysdyn-1.0/RootConfigurationDiagram"; - public static final String SimulateOnChangeExperiment = "http://www.simantics.org/Sysdyn-1.0/SimulateOnChangeExperiment"; - public static final String Stock = "http://www.simantics.org/Sysdyn-1.0/Stock"; - public static final String StockExpression = "http://www.simantics.org/Sysdyn-1.0/StockExpression"; - public static final String StockSymbol = "http://www.simantics.org/Sysdyn-1.0/StockSymbol"; - public static final String SysdynConnectionType = "http://www.simantics.org/Sysdyn-1.0/SysdynConnectionType"; - public static final String SysdynModel = "http://www.simantics.org/Sysdyn-1.0/SysdynModel"; - public static final String SysdynModelManager = "http://www.simantics.org/Sysdyn-1.0/SysdynModelManager"; - public static final String SysdynProject = "http://www.simantics.org/Sysdyn-1.0/SysdynProject"; - public static final String SysdynTerminal = "http://www.simantics.org/Sysdyn-1.0/SysdynTerminal"; - public static final String Valve = "http://www.simantics.org/Sysdyn-1.0/Valve"; - public static final String ValveSymbol = "http://www.simantics.org/Sysdyn-1.0/ValveSymbol"; - public static final String Variable = "http://www.simantics.org/Sysdyn-1.0/Variable"; - public static final String WithLookupExpression = "http://www.simantics.org/Sysdyn-1.0/WithLookupExpression"; - public static final String WorkModelConfigurationDiagram = "http://www.simantics.org/Sysdyn-1.0/WorkModelConfigurationDiagram"; - public static final String WorkModuleConfigurationDiagram = "http://www.simantics.org/Sysdyn-1.0/WorkModuleConfigurationDiagram"; - public static final String WorkSymbol = "http://www.simantics.org/Sysdyn-1.0/WorkSymbol"; - public static final String WorkforceModuleConfigurationDiagram = "http://www.simantics.org/Sysdyn-1.0/WorkforceModuleConfigurationDiagram"; - public static final String WorkforceSymbol = "http://www.simantics.org/Sysdyn-1.0/WorkforceSymbol"; - public static final String angle = "http://www.simantics.org/Sysdyn-1.0/angle"; - } - - public static Resource getResourceOrNull(ReadGraph graph, String uri) { - try { - return graph.getResource(uri); - } catch(DatabaseException e) { - System.err.println(e.getMessage()); - return null; - } - } - - public SysdynResource(ReadGraph graph) { - Admin1 = getResourceOrNull(graph, URIs.Admin1); - Admin1CM = getResourceOrNull(graph, URIs.Admin1CM); - Admin2 = getResourceOrNull(graph, URIs.Admin2); - Admin2CM = getResourceOrNull(graph, URIs.Admin2CM); - Auxiliary = getResourceOrNull(graph, URIs.Auxiliary); - AuxiliarySymbol = getResourceOrNull(graph, URIs.AuxiliarySymbol); - BasicExperiment = getResourceOrNull(graph, URIs.BasicExperiment); - CapacityModuleConfigurationDiagram = getResourceOrNull(graph, URIs.CapacityModuleConfigurationDiagram); - CapacitySymbol = getResourceOrNull(graph, URIs.CapacitySymbol); - Cloud = getResourceOrNull(graph, URIs.Cloud); - CloudSymbol = getResourceOrNull(graph, URIs.CloudSymbol); - Configuration = getResourceOrNull(graph, URIs.Configuration); - ConfigurationDiagram = getResourceOrNull(graph, URIs.ConfigurationDiagram); - ConstantExpression = getResourceOrNull(graph, URIs.ConstantExpression); - CustomerModuleConfigurationDiagram = getResourceOrNull(graph, URIs.CustomerModuleConfigurationDiagram); - CustomersSymbol = getResourceOrNull(graph, URIs.CustomersSymbol); - DefaultRealization = getResourceOrNull(graph, URIs.DefaultRealization); - DelayExpression = getResourceOrNull(graph, URIs.DelayExpression); - Dependency = getResourceOrNull(graph, URIs.Dependency); - DependencyConnection = getResourceOrNull(graph, URIs.DependencyConnection); - DiagramToCompositeMapping = getResourceOrNull(graph, URIs.DiagramToCompositeMapping); - Experiment = getResourceOrNull(graph, URIs.Experiment); - Expression = getResourceOrNull(graph, URIs.Expression); - Flow = getResourceOrNull(graph, URIs.Flow); - FlowConnection = getResourceOrNull(graph, URIs.FlowConnection); - GameExperiment = getResourceOrNull(graph, URIs.GameExperiment); - HasDefaultInputValue = getResourceOrNull(graph, URIs.HasDefaultInputValue); - HasEquation = getResourceOrNull(graph, URIs.HasEquation); - HasExpression = getResourceOrNull(graph, URIs.HasExpression); - HasHead = getResourceOrNull(graph, URIs.HasHead); - HasHeadTerminal = getResourceOrNull(graph, URIs.HasHeadTerminal); - HasInitialEquation = getResourceOrNull(graph, URIs.HasInitialEquation); - HasLookup = getResourceOrNull(graph, URIs.HasLookup); - HasMaxX = getResourceOrNull(graph, URIs.HasMaxX); - HasMaxY = getResourceOrNull(graph, URIs.HasMaxY); - HasMinX = getResourceOrNull(graph, URIs.HasMinX); - HasMinY = getResourceOrNull(graph, URIs.HasMinY); - HasParameterFile = getResourceOrNull(graph, URIs.HasParameterFile); - HasRangeEnd = getResourceOrNull(graph, URIs.HasRangeEnd); - HasRangeStart = getResourceOrNull(graph, URIs.HasRangeStart); - HasRangeStep = getResourceOrNull(graph, URIs.HasRangeStep); - HasResult = getResourceOrNull(graph, URIs.HasResult); - HasResultFile = getResourceOrNull(graph, URIs.HasResultFile); - HasStartTime = getResourceOrNull(graph, URIs.HasStartTime); - HasStopTime = getResourceOrNull(graph, URIs.HasStopTime); - HasTail = getResourceOrNull(graph, URIs.HasTail); - HasTailTerminal = getResourceOrNull(graph, URIs.HasTailTerminal); - HasTolerance = getResourceOrNull(graph, URIs.HasTolerance); - HasUnit = getResourceOrNull(graph, URIs.HasUnit); - HasX = getResourceOrNull(graph, URIs.HasX); - HasY = getResourceOrNull(graph, URIs.HasY); - HistoryRealization = getResourceOrNull(graph, URIs.HistoryRealization); - IndependentVariable = getResourceOrNull(graph, URIs.IndependentVariable); - Input = getResourceOrNull(graph, URIs.Input); - InputSymbol = getResourceOrNull(graph, URIs.InputSymbol); - IsHeadOf = getResourceOrNull(graph, URIs.IsHeadOf); - IsHeadOfTerminal = getResourceOrNull(graph, URIs.IsHeadOfTerminal); - IsOutput = getResourceOrNull(graph, URIs.IsOutput); - IsTailOf = getResourceOrNull(graph, URIs.IsTailOf); - IsTailOfTerminal = getResourceOrNull(graph, URIs.IsTailOfTerminal); - LookupExpression = getResourceOrNull(graph, URIs.LookupExpression); - Module = getResourceOrNull(graph, URIs.Module); - ModuleSymbol = getResourceOrNull(graph, URIs.ModuleSymbol); - NormalExpression = getResourceOrNull(graph, URIs.NormalExpression); - ParameterExpression = getResourceOrNull(graph, URIs.ParameterExpression); - RefersTo = getResourceOrNull(graph, URIs.RefersTo); - Result = getResourceOrNull(graph, URIs.Result); - RootConfigurationDiagram = getResourceOrNull(graph, URIs.RootConfigurationDiagram); - SimulateOnChangeExperiment = getResourceOrNull(graph, URIs.SimulateOnChangeExperiment); - Stock = getResourceOrNull(graph, URIs.Stock); - StockExpression = getResourceOrNull(graph, URIs.StockExpression); - StockSymbol = getResourceOrNull(graph, URIs.StockSymbol); - SysdynConnectionType = getResourceOrNull(graph, URIs.SysdynConnectionType); - SysdynModel = getResourceOrNull(graph, URIs.SysdynModel); - SysdynModelManager = getResourceOrNull(graph, URIs.SysdynModelManager); - SysdynProject = getResourceOrNull(graph, URIs.SysdynProject); - SysdynTerminal = getResourceOrNull(graph, URIs.SysdynTerminal); - Valve = getResourceOrNull(graph, URIs.Valve); - ValveSymbol = getResourceOrNull(graph, URIs.ValveSymbol); - Variable = getResourceOrNull(graph, URIs.Variable); - WithLookupExpression = getResourceOrNull(graph, URIs.WithLookupExpression); - WorkModelConfigurationDiagram = getResourceOrNull(graph, URIs.WorkModelConfigurationDiagram); - WorkModuleConfigurationDiagram = getResourceOrNull(graph, URIs.WorkModuleConfigurationDiagram); - WorkSymbol = getResourceOrNull(graph, URIs.WorkSymbol); - WorkforceModuleConfigurationDiagram = getResourceOrNull(graph, URIs.WorkforceModuleConfigurationDiagram); - WorkforceSymbol = getResourceOrNull(graph, URIs.WorkforceSymbol); - angle = getResourceOrNull(graph, URIs.angle); - } - - public static SysdynResource getInstance(ReadGraph graph) { - Session session = graph.getSession(); - SysdynResource ret = session.peekService(SysdynResource.class); - if(ret == null) { - ret = new SysdynResource(graph); - session.registerService(SysdynResource.class, ret); - } - return ret; - } - - public static SysdynResource getInstance(Session session) throws DatabaseException { - SysdynResource ret = session.peekService(SysdynResource.class); - if(ret == null) { - ret = session.syncRequest(new Read() { - public SysdynResource perform(ReadGraph graph) throws DatabaseException { - return new SysdynResource(graph); - } - }); - session.registerService(SysdynResource.class, ret); - } - return ret; - } - -} - diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/manager/SysdynExperiment.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/manager/SysdynExperiment.java index 46eb8339..0392d134 100644 --- a/org.simantics.sysdyn/src/org/simantics/sysdyn/manager/SysdynExperiment.java +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/manager/SysdynExperiment.java @@ -70,6 +70,7 @@ public class SysdynExperiment extends Experiment implements IDynamicExperiment { File projectRoot = new File(root, projectName); if(!projectRoot.isDirectory()) projectRoot.mkdir(); File file = new File( projectRoot, UUID.randomUUID().toString() + ".dbb"); + SysdynResource sr = SysdynResource.getInstance(graph); Resource res = GraphUtils.create2(graph, sr.Result, b.HasLabel, "Result x",