Package org.somda.sdc.glue.consumer.sco
Class ScoTransactionImpl<T extends org.somda.sdc.biceps.model.message.AbstractSetResponse>
java.lang.Object
org.somda.sdc.glue.consumer.sco.ScoTransactionImpl<T>
- Type Parameters:
T- the response type.
- All Implemented Interfaces:
ScoTransaction<T>
public class ScoTransactionImpl<T extends org.somda.sdc.biceps.model.message.AbstractSetResponse>
extends Object
implements ScoTransaction<T>
Default implementation of ScoTransaction
The implementation supports an internal function to trigger reception of incoming reports,
see receiveIncomingReport(OperationInvokedReport.ReportPart).
-
Constructor Summary
ConstructorsConstructorDescriptionScoTransactionImpl(T response, Consumer<org.somda.sdc.biceps.model.message.OperationInvokedReport.ReportPart> reportListener, ScoUtil scoUtil) -
Method Summary
Modifier and TypeMethodDescriptionList<org.somda.sdc.biceps.model.message.OperationInvokedReport.ReportPart>Gets all reports received so far.Gets set response message.longGets the transaction id.voidreceiveIncomingReport(org.somda.sdc.biceps.model.message.OperationInvokedReport.ReportPart report) Internal function to trigger reception of an incoming report.List<org.somda.sdc.biceps.model.message.OperationInvokedReport.ReportPart>waitForFinalReport(Duration waitTime) Starts waiting for a final report.
-
Constructor Details
-
ScoTransactionImpl
-
-
Method Details
-
getTransactionId
public long getTransactionId()Description copied from interface:ScoTransactionGets the transaction id.Shortcut of accessing
getTransactionId()ofScoTransaction.getResponse().- Specified by:
getTransactionIdin interfaceScoTransaction<T extends org.somda.sdc.biceps.model.message.AbstractSetResponse>- Returns:
- the transaction id of this ScoTransactionImpl.
-
getReports
Description copied from interface:ScoTransactionGets all reports received so far.- Specified by:
getReportsin interfaceScoTransaction<T extends org.somda.sdc.biceps.model.message.AbstractSetResponse>- Returns:
- Snapshot of received reports as a copy.
-
getResponse
Description copied from interface:ScoTransactionGets set response message.- Specified by:
getResponsein interfaceScoTransaction<T extends org.somda.sdc.biceps.model.message.AbstractSetResponse>- Returns:
- a copy of the set response message of this ScoTransactionImpl.
-
waitForFinalReport
public List<org.somda.sdc.biceps.model.message.OperationInvokedReport.ReportPart> waitForFinalReport(Duration waitTime) Description copied from interface:ScoTransactionStarts waiting for a final report.A report is final if
ScoUtil.isFinalReport(OperationInvokedReport.ReportPart)holds true.- Specified by:
waitForFinalReportin interfaceScoTransaction<T extends org.somda.sdc.biceps.model.message.AbstractSetResponse>- Parameters:
waitTime- maximum wait time until this function returns.- Returns:
- a list that holds all reports including the final one or an empty list if no final report has been received.
-
receiveIncomingReport
public void receiveIncomingReport(org.somda.sdc.biceps.model.message.OperationInvokedReport.ReportPart report) Internal function to trigger reception of an incoming report.Notifies waiting threads.
- Parameters:
report- the report to receive.
-