diff options
Diffstat (limited to 'petascope/src/petascope/wcps/server/core/AxisName.java')
-rw-r--r-- | petascope/src/petascope/wcps/server/core/AxisName.java | 77 |
1 files changed, 39 insertions, 38 deletions
diff --git a/petascope/src/petascope/wcps/server/core/AxisName.java b/petascope/src/petascope/wcps/server/core/AxisName.java index 6520ef1..151a054 100644 --- a/petascope/src/petascope/wcps/server/core/AxisName.java +++ b/petascope/src/petascope/wcps/server/core/AxisName.java @@ -14,45 +14,46 @@ * You should have received a copy of the GNU General Public License * along with rasdaman community. If not, see <http://www.gnu.org/licenses/>. * - * Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann / - rasdaman GmbH. + * Copyright 2003 - 2010 Peter Baumann / rasdaman GmbH. * * For more information please see <http://www.rasdaman.org> * or contact Peter Baumann via <baumann@rasdaman.com>. */ -package petascope.wcps.server.core;
-
-import petascope.wcps.server.exceptions.WCPSException;
-import java.util.Collection;
-import org.w3c.dom.*;
-
-public class AxisName implements IRasNode {
-
- private String name;
-
- public AxisName(Node node, XmlQuery xq) throws WCPSException {
- System.err.println("Trying axis node: " + node.getNodeName());
-
- while ((node != null) && node.getNodeName().equals("#text")) {
- node = node.getNextSibling();
- }
-
- if (node != null && node.getNodeName().equals("axis")) {
- String axis = node.getTextContent();
- // validate axis name
- IDynamicMetadataSource meta = xq.getMetadataSource();
- Collection<String> axisNames = meta.getAxisNames();
- if (axisNames.contains(axis)) {
- this.name = axis;
- } else {
- throw new WCPSException("Unknown axis name " + axis);
- }
- } else {
- throw new WCPSException("Could not find an axis node !");
- }
- }
-
- public String toRasQL() {
- return name;
- }
-}
+package petascope.wcps.server.core; + +import petascope.core.IDynamicMetadataSource; +import petascope.exceptions.WCPSException; +import java.util.Collection; +import org.w3c.dom.*; +import petascope.exceptions.ExceptionCode; + +public class AxisName implements IRasNode { + + private String name; + + public AxisName(Node node, XmlQuery xq) throws WCPSException { + System.err.println("Trying axis node: " + node.getNodeName()); + + while ((node != null) && node.getNodeName().equals("#text")) { + node = node.getNextSibling(); + } + + if (node != null && node.getNodeName().equals("axis")) { + String axis = node.getTextContent(); + // validate axis name + IDynamicMetadataSource meta = xq.getMetadataSource(); + Collection<String> axisNames = meta.getAxisNames(); + if (axisNames.contains(axis)) { + this.name = axis; + } else { + throw new WCPSException(ExceptionCode.InvalidRequest, "Unknown axis name " + axis); + } + } else { + throw new WCPSException(ExceptionCode.InvalidRequest, "Could not find an axis node !"); + } + } + + public String toRasQL() { + return name; + } +} |