Skip to content

Commit

Permalink
DBT-376 Migrate to MIR 2023.06.x (#273)
Browse files Browse the repository at this point in the history
* Apply changes in xsl and properties
* Fix mail queue access
* Update mycore-parent
* Build with Java 21
* Change URL to URI

---------

Co-authored-by: Thomas Scheffler <[email protected]>
  • Loading branch information
Antoniafriedrich and yagee-de authored Dec 10, 2024
1 parent d8c500a commit 33866f5
Show file tree
Hide file tree
Showing 23 changed files with 236 additions and 153 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
uses: apache/maven-gh-actions-shared/.github/workflows/maven-verify.yml@v3
with:
ff-site-goal: ''
ff-os: 'ubuntu-22.04'
ff-os: 'ubuntu-24.04'
ff-jdk: '17'
ff-goal: '-P run-its verify'
ff-site-run: false
Expand All @@ -26,5 +26,5 @@ jobs:
{"os": "windows-latest"},
{"jdk": "8"},
{"jdk": "11"},
{"os": "ubuntu-latest", "jdk": "17"}
{"os": "ubuntu-latest", "jdk": "21"}
]
8 changes: 4 additions & 4 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007

Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.

Expand Down Expand Up @@ -645,7 +645,7 @@ the "copyright" line and a pointer to where the full notice is found.
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
along with this program. If not, see <https://www.gnu.org/licenses/>.

Also add information on how to contact you by electronic and paper mail.

Expand All @@ -664,11 +664,11 @@ might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
<https://www.gnu.org/licenses/>.

The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
<https://www.gnu.org/licenses/why-not-lgpl.html>.
35 changes: 32 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,36 @@ DBT (acronym for Digitale Bibliothek Thüringen) is an open source repository so

