Search in sources :

Example 1 with TransactionSerializerSchemeProvider

use of cz.o2.proxima.transaction.TransactionSerializerSchemeProvider in project proxima-platform by O2-Czech-Republic.

the class ConfigRepository method createEntityTransaction.

private void createEntityTransaction(Config transactionsConfig) {
    String schemeProviderScheme = "java";
    if (transactionsConfig.hasPath(SCHEME_PROVIDER)) {
        schemeProviderScheme = transactionsConfig.getString(SCHEME_PROVIDER);
    }
    Optional<ValueSerializerFactory> factory = getValueSerializerFactory(schemeProviderScheme);
    if (!factory.isPresent() || !factory.get().canProvideTransactionSerializer()) {
        throw new IllegalArgumentException("Scheme provider for transactions " + schemeProviderScheme + ", is either missing or unable to provide transaction schemes.");
    }
    TransactionSerializerSchemeProvider schemeProvider = factory.get().createTransactionSerializerSchemeProvider();
    EntityDescriptor.Builder builder = EntityDescriptor.newBuilder().setName(TRANSACTION_ENTITY);
    loadRegular(TRANSACTION_ENTITY, REQUEST_ATTRIBUTE, Collections.singletonMap(SCHEME, schemeProvider.getRequestScheme()), builder);
    loadRegular(TRANSACTION_ENTITY, RESPONSE_ATTRIBUTE, Collections.singletonMap(SCHEME, schemeProvider.getResponseScheme()), builder);
    loadRegular(TRANSACTION_ENTITY, STATE_ATTRIBUTE, Collections.singletonMap(SCHEME, schemeProvider.getStateScheme()), builder);
    loadRegular(TRANSACTION_ENTITY, COMMIT_ATTRIBUTE, Collections.singletonMap(SCHEME, schemeProvider.getCommitScheme()), builder);
    entitiesByName.put(TRANSACTION_ENTITY, builder.build());
}
Also used : ValueSerializerFactory(cz.o2.proxima.scheme.ValueSerializerFactory) TransactionSerializerSchemeProvider(cz.o2.proxima.transaction.TransactionSerializerSchemeProvider)

Aggregations

ValueSerializerFactory (cz.o2.proxima.scheme.ValueSerializerFactory)1 TransactionSerializerSchemeProvider (cz.o2.proxima.transaction.TransactionSerializerSchemeProvider)1