Skip to content

Commit

Permalink
add throwOnWriteLimit variable to coincide with TIKA-4149
Browse files Browse the repository at this point in the history
  • Loading branch information
tballison committed Sep 29, 2023
1 parent 79bb602 commit ef136bf
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 37 deletions.
68 changes: 34 additions & 34 deletions tika-gui-app/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -193,16 +193,16 @@
<artifactId>download-maven-plugin</artifactId>
<executions>
<execution>
<id>tika-async-cli-3.0.0-20230916.113230-19</id>
<id>tika-async-cli-3.0.0-20230929.180046-41</id>
<phase>prepare-package</phase>
<goals>
<goal>wget</goal>
</goals>
<configuration>
<url>https://repository.apache.org/content/groups/snapshots/org/apache/tika/tika-async-cli/3.0.0-SNAPSHOT/tika-async-cli-3.0.0-20230916.113230-19.jar</url>
<url>https://repository.apache.org/content/groups/snapshots/org/apache/tika/tika-async-cli/3.0.0-SNAPSHOT/tika-async-cli-3.0.0-20230929.180046-41.jar</url>
<unpack>false</unpack>
<outputDirectory>${project.build.directory}/lib/tika-core</outputDirectory>
<md5>2162c7e9a3f4a93c0c5566323ad65cf7</md5>
<md5>8f23c6be86dc762e03c38a6e764b4a68</md5>
</configuration>
</execution>
<execution>
Expand All @@ -219,39 +219,39 @@
</configuration>
</execution>
<execution>
<id>tika-fetcher-s3-3.0.0-20230916.113250-19</id>
<id>tika-fetcher-s3-3.0.0-20230929.180046-41</id>
<phase>prepare-package</phase>
<goals>
<goal>wget</goal>
</goals>
<configuration>
<url>https://repository.apache.org/content/groups/snapshots/org/apache/tika/tika-fetcher-s3/3.0.0-SNAPSHOT/tika-fetcher-s3-3.0.0-20230916.113250-19.jar</url>
<url>https://repository.apache.org/content/groups/snapshots/org/apache/tika/tika-fetcher-s3/3.0.0-SNAPSHOT/tika-fetcher-s3-3.0.0-20230929.180046-41.jar</url>
<unpack>false</unpack>
<outputDirectory>${project.build.directory}/lib/tika-fetcher-s3</outputDirectory>
<md5>902ba0eba30eb70f16603359285ec796</md5>
<md5>adecfb8a8b09eefd453ab8a8b63fa15c</md5>
</configuration>
</execution>
<execution>
<id>tika-parser-sqlite3-package-3.0.0-20230916.113313-19</id>
<id>tika-parser-sqlite3-package-3.0.0-20230929.180046-41</id>
<phase>prepare-package</phase>
<goals>
<goal>wget</goal>
</goals>
<configuration>
<url>https://repository.apache.org/content/groups/snapshots/org/apache/tika/tika-parser-sqlite3-package/3.0.0-SNAPSHOT/tika-parser-sqlite3-package-3.0.0-20230916.113313-19.jar</url>
<url>https://repository.apache.org/content/groups/snapshots/org/apache/tika/tika-parser-sqlite3-package/3.0.0-SNAPSHOT/tika-parser-sqlite3-package-3.0.0-20230929.180046-41.jar</url>
<unpack>false</unpack>
<outputDirectory>${project.build.directory}/lib/tika-app</outputDirectory>
<md5>30c2565c8e051cb30da52f3d778e1078</md5>
</configuration>
</execution>
<execution>
<id>tika-pipes-reporter-fs-status-3.0.0-20230916.113325-19</id>
<id>tika-pipes-reporter-fs-status-3.0.0-20230929.180046-41</id>
<phase>prepare-package</phase>
<goals>
<goal>wget</goal>
</goals>
<configuration>
<url>https://repository.apache.org/content/groups/snapshots/org/apache/tika/tika-pipes-reporter-fs-status/3.0.0-SNAPSHOT/tika-pipes-reporter-fs-status-3.0.0-20230916.113325-19.jar</url>
<url>https://repository.apache.org/content/groups/snapshots/org/apache/tika/tika-pipes-reporter-fs-status/3.0.0-SNAPSHOT/tika-pipes-reporter-fs-status-3.0.0-20230929.180046-41.jar</url>
<unpack>false</unpack>
<outputDirectory>${project.build.directory}/lib/tika-core</outputDirectory>
<md5>874b8819dec38cdd83a2258f195a1856</md5>
Expand All @@ -271,133 +271,133 @@
</configuration>
</execution>
<execution>
<id>tika-emitter-fs-3.0.0-20230916.113236-19</id>
<id>tika-emitter-fs-3.0.0-20230929.180046-41</id>
<phase>prepare-package</phase>
<goals>
<goal>wget</goal>
</goals>
<configuration>
<url>https://repository.apache.org/content/groups/snapshots/org/apache/tika/tika-emitter-fs/3.0.0-SNAPSHOT/tika-emitter-fs-3.0.0-20230916.113236-19.jar</url>
<url>https://repository.apache.org/content/groups/snapshots/org/apache/tika/tika-emitter-fs/3.0.0-SNAPSHOT/tika-emitter-fs-3.0.0-20230929.180046-41.jar</url>
<unpack>false</unpack>
<outputDirectory>${project.build.directory}/lib/tika-emitter-fs</outputDirectory>
<md5>4ddc6102f326ef4905b8ec297f6930d7</md5>
</configuration>
</execution>
<execution>
<id>tika-emitter-jdbc-3.0.0-20230916.113239-19</id>
<id>tika-emitter-jdbc-3.0.0-20230929.180046-41</id>
<phase>prepare-package</phase>
<goals>
<goal>wget</goal>
</goals>
<configuration>
<url>https://repository.apache.org/content/groups/snapshots/org/apache/tika/tika-emitter-jdbc/3.0.0-SNAPSHOT/tika-emitter-jdbc-3.0.0-20230916.113239-19.jar</url>
<url>https://repository.apache.org/content/groups/snapshots/org/apache/tika/tika-emitter-jdbc/3.0.0-SNAPSHOT/tika-emitter-jdbc-3.0.0-20230929.180046-41.jar</url>
<unpack>false</unpack>
<outputDirectory>${project.build.directory}/lib/tika-emitter-jdbc</outputDirectory>
<md5>aef47a06adb481e5ed922695fe94ad3b</md5>
</configuration>
</execution>
<execution>
<id>tika-pipes-reporter-jdbc-3.0.0-20230916.113326-19</id>
<id>tika-pipes-reporter-jdbc-3.0.0-20230929.180046-41</id>
<phase>prepare-package</phase>
<goals>
<goal>wget</goal>
</goals>
<configuration>
<url>https://repository.apache.org/content/groups/snapshots/org/apache/tika/tika-pipes-reporter-jdbc/3.0.0-SNAPSHOT/tika-pipes-reporter-jdbc-3.0.0-20230916.113326-19.jar</url>
<url>https://repository.apache.org/content/groups/snapshots/org/apache/tika/tika-pipes-reporter-jdbc/3.0.0-SNAPSHOT/tika-pipes-reporter-jdbc-3.0.0-20230929.180046-41.jar</url>
<unpack>false</unpack>
<outputDirectory>${project.build.directory}/lib/tika-core</outputDirectory>
<md5>f4e80ec1445287e000d2ad22a440764a</md5>
</configuration>
</execution>
<execution>
<id>tika-eval-core-3.0.0-20230916.113245-19</id>
<id>tika-eval-core-3.0.0-20230929.080223-40</id>
<phase>prepare-package</phase>
<goals>
<goal>wget</goal>
</goals>
<configuration>
<url>https://repository.apache.org/content/groups/snapshots/org/apache/tika/tika-eval-core/3.0.0-SNAPSHOT/tika-eval-core-3.0.0-20230916.113245-19.jar</url>
<url>https://repository.apache.org/content/groups/snapshots/org/apache/tika/tika-eval-core/3.0.0-SNAPSHOT/tika-eval-core-3.0.0-20230929.080223-40.jar</url>
<unpack>false</unpack>
<outputDirectory>${project.build.directory}/lib/tika-extras</outputDirectory>
<md5>a224e425b7bbc0f8e8d959e97734676b</md5>
<md5>184c0ad313682f0fdbcb4513a85b52fa</md5>
</configuration>
</execution>
<execution>
<id>tika-pipes-iterator-s3-3.0.0-20230916.113323-19</id>
<id>tika-pipes-iterator-s3-3.0.0-20230929.180046-41</id>
<phase>prepare-package</phase>
<goals>
<goal>wget</goal>
</goals>
<configuration>
<url>https://repository.apache.org/content/groups/snapshots/org/apache/tika/tika-pipes-iterator-s3/3.0.0-SNAPSHOT/tika-pipes-iterator-s3-3.0.0-20230916.113323-19.jar</url>
<url>https://repository.apache.org/content/groups/snapshots/org/apache/tika/tika-pipes-iterator-s3/3.0.0-SNAPSHOT/tika-pipes-iterator-s3-3.0.0-20230929.180046-41.jar</url>
<unpack>false</unpack>
<outputDirectory>${project.build.directory}/lib/tika-pipes-iterator-s3</outputDirectory>
<md5>7ece173d822a4e639b7de850c1b8ff0a</md5>
<md5>739fde29a4ce47baf52d5d5db6e9e223</md5>
</configuration>
</execution>
<execution>
<id>tika-serialization-3.0.0-20230916.113329-20</id>
<id>tika-serialization-3.0.0-20230929.180046-42</id>
<phase>prepare-package</phase>
<goals>
<goal>wget</goal>
</goals>
<configuration>
<url>https://repository.apache.org/content/groups/snapshots/org/apache/tika/tika-serialization/3.0.0-SNAPSHOT/tika-serialization-3.0.0-20230916.113329-20.jar</url>
<url>https://repository.apache.org/content/groups/snapshots/org/apache/tika/tika-serialization/3.0.0-SNAPSHOT/tika-serialization-3.0.0-20230929.180046-42.jar</url>
<unpack>false</unpack>
<outputDirectory>${project.build.directory}/lib/tika-core</outputDirectory>
<md5>98384bcac2c450b613c6ffde5cbe43dd</md5>
</configuration>
</execution>
<execution>
<id>tika-detector-siegfried-3.0.0-20230916.113234-19</id>
<id>tika-detector-siegfried-3.0.0-20230929.080217-40</id>
<phase>prepare-package</phase>
<goals>
<goal>wget</goal>
</goals>
<configuration>
<url>https://repository.apache.org/content/groups/snapshots/org/apache/tika/tika-detector-siegfried/3.0.0-SNAPSHOT/tika-detector-siegfried-3.0.0-20230916.113234-19.jar</url>
<url>https://repository.apache.org/content/groups/snapshots/org/apache/tika/tika-detector-siegfried/3.0.0-SNAPSHOT/tika-detector-siegfried-3.0.0-20230929.080217-40.jar</url>
<unpack>false</unpack>
<outputDirectory>${project.build.directory}/lib/tika-extras</outputDirectory>
<md5>945a1fae320b3a89a1062701dc6c354b</md5>
</configuration>
</execution>
<execution>
<id>tika-emitter-opensearch-3.0.0-20230916.113240-19</id>
<id>tika-emitter-opensearch-3.0.0-20230929.180046-41</id>
<phase>prepare-package</phase>
<goals>
<goal>wget</goal>
</goals>
<configuration>
<url>https://repository.apache.org/content/groups/snapshots/org/apache/tika/tika-emitter-opensearch/3.0.0-SNAPSHOT/tika-emitter-opensearch-3.0.0-20230916.113240-19.jar</url>
<url>https://repository.apache.org/content/groups/snapshots/org/apache/tika/tika-emitter-opensearch/3.0.0-SNAPSHOT/tika-emitter-opensearch-3.0.0-20230929.180046-41.jar</url>
<unpack>false</unpack>
<outputDirectory>${project.build.directory}/lib/tika-emitter-opensearch</outputDirectory>
<md5>94920de26db8c229ee1dc4145d7b6df4</md5>
</configuration>
</execution>
<execution>
<id>tika-emitter-s3-3.0.0-20230916.113241-19</id>
<id>tika-emitter-s3-3.0.0-20230929.180046-41</id>
<phase>prepare-package</phase>
<goals>
<goal>wget</goal>
</goals>
<configuration>
<url>https://repository.apache.org/content/groups/snapshots/org/apache/tika/tika-emitter-s3/3.0.0-SNAPSHOT/tika-emitter-s3-3.0.0-20230916.113241-19.jar</url>
<url>https://repository.apache.org/content/groups/snapshots/org/apache/tika/tika-emitter-s3/3.0.0-SNAPSHOT/tika-emitter-s3-3.0.0-20230929.180046-41.jar</url>
<unpack>false</unpack>
<outputDirectory>${project.build.directory}/lib/tika-emitter-s3</outputDirectory>
<md5>d69e1cfef10e12626aad209efcb97691</md5>
<md5>68559a84f11bc599ee1b1a88cab841d8</md5>
</configuration>
</execution>
<execution>
<id>tika-app-3.0.0-20230916.113228-19</id>
<id>tika-app-3.0.0-20230929.180046-41</id>
<phase>prepare-package</phase>
<goals>
<goal>wget</goal>
</goals>
<configuration>
<url>https://repository.apache.org/content/groups/snapshots/org/apache/tika/tika-app/3.0.0-SNAPSHOT/tika-app-3.0.0-20230916.113228-19.jar</url>
<url>https://repository.apache.org/content/groups/snapshots/org/apache/tika/tika-app/3.0.0-SNAPSHOT/tika-app-3.0.0-20230929.180046-41.jar</url>
<unpack>false</unpack>
<outputDirectory>${project.build.directory}/lib/tika-app</outputDirectory>
<md5>4af4bb225cdb80782aee65f1edee7000</md5>
<md5>c8585b454722d835f885c0ef80bbd116</md5>
</configuration>
</execution>
<execution>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.CheckBox;
import javafx.scene.control.ComboBox;
import javafx.scene.control.TextField;
import org.apache.logging.log4j.LogManager;
Expand Down Expand Up @@ -64,6 +65,9 @@ public class AdvancedBatchController extends ControllerBase implements Initializ
@FXML
private TextField writeLimit;

