Skip to content

Commit 40679d2

Browse files
committed
Bump of log4j and jenax versions - no more module access warnings \o/
1 parent 04df6f4 commit 40679d2

File tree

10 files changed

+163
-171
lines changed

10 files changed

+163
-171
lines changed

dcat-experimental/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777

7878
<dependency>
7979
<groupId>org.slf4j</groupId>
80-
<artifactId>slf4j-log4j12</artifactId>
80+
<artifactId>slf4j-api</artifactId>
8181
</dependency>
8282

8383
<dependency>

dcat-suite-binding-ckan/pom.xml

+11-13
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,26 @@
1515

1616

1717
<dependencies>
18+
<dependency>
19+
<groupId>org.slf4j</groupId>
20+
<artifactId>slf4j-api</artifactId>
21+
</dependency>
22+
1823
<!-- <dependency> -->
1924
<!-- <groupId>org.aksw.jenax</groupId> -->
2025
<!-- <artifactId>jenax-core</artifactId> -->
2126
<!-- </dependency> -->
2227

23-
<!--
24-
<dependency>
25-
<groupId>org.apache.beam</groupId>
26-
<artifactId>beam-sdks-java-core</artifactId>
27-
</dependency>
28-
-->
28+
<!-- <dependency> <groupId>org.apache.beam</groupId> <artifactId>beam-sdks-java-core</artifactId>
29+
</dependency> -->
2930

3031
<dependency>
31-
<groupId>org.aksw.jenax</groupId>
32-
<artifactId>jenax-facete-impl</artifactId>
32+
<groupId>org.aksw.jenax</groupId>
33+
<artifactId>jenax-facete-impl</artifactId>
3334
</dependency>
3435

35-
<!-- Only used for spring's conversion service of spring-core; try to remove this dep -->
36+
<!-- Only used for spring's conversion service of spring-core; try to remove
37+
this dep -->
3638
<dependency>
3739
<groupId>org.springframework.boot</groupId>
3840
<artifactId>spring-boot</artifactId>
@@ -97,10 +99,6 @@
9799
</dependency>
98100

99101

100-
<dependency>
101-
<groupId>org.slf4j</groupId>
102-
<artifactId>slf4j-log4j12</artifactId>
103-
</dependency>
104102

105103
<dependency>
106104
<groupId>junit</groupId>

dcat-suite-binding-ckan/src/main/java/org/aksw/ckan_deploy/core/DcatCkanDeployUtils.java

+85-81
Original file line numberDiff line numberDiff line change
@@ -299,94 +299,97 @@ public static void deploy(CkanClient ckanClient, DcatDataset dataset, IRIxResolv
299299
remoteCkanDataset = ckanClient.updateDataset(remoteCkanDataset);
300300
}
301301