## Git-Style-Guide
For the moment see [agis-:Git-Style-Guide](https://github.com/agis-/git-style-guide) and use it with the following exceptions:
- Subject to commits is in form: `{JIRA-Ticket} {Ticket summary} {Commit summary}`, like `DBT-104 GIT-Migration add .travis.yml`
- Branch name to work on a ticket is in form: `issues/{JIRA-Ticket}-{Ticket Summary}`, like `issues/DBT-104-GIT-Migration`
- Subject to commits is in form: `{JIRA-Ticket} {Ticket summary} {Commit summary}`, like `DBT-104 GIT-Migration add .travis.yml`
- Branch name to work on a ticket is in form: `issues/{JIRA-Ticket}-{Ticket Summary}`, like `issues/DBT-104-GIT-Migration`

Stay tuned for more information. :bow:
---

## Installation instructions for developers

1. **Build JAR**:
- Run:
`mvn clean install`


2. **Deploy the JAR File**:
- Move the generated JAR file (located in `dbt/target`) to the `lib` folder in your home directory.
For example: `~/.mycore/dev-mir/lib`


3. **Update Solr Core Names**:
- Change the Solr core names from `mir` and `mir-classifications` to `dbt` and `dbt-classifications` using your Solr Admin UI.
- Restart your Solr server.


4. **Launch and Setup DBT**:
- After starting your MIR, the DBT interface will launch.
- Log in as the administrator (Superuser) and navigate in the User menu to "Edit Classifications".
- Import all files from `src/main/resources/setup/classifications` for DBT to function correctly.
- Reload main and classifications in the WebCLI if needed.

`reload solr configuration main in core main`

`reload solr configuration classification in core classification`
---
Stay tuned for more information. :bow:
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.mycore</groupId>
<artifactId>mycore-parent</artifactId>
<version>52-SNAPSHOT</version>
<version>53</version>
</parent>
<artifactId>dbt-module</artifactId>
<version>2023.06-SNAPSHOT</version>
Expand Down
20 changes: 13 additions & 7 deletions src/main/java/de/urmel_dl/dbt/common/DBTVersion.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.UncheckedIOException;
import java.net.URL;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.Locale;
import java.util.Map;
import java.util.Properties;
Expand Down Expand Up @@ -55,25 +56,30 @@ public static String getVersion() {

private static Properties loadVersionProperties() {
Properties props = new Properties();
URL gitPropURL = MIRCoreVersion.class.getResource("/de/urmel_dl/dbt/git.properties");
try (InputStream gitPropStream = getInputStream(gitPropURL);) {
URI gitPropURI;
try {
gitPropURI = MIRCoreVersion.class.getResource("/de/urmel_dl/dbt/git.properties").toURI();
} catch (URISyntaxException e) {
throw new RuntimeException(e);
}
try (InputStream gitPropStream = getInputStream(gitPropURI);) {
props.load(gitPropStream);
} catch (IOException e) {
throw new UncheckedIOException("Error while initializing DBTVersion.", e);
}
return props;
}

private static InputStream getInputStream(URL gitPropURL) throws IOException {
if (gitPropURL == null) {
private static InputStream getInputStream(URI gitPropURI) throws IOException {
if (gitPropURI == null) {
return new InputStream() {
@Override
public int read() throws IOException {
public int read() {
return -1;
}
};
}
return gitPropURL.openStream();
return gitPropURI.toURL().openStream();
}

public static String getBranch() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,8 @@

import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.net.URLDecoder;
import java.nio.file.Files;
import java.util.Arrays;
Expand Down Expand Up @@ -109,7 +107,7 @@ private boolean validateReferrer(final HttpServletRequest httpServletRequest) {
return false;
}
try {
final String pathInfo = new URL(referrer).getPath();
final String pathInfo = URI.create(referrer).getPath();
if (PATTERN_ALLOWED_REFERRER.matcher(pathInfo).matches()) {
Optional<String> optDerId = Arrays.stream(pathInfo.split("/"))
.filter(f -> PATTERN_DERIVATE_ID.matcher(f).matches())
Expand All @@ -122,7 +120,7 @@ private boolean validateReferrer(final HttpServletRequest httpServletRequest) {
return Files.exists(MCRPath.getPath(derivateId, fileName));
}
}
} catch (MalformedURLException | UnsupportedEncodingException e) {
} catch (UnsupportedEncodingException e) {
LOGGER.error("Couldn't parse referrer " + referrer + ".", e);
}
return false;
Expand Down
6 changes: 2 additions & 4 deletions src/main/java/de/urmel_dl/dbt/media/MediaService.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import java.io.UncheckedIOException;
import java.math.BigInteger;
import java.net.URI;
import java.net.URL;
import java.nio.channels.Channels;
import java.nio.channels.ReadableByteChannel;
import java.nio.charset.StandardCharsets;
Expand Down Expand Up @@ -506,10 +505,9 @@ public void run() {

Path tmpFile = Files.createTempDirectory("media").resolve(job.getId() + ".zip");
try {
URL website = new URL(SERVER_ADDRESS + new MessageFormat(CONVERTER_DOWNLOAD_PATH, Locale.ROOT)
URI website = URI.create(SERVER_ADDRESS + new MessageFormat(CONVERTER_DOWNLOAD_PATH, Locale.ROOT)
.format(new Object[] { job.getId().replaceAll(" ", "%20") }));
ReadableByteChannel rbc = Channels.newChannel(website.openStream());

ReadableByteChannel rbc = Channels.newChannel(website.toURL().openStream());
try (FileOutputStream fos = new FileOutputStream(tmpFile.toFile())) {
fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import java.io.File;
import java.io.IOException;
import java.net.URL;
import java.net.URI;
import java.nio.file.Files;
import java.nio.file.NoSuchFileException;
import java.nio.file.Path;
Expand Down Expand Up @@ -63,7 +63,8 @@ public class MigrationCommands extends MCRAbstractCommands {
@MCRCommand(syntax = "fix objects for base {0} with file {1}",
help = "transforms all mycore objects for base {0} with the given file or URL {1}")
public static List<String> xsltObjects(final String base, final String xslFile) throws Exception {
URL styleFile = MigrationCommands.class.getResource("/xsl/" + xslFile);
URI styleFile = MigrationCommands.class.getResource("/xsl/" + xslFile).toURI();

if (styleFile == null) {
final File file = new File(xslFile);

Expand All @@ -72,7 +73,7 @@ public static List<String> xsltObjects(final String base, final String xslFile)
return null;
}

styleFile = file.toURI().toURL();
styleFile = file.toURI();
}

List<String> cmds = new ArrayList<String>();
Expand Down
Loading

0 comments on commit 33866f5

Please sign in to comment.