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.jcr.source;
18:
19: import javax.jcr.Value;
20:
21: import org.apache.excalibur.source.SourceValidity;
22:
23: /**
24: * Validity of a {@link JCRNodeSource}. It's a wrapper around a JCR
25: * <code>Value</code>.
26: *
27: * @version $Id: JCRNodeSourceValidity.java 449153 2006-09-23 04:27:50Z crossley $
28: */
29: public class JCRNodeSourceValidity implements SourceValidity {
30:
31: private Value value;
32:
33: public JCRNodeSourceValidity(Value value) {
34: this .value = value;
35: }
36:
37: public int isValid() {
38: // Don't know, need another validity to compare with
39: return 0;
40: }
41:
42: public int isValid(SourceValidity other) {
43: if (other instanceof JCRNodeSourceValidity) {
44: // compare the two values
45: return ((JCRNodeSourceValidity) other).value
46: .equals(this .value) ? 1 : -1;
47: } else {
48: // invalid
49: return -1;
50: }
51: }
52: }
|