├── .github └── workflows │ └── maven.yml ├── .gitignore ├── CODE_OF_CONDUCT.md ├── Dockerfile ├── LICENSE.txt ├── README.md ├── docker-build.sh ├── phoss-directory-client ├── findbugs-exclude.xml ├── pom.xml └── src │ ├── etc │ ├── javadoc.css │ └── license-template.txt │ ├── main │ ├── java │ │ └── com │ │ │ └── helger │ │ │ └── pd │ │ │ └── client │ │ │ ├── IPDClientExceptionCallback.java │ │ │ ├── PDClient.java │ │ │ ├── PDClientConfiguration.java │ │ │ ├── PDClientResponseHandler.java │ │ │ └── PDHttpClientSettings.java │ └── resources │ │ ├── LICENSE │ │ └── NOTICE │ └── test │ ├── java │ └── com │ │ └── helger │ │ └── pd │ │ └── client │ │ ├── PDClientTest.java │ │ └── SPITest.java │ └── resources │ └── application.properties ├── phoss-directory-indexer ├── findbugs-exclude.xml ├── pom.xml └── src │ ├── etc │ ├── javadoc.css │ └── license-template.txt │ ├── main │ ├── java │ │ └── com │ │ │ └── helger │ │ │ └── pd │ │ │ └── indexer │ │ │ ├── CDirectoryVersion.java │ │ │ ├── businesscard │ │ │ ├── IPDBusinessCardProvider.java │ │ │ ├── PDExtendedBusinessCard.java │ │ │ ├── PDSMPHttpResponseHandlerBusinessCard.java │ │ │ └── SMPBusinessCardProvider.java │ │ │ ├── clientcert │ │ │ ├── ClientCertificateValidationResult.java │ │ │ └── ClientCertificateValidator.java │ │ │ ├── config │ │ │ └── IndexerMicroTypeConverterRegistrar.java │ │ │ ├── index │ │ │ ├── EIndexerWorkItemType.java │ │ │ ├── IIndexerWorkItem.java │ │ │ ├── IndexerWorkItem.java │ │ │ ├── IndexerWorkItemMicroTypeConverter.java │ │ │ └── IndexerWorkItemQueue.java │ │ │ ├── job │ │ │ └── ReIndexJob.java │ │ │ ├── lucene │ │ │ ├── AllDocumentsCollector.java │ │ │ ├── ILuceneAnalyzerProvider.java │ │ │ ├── ILuceneDocumentProvider.java │ │ │ └── PDLucene.java │ │ │ ├── mgr │ │ │ ├── IPDStorageManager.java │ │ │ ├── PDIndexExecutor.java │ │ │ ├── PDIndexerManager.java │ │ │ └── PDMetaManager.java │ │ │ ├── reindex │ │ │ ├── IReIndexWorkItem.java │ │ │ ├── IReIndexWorkItemList.java │ │ │ ├── ReIndexWorkItem.java │ │ │ ├── ReIndexWorkItemList.java │ │ │ └── ReIndexWorkItemMicroTypeConverter.java │ │ │ ├── rest │ │ │ └── IndexerResource.java │ │ │ ├── settings │ │ │ ├── PDConfiguredTrustStore.java │ │ │ └── PDServerConfiguration.java │ │ │ └── storage │ │ │ ├── CPDStorage.java │ │ │ ├── PDQueryManager.java │ │ │ ├── PDStorageManager.java │ │ │ ├── PDStoredBusinessEntity.java │ │ │ ├── PDStoredContact.java │ │ │ ├── PDStoredIdentifier.java │ │ │ ├── PDStoredMLName.java │ │ │ ├── PDStoredMetaData.java │ │ │ └── field │ │ │ ├── AbstractPDField.java │ │ │ ├── EPDStringFieldTokenize.java │ │ │ ├── PDField.java │ │ │ ├── PDNumericField.java │ │ │ └── PDStringField.java │ └── resources │ │ ├── LICENSE │ │ ├── META-INF │ │ └── services │ │ │ └── com.helger.xml.microdom.convert.IMicroTypeConverterRegistrarSPI │ │ ├── NOTICE │ │ └── phoss-directory-version.properties │ └── test │ ├── java │ └── com │ │ └── helger │ │ └── pd │ │ └── indexer │ │ ├── CDirectoryVersionTest.java │ │ ├── PDIndexerTestRule.java │ │ ├── SPITest.java │ │ ├── businesscard │ │ └── SMPBusinessCardProviderTest.java │ │ ├── lucene │ │ ├── PDLuceneTest.java │ │ └── QueryParserFuncTest.java │ │ ├── rest │ │ ├── IndexerResourceTest.java │ │ ├── LocalHost8080FuncTest.java │ │ └── MockServer.java │ │ ├── settings │ │ └── PDServerConfigurationTest.java │ │ └── storage │ │ ├── PDDocumentMetaDataTest.java │ │ └── PDStorageManagerTest.java │ └── resources │ ├── 00readme.txt │ ├── pd.properties │ ├── simplelogger.properties │ └── test-https-keystore.jks ├── phoss-directory-publisher ├── docs │ └── de4a │ │ ├── de4alogo-128-88.png │ │ └── favicon-pack.zip ├── findbugs-exclude.xml ├── pom.xml └── src │ ├── etc │ ├── javadoc.css │ └── license-template.txt │ ├── main │ ├── java │ │ └── com │ │ │ └── helger │ │ │ └── pd │ │ │ └── publisher │ │ │ ├── CPDPublisher.java │ │ │ ├── EPDSMLMode.java │ │ │ ├── ajax │ │ │ ├── AjaxExecutorPublicLogin.java │ │ │ └── CAjax.java │ │ │ ├── app │ │ │ ├── AppCommonUI.java │ │ │ ├── AppInternalErrorHandler.java │ │ │ ├── AppSecurity.java │ │ │ ├── ISMLInfoManager.java │ │ │ ├── PDLoginManager.java │ │ │ ├── PDPMetaManager.java │ │ │ ├── PDSessionSingleton.java │ │ │ ├── SMLInfoManager.java │ │ │ ├── pub │ │ │ │ ├── AbstractPagePublicSearch.java │ │ │ │ ├── CMenuPublic.java │ │ │ │ ├── CaptchaSessionSingleton.java │ │ │ │ ├── MenuPublic.java │ │ │ │ ├── PagePublicContact.java │ │ │ │ ├── PagePublicSearchExtended.java │ │ │ │ ├── PagePublicSearchSimple.java │ │ │ │ └── PublicHTMLProvider.java │ │ │ └── secure │ │ │ │ ├── AbstractPageSecureReIndex.java │ │ │ │ ├── CMenuSecure.java │ │ │ │ ├── MenuSecure.java │ │ │ │ ├── PageSecureAdminLuceneInformation.java │ │ │ │ ├── PageSecureAdminSMLConfiguration.java │ │ │ │ ├── PageSecureDeleteManually.java │ │ │ │ ├── PageSecureIndexImport.java │ │ │ │ ├── PageSecureIndexManually.java │ │ │ │ ├── PageSecureListDeadIndex.java │ │ │ │ ├── PageSecureListIndex.java │ │ │ │ ├── PageSecureListReIndex.java │ │ │ │ ├── PageSecureParticipantActions.java │ │ │ │ ├── PageSecureParticipantCount.java │ │ │ │ ├── PageSecureParticipantList.java │ │ │ │ └── SecureHTMLProvider.java │ │ │ ├── exportall │ │ │ ├── ExportAllDataJob.java │ │ │ ├── ExportAllManager.java │ │ │ └── ExportHelper.java │ │ │ ├── nicename │ │ │ ├── NiceNameEntry.java │ │ │ ├── NiceNameHandler.java │ │ │ └── NiceNameUI.java │ │ │ ├── search │ │ │ ├── EPDOutputFormat.java │ │ │ ├── EPDSearchField.java │ │ │ ├── EPDSearchFieldName.java │ │ │ ├── ESearchDataType.java │ │ │ ├── ESearchOperator.java │ │ │ ├── ESearchOperatorText.java │ │ │ ├── SearchMatcher.java │ │ │ └── SearchRateLimit.java │ │ │ ├── servlet │ │ │ ├── AppRootServlet.java │ │ │ ├── AppWebAppListener.java │ │ │ ├── ExportDeliveryHttpHandler.java │ │ │ ├── ExportServlet.java │ │ │ ├── PublicApplicationServlet.java │ │ │ ├── PublicParticipantServlet.java │ │ │ ├── PublicParticipantXServletHandler.java │ │ │ ├── PublicSearchServlet.java │ │ │ ├── PublicSearchXServletHandler.java │ │ │ ├── SecureApplicationServlet.java │ │ │ └── SecureLoginFilter.java │ │ │ ├── ui │ │ │ ├── AbstractAppWebPage.java │ │ │ ├── AbstractAppWebPageForm.java │ │ │ ├── AppPageViewExternal.java │ │ │ ├── HCSearchOperatorSelect.java │ │ │ └── PDCommonUI.java │ │ │ └── updater │ │ │ └── SyncAllBusinessCardsJob.java │ ├── resources │ │ ├── LICENSE │ │ ├── NOTICE │ │ ├── application.properties │ │ ├── codelists │ │ │ └── directory │ │ │ │ ├── doctypeid-mapping.xml │ │ │ │ └── processid-mapping.xml │ │ ├── html │ │ │ ├── css.xml │ │ │ ├── js.xml │ │ │ └── metatags.xml │ │ ├── log4j2-prod.xml │ │ ├── log4j2-testing.xml │ │ ├── log4j2.xml │ │ ├── pd.de4a.properties │ │ ├── pd.dev.properties │ │ ├── pd.peppol-prod.properties │ │ ├── pd.peppol-test.properties │ │ ├── pd.properties │ │ ├── pd.toop4eu.properties │ │ └── viewpages │ │ │ └── en │ │ │ ├── about.xml │ │ │ ├── docs_export_all.xml │ │ │ ├── docs_how_to.xml │ │ │ ├── docs_introduction.xml │ │ │ └── docs_rest_api.xml │ └── webapp │ │ ├── WEB-INF │ │ └── web.xml │ │ ├── css │ │ ├── default.css │ │ └── default.min.css │ │ ├── favicon.ico │ │ ├── files │ │ ├── OpenPEPPOL Directory for SMP providers 2016-12-05.pdf │ │ ├── PEPPOL-EDN-Directory-1.1.1-2020-10-15.pdf │ │ ├── directory-export-v1.xsd │ │ ├── directory-export-v2.xsd │ │ └── directory-search-result-list-v1.xsd │ │ ├── google9aa227895f65ee21.html │ │ ├── imgs │ │ ├── de4a │ │ │ ├── de4a-small-158-50.png │ │ │ ├── favicon-16x16.png │ │ │ ├── favicon-32x32.png │ │ │ └── favicon-96x96.png │ │ ├── peppol │ │ │ ├── favicon-16x16.png │ │ │ ├── favicon-32x32.png │ │ │ ├── favicon-96x96.png │ │ │ ├── peppol-small-204-50.png │ │ │ └── peppol.png │ │ └── toop │ │ │ ├── favicon-16x16.png │ │ │ ├── favicon-32x32.png │ │ │ ├── favicon-96x96.png │ │ │ ├── toop-directory.png │ │ │ └── toop-small-144-50.png │ │ └── js │ │ ├── default.js │ │ └── default.min.js │ └── test │ ├── java │ └── com │ │ └── helger │ │ └── pd │ │ └── publisher │ │ ├── SPITest.java │ │ ├── jetty │ │ ├── JettyStopPD.java │ │ └── RunInJettyPD.java │ │ ├── search │ │ ├── SearchMatcherTest.java │ │ └── SearchRateLimitTest.java │ │ └── servlet │ │ └── PublicSearchXServletHandlerTest.java │ └── resources │ └── .gitignore ├── phoss-directory-searchapi ├── findbugs-exclude.xml ├── pom.xml └── src │ ├── etc │ ├── javadoc.css │ └── license-template.txt │ ├── main │ ├── java │ │ └── com │ │ │ └── helger │ │ │ └── pd │ │ │ └── searchapi │ │ │ ├── CPDSearchAPI.java │ │ │ ├── EPDSearchAPIDocumentType.java │ │ │ ├── PDResultListMarshaller.java │ │ │ ├── PDSearchAPIReader.java │ │ │ ├── PDSearchAPIValidator.java │ │ │ └── PDSearchAPIWriter.java │ ├── jaxb │ │ └── v1.xjb │ └── resources │ │ ├── LICENSE │ │ ├── NOTICE │ │ └── schemas │ │ └── directory-search-result-list-v1.xsd │ └── test │ ├── java │ └── com │ │ └── helger │ │ └── pd │ │ └── searchapi │ │ ├── CPDSearchAPITest.java │ │ ├── PDResultListMarshallerTest.java │ │ └── SPITest.java │ └── resources │ ├── .gitignore │ └── external │ └── test-xml │ └── good │ └── test1.xml ├── pom.xml └── src └── etc └── license-template.txt /.github/workflows/maven.yml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2015-2022 Philip Helger (www.helger.com) 3 | # philip[at]helger[dot]com 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | name: Maven build 19 | 20 | on: 21 | push: 22 | branches: 23 | - master 24 | 25 | jobs: 26 | build: 27 | runs-on: ubuntu-latest 28 | strategy: 29 | matrix: 30 | java: [ '11', '17', '21' ] 31 | name: Java ${{ matrix.Java }} build 32 | 33 | steps: 34 | - uses: actions/checkout@v4 35 | - name: Set up JDK ${{ matrix.Java }} 36 | uses: actions/setup-java@v4 37 | with: 38 | java-version: ${{ matrix.Java }} 39 | distribution: 'adopt' 40 | server-id: ossrh 41 | server-username: MAVEN_USERNAME 42 | server-password: MAVEN_PASSWORD 43 | 44 | - name: Cache local Maven repository 45 | uses: actions/cache@v4 46 | with: 47 | path: ~/.m2/repository 48 | key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} 49 | restore-keys: | 50 | ${{ runner.os }}-maven- 51 | 52 | - name: Build and deploy with Maven 53 | run: mvn --batch-mode --update-snapshots deploy 54 | if: matrix.Java == 11 55 | env: 56 | MAVEN_USERNAME: ${{ secrets.SONATYPE_USERNAME }} 57 | MAVEN_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} 58 | 59 | - name: Maven Build 60 | run: mvn --batch-mode --update-snapshots install 61 | if: matrix.Java != 11 62 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | target/ 2 | .settings/ 3 | generated/ 4 | 5 | *.iml 6 | *.jks 7 | private-*.properties 8 | 9 | .project 10 | .classpath 11 | .factorypath 12 | zz 13 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. 6 | 7 | ## Our Standards 8 | 9 | Examples of behavior that contributes to creating a positive environment include: 10 | 11 | * Using welcoming and inclusive language 12 | * Being respectful of differing viewpoints and experiences 13 | * Gracefully accepting constructive criticism 14 | * Focusing on what is best for the community 15 | * Showing empathy towards other community members 16 | 17 | Examples of unacceptable behavior by participants include: 18 | 19 | * The use of sexualized language or imagery and unwelcome sexual attention or advances 20 | * Trolling, insulting/derogatory comments, and personal or political attacks 21 | * Public or private harassment 22 | * Publishing others' private information, such as a physical or electronic address, without explicit permission 23 | * Other conduct which could reasonably be considered inappropriate in a professional setting 24 | 25 | ## Our Responsibilities 26 | 27 | Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. 28 | 29 | Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. 30 | 31 | ## Scope 32 | 33 | This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. 34 | 35 | ## Enforcement 36 | 37 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at codeofconduct@helger.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. 38 | 39 | Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. 40 | 41 | ## Attribution 42 | 43 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] 44 | 45 | [homepage]: http://contributor-covenant.org 46 | [version]: http://contributor-covenant.org/version/1/4/ 47 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2015-2025 Philip Helger (www.helger.com) 3 | # philip[at]helger[dot]com 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | FROM tomcat:10-jdk11 19 | 20 | ARG VERSION="0.13.1" 21 | ARG WAR_NAME=phoss-directory-publisher-${VERSION}.war 22 | 23 | WORKDIR $CATALINA_HOME/webapps 24 | 25 | ENV CATALINS_OPTS="$CATALINA_OPTS -Djava.security.egd=file:/dev/urandom" 26 | 27 | RUN wget -O ${WAR_NAME} https://github.com/phax/phoss-directory/releases/download/phoss-directory-parent-pom-${VERSION}/${WAR_NAME} 28 | 29 | RUN unzip ${WAR_NAME} -d ROOT && \ 30 | rm -rf ${WAR_NAME} 31 | -------------------------------------------------------------------------------- /docker-build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright (C) 2015-2025 Philip Helger (www.helger.com) 4 | # philip[at]helger[dot]com 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | 20 | 21 | version=0.9.9 22 | docker build --build-arg VERSION=$version -t phelger/phoss-directory-publisher:$version . 23 | docker tag phelger/phoss-directory-publisher:$version phelger/phoss-directory-publisher:latest 24 | docker push phelger/phoss-directory-publisher:latest 25 | 26 | -------------------------------------------------------------------------------- /phoss-directory-client/findbugs-exclude.xml: -------------------------------------------------------------------------------- 1 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /phoss-directory-client/src/etc/license-template.txt: -------------------------------------------------------------------------------- 1 | Copyright (C) 2015-2025 Philip Helger (www.helger.com) 2 | philip[at]helger[dot]com 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. -------------------------------------------------------------------------------- /phoss-directory-client/src/main/java/com/helger/pd/client/IPDClientExceptionCallback.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.pd.client; 18 | 19 | import javax.annotation.Nonnull; 20 | 21 | import com.helger.commons.callback.ICallback; 22 | import com.helger.peppolid.IParticipantIdentifier; 23 | 24 | /** 25 | * Special exception callback interface for the Peppol Directory client. 26 | * 27 | * @author Philip Helger 28 | * @since 0.5.1 29 | */ 30 | @FunctionalInterface 31 | public interface IPDClientExceptionCallback extends ICallback 32 | { 33 | /** 34 | * Called for every exception in HTTP calls. 35 | * 36 | * @param aParticipantID 37 | * The participant for which the PD should be invoked. 38 | * @param sContext 39 | * The context in which the exception occurred. May neither be 40 | * null nor empty. 41 | * @param aException 42 | * The exception that occurred. May not be null. 43 | */ 44 | void onException (@Nonnull IParticipantIdentifier aParticipantID, @Nonnull String sContext, @Nonnull Throwable aException); 45 | } 46 | -------------------------------------------------------------------------------- /phoss-directory-client/src/main/java/com/helger/pd/client/PDClientResponseHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.pd.client; 18 | 19 | import java.io.IOException; 20 | import java.nio.charset.Charset; 21 | import java.nio.charset.StandardCharsets; 22 | 23 | import javax.annotation.Nonnull; 24 | import javax.annotation.Nullable; 25 | 26 | import org.apache.hc.client5.http.ClientProtocolException; 27 | import org.apache.hc.client5.http.HttpResponseException; 28 | import org.apache.hc.core5.http.ClassicHttpResponse; 29 | import org.apache.hc.core5.http.ContentType; 30 | import org.apache.hc.core5.http.HttpEntity; 31 | import org.apache.hc.core5.http.io.HttpClientResponseHandler; 32 | 33 | import com.helger.commons.state.ESuccess; 34 | import com.helger.httpclient.HttpClientHelper; 35 | 36 | /** 37 | * Special response handler for PD client 38 | * 39 | * @author Philip Helger 40 | */ 41 | public class PDClientResponseHandler implements HttpClientResponseHandler 42 | { 43 | public PDClientResponseHandler () 44 | {} 45 | 46 | @Nullable 47 | public ESuccess handleResponse (@Nonnull final ClassicHttpResponse aHttpResponse) throws ClientProtocolException, 48 | IOException 49 | { 50 | // Check result 51 | if (aHttpResponse.getCode () >= 200 && aHttpResponse.getCode () < 300) 52 | return ESuccess.SUCCESS; 53 | 54 | // Not found 55 | if (aHttpResponse.getCode () == 404) 56 | return ESuccess.FAILURE; 57 | 58 | // Unexpected 59 | final HttpEntity aEntity = aHttpResponse.getEntity (); 60 | String sContent = null; 61 | if (aEntity != null) 62 | { 63 | final ContentType aContentType = HttpClientHelper.getContentTypeOrDefault (aEntity, ContentType.DEFAULT_TEXT); 64 | 65 | // Default to UTF-8 internally 66 | Charset aCharset = aContentType.getCharset (); 67 | if (aCharset == null) 68 | aCharset = StandardCharsets.UTF_8; 69 | 70 | sContent = HttpClientHelper.entityToString (aEntity, aCharset); 71 | } 72 | 73 | String sMessage = aHttpResponse.getReasonPhrase () + " [" + aHttpResponse.getCode () + "]"; 74 | if (sContent != null) 75 | sMessage += "\nResponse content: " + sContent; 76 | throw new HttpResponseException (aHttpResponse.getCode (), sMessage); 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /phoss-directory-client/src/main/resources/NOTICE: -------------------------------------------------------------------------------- 1 | ============================================================================= 2 | = NOTICE file corresponding to section 4d of the Apache License Version 2.0 = 3 | ============================================================================= 4 | This product includes Open Source Software developed by 5 | Philip Helger - https://www.helger.com/ 6 | -------------------------------------------------------------------------------- /phoss-directory-client/src/test/java/com/helger/pd/client/PDClientTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.pd.client; 18 | 19 | import org.junit.Ignore; 20 | import org.junit.Test; 21 | import org.slf4j.Logger; 22 | import org.slf4j.LoggerFactory; 23 | 24 | import com.helger.commons.exception.InitializationException; 25 | import com.helger.peppolid.IParticipantIdentifier; 26 | import com.helger.peppolid.factory.PeppolIdentifierFactory; 27 | 28 | /** 29 | * Test class for class {@link PDClient}. 30 | * 31 | * @author Philip Helger 32 | */ 33 | public final class PDClientTest 34 | { 35 | private static final Logger LOGGER = LoggerFactory.getLogger (PDClientTest.class); 36 | 37 | @Test 38 | @Ignore ("Avoid long connection timeout") 39 | public void testNonExistingPort () 40 | { 41 | final IParticipantIdentifier aPI = PeppolIdentifierFactory.INSTANCE.createParticipantIdentifierWithDefaultScheme ("9915:test"); 42 | try (final PDClient aClient = new PDClient ("http://193.10.8.211:7999")) 43 | { 44 | if (aClient.deleteServiceGroupFromIndex (aPI).isSuccess ()) 45 | { 46 | aClient.isServiceGroupRegistered (aPI); 47 | aClient.addServiceGroupToIndex (aPI); 48 | } 49 | } 50 | catch (final InitializationException ex) 51 | { 52 | LOGGER.error ("Failed to invoke PDClient", ex); 53 | } 54 | } 55 | 56 | @Test 57 | public void testTestServer () 58 | { 59 | final IParticipantIdentifier aPI = PeppolIdentifierFactory.INSTANCE.createParticipantIdentifierWithDefaultScheme ("9915:test"); 60 | try (final PDClient aClient = new PDClient ("https://test-directory.peppol.eu")) 61 | { 62 | if (aClient.deleteServiceGroupFromIndex (aPI).isSuccess ()) 63 | { 64 | aClient.isServiceGroupRegistered (aPI); 65 | aClient.addServiceGroupToIndex (aPI); 66 | } 67 | } 68 | catch (final InitializationException ex) 69 | { 70 | LOGGER.error ("Failed to invoke PDClient", ex); 71 | } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /phoss-directory-client/src/test/java/com/helger/pd/client/SPITest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.pd.client; 18 | 19 | import org.junit.Test; 20 | 21 | import com.helger.commons.mock.SPITestHelper; 22 | 23 | /** 24 | * Test SPI definitions 25 | * 26 | * @author Philip Helger 27 | */ 28 | public final class SPITest 29 | { 30 | @Test 31 | public void testBasic () throws Exception 32 | { 33 | SPITestHelper.testIfAllSPIImplementationsAreValid (); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /phoss-directory-client/src/test/resources/application.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2015-2025 Philip Helger (www.helger.com) 3 | # philip[at]helger[dot]com 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | # Key store with SMP key (required) 19 | keystore.path = smp.pilot.jks 20 | keystore.password = peppol 21 | keystore.key.alias = smp.pilot 22 | keystore.key.password = peppol 23 | 24 | # Default trust store (optional) 25 | truststore.path = truststore/complete.jks 26 | truststore.password = peppol 27 | 28 | # TLS settings 29 | # Must be disabled for https://test-directory.peppol.eu and https://directory.peppol.eu 30 | https.hostname-verification.disabled = true 31 | 32 | # Connection timeout in milliseconds; default is 5000 33 | # connect.timeout.ms = 5000 34 | 35 | # Request timeout in milliseconds; default is 10000 36 | # request.timeout.ms = 10000 37 | -------------------------------------------------------------------------------- /phoss-directory-indexer/findbugs-exclude.xml: -------------------------------------------------------------------------------- 1 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /phoss-directory-indexer/src/etc/license-template.txt: -------------------------------------------------------------------------------- 1 | Copyright (C) 2015-2025 Philip Helger (www.helger.com) 2 | philip[at]helger[dot]com 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. -------------------------------------------------------------------------------- /phoss-directory-indexer/src/main/java/com/helger/pd/indexer/CDirectoryVersion.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.pd.indexer; 18 | 19 | import javax.annotation.concurrent.Immutable; 20 | 21 | import org.slf4j.Logger; 22 | import org.slf4j.LoggerFactory; 23 | 24 | import com.helger.commons.collection.impl.ICommonsMap; 25 | import com.helger.commons.io.resource.ClassPathResource; 26 | import com.helger.commons.lang.PropertiesHelper; 27 | 28 | /** 29 | * Contains application wide constants. 30 | * 31 | * @author Philip Helger 32 | */ 33 | @Immutable 34 | public final class CDirectoryVersion 35 | { 36 | /** Current version - from properties file */ 37 | public static final String BUILD_VERSION; 38 | /** Build timestamp - from properties file */ 39 | public static final String BUILD_TIMESTAMP; 40 | 41 | private static final Logger LOGGER = LoggerFactory.getLogger (CDirectoryVersion.class); 42 | 43 | static 44 | { 45 | String sProjectVersion = null; 46 | String sProjectTimestamp = null; 47 | final ICommonsMap p = PropertiesHelper.loadProperties (new ClassPathResource ("phoss-directory-version.properties")); 48 | if (p != null) 49 | { 50 | sProjectVersion = p.get ("version"); 51 | sProjectTimestamp = p.get ("timestamp"); 52 | } 53 | if (sProjectVersion == null) 54 | { 55 | sProjectVersion = "undefined"; 56 | LOGGER.warn ("Failed to load version number"); 57 | } 58 | BUILD_VERSION = sProjectVersion; 59 | if (sProjectTimestamp == null) 60 | { 61 | sProjectTimestamp = "undefined"; 62 | LOGGER.warn ("Failed to load timestamp"); 63 | } 64 | BUILD_TIMESTAMP = sProjectTimestamp; 65 | } 66 | 67 | private CDirectoryVersion () 68 | {} 69 | } 70 | -------------------------------------------------------------------------------- /phoss-directory-indexer/src/main/java/com/helger/pd/indexer/businesscard/IPDBusinessCardProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.pd.indexer.businesscard; 18 | 19 | import javax.annotation.Nonnull; 20 | import javax.annotation.Nullable; 21 | 22 | import com.helger.peppolid.IParticipantIdentifier; 23 | 24 | /** 25 | * Abstract interface to retrieve the {@link PDExtendedBusinessCard} from a 26 | * provided Peppol participant ID. By default an SMP /businesscard 27 | * API is queried. Nevertheless for testing purposes it may be possible to 28 | * provide mock data. 29 | * 30 | * @author Philip Helger 31 | */ 32 | @FunctionalInterface 33 | public interface IPDBusinessCardProvider 34 | { 35 | /** 36 | * Get the {@link PDExtendedBusinessCard} for the given participant ID. 37 | * 38 | * @param aParticipantID 39 | * Peppol participant ID. May not be null. 40 | * @return null if no business card exists for the provided 41 | * participant ID. 42 | */ 43 | @Nullable 44 | PDExtendedBusinessCard getBusinessCard (@Nonnull IParticipantIdentifier aParticipantID); 45 | } 46 | -------------------------------------------------------------------------------- /phoss-directory-indexer/src/main/java/com/helger/pd/indexer/businesscard/PDSMPHttpResponseHandlerBusinessCard.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.pd.indexer.businesscard; 18 | 19 | import java.io.IOException; 20 | import java.nio.charset.Charset; 21 | import java.nio.charset.StandardCharsets; 22 | 23 | import javax.annotation.Nonnull; 24 | import javax.annotation.Nullable; 25 | 26 | import org.apache.hc.client5.http.ClientProtocolException; 27 | import org.apache.hc.core5.http.ContentType; 28 | import org.apache.hc.core5.http.HttpEntity; 29 | 30 | import com.helger.commons.io.stream.StreamHelper; 31 | import com.helger.httpclient.HttpClientHelper; 32 | import com.helger.peppol.businesscard.generic.PDBusinessCard; 33 | import com.helger.peppol.businesscard.helper.PDBusinessCardHelper; 34 | import com.helger.smpclient.httpclient.AbstractSMPResponseHandler; 35 | 36 | /** 37 | * Handle unsigned SMP responses and interpret as PD v1 or v2 or v3. 38 | * 39 | * @author Philip Helger 40 | */ 41 | final class PDSMPHttpResponseHandlerBusinessCard extends AbstractSMPResponseHandler 42 | { 43 | @Override 44 | @Nullable 45 | public PDBusinessCard handleEntity (@Nonnull final HttpEntity aEntity) throws IOException 46 | { 47 | // Read the payload and remember it! 48 | final ContentType aContentType = HttpClientHelper.getContentTypeOrDefault (aEntity); 49 | final Charset aCharset = aContentType.getCharset (); 50 | final byte [] aData = StreamHelper.getAllBytes (aEntity.getContent ()); 51 | if (aData == null) 52 | return null; 53 | 54 | final PDBusinessCard aBC = PDBusinessCardHelper.parseBusinessCard (aData, aCharset); 55 | if (aBC != null) 56 | return aBC; 57 | 58 | // Unsupported 59 | throw new ClientProtocolException ("Malformed XML document returned from SMP server (no supported BusinessCard format):\n" + 60 | new String (aData, StandardCharsets.UTF_8)); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /phoss-directory-indexer/src/main/java/com/helger/pd/indexer/clientcert/ClientCertificateValidationResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.pd.indexer.clientcert; 18 | 19 | import java.io.Serializable; 20 | 21 | import javax.annotation.Nonnull; 22 | import javax.annotation.Nullable; 23 | import javax.annotation.concurrent.Immutable; 24 | 25 | import com.helger.commons.ValueEnforcer; 26 | import com.helger.commons.annotation.Nonempty; 27 | import com.helger.commons.state.ISuccessIndicator; 28 | 29 | /** 30 | * This class contains the result of a single client certificate validation. Use 31 | * the factory methods {@link #createSuccess(String)} and 32 | * {@link #createFailure()} to create objects of this class. 33 | * 34 | * @author Philip Helger 35 | */ 36 | @Immutable 37 | public final class ClientCertificateValidationResult implements ISuccessIndicator, Serializable 38 | { 39 | private final boolean m_bSuccess; 40 | private final String m_sClientID; 41 | 42 | private ClientCertificateValidationResult (final boolean bSuccess, @Nullable final String sClientID) 43 | { 44 | m_bSuccess = bSuccess; 45 | m_sClientID = sClientID; 46 | } 47 | 48 | public boolean isSuccess () 49 | { 50 | return m_bSuccess; 51 | } 52 | 53 | @Override 54 | public boolean isFailure () 55 | { 56 | return !m_bSuccess; 57 | } 58 | 59 | /** 60 | * @return The ID of the client that triggered the request. Must be 61 | * null on failure and must not be null on 62 | * success. 63 | */ 64 | @Nullable 65 | public String getClientID () 66 | { 67 | return m_sClientID; 68 | } 69 | 70 | /** 71 | * Create client certificate validation success 72 | * 73 | * @param sClientID 74 | * Client ID to use. May neither be null nor empty. 75 | * @return Never null. 76 | */ 77 | @Nonnull 78 | public static ClientCertificateValidationResult createSuccess (@Nonnull @Nonempty final String sClientID) 79 | { 80 | ValueEnforcer.notEmpty (sClientID, "ClientID"); 81 | return new ClientCertificateValidationResult (true, sClientID); 82 | } 83 | 84 | /** 85 | * Create client certificate validation failure 86 | * 87 | * @return Never null. 88 | */ 89 | @Nonnull 90 | public static ClientCertificateValidationResult createFailure () 91 | { 92 | return new ClientCertificateValidationResult (false, null); 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /phoss-directory-indexer/src/main/java/com/helger/pd/indexer/config/IndexerMicroTypeConverterRegistrar.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.pd.indexer.config; 18 | 19 | import javax.annotation.Nonnull; 20 | import javax.annotation.concurrent.Immutable; 21 | 22 | import com.helger.commons.annotation.IsSPIImplementation; 23 | import com.helger.pd.indexer.index.IndexerWorkItem; 24 | import com.helger.pd.indexer.index.IndexerWorkItemMicroTypeConverter; 25 | import com.helger.pd.indexer.reindex.ReIndexWorkItem; 26 | import com.helger.pd.indexer.reindex.ReIndexWorkItemMicroTypeConverter; 27 | import com.helger.xml.microdom.convert.IMicroTypeConverterRegistrarSPI; 28 | import com.helger.xml.microdom.convert.IMicroTypeConverterRegistry; 29 | 30 | /** 31 | * Implementation of {@link IMicroTypeConverterRegistrarSPI} for Peppol 32 | * Directory indexer types 33 | * 34 | * @author Philip Helger 35 | */ 36 | @Immutable 37 | @IsSPIImplementation 38 | public final class IndexerMicroTypeConverterRegistrar implements IMicroTypeConverterRegistrarSPI 39 | { 40 | public void registerMicroTypeConverter (@Nonnull final IMicroTypeConverterRegistry aRegistry) 41 | { 42 | aRegistry.registerMicroElementTypeConverter (IndexerWorkItem.class, new IndexerWorkItemMicroTypeConverter ()); 43 | aRegistry.registerMicroElementTypeConverter (ReIndexWorkItem.class, new ReIndexWorkItemMicroTypeConverter ()); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /phoss-directory-indexer/src/main/java/com/helger/pd/indexer/index/EIndexerWorkItemType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.pd.indexer.index; 18 | 19 | import javax.annotation.Nonnull; 20 | import javax.annotation.Nullable; 21 | 22 | import com.helger.commons.annotation.Nonempty; 23 | import com.helger.commons.id.IHasID; 24 | import com.helger.commons.lang.EnumHelper; 25 | import com.helger.commons.name.IHasDisplayName; 26 | 27 | /** 28 | * The work item types to use. 29 | * 30 | * @author Philip Helger 31 | */ 32 | public enum EIndexerWorkItemType implements IHasID , IHasDisplayName 33 | { 34 | /** Use for create and/or update of business cards */ 35 | CREATE_UPDATE ("create", "Create/update"), 36 | /** Use for delete of a business card */ 37 | DELETE ("delete", "Delete"), 38 | /** Use for internal synchronization (update or delete) of business cards */ 39 | SYNC ("sync", "Synchronize"); 40 | 41 | private final String m_sID; 42 | private final String m_sDisplayName; 43 | 44 | private EIndexerWorkItemType (@Nonnull @Nonempty final String sID, @Nonnull @Nonempty final String sDisplayName) 45 | { 46 | m_sID = sID; 47 | m_sDisplayName = sDisplayName; 48 | } 49 | 50 | @Nonnull 51 | @Nonempty 52 | public String getID () 53 | { 54 | return m_sID; 55 | } 56 | 57 | @Nonnull 58 | @Nonempty 59 | public String getDisplayName () 60 | { 61 | return m_sDisplayName; 62 | } 63 | 64 | @Nullable 65 | public static EIndexerWorkItemType getFromIDOrNull (@Nullable final String sID) 66 | { 67 | return EnumHelper.getFromIDOrNull (EIndexerWorkItemType.class, sID); 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /phoss-directory-indexer/src/main/java/com/helger/pd/indexer/index/IIndexerWorkItem.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.pd.indexer.index; 18 | 19 | import java.io.Serializable; 20 | 21 | import javax.annotation.Nonnull; 22 | 23 | import com.helger.commons.annotation.Nonempty; 24 | import com.helger.commons.annotation.ReturnsMutableCopy; 25 | import com.helger.commons.name.IHasDisplayName; 26 | import com.helger.commons.type.ITypedObject; 27 | import com.helger.datetime.domain.IHasCreationDateTime; 28 | import com.helger.pd.indexer.storage.PDStoredMetaData; 29 | import com.helger.peppolid.IParticipantIdentifier; 30 | 31 | /** 32 | * Base interface for indexer work item with only reading methods. 33 | * 34 | * @author Philip Helger 35 | */ 36 | public interface IIndexerWorkItem extends ITypedObject , Serializable, IHasCreationDateTime, IHasDisplayName 37 | { 38 | /** 39 | * Special requesting host if triggered by a scheduled SML run 40 | * 41 | * @see #getRequestingHost() 42 | */ 43 | String REQUESTING_HOST_SML = "automatic"; 44 | 45 | /** 46 | * @return The participant identifier it is all about. May not be 47 | * null. 48 | */ 49 | @Nonnull 50 | IParticipantIdentifier getParticipantID (); 51 | 52 | /** 53 | * @return The action type to execute. Never null. 54 | */ 55 | @Nonnull 56 | EIndexerWorkItemType getType (); 57 | 58 | /** 59 | * @return The ID of the client (=SMP; based on the provided client 60 | * certificate) that requested this action. Never null. 61 | */ 62 | @Nonnull 63 | @Nonempty 64 | String getOwnerID (); 65 | 66 | /** 67 | * @return The IP address/host name of the host requesting this work item. If 68 | * this action is triggered by the scheduled SML exchange, this should 69 | * be {@value #REQUESTING_HOST_SML}. 70 | */ 71 | @Nonnull 72 | String getRequestingHost (); 73 | 74 | /** 75 | * @return A special pre-build log prefix used when logging something about 76 | * this object. 77 | */ 78 | @Nonnull 79 | @Nonempty 80 | default String getLogText () 81 | { 82 | return getOwnerID () + "@" + getType () + "[" + getParticipantID ().getURIEncoded () + "]"; 83 | } 84 | 85 | /** 86 | * @return The information of this as a {@link PDStoredMetaData} object to be 87 | * used by the storage engine. 88 | */ 89 | @Nonnull 90 | @ReturnsMutableCopy 91 | default PDStoredMetaData getAsMetaData () 92 | { 93 | return new PDStoredMetaData (getCreationDateTime (), getOwnerID (), getRequestingHost ()); 94 | } 95 | 96 | @Nonnull 97 | @Nonempty 98 | default String getDisplayName () 99 | { 100 | return getLogText (); 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /phoss-directory-indexer/src/main/java/com/helger/pd/indexer/lucene/ILuceneAnalyzerProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.pd.indexer.lucene; 18 | 19 | import java.io.IOException; 20 | 21 | import javax.annotation.Nullable; 22 | 23 | import org.apache.lucene.analysis.Analyzer; 24 | 25 | /** 26 | * Lucene {@link Analyzer} retrieval interface 27 | * 28 | * @author Philip Helger 29 | */ 30 | @FunctionalInterface 31 | public interface ILuceneAnalyzerProvider 32 | { 33 | /** 34 | * Get the Lucene Analyzer to use 35 | * 36 | * @return The Analyzer to use. May be null if the underlying 37 | * Analyzer is already closed 38 | * @throws IOException 39 | * In case of a Lucene error 40 | */ 41 | @Nullable 42 | Analyzer getAnalyzer () throws IOException; 43 | } 44 | -------------------------------------------------------------------------------- /phoss-directory-indexer/src/main/java/com/helger/pd/indexer/lucene/ILuceneDocumentProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.pd.indexer.lucene; 18 | 19 | import java.io.IOException; 20 | 21 | import javax.annotation.Nullable; 22 | 23 | import org.apache.lucene.document.Document; 24 | 25 | /** 26 | * {@link Document} retrieval interface 27 | * 28 | * @author Philip Helger 29 | */ 30 | @FunctionalInterface 31 | public interface ILuceneDocumentProvider 32 | { 33 | /** 34 | * Get the Lucene document from the document ID 35 | * 36 | * @param nDocID 37 | * Internal Lucene Document ID 38 | * @return The Document or null. 39 | * @throws IOException 40 | * In case of a Lucene error 41 | */ 42 | @Nullable 43 | Document getDocument (int nDocID) throws IOException; 44 | } 45 | -------------------------------------------------------------------------------- /phoss-directory-indexer/src/main/java/com/helger/pd/indexer/mgr/IPDStorageManager.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.pd.indexer.mgr; 18 | 19 | import java.io.Closeable; 20 | import java.io.IOException; 21 | 22 | import javax.annotation.CheckForSigned; 23 | import javax.annotation.Nonnull; 24 | import javax.annotation.Nullable; 25 | 26 | import com.helger.commons.state.ESuccess; 27 | import com.helger.pd.indexer.businesscard.PDExtendedBusinessCard; 28 | import com.helger.pd.indexer.storage.PDStoredMetaData; 29 | import com.helger.peppolid.IParticipantIdentifier; 30 | 31 | /** 32 | * The abstract storage manager interface. It contains all the actions that can 33 | * be performed with business cards. 34 | * 35 | * @author Philip Helger 36 | */ 37 | public interface IPDStorageManager extends Closeable 38 | { 39 | /** 40 | * Create a new entry or update an existing entry. 41 | * 42 | * @param aParticipantID 43 | * Participant identifier it is all about. 44 | * @param aExtBI 45 | * The extended business card with the document type identifiers. 46 | * @param aMetaData 47 | * The additional meta data to be stored. 48 | * @return {@link ESuccess#SUCCESS} upon success, {@link ESuccess#FAILURE} on 49 | * error. 50 | * @throws IOException 51 | * in case of IO error 52 | */ 53 | @Nonnull 54 | ESuccess createOrUpdateEntry (@Nonnull IParticipantIdentifier aParticipantID, 55 | @Nonnull PDExtendedBusinessCard aExtBI, 56 | @Nonnull PDStoredMetaData aMetaData) throws IOException; 57 | 58 | /** 59 | * Delete an existing entry (not recoverable). 60 | * 61 | * @param aParticipantID 62 | * Participant ID to be deleted. 63 | * @param aMetaData 64 | * The entry metadata. Basically only for logging purposes. May be 65 | * null. 66 | * @param bVerifyOwner 67 | * true if the owner should be considered, 68 | * false if not. 69 | * @return The number of deleted entries, or -1 in case of failure 70 | * @throws IOException 71 | * in case of IO error 72 | */ 73 | @CheckForSigned 74 | int deleteEntry (@Nonnull IParticipantIdentifier aParticipantID, 75 | @Nullable PDStoredMetaData aMetaData, 76 | boolean bVerifyOwner) throws IOException; 77 | } 78 | -------------------------------------------------------------------------------- /phoss-directory-indexer/src/main/java/com/helger/pd/indexer/reindex/IReIndexWorkItemList.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.pd.indexer.reindex; 18 | 19 | import java.util.function.Predicate; 20 | 21 | import javax.annotation.Nonnegative; 22 | import javax.annotation.Nonnull; 23 | import javax.annotation.Nullable; 24 | 25 | import com.helger.commons.annotation.ReturnsMutableCopy; 26 | import com.helger.commons.collection.impl.ICommonsList; 27 | import com.helger.commons.state.EChange; 28 | 29 | /** 30 | * Base interface for {@link ReIndexWorkItem} objects. 31 | * 32 | * @author Philip Helger 33 | */ 34 | public interface IReIndexWorkItemList 35 | { 36 | /** 37 | * @return A list of all re-index items currently in the list. Never 38 | * null but maybe empty. 39 | */ 40 | @Nonnull 41 | @ReturnsMutableCopy 42 | ICommonsList getAllItems (); 43 | 44 | /** 45 | * @return The number of contained items. Always ≥ 0. 46 | */ 47 | @Nonnegative 48 | int getItemCount (); 49 | 50 | /** 51 | * Get the item with the specified ID. 52 | * 53 | * @param sID 54 | * The ID to search. May be null. 55 | * @return null if no such item exists. 56 | */ 57 | @Nullable 58 | IReIndexWorkItem getItemOfID (@Nullable String sID); 59 | 60 | /** 61 | * Find and remove the first work item matching the provided predicate. 62 | * 63 | * @param aFilter 64 | * The predicate to use. May not be null. 65 | * @return null if no such entry exists. 66 | */ 67 | @Nullable 68 | IReIndexWorkItem getAndRemoveEntry (@Nonnull Predicate aFilter); 69 | 70 | @Nonnull 71 | default EChange deleteItem (@Nullable final String sID) 72 | { 73 | return EChange.valueOf (sID != null && getAndRemoveEntry (x -> x.getID ().equals (sID)) != null); 74 | } 75 | 76 | /** 77 | * Remove all work items matching the provided predicate. 78 | * 79 | * @param aFilter 80 | * The predicate to use. May not be null. 81 | * @return null if no such entry exists. 82 | */ 83 | @Nonnull 84 | @ReturnsMutableCopy 85 | ICommonsList getAndRemoveAllEntries (@Nonnull Predicate aFilter); 86 | 87 | @Nonnull 88 | default EChange deleteAllItems () 89 | { 90 | return EChange.valueOf (getAndRemoveAllEntries (x -> true).isNotEmpty ()); 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /phoss-directory-indexer/src/main/java/com/helger/pd/indexer/settings/PDConfiguredTrustStore.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.pd.indexer.settings; 18 | 19 | import java.io.Serializable; 20 | 21 | import javax.annotation.Nonnull; 22 | import javax.annotation.concurrent.Immutable; 23 | 24 | import com.helger.commons.ValueEnforcer; 25 | import com.helger.commons.annotation.Nonempty; 26 | import com.helger.security.keystore.EKeyStoreType; 27 | 28 | /** 29 | * A single truststore as found in the pd.properties configuration file. 30 | * 31 | * @author Philip Helger 32 | */ 33 | @Immutable 34 | public class PDConfiguredTrustStore implements Serializable 35 | { 36 | private final EKeyStoreType m_eType; 37 | private final String m_sPath; 38 | private final String m_sPassword; 39 | private final String m_sAlias; 40 | 41 | public PDConfiguredTrustStore (@Nonnull final EKeyStoreType eType, 42 | @Nonnull @Nonempty final String sPath, 43 | @Nonnull final String sPassword, 44 | @Nonnull @Nonempty final String sAlias) 45 | { 46 | ValueEnforcer.notNull (eType, "Type"); 47 | ValueEnforcer.notEmpty (sPath, "Path"); 48 | ValueEnforcer.notNull (sPassword, "Password"); 49 | ValueEnforcer.notEmpty (sAlias, "Alias"); 50 | m_eType = eType; 51 | m_sPath = sPath; 52 | m_sPassword = sPassword; 53 | m_sAlias = sAlias; 54 | } 55 | 56 | @Nonnull 57 | public EKeyStoreType getType () 58 | { 59 | return m_eType; 60 | } 61 | 62 | @Nonnull 63 | @Nonempty 64 | public String getPath () 65 | { 66 | return m_sPath; 67 | } 68 | 69 | @Nonnull 70 | public String getPassword () 71 | { 72 | return m_sPassword; 73 | } 74 | 75 | @Nonnull 76 | @Nonempty 77 | public String getAlias () 78 | { 79 | return m_sAlias; 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /phoss-directory-indexer/src/main/java/com/helger/pd/indexer/storage/CPDStorage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.pd.indexer.storage; 18 | 19 | import javax.annotation.Nullable; 20 | import javax.annotation.concurrent.Immutable; 21 | 22 | /** 23 | * Constants Lucene field names 24 | * 25 | * @author Philip Helger 26 | */ 27 | @Immutable 28 | public final class CPDStorage 29 | { 30 | public static final String FIELD_ALL_FIELDS = "allfields"; 31 | 32 | public static final String OWNER_MANUALLY_TRIGGERED = "manually-triggered"; 33 | public static final String OWNER_IMPORT_TRIGGERED = "import-triggered"; 34 | public static final String OWNER_DUPLICATE_ELIMINATION = "duplicate-elimination"; 35 | public static final String OWNER_SYNC_JOB = "sync-job"; 36 | 37 | private CPDStorage () 38 | {} 39 | 40 | public static boolean isSpecialOwnerID (@Nullable final String s) 41 | { 42 | return OWNER_MANUALLY_TRIGGERED.equals (s) || 43 | OWNER_IMPORT_TRIGGERED.equals (s) || 44 | OWNER_DUPLICATE_ELIMINATION.equals (s) || 45 | OWNER_SYNC_JOB.equals (s); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /phoss-directory-indexer/src/main/java/com/helger/pd/indexer/storage/PDStoredIdentifier.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.pd.indexer.storage; 18 | 19 | import javax.annotation.Nonnull; 20 | import javax.annotation.concurrent.Immutable; 21 | 22 | import com.helger.commons.ValueEnforcer; 23 | import com.helger.commons.annotation.Nonempty; 24 | import com.helger.commons.hashcode.HashCodeGenerator; 25 | import com.helger.commons.string.ToStringGenerator; 26 | import com.helger.peppol.businesscard.generic.PDIdentifier; 27 | 28 | /** 29 | * This class represents a single identifier as stored by Lucene consisting of a 30 | * type and a value. 31 | * 32 | * @author Philip Helger 33 | */ 34 | @Immutable 35 | public final class PDStoredIdentifier 36 | { 37 | private final String m_sScheme; 38 | private final String m_sValue; 39 | 40 | public PDStoredIdentifier (@Nonnull @Nonempty final String sScheme, @Nonnull @Nonempty final String sValue) 41 | { 42 | m_sScheme = ValueEnforcer.notEmpty (sScheme, "Scheme"); 43 | m_sValue = ValueEnforcer.notEmpty (sValue, "Value"); 44 | } 45 | 46 | @Nonnull 47 | @Nonempty 48 | public String getScheme () 49 | { 50 | return m_sScheme; 51 | } 52 | 53 | @Nonnull 54 | @Nonempty 55 | public String getValue () 56 | { 57 | return m_sValue; 58 | } 59 | 60 | @Nonnull 61 | public PDIdentifier getAsGenericObject () 62 | { 63 | return new PDIdentifier (m_sScheme, m_sValue); 64 | } 65 | 66 | @Nonnull 67 | @Nonempty 68 | public String getSchemeAndValue () 69 | { 70 | return m_sScheme + "::" + m_sValue; 71 | } 72 | 73 | @Override 74 | public boolean equals (final Object o) 75 | { 76 | if (o == this) 77 | return true; 78 | if (o == null || !getClass ().equals (o.getClass ())) 79 | return false; 80 | final PDStoredIdentifier rhs = (PDStoredIdentifier) o; 81 | return m_sScheme.equals (rhs.m_sScheme) && m_sValue.equals (rhs.m_sValue); 82 | } 83 | 84 | @Override 85 | public int hashCode () 86 | { 87 | return new HashCodeGenerator (this).append (m_sScheme).append (m_sValue).getHashCode (); 88 | } 89 | 90 | @Override 91 | public String toString () 92 | { 93 | return new ToStringGenerator (null).append ("Scheme", m_sScheme).append ("Value", m_sValue).getToString (); 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /phoss-directory-indexer/src/main/java/com/helger/pd/indexer/storage/field/EPDStringFieldTokenize.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.pd.indexer.storage.field; 18 | 19 | import javax.annotation.Nonnull; 20 | 21 | import org.apache.lucene.document.Field; 22 | import org.apache.lucene.document.Field.Store; 23 | import org.apache.lucene.document.StringField; 24 | import org.apache.lucene.document.TextField; 25 | 26 | /** 27 | * Toeknize or not tokenize? 28 | * 29 | * @author Philip Helger 30 | */ 31 | public enum EPDStringFieldTokenize 32 | { 33 | TOKENIZE 34 | { 35 | @Override 36 | @Nonnull 37 | public Field createField (@Nonnull final String sFieldName, @Nonnull final String sFieldValue, @Nonnull final Store eStore) 38 | { 39 | return new TextField (sFieldName, sFieldValue, eStore); 40 | } 41 | }, 42 | NO_TOKENIZE 43 | { 44 | @Override 45 | @Nonnull 46 | public Field createField (@Nonnull final String sFieldName, @Nonnull final String sFieldValue, @Nonnull final Store eStore) 47 | { 48 | return new StringField (sFieldName, sFieldValue, eStore); 49 | } 50 | }; 51 | 52 | @Nonnull 53 | public abstract Field createField (@Nonnull String sFieldName, @Nonnull String sFieldValue, @Nonnull Field.Store eStore); 54 | } 55 | -------------------------------------------------------------------------------- /phoss-directory-indexer/src/main/java/com/helger/pd/indexer/storage/field/PDNumericField.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.pd.indexer.storage.field; 18 | 19 | import java.util.function.Function; 20 | 21 | import javax.annotation.Nonnull; 22 | 23 | import org.apache.lucene.document.Field; 24 | import org.apache.lucene.document.StoredField; 25 | import org.apache.lucene.index.IndexableField; 26 | 27 | import com.helger.commons.annotation.Nonempty; 28 | 29 | /** 30 | * A Lucene field that can be mapped to a {@link Number} and back. 31 | * 32 | * @author Philip Helger 33 | * @param 34 | * The native type. 35 | */ 36 | public class PDNumericField extends AbstractPDField 37 | { 38 | public PDNumericField (@Nonnull @Nonempty final String sFieldName, 39 | @Nonnull final Function aConverterToStorage, 40 | @Nonnull final Function aConverterFromStorage, 41 | @Nonnull final Field.Store eStore) 42 | { 43 | super (sFieldName, aConverterToStorage, aConverterFromStorage, eStore); 44 | } 45 | 46 | @Override 47 | @Nonnull 48 | public Field getAsField (@Nonnull final NATIVE_TYPE aValue) 49 | { 50 | final Number aLongValue = getAsStorageValue (aValue); 51 | return new StoredField (getFieldName (), aLongValue.longValue ()); 52 | } 53 | 54 | @Override 55 | @Nonnull 56 | protected NATIVE_TYPE getFieldNativeValue (@Nonnull final IndexableField aField) 57 | { 58 | return getAsNativeValue (aField.numericValue ()); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /phoss-directory-indexer/src/main/resources/META-INF/services/com.helger.xml.microdom.convert.IMicroTypeConverterRegistrarSPI: -------------------------------------------------------------------------------- 1 | com.helger.pd.indexer.config.IndexerMicroTypeConverterRegistrar 2 | -------------------------------------------------------------------------------- /phoss-directory-indexer/src/main/resources/NOTICE: -------------------------------------------------------------------------------- 1 | ============================================================================= 2 | = NOTICE file corresponding to section 4d of the Apache License Version 2.0 = 3 | ============================================================================= 4 | This product includes Open Source Software developed by 5 | Philip Helger - https://www.helger.com/ 6 | -------------------------------------------------------------------------------- /phoss-directory-indexer/src/main/resources/phoss-directory-version.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2015-2025 Philip Helger (www.helger.com) 3 | # philip[at]helger[dot]com 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | # Project version number - this is generated automatically 19 | version=${project.version} 20 | # Build timestamp 21 | timestamp=${maven.build.timestamp} 22 | -------------------------------------------------------------------------------- /phoss-directory-indexer/src/test/java/com/helger/pd/indexer/CDirectoryVersionTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.pd.indexer; 18 | 19 | import static org.junit.Assert.assertFalse; 20 | import static org.junit.Assert.assertNotEquals; 21 | 22 | import org.junit.Test; 23 | import org.slf4j.Logger; 24 | import org.slf4j.LoggerFactory; 25 | 26 | /** 27 | * Test class for class {@link CDirectoryVersion} 28 | * 29 | * @author Philip Helger 30 | */ 31 | public final class CDirectoryVersionTest 32 | { 33 | private static final Logger LOGGER = LoggerFactory.getLogger (CDirectoryVersionTest.class); 34 | 35 | @Test 36 | public void testBasic () 37 | { 38 | LOGGER.info ("CDirectoryVersion.BUILD_VERSION = '" + CDirectoryVersion.BUILD_VERSION + "'"); 39 | LOGGER.info ("CDirectoryVersion.BUILD_TIMESTAMP = '" + CDirectoryVersion.BUILD_TIMESTAMP + "'"); 40 | 41 | assertNotEquals ("undefined", CDirectoryVersion.BUILD_VERSION); 42 | assertNotEquals ("undefined", CDirectoryVersion.BUILD_TIMESTAMP); 43 | 44 | // Check variable resolution 45 | assertFalse (CDirectoryVersion.BUILD_VERSION.contains ("${")); 46 | assertFalse (CDirectoryVersion.BUILD_TIMESTAMP.contains ("${")); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /phoss-directory-indexer/src/test/java/com/helger/pd/indexer/PDIndexerTestRule.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.pd.indexer; 18 | 19 | import java.io.File; 20 | 21 | import org.slf4j.bridge.SLF4JBridgeHandler; 22 | 23 | import com.helger.commons.id.factory.GlobalIDFactory; 24 | import com.helger.commons.io.file.FileOperationManager; 25 | import com.helger.pd.indexer.lucene.PDLucene; 26 | import com.helger.pd.indexer.settings.PDServerConfiguration; 27 | import com.helger.photon.app.mock.PhotonAppWebTestRule; 28 | import com.helger.photon.io.WebIOIntIDFactory; 29 | import com.helger.scope.mock.ScopeTestRule; 30 | 31 | /** 32 | * Special Peppol Directory test rule with the correct data path from the 33 | * settings file. 34 | * 35 | * @author Philip Helger 36 | */ 37 | public class PDIndexerTestRule extends PhotonAppWebTestRule 38 | { 39 | static 40 | { 41 | SLF4JBridgeHandler.removeHandlersForRootLogger (); 42 | SLF4JBridgeHandler.install (); 43 | } 44 | 45 | public PDIndexerTestRule () 46 | { 47 | super (new File (PDServerConfiguration.getDataPath ()), ScopeTestRule.STORAGE_PATH.getAbsolutePath ()); 48 | } 49 | 50 | @Override 51 | public void before () 52 | { 53 | super.before (); 54 | FileOperationManager.INSTANCE.deleteDirRecursiveIfExisting (PDLucene.getLuceneIndexDir ()); 55 | GlobalIDFactory.setPersistentIntIDFactory (new WebIOIntIDFactory ("pd-ids.dat")); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /phoss-directory-indexer/src/test/java/com/helger/pd/indexer/SPITest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.pd.indexer; 18 | 19 | import org.junit.Test; 20 | 21 | import com.helger.commons.mock.SPITestHelper; 22 | 23 | /** 24 | * Test SPI definitions 25 | * 26 | * @author Philip Helger 27 | */ 28 | public final class SPITest 29 | { 30 | @Test 31 | public void testBasic () throws Exception 32 | { 33 | // Special case: allow for invalid ones! 34 | SPITestHelper.testIfAllSPIImplementationsAreValid (true); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /phoss-directory-indexer/src/test/java/com/helger/pd/indexer/lucene/QueryParserFuncTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.pd.indexer.lucene; 18 | 19 | import org.apache.lucene.queryparser.classic.ParseException; 20 | import org.apache.lucene.queryparser.classic.QueryParser; 21 | import org.apache.lucene.queryparser.classic.QueryParser.Operator; 22 | import org.apache.lucene.search.Query; 23 | import org.junit.Test; 24 | 25 | public final class QueryParserFuncTest 26 | { 27 | @Test 28 | public void test () throws ParseException 29 | { 30 | final QueryParser aQP = new QueryParser ("", PDLucene.createAnalyzer ()); 31 | aQP.setDefaultOperator (Operator.AND); 32 | aQP.setAllowLeadingWildcard (true); 33 | final Query aQuery = aQP.parse ("(allfields:*9905* AND allfields:*leckma*) AND NOT deleted:(*)"); 34 | System.out.println (aQuery.getClass () + " -- " + aQuery); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /phoss-directory-indexer/src/test/java/com/helger/pd/indexer/settings/PDServerConfigurationTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.pd.indexer.settings; 18 | 19 | import static org.junit.Assert.assertEquals; 20 | 21 | import org.junit.Test; 22 | 23 | import com.helger.commons.collection.impl.CommonsHashSet; 24 | import com.helger.commons.collection.impl.ICommonsList; 25 | 26 | /** 27 | * Test class for class {@link PDServerConfiguration}. 28 | * 29 | * @author Philip Helger 30 | */ 31 | public final class PDServerConfigurationTest 32 | { 33 | @Test 34 | public void testClientCerts () 35 | { 36 | final ICommonsList aList = PDServerConfiguration.getAllClientCertIssuer (); 37 | assertEquals (2, aList.size ()); 38 | // Check if all items are unique 39 | assertEquals (2, new CommonsHashSet <> (aList).size ()); 40 | assertEquals ("CN=PEPPOL SERVICE METADATA PUBLISHER CA - G2,O=OpenPEPPOL AISBL,C=BE", aList.get (0)); 41 | assertEquals ("CN=PEPPOL SERVICE METADATA PUBLISHER TEST CA - G2,OU=FOR TEST ONLY,O=OpenPEPPOL AISBL,C=BE", aList.get (1)); 42 | } 43 | 44 | @Test 45 | public void testTrustStores () 46 | { 47 | final ICommonsList aList = PDServerConfiguration.getAllTrustStores (); 48 | assertEquals (2, aList.size ()); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /phoss-directory-indexer/src/test/java/com/helger/pd/indexer/storage/PDDocumentMetaDataTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.pd.indexer.storage; 18 | 19 | import static org.junit.Assert.assertTrue; 20 | 21 | import org.junit.Test; 22 | 23 | import com.helger.commons.datetime.PDTFactory; 24 | 25 | public final class PDDocumentMetaDataTest 26 | { 27 | @Test 28 | public void testMillis () 29 | { 30 | final long nMillis = System.currentTimeMillis (); 31 | final long nMillis2 = PDTFactory.getMillis (new PDStoredMetaData (PDTFactory.getCurrentLocalDateTime (), 32 | "me", 33 | "localhost").getCreationDT ()); 34 | // Less than a second difference 35 | assertTrue (nMillis + " vs. " + nMillis2, Math.abs (nMillis2 - nMillis) <= 1000); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /phoss-directory-indexer/src/test/resources/00readme.txt: -------------------------------------------------------------------------------- 1 | ==== 2 | Copyright (C) 2015-2023 Philip Helger (www.helger.com) 3 | philip[at]helger[dot]com 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | ==== 17 | 18 | How to create the self-signed keystore: 19 | 20 | "%JAVA_HOME%\bin\keytool" -genkey -keyalg RSA -alias selfsigned -keystore test-https-keystore.jks -storepass password -validity 36000 -keysize 2048 21 | 22 | Using the following password for the key: 23 | password 24 | -------------------------------------------------------------------------------- /phoss-directory-indexer/src/test/resources/pd.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2015-2025 Philip Helger (www.helger.com) 3 | # philip[at]helger[dot]com 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | # Global flags for initializer 19 | global.debug = true 20 | global.production = false 21 | 22 | # Central directory where the data should be stored 23 | webapp.datapath = generated/ 24 | 25 | # Should all files of the application checked for readability? 26 | webapp.checkfileaccess = false 27 | 28 | # Is it a test version? E.g. a separate header 29 | webapp.testversion = true 30 | 31 | # The issuer of the certificate to be passed by the client 32 | clientcert.issuer.1=CN=PEPPOL SERVICE METADATA PUBLISHER CA - G2,O=OpenPEPPOL AISBL,C=BE 33 | clientcert.issuer.2=CN=PEPPOL SERVICE METADATA PUBLISHER TEST CA - G2,OU=FOR TEST ONLY,O=OpenPEPPOL AISBL,C=BE 34 | 35 | # The truststores to check for PEPPOL certificates 36 | truststore.1.type=jks 37 | truststore.1.path=truststore/complete-truststore.jks 38 | truststore.1.password=peppol 39 | truststore.1.alias=peppol service metadata publisher ca - g2 (peppol root ca - g2) 40 | 41 | truststore.2.type=jks 42 | truststore.2.path=truststore/complete-truststore.jks 43 | truststore.2.password=peppol 44 | truststore.2.alias=peppol service metadata publisher test ca - g2 (peppol root test ca - g2) 45 | 46 | # Re-index settings 47 | reindex.maxretryhours = 24 48 | reindex.retryminutes = 5 49 | 50 | # SMP query settings 51 | sml.id = digittest 52 | -------------------------------------------------------------------------------- /phoss-directory-indexer/src/test/resources/simplelogger.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2015-2025 Philip Helger (www.helger.com) 3 | # philip[at]helger[dot]com 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | # SLF4J's SimpleLogger configuration file 19 | # Simple implementation of Logger that sends all enabled log messages, for all defined loggers, to System.err. 20 | 21 | # Default logging detail level for all instances of SimpleLogger. 22 | # Must be one of ("trace", "debug", "info", "warn", or "error"). 23 | # If not specified, defaults to "info". 24 | org.slf4j.simpleLogger.defaultLogLevel=info 25 | 26 | # Logging detail level for a SimpleLogger instance named "xxxxx". 27 | # Must be one of ("trace", "debug", "info", "warn", or "error"). 28 | # If not specified, the default logging detail level is used. 29 | #org.slf4j.simpleLogger.log.xxxxx= 30 | 31 | # Set to true if you want the current date and time to be included in output messages. 32 | # Default is false, and will output the number of milliseconds elapsed since startup. 33 | org.slf4j.simpleLogger.showDateTime=false 34 | 35 | # The date and time format to be used in the output messages. 36 | # The pattern describing the date and time format is the same that is used in java.text.SimpleDateFormat. 37 | # If the format is not specified or is invalid, the default format is used. 38 | # The default format is yyyy-MM-dd HH:mm:ss:SSS Z. 39 | #org.slf4j.simpleLogger.dateTimeFormat=yyyy-MM-dd HH:mm:ss:SSS Z 40 | 41 | # Set to true if you want to output the current thread name. 42 | # Defaults to true. 43 | #org.slf4j.simpleLogger.showThreadName=true 44 | 45 | # Set to true if you want the Logger instance name to be included in output messages. 46 | # Defaults to true. 47 | #org.slf4j.simpleLogger.showLogName=true 48 | 49 | # Set to true if you want the last component of the name to be included in output messages. 50 | # Defaults to false. 51 | #org.slf4j.simpleLogger.showShortLogName=false 52 | -------------------------------------------------------------------------------- /phoss-directory-indexer/src/test/resources/test-https-keystore.jks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phax/phoss-directory/1d381e13b716f91cb156e21bda5457afd96501de/phoss-directory-indexer/src/test/resources/test-https-keystore.jks -------------------------------------------------------------------------------- /phoss-directory-publisher/docs/de4a/de4alogo-128-88.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phax/phoss-directory/1d381e13b716f91cb156e21bda5457afd96501de/phoss-directory-publisher/docs/de4a/de4alogo-128-88.png -------------------------------------------------------------------------------- /phoss-directory-publisher/docs/de4a/favicon-pack.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phax/phoss-directory/1d381e13b716f91cb156e21bda5457afd96501de/phoss-directory-publisher/docs/de4a/favicon-pack.zip -------------------------------------------------------------------------------- /phoss-directory-publisher/findbugs-exclude.xml: -------------------------------------------------------------------------------- 1 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /phoss-directory-publisher/src/etc/license-template.txt: -------------------------------------------------------------------------------- 1 | Copyright (C) 2015-2025 Philip Helger (www.helger.com) 2 | philip[at]helger[dot]com 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. -------------------------------------------------------------------------------- /phoss-directory-publisher/src/main/java/com/helger/pd/publisher/CPDPublisher.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.pd.publisher; 18 | 19 | import javax.annotation.Nonnull; 20 | import javax.annotation.concurrent.NotThreadSafe; 21 | 22 | import com.helger.commons.ValueEnforcer; 23 | import com.helger.commons.annotation.Nonempty; 24 | import com.helger.commons.email.EmailAddress; 25 | import com.helger.commons.email.IEmailAddress; 26 | import com.helger.commons.url.ISimpleURL; 27 | import com.helger.commons.url.SimpleURL; 28 | import com.helger.pd.indexer.CDirectoryVersion; 29 | import com.helger.pd.indexer.settings.PDServerConfiguration; 30 | 31 | @NotThreadSafe 32 | public final class CPDPublisher 33 | { 34 | // Email sender - depends on the used SMTP server 35 | public static final IEmailAddress EMAIL_SENDER = new EmailAddress ("no-reply@helger.com"); 36 | public static final boolean EXPORT_BUSINESS_CARDS_JSON = true; 37 | public static final boolean EXPORT_BUSINESS_CARDS_EXCEL = false; 38 | public static final boolean EXPORT_BUSINESS_CARDS_CSV = true; 39 | public static final boolean EXPORT_PARTICIPANTS_XML = true; 40 | public static final boolean EXPORT_PARTICIPANTS_JSON = true; 41 | public static final boolean EXPORT_PARTICIPANTS_CSV = true; 42 | 43 | // APP Name - like "Peppol Directory" 44 | private static final String APPLICATION_TITLE = PDServerConfiguration.getAppName (); 45 | 46 | private static ISimpleURL s_aLogoImageURL = new SimpleURL ("/imgs/peppol/peppol.png"); 47 | 48 | private CPDPublisher () 49 | {} 50 | 51 | public static void setLogoImageURL (@Nonnull @Nonempty final String sLogoImageURL) 52 | { 53 | ValueEnforcer.notEmpty (sLogoImageURL, "LogoImageURL"); 54 | s_aLogoImageURL = new SimpleURL (sLogoImageURL); 55 | } 56 | 57 | @Nonnull 58 | public static ISimpleURL getLogoImageURL () 59 | { 60 | return s_aLogoImageURL; 61 | } 62 | 63 | @Nonnull 64 | @Nonempty 65 | public static String getApplication () 66 | { 67 | return APPLICATION_TITLE; 68 | } 69 | 70 | @Nonnull 71 | @Nonempty 72 | public static String getApplicationTitle () 73 | { 74 | return APPLICATION_TITLE + (PDServerConfiguration.isTestVersion () ? " [TEST]" : ""); 75 | } 76 | 77 | @Nonnull 78 | @Nonempty 79 | public static String getApplicationTitleWithVersion () 80 | { 81 | return getApplicationTitle () + " v" + CDirectoryVersion.BUILD_VERSION; 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /phoss-directory-publisher/src/main/java/com/helger/pd/publisher/EPDSMLMode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.pd.publisher; 18 | 19 | public enum EPDSMLMode 20 | { 21 | SML, 22 | SMK, 23 | BOTH; 24 | } 25 | -------------------------------------------------------------------------------- /phoss-directory-publisher/src/main/java/com/helger/pd/publisher/ajax/CAjax.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.pd.publisher.ajax; 18 | 19 | import javax.annotation.Nonnull; 20 | import javax.annotation.concurrent.Immutable; 21 | 22 | import com.helger.pd.publisher.app.AppCommonUI; 23 | import com.helger.photon.ajax.IAjaxRegistry; 24 | import com.helger.photon.ajax.decl.AjaxFunctionDeclaration; 25 | import com.helger.photon.ajax.decl.IAjaxFunctionDeclaration; 26 | import com.helger.photon.uictrls.datatables.ajax.AjaxExecutorDataTables; 27 | import com.helger.photon.uictrls.datatables.ajax.AjaxExecutorDataTablesI18N; 28 | 29 | /** 30 | * This class defines the available ajax functions for the application. 31 | * 32 | * @author Philip Helger 33 | */ 34 | @Immutable 35 | public final class CAjax 36 | { 37 | public static final IAjaxFunctionDeclaration DATATABLES = AjaxFunctionDeclaration.builder ("dataTables") 38 | .executor (AjaxExecutorDataTables.class) 39 | .build (); 40 | public static final IAjaxFunctionDeclaration DATATABLES_I18N = AjaxFunctionDeclaration.builder ("datatables-i18n") 41 | .executor (new AjaxExecutorDataTablesI18N (AppCommonUI.DEFAULT_LOCALE)) 42 | .build (); 43 | public static final IAjaxFunctionDeclaration LOGIN = AjaxFunctionDeclaration.builder ("login") 44 | .executor (AjaxExecutorPublicLogin.class) 45 | .build (); 46 | 47 | private CAjax () 48 | {} 49 | 50 | public static void initAjax (@Nonnull final IAjaxRegistry aAjaxRegistry) 51 | { 52 | aAjaxRegistry.registerFunction (DATATABLES); 53 | aAjaxRegistry.registerFunction (DATATABLES_I18N); 54 | aAjaxRegistry.registerFunction (LOGIN); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /phoss-directory-publisher/src/main/java/com/helger/pd/publisher/app/AppInternalErrorHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.pd.publisher.app; 18 | 19 | import java.util.Map; 20 | 21 | import javax.annotation.Nonnull; 22 | import javax.annotation.Nullable; 23 | 24 | import com.helger.commons.annotation.Nonempty; 25 | import com.helger.commons.email.EmailAddress; 26 | import com.helger.pd.publisher.CPDPublisher; 27 | import com.helger.photon.core.interror.InternalErrorBuilder; 28 | import com.helger.photon.core.interror.InternalErrorSettings; 29 | import com.helger.photon.core.interror.callback.AbstractErrorCallback; 30 | import com.helger.photon.core.mgr.PhotonCoreManager; 31 | import com.helger.photon.core.smtp.CNamedSMTPSettings; 32 | import com.helger.photon.core.smtp.NamedSMTPSettings; 33 | import com.helger.smtp.settings.ISMTPSettings; 34 | import com.helger.web.scope.IRequestWebScopeWithoutResponse; 35 | 36 | public final class AppInternalErrorHandler extends AbstractErrorCallback 37 | { 38 | @Override 39 | protected void onError (@Nullable final Throwable t, 40 | @Nullable final IRequestWebScopeWithoutResponse aRequestScope, 41 | @Nonnull @Nonempty final String sErrorCode, 42 | @Nullable final Map aCustomAttrs) 43 | { 44 | new InternalErrorBuilder ().setThrowable (t) 45 | .setRequestScope (aRequestScope) 46 | .addErrorMessage (sErrorCode) 47 | .addCustomData (aCustomAttrs) 48 | .handle (); 49 | } 50 | 51 | public static void doSetup () 52 | { 53 | // Set global internal error handlers 54 | new AppInternalErrorHandler ().install (); 55 | 56 | final NamedSMTPSettings aNamedSettings = PhotonCoreManager.getSMTPSettingsMgr () 57 | .getSettings (CNamedSMTPSettings.NAMED_SMTP_SETTINGS_DEFAULT_ID); 58 | final ISMTPSettings aSMTPSettings = aNamedSettings == null ? null : aNamedSettings.getSMTPSettings (); 59 | InternalErrorSettings.setSMTPSenderAddress (new EmailAddress ("pd@helger.com", CPDPublisher.getApplicationTitle ())); 60 | InternalErrorSettings.setSMTPReceiverAddress (new EmailAddress ("philip@helger.com", "Philip")); 61 | InternalErrorSettings.setSMTPSettings (aSMTPSettings); 62 | InternalErrorSettings.setFallbackLocale (AppCommonUI.DEFAULT_LOCALE); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /phoss-directory-publisher/src/main/java/com/helger/pd/publisher/app/PDLoginManager.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.pd.publisher.app; 18 | 19 | import java.time.Duration; 20 | 21 | import javax.annotation.Nonnull; 22 | import javax.annotation.Nullable; 23 | 24 | import com.helger.html.hc.IHCNode; 25 | import com.helger.html.hc.html.grouping.HCDiv; 26 | import com.helger.html.hc.html.textlevel.HCSmall; 27 | import com.helger.pd.indexer.CDirectoryVersion; 28 | import com.helger.pd.publisher.CPDPublisher; 29 | import com.helger.photon.app.html.IHTMLProvider; 30 | import com.helger.photon.bootstrap4.CBootstrapCSS; 31 | import com.helger.photon.bootstrap4.uictrls.ext.BootstrapLoginHTMLProvider; 32 | import com.helger.photon.bootstrap4.uictrls.ext.BootstrapLoginManager; 33 | import com.helger.photon.core.execcontext.ISimpleWebExecutionContext; 34 | import com.helger.security.authentication.credentials.ICredentialValidationResult; 35 | 36 | public final class PDLoginManager extends BootstrapLoginManager 37 | { 38 | public PDLoginManager () 39 | { 40 | super (CPDPublisher.getApplicationTitle () + " Administration - Login"); 41 | setRequiredRoleIDs (AppSecurity.REQUIRED_ROLE_IDS_CONFIG); 42 | setFailedLoginWaitingTime (Duration.ofSeconds (1)); 43 | } 44 | 45 | @Override 46 | protected IHTMLProvider createLoginScreen (final boolean bLoginError, 47 | @Nonnull final ICredentialValidationResult aLoginResult) 48 | { 49 | return new BootstrapLoginHTMLProvider (bLoginError, aLoginResult, getPageTitle ()) 50 | { 51 | @Override 52 | @Nullable 53 | protected IHCNode createFormFooter (@Nonnull final ISimpleWebExecutionContext aSWEC) 54 | { 55 | final HCDiv aDiv = new HCDiv ().addClass (CBootstrapCSS.D_FLEX).addClass (CBootstrapCSS.MT_5); 56 | aDiv.addChild (new HCSmall ().addChild (CPDPublisher.getApplicationTitleWithVersion () + 57 | " / " + 58 | CDirectoryVersion.BUILD_TIMESTAMP)); 59 | return aDiv; 60 | } 61 | }; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /phoss-directory-publisher/src/main/java/com/helger/pd/publisher/app/PDSessionSingleton.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.pd.publisher.app; 18 | 19 | import javax.annotation.Nonnull; 20 | import javax.annotation.Nullable; 21 | 22 | import org.apache.lucene.search.Query; 23 | 24 | import com.helger.commons.annotation.UsedViaReflection; 25 | import com.helger.web.scope.singleton.AbstractSessionWebSingleton; 26 | 27 | public final class PDSessionSingleton extends AbstractSessionWebSingleton 28 | { 29 | private Query m_aLastQuery; 30 | 31 | @Deprecated 32 | @UsedViaReflection 33 | public PDSessionSingleton () 34 | {} 35 | 36 | @Nonnull 37 | public static PDSessionSingleton getInstance () 38 | { 39 | return getSessionSingleton (PDSessionSingleton.class); 40 | } 41 | 42 | @Nullable 43 | public Query getLastQuery () 44 | { 45 | return m_aLastQuery; 46 | } 47 | 48 | public void setLastQuery (@Nullable final Query aLastQuery) 49 | { 50 | m_aLastQuery = aLastQuery; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /phoss-directory-publisher/src/main/java/com/helger/pd/publisher/app/pub/CMenuPublic.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.pd.publisher.app.pub; 18 | 19 | import javax.annotation.concurrent.Immutable; 20 | 21 | @Immutable 22 | public final class CMenuPublic 23 | { 24 | public static final String MENU_SEARCH_SIMPLE = "search"; 25 | public static final String MENU_SEARCH_EXTENDED = "search-ext"; 26 | public static final String MENU_DOCS_INTRODUCTION = "docs-introduction"; 27 | public static final String MENU_DOCS_HOW_TO = "docs-how-to"; 28 | public static final String MENU_DOCS_REST_API = "docs-rest-api"; 29 | public static final String MENU_DOCS_EXPORT_ALL = "docs-export-all"; 30 | public static final String MENU_SUPPORT_CONTACT_US = "contact-us"; 31 | public static final String MENU_ABOUT = "about"; 32 | 33 | // flags 34 | public static final String FLAG_FOOTER = "footer"; 35 | 36 | private CMenuPublic () 37 | {} 38 | } 39 | -------------------------------------------------------------------------------- /phoss-directory-publisher/src/main/java/com/helger/pd/publisher/app/pub/CaptchaSessionSingleton.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.pd.publisher.app.pub; 18 | 19 | import javax.annotation.Nonnull; 20 | 21 | import com.helger.commons.annotation.UsedViaReflection; 22 | import com.helger.web.scope.singleton.AbstractSessionWebSingleton; 23 | 24 | public final class CaptchaSessionSingleton extends AbstractSessionWebSingleton 25 | { 26 | private boolean m_bChecked = false; 27 | 28 | @Deprecated 29 | @UsedViaReflection 30 | public CaptchaSessionSingleton () 31 | {} 32 | 33 | @Nonnull 34 | public static CaptchaSessionSingleton getInstance () 35 | { 36 | return getSessionSingleton (CaptchaSessionSingleton.class); 37 | } 38 | 39 | public boolean isChecked () 40 | { 41 | return m_bChecked; 42 | } 43 | 44 | public void setChecked () 45 | { 46 | m_bChecked = true; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /phoss-directory-publisher/src/main/java/com/helger/pd/publisher/app/pub/MenuPublic.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.pd.publisher.app.pub; 18 | 19 | import javax.annotation.Nonnull; 20 | import javax.annotation.concurrent.Immutable; 21 | 22 | import com.helger.commons.debug.GlobalDebug; 23 | import com.helger.commons.io.resource.ClassPathResource; 24 | import com.helger.pd.indexer.settings.PDServerConfiguration; 25 | import com.helger.pd.publisher.CPDPublisher; 26 | import com.helger.pd.publisher.ui.AppPageViewExternal; 27 | import com.helger.photon.core.menu.IMenuTree; 28 | 29 | @Immutable 30 | public final class MenuPublic 31 | { 32 | private MenuPublic () 33 | {} 34 | 35 | public static void init (@Nonnull final IMenuTree aMenuTree) 36 | { 37 | // Not logged in 38 | aMenuTree.createRootItem (new PagePublicSearchSimple (CMenuPublic.MENU_SEARCH_SIMPLE)); 39 | if (GlobalDebug.isDebugMode ()) 40 | aMenuTree.createRootItem (new PagePublicSearchExtended (CMenuPublic.MENU_SEARCH_EXTENDED)); 41 | aMenuTree.createRootItem (new AppPageViewExternal (CMenuPublic.MENU_DOCS_INTRODUCTION, 42 | "Introduction", 43 | new ClassPathResource ("viewpages/en/docs_introduction.xml"))); 44 | aMenuTree.createRootItem (new AppPageViewExternal (CMenuPublic.MENU_DOCS_HOW_TO, 45 | "How to use it", 46 | new ClassPathResource ("viewpages/en/docs_how_to.xml"))); 47 | aMenuTree.createRootItem (new AppPageViewExternal (CMenuPublic.MENU_DOCS_REST_API, 48 | "REST API documentation", 49 | new ClassPathResource ("viewpages/en/docs_rest_api.xml"))); 50 | aMenuTree.createRootItem (new AppPageViewExternal (CMenuPublic.MENU_DOCS_EXPORT_ALL, 51 | "Export data", 52 | new ClassPathResource ("viewpages/en/docs_export_all.xml"))); 53 | if (PDServerConfiguration.isWebAppShowContactPage ()) 54 | { 55 | aMenuTree.createRootItem (new PagePublicContact (CMenuPublic.MENU_SUPPORT_CONTACT_US)); 56 | } 57 | aMenuTree.createRootItem (new AppPageViewExternal (CMenuPublic.MENU_ABOUT, 58 | "About " + CPDPublisher.getApplication (), 59 | new ClassPathResource ("viewpages/en/about.xml"))); 60 | 61 | // Set default 62 | aMenuTree.setDefaultMenuItemID (CMenuPublic.MENU_SEARCH_SIMPLE); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /phoss-directory-publisher/src/main/java/com/helger/pd/publisher/app/secure/CMenuSecure.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.pd.publisher.app.secure; 18 | 19 | import javax.annotation.concurrent.Immutable; 20 | 21 | @Immutable 22 | public final class CMenuSecure 23 | { 24 | // Menu item IDs 25 | public static final String MENU_INDEXER = "indexer"; 26 | public static final String MENU_PARTICIPANT_COUNT = "participant_count"; 27 | public static final String MENU_PARTICIPANT_LIST = "participant_list"; 28 | public static final String MENU_PARTICIPANT_ACTIONS = "participant_actions"; 29 | public static final String MENU_INDEX_MANUALLY = "index_manually"; 30 | public static final String MENU_INDEX_IMPORT = "index_import"; 31 | public static final String MENU_DELETE_MANUALLY = "delete_manually"; 32 | public static final String MENU_LIST_INDEX = "list_index"; 33 | public static final String MENU_LIST_RE_INDEX = "list_reindex"; 34 | public static final String MENU_LIST_DEAD_INDEX = "list_deadindex"; 35 | 36 | public static final String MENU_ADMIN = "admin"; 37 | public static final String MENU_ADMIN_CHANGE_PASSWORD = "change_password"; 38 | public static final String MENU_ADMIN_SML_CONFIGURATION = "sml_configuration"; 39 | public static final String MENU_ADMIN_LUCENE_INFO = "lucene_info"; 40 | 41 | private CMenuSecure () 42 | {} 43 | } 44 | -------------------------------------------------------------------------------- /phoss-directory-publisher/src/main/java/com/helger/pd/publisher/app/secure/PageSecureAdminLuceneInformation.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.pd.publisher.app.secure; 18 | 19 | import java.io.IOException; 20 | 21 | import javax.annotation.Nonnull; 22 | 23 | import org.apache.lucene.index.DirectoryReader; 24 | 25 | import com.helger.commons.annotation.Nonempty; 26 | import com.helger.commons.lang.StackTraceHelper; 27 | import com.helger.html.hc.ext.HCExtHelper; 28 | import com.helger.html.hc.impl.HCNodeList; 29 | import com.helger.pd.indexer.lucene.PDLucene; 30 | import com.helger.pd.indexer.mgr.PDMetaManager; 31 | import com.helger.pd.publisher.ui.AbstractAppWebPage; 32 | import com.helger.photon.bootstrap4.table.BootstrapTable; 33 | import com.helger.photon.uicore.page.WebPageExecutionContext; 34 | 35 | /** 36 | * Information on the Lucene Index. 37 | * 38 | * @author Philip Helger 39 | * @since 0.7.1 40 | */ 41 | public final class PageSecureAdminLuceneInformation extends AbstractAppWebPage 42 | { 43 | public PageSecureAdminLuceneInformation (@Nonnull @Nonempty final String sID) 44 | { 45 | super (sID, "Lucene information"); 46 | } 47 | 48 | @Override 49 | protected void fillContent (final WebPageExecutionContext aWPEC) 50 | { 51 | final HCNodeList aNodeList = aWPEC.getNodeList (); 52 | final PDLucene aLucene = PDMetaManager.getLucene (); 53 | 54 | final BootstrapTable aTable = new BootstrapTable (); 55 | aTable.addBodyRow ().addCells ("Lucene index directory", PDLucene.getLuceneIndexDir ().getAbsolutePath ()); 56 | try 57 | { 58 | final DirectoryReader aReader = aLucene.getReader (); 59 | if (aReader != null) 60 | aTable.addBodyRow ().addCells ("Directory information", aReader.toString ()); 61 | } 62 | catch (final IOException ex) 63 | { 64 | aTable.addBodyRow () 65 | .addCell ("Directory information") 66 | .addCell (HCExtHelper.nl2divList (ex.getClass ().getName () + "\n" + StackTraceHelper.getStackAsString (ex))); 67 | } 68 | aNodeList.addChild (aTable); 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /phoss-directory-publisher/src/main/java/com/helger/pd/publisher/app/secure/PageSecureListDeadIndex.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.pd.publisher.app.secure; 18 | 19 | import javax.annotation.Nonnull; 20 | 21 | import com.helger.commons.annotation.Nonempty; 22 | import com.helger.html.hc.impl.HCNodeList; 23 | import com.helger.pd.indexer.mgr.PDIndexerManager; 24 | import com.helger.pd.indexer.mgr.PDMetaManager; 25 | import com.helger.pd.indexer.reindex.IReIndexWorkItemList; 26 | import com.helger.photon.uicore.page.WebPageExecutionContext; 27 | 28 | public final class PageSecureListDeadIndex extends AbstractPageSecureReIndex 29 | { 30 | public PageSecureListDeadIndex (@Nonnull @Nonempty final String sID) 31 | { 32 | super (sID, "Dead Index List", true); 33 | } 34 | 35 | @Override 36 | @Nonnull 37 | protected IReIndexWorkItemList getReIndexWorkItemList () 38 | { 39 | final PDIndexerManager aIndexerMgr = PDMetaManager.getIndexerMgr (); 40 | return aIndexerMgr.getDeadList (); 41 | } 42 | 43 | @Override 44 | protected void showListOfExistingObjects (@Nonnull final WebPageExecutionContext aWPEC) 45 | { 46 | final HCNodeList aNodeList = aWPEC.getNodeList (); 47 | aNodeList.addChild (info ("This page contains all entries where indexing failed totally.")); 48 | super.showListOfExistingObjects (aWPEC); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /phoss-directory-publisher/src/main/java/com/helger/pd/publisher/app/secure/PageSecureListReIndex.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.pd.publisher.app.secure; 18 | 19 | import javax.annotation.Nonnull; 20 | 21 | import com.helger.commons.annotation.Nonempty; 22 | import com.helger.html.hc.impl.HCNodeList; 23 | import com.helger.pd.indexer.mgr.PDIndexerManager; 24 | import com.helger.pd.indexer.mgr.PDMetaManager; 25 | import com.helger.pd.indexer.reindex.IReIndexWorkItemList; 26 | import com.helger.pd.indexer.settings.PDServerConfiguration; 27 | import com.helger.photon.uicore.page.WebPageExecutionContext; 28 | 29 | public final class PageSecureListReIndex extends AbstractPageSecureReIndex 30 | { 31 | public PageSecureListReIndex (@Nonnull @Nonempty final String sID) 32 | { 33 | super (sID, "Re-Index List", false); 34 | } 35 | 36 | @Override 37 | @Nonnull 38 | protected IReIndexWorkItemList getReIndexWorkItemList () 39 | { 40 | final PDIndexerManager aIndexerMgr = PDMetaManager.getIndexerMgr (); 41 | return aIndexerMgr.getReIndexList (); 42 | } 43 | 44 | @Override 45 | protected void showListOfExistingObjects (@Nonnull final WebPageExecutionContext aWPEC) 46 | { 47 | final HCNodeList aNodeList = aWPEC.getNodeList (); 48 | aNodeList.addChild (info ().addChild (div ("This page contains all entries where indexing failed initially but is re-tried.")) 49 | .addChild (div ("Re-index happens every " + PDServerConfiguration.getReIndexRetryMinutes () + " minute(s)")) 50 | .addChild (div ("Re-indexing stops after " + 51 | PDServerConfiguration.getReIndexMaxRetryHours () + 52 | " hour(s)"))); 53 | super.showListOfExistingObjects (aWPEC); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /phoss-directory-publisher/src/main/java/com/helger/pd/publisher/search/EPDOutputFormat.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.pd.publisher.search; 18 | 19 | import javax.annotation.Nonnull; 20 | import javax.annotation.Nullable; 21 | 22 | import com.helger.commons.annotation.Nonempty; 23 | import com.helger.commons.id.IHasID; 24 | import com.helger.commons.lang.EnumHelper; 25 | import com.helger.commons.mime.CMimeType; 26 | import com.helger.commons.mime.IMimeType; 27 | import com.helger.commons.name.IHasDisplayName; 28 | 29 | /** 30 | * Defines the search REST service output format. 31 | * 32 | * @author Philip Helger 33 | */ 34 | public enum EPDOutputFormat implements IHasID , IHasDisplayName 35 | { 36 | XML ("xml", "XML", CMimeType.APPLICATION_XML, ".xml"), 37 | JSON ("json", "JSON", CMimeType.APPLICATION_JSON, ".json"); 38 | 39 | private final String m_sID; 40 | private final String m_sDisplayName; 41 | private final IMimeType m_aMimeType; 42 | private final String m_sFileExtension; 43 | 44 | private EPDOutputFormat (@Nonnull @Nonempty final String sID, 45 | @Nonnull @Nonempty final String sDisplayName, 46 | @Nonnull final IMimeType aMimeType, 47 | @Nonnull @Nonempty final String sFileExtension) 48 | { 49 | m_sID = sID; 50 | m_sDisplayName = sDisplayName; 51 | m_aMimeType = aMimeType; 52 | m_sFileExtension = sFileExtension; 53 | } 54 | 55 | @Nonnull 56 | @Nonempty 57 | public String getID () 58 | { 59 | return m_sID; 60 | } 61 | 62 | @Nonnull 63 | @Nonempty 64 | public String getDisplayName () 65 | { 66 | return m_sDisplayName; 67 | } 68 | 69 | /** 70 | * @return The MIME type to be used for this format. Never null. 71 | */ 72 | @Nonnull 73 | public IMimeType getMimeType () 74 | { 75 | return m_aMimeType; 76 | } 77 | 78 | /** 79 | * @return The filename extension for this output format. Neither 80 | * null nor empty and always starting with a dot! 81 | */ 82 | @Nonnull 83 | @Nonempty 84 | public String getFileExtension () 85 | { 86 | return m_sFileExtension; 87 | } 88 | 89 | @Nullable 90 | public static EPDOutputFormat getFromIDCaseInsensitiveOrNull (@Nullable final String sID) 91 | { 92 | return EnumHelper.getFromIDCaseInsensitiveOrNull (EPDOutputFormat.class, sID); 93 | } 94 | 95 | @Nullable 96 | public static EPDOutputFormat getFromIDCaseInsensitiveOrDefault (@Nullable final String sID, @Nullable final EPDOutputFormat eDefault) 97 | { 98 | return EnumHelper.getFromIDCaseInsensitiveOrDefault (EPDOutputFormat.class, sID, eDefault); 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /phoss-directory-publisher/src/main/java/com/helger/pd/publisher/search/EPDSearchFieldName.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.pd.publisher.search; 18 | 19 | import java.util.Locale; 20 | 21 | import javax.annotation.Nonnull; 22 | import javax.annotation.Nullable; 23 | 24 | import com.helger.commons.text.IMultilingualText; 25 | import com.helger.commons.text.display.IHasDisplayText; 26 | import com.helger.commons.text.resolve.DefaultTextResolver; 27 | import com.helger.commons.text.util.TextHelper; 28 | 29 | /** 30 | * Multilingual names for {@link EPDSearchField}. 31 | * 32 | * @author Philip Helger 33 | */ 34 | public enum EPDSearchFieldName implements IHasDisplayText 35 | { 36 | GENERIC ("Allgemeiner Suchtext", "Generic search text"), 37 | PARTICIPANT_ID ("Teilnehmer ID", "Participant ID"), 38 | NAME ("Name", "Name"), 39 | COUNTRY ("Land", "Country"), 40 | GEO_INFO ("Geographische Information", "Geographical information"), 41 | IDENTIFIER ("Andere ID", "Additional identifiers"), 42 | WEBSITE ("Website", "Web site"), 43 | CONTACT ("Kontaktperson", "Contact person"), 44 | ADDITIONAL_INFORMATION ("Freitext", "Additional information"), 45 | REGISTRATION_DATE ("Registrierungsdatum", "Registration date"), 46 | DOCUMENT_TYPE ("Dokumentenart", "Document type"); 47 | 48 | private final IMultilingualText m_aTP; 49 | 50 | private EPDSearchFieldName (@Nonnull final String sDE, @Nonnull final String sEN) 51 | { 52 | m_aTP = TextHelper.create_DE_EN (sDE, sEN); 53 | } 54 | 55 | @Nullable 56 | public String getDisplayText (@Nonnull final Locale aContentLocale) 57 | { 58 | return DefaultTextResolver.getTextStatic (this, m_aTP, aContentLocale); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /phoss-directory-publisher/src/main/java/com/helger/pd/publisher/search/ESearchOperatorText.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.pd.publisher.search; 18 | 19 | import java.util.Locale; 20 | 21 | import javax.annotation.Nonnull; 22 | import javax.annotation.Nullable; 23 | 24 | import com.helger.commons.text.IMultilingualText; 25 | import com.helger.commons.text.display.IHasDisplayText; 26 | import com.helger.commons.text.resolve.DefaultTextResolver; 27 | import com.helger.commons.text.util.TextHelper; 28 | 29 | /** 30 | * Multilingual names for {@link ESearchOperator}. 31 | * 32 | * @author Philip Helger 33 | */ 34 | public enum ESearchOperatorText implements IHasDisplayText 35 | { 36 | /** Equals */ 37 | EQ ("="), 38 | /** Not equals */ 39 | NE ("!="), 40 | /** Lower than */ 41 | LT ("<"), 42 | /** Lower or equal */ 43 | LE ("<="), 44 | /** Greater than */ 45 | GT (">"), 46 | /** Greater or equal */ 47 | GE (">="), 48 | /** Is empty */ 49 | EMPTY ("leer", "empty"), 50 | /** Is not empty */ 51 | NOT_EMPTY ("gesetzt", "not empty"), 52 | /** String contains */ 53 | STRING_CONTAINS ("enthält", "contains"), 54 | /** String starts with */ 55 | STRING_STARTS_WITH ("beginnt mit", "starts with"), 56 | /** String ends with */ 57 | STRING_ENDS_WITH ("endet mit", "ends with"), 58 | /** String matches regular expression */ 59 | STRING_REGEX ("entspricht regulärem Ausdruck", "matches regular expression"), 60 | /** Int even */ 61 | INT_EVEN ("gerade", "even"), 62 | /** Int odd */ 63 | INT_ODD ("ungerade", "odd"), 64 | /** Year of date */ 65 | DATE_YEAR ("Jahr", "year"), 66 | /** Month of date */ 67 | DATE_MONTH ("Monat", "month"), 68 | /** Day of date */ 69 | DATE_DAY ("Tag", "day"), 70 | /** Year and month of date */ 71 | DATE_YEAR_MONTH ("Jahr und Monat", "year and month"), 72 | /** Month and day of date */ 73 | DATE_MONTH_DAY ("Monat und Tag", "month and day"), 74 | /** Hour of time */ 75 | TIME_HOUR ("Stunde", "hour"), 76 | /** Minute of time */ 77 | TIME_MINUTE ("Minute", "minute"), 78 | /** Second of time */ 79 | TIME_SECOND ("Sekunde", "second"); 80 | 81 | private final IMultilingualText m_aTP; 82 | 83 | private ESearchOperatorText (@Nonnull final String sGeneric) 84 | { 85 | this (sGeneric, sGeneric); 86 | } 87 | 88 | private ESearchOperatorText (@Nonnull final String sDE, @Nonnull final String sEN) 89 | { 90 | m_aTP = TextHelper.create_DE_EN (sDE, sEN); 91 | } 92 | 93 | @Nullable 94 | public String getDisplayText (@Nonnull final Locale aContentLocale) 95 | { 96 | return DefaultTextResolver.getTextStatic (this, m_aTP, aContentLocale); 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /phoss-directory-publisher/src/main/java/com/helger/pd/publisher/search/SearchRateLimit.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.pd.publisher.search; 18 | 19 | import java.time.Duration; 20 | 21 | import javax.annotation.Nullable; 22 | 23 | import org.slf4j.Logger; 24 | import org.slf4j.LoggerFactory; 25 | 26 | import com.helger.pd.indexer.settings.PDServerConfiguration; 27 | 28 | import es.moki.ratelimitj.core.limiter.request.RequestLimitRule; 29 | import es.moki.ratelimitj.core.limiter.request.RequestRateLimiter; 30 | import es.moki.ratelimitj.inmemory.request.InMemorySlidingWindowRequestRateLimiter; 31 | 32 | public final class SearchRateLimit 33 | { 34 | // Before the Instance, because it is used in the constructor 35 | private static final Logger LOGGER = LoggerFactory.getLogger (SearchRateLimit.class); 36 | public static final SearchRateLimit INSTANCE = new SearchRateLimit (); 37 | 38 | private final RequestRateLimiter m_aRequestRateLimiter; 39 | 40 | private SearchRateLimit () 41 | { 42 | final long nRequestsPerSec = PDServerConfiguration.getRESTAPIMaxRequestsPerSecond (); 43 | if (nRequestsPerSec > 0) 44 | { 45 | // 2 request per second, per key 46 | // Note: duration must be > 1 second 47 | m_aRequestRateLimiter = new InMemorySlidingWindowRequestRateLimiter (RequestLimitRule.of (Duration.ofSeconds (2), 48 | nRequestsPerSec * 2)); 49 | LOGGER.info ("Installed search rate limiter with a maximum of " + nRequestsPerSec + " requests per second"); 50 | } 51 | else 52 | { 53 | m_aRequestRateLimiter = null; 54 | LOGGER.info ("Search API runs without limit"); 55 | } 56 | } 57 | 58 | @Nullable 59 | public RequestRateLimiter rateLimiter () 60 | { 61 | return m_aRequestRateLimiter; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /phoss-directory-publisher/src/main/java/com/helger/pd/publisher/servlet/AppRootServlet.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.pd.publisher.servlet; 18 | 19 | import com.helger.commons.http.EHttpMethod; 20 | import com.helger.photon.core.servlet.AbstractPublicApplicationServlet; 21 | import com.helger.photon.core.servlet.RootXServletHandler; 22 | import com.helger.xservlet.AbstractXServlet; 23 | 24 | public class AppRootServlet extends AbstractXServlet 25 | { 26 | public AppRootServlet () 27 | { 28 | handlerRegistry ().registerHandler (EHttpMethod.GET, new RootXServletHandler (AbstractPublicApplicationServlet.SERVLET_DEFAULT_PATH)); 29 | handlerRegistry ().copyHandlerToAll (EHttpMethod.GET); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /phoss-directory-publisher/src/main/java/com/helger/pd/publisher/servlet/ExportServlet.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.pd.publisher.servlet; 18 | 19 | import com.helger.commons.http.EHttpMethod; 20 | import com.helger.xservlet.AbstractXServlet; 21 | 22 | /** 23 | * Simple servlet streaming files not normally visible by the web server. 24 | * 25 | * @author philip 26 | */ 27 | public final class ExportServlet extends AbstractXServlet 28 | { 29 | public static final String SERVLET_DEFAULT_NAME = "export"; 30 | public static final String SERVLET_DEFAULT_PATH = '/' + SERVLET_DEFAULT_NAME; 31 | 32 | public ExportServlet () 33 | { 34 | handlerRegistry ().registerHandler (EHttpMethod.GET, new ExportDeliveryHttpHandler ()); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /phoss-directory-publisher/src/main/java/com/helger/pd/publisher/servlet/PublicApplicationServlet.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.pd.publisher.servlet; 18 | 19 | import com.helger.pd.publisher.app.pub.PublicHTMLProvider; 20 | import com.helger.photon.app.html.IHTMLProvider; 21 | import com.helger.photon.core.servlet.AbstractApplicationXServletHandler; 22 | import com.helger.photon.core.servlet.AbstractPublicApplicationServlet; 23 | import com.helger.web.scope.IRequestWebScopeWithoutResponse; 24 | 25 | public class PublicApplicationServlet extends AbstractPublicApplicationServlet 26 | { 27 | public PublicApplicationServlet () 28 | { 29 | super (new AbstractApplicationXServletHandler () 30 | { 31 | @Override 32 | protected IHTMLProvider createHTMLProvider (final IRequestWebScopeWithoutResponse aRequestScope) 33 | { 34 | return new PublicHTMLProvider (); 35 | } 36 | }); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /phoss-directory-publisher/src/main/java/com/helger/pd/publisher/servlet/PublicParticipantServlet.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.pd.publisher.servlet; 18 | 19 | import com.helger.commons.http.EHttpMethod; 20 | import com.helger.xservlet.AbstractXServlet; 21 | 22 | /** 23 | * The participant quick lookup servlet (issue #30). Handles only GET requests. 24 | * 25 | * @author Philip Helger 26 | */ 27 | public final class PublicParticipantServlet extends AbstractXServlet 28 | { 29 | public PublicParticipantServlet () 30 | { 31 | handlerRegistry ().registerHandler (EHttpMethod.GET, new PublicParticipantXServletHandler ()); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /phoss-directory-publisher/src/main/java/com/helger/pd/publisher/servlet/PublicSearchServlet.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.pd.publisher.servlet; 18 | 19 | import com.helger.commons.http.EHttpMethod; 20 | import com.helger.xservlet.AbstractXServlet; 21 | 22 | /** 23 | * The REST search servlet. Handles only GET requests. 24 | * 25 | * @author Philip Helger 26 | */ 27 | public final class PublicSearchServlet extends AbstractXServlet 28 | { 29 | public PublicSearchServlet () 30 | { 31 | handlerRegistry ().registerHandler (EHttpMethod.GET, new PublicSearchXServletHandler ()); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /phoss-directory-publisher/src/main/java/com/helger/pd/publisher/servlet/SecureApplicationServlet.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.pd.publisher.servlet; 18 | 19 | import com.helger.pd.publisher.app.secure.SecureHTMLProvider; 20 | import com.helger.photon.app.html.IHTMLProvider; 21 | import com.helger.photon.core.servlet.AbstractApplicationXServletHandler; 22 | import com.helger.photon.core.servlet.AbstractSecureApplicationServlet; 23 | import com.helger.web.scope.IRequestWebScopeWithoutResponse; 24 | 25 | /** 26 | * The servlet to show the secure application 27 | * 28 | * @author Philip Helger 29 | */ 30 | public class SecureApplicationServlet extends AbstractSecureApplicationServlet 31 | { 32 | public SecureApplicationServlet () 33 | { 34 | super (new AbstractApplicationXServletHandler () 35 | { 36 | @Override 37 | protected IHTMLProvider createHTMLProvider (final IRequestWebScopeWithoutResponse aRequestScope) 38 | { 39 | return new SecureHTMLProvider (); 40 | } 41 | }); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /phoss-directory-publisher/src/main/java/com/helger/pd/publisher/servlet/SecureLoginFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.pd.publisher.servlet; 18 | 19 | import javax.annotation.Nonnull; 20 | 21 | import com.helger.commons.state.EContinue; 22 | import com.helger.pd.publisher.app.AppSecurity; 23 | import com.helger.pd.publisher.app.PDLoginManager; 24 | import com.helger.photon.core.servlet.AbstractUnifiedResponseFilter; 25 | import com.helger.photon.security.login.LoggedInUserManager; 26 | import com.helger.photon.security.util.SecurityHelper; 27 | import com.helger.servlet.response.UnifiedResponse; 28 | import com.helger.web.scope.IRequestWebScopeWithoutResponse; 29 | 30 | import jakarta.servlet.ServletException; 31 | import jakarta.servlet.http.HttpServletResponse; 32 | 33 | /** 34 | * A special servlet filter that checks that a user can only access the config 35 | * application after authenticating. 36 | * 37 | * @author Philip Helger 38 | */ 39 | public final class SecureLoginFilter extends AbstractUnifiedResponseFilter 40 | { 41 | private PDLoginManager m_aLogin; 42 | 43 | @Override 44 | public void init () throws ServletException 45 | { 46 | super.init (); 47 | // Make the application login configurable if you like 48 | m_aLogin = new PDLoginManager (); 49 | } 50 | 51 | @Override 52 | @Nonnull 53 | protected EContinue handleRequest (@Nonnull final IRequestWebScopeWithoutResponse aRequestScope, 54 | @Nonnull final UnifiedResponse aUnifiedResponse) throws ServletException 55 | { 56 | if (m_aLogin.checkUserAndShowLogin (aRequestScope, aUnifiedResponse).isBreak ()) 57 | { 58 | // Show login screen 59 | return EContinue.BREAK; 60 | } 61 | 62 | // Check if the currently logged in user has the required roles 63 | final String sCurrentUserID = LoggedInUserManager.getInstance ().getCurrentUserID (); 64 | if (!SecurityHelper.hasUserAllRoles (sCurrentUserID, AppSecurity.REQUIRED_ROLE_IDS_CONFIG)) 65 | { 66 | aUnifiedResponse.setStatus (HttpServletResponse.SC_FORBIDDEN); 67 | return EContinue.BREAK; 68 | } 69 | 70 | return EContinue.CONTINUE; 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /phoss-directory-publisher/src/main/java/com/helger/pd/publisher/ui/AbstractAppWebPage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.pd.publisher.ui; 18 | 19 | import javax.annotation.Nonnull; 20 | 21 | import com.helger.commons.annotation.Nonempty; 22 | import com.helger.photon.bootstrap4.pages.AbstractBootstrapWebPage; 23 | import com.helger.photon.uicore.page.WebPageExecutionContext; 24 | 25 | public abstract class AbstractAppWebPage extends AbstractBootstrapWebPage 26 | { 27 | public AbstractAppWebPage (@Nonnull @Nonempty final String sID, @Nonnull final String sName) 28 | { 29 | super (sID, sName); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /phoss-directory-publisher/src/main/java/com/helger/pd/publisher/ui/AbstractAppWebPageForm.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.pd.publisher.ui; 18 | 19 | import javax.annotation.Nonnull; 20 | import javax.annotation.Nullable; 21 | 22 | import com.helger.commons.annotation.Nonempty; 23 | import com.helger.commons.id.IHasID; 24 | import com.helger.commons.name.IHasDisplayName; 25 | import com.helger.photon.bootstrap4.pages.AbstractBootstrapWebPageForm; 26 | import com.helger.photon.uicore.page.WebPageExecutionContext; 27 | 28 | public abstract class AbstractAppWebPageForm > extends 29 | AbstractBootstrapWebPageForm 30 | { 31 | public AbstractAppWebPageForm (@Nonnull @Nonempty final String sID, @Nonnull final String sName) 32 | { 33 | super (sID, sName); 34 | } 35 | 36 | @Override 37 | @Nullable 38 | public String getHeaderText (@Nonnull final WebPageExecutionContext aWPEC) 39 | { 40 | final DATATYPE aSelectedObject = getSelectedObject (aWPEC, getSelectedObjectID (aWPEC)); 41 | if (aSelectedObject instanceof IHasDisplayName) 42 | return ((IHasDisplayName) aSelectedObject).getDisplayName (); 43 | return super.getHeaderText (aWPEC); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /phoss-directory-publisher/src/main/java/com/helger/pd/publisher/ui/AppPageViewExternal.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.pd.publisher.ui; 18 | 19 | import javax.annotation.Nonnull; 20 | import javax.annotation.Nullable; 21 | 22 | import com.helger.commons.annotation.Nonempty; 23 | import com.helger.commons.io.resource.IReadableResource; 24 | import com.helger.html.EHTMLVersion; 25 | import com.helger.html.hc.IHCNode; 26 | import com.helger.photon.bootstrap4.pages.BootstrapWebPageUIHandler; 27 | import com.helger.photon.uicore.page.WebPageExecutionContext; 28 | import com.helger.photon.uicore.page.external.BasePageViewExternal; 29 | import com.helger.photon.uicore.page.external.PageViewExternalHTMLCleanser; 30 | import com.helger.xml.microdom.IMicroContainer; 31 | import com.helger.xml.microdom.util.MicroVisitor; 32 | 33 | public class AppPageViewExternal extends BasePageViewExternal 34 | { 35 | private static void _cleanCode (@Nonnull final IMicroContainer aCont) 36 | { 37 | // Do not clean texts, because this destroys "pre" formatting! 38 | final PageViewExternalHTMLCleanser aCleanser = new PageViewExternalHTMLCleanser (EHTMLVersion.HTML5).setCleanTexts (false); 39 | MicroVisitor.visit (aCont, aCleanser); 40 | } 41 | 42 | public AppPageViewExternal (@Nonnull @Nonempty final String sID, @Nonnull final String sName, @Nonnull final IReadableResource aResource) 43 | { 44 | // Special content cleaner 45 | super (sID, sName, aResource, AppPageViewExternal::_cleanCode); 46 | } 47 | 48 | @Override 49 | @Nullable 50 | public IHCNode getHeaderNode (@Nonnull final WebPageExecutionContext aWPEC) 51 | { 52 | final String sHeaderText = getHeaderText (aWPEC); 53 | return BootstrapWebPageUIHandler.INSTANCE.createPageHeader (sHeaderText); 54 | } 55 | 56 | @Override 57 | protected void fillContent (@Nonnull final WebPageExecutionContext aWPEC) 58 | { 59 | super.fillContent (aWPEC); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /phoss-directory-publisher/src/main/java/com/helger/pd/publisher/ui/HCSearchOperatorSelect.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.pd.publisher.ui; 18 | 19 | import java.util.EnumSet; 20 | import java.util.Locale; 21 | 22 | import javax.annotation.Nonnull; 23 | 24 | import com.helger.html.request.IHCRequestField; 25 | import com.helger.pd.publisher.search.ESearchDataType; 26 | import com.helger.pd.publisher.search.ESearchOperator; 27 | import com.helger.photon.uicore.html.select.HCExtSelect; 28 | 29 | public class HCSearchOperatorSelect extends HCExtSelect 30 | { 31 | public HCSearchOperatorSelect (@Nonnull final IHCRequestField aRF, 32 | @Nonnull final ESearchDataType eDataType, 33 | @Nonnull final Locale aDisplayLocale) 34 | { 35 | this (aRF, eDataType.getAllAllowedOperators (), aDisplayLocale); 36 | } 37 | 38 | public HCSearchOperatorSelect (@Nonnull final IHCRequestField aRF, 39 | @Nonnull final EnumSet aOperators, 40 | @Nonnull final Locale aDisplayLocale) 41 | { 42 | super (aRF); 43 | 44 | for (final ESearchOperator eOp : aOperators) 45 | addOption (eOp.getID (), eOp.getDisplayText (aDisplayLocale)); 46 | addOptionPleaseSelect (aDisplayLocale); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /phoss-directory-publisher/src/main/resources/NOTICE: -------------------------------------------------------------------------------- 1 | ============================================================================= 2 | = NOTICE file corresponding to section 4d of the Apache License Version 2.0 = 3 | ============================================================================= 4 | This product includes Open Source Software developed by 5 | Philip Helger - https://www.helger.com/ 6 | -------------------------------------------------------------------------------- /phoss-directory-publisher/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2015-2025 Philip Helger (www.helger.com) 3 | # philip[at]helger[dot]com 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | # For SMP client 19 | smpclient.truststore.type = jks 20 | smpclient.truststore.path = truststore/complete-truststore.jks 21 | smpclient.truststore.password = peppol 22 | -------------------------------------------------------------------------------- /phoss-directory-publisher/src/main/resources/html/css.xml: -------------------------------------------------------------------------------- 1 | 2 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /phoss-directory-publisher/src/main/resources/html/js.xml: -------------------------------------------------------------------------------- 1 | 2 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /phoss-directory-publisher/src/main/resources/html/metatags.xml: -------------------------------------------------------------------------------- 1 | 2 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /phoss-directory-publisher/src/main/resources/log4j2-prod.xml: -------------------------------------------------------------------------------- 1 | 2 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /phoss-directory-publisher/src/main/resources/log4j2-testing.xml: -------------------------------------------------------------------------------- 1 | 2 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /phoss-directory-publisher/src/main/resources/log4j2.xml: -------------------------------------------------------------------------------- 1 | 2 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /phoss-directory-publisher/src/main/resources/pd.de4a.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2015-2025 Philip Helger (www.helger.com) 3 | # philip[at]helger[dot]com 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | # Global flags for initializer 19 | global.debug = false 20 | global.production = false 21 | 22 | # Central directory where the data should be stored 23 | webapp.datapath = /de4a/data 24 | 25 | # Should all files of the application checked for readability? 26 | webapp.checkfileaccess = false 27 | 28 | # Is it a test version? E.g. a separate header 29 | webapp.testversion = false 30 | 31 | webapp.search.ui=de4a 32 | 33 | # Application name 34 | webapp.appname = DE4A Directory 35 | #TODO 36 | webapp.applogo.image.path = /imgs/de4a/de4a-small-158-50.png 37 | webapp.favicon.png.16x16 = /imgs/de4a/favicon-16x16.png 38 | webapp.favicon.png.32x32 = /imgs/de4a/favicon-32x32.png 39 | webapp.favicon.png.96x96 = /imgs/de4a/favicon-96x96.png 40 | 41 | # Vendor name and URL 42 | webapp.vendor.name = DE4A EU project 43 | webapp.vendor.url = https://www.de4a.eu 44 | 45 | # Change image 46 | #TODO 47 | #webapp.logo.image.path = /imgs/toop-directory.png 48 | 49 | # Is the client certificate validation for the indexer active? 50 | # Can only be enabled when the server runs on https! 51 | indexer.clientcert.validation = false 52 | 53 | # The issuer of the certificate to be passed by the client 54 | #clientcert.issuer.1=CN=TeleSec Business CA 1,OU=T-Systems Trust Center,O=T-Systems International GmbH,C=DE 55 | 56 | # The truststore to check for SMP certificates 57 | #truststore.1.type=jks 58 | #truststore.1.path=truststore/de4a-truststore-smp-it2-pw-de4a.jks 59 | #truststore.1.password=de4a 60 | #truststore.1.alias=telesec business ca 1 (t-telesec globalroot class 2) 61 | 62 | # Use the U-NAPTR lookup 63 | sml.urlprovider = esens 64 | 65 | # Use OASIS BDXR SMP client 66 | smp.mode = oasis-bdxr-v1 67 | 68 | smp.tls.trust-all = true 69 | 70 | reindex.maxretryhours=24 71 | reindex.retryminutes=5 72 | 73 | # Identifier types 74 | identifier.type = oasis-bdxr-v1 75 | 76 | # SMP mode to use 77 | smp.mode = oasis-bdxr-v1 78 | 79 | # Maximum 2 search requests per second 80 | rest.limit.requestspersecond=2 81 | 82 | # Sync all business cards 83 | sync.businesscards = true 84 | -------------------------------------------------------------------------------- /phoss-directory-publisher/src/main/resources/pd.dev.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2015-2025 Philip Helger (www.helger.com) 3 | # philip[at]helger[dot]com 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | # Global flags for initializer 19 | global.debug = true 20 | global.production = false 21 | 22 | # Central directory where the data should be stored 23 | webapp.datapath = /var/www/peppol-directory/data 24 | 25 | # Should all files of the application checked for readability? 26 | webapp.checkfileaccess = false 27 | 28 | # Is it a test version? E.g. a separate header 29 | webapp.testversion = true 30 | 31 | webapp.search.ui=peppol 32 | 33 | # Application name 34 | webapp.appname = phoss Directory 35 | webapp.applogo.image.path = 36 | #webapp.favicon.png.16x16 = /imgs/toop/favicon-16x16.png 37 | #webapp.favicon.png.32x32 = /imgs/toop/favicon-32x32.png 38 | #webapp.favicon.png.96x96 = /imgs/toop/favicon-96x96.png 39 | 40 | # Is the client certificate validation for the indexer active? 41 | # Can only be enabled when the server runs on https! 42 | indexer.clientcert.validation = false 43 | 44 | # The issuer of the certificate to be passed by the client 45 | clientcert.issuer.1=CN=PEPPOL SERVICE METADATA PUBLISHER CA - G2,O=OpenPEPPOL AISBL,C=BE 46 | clientcert.issuer.2=CN=PEPPOL SERVICE METADATA PUBLISHER TEST CA - G2,OU=FOR TEST ONLY,O=OpenPEPPOL AISBL,C=BE 47 | 48 | # The truststores to check for Peppol certificates 49 | truststore.1.type=jks 50 | truststore.1.path=truststore/complete-truststore.jks 51 | truststore.1.password=peppol 52 | truststore.1.alias=peppol service metadata publisher ca - g2 (peppol root ca - g2) 53 | 54 | truststore.2.type=jks 55 | truststore.2.path=truststore/complete-truststore.jks 56 | truststore.2.password=peppol 57 | truststore.2.alias=peppol service metadata publisher test ca - g2 (peppol root test ca - g2) 58 | 59 | reindex.maxretryhours=24 60 | reindex.retryminutes=5 61 | 62 | # Identifier types 63 | identifier.type = peppol 64 | #identifier.type = simple 65 | 66 | # SMP mode to use 67 | smp.mode = peppol 68 | 69 | smp.tls.trust-all = false 70 | 71 | # Fixed SMP URI? 72 | #smp.uri = http://localhost:90 73 | 74 | # Maximum 2 search requests per second 75 | rest.limit.requestspersecond=2 76 | 77 | # Don't sync all business cards 78 | sync.businesscards = false 79 | -------------------------------------------------------------------------------- /phoss-directory-publisher/src/main/resources/pd.peppol-prod.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2015-2025 Philip Helger (www.helger.com) 3 | # philip[at]helger[dot]com 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | # Global flags for initializer 19 | global.debug = false 20 | global.production = true 21 | 22 | # Central directory where the data should be stored 23 | webapp.datapath = /opt/tomcat/peppoldirectory-smlprod 24 | 25 | # Should all files of the application checked for readability? 26 | webapp.checkfileaccess = false 27 | 28 | # Is it a test version? E.g. a separate header 29 | webapp.testversion = false 30 | 31 | webapp.search.ui=peppol 32 | 33 | # Application name 34 | webapp.appname = Peppol Directory 35 | webapp.applogo.image.path = /imgs/peppol/peppol-small-204-50.png 36 | webapp.favicon.png.16x16 = /imgs/peppol/favicon-16x16.png 37 | webapp.favicon.png.32x32 = /imgs/peppol/favicon-32x32.png 38 | webapp.favicon.png.96x96 = /imgs/peppol/favicon-96x96.png 39 | 40 | # Force all paths (links) to be "/" instead of the context path 41 | # This is helpful if the web application runs in a context like "/pd" but is proxied to a root path 42 | webapp.forceroot = true 43 | 44 | webapp.google.analytics.account = UA-55419519-3 45 | 46 | # Show contact form 47 | webapp.contact.show = true 48 | webapp.contact.title = Peppol Service Desk 49 | webapp.contact.external.url = https://openpeppol.atlassian.net/servicedesk/customer/portal/1 50 | 51 | # Is the client certificate validation for the indexer active? 52 | # Can only be enabled when the server runs on https! 53 | indexer.clientcert.validation = true 54 | 55 | # The issuer of the certificate to be passed by the client 56 | clientcert.issuer.1=CN=PEPPOL SERVICE METADATA PUBLISHER CA - G2,O=OpenPEPPOL AISBL,C=BE 57 | 58 | # The truststore to check for PEPPOL certificates 59 | truststore.1.type=jks 60 | truststore.1.path=truststore/complete-truststore.jks 61 | truststore.1.password=peppol 62 | truststore.1.alias=peppol service metadata publisher ca - g2 (peppol root ca - g2) 63 | 64 | # Try at maximum 1 hour 65 | reindex.maxretryhours=1 66 | 67 | # Retry every 10 minutes 68 | reindex.retryminutes=10 69 | 70 | # Identifier types 71 | identifier.type = peppol 72 | 73 | # SMP mode to use 74 | smp.mode = peppol 75 | 76 | smp.tls.trust-all = false 77 | 78 | # Maximum 2 search requests per second 79 | rest.limit.requestspersecond=2 80 | 81 | # Don't sync all business cards 82 | sync.businesscards = false 83 | -------------------------------------------------------------------------------- /phoss-directory-publisher/src/main/resources/pd.peppol-test.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2015-2025 Philip Helger (www.helger.com) 3 | # philip[at]helger[dot]com 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | # Global flags for initializer 19 | global.debug = false 20 | global.production = true 21 | 22 | # Central directory where the data should be stored 23 | webapp.datapath = /opt/tomcat/peppoldirectory-smkprod 24 | 25 | # Should all files of the application checked for readability? 26 | webapp.checkfileaccess = false 27 | 28 | # Is it a test version? E.g. a separate header 29 | webapp.testversion = true 30 | 31 | webapp.search.ui=peppol 32 | 33 | # Application name 34 | webapp.appname = Peppol Directory 35 | webapp.applogo.image.path = /imgs/peppol/peppol-small-204-50.png 36 | webapp.favicon.png.16x16 = /imgs/peppol/favicon-16x16.png 37 | webapp.favicon.png.32x32 = /imgs/peppol/favicon-32x32.png 38 | webapp.favicon.png.96x96 = /imgs/peppol/favicon-96x96.png 39 | 40 | # Force all paths (links) to be "/" instead of the context path 41 | # This is helpful if the web application runs in a context like "/pd" but is proxied to a root path 42 | webapp.forceroot = true 43 | 44 | webapp.google.analytics.account = UA-55419519-2 45 | 46 | # Show contact form 47 | webapp.contact.show = true 48 | webapp.contact.title = Peppol Service Desk 49 | webapp.contact.external.url = https://openpeppol.atlassian.net/servicedesk/customer/portal/1 50 | 51 | # Is the client certificate validation for the indexer active? 52 | # Can only be enabled when the server runs on https! 53 | indexer.clientcert.validation = true 54 | 55 | # The issuer of the certificate to be passed by the client 56 | clientcert.issuer.1=CN=PEPPOL SERVICE METADATA PUBLISHER TEST CA - G2,OU=FOR TEST ONLY,O=OpenPEPPOL AISBL,C=BE 57 | 58 | # The truststore to check for PEPPOL certificates 59 | truststore.1.type=jks 60 | truststore.1.path=truststore/complete-truststore.jks 61 | truststore.1.password=peppol 62 | truststore.1.alias=peppol service metadata publisher test ca - g2 (peppol root test ca - g2) 63 | 64 | # Try at maximum 1 hour 65 | reindex.maxretryhours=1 66 | 67 | # Retry every 10 minutes 68 | reindex.retryminutes=10 69 | # Identifier types 70 | identifier.type = peppol 71 | 72 | # SMP mode to use 73 | smp.mode = peppol 74 | 75 | smp.tls.trust-all = false 76 | 77 | # Maximum 2 search requests per second 78 | rest.limit.requestspersecond=2 79 | 80 | # Don't sync all business cards 81 | sync.businesscards = false 82 | -------------------------------------------------------------------------------- /phoss-directory-publisher/src/main/resources/pd.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2015-2025 Philip Helger (www.helger.com) 3 | # philip[at]helger[dot]com 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | # Global flags for initializer 19 | global.debug = true 20 | global.production = false 21 | 22 | # Central directory where the data should be stored 23 | webapp.datapath = /var/www/peppol-directory/data 24 | 25 | # Should all files of the application checked for readability? 26 | webapp.checkfileaccess = false 27 | 28 | # Is it a test version? E.g. a separate header 29 | webapp.testversion = true 30 | 31 | # Allowed values: peppol, de4a, toop 32 | webapp.search.ui=peppol 33 | 34 | # Application name 35 | webapp.appname = phoss Directory 36 | webapp.applogo.image.path = /imgs/peppol/peppol-small-204-50.png 37 | webapp.favicon.png.16x16 = /imgs/peppol/favicon-16x16.png 38 | webapp.favicon.png.32x32 = /imgs/peppol/favicon-32x32.png 39 | webapp.favicon.png.96x96 = /imgs/peppol/favicon-96x96.png 40 | 41 | # Vendor name and URL 42 | #webapp.vendor.name = Who's operating it 43 | #webapp.vendor.url = http://toop.eu 44 | 45 | # Show contact form 46 | webapp.contact.show = true 47 | webapp.contact.title = Peppol Service Desk 48 | webapp.contact.external.url = https://openpeppol.atlassian.net/servicedesk/customer/portal/1 49 | 50 | # Is the client certificate validation for the indexer active? 51 | # Can only be enabled when the server runs on https! 52 | indexer.clientcert.validation = false 53 | 54 | # The issuer of the certificate to be passed by the client 55 | clientcert.issuer.1=CN=PEPPOL SERVICE METADATA PUBLISHER CA - G2,O=OpenPEPPOL AISBL,C=BE 56 | clientcert.issuer.2=CN=PEPPOL SERVICE METADATA PUBLISHER TEST CA - G2,OU=FOR TEST ONLY,O=OpenPEPPOL AISBL,C=BE 57 | 58 | # The truststores to check for Peppol certificates 59 | truststore.1.type=jks 60 | truststore.1.path=truststore/complete-truststore.jks 61 | truststore.1.password=peppol 62 | truststore.1.alias=peppol service metadata publisher ca - g2 (peppol root ca - g2) 63 | 64 | truststore.2.type=jks 65 | truststore.2.path=truststore/complete-truststore.jks 66 | truststore.2.password=peppol 67 | truststore.2.alias=peppol service metadata publisher test ca - g2 (peppol root test ca - g2) 68 | 69 | reindex.maxretryhours=24 70 | reindex.retryminutes=5 71 | 72 | # Identifier types 73 | identifier.type = peppol 74 | #identifier.type = simple 75 | 76 | # SMP mode to use 77 | # oasis-bdxr-v1, oasis-bdxr-v2 or peppol 78 | smp.mode = peppol 79 | 80 | smp.tls.trust-all = false 81 | 82 | # Fixed SMP URI? 83 | #smp.uri = http://localhost:90 84 | 85 | # Maximum 2 search requests per second 86 | rest.limit.requestspersecond=2 87 | 88 | # Don't sync all business cards 89 | sync.businesscards = false 90 | -------------------------------------------------------------------------------- /phoss-directory-publisher/src/main/resources/pd.toop4eu.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2015-2025 Philip Helger (www.helger.com) 3 | # philip[at]helger[dot]com 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | # Global flags for initializer 19 | global.debug = false 20 | global.production = false 21 | 22 | # Central directory where the data should be stored 23 | webapp.datapath = /toop-dir/directory/data 24 | 25 | # Should all files of the application checked for readability? 26 | webapp.checkfileaccess = false 27 | 28 | # Is it a test version? E.g. a separate header 29 | webapp.testversion = false 30 | 31 | webapp.search.ui = toop 32 | 33 | # Application name 34 | webapp.appname = TOOP Directory 35 | webapp.applogo.image.path = /imgs/toop/toop-small-144-50.png 36 | webapp.favicon.png.16x16 = /imgs/toop/favicon-16x16.png 37 | webapp.favicon.png.32x32 = /imgs/toop/favicon-32x32.png 38 | webapp.favicon.png.96x96 = /imgs/toop/favicon-96x96.png 39 | 40 | # Vendor name and URL 41 | webapp.vendor.name = TOOP CCTF 42 | webapp.vendor.url = http://toop.eu 43 | 44 | # Change image 45 | webapp.logo.image.path = /imgs/toop-directory.png 46 | 47 | # Is the client certificate validation for the indexer active? 48 | # Can only be enabled when the server runs on https! 49 | indexer.clientcert.validation = false 50 | 51 | # Use the U-NAPTR lookup 52 | sml.urlprovider = esens 53 | 54 | # Use OASIS BDXR SMP client 55 | smp.mode = oasis-bdxr-v1 56 | 57 | reindex.maxretryhours=24 58 | reindex.retryminutes=5 59 | 60 | # Identifier types 61 | identifier.type = oasis-bdxr-v1 62 | 63 | # SMP mode to use 64 | smp.mode = oasis-bdxr-v1 65 | 66 | smp.tls.trust-all = false 67 | 68 | # Maximum 2 search requests per second 69 | rest.limit.requestspersecond=2 70 | 71 | # Sync all business cards 72 | sync.businesscards = true 73 | -------------------------------------------------------------------------------- /phoss-directory-publisher/src/main/resources/viewpages/en/about.xml: -------------------------------------------------------------------------------- 1 | 19 |

