plc4x-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Julian Feinauer <>
Subject Object-PLC-Mapping
Date Sun, 16 Sep 2018 14:50:20 GMT
Hey all,

I played around a bit with our idea of a JPA Layer on Top of PLC4X (as I would need one currently)
and came up with a very simple first sample.
My idea is to use annotations on a POJO to give all necessary information and have a PlcEntityManager
(similar to JPAs EntityManager) which is then responsible for everything.

Quick Note on naming, I decided to use OPM (opposed to ORM) as object-to-plc mapping because
PLCJPA or all such things sound horrible.

I implemented a “.find(Class<?> clazz)” on the PlcEntityManager which just returns
a Pojo but with all PLC Values injected.

For the Pojos I defined two Annotations:
@PlcEntity(“plc connection string”)
@PlcField(“plc address string”)

And an example Entity would look like

public static class MyEntity {

    private Long counter;

    private long counter2;

    public Long getCounter() {
        return counter;

    public long getCounter2() {
        return counter2;

I added a minimal working example with a simple test in my repository in the Branch “opm-plcentitymanager”

This is not meant to be the final solution but to be a basis for the first version of this
feature that I would really like to add soon.
Currently I do not use dynamic proxies but only return entities with the requested values
But it should be no problem to return “attached” proxies that sync the values from time
to time or do even forward the “setXXX” methods to Plc Writes.

What do you think? How would such a feature be used and what are the necessary things from
your perspective?

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message