com.guardtime.ksi.pdu.RequestContextFactory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ksi-service-client Show documentation
Show all versions of ksi-service-client Show documentation
Common module for all KSI service clients
package com.guardtime.ksi.pdu;
/**
* Creates {@link KSIRequestContext}s for aggregator and extender requests.
*/
public class RequestContextFactory {
/**
* Instance of RequestContextFactory which uses {@link DefaultPduIdentifierProvider}
*/
public static final RequestContextFactory DEFAULT_FACTORY = new RequestContextFactory(new DefaultPduIdentifierProvider());
private final PduIdentifierProvider pduIdentifierProvider;
/**
* @param pduIdentifierProvider to use for making the {@link KSIRequestContext}s
*/
public RequestContextFactory(PduIdentifierProvider pduIdentifierProvider) {
this.pduIdentifierProvider = pduIdentifierProvider;
}
/**
* Creates a new {@link KSIRequestContext}
*/
public KSIRequestContext createContext() {
return new KSIRequestContext(pduIdentifierProvider.nextRequestId(), pduIdentifierProvider.getInstanceId(), pduIdentifierProvider.nextMessageId());
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy