[ 
https://issues.apache.org/jira/browse/TIKA-4512?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18030669#comment-18030669
 ] 

Tim Allison commented on TIKA-4512:
-----------------------------------

I'm currently looking at a refactor that would convert all pipes configs to 
json with something like:
{noformat}
      PolymorphicTypeValidator ptv = BasicPolymorphicTypeValidator
                .builder()
                .allowIfSubType(PipesReporter.class)
                .allowIfSubType(List.class)
                .allowIfSubType(Path.class)
                .allowIfSubType(Fetcher.class)
                .build();
        ObjectMapper mapper = new ObjectMapper();
        mapper.activateDefaultTyping(ptv,
                ObjectMapper.DefaultTyping.NON_FINAL,
                JsonTypeInfo.As.PROPERTY);
        MockReporter mockReporter = new MockReporter();
        mockReporter.setEndpoint("my end point");
        Fetcher fetcher = new FileSystemFetcher();
        String json = mapper.writeValueAsString(fetcher);
        System.out.println(json);

        Fetcher rebuilt = mapper.readValue(json, Fetcher.class);
        System.out.println(rebuilt); {noformat}
That works with this json, which isn't too crazily human unreadable:
{noformat}
{
  "@class" : "org.apache.tika.pipes.core.async.AsyncConfig",
  "maxForEmitBatchBytes" : 10000,
  "timeoutMillis" : 60000,
  "startupTimeoutMillis" : 240000,
  "sleepOnStartupTimeoutMillis" : 240000,
  "shutdownClientAfterMillis" : 300000,
  "numClients" : 4,
  "maxFilesProcessedPerProcess" : 10000,
  "staleFetcherTimeoutSeconds" : 600,
  "staleFetcherDelaySeconds" : 60,
  "forkedJvmArgs" : [ "java.util.ArrayList", [ ] ],
  "tikaConfig" : [ "java.nio.file.Path", 
"file:///blahblah/tika-main/tika-pipes/tika-pipes-core/target/test-classes/configs/TIKA-3865-params.xml"
 ],
  "javaPath" : "java",
  "emitWithinMillis" : 60000,
  "emitMaxEstimatedBytes" : 100000,
  "queueSize" : 10000,
  "numEmitters" : 1,
  "emitIntermediateResults" : false,
  "pipesReporter" : {
    "@class" : "org.apache.tika.pipes.core.CompositePipesReporter",
    "pipesReporters" : [ "java.util.ArrayList", [ {
      "@class" : "org.apache.tika.pipes.core.async.MockReporter",
      "endpoint" : "somethingOrOther1"
    }, {
      "@class" : "org.apache.tika.pipes.core.async.MockReporter",
      "endpoint" : "somethingOrOther2"
    } ] ]
  }
} {noformat}

> Experiment with pf4j for tika-pipes
> -----------------------------------
>
>                 Key: TIKA-4512
>                 URL: https://issues.apache.org/jira/browse/TIKA-4512
>             Project: Tika
>          Issue Type: Sub-task
>            Reporter: Tim Allison
>            Priority: Major
>
> This is proof of concept work based on [~ndipiazza] 's TIKA-4272-docker 
> branch.
> I really like a lot of that work.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to