Introduction

20 |

21 | phoss Directory is a Open Source Software developed on behalf of 22 | OpenPeppol AISBL. 23 |

24 | 25 |

26 | OpenPeppol is not liable for the data published in the Peppol Directory. 27 | All information presented here is automatically assembled from information 28 | provided by Peppol SMPs and is only collected and indexed for searchability. 29 |

30 | 31 |

Technical information

32 |

33 | The source code of phoss Directory can be found on 34 | GitHub phax/phoss-directory. 35 | The source code is licensed under the Apache 2.0 license. 36 |

37 |

38 | Original development by Philip Helger for Peppol Directory. 39 |

40 | -------------------------------------------------------------------------------- /phoss-directory-publisher/src/main/resources/viewpages/en/docs_export_all.xml: -------------------------------------------------------------------------------- 1 | 19 |

20 | The Directory allows you to download all data contained. 21 |

22 | 23 |

XML

24 | 25 |
    26 |
  • The Directory XML data can be downloaded via the URL /export/businesscards.
  • 27 |
  • The response MIME type is always application/xml.
  • 28 |
  • Responses can be cached up to 24 hours.
  • 29 |
  • The data is updated once a day.
  • 30 |
  • 31 | The XML Schema for the XML responses can be downloaded from 32 | /files/directory-export-v2.xsd 33 |
  • 34 |
  • 35 | XML schema old versions: 36 | /files/directory-export-v1.xsd 37 |
  • 38 |
