01: /*
02: * The contents of this file are subject to the terms of the Common Development
03: * and Distribution License (the License). You may not use this file except in
04: * compliance with the License.
05: *
06: * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
07: * or http://www.netbeans.org/cddl.txt.
08: *
09: * When distributing Covered Code, include this CDDL Header Notice in each file
10: * and include the License file at http://www.netbeans.org/cddl.txt.
11: * If applicable, add the following below the CDDL Header, with the fields
12: * enclosed by brackets [] replaced by your own identifying information:
13: * "Portions Copyrighted [year] [name of copyright owner]"
14: *
15: * The Original Software is NetBeans. The Initial Developer of the Original
16: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
17: * Microsystems, Inc. All Rights Reserved.
18: */
19:
20: package org.netbeans.modules.bpel.model.spi;
21:
22: import java.util.Iterator;
23:
24: import org.netbeans.modules.bpel.model.api.Activity;
25: import org.netbeans.modules.bpel.model.api.BaseScope;
26: import org.netbeans.modules.bpel.model.api.BpelEntity;
27: import org.netbeans.modules.bpel.model.api.BpelModel;
28: import org.netbeans.modules.bpel.model.api.VariableDeclarationScope;
29:
30: /**
31: * This is helper interface for finding various elements in OM.
32: *
33: * @author ads
34: */
35: public interface FindHelper {
36:
37: /**
38: * Returns XPath expression for OM element.
39: *
40: * @param entity
41: * BpelEntity object.
42: * @return xpath for <code>entity</code>.
43: */
44: String getXPath(BpelEntity entity);
45:
46: /**
47: * Returns iterator that iterate over hierarchical scope parents of current
48: * element.
49: *
50: * @param entity
51: * BpelEntity object.
52: * @return iterator for iterate through BaseScope .
53: */
54: Iterator<BaseScope> scopeIterator(BpelEntity entity);
55:
56: /**
57: * Returns iterator that iterate over hierarchical VariableDeclarationScope
58: * parents of current element.
59: *
60: * @param entity BpelEntity object.
61: * @return iterator for iterate through VariableDeclarationScope .
62: */
63: Iterator<VariableDeclarationScope> varaibleDeclarationScopes(
64: BpelEntity entity);
65:
66: /**
67: * Returns nearest Activity that enclose this element.
68: *
69: * @param entity
70: * BpelEntity object.
71: * @return nearest parent activity.
72: */
73: Activity getParentActivity(BpelEntity entity);
74:
75: /**
76: * Returns reference to element in model by <code>xpath</code> expression.
77: * Runtime exception can be thrown if <code>xpath</code>
78: * is bad XPath expression.
79: *
80: * @param model
81: * model which will be used for search.
82: * @param xpath XPath expression.
83: * @return array of found model elements.
84: */
85: BpelEntity[] findModelElements(BpelModel model, String xpath);
86:
87: }
|