View Javadoc

1   package net.krecan.m2_proxy.store;
2   
3   import net.krecan.m2_proxy.Resource;
4   
5   /***
6    * Validates reources in the store. Decides whether given resource is valid in the store and whether 
7    * gien resource should be stored in the store.
8    * @author Lukas Krecan
9    *
10   */
11  public interface StoreValidator {
12  	public static final StoreValidator EVERYTHING_VALID_VALIDATOR = new StoreValidator()
13  	{
14  		public boolean shouldStoreResource(Resource resource) {
15  			return true;
16  		}
17  		public boolean isResourceValid(Resource resource) {
18  			if (resource==null) return false;
19  			return true;
20  		}
21  	};
22  	public static final StoreValidator NOTHING_VALID_VALIDATOR = new StoreValidator()
23  	{
24  		public boolean shouldStoreResource(Resource resource) {
25  			return false;
26  		}
27  		public boolean isResourceValid(Resource resource) {
28  			return false;
29  		}
30  	};
31  	/***
32  	 * Decides whether we should store the resource
33  	 * @param resourcerPath
34  	 * @return
35  	 */
36  	public boolean shouldStoreResource(Resource resource);
37  	
38  	/***
39  	 * Decides if the entry in the store is valid. If resource is null, returns false.
40  	 * @param resourcePath
41  	 * @param lastModified
42  	 * @return
43  	 */
44  	public boolean isResourceValid(Resource resource);
45  }