-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 239dc49
Showing
43 changed files
with
9,955 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# | ||
# https://help.github.com/articles/dealing-with-line-endings/ | ||
# | ||
# Linux start script should use lf | ||
/gradlew text eol=lf | ||
|
||
# These are Windows script files and should use crlf | ||
*.bat text eol=crlf | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Ignore Gradle project-specific cache directory | ||
.gradle | ||
|
||
# Ignore Gradle build output directory | ||
build | ||
|
||
*/build/ | ||
/.gradle/ | ||
.idea/ | ||
.DS_Store | ||
build.properties | ||
dist | ||
out | ||
*/out | ||
bin | ||
*/bin | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
## one-record-hackathon2023-carbulator | ||
|
||
# The Carbulator | ||
|
||
For more background information, see devpost https://devpost.com/software/the-carbulator. | ||
|
||
This project has been created during | ||
_IATA ONE Record Hackathon – hosted by Lufthansa Cargo, 23-25 June 2023_, see https://onerecord-fra.devpost.com/ | ||
|
||
## Toolbox | ||
This project uses public available tools / libraries, mainly | ||
|
||
* https://github.com/riege/one-record-ontologydatamodel (UPL-1.0 license) library containing Java POJO classes for ONE Record DataModel. | ||
* https://github.com/riege/one-record-jsonutils (UPL-1.0 license) library to write and read ONE Record JSON files. | ||
* https://my.carboncare.ch/ISO-API_3.0.zip CarbonCare CO₂ calculation API | ||
* More open source Java utility APIs to be used (e.g. Apache Commandline Scanner API etc). | ||
The project is build with open source CI tools (maven or gradle) and all required API library dependencies listed in the project configuration file engine/build.gradle.kts. | ||
|
||
# Developer Info | ||
|
||
## Basic startup | ||
Make sure the `repository` is checked out and everything starts from that directory. | ||
|
||
Build the project (you need a Java compiler): | ||
|
||
./gradlew shadowJar | ||
|
||
Then start the engine with default parameter: | ||
|
||
java -jar engine/build/libs/engine-all.jar | ||
|
||
Best viewed in a 100x40 character terminal.. | ||
|
||
## Commandline Options | ||
During the Hackathon event and development, the Carbulator Engine connected | ||
to a local CarbonCare API server copy, which was added to the local network. | ||
This server was already using the new CarbonCare calculation API 3.0 (see link below) which will get | ||
productive officially on July 1st, 2023 and which uses the new | ||
CO2 calculation standard ISO-14083:2023. | ||
|
||
For future production usage, the address of CarbonCare API server needs to be | ||
provided together with a APIKEY. Commandline options to the Carbulator Engine are: | ||
|
||
### CarbonCare API key | ||
-a,--apikey <key> | ||
|
||
### URL Prefix of the CarbonCare server API URL | ||
-h,--hosturlprefix <hostprefix> | ||
|
||
### Port for CarbonCare server API URL | ||
-p,--hostport <port> | ||
|
||
### Input single JSON bookingOption (filename/URL), multiple use possible | ||
-i,--input <fqfn> | ||
|
||
### Output file name for carbonated JSON array of BookingOptions | ||
-o,--output <fqfn> | ||
|
||
|
||
## Developer Source Code Info | ||
|
||
Java class `DemoDataGenerator` generates ONE Record BookingOption .json files | ||
into `engine/src/main/resources`. | ||
|
||
Note that `CommandLine#getInputSources()` uses (some) of these files as default | ||
input for the `CarbulatorEngine` class. | ||
|
||
This approach (generating files + parsing them) has been choosen intentionally | ||
to | ||
* ensure JSON example files are correct as per Ontology | ||
* allow to feed other JSON files to `CarbulatorEngine` as well, as long as their content matches the BookingOption requirements and rules. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/* | ||
* This file was generated by the Gradle 'init' task. | ||
* | ||
* This generated file contains a sample Java application project to get you started. | ||
* For more details take a look at the 'Building Java & JVM projects' chapter in the Gradle | ||
* User Manual available at https://docs.gradle.org/8.0.2/userguide/building_java_projects.html | ||
*/ | ||
|
||
plugins { | ||
// Apply the application plugin to add support for building a CLI application in Java. | ||
application | ||
id("com.github.johnrengelman.shadow") version "8.1.1" | ||
} | ||
|
||
repositories { | ||
// Use Maven Central for resolving dependencies. | ||
mavenCentral() | ||
mavenLocal() | ||
maven { | ||
name = "GitHubPackages" | ||
url = uri("https://maven.pkg.github.com/riege/packages") | ||
credentials { | ||
username = (project.findProperty("github.packages.access.user") ?: System.getenv("GITHUB_PACKAGES_ACCESS_USER")).toString() | ||
password = (project.findProperty("github.packages.access.token") ?: System.getenv("GITHUB_PACKAGES_ACCESS_TOKEN")).toString() | ||
} | ||
} | ||
maven { | ||
url = uri( "https://jitpack.io") | ||
} | ||
} | ||
|
||
java.sourceCompatibility = JavaVersion.VERSION_1_8 | ||
java.targetCompatibility = JavaVersion.VERSION_1_8 | ||
|
||
dependencies { | ||
// Use JUnit Jupiter for testing. | ||
testImplementation("org.junit.jupiter:junit-jupiter:5.9.2") | ||
|
||
// no longer using com.riege:one-record-ontologymodel:2.0.2 but | ||
// ONE Record data model in Java POJOs: | ||
// as per https://jitpack.io/#riege/one-record-ontologydatamodel | ||
implementation("com.github.riege:one-record-ontologydatamodel:0.2.3") | ||
// as per https://jitpack.io/#riege/one-record-jsonutils | ||
implementation("com.github.riege:one-record-jsonutils:0.9.2") | ||
implementation("javax.xml.bind:jaxb-api:2.3.1") | ||
implementation("org.jboss.resteasy:resteasy-jaxrs:3.0.12.Final") | ||
implementation("org.jboss.resteasy:jaxrs-api:3.0.12.Final") | ||
implementation("org.jboss.resteasy:resteasy-jaxb-provider:3.0.12.Final") | ||
implementation("org.jboss.resteasy:resteasy-jackson2-provider:3.0.12.Final") | ||
implementation("org.glassfish.jersey.core:jersey-client:2.34") | ||
implementation("org.glassfish.jersey.inject:jersey-hk2:2.28") | ||
implementation("org.glassfish.jersey.media:jersey-media-jaxb:2.28") | ||
|
||
// Commandline parsind | ||
implementation("commons-cli:commons-cli:1.5.0") | ||
} | ||
|
||
application { | ||
// Define the main class for the application. | ||
mainClass.set("com.riege.onerecord.carbulator.CarbulatorEngine") | ||
} | ||
|
||
tasks.named<Test>("test") { | ||
// Use JUnit Platform for unit tests. | ||
useJUnitPlatform() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,206 @@ | ||
// | ||
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.3.2 | ||
// See <a href="https://javaee.github.io/jaxb-v2/">https://javaee.github.io/jaxb-v2/</a> | ||
// Any modifications to this file will be lost upon recompilation of the source schema. | ||
// Generated on: 2023.06.24 at 08:42:20 AM CEST | ||
// | ||
|
||
|
||
package CarbonCare; | ||
|
||
import javax.xml.bind.annotation.XmlAccessType; | ||
import javax.xml.bind.annotation.XmlAccessorType; | ||
import javax.xml.bind.annotation.XmlElement; | ||
import javax.xml.bind.annotation.XmlRootElement; | ||
import javax.xml.bind.annotation.XmlType; | ||
|
||
|
||
/** | ||
* <p>Java class for anonymous complex type. | ||
* | ||
* <p>The following schema fragment specifies the expected content contained within this class. | ||
* | ||
* <pre> | ||
* <complexType> | ||
* <complexContent> | ||
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> | ||
* <all> | ||
* <element name="PostalCode" type="{http://www.w3.org/2001/XMLSchema}string"/> | ||
* <element name="TwoLetterCountry" type="{http://www.w3.org/2001/XMLSchema}string"/> | ||
* <element name="Country" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> | ||
* <element name="City" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> | ||
* <element name="Street" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> | ||
* <element name="UnLoCode" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> | ||
* </all> | ||
* </restriction> | ||
* </complexContent> | ||
* </complexType> | ||
* </pre> | ||
* | ||
* | ||
*/ | ||
@XmlAccessorType(XmlAccessType.FIELD) | ||
@XmlType(name = "", propOrder = { | ||
|
||
}) | ||
@XmlRootElement(name = "Address") | ||
public class Address { | ||
|
||
@XmlElement(name = "PostalCode", required = true) | ||
protected String postalCode; | ||
@XmlElement(name = "TwoLetterCountry", required = true) | ||
protected String twoLetterCountry; | ||
@XmlElement(name = "Country") | ||
protected String country; | ||
@XmlElement(name = "City") | ||
protected String city; | ||
@XmlElement(name = "Street") | ||
protected String street; | ||
@XmlElement(name = "UnLoCode") | ||
protected String unLoCode; | ||
|
||
/** | ||
* Gets the value of the postalCode property. | ||
* | ||
* @return | ||
* possible object is | ||
* {@link String } | ||
* | ||
*/ | ||
public String getPostalCode() { | ||
return postalCode; | ||
} | ||
|
||
/** | ||
* Sets the value of the postalCode property. | ||
* | ||
* @param value | ||
* allowed object is | ||
* {@link String } | ||
* | ||
*/ | ||
public void setPostalCode(String value) { | ||
this.postalCode = value; | ||
} | ||
|
||
/** | ||
* Gets the value of the twoLetterCountry property. | ||
* | ||
* @return | ||
* possible object is | ||
* {@link String } | ||
* | ||
*/ | ||
public String getTwoLetterCountry() { | ||
return twoLetterCountry; | ||
} | ||
|
||
/** | ||
* Sets the value of the twoLetterCountry property. | ||
* | ||
* @param value | ||
* allowed object is | ||
* {@link String } | ||
* | ||
*/ | ||
public void setTwoLetterCountry(String value) { | ||
this.twoLetterCountry = value; | ||
} | ||
|
||
/** | ||
* Gets the value of the country property. | ||
* | ||
* @return | ||
* possible object is | ||
* {@link String } | ||
* | ||
*/ | ||
public String getCountry() { | ||
return country; | ||
} | ||
|
||
/** | ||
* Sets the value of the country property. | ||
* | ||
* @param value | ||
* allowed object is | ||
* {@link String } | ||
* | ||
*/ | ||
public void setCountry(String value) { | ||
this.country = value; | ||
} | ||
|
||
/** | ||
* Gets the value of the city property. | ||
* | ||
* @return | ||
* possible object is | ||
* {@link String } | ||
* | ||
*/ | ||
public String getCity() { | ||
return city; | ||
} | ||
|
||
/** | ||
* Sets the value of the city property. | ||
* | ||
* @param value | ||
* allowed object is | ||
* {@link String } | ||
* | ||
*/ | ||
public void setCity(String value) { | ||
this.city = value; | ||
} | ||
|
||
/** | ||
* Gets the value of the street property. | ||
* | ||
* @return | ||
* possible object is | ||
* {@link String } | ||
* | ||
*/ | ||
public String getStreet() { | ||
return street; | ||
} | ||
|
||
/** | ||
* Sets the value of the street property. | ||
* | ||
* @param value | ||
* allowed object is | ||
* {@link String } | ||
* | ||
*/ | ||
public void setStreet(String value) { | ||
this.street = value; | ||
} | ||
|
||
/** | ||
* Gets the value of the unLoCode property. | ||
* | ||
* @return | ||
* possible object is | ||
* {@link String } | ||
* | ||
*/ | ||
public String getUnLoCode() { | ||
return unLoCode; | ||
} | ||
|
||
/** | ||
* Sets the value of the unLoCode property. | ||
* | ||
* @param value | ||
* allowed object is | ||
* {@link String } | ||
* | ||
*/ | ||
public void setUnLoCode(String value) { | ||
this.unLoCode = value; | ||
} | ||
|
||
} |
Oops, something went wrong.