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

ASF GitHub Bot commented on TIKA-4572:
--------------------------------------

tballison commented on code in PR #2452:
URL: https://github.com/apache/tika/pull/2452#discussion_r2623284127


##########
tika-grpc/src/main/java/org/apache/tika/pipes/grpc/TikaGrpcServerImpl.java:
##########
@@ -77,99 +75,41 @@ class TikaGrpcServerImpl extends TikaGrpc.TikaImplBase {
     }
     public static final JsonSchemaGenerator JSON_SCHEMA_GENERATOR = new 
JsonSchemaGenerator(OBJECT_MAPPER);
 
-    /**
-     * FetcherID is key, The pair is the Fetcher object and the Metadata
-     */
     PipesConfig pipesConfig;
     PipesClient pipesClient;
-    ExpiringFetcherStore expiringFetcherStore;
+    FetcherManager fetcherManager;
+    Path tikaConfigPath;
+    PluginManager pluginManager;
 
-    String tikaConfigPath;
-
-    TikaGrpcServerImpl(String tikaConfigPath)
-            throws TikaConfigException, IOException, 
ParserConfigurationException,
-            TransformerException, SAXException {
+    TikaGrpcServerImpl(String tikaConfigPath) throws TikaConfigException, 
IOException {
         File tikaConfigFile = new File(tikaConfigPath);
-        if (!tikaConfigFile.canWrite()) {
-            File tmpTikaConfigFile = Files.createTempFile("configCopy", 
tikaConfigFile.getName()).toFile();
-            tmpTikaConfigFile.deleteOnExit();
-            LOG.info("Tika config file {} is read-only. Making a temporary 
copy to {}", tikaConfigFile, tmpTikaConfigFile);
-            String tikaConfigFileContents = 
FileUtils.readFileToString(tikaConfigFile, StandardCharsets.UTF_8);
-            FileUtils.writeStringToFile(tmpTikaConfigFile, 
tikaConfigFileContents, StandardCharsets.UTF_8);
-            tikaConfigFile = tmpTikaConfigFile;
-            tikaConfigPath = tikaConfigFile.getAbsolutePath();
+        if (!tikaConfigFile.exists()) {
+            throw new TikaConfigException("Tika config file does not exist: " 
+ tikaConfigPath);
         }
-        pipesConfig = 
TikaLoader.load(tikaConfigFile.toPath()).configs().load("pipes", 
PipesConfig.class);
-        pipesClient = new PipesClient(pipesConfig, tikaConfigFile.toPath());
 
-        expiringFetcherStore = new 
ExpiringFetcherStore(pipesConfig.getStaleFetcherTimeoutSeconds(),
-                pipesConfig.getStaleFetcherDelaySeconds());
-        this.tikaConfigPath = tikaConfigPath;
-        try {
-            updateTikaConfig();
-        } catch (TikaException e) {
-            throw new TikaConfigException("Problem updating tikaConfig", e);
-        }
-    }
+        Path configPath = tikaConfigFile.toPath();
+        this.tikaConfigPath = configPath;
 
-    private void updateTikaConfig() throws ParserConfigurationException, 
IOException, SAXException, TransformerException, TikaException {
-        /* TODO 

> update tika-grpc to use tika json configs
> -----------------------------------------
>
>                 Key: TIKA-4572
>                 URL: https://issues.apache.org/jira/browse/TIKA-4572
>             Project: Tika
>          Issue Type: Task
>            Reporter: Nicholas DiPiazza
>            Priority: Major
>
> the tika-config json configs changed 
> tika-grpc didn't use them yet - had everything commented out/disabled
> fix that
>  



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

Reply via email to