01: /*
02: * Copyright 2006 Day Management AG, Switzerland. All rights reserved.
03: */
04: package javax.jcr;
05:
06: /**
07: * This interface defines two signatures of the
08: * <code>visit</code> method; one taking a <code>Node</code>, the other a
09: * <code>Property</code>. When an object implementing this interface is passed
10: * to <code>{@link Item#accept(ItemVisitor visitor)}</code> the appropriate
11: * <code>visit</code> method is automatically called, depending on whether the
12: * <code>Item</code> in question is a <code>Node</code> or a
13: * <code>Property</code>. Different implementations of this interface can be
14: * written for different purposes. It is, for example, possible for the
15: * <code>{@link #visit(Node node)}</code> method to call <code>accept</code> on the
16: * children of the passed node and thus recurse through the tree performing some
17: * operation on each <code>Item</code>.
18: */
19: public interface ItemVisitor {
20:
21: /**
22: * This method is called when the <code>ItemVisitor</code> is
23: * passed to the <code>accept</code> method of a <code>Property</code>.
24: * If this method throws an exception the visiting process is aborted.
25: *
26: * @param property The <code>Property</code> that is accepting this visitor.
27: *
28: * @throws RepositoryException if an error occurrs
29: */
30: public void visit(Property property) throws RepositoryException;
31:
32: /**
33: * This method is called when the <code>ItemVisitor</code> is
34: * passed to the <code>accept</code> method of a <code>Node</code>.
35: * If this method throws an exception the visiting process is aborted.
36: *
37: * @param node The <code>Node</code that is accepting this visitor.
38: *
39: * @throws RepositoryException if an error occurrs
40: */
41: public void visit(Node node) throws RepositoryException;
42: }
|