Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuergen Haug2012-11-06 07:15:06 -0500
committerJuergen Haug2012-11-06 07:15:06 -0500
commit1a88593291ca91aebc655ceebcbd3a053f4f41b6 (patch)
tree7e5247f75bc10e29def9835cad6c868188191a84 /plugins/org.eclipse.etrice.core.config
parent84eaee9b6c00c189510ed82543bb783780db8867 (diff)
downloadorg.eclipse.etrice-1a88593291ca91aebc655ceebcbd3a053f4f41b6.tar.gz
org.eclipse.etrice-1a88593291ca91aebc655ceebcbd3a053f4f41b6.tar.xz
org.eclipse.etrice-1a88593291ca91aebc655ceebcbd3a053f4f41b6.zip
[CQ 6485][config, generator] missing gen .java files + fixes
Diffstat (limited to 'plugins/org.eclipse.etrice.core.config')
-rw-r--r--plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/config/DataConfiguration.xtend65
-rw-r--r--plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/config/DataConfigurationHelper.java70
-rw-r--r--plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/validation/ConfigJavaValidator.java285
-rw-r--r--plugins/org.eclipse.etrice.core.config/xtend-gen/org/eclipse/etrice/core/config/DataConfiguration.java133
4 files changed, 367 insertions, 186 deletions
diff --git a/plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/config/DataConfiguration.xtend b/plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/config/DataConfiguration.xtend
index 4debf24c9..fe0d33f91 100644
--- a/plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/config/DataConfiguration.xtend
+++ b/plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/config/DataConfiguration.xtend
@@ -1,5 +1,6 @@
package org.eclipse.etrice.core.config
+import java.util.ArrayList
import java.util.List
import org.eclipse.emf.ecore.resource.ResourceSet
import org.eclipse.etrice.core.ConfigStandaloneSetup
@@ -10,7 +11,6 @@ import org.eclipse.etrice.core.room.Attribute
import org.eclipse.etrice.core.room.ProtocolClass
import org.eclipse.etrice.core.room.SubSystemClass
import org.eclipse.etrice.generator.base.IDataConfiguration
-import java.util.ArrayList
class DataConfiguration implements IDataConfiguration {
@@ -58,32 +58,47 @@ class DataConfiguration implements IDataConfiguration {
// dynamic
- override getAllDynConfigReadAttributes(ActorClass actor) {
- return new ArrayList<Attribute>
+ override getPollingTimerUser(SubSystemClass subsystem) {
+ subsystem.config?.dynConfig?.polling
}
- override getAllDynConfigWriteAttributes(ActorClass actor) {
- return new ArrayList<Attribute>
- }
-
- override getDynConfigReadAttributes(SubSystemClass subsystem) {
- return new ArrayList<Attribute>
+ override getUserCode1(SubSystemClass subsystem) {
+ var dynConfig = subsystem.config?.dynConfig
+ return
+ if(dynConfig?.filePath != null)
+ "import org.eclipse.etrice.runtime.java.config.ConfigSourceFile; // TODO JH make lang independent"
+ else
+ dynConfig?.userCode1
}
- override getDynConfigWriteAttributes(SubSystemClass subsystem) {
- return new ArrayList<Attribute>
+ override getUserCode2(SubSystemClass subsystem) {
+ var dynConfig = subsystem.config?.dynConfig
+ return
+ if(dynConfig?.filePath != null)
+ '''new ConfigSourceFile("«dynConfig.filePath»")'''
+ else
+ dynConfig?.userCode2
}
- override hasDynConfigReadAttributes(ActorClass actor) {
- false
+ override getDynConfigReadAttributes(String actorInstance) {
+ val result = new ArrayList<Attribute>
+ var configs = DataConfigurationHelper::dynActorInstanceAttrMap.get(actorInstance)
+ configs?.forEach(c | if(c.readOnly)result.add(c.attribute))
+
+ return result
}
- override hasDynConfigWriteAttributes(ActorClass actor) {
- false
+ override getDynConfigWriteAttributes(String actorInstance) {
+ val result = new ArrayList<Attribute>
+ var configs = DataConfigurationHelper::dynActorInstanceAttrMap.get(actorInstance)
+ configs?.forEach(c | if(!c.readOnly)result.add(c.attribute))
+
+ return result
}
+
override hasVariableService(SubSystemClass subsystem) {
- false
+ subsystem.config?.dynConfig != null
}
def private toStringExpr(LiteralArray literal){
@@ -98,5 +113,23 @@ class DataConfiguration implements IDataConfiguration {
StringLiteral: literal.value.toString
}
}
+
+ def private getConfig(SubSystemClass cc){
+ DataConfigurationHelper::subSystemConfigMap.get(cc)
+ }
+
+ override getDynConfigReadAttributes(ActorClass actor) {
+ val result = new ArrayList<Attribute>
+ var configs = DataConfigurationHelper::dynActorClassAttrMap.get(actor)
+ configs?.forEach(c | if(c.readOnly)result.add(c.attribute))
+ return result
+ }
+
+ override getDynConfigWriteAttributes(ActorClass actor) {
+ val result = new ArrayList<Attribute>
+ var configs = DataConfigurationHelper::dynActorClassAttrMap.get(actor)
+ configs?.forEach(c | if(!c.readOnly)result.add(c.attribute))
+ return result
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/config/DataConfigurationHelper.java b/plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/config/DataConfigurationHelper.java
index bba25fd0c..7dd910625 100644
--- a/plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/config/DataConfigurationHelper.java
+++ b/plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/config/DataConfigurationHelper.java
@@ -32,7 +32,6 @@ import org.eclipse.etrice.core.genmodel.base.ILogger;
import org.eclipse.etrice.core.room.ActorClass;
import org.eclipse.etrice.core.room.Attribute;
import org.eclipse.etrice.core.room.DataClass;
-import org.eclipse.etrice.core.room.PrimitiveType;
import org.eclipse.etrice.core.room.ProtocolClass;
import org.eclipse.etrice.core.room.SubSystemClass;
@@ -44,20 +43,18 @@ public class DataConfigurationHelper {
public static Map<String, AttrInstanceConfig> actorInstanceAttrMap = new HashMap<String, AttrInstanceConfig>();
// dynamic
- public static Map<SubSystemClass, SubSystemConfig> ssc2ssConfMap = new HashMap<SubSystemClass, SubSystemConfig>();
- public static Map<SubSystemClass, List<AttrInstanceConfig>> ssc2attrInstConfMap = new HashMap<SubSystemClass, List<AttrInstanceConfig>>();
- public static Map<ActorClass, List<ActorInstanceConfig>> ac2aiConfMap = new HashMap<ActorClass, List<ActorInstanceConfig>>();
- public static Map<ActorInstanceConfig, ActorClass> aiConf2acMap = new HashMap<ActorInstanceConfig, ActorClass>();
+ public static Map<SubSystemClass, SubSystemConfig> subSystemConfigMap = new HashMap<SubSystemClass, SubSystemConfig>();
+ public static Map<String, List<AttrInstanceConfig>> dynActorInstanceAttrMap = new HashMap<String, List<AttrInstanceConfig>>();
+ public static Map<ActorClass, List<AttrInstanceConfig>> dynActorClassAttrMap = new HashMap<ActorClass, List<AttrInstanceConfig>>();
public static boolean setConfigModels(ResourceSet rs, ILogger logger) {
actorClassAttrMap.clear();
protocolClassAttrMap.clear();
actorInstanceAttrMap.clear();
-
- ssc2ssConfMap.clear();
- ssc2attrInstConfMap.clear();
- ac2aiConfMap.clear();
- aiConf2acMap.clear();
+ subSystemConfigMap.clear();
+ dynActorInstanceAttrMap.clear();
+ dynActorClassAttrMap.clear();
+
boolean error = false;
List<ConfigModel> configs = new ArrayList<ConfigModel>();
@@ -100,7 +97,7 @@ public class DataConfigurationHelper {
for (ActorInstanceConfig instanceConfig : config
.getActorInstanceConfigs()) {
String path = "/" + instanceConfig.getRoot().getName()
- + toPath(instanceConfig.getPath().getRefs(), "/");
+ + toStringPath(instanceConfig.getPath().getRefs(), "/");
if (actorInstances.contains(path)) {
logger.logError(
"Multiple configurations for actor instance "
@@ -109,50 +106,43 @@ public class DataConfigurationHelper {
actorInstances.add(path);
collectConfigs(instanceConfig, path, actorInstanceAttrMap);
}
-
- ActorClass ac = ConfigUtil.resolve(instanceConfig.getRoot(),
- instanceConfig.getPath());
- if (ac2aiConfMap.get(ac) == null)
- ac2aiConfMap.put(ac, new ArrayList<ActorInstanceConfig>());
- ac2aiConfMap.get(ac).add(instanceConfig);
-
- aiConf2acMap.put(instanceConfig, ac);
}
for (SubSystemConfig ssConfig : config.getSubSystemConfigs()) {
- if (ssc2ssConfMap.containsKey(ssConfig)) {
+ if (subSystemConfigMap.containsKey(ssConfig.getSubSystem())) {
logger.logError(
"Multiple configurations for subSystem class "
+ ssConfig.getSubSystem().getName()
+ " found", null);
error = true;
- } else {
- ssc2ssConfMap.put(ssConfig.getSubSystem(), ssConfig);
- ssc2attrInstConfMap.put(ssConfig.getSubSystem(),
- new ArrayList<AttrInstanceConfig>());
- }
+ } else
+ subSystemConfigMap.put(ssConfig.getSubSystem(), ssConfig);
}
}
- // dynConfigSubsystemMap
- // for (ActorInstanceConfig instanceConfig : actorInstanceMap.values())
- // {
- // List<AttrInstanceConfig> dynConfigs = new
- // ArrayList<AttrInstanceConfig>();
- // for (AttrInstanceConfig config : instanceConfig.getAttributes())
- // if (config.isDynConfig())
- // dynConfigs.add(config);
- // if (!dynConfigs.isEmpty())
- // ssc2attrInstConfMap.get(instanceConfig.getRoot()).addAll(
- // dynConfigs);
- // }
-
return !error;
}
private static void collectConfigs(ActorInstanceConfig actorConfig,
String path, Map<String, AttrInstanceConfig> map) {
- for (AttrInstanceConfig c : actorConfig.getAttributes())
+ for (AttrInstanceConfig c : actorConfig.getAttributes()) {
collectConfigs(c, path + "/" + c.getAttribute().getName(), map);
+
+ if (c.isDynConfig()) {
+ List<AttrInstanceConfig> list = dynActorInstanceAttrMap
+ .get(path);
+ if (list == null)
+ list = new ArrayList<AttrInstanceConfig>();
+ list.add(c);
+ dynActorInstanceAttrMap.put(path, list);
+
+ ActorClass ac = ConfigUtil.getLastActorRef(
+ actorConfig.getRoot(), actorConfig.getPath()).getType();
+ if ((list = dynActorClassAttrMap.get(ac)) == null)
+ list = new ArrayList<AttrInstanceConfig>();
+ list.add(c);
+ dynActorClassAttrMap.put(ac, list);
+ }
+ }
}
private static void collectConfigs(ProtocolClassConfig protocolConfig,
@@ -191,7 +181,7 @@ public class DataConfigurationHelper {
map.put(path, config);
}
- public static String toPath(Iterable<String> path, String pathDelim) {
+ public static String toStringPath(Iterable<String> path, String pathDelim) {
StringBuilder b = new StringBuilder();
for (String p : path)
b.append(pathDelim + p);
diff --git a/plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/validation/ConfigJavaValidator.java b/plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/validation/ConfigJavaValidator.java
index 79732bc36..24abc0afc 100644
--- a/plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/validation/ConfigJavaValidator.java
+++ b/plugins/org.eclipse.etrice.core.config/src/org/eclipse/etrice/core/validation/ConfigJavaValidator.java
@@ -12,6 +12,8 @@
package org.eclipse.etrice.core.validation;
+import java.util.ArrayList;
+import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@@ -44,16 +46,17 @@ import org.eclipse.etrice.core.room.ActorContainerClass;
import org.eclipse.etrice.core.room.ActorRef;
import org.eclipse.etrice.core.room.Attribute;
import org.eclipse.etrice.core.room.DataType;
+import org.eclipse.etrice.core.room.GeneralProtocolClass;
import org.eclipse.etrice.core.room.InterfaceItem;
import org.eclipse.etrice.core.room.LiteralType;
import org.eclipse.etrice.core.room.PrimitiveType;
import org.eclipse.etrice.core.room.ProtocolClass;
import org.eclipse.etrice.core.room.SubSystemClass;
-import org.eclipse.xtext.conversion.ValueConverterException;
import org.eclipse.xtext.validation.Check;
public class ConfigJavaValidator extends AbstractConfigJavaValidator {
+ @SuppressWarnings("unused")
private ConfigValueConverterService converter = new ConfigValueConverterService();
@Check
@@ -283,30 +286,11 @@ public class ConfigJavaValidator extends AbstractConfigJavaValidator {
// numeric check
if ((type == LiteralType.INT || type == LiteralType.REAL)) {
- ActorClassConfig classConfig = null;
- if (config.eContainer() instanceof ActorInstanceConfig) {
- ActorInstanceConfig actorConfig = (ActorInstanceConfig) config
- .eContainer();
- ActorContainerClass actorClass = ConfigUtil.resolve(
- actorConfig.getRoot(), actorConfig.getPath());
- // find ActorClassConfig
- ConfigModel model = getConfigModel(actorConfig);
- for (ActorClassConfig cf : model.getActorClassConfigs()) {
- if (cf.getActor().equals(actorClass)) {
- classConfig = cf;
- break;
- }
- }
- } else if (config.eContainer() instanceof ActorClassConfig)
- classConfig = (ActorClassConfig) config.eContainer();
-
AttrClassConfig attrClassConfig = null;
- if (classConfig != null) {
- for (AttrClassConfig acf : classConfig.getAttributes())
- if (config.getAttribute().equals(acf.getAttribute())) {
- attrClassConfig = acf;
- break;
- }
+ if (config instanceof AttrInstanceConfig) {
+ attrClassConfig = resolveAttrClassConfig((AttrInstanceConfig) config);
+ } else if (config instanceof AttrClassConfig) {
+ attrClassConfig = (AttrClassConfig) config;
}
if (attrClassConfig != null) {
@@ -324,14 +308,20 @@ public class ConfigJavaValidator extends AbstractConfigJavaValidator {
error("value is less than minimum",
config.getValue(), arrayRef,
values.indexOf(value));
- }
+ } else if (min != null)
+ warning("could not compare with minimum (incompatible datatypes)",
+ config.getValue(), arrayRef,
+ values.indexOf(value));
if (max instanceof RealLiteral) {
double dbMax = ((RealLiteral) max).getValue();
if (dbMax < dbValue)
error("value exceeds maximum",
config.getValue(), arrayRef,
values.indexOf(value));
- }
+ } else if (max != null)
+ warning("could not compare with maximum (incompatible datatypes)",
+ config.getValue(), arrayRef,
+ values.indexOf(value));
} else if (value instanceof IntLiteral) {
long lValue = ((IntLiteral) value).getValue();
if (min instanceof IntLiteral) {
@@ -340,14 +330,20 @@ public class ConfigJavaValidator extends AbstractConfigJavaValidator {
error("value is less than minimum",
config.getValue(), arrayRef,
values.indexOf(value));
- }
+ } else if (min != null)
+ warning("could not compare with minimum (incompatible datatypes)",
+ config.getValue(), arrayRef,
+ values.indexOf(value));
if (max instanceof IntLiteral) {
long lMax = ((IntLiteral) max).getValue();
if (lMax < lValue)
error("value exceeds maximum",
config.getValue(), arrayRef,
values.indexOf(value));
- }
+ } else if (max != null)
+ warning("could not compare with maximum (incompatible datatypes)",
+ config.getValue(), arrayRef,
+ values.indexOf(value));
}
}
}
@@ -367,50 +363,47 @@ public class ConfigJavaValidator extends AbstractConfigJavaValidator {
if (primitive.getType() == LiteralType.INT) {
if (!(min instanceof IntLiteral))
error("incompatible datatype: maximum is not int", minRef);
- } else if (primitive.getType() == LiteralType.REAL) {
- if (!(min instanceof RealLiteral))
- error("incompatible datatype: maximum is not real", minRef);
}
// check room default if config default is not set
- String defaultValue = config.getAttribute()
- .getDefaultValueLiteral();
- if (config.getValue() == null && defaultValue != null) {
- if (type == LiteralType.INT) {
- if (min instanceof IntLiteral) {
- try {
- long lDefaultValue = converter.getLongConverter()
- .toValue(defaultValue, null);
- long lMax = ((IntLiteral) min).getValue();
- if (lMax < lDefaultValue)
- error("default value in ROOM model is less than this maximum",
- minRef);
- } catch (ValueConverterException e) {
- warning("could not compare with int value in ROOM model (parse error)",
- minRef);
- }
- } else
- warning("could not compare with int value in ROOM model (incompatible datatypes)",
- minRef);
- } else if (type == LiteralType.REAL) {
- if (min instanceof RealLiteral) {
- try {
- double dbDefaultValue = converter
- .getRealConverter().toValue(defaultValue,
- null);
- double dbMax = ((RealLiteral) min).getValue();
- if (dbMax < dbDefaultValue)
- error("default value in ROOM model is less than this maximum",
- minRef);
- } catch (ValueConverterException e1) {
- warning("could not compare with real value in ROOM model (parse error)",
- minRef);
- }
- } else
- warning("could not compare with real value in ROOM model (incompatible datatypes)",
- minRef);
- }
-
- }
+// String defaultValue = config.getAttribute()
+// .getDefaultValueLiteral();
+// if (config.getValue() == null && defaultValue != null) {
+// if (type == LiteralType.INT) {
+// if (min instanceof IntLiteral) {
+// try {
+// long lDefaultValue = converter.getLongConverter()
+// .toValue(defaultValue, null);
+// long lMax = ((IntLiteral) min).getValue();
+// if (lMax < lDefaultValue)
+// error("default value in ROOM model is less than this maximum",
+// minRef);
+// } catch (ValueConverterException e) {
+// warning("could not compare with int value in ROOM model (parse error)",
+// minRef);
+// }
+// } else
+// warning("could not compare with int value in ROOM model (incompatible datatypes)",
+// minRef);
+// } else if (type == LiteralType.REAL) {
+// if (min instanceof RealLiteral) {
+// try {
+// double dbDefaultValue = converter
+// .getRealConverter().toValue(defaultValue,
+// null);
+// double dbMax = ((RealLiteral) min).getValue();
+// if (dbMax < dbDefaultValue)
+// error("default value in ROOM model is less than this maximum",
+// minRef);
+// } catch (ValueConverterException e1) {
+// warning("could not compare with real value in ROOM model (parse error)",
+// minRef);
+// }
+// } else
+// warning("could not compare with real value in ROOM model (incompatible datatypes)",
+// minRef);
+// }
+//
+// }
}
}
@@ -428,50 +421,47 @@ public class ConfigJavaValidator extends AbstractConfigJavaValidator {
if (primitive.getType() == LiteralType.INT) {
if (!(max instanceof IntLiteral))
error("incompatible datatype: maximum is not int", maxRef);
- } else if (primitive.getType() == LiteralType.REAL) {
- if (!(max instanceof RealLiteral))
- error("incompatible datatype: maximum is not real", maxRef);
}
// check room default if config default is not set
- String defaultValue = config.getAttribute()
- .getDefaultValueLiteral();
- if (config.getValue() == null && defaultValue != null) {
- if (type == LiteralType.INT) {
- if (max instanceof IntLiteral) {
- try {
- long lDefaultValue = converter.getLongConverter()
- .toValue(defaultValue, null);
- long lMax = ((IntLiteral) max).getValue();
- if (lMax < lDefaultValue)
- error("default value in ROOM model exceeds this maximum",
- maxRef);
- } catch (ValueConverterException e) {
- warning("could not compare with int value in ROOM model (parse error)",
- maxRef);
- }
- } else
- warning("could not compare with int value in ROOM model (incompatible datatypes)",
- maxRef);
- } else if (type == LiteralType.REAL) {
- if (max instanceof RealLiteral) {
- try {
- double dbDefaultValue = converter
- .getRealConverter().toValue(defaultValue,
- null);
- double dbMax = ((RealLiteral) max).getValue();
- if (dbMax < dbDefaultValue)
- error("default value in ROOM model exceeds this maximum",
- maxRef);
- } catch (ValueConverterException e1) {
- warning("could not compare with real value in ROOM model (parse error)",
- maxRef);
- }
- } else
- warning("could not compare with real value in ROOM model (incompatible datatypes)",
- maxRef);
- }
-
- }
+// String defaultValue = config.getAttribute()
+// .getDefaultValueLiteral();
+// if (config.getValue() == null && defaultValue != null) {
+// if (type == LiteralType.INT) {
+// if (max instanceof IntLiteral) {
+// try {
+// long lDefaultValue = converter.getLongConverter()
+// .toValue(defaultValue, null);
+// long lMax = ((IntLiteral) max).getValue();
+// if (lMax < lDefaultValue)
+// error("default value in ROOM model exceeds this maximum",
+// maxRef);
+// } catch (ValueConverterException e) {
+// warning("could not compare with int value in ROOM model (parse error)",
+// maxRef);
+// }
+// } else
+// warning("could not compare with int value in ROOM model (incompatible datatypes)",
+// maxRef);
+// } else if (type == LiteralType.REAL) {
+// if (max instanceof RealLiteral) {
+// try {
+// double dbDefaultValue = converter
+// .getRealConverter().toValue(defaultValue,
+// null);
+// double dbMax = ((RealLiteral) max).getValue();
+// if (dbMax < dbDefaultValue)
+// error("default value in ROOM model exceeds this maximum",
+// maxRef);
+// } catch (ValueConverterException e1) {
+// warning("could not compare with real value in ROOM model (parse error)",
+// maxRef);
+// }
+// } else
+// warning("could not compare with real value in ROOM model (incompatible datatypes)",
+// maxRef);
+// }
+//
+// }
}
}
@@ -483,6 +473,77 @@ public class ConfigJavaValidator extends AbstractConfigJavaValidator {
return (ConfigModel) root;
}
+ private AttrClassConfig resolveAttrClassConfig(AttrInstanceConfig config) {
+ // AttrInstanceConfig -> root AttrInstanceConfig
+ List<Attribute> path = new ArrayList<Attribute>();
+ path.add(config.getAttribute());
+ AttrInstanceConfig source = config;
+ while (source.eContainer() instanceof AttrInstanceConfig) {
+ source = (AttrInstanceConfig) source.eContainer();
+ path.add(source.getAttribute());
+ }
+ Collections.reverse(path);
+ // ActorClassConfig or PortClassConfig
+ ConfigModel model = getConfigModel(source);
+ List<AttrClassConfig> rootClassAttrConfigs = new ArrayList<AttrClassConfig>();
+ if (source.eContainer() instanceof PortInstanceConfig) {
+ PortInstanceConfig portInstanceConfig = (PortInstanceConfig) source
+ .eContainer();
+ GeneralProtocolClass generalProtocol = portInstanceConfig.getItem()
+ .getGeneralProtocol();
+ PortClassConfig portClassConfig = null;
+ if (generalProtocol instanceof ProtocolClass) {
+ ProtocolClass protocol = (ProtocolClass) generalProtocol;
+ for (ProtocolClassConfig cf : model.getProtocolClassConfigs()) {
+ if (cf.getProtocol().equals(protocol)) {
+ if (protocol.getRegular().equals(
+ ConfigUtil.getPortClass(portInstanceConfig)))
+ portClassConfig = cf.getRegular();
+ else
+ portClassConfig = cf.getConjugated();
+ break;
+ }
+ }
+ }
+ if (portClassConfig != null)
+ rootClassAttrConfigs = portClassConfig.getAttributes();
+ } else if (source.eContainer() instanceof ActorInstanceConfig) {
+ ActorInstanceConfig aiConfig = (ActorInstanceConfig) source
+ .eContainer();
+ ActorClass actor = ConfigUtil.getLastActorRef(aiConfig.getRoot(),
+ aiConfig.getPath()).getType();
+ // find ActorClassConfig
+ for (ActorClassConfig cf : model.getActorClassConfigs()) {
+ if (cf.getActor().equals(actor)) {
+ rootClassAttrConfigs = cf.getAttributes();
+ break;
+ }
+ }
+ }
+
+ // -> AttrClassConfig
+ AttrClassConfig target = null;
+ for (AttrClassConfig c : rootClassAttrConfigs)
+ if (c.getAttribute().equals(path.get(0)))
+ target = c;
+ if (target != null) {
+ path.remove(0);
+ for (Attribute a : path) {
+ AttrClassConfig match = null;
+ for (AttrClassConfig c : target.getAttributes())
+ if (c.getAttribute().equals(a)) {
+ match = c;
+ break;
+ }
+ if (match == null)
+ return null;
+ target = match;
+ }
+ }
+
+ return target;
+ }
+
private String refPathToString(RefPath path) {
String str = "";
for (String s : path.getRefs())
diff --git a/plugins/org.eclipse.etrice.core.config/xtend-gen/org/eclipse/etrice/core/config/DataConfiguration.java b/plugins/org.eclipse.etrice.core.config/xtend-gen/org/eclipse/etrice/core/config/DataConfiguration.java
index a89ceb930..d56189b1c 100644
--- a/plugins/org.eclipse.etrice.core.config/xtend-gen/org/eclipse/etrice/core/config/DataConfiguration.java
+++ b/plugins/org.eclipse.etrice.core.config/xtend-gen/org/eclipse/etrice/core/config/DataConfiguration.java
@@ -1,5 +1,6 @@
package org.eclipse.etrice.core.config;
+import com.google.common.base.Objects;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.emf.common.util.EList;
@@ -9,12 +10,14 @@ import org.eclipse.etrice.core.config.AttrClassConfig;
import org.eclipse.etrice.core.config.AttrInstanceConfig;
import org.eclipse.etrice.core.config.BooleanLiteral;
import org.eclipse.etrice.core.config.DataConfigurationHelper;
+import org.eclipse.etrice.core.config.DynamicConfig;
import org.eclipse.etrice.core.config.IntLiteral;
import org.eclipse.etrice.core.config.Literal;
import org.eclipse.etrice.core.config.LiteralArray;
import org.eclipse.etrice.core.config.NumberLiteral;
import org.eclipse.etrice.core.config.RealLiteral;
import org.eclipse.etrice.core.config.StringLiteral;
+import org.eclipse.etrice.core.config.SubSystemConfig;
import org.eclipse.etrice.core.genmodel.base.ILogger;
import org.eclipse.etrice.core.genmodel.etricegen.ActorInstance;
import org.eclipse.etrice.core.room.ActorClass;
@@ -23,6 +26,8 @@ import org.eclipse.etrice.core.room.ProtocolClass;
import org.eclipse.etrice.core.room.SubSystemClass;
import org.eclipse.etrice.generator.base.IDataConfiguration;
import org.eclipse.xtend2.lib.StringConcatenation;
+import org.eclipse.xtext.xbase.lib.IterableExtensions;
+import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;
@SuppressWarnings("all")
public class DataConfiguration implements IDataConfiguration {
@@ -133,36 +138,88 @@ public class DataConfiguration implements IDataConfiguration {
return _xblockexpression;
}
- public List<Attribute> getAllDynConfigReadAttributes(final ActorClass actor) {
- ArrayList<Attribute> _arrayList = new ArrayList<Attribute>();
- return _arrayList;
+ public int getPollingTimerUser(final SubSystemClass subsystem) {
+ SubSystemConfig _config = this.getConfig(subsystem);
+ DynamicConfig _dynConfig = _config==null?(DynamicConfig)null:_config.getDynConfig();
+ int _polling = _dynConfig==null?0:_dynConfig.getPolling();
+ return _polling;
}
- public List<Attribute> getAllDynConfigWriteAttributes(final ActorClass actor) {
- ArrayList<Attribute> _arrayList = new ArrayList<Attribute>();
- return _arrayList;
+ public String getUserCode1(final SubSystemClass subsystem) {
+ SubSystemConfig _config = this.getConfig(subsystem);
+ DynamicConfig dynConfig = _config==null?(DynamicConfig)null:_config.getDynConfig();
+ String _xifexpression = null;
+ String _filePath = dynConfig==null?(String)null:dynConfig.getFilePath();
+ boolean _notEquals = (!Objects.equal(_filePath, null));
+ if (_notEquals) {
+ _xifexpression = "import org.eclipse.etrice.runtime.java.config.ConfigSourceFile; // TODO JH make lang independent";
+ } else {
+ String _userCode1 = dynConfig==null?(String)null:dynConfig.getUserCode1();
+ _xifexpression = _userCode1;
+ }
+ return _xifexpression;
}
- public List<Attribute> getDynConfigReadAttributes(final SubSystemClass subsystem) {
- ArrayList<Attribute> _arrayList = new ArrayList<Attribute>();
- return _arrayList;
+ public String getUserCode2(final SubSystemClass subsystem) {
+ SubSystemConfig _config = this.getConfig(subsystem);
+ DynamicConfig dynConfig = _config==null?(DynamicConfig)null:_config.getDynConfig();
+ String _xifexpression = null;
+ String _filePath = dynConfig==null?(String)null:dynConfig.getFilePath();
+ boolean _notEquals = (!Objects.equal(_filePath, null));
+ if (_notEquals) {
+ StringConcatenation _builder = new StringConcatenation();
+ _builder.append("new ConfigSourceFile(\"");
+ String _filePath_1 = dynConfig.getFilePath();
+ _builder.append(_filePath_1, "");
+ _builder.append("\")");
+ _xifexpression = _builder.toString();
+ } else {
+ String _userCode2 = dynConfig==null?(String)null:dynConfig.getUserCode2();
+ _xifexpression = _userCode2;
+ }
+ return _xifexpression;
}
- public List<Attribute> getDynConfigWriteAttributes(final SubSystemClass subsystem) {
+ public List<Attribute> getDynConfigReadAttributes(final String actorInstance) {
ArrayList<Attribute> _arrayList = new ArrayList<Attribute>();
- return _arrayList;
- }
-
- public boolean hasDynConfigReadAttributes(final ActorClass actor) {
- return false;
+ final ArrayList<Attribute> result = _arrayList;
+ List<AttrInstanceConfig> configs = DataConfigurationHelper.dynActorInstanceAttrMap.get(actorInstance);
+ final Procedure1<AttrInstanceConfig> _function = new Procedure1<AttrInstanceConfig>() {
+ public void apply(final AttrInstanceConfig c) {
+ boolean _isReadOnly = c.isReadOnly();
+ if (_isReadOnly) {
+ Attribute _attribute = c.getAttribute();
+ result.add(_attribute);
+ }
+ }
+ };
+ if (configs!=null) IterableExtensions.<AttrInstanceConfig>forEach(configs, _function);
+ return result;
}
- public boolean hasDynConfigWriteAttributes(final ActorClass actor) {
- return false;
+ public List<Attribute> getDynConfigWriteAttributes(final String actorInstance) {
+ ArrayList<Attribute> _arrayList = new ArrayList<Attribute>();
+ final ArrayList<Attribute> result = _arrayList;
+ List<AttrInstanceConfig> configs = DataConfigurationHelper.dynActorInstanceAttrMap.get(actorInstance);
+ final Procedure1<AttrInstanceConfig> _function = new Procedure1<AttrInstanceConfig>() {
+ public void apply(final AttrInstanceConfig c) {
+ boolean _isReadOnly = c.isReadOnly();
+ boolean _not = (!_isReadOnly);
+ if (_not) {
+ Attribute _attribute = c.getAttribute();
+ result.add(_attribute);
+ }
+ }
+ };
+ if (configs!=null) IterableExtensions.<AttrInstanceConfig>forEach(configs, _function);
+ return result;
}
public boolean hasVariableService(final SubSystemClass subsystem) {
- return false;
+ SubSystemConfig _config = this.getConfig(subsystem);
+ DynamicConfig _dynConfig = _config==null?(DynamicConfig)null:_config.getDynConfig();
+ boolean _notEquals = (!Objects.equal(_dynConfig, null));
+ return _notEquals;
}
private String toStringExpr(final LiteralArray literal) {
@@ -225,4 +282,44 @@ public class DataConfiguration implements IDataConfiguration {
}
return _switchResult;
}
+
+ private SubSystemConfig getConfig(final SubSystemClass cc) {
+ SubSystemConfig _get = DataConfigurationHelper.subSystemConfigMap.get(cc);
+ return _get;
+ }
+
+ public List<Attribute> getDynConfigReadAttributes(final ActorClass actor) {
+ ArrayList<Attribute> _arrayList = new ArrayList<Attribute>();
+ final ArrayList<Attribute> result = _arrayList;
+ List<AttrInstanceConfig> configs = DataConfigurationHelper.dynActorClassAttrMap.get(actor);
+ final Procedure1<AttrInstanceConfig> _function = new Procedure1<AttrInstanceConfig>() {
+ public void apply(final AttrInstanceConfig c) {
+ boolean _isReadOnly = c.isReadOnly();
+ if (_isReadOnly) {
+ Attribute _attribute = c.getAttribute();
+ result.add(_attribute);
+ }
+ }
+ };
+ if (configs!=null) IterableExtensions.<AttrInstanceConfig>forEach(configs, _function);
+ return result;
+ }
+
+ public List<Attribute> getDynConfigWriteAttributes(final ActorClass actor) {
+ ArrayList<Attribute> _arrayList = new ArrayList<Attribute>();
+ final ArrayList<Attribute> result = _arrayList;
+ List<AttrInstanceConfig> configs = DataConfigurationHelper.dynActorClassAttrMap.get(actor);
+ final Procedure1<AttrInstanceConfig> _function = new Procedure1<AttrInstanceConfig>() {
+ public void apply(final AttrInstanceConfig c) {
+ boolean _isReadOnly = c.isReadOnly();
+ boolean _not = (!_isReadOnly);
+ if (_not) {
+ Attribute _attribute = c.getAttribute();
+ result.add(_attribute);
+ }
+ }
+ };
+ if (configs!=null) IterableExtensions.<AttrInstanceConfig>forEach(configs, _function);
+ return result;
+ }
}

Back to the top