olca-proto
is a Protocol Buffers
implementation of the olca-schema format.
It also defines a gRPC service interface for calling
openLCA functions.
If you use Maven, just add the following dependency:
<dependency>
<groupId>org.openlca</groupId>
<artifactId>olca-proto</artifactId>
<version>2.0.0</version>
</dependency>
For the gRPC service interface, add this:
<dependency>
<groupId>org.openlca</groupId>
<artifactId>olca-grpc</artifactId>
<version>2.0.0</version>
</dependency>
The Java source code is generated from proto3 files in the proto
folder of
this project. The olca.proto
file contains the definition of the openLCA
schema format and is generated via the osch
tool of the olca-schema project.
To generate the Java source code, we use the protobuf-maven-plugin:
mvn compile
You need to have the protoc
compiler with the gRPC plugin for Java installed.
One way to install it, is to just put the binaries of these tools into your
system path. The protoc
binary can be downloaded from its GitHub release page:
https://github.com/protocolbuffers/protobuf/releases. The gRPC Java plugin
can be downloaded from the Maven Central Repository:
https://repo1.maven.org/maven2/io/grpc/protoc-gen-grpc-java/. You may need to
rename the plugin to protoc-gen-grpc-java
and set the executable flags:
chmod +x protoc-gen-grpc-java