Class Phase4PeppolServletMessageProcessorSPI

java.lang.Object
com.helger.phase4.peppol.servlet.Phase4PeppolServletMessageProcessorSPI
All Implemented Interfaces:
com.helger.phase4.incoming.spi.IAS4IncomingMessageProcessorSPI

@IsSPIImplementation public class Phase4PeppolServletMessageProcessorSPI extends Object implements com.helger.phase4.incoming.spi.IAS4IncomingMessageProcessorSPI
This is the SPI implementation to handle generic incoming AS4 requests. The main goal of this class is to implement the Peppol specific requirements of packaging data in SBDH. Users of this package must implement IPhase4PeppolIncomingSBDHandlerSPI instead which provides a more Peppol-style SPI handler. This class is instantiated only once, therefore changing the state of this class may have unintended side effects.
Author:
Philip Helger
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final com.helger.peppol.smp.ESMPTransportProfile
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    afterSuccessfulPeppolProcessing(@NonNull com.helger.phase4.ebms3header.Ebms3UserMessage aUserMessage, @NonNull com.helger.peppol.sbdh.PeppolSBDHData aPeppolSBD, @NonNull com.helger.phase4.incoming.IAS4IncomingMessageState aState)
    Method that is invoked after the message was successfully processed with at least one handler, and before a Receipt is returned.
    static @Nullable com.helger.peppol.reporting.api.PeppolReportingItem
    createPeppolReportingItemForReceivedMessage(@NonNull com.helger.phase4.ebms3header.Ebms3UserMessage aUserMessage, @NonNull com.helger.peppol.sbdh.PeppolSBDHData aPeppolSBD, @NonNull com.helger.phase4.incoming.IAS4IncomingMessageState aIncomingState, @NonNull @Nonempty String sC3ID, @NonNull @Nonempty String sC4CountryCode, @NonNull @Nonempty String sEndUserID)
    Method to create a new PeppolReportingItem for a received message.
    final @NonNull com.helger.collection.commons.ICommonsList<IPhase4PeppolIncomingSBDHandlerSPI>
     
     
    final @NonNull com.helger.peppol.smp.ISMPTransportProfile
     
    void
    processAS4ResponseMessage(@NonNull com.helger.phase4.incoming.IAS4IncomingMessageMetadata aMessageMetadata, @NonNull com.helger.phase4.incoming.IAS4IncomingMessageState aState, @NonNull @Nonempty String sResponseMessageID, byte @Nullable [] aResponseBytes, boolean bResponsePayloadIsAvailable, @NonNull com.helger.phase4.error.AS4ErrorList aEbmsErrorMessages)
     
    @NonNull com.helger.phase4.incoming.spi.AS4SignalMessageProcessorResult
    processAS4SignalMessage(@NonNull com.helger.phase4.incoming.IAS4IncomingMessageMetadata aMessageMetadata, @NonNull com.helger.http.header.HttpHeaderMap aHttpHeaders, @NonNull com.helger.phase4.ebms3header.Ebms3SignalMessage aSignalMessage, @Nullable com.helger.phase4.model.pmode.IPMode aPMode, @NonNull com.helger.phase4.incoming.IAS4IncomingMessageState aState, @NonNull com.helger.phase4.error.AS4ErrorList aProcessingErrorMessages)
     
    @NonNull com.helger.phase4.incoming.spi.AS4MessageProcessorResult
    processAS4UserMessage(@NonNull com.helger.phase4.incoming.IAS4IncomingMessageMetadata aMessageMetadata, @NonNull com.helger.http.header.HttpHeaderMap aHttpHeaders, @NonNull com.helger.phase4.ebms3header.Ebms3UserMessage aUserMessage, @NonNull com.helger.phase4.model.pmode.IPMode aSrcPMode, @Nullable Node aPayload, @Nullable com.helger.collection.commons.ICommonsList<com.helger.phase4.attachment.WSS4JAttachment> aIncomingAttachments, @NonNull com.helger.phase4.incoming.IAS4IncomingMessageState aIncomingState, @NonNull com.helger.phase4.error.AS4ErrorList aProcessingErrorMessages)
     
    Set all handler to be used.
    Set the receiver check data to be used.
    setTransportProfile(@NonNull com.helger.peppol.smp.ISMPTransportProfile aTransportProfile)
    Set the transport profile to be used.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • DEFAULT_TRANSPORT_PROFILE

      public static final com.helger.peppol.smp.ESMPTransportProfile DEFAULT_TRANSPORT_PROFILE
  • Constructor Details

    • Phase4PeppolServletMessageProcessorSPI

      @UsedViaReflection public Phase4PeppolServletMessageProcessorSPI()
      Constructor. Uses all SPI implementations of IPhase4PeppolIncomingSBDHandlerSPI as the handlers.
  • Method Details

    • getAllHandler

      @ReturnsMutableCopy public final @NonNull com.helger.collection.commons.ICommonsList<IPhase4PeppolIncomingSBDHandlerSPI> getAllHandler()
      Returns:
      A list of all contained Peppol specific SBD handlers. Never null but maybe empty.
    • setAllHandler

      public final @NonNull Phase4PeppolServletMessageProcessorSPI setAllHandler(@NonNull Iterable<? extends IPhase4PeppolIncomingSBDHandlerSPI> aHandlers)
      Set all handler to be used. This is helpful, if this message processor is not used as an SPI but as a manually configured handler.
      Parameters:
      aHandlers - The handler to be set. May not be null but maybe empty (in which case the message is basically discarded).
      Returns:
      this for chaining
    • getTransportProfile

      public final @NonNull com.helger.peppol.smp.ISMPTransportProfile getTransportProfile()
      Returns:
      the transport profile to be handled. Never null. By default it is "Peppol AS4 v2" (see DEFAULT_TRANSPORT_PROFILE).
    • setTransportProfile

      public final @NonNull Phase4PeppolServletMessageProcessorSPI setTransportProfile(@NonNull com.helger.peppol.smp.ISMPTransportProfile aTransportProfile)
      Set the transport profile to be used. By default it is Peppol AS4 v2.
      Parameters:
      aTransportProfile - The transport profile to be used. May not be null.
      Returns:
      this for chaining
    • getReceiverCheckData

      public final @Nullable Phase4PeppolReceiverConfiguration getReceiverCheckData()
      Returns:
      The receiver check data to be used. null by default.
      Since:
      0.9.13
    • setReceiverCheckData

      public final @NonNull Phase4PeppolServletMessageProcessorSPI setReceiverCheckData(@Nullable Phase4PeppolReceiverConfiguration aReceiverCheckData)
      Set the receiver check data to be used. If set, it overrides the global one defined by Phase4PeppolDefaultReceiverConfiguration.
      Parameters:
      aReceiverCheckData - The customer receiver check data to use. May be null.
      Returns:
      this for chaining
      Since:
      0.9.13
    • createPeppolReportingItemForReceivedMessage

      public static @Nullable com.helger.peppol.reporting.api.PeppolReportingItem createPeppolReportingItemForReceivedMessage(@NonNull com.helger.phase4.ebms3header.Ebms3UserMessage aUserMessage, @NonNull com.helger.peppol.sbdh.PeppolSBDHData aPeppolSBD, @NonNull com.helger.phase4.incoming.IAS4IncomingMessageState aIncomingState, @Nonempty @NonNull @Nonempty String sC3ID, @Nonempty @NonNull @Nonempty String sC4CountryCode, @Nonempty @NonNull @Nonempty String sEndUserID)
      Method to create a new PeppolReportingItem for a received message.
      Parameters:
      aUserMessage - The current AS4 UserMessage. May not be null.
      aPeppolSBD - The parsed Peppol SBDH object. May not be null.
      aIncomingState - The processing state of the incoming message. May not be null.
      sC3ID - The Peppol Service Provider Seat ID (in the format PXX000000). May neither be null nor empty.
      sC4CountryCode - The country code of the End User that is the business receiver of the document. Must neither be null nor empty.
      sEndUserID - The internal (local) ID of the End User that is the business receiver of the document. This ID is NOT part of the reporting towards OpenPeppol, it is just for created aggregating counts. Must neither be null nor empty.
      Returns:
      null if not all necessary elements are present. Check logs for details.
      Since:
      2.2.2
    • afterSuccessfulPeppolProcessing

      @OverrideOnDemand protected void afterSuccessfulPeppolProcessing(@NonNull com.helger.phase4.ebms3header.Ebms3UserMessage aUserMessage, @NonNull com.helger.peppol.sbdh.PeppolSBDHData aPeppolSBD, @NonNull com.helger.phase4.incoming.IAS4IncomingMessageState aState)
      Method that is invoked after the message was successfully processed with at least one handler, and before a Receipt is returned. By default this method does nothing. The idea was to override this method to allow for remembering the created transaction for Peppol Reporting.
      Parameters:
      aUserMessage - The current AS4 UserMessage. Never null.
      aPeppolSBD - The parsed Peppol SBDH object. Never null.
      aState - The processing state of the incoming message. Never null.
      Since:
      2.2.2
      See Also:
    • processAS4UserMessage

      public @NonNull com.helger.phase4.incoming.spi.AS4MessageProcessorResult processAS4UserMessage(@NonNull com.helger.phase4.incoming.IAS4IncomingMessageMetadata aMessageMetadata, @NonNull com.helger.http.header.HttpHeaderMap aHttpHeaders, @NonNull com.helger.phase4.ebms3header.Ebms3UserMessage aUserMessage, @NonNull com.helger.phase4.model.pmode.IPMode aSrcPMode, @Nullable Node aPayload, @Nullable com.helger.collection.commons.ICommonsList<com.helger.phase4.attachment.WSS4JAttachment> aIncomingAttachments, @NonNull com.helger.phase4.incoming.IAS4IncomingMessageState aIncomingState, @NonNull com.helger.phase4.error.AS4ErrorList aProcessingErrorMessages)
      Specified by:
      processAS4UserMessage in interface com.helger.phase4.incoming.spi.IAS4IncomingMessageProcessorSPI
    • processAS4SignalMessage

      @UnsupportedOperation public @NonNull com.helger.phase4.incoming.spi.AS4SignalMessageProcessorResult processAS4SignalMessage(@NonNull com.helger.phase4.incoming.IAS4IncomingMessageMetadata aMessageMetadata, @NonNull com.helger.http.header.HttpHeaderMap aHttpHeaders, @NonNull com.helger.phase4.ebms3header.Ebms3SignalMessage aSignalMessage, @Nullable com.helger.phase4.model.pmode.IPMode aPMode, @NonNull com.helger.phase4.incoming.IAS4IncomingMessageState aState, @NonNull com.helger.phase4.error.AS4ErrorList aProcessingErrorMessages)
      Specified by:
      processAS4SignalMessage in interface com.helger.phase4.incoming.spi.IAS4IncomingMessageProcessorSPI
    • processAS4ResponseMessage

      public void processAS4ResponseMessage(@NonNull com.helger.phase4.incoming.IAS4IncomingMessageMetadata aMessageMetadata, @NonNull com.helger.phase4.incoming.IAS4IncomingMessageState aState, @Nonempty @NonNull @Nonempty String sResponseMessageID, byte @Nullable [] aResponseBytes, boolean bResponsePayloadIsAvailable, @NonNull com.helger.phase4.error.AS4ErrorList aEbmsErrorMessages)
      Specified by:
      processAS4ResponseMessage in interface com.helger.phase4.incoming.spi.IAS4IncomingMessageProcessorSPI