项目作者: International-Data-Spaces-Association

项目描述 :
Latest: 5.0.4 (LTS v4: 4.0.9) - The IDS Framework aims to simplify the development of an IDS Connector.
高级语言: Java
项目地址: git://github.com/International-Data-Spaces-Association/IDS-Connector-Framework.git
创建时间: 2020-12-04T10:36:53Z
项目社区:https://github.com/International-Data-Spaces-Association/IDS-Connector-Framework

开源协议:Apache License 2.0

下载





— End-Of-Support: 23.07.2021 — Please use the IDS-Messaging-Services! —





License
Issues
Discussions
Wiki
Contributing
Code of Conduct

IDS Framework

The IDS Framework aims to simplify the development of an IDS Connector.
The Framework provides basic functionality encompassing creation and handling of IDS messages and communication to the DAPS and Brokers. However,
different Connectors can have various requirements regarding protocols and data endpoint types for data exchange. Therefore,
the final implementation of the data exchange remains for applications leveraging the Framework.
It will be developed continuously to improve and simplify the development of IDS Connectors.

Table of Contents

Prerequisites

  • The Framework uses asymmetric encryption concepts and requires public and private key of the Connector instance.
  • Furthermore, it utilizes the IDS Configurationmodel which was developed within the IDS Informationmodel. Therefor a
    configmodel.json file should exist to load the configuration of the Connector into the Configurationmodel. An example of that can be seen inside the Demo Connector project.
    The configuration file should reference the key and trust store.

Installation

It is suggested to use the latest release from the Fraunhofer ISST Maven Repository. In case you want to build
it by yourself locally, you have to execute the following command:

  1. ./mvnw -P dev clean install

Integration into a Java Project

In order to use the Framework inside a new java application add the isst-nexus-public repository and the dependency to
the pom.xml file.

  1. <!-- IDS Framework -->
  2. <dependency>
  3. <groupId>de.fraunhofer.isst.ids.framework</groupId>
  4. <artifactId>base</artifactId>
  5. <version>${ids-framework.version}</version>
  6. </dependency>
  7. <repositories>
  8. <repository>
  9. <id>isst-nexus-public</id>
  10. <name>isst-public</name>
  11. <url>https://mvn.ids.isst.fraunhofer.de/nexus/repository/ids-public/</url>
  12. </repository>
  13. </repositories>

Usage of the IDS Framework

For a detailed description of the usage of the IDS Framework and its modules see the Wiki pages of this project.

MVP Framework Demo

To create a minimum viable IDS Connector, you only have to do few steps. Precondition is a Spring Boot project.

  1. Add the @ComponentScan annotation to the SpringBoot Application and scan the framework messaging packages

    1. @ComponentScan({
    2. "de.fraunhofer.isst.ids.framework.messaging.spring.controller",
    3. "de.fraunhofer.isst.ids.framework.messaging.spring",
    4. "<APPLICATION-PACKAGE>"
    5. })
  2. Implement a MessageHandler for the instances of RequestMessage your Connector should be able to process.
    An example for a MessageHandler (for RequestMessageImpl) is given below.

    1. @Component
    2. @SupportedMessageType(RequestMessageImpl.class)
    3. public class RequestMessageHandler implements MessageHandler<RequestMessageImpl> {
    4. private static final Logger LOGGER = LoggerFactory.getLogger(RequestMessageHandler.class);
    5. private final Connector connector;
    6. private final TokenProvider provider;
    7. public RequestMessageHandler(ConfigurationContainer container, TokenProvider provider){
    8. this.connector = container.getConnector();
    9. this.provider = provider;
    10. }
    11. @Override
    12. public MessageResponse handleMessage(RequestMessageImpl requestMessage, MessagePayload messagePayload) throws MessageHandlingException {
    13. try {
    14. LOGGER.info("Received a RequestMessage!");
    15. // Just return the received payload as plain string
    16. String receivedPayload = IOUtils.toString(messagePayload.getUnderlyingInputStream(), StandardCharsets.UTF_8.name()) + " - from RequestMessage!";
    17. var message = new ResponseMessageBuilder()
    18. ._securityToken_(provider.getTokenJWS())
    19. ._correlationMessage_(requestMessage.getId())
    20. ._issued_(Util.getGregorianNow())
    21. ._issuerConnector_(connector.getId())
    22. ._modelVersion_(this.connector.getOutboundModelVersion())
    23. ._senderAgent_(connector.getId())
    24. .build();
    25. return BodyResponse.create(message, receivedPayload);
    26. } catch (Exception e) {
    27. return ErrorResponse.withDefaultHeader(RejectionReason.INTERNAL_RECIPIENT_ERROR, e.getMessage(), connector.getId(), connector.getOutboundModelVersion());
    28. }
    29. }
    30. }

Versioning

The IDS Framework uses the SemVer for versioning. The release Versions are tagged with their respective version.


License

This project is licensed under the Apache License 2.0 - see the LICENSE.md file for details.