Skip to content

Commit

Permalink
Merge pull request DSpace#10014 from tdonohue/oai_dep_cleanup
Browse files Browse the repository at this point in the history
Dependency cleanup for OAI-PMH and Log4j (removing log4j v1 bridge & settings which used it)
  • Loading branch information
tdonohue authored Nov 18, 2024
2 parents 398c61f + 76b54b3 commit 117859d
Show file tree
Hide file tree
Showing 28 changed files with 107 additions and 133 deletions.
1 change: 0 additions & 1 deletion dspace-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -703,7 +703,6 @@
<dependency>
<groupId>jakarta.inject</groupId>
<artifactId>jakarta.inject-api</artifactId>
<version>2.0.1</version>
</dependency>

<!-- JAXB API and implementation (no longer bundled as of Java 11) -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
import com.google.common.io.Files;
import com.opencsv.CSVReader;
import com.opencsv.exceptions.CsvException;
import org.apache.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.dspace.AbstractIntegrationTestWithDatabase;
import org.dspace.app.launcher.ScriptLauncher;
import org.dspace.app.scripts.handler.impl.TestDSpaceRunnableHandler;
Expand Down Expand Up @@ -51,7 +52,7 @@ public class MetadataExportSearchIT extends AbstractIntegrationTestWithDatabase
private Item[] itemsSubject2 = new Item[numberItemsSubject2];
private String filename;
private Collection collection;
private Logger logger = Logger.getLogger(MetadataExportSearchIT.class);
private Logger logger = LogManager.getLogger(MetadataExportSearchIT.class);
private ConfigurationService configurationService = DSpaceServicesFactory.getInstance().getConfigurationService();
private SearchService searchService;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
import java.sql.SQLException;
import java.util.Date;

