}
}, httpService);
}
private void migrateHttpFileCache(NetworkConfig config, HttpService httpService) throws TransactionFailure {
final HttpFileCache httpFileCache = httpService.getHttpFileCache();
if (httpFileCache == null) {
return;
}
ConfigSupport.apply(new SingleConfigCode<NetworkConfig>() {
@Override
public Object run(NetworkConfig param) throws TransactionFailure {
for (Protocol protocol : param.getProtocols().getProtocol()) {
final Http http = protocol.getHttp();
if (http != null) {
ConfigSupport.apply(new SingleConfigCode<Http>() {
@Override
public Object run(Http http) throws TransactionFailure {
final FileCache cache = http.createChild(FileCache.class);
http.setFileCache(cache);
cache.setEnabled(httpFileCache.getFileCachingEnabled());
cache.setMaxAgeSeconds(httpFileCache.getMaxAgeInSeconds());
cache.setMaxCacheSizeBytes(httpFileCache.getMediumFileSpaceInBytes());
cache.setMaxFilesCount(httpFileCache.getMaxFilesCount());
return null;
}
}, http);
}
}