Information modeling features in the upcoming UA SDK
03.04.2014
Update 20.5.2014: Edited things that have changed recently.
Update 10.7.2014: Edited code-examples to reflect 2.0 release version
The release of the 2.0 version of our Java SDK is just around the corner. In the new version, we are introducing new features that should help you to use information models in your UA applications. In this blog post, I will tell you about how to
- generate Java classes from your UA models
- create instances of UA types in your server applications
- read instances of UA types in your client applications
Code generation
The new SDK has an option to include a code generation tool which basically converts your information models from NodeSet2.xml-format to Java classes. You can create NodeSet2.xml files with UaModeler design tool.
The generator has its own codegen-folder:
To initially setup your code generation infrastructure, you have to edit the codegen.properties file:
add path to your source NodeSet2.xml file add Java package for your model or use the set-package scripts select templates you want to generate code from add paths where code should be generated to And that’s it! Now you can just run the Ant build tool and source code will appear in the output folder. By executing the Ant task in your build script, you do not have to worry about code generation afterwards; code is generated each time the source NodeSet2.xml file changes!
Currently, code generation supports the following features:
- Object types and variable types
- Getters and setters for child objects and variables
- Getters and setters for child variable values
- Method calls and implementations
- Custom structures and enumerations
Create instances on UA server
To integrate the generated code to your UA server application, follow these steps:
Read instances on UA client
Reading instances with UA client is now really simple:
Additional reading
In the codegen folder, there are Readme.md and ReadmeSample.md files that contain up to date instructions for use.
Eero Laukkanen
Software Engineer
Expertise and responsibility areas: OPC & OPC UA product development and project work
Tags: Information Models, Java, OPC UA, SDK for Java
comments powered by DisqusAbout Prosys OPC Ltd
Prosys OPC is a leading provider of professional OPC software and services with over 20 years of experience in the field. OPC and OPC UA (Unified Architecture) are communications standards used especially by industrial and high-tech companies.
Newest blog posts
Why Do Standards Matter in Smart Manufacturing?
The blog post discusses the importance of standards in smart manufacturing, envisioning a future where auto-configurable systems in manufacturing rely on standardized data formats for seamless integration and reduced costs, with a focus on the OPC UA standard family as a key enabler.
OPC UA PubSub to Cloud via MQTT
Detailed overview of the demo presented at the OPC Foundation booth
SimServer How To #3: Simulate data changes on a server using an OPC UA client
A two-part step-by-step tutorial on how to write data changes on an OPC UA server using an OPC UA client.