Skip to content

Commit 5d3e6cd

Browse files
authored
Merge pull request #2284 from adamretter/refactor/prov-expath-pkg-fork-4.x.x
(4.x.x) Improve the provenance of our EXPath Pkg Repo fork dependency
2 parents 6322824 + 3c582da commit 5d3e6cd

File tree

10 files changed

+16
-15
lines changed

10 files changed

+16
-15
lines changed

.classpath

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
<classpathentry kind="lib" path="lib/core/lz4-java-1.5.0.jar"/>
2727
<classpathentry kind="lib" path="lib/core/icu4j-59_1.jar"/>
2828
<classpathentry kind="lib" path="lib/core/icu4j-localespi-59_1.jar"/>
29-
<classpathentry kind="lib" path="lib/core/pkg-java-fork.jar"/>
29+
<classpathentry kind="lib" path="lib/core/pkg-java-1.1.jar"/>
3030
<classpathentry kind="lib" path="lib/core/caffeine-2.6.2.jar"/>
3131
<classpathentry kind="lib" path="lib/core/jctools-core-2.1.2.jar"/>
3232
<classpathentry kind="lib" path="lib/core/jsr305-3.0.2.jar"/>

extensions/modules/src/org/exist/xquery/modules/expathrepo/InstallFunction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public Sequence eval(Sequence[] args, Sequence contextSequence)
105105
doc = _getDocument(pkgOrPath);
106106
Path file = ((NativeBroker)context.getBroker()).getCollectionBinaryFileFsPath(doc.getURI());
107107
LOG.debug("Installing file: " + file.toAbsolutePath().toString());
108-
pkg = parent_repo.installPackage(file, force, interact);
108+
pkg = parent_repo.installPackage(new XarFileSource(file), force, interact);
109109
repo.get().reportAction(ExistRepository.Action.INSTALL, pkg.getName());
110110
} finally {
111111
if (doc != null)

lib/core/pkg-java-1.1.jar

85.9 KB
Binary file not shown.

lib/core/pkg-java-fork.jar

-156 KB
Binary file not shown.

nbproject/project.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ file.reference.lucene-queries-4.10.4.jar=extensions/indexes/lucene/lib/lucene-qu
3535
file.reference.lucene-queryparser-4.10.4.jar=extensions/indexes/lucene/lib/lucene-queryparser-4.10.4.jar
3636
file.reference.nekohtml-1.9.22.jar=lib/user/nekohtml-1.9.22.jar
3737
file.reference.objenesis-2.2.jar=lib/test/objenesis-2.2.jar
38-
file.reference.pkg-java-fork.jar=lib/core/pkg-java-fork.jar
38+
file.reference.pkg-java-1.1.jar=lib/core/pkg-java-1.1.jar
3939
file.reference.quartz-2.3.0.jar=lib/core/quartz-2.3.0.jar
4040
file.reference.Saxon-HE-9.6.0-7.jar=lib/endorsed/Saxon-HE-9.6.0-7.jar
4141
file.reference.slf4j-api-1.7.25.jar=lib/core/slf4j-api-1.7.25.jar
@@ -400,7 +400,7 @@ javac.classpath=\
400400
${file.reference.wrapper.jar}:\
401401
${file.reference.wrapperApp.jar}:\
402402
${file.reference.jargo-0.4.14.jar}:\
403-
${file.reference.pkg-java-fork.jar}:\
403+
${file.reference.pkg-java-1.1.jar}:\
404404
${file.reference.jna-4.2.2.jar}:\
405405
${file.reference.jna-platform-4.2.2.jar}
406406
javadoc.additionalparam=-J-Xmx320m

src/org/exist/repo/ClasspathHelper.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
*/
2121
package org.exist.repo;
2222

23-
import java.io.*;
23+
import java.io.BufferedReader;
24+
import java.io.IOException;
2425
import java.nio.file.Files;
2526
import java.nio.file.Path;
2627
import java.util.Collection;
@@ -70,7 +71,7 @@ public static void updateClasspath(BrokerPool pool, org.expath.pkg.repo.Package
7071
return;
7172
}
7273
final FileSystemStorage.FileSystemResolver resolver = (FileSystemStorage.FileSystemResolver) pkg.getResolver();
73-
final File packageDir = resolver.resolveResourceAsFile(".");
74+
final Path packageDir = resolver.resolveResourceAsFile(".");
7475
final Classpath cp = new Classpath();
7576
try {
7677
scanPackageDir(cp, packageDir);
@@ -92,7 +93,7 @@ private static void scanPackages(BrokerPool pool, Classpath classpath) {
9293
} else {
9394
try {
9495
final FileSystemStorage.FileSystemResolver resolver = (FileSystemStorage.FileSystemResolver) pkg.getResolver();
95-
final File packageDir = resolver.resolveResourceAsFile(".");
96+
final Path packageDir = resolver.resolveResourceAsFile(".");
9697
scanPackageDir(classpath, packageDir);
9798
} catch (final IOException e) {
9899
LOG.warn("An error occurred while updating classpath for package " + pkg.getName(), e);
@@ -125,8 +126,8 @@ private static boolean isCompatible(Package pkg) throws PackageException {
125126
return processorVersion.getDependencyVersion().isCompatible(procVersion);
126127
}
127128

128-
private static void scanPackageDir(Classpath classpath, File module) throws IOException {
129-
final Path dotExist = module.toPath().resolve(".exist");
129+
private static void scanPackageDir(Classpath classpath, Path module) throws IOException {
130+
final Path dotExist = module.resolve(".exist");
130131
if (Files.exists(dotExist)) {
131132
if (!Files.isDirectory(dotExist)) {
132133
throw new IOException("The .exist config dir is not a dir: " + dotExist);

src/org/exist/repo/Deployment.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ protected Optional<Path> getPackageDir(final String pkgName, final Optional<Exis
132132

133133
protected Path getPackageDir(final Package pkg) {
134134
final FileSystemStorage.FileSystemResolver resolver = (FileSystemStorage.FileSystemResolver) pkg.getResolver();
135-
return resolver.resolveResourceAsFile("").toPath();
135+
return resolver.resolveResourceAsFile("");
136136
}
137137

138138
protected Optional<org.expath.pkg.repo.Package> getPackage(final String pkgName, final Optional<ExistRepository> repo) throws PackageException {
@@ -267,7 +267,7 @@ public Optional<String> installAndDeploy(final Path xar, final PackageLoader loa
267267
// installing the xar into the expath repo
268268
LOG.info("Installing package " + xar.toAbsolutePath().toString());
269269
final UserInteractionStrategy interact = new BatchUserInteraction();
270-
final org.expath.pkg.repo.Package pkg = repo.get().getParentRepo().installPackage(xar, true, interact);
270+
final org.expath.pkg.repo.Package pkg = repo.get().getParentRepo().installPackage(new XarFileSource(xar), true, interact);
271271
final ExistPkgInfo info = (ExistPkgInfo) pkg.getInfo("exist");
272272
if (info != null && !info.getJars().isEmpty()) {
273273
ClasspathHelper.updateClasspath(broker.getBrokerPool(), pkg);

src/org/exist/repo/ExistPkgExtension.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ private void setupPackage(Package pkg, ExistPkgInfo info)
135135
// TODO: FIXME: Bad, BAD design! But will be resolved naturally by moving the
136136
// install code within the storage class (because we are writing on disk)...
137137
final FileSystemResolver res = (FileSystemResolver) pkg.getResolver();
138-
final Path classpath = res.resolveResourceAsFile(".exist/classpath.txt").toPath();
138+
final Path classpath = res.resolveResourceAsFile(".exist/classpath.txt");
139139

140140
// create [pkg_dir]/.exist/classpath.txt if not already
141141
final Path exist = classpath.getParent();

src/org/exist/repo/ExistRepository.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public void prepare(final BrokerPool brokerPool) throws BrokerPoolServiceExcepti
8585
LOG.info("Using directory " + expathDir.toAbsolutePath().toString() + " for expath package repository");
8686

8787
try {
88-
final FileSystemStorage storage = new FileSystemStorage(expathDir.toFile());
88+
final FileSystemStorage storage = new FileSystemStorage(expathDir);
8989
storage.setErrorIfNoContentDir(false);
9090
this.myParent = new Repository(storage);
9191
myParent.registerExtension(new ExistPkgExtension());
@@ -197,7 +197,7 @@ public Path resolveXQueryModule(final String namespace) throws XPathException {
197197
if (info != null) {
198198
final String f = info.getXQuery(uri);
199199
if (f != null) {
200-
return resolver.resolveComponentAsFile(f).toPath();
200+
return resolver.resolveComponentAsFile(f);
201201
}
202202
}
203203
String sysid = null; // declared here to be used in catch

src/org/exist/start/start.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ lib/core/log4j-core-%latest%.jar always
5252
lib/core/log4j-jul-%latest%.jar always
5353
lib/core/log4j-slf4j-impl-%latest%.jar always
5454
lib/core/slf4j-api-%latest%.jar always
55-
lib/core/pkg-java-fork.jar always
55+
lib/core/pkg-java-%latest%.jar always
5656
lib/core/quartz-%latest%.jar always
5757
lib/core/ws-commons-util-%latest%.jar always
5858
lib/core/xmldb-api-%latest%.jar always

0 commit comments

Comments
 (0)