Public:BWmeta service/Transformers

From YaddaWiki

(Difference between revisions)
Jump to: navigation, search
(MetadataTransformerFactory and transformer interfaces)
Line 37: Line 37:
* <code>IMetadataWriter&lt;T&gt;</code> serializes an object of type <code>T</code> to a <code>String</code> or a <code>Writer</code>
* <code>IMetadataWriter&lt;T&gt;</code> serializes an object of type <code>T</code> to a <code>String</code> or a <code>Writer</code>
* <code>IMetadataConverter&lt;S, T&gt;</code> converts an object of type <code>S</code> to an object of type <code>T</code>
* <code>IMetadataConverter&lt;S, T&gt;</code> converts an object of type <code>S</code> to an object of type <code>T</code>
 +
 +
<code>MetadataTransformerFactory</code> maintains a list of available "atomic" transformers
 +
and is able to combine the atomic transformers into more complex ones.

Revision as of 15:49, 18 November 2010

Service details
NameBWmeta
Code location
(relative to SVN root)
projects/dir/bwmeta-core
Javadoc
Contact personJakub Jurkiewicz

Background and motivation

As of 2010Q4, three versions of BWmeta format and at least three Java models of BWmeta are used in YADDA. See here for details. Serialization and deserialization is implemented for the following pairs:

Repo DL Y
1.0.5 Image:Tick.png Image:Tick.png
1.2.0 Image:Tick.png
2.0.0 Image:Tick.png

There are also converters between selected models:

  • Y ↔ DL

Serialization of Y model to BWmeta 1.0.5 is therefore possible through the following chain of transformations:

  • Y model → DL model → BWmeta 1.0.5

Conversion from DL model to Repo model is possible through:

  • DL model → BWmeta 1.0.5 → Repo model

Unfortunately, many mutually-incompatible transformation interfaces are present. It is difficult to understand which transformations are possible, how to combine them, which classes should be used for that end and how to instantiate the classes.

A unified interface to all the transformations would be very helpful.

MetadataTransformerFactory and transformer interfaces

Three different transformer types are present: readers, writers and converters. Each type has a corresponding interface:

  • IMetadataReader<T> deserializes an object of type T from a String or a Reader
  • IMetadataWriter<T> serializes an object of type T to a String or a Writer
  • IMetadataConverter<S, T> converts an object of type S to an object of type T

MetadataTransformerFactory maintains a list of available "atomic" transformers and is able to combine the atomic transformers into more complex ones.

Personal tools