39 | 40 | -------------------------------------------------------------------------------- /phoss-directory-publisher/src/main/resources/viewpages/en/docs_how_to.xml: -------------------------------------------------------------------------------- 1 | 19 |

How to use Peppol Directory

20 | 21 |

22 | The Peppol Directory offers the following possibilities to search for participant information: 23 |

24 | 25 |
    26 |
  • 27 | Freetext search via a Webbrowser. 28 | There is both a simple search interface (available) 29 | as well as a more complex search interface to search for certain fields only (work in progress). 30 |
  • 31 |
  • 32 | Automatic search via a REST API (work in progress). 33 | Details can be found on a separate page 34 |
  • 35 |
  • 36 | Download information and evaluate the information externally (work in progress). 37 |
  • 38 |
-------------------------------------------------------------------------------- /phoss-directory-publisher/src/main/resources/viewpages/en/docs_introduction.xml: -------------------------------------------------------------------------------- 1 | 19 |

What is Peppol Directory?

20 | 21 |

22 | The Peppol Directory contains information about entities participating in the Peppol network. 23 | It is intended to support business cases that are concerned with finding Peppol participants registered 24 | on the Peppol network in order to start exchanging business documents with them. 25 |

26 | 27 |

28 | The Peppol Directory aggregates public information from SMPs (Service Metadata Publisher) and provides them 29 | centrally in a structured way. 30 |

