GateNLP / gatelib-interaction

Various bits and pieces for interacting between GATE plugins and other software via command line or microservice
Apache License 2.0
0 stars 0 forks source link

Make using this easier and more flexible #8

Open johann-petrak opened 4 years ago

johann-petrak commented 4 years ago

E.g.


Process4JsonStream p = Process4String.creator
  .commad(theCommandToRun)
  .environment(envvars)
  .workingDir(dir)
  .readTimeOut(millisecs)
  .writeTimeOut(millisecs)
  .terminationTimeOut(millisecs)
  .abortTimeOut(millisecs)
  .stderrTo(System.out)
  .someOtherSettings()
  .create();
p.send(myJsonString);
String result = p.receive();
// ... more back and forth.
int exitCode = p.stop();

For special types to create, a specialised builder can be used that allows to set type-specific
options, e.g. for the JsonStrem we could pass the object mapper.

If we would implement a whole protocol for each class and not just the way how to exchange data, then things may be even easier for the user, BUT we would be forced to only connect to processes which use the same protocol, by using the appropriate java or python client library. There are just too many ways how to do this, so we decide: no implementation of a specific protocol!