Skip to content

Commit e5bea25

Browse files
committed
Merge branch 'feature/update-dropwizard'
2 parents 5542fd1 + 46d4641 commit e5bea25

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+1598
-1677
lines changed

build.gradle

Lines changed: 41 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ plugins {
2424
id 'org.ajoberstar.grgit' version '5.3.0' apply false
2525
id 'distribution'
2626
id 'application'
27+
id "org.jetbrains.kotlin.jvm" version "1.8.21"
2728
}
2829

2930
apply plugin: 'jacoco'
@@ -89,29 +90,31 @@ dependencies {
8990

9091
//Apache commons
9192
implementation group: 'commons-pool', name: 'commons-pool', version: '1.6'
92-
implementation group: 'commons-io', name: 'commons-io', version: '2.9.0'
93+
implementation group: 'commons-io', name: 'commons-io', version: '2.14.0'
9394
implementation group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.5.14'
9495
implementation group: 'org.apache.httpcomponents', name: 'httpmime', version: '4.5.3'
9596
implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.6'
9697
implementation group: 'org.apache.commons', name: 'commons-collections4', version: '4.4'
9798
implementation group: 'org.apache.commons', name: 'commons-csv', version: '1.5'
9899

99100
//Dropwizard
100-
implementation "io.dropwizard:dropwizard-core:1.3.23"
101-
implementation "io.dropwizard:dropwizard-assets:1.3.23"
102-
implementation "com.hubspot.dropwizard:dropwizard-guicier:1.3.5.0"
103-
implementation "io.dropwizard:dropwizard-testing:1.3.23"
104-
implementation "io.dropwizard:dropwizard-forms:1.3.23"
105-
implementation "io.dropwizard:dropwizard-client:1.3.23"
106-
implementation "io.dropwizard:dropwizard-auth:1.3.23"
107-
implementation "io.dropwizard.metrics:metrics-core:4.0.0"
108-
implementation "io.dropwizard.metrics:metrics-servlets:4.0.0"
109-
110-
implementation group: 'com.google.guava', name: 'guava', version: '28.2-jre'
101+
implementation 'ru.vyarus:dropwizard-guicey:7.0.0'
102+
103+
implementation 'io.dropwizard:dropwizard-bom:4.0.2'
104+
implementation 'io.dropwizard:dropwizard-core:4.0.2'
105+
implementation 'io.dropwizard:dropwizard-assets:4.0.2'
106+
implementation 'io.dropwizard:dropwizard-testing:4.0.2'
107+
implementation 'io.dropwizard:dropwizard-forms:4.0.2'
108+
implementation 'io.dropwizard:dropwizard-client:4.0.2'
109+
implementation 'io.dropwizard:dropwizard-auth:4.0.2'
110+
implementation 'io.dropwizard.metrics:metrics-core:4.2.22'
111+
implementation 'io.dropwizard.metrics:metrics-servlets:4.2.22'
112+
113+
implementation group: 'com.google.guava', name: 'guava', version: '32.0.1-jre'
111114

112115
//Parsing xml/json
113-
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: '2.10.1'
114-
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.10.1'
116+
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: '2.13.1'
117+
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.13.4.2'
115118
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-annotations', version: '2.10.1'
116119
implementation group: 'xom', name: 'xom', version: '1.3.2'
117120
implementation group: 'javax.xml.bind', name: 'jaxb-api', version: '2.3.0'
@@ -141,10 +144,27 @@ dependencies {
141144
}
142145

143146
//Tests
144-
testImplementation group: 'junit', name: 'junit', version: '4.12'
145-
testImplementation group: 'org.hamcrest', name: 'hamcrest-all', version: '1.3'
147+
testImplementation(platform('org.junit:junit-bom:5.10.2'))
148+
testRuntimeOnly("org.junit.platform:junit-platform-launcher") {
149+
because("Only needed to run tests in a version of IntelliJ IDEA that bundles older versions")
150+
}
151+
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine")
152+
testImplementation('org.junit.jupiter:junit-jupiter')
153+
testRuntimeOnly("org.junit.vintage:junit-vintage-engine") {
154+
because 'allows JUnit 3 and JUnit 4 tests to run'
155+
}
156+
157+
testRuntimeOnly("org.junit.platform:junit-platform-launcher") {
158+
because 'allows tests to run from IDEs that bundle older version of launcher'
159+
}
160+
testImplementation 'org.easymock:easymock:5.2.0'
161+
testImplementation 'org.hamcrest:hamcrest-all:1.3'
162+
testImplementation 'org.hamcrest:hamcrest-library:2.2'
146163
testImplementation 'org.powermock:powermock-module-junit4:2.0.9'
147164
testImplementation 'org.powermock:powermock-api-easymock:2.0.9'
165+
testImplementation 'org.jetbrains.kotlin:kotlin-test'
166+
testImplementation "io.mockk:mockk:1.13.9"
167+
148168
}
149169

