View Javadoc
1   package org.kuali.common.devops.logic.function;
2   
3   import org.kuali.common.devops.logic.HttpCacher;
4   import org.kuali.common.devops.model.FileCache;
5   
6   import com.google.common.base.Function;
7   
8   public final class FileCacheFunction implements Function<String, FileCache> {
9   
10  	public FileCacheFunction() {
11  		this(true);
12  	}
13  
14  	public FileCacheFunction(boolean refresh) {
15  		this.refresh = refresh;
16  	}
17  
18  	private final boolean refresh;
19  
20  	@Override
21  	public FileCache apply(String url) {
22  		if (refresh) {
23  			return HttpCacher.refresh(url);
24  		} else {
25  			return HttpCacher.loadFromCache(url);
26  		}
27  	}
28  
29  }