Client Libraries
The Common Information Model (CIM) is a comprehensive and complex model. Generating Java classes directly from the XSD files can therefore be challenging. The repository eddie-energy/eddie provides a Maven artifact that already contains the relevant CIM classes. Find the latest version on the Maven Central Repository.
Getting started
The library contains a large number of classes. The following envelope classes are the most important entry points:
energy.eddie.cim.v0_82.vhd.ValidatedHistoricalDataEnvelopefor validated historical date market documentsenergy.eddie.cim.v0_1_12.rtd.RTDEnvelopefor near real-time data market documentsenergy.eddie.cim.v0_82.ap.AccountingPointEnvelopefor accounting point date market documentsenergy.eddie.cim.v0_82.pmd.PermissionEnvelopefor permission market documents and termination documentsenergy.eddie.cim.v0_91_08.RTREnvelopefor redistribution transaction request documents
These classes can be used to:
- Parse incoming XML messages
- Create messages that are sent to the EDDIE framework
The following example demonstrates how to deserialize an XML message from a string. This approach can be used in Kafka or AMQP deserializers.
The example requires:
- Jakarta XML Bind API
- A JAXB runtime implementation, e.g. Glassfish JAXB Runtime.
Versions
The CIM library uses semantic versioning. The changelog can be found in the GitHub repository here: https://github.com/eddie-energy/eddie/blob/main/cim/CHANGELOG.md
Importing the library
INFO
You can find the CIM package in the EDDIE repository here: https://central.sonatype.com/artifact/energy.eddie/cim.
<dependency>
<groupId>energy.eddie</groupId>
<artifactId>cim</artifactId>
<version>1.0.0</version> <!-- Use the desired version from Maven Central -->
</dependency>// Use the desired version from Maven Central
implementation("energy.eddie:cim:1.0.0")// Use the desired version from Maven Central
implementation 'energy.eddie:cim:1.0.0'Example code
import energy.eddie.cim.serde.DeserializationException;
import energy.eddie.cim.serde.SerdeFactory;
import energy.eddie.cim.serde.SerdeInitializationException;
import energy.eddie.cim.serde.SerializationException;
import energy.eddie.cim.v1_12.rtd.RTDEnvelope;
import java.nio.charset.StandardCharsets;
public class MyClass {
public void serdeExample() throws SerdeInitializationException, SerializationException, DeserializationException {
var serdeFactory = SerdeFactory.getInstance();
var serde = serdeFactory.create("xml");
// var serde = serdeFactory.create("json"); // also works for JSON
var rtdEnvelope = new RTDEnvelope();
// SERIALIZATION
var payloadBytes = serde.serialize(rtdEnvelope);
var payload = new String(payloadBytes, StandardCharsets.UTF_8);
// DESERIALIZATION
rtdEnvelope = serde.deserialize(payload.getBytes(StandardCharsets.UTF_8), RTDEnvelope.class);
}
}