final LevelDBStoreConfiguration.ImplementationType implementationType = LevelDBStoreConfiguration.ImplementationType.valueOf(LevelDBImplementationResource.TYPE.resolveModelAttribute(context, node).asString());
builder.implementationType(implementationType);
}
return builder;
} else if (storeKey.equals(ModelKeys.REST_STORE)) {
final RestStoreConfigurationBuilder builder = persistenceBuilder.addStore(RestStoreConfigurationBuilder.class);
builder.host("localhost"); // To pass builder validation, the builder will be configured properly when the outbound socket is ready to be injected
for (ModelNode server : store.require(ModelKeys.REMOTE_SERVERS).asList()) {
String outboundSocketBinding = server.get(ModelKeys.OUTBOUND_SOCKET_BINDING).asString();
Injector<OutboundSocketBinding> injector = new SimpleInjector<OutboundSocketBinding>() {
@Override
public void inject(OutboundSocketBinding value) {
try {
builder.host(value.getDestinationAddress().getHostAddress()).port(value.getDestinationPort()); // FIXME: add support for multiple hosts
} catch (UnknownHostException e) {
throw InfinispanMessages.MESSAGES.failedToInjectSocketBinding(e, value);
}
}
};
dependencies.add(new Dependency<OutboundSocketBinding>(OutboundSocketBinding.OUTBOUND_SOCKET_BINDING_BASE_SERVICE_NAME.append(outboundSocketBinding), OutboundSocketBinding.class, injector));
}
if (store.hasDefined(ModelKeys.APPEND_CACHE_NAME_TO_PATH)) {
builder.appendCacheNameToPath(store.require(ModelKeys.APPEND_CACHE_NAME_TO_PATH).asBoolean());
}
if (store.hasDefined(ModelKeys.PATH)) {
builder.path(store.get(ModelKeys.PATH).asString());
}
builder.rawValues(true);
builder.metadataHelper(MimeMetadataHelper.class);
if (store.hasDefined(ModelKeys.CONNECTION_POOL)) {
ModelNode pool = store.get(ModelKeys.CONNECTION_POOL);
if (pool.hasDefined(ModelKeys.CONNECTION_TIMEOUT)) {
builder.connectionPool().connectionTimeout(pool.require(ModelKeys.CONNECTION_TIMEOUT).asInt());
}
if (pool.hasDefined(ModelKeys.MAX_CONNECTIONS_PER_HOST)) {
builder.connectionPool().maxConnectionsPerHost(pool.require(ModelKeys.MAX_CONNECTIONS_PER_HOST).asInt());
}
if (pool.hasDefined(ModelKeys.MAX_TOTAL_CONNECTIONS)) {
builder.connectionPool().maxTotalConnections(pool.require(ModelKeys.MAX_TOTAL_CONNECTIONS).asInt());
}
if (pool.hasDefined(ModelKeys.BUFFER_SIZE)) {
builder.connectionPool().bufferSize(pool.require(ModelKeys.BUFFER_SIZE).asInt());
}
if (pool.hasDefined(ModelKeys.SOCKET_TIMEOUT)) {
builder.connectionPool().socketTimeout(pool.require(ModelKeys.SOCKET_TIMEOUT).asInt());
}
if (pool.hasDefined(ModelKeys.TCP_NO_DELAY)) {
builder.connectionPool().tcpNoDelay(pool.require(ModelKeys.TCP_NO_DELAY).asBoolean());
}
}
return builder;
} else if (storeKey.equals(ModelKeys.STORE)) {
String className = store.require(ModelKeys.CLASS).asString();