In ADTF 3, how can we create a drop-down list for the filter properties? - adtf

In ADTF 2 we could do that using NSSUBPROP. I am looking for a similar function in ADTF3.

It is still possible but you have to differ between the two concepts of the major version. In ADTF 3.x the configuration is encoupled from runtime, this means ADTF Configuration Editor will not load .adtfplugins, it will load .plugindescriptions, which can be generated from the plugin itself and merged with custom information. For runtime it is only necessary which type of property and which value is set. For CE, there can be comboboxes, this must be done manually in .plugindescription and merged with the generated one if necessary. There is an example missing (coming) but to do so have a look here:
<property_set_description>
<property_descriptions>
<property_description>
<name>operation</name>
<type>tInt</type>
<value>0</value>
<list>
<property_list_enumeration>
<name>Add</name>
<value>0</value>
</property_list_enumeration>
<property_list_enumeration>
<name>Subtract</name>
<value>1</value>
</property_list_enumeration>
<property_list_enumeration>
<name>Multiply</name>
<value>2</value>
</property_list_enumeration>
<property_list_enumeration>
<name>Divide</name>
<value>3</value>
</property_list_enumeration>
</list>
<list_extendable>false</list_extendable>
</property_description>
...
Please have a look at the stylesheet -> https://support.digitalwerk.net/adtf/v3/adtf_html/page_adtfxsd_plugindescription.html
There will also be a UI Support (Plugin Description Editor) in upcoming versions.

Related

Placeholder of Camel from tag is not getting updated with new values

I have my publicAddress property defined in Spring XML and using it in Java DSL(Route builders). Value of 'publicAddress' comes from Web GUI.
<util:properties id="service-properties">
<prop key="publicAddress"></prop></util:properties>
I was previously using Camel 2.10 and have switched to 2.15.
Following code is used to create Route builders which has different public addresses. With this code in place, if I create second Route builder, value of 'publicAddress' does not gets updated. RouteBuilder gets created with old value of 'publicAddress'
from(abcd+ ":"+ serviceName+ "://{{publicAddress}}?loggingEnabled= {{loggingEnabled}}").routeId(xyz + serviceName + "Route");
I tried using service-properties:{{publicAddress}} but that gave me null value.
Any idea which placeholder I need to use to resolve this issue ?

Serilog Additional Properties

I work working with Serilog and logging events to SQL Server (using the Serilog, Serilog.Framework.Logging and Serilog.Sinks.MSSqlServer libraries).
As part of an MVC6 application, when I log events and set the option to include properties, I see some additional properties in the XML column.
If I issue something like the following statement:
Log.Information("{Property1}", "Value1");
I see something like the following in the Properties column:
<properties>
<property key="Property1">Value1</property>
<property key="SourceContext">WebApplication4.Controllers.BaseController</property>
<property key="ActionId">1b9f9c7e-7c5c-4b14-a30d-99f2ebc88c51</property>
<property key="RequestId">80000191-0001-f000-b63f-84710c7967bb</property>
</properties>
Where do these extra properties come from? Can I set additional properties similar to these? If so, where do I set them? I can set additional properties if I include them in the message (similar to Property1 above) but I might want to include additional properties that are not in the message.
There are three ways to go about this.
The first is to use ForContext() to create a logger instance with specific properties attached:
var specific = Log.ForContext("SomeProperty", 42);
specific.Information("This has properties attached");
The second is using enrichers:
Log.Logger = new LoggerConfiguration()
.Enrich.WithMachineName()
// Other config...
The third is the LogContext.
using (LogContext.PushProperty("SomeProperty", 42))
{
Log.Information("This has properties attached");
}
Some minor setup is required for this, check out the info on the Serilog wiki.

How To invoke a model's template from another model in xpand for AUTOSAR

