29
29
import org .exist .xquery .util .ExpressionDumper ;
30
30
import org .exist .xquery .value .Sequence ;
31
31
32
- public class TimerPragma extends AbstractPragma {
32
+ /**
33
+ * An XQuery Pragma that will record the execution
34
+ * time of the associated expression.
35
+ */
36
+ public class TimePragma extends AbstractPragma {
33
37
34
- public static final QName TIMER_PRAGMA_NAME = new QName ("timer" , Namespaces .EXIST_NS , "exist" );
38
+ public static final QName TIME_PRAGMA_NAME = new QName ("time" , Namespaces .EXIST_NS , "exist" );
39
+ public static final QName DEPRECATED_TIMER_PRAGMA_NAME = new QName ("timer" , Namespaces .EXIST_NS , "exist" );
35
40
36
41
private Logger log = null ;
37
42
38
43
private long start ;
39
44
private boolean verbose = true ;
40
45
41
- public TimerPragma (final Expression expression , final QName qname , final String contents ) throws XPathException {
46
+ public TimePragma (final Expression expression , final QName qname , final String contents ) throws XPathException {
42
47
super (expression , qname , contents );
43
48
if (contents != null && !contents .isEmpty ()) {
44
49
45
50
final String [] options = Option .tokenize (contents );
46
51
for (final String option : options ) {
47
52
final String [] param = Option .parseKeyValuePair (option );
48
53
if (param == null ) {
49
- throw new XPathException ((Expression ) null , "Invalid content found for pragma " + TIMER_PRAGMA_NAME .getStringValue () + ": " + contents );
54
+ throw new XPathException ((Expression ) null , "Invalid content found for pragma " + TIME_PRAGMA_NAME .getStringValue () + ": " + contents );
50
55
}
51
56
52
57
if ("verbose" .equals (param [0 ])) {
@@ -57,7 +62,7 @@ public TimerPragma(final Expression expression, final QName qname, final String
57
62
}
58
63
}
59
64
if (log == null ) {
60
- log = LogManager .getLogger (TimerPragma .class );
65
+ log = LogManager .getLogger (TimePragma .class );
61
66
}
62
67
}
63
68
0 commit comments