@FXML
private CheckBox throwOnWriteLimitReached;

@Override
public void initialize(URL fxmlFileLocation, ResourceBundle resources) {

Expand All @@ -87,11 +91,17 @@ public void initialize(URL fxmlFileLocation, ResourceBundle resources) {
if (batchProcessConfig.getWriteLimit() > -1) {
writeLimit.setText(Long.toString(batchProcessConfig.getWriteLimit()));
}
//add a listener so that we can validate input
//when the user enters it
writeLimit.focusedProperty().addListener((ov, oldV, newV) -> {
if (! newV) {
setWriteLimit();
}
});

if (batchProcessConfig.isThrowOnWriteLimitReached()) {
throwOnWriteLimitReached.setSelected(true);
}
}

public void setWriteLimit() {
Expand Down Expand Up @@ -164,6 +174,8 @@ public void saveState() {
bpc.getEmitWithinMs());
bpc.setEmitWithinMs(emitWithin);

bpc.setThrowOnWriteLimitReached(throwOnWriteLimitReached.isSelected());

APP_CONTEXT.saveState();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ public class BatchProcessConfig {

private long writeLimit = -1;

private boolean throwOnWriteLimitReached = false;

public Optional<ConfigItem> getPipesIterator() {
return pipesIterator;
}
Expand Down Expand Up @@ -211,6 +213,14 @@ public void setWriteLimit(long writeLimit) {
this.writeLimit = writeLimit;
}

public void setThrowOnWriteLimitReached(boolean throwOnWriteLimitReached) {
this.throwOnWriteLimitReached = throwOnWriteLimitReached;
}

public boolean isThrowOnWriteLimitReached() {
return throwOnWriteLimitReached;
}

public void setParserConfig(ParserConfig parserConfig) {
this.parserConfig = parserConfig;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,8 @@ private void appendFSPipesIterator(BatchProcessConfig batchProcessConfig,

if (batchProcessConfig.getWriteLimit() >= 0) {
writer.appendTextElement(params, "writeLimit", Long.toString(batchProcessConfig.getWriteLimit()));
writer.appendTextElement(params, "throwOnWriteLimitReached",
Boolean.toString(batchProcessConfig.isThrowOnWriteLimitReached()));
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>

<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
Expand All @@ -17,8 +18,10 @@
specific language governing permissions and limitations
under the License.
-->

<?import java.lang.String?>
<?import javafx.collections.FXCollections?>
<?import javafx.scene.control.CheckBox?>
<?import javafx.scene.control.ComboBox?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.Tab?>
Expand All @@ -35,12 +38,12 @@
<tabs>
<Tab closable="false" disable="false" text="Detectors">
<content>
<fx:include fx:id="detector_config" source="detector-view.fxml"/>
<fx:include fx:id="detector_config" source="detector-view.fxml" />
</content>
</Tab>
<Tab closable="false" disable="false" text="Parsers">
<content>
<fx:include fx:id="parser_config" source="parser-view.fxml"/>
<fx:include fx:id="parser_config" source="parser-view.fxml" />
</content>
</Tab>
<Tab closable="false" text="Parse Options">
Expand All @@ -59,6 +62,7 @@
</ComboBox>
<Label layoutX="54.0" layoutY="110.0" prefHeight="21.0" prefWidth="121.0" text="Write Limit (bytes)" />
<TextField fx:id="writeLimit" alignment="CENTER_RIGHT" layoutX="188.0" layoutY="108.0" onAction="#setWriteLimit" />
<CheckBox fx:id="throwOnWriteLimitReached" layoutX="388.0" layoutY="112.0" mnemonicParsing="false" text="Stop if limit reached" />
</children>
</AnchorPane>
</content>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,15 @@
package org.tallison.tika.app.fx.ctx;

import java.io.StringWriter;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Collections;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.datatype.jdk8.Jdk8Module;
import org.apache.commons.io.FileUtils;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
Expand All @@ -41,9 +44,10 @@ public static void setUp() throws Exception {

@Test
public void testBasic() throws Exception {
String emitterPath = "somthing123456789";
AppContext appContext = new AppContext();
EmitterSpec emitterSpec = new FileSystemEmitterSpec(Collections.EMPTY_LIST);
((FileSystemEmitterSpec)emitterSpec).setBasePath(Paths.get("something"));
((FileSystemEmitterSpec)emitterSpec).setBasePath(Paths.get(emitterPath));
emitterSpec.setShortLabel("short label");
emitterSpec.setFullLabel("full label");
emitterSpec.initialize();
Expand All @@ -58,6 +62,12 @@ public void testBasic() throws Exception {
StringWriter writer = new StringWriter();
objectMapper.writeValue(writer, appContext);
AppContext deserialized = objectMapper.readValue(writer.toString(), AppContext.class);

//cleanup
Path something = Paths.get(emitterPath);
if (Files.isDirectory(something)) {
FileUtils.deleteDirectory(something.toFile());
}
}

@Test
Expand Down

0 comments on commit ef136bf

Please sign in to comment.