Closed fabiosimeoni closed 9 years ago
first draft of a GradePublisher
that offers an embedded DSL based on Java 8 lambdas over standard jax-rs
facilities.
Tested with rfb
:
drop("rfb.xml").with(xml).in(ami).as("rfb");
we can:
drop()
files or directly InputStream
sxml
,json
,csv
) and known deployments (ami
for now, then preproduction
and production
)we still do not have a neat solution for csv
, which requires additional parsing directives and a multipart
request. working next on how to cover that special case along with the others.
second draft of GradePublisher
with support for csv
uploads.
tested with AdminUnitGlue
:
Csv csv = csv().delimitedBy(',').in("UTF-16");
drop("admin-units.txt").with(csv).in(ami).as("admin-units");
DSL is stabler now as follows:
drop( InputStream | String ).with(UploadInfo).in(Deployment).as(String);
drop(String)
loads the stream from the filename in input.UploadInfo
is a class with two static final
constants - xml
and json
- and one subclass Csv
. The latter takes parsing options and serialises to json
. Internally, 'UploadInfo' is also responsible for actions specific to the different media types, particularly the body of the requests. For example, the Csv
subclass knows that the body has to be multipart
and knows how to build it.Deployment
is an enum with known Grade
installations and relative configuration, like ami
@ grade.ddns.net
.Finally, xml
and json
uploads are compressed now.
csv
uploads also compressed now.
grade
installations now expose an Upload Service forxml
,csv
, andjson
data.we no longer need to pass through the API of a
VR
plugin, which wasn't intended for direct, programmatic publication and makes for awkward idioms.furthermore, all future evolution to the ingestion logic in
grade
will pass through the Upload Service and the VR plugin will become outdated.Refactor to the new Upload Service.