01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17: package org.apache.cocoon.caching;
18:
19: /**
20: * A validation object aggregating two validity objects. This is similar to the
21: * {@link AggregatedCacheValidity} with the difference that the amount of
22: * aggregated objects is limited.
23: *
24: * @deprecated Use the Avalon Excalibur SourceValidity implementations instead
25: * @author <a href="mailto:dims@yahoo.com">Davanum Srinivas</a>
26: * @version CVS $Id: CompositeCacheValidity.java 433543 2006-08-22 06:22:54Z crossley $
27: */
28: public final class CompositeCacheValidity implements CacheValidity {
29:
30: private CacheValidity v1;
31: private CacheValidity v2;
32:
33: /**
34: * Constructor
35: */
36: public CompositeCacheValidity(CacheValidity v1, CacheValidity v2) {
37: this .v1 = v1;
38: this .v2 = v2;
39: }
40:
41: public boolean isValid(CacheValidity validity) {
42: if (validity instanceof CompositeCacheValidity) {
43: return (v1.isValid(((CompositeCacheValidity) validity)
44: .getValidity1()) && v2
45: .isValid(((CompositeCacheValidity) validity)
46: .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 toString() {
60: return "Composite Validity[" + v1 + ':' + v2 + ']';
61: }
62: }
|