View Javadoc

1   /**
2    * Copyright (C) 2005-2009 Alfresco Software Limited.
3    *
4    * This file is part of the Spring Surf Extension project.
5    *
6    * Licensed under the Apache License, Version 2.0 (the "License");
7    * you may not use this file except in compliance with the License.
8    * You may obtain a copy of the License at
9    *
10   *  http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing, software
13   * distributed under the License is distributed on an "AS IS" BASIS,
14   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   * See the License for the specific language governing permissions and
16   * limitations under the License.
17   */
18  
19  package org.springframework.extensions.webscripts;
20  
21  import java.util.Date;
22  
23  
24  /**
25   * Web Script Cache
26   *
27   * Records the desired cache requirements for the Web Script
28   * 
29   * @author davidc
30   */
31  public class Cache implements Description.RequiredCache
32  {
33      private boolean neverCache = true;
34      private boolean isPublic = false;
35      private boolean mustRevalidate = true;
36      private Date lastModified = null;
37      private String eTag = null;
38      private Long maxAge = null;
39  
40      
41      /**
42       * Construct
43       */
44      public Cache()
45      {
46      }
47      
48      /**
49       * Construct
50       * 
51       * @param requiredCache
52       */
53      public Cache(Description.RequiredCache requiredCache)
54      {
55          neverCache = requiredCache.getNeverCache();
56          isPublic = requiredCache.getIsPublic();
57          mustRevalidate = requiredCache.getMustRevalidate();
58      }
59      
60      /* (non-Javadoc)
61       * @see org.alfresco.web.scripts.WebScriptDescription.RequiredCache#getNeverCache()
62       */
63      public boolean getNeverCache()
64      {
65          return neverCache;
66      }
67      
68      /**
69       * @param neverCache
70       */
71      public void setNeverCache(boolean neverCache)
72      {
73          this.neverCache = neverCache;
74      }
75  
76      /* (non-Javadoc)
77       * @see org.alfresco.web.scripts.WebScriptDescription.RequiredCache#getIsPublic()
78       */
79      public boolean getIsPublic()
80      {
81          return isPublic;
82      }
83      
84      /**
85       * @param isPublic
86       */
87      public void setIsPublic(boolean isPublic)
88      {
89          this.isPublic = isPublic;
90      }
91  
92      /**
93       * @return last modified
94       */
95      public Date getLastModified()
96      {
97          return lastModified;
98      }
99      
100     /**
101      * @param lastModified
102      */
103     public void setLastModified(Date lastModified)
104     {
105         this.lastModified = lastModified;
106     }
107     
108     /**
109      * @return  ETag
110      */
111     public String getETag()
112     {
113         return eTag;
114     }
115     
116     /**
117      * @param tag  ETag
118      */
119     public void setETag(String tag)
120     {
121         eTag = tag;
122     }
123     
124     /**
125      * @return  Max Age (seconds)
126      */
127     public Long getMaxAge()
128     {
129         return maxAge;
130     }
131     
132     /**
133      * @param maxAge  Max Age (seconds)
134      */
135     public void setMaxAge(Long maxAge)
136     {
137         this.maxAge = maxAge;
138     }
139 
140     /* (non-Javadoc)
141      * @see org.alfresco.web.scripts.WebScriptDescription.RequiredCache#getMustRevalidate()
142      */
143     public boolean getMustRevalidate()
144     {
145         return mustRevalidate;
146     }
147     
148     /**
149      * @param mustRevalidate
150      */
151     public void setMustRevalidate(boolean mustRevalidate)
152     {
153         this.mustRevalidate = mustRevalidate;
154     }
155     
156 }