150170
configurations.all {
@@ -155,6 +175,7 @@ configurations.all {
155175
exclude group: 'org.slf4j', module: "slf4j-log4j12"
156176
}
157177

178+
158179
def getJavaLibraryPath = {
159180
def jepLocalLibraries = ""
160181
if (Os.isFamily(Os.FAMILY_MAC)) {
@@ -275,6 +296,10 @@ jar {
275296
enabled true
276297
}
277298

299+
artifacts {
300+
archives shadowJar
301+
}
302+
278303
distZip.enabled = true
279304
distTar.enabled = false
280305
shadowDistZip.enabled = false

resources/config/config-docker.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ entityFishingPort: 443
1919
#entityFishingPort: 8090
2020

2121
# if true we use binary classifiers for the contexts, otherwise use a single multi-label classifier
22-
# binary classifiers perform better, but havier to use
22+
# binary classifiers perform better, but heavier to use
2323
useBinaryContextClassifiers: false
2424

2525
# sequence labeling model (identify data-related sections)
@@ -35,7 +35,7 @@ models:
3535
window: 20
3636
nbMaxIterations: 2000
3737

38-
# classifier model, dataset binary (datset or not dataset in the current sentence)
38+
# classifier model, dataset binary (dataset or not dataset in the current sentence)
3939
- name: "dataseer-binary"
4040
engine: "delft"
4141
delft:
@@ -120,7 +120,6 @@ models:
120120
architecture: "bert"
121121
transformer: "michiyasunaga/LinkBERT-basecased"
122122

123-
124123
# Limit the maximum number of requests (0, no limit)
125124
maxParallelRequests: 0
126125

@@ -131,17 +130,18 @@ corsAllowedHeaders: "X-Requested-With,Content-Type,Accept,Origin"
131130

132131
server:
133132
type: custom
134-
idleTimeout: 120 seconds
135133
applicationConnectors:
136134
- type: http
137135
port: 8060
136+
idleTimeout: 120 seconds
137+
acceptQueueSize: 2048
138138
adminConnectors:
139139
- type: http
140140
port: 8061
141141
registerDefaultExceptionMappers: false
142142
maxThreads: 2048
143143
maxQueuedRequests: 2048
144-
acceptQueueSize: 2048
144+
145145
requestLog:
146146
appenders: []
147147

resources/config/config.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,17 +131,18 @@ corsAllowedHeaders: "X-Requested-With,Content-Type,Accept,Origin"
131131

132132
server:
133133
type: custom
134-
idleTimeout: 120 seconds
135134
applicationConnectors:
136135
- type: http
137136
port: 8060
137+
idleTimeout: 120 seconds
138+
acceptQueueSize: 2048
138139
adminConnectors:
139140
- type: http
140141
port: 8061
141142
registerDefaultExceptionMappers: false
142143
maxThreads: 2048
143144
maxQueuedRequests: 2048
144-
acceptQueueSize: 2048
145+
145146
requestLog:
146147
appenders: []
147148

src/main/java/org/grobid/core/analyzers/DatastetAnalyzer.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package org.grobid.core.analyzers;
22

3-
import org.grobid.core.layout.LayoutToken;
43
import org.grobid.core.lang.Language;
4+
import org.grobid.core.layout.LayoutToken;
55

66
import java.util.ArrayList;
77
import java.util.List;
@@ -21,8 +21,8 @@ public static DatastetAnalyzer getInstance() {
2121
if (instance == null) {
2222
//double check idiom
2323
// synchronized (instanceController) {
24-
if (instance == null)
25-
getNewInstance();
24+
if (instance == null)
25+
getNewInstance();
2626
// }
2727
}
2828
return instance;
@@ -111,7 +111,7 @@ public List<LayoutToken> retokenizeLayoutTokens(List<LayoutToken> tokens) {
111111
return result;
112112
}
113113

114-
public List<LayoutToken> tokenize(LayoutToken chunk) {
114+
public List<LayoutToken> tokenize(LayoutToken chunk) {
115115
List<LayoutToken> result = new ArrayList<>();
116116
String text = chunk.getText();
117117
StringTokenizer st = new StringTokenizer(text, DELIMITERS, true);
@@ -127,7 +127,7 @@ public List<LayoutToken> tokenize(LayoutToken chunk) {
127127
}
128128

129129
return result;
130-
}
130+
}
131131

132132
public List<LayoutToken> retokenizeSubdigitsFromLayoutToken(List<LayoutToken> tokens) {
133133
// already done by this analyzer

src/main/java/org/grobid/core/data/BiblioComponent.java

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,19 @@
11
package org.grobid.core.data;
22

3-
import org.grobid.core.engines.label.TaggingLabel;
4-
import org.grobid.core.utilities.TextUtilities;
5-
import org.grobid.core.utilities.OffsetPosition;
6-
import org.grobid.core.lexicon.DatastetLexicon;
7-
import org.grobid.core.layout.BoundingBox;
8-
import org.grobid.core.layout.LayoutToken;
9-
103
import com.fasterxml.jackson.core.JsonProcessingException;
114
import com.fasterxml.jackson.databind.ObjectMapper;
12-
13-
import java.util.List;
14-
5+
import org.grobid.core.layout.BoundingBox;
6+
import org.grobid.core.utilities.TextUtilities;
157
import org.slf4j.Logger;
168
import org.slf4j.LoggerFactory;
179

1810
/**
19-
* Representation of the bibliographical reference element for a software mention.
20-
* The component represent the reference callout (position) and its matched full
21-
* bibliographical reference.
22-
*
23-
* The bibliographical reference can also be disambiguated against wikidata via
24-
* its (inherited) KnowledgeEntity object attributes.
11+
* Representation of the bibliographical reference element for a software mention.
12+
* The component represent the reference callout (position) and its matched full
13+
* bibliographical reference.
14+
* <p>
15+
* The bibliographical reference can also be disambiguated against wikidata via
16+
* its (inherited) KnowledgeEntity object attributes.
2517
*/
2618
public class BiblioComponent extends DatasetComponent {
2719
private static final Logger logger = LoggerFactory.getLogger(BiblioComponent.class);
@@ -62,10 +54,10 @@ public int getRefKey() {
6254

6355
public String toJson() {
6456
ObjectMapper mapper = new ObjectMapper();
65-
57+
6658
StringBuffer buffer = new StringBuffer();
6759
buffer.append("{ ");
68-
60+
6961
try {
7062
buffer.append("\"label\" : " + mapper.writeValueAsString(rawForm));
7163
} catch (JsonProcessingException e) {
@@ -82,7 +74,7 @@ public String toJson() {
8274
}
8375
}*/
8476
buffer.append(", \"refKey\": " + refKey);
85-
77+
8678
// knowledge information
8779
if (wikidataId != null) {
8880
buffer.append(", \"wikidataId\": \"" + wikidataId + "\"");
@@ -99,10 +91,10 @@ public String toJson() {
9991

10092
if (offsets != null) {
10193
buffer.append(", \"offsetStart\" : " + offsets.start);
102-
buffer.append(", \"offsetEnd\" : " + offsets.end);
94+
buffer.append(", \"offsetEnd\" : " + offsets.end);
10395
}
10496

105-
if ( (boundingBoxes != null) && (boundingBoxes.size() > 0) ) {
97+
if ((boundingBoxes != null) && (boundingBoxes.size() > 0)) {
10698
buffer.append(", \"boundingBoxes\" : [");
10799
boolean first = true;
108100
for (BoundingBox box : boundingBoxes) {
@@ -114,7 +106,7 @@ public String toJson() {
114106
}
115107
buffer.append("] ");
116108
}
117-
109+
118110
buffer.append(" }");
119111
return buffer.toString();
120112
}

0 commit comments

Comments
 (0)