1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package nl.hippo.portal.cms.source;
17
18 import java.io.InputStream;
19
20 import nl.hippo.client.api.content.DocumentPath;
21 import nl.hippo.portal.cms.CMSSite;
22 import nl.hippo.portal.cms.cache.CacheKeyFactory;
23 import nl.hippo.portal.cms.cache.EventValidityFactory;
24 import nl.hippo.portal.cms.cache.ObjectCache;
25
26 /***
27 * @author <a href="mailto:d.dam@hippo.nl">Dennis Dam</a>
28 *
29 * @version $Id: AbstractEventCacheableSourceFactory.java 10568 2008-02-19 21:20:00Z ddam $
30 */
31 public abstract class AbstractEventCacheableSourceFactory extends AbstractSourceFactory {
32
33 private CMSSite site;
34
35 public EventCacheableSource getEventCacheableSource(CMSSite site, InputStream is, DocumentPath[] paths){
36 ObjectCache cache = site.getObjectCache();
37 CacheKeyFactory keyFactory = cache.getCacheKeyFactory();
38 EventValidityFactory validityFactory = cache.getEventValidityFactory();
39 return new EventCacheableSource(is,keyFactory.createKey(new Object[]{"factory="+getName(),paths}),validityFactory.createValidities(paths));
40 }
41
42 public EventCacheableSource getEventCacheableSource(CMSSite site, InputStream is, DocumentPath path){
43 return this.getEventCacheableSource(site, is, new DocumentPath[]{path});
44 }
45
46
47 public void setSite(CMSSite site) {
48 this.site = site;
49 }
50
51 protected CMSSite getSite() {
52 return this.site;
53 }
54
55 }