31 | 32 |

Target audience

33 | 34 |

35 | This page is intended for all users that are trying to locate their business partners in the Peppol network. 36 | Both for onboarding as well for extending the scope of document exchange. 37 |

38 | 39 |

Who is listed here?

40 | 41 |

42 | Currently the publication of Peppol participant information in an SMP happens on a voluntary basis. 43 | That implies that not all business entities are listed in the Peppol Directory which implies 44 | that if your desired partner does not show up in here it doesn't mean that the entity is not 45 | in the Peppol network! 46 | On the other hand if an entity shows up in the Peppol Directory you can be sure that the 47 | participant is a participant of the Peppol network. 48 |

49 | 50 |

Why only receiving capabilities are listed?

51 | 52 |

53 | The current administrative policy of the Peppol network requires that only Document Receiving capabilities 54 | of Peppol participants are registered on the network. 55 | There are plans to expand this in future to also encompass Document senders. 56 |

57 | 58 |

59 | Until then, however, Peppol Directory can only natively index Receivers. 60 | Until the Peppol Policy changes, Peppol Senders without receiving capabilities 61 | would thus be invisible to Peppol Directory. 62 |

63 | 64 |

65 | If a Participant has connectivity to send Peppol documents (e.g. Invoices) but not yet receive (e.g. Purchase Orders), 66 | then they still can be set up on Peppol Directory by means of a workaround 67 | (where their Peppol Provider creates a Dummy ID for indexing). 68 |