302+
302303
for(DcatDistribution dcatDistribution : dataset.getDistributions()) {
303304

304305

305306
CkanResource remoteCkanResource = createOrUpdateResource(ckanClient, remoteCkanDataset, dataset, dcatDistribution);
306307

307-
// Check if there is a graph in the dataset that matches the distribution
308-
String distributionName = dcatDistribution.getTitle();
308+
if (!noFileUpload) {
309309

310-
logger.info("Deploying distribution " + distributionName);
310+
// Check if there is a graph in the dataset that matches the distribution
311+
String distributionName = dcatDistribution.getTitle();
311312

312-
Set<String> downloadUrls = dcatDistribution.getDownloadURLs();
313+
logger.info("Deploying distribution " + distributionName);
313314

314-
List<String> resolvedUrls = downloadUrls.stream()
315-
//.filter(Resource::isURIResource)
316-
//.map(Resource::getURI)
317-
.map(iriResolver::resolve)
318-
.map(IRIx::str)
319-
.collect(Collectors.toList());
315+
Set<String> downloadUrls = dcatDistribution.getDownloadURLs();
320316

321-
Set<URI> resolvedValidUrls = resolvedUrls.stream()
322-
.map(str -> UriUtils.tryNewURI(str).orElse(null))
323-
.filter(r -> r != null)
324-
.collect(Collectors.toCollection(LinkedHashSet::new));
317+
List<String> resolvedUrls = downloadUrls.stream()
318+
//.filter(Resource::isURIResource)
319+
//.map(Resource::getURI)
320+
.map(iriResolver::resolve)
321+
.map(IRIx::str)
322+
.collect(Collectors.toList());
325323

326-
if (resolvedUrls.size() > 1) {
327-
logger.warn("Multiple URLs associated with a distribution; assuming they mirror content and choosing one from " + resolvedUrls);
328-
}
324+
Set<URI> resolvedValidUrls = resolvedUrls.stream()
325+
.map(str -> UriUtils.tryNewURI(str).orElse(null))
326+
.filter(r -> r != null)
327+
.collect(Collectors.toCollection(LinkedHashSet::new));
329328

330-
Set<URI> urlsToExistingPaths = resolvedValidUrls.stream()
331-
.filter(uri ->
332-
DcatCkanDeployUtils.pathsGet(uri)
333-
.filter(Files::exists)
334-
.filter(Files::isRegularFile)
335-
.isPresent())
336-
.collect(Collectors.toSet());
337-
338-
Set<URI> webUrls = Sets.difference(resolvedValidUrls, urlsToExistingPaths);
339-
340-
String downloadFilename;
341-
Optional<Path> pathReference = Optional.empty();
342-
Path root = null;
343-
if (urlsToExistingPaths.size() > 0) {
344-
URI fileUrl = urlsToExistingPaths.iterator().next();
345-
pathReference = DcatCkanDeployUtils.pathsGet(fileUrl);
346-
downloadFilename = pathReference.get().getFileName().toString();
347-
} else {
348-
// TODO This should go through the conjure http cache
349-
root = Files.createTempDirectory("http-cache-");
350-
URI webUrl = webUrls.iterator().next();
351-
String webUrlPathStr = webUrl.getPath();
352-
Path tmp = Paths.get(webUrlPathStr);
353-
downloadFilename = tmp.getFileName().toString();
354-
355-
HttpResourceRepositoryFromFileSystemImpl manager = HttpResourceRepositoryFromFileSystemImpl.create(root);
356-
357-
BasicHttpRequest r = new BasicHttpRequest("GET", webUrl.toASCIIString());
358-
// r.setHeader(HttpHeaders.ACCEPT, WebContent.contentTypeTurtleAlt2);
359-
// r.setHeader(HttpHeaders.ACCEPT_ENCODING, "gzip,identity;q=0");
360-
361-
RdfHttpEntityFile httpEntity = manager.get(r, HttpResourceRepositoryFromFileSystemImpl::resolveRequest);
362-
pathReference = Optional.ofNullable(httpEntity).map(RdfHttpEntityFile::getAbsolutePath);
363-
}
329+
if (resolvedUrls.size() > 1) {
330+
logger.warn("Multiple URLs associated with a distribution; assuming they mirror content and choosing one from " + resolvedUrls);
331+
}
332+
333+
Set<URI> urlsToExistingPaths = resolvedValidUrls.stream()
334+
.filter(uri ->
335+
DcatCkanDeployUtils.pathsGet(uri)
336+
.filter(Files::exists)
337+
.filter(Files::isRegularFile)
338+
.isPresent())
339+
.collect(Collectors.toSet());
340+
341+
Set<URI> webUrls = Sets.difference(resolvedValidUrls, urlsToExistingPaths);
342+
343+
String downloadFilename;
344+
Optional<Path> pathReference = Optional.empty();
345+
Path root = null;
346+
if (urlsToExistingPaths.size() > 0) {
347+
URI fileUrl = urlsToExistingPaths.iterator().next();
348+
pathReference = DcatCkanDeployUtils.pathsGet(fileUrl);
349+
downloadFilename = pathReference.get().getFileName().toString();
350+
} else {
351+
// TODO This should go through the conjure resource cache
352+
root = Files.createTempDirectory("http-cache-");
353+
URI webUrl = webUrls.iterator().next();
354+
String webUrlPathStr = webUrl.getPath();
355+
Path tmp = Paths.get(webUrlPathStr);
356+
downloadFilename = tmp.getFileName().toString();
364357

365-
// TODO This breaks if the downloadURLs are web urls.
366-
// We need a flag whether to do a file upload for web urls, or whether to just update metadata
367-
368-
// Optional<Path> pathReference = resolvedValidUrls.stream()
369-
// .map(DcatCkanDeployUtils::pathsGet)
370-
// .filter(Optional::isPresent)
371-
// .map(Optional::get)
372-
// .filter(Files::exists)
373-
// .findFirst();
374-
//
375-
376-
if(pathReference.isPresent()) {
377-
Path path = pathReference.get();
378-
379-
//String filename = distributionName + ".nt";
380-
String probedContentType = null;
381-
try {
382-
probedContentType = Files.probeContentType(path);
383-
} catch (IOException e) {
384-
logger.warn("Failed to probe content type of " + path, e);
358+
HttpResourceRepositoryFromFileSystemImpl manager = HttpResourceRepositoryFromFileSystemImpl.create(root);
359+
360+
BasicHttpRequest r = new BasicHttpRequest("GET", webUrl.toASCIIString());
361+
// r.setHeader(HttpHeaders.ACCEPT, WebContent.contentTypeTurtleAlt2);
362+
// r.setHeader(HttpHeaders.ACCEPT_ENCODING, "gzip,identity;q=0");
363+
364+
RdfHttpEntityFile httpEntity = manager.get(r, HttpResourceRepositoryFromFileSystemImpl::resolveRequest);
365+
pathReference = Optional.ofNullable(httpEntity).map(RdfHttpEntityFile::getAbsolutePath);
385366
}
386367

387-
String contentType = Optional.ofNullable(probedContentType).orElse(ContentType.APPLICATION_OCTET_STREAM.toString());
368+
// TODO This breaks if the downloadURLs are web urls.
369+
// We need a flag whether to do a file upload for web urls, or whether to just update metadata
370+
371+
// Optional<Path> pathReference = resolvedValidUrls.stream()
372+
// .map(DcatCkanDeployUtils::pathsGet)
373+
// .filter(Optional::isPresent)
374+
// .map(Optional::get)
375+
// .filter(Files::exists)
376+
// .findFirst();
377+
//
378+
379+
if (pathReference.isPresent()) {
380+
Path path = pathReference.get();
381+
382+
//String filename = distributionName + ".nt";
383+
String probedContentType = null;
384+
try {
385+
probedContentType = Files.probeContentType(path);
386+
} catch (IOException e) {
387+
logger.warn("Failed to probe content type of " + path, e);
388+
}
389+
390+
String contentType = Optional.ofNullable(probedContentType).orElse(ContentType.APPLICATION_OCTET_STREAM.toString());
388391

389-
if (!noFileUpload) {
392+
// if (!noFileUpload) {
390393

391394
logger.info("Uploading file " + path);
392395
CkanResource tmp = CkanClientUtils.uploadFile(
@@ -431,18 +434,19 @@ public static void deploy(CkanClient ckanClient, DcatDataset dataset, IRIxResolv
431434
//remoteCkanResource = ckanClient.updateResource(remoteCkanResource);
432435

433436

434-
} else {
435-
logger.info("File upload disabled. Skipping " + path);
437+
// } else {
438+
// logger.info("File upload disabled. Skipping " + path);
439+
// }
436440
}
437-
}
438441

439-
Resource newDownloadUrl = ResourceFactory.createResource(remoteCkanResource.getUrl());
442+
Resource newDownloadUrl = ResourceFactory.createResource(remoteCkanResource.getUrl());
440443

441-
org.aksw.jena_sparql_api.rdf.collections.ResourceUtils.setProperty(dcatDistribution, DCAT.downloadURL, newDownloadUrl);
444+
org.aksw.jena_sparql_api.rdf.collections.ResourceUtils.setProperty(dcatDistribution, DCAT.downloadURL, newDownloadUrl);
442445

443-
if (root != null) {
444-
logger.info("Removing directory recursively: " + root);
445-
// MoreFiles.deleteRecursively(root);
446+
if (root != null) {
447+
logger.info("Removing directory recursively: " + root);
448+
// MoreFiles.deleteRecursively(root);
449+
}
446450
}
447451
}
448452
}

dcat-suite-binding-ckan/src/main/java/org/aksw/dcat/repo/impl/fs/CatalogResolverFilesystem.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,7 @@ public DatasetResolver doCacheDataset(String requestId, DatasetResolver dr) thro
498498
for(String altId : altIds) {
499499
Path tgt = datasetByIdFolder.resolve(UriToPathUtils.resolvePath(altId));
500500
Files.createDirectories(tgt);
501-
SymLinkUtils.allocateSymbolicLink(SymbolicLinkStrategies.STANDARD, dsFolder, tgt, "_content", "");
501+
SymLinkUtils.allocateSymbolicLink(SymbolicLinkStrategies.STANDARD, dsFolder, tgt, Function.identity(), "_content", "");
502502
}
503503

504504

@@ -513,7 +513,7 @@ public void indexDistributions(DcatDataset dcatDataset, Path targetDatasetFolder
513513
Path linkSource = distributionIndexFolder.resolve(UriToPathUtils.resolvePath(uri));
514514
Files.createDirectories(linkSource);
515515

516-
SymLinkUtils.allocateSymbolicLink(SymbolicLinkStrategies.STANDARD, targetDatasetFolder, linkSource, "_content", "");
516+
SymLinkUtils.allocateSymbolicLink(SymbolicLinkStrategies.STANDARD, targetDatasetFolder, linkSource, Function.identity(), "_content", "");
517517
}
518518
}
519519
}

dcat-suite-cli/pom.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@
7171
</dependency> -->
7272

7373
<dependency>
74-
<groupId>org.slf4j</groupId>
75-
<artifactId>slf4j-log4j12</artifactId>
74+
<groupId>org.apache.logging.log4j</groupId>
75+
<artifactId>log4j-slf4j18-impl</artifactId>
7676
</dependency>
7777

7878
<dependency>

dcat-suite-cli/src/main/resources/log4j.properties

-45
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
dest = err
2+
name = PropertiesConfig
3+
4+
appender.console.type = Console
5+
appender.console.name = STDERR
6+
appender.console.target = SYSTEM_ERR
7+
appender.console.layout.type = PatternLayout
8+
appender.console.layout.pattern = [%p] %m%n
9+
10+
rootLogger.level = info
11+
rootLogger.appenderRef.stderr.ref = STDERR
12+
13+
logger.jena-root.name = Jena
14+
logger.jena-root.level = warn
15+
16+
logger.jena-core.name = org.apache.jena
17+
logger.jena-core.level = warn
18+
19+
logger.jena-syntax.name = org.apache.jena.sparql.syntax.syntaxtransform.ElementTransformer
20+
logger.jena-syntax.level = off
21+
22+
logger.apache-http.name = org.apache.http
23+
logger.apache-http.level = warn
24+
25+
logger.jetty.name = org.eclipse.jetty
26+
logger.jetty.level = warn
27+
28+
logger.spring.name = org.springframework
29+
logger.spring.level = warn
30+
31+
logger.cors.name = org.aksw.jena_sparql_api.web.filters.CorsFilter
32+
logger.cors.level = warn
33+
34+
logger.riot.name = org.apache.jena.riot.resultset.rw
35+
logger.riot.level = off
36+
37+
logger.fs.name = org.aksw.jena_sparql_api.sparql.ext.fs.QueryIterServiceOrFile
38+
logger.fs.level = info
39+
40+

dcat-suite-core/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272

7373
<dependency>
7474
<groupId>org.slf4j</groupId>
75-
<artifactId>slf4j-log4j12</artifactId>
75+
<artifactId>slf4j-api</artifactId>
7676
</dependency>
7777

7878
<dependency>

0 commit comments

Comments
 (0)