Package com.helger.phase4.peppol.servlet
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
FieldsModifier and TypeFieldDescriptionstatic final com.helger.peppol.smp.ESMPTransportProfile -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidafterSuccessfulPeppolProcessing(@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.PeppolReportingItemcreatePeppolReportingItemForReceivedMessage(@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 newPeppolReportingItemfor a received message.final @NonNull com.helger.collection.commons.ICommonsList<IPhase4PeppolIncomingSBDHandlerSPI> final @Nullable Phase4PeppolReceiverConfigurationfinal @NonNull com.helger.peppol.smp.ISMPTransportProfilevoidprocessAS4ResponseMessage(@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.AS4SignalMessageProcessorResultprocessAS4SignalMessage(@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.AS4MessageProcessorResultprocessAS4UserMessage(@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) final @NonNull Phase4PeppolServletMessageProcessorSPIsetAllHandler(@NonNull Iterable<? extends IPhase4PeppolIncomingSBDHandlerSPI> aHandlers) Set all handler to be used.final @NonNull Phase4PeppolServletMessageProcessorSPIsetReceiverCheckData(@Nullable Phase4PeppolReceiverConfiguration aReceiverCheckData) Set the receiver check data to be used.final @NonNull Phase4PeppolServletMessageProcessorSPIsetTransportProfile(@NonNull com.helger.peppol.smp.ISMPTransportProfile aTransportProfile) Set the transport profile to be used.
-
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 ofIPhase4PeppolIncomingSBDHandlerSPIas 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
nullbut 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 benullbut 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" (seeDEFAULT_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 benull.- Returns:
- this for chaining
-
getReceiverCheckData
- Returns:
- The receiver check data to be used.
nullby 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 byPhase4PeppolDefaultReceiverConfiguration.- Parameters:
aReceiverCheckData- The customer receiver check data to use. May benull.- 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 newPeppolReportingItemfor a received message.- Parameters:
aUserMessage- The current AS4 UserMessage. May not benull.aPeppolSBD- The parsed Peppol SBDH object. May not benull.aIncomingState- The processing state of the incoming message. May not benull.sC3ID- The Peppol Service Provider Seat ID (in the format PXX000000). May neither benullnor empty.sC4CountryCode- The country code of the End User that is the business receiver of the document. Must neither benullnor 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 benullnor empty.- Returns:
nullif 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. Nevernull.aPeppolSBD- The parsed Peppol SBDH object. Nevernull.aState- The processing state of the incoming message. Nevernull.- 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:
processAS4UserMessagein interfacecom.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:
processAS4SignalMessagein interfacecom.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:
processAS4ResponseMessagein interfacecom.helger.phase4.incoming.spi.IAS4IncomingMessageProcessorSPI
-