KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > cocoon > caching > CompositeCacheValidity


1 /*
2  * Copyright 1999-2004 The Apache Software Foundation.
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" BASIS,
12  * 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 org.apache.cocoon.caching;
17
18
19
20 /**
21  * A validation object aggregating two validity objects. This is similar to the
22  * {@link AggregatedCacheValidity} with the difference that the amount of
23  * aggregated objects is limited.
24  *
25  * @deprecated Use the Avalon Excalibur SourceValidity implementations instead
26  * @author <a HREF="mailto:dims@yahoo.com">Davanum Srinivas</a>
27  * @version CVS $Id: CompositeCacheValidity.java 30932 2004-07-29 17:35:38Z vgritsenko $
28  */

29 public final class CompositeCacheValidity
30 implements CacheValidity {
31
32     private CacheValidity v1;
33     private CacheValidity v2;
34
35     /**
36      * Constructor
37      */

38     public CompositeCacheValidity(CacheValidity v1, CacheValidity v2) {
39         this.v1 = v1;
40         this.v2 = v2;
41     }
42
43     public boolean isValid(CacheValidity validity) {
44         if (validity instanceof CompositeCacheValidity) {
45             return (v1.isValid(((CompositeCacheValidity)validity).getValidity1()) &&
46                     v2.isValid(((CompositeCacheValidity)validity).getValidity2()));
47         }
48         return false;
49     }
50
51     public CacheValidity getValidity1() {
52         return this.v1;
53     }
54
55     public CacheValidity getValidity2() {
56         return this.v2;
57     }
58
59     public String JavaDoc toString() {
60         return "Composite Validity[" + v1 + ':' + v2 + ']';
61     }
62 }
63
Popular Tags