Skip to content

Commit

Permalink
Updated pidservices2 dependency to be jakarta EE compatible
Browse files Browse the repository at this point in the history
  • Loading branch information
Willem Elbers committed Oct 31, 2024
1 parent 41ac766 commit 610d618
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@
<dependency>
<groupId>de.uni_leipzig.asv</groupId>
<artifactId>clarin.webservices.pidservices2</artifactId>
<version>4.1</version>
<version>5.0</version>
<exclusions>
<exclusion>
<!-- replaced with jcl-over-slf4j -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
*/
package eu.clarin.cmdi.virtualcollectionregistry;

import de.uni_leipzig.asv.clarin.webservices.pidservices2.PidApiException;
import eu.clarin.cmdi.virtualcollectionregistry.model.VirtualCollection;
import eu.clarin.cmdi.virtualcollectionregistry.pid.PersistentIdentifier;

Expand All @@ -25,7 +26,6 @@
import javax.persistence.EntityManager;
import javax.persistence.LockModeType;
import javax.persistence.TypedQuery;
import org.apache.commons.httpclient.HttpException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
Expand Down Expand Up @@ -141,7 +141,7 @@ protected void allocatePersistentIdentifier(EntityManager em, VirtualCollection
logger.error("Failed to mint PID, setting vc to error state", ex);
vc.setState(VirtualCollection.State.ERROR);
vc.setProblemDetails(ex.getMessage());
if(ex.getCause() instanceof HttpException) {
if(ex.getCause() instanceof PidApiException) {
vc.setProblem(VirtualCollection.Problem.PID_MINTING_HTTP_ERROR);
} else {
vc.setProblem(VirtualCollection.Problem.PID_MINTING_UNKOWN);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,17 @@

import de.uni_leipzig.asv.clarin.webservices.pidservices2.Configuration;
import de.uni_leipzig.asv.clarin.webservices.pidservices2.HandleField;
import de.uni_leipzig.asv.clarin.webservices.pidservices2.PidApiException;
import de.uni_leipzig.asv.clarin.webservices.pidservices2.interfaces.PidWriter;
import eu.clarin.cmdi.virtualcollectionregistry.PermaLinkService;
import eu.clarin.cmdi.virtualcollectionregistry.PidProviderServiceImpl;
import eu.clarin.cmdi.virtualcollectionregistry.VirtualCollectionRegistryException;
import eu.clarin.cmdi.virtualcollectionregistry.gui.Application;
import eu.clarin.cmdi.virtualcollectionregistry.model.VirtualCollection;

import java.io.Serializable;
import java.net.URI;
import java.util.EnumMap;
import java.util.Map;
import org.apache.commons.httpclient.HttpException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
Expand Down Expand Up @@ -68,9 +67,11 @@ public PersistentIdentifier createIdentifier(VirtualCollection vc, PermaLinkServ
final String requestedPid = String.format("%s%d", getInfix(), vc.getId());
final String pid = pidWriter.registerNewPID(configuration, fieldMap, requestedPid);
return new PersistentIdentifier(vc, PersistentIdentifier.Type.HANDLE, primary, pid);
} catch (HttpException ex) {
} catch (PidApiException ex) {
throw new VirtualCollectionRegistryException("Could not create EPIC identifier", ex);
}
} catch(Throwable ex) {
throw new VirtualCollectionRegistryException("Could not create EPIC identifier", ex);
}
}

private Map<HandleField, String> createPIDFieldMap(VirtualCollection vc, PermaLinkService permaLinkService) {
Expand Down

0 comments on commit 610d618

Please sign in to comment.