The Translation and Serialization Toolkit (Taskit) is a library that was created to facilitate converting from various input files into Java Objects. This is especially useful for Simulation Models such as GCM.
Currently there is only 1 supported serialization format, and that is protobuf. Other formats such as binary will follow in the future.
As of v3.2.0, this project is in Maven Central.
Distributed under the GPLv3 License. See LICENSE for more information.
Please read the HHS vulnerability disclosure.
To use this project in your project, simply add the following dependency to your dependencies
section of your pom.xml file.
<dependency>
<groupId>gov.hhs.aspr.ms.taskit</groupId>
<artifactId>core</artifactId>
<version>5.0.0</version>
</dependency>
To use the protobuf library of taskit, simply add the following dependency to your dependencies
section of your pom.xml file.
<dependency>
<groupId>gov.hhs.aspr.ms.taskit</groupId>
<artifactId>protobuf</artifactId>
<version>5.0.0</version>
</dependency>
Currently Taskit is composed of a Core library and a Protobuf library.
Core contains TranslationSpec, TaskitEngine, TaskitEngineId, TaskitEngineManager, and Translator. These classes define the root level functionality of Taskit.
An abstract class that defines how to translate between two different Java Types. Implementers of this class must define the intricate details on the translation, while the abstract class strictly handles initialization and determining which internal translate method to call based on the given object that needs to be translated.
An abstract class that contains a mapping of classes to TranslationSpecs. It has the sole responsibility of translating/reading/writing. For translating, it will determine which TranslationSpec to use based on the class of the given object to translate. Implementers of this class must define how to read/write files, as that process can vary between serialization libraries.
An identifier for a TaskitEngine, for use in the TaskitEngineManager.
The TaskitEngineManager can handle multiple TaskitEngines and allows the user to read/write/translate using the TaskitEngineId to determine which TaskitEngine to use. Contains the same methods as TaskitEngine, with an additional parameter for the TaskitEngineId.
A Translator is simply a class that can wrap a group of TranslationSpecs that should/will often be used together. It also contains a dependency mechanism that allows for Translators to depend on other Translators, which is useful if a given TranslationSpec requires another TranslationSpec that is not provided by the encompassing Translator. Translators must follow a DAG pattern; there cannot be duplicate Translators, missing Translators nor cyclic Translator dependencies.
Protobuf is a version of taskit made specifically to be used with protobuf. This library builds on the Core library described above and adds a distinct TaskitEngine and TranslationSpecs needed to fully support protobuf.
This library supports the following proto message types:
- messages
- enums
- Any
- basic types (int32, double, etc)
- Date
See TestObject for an example proto file.
- Maven 3.8.x
- Java 17
- Favorite IDE for Java development
- Modeling Utilities located here
*Note that Modeling Utilities is in Maven Central, so there is no need to clone and build it.
To build this project:
- Clone the repo
- open a command line terminal
- navigate to the root folder of this project
- run the command:
mvn clean install
Documentation has yet to be created. In the interim, the code is mostly commented and the javadocs do provide good detail with regards to method and class expectations.