Skip to content

Commit

Permalink
Renamed and extracted interface
Browse files Browse the repository at this point in the history
  • Loading branch information
phax committed Oct 23, 2024
1 parent 3578d75 commit 2561848
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@
import com.helger.phase4.util.AS4ResourceHelper;
import com.helger.phase4.util.AS4XMLHelper;
import com.helger.phase4.util.Phase4Exception;
import com.helger.phase4.v3.ChangePhase4V3;
import com.helger.photon.io.PhotonWorkerPool;
import com.helger.xml.serialize.write.XMLWriter;

Expand Down Expand Up @@ -272,11 +271,15 @@ public void applyToResponse (@Nonnull final IAS4ResponseAbstraction aHttpRespons
if (aDumpOS != null)
try
{
StreamHelper.copyInputStreamToOutputStream (aContent.getBufferedInputStream (), aDumpOS);
StreamHelper.copyByteStream ()
.from (aContent.getBufferedInputStream ())
.closeFrom (true)
.to (aDumpOS)
.closeTo (true)
.build ();
}
finally
{
StreamHelper.close (aDumpOS);
aOutgoingDumper.onEndRequest (EAS4MessageMode.RESPONSE,
m_aIncomingMessageMetadata,
m_aIncomingState,
Expand All @@ -292,25 +295,6 @@ public void applyToResponse (@Nonnull final IAS4ResponseAbstraction aHttpRespons
}
}

/**
* Callback interface to indicate finalization of async processing.
*
* @author Philip Helger
* @since 0.13.1
*/
@ChangePhase4V3 ("Rename")
public interface ISoapProcessingFinalizedCallback
{
/**
* Indicate that processing has finished.
*
* @param bWasSynchronous
* <code>true</code> if it was synchronous, <code>false</code> if it
* was asynchronous.
*/
void onProcessingFinalized (boolean bWasSynchronous);
}

private static final class SPIInvocationResult implements ISuccessIndicator
{
private boolean m_bSuccess = false;
Expand Down Expand Up @@ -376,7 +360,7 @@ public boolean hasAsyncResponseURL ()
private IAS4IncomingDumper m_aIncomingDumper;
private IAS4OutgoingDumper m_aOutgoingDumper;
private IAS4RetryCallback m_aRetryCallback;
private ISoapProcessingFinalizedCallback m_aSoapProcessingFinalizedCB;
private IAS4SoapProcessingFinalizedCallback m_aSoapProcessingFinalizedCB;

/** By default get all message processors from the global SPI registry */
private Supplier <? extends ICommonsList <IAS4IncomingMessageProcessorSPI>> m_aProcessorSupplier = AS4IncomingMessageProcessorManager::getAllProcessors;
Expand Down Expand Up @@ -722,7 +706,7 @@ public final AS4RequestHandler setRetryCallback (@Nullable final IAS4RetryCallba
* @since 0.13.1
*/
@Nullable
public final ISoapProcessingFinalizedCallback getSoapProcessingFinalizedCallback ()
public final IAS4SoapProcessingFinalizedCallback getSoapProcessingFinalizedCallback ()
{
return m_aSoapProcessingFinalizedCB;
}
Expand All @@ -740,7 +724,7 @@ public final ISoapProcessingFinalizedCallback getSoapProcessingFinalizedCallback
* @since 0.13.1
*/
@Nonnull
public final AS4RequestHandler setSoapProcessingFinalizedCallback (@Nullable final ISoapProcessingFinalizedCallback aSoapProcessingFinalizedCB)
public final AS4RequestHandler setSoapProcessingFinalizedCallback (@Nullable final IAS4SoapProcessingFinalizedCallback aSoapProcessingFinalizedCB)
{
m_aSoapProcessingFinalizedCB = aSoapProcessingFinalizedCB;
return this;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* Copyright (C) 2015-2024 Philip Helger (www.helger.com)
* philip[at]helger[dot]com
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.helger.phase4.incoming;

/**
* Callback interface to indicate finalization of async processing.
*
* @author Philip Helger
* @since 0.13.1
*/
public interface IAS4SoapProcessingFinalizedCallback
{
/**
* Indicate that processing has finished.
*
* @param bWasSynchronous
* <code>true</code> if it was synchronous, <code>false</code> if it
* was asynchronous.
*/
void onProcessingFinalized (boolean bWasSynchronous);
}

0 comments on commit 2561848

Please sign in to comment.