use of org.eclipse.dataspaceconnector.contract.policy.PolicyArchiveImpl in project DataSpaceConnector by eclipse-dataspaceconnector.
the class ContractServiceExtension method registerServices.
private void registerServices(ServiceExtensionContext context) {
var definitionService = new ContractDefinitionServiceImpl(monitor, contractDefinitionStore, policyEngine, policyStore);
context.registerService(ContractDefinitionService.class, definitionService);
var contractOfferService = new ContractOfferServiceImpl(agentService, definitionService, assetIndex, policyStore);
context.registerService(ContractOfferService.class, contractOfferService);
var validationService = new ContractValidationServiceImpl(agentService, definitionService, assetIndex, policyStore);
context.registerService(ContractValidationService.class, validationService);
var waitStrategy = context.hasService(NegotiationWaitStrategy.class) ? context.getService(NegotiationWaitStrategy.class) : new ExponentialWaitStrategy(DEFAULT_ITERATION_WAIT);
CommandQueue<ContractNegotiationCommand> commandQueue = new BoundedCommandQueue<>(10);
CommandRunner<ContractNegotiationCommand> commandRunner = new CommandRunner<>(commandHandlerRegistry, monitor);
var telemetry = context.getTelemetry();
var observable = new ContractNegotiationObservableImpl();
context.registerService(ContractNegotiationObservable.class, observable);
context.registerService(PolicyArchive.class, new PolicyArchiveImpl(store, policyStore));
consumerNegotiationManager = ConsumerContractNegotiationManagerImpl.Builder.newInstance().waitStrategy(waitStrategy).dispatcherRegistry(dispatcherRegistry).monitor(monitor).validationService(validationService).commandQueue(commandQueue).commandRunner(commandRunner).observable(observable).telemetry(telemetry).executorInstrumentation(context.getService(ExecutorInstrumentation.class)).store(store).policyStore(policyStore).batchSize(context.getSetting(NEGOTIATION_CONSUMER_STATE_MACHINE_BATCH_SIZE, 5)).build();
providerNegotiationManager = ProviderContractNegotiationManagerImpl.Builder.newInstance().waitStrategy(waitStrategy).dispatcherRegistry(dispatcherRegistry).monitor(monitor).validationService(validationService).commandQueue(commandQueue).commandRunner(commandRunner).observable(observable).telemetry(telemetry).executorInstrumentation(context.getService(ExecutorInstrumentation.class)).store(store).policyStore(policyStore).batchSize(context.getSetting(NEGOTIATION_PROVIDER_STATE_MACHINE_BATCH_SIZE, 5)).build();
context.registerService(ConsumerContractNegotiationManager.class, consumerNegotiationManager);
context.registerService(ProviderContractNegotiationManager.class, providerNegotiationManager);
}
Aggregations