I've been trying to develop an AUTOSAR 4.2.1 module to generate code using Xpand/Xtend. I'm using artext demonstrator 1.6.0. But my query is that the concept of defining a variation point is not found in the PDF(ECUConfigurationParameters.arxml) when I create a new Ecu platform project in the demonstrator (or maybe I'm not familiar with finding out how).
By default I'm able to fetch parameter values from an arxml. But when there is more than one value for a parameter which is defined in a different post build variant condition, I'm getting only the first value.
For example, if the arxml contains this
<ECUC-NUMERICAL-PARAM-VALUE>
<DEFINITION-REF DEST="ECUC-BOOLEAN-PARAM-DEF"> /AUTOSAR/EcucDefs/Com/ComConfig/ComIPdu/ComIPduCancellationSuppo rt</DEFINITION-REF>
<VARIATION-POINT>
<POST-BUILD-VARIANT-CONDITIONS>
<POST-BUILD-VARIANT-CONDITION>
<MATCHING-CRITERION-REF DEST="POST-BUILD-VARIANT-CRITERION">/EcucDemo/PostBuildConfigSet</MATCHING-CRITERION-REF>
<VALUE>1</VALUE>
</POST-BUILD-VARIANT-CONDITION>
</POST-BUILD-VARIANT-CONDITIONS>
</VARIATION-POINT>
<VALUE>1</VALUE>
</ECUC-NUMERICAL-PARAM-VALUE>
<ECUC-NUMERICAL-PARAM-VALUE>
<DEFINITION-REF DEST="ECUC-BOOLEAN-PARAM-DEF"> /AUTOSAR/EcucDefs/Com/ComConfig/ComIPdu/ComIPduCancellationSuppo rt</DEFINITION-REF>
<VARIATION-POINT>
<POST-BUILD-VARIANT-CONDITIONS>
<POST-BUILD-VARIANT-CONDITION>
<MATCHING-CRITERION-REF DEST="POST-BUILD-VARIANT-CRITERION">/EcucDemo/PostBuildConfigSet</MATCHING-CRITERION-REF>
<VALUE>2</VALUE>
</POST-BUILD-VARIANT-CONDITION>
</POST-BUILD-VARIANT-CONDITIONS>
</VARIATION-POINT>
<VALUE>0</VALUE>
</ECUC-NUMERICAL-PARAM-VALUE>
it gives me value as 'true' in Xpand if I do Com.ComConfig.ComIpdus.ComIPduCancellationSupport. I’m unable to access the second value ‘false’.
How may I proceed to fetch the parameter values based on the post-build variant conditions?
I'm trying to do the following:
«DEFINE Gen1 FOR varianthandling::VariationPoint»
«EXPAND Gen1::GetThings»
«ENDDEFINE»
«DEFINE GenMain FOR AUTOSAR::EcucDefs::Com»
«EXPAND Gen1 FOR varianthandling::VariationPoint»
«ENDDEFINE»
This gives me an error as 'Couldn't find definition ComOtherVarGen for type xpand2::Type'. How do I achieve the above?
Please note that I am not trying to add/modify any functionality to the template of 'MainObj' so 'AROUND' is not what I'm looking for.
Any help is greatly appreciated.
The tool which you are using to create the model (which is created from the PDF file + EcuC Values file) must be able to build a model which is post-build compatible.
If you are sure, this being done- Then try the below method
Com.ComConfig.ComIpdus.ComIPduCancellationSupport changes to
<FOREACH Com.ComConfig.ComIpdus.ComIPduCancellationSupport AS ele>
<ele>
<ENDFOREACH>
or
Com.ComConfig.ComIpdus.ComIPduCancellationSupport.get(0)
Com.ComConfig.ComIpdus.ComIPduCancellationSupport.get(1)

spring mongodb write-concern values

I have the following core mongo options configuration in spring:
<mongo:mongo host="${db.hostname}" >
<mongo:options
connections-per-host="40"
threads-allowed-to-block-for-connection-multiplier="1500"
connect-timeout="15000"
auto-connect-retry="true"
socket-timeout="60000"
write-number="1"
write-fsync="false"/>
</mongo:mongo>
What I want to know is about different write-number options which is relevant to write concern like none, normal, safe etc.
Can I assume the mapping of write-number to writeconcern as below?
NONE: -1
NORMAL: 0
SAFE: 1 (default)
FSYNC_SAFE: 2
REPLICAS_SAFE: 3
JOURNAL_SAFE: 4
MAJORITY: 5
Following link has provided a good help to set mongo options in spring, but not specific enough for write-number values:
How to configure MongoDB Java driver MongoOptions for production use?
The write-concern number is the value of "w" which maps to the number of replicas that the write must propagate to before being considered successful when w > 1.
FSYNC_SAFE maps to setting write-fsync (true or false) and since JOURNAL_SAFE is also a boolean value, I suspect there is a similar boolean setting in Spring but I couldn't find it in any of their docs.
If you have everything installed to test this out empirically, just try several configurations and check the actual setting of the resultant write concern with something like:
WriteConcern wc = new WriteConcern(); // should get your default write concern
System.out.println(wc.getJ());
System.out.println(wc.getFsync());
System.out.println(wc.getW());
That should show you Journal setting, Fsync setting (both boolean), W (as an int).
You can confiture write-concern="ACKNOWLEDGED".
<mongo:mongo id="replicaSetMongo" replica-set="${mongo.replicaSetSevers}" />
<mongo:db-factory dbname="${mongo.dbname}" mongo-ref="replicaSetMongo" write-concern="ACKNOWLEDGED" />
<bean id="mongoTemplate" class="org.springframework.data.mongodb.core.MongoTemplate">
<constructor-arg name="mongoDbFactory" ref="mongoDbFactory" />
</bean>
Hope this can help.

How can I configure the indexes for using db4o with Spring?

I'm currently evaluating the Spring-db4o integration. I was impressed by the declarative transaction support as well as the ease to provide declarative configuration.
Unfortunately, I'm struggling to figure how to create an index on specific fields. Spring is preparing the db during the tomcat server startup. Here's my spring entry :
<bean id="objectContainer" class="org.springmodules.db4o.ObjectContainerFactoryBean">
<property name="configuration" ref="db4oConfiguration" />
<property name="databaseFile" value="/WEB-INF/repo/taxonomy.db4o" />
</bean>
<bean id="db4oConfiguration" class="org.springmodules.db4o.ConfigurationFactoryBean">
<property name="updateDepth" value="5" />
<property name="configurationCreationMode" value="NEW" />
</bean>
<bean id="db4otemplate" class="org.springmodules.db4o.Db4oTemplate">
<constructor-arg ref="objectContainer" />
</bean>
db4oConfiguration doesn't provide any means to specify the index. I wrote a simple ServiceServletListener to set the index. Here's the relevant code:
Db4o.configure().objectClass(com.test.Metadata.class).objectField("id").indexed(true);
Db4o.configure().objectClass(com.test.Metadata.class).objectField("value").indexed(true);
I inserted around 6000 rows in this table and then used a SODA query to retrieve a row based on the key. But the performance was pretty poor. To verify that indexes have been applied properly, I ran the following program:
private static void indexTest(ObjectContainer db){
for (StoredClass storedClass : db.ext().storedClasses()) {
for (StoredField field : storedClass.getStoredFields()) {
if(field.hasIndex()){
System.out.println("Field "+field.getName()+" is indexed! ");
}else{
System.out.println("Field "+field.getName()+" isn't indexed! ");
}
}
}
}
Unfortunately, the results show that no field is indexed.
On a similar context, in OME browser, I saw there's an option to create index on fields of each class. If I turn the index to true and save, it appears to be applying the change to db4o. But again, if run this sample test on the db4o file, it doesn't reveal any index.
Any pointers on this will be highly appreciated.
Unfortunately I don't know the spring extension for db4o that well.
However the Db4o.configure() stuff is deprecated and works differently than in earlier versions. In earlier versions there was a global db4o configuration. Not this configuration doesn't exist anymore. The Db4o.configure() call doesn't change the configuration for running object containers.
Now you could try to do this work around and a running container:
container.ext().configure().objectClass(com.test.Metadata.class).objectField("id").indexed(true);
This way you change the configuration of the running object container. Note that changing the configuration of a running object container can lead to dangerous side effect and should be only used as last resort.

Resources