import org.apache.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.dspace.content.Item;
import org.dspace.core.Context;
import org.dspace.orcid.OrcidHistory;
Expand All @@ -24,7 +25,7 @@
*/
public class OrcidHistoryBuilder extends AbstractBuilder<OrcidHistory, OrcidHistoryService> {

private static final Logger log = Logger.getLogger(OrcidHistoryBuilder.class);
private static final Logger log = LogManager.getLogger(OrcidHistoryBuilder.class);

private OrcidHistory orcidHistory;

Expand Down
31 changes: 2 additions & 29 deletions dspace-oai/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,8 @@

<!-- Java Injection -->
<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
<version>1</version>
<groupId>jakarta.inject</groupId>
<artifactId>jakarta.inject-api</artifactId>
</dependency>

<!-- Needed to support Spring @Configuration classes (to register servlets/beans with Spring Boot webapp) -->
Expand Down Expand Up @@ -99,22 +98,9 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</exclusion>
<!-- More recent version is pulled in via below dependencies -->
<exclusion>
<groupId>org.parboiled</groupId>
<artifactId>parboiled-java</artifactId>
</exclusion>
</exclusions>
</dependency>

<!-- Newer version, necessary to align with newer version of ASM in parent POM
This is needed by both jtwig-spring-boot-starter and our tests. -->
<dependency>
<groupId>org.parboiled</groupId>
<artifactId>parboiled-java</artifactId>
<version>1.3.1</version>
</dependency>

<!-- Internal -->
<dependency>
<groupId>org.dspace</groupId>
Expand All @@ -137,19 +123,6 @@
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-web</artifactId>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-1.2-api</artifactId>
</dependency>

<!-- Testing -->
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

import com.lyncode.xoai.dataprovider.xml.xoai.Element;
import com.lyncode.xoai.dataprovider.xml.xoai.Metadata;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.dspace.content.Item;
import org.dspace.core.Context;
import org.dspace.license.factory.LicenseServiceFactory;
Expand Down
2 changes: 1 addition & 1 deletion dspace-oai/src/main/java/org/dspace/xoai/app/XOAI.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

import static com.lyncode.xoai.dataprovider.core.Granularity.Second;
import static java.util.Objects.nonNull;
import static org.apache.commons.lang.StringUtils.EMPTY;
import static org.apache.commons.lang3.StringUtils.EMPTY;
import static org.apache.solr.common.params.CursorMarkParams.CURSOR_MARK_PARAM;
import static org.apache.solr.common.params.CursorMarkParams.CURSOR_MARK_START;
import static org.dspace.xoai.util.ItemUtils.retrieveMetadata;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

import java.sql.SQLException;

import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.dspace.content.Bundle;
import org.dspace.content.Item;
import org.dspace.handle.factory.HandleServiceFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,14 @@
import static org.hamcrest.MatcherAssert.assertThat;

import java.io.InputStream;
import java.nio.charset.Charset;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.stream.StreamSource;

import com.lyncode.xoai.util.XSLPipeline;
import org.apache.commons.io.IOUtils;
import org.dspace.xoai.tests.support.XmlMatcherBuilder;
import org.junit.Test;
import org.parboiled.common.FileUtils;

public class PipelineTest {
private static TransformerFactory factory = TransformerFactory.newInstance();
Expand All @@ -28,9 +29,9 @@ public class PipelineTest {
public void pipelineTest() throws Exception {
InputStream input = PipelineTest.class.getClassLoader().getResourceAsStream("item.xml");
InputStream xslt = PipelineTest.class.getClassLoader().getResourceAsStream("oai_dc.xsl");
String output = FileUtils.readAllText(new XSLPipeline(input, true)
.apply(factory.newTemplates(new StreamSource(xslt)))
.getTransformed());
String output = IOUtils.toString(new XSLPipeline(input, true)
.apply(factory.newTemplates(new StreamSource(xslt)))
.getTransformed(), Charset.defaultCharset());

assertThat(output, oai_dc().withXPath("/oai_dc:dc/dc:title", equalTo("Teste")));

Expand Down
4 changes: 0 additions & 4 deletions dspace-rdf/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,6 @@
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-web</artifactId>
</dependency>

<dependency>
<groupId>org.apache.commons</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
import java.util.List;

import jakarta.servlet.http.HttpServletRequest;
import org.apache.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.dspace.app.rest.model.PageRest;
import org.dspace.app.rest.model.SearchEventRest;
import org.dspace.app.rest.model.SearchResultsRest;
Expand All @@ -31,7 +32,7 @@
@Component
public class SearchEventConverter {
/* Log4j logger */
private static final Logger log = Logger.getLogger(SearchEventConverter.class);
private static final Logger log = LogManager.getLogger(SearchEventConverter.class);

@Autowired
private ScopeResolver scopeResolver;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
import java.util.List;

import jakarta.servlet.http.HttpServletRequest;
import org.apache.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.dspace.app.rest.signposting.model.LinksetNode;
import org.dspace.app.rest.signposting.model.LinksetRelationType;
import org.dspace.content.Bitstream;
Expand All @@ -25,7 +26,7 @@
*/
public class BitstreamLinksetProcessor extends BitstreamSignpostingProcessor {

private static final Logger log = Logger.getLogger(BitstreamLinksetProcessor.class);
private static final Logger log = LogManager.getLogger(BitstreamLinksetProcessor.class);

private final BitstreamService bitstreamService;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
import java.util.List;

import jakarta.servlet.http.HttpServletRequest;
import org.apache.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.dspace.app.rest.signposting.model.LinksetNode;
import org.dspace.app.rest.signposting.model.LinksetRelationType;
import org.dspace.content.Bitstream;
Expand All @@ -28,7 +29,7 @@
*/
public class BitstreamParentItemProcessor extends BitstreamSignpostingProcessor {

private static final Logger log = Logger.getLogger(BitstreamParentItemProcessor.class);
private static final Logger log = LogManager.getLogger(BitstreamParentItemProcessor.class);

private final BitstreamService bitstreamService;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@

import jakarta.servlet.http.HttpServletRequest;
import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.dspace.app.rest.signposting.model.LinksetNode;
import org.dspace.app.rest.signposting.model.LinksetRelationType;
import org.dspace.content.Bitstream;
Expand All @@ -28,7 +29,7 @@
*/
public class BitstreamTypeProcessor extends BitstreamSignpostingProcessor {

private static final Logger log = Logger.getLogger(BitstreamTypeProcessor.class);
private static final Logger log = LogManager.getLogger(BitstreamTypeProcessor.class);

@Autowired
private SimpleMapConverter mapConverterDSpaceToSchemaOrgUri;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
import java.util.List;

import jakarta.servlet.http.HttpServletRequest;
import org.apache.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.dspace.app.rest.signposting.model.LinksetNode;
import org.dspace.app.rest.signposting.model.LinksetRelationType;
import org.dspace.content.Item;
Expand All @@ -37,7 +38,7 @@ public class ItemAuthorProcessor extends ItemSignpostingProcessor {
/**
* log4j category
*/
private static final Logger log = Logger.getLogger(ItemAuthorProcessor.class);
private static final Logger log = LogManager.getLogger(ItemAuthorProcessor.class);

private final ItemService itemService;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
import java.util.List;

import jakarta.servlet.http.HttpServletRequest;
import org.apache.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.dspace.app.rest.signposting.model.LinksetNode;
import org.dspace.app.rest.signposting.model.LinksetRelationType;
import org.dspace.content.Bitstream;
Expand All @@ -33,7 +34,7 @@ public class ItemContentBitstreamsProcessor extends ItemSignpostingProcessor {
/**
* log4j category
*/
private static final Logger log = Logger.getLogger(ItemContentBitstreamsProcessor.class);
private static final Logger log = LogManager.getLogger(ItemContentBitstreamsProcessor.class);

public ItemContentBitstreamsProcessor(FrontendUrlService frontendUrlService) {
super(frontendUrlService);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
import java.util.List;

import jakarta.servlet.http.HttpServletRequest;
import org.apache.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.dspace.app.rest.signposting.model.LinksetNode;
import org.dspace.app.rest.signposting.model.LinksetRelationType;
import org.dspace.content.Item;
Expand All @@ -23,7 +24,7 @@
*/
public class ItemDescribedbyProcessor extends ItemSignpostingProcessor {

private static final Logger log = Logger.getLogger(ItemDescribedbyProcessor.class);
private static final Logger log = LogManager.getLogger(ItemDescribedbyProcessor.class);

private final ConfigurationService configurationService;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@

import jakarta.servlet.http.HttpServletRequest;
import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.dspace.app.rest.signposting.model.LinksetNode;
import org.dspace.app.rest.signposting.model.LinksetRelationType;
import org.dspace.content.Item;
Expand All @@ -25,7 +26,7 @@
*/
public class ItemLicenseProcessor extends ItemSignpostingProcessor {

private static final Logger log = Logger.getLogger(ItemLicenseProcessor.class);
private static final Logger log = LogManager.getLogger(ItemLicenseProcessor.class);

private final CreativeCommonsService creativeCommonsService =
LicenseServiceFactory.getInstance().getCreativeCommonsService();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
import java.util.List;

import jakarta.servlet.http.HttpServletRequest;
import org.apache.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.dspace.app.rest.signposting.model.LinksetNode;
import org.dspace.app.rest.signposting.model.LinksetRelationType;
import org.dspace.content.Item;
Expand All @@ -23,7 +24,7 @@
*/
public class ItemLinksetProcessor extends ItemSignpostingProcessor {

private static final Logger log = Logger.getLogger(ItemLinksetProcessor.class);
private static final Logger log = LogManager.getLogger(ItemLinksetProcessor.class);

private final ConfigurationService configurationService;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@

import jakarta.servlet.http.HttpServletRequest;
import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.dspace.app.rest.signposting.model.LinksetNode;
import org.dspace.app.rest.signposting.model.LinksetRelationType;
import org.dspace.content.Item;
Expand All @@ -27,7 +28,7 @@
*/
public class ItemTypeProcessor extends ItemSignpostingProcessor {

private static final Logger log = Logger.getLogger(ItemTypeProcessor.class);
private static final Logger log = LogManager.getLogger(ItemTypeProcessor.class);
private static final String ABOUT_PAGE_URI = "https://schema.org/AboutPage";

@Autowired
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
import java.util.List;

import jakarta.servlet.http.HttpServletRequest;
import org.apache.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.dspace.app.rest.security.BitstreamMetadataReadPermissionEvaluatorPlugin;
import org.dspace.app.rest.signposting.model.LinksetNode;
import org.dspace.app.rest.signposting.processor.bitstream.BitstreamSignpostingProcessor;
Expand All @@ -37,7 +38,7 @@
@Service
public class LinksetServiceImpl implements LinksetService {

private static final Logger log = Logger.getLogger(LinksetServiceImpl.class);
private static final Logger log = LogManager.getLogger(LinksetServiceImpl.class);

@Autowired
protected ItemService itemService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import javax.inject.Inject;

import jakarta.inject.Inject;
import org.dspace.app.rest.model.ErrorRest;
import org.dspace.app.rest.submit.SubmissionService;
import org.dspace.app.util.DCInputsReaderException;
Expand Down
4 changes: 0 additions & 4 deletions dspace-sword/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,6 @@
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-web</artifactId>
</dependency>

<dependency>
<groupId>xom</groupId>
Expand Down
Loading

0 comments on commit 117859d

Please sign in to comment.