69 | -------------------------------------------------------------------------------- /phoss-directory-publisher/src/main/webapp/css/default.min.css: -------------------------------------------------------------------------------- 1 | #viewport table{margin-bottom:0 !important}#footer{display:block;background-color:#F5F5F5;border-top:1px solid #E5E5E5;margin-top:20px;padding:30px 0;text-align:center}.footer-links li{display:inline}#menu{min-width:15rem}#menu .nav>li>a{color:#716B7A;display:block;padding:5px 5px}#menu .nav>.active>a,#menu .nav>.active:hover>a,#menu .nav>.active:focus>a{background-color:rgba(0,0,0,0);border-right:1px solid #428BCA;color:#428BCA;font-weight:bold}#menu .nav .nav>li>a{font-size:90%;padding-bottom:3px;padding-left:15px;padding-top:3px}#menu .nav .nav .nav>li>a{padding-left:25px}#menu li.menu-separator{border-top:solid 1px rgba(0,0,0,0.125);padding-top:6px}.big-query-image-container{width:100%;height:200px}.big-query-image{width:100%;height:inherit;background-size:cover;background-position:center;background-repeat:no-repeat}.big-query-box{margin-top:3em}.big-query-helptext{font-size:small;color:#fff;margin:0.5em}.big-query-buttons{margin-top:1em;text-align:center}.small-querybox{margin:10px 0}.result-doc{margin:0.5em;padding:3px}li:nth-of-type(2n+1) .result-doc{background:#ddd}div.result-doc ul{padding-left:1em}div.result-doc ul li{list-style-type:none}.result-doc-header{border-top:solid 1px black;margin:0;padding:0}.result-doc-header:first-child{border-top:none}.result-doc-header table{margin:0}.result-doc-header table tbody td{padding-top:0;padding-bottom:0;border:0}.result-doc-sdbutton{margin-top:1em;margin-left:1em}.result-panel .form-group{margin-bottom:0}.result-panel .form-group table{margin-bottom:0}.rest .item{margin:1em 0;border-top:solid 1px black}.rest .pname{font-family:Menlo,Monaco,Consolas,"Courier New",monospace;font-weight:bold;background-color:#ddd;padding:2px 4px;border-radius:4px}.rest .pdesc{background-color:#ddd;padding:2px 4px;border-radius:4px}.vertical-padded-text{padding:0.375rem 0.75rem} -------------------------------------------------------------------------------- /phoss-directory-publisher/src/main/webapp/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phax/phoss-directory/1d381e13b716f91cb156e21bda5457afd96501de/phoss-directory-publisher/src/main/webapp/favicon.ico -------------------------------------------------------------------------------- /phoss-directory-publisher/src/main/webapp/files/OpenPEPPOL Directory for SMP providers 2016-12-05.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phax/phoss-directory/1d381e13b716f91cb156e21bda5457afd96501de/phoss-directory-publisher/src/main/webapp/files/OpenPEPPOL Directory for SMP providers 2016-12-05.pdf -------------------------------------------------------------------------------- /phoss-directory-publisher/src/main/webapp/files/PEPPOL-EDN-Directory-1.1.1-2020-10-15.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phax/phoss-directory/1d381e13b716f91cb156e21bda5457afd96501de/phoss-directory-publisher/src/main/webapp/files/PEPPOL-EDN-Directory-1.1.1-2020-10-15.pdf -------------------------------------------------------------------------------- /phoss-directory-publisher/src/main/webapp/google9aa227895f65ee21.html: -------------------------------------------------------------------------------- 1 | 19 | google-site-verification: google9aa227895f65ee21.html -------------------------------------------------------------------------------- /phoss-directory-publisher/src/main/webapp/imgs/de4a/de4a-small-158-50.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phax/phoss-directory/1d381e13b716f91cb156e21bda5457afd96501de/phoss-directory-publisher/src/main/webapp/imgs/de4a/de4a-small-158-50.png -------------------------------------------------------------------------------- /phoss-directory-publisher/src/main/webapp/imgs/de4a/favicon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phax/phoss-directory/1d381e13b716f91cb156e21bda5457afd96501de/phoss-directory-publisher/src/main/webapp/imgs/de4a/favicon-16x16.png -------------------------------------------------------------------------------- /phoss-directory-publisher/src/main/webapp/imgs/de4a/favicon-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phax/phoss-directory/1d381e13b716f91cb156e21bda5457afd96501de/phoss-directory-publisher/src/main/webapp/imgs/de4a/favicon-32x32.png -------------------------------------------------------------------------------- /phoss-directory-publisher/src/main/webapp/imgs/de4a/favicon-96x96.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phax/phoss-directory/1d381e13b716f91cb156e21bda5457afd96501de/phoss-directory-publisher/src/main/webapp/imgs/de4a/favicon-96x96.png -------------------------------------------------------------------------------- /phoss-directory-publisher/src/main/webapp/imgs/peppol/favicon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phax/phoss-directory/1d381e13b716f91cb156e21bda5457afd96501de/phoss-directory-publisher/src/main/webapp/imgs/peppol/favicon-16x16.png -------------------------------------------------------------------------------- /phoss-directory-publisher/src/main/webapp/imgs/peppol/favicon-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phax/phoss-directory/1d381e13b716f91cb156e21bda5457afd96501de/phoss-directory-publisher/src/main/webapp/imgs/peppol/favicon-32x32.png -------------------------------------------------------------------------------- /phoss-directory-publisher/src/main/webapp/imgs/peppol/favicon-96x96.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phax/phoss-directory/1d381e13b716f91cb156e21bda5457afd96501de/phoss-directory-publisher/src/main/webapp/imgs/peppol/favicon-96x96.png -------------------------------------------------------------------------------- /phoss-directory-publisher/src/main/webapp/imgs/peppol/peppol-small-204-50.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phax/phoss-directory/1d381e13b716f91cb156e21bda5457afd96501de/phoss-directory-publisher/src/main/webapp/imgs/peppol/peppol-small-204-50.png -------------------------------------------------------------------------------- /phoss-directory-publisher/src/main/webapp/imgs/peppol/peppol.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phax/phoss-directory/1d381e13b716f91cb156e21bda5457afd96501de/phoss-directory-publisher/src/main/webapp/imgs/peppol/peppol.png -------------------------------------------------------------------------------- /phoss-directory-publisher/src/main/webapp/imgs/toop/favicon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phax/phoss-directory/1d381e13b716f91cb156e21bda5457afd96501de/phoss-directory-publisher/src/main/webapp/imgs/toop/favicon-16x16.png -------------------------------------------------------------------------------- /phoss-directory-publisher/src/main/webapp/imgs/toop/favicon-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phax/phoss-directory/1d381e13b716f91cb156e21bda5457afd96501de/phoss-directory-publisher/src/main/webapp/imgs/toop/favicon-32x32.png -------------------------------------------------------------------------------- /phoss-directory-publisher/src/main/webapp/imgs/toop/favicon-96x96.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phax/phoss-directory/1d381e13b716f91cb156e21bda5457afd96501de/phoss-directory-publisher/src/main/webapp/imgs/toop/favicon-96x96.png -------------------------------------------------------------------------------- /phoss-directory-publisher/src/main/webapp/imgs/toop/toop-directory.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phax/phoss-directory/1d381e13b716f91cb156e21bda5457afd96501de/phoss-directory-publisher/src/main/webapp/imgs/toop/toop-directory.png -------------------------------------------------------------------------------- /phoss-directory-publisher/src/main/webapp/imgs/toop/toop-small-144-50.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phax/phoss-directory/1d381e13b716f91cb156e21bda5457afd96501de/phoss-directory-publisher/src/main/webapp/imgs/toop/toop-small-144-50.png -------------------------------------------------------------------------------- /phoss-directory-publisher/src/main/webapp/js/default.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | $('form').preventDoubleSubmission(); 18 | 19 | // Used in REST API view page only 20 | $('.tryme').each (function(){ 21 | var sHref = $(this).find ('code').eq (0).text () + '&beautify=true'; 22 | $(this).find ('a').eq (0).attr ('target', '_blank').attr ('href', sHref); 23 | }); 24 | -------------------------------------------------------------------------------- /phoss-directory-publisher/src/main/webapp/js/default.min.js: -------------------------------------------------------------------------------- 1 | $("form").preventDoubleSubmission();$(".tryme").each(function(){var a=$(this).find("code").eq(0).text()+"&beautify=true";$(this).find("a").eq(0).attr("target","_blank").attr("href",a)}); 2 | -------------------------------------------------------------------------------- /phoss-directory-publisher/src/test/java/com/helger/pd/publisher/SPITest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.pd.publisher; 18 | 19 | import org.junit.Test; 20 | 21 | import com.helger.commons.mock.SPITestHelper; 22 | import com.helger.photon.core.mock.PhotonCoreValidator; 23 | 24 | /** 25 | * Test SPI definitions and web.xml 26 | * 27 | * @author Philip Helger 28 | */ 29 | public final class SPITest 30 | { 31 | @Test 32 | public void testBasic () throws Exception 33 | { 34 | SPITestHelper.testIfAllSPIImplementationsAreValid (); 35 | PhotonCoreValidator.validateExternalResources (); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /phoss-directory-publisher/src/test/java/com/helger/pd/publisher/jetty/JettyStopPD.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.pd.publisher.jetty; 18 | 19 | import java.io.IOException; 20 | 21 | import com.helger.photon.jetty.JettyStopper; 22 | 23 | public final class JettyStopPD 24 | { 25 | public static void main (final String [] args) throws IOException 26 | { 27 | new JettyStopper ().run (); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /phoss-directory-publisher/src/test/java/com/helger/pd/publisher/jetty/RunInJettyPD.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.pd.publisher.jetty; 18 | 19 | import javax.annotation.concurrent.Immutable; 20 | 21 | import com.helger.httpclient.HttpDebugger; 22 | import com.helger.photon.jetty.JettyStarter; 23 | 24 | /** 25 | * Run as a standalone web application in Jetty on port 8080.
26 | * http://localhost:8080/ 27 | * 28 | * @author Philip Helger 29 | */ 30 | @Immutable 31 | public final class RunInJettyPD 32 | { 33 | public static void main (final String [] args) throws Exception 34 | { 35 | HttpDebugger.setEnabled (false); 36 | new JettyStarter (RunInJettyPD.class).setSessionCookieName ("PDSESSION").run (); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /phoss-directory-publisher/src/test/java/com/helger/pd/publisher/search/SearchRateLimitTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.pd.publisher.search; 18 | 19 | import static org.junit.Assert.assertNotNull; 20 | 21 | import org.junit.Test; 22 | 23 | /** 24 | * Test class for class {@link SearchRateLimit}. 25 | * 26 | * @author Philip Helger 27 | */ 28 | public final class SearchRateLimitTest 29 | { 30 | @Test 31 | public void testInit () 32 | { 33 | assertNotNull (SearchRateLimit.INSTANCE.rateLimiter ()); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /phoss-directory-publisher/src/test/java/com/helger/pd/publisher/servlet/PublicSearchXServletHandlerTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.pd.publisher.servlet; 18 | 19 | import static org.junit.Assert.assertNotNull; 20 | import static org.junit.Assert.assertTrue; 21 | 22 | import javax.xml.validation.Validator; 23 | 24 | import org.junit.Test; 25 | 26 | import com.helger.commons.io.resource.FileSystemResource; 27 | import com.helger.xml.sax.CollectingSAXErrorHandler; 28 | import com.helger.xml.schema.XMLSchemaCache; 29 | 30 | /** 31 | * Test for class {@link PublicSearchXServletHandler} 32 | * 33 | * @author Philip Helger 34 | */ 35 | public final class PublicSearchXServletHandlerTest 36 | { 37 | @Test 38 | public void testParseXSDExportV1 () 39 | { 40 | // Demo validation 41 | final CollectingSAXErrorHandler aErrHdl = new CollectingSAXErrorHandler (); 42 | final Validator v = new XMLSchemaCache (aErrHdl).getValidator (new FileSystemResource ("src/main/webapp/files/directory-export-v1.xsd")); 43 | assertNotNull (v); 44 | assertTrue (aErrHdl.getErrorList ().toString (), aErrHdl.getErrorList ().isEmpty ()); 45 | } 46 | 47 | @Test 48 | public void testParseXSDExportV2 () 49 | { 50 | // Demo validation 51 | final CollectingSAXErrorHandler aErrHdl = new CollectingSAXErrorHandler (); 52 | final Validator v = new XMLSchemaCache (aErrHdl).getValidator (new FileSystemResource ("src/main/webapp/files/directory-export-v2.xsd")); 53 | assertNotNull (v); 54 | assertTrue (aErrHdl.getErrorList ().toString (), aErrHdl.getErrorList ().isEmpty ()); 55 | } 56 | 57 | @Test 58 | public void testParseXSDSearch () 59 | { 60 | final CollectingSAXErrorHandler aErrHdl = new CollectingSAXErrorHandler (); 61 | final Validator v = new XMLSchemaCache (aErrHdl).getValidator (new FileSystemResource ("src/main/webapp/files/directory-search-result-list-v1.xsd")); 62 | assertNotNull (v); 63 | assertTrue (aErrHdl.getErrorList ().toString (), aErrHdl.getErrorList ().isEmpty ()); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /phoss-directory-publisher/src/test/resources/.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phax/phoss-directory/1d381e13b716f91cb156e21bda5457afd96501de/phoss-directory-publisher/src/test/resources/.gitignore -------------------------------------------------------------------------------- /phoss-directory-searchapi/findbugs-exclude.xml: -------------------------------------------------------------------------------- 1 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /phoss-directory-searchapi/src/etc/license-template.txt: -------------------------------------------------------------------------------- 1 | Copyright (C) 2019-2025 Philip Helger (www.helger.com) 2 | philip[at]helger[dot]com 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. -------------------------------------------------------------------------------- /phoss-directory-searchapi/src/main/java/com/helger/pd/searchapi/CPDSearchAPI.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.pd.searchapi; 18 | 19 | import java.util.List; 20 | 21 | import javax.annotation.Nonnull; 22 | import javax.annotation.concurrent.Immutable; 23 | 24 | import com.helger.commons.annotation.CodingStyleguideUnaware; 25 | import com.helger.commons.annotation.PresentForCodeCoverage; 26 | import com.helger.commons.collection.impl.CommonsArrayList; 27 | import com.helger.commons.io.resource.ClassPathResource; 28 | 29 | /** 30 | * Contains all the constants for PD Search API handling. 31 | * 32 | * @author Philip Helger 33 | */ 34 | @Immutable 35 | public final class CPDSearchAPI 36 | { 37 | @Nonnull 38 | private static ClassLoader _getCL () 39 | { 40 | return CPDSearchAPI.class.getClassLoader (); 41 | } 42 | 43 | /** 44 | * XML Schema resources for Result List v1. 45 | */ 46 | public static final String RESULT_LIST_V1_XSD_PATH = "/schemas/directory-search-result-list-v1.xsd"; 47 | 48 | /** 49 | * XML Schema resources for Result List v1. 50 | */ 51 | @CodingStyleguideUnaware 52 | public static final List RESULT_LIST_V1_XSDS = new CommonsArrayList <> (new ClassPathResource (RESULT_LIST_V1_XSD_PATH, 53 | _getCL ())).getAsUnmodifiable (); 54 | 55 | @PresentForCodeCoverage 56 | private static final CPDSearchAPI INSTANCE = new CPDSearchAPI (); 57 | 58 | private CPDSearchAPI () 59 | {} 60 | } 61 | -------------------------------------------------------------------------------- /phoss-directory-searchapi/src/main/java/com/helger/pd/searchapi/EPDSearchAPIDocumentType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.pd.searchapi; 18 | 19 | import java.util.List; 20 | import java.util.function.Function; 21 | 22 | import javax.annotation.Nonnull; 23 | import javax.annotation.Nullable; 24 | import javax.xml.validation.Schema; 25 | 26 | import com.helger.commons.annotation.Nonempty; 27 | import com.helger.commons.annotation.ReturnsMutableCopy; 28 | import com.helger.commons.collection.impl.ICommonsList; 29 | import com.helger.commons.io.resource.ClassPathResource; 30 | import com.helger.jaxb.builder.IJAXBDocumentType; 31 | import com.helger.jaxb.builder.JAXBDocumentType; 32 | import com.helger.pd.searchapi.v1.ResultListType; 33 | 34 | /** 35 | * Enumeration with all available document types. 36 | * 37 | * @author Philip Helger 38 | */ 39 | @Deprecated (forRemoval = true, since = "0.12.1") 40 | public enum EPDSearchAPIDocumentType implements IJAXBDocumentType 41 | { 42 | RESULT_LIST_V1 (ResultListType.class, CPDSearchAPI.RESULT_LIST_V1_XSDS, x -> "resultlist"); 43 | 44 | private final JAXBDocumentType m_aDocType; 45 | 46 | EPDSearchAPIDocumentType (@Nonnull final Class aClass, 47 | @Nonnull final List aXSDs, 48 | @Nullable final Function aTypeToElementNameMapper) 49 | { 50 | m_aDocType = new JAXBDocumentType (aClass, aXSDs, aTypeToElementNameMapper); 51 | } 52 | 53 | @Nonnull 54 | public Class getImplementationClass () 55 | { 56 | return m_aDocType.getImplementationClass (); 57 | } 58 | 59 | @Nonnull 60 | @Nonempty 61 | @ReturnsMutableCopy 62 | public ICommonsList getAllXSDResources () 63 | { 64 | return m_aDocType.getAllXSDResources (); 65 | } 66 | 67 | @Nonnull 68 | public String getNamespaceURI () 69 | { 70 | return m_aDocType.getNamespaceURI (); 71 | } 72 | 73 | @Nonnull 74 | @Nonempty 75 | public String getLocalName () 76 | { 77 | return m_aDocType.getLocalName (); 78 | } 79 | 80 | @Nonnull 81 | public Schema getSchema () 82 | { 83 | return m_aDocType.getSchema (); 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /phoss-directory-searchapi/src/main/java/com/helger/pd/searchapi/PDResultListMarshaller.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.pd.searchapi; 18 | 19 | import javax.annotation.concurrent.NotThreadSafe; 20 | 21 | import com.helger.jaxb.GenericJAXBMarshaller; 22 | import com.helger.pd.searchapi.v1.ObjectFactory; 23 | import com.helger.pd.searchapi.v1.ResultListType; 24 | 25 | /** 26 | * A JAXB marshaller for PD Search result list documents. 27 | * 28 | * @author Philip Helger 29 | * @since 0.12.1 30 | */ 31 | @NotThreadSafe 32 | public class PDResultListMarshaller extends GenericJAXBMarshaller 33 | { 34 | public PDResultListMarshaller () 35 | { 36 | super (ResultListType.class, CPDSearchAPI.RESULT_LIST_V1_XSDS, new ObjectFactory ()::createResultlist); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /phoss-directory-searchapi/src/main/java/com/helger/pd/searchapi/PDSearchAPIReader.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.pd.searchapi; 18 | 19 | import javax.annotation.Nonnull; 20 | import javax.annotation.concurrent.NotThreadSafe; 21 | 22 | import com.helger.jaxb.builder.JAXBReaderBuilder; 23 | import com.helger.pd.searchapi.v1.ResultListType; 24 | 25 | /** 26 | * A reader builder for PD Search API documents. 27 | * 28 | * @author Philip Helger 29 | * @param 30 | * The BDE implementation class to be read 31 | * @deprecated Use {@link PDResultListMarshaller} instead 32 | */ 33 | @NotThreadSafe 34 | @Deprecated (forRemoval = true, since = "0.12.1") 35 | public class PDSearchAPIReader extends JAXBReaderBuilder > 36 | { 37 | public PDSearchAPIReader (@Nonnull final EPDSearchAPIDocumentType eDocType, 38 | @Nonnull final Class aImplClass) 39 | { 40 | super (eDocType, aImplClass); 41 | } 42 | 43 | /** 44 | * Create a reader builder for ResultListType. 45 | * 46 | * @return The builder and never null 47 | */ 48 | @Nonnull 49 | public static PDSearchAPIReader resultListV1 () 50 | { 51 | return new PDSearchAPIReader <> (EPDSearchAPIDocumentType.RESULT_LIST_V1, ResultListType.class); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /phoss-directory-searchapi/src/main/java/com/helger/pd/searchapi/PDSearchAPIValidator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.pd.searchapi; 18 | 19 | import javax.annotation.Nonnull; 20 | import javax.annotation.concurrent.NotThreadSafe; 21 | 22 | import com.helger.jaxb.builder.JAXBValidationBuilder; 23 | import com.helger.pd.searchapi.v1.ResultListType; 24 | 25 | /** 26 | * A validator builder for BDE documents. 27 | * 28 | * @author Philip Helger 29 | * @param 30 | * The BDE implementation class to be validated 31 | * @deprecated Use {@link PDResultListMarshaller} instead 32 | */ 33 | @NotThreadSafe 34 | @Deprecated (forRemoval = true, since = "0.12.1") 35 | public class PDSearchAPIValidator extends JAXBValidationBuilder > 36 | { 37 | public PDSearchAPIValidator (@Nonnull final EPDSearchAPIDocumentType eDocType) 38 | { 39 | super (eDocType); 40 | } 41 | 42 | /** 43 | * Create a validator builder for ResultListType. 44 | * 45 | * @return The builder and never null 46 | */ 47 | @Nonnull 48 | public static PDSearchAPIValidator resultListV1 () 49 | { 50 | return new PDSearchAPIValidator <> (EPDSearchAPIDocumentType.RESULT_LIST_V1); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /phoss-directory-searchapi/src/main/java/com/helger/pd/searchapi/PDSearchAPIWriter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.pd.searchapi; 18 | 19 | import javax.annotation.Nonnull; 20 | import javax.annotation.concurrent.NotThreadSafe; 21 | 22 | import com.helger.jaxb.builder.JAXBWriterBuilder; 23 | import com.helger.pd.searchapi.v1.ResultListType; 24 | import com.helger.xml.namespace.MapBasedNamespaceContext; 25 | 26 | /** 27 | * A writer builder for BDE documents. 28 | * 29 | * @author Philip Helger 30 | * @param 31 | * The BDE implementation class to be written 32 | * @deprecated Use {@link PDResultListMarshaller} instead 33 | */ 34 | @NotThreadSafe 35 | @Deprecated (forRemoval = true, since = "0.12.1") 36 | public class PDSearchAPIWriter extends JAXBWriterBuilder > 37 | { 38 | public PDSearchAPIWriter (@Nonnull final EPDSearchAPIDocumentType eDocType) 39 | { 40 | super (eDocType); 41 | 42 | // Create a special namespace context for the passed document type 43 | final MapBasedNamespaceContext aNSContext = new MapBasedNamespaceContext (); 44 | aNSContext.addDefaultNamespaceURI (m_aDocType.getNamespaceURI ()); 45 | setNamespaceContext (aNSContext); 46 | } 47 | 48 | /** 49 | * Create a writer builder for ResultListType. 50 | * 51 | * @return The builder and never null 52 | */ 53 | @Nonnull 54 | public static PDSearchAPIWriter resultListV1 () 55 | { 56 | return new PDSearchAPIWriter <> (EPDSearchAPIDocumentType.RESULT_LIST_V1); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /phoss-directory-searchapi/src/main/jaxb/v1.xjb: -------------------------------------------------------------------------------- 1 | 2 | 20 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /phoss-directory-searchapi/src/main/resources/NOTICE: -------------------------------------------------------------------------------- 1 | ============================================================================= 2 | = NOTICE file corresponding to section 4d of the Apache License Version 2.0 = 3 | ============================================================================= 4 | This product includes Open Source Software developed by 5 | Philip Helger - https://www.helger.com/ 6 | -------------------------------------------------------------------------------- /phoss-directory-searchapi/src/test/java/com/helger/pd/searchapi/CPDSearchAPITest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.pd.searchapi; 18 | 19 | import static org.junit.Assert.assertTrue; 20 | 21 | import org.junit.Test; 22 | 23 | import com.helger.commons.io.resource.ClassPathResource; 24 | 25 | /** 26 | * Test class for class {@link CPDSearchAPI}. 27 | * 28 | * @author Philip Helger 29 | */ 30 | public final class CPDSearchAPITest 31 | { 32 | @Test 33 | public void testBasic () 34 | { 35 | for (final ClassPathResource aCPR : CPDSearchAPI.RESULT_LIST_V1_XSDS) 36 | assertTrue ("Missing: " + aCPR.getPath (), aCPR.exists ()); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /phoss-directory-searchapi/src/test/java/com/helger/pd/searchapi/PDResultListMarshallerTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.pd.searchapi; 18 | 19 | import static org.junit.Assert.assertNotNull; 20 | 21 | import java.io.File; 22 | 23 | import org.junit.Test; 24 | import org.slf4j.Logger; 25 | import org.slf4j.LoggerFactory; 26 | 27 | import com.helger.commons.io.file.FileSystemIterator; 28 | import com.helger.pd.searchapi.v1.ResultListType; 29 | 30 | /** 31 | * Test class for class {@link PDResultListMarshaller}. 32 | * 33 | * @author Philip Helger 34 | */ 35 | public final class PDResultListMarshallerTest 36 | { 37 | private static final Logger LOGGER = LoggerFactory.getLogger (PDResultListMarshallerTest.class); 38 | 39 | @Test 40 | public void testBasic () 41 | { 42 | final PDResultListMarshaller m = new PDResultListMarshaller (); 43 | for (final File f : new FileSystemIterator (new File ("src/test/resources/external/test-xml/good"))) 44 | if (f.getName ().endsWith (".xml")) 45 | { 46 | LOGGER.info ("Reading " + f.getName ()); 47 | 48 | final ResultListType res = m.read (f); 49 | assertNotNull (res); 50 | 51 | final byte [] bytes = m.getAsBytes (res); 52 | assertNotNull (bytes); 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /phoss-directory-searchapi/src/test/java/com/helger/pd/searchapi/SPITest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.pd.searchapi; 18 | 19 | import org.junit.Test; 20 | 21 | import com.helger.commons.mock.SPITestHelper; 22 | 23 | /** 24 | * Test SPI definitions 25 | * 26 | * @author Philip Helger 27 | */ 28 | public final class SPITest 29 | { 30 | @Test 31 | public void testBasic () throws Exception 32 | { 33 | SPITestHelper.testIfAllSPIImplementationsAreValid (); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /phoss-directory-searchapi/src/test/resources/.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phax/phoss-directory/1d381e13b716f91cb156e21bda5457afd96501de/phoss-directory-searchapi/src/test/resources/.gitignore -------------------------------------------------------------------------------- /phoss-directory-searchapi/src/test/resources/external/test-xml/good/test1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9915:b 5 | urn:oasis:names:specification:ubl:schema:xsd:Invoice-2::Invoice##urn:cen.eu:en16931:2017#compliant#urn:fdc:peppol.eu:2017:poacc:billing:3.0::2.1 6 | urn:oasis:names:specification:ubl:schema:xsd:CreditNote-2::CreditNote##urn:www.cenbii.eu:transaction:biitrns014:ver2.0:extended:urn:www.peppol.eu:bis:peppol5a:ver2.0:extended:urn:www.erechnung.gv.at:ver1.0::2.1 7 | urn:oasis:names:specification:ubl:schema:xsd:Invoice-2::Invoice##urn:www.cenbii.eu:transaction:biitrns010:ver2.0:extended:urn:www.peppol.eu:bis:peppol5a:ver2.0:extended:urn:www.erechnung.gv.at:ver1.0::2.1 8 | urn:oasis:names:specification:ubl:schema:xsd:CreditNote-2::CreditNote##urn:cen.eu:en16931:2017#compliant#urn:fdc:peppol.eu:2017:poacc:billing:3.0::2.1 9 | urn:oasis:names:specification:ubl:schema:xsd:Invoice-2::Invoice##urn:www.cenbii.eu:transaction:biitrns010:ver2.0:extended:urn:www.peppol.eu:bis:peppol4a:ver2.0:extended:urn:www.erechnung.gv.at:ver1.0::2.1 10 | 11 | Austrian Government 12 | AT 13 | https://www.erechnung.gv.at 14 | 15 | This is the production endpoint for the whole Austrian Government. 16 | Governmental departments are all ministries and their subordinated departments, the Parliament, the office of the federal president (Präsidentschaftskanzlei), the higher administrative court (Verwaltungsgerichtshof), the constitutional court (Verfassungsgerichtshof), the Austrian ombudsman board (Volksanwaltschaft) and the court of audit (Rechnungshof). 17 | 2010-01-01 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/etc/license-template.txt: -------------------------------------------------------------------------------- 1 | Copyright (C) 2015-2025 Philip Helger (www.helger.com) 2 | philip[at]helger[dot]com 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. --------------------------------------------------------------------------------