From e0d5e1455e6c5a7a4c3ae0e62643ac9ea6447549 Mon Sep 17 00:00:00 2001 From: Giambattista Bloisi Date: Mon, 21 Oct 2024 09:03:20 +0200 Subject: [PATCH] Import cnr-rmi-api project, rename it dnet-rmi-api and use jakarta and metro in place of javax for portability to java 17 --- dhp-rmi-api/pom.xml | 34 +++++ .../common/rmi/APIDeprecatedException.java | 11 ++ .../eu/dnetlib/common/rmi/BaseService.java | 35 +++++ .../common/rmi/DNetRestDocumentation.java | 19 +++ .../eu/dnetlib/common/rmi/RMIException.java | 27 ++++ .../common/rmi/UnimplementedException.java | 11 ++ .../rmi/CollectionService.java | 31 ++++ .../rmi/CollectionServiceException.java | 27 ++++ .../publisher/rmi/PublisherService.java | 57 ++++++++ .../mdstore/DocumentNotFoundException.java | 30 ++++ .../dnetlib/data/mdstore/MDStoreService.java | 118 +++++++++++++++ .../data/mdstore/MDStoreServiceException.java | 33 +++++ .../rmi/ObjectPackagingException.java | 28 ++++ .../rmi/ObjectPackagingService.java | 37 +++++ .../dnetlib/enabling/dlm/rmi/DlmService.java | 17 +++ .../hcm/rmi/HostingContextManagerService.java | 19 +++ .../hnm/rmi/HostingNodeManagerService.java | 15 ++ .../ISLookUpDocumentNotFoundException.java | 47 ++++++ .../is/lookup/rmi/ISLookUpException.java | 27 ++++ .../is/lookup/rmi/ISLookUpService.java | 57 ++++++++ .../ISRegistryDocumentNotFoundException.java | 28 ++++ .../is/registry/rmi/ISRegistryException.java | 25 ++++ .../is/registry/rmi/ISRegistryService.java | 72 ++++++++++ .../enabling/is/sn/rmi/ISSNException.java | 25 ++++ .../enabling/is/sn/rmi/ISSNService.java | 121 ++++++++++++++++ .../SubscriptionRequestRejectedException.java | 21 +++ .../is/store/rmi/ISStoreException.java | 25 ++++ .../enabling/is/store/rmi/ISStoreService.java | 47 ++++++ .../resultset/rmi/ResultSetException.java | 22 +++ .../resultset/rmi/ResultSetService.java | 135 ++++++++++++++++++ 30 files changed, 1201 insertions(+) create mode 100644 dhp-rmi-api/pom.xml create mode 100644 dhp-rmi-api/src/main/java/eu/dnetlib/common/rmi/APIDeprecatedException.java create mode 100644 dhp-rmi-api/src/main/java/eu/dnetlib/common/rmi/BaseService.java create mode 100644 dhp-rmi-api/src/main/java/eu/dnetlib/common/rmi/DNetRestDocumentation.java create mode 100644 dhp-rmi-api/src/main/java/eu/dnetlib/common/rmi/RMIException.java create mode 100644 dhp-rmi-api/src/main/java/eu/dnetlib/common/rmi/UnimplementedException.java create mode 100644 dhp-rmi-api/src/main/java/eu/dnetlib/data/information/collectionservice/rmi/CollectionService.java create mode 100644 dhp-rmi-api/src/main/java/eu/dnetlib/data/information/collectionservice/rmi/CollectionServiceException.java create mode 100644 dhp-rmi-api/src/main/java/eu/dnetlib/data/information/publisher/rmi/PublisherService.java create mode 100644 dhp-rmi-api/src/main/java/eu/dnetlib/data/mdstore/DocumentNotFoundException.java create mode 100644 dhp-rmi-api/src/main/java/eu/dnetlib/data/mdstore/MDStoreService.java create mode 100644 dhp-rmi-api/src/main/java/eu/dnetlib/data/mdstore/MDStoreServiceException.java create mode 100644 dhp-rmi-api/src/main/java/eu/dnetlib/data/utility/objectpackaging/rmi/ObjectPackagingException.java create mode 100644 dhp-rmi-api/src/main/java/eu/dnetlib/data/utility/objectpackaging/rmi/ObjectPackagingService.java create mode 100644 dhp-rmi-api/src/main/java/eu/dnetlib/enabling/dlm/rmi/DlmService.java create mode 100644 dhp-rmi-api/src/main/java/eu/dnetlib/enabling/hcm/rmi/HostingContextManagerService.java create mode 100644 dhp-rmi-api/src/main/java/eu/dnetlib/enabling/hnm/rmi/HostingNodeManagerService.java create mode 100644 dhp-rmi-api/src/main/java/eu/dnetlib/enabling/is/lookup/rmi/ISLookUpDocumentNotFoundException.java create mode 100644 dhp-rmi-api/src/main/java/eu/dnetlib/enabling/is/lookup/rmi/ISLookUpException.java create mode 100644 dhp-rmi-api/src/main/java/eu/dnetlib/enabling/is/lookup/rmi/ISLookUpService.java create mode 100644 dhp-rmi-api/src/main/java/eu/dnetlib/enabling/is/registry/ISRegistryDocumentNotFoundException.java create mode 100644 dhp-rmi-api/src/main/java/eu/dnetlib/enabling/is/registry/rmi/ISRegistryException.java create mode 100644 dhp-rmi-api/src/main/java/eu/dnetlib/enabling/is/registry/rmi/ISRegistryService.java create mode 100644 dhp-rmi-api/src/main/java/eu/dnetlib/enabling/is/sn/rmi/ISSNException.java create mode 100644 dhp-rmi-api/src/main/java/eu/dnetlib/enabling/is/sn/rmi/ISSNService.java create mode 100644 dhp-rmi-api/src/main/java/eu/dnetlib/enabling/is/sn/rmi/SubscriptionRequestRejectedException.java create mode 100644 dhp-rmi-api/src/main/java/eu/dnetlib/enabling/is/store/rmi/ISStoreException.java create mode 100644 dhp-rmi-api/src/main/java/eu/dnetlib/enabling/is/store/rmi/ISStoreService.java create mode 100644 dhp-rmi-api/src/main/java/eu/dnetlib/enabling/resultset/rmi/ResultSetException.java create mode 100644 dhp-rmi-api/src/main/java/eu/dnetlib/enabling/resultset/rmi/ResultSetService.java diff --git a/dhp-rmi-api/pom.xml b/dhp-rmi-api/pom.xml new file mode 100644 index 000000000..2073bd8ba --- /dev/null +++ b/dhp-rmi-api/pom.xml @@ -0,0 +1,34 @@ + + + + eu.dnetlib.dhp + dhp + 1.2.5-SNAPSHOT + ../pom.xml + + 4.0.0 + eu.dnetlib + dhp-rmi-api + jar + 1.2.5-SNAPSHOT + + + org.apache.cxf + cxf-core + ${cxf.version} + + + + org.apache.cxf + cxf-rt-frontend-jaxws + ${cxf.version} + + + + org.glassfish.metro + webservices-rt + ${metro.version} + + + diff --git a/dhp-rmi-api/src/main/java/eu/dnetlib/common/rmi/APIDeprecatedException.java b/dhp-rmi-api/src/main/java/eu/dnetlib/common/rmi/APIDeprecatedException.java new file mode 100644 index 000000000..409bf71c5 --- /dev/null +++ b/dhp-rmi-api/src/main/java/eu/dnetlib/common/rmi/APIDeprecatedException.java @@ -0,0 +1,11 @@ + +package eu.dnetlib.common.rmi; + +public class APIDeprecatedException extends RuntimeException { + + /** + * + */ + private static final long serialVersionUID = -5606373588445519515L; + +} diff --git a/dhp-rmi-api/src/main/java/eu/dnetlib/common/rmi/BaseService.java b/dhp-rmi-api/src/main/java/eu/dnetlib/common/rmi/BaseService.java new file mode 100644 index 000000000..0d521796f --- /dev/null +++ b/dhp-rmi-api/src/main/java/eu/dnetlib/common/rmi/BaseService.java @@ -0,0 +1,35 @@ + +package eu.dnetlib.common.rmi; + +import jakarta.jws.WebMethod; +import jakarta.jws.WebParam; +import jakarta.jws.WebService; + +@WebService(targetNamespace = "http://services.dnetlib.eu/") +public interface BaseService { + + /** + * All DRIVER services must implement method notify() in order to communicate with the IS_SN + * + * @param subsrciptionId + * @param topic + * @param isId + * @param message + */ + @WebMethod(operationName = "notify") + void notify(@WebParam(name = "subscrId") String subscriptionId, + @WebParam(name = "topic") String topic, + @WebParam(name = "is_id") String isId, + @WebParam(name = "message") String message); + + /** + * Identifies the service's version. Version syntax: ${NAME}-${MAJOR}.${MINOR}.${MICRO}[-${LABEL}] + * + * @return the service's version + */ + @WebMethod(operationName = "identify") + String identify(); + + void start(); + +} diff --git a/dhp-rmi-api/src/main/java/eu/dnetlib/common/rmi/DNetRestDocumentation.java b/dhp-rmi-api/src/main/java/eu/dnetlib/common/rmi/DNetRestDocumentation.java new file mode 100644 index 000000000..4b9bd6b4f --- /dev/null +++ b/dhp-rmi-api/src/main/java/eu/dnetlib/common/rmi/DNetRestDocumentation.java @@ -0,0 +1,19 @@ + +package eu.dnetlib.common.rmi; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * Created by claudio on 30/11/2016. + * to be used in REST controllers, and autodiscovered to build and publish their documentation + */ +@Target({ + ElementType.TYPE +}) +@Retention(RetentionPolicy.RUNTIME) +public @interface DNetRestDocumentation { + +} diff --git a/dhp-rmi-api/src/main/java/eu/dnetlib/common/rmi/RMIException.java b/dhp-rmi-api/src/main/java/eu/dnetlib/common/rmi/RMIException.java new file mode 100644 index 000000000..bf62b7da3 --- /dev/null +++ b/dhp-rmi-api/src/main/java/eu/dnetlib/common/rmi/RMIException.java @@ -0,0 +1,27 @@ + +package eu.dnetlib.common.rmi; + +/** + * All RMI exception thrown from the service remote method invocation interfaces inherit this class + * + * @author marko + */ +abstract public class RMIException extends Exception { // NOPMD + + /** + * + */ + private static final long serialVersionUID = 428841258652765265L; + + public RMIException(final Throwable exception) { + super(exception); + } + + public RMIException(final String string) { + super(string); + } + + public RMIException(final String string, final Throwable exception) { + super(string, exception); + } +} diff --git a/dhp-rmi-api/src/main/java/eu/dnetlib/common/rmi/UnimplementedException.java b/dhp-rmi-api/src/main/java/eu/dnetlib/common/rmi/UnimplementedException.java new file mode 100644 index 000000000..d3b6611df --- /dev/null +++ b/dhp-rmi-api/src/main/java/eu/dnetlib/common/rmi/UnimplementedException.java @@ -0,0 +1,11 @@ + +package eu.dnetlib.common.rmi; + +public class UnimplementedException extends RuntimeException { + + /** + * + */ + private static final long serialVersionUID = 6040968020696349497L; + +} diff --git a/dhp-rmi-api/src/main/java/eu/dnetlib/data/information/collectionservice/rmi/CollectionService.java b/dhp-rmi-api/src/main/java/eu/dnetlib/data/information/collectionservice/rmi/CollectionService.java new file mode 100644 index 000000000..6827dcfbe --- /dev/null +++ b/dhp-rmi-api/src/main/java/eu/dnetlib/data/information/collectionservice/rmi/CollectionService.java @@ -0,0 +1,31 @@ + +package eu.dnetlib.data.information.collectionservice.rmi; + +import java.util.List; + +import eu.dnetlib.common.rmi.BaseService; +import jakarta.jws.WebParam; +import jakarta.jws.WebService; + +/** + * The Collection Service is used to ... + */ + +@WebService(targetNamespace = "http://services.dnetlib.eu/") +public interface CollectionService extends BaseService { + + String getCollection(@WebParam(name = "collId") + final String collId) throws CollectionServiceException; + + List getCollections(@WebParam(name = "collIds") + final List collIds) throws CollectionServiceException; + + void updateCollection(@WebParam(name = "coll") + final String coll) throws CollectionServiceException; + + void deleteCollection(@WebParam(name = "collId") + final String collId) throws CollectionServiceException; + + String createCollection(@WebParam(name = "coll") + final String coll) throws CollectionServiceException; +} diff --git a/dhp-rmi-api/src/main/java/eu/dnetlib/data/information/collectionservice/rmi/CollectionServiceException.java b/dhp-rmi-api/src/main/java/eu/dnetlib/data/information/collectionservice/rmi/CollectionServiceException.java new file mode 100644 index 000000000..1d0fd0bd1 --- /dev/null +++ b/dhp-rmi-api/src/main/java/eu/dnetlib/data/information/collectionservice/rmi/CollectionServiceException.java @@ -0,0 +1,27 @@ + +package eu.dnetlib.data.information.collectionservice.rmi; + +import eu.dnetlib.common.rmi.RMIException; +import jakarta.xml.ws.WebFault; + +@WebFault +public class CollectionServiceException extends RMIException { + + /** + * + */ + private static final long serialVersionUID = 8094008463553904905L; + + public CollectionServiceException(Throwable e) { + super(e); + } + + public CollectionServiceException(String message, Throwable e) { + super(message, e); + } + + public CollectionServiceException(String message) { + super(message); + } + +} diff --git a/dhp-rmi-api/src/main/java/eu/dnetlib/data/information/publisher/rmi/PublisherService.java b/dhp-rmi-api/src/main/java/eu/dnetlib/data/information/publisher/rmi/PublisherService.java new file mode 100644 index 000000000..f9865c7bc --- /dev/null +++ b/dhp-rmi-api/src/main/java/eu/dnetlib/data/information/publisher/rmi/PublisherService.java @@ -0,0 +1,57 @@ + +package eu.dnetlib.data.information.publisher.rmi; + +import java.util.List; + +import eu.dnetlib.common.rmi.BaseService; +import jakarta.jws.WebMethod; +import jakarta.jws.WebParam; +import jakarta.jws.WebService; +import jakarta.xml.ws.wsaddressing.W3CEndpointReference; + +/** + * Publisher service. Provides access to metadata records and objects. + * + * @author marko + */ +@WebService(targetNamespace = "http://services.dnetlib.eu/") +public interface PublisherService extends BaseService { + + /** + * Get a (metadata) resource by ID. + * + * @param id + * @param format + * @param layout + * @param interpretation + * @return + */ + @WebMethod + String getResourceById(@WebParam(name = "id") + final String id, + @WebParam(name = "format") + final String format, + @WebParam(name = "layout") + final String layout, + @WebParam(name = "interpretation") + final String interpretation); + + /** + * Get (metadata) resources by IDs. + * + * @param ids + * @param format + * @param layout + * @param interpretation + * @return + */ + @WebMethod + W3CEndpointReference getResourcesByIds(@WebParam(name = "ids") + final List ids, + @WebParam(name = "format") + final String format, + @WebParam(name = "layout") + final String layout, + @WebParam(name = "interpretation") + final String interpretation); +} diff --git a/dhp-rmi-api/src/main/java/eu/dnetlib/data/mdstore/DocumentNotFoundException.java b/dhp-rmi-api/src/main/java/eu/dnetlib/data/mdstore/DocumentNotFoundException.java new file mode 100644 index 000000000..cffb113f2 --- /dev/null +++ b/dhp-rmi-api/src/main/java/eu/dnetlib/data/mdstore/DocumentNotFoundException.java @@ -0,0 +1,30 @@ + +package eu.dnetlib.data.mdstore; + +/** + * Signals that a metadata record cannot be found in a given MDStore. + */ +public class DocumentNotFoundException extends MDStoreServiceException { + + /** + * + */ + private static final long serialVersionUID = 5188036989114250548L; + + public DocumentNotFoundException(final String s, final Throwable e) { + super(s, e); + } + + public DocumentNotFoundException(final String s) { + super(s); + } + + public DocumentNotFoundException(final Throwable e) { + super(e); + } + + public DocumentNotFoundException() { + super(); + } + +} diff --git a/dhp-rmi-api/src/main/java/eu/dnetlib/data/mdstore/MDStoreService.java b/dhp-rmi-api/src/main/java/eu/dnetlib/data/mdstore/MDStoreService.java new file mode 100644 index 000000000..e59c4e9b7 --- /dev/null +++ b/dhp-rmi-api/src/main/java/eu/dnetlib/data/mdstore/MDStoreService.java @@ -0,0 +1,118 @@ + +package eu.dnetlib.data.mdstore; + +import java.util.List; + +import eu.dnetlib.common.rmi.BaseService; +import jakarta.jws.WebMethod; +import jakarta.jws.WebParam; +import jakarta.jws.WebService; +import jakarta.xml.ws.wsaddressing.W3CEndpointReference; + +@WebService(targetNamespace = "http://services.dnetlib.eu/") +public interface MDStoreService extends BaseService { + + /** + * Identifies service and version. + * + * @return + */ + @Override + String identify(); + + /** + * Returns ResultSet EPR for delivered mdstore records. + * + * @param mdId + * @param from + * @param until + * @param recordFilter REGEX on the metadata record + * @return ResultSet EPR + * @throws MDStoreServiceException + */ + W3CEndpointReference deliverMDRecords(@WebParam(name = "mdId") + final String mdId, + @WebParam(name = "from") + final String from, + @WebParam(name = "until") + final String until, + @WebParam(name = "recordsFilter") + final String recordFilter) throws MDStoreServiceException; + + /** + * Deliver single record from selected mdstore. + * + * @param mdId + * @param recordId + * @return record + * @throws MDStoreServiceException + */ + String deliverRecord(@WebParam(name = "mdId") + final String mdId, @WebParam(name = "recordId") + final String recordId) throws MDStoreServiceException; + + /** + * Returns list of all stored indices. + * + * @return list of all stored indices + */ + List getListOfMDStores() throws MDStoreServiceException; + + List listMDStores(@WebParam(name = "format") + final String format, + @WebParam(name = "layout") + final String layout, + @WebParam(name = "interpretation") + final String interpretation) throws MDStoreServiceException; + + W3CEndpointReference bulkDeliverMDRecords(@WebParam(name = "format") + final String format, + @WebParam(name = "layout") + final String layout, + @WebParam(name = "interpretation") + final String interpretation) throws MDStoreServiceException; + + /** + * Store md records from a result set + * + * @param mdId + * @param rsId + * @param storingType + * @return returns true immediately. + * @throws MDStoreServiceException + */ + @Deprecated + boolean storeMDRecordsFromRS(@WebParam(name = "mdId") + final String mdId, + @WebParam(name = "rsId") + final String rsId, + @WebParam(name = "storingType") + final String storingType) throws MDStoreServiceException; + + /** + * Gets the size of the mdstore with the given identifier. + * + * @param mdId identifier of an mdstore + * @return the number of records in the store + */ + @WebMethod(operationName = "size") + int size(@WebParam(name = "mdId") + final String mdId) throws MDStoreServiceException; + + /** + * Gets the sum of records stored in all mdstore with the given format, layout , interpretation + * + * @param format format + * @param layout layout + * @param interpretation interpretation + * @return the total number of records in the mdstores of the given type + */ + @WebMethod(operationName = "sizeByFormat") + int size(@WebParam(name = "format") + final String format, + @WebParam(name = "layout") + final String layout, + @WebParam(name = "interpretation") + final String interpretation) throws MDStoreServiceException; + +} diff --git a/dhp-rmi-api/src/main/java/eu/dnetlib/data/mdstore/MDStoreServiceException.java b/dhp-rmi-api/src/main/java/eu/dnetlib/data/mdstore/MDStoreServiceException.java new file mode 100644 index 000000000..471b2a90a --- /dev/null +++ b/dhp-rmi-api/src/main/java/eu/dnetlib/data/mdstore/MDStoreServiceException.java @@ -0,0 +1,33 @@ + +package eu.dnetlib.data.mdstore; + +/** + * General mdstore service exception. + * + * @author claudio atzori + * @version 1.0.0 + */ +public class MDStoreServiceException extends Exception { + + /** + * + */ + private static final long serialVersionUID = -6772977735282310658L; + + public MDStoreServiceException(String s, Throwable e) { + super(s, e); + } + + public MDStoreServiceException(String s) { + super(s); + } + + public MDStoreServiceException(Throwable e) { + super(e); + } + + public MDStoreServiceException() { + super(); + } + +} diff --git a/dhp-rmi-api/src/main/java/eu/dnetlib/data/utility/objectpackaging/rmi/ObjectPackagingException.java b/dhp-rmi-api/src/main/java/eu/dnetlib/data/utility/objectpackaging/rmi/ObjectPackagingException.java new file mode 100644 index 000000000..ade6d9ffc --- /dev/null +++ b/dhp-rmi-api/src/main/java/eu/dnetlib/data/utility/objectpackaging/rmi/ObjectPackagingException.java @@ -0,0 +1,28 @@ + +package eu.dnetlib.data.utility.objectpackaging.rmi; + +import eu.dnetlib.common.rmi.RMIException; +import jakarta.xml.ws.WebFault; + +@WebFault +public class ObjectPackagingException extends RMIException { + + private static final long serialVersionUID = 3468254939586031822L; + + /** + * + */ + + public ObjectPackagingException(Throwable e) { + super(e); + } + + public ObjectPackagingException(String message, Throwable e) { + super(message, e); + } + + public ObjectPackagingException(String message) { + super(message); + } + +} diff --git a/dhp-rmi-api/src/main/java/eu/dnetlib/data/utility/objectpackaging/rmi/ObjectPackagingService.java b/dhp-rmi-api/src/main/java/eu/dnetlib/data/utility/objectpackaging/rmi/ObjectPackagingService.java new file mode 100644 index 000000000..6453cfe1d --- /dev/null +++ b/dhp-rmi-api/src/main/java/eu/dnetlib/data/utility/objectpackaging/rmi/ObjectPackagingService.java @@ -0,0 +1,37 @@ + +package eu.dnetlib.data.utility.objectpackaging.rmi; + +import java.util.List; + +import eu.dnetlib.common.rmi.BaseService; +import jakarta.jws.WebParam; +import jakarta.jws.WebService; +import jakarta.xml.ws.wsaddressing.W3CEndpointReference; + +/** + * The Object Packaging Service is used to combine the records spread + * into one information package, namely an Object Record. + */ + +@WebService(targetNamespace = "http://services.dnetlib.eu/") +public interface ObjectPackagingService extends BaseService { + /** + * Return the EPR of the resultSet containing the generated packages + * + * @param eprs A list of EPRs used to access the input resultSets. ResultSets MUST be ordered using an order key identified by xpath_ID + * @param xpath_ID A valid xpath, used to access the ordered ID of the elements of the input resultSets. + * @return EPR of the generated resultset + */ + W3CEndpointReference generatePackages(@WebParam(name = "eprs") List eprs, + @WebParam(name = "xpath_ID") String xpath_ID) throws ObjectPackagingException; + + /** + * Return the EPR of the resultSet containing the unpackaged element + * + * @param epr The epr used to access the resultset that contains input packages, packages are xml record in this format: REC1REC2REC3 + * @return EPR of the generated resultset + */ + W3CEndpointReference splitPackages(@WebParam(name = "epr") W3CEndpointReference epr) + throws ObjectPackagingException; + +} diff --git a/dhp-rmi-api/src/main/java/eu/dnetlib/enabling/dlm/rmi/DlmService.java b/dhp-rmi-api/src/main/java/eu/dnetlib/enabling/dlm/rmi/DlmService.java new file mode 100644 index 000000000..046b78a44 --- /dev/null +++ b/dhp-rmi-api/src/main/java/eu/dnetlib/enabling/dlm/rmi/DlmService.java @@ -0,0 +1,17 @@ + +package eu.dnetlib.enabling.dlm.rmi; + +import eu.dnetlib.common.rmi.BaseService; +import jakarta.jws.WebService; + +/** + * Distributed lock manager. Currently is used mostly to start the underlying lock manager (e.g. zookeeper) and let + * client interface directly with it. + * + *

The DLM service profile contains the entry point of the underlying locking service.

+ * + * @author marko + */ +@WebService(targetNamespace = "http://services.dnetlib.eu/") +public interface DlmService extends BaseService { +} diff --git a/dhp-rmi-api/src/main/java/eu/dnetlib/enabling/hcm/rmi/HostingContextManagerService.java b/dhp-rmi-api/src/main/java/eu/dnetlib/enabling/hcm/rmi/HostingContextManagerService.java new file mode 100644 index 000000000..3d11ca129 --- /dev/null +++ b/dhp-rmi-api/src/main/java/eu/dnetlib/enabling/hcm/rmi/HostingContextManagerService.java @@ -0,0 +1,19 @@ + +package eu.dnetlib.enabling.hcm.rmi; + +import eu.dnetlib.common.rmi.BaseService; +import jakarta.jws.WebService; + +/** + * Like a HostingNodeManager, but any webapp (web context) can have its own. + *

+ * useful for dispatching notifications shared by all the services local to a single context. + *

+ * + * @author marko + * @author antonis + */ +@WebService(targetNamespace = "http://services.dnetlib.eu/") +public interface HostingContextManagerService extends BaseService { + +} diff --git a/dhp-rmi-api/src/main/java/eu/dnetlib/enabling/hnm/rmi/HostingNodeManagerService.java b/dhp-rmi-api/src/main/java/eu/dnetlib/enabling/hnm/rmi/HostingNodeManagerService.java new file mode 100644 index 000000000..bd8431818 --- /dev/null +++ b/dhp-rmi-api/src/main/java/eu/dnetlib/enabling/hnm/rmi/HostingNodeManagerService.java @@ -0,0 +1,15 @@ + +package eu.dnetlib.enabling.hnm.rmi; + +import eu.dnetlib.common.rmi.BaseService; +import jakarta.jws.WebParam; +import jakarta.jws.WebService; + +/** + * The HostingNodeManager Service is used to ... + */ + +@WebService(targetNamespace = "http://services.dnetlib.eu/") +public interface HostingNodeManagerService extends BaseService { + String echo(@WebParam(name = "s") String s); +} diff --git a/dhp-rmi-api/src/main/java/eu/dnetlib/enabling/is/lookup/rmi/ISLookUpDocumentNotFoundException.java b/dhp-rmi-api/src/main/java/eu/dnetlib/enabling/is/lookup/rmi/ISLookUpDocumentNotFoundException.java new file mode 100644 index 000000000..82c3a1750 --- /dev/null +++ b/dhp-rmi-api/src/main/java/eu/dnetlib/enabling/is/lookup/rmi/ISLookUpDocumentNotFoundException.java @@ -0,0 +1,47 @@ + +package eu.dnetlib.enabling.is.lookup.rmi; + +import jakarta.xml.ws.WebFault; + +/** + * Thrown when a given document is not found. + * + * @author marko + */ +@WebFault +public class ISLookUpDocumentNotFoundException extends ISLookUpException { + + /** + * exception chain + message. + * + * @param message message + * @param e + */ + public ISLookUpDocumentNotFoundException(String message, Throwable e) { + super(message, e); + } + + /** + * exception chain constructor. + * + * @param e + */ + public ISLookUpDocumentNotFoundException(Throwable e) { + super(e); + } + + /** + * exception message. + * + * @param message + */ + public ISLookUpDocumentNotFoundException(String message) { + super(message); + } + + /** + * + */ + private static final long serialVersionUID = 2295995755165801937L; + +} diff --git a/dhp-rmi-api/src/main/java/eu/dnetlib/enabling/is/lookup/rmi/ISLookUpException.java b/dhp-rmi-api/src/main/java/eu/dnetlib/enabling/is/lookup/rmi/ISLookUpException.java new file mode 100644 index 000000000..bd5c26ce7 --- /dev/null +++ b/dhp-rmi-api/src/main/java/eu/dnetlib/enabling/is/lookup/rmi/ISLookUpException.java @@ -0,0 +1,27 @@ + +package eu.dnetlib.enabling.is.lookup.rmi; + +import eu.dnetlib.common.rmi.RMIException; +import jakarta.xml.ws.WebFault; + +@WebFault +public class ISLookUpException extends RMIException { + + /** + * + */ + private static final long serialVersionUID = -5626136963653382533L; + + public ISLookUpException(Throwable e) { + super(e); + } + + public ISLookUpException(String message, Throwable e) { + super(message, e); + } + + public ISLookUpException(String message) { + super(message); + } + +} diff --git a/dhp-rmi-api/src/main/java/eu/dnetlib/enabling/is/lookup/rmi/ISLookUpService.java b/dhp-rmi-api/src/main/java/eu/dnetlib/enabling/is/lookup/rmi/ISLookUpService.java new file mode 100644 index 000000000..a63ea36a6 --- /dev/null +++ b/dhp-rmi-api/src/main/java/eu/dnetlib/enabling/is/lookup/rmi/ISLookUpService.java @@ -0,0 +1,57 @@ + +package eu.dnetlib.enabling.is.lookup.rmi; + +import java.util.List; + +import eu.dnetlib.common.rmi.BaseService; +import jakarta.jws.WebParam; +import jakarta.jws.WebService; + +@WebService(targetNamespace = "http://services.dnetlib.eu/") +public interface ISLookUpService extends BaseService { + + Boolean flushCachedResultSets(); + + @Deprecated + String getCollection(@WebParam(name = "profId") String profId, @WebParam(name = "format") String format) + throws ISLookUpException; + + String retrieveCollection(@WebParam(name = "profId") String profId) throws ISLookUpException; + + String getResourceProfile(@WebParam(name = "profId") String profId) + throws ISLookUpException; + + String getResourceProfileByQuery(@WebParam(name = "XQuery") String XQuery) + throws ISLookUpException; + + String getResourceQoSParams(@WebParam(name = "id") String id) throws ISLookUpException; + + String getResourceTypeSchema(@WebParam(name = "resourceType") String resourceType) + throws ISLookUpException; + + List listCollections( + @WebParam(name = "format") String format, + @WebParam(name = "idfather") String idfather, + @WebParam(name = "owner") String owner) throws ISLookUpException; + + @Deprecated + List listDHNIDs() throws ISLookUpException; + + List listResourceTypes() throws ISLookUpException; + + @Deprecated + List listServiceIDs(@WebParam(name = "serviceType") String serviceType) throws ISLookUpException; + + @Deprecated + List listServiceTypes() throws ISLookUpException; + + /** + * Like searchProfile(), but bypassing the resultset. Useful for short xquery results. + * + * @param xquery xquery to be executed + * @return list of strings (never null) + * @throws ISLookUpException could happen + */ + List quickSearchProfile(@WebParam(name = "XQuery") String xquery) throws ISLookUpException; + +} diff --git a/dhp-rmi-api/src/main/java/eu/dnetlib/enabling/is/registry/ISRegistryDocumentNotFoundException.java b/dhp-rmi-api/src/main/java/eu/dnetlib/enabling/is/registry/ISRegistryDocumentNotFoundException.java new file mode 100644 index 000000000..62de1aaab --- /dev/null +++ b/dhp-rmi-api/src/main/java/eu/dnetlib/enabling/is/registry/ISRegistryDocumentNotFoundException.java @@ -0,0 +1,28 @@ + +package eu.dnetlib.enabling.is.registry; + +import eu.dnetlib.enabling.is.registry.rmi.ISRegistryException; + +public class ISRegistryDocumentNotFoundException extends ISRegistryException { + + /** + * + */ + private static final long serialVersionUID = -1304948213334188538L; + + public ISRegistryDocumentNotFoundException(String string, Throwable e) { + super(string, e); + // TODO Auto-generated constructor stub + } + + public ISRegistryDocumentNotFoundException(String string) { + super(string); + // TODO Auto-generated constructor stub + } + + public ISRegistryDocumentNotFoundException(Throwable e) { + super(e); + // TODO Auto-generated constructor stub + } + +} diff --git a/dhp-rmi-api/src/main/java/eu/dnetlib/enabling/is/registry/rmi/ISRegistryException.java b/dhp-rmi-api/src/main/java/eu/dnetlib/enabling/is/registry/rmi/ISRegistryException.java new file mode 100644 index 000000000..e7795ab1b --- /dev/null +++ b/dhp-rmi-api/src/main/java/eu/dnetlib/enabling/is/registry/rmi/ISRegistryException.java @@ -0,0 +1,25 @@ + +package eu.dnetlib.enabling.is.registry.rmi; + +import eu.dnetlib.common.rmi.RMIException; + +public class ISRegistryException extends RMIException { + + /** + * + */ + private static final long serialVersionUID = -3347405941287624771L; + + public ISRegistryException(Throwable e) { + super(e); + } + + public ISRegistryException(String string) { + super(string); + } + + public ISRegistryException(String string, Throwable e) { + super(string, e); + } + +} diff --git a/dhp-rmi-api/src/main/java/eu/dnetlib/enabling/is/registry/rmi/ISRegistryService.java b/dhp-rmi-api/src/main/java/eu/dnetlib/enabling/is/registry/rmi/ISRegistryService.java new file mode 100644 index 000000000..3fd10bcbf --- /dev/null +++ b/dhp-rmi-api/src/main/java/eu/dnetlib/enabling/is/registry/rmi/ISRegistryService.java @@ -0,0 +1,72 @@ + +package eu.dnetlib.enabling.is.registry.rmi; + +import java.util.List; + +import eu.dnetlib.common.rmi.BaseService; +import jakarta.jws.WebService; + +@WebService(targetNamespace = "http://services.dnetlib.eu/") +public interface ISRegistryService extends BaseService { + + boolean addOrUpdateResourceType(String resourceType, String resourceSchema) throws ISRegistryException; + + boolean addResourceType(String resourceType, String resourceSchema) throws ISRegistryException; + + boolean deleteProfile(String profId) throws ISRegistryException; + + @Deprecated + boolean deleteProfiles(List arrayprofId) throws ISRegistryException; + + /** + * @param resourceType + * @param hierarchical remove subscription topics + * @return + * @throws ISRegistryException + */ + boolean deleteResourceType(String resourceType, Boolean hierarchical) throws ISRegistryException; + + boolean executeXUpdate(String XQuery) throws ISRegistryException; + + String insertProfileForValidation(String resourceType, String resourceProfile) throws ISRegistryException; + + String invalidateProfile(String profId) throws ISRegistryException; + + boolean refreshProfile(String profId, String resourceType) throws ISRegistryException; + + /** + * register a XML Profile. + * + * @param resourceProfile xml profile + * @return profile id + * @throws ISRegistryException + */ + String registerProfile(String resourceProfile) throws ISRegistryException; + + String registerSecureProfile(String resourceProfId, String secureProfId) throws ISRegistryException; + + boolean updateProfile(String profId, String resourceProfile, String resourceType) throws ISRegistryException; + + @Deprecated + String updateProfileDHN(String resourceProfile) throws ISRegistryException; + + boolean addProfileNode(String profId, String xpath, String node) throws ISRegistryException; + + boolean updateProfileNode(String profId, String xpath, String node) throws ISRegistryException; + + boolean removeProfileNode(String profId, String nodeId) throws ISRegistryException; + + @Deprecated + boolean updateRegionDescription(String profId, String resourceProfile) throws ISRegistryException; + + String validateProfile(String profId) throws ISRegistryException; + + @Deprecated + List validateProfiles(List profIds) throws ISRegistryException; + + void addBlackBoardMessage(String profId, String messageId, String message) throws ISRegistryException; + + void replyBlackBoardMessage(String profId, String message) throws ISRegistryException; + + void deleteBlackBoardMessage(String profId, String messageId) throws ISRegistryException; +} diff --git a/dhp-rmi-api/src/main/java/eu/dnetlib/enabling/is/sn/rmi/ISSNException.java b/dhp-rmi-api/src/main/java/eu/dnetlib/enabling/is/sn/rmi/ISSNException.java new file mode 100644 index 000000000..c81470911 --- /dev/null +++ b/dhp-rmi-api/src/main/java/eu/dnetlib/enabling/is/sn/rmi/ISSNException.java @@ -0,0 +1,25 @@ + +package eu.dnetlib.enabling.is.sn.rmi; + +import eu.dnetlib.common.rmi.RMIException; + +public class ISSNException extends RMIException { + + /** + * + */ + private static final long serialVersionUID = -7384073901457430004L; + + public ISSNException(final Throwable e) { + super(e); + } + + public ISSNException(final String message) { + super(message); + } + + public ISSNException(final String message, final Throwable e) { + super(message, e); + } + +} diff --git a/dhp-rmi-api/src/main/java/eu/dnetlib/enabling/is/sn/rmi/ISSNService.java b/dhp-rmi-api/src/main/java/eu/dnetlib/enabling/is/sn/rmi/ISSNService.java new file mode 100644 index 000000000..c53c4eda1 --- /dev/null +++ b/dhp-rmi-api/src/main/java/eu/dnetlib/enabling/is/sn/rmi/ISSNService.java @@ -0,0 +1,121 @@ + +package eu.dnetlib.enabling.is.sn.rmi; + +import java.util.List; + +import eu.dnetlib.common.rmi.BaseService; +import jakarta.jws.WebParam; +import jakarta.jws.WebService; +import jakarta.xml.ws.wsaddressing.W3CEndpointReference; + +@WebService(targetNamespace = "http://services.dnetlib.eu/") +public interface ISSNService extends BaseService { + + /** + * fossil. + * + * @param topic + * @return + * @throws ISSNException + */ + String getCurrentMessage(@WebParam(name = "topic") String topic) throws ISSNException; + + /** + * puts a subcription in a paused state. paused subscription are not notified even when triggered. + * + * @param subscrId subscription identifier + * @return returns false if the subscription is already paused. + * @throws ISSNException may happen + */ + boolean pauseSubscription(@WebParam(name = "subscrId") String subscrId) throws ISSNException; + + /** + * Used to renew the subscription before it expires. + * + *

+ * In practice it resets the ttl to another value, so it can be used to reset a infinte ttl subscription to a finite + * value. + *

+ * + * @param subscrId subscription id + * @param terminationTime new ttl (from now), or 0 (infinite) + * @return true if successful + * @throws ISSNException may happen + */ + boolean renew(@WebParam(name = "subscrId") String subscrId, @WebParam(name = "terminationTime") int terminationTime) + throws ISSNException; + + /** + * resumes a paused subscription. + * + * @param subscrId subscription id + * @return true if resumed. false if it was not paused. + * @throws ISSNException may happen + */ + boolean resumeSubscription(@WebParam(name = "subscrId") String subscrId) throws ISSNException; + + /** + * @param consumerReference epr to be called when the notification is triggered + * @param topicExpression topic expression to register + * @param initialTerminationTime ttl in seconds (0 = infinite) + * @return subscription id + * @throws ISSNException may happen + */ + String subscribe( + @WebParam(name = "consumerReference") W3CEndpointReference consumerReference, + @WebParam(name = "topicExpression") String topicExpression, + @WebParam(name = "initialTerminationTime") int initialTerminationTime) + throws ISSNException; + + boolean unsubscribe(@WebParam(name = "subscrId") String subscrId) throws ISSNException; + + /** + * fossil. + * + * @param resourceType + * @param profileId + * @param profile + * @return + * @throws ISSNException + */ + boolean actionCreatePerformed( + @WebParam(name = "resourceType") String resourceType, + @WebParam(name = "profileId") String profileId, + @WebParam(name = "profile") String profile) throws ISSNException; + + /** + * fossil. + * + * @param resourceType + * @param profileId + * @param profileBefore + * @param profileAfter + * @return + * @throws ISSNException + */ + boolean actionUpdatePerformed( + @WebParam(name = "resourceType") String resourceType, + @WebParam(name = "profileId") String profileId, + @WebParam(name = "profileBefore") String profileBefore, + @WebParam(name = "profileAfter") String profileAfter) throws ISSNException; + + /** + * fossil. + * + * @param resourceType + * @param profileId + * @return + * @throws ISSNException + */ + boolean actionDeletePerformed(@WebParam(name = "resourceType") String resourceType, + @WebParam(name = "profileId") String profileId) + throws ISSNException; + + /** + * list all subscriptions. Mostly for debug reasons. + * + * @return list of subscription ids. + */ + List listSubscriptions(); + +} diff --git a/dhp-rmi-api/src/main/java/eu/dnetlib/enabling/is/sn/rmi/SubscriptionRequestRejectedException.java b/dhp-rmi-api/src/main/java/eu/dnetlib/enabling/is/sn/rmi/SubscriptionRequestRejectedException.java new file mode 100644 index 000000000..75928092e --- /dev/null +++ b/dhp-rmi-api/src/main/java/eu/dnetlib/enabling/is/sn/rmi/SubscriptionRequestRejectedException.java @@ -0,0 +1,21 @@ + +package eu.dnetlib.enabling.is.sn.rmi; + +/** + * Thrown when a subscription request is rejected. + * + * @author claudio + */ +public class SubscriptionRequestRejectedException extends ISSNException { + + /** + * + */ + private static final long serialVersionUID = 263095606953662098L; + + public SubscriptionRequestRejectedException(String message) { + super(message); + // TODO Auto-generated constructor stub + } + +} diff --git a/dhp-rmi-api/src/main/java/eu/dnetlib/enabling/is/store/rmi/ISStoreException.java b/dhp-rmi-api/src/main/java/eu/dnetlib/enabling/is/store/rmi/ISStoreException.java new file mode 100644 index 000000000..4f9530dfa --- /dev/null +++ b/dhp-rmi-api/src/main/java/eu/dnetlib/enabling/is/store/rmi/ISStoreException.java @@ -0,0 +1,25 @@ + +package eu.dnetlib.enabling.is.store.rmi; + +import eu.dnetlib.common.rmi.RMIException; + +public class ISStoreException extends RMIException { + + /** + * + */ + private static final long serialVersionUID = 8683126829156096420L; + + public ISStoreException(Throwable e) { + super(e); + } + + public ISStoreException(String message, Throwable e) { + super(message, e); + } + + public ISStoreException(String message) { + super(message); + } + +} diff --git a/dhp-rmi-api/src/main/java/eu/dnetlib/enabling/is/store/rmi/ISStoreService.java b/dhp-rmi-api/src/main/java/eu/dnetlib/enabling/is/store/rmi/ISStoreService.java new file mode 100644 index 000000000..4b92b69c9 --- /dev/null +++ b/dhp-rmi-api/src/main/java/eu/dnetlib/enabling/is/store/rmi/ISStoreService.java @@ -0,0 +1,47 @@ + +package eu.dnetlib.enabling.is.store.rmi; + +import java.util.List; + +import eu.dnetlib.common.rmi.BaseService; +import jakarta.jws.WebParam; +import jakarta.jws.WebService; + +@WebService(targetNamespace = "http://services.dnetlib.eu/") +public interface ISStoreService extends BaseService { + + boolean createFileColl(@WebParam(name = "fileColl") String fileColl) throws ISStoreException; + + boolean deleteFileColl(@WebParam(name = "fileColl") String fileColl) throws ISStoreException; + + boolean deleteXML(@WebParam(name = "fileName") String fileName, @WebParam(name = "fileColl") String fileColl) + throws ISStoreException; + + boolean executeXUpdate(@WebParam(name = "query") String query) throws ISStoreException; + + List getFileColls() throws ISStoreException; + + List getFileNames(@WebParam(name = "fileColl") String fileColl) throws ISStoreException; + + String getXML(@WebParam(name = "fileName") String fileName, @WebParam(name = "fileColl") String fileColl) + throws ISStoreException; + + String getXMLbyQuery(@WebParam(name = "query") String query) throws ISStoreException; + + boolean insertXML(@WebParam(name = "fileName") String fileName, @WebParam(name = "fileColl") String fileColl, + @WebParam(name = "file") String file) + throws ISStoreException; + + boolean reindex(); + + List quickSearchXML(@WebParam(name = "query") String query) throws ISStoreException; + + boolean sync(); + + boolean updateXML(@WebParam(name = "fileName") String fileName, @WebParam(name = "fileColl") String fileColl, + @WebParam(name = "file") String file) + throws ISStoreException; + + String backup() throws ISStoreException; + +} diff --git a/dhp-rmi-api/src/main/java/eu/dnetlib/enabling/resultset/rmi/ResultSetException.java b/dhp-rmi-api/src/main/java/eu/dnetlib/enabling/resultset/rmi/ResultSetException.java new file mode 100644 index 000000000..f376a4625 --- /dev/null +++ b/dhp-rmi-api/src/main/java/eu/dnetlib/enabling/resultset/rmi/ResultSetException.java @@ -0,0 +1,22 @@ + +package eu.dnetlib.enabling.resultset.rmi; + +import eu.dnetlib.common.rmi.RMIException; + +public class ResultSetException extends RMIException { + + /** + * + */ + private static final long serialVersionUID = -7130554407601059627L; + + public ResultSetException(Throwable e) { + super(e); + // TODO Auto-generated constructor stub + } + + public ResultSetException(String string) { + super(string); + } + +} diff --git a/dhp-rmi-api/src/main/java/eu/dnetlib/enabling/resultset/rmi/ResultSetService.java b/dhp-rmi-api/src/main/java/eu/dnetlib/enabling/resultset/rmi/ResultSetService.java new file mode 100644 index 000000000..10079c907 --- /dev/null +++ b/dhp-rmi-api/src/main/java/eu/dnetlib/enabling/resultset/rmi/ResultSetService.java @@ -0,0 +1,135 @@ + +package eu.dnetlib.enabling.resultset.rmi; + +import java.util.List; + +import eu.dnetlib.common.rmi.BaseService; +import jakarta.jws.WebMethod; +import jakarta.jws.WebParam; +import jakarta.jws.WebService; +import jakarta.xml.ws.wsaddressing.W3CEndpointReference; + +/** + * ResultSet service interface. + *

+ * TODO: implement other compatibility methods as needed. + * + * @author marko + */ +@WebService(targetNamespace = "http://services.dnetlib.eu/") +public interface ResultSetService extends BaseService { + /** + * create a new pull rs. + * + * @param bdId bulk data identifier + * @param initialPageSize page size for the polling on the server side. + * @param expiryTime RS expiry time + * @return + */ + W3CEndpointReference createPullRSEPR( + @WebParam(name = "dataProviderServiceAddress") W3CEndpointReference dataProviderEPR, + @WebParam(name = "bdId") String bdId, + @WebParam(name = "initialPageSize") int initialPageSize, + @WebParam(name = "expiryTime") int expiryTime, + @WebParam(name = "styleSheet") String styleSheet, + @WebParam(name = "keepAliveTime") Integer keepAliveTime, + @WebParam(name = "total") Integer total); + + /** + * create a new pull rs. + *

+ * compatibility version + * + * @param bdId bulk data identifier + * @param initialPageSize page size for the polling on the server side. + * @param expiryTime RS expiry time + * @return + */ + W3CEndpointReference createPullRS( + @WebParam(name = "dataProviderServiceAddress") String dataProviderServiceAddress, + @WebParam(name = "bdId") String bdId, + @WebParam(name = "initialPageSize") int initialPageSize, + @WebParam(name = "expiryTime") int expiryTime, + @WebParam(name = "styleSheet") String styleSheet, + @WebParam(name = "keepAliveTime") Integer keepAliveTime, + @WebParam(name = "total") Integer total); + + /** + * close a result set. A closed resultset is guaranteed not to grow. + * + * @param rsId + */ + void closeRS(@WebParam(name = "rsId") String rsId); + + /** + * get one 'page' of results. + *

+ * TODO: define how results are returned when the range is not present in the result set. + * + * @param fromPosition counting from 1 + * @param toPosition included + * @param requestMode + * @return a page of data + */ + List getResult( + @WebParam(name = "rsId") String rsId, + @WebParam(name = "fromPosition") int fromPosition, + @WebParam(name = "toPosition") int toPosition, + @WebParam(name = "requestMode") String requestMode) throws ResultSetException; + + /** + * get the number of result elements present in the resultset. + * + * @param rsId result set identifier + * @return number of results available in the resultset + * @throws ResultSetException + */ + int getNumberOfElements(@WebParam(name = "rsId") String rsId) throws ResultSetException; + + /** + * create a new push resultset. + * + * @param expiryTime RS expiry time + * @param keepAliveTime keep alive time + * @return epr of new resultset + * @throws ResultSetException + */ + W3CEndpointReference createPushRS(@WebParam(name = "expiryTime") int expiryTime, + @WebParam(name = "keepAliveTime") int keepAliveTime) + throws ResultSetException; + + /** + * add new data to a push resultset. + * + * @param rsId resultset id + * @param elements list of elements to be addded + * @return dummy value + * @throws ResultSetException + */ + String populateRS(@WebParam(name = "rsId") String rsId, @WebParam(name = "elements") List elements) + throws ResultSetException; + + /** + * return current status of a resultset. + * + * @param rsId resultset id + * @return status + * @throws ResultSetException + */ + String getRSStatus(@WebParam(name = "rsId") String rsId) throws ResultSetException; + + /** + * read a resultset property. + * + * @param rsId resultset id + * @param name property value + * @return property value + * @throws ResultSetException + */ + String getProperty(@WebParam(name = "rsId") String rsId, @WebParam(name = "name") String name) + throws ResultSetException; + + @WebMethod(operationName = "identify") + String identify(); + +}