View Javadoc

1   /*
2    * Copyright 2007 Hippo
3    *
4    * Licensed under the Apache License, Version 2.0 (the  "License"); 
5    * you may not use this file except in compliance with the License. 
6    * You may obtain a copy of the License at
7    *
8    * http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" 
12   * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
13   * See the License for the specific language governing permissions and 
14   * limitations under the License.
15   */
16  package nl.hippo.portal.cms.source;
17  
18  import java.io.InputStream;
19  
20  import nl.hippo.client.api.event.EventValidity;
21  import nl.hippo.portal.cms.cache.EventCacheable;
22  import nl.hippo.portal.cms.cache.PortalCacheKey;
23  
24  /***
25   * @author <a href="mailto:d.dam@hippo.nl">Dennis Dam</a>
26   *
27   * @version $Id: EventCacheableSource.java 8564 2007-10-18 15:30:09Z ddam $
28   */
29  public class EventCacheableSource implements EventCacheable, Source {
30  
31      private PortalCacheKey key;
32      private EventValidity[] validities;
33      private InputStream stream;
34      
35      public EventCacheableSource(InputStream stream, PortalCacheKey key, EventValidity[] validities) {
36          super();
37          this.stream=stream;
38          this.key = key;        
39          this.validities = validities;
40      }
41  
42      public EventCacheableSource(InputStream stream, PortalCacheKey key, EventValidity validity) {
43          this(stream,key,new EventValidity[]{validity});
44      }
45  
46      /* (non-Javadoc)
47       * @see nl.hippo.portal.cms.cache.EventCacheable#getCacheKey()
48       */
49      public PortalCacheKey getCacheKey() {
50          return key;
51      }
52  
53      /* (non-Javadoc)
54       * @see nl.hippo.portal.cms.cache.EventCacheable#getEventValidities()
55       */
56      public EventValidity[] getEventValidities() {
57          return validities;
58      }
59  
60      /* (non-Javadoc)
61       * @see nl.hippo.pac.jaxb.JAXBSource#getInputStream()
62       */
63      public InputStream getInputStream() {
64          return stream;
65      }
66  
67  }