anuragraghavan / franca

Automatically exported from code.google.com/p/franca
0 stars 0 forks source link

Franca 0.9.1: severe restrictions for data type deployment #133

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Franca 0.9.1 allows to configure parameters in the deployment model(see 
attached example test.fidl and test.fdepl).

The problem is that it allows only deployment definitions for top level type 
definitions, and only for type definitions itself and not for type usages.

In the example (spec.fdepl) the deployment specification allows to configure 
encoding and string length as parameters to a string datatype definition.

issue #1:
String is then used for attributes str and str2. There is no possibility to 
define any different encoding nor string length for String usage at those 
attributes.
actually it would be expected to be able to deploy:

attribute str {
   Encoding = 4
   StrLength = 6
}

issue #2:
if an array of string is defined in MyStruct, it is not possible to define 
encoding nor string length nor array length for the strings used in that array 
of strings x within the struct typedef.
actually it would be expected to be able to deploy:

method foo1 {
 in {
   x {
      Length = 23   // currently not possible. Should be possible as an option.
      str {  // currently not possible. Should be possible as an option.
          Encoding = 2
          StrLength = 7
      }
   }
   s {
      Encoding = 0
      StrLength = 5
}}}

struct MyStruct {
  str {
     Encoding = 1
     StrLength = 3
     Length = 6
}}

Within automotive networks it is quite possible that some of the deployment 
parameters like array length or string encodings are configured dependend on 
their usage. Method foo() and method foo1() might both use MyStruct as type for 
parameter x, but with different deployment configuration.

Franca 0.9.1 deployment does not support this properly and enforces to create 
different type definitions to enable different deployments - this breaks 
abstraction severely (i.e. one should not need to know about deployment 
constraints while defining an abstract Franca interface).

Original issue reported on code.google.com by manfred....@bmw.de on 28 Jan 2015 at 5:28

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by klaus.birken@gmail.com on 12 Feb 2015 at 7:13

GoogleCodeExporter commented 9 years ago

Original comment by klaus.birken@gmail.com on 10 Mar 2015 at 2:06

GoogleCodeExporter commented 9 years ago

Original comment by klaus.birken@gmail.com on 10 Mar 2015 at 2:06

GoogleCodeExporter commented 9 years ago
Implemented on develop, final commit is 1c87ac8.

It is possible now to overwrite the deployment of the complex types array, 
enumeration, struct and union. There are special keywords now for overwriting 
properties, look for "#", "#enumeration", #struct", and "#union" (everything 
related to overwrite begins with a hash mark). See examples in the deploy.test 
project:

https://code.google.com/a/eclipselabs.org/p/franca/source/browse/tests/org.franc
a.deploymodel.dsl.tests/model/testcases/70-DefTypesOverwrite.fdepl?name=develop

and

https://code.google.com/a/eclipselabs.org/p/franca/source/browse/tests/org.franc
a.deploymodel.dsl.tests/model/testcases/65-DefCompoundOverwrite.fdepl?name=devel
op

Overwriting can be done in deployment definitions for all Franca model elements 
which are typed (FField, FAttribute, FArgument) and for the element type of 
explicit arrays (FArrayType). 

The generation of Java classes for easy access to properties has underwent a 
major rewrite. However, the previous API is still available, but will be marked 
as deprecated. Change your client code in order to remove the deprecation 
warnings. The latest generated API will be in collected in a generated class 
named exactly as the deployment specification and located in the same (Java) 
package as the deployment specification. Look for the getOverwriteAccessor() 
methods to access overwritten property values. Check the test classes 
InterfaceDeployAccessorTest, TypeCollectionAccessorTest and 
DeployAccessorTypesTest in the plug-in org.franca.deploymodel.dsl.tests to get 
some hints about how to use the new generated API.

Documentation is yet to come :-).

Original comment by klaus.birken@gmail.com on 8 May 2015 at 6:56