View Javadoc

1   /**
2    * Copyright (c) 2011, University of Konstanz, Distributed Systems Group
3    * All rights reserved.
4    * 
5    * Redistribution and use in source and binary forms, with or without
6    * modification, are permitted provided that the following conditions are met:
7    * * Redistributions of source code must retain the above copyright
8    * notice, this list of conditions and the following disclaimer.
9    * * Redistributions in binary form must reproduce the above copyright
10   * notice, this list of conditions and the following disclaimer in the
11   * documentation and/or other materials provided with the distribution.
12   * * Neither the name of the University of Konstanz nor the
13   * names of its contributors may be used to endorse or promote products
14   * derived from this software without specific prior written permission.
15   * 
16   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17   * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18   * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19   * DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
20   * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21   * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22   * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24   * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25   * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26   */
27  
28  package org.treetank.service.xml.xpath;
29  
30  import org.treetank.exception.TTXPathException;
31  
32  public enum EXPathError {
33  
34      /** XPath static error 0001. */
35      XPST0001("err:XPST0001:  Some component of the static context has not " + "been assigned a value."),
36  
37      /** XPath dynamic error 0004. */
38      XPDY0002("err:XPDY0002:   Some part of the dynamic context has not " + "been assigned a value."),
39  
40      /** XPath static error 0003. */
41      XPST0003("err:XPST0003: Expression is not a valid instance of the grammar" + "defined in A.1 EBNF."),
42  
43      /** XPath type error 0004. */
44      XPTY0004("err:XPTY0004 The type is not appropriate the expression or the "
45          + "typedoes not match a required type as specified by the matching rules."),
46  
47      /** XPath static error 0005. */
48      XPST0005("err:XPST0005:  The static type assigned to an expression other than the "
49          + "expression() or data(()) is empty-sequence()."),
50  
51      /** XPath static error 0008. */
52      XPST0008("err:XPST0008 Expression refers to a name that is not defined in the " + "static context"),
53  
54      /** XPath static error 0010. */
55      XPST0010("err:XPST0010: " + "Axis is not supported."),
56  
57      /** XPath static error 0017. */
58      XPST0017("err:XPST0017  The expanded QName and number of arguments in a "
59          + "function call do not match the name and arity of a function " + "signature."),
60  
61      /** XPath type error 0018. */
62      XPTY0018("err:XPTY0018  Result of the last step "
63          + "in a path expression contains both nodes and atomic values."),
64  
65      /** XPath type error 0019. */
66      XPTY0019("err:XPTY0019  Result of a step (other "
67          + "than the last step) in a path expression contains an atomic value."),
68  
69      /** XPath type error 0020. */
70      XPTY0020("err:XPTY0020 Context item in an axis step is not a node."),
71  
72      /** XPath dynamic error 0050. */
73      XPDY0050("err:XPDY0050 " + "Dynamic type of the operand of a treat expression does not match"
74          + " the sequence type specified by the treat expression."),
75  
76      /** XPath static error 0051. */
77      XPST0051("err:XPST0051 " + "Type is not defined in the in-scope schema types as an " + "atomic type."),
78  
79      /** XPath static error 0080. */
80      XPST0080("err:XPST0080 " + "Target type of a cast or castable expression must not be "
81          + "xs:NOTATION or xs:anyAtomicType."),
82  
83      /** XPath static error 0081. */
84      XPST0081("err:XPST0081 " + "Namespace prefix cannot be expanded into a namespace URI by "
85          + "using the statically known namespaces."),
86  
87      FOCA0001("err:FOCA0001, Input value too large for decimal."), FOCA0002(
88          "err:FOCA0002, Invalid lexical value."),
89          FOCA0003("err:FOCA0003, Input value too large for integer."), FOCA0005(
90              "err:FOCA0005, NaN supplied as float/double value."), FOCA0006(
91              "err:FOCA0006, String to be cast to decimal has too many digits of precision."), FOCH0001(
92              "err:FOCH0001, Code point not valid."), FOCH0002("err:FOCH0002, Unsupported collation."),
93          FOCH0003("err:FOCH0003, Unsupported normalization form."), FORH0004(
94              "err:FOCH0004, Collation does not support collation units."), FODC0001(
95              "err:FODC0001, No context document."), FODC0002("err:FODC0002, Error retrieving resource."),
96          FODC0003("err:FODC0003, Function stability not defined."), FODC0004(
97              "err:FODC0004, Invalid argument to fn:collection."), FODC0005(
98              "err:FODC0005, Invalid argument to fn:doc or fn:doc-available."), FODT0001(
99              "err:FODT0001, Overflow/underflow in date/time operation."), FODT0002(
100             "err:FODT0002, Overflow/underflow in duration operation."), FODT0003(
101             "err:FODT0003, Invalid timezone value."),
102         FONS0004("err:FONS0004, No namespace found for prefix."), FONS0005(
103             "err:FONS0005, Base-uri not defined in the static context."),
104         /**
105          * XQuery and XPath Function and Operators error 0001. This error is raised
106          * whenever an attempt is made to divide by zero.
107          */
108         FOAR0001("err:FOAR0001: Division by zero."),
109         /**
110          * XQuery and XPath Function and Operators error 0002. This error is raised
111          * whenever numeric operations result in an overflow or underflow.
112          */
113         FOAR0002("err:FOAR0002: Numeric operation overflow/underflow."), FOER0000(
114             "err:FOER0000: Unidentified error."), FORG0001(
115             "err:FORG0001, Invalid value for cast/constructor."), FORG0002(
116             "err:FORG0002, Invalid argument to fn:resolve-uri()."), FORG0003(
117             "err:FORG0003, fn:zero-or-one called with a sequence containing more than one item."), FORG0004(
118             "err:FORG0004, fn:one-or-more called with a sequence containing no items."), FORG0005(
119             "err:FORG0005, fn:exactly-one called with a sequence containing zero or more than one item."),
120         /** XQuery and XPath Function and Operators error 0006. */
121         FORG0006("err:FORG0006 Invalid argument type."), FORG0007(""), FORG0008(
122             "err:FORG0008, Both arguments to fn:dateTime have a specified timezone."), FORG0009(
123             "err:FORG0009, Error in resolving a relative URI against a base URI in fn:resolve-uri."),
124         FORX0001("err:FORX0001, Invalid regular expression. flags"), FORX0002(
125             "err:FORX0002, Invalid regular expression."), FORX0003(
126             "err:FORX0003, Regular expression matches zero-length string."), FORX0004(
127             "err:FORX0004, Invalid replacement string."), FOTY0012(
128             "err:FOTY0012, Argument node does not have a typed value."), ;
129 
130     /** error message. */
131     private final String mMessage;
132 
133     /**
134      * Encapsulated Exception for the specified Enum.
135      */
136     private final TTXPathException mException;
137 
138     /**
139      * Constructor. Initializes the internal state.
140      * 
141      * @param msg
142      *            the error message
143      */
144     private EXPathError(final String msg) {
145         mMessage = msg;
146         mException = new TTXPathException(mMessage);
147     }
148 
149     /**
150      * Returns the error message of the respective error.
151      * 
152      * @return error message
153      */
154     public String getMsg() {
155         return mMessage;
156     }
157 
158     /**
159      * Getting the specific exception for a type.
160      * 
161      * @return {@link TTXPathException} encapsulated
162      */
163     public TTXPathException getEncapsulatedException() {
164         return mException;
165     }
166 
167 }