1 /**
2 * Copyright 2011 meltmedia
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.xchain.framework.jxpath;
17
18 import javax.xml.namespace.QName;
19
20 import org.apache.commons.jxpath.JXPathContext;
21
22 /**
23 * An extension of the QNameVariables to work within a given scope.
24 *
25 * @author Christian Trimble
26 * @author Devon Tackett
27 */
28 public interface ScopedQNameVariables
29 extends QNameVariables
30 {
31 /**
32 * Declares a variable for the specified name and value. If the variable name is of the form 'prefix:local-name',
33 * then the prefix is resolved. If the variable name is of the form '{uri}local-name', then the uri is taken from the
34 * variable name. Otherwise, the entire variable name is considered a local name and the uri is the null namespace uri.
35 *
36 * @param varName The name of the variable with the format 'prefix:local-name', '{uri}local-name', or 'local-name'.
37 * @param value The value to be set for this variable.
38 * @param scope The scope of the variable.
39 */
40 public void declareVariable( String varName, Object value, Scope scope );
41
42 /**
43 * Declares a variable for the specified QName and value.
44 *
45 * @param varName The QName of the variable .
46 * @param value The value to be set for this variable.
47 * @param scope The scope of the variable.
48 */
49 public void declareVariable( QName varName, Object value, Scope scope );
50
51 /**
52 * Get the variable value at the given name for the given scope.
53 *
54 * @param varName The name of the variable.
55 * @param scope The scope of the variable.
56 *
57 * @return The variable for the given name at the given scope. Null if the variable does not exist.
58 */
59 public Object getVariable( String varName, Scope scope );
60
61 /**
62 * Get the variable value at the given QName for the given scope.
63 *
64 * @param varName The QName of the variable.
65 * @param scope The scope of the variable.
66 *
67 * @return The variable for the given QName at the given scope. Null if the variable does not exist.
68 */
69 public Object getVariable( QName varName, Scope scope );
70
71 /**
72 * Determine if the variable with the given QName exists at the given scope.
73 *
74 * @param varName The QName of the variable.
75 * @param scope The scope to check at.
76 *
77 * @return True if the variable is declared at the given scope. False if not.
78 */
79 public boolean isDeclaredVariable( QName varName, Scope scope );
80
81 /**
82 * Remove the declaration of the variable with the given name at the given scope.
83 *
84 * @param varName The name of the variable to undeclare.
85 * @param scope The scope at which to undeclare the variable.
86 */
87 public void undeclareVariable( String varName, Scope scope );
88
89 /**
90 * Remove the declaration of the variable with the given QName at the given scope.
91 *
92 * @param varName The QName of the variable to undeclare.
93 * @param scope The scope at which to undeclare the variable.
94 */
95 public void undeclareVariable( QName varName, Scope scope );
96
97 /**
98 * Release all components created at the scope that these variables are for.
99 */
100 public void releaseComponents();
101 }