diff --git a/phase4-spring-boot-demo/README.md b/phase4-spring-boot-demo/README.md deleted file mode 100644 index 3278e8022..000000000 --- a/phase4-spring-boot-demo/README.md +++ /dev/null @@ -1,12 +0,0 @@ -## phase4-peppol-servlet Spring Boot integration - -This is a stub project that demonstrates a simple method of integrating the phase4 library with the Peppol profile and Spring Boot managed classes. - -# Building from source - -Apache Maven needed 3.6 or later and Java JDK 11 or later is required. - -Run on the commandline `mvn clean install -U`. - ---- -Initially developed at Opensoft. diff --git a/phase4-spring-boot-demo/findbugs-exclude.xml b/phase4-spring-boot-demo/findbugs-exclude.xml deleted file mode 100644 index 6e6c20846..000000000 --- a/phase4-spring-boot-demo/findbugs-exclude.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - diff --git a/phase4-spring-boot-demo/pom.xml b/phase4-spring-boot-demo/pom.xml deleted file mode 100644 index 3715e425b..000000000 --- a/phase4-spring-boot-demo/pom.xml +++ /dev/null @@ -1,122 +0,0 @@ - - - - 4.0.0 - - com.helger.phase4 - phase4-parent-pom - 3.0.0-SNAPSHOT - - phase4-spring-boot-demo - phase4-spring-boot-demo - phase4 Spring Boot demo application - https://github.com/phax/phase4/phase4-spring-boot-demo - 2021 - - - - Apache 2 - http://www.apache.org/licenses/LICENSE-2.0 - repo - - - - - - org.springframework.boot - spring-boot-starter - ${spring-boot.version} - - - org.springframework.boot - spring-boot-starter-web - ${spring-boot.version} - - - - org.springframework.boot - spring-boot-starter-actuator - ${spring-boot.version} - - - - org.springframework.boot - spring-boot-devtools - ${spring-boot.version} - runtime - true - - - - com.helger.phase4 - phase4-lib - - - com.helger.phase4 - phase4-profile-peppol - - - com.helger.phase4 - phase4-peppol-servlet - - - - com.sun.xml.bind - jaxb-impl - - - - org.springframework.boot - spring-boot-starter-test - ${spring-boot.version} - test - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - 17 - 17 - true - - - - org.springframework.boot - spring-boot-maven-plugin - ${spring-boot.version} - - - - repackage - - - - - com.helger.phase4.springboot.Phase4SpringbootApplication - ZIP - - - - - diff --git a/phase4-spring-boot-demo/src/etc/javadoc.css b/phase4-spring-boot-demo/src/etc/javadoc.css deleted file mode 100644 index 6c2993b7a..000000000 --- a/phase4-spring-boot-demo/src/etc/javadoc.css +++ /dev/null @@ -1,583 +0,0 @@ -/** - * Copyright (C) 2021-2024 Philip Helger (www.helger.com) - * philip[at]helger[dot]com - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* - * based on phloc javadoc CSS. - * (c) 2011-2014 phloc systems. - * Derived from the original javadoc CSS from Sun JDK - */ - -body { - background-color: #FFFFFF; - color: #353833; - font-family: Arial, Helvetica, sans-serif; - font-size: 76%; - margin: 0; -} - -a:link,a:visited { - color: #880000; - text-decoration: none; -} - -a:hover,a:focus { - color: #BB2222; - text-decoration: none; -} - -a:active { - color: #4C6B87; - text-decoration: none; -} - -a[name] { - color: #353833; -} - -a[name]:hover { - color: #353833; - text-decoration: none; -} - -pre { - font-size: 1.3em; -} - -h1 { - font-size: 1.8em; -} - -h2 { - font-size: 1.5em; -} - -h3 { - font-size: 1.4em; -} - -h4 { - font-size: 1.3em; -} - -h5 { - font-size: 1.2em; -} - -h6 { - font-size: 1.1em; -} - -ul { - list-style-type: disc; -} - -code,tt { - font-size: 1.2em; -} - -dt code { - font-size: 1.2em; -} - -table tr td dt code { - font-size: 1.2em; - vertical-align: top; -} - -sup { - font-size: 0.6em; -} - -.clear { - clear: both; - height: 0; - overflow: hidden; -} - -.aboutLanguage { - float: right; - font-size: 0.8em; - margin-top: -7px; - padding: 0 21px; - z-index: 200; -} - -.legalCopy { - margin-left: 0.5em; -} - -.bar a,.bar a:link,.bar a:visited,.bar a:active { - color: #FFFFFF; - text-decoration: none; -} - -.bar a:hover,.bar a:focus { - color: #BB7A2A; -} - -.tab { - background-color: #0066FF; - background-image: url("resources/titlebar.gif"); - background-position: left top; - background-repeat: no-repeat; - color: #FFFFFF; - font-weight: bold; - padding: 8px; - width: 5em; -} - -.bar { - background-image: url("resources/background.gif"); - background-repeat: repeat-x; - color: #FFFFFF; - font-size: 1em; - height: auto; - margin: 0; - padding: 0.8em 0.5em 0.4em 0.8em; -} - -.topNav { - background-image: url("resources/background.gif"); - background-repeat: repeat-x; - clear: right; - color: #FFFFFF; - float: left; - height: 2.8em; - overflow: hidden; - padding: 10px 0 0; - width: 100%; -} - -.bottomNav { - background-image: url("resources/background.gif"); - background-repeat: repeat-x; - clear: right; - color: #FFFFFF; - float: left; - height: 2.8em; - margin-top: 10px; - overflow: hidden; - padding: 10px 0 0; - width: 100%; -} - -.subNav { - background-color: #DEE3E9; - border-bottom: 1px solid #9EADC0; - float: left; - overflow: hidden; - width: 100%; -} - -.subNav div { - clear: left; - float: left; - padding: 0 0 5px 6px; -} - -ul.navList,ul.subNavList { - float: left; - margin: 0 25px 0 0; - padding: 0; -} - -ul.navList li { - float: left; - list-style: none outside none; - padding: 3px 6px; -} - -ul.subNavList li { - float: left; - font-size: 90%; - list-style: none outside none; -} - -.topNav a:link,.topNav a:active,.topNav a:visited,.bottomNav a:link,.bottomNav a:active,.bottomNav a:visited - { - color: #FFFFFF; - text-decoration: none; -} - -.topNav a:hover,.bottomNav a:hover { - color: #BB7A2A; - text-decoration: none; -} - -.navBarCell1Rev { - background-color: #A88834; - background-image: url("resources/tab.gif"); - border: 1px solid #C9AA44; - color: #FFFFFF; - margin: auto 5px; -} - -.header,.footer { - clear: both; - margin: 0 20px; - padding: 5px 0 0; -} - -.indexHeader { - margin: 10px; - position: relative; -} - -.indexHeader h1 { - font-size: 1.3em; -} - -.title { - color: #880000; - margin: 10px 0; -} - -.subTitle { - margin: 5px 0 0; -} - -.header ul { - margin: 0 0 25px; - padding: 0; -} - -.footer ul { - margin: 20px 0 5px; -} - -.header ul li,.footer ul li { - font-size: 1.2em; - list-style: none outside none; -} - -div.details ul.blockList ul.blockList ul.blockList li.blockList h4,div.details ul.blockList ul.blockList ul.blockListLast li.blockList h4 - { - background-color: #DEE3E9; - border-bottom: 1px solid #9EADC0; - border-top: 1px solid #9EADC0; - margin: 0 0 6px -8px; - padding: 2px 5px; -} - -ul.blockList ul.blockList ul.blockList li.blockList h3 { - background-color: #DEE3E9; - border-bottom: 1px solid #9EADC0; - border-top: 1px solid #9EADC0; - margin: 0 0 6px -8px; - padding: 2px 5px; -} - -ul.blockList ul.blockList li.blockList h3 { - margin: 15px 0; - padding: 0; -} - -ul.blockList li.blockList h2 { - padding: 0 0 20px; -} - -.contentContainer,.sourceContainer,.classUseContainer,.serializedFormContainer,.constantValuesContainer - { - clear: both; - padding: 10px 20px; - position: relative; -} - -.indexContainer { - font-size: 1em; - margin: 10px; - position: relative; -} - -.indexContainer h2 { - font-size: 1.1em; - padding: 0 0 3px; -} - -.indexContainer ul { - margin: 0; - padding: 0; -} - -.indexContainer ul li { - list-style: none outside none; -} - -.contentContainer .description dl dt,.contentContainer .details dl dt,.serializedFormContainer dl dt - { - color: #4E4E4E; - font-size: 1.1em; - font-weight: bold; - margin: 10px 0 0; -} - -.contentContainer .description dl dd,.contentContainer .details dl dd,.serializedFormContainer dl dd - { - margin: 10px 0 10px 20px; -} - -.serializedFormContainer dl.nameValue dt { - display: inline; - font-size: 1.1em; - font-weight: bold; - margin-left: 1px; -} - -.serializedFormContainer dl.nameValue dd { - display: inline; - font-size: 1.1em; -} - -ul.horizontal li { - display: inline; - font-size: 0.9em; -} - -ul.inheritance { - margin: 0; - padding: 0; -} - -ul.inheritance li { - display: inline; - list-style: none outside none; -} - -ul.inheritance li ul.inheritance { - margin-left: 15px; - padding-left: 15px; - padding-top: 1px; -} - -ul.blockList,ul.blockListLast { - margin: 10px 0; - padding: 0; -} - -ul.blockList li.blockList,ul.blockListLast li.blockList { - list-style: none outside none; - margin-bottom: 25px; -} - -ul.blockList ul.blockList li.blockList,ul.blockList ul.blockListLast li.blockList - { - background-color: #F9F9F9; - border: 1px solid #9EADC0; - padding: 0 20px 5px 10px; -} - -ul.blockList ul.blockList ul.blockList li.blockList,ul.blockList ul.blockList ul.blockListLast li.blockList - { - -moz-border-bottom-colors: none; - -moz-border-left-colors: none; - -moz-border-right-colors: none; - -moz-border-top-colors: none; - background-color: #FFFFFF; - border-color: currentColor #9EADC0 #9EADC0; - border-image: none; - border-right: 1px solid #9EADC0; - border-style: none solid solid; - border-width: medium 1px 1px; - padding: 0 0 5px 8px; -} - -ul.blockList ul.blockList ul.blockList ul.blockList li.blockList { - -moz-border-bottom-colors: none; - -moz-border-left-colors: none; - -moz-border-right-colors: none; - -moz-border-top-colors: none; - border-color: currentColor currentColor #9EADC0; - border-image: none; - border-style: none none solid; - border-width: medium medium 1px; - margin-left: 0; - padding-bottom: 15px; - padding-left: 0; -} - -ul.blockList ul.blockList ul.blockList ul.blockList li.blockListLast { - border-bottom: medium none; - list-style: none outside none; - padding-bottom: 0; -} - -table tr td dl,table tr td dl dt,table tr td dl dd { - margin-bottom: 1px; - margin-top: 0; -} - -.contentContainer table,.classUseContainer table,.constantValuesContainer table - { - border-bottom: 1px solid #9EADC0; - width: 100%; -} - -.contentContainer ul li table,.classUseContainer ul li table,.constantValuesContainer ul li table - { - width: 100%; -} - -.contentContainer .description table,.contentContainer .details table { - border-bottom: medium none; -} - -.contentContainer ul li table th.colOne,.contentContainer ul li table th.colFirst,.contentContainer ul li table th.colLast,.classUseContainer ul li table th,.constantValuesContainer ul li table th,.contentContainer ul li table td.colOne,.contentContainer ul li table td.colFirst,.contentContainer ul li table td.colLast,.classUseContainer ul li table td,.constantValuesContainer ul li table td - { - padding-right: 20px; - vertical-align: top; -} - -.contentContainer ul li table th.colLast,.classUseContainer ul li table th.colLast,.constantValuesContainer ul li table th.colLast,.contentContainer ul li table td.colLast,.classUseContainer ul li table td.colLast,.constantValuesContainer ul li table td.colLast,.contentContainer ul li table th.colOne,.classUseContainer ul li table th.colOne,.contentContainer ul li table td.colOne,.classUseContainer ul li table td.colOne - { - padding-right: 3px; -} - -.overviewSummary caption,.packageSummary caption,.contentContainer ul.blockList li.blockList caption,.summary caption,.classUseContainer caption,.constantValuesContainer caption - { - background-repeat: no-repeat; - clear: none; - color: #FFFFFF; - font-weight: bold; - margin: 0; - overflow: hidden; - padding: 0; - position: relative; - text-align: left; -} - -caption a:link,caption a:hover,caption a:active,caption a:visited { - color: #FFFFFF; -} - -.overviewSummary caption span,.packageSummary caption span,.contentContainer ul.blockList li.blockList caption span,.summary caption span,.classUseContainer caption span,.constantValuesContainer caption span - { - background-image: url("resources/titlebar.gif"); - display: block; - float: left; - height: 18px; - padding-left: 8px; - padding-top: 8px; - white-space: nowrap; -} - -.overviewSummary .tabEnd,.packageSummary .tabEnd,.contentContainer ul.blockList li.blockList .tabEnd,.summary .tabEnd,.classUseContainer .tabEnd,.constantValuesContainer .tabEnd - { - background-image: url("resources/titlebar_end.gif"); - background-position: right top; - background-repeat: no-repeat; - float: left; - position: relative; - width: 10px; -} - -ul.blockList ul.blockList li.blockList table { - margin: 0 0 12px; - width: 100%; -} - -.tableSubHeadingColor { - background-color: #EEEEFF; -} - -.altColor { - background-color: #EEEEEF; -} - -.rowColor { - background-color: #FFFFFF; -} - -.overviewSummary td,.packageSummary td,.contentContainer ul.blockList li.blockList td,.summary td,.classUseContainer td,.constantValuesContainer td - { - padding: 3px 3px 3px 7px; - text-align: left; -} - -th.colFirst,th.colLast,th.colOne,.constantValuesContainer th { - background: none repeat scroll 0 0 #DEE3E9; - border-bottom: 1px solid #9EADC0; - border-top: 1px solid #9EADC0; - padding: 3px 3px 3px 7px; - text-align: left; -} - -td.colOne a:link,td.colOne a:active,td.colOne a:visited,td.colOne a:hover,td.colFirst a:link,td.colFirst a:active,td.colFirst a:visited,td.colFirst a:hover,td.colLast a:link,td.colLast a:active,td.colLast a:visited,td.colLast a:hover,.constantValuesContainer td a:link,.constantValuesContainer td a:active,.constantValuesContainer td a:visited,.constantValuesContainer td a:hover - { - font-weight: bold; -} - -td.colFirst,th.colFirst { - border-left: 1px solid #9EADC0; - white-space: nowrap; -} - -td.colLast,th.colLast { - border-right: 1px solid #9EADC0; -} - -td.colOne,th.colOne { - border-left: 1px solid #9EADC0; - border-right: 1px solid #9EADC0; -} - -table.overviewSummary { - margin-left: 0; - padding: 0; -} - -table.overviewSummary td.colFirst,table.overviewSummary th.colFirst,table.overviewSummary td.colOne,table.overviewSummary th.colOne - { - vertical-align: middle; - width: 25%; -} - -table.packageSummary td.colFirst,table.overviewSummary th.colFirst { - vertical-align: middle; - width: 25%; -} - -.description pre { - margin-top: 0; -} - -.deprecatedContent { - margin: 0; - padding: 10px 0; -} - -.docSummary { - padding: 0; -} - -.sourceLineNo { - color: #008000; - padding: 0 30px 0 0; -} - -h1.hidden { - font-size: 0.9em; - overflow: hidden; - visibility: hidden; -} - -.block { - display: block; - margin: 3px 0 0; -} - -.strong { - font-weight: bold; -} diff --git a/phase4-spring-boot-demo/src/etc/license-template.txt b/phase4-spring-boot-demo/src/etc/license-template.txt deleted file mode 100644 index d61b4206f..000000000 --- a/phase4-spring-boot-demo/src/etc/license-template.txt +++ /dev/null @@ -1,14 +0,0 @@ -Copyright (C) 2021-2024 Philip Helger (www.helger.com) -philip[at]helger[dot]com - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. \ No newline at end of file diff --git a/phase4-spring-boot-demo/src/main/java/com/helger/phase4/springboot/Phase4SpringbootApplication.java b/phase4-spring-boot-demo/src/main/java/com/helger/phase4/springboot/Phase4SpringbootApplication.java deleted file mode 100644 index 4c179dd66..000000000 --- a/phase4-spring-boot-demo/src/main/java/com/helger/phase4/springboot/Phase4SpringbootApplication.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (C) 2021-2024 Philip Helger (www.helger.com) - * philip[at]helger[dot]com - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.helger.phase4.springboot; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; - -@SpringBootApplication -public class Phase4SpringbootApplication -{ - public static void main (final String [] args) - { - SpringApplication.run (Phase4SpringbootApplication.class, args); - } -} diff --git a/phase4-spring-boot-demo/src/main/java/com/helger/phase4/springboot/enumeration/ESBDHHandlerServiceSelector.java b/phase4-spring-boot-demo/src/main/java/com/helger/phase4/springboot/enumeration/ESBDHHandlerServiceSelector.java deleted file mode 100644 index a8860a98e..000000000 --- a/phase4-spring-boot-demo/src/main/java/com/helger/phase4/springboot/enumeration/ESBDHHandlerServiceSelector.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (C) 2021-2024 Philip Helger (www.helger.com) - * philip[at]helger[dot]com - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.helger.phase4.springboot.enumeration; - -import javax.annotation.Nonnull; - -import com.helger.commons.annotation.Nonempty; - -public enum ESBDHHandlerServiceSelector -{ - CUSTOM_PEPPOL_INCOMING (Constants.CUSTOM_PEPPOL_INCOMING_VALUE); - - public static class Constants - { - public static final String CUSTOM_PEPPOL_INCOMING_VALUE = "CustomPeppolIncomingSBDHandlerServiceImpl"; - } - - private final String m_sLabel; - - ESBDHHandlerServiceSelector (@Nonnull @Nonempty final String sLabel) - { - m_sLabel = sLabel; - } - - @Nonnull - @Nonempty - public String getLabel () - { - return m_sLabel; - } -} diff --git a/phase4-spring-boot-demo/src/main/java/com/helger/phase4/springboot/service/CustomPeppolIncomingSBDHandlerServiceImpl.java b/phase4-spring-boot-demo/src/main/java/com/helger/phase4/springboot/service/CustomPeppolIncomingSBDHandlerServiceImpl.java deleted file mode 100644 index 0d02c142e..000000000 --- a/phase4-spring-boot-demo/src/main/java/com/helger/phase4/springboot/service/CustomPeppolIncomingSBDHandlerServiceImpl.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright (C) 2021-2024 Philip Helger (www.helger.com) - * philip[at]helger[dot]com - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.helger.phase4.springboot.service; - -import javax.annotation.Nonnull; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.config.ConfigurableBeanFactory; -import org.springframework.context.annotation.Scope; -import org.springframework.stereotype.Service; -import org.unece.cefact.namespaces.sbdh.StandardBusinessDocument; - -import com.helger.commons.http.HttpHeaderMap; -import com.helger.peppol.sbdh.PeppolSBDHData; -import com.helger.phase4.ebms3header.Ebms3UserMessage; -import com.helger.phase4.incoming.IAS4IncomingMessageMetadata; -import com.helger.phase4.incoming.IAS4IncomingMessageState; -import com.helger.phase4.springboot.enumeration.ESBDHHandlerServiceSelector; - -@Scope (value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) -@Service (ESBDHHandlerServiceSelector.Constants.CUSTOM_PEPPOL_INCOMING_VALUE) -@SuppressWarnings ("unused") -public class CustomPeppolIncomingSBDHandlerServiceImpl implements ISBDHandlerService -{ - private static final Logger LOGGER = LoggerFactory.getLogger (CustomPeppolIncomingSBDHandlerServiceImpl.class); - - // Non-managed Spring fields - private IAS4IncomingMessageMetadata m_aMessageMetadata; - private HttpHeaderMap m_aHttpHeaders; - private Ebms3UserMessage m_aUserMessage; - private byte [] m_aStandardBusinessDocumentBytes; - private StandardBusinessDocument m_aStandardBusinessDocument; - private PeppolSBDHData m_aPeppolStandardBusinessDocumentHeader; - private IAS4IncomingMessageState m_aMessageState; - - // Managed Spring fields - - public CustomPeppolIncomingSBDHandlerServiceImpl () - {} - - public void setMessageMetadata (@Nonnull final IAS4IncomingMessageMetadata messageMetadata) - { - m_aMessageMetadata = messageMetadata; - } - - public void setHttpHeaders (@Nonnull final HttpHeaderMap httpHeaders) - { - m_aHttpHeaders = httpHeaders; - } - - public void setUserMessage (@Nonnull final Ebms3UserMessage userMessage) - { - m_aUserMessage = userMessage; - } - - public void setStandardBusinessDocumentBytes (@Nonnull final byte [] standardBusinessDocumentBytes) - { - m_aStandardBusinessDocumentBytes = standardBusinessDocumentBytes; - } - - public void setStandardBusinessDocument (@Nonnull final StandardBusinessDocument standardBusinessDocument) - { - m_aStandardBusinessDocument = standardBusinessDocument; - } - - public void setPeppolStandardBusinessDocumentHeader (@Nonnull final PeppolSBDHData peppolStandardBusinessDocumentHeader) - { - m_aPeppolStandardBusinessDocumentHeader = peppolStandardBusinessDocumentHeader; - } - - public void setMessageState (@Nonnull final IAS4IncomingMessageState messageState) - { - m_aMessageState = messageState; - } - - public void handle () throws Exception - { - // TODO Add your logic that leads to persisting the document in a database. - LOGGER.error ("The main 'handle' method needs to be implemented with something reasonable"); - } -} diff --git a/phase4-spring-boot-demo/src/main/java/com/helger/phase4/springboot/service/ISBDHandlerService.java b/phase4-spring-boot-demo/src/main/java/com/helger/phase4/springboot/service/ISBDHandlerService.java deleted file mode 100644 index 5a86e3ba5..000000000 --- a/phase4-spring-boot-demo/src/main/java/com/helger/phase4/springboot/service/ISBDHandlerService.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (C) 2021-2024 Philip Helger (www.helger.com) - * philip[at]helger[dot]com - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.helger.phase4.springboot.service; - -import javax.annotation.Nonnull; - -import org.springframework.stereotype.Service; -import org.unece.cefact.namespaces.sbdh.StandardBusinessDocument; - -import com.helger.commons.http.HttpHeaderMap; -import com.helger.peppol.sbdh.PeppolSBDHData; -import com.helger.phase4.ebms3header.Ebms3UserMessage; -import com.helger.phase4.incoming.IAS4IncomingMessageMetadata; -import com.helger.phase4.incoming.IAS4IncomingMessageState; - -@Service -public interface ISBDHandlerService -{ - void setMessageMetadata (@Nonnull IAS4IncomingMessageMetadata messageMetadata); - - void setHttpHeaders (@Nonnull HttpHeaderMap httpHeaders); - - void setUserMessage (@Nonnull Ebms3UserMessage userMessage); - - void setStandardBusinessDocument (@Nonnull StandardBusinessDocument standardBusinessDocument); - - void setStandardBusinessDocumentBytes (@Nonnull byte [] standardBusinessDocumentBytes); - - void setPeppolStandardBusinessDocumentHeader (@Nonnull PeppolSBDHData peppolStandardBusinessDocumentHeader); - - void setMessageState (@Nonnull IAS4IncomingMessageState messageState); - - void handle () throws Exception; -} diff --git a/phase4-spring-boot-demo/src/main/java/com/helger/phase4/springboot/service/SDBHandlerServiceLocator.java b/phase4-spring-boot-demo/src/main/java/com/helger/phase4/springboot/service/SDBHandlerServiceLocator.java deleted file mode 100644 index a1976641e..000000000 --- a/phase4-spring-boot-demo/src/main/java/com/helger/phase4/springboot/service/SDBHandlerServiceLocator.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (C) 2021-2024 Philip Helger (www.helger.com) - * philip[at]helger[dot]com - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.helger.phase4.springboot.service; - -import javax.annotation.Nonnull; - -import org.springframework.beans.BeansException; -import org.springframework.context.ApplicationContext; -import org.springframework.context.ApplicationContextAware; -import org.springframework.stereotype.Component; - -import com.helger.phase4.springboot.enumeration.ESBDHHandlerServiceSelector; - -@Component -public class SDBHandlerServiceLocator implements ApplicationContextAware -{ - private static ApplicationContext s_aAppContext; - - /** - * Returns the Spring managed bean instance of the given service if it exists. - * Returns null otherwise. - * - * @param selector - * Selector enum. May not be null. - * @return The desired service - */ - @Nonnull - public static ISBDHandlerService getService (@Nonnull final ESBDHHandlerServiceSelector selector) - { - return s_aAppContext.getBean (selector.getLabel (), ISBDHandlerService.class); - } - - @Override - public void setApplicationContext (@Nonnull final ApplicationContext aCtx) throws BeansException - { - // store ApplicationContext reference to access required beans later on - s_aAppContext = aCtx; - } -} diff --git a/phase4-spring-boot-demo/src/main/java/com/helger/phase4/springboot/servlet/ServletConfig.java b/phase4-spring-boot-demo/src/main/java/com/helger/phase4/springboot/servlet/ServletConfig.java deleted file mode 100644 index e1055ba26..000000000 --- a/phase4-spring-boot-demo/src/main/java/com/helger/phase4/springboot/servlet/ServletConfig.java +++ /dev/null @@ -1,322 +0,0 @@ -/* - * Copyright (C) 2021-2024 Philip Helger (www.helger.com) - * philip[at]helger[dot]com - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.helger.phase4.springboot.servlet; - -import java.io.File; -import java.security.KeyStore; -import java.security.cert.X509Certificate; - -import javax.annotation.Nonnull; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.slf4j.bridge.SLF4JBridgeHandler; -import org.springframework.boot.web.servlet.ServletRegistrationBean; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -import com.helger.commons.debug.GlobalDebug; -import com.helger.commons.exception.InitializationException; -import com.helger.commons.http.EHttpMethod; -import com.helger.commons.mime.CMimeType; -import com.helger.commons.state.ETriState; -import com.helger.commons.string.StringHelper; -import com.helger.commons.url.URLHelper; -import com.helger.httpclient.HttpDebugger; -import com.helger.peppol.utils.EPeppolCertificateCheckResult; -import com.helger.peppol.utils.PeppolCertificateChecker; -import com.helger.phase4.config.AS4Configuration; -import com.helger.phase4.crypto.AS4CryptoFactoryConfiguration; -import com.helger.phase4.crypto.IAS4CryptoFactory; -import com.helger.phase4.incoming.AS4IncomingProfileSelectorConstant; -import com.helger.phase4.incoming.AS4RequestHandler; -import com.helger.phase4.incoming.AS4ServerInitializer; -import com.helger.phase4.incoming.mgr.AS4ProfileSelector; -import com.helger.phase4.mgr.MetaAS4Manager; -import com.helger.phase4.peppol.servlet.Phase4PeppolDefaultReceiverConfiguration; -import com.helger.phase4.peppol.servlet.Phase4PeppolReceiverConfiguration; -import com.helger.phase4.peppol.servlet.Phase4PeppolServletMessageProcessorSPI; -import com.helger.phase4.profile.peppol.AS4PeppolProfileRegistarSPI; -import com.helger.phase4.profile.peppol.PeppolCRLDownloader; -import com.helger.phase4.profile.peppol.Phase4PeppolHttpClientSettings; -import com.helger.phase4.servlet.AS4UnifiedResponse; -import com.helger.phase4.servlet.AS4XServletHandler; -import com.helger.phase4.servlet.IAS4ServletRequestHandlerCustomizer; -import com.helger.photon.io.WebFileIO; -import com.helger.security.certificate.CertificateHelper; -import com.helger.servlet.ServletHelper; -import com.helger.smpclient.peppol.SMPClientReadOnly; -import com.helger.web.scope.IRequestWebScopeWithoutResponse; -import com.helger.web.scope.mgr.WebScopeManager; -import com.helger.xservlet.AbstractXServlet; -import com.helger.xservlet.requesttrack.RequestTrackerSettings; - -import jakarta.activation.CommandMap; -import jakarta.annotation.PreDestroy; -import jakarta.servlet.ServletContext; - -@Configuration -public class ServletConfig -{ - private static final Logger LOGGER = LoggerFactory.getLogger (ServletConfig.class); - - /** - * This method is a placeholder for retrieving a custom - * {@link IAS4CryptoFactory}. - * - * @return the {@link IAS4CryptoFactory} to use. May not be null. - */ - @Nonnull - public static IAS4CryptoFactory getCryptoFactoryToUse () - { - // If you have a custom crypto factory, build/return it here - return AS4CryptoFactoryConfiguration.getDefaultInstance (); - } - - public static class MyAS4Servlet extends AbstractXServlet - { - public MyAS4Servlet () - { - // Multipart is handled specifically inside - settings ().setMultipartEnabled (false); - final AS4XServletHandler hdl = new AS4XServletHandler (); - hdl.setRequestHandlerCustomizer (new IAS4ServletRequestHandlerCustomizer () - { - public void customizeBeforeHandling (@Nonnull final IRequestWebScopeWithoutResponse aRequestScope, - @Nonnull final AS4UnifiedResponse aUnifiedResponse, - @Nonnull final AS4RequestHandler aRequestHandler) - { - // This method refers to the outer static method - aRequestHandler.setCryptoFactory (ServletConfig.getCryptoFactoryToUse ()); - - // Example code to disable PMode validation - if (false) - { - // Note: API is for 3.0.0 only - aRequestHandler.setIncomingProfileSelector (new AS4IncomingProfileSelectorConstant (AS4PeppolProfileRegistarSPI.AS4_PROFILE_ID, - false)); - } - - // Example for changing the Peppol receiver data based on the source - // URL - if (false) - { - final String sUrl = aRequestScope.getURLDecoded (); - // The receiver check data you want to set - final Phase4PeppolReceiverConfiguration aReceiverCheckData; - if (sUrl != null && sUrl.startsWith ("https://ap-prod.example.org/as4")) - { - aReceiverCheckData = new Phase4PeppolReceiverConfiguration (true, - new SMPClientReadOnly (URLHelper.getAsURI ("http://smp-prod.example.org")), - Phase4PeppolDefaultReceiverConfiguration.DEFAULT_WILDCARD_SELECTION_MODE, - "https://ap-prod.example.org/as4", - CertificateHelper.convertStringToCertficateOrNull ("....Public Prod AP Cert...."), - Phase4PeppolDefaultReceiverConfiguration.isPerformSBDHValueChecks (), - Phase4PeppolDefaultReceiverConfiguration.isCheckSBDHForMandatoryCountryC1 (), - Phase4PeppolDefaultReceiverConfiguration.isCheckSigningCertificateRevocation ()); - } - else - { - aReceiverCheckData = new Phase4PeppolReceiverConfiguration (true, - new SMPClientReadOnly (URLHelper.getAsURI ("http://smp-test.example.org")), - Phase4PeppolDefaultReceiverConfiguration.DEFAULT_WILDCARD_SELECTION_MODE, - "https://ap-test.example.org/as4", - CertificateHelper.convertStringToCertficateOrNull ("....Public Test AP Cert...."), - Phase4PeppolDefaultReceiverConfiguration.isPerformSBDHValueChecks (), - Phase4PeppolDefaultReceiverConfiguration.isCheckSBDHForMandatoryCountryC1 (), - Phase4PeppolDefaultReceiverConfiguration.isCheckSigningCertificateRevocation ()); - } - - // Find the right SPI handler - aRequestHandler.getProcessorOfType (Phase4PeppolServletMessageProcessorSPI.class) - .setReceiverCheckData (aReceiverCheckData); - } - } - - public void customizeAfterHandling (@Nonnull final IRequestWebScopeWithoutResponse aRequestScope, - @Nonnull final AS4UnifiedResponse aUnifiedResponse, - @Nonnull final AS4RequestHandler aRequestHandler) - { - // empty - } - }); - - // HTTP POST only - handlerRegistry ().registerHandler (EHttpMethod.POST, hdl); - } - } - - @Bean - public ServletRegistrationBean servletRegistrationBean (final ServletContext ctx) - { - // Must be called BEFORE the servlet is instantiated - _init (ctx); - final ServletRegistrationBean bean = new ServletRegistrationBean <> (new MyAS4Servlet (), - true, - "/as4"); - bean.setLoadOnStartup (1); - return bean; - } - - private void _init (@Nonnull final ServletContext aSC) - { - // Do it only once - if (!WebScopeManager.isGlobalScopePresent ()) - { - WebScopeManager.onGlobalBegin (aSC); - _initGlobalSettings (aSC); - _initAS4 (); - _initPeppolAS4 (); - } - } - - private static void _initGlobalSettings (@Nonnull final ServletContext aSC) - { - // Logging: JUL to SLF4J - SLF4JBridgeHandler.removeHandlersForRootLogger (); - SLF4JBridgeHandler.install (); - - if (GlobalDebug.isDebugMode ()) - { - RequestTrackerSettings.setLongRunningRequestsCheckEnabled (false); - RequestTrackerSettings.setParallelRunningRequestsCheckEnabled (false); - } - - HttpDebugger.setEnabled (false); - - // Sanity check - if (CommandMap.getDefaultCommandMap ().createDataContentHandler (CMimeType.MULTIPART_RELATED.getAsString ()) == - null) - throw new IllegalStateException ("No DataContentHandler for MIME Type '" + - CMimeType.MULTIPART_RELATED.getAsString () + - "' is available. There seems to be a problem with the dependencies/packaging"); - - // Init the data path - { - // Get the ServletContext base path - final String sServletContextPath = ServletHelper.getServletContextBasePath (aSC); - // Get the data path - final String sDataPath = AS4Configuration.getDataPath (); - if (StringHelper.hasNoText (sDataPath)) - throw new InitializationException ("No data path was provided!"); - final boolean bFileAccessCheck = false; - // Init the IO layer - WebFileIO.initPaths (new File (sDataPath).getAbsoluteFile (), sServletContextPath, bFileAccessCheck); - } - } - - private static void _initAS4 () - { - // Enforce Peppol profile usage - AS4ProfileSelector.setCustomDefaultAS4ProfileID (AS4PeppolProfileRegistarSPI.AS4_PROFILE_ID); - - AS4ServerInitializer.initAS4Server (); - } - - private static void _initPeppolAS4 () - { - // Our server expects all SBDH to contain the COUNTRY_C1 element in SBDH - // (this is the default setting, but added it here for easy modification) - Phase4PeppolDefaultReceiverConfiguration.setCheckSBDHForMandatoryCountryC1 (true); - - // Our server should check all signing certificates of incoming messages - // if - // they are revoked or not - // (this is the default setting, but added it here for easy modification) - Phase4PeppolDefaultReceiverConfiguration.setCheckSigningCertificateRevocation (true); - - // Make sure the download of CRL is using Apache HttpClient and that the - // provided settings are used. If e.g. a proxy is needed to access - // outbound - // resources, it can be configured here - PeppolCRLDownloader.setAsDefaultCRLCache (new Phase4PeppolHttpClientSettings ()); - - // Throws an exception if configuration parameters are missing - final IAS4CryptoFactory aCF = getCryptoFactoryToUse (); - - // Check if crypto properties are okay - final KeyStore aKS = aCF.getKeyStore (); - if (aKS == null) - throw new InitializationException ("Failed to load configured AS4 Key store - fix the configuration"); - LOGGER.info ("Successfully loaded configured AS4 key store from the crypto factory"); - - final KeyStore.PrivateKeyEntry aPKE = aCF.getPrivateKeyEntry (); - if (aPKE == null) - throw new InitializationException ("Failed to load configured AS4 private key - fix the configuration"); - LOGGER.info ("Successfully loaded configured AS4 private key from the crypto factory"); - - // No OCSP check for performance - final X509Certificate aAPCert = (X509Certificate) aPKE.getCertificate (); - - // TODO This block SHOULD be uncommented once you have a Peppol - // certificate - if (false) - { - // Check that your Peppol AP certificate is valid - // * No caching - // * Use global certificate check mode - final EPeppolCertificateCheckResult eCheckResult = PeppolCertificateChecker.checkPeppolAPCertificate (aAPCert, - MetaAS4Manager.getTimestampMgr () - .getCurrentDateTime (), - ETriState.FALSE, - null); - if (eCheckResult.isInvalid ()) - throw new InitializationException ("The provided certificate is not a Peppol certificate. Check result: " + - eCheckResult); - LOGGER.info ("Sucessfully checked that the provided Peppol AP certificate is valid."); - } - - final String sSMPURL = AS4Configuration.getConfig ().getAsString ("smp.url"); - final String sAPURL = AS4Configuration.getThisEndpointAddress (); - if (StringHelper.hasText (sSMPURL) && StringHelper.hasText (sAPURL)) - { - // To process the message even though the receiver is not registered in - // our AP - Phase4PeppolDefaultReceiverConfiguration.setReceiverCheckEnabled (true); - Phase4PeppolDefaultReceiverConfiguration.setSMPClient (new SMPClientReadOnly (URLHelper.getAsURI (sSMPURL))); - Phase4PeppolDefaultReceiverConfiguration.setWildcardSelectionMode (Phase4PeppolDefaultReceiverConfiguration.DEFAULT_WILDCARD_SELECTION_MODE); - Phase4PeppolDefaultReceiverConfiguration.setAS4EndpointURL (sAPURL); - Phase4PeppolDefaultReceiverConfiguration.setAPCertificate (aAPCert); - LOGGER.info ("phase4 Peppol receiver checks are enabled"); - } - else - { - Phase4PeppolDefaultReceiverConfiguration.setReceiverCheckEnabled (false); - LOGGER.warn ("phase4 Peppol receiver checks are disabled"); - } - } - - private static final class Destroyer - { - @PreDestroy - public void destroy () - { - if (WebScopeManager.isGlobalScopePresent ()) - { - AS4ServerInitializer.shutdownAS4Server (); - WebFileIO.resetPaths (); - WebScopeManager.onGlobalEnd (); - } - } - } - - @Bean - public Destroyer destroyer () - { - return new Destroyer (); - } -} diff --git a/phase4-spring-boot-demo/src/main/java/com/helger/phase4/springboot/spi/CustomPeppolIncomingSBDHandlerSPI.java b/phase4-spring-boot-demo/src/main/java/com/helger/phase4/springboot/spi/CustomPeppolIncomingSBDHandlerSPI.java deleted file mode 100644 index 5cf97dbd6..000000000 --- a/phase4-spring-boot-demo/src/main/java/com/helger/phase4/springboot/spi/CustomPeppolIncomingSBDHandlerSPI.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (C) 2021-2024 Philip Helger (www.helger.com) - * philip[at]helger[dot]com - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.helger.phase4.springboot.spi; - -import javax.annotation.Nonnull; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.unece.cefact.namespaces.sbdh.StandardBusinessDocument; - -import com.helger.commons.annotation.IsSPIImplementation; -import com.helger.commons.collection.impl.ICommonsList; -import com.helger.commons.http.HttpHeaderMap; -import com.helger.peppol.sbdh.PeppolSBDHData; -import com.helger.phase4.ebms3header.Ebms3Error; -import com.helger.phase4.ebms3header.Ebms3UserMessage; -import com.helger.phase4.incoming.IAS4IncomingMessageMetadata; -import com.helger.phase4.incoming.IAS4IncomingMessageState; -import com.helger.phase4.peppol.servlet.IPhase4PeppolIncomingSBDHandlerSPI; -import com.helger.phase4.springboot.enumeration.ESBDHHandlerServiceSelector; -import com.helger.phase4.springboot.service.ISBDHandlerService; -import com.helger.phase4.springboot.service.SDBHandlerServiceLocator; - -/** - * This is one way of handling incoming messages: creating a domain object and - * passing it to a Spring Service object - * - * @author Philip Helger - */ -@IsSPIImplementation -public class CustomPeppolIncomingSBDHandlerSPI implements IPhase4PeppolIncomingSBDHandlerSPI -{ - private static final Logger LOGGER = LoggerFactory.getLogger (CustomPeppolIncomingSBDHandlerSPI.class); - - public void handleIncomingSBD (@Nonnull final IAS4IncomingMessageMetadata aMessageMetadata, - @Nonnull final HttpHeaderMap aHeaders, - @Nonnull final Ebms3UserMessage aUserMessage, - @Nonnull final byte [] aSBDBytes, - @Nonnull final StandardBusinessDocument aSBD, - @Nonnull final PeppolSBDHData aPeppolSBD, - @Nonnull final IAS4IncomingMessageState aState, - @Nonnull final ICommonsList aProcessingErrorMessages) throws Exception - { - // Get the service from the locator - LOGGER.info ("Retrieving the handler service."); - final ISBDHandlerService service = SDBHandlerServiceLocator.getService (ESBDHHandlerServiceSelector.CUSTOM_PEPPOL_INCOMING); - LOGGER.info ("Successfully retrieved the handler service."); - - // Inject the parameters into the service - LOGGER.info ("Injecting parameters into the handler service."); - service.setMessageMetadata (aMessageMetadata); - service.setHttpHeaders (aHeaders); - service.setUserMessage (aUserMessage); - service.setStandardBusinessDocumentBytes (aSBDBytes); - service.setStandardBusinessDocument (aSBD); - service.setPeppolStandardBusinessDocumentHeader (aPeppolSBD); - service.setMessageState (aState); - - // Handle the request, might raise an exception that needs to be dealt - // carefully - LOGGER.info ("Handling request."); - service.handle (); - LOGGER.info ("Request handled with success."); - } -} diff --git a/phase4-spring-boot-demo/src/main/java/com/helger/phase4/springboot/spi/CustomPeppolIncomingViaInterfaceSPI.java b/phase4-spring-boot-demo/src/main/java/com/helger/phase4/springboot/spi/CustomPeppolIncomingViaInterfaceSPI.java deleted file mode 100644 index b5f5b5733..000000000 --- a/phase4-spring-boot-demo/src/main/java/com/helger/phase4/springboot/spi/CustomPeppolIncomingViaInterfaceSPI.java +++ /dev/null @@ -1,147 +0,0 @@ -/* - * Copyright (C) 2021-2024 Philip Helger (www.helger.com) - * philip[at]helger[dot]com - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.helger.phase4.springboot.spi; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.unece.cefact.namespaces.sbdh.StandardBusinessDocument; - -import com.helger.commons.annotation.IsSPIImplementation; -import com.helger.commons.collection.impl.ICommonsList; -import com.helger.commons.http.HttpHeaderMap; -import com.helger.peppol.sbdh.PeppolSBDHData; -import com.helger.phase4.ebms3header.Ebms3Error; -import com.helger.phase4.ebms3header.Ebms3UserMessage; -import com.helger.phase4.incoming.IAS4IncomingMessageMetadata; -import com.helger.phase4.incoming.IAS4IncomingMessageState; -import com.helger.phase4.peppol.servlet.IPhase4PeppolIncomingSBDHandlerSPI; - -/** - * This is one way of handling incoming messages: have an interface - * {@link IPeppolIncomingHandler} that mimics the parameters of the - * {@link IPhase4PeppolIncomingSBDHandlerSPI} handling method. Use a static - * member of this class to set it. Each invocation of the SPI triggers a call to - * the registered handler.
- * Based on https://github.com/phax/phase4/discussions/115 - * - * @author Philip Helger - */ -@IsSPIImplementation -public class CustomPeppolIncomingViaInterfaceSPI implements IPhase4PeppolIncomingSBDHandlerSPI -{ - public interface IPeppolIncomingHandler - { - /** - * Handle the provided incoming StandardBusinessDocument - * - * @param aMessageMetadata - * Message metadata. Includes data when and from whom it was - * received. Never null. - * @param aHeaders - * The (HTTP) headers of the incoming request. Never - * null. - * @param aUserMessage - * The received EBMS user message. Never null. - * @param aSBDBytes - * The raw SBD bytes. Never null. - * @param aSBD - * The incoming parsed Standard Business Document that is never - * null. This is the pre-parsed SBD bytes. - * @param aPeppolSBD - * The pre-parsed Peppol Standard Business Document. Never - * null. - * @param aState - * The message state. Can e.g. be used to retrieve information about - * the certificate found in the message. Never null. - * @param aProcessingErrorMessages - * The list of error messages to be filled by the custom handler. - * Never null. Since v2.6.0. - * @throws Exception - * In case it cannot be processed. - */ - void handleIncomingSBD (@Nonnull IAS4IncomingMessageMetadata aMessageMetadata, - @Nonnull HttpHeaderMap aHeaders, - @Nonnull Ebms3UserMessage aUserMessage, - @Nonnull byte [] aSBDBytes, - @Nonnull StandardBusinessDocument aSBD, - @Nonnull PeppolSBDHData aPeppolSBD, - @Nonnull IAS4IncomingMessageState aState, - @Nonnull ICommonsList aProcessingErrorMessages) throws Exception; - } - - private static final Logger LOGGER = LoggerFactory.getLogger (CustomPeppolIncomingViaInterfaceSPI.class); - private static IPeppolIncomingHandler s_aHandler = null; - - /** - * @return The statically defined incoming handler. May be null. - * Is null by default. - */ - @Nullable - public static IPeppolIncomingHandler getIncomingHandler () - { - return s_aHandler; - } - - /** - * Call this method once on application startup. Should only be called once. - * - * @param aHandler - * The handler to be used. May be null but makes no sense. - */ - public static void setIncomingHandler (@Nullable final IPeppolIncomingHandler aHandler) - { - if (s_aHandler != null && aHandler != null) - LOGGER.warn ("Overwriting static handler for incoming Peppol messages"); - s_aHandler = aHandler; - } - - public void handleIncomingSBD (@Nonnull final IAS4IncomingMessageMetadata aMessageMetadata, - @Nonnull final HttpHeaderMap aHeaders, - @Nonnull final Ebms3UserMessage aUserMessage, - @Nonnull final byte [] aSBDBytes, - @Nonnull final StandardBusinessDocument aSBD, - @Nonnull final PeppolSBDHData aPeppolSBD, - @Nonnull final IAS4IncomingMessageState aState, - @Nonnull final ICommonsList aProcessingErrorMessages) throws Exception - { - if (s_aHandler != null) - { - LOGGER.info ("Invoking the registered handler"); - try - { - s_aHandler.handleIncomingSBD (aMessageMetadata, - aHeaders, - aUserMessage, - aSBDBytes, - aSBD, - aPeppolSBD, - aState, - aProcessingErrorMessages); - } - finally - { - // Also called in case of Exceptions - LOGGER.info ("Finished invoking the registered handler"); - } - } - else - LOGGER.error ("No handler is registered. Make sure to call 'setIncomingHandler' of this class on application startup"); - } -} diff --git a/phase4-spring-boot-demo/src/main/resources/LICENSE b/phase4-spring-boot-demo/src/main/resources/LICENSE deleted file mode 100644 index 8f71f43fe..000000000 --- a/phase4-spring-boot-demo/src/main/resources/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright {yyyy} {name of copyright owner} - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - diff --git a/phase4-spring-boot-demo/src/main/resources/META-INF/services/com.helger.phase4.peppol.servlet.IPhase4PeppolIncomingSBDHandlerSPI b/phase4-spring-boot-demo/src/main/resources/META-INF/services/com.helger.phase4.peppol.servlet.IPhase4PeppolIncomingSBDHandlerSPI deleted file mode 100644 index 1470c70e0..000000000 --- a/phase4-spring-boot-demo/src/main/resources/META-INF/services/com.helger.phase4.peppol.servlet.IPhase4PeppolIncomingSBDHandlerSPI +++ /dev/null @@ -1,2 +0,0 @@ -com.helger.phase4.springboot.spi.CustomPeppolIncomingSBDHandlerSPI -com.helger.phase4.springboot.spi.CustomPeppolIncomingViaInterfaceSPI diff --git a/phase4-spring-boot-demo/src/main/resources/NOTICE b/phase4-spring-boot-demo/src/main/resources/NOTICE deleted file mode 100644 index 110b217e8..000000000 --- a/phase4-spring-boot-demo/src/main/resources/NOTICE +++ /dev/null @@ -1,8 +0,0 @@ -============================================================================= -= NOTICE file corresponding to section 4d of the Apache License Version 2.0 = -============================================================================= -This product includes Open Source Software developed by -Philip Helger - https://www.helger.com/ - -This product includes Open Source Software developed by -Opensoft - https://www.opensoft.pt/ diff --git a/phase4-spring-boot-demo/src/main/resources/application.properties b/phase4-spring-boot-demo/src/main/resources/application.properties deleted file mode 100644 index 66ce61b5b..000000000 --- a/phase4-spring-boot-demo/src/main/resources/application.properties +++ /dev/null @@ -1,56 +0,0 @@ -# -# Copyright (C) 2021-2024 Philip Helger (www.helger.com) -# philip[at]helger[dot]com -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -global.debug=true -global.production=false -global.nostartupinfo=true -#global.datapath=/var/www/as4/data -global.datapath=generated/ - -phase4.endpoint.address=http://localhost:8080/as4 -#smp.url=http://smp.helger.com - -org.apache.wss4j.crypto.provider=org.apache.wss4j.common.crypto.Merlin -org.apache.wss4j.crypto.merlin.keystore.type=JKS -org.apache.wss4j.crypto.merlin.keystore.file=invalid-keystore-pw-peppol.jks -org.apache.wss4j.crypto.merlin.keystore.password=peppol -org.apache.wss4j.crypto.merlin.keystore.alias=1 -org.apache.wss4j.crypto.merlin.keystore.private.password=peppol -#org.apache.wss4j.crypto.merlin.load.cacerts=false -#org.apache.wss4j.crypto.merlin.truststore.provider= -org.apache.wss4j.crypto.merlin.truststore.type=JKS -org.apache.wss4j.crypto.merlin.truststore.file=truststore/complete-truststore.jks -org.apache.wss4j.crypto.merlin.truststore.password=peppol - -# SMP Client -smpclient.truststore.type=JKS -smpclient.truststore.path=truststore/complete-truststore.jks -smpclient.truststore.password=peppol - -# Outbound Proxy (if needed) -#http.proxy.host= -#http.proxy.port= -#http.proxy.nonProxyHosts - -# Spring Boot - /actuator/shutdown -management.endpoints.web.exposure.include=* -management.endpoint.shutdown.enabled=true -endpoints.shutdown.enabled=true - -# Max file size for large tests -spring.servlet.multipart.max-file-size=100MB -spring.servlet.multipart.max-request-size=100MB diff --git a/phase4-spring-boot-demo/src/main/resources/invalid-keystore-pw-peppol.jks b/phase4-spring-boot-demo/src/main/resources/invalid-keystore-pw-peppol.jks deleted file mode 100644 index f9401c89b..000000000 Binary files a/phase4-spring-boot-demo/src/main/resources/invalid-keystore-pw-peppol.jks and /dev/null differ diff --git a/phase4-spring-boot-demo/src/main/resources/log4j2.xml b/phase4-spring-boot-demo/src/main/resources/log4j2.xml deleted file mode 100644 index 3f176fb69..000000000 --- a/phase4-spring-boot-demo/src/main/resources/log4j2.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/phase4-spring-boot-demo/src/test/java/com/helger/phase4/springboot/Phase4SpringbootApplicationTests.java b/phase4-spring-boot-demo/src/test/java/com/helger/phase4/springboot/Phase4SpringbootApplicationTests.java deleted file mode 100644 index e9811ae8c..000000000 --- a/phase4-spring-boot-demo/src/test/java/com/helger/phase4/springboot/Phase4SpringbootApplicationTests.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2021-2024 Philip Helger (www.helger.com) - * philip[at]helger[dot]com - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.helger.phase4.springboot; - -import org.junit.jupiter.api.Test; -import org.springframework.boot.test.context.SpringBootTest; - -@SpringBootTest -class Phase4SpringbootApplicationTests -{ - @Test - void testContextLoads () - {} -} diff --git a/phase4-spring-boot-demo/src/test/java/com/helger/phase4/springboot/SPITest.java b/phase4-spring-boot-demo/src/test/java/com/helger/phase4/springboot/SPITest.java deleted file mode 100644 index 2bb036eda..000000000 --- a/phase4-spring-boot-demo/src/test/java/com/helger/phase4/springboot/SPITest.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (C) 2021-2024 Philip Helger (www.helger.com) - * philip[at]helger[dot]com - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.helger.phase4.springboot; - -import org.junit.jupiter.api.Test; - -import com.helger.commons.mock.SPITestHelper; - -/** - * Test SPI definitions - * - * @author Philip Helger - */ -public final class SPITest -{ - @Test - public void testBasic () throws Exception - { - SPITestHelper.testIfAllSPIImplementationsAreValid (); - } -} diff --git a/pom.xml b/pom.xml index f71ce551d..614fc7556 100644 --- a/pom.xml +++ b/pom.xml @@ -85,7 +85,6 @@ 10.1.9 10.0.2 3.2.1 - 3.3.5 @@ -316,69 +315,29 @@ - - - java11-16 - - [11,17) - - - phase4-lib - phase4-profile-bdew - phase4-profile-cef - phase4-profile-dbnalliance - phase4-profile-eespa - phase4-profile-entsog - phase4-profile-euctp - phase4-profile-peppol - phase4-test - phase4-server-webapp - phase4-dynamic-discovery - - phase4-bdew-client - phase4-cef-client - phase4-dbnalliance-client - phase4-entsog-client - phase4-euctp-client - phase4-eudamed-client - phase4-peppol-client - phase4-peppol-servlet - phase4-peppol-server-webapp - - - - - java17+ - - [17,) - - - phase4-lib - phase4-profile-bdew - phase4-profile-cef - phase4-profile-dbnalliance - phase4-profile-eespa - phase4-profile-entsog - phase4-profile-euctp - phase4-profile-peppol - phase4-test - phase4-server-webapp - phase4-dynamic-discovery - - phase4-bdew-client - phase4-cef-client - phase4-dbnalliance-client - phase4-entsog-client - phase4-euctp-client - phase4-eudamed-client - phase4-peppol-client - phase4-peppol-servlet - phase4-peppol-server-webapp - - phase4-spring-boot-demo - - - + + phase4-lib + phase4-profile-bdew + phase4-profile-cef + phase4-profile-dbnalliance + phase4-profile-eespa + phase4-profile-entsog + phase4-profile-euctp + phase4-profile-peppol + phase4-test + phase4-server-webapp + phase4-dynamic-discovery + + phase4-bdew-client + phase4-cef-client + phase4-dbnalliance-client + phase4-entsog-client + phase4-euctp-client + phase4-eudamed-client + phase4-peppol-client + phase4-peppol-servlet + phase4-peppol-server-webapp +