summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDimitar Misev <dimitar@debian.(none)>2011-02-05 22:44:35 +0100
committerwww-data <www-data@ubuntu.localdomain>2011-02-16 10:01:49 +0100
commit3d356cc9ef7b1055242256c00a2e6b93b5462880 (patch)
tree977d6292418f8bce19632e10e13ac39da617c226
parent054f18a0e07c429609aae393f6bde67f21f9b82c (diff)
downloadrasdaman-upstream-master.zip
rasdaman-upstream-master.tar.gz
rasdaman-upstream-master.tar.xz
WCS 2.0 implementation in PetascopeHEADmaster
-rw-r--r--petascope/INSTALL29
-rw-r--r--petascope/Makefile.in2
-rw-r--r--petascope/README57
-rw-r--r--petascope/lib/junit-4.5-api.zipbin184067 -> 0 bytes
-rw-r--r--petascope/lib/junit-4.5-src.jarbin109014 -> 0 bytes
-rw-r--r--petascope/misc/petascopedb.sql550
-rw-r--r--petascope/nbproject/build-impl.xml222
-rw-r--r--petascope/nbproject/genfiles.properties6
-rw-r--r--petascope/nbproject/project.properties24
-rw-r--r--petascope/nbproject/project.xml21
-rw-r--r--petascope/settings.properties73
-rw-r--r--petascope/src/log4j.properties37
-rw-r--r--petascope/src/petascope/ConfigManager.java84
-rw-r--r--petascope/src/petascope/PetascopeInterface.java434
-rw-r--r--petascope/src/petascope/PetascopeXmlNamespaceMapper.java9
-rw-r--r--petascope/src/petascope/wcps/grammar/AxisIterator.java61
-rw-r--r--petascope/src/petascope/wcps/grammar/AxisIteratorList.java5
-rw-r--r--petascope/src/petascope/wcps/grammar/BooleanExpr.java5
-rw-r--r--petascope/src/petascope/wcps/grammar/BooleanScalarExpr.java5
-rw-r--r--petascope/src/petascope/wcps/grammar/CastExpr.java5
-rw-r--r--petascope/src/petascope/wcps/grammar/ComplexConst.java5
-rw-r--r--petascope/src/petascope/wcps/grammar/CondenseExpr.java5
-rw-r--r--petascope/src/petascope/wcps/grammar/CondenseOperation.java5
-rw-r--r--petascope/src/petascope/wcps/grammar/ConstantList.java7
-rw-r--r--petascope/src/petascope/wcps/grammar/CoverageConstantExpr.java5
-rw-r--r--petascope/src/petascope/wcps/grammar/CoverageConstructorExpr.java5
-rw-r--r--petascope/src/petascope/wcps/grammar/CoverageExpr.java5
-rw-r--r--petascope/src/petascope/wcps/grammar/CoverageList.java5
-rw-r--r--petascope/src/petascope/wcps/grammar/CrsList.java7
-rw-r--r--petascope/src/petascope/wcps/grammar/CrsTransformExpr.java5
-rw-r--r--petascope/src/petascope/wcps/grammar/DimensionIntervalElement.java5
-rw-r--r--petascope/src/petascope/wcps/grammar/DimensionIntervalExpr.java5
-rw-r--r--petascope/src/petascope/wcps/grammar/DimensionIntervalList.java7
-rw-r--r--petascope/src/petascope/wcps/grammar/DimensionPointElement.java5
-rw-r--r--petascope/src/petascope/wcps/grammar/DimensionPointList.java7
-rw-r--r--petascope/src/petascope/wcps/grammar/DomainExpr.java5
-rw-r--r--petascope/src/petascope/wcps/grammar/EncodedCoverageExpr.java5
-rw-r--r--petascope/src/petascope/wcps/grammar/ExponentialExpr.java5
-rw-r--r--petascope/src/petascope/wcps/grammar/ExtendExpr.java5
-rw-r--r--petascope/src/petascope/wcps/grammar/FieldInterpolationElement.java5
-rw-r--r--petascope/src/petascope/wcps/grammar/FieldInterpolationList.java7
-rw-r--r--petascope/src/petascope/wcps/grammar/ForClause.java5
-rw-r--r--petascope/src/petascope/wcps/grammar/ForClauseElements.java5
-rw-r--r--petascope/src/petascope/wcps/grammar/GeneralCondenseExpr.java5
-rw-r--r--petascope/src/petascope/wcps/grammar/IParseTreeNode.java5
-rw-r--r--petascope/src/petascope/wcps/grammar/ImageCrsDomainMetadataExpr.java5
-rw-r--r--petascope/src/petascope/wcps/grammar/IndexExpr.java5
-rw-r--r--petascope/src/petascope/wcps/grammar/InterpolationMethod.java5
-rw-r--r--petascope/src/petascope/wcps/grammar/InterpolationMethodList.java7
-rw-r--r--petascope/src/petascope/wcps/grammar/IntervalExpr.java5
-rw-r--r--petascope/src/petascope/wcps/grammar/MetaDataExpr.java5
-rw-r--r--petascope/src/petascope/wcps/grammar/NumericScalarExpr.java5
-rw-r--r--petascope/src/petascope/wcps/grammar/ProcessingExpr.java5
-rw-r--r--petascope/src/petascope/wcps/grammar/RangeConstructorExpr.java7
-rw-r--r--petascope/src/petascope/wcps/grammar/RangeConstructorTerm.java5
-rw-r--r--petascope/src/petascope/wcps/grammar/RangeExpr.java5
-rw-r--r--petascope/src/petascope/wcps/grammar/RangeExprList.java7
-rw-r--r--petascope/src/petascope/wcps/grammar/ReduceExpr.java5
-rw-r--r--petascope/src/petascope/wcps/grammar/ReturnClause.java5
-rw-r--r--petascope/src/petascope/wcps/grammar/ScalarExpr.java5
-rw-r--r--petascope/src/petascope/wcps/grammar/ScaleExpr.java5
-rw-r--r--petascope/src/petascope/wcps/grammar/SelectExpr.java5
-rw-r--r--petascope/src/petascope/wcps/grammar/SetMetaDataExpr.java5
-rw-r--r--petascope/src/petascope/wcps/grammar/SliceExpr.java5
-rw-r--r--petascope/src/petascope/wcps/grammar/StoreExpr.java5
-rw-r--r--petascope/src/petascope/wcps/grammar/StringScalarExpr.java5
-rw-r--r--petascope/src/petascope/wcps/grammar/SubsetExpr.java5
-rw-r--r--petascope/src/petascope/wcps/grammar/TrigonometricExpr.java5
-rw-r--r--petascope/src/petascope/wcps/grammar/TrimExpr.java5
-rw-r--r--petascope/src/petascope/wcps/grammar/VariableList.java5
-rw-r--r--petascope/src/petascope/wcps/grammar/WCPSRequest.java5
-rw-r--r--petascope/src/petascope/wcps/grammar/WhereClause.java5
-rw-r--r--petascope/src/petascope/wcps/grammar/wcps.g4
-rw-r--r--petascope/src/petascope/wcps/grammar/wcpsParser.java1
-rw-r--r--petascope/src/petascope/wcps/server/cli/xml.java269
-rw-r--r--petascope/src/petascope/wcps/server/core/AxisIterator.java183
-rw-r--r--petascope/src/petascope/wcps/server/core/AxisName.java77
-rw-r--r--petascope/src/petascope/wcps/server/core/BinaryOperationCoverageExpr.java210
-rw-r--r--petascope/src/petascope/wcps/server/core/BooleanScalarExpr.java236
-rw-r--r--petascope/src/petascope/wcps/server/core/CellDomainElement.java35
-rw-r--r--petascope/src/petascope/wcps/server/core/ComplexConstant.java203
-rw-r--r--petascope/src/petascope/wcps/server/core/CondenseOperation.java107
-rw-r--r--petascope/src/petascope/wcps/server/core/CondenseScalarExpr.java156
-rw-r--r--petascope/src/petascope/wcps/server/core/ConstantCoverageExpr.java288
-rw-r--r--petascope/src/petascope/wcps/server/core/ConstantList.java169
-rw-r--r--petascope/src/petascope/wcps/server/core/ConstructCoverageExpr.java284
-rw-r--r--petascope/src/petascope/wcps/server/core/CoverageExpr.java321
-rw-r--r--petascope/src/petascope/wcps/server/core/CoverageExprPairType.java166
-rw-r--r--petascope/src/petascope/wcps/server/core/CoverageInfo.java298
-rw-r--r--petascope/src/petascope/wcps/server/core/CoverageIterator.java144
-rw-r--r--petascope/src/petascope/wcps/server/core/Crs.java210
-rw-r--r--petascope/src/petascope/wcps/server/core/CrsTransformCoverageExpr.java45
-rw-r--r--petascope/src/petascope/wcps/server/core/DbMetadataSource.java1175
-rw-r--r--petascope/src/petascope/wcps/server/core/DimensionIntervalElement.java407
-rw-r--r--petascope/src/petascope/wcps/server/core/DimensionIntervalList.java70
-rw-r--r--petascope/src/petascope/wcps/server/core/DimensionPointElement.java220
-rw-r--r--petascope/src/petascope/wcps/server/core/DomainElement.java354
-rw-r--r--petascope/src/petascope/wcps/server/core/DynamicMetadataSource.java106
-rw-r--r--petascope/src/petascope/wcps/server/core/EncodeDataExpr.java152
-rw-r--r--petascope/src/petascope/wcps/server/core/ExtendCoverageExpr.java224
-rw-r--r--petascope/src/petascope/wcps/server/core/FieldInterpolationElement.java118
-rw-r--r--petascope/src/petascope/wcps/server/core/FieldName.java65
-rw-r--r--petascope/src/petascope/wcps/server/core/ICoverageInfo.java5
-rw-r--r--petascope/src/petascope/wcps/server/core/IDynamicMetadataSource.java34
-rw-r--r--petascope/src/petascope/wcps/server/core/IMetadataSource.java45
-rw-r--r--petascope/src/petascope/wcps/server/core/IRasNode.java5
-rw-r--r--petascope/src/petascope/wcps/server/core/InducedOperationCoverageExpr.java136
-rw-r--r--petascope/src/petascope/wcps/server/core/InterpolationMethod.java131
-rw-r--r--petascope/src/petascope/wcps/server/core/Metadata.java705
-rw-r--r--petascope/src/petascope/wcps/server/core/MetadataScalarExpr.java35
-rw-r--r--petascope/src/petascope/wcps/server/core/NumericScalarExpr.java306
-rw-r--r--petascope/src/petascope/wcps/server/core/ProcessCoveragesRequest.java462
-rw-r--r--petascope/src/petascope/wcps/server/core/RangeComponent.java133
-rw-r--r--petascope/src/petascope/wcps/server/core/RangeCoverageExpr.java126
-rw-r--r--petascope/src/petascope/wcps/server/core/RangeElement.java294
-rw-r--r--petascope/src/petascope/wcps/server/core/RangeField.java68
-rw-r--r--petascope/src/petascope/wcps/server/core/ReduceScalarExpr.java96
-rw-r--r--petascope/src/petascope/wcps/server/core/SDU.java20
-rw-r--r--petascope/src/petascope/wcps/server/core/ScalarExpr.java303
-rw-r--r--petascope/src/petascope/wcps/server/core/ScaleCoverageExpr.java250
-rw-r--r--petascope/src/petascope/wcps/server/core/SetMetadataCoverageExpr.java45
-rw-r--r--petascope/src/petascope/wcps/server/core/SliceCoverageExpr.java222
-rw-r--r--petascope/src/petascope/wcps/server/core/StringScalarExpr.java86
-rw-r--r--petascope/src/petascope/wcps/server/core/SubsetOperationCoverageExpr.java100
-rw-r--r--petascope/src/petascope/wcps/server/core/TrimCoverageExpr.java224
-rw-r--r--petascope/src/petascope/wcps/server/core/UnaryOperationCoverageExpr.java266
-rw-r--r--petascope/src/petascope/wcps/server/core/VariableReference.java73
-rw-r--r--petascope/src/petascope/wcps/server/core/WCPS.java327
-rw-r--r--petascope/src/petascope/wcps/server/core/Wgs84Crs.java207
-rw-r--r--petascope/src/petascope/wcps/server/core/XmlQuery.java13
-rw-r--r--petascope/src/petascope/wcps/server/exceptions/InvalidCrsException.java30
-rw-r--r--petascope/src/petascope/wcps/server/exceptions/InvalidMetadataException.java37
-rw-r--r--petascope/src/petascope/wcps/server/exceptions/InvalidWcpsRequestException.java39
-rw-r--r--petascope/src/petascope/wcps/server/exceptions/ResourceException.java41
-rw-r--r--petascope/src/petascope/wcps/server/exceptions/WCPSException.java40
-rw-r--r--petascope/src/petascope/wcps/server/servlet/WCPSServlet.java468
-rw-r--r--petascope/src/petascope/wcps/server/test/FullTestsOnline.java10
-rw-r--r--petascope/src/petascope/wcps/server/test/GrammarTest.java3
-rw-r--r--petascope/src/petascope/wcps/server/test/GrammarTestOnline.java3
-rw-r--r--petascope/src/petascope/wcps/server/test/XmlTestOnline.java3
-rw-r--r--petascope/src/petascope/wcs/server/WcsServer.java84
-rw-r--r--petascope/src/petascope/wcs/server/cli/CLI.java14
-rw-r--r--petascope/src/petascope/wcs/server/core/TimeString.java15
-rw-r--r--petascope/src/petascope/wcs/server/core/convertGetCoverage.java138
-rw-r--r--petascope/src/petascope/wcs/server/core/executeDescribeCoverage.java32
-rw-r--r--petascope/src/petascope/wcs/server/core/executeGetCapabilities.java33
-rw-r--r--petascope/src/petascope/wcs/server/exceptions/ActionNotSupportedException.java42
-rw-r--r--petascope/src/petascope/wcs/server/exceptions/BadResponseHandlerException.java42
-rw-r--r--petascope/src/petascope/wcs/server/exceptions/InputOutputException.java42
-rw-r--r--petascope/src/petascope/wcs/server/exceptions/InternalComponentException.java42
-rw-r--r--petascope/src/petascope/wcs/server/exceptions/InternalSqlException.java42
-rw-r--r--petascope/src/petascope/wcs/server/exceptions/InvalidParameterValueException.java42
-rw-r--r--petascope/src/petascope/wcs/server/exceptions/InvalidPropertyValueException.java42
-rw-r--r--petascope/src/petascope/wcs/server/exceptions/InvalidRequestException.java42
-rw-r--r--petascope/src/petascope/wcs/server/exceptions/InvalidServiceConfigurationException.java42
-rw-r--r--petascope/src/petascope/wcs/server/exceptions/InvalidTemporalMetadataException.java42
-rw-r--r--petascope/src/petascope/wcs/server/exceptions/MaliciousQueryException.java42
-rw-r--r--petascope/src/petascope/wcs/server/exceptions/MissingParameterValueException.java42
-rw-r--r--petascope/src/petascope/wcs/server/exceptions/MultiBandImagesNotSupportedException.java42
-rw-r--r--petascope/src/petascope/wcs/server/exceptions/NoApplicableCodeException.java42
-rw-r--r--petascope/src/petascope/wcs/server/exceptions/NodeParsingNotImplementedException.java42
-rw-r--r--petascope/src/petascope/wcs/server/exceptions/NotEnoughStorageException.java42
-rw-r--r--petascope/src/petascope/wcs/server/exceptions/RasdamanRequestFailedException.java42
-rw-r--r--petascope/src/petascope/wcs/server/exceptions/RasdamanUnavailableException.java42
-rw-r--r--petascope/src/petascope/wcs/server/exceptions/ServletConnectionException.java42
-rw-r--r--petascope/src/petascope/wcs/server/exceptions/UnsupportedCombinationException.java42
-rw-r--r--petascope/src/petascope/wcs/server/exceptions/WCSException.java149
-rw-r--r--petascope/src/petascope/wcs/server/exceptions/WcsRuntimeException.java42
-rw-r--r--petascope/src/petascope/wcs/server/exceptions/XmlNotValidException.java42
-rw-r--r--petascope/src/petascope/wcs/server/exceptions/XmlStructuresException.java42
-rw-r--r--petascope/src/petascope/wcs2/schemas/Examples/requestDescribeCoverage.xml8
-rw-r--r--petascope/src/petascope/wcs2/schemas/Examples/requestGetCapabilities.xml10
-rw-r--r--petascope/src/petascope/wcs2/schemas/Examples/requestGetCoverage.xml18
-rw-r--r--petascope/src/petascope/wcs2/schemas/Examples/responseDescribeCoverage.xml37
-rw-r--r--petascope/src/petascope/wcs2/schemas/Examples/responseGetCapabilities.xml60
-rw-r--r--petascope/src/petascope/wcs2/schemas/Examples/responseGetCoverage.xml40
-rw-r--r--petascope/src/petascope/wcs2/schemas/Examples/wcsDescribeCoverage.xml57
-rw-r--r--petascope/src/petascope/wcs2/schemas/Examples/wcsGetCapabilities.xml125
-rw-r--r--petascope/src/petascope/wcs2/schemas/Examples/wcsGetCoverage.xml57
-rw-r--r--petascope/src/petascope/wcs2/schemas/SchemaServlet.java97
-rw-r--r--petascope/src/petascope/wcs2/schemas/gml/Examples/2dIdentityConversion.xml16
-rw-r--r--petascope/src/petascope/wcs2/schemas/gml/Examples/2dIdentityMethod.xml22
-rw-r--r--petascope/src/petascope/wcs2/schemas/gml/Examples/exampleRangeStructure.xml35
-rw-r--r--petascope/src/petascope/wcs2/schemas/gml/Examples/exampleRectifiedGridCoverage.xml56
-rw-r--r--petascope/src/petascope/wcs2/schemas/gml/Examples/exampleReferenceablGridCoverage.xml60
-rw-r--r--petascope/src/petascope/wcs2/schemas/gml/gmlwcsAll.xsd21
-rw-r--r--petascope/src/petascope/wcs2/schemas/gml/wcsCoverage.xsd160
-rw-r--r--petascope/src/petascope/wcs2/schemas/gml/wcsDataTypeIdentifiers.xml111
-rw-r--r--petascope/src/petascope/wcs2/schemas/gml/wcsGrids.xsd156
-rw-r--r--petascope/src/petascope/wcs2/schemas/wcsAll.xsd21
-rw-r--r--petascope/src/petascope/wcs2/schemas/wcsCommon.xsd87
-rw-r--r--petascope/src/petascope/wcs2/schemas/wcsDescribeCoverage.xsd73
-rw-r--r--petascope/src/petascope/wcs2/schemas/wcsExtensions.xml125
-rw-r--r--petascope/src/petascope/wcs2/schemas/wcsGetCapabilities.xsd56
-rw-r--r--petascope/src/petascope/wcs2/schemas/wcsGetCoverage.xsd88
-rw-r--r--petascope/src/petascope/wcs2/server/Wcs2Server.java120
-rw-r--r--petascope/src/petascope/wcs2/server/ops/DescribeCoverage.java204
-rw-r--r--petascope/src/petascope/wcs2/server/ops/GetCapabilities.java85
-rw-r--r--petascope/src/petascope/wcs2/server/ops/GetCoverage.java529
-rw-r--r--petascope/src/petascope/wcs2/server/ops/WcsOperation.java36
-rw-r--r--petascope/src/petascope/wcs2/server/templates/DescribeCoverageTemplate.xml38
-rw-r--r--petascope/src/petascope/wcs2/server/templates/GetCapabilitiesTemplate.xml92
-rw-r--r--petascope/src/petascope/wcs2/server/templates/GetCoverageTemplate.xml38
-rw-r--r--petascope/src/petascope/wcs2/server/templates/WcsNamespaceContext.java59
-rw-r--r--petascope/src/petascope/wcst/server/WcstServer.java61
-rw-r--r--petascope/src/petascope/wcst/server/servlet/wcstServlet.java14
-rw-r--r--petascope/src/petascope/wcst/transaction/ServiceFirewall.java4
-rw-r--r--petascope/src/petascope/wcst/transaction/executeAsyncTransaction.java52
-rw-r--r--petascope/src/petascope/wcst/transaction/executeTransaction.java429
-rw-r--r--petascope/src/petascope/wcst/transaction/tools/RasdamanUtils.java28
-rw-r--r--petascope/src/petascope/wcst/transaction/tools/TestRasdamanUtils.java12
-rw-r--r--petascope/src/petascope/wps/server/WpsServer.java24
-rw-r--r--petascope/web/WEB-INF/web.xml9
213 files changed, 5810 insertions, 12644 deletions
diff --git a/petascope/INSTALL b/petascope/INSTALL
index 9ef074b..1ee10ad 100644
--- a/petascope/INSTALL
+++ b/petascope/INSTALL
@@ -1,25 +1,26 @@
-This file contains instructions on how to install PetaScope.
+This file contains instructions on how to install PetaScope.
BUILD AND INSTALL:
-- download the PetaScope package from www.petascope.org/Download
- and uncompress the tarball; alternatively, download from the
- repository saying
- $ git clone git://kahlua.eecs.jacobs-university.de/petascope.git
-- compile the code and the servlet interface:
- $ ant
-- edit the settings.properties configuration file
-- initialize the PostgreSQL database for PetaScope metadata saying
- $ psql < misc/petascopedb.sql
-- deploy the war file, dist/petascope.war, with Tomcat.
+- PetaScope is part of the rasdaman distribution (www.rasdaman.org), to get it use
+ $ git clone git://kahlua.eecs.jacobs-university.de/rasdaman.git
+- Setup the database (create database petascopedb in PostgreSQL, with user
+ petauser/petapasswd), or edit the db/settings.properties configuration file.
+ To insert initial metadata in petascopedb, run:
+ $ make setupdb
+- Compile all in one step:
+ $ make all
+ This compiles the code, creates a war archive in build/dist and Javadoc in build/apidocs)
+- Deploy the war file, build/dist/petascope.war, with Tomcat. If CATALINA_HOME
+ is properly set to the Tomcat's home directory, you can also do:
+ $ make install
+- Run any tests (currently this runs only WCS 2.0 tests):
+ $ make test
Please note that in order for PetaScope to run, you also need a
rasdaman server available. You can download and install it from
www.rasdaman.org/Download
-For further details, refer to the documentation available at
-www.petascope.org/Install and www.petascope.org/Support.
-
VERSION COMPATIBILITY STATEMENT:
Petascope compiles successfully with Java 1.6.
diff --git a/petascope/Makefile.in b/petascope/Makefile.in
index 2c15aaa..35591c4 100644
--- a/petascope/Makefile.in
+++ b/petascope/Makefile.in
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# Makefile.in generated by automake 1.11 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
diff --git a/petascope/README b/petascope/README
index f46ed45..095a090 100644
--- a/petascope/README
+++ b/petascope/README
@@ -1,42 +1,42 @@
-This file is part of PetaScope, a free implementation of the Open GeoSpatial Consortium (OGC, www.opengeospatial.org) Web Coverage Service (WCS) standards suite. As such, it implements the following interface standards:
-- Web Coverage Service (WCS) 1.1.2
-- WCS Processing Extension 1.0.0, which grounds on Web Coverage Processing Service (WCPS) 1.0.0
-- WCS Transaction Extension (WCS-T) 1.4.0
-
-In addition, you can find a demo implementation of the Web Coverage Service (WCS) 2.0, which is currently under development.
+PetaScope
+---------
-PetaScope is implemented as a Java servlet. As such, it relies on the following freely available components which are not part of the PetaScope distribution:
-- rasdaman (www.rasdaman.org) as raster server
-- Tomcat (tomcat.apache.org) as servlet container
-- PostgreSQL (www.postgresql.org) as relational database system
+This file is part of PetaScope, a free implementation of the Open GeoSpatial Consortium (OGC,
+www.opengeospatial.org) Web Coverage Service (WCS) standards suite. As such, it implements the
+following interface standards:
+ - Web Coverage Service (WCS) 2.0
+ - Web Coverage Service (WCS) 1.1.2
+ - Web Coverage Processing Service (WCPS) 1.0.0
+ - WCS Transaction Extension (WCS-T) 1.4.0
-DISTRIBUTION
-============
+PetaScope is implemented as a Java servlet. As such, it relies on the following
+freely available components which are not part of the PetaScope distribution:
+ - rasdaman (www.rasdaman.org) as raster server
+ - Tomcat (tomcat.apache.org) as servlet container
+ - PostgreSQL (www.postgresql.org) as relational database system
+
+
+Distribution
+------------
A PetaScope distribution consists of the following directories and files:
-doc/ Source code documentation,
- generated by javadoc
-examples/ Sample XML requests
-lib/ External libraries required (+)
-misc/ Additional scripts and files, e.g., for
- initializing the metadata database
-src/ PetaScope Java source code
-test/ test source code and test files
-nbproject/ Project build files and properties.
-xml/ WC*S schema files used by PetaScope
- (copies from schemas.opengis.net)
-settings.properties Servlet initialization parameters,
- such as database connections (*)
+db/ Scripts to initialize and maintain the PetaScope database
+db/settings.properties Servlet initialization parameters, such as database connections (*)
+lib/ External libraries required
+makefiles/
+nbproject/ NetBeans project build files and properties.
+src/ Main source code
+test/ Test source code and test files
+xml/ WC*S schema files used by PetaScope (copies from schemas.opengis.net)
web/WEB-INF/web.xml PetaScope servlet deployment file (*)
LICENSE PetaScope license
build.xml "Ant" rule file for building PetaScope
+Makefile Standard Makefile for building PetaScope, see 'make help' for more details
+INSTALL Installation guidelines
README This file
Notes:
-(+) provided for convenience; it is recommended
- to sustitute these by the resp. files of your
- installation.
(*) requires manual configuration
See INSTALL for installation guidelines.
@@ -48,4 +48,3 @@ PetaScope is licensed by Jacobs University Bremen
(www.jacobs-university.de) and Peter Baumann
(www.peter-baumann.org) under the GNU General Public
License (GPL), see www.gnu.org or the LICENSE file.
-
diff --git a/petascope/lib/junit-4.5-api.zip b/petascope/lib/junit-4.5-api.zip
deleted file mode 100644
index 5748c44..0000000
--- a/petascope/lib/junit-4.5-api.zip
+++ /dev/null
Binary files differ
diff --git a/petascope/lib/junit-4.5-src.jar b/petascope/lib/junit-4.5-src.jar
deleted file mode 100644
index 18774a5..0000000
--- a/petascope/lib/junit-4.5-src.jar
+++ /dev/null
Binary files differ
diff --git a/petascope/misc/petascopedb.sql b/petascope/misc/petascopedb.sql
deleted file mode 100644
index 771b641..0000000
--- a/petascope/misc/petascopedb.sql
+++ /dev/null
@@ -1,550 +0,0 @@
--- These SQL statements will create the metadata database required by WCPS. Each coverage defined here must have a rasdaman collection by the same name in order to work.
-
-
--- There are three types of tables.
--- The "static" fixed tables are the ones for which you see "insert" statements in this file. They should generally never be modified. Any modifications of these tables will require to be reflected in the WCPS source code, so a code review must be done if anything is inserted or deleted there. The values of these tables are specified by the WCPS standard.
--- The "service" tables contain various things that are not per-coverage. These are modifiable, but see the comments for each before you change them.
--- The "coverage" tables contain information for each coverage. They can be modified freely, as long as the end result makes sense, as described below.
-
------------------------------------------------------------------------------------------
--- STATIC TABLES. Once again, modifying any of these will break WCPS.
------------------------------------------------------------------------------------------
-
--- This is a static table, describing the type of axes WCPS knows about. Don't touch it.
-CREATE TABLE ps_axistype (
- id serial NOT NULL,
- axistype character varying(9) UNIQUE NOT NULL,
- primary key (id)
-);
-
-INSERT INTO ps_axistype VALUES (1, 'x');
-INSERT INTO ps_axistype VALUES (2, 'y');
-INSERT INTO ps_axistype VALUES (3, 'temporal');
-INSERT INTO ps_axistype VALUES (4, 'elevation');
-INSERT INTO ps_axistype VALUES (5, 'other');
-INSERT INTO ps_axistype VALUES (6, 't');
-SELECT pg_catalog.setval('ps_axistype_id_seq', 6, true);
-
--- This is a static table, describing the range datatypes WCPS knows about. Don't touch it.
-CREATE TABLE ps_datatype (
- id serial NOT NULL,
- datatype text NOT NULL,
- primary key (id)
-);
-
-INSERT INTO ps_datatype (id, datatype) VALUES (1, 'boolean');
-INSERT INTO ps_datatype (id, datatype) VALUES (2, 'char');
-INSERT INTO ps_datatype (id, datatype) VALUES (3, 'unsigned char');
-INSERT INTO ps_datatype (id, datatype) VALUES (4, 'short');
-INSERT INTO ps_datatype (id, datatype) VALUES (5, 'unsigned short');
-INSERT INTO ps_datatype (id, datatype) VALUES (6, 'int');
-INSERT INTO ps_datatype (id, datatype) VALUES (7, 'unsigned int');
-INSERT INTO ps_datatype (id, datatype) VALUES (8, 'long');
-INSERT INTO ps_datatype (id, datatype) VALUES (9, 'unsigned long');
-INSERT INTO ps_datatype (id, datatype) VALUES (10, 'float');
-INSERT INTO ps_datatype (id, datatype) VALUES (11, 'double');
-INSERT INTO ps_datatype (id, datatype) VALUES (12, 'complex');
-INSERT INTO ps_datatype (id, datatype) VALUES (13, 'complex2');
-SELECT pg_catalog.setval('ps_datatype_id_seq', 13, true);
-
--- This is a static table, describing the interpolation types WCPS knows about. Don't touch it.
-CREATE TABLE ps_interpolationtype (
- id serial NOT NULL,
- interpolationtype text NOT NULL,
- primary key (id)
-);
-
-INSERT INTO ps_interpolationtype (id, interpolationtype) VALUES (1, 'nearest');
-INSERT INTO ps_interpolationtype (id, interpolationtype) VALUES (2, 'linear');
-INSERT INTO ps_interpolationtype (id, interpolationtype) VALUES (3, 'cubic');
-INSERT INTO ps_interpolationtype (id, interpolationtype) VALUES (4, 'quadratic');
-INSERT INTO ps_interpolationtype (id, interpolationtype) VALUES (5, 'none');
-SELECT pg_catalog.setval('ps_interpolationtype_id_seq', 5, true);
-
--- This is a static table, describing the null resistances WCPS knows about. Don't touch it.
-CREATE TABLE ps_nullresistance (
- id serial NOT NULL,
- nullresistance text NOT NULL,
- primary key (id)
-);
-
-INSERT INTO ps_nullresistance (id, nullresistance) VALUES (1, 'full');
-INSERT INTO ps_nullresistance (id, nullresistance) VALUES (2, 'none');
-INSERT INTO ps_nullresistance (id, nullresistance) VALUES (3, 'half');
-INSERT INTO ps_nullresistance (id, nullresistance) VALUES (4, 'other');
-SELECT pg_catalog.setval('ps_nullresistance_id_seq', 4, true);
-
--- This is a static table, describing the coordinate reference systems known by WCPS. Don't touch it.
--- Whether it's actually present in the table or not, the CRS called "CRS:1" is always supported. CRS:1 is the image CRS, i.e. addressable by pixels.
--- The current implementation does not support CRSs other than CRS:1, and does not use the contents of the table.
-CREATE TABLE ps_crs (
- id serial NOT NULL,
- name text NOT NULL,
- primary key (id)
-);
-
-INSERT INTO ps_crs VALUES (9, 'urn:ogc:def:crs:OGC:1.3:CRS84');
-INSERT INTO ps_crs VALUES (8, 'CRS:1');
-SELECT pg_catalog.setval('ps_crs_id_seq', 9, true);
-
-
------------------------------------------------------------------------------------------
--- SERVICE TABLES.
------------------------------------------------------------------------------------------
-
--- This table describes the encoding formats known to WCPS, as well as their mappings to mimetypes. WCPS doesn't care about these, but if you add any, make sure that rasdaman can encode in the format specified by 'name', or encoding to that format won't work.
-CREATE TABLE ps_format (
- id serial NOT NULL,
- name character varying(64) NOT NULL,
- mimetype character varying(128) NOT NULL,
- primary key (id)
-);
-
-INSERT INTO ps_format VALUES (1, 'csv', 'text/plain');
-INSERT INTO ps_format VALUES (2, 'jpg', 'image/jpeg');
-INSERT INTO ps_format VALUES (3, 'jpeg', 'image/jpeg');
-INSERT INTO ps_format VALUES (4, 'png', 'image/png');
-INSERT INTO ps_format VALUES (5, 'tif', 'image/tiff');
-INSERT INTO ps_format VALUES (6, 'tiff', 'image/tiff');
-INSERT INTO ps_format VALUES (7, 'raw', 'application/x-octet-stream');
-
-SELECT pg_catalog.setval('ps_format_id_seq', 7, true);
-
-
------------------------------------------------------------------------------------------
--- COVERAGE TABLES. At this point, you need to have read the beginning of the WCPS standard, which describes the different metadata a coverage may have.
--- When entering a new coverage, it's best to fill the tables in the order listed here, to satisfy foreign key constraints.
------------------------------------------------------------------------------------------
-
--- A coverage must be introduced here.
--- The name must correspond to the rasdaman collection for that data. It must also be present in PS_NullSet below.
--- The nullDefault must be the default null value for the coverage. It must match the range type. If the range type is a structure, it must look like this: {c1,c2,c3...} where cn is the nth component of the value.
--- The interpolationTypeDefault is the default interpolation type used in operations that require one, but don't have one specified. It must point to an entry in the static table above.
--- The nullResistanceDefault is the default null resistance used in operations that require one, but don't have one specified. It must point to an entry in the static table above.
-CREATE TABLE ps_coverage (
- id serial NOT NULL,
- name text NOT NULL,
- nullvalue text,
- crs text,
- nulldefault text,
- interpolationtypedefault integer,
- nullresistancedefault integer,
- primary key (id),
- foreign key (interpolationTypeDefault) references ps_interpolationType (id),
- foreign key (nullResistanceDefault) references ps_nullResistance (id)
-);
-
-INSERT INTO ps_coverage VALUES (30, 'climate_clouds', NULL, NULL, '0', 5, 2);
-INSERT INTO ps_coverage VALUES (31, 'climate_earth', NULL, NULL, '0', 5, 2);
-INSERT INTO ps_coverage VALUES (8, 'Modis', NULL, NULL, '0', 5, 2);
-INSERT INTO ps_coverage VALUES (29, 'TP', NULL, NULL, '0', 5, 2);
-INSERT INTO ps_coverage VALUES (27, 'NN3_10', NULL, NULL, '0', 5, 2);
-INSERT INTO ps_coverage VALUES (2, 'nrg', NULL, '', '{0,0,0}', 5, 2);
-INSERT INTO ps_coverage VALUES (28, 'NN3_11', NULL, NULL, '0', 5, 2);
-INSERT INTO ps_coverage VALUES (32, 'NIR', NULL, NULL, '{0,0,0}', 5, 2);
-INSERT INTO ps_coverage VALUES (7, 'Waha_SEGY', NULL, NULL, '0', 5, 2);
-INSERT INTO ps_coverage VALUES (3, 'mr', NULL, '', '{0,0}', 5, 2);
-INSERT INTO ps_coverage VALUES (1, 'rgb', NULL, NULL, '{0,0,0}', 5, 2);
-INSERT INTO ps_coverage VALUES (17, 'climate_temperature', NULL, NULL, '0', 5, 2);
-INSERT INTO ps_coverage VALUES (16, 'whatevereeeee', NULL, NULL, '0', 5, 2);
-INSERT INTO ps_coverage VALUES (6, 'Boonsville_SEGY', NULL, NULL, '0', 5, 2);
-INSERT INTO ps_coverage VALUES (4, 'mowglie', NULL, '', '{0,0,0}', 5, 2);
-INSERT INTO ps_coverage VALUES (19, 'NN3_2', NULL, NULL, '0', 5, 2);
-INSERT INTO ps_coverage VALUES (20, 'NN3_3', NULL, NULL, '0', 5, 2);
-INSERT INTO ps_coverage VALUES (18, 'NN3_1', NULL, NULL, '0', 5, 2);
-INSERT INTO ps_coverage VALUES (23, 'NN3_6', NULL, NULL, '0', 5, 2);
-INSERT INTO ps_coverage VALUES (24, 'NN3_7', NULL, NULL, '0', 5, 2);
-INSERT INTO ps_coverage VALUES (21, 'NN3_4', NULL, NULL, '0', 5, 2);
-INSERT INTO ps_coverage VALUES (22, 'NN3_5', NULL, NULL, '0', 5, 2);
-INSERT INTO ps_coverage VALUES (25, 'NN3_8', NULL, '', '0', 5, 2);
-INSERT INTO ps_coverage VALUES (26, 'NN3_9', NULL, NULL, '0', 5, 2);
-
-SELECT pg_catalog.setval('ps_coverage_id_seq', 32, true);
-
-
--- Each coverage has a number of axes, called its dimension. Each axis must have an entry here.
--- The coverage is the id of the coverage a given entry describes.
--- The i is the number of axis for that coverage. Axes are ordered, so be careful.
--- The lo is the lowest addressable pixel, usually 0.
--- The hi is the highest addressable pixel, usually the total number of pixels on the axis minus 1.
-CREATE TABLE ps_celldomain (
- id serial NOT NULL,
- coverage integer NOT NULL,
- i integer NOT NULL,
- lo integer NOT NULL,
- hi integer NOT NULL,
- primary key (id),
- unique (coverage, i),
- foreign key (coverage) references ps_coverage (id) on delete cascade
-);
-
-INSERT INTO ps_celldomain VALUES (147, 30, 0, 0, 719);
-INSERT INTO ps_celldomain VALUES (148, 30, 1, 0, 360);
-INSERT INTO ps_celldomain VALUES (149, 30, 2, 0, 59);
-INSERT INTO ps_celldomain VALUES (152, 31, 0, 0, 719);
-INSERT INTO ps_celldomain VALUES (153, 31, 1, 0, 360);
-INSERT INTO ps_celldomain VALUES (154, 31, 2, 0, 60);
-INSERT INTO ps_celldomain VALUES (155, 8, 0, 0, 7);
-INSERT INTO ps_celldomain VALUES (156, 8, 1, 0, 1199);
-INSERT INTO ps_celldomain VALUES (157, 8, 2, 0, 1199);
-INSERT INTO ps_celldomain VALUES (158, 29, 0, 0, 719);
-INSERT INTO ps_celldomain VALUES (159, 29, 1, 0, 369);
-INSERT INTO ps_celldomain VALUES (160, 29, 2, 0, 30);
-INSERT INTO ps_celldomain VALUES (161, 29, 3, 0, 25);
-INSERT INTO ps_celldomain VALUES (162, 27, 0, 0, 125);
-INSERT INTO ps_celldomain VALUES (163, 2, 0, 0, 1959);
-INSERT INTO ps_celldomain VALUES (164, 2, 1, 0, 1075);
-INSERT INTO ps_celldomain VALUES (165, 28, 0, 0, 125);
-INSERT INTO ps_celldomain VALUES (166, 32, 0, 0, 1915);
-INSERT INTO ps_celldomain VALUES (167, 32, 1, 0, 1075);
-INSERT INTO ps_celldomain VALUES (168, 7, 0, 0, 201);
-INSERT INTO ps_celldomain VALUES (169, 7, 1, 0, 258);
-INSERT INTO ps_celldomain VALUES (170, 7, 2, 0, 1000);
-INSERT INTO ps_celldomain VALUES (171, 3, 0, 0, 255);
-INSERT INTO ps_celldomain VALUES (172, 3, 1, 0, 210);
-INSERT INTO ps_celldomain VALUES (173, 1, 0, 0, 399);
-INSERT INTO ps_celldomain VALUES (174, 1, 1, 0, 343);
-INSERT INTO ps_celldomain VALUES (175, 17, 0, 0, 719);
-INSERT INTO ps_celldomain VALUES (176, 17, 1, 0, 360);
-INSERT INTO ps_celldomain VALUES (177, 17, 2, 0, 60);
-INSERT INTO ps_celldomain VALUES (178, 16, 0, 0, 699);
-INSERT INTO ps_celldomain VALUES (179, 6, 0, 0, 134);
-INSERT INTO ps_celldomain VALUES (180, 6, 1, 0, 94);
-INSERT INTO ps_celldomain VALUES (181, 6, 2, 0, 2000);
-INSERT INTO ps_celldomain VALUES (182, 4, 0, 0, 119);
-INSERT INTO ps_celldomain VALUES (183, 4, 1, 0, 158);
-INSERT INTO ps_celldomain VALUES (184, 4, 2, 0, 118);
-INSERT INTO ps_celldomain VALUES (185, 19, 0, 0, 125);
-INSERT INTO ps_celldomain VALUES (186, 20, 0, 0, 125);
-INSERT INTO ps_celldomain VALUES (187, 18, 0, 0, 125);
-INSERT INTO ps_celldomain VALUES (188, 23, 0, 0, 125);
-INSERT INTO ps_celldomain VALUES (189, 24, 0, 0, 125);
-INSERT INTO ps_celldomain VALUES (190, 21, 0, 0, 125);
-INSERT INTO ps_celldomain VALUES (191, 22, 0, 0, 125);
-INSERT INTO ps_celldomain VALUES (192, 25, 0, 0, 125);
-INSERT INTO ps_celldomain VALUES (193, 26, 0, 0, 125);
-
-SELECT pg_catalog.setval('ps_celldomain_id_seq', 193, true);
-
--- Addressing by pixels is good enough for some things, but sometimes you need to address a coverage via its geo coordinates. The geographic extent of each coverage is similar to the cell domain, but in geo coordinates.
--- For each coverage, the number of entries must be the same as in the CellDomain table.
--- The coverage is the id of the coverage a given entry describes.
--- The i is the number of axis for that coverage. Axes are ordered, so be careful.
--- The name is the name of a given axis. For example, a horizontal axis could have the name "x", and the a vertical one could have "y". You can then ask WCPS to scale x by 2, etc.
--- The type is one of the axes types in the static table above.
--- If the type is not temporal, numLo and numHi must be the lowest and highest addressable points in geo coordinates, and strLo and strHi must be left null.
--- If the type is temporal, numLo and numHi must be left null, and strLo and strHi must be timestamps, specifying the extent.
--- Because WCPS currently does not support geo coordinates, you can use dummy values for numLo and numHi, e.g. 0 and 1.
--- Because the current implementation does not currently support temporal axes, you can use "other" as the type and specify dummy values for numLo and numHi.
--- Fanally, geocoordinates are dependent on the CRS, so this table doesn't currently make much sense. An entry should be per coverage, axis, and CRS, rather than just per coverage and axis as it is now.
-CREATE TABLE ps_domain (
- id serial NOT NULL,
- coverage integer NOT NULL,
- i integer NOT NULL,
- name text NOT NULL,
- type integer NOT NULL,
- numlo double precision,
- numhi double precision,
- strlo text,
- strhi text,
- primary key (id),
- unique (coverage, i),
- foreign key (coverage) references ps_coverage (id) on delete cascade,
- foreign key (type) references ps_axisType (id) on delete cascade
-);
-
-INSERT INTO ps_domain VALUES (104, 30, 0, 'x', 5, 0, 1, NULL, NULL);
-INSERT INTO ps_domain VALUES (105, 30, 1, 'y', 5, 0, 1, NULL, NULL);
-INSERT INTO ps_domain VALUES (106, 30, 2, 't', 5, 0, 1, NULL, NULL);
-INSERT INTO ps_domain VALUES (109, 31, 0, 'x', 5, 0, 1, NULL, NULL);
-INSERT INTO ps_domain VALUES (110, 31, 1, 'y', 5, 0, 1, NULL, NULL);
-INSERT INTO ps_domain VALUES (111, 31, 2, 't', 5, 0, 1, NULL, NULL);
-INSERT INTO ps_domain VALUES (112, 8, 0, 't', 5, 0, 1, NULL, NULL);
-INSERT INTO ps_domain VALUES (113, 8, 1, 'x', 1, 0, 1, NULL, NULL);
-INSERT INTO ps_domain VALUES (114, 8, 2, 'y', 2, 0, 1, NULL, NULL);
-INSERT INTO ps_domain VALUES (115, 29, 0, 'x', 5, 0, 1, NULL, NULL);
-INSERT INTO ps_domain VALUES (116, 29, 1, 'y', 5, 0, 1, NULL, NULL);
-INSERT INTO ps_domain VALUES (117, 29, 2, 'z', 5, 0, 1, NULL, NULL);
-INSERT INTO ps_domain VALUES (118, 29, 3, 't', 5, 0, 1, NULL, NULL);
-INSERT INTO ps_domain VALUES (119, 27, 0, 't', 5, 0, 1, NULL, NULL);
-INSERT INTO ps_domain VALUES (120, 2, 0, 'x', 1, 0, 1, NULL, NULL);
-INSERT INTO ps_domain VALUES (121, 2, 1, 'y', 2, 0, 1, NULL, NULL);
-INSERT INTO ps_domain VALUES (122, 28, 0, 't', 5, 0, 1, NULL, NULL);
-INSERT INTO ps_domain VALUES (123, 32, 0, 'x', 5, 0, 1, NULL, NULL);
-INSERT INTO ps_domain VALUES (124, 32, 1, 'y', 5, 0, 1, NULL, NULL);
-INSERT INTO ps_domain VALUES (125, 7, 0, 'x', 1, 0, 1, NULL, NULL);
-INSERT INTO ps_domain VALUES (126, 7, 1, 'y', 2, 0, 1, NULL, NULL);
-INSERT INTO ps_domain VALUES (127, 7, 2, 'z', 4, 0, 1, NULL, NULL);
-INSERT INTO ps_domain VALUES (128, 3, 0, 'x', 1, 0, 1, NULL, NULL);
-INSERT INTO ps_domain VALUES (129, 3, 1, 'y', 2, 0, 1, NULL, NULL);
-INSERT INTO ps_domain VALUES (130, 1, 0, 'x', 1, 0, 1, NULL, NULL);
-INSERT INTO ps_domain VALUES (131, 1, 1, 'y', 2, 0, 1, NULL, NULL);
-INSERT INTO ps_domain VALUES (132, 17, 0, 'x', 1, 0, 1, NULL, NULL);
-INSERT INTO ps_domain VALUES (133, 17, 1, 'y', 2, 0, 1, NULL, NULL);
-INSERT INTO ps_domain VALUES (134, 17, 2, 't', 5, 0, 1, NULL, NULL);
-INSERT INTO ps_domain VALUES (135, 16, 0, 'd0', 1, 0, 1, NULL, NULL);
-INSERT INTO ps_domain VALUES (136, 6, 0, 'x', 1, 0, 1, NULL, NULL);
-INSERT INTO ps_domain VALUES (137, 6, 1, 'y', 2, 0, 1, NULL, NULL);
-INSERT INTO ps_domain VALUES (138, 6, 2, 'z', 4, 0, 1, NULL, NULL);
-INSERT INTO ps_domain VALUES (139, 4, 0, 'x', 1, 0, 1, NULL, NULL);
-INSERT INTO ps_domain VALUES (140, 4, 1, 'y', 2, 0, 1, NULL, NULL);
-INSERT INTO ps_domain VALUES (141, 4, 2, 't', 5, 0, 1, NULL, NULL);
-INSERT INTO ps_domain VALUES (142, 19, 0, 't', 5, 0, 1, NULL, NULL);
-INSERT INTO ps_domain VALUES (143, 20, 0, 't', 5, 0, 1, NULL, NULL);
-INSERT INTO ps_domain VALUES (144, 18, 0, 't', 5, 0, 1, NULL, NULL);
-INSERT INTO ps_domain VALUES (145, 23, 0, 't', 5, 0, 1, NULL, NULL);
-INSERT INTO ps_domain VALUES (146, 24, 0, 't', 5, 0, 1, NULL, NULL);
-INSERT INTO ps_domain VALUES (147, 21, 0, 't', 5, 0, 1, NULL, NULL);
-INSERT INTO ps_domain VALUES (148, 22, 0, 't', 5, 0, 1, NULL, NULL);
-INSERT INTO ps_domain VALUES (149, 25, 0, 't', 5, 0, 1, NULL, NULL);
-INSERT INTO ps_domain VALUES (150, 26, 0, 't', 5, 0, 1, NULL, NULL);
-
-SELECT pg_catalog.setval('ps_domain_id_seq', 55, true);
-
--- The range is the datatype of the coverage cell values.
--- The coverage is the id of the coverage a given entry describes.
--- The i is the number of the structure component. Because cells can have composite types, you could have multiple entries for each coverage. Entries are ordered.
--- The name is a handle for that component. Names for the components for a RGB coverage, for example, could be "red", "green", and "blue". You can then ask WCPS for the blue channel of a coverage, and it will know what you're talking about.
--- The type is the datatype of the given component. Note that while in principle each component could have a different datatype, having that might cause problems.
-CREATE TABLE ps_range (
- id serial NOT NULL,
- coverage integer NOT NULL,
- i integer NOT NULL,
- name text NOT NULL,
- type integer NOT NULL,
- primary key (id),
- unique (coverage, i),
- foreign key (coverage) references ps_coverage (id) on delete cascade,
- foreign key (type) references ps_dataType (id) on delete cascade
-);
-
-INSERT INTO ps_range VALUES (165, 30, 0, 'value', 10);
-INSERT INTO ps_range VALUES (169, 31, 0, 'value', 10);
-INSERT INTO ps_range VALUES (170, 8, 0, 'fire', 2);
-INSERT INTO ps_range VALUES (171, 29, 0, 'value', 10);
-INSERT INTO ps_range VALUES (172, 27, 0, 'value', 5);
-INSERT INTO ps_range VALUES (173, 2, 0, 'nir', 7);
-INSERT INTO ps_range VALUES (174, 2, 1, 'red', 7);
-INSERT INTO ps_range VALUES (175, 2, 2, 'green', 7);
-INSERT INTO ps_range VALUES (176, 28, 0, 'value', 5);
-INSERT INTO ps_range VALUES (177, 32, 0, 'red', 7);
-INSERT INTO ps_range VALUES (178, 32, 1, 'green', 7);
-INSERT INTO ps_range VALUES (179, 32, 2, 'blue', 7);
-INSERT INTO ps_range VALUES (180, 7, 0, 'density', 4);
-INSERT INTO ps_range VALUES (181, 3, 0, 'green', 7);
-INSERT INTO ps_range VALUES (182, 3, 1, 'grey', 7);
-INSERT INTO ps_range VALUES (183, 1, 0, 'red', 7);
-INSERT INTO ps_range VALUES (184, 1, 1, 'green', 7);
-INSERT INTO ps_range VALUES (185, 1, 2, 'blue', 7);
-INSERT INTO ps_range VALUES (186, 17, 0, 'temperature', 10);
-INSERT INTO ps_range VALUES (187, 16, 0, 'r0', 7);
-INSERT INTO ps_range VALUES (188, 6, 0, 'density', 10);
-INSERT INTO ps_range VALUES (189, 4, 0, 'red', 7);
-INSERT INTO ps_range VALUES (190, 4, 1, 'green', 7);
-INSERT INTO ps_range VALUES (191, 4, 2, 'blue', 7);
-INSERT INTO ps_range VALUES (192, 19, 0, 'value', 5);
-INSERT INTO ps_range VALUES (193, 20, 0, 'value', 5);
-INSERT INTO ps_range VALUES (194, 18, 0, 'value', 5);
-INSERT INTO ps_range VALUES (195, 23, 0, 'value', 5);
-INSERT INTO ps_range VALUES (196, 24, 0, 'value', 5);
-INSERT INTO ps_range VALUES (197, 21, 0, 'value', 5);
-INSERT INTO ps_range VALUES (198, 22, 0, 'value', 5);
-INSERT INTO ps_range VALUES (199, 25, 0, 'value', 5);
-INSERT INTO ps_range VALUES (200, 26, 0, 'value', 5);
-
-SELECT pg_catalog.setval('ps_range_id_seq', 49, true);
-
-
--- Each coverage allows a set of interpolation methods. An interpolation method is a pair of an interpolation type and a null resistance. Each coverage is required to have at least one entry in that table, and the defaults in PS_Coverage must be present here.
--- The current implementation does not use the contents of this table, but it does ensure that the above constraints are met.
-CREATE TABLE ps_interpolationset (
- id serial NOT NULL,
- coverage integer NOT NULL,
- interpolationtype integer NOT NULL,
- nullresistance integer NOT NULL,
- primary key (id),
- unique (coverage, interpolationType, nullResistance),
- foreign key (coverage) references ps_coverage (id) on delete cascade,
- foreign key (interpolationType) references ps_interpolationType (id) on delete cascade,
- foreign key (nullResistance) references ps_nullResistance (id) on delete cascade
-);
-
-INSERT INTO ps_interpolationset VALUES (69, 30, 5, 2);
-INSERT INTO ps_interpolationset VALUES (71, 31, 5, 2);
-INSERT INTO ps_interpolationset VALUES (72, 8, 5, 2);
-INSERT INTO ps_interpolationset VALUES (73, 29, 5, 2);
-INSERT INTO ps_interpolationset VALUES (74, 27, 5, 2);
-INSERT INTO ps_interpolationset VALUES (75, 2, 5, 2);
-INSERT INTO ps_interpolationset VALUES (76, 28, 5, 2);
-INSERT INTO ps_interpolationset VALUES (77, 32, 5, 2);
-INSERT INTO ps_interpolationset VALUES (78, 7, 5, 2);
-INSERT INTO ps_interpolationset VALUES (79, 3, 5, 2);
-INSERT INTO ps_interpolationset VALUES (80, 1, 5, 2);
-INSERT INTO ps_interpolationset VALUES (81, 17, 5, 2);
-INSERT INTO ps_interpolationset VALUES (82, 16, 5, 2);
-INSERT INTO ps_interpolationset VALUES (83, 6, 5, 2);
-INSERT INTO ps_interpolationset VALUES (84, 4, 5, 2);
-INSERT INTO ps_interpolationset VALUES (85, 19, 5, 2);
-INSERT INTO ps_interpolationset VALUES (86, 20, 5, 2);
-INSERT INTO ps_interpolationset VALUES (87, 18, 5, 2);
-INSERT INTO ps_interpolationset VALUES (88, 23, 5, 2);
-INSERT INTO ps_interpolationset VALUES (89, 24, 5, 2);
-INSERT INTO ps_interpolationset VALUES (90, 21, 5, 2);
-INSERT INTO ps_interpolationset VALUES (91, 22, 5, 2);
-INSERT INTO ps_interpolationset VALUES (92, 25, 5, 2);
-INSERT INTO ps_interpolationset VALUES (93, 26, 5, 2);
-
-SELECT pg_catalog.setval('ps_interpolationset_id_seq', 26, true);
-
-
--- Each coverage allows a set of null values. If the range is non-composite, a null value is the value of the single component, e.g. "0". If the range is composite, a null value is of the form "{c1,c2,c3}", e.g. "{0,0,0}" for a RGB coverage. Each coverage is required to have at least one entry in that table, and the defaults in PS_Coverage must be present here.
--- The current implementation does not use the contents of this table, but it does ensure that the above constraints are met.
-CREATE TABLE ps_nullset (
- id serial NOT NULL,
- coverage integer NOT NULL,
- nullvalue text NOT NULL,
- primary key (id),
- unique (coverage, nullValue),
- foreign key (coverage) references ps_coverage (id) on delete cascade
-);
-
-INSERT INTO ps_nullset VALUES (69, 30, '0');
-INSERT INTO ps_nullset VALUES (71, 31, '0');
-INSERT INTO ps_nullset VALUES (72, 8, '0');
-INSERT INTO ps_nullset VALUES (73, 29, '0');
-INSERT INTO ps_nullset VALUES (74, 27, '0');
-INSERT INTO ps_nullset VALUES (75, 2, '{0,0,0}');
-INSERT INTO ps_nullset VALUES (76, 28, '0');
-INSERT INTO ps_nullset VALUES (77, 32, '{0,0,0}');
-INSERT INTO ps_nullset VALUES (78, 7, '0');
-INSERT INTO ps_nullset VALUES (79, 3, '{0,0}');
-INSERT INTO ps_nullset VALUES (80, 1, '{0,0,0}');
-INSERT INTO ps_nullset VALUES (81, 17, '0');
-INSERT INTO ps_nullset VALUES (82, 16, '0');
-INSERT INTO ps_nullset VALUES (83, 6, '0');
-INSERT INTO ps_nullset VALUES (84, 4, '{0,0,0}');
-INSERT INTO ps_nullset VALUES (85, 19, '0');
-INSERT INTO ps_nullset VALUES (86, 20, '0');
-INSERT INTO ps_nullset VALUES (87, 18, '0');
-INSERT INTO ps_nullset VALUES (88, 23, '0');
-INSERT INTO ps_nullset VALUES (89, 24, '0');
-INSERT INTO ps_nullset VALUES (90, 21, '0');
-INSERT INTO ps_nullset VALUES (91, 22, '0');
-INSERT INTO ps_nullset VALUES (92, 25, '0');
-INSERT INTO ps_nullset VALUES (93, 26, '0');
-
-SELECT pg_catalog.setval('ps_nullset_id_seq', 27, true);
-
-
--- Each axis of a coverage has a set of allowed coordinate reference systems. Here, "CRS:1" is once again assumed for each axis, whether present or not.
--- The current implementation does not use the contents of this table, but it does ensure that the above constraints are met. Because of this, if the PS_CrsSet is left empty, this one should be empty too.
-CREATE TABLE ps_crsset (
- id serial NOT NULL,
- axis integer NOT NULL,
- crs integer NOT NULL,
- primary key (id),
- unique (axis, crs),
- foreign key (axis) references ps_domain (id) on delete cascade,
- foreign key (crs) references ps_crs (id) on delete cascade
-);
-
-INSERT INTO ps_crsset VALUES (40, 104, 8);
-INSERT INTO ps_crsset VALUES (41, 105, 8);
-INSERT INTO ps_crsset VALUES (42, 106, 8);
-INSERT INTO ps_crsset VALUES (45, 109, 8);
-INSERT INTO ps_crsset VALUES (46, 110, 8);
-INSERT INTO ps_crsset VALUES (47, 111, 8);
-INSERT INTO ps_crsset VALUES (48, 112, 8);
-INSERT INTO ps_crsset VALUES (49, 113, 8);
-INSERT INTO ps_crsset VALUES (50, 114, 8);
-INSERT INTO ps_crsset VALUES (51, 115, 8);
-INSERT INTO ps_crsset VALUES (52, 116, 8);
-INSERT INTO ps_crsset VALUES (53, 117, 8);
-INSERT INTO ps_crsset VALUES (54, 118, 8);
-INSERT INTO ps_crsset VALUES (55, 119, 8);
-INSERT INTO ps_crsset VALUES (56, 120, 8);
-INSERT INTO ps_crsset VALUES (57, 121, 8);
-INSERT INTO ps_crsset VALUES (58, 122, 8);
-INSERT INTO ps_crsset VALUES (59, 123, 8);
-INSERT INTO ps_crsset VALUES (60, 124, 8);
-INSERT INTO ps_crsset VALUES (61, 125, 8);
-INSERT INTO ps_crsset VALUES (62, 126, 8);
-INSERT INTO ps_crsset VALUES (63, 127, 8);
-INSERT INTO ps_crsset VALUES (64, 128, 8);
-INSERT INTO ps_crsset VALUES (65, 129, 8);
-INSERT INTO ps_crsset VALUES (66, 130, 8);
-INSERT INTO ps_crsset VALUES (67, 131, 8);
-INSERT INTO ps_crsset VALUES (68, 132, 8);
-INSERT INTO ps_crsset VALUES (69, 133, 8);
-INSERT INTO ps_crsset VALUES (70, 134, 8);
-INSERT INTO ps_crsset VALUES (71, 135, 8);
-INSERT INTO ps_crsset VALUES (72, 136, 8);
-INSERT INTO ps_crsset VALUES (73, 137, 8);
-INSERT INTO ps_crsset VALUES (74, 138, 8);
-INSERT INTO ps_crsset VALUES (75, 139, 8);
-INSERT INTO ps_crsset VALUES (76, 140, 8);
-INSERT INTO ps_crsset VALUES (77, 141, 8);
-INSERT INTO ps_crsset VALUES (78, 142, 8);
-INSERT INTO ps_crsset VALUES (79, 143, 8);
-INSERT INTO ps_crsset VALUES (80, 144, 8);
-INSERT INTO ps_crsset VALUES (81, 145, 8);
-INSERT INTO ps_crsset VALUES (82, 146, 8);
-INSERT INTO ps_crsset VALUES (83, 147, 8);
-INSERT INTO ps_crsset VALUES (84, 148, 8);
-INSERT INTO ps_crsset VALUES (85, 149, 8);
-INSERT INTO ps_crsset VALUES (86, 150, 8);
-
-SELECT pg_catalog.setval('ps_crsset_id_seq', 2, true);
-
--- This table contains textual descriptions of the available coverages.
-CREATE TABLE ps_descriptions (
- id serial NOT NULL,
- coverage integer NOT NULL,
- title text NOT NULL,
- abstract text,
- keywords text,
- primary key (id),
- unique (coverage),
- foreign key (coverage) references ps_coverage (id) on delete cascade
-);
-
-INSERT INTO ps_descriptions VALUES (10, 30, '', '', '');
-INSERT INTO ps_descriptions VALUES (12, 31, '', '', '');
-INSERT INTO ps_descriptions VALUES (13, 8, '', '', '');
-INSERT INTO ps_descriptions VALUES (14, 29, '', '', '');
-INSERT INTO ps_descriptions VALUES (15, 27, '', '', '');
-INSERT INTO ps_descriptions VALUES (16, 2, '', '', '');
-INSERT INTO ps_descriptions VALUES (17, 28, '', '', '');
-INSERT INTO ps_descriptions VALUES (18, 32, '', '', '');
-INSERT INTO ps_descriptions VALUES (19, 7, '', '', '');
-INSERT INTO ps_descriptions VALUES (20, 3, '', '', '');
-INSERT INTO ps_descriptions VALUES (22, 17, '', '', '');
-INSERT INTO ps_descriptions VALUES (23, 16, '', '', '');
-INSERT INTO ps_descriptions VALUES (24, 6, '', '', '');
-INSERT INTO ps_descriptions VALUES (25, 4, '', '', '');
-INSERT INTO ps_descriptions VALUES (26, 19, '', '', '');
-INSERT INTO ps_descriptions VALUES (27, 20, '', '', '');
-INSERT INTO ps_descriptions VALUES (28, 18, '', '', '');
-INSERT INTO ps_descriptions VALUES (29, 23, '', '', '');
-INSERT INTO ps_descriptions VALUES (30, 24, '', '', '');
-INSERT INTO ps_descriptions VALUES (31, 21, '', '', '');
-INSERT INTO ps_descriptions VALUES (32, 22, '', '', '');
-INSERT INTO ps_descriptions VALUES (33, 25, '', '', '');
-INSERT INTO ps_descriptions VALUES (34, 26, '', '', '');
-INSERT INTO ps_descriptions VALUES (21, 1, 'Coverage "rgb"', 'Abstract for coverage "rgb"', '{red,green,blue}');
-
--- This table contains metadata for CRS transformations: WGS84 bounding box limits and offsets for the X and Y axis.
-CREATE TABLE ps_crsdetails (
- id serial NOT NULL,
- coverage integer NOT NULL,
- low1 float NOT NULL,
- high1 float NOT NULL,
- low2 float NOT NULL,
- high2 float NOT NULL,
- offset1 float,
- offset2 float,
- unique (coverage),
- foreign key (coverage) references ps_coverage (id) on delete cascade
-);
-
-INSERT INTO ps_crsdetails VALUES (2, 1, -30.0, 65.0, -35.0, 80.0, NULL, NULL);
diff --git a/petascope/nbproject/build-impl.xml b/petascope/nbproject/build-impl.xml
index bf62a50..de3a4f5 100644
--- a/petascope/nbproject/build-impl.xml
+++ b/petascope/nbproject/build-impl.xml
@@ -198,7 +198,10 @@
<property name="runmain.jvmargs" value=""/>
<path id="endorsed.classpath.path" path="${endorsed.classpath}"/>
<condition else="" property="endorsed.classpath.cmd.line.arg" value="-Xbootclasspath/p:'${toString:endorsed.classpath.path}'">
- <length length="0" string="${endorsed.classpath}" when="greater"/>
+ <and>
+ <isset property="endorsed.classpath"/>
+ <length length="0" string="${endorsed.classpath}" when="greater"/>
+ </and>
</condition>
</target>
<target depends="init" name="-init-cos" unless="deploy.on.save">
@@ -223,13 +226,27 @@
<fail unless="build.test.results.dir">Must set build.test.results.dir</fail>
<fail unless="build.classes.excludes">Must set build.classes.excludes</fail>
<fail unless="dist.war">Must set dist.war</fail>
- <!--fail unless="j2ee.platform.classpath">
+ <condition property="missing.j2ee.server.home">
+ <and>
+ <matches pattern="j2ee.server.home" string="${j2ee.platform.classpath}"/>
+ <not>
+ <isset property="j2ee.server.home"/>
+ </not>
+ </and>
+ </condition>
+ <fail if="missing.j2ee.server.home">
+The Java EE server classpath is not correctly set up - server home directory is missing.
+Either open the project in the IDE and assign the server or setup the server classpath manually.
+For example like this:
+ ant -Dj2ee.server.home=&lt;app_server_installation_directory&gt;
+ </fail>
+ <fail unless="j2ee.platform.classpath">
The Java EE server classpath is not correctly set up. Your active server type is ${j2ee.server.type}.
Either open the project in the IDE and assign the server or setup the server classpath manually.
For example like this:
ant -Duser.properties.file=&lt;path_to_property_file&gt; (where you put the property "j2ee.platform.classpath" in a .properties file)
or ant -Dj2ee.platform.classpath=&lt;server_classpath&gt; (where no properties file is used)
- </fail-->
+ </fail>
</target>
<target name="-init-macrodef-property">
<macrodef name="property" uri="http://www.netbeans.org/ns/web-project/1">
@@ -240,11 +257,51 @@ or ant -Dj2ee.platform.classpath=&lt;server_classpath&gt; (where no properties f
</sequential>
</macrodef>
</target>
- <target name="-init-macrodef-javac">
+ <target depends="-init-ap-cmdline-properties" if="ap.supported.internal" name="-init-macrodef-javac-with-processors">
+ <macrodef name="javac" uri="http://www.netbeans.org/ns/web-project/2">
+ <attribute default="${src.java.dir}" name="srcdir"/>
+ <attribute default="${build.classes.dir}" name="destdir"/>
+ <attribute default="${javac.classpath}:${j2ee.platform.classpath}" name="classpath"/>
+ <attribute default="${javac.processorpath}" name="processorpath"/>
+ <attribute default="${build.generated.sources.dir}/ap-source-output" name="apgeneratedsrcdir"/>
+ <attribute default="${includes}" name="includes"/>
+ <attribute default="${excludes}" name="excludes"/>
+ <attribute default="${javac.debug}" name="debug"/>
+ <attribute default="${empty.dir}" name="gensrcdir"/>
+ <element name="customize" optional="true"/>
+ <sequential>
+ <property location="${build.dir}/empty" name="empty.dir"/>
+ <mkdir dir="${empty.dir}"/>
+ <mkdir dir="@{apgeneratedsrcdir}"/>
+ <javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" includeantruntime="false" includes="@{includes}" source="${javac.source}" srcdir="@{srcdir}" target="${javac.target}">
+ <src>
+ <dirset dir="@{gensrcdir}" erroronmissingdir="false">
+ <include name="*"/>
+ </dirset>
+ </src>
+ <classpath>
+ <path path="@{classpath}"/>
+ </classpath>
+ <compilerarg line="${endorsed.classpath.cmd.line.arg}"/>
+ <compilerarg line="${javac.compilerargs}"/>
+ <compilerarg value="-processorpath"/>
+ <compilerarg path="@{processorpath}:${empty.dir}"/>
+ <compilerarg line="${ap.processors.internal}"/>
+ <compilerarg value="-s"/>
+ <compilerarg path="@{apgeneratedsrcdir}"/>
+ <compilerarg line="${ap.proc.none.internal}"/>
+ <customize/>
+ </javac>
+ </sequential>
+ </macrodef>
+ </target>
+ <target depends="-init-ap-cmdline-properties" name="-init-macrodef-javac-without-processors" unless="ap.supported.internal">
<macrodef name="javac" uri="http://www.netbeans.org/ns/web-project/2">
<attribute default="${src.java.dir}" name="srcdir"/>
<attribute default="${build.classes.dir}" name="destdir"/>
<attribute default="${javac.classpath}:${j2ee.platform.classpath}" name="classpath"/>
+ <attribute default="${javac.processorpath}" name="processorpath"/>
+ <attribute default="${build.generated.sources.dir}/ap-source-output" name="apgeneratedsrcdir"/>
<attribute default="${includes}" name="includes"/>
<attribute default="${excludes}" name="excludes"/>
<attribute default="${javac.debug}" name="debug"/>
@@ -269,6 +326,38 @@ or ant -Dj2ee.platform.classpath=&lt;server_classpath&gt; (where no properties f
</sequential>
</macrodef>
</target>
+ <target depends="-init-macrodef-javac-with-processors,-init-macrodef-javac-without-processors" name="-init-macrodef-javac">
+ <macrodef name="depend" uri="http://www.netbeans.org/ns/web-project/2">
+ <attribute default="${src.java.dir}" name="srcdir"/>
+ <attribute default="${build.classes.dir}" name="destdir"/>
+ <attribute default="${javac.classpath}:${j2ee.platform.classpath}" name="classpath"/>
+ <sequential>
+ <depend cache="${build.dir}/depcache" destdir="@{destdir}" excludes="${excludes}" includes="${includes}" srcdir="@{srcdir}">
+ <classpath>
+ <path path="@{classpath}"/>
+ </classpath>
+ </depend>
+ </sequential>
+ </macrodef>
+ <macrodef name="force-recompile" uri="http://www.netbeans.org/ns/web-project/2">
+ <attribute default="${build.classes.dir}" name="destdir"/>
+ <sequential>
+ <fail unless="javac.includes">Must set javac.includes</fail>
+ <pathconvert pathsep="${line.separator}" property="javac.includes.binary">
+ <path>
+ <filelist dir="@{destdir}" files="${javac.includes}"/>
+ </path>
+ <globmapper from="*.java" to="*.class"/>
+ </pathconvert>
+ <tempfile deleteonexit="true" property="javac.includesfile.binary"/>
+ <echo file="${javac.includesfile.binary}" message="${javac.includes.binary}"/>
+ <delete>
+ <files includesfile="${javac.includesfile.binary}"/>
+ </delete>
+ <delete file="${javac.includesfile.binary}"/>
+ </sequential>
+ </macrodef>
+ </target>
<target name="-init-macrodef-junit">
<macrodef name="junit" uri="http://www.netbeans.org/ns/web-project/2">
<attribute default="${includes}" name="includes"/>
@@ -291,6 +380,7 @@ or ant -Dj2ee.platform.classpath=&lt;server_classpath&gt; (where no properties f
<formatter type="brief" usefile="false"/>
<formatter type="xml"/>
<jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
+ <jvmarg value="-ea"/>
<jvmarg line="${runmain.jvmargs}"/>
</junit>
</sequential>
@@ -411,7 +501,43 @@ exists or setup the property manually. For example like this:
</fail>
<taskdef classpath="${libs.CopyLibs.classpath}" resource="org/netbeans/modules/java/j2seproject/copylibstask/antlib.xml"/>
</target>
- <target depends="-pre-init,-init-private,-init-libraries,-init-user,-init-project,-do-init,-post-init,-init-check,-init-macrodef-property,-init-macrodef-javac,-init-macrodef-junit,-init-macrodef-java,-init-macrodef-nbjpda,-init-macrodef-nbjsdebug,-init-macrodef-debug,-init-taskdefs" name="init"/>
+ <target name="-init-ap-cmdline-properties">
+ <property name="annotation.processing.enabled" value="true"/>
+ <property name="annotation.processing.processors.list" value=""/>
+ <property name="annotation.processing.run.all.processors" value="true"/>
+ <property name="javac.processorpath" value="${javac.classpath}"/>
+ <property name="javac.test.processorpath" value="${javac.test.classpath}"/>
+ <condition property="ap.supported.internal" value="true">
+ <not>
+ <matches pattern="1\.[0-5](\..*)?" string="${javac.source}"/>
+ </not>
+ </condition>
+ </target>
+ <target depends="-init-ap-cmdline-properties" if="ap.supported.internal" name="-init-ap-cmdline-supported">
+ <condition else="" property="ap.processors.internal" value="-processor ${annotation.processing.processors.list}">
+ <isfalse value="${annotation.processing.run.all.processors}"/>
+ </condition>
+ <condition else="" property="ap.proc.none.internal" value="-proc:none">
+ <isfalse value="${annotation.processing.enabled}"/>
+ </condition>
+ </target>
+ <target depends="-init-ap-cmdline-properties,-init-ap-cmdline-supported" name="-init-ap-cmdline">
+ <property name="ap.cmd.line.internal" value=""/>
+ </target>
+ <target depends="-profile-pre-init, init, -profile-post-init, -profile-init-check" name="profile-init"/>
+ <target name="-profile-pre-init">
+ <!-- Empty placeholder for easier customization. -->
+ <!-- You can override this target in the ../build.xml file. -->
+ </target>
+ <target name="-profile-post-init">
+ <!-- Empty placeholder for easier customization. -->
+ <!-- You can override this target in the ../build.xml file. -->
+ </target>
+ <target depends="-profile-pre-init, init, -profile-post-init" name="-profile-init-check">
+ <fail unless="profiler.info.jvm">Must set JVM to use for profiling in profiler.info.jvm</fail>
+ <fail unless="profiler.info.jvmargs.agent">Must set profiler agent JVM arguments in profiler.info.jvmargs.agent</fail>
+ </target>
+ <target depends="-pre-init,-init-private,-init-libraries,-init-user,-init-project,-do-init,-post-init,-init-check,-init-macrodef-property,-init-macrodef-javac,-init-macrodef-junit,-init-macrodef-java,-init-macrodef-nbjpda,-init-macrodef-nbjsdebug,-init-macrodef-debug,-init-taskdefs,-init-ap-cmdline" name="init"/>
<!--
COMPILATION SECTION
-->
@@ -483,10 +609,10 @@ exists or setup the property manually. For example like this:
<arg value="-compilerSourceVM ${javac.source}"/>
<arg value="-compilerTargetVM ${javac.target}"/>
<arg value="-javaEncoding ${source.encoding}"/>
- <classpath path="${java.home}/../lib/tools.jar:${jspctask.classpath}:${jspcompilation.classpath}"/>
+ <classpath path="${java.home}/../lib/tools.jar:${libs.jsp-compiler.classpath}:${libs.jsp-compilation.classpath}"/>
</java>
<mkdir dir="${build.generated.dir}/classes"/>
- <webproject2:javac classpath="${j2ee.platform.classpath}:${build.classes.dir}:${jspcompilation.classpath}" destdir="${build.generated.dir}/classes" srcdir="${build.generated.dir}/src"/>
+ <webproject2:javac classpath="${build.classes.dir}:${libs.jsp-compilation.classpath}:${javac.classpath}:${j2ee.platform.classpath}" destdir="${build.generated.dir}/classes" srcdir="${build.generated.dir}/src"/>
</target>
<target depends="compile" if="jsp.includes" name="-do-compile-single-jsp">
<fail unless="javac.jsp.includes">Must select some files in the IDE or set javac.jsp.includes</fail>
@@ -502,10 +628,10 @@ exists or setup the property manually. For example like this:
<arg value="-compilerSourceVM ${javac.source}"/>
<arg value="-compilerTargetVM ${javac.target}"/>
<arg value="-javaEncoding ${source.encoding}"/>
- <classpath path="${java.home}/../lib/tools.jar:${jspctask.classpath}:${jspcompilation.classpath}"/>
+ <classpath path="${java.home}/../lib/tools.jar:${libs.jsp-compiler.classpath}:${libs.jsp-compilation.classpath}"/>
</java>
<mkdir dir="${build.generated.dir}/classes"/>
- <webproject2:javac classpath="${j2ee.platform.classpath}:${build.classes.dir}:${jspcompilation.classpath}" destdir="${build.generated.dir}/classes" srcdir="${build.generated.dir}/src">
+ <webproject2:javac classpath="${build.classes.dir}:${libs.jsp-compilation.classpath}:${javac.classpath}:${j2ee.platform.classpath}" destdir="${build.generated.dir}/classes" srcdir="${build.generated.dir}/src">
<customize>
<patternset includes="${javac.jsp.includes}"/>
</customize>
@@ -570,8 +696,11 @@ exists or setup the property manually. For example like this:
<copyfiles files="${file.reference.log4j-1.2.15.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
<copyfiles files="${file.reference.slf4j-api-1.5.8.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
<copyfiles files="${file.reference.slf4j-log4j12-1.5.8.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
- <copyfiles files="${file.reference.settings.properties}" todir="${build.web.dir}//"/>
+ <copyfiles files="${file.reference.uuid-3.2.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
+ <copyfiles files="${file.reference.xom-1.2.6.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
+ <copyfiles files="${file.reference.cos.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
<copyfiles files="${file.reference.wcpsProcessCoverages.xsd}" todir="${build.web.dir}//xml/ogc/wcps/1.0.0/"/>
+ <copyfiles files="${file.reference.settings.properties}" todir="${build.web.dir}//"/>
<copyfiles files="${file.reference.wcps-servlet.html}" todir="${build.web.dir}//templates/"/>
<copyfiles files="${file.reference.wcst-servlet.html}" todir="${build.web.dir}//templates/"/>
<copyfiles files="${file.reference.interface-servlet.html}" todir="${build.web.dir}//templates/"/>
@@ -598,8 +727,11 @@ exists or setup the property manually. For example like this:
<copyfiles files="${file.reference.log4j-1.2.15.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
<copyfiles files="${file.reference.slf4j-api-1.5.8.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
<copyfiles files="${file.reference.slf4j-log4j12-1.5.8.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
- <copyfiles files="${file.reference.settings.properties}" todir="${build.web.dir}//"/>
+ <copyfiles files="${file.reference.uuid-3.2.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
+ <copyfiles files="${file.reference.xom-1.2.6.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
+ <copyfiles files="${file.reference.cos.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
<copyfiles files="${file.reference.wcpsProcessCoverages.xsd}" todir="${build.web.dir}//xml/ogc/wcps/1.0.0/"/>
+ <copyfiles files="${file.reference.settings.properties}" todir="${build.web.dir}//"/>
<copyfiles files="${file.reference.wcps-servlet.html}" todir="${build.web.dir}//templates/"/>
<copyfiles files="${file.reference.wcst-servlet.html}" todir="${build.web.dir}//templates/"/>
<copyfiles files="${file.reference.interface-servlet.html}" todir="${build.web.dir}//templates/"/>
@@ -784,9 +916,38 @@ exists or setup the property manually. For example like this:
</target>
<target depends="init,-pre-debug-fix,-do-debug-fix" if="netbeans.home" name="debug-fix"/>
<!--
+ =================
+ PROFILING SECTION
+ =================
+ -->
+ <target description="Profile a J2EE project in the IDE." name="profile">
+ <condition else="start-profiled-server" property="profiler.startserver.target" value="start-profiled-server-extraargs">
+ <isset property="profiler.info.jvmargs.extra"/>
+ </condition>
+ <antcall target="${profiler.startserver.target}"/>
+ <antcall target="run"/>
+ <antcall target="start-loadgen"/>
+ </target>
+ <target name="start-profiled-server">
+ <nbstartprofiledserver forceRestart="${profiler.j2ee.serverForceRestart}" javaPlatform="${profiler.info.javaPlatform}" startupTimeout="${profiler.j2ee.serverStartupTimeout}">
+ <jvmarg value="${profiler.info.jvmargs.agent}"/>
+ <jvmarg value="${profiler.j2ee.agentID}"/>
+ </nbstartprofiledserver>
+ </target>
+ <target name="start-profiled-server-extraargs">
+ <nbstartprofiledserver forceRestart="${profiler.j2ee.serverForceRestart}" javaPlatform="${profiler.info.javaPlatform}" startupTimeout="${profiler.j2ee.serverStartupTimeout}">
+ <jvmarg value="${profiler.info.jvmargs.extra}"/>
+ <jvmarg value="${profiler.info.jvmargs.agent}"/>
+ <jvmarg value="${profiler.j2ee.agentID}"/>
+ </nbstartprofiledserver>
+ </target>
+ <target if="profiler.loadgen.path" name="start-loadgen">
+ <loadgenstart path="${profiler.loadgen.path}"/>
+ </target>
+ <!--
JAVADOC SECTION
-->
- <target depends="init" name="javadoc-build">
+ <target depends="init" if="have.sources" name="javadoc-build">
<mkdir dir="${dist.javadoc.dir}"/>
<javadoc additionalparam="${javadoc.additionalparam}" author="${javadoc.author}" charset="UTF-8" destdir="${dist.javadoc.dir}" docencoding="UTF-8" encoding="${javadoc.encoding.used}" failonerror="true" noindex="${javadoc.noindex}" nonavbar="${javadoc.nonavbar}" notree="${javadoc.notree}" private="${javadoc.private}" source="${javac.source}" splitindex="${javadoc.splitindex}" use="${javadoc.use}" useexternalfile="true" version="${javadoc.version}" windowtitle="${javadoc.windowtitle}">
<classpath>
@@ -799,6 +960,14 @@ exists or setup the property manually. For example like this:
<include name="**/*.java"/>
</fileset>
</javadoc>
+ <copy todir="${dist.javadoc.dir}">
+ <fileset dir="${src.java.dir}" excludes="${excludes}" includes="${includes}">
+ <filename name="**/doc-files/**"/>
+ </fileset>
+ <fileset dir="${build.generated.sources.dir}" erroronmissingdir="false">
+ <include name="**/doc-files/**"/>
+ </fileset>
+ </copy>
</target>
<target depends="init,javadoc-build" if="netbeans.home" name="javadoc-browse" unless="no.javadoc.preview">
<nbbrowse file="${dist.javadoc.dir}/index.html"/>
@@ -897,6 +1066,35 @@ exists or setup the property manually. For example like this:
</target>
<target depends="init,-pre-debug-fix,-do-debug-fix-test" if="netbeans.home" name="debug-fix-test"/>
<!--
+ =========================
+ TESTS PROFILING SECTION
+ =========================
+ -->
+ <target depends="profile-init,compile-test-single" if="netbeans.home" name="profile-test-single">
+ <nbprofiledirect>
+ <classpath>
+ <path path="${run.test.classpath}"/>
+ <path path="${j2ee.platform.classpath}"/>
+ </classpath>
+ </nbprofiledirect>
+ <junit dir="${profiler.info.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" jvm="${profiler.info.jvm}" showoutput="true">
+ <env key="${profiler.info.pathvar}" path="${profiler.info.agentpath}:${profiler.current.path}"/>
+ <jvmarg value="${profiler.info.jvmargs.agent}"/>
+ <jvmarg line="${profiler.info.jvmargs}"/>
+ <test name="${profile.class}"/>
+ <classpath>
+ <path path="${run.test.classpath}"/>
+ <path path="${j2ee.platform.classpath}"/>
+ </classpath>
+ <syspropertyset>
+ <propertyref prefix="test-sys-prop."/>
+ <mapper from="test-sys-prop.*" to="*" type="glob"/>
+ </syspropertyset>
+ <formatter type="brief" usefile="false"/>
+ <formatter type="xml"/>
+ </junit>
+ </target>
+ <!--
CLEANUP SECTION
-->
diff --git a/petascope/nbproject/genfiles.properties b/petascope/nbproject/genfiles.properties
index 315ce61..85317c8 100644
--- a/petascope/nbproject/genfiles.properties
+++ b/petascope/nbproject/genfiles.properties
@@ -3,9 +3,9 @@ build.xml.script.CRC32=a3483906
build.xml.stylesheet.CRC32=c0ebde35
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
-nbproject/build-impl.xml.data.CRC32=8bacb2b4
-nbproject/build-impl.xml.script.CRC32=b56242e3
-nbproject/build-impl.xml.stylesheet.CRC32=b139b33b@1.21.2.1
+nbproject/build-impl.xml.data.CRC32=1a038819
+nbproject/build-impl.xml.script.CRC32=e8e4d0d1
+nbproject/build-impl.xml.stylesheet.CRC32=c68181ec@1.27.0.1
nbproject/profiler-build-impl.xml.data.CRC32=08a10577
nbproject/profiler-build-impl.xml.script.CRC32=a84d8f2e
nbproject/profiler-build-impl.xml.stylesheet.CRC32=0bb5b37b
diff --git a/petascope/nbproject/project.properties b/petascope/nbproject/project.properties
index 4f2846b..eb26bb3 100644
--- a/petascope/nbproject/project.properties
+++ b/petascope/nbproject/project.properties
@@ -1,3 +1,9 @@
+annotation.processing.enabled=true
+annotation.processing.enabled.in.editor=true
+annotation.processing.processors.list=
+annotation.processing.run.all.processors=true
+annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
+auxiliary.org-netbeans-modules-html-editor-lib.default-public-id=-//W3C//DTD HTML 4.0 Transitional//EN
build.classes.dir=${build.web.dir}/WEB-INF/classes
build.classes.excludes=**/*.java,**/*.form
build.dir=build
@@ -25,6 +31,7 @@ file.reference.antlrworks-1.2.3.jar=lib/antlrworks-1.2.3.jar
file.reference.commons-fileupload-1.2.jar=lib/commons-fileupload-1.2.jar
file.reference.commons-io-1.3.2.jar=lib/commons-io-1.3.2.jar
file.reference.commons-math-1.1.jar=lib/commons-math-1.1.jar
+file.reference.cos.jar=../../../../../home/dimitar/projects/rasdaman/petascope/lib/cos.jar
file.reference.gml-v_3_1_1-schema-1.0-SNAPSHOT.jar=lib/gml-v_3_1_1-schema-1.0-SNAPSHOT.jar
file.reference.interface-servlet.html=templates/interface-servlet.html
file.reference.jaxb-api.jar=lib/jaxb-api.jar
@@ -42,14 +49,17 @@ file.reference.servlet-2_5-api.jar=lib/servlet-2_5-api.jar
file.reference.settings.properties=settings.properties
file.reference.slf4j-api-1.5.8.jar=lib/slf4j-api-1.5.8.jar
file.reference.slf4j-log4j12-1.5.8.jar=lib/slf4j-log4j12-1.5.8.jar
+file.reference.uuid-3.2.jar=lib/uuid-3.2.jar
file.reference.wcps-servlet.html=templates/wcps-servlet.html
file.reference.wcpsProcessCoverages.xsd=xml/ogc/wcps/1.0.0/wcpsProcessCoverages.xsd
file.reference.wcs-v_1_1_0-schema-1.0-SNAPSHOT.jar=lib/wcs-v_1_1_0-schema-1.0-SNAPSHOT.jar
file.reference.wcst-schema.jar=lib/wcst-schema.jar
file.reference.wcst-servlet.html=templates/wcst-servlet.html
+file.reference.xom-1.2.6.jar=lib/xom-1.2.6.jar
includes=**
-j2ee.deploy.on.save=true
+j2ee.deploy.on.save=false
j2ee.platform=1.5
+j2ee.platform.classpath=${j2ee.server.home}/lib/servlet-api.jar:${j2ee.server.home}/lib/catalina-ant.jar:${j2ee.server.home}/lib/jsp-api.jar:${j2ee.server.home}/lib/tomcat-dbcp.jar:${j2ee.server.home}/lib/jasper.jar:${j2ee.server.home}/lib/catalina.jar:${j2ee.server.home}/lib/jasper-el.jar:${j2ee.server.home}/lib/tomcat-api.jar:${j2ee.server.home}/lib/annotations-api.jar:${j2ee.server.home}/lib/catalina-tribes.jar:${j2ee.server.home}/lib/tomcat-i18n-ja.jar:${j2ee.server.home}/lib/tomcat-i18n-es.jar:${j2ee.server.home}/lib/tomcat-util.jar:${j2ee.server.home}/lib/tomcat-i18n-fr.jar:${j2ee.server.home}/lib/catalina-ha.jar:${j2ee.server.home}/lib/ecj-3.6.jar:${j2ee.server.home}/lib/tomcat-coyote.jar:${j2ee.server.home}/lib/el-api.jar:${j2ee.server.home}/bin/tomcat-juli.jar
j2ee.server.type=Tomcat60
jar.compress=false
javac.classpath=\
@@ -72,17 +82,23 @@ javac.classpath=\
${file.reference.ows-v_1_0_0-schema-1.0-SNAPSHOT.jar}:\
${file.reference.log4j-1.2.15.jar}:\
${file.reference.slf4j-api-1.5.8.jar}:\
- ${file.reference.slf4j-log4j12-1.5.8.jar}
+ ${file.reference.slf4j-log4j12-1.5.8.jar}:\
+ ${file.reference.uuid-3.2.jar}:\
+ ${file.reference.xom-1.2.6.jar}:\
+ ${file.reference.cos.jar}
# Space-separated list of extra javac options
-javac.compilerargs=
+javac.compilerargs=-g
javac.debug=true
javac.deprecation=false
+javac.processorpath=\
+ ${javac.classpath}
javac.source=1.6
javac.target=1.6
javac.test.classpath=\
${javac.classpath}:\
${build.classes.dir}:\
${libs.junit_4.classpath}
+javac.test.processorpath=${javac.test.classpath}
javadoc.additionalparam=
javadoc.author=false
javadoc.encoding=${source.encoding}
@@ -116,8 +132,8 @@ source.root=src
src.java.dir=src
test.test.dir=test
war.content.additional=\
- ${file.reference.settings.properties}:\
${file.reference.wcpsProcessCoverages.xsd}:\
+ ${file.reference.settings.properties}:\
${file.reference.wcps-servlet.html}:\
${file.reference.wcst-servlet.html}:\
${file.reference.interface-servlet.html}:\
diff --git a/petascope/nbproject/project.xml b/petascope/nbproject/project.xml
index c40c16d..c9768e3 100644
--- a/petascope/nbproject/project.xml
+++ b/petascope/nbproject/project.xml
@@ -2,6 +2,7 @@
<project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.web.project</type>
<configuration>
+ <buildExtensions xmlns="http://www.netbeans.org/ns/ant-build-extender/1"/>
<data xmlns="http://www.netbeans.org/ns/web-project/3">
<name>PetaScope</name>
<minimum-ant-version>1.6.5</minimum-ant-version>
@@ -84,17 +85,29 @@
<file>${file.reference.slf4j-log4j12-1.5.8.jar}</file>
<path-in-war>WEB-INF/lib</path-in-war>
</library>
- </web-module-libraries>
- <web-module-additional-libraries>
<library dirs="200">
- <file>${file.reference.settings.properties}</file>
- <path-in-war>/</path-in-war>
+ <file>${file.reference.uuid-3.2.jar}</file>
+ <path-in-war>WEB-INF/lib</path-in-war>
</library>
<library dirs="200">
+ <file>${file.reference.xom-1.2.6.jar}</file>
+ <path-in-war>WEB-INF/lib</path-in-war>
+ </library>
+ <library dirs="200">
+ <file>${file.reference.cos.jar}</file>
+ <path-in-war>WEB-INF/lib</path-in-war>
+ </library>
+ </web-module-libraries>
+ <web-module-additional-libraries>
+ <library dirs="200">
<file>${file.reference.wcpsProcessCoverages.xsd}</file>
<path-in-war>/xml/ogc/wcps/1.0.0/</path-in-war>
</library>
<library dirs="200">
+ <file>${file.reference.settings.properties}</file>
+ <path-in-war>/</path-in-war>
+ </library>
+ <library dirs="200">
<file>${file.reference.wcps-servlet.html}</file>
<path-in-war>/templates/</path-in-war>
</library>
diff --git a/petascope/settings.properties b/petascope/settings.properties
deleted file mode 100644
index 6d5b40d..0000000
--- a/petascope/settings.properties
+++ /dev/null
@@ -1,73 +0,0 @@
-# ---------------------------------------------------------------------
-# settings.properties
-#
-# PetaScope configuration file
-#
-# Important note:
-# Parameters marked "yes" in item "need to adapt" MUST be configured
-# to meaningful values during installation, they CAN NOT be used as is!
-# ---------------------------------------------------------------------
-
-# parameter: metadata_driver
-# purpose: name of DBMS driver to be loaded
-# need to adapt: no
-metadata_driver=org.postgresql.Driver
-
-# parameter: metadata_url
-# purpose: JDBC URL of database serving PetaScope metadata
-# recommendation: use default values on a default Postgresql
-# installation, and DB name petascopedb
-# need to adapt: yes
-metadata_url=jdbc:postgresql://localhost:5432/petascopedb
-
-# parameter: metadata_user
-# purpose: DBMS login under which servlet has r/w access
-# to PetaScope metadata;
-# recommendation: establish a dedicated user
-# need to adapt: yes
-metadata_user=petauser
-
-# parameter: metadata_pass
-# purpose: password for DBMS login, as above
-# need to adapt: yes
-metadata_pass=petapasswd
-
-# parameter: rasdaman_url
-# purpose: URL of rasdaman database serving PetaScope raster data
-# need to adapt: yes
-rasdaman_url=http://localhost:7001
-
-# parameter: rasdaman_database
-# purpose: name of rasdaman database serving PetaScope raster data
-# recommendation: use rasdaman standard name, RASBASE
-# need to adapt: no
-rasdaman_database=RASBASE
-
-# parameter: servlet_info
-# purpose: description text about the servlet
-# need to adapt: no
-servlet_info=PetaScope (Developed at Jacobs University)
-
-# parameter: print_log
-# purpose: print log messages to the tomcat log files? "true" or "false"
-# need to adapt: no
-print_log=true
-
-# parameter: print_output
-# purpose: print status messages to standard out? "true" or "false"
-# need to adapt: no
-print_output=true
-
-# ---------------------------------------------------------------------
-# Settings for the WCS-T Server
-# ---------------------------------------------------------------------
-
-# parameter: wcst_version
-# purpose: version of WCS-T standard implemented
-# need to adapt: no
-wcst_version=1.1.4
-
-# parameter: wcst_language
-# purpose: language accepted by the server
-# need to adapt: no
-wcst_language=en
diff --git a/petascope/src/log4j.properties b/petascope/src/log4j.properties
index b394c5f..15649c1 100644
--- a/petascope/src/log4j.properties
+++ b/petascope/src/log4j.properties
@@ -1,34 +1,13 @@
-# =============================================================
-# ------------------- petascope log configuration ------------
-# =============================================================
-#
-# This is the configuration file for the log4j-based petascope logging.
-#
-# =============================================================
-# ------------------- log output configuration ---------------
-# =============================================================
+log4j.rootLogger=TRACE, rollingFile, stdout
-# The rootLogger option defines where the log output should go.
-# Log4j uses appender to direct the output to a specific target.
-# By default deegree logs to the console (appender: stdout)
-log4j.rootLogger=INFO, stdout
-# To also log into a logfile (example below):
-#log4j.rootLogger=INFO, logfile, stdout
-
-# Below is the configuration of the log appender. The format of
-# the log messages is configured with the ConversionPattern option.
-# see http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/PatternLayout.html
-
-# =============== console output appender =====================
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
-log4j.appender.stdout.layout.ConversionPattern=[%d{HH:mm:ss}] %5p: [%c{1}] %m%n
+log4j.appender.stdout.layout.ConversionPattern=%6p [%d{HH:mm:ss}] %c{1}@%L: %m%n
-# =================== common logging =========================
-# The log level for all classes that are not configured below.
-log4j.logger.petascope=INFO
+log4j.appender.rollingFile=org.apache.log4j.RollingFileAppender
+log4j.appender.rollingFile.File=petascope.log
+log4j.appender.rollingFile.MaxFileSize=10MB
+log4j.appender.rollingFile.MaxBackupIndex=2
+log4j.appender.rollingFile.layout = org.apache.log4j.PatternLayout
+log4j.appender.rollingFile.layout.ConversionPattern= %6p:[%d{HH:mm:ss}] %c{1}@%L: %m%n
-log4j.logger.petascope.wcps=DEBUG
-log4j.logger.petascope.wcst=DEBUG
-log4j.logger.petascope.wcs=DEBUG
-log4j.logger.petascope.wcs2=TRACE \ No newline at end of file
diff --git a/petascope/src/petascope/ConfigManager.java b/petascope/src/petascope/ConfigManager.java
index 0fa0481..c049493 100644
--- a/petascope/src/petascope/ConfigManager.java
+++ b/petascope/src/petascope/ConfigManager.java
@@ -14,19 +14,16 @@
* 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;
-//~--- JDK imports ------------------------------------------------------------
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
-
import java.io.InputStream;
import java.net.URI;
import java.util.Properties;
@@ -34,7 +31,8 @@ import javax.servlet.ServletException;
import org.apache.commons.io.IOUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import petascope.wcs2.server.templates.WcsNamespaceContext;
+import petascope.wcs2.templates.WcsNamespaceContext;
+import static petascope.util.MsgUtil.*;
/**
* Configuration Manager class: a single entry point for all server settings.
@@ -44,7 +42,7 @@ import petascope.wcs2.server.templates.WcsNamespaceContext;
*/
public class ConfigManager {
- private static Logger LOG = LoggerFactory.getLogger(ConfigManager.class);
+ private static Logger log = LoggerFactory.getLogger(ConfigManager.class);
/* Major version number. This is the first release (1). */
private final static String MAJOR = "1";
@@ -56,11 +54,22 @@ public class ConfigManager {
/* Petascope 1.2.0 contains WCS 1.1.0, WCS 2.0, WCS-T 1.0.0 and WCPS 1.0.0 */
public final static String PETASCOPE_VERSION = MAJOR + "." + MINOR + "." + BUGFIX;
+ public final static String PETASCOPE_LANGUAGE = "en";
/* Settings variables */
public static String WCST_LANGUAGE;
public static String WCST_VERSION;
+ public static String WCPS_LANGUAGE = "en";
+ public static String WCPS_VERSION = "1.0.0";
+ public static String WPS_LANGUAGE = "en";
+ public static String WPS_VERSION = "1.0.0";
+ public static String WCS_LANGUAGE = "en";
+ public static String WCS_VERSION = "1.1.0";
+ public static String WCS2_LANGUAGE = "en";
+ public static String WCS2_VERSION = "2.0.0";
public static String RASDAMAN_URL;
public static String RASDAMAN_DATABASE;
+ public static String RASDAMAN_LANGUAGE = "en";
+ public static String RASDAMAN_VERSION = "8";
public static String METADATA_DRIVER;
public static String METADATA_URL;
public static String METADATA_USER;
@@ -76,6 +85,7 @@ public class ConfigManager {
/* This URL gets initialized automatically when the first request is received.
* Its value is used in the Capabilities response */
public static String PETASCOPE_SERVLET_URL;
+ public static String WCS2_SERVLET_URL;
/* WCS-T Settings. Overridden by user-preferences in <code>settings.properties</code> */
public static String WCST_DEFAULT_INTERPOLATION = "none";
@@ -94,12 +104,12 @@ public class ConfigManager {
private ConfigManager(String settingsPath, String servletRoot) throws ServletException {
props = new Properties();
try {
- LOG.info("Loading settings from file: " + settingsPath);
+ log.info("Loading settings from file: " + settingsPath);
props.load(new FileInputStream(settingsPath));
initSettings(servletRoot);
} catch (IOException e) {
- LOG.error("Failed to load settings. Stack trace: " + e);
- throw new ServletException("Failed to load settings file.");
+ log.error("Failed to load settings. Stack trace: " + e);
+ throw new ServletException(msg(SETTINGS_FAILED_LOADING));
}
}
@@ -121,8 +131,7 @@ public class ConfigManager {
public static ConfigManager getInstance() {
if (instance == null) {
- throw new RuntimeException("Could not initialize the ConfigManager "
- + "because no settings file path was provided.");
+ throw new RuntimeException(msg(SETTINGS_INITERROR));
}
return instance;
}
@@ -156,16 +165,10 @@ public class ConfigManager {
CCIP_HACK = Boolean.parseBoolean(get("ccip_version"));
try {
- URI desc = WcsNamespaceContext.class.getResource("DescribeCoverageTemplate.xml").toURI();
- URI getcov = WcsNamespaceContext.class.getResource("GetCoverageTemplate.xml").toURI();
- URI getcap = WcsNamespaceContext.class.getResource("GetCapabilitiesTemplate.xml").toURI();
- WCS2_GET_CAPABILITIES_TEMPLATE = loadFile(getcap);
- WCS2_DESCRIBE_COVERAGE_TEMPLATE = loadFile(desc);
- WCS2_GET_COVERAGE_TEMPLATE = loadFile(getcov);
WCS2_SCHEMA_URL = get("wcs2_schema_url");
} catch (Exception e) {
- LOG.warn("Could not read XML template files for WCS 2.0. Therefore, WCS 2.0 will be unable to start.");
+ log.warn("Could not read XML template files for WCS 2.0. Therefore, WCS 2.0 will be unable to start.");
}
/* User preferences override default values for WCS-T */
@@ -182,38 +185,35 @@ public class ConfigManager {
WCST_DEFAULT_DATATYPE = tmp;
}
- LOG.info("---------------------------");
+ log.info("---------------------------");
if (CCIP_HACK) {
- LOG.info("-----------CCIP------------");
+ log.info("-----------CCIP------------");
}
- LOG.info("---------------------------");
-
-// log("Print Log: " + PRINT_LOG);
- LOG.info(" *** PETASCOPE *** ");
- LOG.info("Rasdaman URL: " + RASDAMAN_URL);
- LOG.info("Rasdaman DB: " + RASDAMAN_DATABASE);
- LOG.info("Metadata Driver: " + METADATA_DRIVER);
- LOG.info("Metadata URL: " + METADATA_URL);
- LOG.info("Metadata Username: " + METADATA_USER);
-// LOG.info("Metadata Password: " + METADATA_PASS);
- LOG.info(" *** WCS-T *** ");
- LOG.info("WCS-T Language: " + WCST_LANGUAGE);
- LOG.info("WCS-T Version: " + WCST_VERSION);
- LOG.info("WCS-T Default Interpolation: " + WCST_DEFAULT_INTERPOLATION);
- LOG.info("WCS-T Default Null Resistance: " + WCST_DEFAULT_NULL_RESISTANCE);
- LOG.info("WCS-T Default Datatype: " + WCST_DEFAULT_DATATYPE);
- LOG.info(" *** WCS 2.0 *** ");
- LOG.trace("Get Capabilities Template: " + WCS2_GET_CAPABILITIES_TEMPLATE.substring(0, 100));
- LOG.trace("Describe Coverage Template: " + WCS2_DESCRIBE_COVERAGE_TEMPLATE.substring(0, 100));
- LOG.trace("Get Capabilities Template: " + WCS2_GET_COVERAGE_TEMPLATE.substring(0, 100));
- LOG.info("---------------------------");
+ log.info("---------------------------");
+
+// log("Print Log: " + PRINT_log);
+ log.info(" *** PETASCOPE *** ");
+ log.info("Rasdaman URL: " + RASDAMAN_URL);
+ log.info("Rasdaman DB: " + RASDAMAN_DATABASE);
+ log.info("Metadata Driver: " + METADATA_DRIVER);
+ log.info("Metadata URL: " + METADATA_URL);
+ log.info("Metadata Username: " + METADATA_USER);
+// log.info("Metadata Password: " + METADATA_PASS);
+ log.info(" *** WCS-T *** ");
+ log.info("WCS-T Language: " + WCST_LANGUAGE);
+ log.info("WCS-T Version: " + WCST_VERSION);
+ log.info("WCS-T Default Interpolation: " + WCST_DEFAULT_INTERPOLATION);
+ log.info("WCS-T Default Null Resistance: " + WCST_DEFAULT_NULL_RESISTANCE);
+ log.info("WCS-T Default Datatype: " + WCST_DEFAULT_DATATYPE);
+ log.info(" *** WCS 2.0 *** ");
+ log.info("---------------------------");
}
private String loadFile(URI fileUri) throws IOException {
InputStream is = null;
String contents = null;
try {
- LOG.debug("Loading file: " + fileUri);
+ log.debug("Loading file: " + fileUri);
File f = new File(fileUri);
is = new FileInputStream(f);
contents = IOUtils.toString(is);
diff --git a/petascope/src/petascope/PetascopeInterface.java b/petascope/src/petascope/PetascopeInterface.java
index c3cd7c8..f10d3d2 100644
--- a/petascope/src/petascope/PetascopeInterface.java
+++ b/petascope/src/petascope/PetascopeInterface.java
@@ -14,14 +14,14 @@
* 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;
+import com.oreilly.servlet.MultipartResponse;
import java.io.DataOutputStream;
import java.io.File;
import java.io.FileOutputStream;
@@ -29,14 +29,9 @@ import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.StringWriter;
-import java.io.UnsupportedEncodingException;
-import java.lang.String;
-import java.net.URISyntaxException;
-import java.net.URLDecoder;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.logging.Level;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
@@ -44,13 +39,11 @@ import javax.servlet.http.HttpServletResponse;
import javax.xml.bind.JAXBException;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactory;
import net.opengis.ows.v_1_0_0.ExceptionReport;
-import org.antlr.runtime.RecognitionException;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import org.apache.log4j.PropertyConfigurator;
@@ -59,34 +52,41 @@ import org.slf4j.LoggerFactory;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.xml.sax.SAXException;
-import petascope.wcps.server.core.DbMetadataSource;
+import petascope.core.DbMetadataSource;
+import petascope.exceptions.RasdamanException;
+import petascope.exceptions.WCSTException;
import petascope.wcps.server.core.ProcessCoveragesRequest;
-import petascope.wcps.server.exceptions.InvalidCrsException;
-import petascope.wcps.server.exceptions.ResourceException;
import petascope.wcps.server.core.WCPS;
-import petascope.wcps.server.exceptions.WCPSException;
-import petascope.wcs.server.exceptions.WCSException;
+import petascope.exceptions.WCPSException;
+import petascope.exceptions.WCSException;
+import petascope.exceptions.ExceptionCode;
+import petascope.exceptions.PetascopeException;
+import petascope.util.Pair;
+import petascope.util.StringUtil;
+import petascope.util.XMLUtil;
import petascope.wcs.server.WcsServer;
-import petascope.wcs.server.exceptions.InputOutputException;
-import petascope.wcs.server.exceptions.InternalComponentException;
-import petascope.wcs.server.exceptions.InvalidRequestException;
-import petascope.wcs.server.exceptions.NoApplicableCodeException;
-import petascope.wcs.server.exceptions.ServletConnectionException;
-import petascope.wcs.server.exceptions.WcsRuntimeException;
-import petascope.wcs.server.exceptions.XmlNotValidException;
-import petascope.wcs2.server.Wcs2Server;
-import petascope.wcs2.server.templates.WcsNamespaceContext;
+import petascope.wcs2.extensions.ExtensionsRegistry;
+import petascope.wcs2.extensions.FormatExtension;
+import petascope.wcs2.extensions.ProtocolExtension;
+import petascope.wcs2.handlers.Response;
+import petascope.wcs2.templates.Templates;
+import petascope.wcs2.templates.WcsNamespaceContext;
import petascope.wcst.server.WcstServer;
import petascope.wps.server.WpsServer;
-/** This servlet is a unified entry-point for all the PetaScope services.
+/**
+ * This servlet is a unified entry-point for all the PetaScope services.
*
* @author Andrei Aiordachioaie
+ * @author Dimitar Misev
*/
public class PetascopeInterface extends HttpServlet {
- private static Logger LOG = LoggerFactory.getLogger(PetascopeInterface.class);
- private DbMetadataSource metadataSource;
+ private static Logger log = LoggerFactory.getLogger(PetascopeInterface.class);
+
+ public static String LOCAL_SERVLET_ADDRESS = "http://localhost:8080/PetaScope/earthlook";
+
+ private DbMetadataSource meta;
/* Xml documents utils */
DocumentBuilder builder = null;
@@ -103,97 +103,81 @@ public class PetascopeInterface extends HttpServlet {
private WCPS wcps;
/* Instance of WcsServer service */
private WcsServer wcs;
- private Wcs2Server wcs2;
/* Initialize the various services: WCPS, WcsServer and WcsServer-T */
@Override
public void init() throws ServletException {
-
- LOG.info("-----------------------------------------------");
- LOG.info(" PetaScope {} starting ...", ConfigManager.PETASCOPE_VERSION);
- LOG.info("-----------------------------------------------");
+ log.info("Petascope {} starting", ConfigManager.PETASCOPE_VERSION);
// Initialize the singleton configuration manager. Now all classes can read the settings.
String settingsPath = getServletContext().getRealPath(relativeSettingsPath);
- ConfigManager config = ConfigManager.getInstance(settingsPath, getServletContext().getRealPath("/"));
+ ConfigManager config = ConfigManager.getInstance(settingsPath, getServletContext().
+ getRealPath("/"));
// Initialize the logging system
PropertyConfigurator.configure(getServletContext().getRealPath("/log4j.properties"));
-
// Read servlet HTML usage message from disk
try {
usageFilePath = getServletContext().getRealPath(usageFilePath);
usageMessage = FileUtils.readFileToString(new File(usageFilePath));
} catch (IOException e) {
- LOG.error("Could not read default servlet HTML response. Stack trace: {}", e);
+ log.error("Could not read default servlet HTML response. Stack trace: {}", e);
throw new ServletException("Could not read interface servlet HTML response", e);
}
/* Initialize WCPS Service */
try {
- LOG.info("WCPS: initializing metadata database");
- metadataSource =
+ log.info("WCPS: initializing metadata database");
+ meta =
new DbMetadataSource(ConfigManager.METADATA_DRIVER,
ConfigManager.METADATA_URL,
ConfigManager.METADATA_USER,
ConfigManager.METADATA_PASS, false);
- LOG.debug("WCPS: initializing WCPS core");
- wcps = new WCPS(metadataSource);
+ log.debug("WCPS: initializing WCPS core");
+ wcps = new WCPS(meta);
- LOG.info("WCPS: initialization complete");
- } catch (ParserConfigurationException e) {
- LOG.error("Stack trace: {}", e);
- throw new ServletException("Fatal: WCPS initialization error", e);
- } catch (WCPSException e) {
- LOG.error("Stack trace: {}", e);
+ log.info("WCPS: initialization complete");
+ } catch (Exception e) {
+ log.error("Stack trace: {}", e);
throw new ServletException("Fatal: WCPS initialization error", e);
}
/* Initialize WCS Service */
try {
- LOG.info("WCS Initialization ...");
- wcs = new WcsServer(settingsPath, metadataSource);
- LOG.info("WCS: Initialization complete.");
+ log.info("WCS Initialization ...");
+ wcs = new WcsServer(settingsPath, meta);
+ log.info("WCS: Initialization complete.");
} catch (Exception e) {
- LOG.error("Stack trace: {}", e);
+ log.error("Stack trace: {}", e);
throw new ServletException("Fatal: WCS initialization error", e);
}
- /* Initialize WCS 2.0 Service */
- try {
- LOG.info("WCS 2.0 Initialization ...");
- wcs2 = new Wcs2Server(settingsPath, metadataSource);
- LOG.info("WCS 2.0: Initialization complete.");
- } catch (Exception e) {
- LOG.error("Stack trace: {}", e);
- throw new ServletException("Fatal: WCS 2.0 initialization error", e);
- }
-
/* Initialize WCS-T Service */
try {
- LOG.info("WCS-T: Initializing ...");
- wcst = new WcstServer(metadataSource);
- LOG.info("WCS-T: Initialization complete.");
- } catch (WCSException e) {
- LOG.error("Stack trace: {}", e);
+ log.info("WCS-T: Initializing ...");
+ wcst = new WcstServer(meta);
+ log.info("WCS-T: Initialization complete.");
+ } catch (Exception e) {
+ log.error("Stack trace: {}", e);
throw new ServletException("Fatal: WCS-T initialization error", e);
}
/* Initialize XML parsing for request redirection */
try {
- DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance();
+ DocumentBuilderFactory domFactory = DocumentBuilderFactory.
+ newInstance();
domFactory.setNamespaceAware(true); // never forget this!
builder = domFactory.newDocumentBuilder();
} catch (Exception e) {
- LOG.error("Stack trace: {}", e);
+ log.error("Stack trace: {}", e);
throw new ServletException("Fatal: Error initializing XML parser", e);
}
- LOG.info("-----------------------------------------------");
- LOG.info(" PetaScope {} successfully started ", ConfigManager.PETASCOPE_VERSION);
- LOG.info("-----------------------------------------------");
+ log.info("-----------------------------------------------");
+ log.info(" PetaScope {} successfully started ", ConfigManager.PETASCOPE_VERSION);
+ log.info("-----------------------------------------------");
}
/* Build a dictionary of parameter names and values, given a request string */
@@ -218,27 +202,15 @@ public class PetascopeInterface extends HttpServlet {
return map;
}
- /* URL-decode a string, if needed */
- private String urldecode(String encodedText, String contentType) throws UnsupportedEncodingException {
- if (encodedText == null) {
- return null;
- }
- String decoded = encodedText;
- LOG.trace("Found URL encoded text: {}", encodedText);
- if (contentType != null && contentType.equals("application/x-www-form-urlencoded") && encodedText.indexOf(" ") == -1) {
- decoded = URLDecoder.decode(encodedText, "UTF-8");
- }
- LOG.trace("Returning decoded text: {}", decoded);
- return decoded;
- }
-
/* Respond to Post requests just like in the case of Get requests */
@Override
public void doPost(HttpServletRequest httpRequest, HttpServletResponse httpResponse) {
/* Init the Petascope URL automatically, for GetCapabilities response */
if (ConfigManager.PETASCOPE_SERVLET_URL == null) {
- ConfigManager.PETASCOPE_SERVLET_URL = httpRequest.getRequestURL().toString();
+ ConfigManager.PETASCOPE_SERVLET_URL = httpRequest.getRequestURL().
+ toString();
}
+
/* Treat POST requests just like GET requests */
doGet(httpRequest, httpResponse);
}
@@ -251,33 +223,35 @@ public class PetascopeInterface extends HttpServlet {
/* Init the Petascope URL automatically, for GetCapabilities response */
if (ConfigManager.PETASCOPE_SERVLET_URL == null) {
- ConfigManager.PETASCOPE_SERVLET_URL = httpRequest.getRequestURL().toString();
- }
-
- /* List all available coverages, to make sure metadata is available */
- try {
- LOG.debug("PetaScope coverages: " + metadataSource.coverages());
- } catch (ResourceException e) {
+ ConfigManager.PETASCOPE_SERVLET_URL = httpRequest.getRequestURL().
+ toString();
}
/* Process the request */
-
try {
try {
requestBody = IOUtils.toString(httpRequest.getReader());
- LOG.trace("POST Request length: " + httpRequest.getContentLength());
- LOG.trace("POST request body: \n------START REQUEST--------\n"
+ log.trace("POST Request length: " + httpRequest.getContentLength());
+ log.trace("POST request body: \n------START REQUEST--------\n"
+ requestBody + "\n------END REQUEST------\n");
+ log.trace("GET Query string: " + httpRequest.getQueryString());
Map<String, String> params = buildParameterDictionary(requestBody);
- LOG.trace("Request parameters: {}", params);
- request = urldecode(params.get("request"), httpRequest.getContentType());
+ log.trace("Request parameters: {}", params);
+ request = StringUtil.urldecode(params.get("request"), httpRequest.
+ getContentType());
// WPS 1.0.0 GET interface processing
- if ((httpRequest.getParameter("Service") != null) && (httpRequest.getParameter("Service").equalsIgnoreCase("WPS"))) {
- WpsServer wpsServer = new WpsServer(httpResponse, httpRequest);
- request = wpsServer.request;
+ String service = httpRequest.getParameter("service");
+ if (service != null) {
+ if (service.equals("WPS")) {
+ WpsServer wpsServer = new WpsServer(httpResponse, httpRequest);
+ request = wpsServer.request;
+ } else if (service.equals("WCS")) {
+ handleWcs2Request(httpRequest.getQueryString(), false, httpResponse);
+ return;
+ }
}
// To preserve compatibility with previous client versions, we allow
@@ -285,10 +259,11 @@ public class PetascopeInterface extends HttpServlet {
String request2 = null;
request2 = httpRequest.getParameter("query");
if (request2 == null) {
- request2 = urldecode(params.get("query"), httpRequest.getContentType());
+ request2 = StringUtil.urldecode(params.get("query"), httpRequest.
+ getContentType());
}
if (request2 != null) {
- LOG.debug("Received Abstract Syntax Request via GET: \n\t\t{}", request2);
+ log.debug("Received Abstract Syntax Request via GET: \n\t\t{}", request2);
request2 = ProcessCoveragesRequest.abstractQueryToXmlQuery(request2);
}
if (request == null && request2 != null) {
@@ -296,14 +271,16 @@ public class PetascopeInterface extends HttpServlet {
}
// Empty request ?
- if (request == null && (requestBody == null || requestBody.length() == 0)) {
+ if (request == null && (requestBody == null || requestBody.
+ length() == 0)) {
printUsage(httpResponse, request);
return;
}
// No parameters, just XML in the request body
if (request == null && requestBody != null && requestBody.length() > 0) {
- request = urldecode(requestBody, httpRequest.getContentType());
+ request = StringUtil.urldecode(requestBody, httpRequest.
+ getContentType());
// if (request.matches(" *<.*") == false)
// {
@@ -312,66 +289,62 @@ public class PetascopeInterface extends HttpServlet {
// }
}
- LOG.debug("Petascope Request: \n------START REQUEST--------\n"
+ log.debug("Petascope Request: \n------START REQUEST--------\n"
+ request + "\n------END REQUEST------\n");
+ if (XMLUtil.isFirstTag(request, "Envelope")) {
+ handleWcs2Request(request, true, httpResponse);
+ return;
+ }
+
Document doc = builder.parse(IOUtils.toInputStream(request));
Element rootElem = doc.getDocumentElement();
String root = rootElem.getTagName();
- LOG.debug("Root Element name: {}", root);
+ log.debug("Root Element name: {}", root);
- String version = "1.1.0";
+ String version = "2.0";
try {
XPath xpath = xpathFactory.newXPath();
xpath.setNamespaceContext(new WcsNamespaceContext());
String query = "/*/@version";
version = (String) xpath.evaluate(query, doc, XPathConstants.STRING);
} catch (XPathExpressionException e) {
- LOG.warn("The root XML node has no attribute called \"version\"");
+ log.warn("The root XML node has no attribute called \"version\"");
}
/* The next request types are defined in the WcsServer standard, and
are common to all the PetaScope services. */
- if (root.endsWith("GetCapabilities")) {
- if (version.startsWith("2")) {
- handleGetCapabilities2(request, httpResponse);
- } else {
+ log.trace("WCS version: {}", version);
+ if (version.startsWith("1")) {
+ if (root.endsWith("GetCapabilities")) {
handleGetCapabilities(request, httpResponse);
- }
- } else if (root.endsWith("DescribeCoverage")) {
- if (version.startsWith("2")) {
- handleDescribeCoverage2(request, httpResponse);
- } else {
+ return;
+ } else if (root.endsWith("DescribeCoverage")) {
handleDescribeCoverage(request, httpResponse);
- }
- } else if (root.endsWith("GetCoverage")) {
- if (version.startsWith("2")) {
- handleGetCoverage2(request, httpResponse);
- } else {
+ return;
+ } else if (root.endsWith("GetCoverage")) {
handleGetCoverage(request, httpResponse);
+ return;
}
- } else /* ProcessCoverages is defined in the WCPS extension to WcsServer */
- if (root.endsWith("ProcessCoveragesRequest")) {
+ } else {
+ handleWcs2Request(request, false, httpResponse);
+ return;
+ }
+ if (root.endsWith("ProcessCoveragesRequest")) { /* ProcessCoverages is defined in the WCPS extension to WcsServer */
handleProcessCoverages(request, httpResponse);
- } else /* Transaction is defined in the WcsServer-T extension to WcsServer */
- if (root.endsWith("Transaction")) {
+ } else if (root.endsWith("Transaction")) { /* Transaction is defined in the WcsServer-T extension to WcsServer */
handleTransaction(request, httpResponse);
- } else /* Print Error Message */ {
+ } else { /* Print Error Message */
handleUnknownRequest(request, httpResponse);
}
- } catch (IOException e) {
- throw new ServletConnectionException(e.getMessage(), e);
- } catch (RecognitionException e) {
- throw new InvalidRequestException(e.getMessage(), e);
- } catch (SAXException e) {
- throw new InvalidRequestException(e.getMessage(), e);
} catch (WCSException e) {
throw e;
} catch (Exception e) {
// Finally, cast all other exceptions into a WCSException
- LOG.error("Runtime error : {}", e.getMessage());
- throw new WcsRuntimeException(e.getMessage(), e);
+ log.error("Runtime error : {}", e.getMessage());
+ throw new WCSException(ExceptionCode.RuntimeError,
+ "Runtime error while processing request", e);
}
} // And catch all WCSExceptions, to display to the client
catch (WCSException e) {
@@ -393,11 +366,11 @@ public class PetascopeInterface extends HttpServlet {
try {
out = new PrintWriter(response.getOutputStream());
} catch (IOException e1) {
- LOG.error("Could not print exception because of IO error. Stack trace:", e1);
+ log.error("Could not print exception because of IO error. Stack trace:", e1);
return;
}
- LOG.error("Error stack trace:", e);
+ log.error("Error stack trace:", e);
if (e instanceof WCSException) {
// We can send an error report
String output = exceptionToXml((WCSException) e);
@@ -405,10 +378,10 @@ public class PetascopeInterface extends HttpServlet {
out.println(output);
out.close();
} else {
- LOG.trace("setting response mimetype to text/html; charset=utf-8");
+ log.trace("setting response mimetype to text/html; charset=utf-8");
response.setContentType("text/html; charset=utf-8");
- LOG.trace("returning the following error message.", e);
- LOG.trace("end of error message");
+ log.trace("returning the following error message.", e);
+ log.trace("end of error message");
out.println(
"<html><head><title>PetaScope</title></head><body>");
@@ -418,71 +391,116 @@ public class PetascopeInterface extends HttpServlet {
e.printStackTrace(out);
out.println("</small></p></body></html>");
out.close();
- LOG.trace("done with error");
+ log.trace("done with error");
}
}
private void handleUnknownRequest(String request, HttpServletResponse httpResponse) {
request = "'" + request + "'";
- WCSException e = new NoApplicableCodeException("Could not understand request " + request);
- printError(httpResponse, request, e);
+ printError(httpResponse, request, new WCSException(
+ ExceptionCode.NoApplicableCode, "Could not understand request " + request));
}
private String exceptionReportToXml(ExceptionReport report) {
String output = null;
try {
- javax.xml.bind.JAXBContext jaxbCtx = javax.xml.bind.JAXBContext.newInstance(report.getClass().getPackage().getName());
+ javax.xml.bind.JAXBContext jaxbCtx = javax.xml.bind.JAXBContext.
+ newInstance(report.getClass().getPackage().getName());
javax.xml.bind.Marshaller marshaller = jaxbCtx.createMarshaller();
marshaller.setProperty(javax.xml.bind.Marshaller.JAXB_ENCODING, "UTF-8"); //NOI18N
marshaller.setProperty("jaxb.formatted.output", true);
marshaller.setProperty("jaxb.schemaLocation",
- "http://www.opengis.net/ows http://schemas.opengis.net/ows/1.0.0/owsExceptionReport.xsd");
+ "http://www.opengis.net/ows http://schemas.opengis.net/ows/2.0/owsExceptionReport.xsd");
marshaller.setProperty("com.sun.xml.bind.namespacePrefixMapper", new PetascopeXmlNamespaceMapper());
StringWriter strWriter = new StringWriter();
marshaller.marshal(report, strWriter);
output = strWriter.toString();
- System.err.println(output);
- LOG.debug("Done marshalling Error Report.");
+ String sub = output.substring(output.indexOf("<ows:Exception "), output.indexOf("</ows:ExceptionReport>"));
+ try {
+ output = Templates.getTemplate(Templates.EXCEPTION_REPORT, Pair.of("\\{exception\\}", sub));
+ } catch (Exception ex) {
+ log.warn("Error handling exception report template");
+ }
+ log.debug("Done marshalling Error Report.");
} catch (JAXBException e2) {
- LOG.error("Stack trace: {}", e2);
- LOG.error("Error stack trace: " + e2);
+ log.error("Stack trace: {}", e2);
+ log.error("Error stack trace: " + e2);
}
return output;
}
- private String exceptionToXml(WCSException e) {
+ private String exceptionToXml(PetascopeException e) {
return exceptionReportToXml(e.getReport());
}
/**
- * GetCapabilities of WCS 1.1
- * @param request
- * @param httpResponse
- * @throws WCSException
+ * Handle WCS 2.0 request.
+ *
+ * @param request request string
+ * @param response
+ * @throws WCSException in case of I/O error, or if the server is unable to handle the request
*/
- private void handleGetCapabilities(String request, HttpServletResponse httpResponse) throws WCSException {
- String output = wcs.GetCapabilities(request);
- PrintWriter out;
+ private void handleWcs2Request(String request, boolean soap, HttpServletResponse response)
+ throws WCSException, PetascopeException {
try {
- out = httpResponse.getWriter();
- httpResponse.setContentType("text/xml; charset=utf-8");
- out.write(output);
- out.flush();
- out.close();
- } catch (IOException e) {
- throw new InputOutputException(e.getMessage(), e);
+ log.info("Handling WCS 2.0 request");
+ ProtocolExtension pext = ExtensionsRegistry.getProtocolExtension(request);
+ if (pext == null) {
+ throw new WCSException(ExceptionCode.NoApplicableCode,
+ "No protocol binding extension that can handle this request was found ");
+ }
+ log.info("Protocol binding extension found: {}", pext.
+ getExtensionIdentifier());
+ Response res = pext.handle(request, meta);
+
+ OutputStream os = response.getOutputStream();
+ if (res.getXml() != null && res.getData() != null) {
+ MultipartResponse multi = new MultipartResponse(response);
+ multi.startResponse(FormatExtension.MIME_GML);
+ IOUtils.write(res.getXml(), os);
+ multi.endResponse();
+ multi.startResponse(res.getMimeType());
+ IOUtils.write(res.getData(), os);
+ multi.endResponse();
+ multi.finish();
+ } else {
+ try {
+ if (res.getMimeType() != null) {
+ response.setContentType(res.getMimeType());
+ } else {
+ // response.setContentType(WcsUtil.MIME_GML);
+ response.setContentType(FormatExtension.MIME_TEXT);
+ }
+ if (res.getXml() != null) {
+ IOUtils.write(res.getXml(), os);
+ } else if (res.getData() != null) {
+ IOUtils.write(res.getData(), os);
+ }
+ } finally {
+ if (os != null) {
+ os.flush();
+ os.close();
+ }
+ }
+ }
+ } catch (Exception ex) {
+ if (!(ex instanceof PetascopeException)) {
+ ex = new WCSException(ExceptionCode.RuntimeError, ex);
+ }
+ throw ((PetascopeException) ex);
}
}
/**
- * GetCapabilities of WCS 2.0
+ * GetCapabilities of WCS 1.1
* @param request
* @param httpResponse
* @throws WCSException
*/
- private void handleGetCapabilities2(String request, HttpServletResponse httpResponse) throws WCSException {
- String output = wcs2.GetCapabilities(request);
+ private void handleGetCapabilities(String request, HttpServletResponse httpResponse)
+ throws WCSException, PetascopeException {
+ String output = wcs.GetCapabilities(request);
PrintWriter out;
try {
out = httpResponse.getWriter();
@@ -491,7 +509,7 @@ public class PetascopeInterface extends HttpServlet {
out.flush();
out.close();
} catch (IOException e) {
- throw new InputOutputException(e.getMessage(), e);
+ throw new WCSException(ExceptionCode.IOConnectionError, e.getMessage(), e);
}
}
@@ -501,7 +519,8 @@ public class PetascopeInterface extends HttpServlet {
* @param httpResponse
* @throws WCSException
*/
- private void handleDescribeCoverage(String request, HttpServletResponse httpResponse) throws WCSException {
+ private void handleDescribeCoverage(String request, HttpServletResponse httpResponse)
+ throws WCSException {
String output = wcs.DescribeCoverage(request);
PrintWriter out;
try {
@@ -511,57 +530,25 @@ public class PetascopeInterface extends HttpServlet {
out.flush();
out.close();
} catch (IOException e) {
- throw new InputOutputException(e.getMessage(), e);
+ throw new WCSException(ExceptionCode.IOConnectionError, e.getMessage(), e);
}
}
- /**
- * Describe Coverage for WCS 2.0
- * @param request
- * @param httpResponse
- * @throws WCSException
- */
- private void handleDescribeCoverage2(String request, HttpServletResponse httpResponse) throws WCSException {
- String output = wcs2.DescribeCoverage(request);
- PrintWriter out;
- try {
- out = httpResponse.getWriter();
- httpResponse.setContentType("text/xml; charset=utf-8");
- out.write(output);
- out.flush();
- out.close();
- } catch (IOException e) {
- throw new InputOutputException(e.getMessage(), e);
- }
- }
-
- private void handleGetCoverage(String request, HttpServletResponse httpResponse) throws WCSException, InvalidCrsException {
+ private void handleGetCoverage(String request, HttpServletResponse httpResponse)
+ throws WCSException {
String xmlRequest = wcs.GetCoverage(request, wcps);
- LOG.debug("Received GetCoverage Request: \n{}", xmlRequest);
+ log.debug("Received GetCoverage Request: \n{}", xmlRequest);
// Redirect the request to WCPS
handleProcessCoverages(xmlRequest, httpResponse);
}
- private void handleGetCoverage2(String request, HttpServletResponse httpResponse) throws WCSException {
- String output = wcs2.GetCoverage(request);
- PrintWriter out;
- try {
- out = httpResponse.getWriter();
- httpResponse.setContentType("text/xml; charset=utf-8");
- out.write(output);
- out.flush();
- out.close();
- } catch (IOException e) {
- throw new InputOutputException(e.getMessage(), e);
- }
- }
-
- private void handleProcessCoverages(String xmlRequest, HttpServletResponse response) throws WCSException, InvalidCrsException {
+ private void handleProcessCoverages(String xmlRequest, HttpServletResponse response)
+ throws WCSException {
OutputStream webOut = null;
try {
- LOG.debug("Received a ProcessCoverages request: \n{}", xmlRequest);
+ log.debug("Received a ProcessCoverages request: \n{}", xmlRequest);
- LOG.debug("WCPS: preparing request");
+ log.debug("WCPS: preparing request");
ProcessCoveragesRequest processCoverageRequest =
wcps.pcPrepare(ConfigManager.RASDAMAN_URL, ConfigManager.RASDAMAN_DATABASE,
IOUtils.toInputStream(xmlRequest));
@@ -569,15 +556,15 @@ public class PetascopeInterface extends HttpServlet {
String query = processCoverageRequest.getRasqlQuery();
String mime = processCoverageRequest.getMime();
- LOG.debug("Resulting RasQL query: [{}] {}", mime, query);
+ log.debug("Resulting RasQL query: [{}] {}", mime, query);
- LOG.trace("WCPS: executing request");
+ log.trace("WCPS: executing request");
List<byte[]> results = processCoverageRequest.execute();
- LOG.debug("WCPS: setting response mimetype to " + mime);
+ log.debug("WCPS: setting response mimetype to " + mime);
response.setContentType(mime);
- LOG.trace("WCPS: returning response");
+ log.trace("WCPS: returning response");
webOut = response.getOutputStream();
if (results.size() > 0) {
webOut.write(results.get(0));
@@ -587,28 +574,30 @@ public class PetascopeInterface extends HttpServlet {
String dir = getServletContext().getRealPath("/");
File f = new File(dir + "image.jpeg");
- LOG.info("HACK: Writing image to: " + f.getAbsolutePath());
+ log.info("HACK: Writing image to: " + f.getAbsolutePath());
{
OutputStream os = new DataOutputStream(new FileOutputStream(f, false));
os.write(results.get(0));
os.close();
- LOG.info("HACK: Wrote image successfully !");
+ log.info("HACK: Wrote image successfully !");
}
} catch (Exception e) {
- LOG.warn("Error while evaluating CCIP hack: '{}'", e.getMessage());
+ log.warn("Error while evaluating CCIP hack: '{}'", e.
+ getMessage());
}
}
} else {
- LOG.warn("WCPS: Warning! No result returned from rasql query.");
+ log.warn("WCPS: Warning! No result returned from rasql query.");
}
- LOG.debug("WCPS: done");
+ log.debug("WCPS: done");
} catch (WCPSException e) {
- throw new InternalComponentException(e.getMessage(), e);
+ throw new WCSException(ExceptionCode.InternalComponentError, e.
+ getMessage(), e);
} catch (SAXException e) {
- throw new XmlNotValidException(e.getMessage(), e);
+ throw new WCSException(ExceptionCode.XmlNotValid, e.getMessage(), e);
} catch (IOException e) {
- throw new InputOutputException(e.getMessage(), e);
+ throw new WCSException(ExceptionCode.IOConnectionError, e.getMessage(), e);
} finally {
if (webOut != null) {
try {
@@ -619,7 +608,9 @@ public class PetascopeInterface extends HttpServlet {
}
}
- private void handleTransaction(String request, HttpServletResponse httpResponse) throws WCSException {
+ private void handleTransaction(String request, HttpServletResponse httpResponse)
+ throws WCSTException, RasdamanException, WCPSException,
+ PetascopeException {
try {
String outputXml = wcst.Transaction(request);
PrintWriter out = new PrintWriter(httpResponse.getOutputStream());
@@ -627,7 +618,8 @@ public class PetascopeInterface extends HttpServlet {
out.write(outputXml);
out.flush();
} catch (IOException e) {
- throw new InputOutputException(e.getMessage(), e);
+ throw new PetascopeException(ExceptionCode.IOConnectionError, e.
+ getMessage(), e);
}
}
}
diff --git a/petascope/src/petascope/PetascopeXmlNamespaceMapper.java b/petascope/src/petascope/PetascopeXmlNamespaceMapper.java
index 5928fd5..c062b8a 100644
--- a/petascope/src/petascope/PetascopeXmlNamespaceMapper.java
+++ b/petascope/src/petascope/PetascopeXmlNamespaceMapper.java
@@ -14,22 +14,20 @@
* 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;
-//~--- JDK imports ------------------------------------------------------------
import com.sun.xml.bind.marshaller.NamespacePrefixMapper;
public class PetascopeXmlNamespaceMapper extends NamespacePrefixMapper {
@Override
public String getPreferredPrefix(String uri, String id, boolean req) {
- if (uri.equals("") || uri.equals("http://www.opengis.net/wcs/1.1")) {
+ if (uri.equals("") || uri.equals("http://www.opengis.net/wcs/1.1") || uri.equals("http://www.opengis.net/wcs/2.0")) {
return "wcs";
}
if (uri.equals("http://www.w3.org/2001/SMIL20/Language")) {
@@ -48,7 +46,8 @@ public class PetascopeXmlNamespaceMapper extends NamespacePrefixMapper {
return "owcs";
}
if (uri.equals("http://www.opengis.net/ows")
- || uri.equals("http://www.opengis.net/ows/1.1")) {
+ || uri.equals("http://www.opengis.net/ows/1.1")
+ || uri.equals("http://www.opengis.net/ows/2.0")) {
return "ows";
}
if (uri.equals("http://www.w3.org/2001/XMLSchema-instance")) {
diff --git a/petascope/src/petascope/wcps/grammar/AxisIterator.java b/petascope/src/petascope/wcps/grammar/AxisIterator.java
index 0f8d610..59a0a59 100644
--- a/petascope/src/petascope/wcps/grammar/AxisIterator.java
+++ b/petascope/src/petascope/wcps/grammar/AxisIterator.java
@@ -14,38 +14,37 @@
* 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.grammar;
-
-/**
- * AxisIterator
- *
- * @author Andrei Aiordachioaie
- */
-public class AxisIterator implements IParseTreeNode {
-
- String axis;
- IntervalExpr interval;
- String var;
-
- public AxisIterator(String var, String axis, IntervalExpr interval) {
- this.var = var;
- this.axis = axis;
- this.interval = interval;
- }
-
- public String toXML() {
- String result = "";
-
- result += "<iteratorVar>" + var + "</iteratorVar>";
- result += "<axis>" + axis + "</axis>";
- result += interval.toXML();
-
- return result;
- }
-}
+package petascope.wcps.grammar;
+
+/**
+ * AxisIterator
+ *
+ * @author Andrei Aiordachioaie
+ */
+public class AxisIterator implements IParseTreeNode {
+
+ String axis;
+ IntervalExpr interval;
+ String var;
+
+ public AxisIterator(String var, String axis, IntervalExpr interval) {
+ this.var = var;
+ this.axis = axis;
+ this.interval = interval;
+ }
+
+ public String toXML() {
+ String result = "";
+
+ result += "<iteratorVar>" + var + "</iteratorVar>";
+ result += "<axis>" + axis + "</axis>";
+ result += interval.toXML();
+
+ return result;
+ }
+}
diff --git a/petascope/src/petascope/wcps/grammar/AxisIteratorList.java b/petascope/src/petascope/wcps/grammar/AxisIteratorList.java
index 2c8d3d8..7447f0b 100644
--- a/petascope/src/petascope/wcps/grammar/AxisIteratorList.java
+++ b/petascope/src/petascope/wcps/grammar/AxisIteratorList.java
@@ -14,13 +14,12 @@
* 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.grammar;
+package petascope.wcps.grammar;
/**
* AxisIteratorList
diff --git a/petascope/src/petascope/wcps/grammar/BooleanExpr.java b/petascope/src/petascope/wcps/grammar/BooleanExpr.java
index fa50e92..2826f59 100644
--- a/petascope/src/petascope/wcps/grammar/BooleanExpr.java
+++ b/petascope/src/petascope/wcps/grammar/BooleanExpr.java
@@ -14,13 +14,12 @@
* 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.grammar;
+package petascope.wcps.grammar;
/**
* BooleanExpr
diff --git a/petascope/src/petascope/wcps/grammar/BooleanScalarExpr.java b/petascope/src/petascope/wcps/grammar/BooleanScalarExpr.java
index 3087f6e..813b76b 100644
--- a/petascope/src/petascope/wcps/grammar/BooleanScalarExpr.java
+++ b/petascope/src/petascope/wcps/grammar/BooleanScalarExpr.java
@@ -14,13 +14,12 @@
* 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.grammar;
+package petascope.wcps.grammar;
/**
* BooleanScalarExpr
diff --git a/petascope/src/petascope/wcps/grammar/CastExpr.java b/petascope/src/petascope/wcps/grammar/CastExpr.java
index 3acafc8..68ac46f 100644
--- a/petascope/src/petascope/wcps/grammar/CastExpr.java
+++ b/petascope/src/petascope/wcps/grammar/CastExpr.java
@@ -14,13 +14,12 @@
* 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.grammar;
+package petascope.wcps.grammar;
/**
* CastExpr
diff --git a/petascope/src/petascope/wcps/grammar/ComplexConst.java b/petascope/src/petascope/wcps/grammar/ComplexConst.java
index 4e5b106..b71683b 100644
--- a/petascope/src/petascope/wcps/grammar/ComplexConst.java
+++ b/petascope/src/petascope/wcps/grammar/ComplexConst.java
@@ -14,13 +14,12 @@
* 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.grammar;
+package petascope.wcps.grammar;
/**
* ComplexConst
diff --git a/petascope/src/petascope/wcps/grammar/CondenseExpr.java b/petascope/src/petascope/wcps/grammar/CondenseExpr.java
index 1ae7c26..2bb1f7c 100644
--- a/petascope/src/petascope/wcps/grammar/CondenseExpr.java
+++ b/petascope/src/petascope/wcps/grammar/CondenseExpr.java
@@ -14,13 +14,12 @@
* 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.grammar;
+package petascope.wcps.grammar;
/**
* CondenseExpr
diff --git a/petascope/src/petascope/wcps/grammar/CondenseOperation.java b/petascope/src/petascope/wcps/grammar/CondenseOperation.java
index 51c6752..8f1f409 100644
--- a/petascope/src/petascope/wcps/grammar/CondenseOperation.java
+++ b/petascope/src/petascope/wcps/grammar/CondenseOperation.java
@@ -14,13 +14,12 @@
* 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.grammar;
+package petascope.wcps.grammar;
/**
* CondenseOperationType
diff --git a/petascope/src/petascope/wcps/grammar/ConstantList.java b/petascope/src/petascope/wcps/grammar/ConstantList.java
index c26e73d..645707a 100644
--- a/petascope/src/petascope/wcps/grammar/ConstantList.java
+++ b/petascope/src/petascope/wcps/grammar/ConstantList.java
@@ -14,14 +14,13 @@
* 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.grammar;
-
+package petascope.wcps.grammar;
+
import java.util.*;
/**
diff --git a/petascope/src/petascope/wcps/grammar/CoverageConstantExpr.java b/petascope/src/petascope/wcps/grammar/CoverageConstantExpr.java
index 49e5c42..a1b13a1 100644
--- a/petascope/src/petascope/wcps/grammar/CoverageConstantExpr.java
+++ b/petascope/src/petascope/wcps/grammar/CoverageConstantExpr.java
@@ -14,13 +14,12 @@
* 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.grammar;
+package petascope.wcps.grammar;
/**
* CoverageConstantExpr
diff --git a/petascope/src/petascope/wcps/grammar/CoverageConstructorExpr.java b/petascope/src/petascope/wcps/grammar/CoverageConstructorExpr.java
index 71c611b..01082a5 100644
--- a/petascope/src/petascope/wcps/grammar/CoverageConstructorExpr.java
+++ b/petascope/src/petascope/wcps/grammar/CoverageConstructorExpr.java
@@ -14,13 +14,12 @@
* 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.grammar;
+package petascope.wcps.grammar;
/**
* CoverageConstructorExpr
diff --git a/petascope/src/petascope/wcps/grammar/CoverageExpr.java b/petascope/src/petascope/wcps/grammar/CoverageExpr.java
index 7f69480..7265dab 100644
--- a/petascope/src/petascope/wcps/grammar/CoverageExpr.java
+++ b/petascope/src/petascope/wcps/grammar/CoverageExpr.java
@@ -14,13 +14,12 @@
* 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.grammar;
+package petascope.wcps.grammar;
/**
* CoverageExpr
diff --git a/petascope/src/petascope/wcps/grammar/CoverageList.java b/petascope/src/petascope/wcps/grammar/CoverageList.java
index 66bd0fe..f00ec52 100644
--- a/petascope/src/petascope/wcps/grammar/CoverageList.java
+++ b/petascope/src/petascope/wcps/grammar/CoverageList.java
@@ -14,13 +14,12 @@
* 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.grammar;
+package petascope.wcps.grammar;
/**
* CoverageList class represents a CoverageList.
diff --git a/petascope/src/petascope/wcps/grammar/CrsList.java b/petascope/src/petascope/wcps/grammar/CrsList.java
index a93f7b9..530830d 100644
--- a/petascope/src/petascope/wcps/grammar/CrsList.java
+++ b/petascope/src/petascope/wcps/grammar/CrsList.java
@@ -14,14 +14,13 @@
* 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.grammar;
-
+package petascope.wcps.grammar;
+
import java.util.*;
/**
diff --git a/petascope/src/petascope/wcps/grammar/CrsTransformExpr.java b/petascope/src/petascope/wcps/grammar/CrsTransformExpr.java
index 86fa60e..7aeabbb 100644
--- a/petascope/src/petascope/wcps/grammar/CrsTransformExpr.java
+++ b/petascope/src/petascope/wcps/grammar/CrsTransformExpr.java
@@ -14,13 +14,12 @@
* 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.grammar;
+package petascope.wcps.grammar;
/**
* CrsTransformExpr
diff --git a/petascope/src/petascope/wcps/grammar/DimensionIntervalElement.java b/petascope/src/petascope/wcps/grammar/DimensionIntervalElement.java
index 711e468..f13d08f 100644
--- a/petascope/src/petascope/wcps/grammar/DimensionIntervalElement.java
+++ b/petascope/src/petascope/wcps/grammar/DimensionIntervalElement.java
@@ -14,13 +14,12 @@
* 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.grammar;
+package petascope.wcps.grammar;
/**
* DimensionIntervalElement
diff --git a/petascope/src/petascope/wcps/grammar/DimensionIntervalExpr.java b/petascope/src/petascope/wcps/grammar/DimensionIntervalExpr.java
index b32dd13..defd4b2 100644
--- a/petascope/src/petascope/wcps/grammar/DimensionIntervalExpr.java
+++ b/petascope/src/petascope/wcps/grammar/DimensionIntervalExpr.java
@@ -14,13 +14,12 @@
* 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.grammar;
+package petascope.wcps.grammar;
/**
* DimensionIntervalExpr
diff --git a/petascope/src/petascope/wcps/grammar/DimensionIntervalList.java b/petascope/src/petascope/wcps/grammar/DimensionIntervalList.java
index 39892a5..1f1f149 100644
--- a/petascope/src/petascope/wcps/grammar/DimensionIntervalList.java
+++ b/petascope/src/petascope/wcps/grammar/DimensionIntervalList.java
@@ -14,14 +14,13 @@
* 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.grammar;
-
+package petascope.wcps.grammar;
+
import java.util.*;
/**
diff --git a/petascope/src/petascope/wcps/grammar/DimensionPointElement.java b/petascope/src/petascope/wcps/grammar/DimensionPointElement.java
index 27ef470..369fd73 100644
--- a/petascope/src/petascope/wcps/grammar/DimensionPointElement.java
+++ b/petascope/src/petascope/wcps/grammar/DimensionPointElement.java
@@ -14,13 +14,12 @@
* 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.grammar;
+package petascope.wcps.grammar;
/**
* DimensionPointElement
diff --git a/petascope/src/petascope/wcps/grammar/DimensionPointList.java b/petascope/src/petascope/wcps/grammar/DimensionPointList.java
index db4f3f0..f862f88 100644
--- a/petascope/src/petascope/wcps/grammar/DimensionPointList.java
+++ b/petascope/src/petascope/wcps/grammar/DimensionPointList.java
@@ -14,14 +14,13 @@
* 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.grammar;
-
+package petascope.wcps.grammar;
+
import java.util.*;
/**
diff --git a/petascope/src/petascope/wcps/grammar/DomainExpr.java b/petascope/src/petascope/wcps/grammar/DomainExpr.java
index a2336c9..faffe90 100644
--- a/petascope/src/petascope/wcps/grammar/DomainExpr.java
+++ b/petascope/src/petascope/wcps/grammar/DomainExpr.java
@@ -14,13 +14,12 @@
* 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.grammar;
+package petascope.wcps.grammar;
/**
* DomainExpr
diff --git a/petascope/src/petascope/wcps/grammar/EncodedCoverageExpr.java b/petascope/src/petascope/wcps/grammar/EncodedCoverageExpr.java
index 93425cc..0289cca 100644
--- a/petascope/src/petascope/wcps/grammar/EncodedCoverageExpr.java
+++ b/petascope/src/petascope/wcps/grammar/EncodedCoverageExpr.java
@@ -14,13 +14,12 @@
* 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.grammar;
+package petascope.wcps.grammar;
/**
* EncodedCoverageExpr
diff --git a/petascope/src/petascope/wcps/grammar/ExponentialExpr.java b/petascope/src/petascope/wcps/grammar/ExponentialExpr.java
index 0d878f9..8aba41a 100644
--- a/petascope/src/petascope/wcps/grammar/ExponentialExpr.java
+++ b/petascope/src/petascope/wcps/grammar/ExponentialExpr.java
@@ -14,13 +14,12 @@
* 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.grammar;
+package petascope.wcps.grammar;
/**
* ExponentialExpr
diff --git a/petascope/src/petascope/wcps/grammar/ExtendExpr.java b/petascope/src/petascope/wcps/grammar/ExtendExpr.java
index 954ae6d..bc9299d 100644
--- a/petascope/src/petascope/wcps/grammar/ExtendExpr.java
+++ b/petascope/src/petascope/wcps/grammar/ExtendExpr.java
@@ -14,13 +14,12 @@
* 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.grammar;
+package petascope.wcps.grammar;
/**
* ExtendExpr
diff --git a/petascope/src/petascope/wcps/grammar/FieldInterpolationElement.java b/petascope/src/petascope/wcps/grammar/FieldInterpolationElement.java
index 556eeda..e34e5ae 100644
--- a/petascope/src/petascope/wcps/grammar/FieldInterpolationElement.java
+++ b/petascope/src/petascope/wcps/grammar/FieldInterpolationElement.java
@@ -14,13 +14,12 @@
* 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.grammar;
+package petascope.wcps.grammar;
/**
* FieldInterpolationElement
diff --git a/petascope/src/petascope/wcps/grammar/FieldInterpolationList.java b/petascope/src/petascope/wcps/grammar/FieldInterpolationList.java
index 4d00adb..e92520d 100644
--- a/petascope/src/petascope/wcps/grammar/FieldInterpolationList.java
+++ b/petascope/src/petascope/wcps/grammar/FieldInterpolationList.java
@@ -14,14 +14,13 @@
* 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.grammar;
-
+package petascope.wcps.grammar;
+
import java.util.*;
/**
diff --git a/petascope/src/petascope/wcps/grammar/ForClause.java b/petascope/src/petascope/wcps/grammar/ForClause.java
index 982d1b9..831b626 100644
--- a/petascope/src/petascope/wcps/grammar/ForClause.java
+++ b/petascope/src/petascope/wcps/grammar/ForClause.java
@@ -14,13 +14,12 @@
* 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.grammar;
+package petascope.wcps.grammar;
/**
* ForClause
diff --git a/petascope/src/petascope/wcps/grammar/ForClauseElements.java b/petascope/src/petascope/wcps/grammar/ForClauseElements.java
index 37ff863..33c7617 100644
--- a/petascope/src/petascope/wcps/grammar/ForClauseElements.java
+++ b/petascope/src/petascope/wcps/grammar/ForClauseElements.java
@@ -14,13 +14,12 @@
* 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.grammar;
+package petascope.wcps.grammar;
/**
* ForClauseElements
diff --git a/petascope/src/petascope/wcps/grammar/GeneralCondenseExpr.java b/petascope/src/petascope/wcps/grammar/GeneralCondenseExpr.java
index 3f6fd32..58d6177 100644
--- a/petascope/src/petascope/wcps/grammar/GeneralCondenseExpr.java
+++ b/petascope/src/petascope/wcps/grammar/GeneralCondenseExpr.java
@@ -14,13 +14,12 @@
* 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.grammar;
+package petascope.wcps.grammar;
/**
* GeneralCondenseExpr
diff --git a/petascope/src/petascope/wcps/grammar/IParseTreeNode.java b/petascope/src/petascope/wcps/grammar/IParseTreeNode.java
index c5672af..5ac0772 100644
--- a/petascope/src/petascope/wcps/grammar/IParseTreeNode.java
+++ b/petascope/src/petascope/wcps/grammar/IParseTreeNode.java
@@ -14,13 +14,12 @@
* 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.grammar;
+package petascope.wcps.grammar;
/* Author: Sorin Stancu-Mara
Date: 7 FEB 2007
diff --git a/petascope/src/petascope/wcps/grammar/ImageCrsDomainMetadataExpr.java b/petascope/src/petascope/wcps/grammar/ImageCrsDomainMetadataExpr.java
index b783483..44bb75e 100644
--- a/petascope/src/petascope/wcps/grammar/ImageCrsDomainMetadataExpr.java
+++ b/petascope/src/petascope/wcps/grammar/ImageCrsDomainMetadataExpr.java
@@ -14,13 +14,12 @@
* 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.grammar;
+package petascope.wcps.grammar;
/**
* ImageCrsDomainMetadataExpr Group
diff --git a/petascope/src/petascope/wcps/grammar/IndexExpr.java b/petascope/src/petascope/wcps/grammar/IndexExpr.java
index c6eeda0..abc480d 100644
--- a/petascope/src/petascope/wcps/grammar/IndexExpr.java
+++ b/petascope/src/petascope/wcps/grammar/IndexExpr.java
@@ -14,13 +14,12 @@
* 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.grammar;
+package petascope.wcps.grammar;
/**
* IndexExpr
diff --git a/petascope/src/petascope/wcps/grammar/InterpolationMethod.java b/petascope/src/petascope/wcps/grammar/InterpolationMethod.java
index 0c655e4..6ad9ad8 100644
--- a/petascope/src/petascope/wcps/grammar/InterpolationMethod.java
+++ b/petascope/src/petascope/wcps/grammar/InterpolationMethod.java
@@ -14,13 +14,12 @@
* 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.grammar;
+package petascope.wcps.grammar;
/**
* InterpolationMethod
diff --git a/petascope/src/petascope/wcps/grammar/InterpolationMethodList.java b/petascope/src/petascope/wcps/grammar/InterpolationMethodList.java
index 002b03b..f9c66f0 100644
--- a/petascope/src/petascope/wcps/grammar/InterpolationMethodList.java
+++ b/petascope/src/petascope/wcps/grammar/InterpolationMethodList.java
@@ -14,14 +14,13 @@
* 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.grammar;
-
+package petascope.wcps.grammar;
+
import java.util.*;
/**
diff --git a/petascope/src/petascope/wcps/grammar/IntervalExpr.java b/petascope/src/petascope/wcps/grammar/IntervalExpr.java
index 955b5a4..8a2a6e9 100644
--- a/petascope/src/petascope/wcps/grammar/IntervalExpr.java
+++ b/petascope/src/petascope/wcps/grammar/IntervalExpr.java
@@ -14,13 +14,12 @@
* 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.grammar;
+package petascope.wcps.grammar;
/**
* IntervalExpr
diff --git a/petascope/src/petascope/wcps/grammar/MetaDataExpr.java b/petascope/src/petascope/wcps/grammar/MetaDataExpr.java
index 071209d..452e2a6 100644
--- a/petascope/src/petascope/wcps/grammar/MetaDataExpr.java
+++ b/petascope/src/petascope/wcps/grammar/MetaDataExpr.java
@@ -14,13 +14,12 @@
* 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.grammar;
+package petascope.wcps.grammar;
/**
* MetaDataExpr
diff --git a/petascope/src/petascope/wcps/grammar/NumericScalarExpr.java b/petascope/src/petascope/wcps/grammar/NumericScalarExpr.java
index 39eeb7e..cb2fed4 100644
--- a/petascope/src/petascope/wcps/grammar/NumericScalarExpr.java
+++ b/petascope/src/petascope/wcps/grammar/NumericScalarExpr.java
@@ -14,13 +14,12 @@
* 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.grammar;
+package petascope.wcps.grammar;
/**
* NumericScalarExpr
diff --git a/petascope/src/petascope/wcps/grammar/ProcessingExpr.java b/petascope/src/petascope/wcps/grammar/ProcessingExpr.java
index 8525da7..c224016 100644
--- a/petascope/src/petascope/wcps/grammar/ProcessingExpr.java
+++ b/petascope/src/petascope/wcps/grammar/ProcessingExpr.java
@@ -14,13 +14,12 @@
* 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.grammar;
+package petascope.wcps.grammar;
/**
* ProcessingExpr
diff --git a/petascope/src/petascope/wcps/grammar/RangeConstructorExpr.java b/petascope/src/petascope/wcps/grammar/RangeConstructorExpr.java
index 16dafe4..e99ecce 100644
--- a/petascope/src/petascope/wcps/grammar/RangeConstructorExpr.java
+++ b/petascope/src/petascope/wcps/grammar/RangeConstructorExpr.java
@@ -14,14 +14,13 @@
* 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.grammar;
-
+package petascope.wcps.grammar;
+
import java.util.*;
/**
diff --git a/petascope/src/petascope/wcps/grammar/RangeConstructorTerm.java b/petascope/src/petascope/wcps/grammar/RangeConstructorTerm.java
index 2fc78f3..f8bbb9b 100644
--- a/petascope/src/petascope/wcps/grammar/RangeConstructorTerm.java
+++ b/petascope/src/petascope/wcps/grammar/RangeConstructorTerm.java
@@ -14,13 +14,12 @@
* 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.grammar;
+package petascope.wcps.grammar;
/**
* RangeConstructorTerm, part of a RangeConstructorExpr
diff --git a/petascope/src/petascope/wcps/grammar/RangeExpr.java b/petascope/src/petascope/wcps/grammar/RangeExpr.java
index 80d7822..086caeb 100644
--- a/petascope/src/petascope/wcps/grammar/RangeExpr.java
+++ b/petascope/src/petascope/wcps/grammar/RangeExpr.java
@@ -14,13 +14,12 @@
* 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.grammar;
+package petascope.wcps.grammar;
/**
* RangeExpr
diff --git a/petascope/src/petascope/wcps/grammar/RangeExprList.java b/petascope/src/petascope/wcps/grammar/RangeExprList.java
index c604f40..71aab13 100644
--- a/petascope/src/petascope/wcps/grammar/RangeExprList.java
+++ b/petascope/src/petascope/wcps/grammar/RangeExprList.java
@@ -14,14 +14,13 @@
* 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.grammar;
-
+package petascope.wcps.grammar;
+
import java.util.*;
/**
diff --git a/petascope/src/petascope/wcps/grammar/ReduceExpr.java b/petascope/src/petascope/wcps/grammar/ReduceExpr.java
index 6cb118a..1a0903f 100644
--- a/petascope/src/petascope/wcps/grammar/ReduceExpr.java
+++ b/petascope/src/petascope/wcps/grammar/ReduceExpr.java
@@ -14,13 +14,12 @@
* 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.grammar;
+package petascope.wcps.grammar;
/**
* ReduceExpr
diff --git a/petascope/src/petascope/wcps/grammar/ReturnClause.java b/petascope/src/petascope/wcps/grammar/ReturnClause.java
index 0fb92a4..90c40ae 100644
--- a/petascope/src/petascope/wcps/grammar/ReturnClause.java
+++ b/petascope/src/petascope/wcps/grammar/ReturnClause.java
@@ -14,13 +14,12 @@
* 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.grammar;
+package petascope.wcps.grammar;
/**
* ReturnClause
diff --git a/petascope/src/petascope/wcps/grammar/ScalarExpr.java b/petascope/src/petascope/wcps/grammar/ScalarExpr.java
index 9a8d94b..9499a4b 100644
--- a/petascope/src/petascope/wcps/grammar/ScalarExpr.java
+++ b/petascope/src/petascope/wcps/grammar/ScalarExpr.java
@@ -14,13 +14,12 @@
* 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.grammar;
+package petascope.wcps.grammar;
/**
* ScalarExpr
diff --git a/petascope/src/petascope/wcps/grammar/ScaleExpr.java b/petascope/src/petascope/wcps/grammar/ScaleExpr.java
index e8e6dec..5ad943d 100644
--- a/petascope/src/petascope/wcps/grammar/ScaleExpr.java
+++ b/petascope/src/petascope/wcps/grammar/ScaleExpr.java
@@ -14,13 +14,12 @@
* 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.grammar;
+package petascope.wcps.grammar;
/**
* ScaleExpr
diff --git a/petascope/src/petascope/wcps/grammar/SelectExpr.java b/petascope/src/petascope/wcps/grammar/SelectExpr.java
index 3e910ac..14f72eb 100644
--- a/petascope/src/petascope/wcps/grammar/SelectExpr.java
+++ b/petascope/src/petascope/wcps/grammar/SelectExpr.java
@@ -14,13 +14,12 @@
* 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.grammar;
+package petascope.wcps.grammar;
/**
* SelectExpr
diff --git a/petascope/src/petascope/wcps/grammar/SetMetaDataExpr.java b/petascope/src/petascope/wcps/grammar/SetMetaDataExpr.java
index 894c266..816c17f 100644
--- a/petascope/src/petascope/wcps/grammar/SetMetaDataExpr.java
+++ b/petascope/src/petascope/wcps/grammar/SetMetaDataExpr.java
@@ -14,13 +14,12 @@
* 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.grammar;
+package petascope.wcps.grammar;
/**
* SetMetaDataExpr
diff --git a/petascope/src/petascope/wcps/grammar/SliceExpr.java b/petascope/src/petascope/wcps/grammar/SliceExpr.java
index 45ec295..6aed265 100644
--- a/petascope/src/petascope/wcps/grammar/SliceExpr.java
+++ b/petascope/src/petascope/wcps/grammar/SliceExpr.java
@@ -14,13 +14,12 @@
* 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.grammar;
+package petascope.wcps.grammar;
/**
* SliceExpr
diff --git a/petascope/src/petascope/wcps/grammar/StoreExpr.java b/petascope/src/petascope/wcps/grammar/StoreExpr.java
index e6b066a..58e428c 100644
--- a/petascope/src/petascope/wcps/grammar/StoreExpr.java
+++ b/petascope/src/petascope/wcps/grammar/StoreExpr.java
@@ -14,13 +14,12 @@
* 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.grammar;
+package petascope.wcps.grammar;
/*
Author: Sorin Stancu-Mara, Andrei Aiordachioaie
diff --git a/petascope/src/petascope/wcps/grammar/StringScalarExpr.java b/petascope/src/petascope/wcps/grammar/StringScalarExpr.java
index 98387ed..f26e5d4 100644
--- a/petascope/src/petascope/wcps/grammar/StringScalarExpr.java
+++ b/petascope/src/petascope/wcps/grammar/StringScalarExpr.java
@@ -14,13 +14,12 @@
* 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.grammar;
+package petascope.wcps.grammar;
/**
* @author: Andrei Aiordachioaie
diff --git a/petascope/src/petascope/wcps/grammar/SubsetExpr.java b/petascope/src/petascope/wcps/grammar/SubsetExpr.java
index ae9e78f..15b9caa 100644
--- a/petascope/src/petascope/wcps/grammar/SubsetExpr.java
+++ b/petascope/src/petascope/wcps/grammar/SubsetExpr.java
@@ -14,13 +14,12 @@
* 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.grammar;
+package petascope.wcps.grammar;
/**
* SubsetExpr
diff --git a/petascope/src/petascope/wcps/grammar/TrigonometricExpr.java b/petascope/src/petascope/wcps/grammar/TrigonometricExpr.java
index f52ec74..2a6cc2b 100644
--- a/petascope/src/petascope/wcps/grammar/TrigonometricExpr.java
+++ b/petascope/src/petascope/wcps/grammar/TrigonometricExpr.java
@@ -14,13 +14,12 @@
* 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.grammar;
+package petascope.wcps.grammar;
/**
* TrigonometricExpr
diff --git a/petascope/src/petascope/wcps/grammar/TrimExpr.java b/petascope/src/petascope/wcps/grammar/TrimExpr.java
index 122c043..49224b7 100644
--- a/petascope/src/petascope/wcps/grammar/TrimExpr.java
+++ b/petascope/src/petascope/wcps/grammar/TrimExpr.java
@@ -14,13 +14,12 @@
* 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.grammar;
+package petascope.wcps.grammar;
/**
* TrimExpr
diff --git a/petascope/src/petascope/wcps/grammar/VariableList.java b/petascope/src/petascope/wcps/grammar/VariableList.java
index 722a321..4a7307e 100644
--- a/petascope/src/petascope/wcps/grammar/VariableList.java
+++ b/petascope/src/petascope/wcps/grammar/VariableList.java
@@ -14,13 +14,12 @@
* 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.grammar;
+package petascope.wcps.grammar;
/*Author: Sorin Stancu-Mara, Andrei Aiordachioaie
* Date: 8 Feb 2008
diff --git a/petascope/src/petascope/wcps/grammar/WCPSRequest.java b/petascope/src/petascope/wcps/grammar/WCPSRequest.java
index 742ddba..4a978da 100644
--- a/petascope/src/petascope/wcps/grammar/WCPSRequest.java
+++ b/petascope/src/petascope/wcps/grammar/WCPSRequest.java
@@ -14,13 +14,12 @@
* 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.grammar;
+package petascope.wcps.grammar;
/**
* WCPSRequest class represents a WCPSRequest.
diff --git a/petascope/src/petascope/wcps/grammar/WhereClause.java b/petascope/src/petascope/wcps/grammar/WhereClause.java
index a698935..9b2dba4 100644
--- a/petascope/src/petascope/wcps/grammar/WhereClause.java
+++ b/petascope/src/petascope/wcps/grammar/WhereClause.java
@@ -14,13 +14,12 @@
* 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.grammar;
+package petascope.wcps.grammar;
/* Author: Sorin Stancu-Mara, Andrei Aiordachioaie
Date: 7 Feb 2007
diff --git a/petascope/src/petascope/wcps/grammar/wcps.g b/petascope/src/petascope/wcps/grammar/wcps.g
index f00d1b5..a3708e7 100644
--- a/petascope/src/petascope/wcps/grammar/wcps.g
+++ b/petascope/src/petascope/wcps/grammar/wcps.g
@@ -23,9 +23,9 @@ language=Java;
output=AST;
}
@header
-{package petascope.wcps.grammar;}
+{package petascope.wcps.grammar;}}
@lexer::header
-{package petascope.wcps.grammar;}
+{package petascope.wcps.grammar;}}
/* Parser Rules */
diff --git a/petascope/src/petascope/wcps/grammar/wcpsParser.java b/petascope/src/petascope/wcps/grammar/wcpsParser.java
index 27f75f8..9c09822 100644
--- a/petascope/src/petascope/wcps/grammar/wcpsParser.java
+++ b/petascope/src/petascope/wcps/grammar/wcpsParser.java
@@ -7,7 +7,6 @@ import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
-
import org.antlr.runtime.tree.*;
public class wcpsParser extends Parser {
diff --git a/petascope/src/petascope/wcps/server/cli/xml.java b/petascope/src/petascope/wcps/server/cli/xml.java
index c9756ab..8a262ca 100644
--- a/petascope/src/petascope/wcps/server/cli/xml.java
+++ b/petascope/src/petascope/wcps/server/cli/xml.java
@@ -14,143 +14,140 @@
* 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.cli;
-
-import petascope.wcps.server.core.DbMetadataSource;
-import petascope.wcps.server.core.ProcessCoveragesRequest;
-import petascope.wcps.server.core.WCPS;
-
-import java.io.File;
-import java.io.FileInputStream;
-
-import java.io.StringReader;
-import java.util.Properties;
-import org.xml.sax.InputSource;
-
-/**
- * This is a small application around the WCPS core. It takes XML requests as files and runs them
- * through WCPS. The resulting radaman queries are displayed, but not executed. This is very useful
- * for testing whether your metadata is valid.
- */
-public class xml {
-
- private static WCPS wcps;
- private static DbMetadataSource metadataSource;
-
- private static void initMetadata() {
- File cwd = new File(".");
- System.out.println("Working in " + cwd.getAbsolutePath());
- String pcSchemaFileName =
- // "src/conf/" +
- "xml" + File.separator + "ogc" + File.separator + "wcps"
- + File.separator + "1.0.0" + File.separator + "wcpsProcessCoverages.xsd";
- File pcSchemaFile = new File(pcSchemaFileName);
-
- if (!pcSchemaFile.exists()) {
- System.err.println("WCPS: could not find the WCPS ProcessCoverage schema ("
- + pcSchemaFileName + ")");
- System.exit(1);
- }
-
- metadataSource = null;
-
- try {
- Properties dbParams = new Properties();
-
- dbParams.load(new FileInputStream("settings.properties"));
- metadataSource =
- new DbMetadataSource(dbParams.getProperty("metadata_driver"),
- dbParams.getProperty("metadata_url"),
- dbParams.getProperty("metadata_user"),
- dbParams.getProperty("metadata_pass"), false);
- wcps = new WCPS(pcSchemaFile, metadataSource);
- } catch (Exception e) {
- System.err.println("WCPS: could not initialize WCPS:");
- e.printStackTrace(System.err);
- System.exit(1);
- }
- }
-
- public static void main(String[] args) {
- if (args.length < 1) {
- System.err.println("WCPS CLI: no input files");
-
- System.err.println("\nWCPS CLI Usage: java wcps.server.cli.xml input.xml");
- System.err.println("Where input.xml contains a ProcessCoverages Request ");
-// System.exit(1);
-
- args = new String[1];
- args[0] = "test/testcases-wcps_dollar/25.test.xml";
- }
- if (args.length > 1) {
- System.err.println("WCPS: no input files");
- System.exit(1);
- }
-
- initMetadata();
-
- for (int i = 0; i < args.length; i++) {
- File fileIn = null;
- InputSource is = null;
-
- try {
- fileIn = new File(args[i]);
- is = new InputSource(new FileInputStream(fileIn));
- } catch (Exception fnfe) {
- System.err.println("WCPS: " + args[i]
- + ": no such file or directory" + fnfe);
- System.exit(1);
- }
-
-
- String result = processCoverage(is, i);
- if (result != null) {
- System.out.println(result);
- } else {
- System.err.println("WCPS: " + args[i] + " failed");
- System.exit(1);
- }
- }
-
- metadataSource.close();
- System.exit(0);
-
- }
-
- private static String processCoverage(InputSource is, int i) {
- String result = null;
-
- try {
- ProcessCoveragesRequest r = wcps.pcPrepare("http://kahlua.eecs.jacobs-university.de:9001",
- "RASSERVICE", is);
- System.err.println("Request " + i);
- String rasql = r.getRasqlQuery();
- String mime = r.getMime();
-// result = "[" + mime + "] " + rasql;
- result = rasql;
- } catch (Exception e) {
- System.err.println("WCPS: request " + i
- + " failed with the following exception:");
- e.printStackTrace(System.err);
- }
-
- return result;
- }
-
- /** Converts a WCPS XML query into a RasQL query string **/
- public static String convertXmlToRasql(String query) {
- String rasql = null;
- if (metadataSource == null) {
- initMetadata();
- }
- InputSource is = new InputSource(new StringReader(query));
- rasql = processCoverage(is, 1);
- return rasql;
- }
-}
+package petascope.wcps.server.cli;
+
+import petascope.core.DbMetadataSource;
+import petascope.wcps.server.core.ProcessCoveragesRequest;
+import petascope.wcps.server.core.WCPS;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.StringReader;
+import java.util.Properties;
+import org.xml.sax.InputSource;
+
+/**
+ * This is a small application around the WCPS core. It takes XML requests as files and runs them
+ * through WCPS. The resulting radaman queries are displayed, but not executed. This is very useful
+ * for testing whether your metadata is valid.
+ */
+public class xml {
+
+ private static WCPS wcps;
+ private static DbMetadataSource metadataSource;
+
+ private static void initMetadata() {
+ File cwd = new File(".");
+ System.out.println("Working in " + cwd.getAbsolutePath());
+ String pcSchemaFileName =
+ // "src/conf/" +
+ "xml" + File.separator + "ogc" + File.separator + "wcps"
+ + File.separator + "1.0.0" + File.separator + "wcpsProcessCoverages.xsd";
+ File pcSchemaFile = new File(pcSchemaFileName);
+
+ if (!pcSchemaFile.exists()) {
+ System.err.println("WCPS: could not find the WCPS ProcessCoverage schema ("
+ + pcSchemaFileName + ")");
+ System.exit(1);
+ }
+
+ metadataSource = null;
+
+ try {
+ Properties dbParams = new Properties();
+
+ dbParams.load(new FileInputStream("settings.properties"));
+ metadataSource =
+ new DbMetadataSource(dbParams.getProperty("metadata_driver"),
+ dbParams.getProperty("metadata_url"),
+ dbParams.getProperty("metadata_user"),
+ dbParams.getProperty("metadata_pass"), false);
+ wcps = new WCPS(pcSchemaFile, metadataSource);
+ } catch (Exception e) {
+ System.err.println("WCPS: could not initialize WCPS:");
+ e.printStackTrace(System.err);
+ System.exit(1);
+ }
+ }
+
+ public static void main(String[] args) {
+ if (args.length < 1) {
+ System.err.println("WCPS CLI: no input files");
+
+ System.err.println("\nWCPS CLI Usage: java wcps.server.cli.xml input.xml");
+ System.err.println("Where input.xml contains a ProcessCoverages Request ");
+// System.exit(1);
+
+ args = new String[1];
+ args[0] = "test/testcases-wcps_dollar/25.test.xml";
+ }
+ if (args.length > 1) {
+ System.err.println("WCPS: no input files");
+ System.exit(1);
+ }
+
+ initMetadata();
+
+ for (int i = 0; i < args.length; i++) {
+ File fileIn = null;
+ InputSource is = null;
+
+ try {
+ fileIn = new File(args[i]);
+ is = new InputSource(new FileInputStream(fileIn));
+ } catch (Exception fnfe) {
+ System.err.println("WCPS: " + args[i]
+ + ": no such file or directory" + fnfe);
+ System.exit(1);
+ }
+
+
+ String result = processCoverage(is, i);
+ if (result != null) {
+ System.out.println(result);
+ } else {
+ System.err.println("WCPS: " + args[i] + " failed");
+ System.exit(1);
+ }
+ }
+
+ metadataSource.close();
+ System.exit(0);
+
+ }
+
+ private static String processCoverage(InputSource is, int i) {
+ String result = null;
+
+ try {
+ ProcessCoveragesRequest r = wcps.pcPrepare("http://kahlua.eecs.jacobs-university.de:9001",
+ "RASSERVICE", is);
+ System.err.println("Request " + i);
+ String rasql = r.getRasqlQuery();
+ String mime = r.getMime();
+// result = "[" + mime + "] " + rasql;
+ result = rasql;
+ } catch (Exception e) {
+ System.err.println("WCPS: request " + i
+ + " failed with the following exception:");
+ e.printStackTrace(System.err);
+ }
+
+ return result;
+ }
+
+ /** Converts a WCPS XML query into a RasQL query string **/
+ public static String convertXmlToRasql(String query) {
+ String rasql = null;
+ if (metadataSource == null) {
+ initMetadata();
+ }
+ InputSource is = new InputSource(new StringReader(query));
+ rasql = processCoverage(is, 1);
+ return rasql;
+ }
+}
diff --git a/petascope/src/petascope/wcps/server/core/AxisIterator.java b/petascope/src/petascope/wcps/server/core/AxisIterator.java
index 1076d86..8be19b6 100644
--- a/petascope/src/petascope/wcps/server/core/AxisIterator.java
+++ b/petascope/src/petascope/wcps/server/core/AxisIterator.java
@@ -14,99 +14,98 @@
* 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.InvalidCrsException;
-import petascope.wcps.server.exceptions.WCPSException;
-import java.math.BigInteger;
-import org.w3c.dom.*;
-
-public class AxisIterator implements IRasNode {
-
- private String var, varTranslation;
- private AxisName axis;
- private NumericScalarExpr hi, lo;
-
- public AxisIterator(Node node, XmlQuery xq, String newIteratorName) throws WCPSException, InvalidCrsException {
- while ((node != null) && node.getNodeName().equals("#text")) {
- node = node.getNextSibling();
- }
- System.err.println("Trying to parse AxisIterator ");
-
- while (node != null) {
- String nodeName = node.getNodeName();
-
- if (nodeName.equals("iteratorVar")) {
- var = node.getTextContent();
- // This variable will be referenced later on. Translate it.
- xq.addReferenceVariable(var, newIteratorName);
- varTranslation = xq.getReferenceVariableName(var);
- } else if (nodeName.equals("axis")) {
- axis = new AxisName(node, xq);
- } else {
- // Should contain the limits
- // TODO: Implement ImageCrsDomainMetadataType class
- if (lo == null) {
- lo = new NumericScalarExpr(node, xq);
- } else if (hi == null) {
- hi = new NumericScalarExpr(node, xq);
- } else {
- throw new WCPSException("Unknown node in AxisIterator: " + nodeName);
- }
- }
-
- node = node.getNextSibling();
- while ((node != null) && node.getNodeName().equals("#text")) {
- node = node.getNextSibling();
- }
- }
- }
-
- public String toRasQL() {
- String result = varTranslation + " in [" + lo.toRasQL() + ":" + hi.toRasQL() + "]";
- return result;
- }
-
- /** Sets a new name for the iterator variable, to be used in the rasql query**/
- public void setVariableTranslation(String newName) {
- varTranslation = newName;
- }
-
- /** Return the Higher bound for the axis iterator.
- * This only works for constant expressions.
- * TODO: implement arbitrary expressions.
- * @return BigInteger
- */
- public BigInteger getHigh() {
- return SDU.str2integer(hi.toRasQL()).get(0);
- }
-
- /** Return the Lower bound for the axis iterator.
- * This only works for constant expressions.
- * TODO: implement arbitrary expressions.
- * @return BIgInteger
- */
- public BigInteger getLow() {
- return SDU.str2integer(lo.toRasQL()).get(0);
- }
-
- /* Return the variable name used in this axis */
- public String getVar() {
- return var;
- }
-
- public String getAxisType() {
- return axis.toRasQL();
- }
-
- /* Returns the m-interval that this axis iterates over in a string form */
- public String getInterval() {
- return lo.toRasQL() + ":" + hi.toRasQL();
- }
-}
+package petascope.wcps.server.core;
+
+import petascope.exceptions.WCPSException;
+import java.math.BigInteger;
+import org.w3c.dom.*;
+import petascope.exceptions.ExceptionCode;
+
+public class AxisIterator implements IRasNode {
+
+ private String var, varTranslation;
+ private AxisName axis;
+ private NumericScalarExpr hi, lo;
+
+ public AxisIterator(Node node, XmlQuery xq, String newIteratorName) throws WCPSException {
+ while ((node != null) && node.getNodeName().equals("#text")) {
+ node = node.getNextSibling();
+ }
+
+ while (node != null) {
+ String nodeName = node.getNodeName();
+
+ if (nodeName.equals("iteratorVar")) {
+ var = node.getTextContent();
+ // This variable will be referenced later on. Translate it.
+ xq.addReferenceVariable(var, newIteratorName);
+ varTranslation = xq.getReferenceVariableName(var);
+ } else if (nodeName.equals("axis")) {
+ axis = new AxisName(node, xq);
+ } else {
+ // Should contain the limits
+ // TODO: Implement ImageCrsDomainMetadataType class
+ if (lo == null) {
+ lo = new NumericScalarExpr(node, xq);
+ } else if (hi == null) {
+ hi = new NumericScalarExpr(node, xq);
+ } else {
+ throw new WCPSException(ExceptionCode.UnsupportedCombination,
+ "Unknown node in AxisIterator: " + nodeName);
+ }
+ }
+
+ node = node.getNextSibling();
+ while ((node != null) && node.getNodeName().equals("#text")) {
+ node = node.getNextSibling();
+ }
+ }
+ }
+
+ public String toRasQL() {
+ String result = varTranslation + " in [" + lo.toRasQL() + ":" + hi.toRasQL() + "]";
+ return result;
+ }
+
+ /** Sets a new name for the iterator variable, to be used in the rasql query**/
+ public void setVariableTranslation(String newName) {
+ varTranslation = newName;
+ }
+
+ /** Return the Higher bound for the axis iterator.
+ * This only works for constant expressions.
+ * TODO: implement arbitrary expressions.
+ * @return BigInteger
+ */
+ public BigInteger getHigh() {
+ return SDU.str2integer(hi.toRasQL()).get(0);
+ }
+
+ /** Return the Lower bound for the axis iterator.
+ * This only works for constant expressions.
+ * TODO: implement arbitrary expressions.
+ * @return BIgInteger
+ */
+ public BigInteger getLow() {
+ return SDU.str2integer(lo.toRasQL()).get(0);
+ }
+
+ /* Return the variable name used in this axis */
+ public String getVar() {
+ return var;
+ }
+
+ public String getAxisType() {
+ return axis.toRasQL();
+ }
+
+ /* Returns the m-interval that this axis iterates over in a string form */
+ public String getInterval() {
+ return lo.toRasQL() + ":" + hi.toRasQL();
+ }
+}
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;
+ }
+}
diff --git a/petascope/src/petascope/wcps/server/core/BinaryOperationCoverageExpr.java b/petascope/src/petascope/wcps/server/core/BinaryOperationCoverageExpr.java
index b23b00b..cfeb0c0 100644
--- a/petascope/src/petascope/wcps/server/core/BinaryOperationCoverageExpr.java
+++ b/petascope/src/petascope/wcps/server/core/BinaryOperationCoverageExpr.java
@@ -14,113 +14,111 @@
* 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.InvalidCrsException;
-import petascope.wcps.server.exceptions.WCPSException;
-import org.w3c.dom.*;
-
-public class BinaryOperationCoverageExpr implements IRasNode, ICoverageInfo {
-
- private IRasNode first, second;
- private CoverageExprPairType pair;
- private CoverageInfo info;
- private String operation;
-
- public BinaryOperationCoverageExpr(Node node, XmlQuery xq)
- throws WCPSException, InvalidCrsException {
- String nodeName = node.getNodeName();
-
- System.err.println("Trying to parse binary operation: " + nodeName);
- boolean okay = false; // will be true if the node is recognized
-
- if (nodeName.equals("plus")) {
- operation = "+";
- okay = true;
- }
-
- if (nodeName.equals("minus")) {
- operation = "-";
- okay = true;
- }
-
- if (nodeName.equals("mult")) {
- operation = "*";
- okay = true;
- }
-
- if (nodeName.equals("div")) {
- operation = "/";
- okay = true;
- }
-
- if (nodeName.equals("and") || nodeName.equals("or") || nodeName.equals("xor")) {
- operation = nodeName;
- okay = true;
- }
-
- if (nodeName.equals("equals")) {
- operation = "=";
- okay = true;
- }
-
- if (nodeName.equals("lessThan")) {
- operation = "<";
- okay = true;
- }
-
- if (nodeName.equals("greaterThan")) {
- operation = ">";
- okay = true;
- }
-
- if (nodeName.equals("lessOrEqual")) {
- operation = "<=";
- okay = true;
- }
-
- if (nodeName.equals("greaterOrEqual")) {
- operation = ">=";
- okay = true;
- }
-
- if (nodeName.equals("notEqual")) {
- operation = "!=";
- okay = true;
- }
-
- if (nodeName.equals("overlay")) {
- operation = "overlay";
- okay = true;
- }
-
- if (!okay) {
- throw new WCPSException("Unexpected binary operation : " + nodeName);
- }
-
- Node operand = node.getFirstChild();
-
- while (operand.getNodeName().equals("#text")) {
- operand = operand.getNextSibling();
- }
-
- pair = new CoverageExprPairType(operand, xq);
- info = new CoverageInfo(((ICoverageInfo) pair).getCoverageInfo());
- first = pair.getFirst();
- second = pair.getSecond();
- }
-
- public CoverageInfo getCoverageInfo() {
- return info;
- }
-
- public String toRasQL() {
- return "((" + first.toRasQL() + ")" + operation + "(" + second.toRasQL() + "))";
- }
-}
+package petascope.wcps.server.core;
+
+import petascope.exceptions.WCPSException;
+import org.w3c.dom.*;
+
+public class BinaryOperationCoverageExpr implements IRasNode, ICoverageInfo {
+
+ private IRasNode first, second;
+ private CoverageExprPairType pair;
+ private CoverageInfo info;
+ private String operation;
+
+ public BinaryOperationCoverageExpr(Node node, XmlQuery xq)
+ throws WCPSException {
+ String nodeName = node.getNodeName();
+
+ System.err.println("Trying to parse binary operation: " + nodeName);
+ boolean okay = false; // will be true if the node is recognized
+
+ if (nodeName.equals("plus")) {
+ operation = "+";
+ okay = true;
+ }
+
+ if (nodeName.equals("minus")) {
+ operation = "-";
+ okay = true;
+ }
+
+ if (nodeName.equals("mult")) {
+ operation = "*";
+ okay = true;
+ }
+
+ if (nodeName.equals("div")) {
+ operation = "/";
+ okay = true;
+ }
+
+ if (nodeName.equals("and") || nodeName.equals("or") || nodeName.equals("xor")) {
+ operation = nodeName;
+ okay = true;
+ }
+
+ if (nodeName.equals("equals")) {
+ operation = "=";
+ okay = true;
+ }
+
+ if (nodeName.equals("lessThan")) {
+ operation = "<";
+ okay = true;
+ }
+
+ if (nodeName.equals("greaterThan")) {
+ operation = ">";
+ okay = true;
+ }
+
+ if (nodeName.equals("lessOrEqual")) {
+ operation = "<=";
+ okay = true;
+ }
+
+ if (nodeName.equals("greaterOrEqual")) {
+ operation = ">=";
+ okay = true;
+ }
+
+ if (nodeName.equals("notEqual")) {
+ operation = "!=";
+ okay = true;
+ }
+
+ if (nodeName.equals("overlay")) {
+ operation = "overlay";
+ okay = true;
+ }
+
+ if (!okay) {
+ throw new WCPSException("Unexpected binary operation : " + nodeName);
+ }
+
+ Node operand = node.getFirstChild();
+
+ while (operand.getNodeName().equals("#text")) {
+ operand = operand.getNextSibling();
+ }
+
+ pair = new CoverageExprPairType(operand, xq);
+ info = new CoverageInfo(((ICoverageInfo) pair).getCoverageInfo());
+ first = pair.getFirst();
+ second = pair.getSecond();
+ }
+
+ public CoverageInfo getCoverageInfo() {
+ return info;
+ }
+
+ public String toRasQL() {
+ return "((" + first.toRasQL() + ")" + operation + "(" + second.toRasQL() + "))";
+ }
+}
diff --git a/petascope/src/petascope/wcps/server/core/BooleanScalarExpr.java b/petascope/src/petascope/wcps/server/core/BooleanScalarExpr.java
index fb99116..cfe64a3 100644
--- a/petascope/src/petascope/wcps/server/core/BooleanScalarExpr.java
+++ b/petascope/src/petascope/wcps/server/core/BooleanScalarExpr.java
@@ -14,126 +14,124 @@
* 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.InvalidCrsException;
-import petascope.wcps.server.exceptions.WCPSException;
-import org.w3c.dom.*;
-
-public class BooleanScalarExpr implements IRasNode {
-
- private IRasNode first, second;
- private String op;
- private boolean simple; // true if the expression is just a value
- private String value;
-
- public BooleanScalarExpr(Node node, XmlQuery xq) throws WCPSException, InvalidCrsException {
- if (node == null) {
- throw new WCPSException("Unexpected null node !");
- }
-
- String nodeName = node.getNodeName();
-
- simple = false;
-
- System.err.println("Parsing boolean scalar operation ...");
-
- if (nodeName.equals("booleanConstant")) {
- simple = true;
- value = node.getFirstChild().getNodeValue();
- } else if (nodeName.equals("booleanAnd")
- || nodeName.equals("booleanOr")
- || nodeName.equals("booleanXor")
- || nodeName.equals("booleanLessThan")
- || nodeName.equals("booleanLessOrEqual")
- || nodeName.equals("booleanGreaterThan")
- || nodeName.equals("booleanGreaterOrEqual")
- || nodeName.equals("booleanEqualNumeric")
- || nodeName.equals("booleanNotEqualNumeric")
- || nodeName.equals("booleanEqualString")
- || nodeName.equals("booleanNotEqualString")) {
- // Logical operations
- if (nodeName.equals("booleanAnd")
- || nodeName.equals("booleanOr")
- || nodeName.equals("booleanXor")) {
- // Remove the "boolean" in front
- op = nodeName.substring(7).toLowerCase();
-
- Node child = node.getFirstChild();
-
- first = new BooleanScalarExpr(child, xq);
- child = child.getNextSibling();
- second = new BooleanScalarExpr(child, xq);
- } else // Boolean Comparison operations between numbers or strings
- {
- if (nodeName.equals("booleanLessThan") || nodeName.equals("booleanLessOrEqual")
- || nodeName.equals("booleanGreaterThan") || nodeName.equals("booleanGreaterOrEqual")
- || nodeName.equals("booleanEqualNumeric") || nodeName.equals("booleanNotEqualNumeric")) {
- if (nodeName.equals("booleanLessThan")) {
- op = "<";
- }
- if (nodeName.equals("booleanLessOrEqual")) {
- op = "<=";
- }
- if (nodeName.equals("booleanGreaterThan")) {
- op = ">";
- }
- if (nodeName.equals("booleanGreaterOrEqual")) {
- op = ">=";
- }
- if (nodeName.equals("booleanEqualNumeric")) {
- op = "=";
- }
- if (nodeName.equals("booleanNotEqualNumeric")) {
- op = "!=";
- }
-
- Node child = node.getFirstChild();
-
- first = new NumericScalarExpr(child, xq);
- child = child.getNextSibling();
- second = new NumericScalarExpr(child, xq);
- } else {
- if (nodeName.equals("booleanEqualString")) {
- op = "=";
- }
- if (nodeName.equals("booleanNotEqualString")) {
- op = "!=";
- }
-
- Node child = node.getFirstChild();
-
- first = new StringScalarExpr(child, xq);
- child = child.getNextSibling();
- second = new StringScalarExpr(child, xq);
- }
- }
-
- } else if (nodeName.equals("booleanNot")) {
- op = "not";
- first = new BooleanScalarExpr(node.getFirstChild(), xq);
- } else {
- throw new WCPSException("Unexpected Binary Expression node : "
- + node.getNodeName());
- }
- System.err.println("*** Boolean Scalar Expr SUCCESS: " + node.getNodeName());
- }
-
- public String toRasQL() {
- if (simple) {
- return value;
- }
-
- if (op.equals("not")) {
- return "not(" + first.toRasQL() + ")";
- }
-
- return "(" + first.toRasQL() + ")" + op + "(" + second.toRasQL() + ")";
- }
-}
+package petascope.wcps.server.core;
+
+import petascope.exceptions.WCPSException;
+import org.w3c.dom.*;
+
+public class BooleanScalarExpr implements IRasNode {
+
+ private IRasNode first, second;
+ private String op;
+ private boolean simple; // true if the expression is just a value
+ private String value;
+
+ public BooleanScalarExpr(Node node, XmlQuery xq) throws WCPSException {
+ if (node == null) {
+ throw new WCPSException("Unexpected null node !");
+ }
+
+ String nodeName = node.getNodeName();
+
+ simple = false;
+
+ System.err.println("Parsing boolean scalar operation ...");
+
+ if (nodeName.equals("booleanConstant")) {
+ simple = true;
+ value = node.getFirstChild().getNodeValue();
+ } else if (nodeName.equals("booleanAnd")
+ || nodeName.equals("booleanOr")
+ || nodeName.equals("booleanXor")
+ || nodeName.equals("booleanLessThan")
+ || nodeName.equals("booleanLessOrEqual")
+ || nodeName.equals("booleanGreaterThan")
+ || nodeName.equals("booleanGreaterOrEqual")
+ || nodeName.equals("booleanEqualNumeric")
+ || nodeName.equals("booleanNotEqualNumeric")
+ || nodeName.equals("booleanEqualString")
+ || nodeName.equals("booleanNotEqualString")) {
+ // Logical operations
+ if (nodeName.equals("booleanAnd")
+ || nodeName.equals("booleanOr")
+ || nodeName.equals("booleanXor")) {
+ // Remove the "boolean" in front
+ op = nodeName.substring(7).toLowerCase();
+
+ Node child = node.getFirstChild();
+
+ first = new BooleanScalarExpr(child, xq);
+ child = child.getNextSibling();
+ second = new BooleanScalarExpr(child, xq);
+ } else // Boolean Comparison operations between numbers or strings
+ {
+ if (nodeName.equals("booleanLessThan") || nodeName.equals("booleanLessOrEqual")
+ || nodeName.equals("booleanGreaterThan") || nodeName.equals("booleanGreaterOrEqual")
+ || nodeName.equals("booleanEqualNumeric") || nodeName.equals("booleanNotEqualNumeric")) {
+ if (nodeName.equals("booleanLessThan")) {
+ op = "<";
+ }
+ if (nodeName.equals("booleanLessOrEqual")) {
+ op = "<=";
+ }
+ if (nodeName.equals("booleanGreaterThan")) {
+ op = ">";
+ }
+ if (nodeName.equals("booleanGreaterOrEqual")) {
+ op = ">=";
+ }
+ if (nodeName.equals("booleanEqualNumeric")) {
+ op = "=";
+ }
+ if (nodeName.equals("booleanNotEqualNumeric")) {
+ op = "!=";
+ }
+
+ Node child = node.getFirstChild();
+
+ first = new NumericScalarExpr(child, xq);
+ child = child.getNextSibling();
+ second = new NumericScalarExpr(child, xq);
+ } else {
+ if (nodeName.equals("booleanEqualString")) {
+ op = "=";
+ }
+ if (nodeName.equals("booleanNotEqualString")) {
+ op = "!=";
+ }
+
+ Node child = node.getFirstChild();
+
+ first = new StringScalarExpr(child, xq);
+ child = child.getNextSibling();
+ second = new StringScalarExpr(child, xq);
+ }
+ }
+
+ } else if (nodeName.equals("booleanNot")) {
+ op = "not";
+ first = new BooleanScalarExpr(node.getFirstChild(), xq);
+ } else {
+ throw new WCPSException("Unexpected Binary Expression node : "
+ + node.getNodeName());
+ }
+ System.err.println("*** Boolean Scalar Expr SUCCESS: " + node.getNodeName());
+ }
+
+ public String toRasQL() {
+ if (simple) {
+ return value;
+ }
+
+ if (op.equals("not")) {
+ return "not(" + first.toRasQL() + ")";
+ }
+
+ return "(" + first.toRasQL() + ")" + op + "(" + second.toRasQL() + ")";
+ }
+}
diff --git a/petascope/src/petascope/wcps/server/core/CellDomainElement.java b/petascope/src/petascope/wcps/server/core/CellDomainElement.java
index b325ce8..051c23d 100644
--- a/petascope/src/petascope/wcps/server/core/CellDomainElement.java
+++ b/petascope/src/petascope/wcps/server/core/CellDomainElement.java
@@ -14,31 +14,34 @@
* 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.InvalidMetadataException;
import java.math.BigInteger;
+import petascope.exceptions.ExceptionCode;
+import petascope.exceptions.WCPSException;
+import petascope.wcs2.parsers.GetCoverageRequest;
//A coverage axis in pixel coordinates. See the WCPS standard.
public class CellDomainElement implements Cloneable {
- private BigInteger hi;
- private BigInteger lo;
+ GetCoverageRequest.DimensionSubset subsetElement;
- public CellDomainElement(BigInteger lo, BigInteger hi) throws InvalidMetadataException {
+ private BigInteger hi; //FIXME: should be double
+ private BigInteger lo; //FIXME: should be double
+
+ public CellDomainElement(BigInteger lo, BigInteger hi) throws WCPSException {
if ((lo == null) || (hi == null)) {
- throw new InvalidMetadataException(
+ throw new WCPSException(ExceptionCode.InvalidMetadata,
"Invalid cell domain element: Bounds may not be null");
}
if (lo.compareTo(hi) == 1) {
- throw new InvalidMetadataException(
+ throw new WCPSException(ExceptionCode.InvalidMetadata,
"Invalid cell domain element: Lower bound cannot be larger than upper bound");
}
@@ -47,11 +50,12 @@ public class CellDomainElement implements Cloneable {
}
+ @Override
public CellDomainElement clone() {
try {
return new CellDomainElement(BigInteger.ZERO.add(lo),
BigInteger.ZERO.add(hi));
- } catch (InvalidMetadataException ime) {
+ } catch (WCPSException ime) {
throw new RuntimeException(
"Invalid metadata while cloning CellDomainElement. This is a software bug in WCPS.",
ime);
@@ -69,12 +73,25 @@ public class CellDomainElement implements Cloneable {
}
+ public void setHi(BigInteger hi){this.hi = hi;}
+
public BigInteger getLo() {
return lo;
}
+ public void setLo(BigInteger lo){this.lo = lo;}
+
+ @Override
public String toString() {
String result = "CellDomainElement [" + lo + ", " + hi + "]";
return result;
}
+
+ public GetCoverageRequest.DimensionSubset getSubsetElement() {
+ return subsetElement;
+ }
+
+ public void setSubsetElement(GetCoverageRequest.DimensionSubset subsetElement) {
+ this.subsetElement = subsetElement;
+ }
}
diff --git a/petascope/src/petascope/wcps/server/core/ComplexConstant.java b/petascope/src/petascope/wcps/server/core/ComplexConstant.java
index 144aa32..a5157b4 100644
--- a/petascope/src/petascope/wcps/server/core/ComplexConstant.java
+++ b/petascope/src/petascope/wcps/server/core/ComplexConstant.java
@@ -14,109 +14,108 @@
* 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 org.w3c.dom.*;
-
-public class ComplexConstant implements IRasNode {
-
- private String re, im;
-
- public ComplexConstant(String str) throws WCPSException {
- boolean ok = true;
- // We only accept the following String representation of a complex number: {re,im}
- if (str.startsWith("{") && str.endsWith("}")) {
- str = str.substring(1, str.length() - 2);
- if (str.indexOf(",") != -1 && str.lastIndexOf(",") != str.indexOf(",")) {
- int comma = str.indexOf(",");
- re = str.substring(0, comma - 1);
- im = str.substring(comma + 1, str.length() - comma - 1);
- } else {
- ok = false;
- }
- } else {
- ok = false;
- }
- if (ok == false) {
- throw new WCPSException("Could not parse Complex Constant !");
- }
-
- // parse the real part
- try {
- Integer real = Integer.parseInt(re);
- } catch (NumberFormatException e) {
- try {
- Float real = Float.parseFloat(re);
- } catch (NumberFormatException e2) {
- throw new WCPSException("Could not parse float or integer "
- + "number for real part of complex number:" + re);
- }
- }
- // parse the imaginary part
- try {
- Integer imag = Integer.parseInt(im);
- } catch (NumberFormatException e) {
- try {
- Float imag = Float.parseFloat(im);
- } catch (NumberFormatException e2) {
- throw new WCPSException("Could not parse float or integer "
- + "number for imaginary part of complex number" + im);
- }
- }
- }
-
- public ComplexConstant(Node node, XmlQuery xq) throws WCPSException {
- System.err.println("Parsing complex constant: " + node.getNodeName());
-
- while ((node != null) && node.getNodeName().equals("#text")) {
- node = node.getNextSibling();
- }
-
- while (node != null) {
- String name = node.getNodeName();
- if (name.equals("re")) {
- re = node.getNodeValue();
- } else if (name.equals("im")) {
- im = node.getNodeValue();
- } else {
- throw new WCPSException("Unknown node while processing complex constant: " + name);
- }
-
- node = node.getNextSibling();
- }
-
- // parse the real part
- try {
- Integer real = Integer.parseInt(re);
- } catch (NumberFormatException e) {
- try {
- Float real = Float.parseFloat(re);
- } catch (NumberFormatException e2) {
- throw new WCPSException("Could not parse float or integer "
- + "number for real part of complex number:" + re);
- }
- }
- // parse the imaginary part
- try {
- Integer imag = Integer.parseInt(im);
- } catch (NumberFormatException e) {
- try {
- Float imag = Float.parseFloat(im);
- } catch (NumberFormatException e2) {
- throw new WCPSException("Could not parse float or integer "
- + "number for imaginary part of complex number" + im);
- }
- }
- }
-
- public String toRasQL() {
- return "complex ( " + re + ", " + im + " ) ";
- }
-}
+package petascope.wcps.server.core;
+
+import petascope.exceptions.WCPSException;
+import org.w3c.dom.*;
+
+public class ComplexConstant implements IRasNode {
+
+ private String re, im;
+
+ public ComplexConstant(String str) throws WCPSException {
+ boolean ok = true;
+ // We only accept the following String representation of a complex number: {re,im}
+ if (str.startsWith("{") && str.endsWith("}")) {
+ str = str.substring(1, str.length() - 2);
+ if (str.indexOf(",") != -1 && str.lastIndexOf(",") != str.indexOf(",")) {
+ int comma = str.indexOf(",");
+ re = str.substring(0, comma - 1);
+ im = str.substring(comma + 1, str.length() - comma - 1);
+ } else {
+ ok = false;
+ }
+ } else {
+ ok = false;
+ }
+ if (ok == false) {
+ throw new WCPSException("Could not parse Complex Constant !");
+ }
+
+ // parse the real part
+ try {
+ Integer real = Integer.parseInt(re);
+ } catch (NumberFormatException e) {
+ try {
+ Float real = Float.parseFloat(re);
+ } catch (NumberFormatException e2) {
+ throw new WCPSException("Could not parse float or integer "
+ + "number for real part of complex number:" + re);
+ }
+ }
+ // parse the imaginary part
+ try {
+ Integer imag = Integer.parseInt(im);
+ } catch (NumberFormatException e) {
+ try {
+ Float imag = Float.parseFloat(im);
+ } catch (NumberFormatException e2) {
+ throw new WCPSException("Could not parse float or integer "
+ + "number for imaginary part of complex number" + im);
+ }
+ }
+ }
+
+ public ComplexConstant(Node node, XmlQuery xq) throws WCPSException {
+ System.err.println("Parsing complex constant: " + node.getNodeName());
+
+ while ((node != null) && node.getNodeName().equals("#text")) {
+ node = node.getNextSibling();
+ }
+
+ while (node != null) {
+ String name = node.getNodeName();
+ if (name.equals("re")) {
+ re = node.getNodeValue();
+ } else if (name.equals("im")) {
+ im = node.getNodeValue();
+ } else {
+ throw new WCPSException("Unknown node while processing complex constant: " + name);
+ }
+
+ node = node.getNextSibling();
+ }
+
+ // parse the real part
+ try {
+ Integer real = Integer.parseInt(re);
+ } catch (NumberFormatException e) {
+ try {
+ Float real = Float.parseFloat(re);
+ } catch (NumberFormatException e2) {
+ throw new WCPSException("Could not parse float or integer "
+ + "number for real part of complex number:" + re);
+ }
+ }
+ // parse the imaginary part
+ try {
+ Integer imag = Integer.parseInt(im);
+ } catch (NumberFormatException e) {
+ try {
+ Float imag = Float.parseFloat(im);
+ } catch (NumberFormatException e2) {
+ throw new WCPSException("Could not parse float or integer "
+ + "number for imaginary part of complex number" + im);
+ }
+ }
+ }
+
+ public String toRasQL() {
+ return "complex ( " + re + ", " + im + " ) ";
+ }
+}
diff --git a/petascope/src/petascope/wcps/server/core/CondenseOperation.java b/petascope/src/petascope/wcps/server/core/CondenseOperation.java
index ec955f5..3e5c040 100644
--- a/petascope/src/petascope/wcps/server/core/CondenseOperation.java
+++ b/petascope/src/petascope/wcps/server/core/CondenseOperation.java
@@ -14,61 +14,60 @@
* 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 org.w3c.dom.*;
-
-public class CondenseOperation implements IRasNode {
-
- private String name;
-
- public CondenseOperation(Node node, XmlQuery xq) throws WCPSException {
- while ((node != null) && node.getNodeName().equals("#text")) {
- node = node.getNextSibling();
- }
-
- System.err.println("Parsing condense Operation: " + node.getNodeName());
-
- String text = node.getNodeName();
- this.name = formatOperation(text);
-
- if (name == null) {
- throw new WCPSException("Unknown condense operation: " + text);
- }
- }
-
- private String formatOperation(String name) {
- String shortOp = null;
- if (name.equals("opPlus")) {
- shortOp = "+";
- }
- if (name.equals("opMult")) {
- shortOp = "*";
- }
- if (name.equals("opMin")) {
- shortOp = "min";
- }
- if (name.equals("opMax")) {
- shortOp = "max";
- }
- if (name.equals("opAnd")) {
- shortOp = "and";
- }
- if (name.equals("opOr")) {
- shortOp = "or";
- }
-
- return shortOp;
- }
-
- public String toRasQL() {
- return name;
- }
-}
+package petascope.wcps.server.core;
+
+import petascope.exceptions.WCPSException;
+import org.w3c.dom.*;
+
+public class CondenseOperation implements IRasNode {
+
+ private String name;
+
+ public CondenseOperation(Node node, XmlQuery xq) throws WCPSException {
+ while ((node != null) && node.getNodeName().equals("#text")) {
+ node = node.getNextSibling();
+ }
+
+ System.err.println("Parsing condense Operation: " + node.getNodeName());
+
+ String text = node.getNodeName();
+ this.name = formatOperation(text);
+
+ if (name == null) {
+ throw new WCPSException("Unknown condense operation: " + text);
+ }
+ }
+
+ private String formatOperation(String name) {
+ String shortOp = null;
+ if (name.equals("opPlus")) {
+ shortOp = "+";
+ }
+ if (name.equals("opMult")) {
+ shortOp = "*";
+ }
+ if (name.equals("opMin")) {
+ shortOp = "min";
+ }
+ if (name.equals("opMax")) {
+ shortOp = "max";
+ }
+ if (name.equals("opAnd")) {
+ shortOp = "and";
+ }
+ if (name.equals("opOr")) {
+ shortOp = "or";
+ }
+
+ return shortOp;
+ }
+
+ public String toRasQL() {
+ return name;
+ }
+}
diff --git a/petascope/src/petascope/wcps/server/core/CondenseScalarExpr.java b/petascope/src/petascope/wcps/server/core/CondenseScalarExpr.java
index 14c2c91..54e7ceb 100644
--- a/petascope/src/petascope/wcps/server/core/CondenseScalarExpr.java
+++ b/petascope/src/petascope/wcps/server/core/CondenseScalarExpr.java
@@ -14,86 +14,84 @@
* 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.InvalidCrsException;
-import petascope.wcps.server.exceptions.WCPSException;
-import java.util.Vector;
-import org.w3c.dom.*;
-
-public class CondenseScalarExpr implements IRasNode {
-
- private CondenseOperation op;
- private Vector<AxisIterator> iterators;
- private IRasNode using;
- private IRasNode where;
- private String axisIteratorString;
- private String newIteratorName;
-
- public CondenseScalarExpr(Node node, XmlQuery xq) throws WCPSException, InvalidCrsException {
- if (node.getNodeName().equals("condense")) {
- node = node.getFirstChild();
- }
- while ((node != null) && node.getNodeName().equals("#text")) {
- node = node.getNextSibling();
- }
-
- iterators = new Vector();
- newIteratorName = xq.registerNewExpressionWithVariables();
- System.err.println("Parsing Condense Scalar Expression: " + node.getNodeName());
-
- while (node != null) {
- String name = node.getNodeName();
- if (op == null) {
- op = new CondenseOperation(node, xq);
- } else if (name.equals("iterator")) {
- AxisIterator it = new AxisIterator(node.getFirstChild(), xq, newIteratorName);
- iterators.add(it);
- } else if (name.equals("where")) {
- where = new BooleanScalarExpr(node.getFirstChild(), xq);
- } else {
- using = new CoverageExpr(node, xq);
- }
-
- node = node.getNextSibling();
- while ((node != null) && node.getNodeName().equals("#text")) {
- node = node.getNextSibling();
- }
- }
-
- buildAxisIteratorDomain();
- }
-
- public String toRasQL() {
- String result = "condense " + op.toRasQL() + " over ";
- result += axisIteratorString;
- if (where != null) {
- result += where.toRasQL();
- }
- result += " using " + using.toRasQL();
- return result;
- }
-
- /* Concatenates all the AxisIterators into one large multi-dimensional object,
- * that will be used to build to RasQL query */
- private void buildAxisIteratorDomain() {
- axisIteratorString = "";
- axisIteratorString += newIteratorName + " in [";
-
- for (int i = 0; i < iterators.size(); i++) {
- if (i > 0) {
- axisIteratorString += ", ";
- }
- AxisIterator ai = iterators.elementAt(i);
- axisIteratorString += ai.getInterval();
- }
-
- axisIteratorString += "]";
- }
-}
+package petascope.wcps.server.core;
+
+import petascope.exceptions.WCPSException;
+import java.util.Vector;
+import org.w3c.dom.*;
+
+public class CondenseScalarExpr implements IRasNode {
+
+ private CondenseOperation op;
+ private Vector<AxisIterator> iterators;
+ private IRasNode using;
+ private IRasNode where;
+ private String axisIteratorString;
+ private String newIteratorName;
+
+ public CondenseScalarExpr(Node node, XmlQuery xq) throws WCPSException {
+ if (node.getNodeName().equals("condense")) {
+ node = node.getFirstChild();
+ }
+ while ((node != null) && node.getNodeName().equals("#text")) {
+ node = node.getNextSibling();
+ }
+
+ iterators = new Vector();
+ newIteratorName = xq.registerNewExpressionWithVariables();
+ System.err.println("Parsing Condense Scalar Expression: " + node.getNodeName());
+
+ while (node != null) {
+ String name = node.getNodeName();
+ if (op == null) {
+ op = new CondenseOperation(node, xq);
+ } else if (name.equals("iterator")) {
+ AxisIterator it = new AxisIterator(node.getFirstChild(), xq, newIteratorName);
+ iterators.add(it);
+ } else if (name.equals("where")) {
+ where = new BooleanScalarExpr(node.getFirstChild(), xq);
+ } else {
+ using = new CoverageExpr(node, xq);
+ }
+
+ node = node.getNextSibling();
+ while ((node != null) && node.getNodeName().equals("#text")) {
+ node = node.getNextSibling();
+ }
+ }
+
+ buildAxisIteratorDomain();
+ }
+
+ public String toRasQL() {
+ String result = "condense " + op.toRasQL() + " over ";
+ result += axisIteratorString;
+ if (where != null) {
+ result += where.toRasQL();
+ }
+ result += " using " + using.toRasQL();
+ return result;
+ }
+
+ /* Concatenates all the AxisIterators into one large multi-dimensional object,
+ * that will be used to build to RasQL query */
+ private void buildAxisIteratorDomain() {
+ axisIteratorString = "";
+ axisIteratorString += newIteratorName + " in [";
+
+ for (int i = 0; i < iterators.size(); i++) {
+ if (i > 0) {
+ axisIteratorString += ", ";
+ }
+ AxisIterator ai = iterators.elementAt(i);
+ axisIteratorString += ai.getInterval();
+ }
+
+ axisIteratorString += "]";
+ }
+}
diff --git a/petascope/src/petascope/wcps/server/core/ConstantCoverageExpr.java b/petascope/src/petascope/wcps/server/core/ConstantCoverageExpr.java
index c9d57fa..32ac118 100644
--- a/petascope/src/petascope/wcps/server/core/ConstantCoverageExpr.java
+++ b/petascope/src/petascope/wcps/server/core/ConstantCoverageExpr.java
@@ -14,152 +14,150 @@
* 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.InvalidCrsException;
-import petascope.wcps.server.exceptions.WCPSException;
-import petascope.wcps.server.exceptions.InvalidMetadataException;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Vector;
-import org.w3c.dom.*;
-
-public class ConstantCoverageExpr implements IRasNode, ICoverageInfo {
-
- private String covName;
- private Vector<AxisIterator> iterators;
- private ConstantList valueList;
- private CoverageInfo info;
- private String axisIteratorString;
- private int requiredListSize = 1;
-
- public ConstantCoverageExpr(Node node, XmlQuery xq)
- throws WCPSException, InvalidCrsException {
- while ((node != null) && node.getNodeName().equals("#text")) {
- node = node.getNextSibling();
- }
-
- iterators = new Vector();
- System.err.println("Parsing Constant Coverage Expr: " + node.getNodeName());
-
- while (node != null) {
- String name = node.getNodeName();
- if (name.equals("name")) {
- covName = node.getTextContent();
- } else if (name.equals("axisIterator")) {
- AxisIterator it = new AxisIterator(node.getFirstChild(), xq, "temp");
- iterators.add(it);
- } else {
- valueList = new ConstantList(node, xq);
- node = valueList.getLastNode();
- }
-
- node = node.getNextSibling();
- while ((node != null) && node.getNodeName().equals("#text")) {
- node = node.getNextSibling();
- }
- }
-
- buildMetadata(xq);
- buildAxisIteratorDomain();
-
- // Sanity check: dimensions should match number of constants in the list
- if (valueList.getSize() != requiredListSize) {
- throw new WCPSException("The number of constants in the list do "
- + "not match the dimensions specified !");
- }
- // Sanity check: metadata should have already been build
- if (info == null) {
- throw new WCPSException("Could not build constant coverage metadata !!!");
- }
- }
-
- public String toRasQL() {
- String result = "< ";
- result += axisIteratorString + " ";
- result += valueList.toRasQL();
- result += ">";
-
- return result;
- }
-
- public CoverageInfo getCoverageInfo() {
- return info;
- }
-
- /* Concatenates all the AxisIterators into one large multi-dimensional object,
- * that will be used to build to RasQL query. Also counts how many elements
- * fit in the specified dimensions. */
- private void buildAxisIteratorDomain() {
- requiredListSize = 1;
- axisIteratorString = "";
- axisIteratorString += "[";
-
- for (int i = 0; i < iterators.size(); i++) {
- if (i > 0) {
- axisIteratorString += ", ";
- }
- AxisIterator ai = iterators.elementAt(i);
- axisIteratorString += ai.getInterval();
- requiredListSize *= (ai.getHigh().intValue() - ai.getLow().intValue() + 1);
- }
-
- axisIteratorString += "]";
-
- System.err.println("Axes for ConstantCoverage tell us that the constant"
- + "list should have exactly " + requiredListSize + " elements !");
- }
-
- /** Builds full metadata for the newly constructed coverage **/
- private void buildMetadata(XmlQuery xq) throws WCPSException {
- List<CellDomainElement> cellDomainList = new LinkedList<CellDomainElement>();
- List<RangeElement> rangeList = new LinkedList<RangeElement>();
- HashSet<String> nullSet = new HashSet<String>();
- String nullDefault = "0";
- nullSet.add(nullDefault);
- HashSet<InterpolationMethod> interpolationSet = new HashSet<InterpolationMethod>();
- InterpolationMethod interpolationDefault = new InterpolationMethod("none", "none");
- interpolationSet.add(interpolationDefault);
- String coverageName = covName;
- List<DomainElement> domainList = new LinkedList<DomainElement>();
-
- Iterator<AxisIterator> i = iterators.iterator();
- while (i.hasNext()) {
- // Build domain metadata
- AxisIterator ai = i.next();
- cellDomainList.add(new CellDomainElement(ai.getLow(), ai.getHigh()));
- String axisName = ai.getVar();
- String axisType = ai.getAxisType();
- String crs = DomainElement.WGS84_CRS;
- HashSet<String> crsset = new HashSet<String>();
- crsset.add(crs);
- DomainElement domain = new DomainElement(axisName, axisType,
- ai.getLow().doubleValue(), ai.getHigh().doubleValue(),
- null, null, crsset, xq.getMetadataSource().getAxisNames());
- domainList.add(domain);
- }
- // TODO: check element datatypes and their consistency
- // "unsigned int" is default datatype
- rangeList.add(new RangeElement("dynamic_type", "unsigned int"));
-
- try {
- Metadata metadata = new Metadata(cellDomainList, rangeList, nullSet,
- nullDefault, interpolationSet, interpolationDefault,
- coverageName, domainList, null);
- // Let the top-level query know the full metadata about us
- xq.getMetadataSource().addDynamicMetadata(covName, metadata);
- info = new CoverageInfo(metadata);
- } catch (InvalidMetadataException e) {
- throw new WCPSException("Could not build coverage '" + covName
- + "' metadata !", e);
- }
- }
-}
+package petascope.wcps.server.core;
+
+import petascope.core.Metadata;
+import petascope.exceptions.PetascopeException;
+import petascope.exceptions.WCPSException;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Vector;
+import org.w3c.dom.*;
+
+public class ConstantCoverageExpr implements IRasNode, ICoverageInfo {
+
+ private String covName;
+ private Vector<AxisIterator> iterators;
+ private ConstantList valueList;
+ private CoverageInfo info;
+ private String axisIteratorString;
+ private int requiredListSize = 1;
+
+ public ConstantCoverageExpr(Node node, XmlQuery xq)
+ throws WCPSException {
+ while ((node != null) && node.getNodeName().equals("#text")) {
+ node = node.getNextSibling();
+ }
+
+ iterators = new Vector();
+ System.err.println("Parsing Constant Coverage Expr: " + node.getNodeName());
+
+ while (node != null) {
+ String name = node.getNodeName();
+ if (name.equals("name")) {
+ covName = node.getTextContent();
+ } else if (name.equals("axisIterator")) {
+ AxisIterator it = new AxisIterator(node.getFirstChild(), xq, "temp");
+ iterators.add(it);
+ } else {
+ valueList = new ConstantList(node, xq);
+ node = valueList.getLastNode();
+ }
+
+ node = node.getNextSibling();
+ while ((node != null) && node.getNodeName().equals("#text")) {
+ node = node.getNextSibling();
+ }
+ }
+
+ try {
+ buildMetadata(xq);
+ } catch (PetascopeException ex) {
+ throw new WCPSException("Cannot build coverage metadata !!!");
+ }
+ buildAxisIteratorDomain();
+
+ // Sanity check: dimensions should match number of constants in the list
+ if (valueList.getSize() != requiredListSize) {
+ throw new WCPSException("The number of constants in the list do "
+ + "not match the dimensions specified !");
+ }
+ // Sanity check: metadata should have already been build
+ if (info == null) {
+ throw new WCPSException("Could not build constant coverage metadata !!!");
+ }
+ }
+
+ public String toRasQL() {
+ String result = "< ";
+ result += axisIteratorString + " ";
+ result += valueList.toRasQL();
+ result += ">";
+
+ return result;
+ }
+
+ public CoverageInfo getCoverageInfo() {
+ return info;
+ }
+
+ /* Concatenates all the AxisIterators into one large multi-dimensional object,
+ * that will be used to build to RasQL query. Also counts how many elements
+ * fit in the specified dimensions. */
+ private void buildAxisIteratorDomain() {
+ requiredListSize = 1;
+ axisIteratorString = "";
+ axisIteratorString += "[";
+
+ for (int i = 0; i < iterators.size(); i++) {
+ if (i > 0) {
+ axisIteratorString += ", ";
+ }
+ AxisIterator ai = iterators.elementAt(i);
+ axisIteratorString += ai.getInterval();
+ requiredListSize *= (ai.getHigh().intValue() - ai.getLow().intValue() + 1);
+ }
+
+ axisIteratorString += "]";
+
+ System.err.println("Axes for ConstantCoverage tell us that the constant"
+ + "list should have exactly " + requiredListSize + " elements !");
+ }
+
+ /** Builds full metadata for the newly constructed coverage **/
+ private void buildMetadata(XmlQuery xq) throws WCPSException, PetascopeException {
+ List<CellDomainElement> cellDomainList = new LinkedList<CellDomainElement>();
+ List<RangeElement> rangeList = new LinkedList<RangeElement>();
+ HashSet<String> nullSet = new HashSet<String>();
+ String nullDefault = "0";
+ nullSet.add(nullDefault);
+ HashSet<InterpolationMethod> interpolationSet = new HashSet<InterpolationMethod>();
+ InterpolationMethod interpolationDefault = new InterpolationMethod("none", "none");
+ interpolationSet.add(interpolationDefault);
+ String coverageName = covName;
+ List<DomainElement> domainList = new LinkedList<DomainElement>();
+
+ Iterator<AxisIterator> i = iterators.iterator();
+ while (i.hasNext()) {
+ // Build domain metadata
+ AxisIterator ai = i.next();
+ cellDomainList.add(new CellDomainElement(ai.getLow(), ai.getHigh()));
+ String axisName = ai.getVar();
+ String axisType = ai.getAxisType();
+ String crs = DomainElement.WGS84_CRS;
+ HashSet<String> crsset = new HashSet<String>();
+ crsset.add(crs);
+ DomainElement domain = new DomainElement(axisName, axisType,
+ ai.getLow().doubleValue(), ai.getHigh().doubleValue(),
+ null, null, crsset, xq.getMetadataSource().getAxisNames(), null); // FIXME uom = null
+ domainList.add(domain);
+ }
+
+ // TODO: check element datatypes and their consistency
+ // "unsigned int" is default datatype
+ rangeList.add(new RangeElement("dynamic_type", "unsigned int", null));
+ Metadata metadata = new Metadata(cellDomainList, rangeList, nullSet,
+ nullDefault, interpolationSet, interpolationDefault,
+ coverageName, "GridCoverage", domainList, null); // FIXME
+ // Let the top-level query know the full metadata about us
+ xq.getMetadataSource().addDynamicMetadata(covName, metadata);
+ info = new CoverageInfo(metadata);
+ }
+}
diff --git a/petascope/src/petascope/wcps/server/core/ConstantList.java b/petascope/src/petascope/wcps/server/core/ConstantList.java
index 70cdde1..3fdb180 100644
--- a/petascope/src/petascope/wcps/server/core/ConstantList.java
+++ b/petascope/src/petascope/wcps/server/core/ConstantList.java
@@ -14,92 +14,91 @@
* 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.math.BigInteger;
-import java.util.ArrayList;
-import org.w3c.dom.*;
-
-public class ConstantList implements IRasNode {
-
- private ArrayList<String> list;
- private String val;
- private Node lastNode;
-
- public ConstantList(Node node, XmlQuery xq) throws WCPSException {
- list = new ArrayList<String>();
-
- while ((node != null) && node.getNodeName().equals("#text")) {
- node = node.getNextSibling();
- }
- System.err.println("Trying to parse ConstantList ");
-
- while (node != null) {
- String nodeName = node.getNodeName();
-
- if (nodeName.equals("value")) {
- val = node.getTextContent();
- checkConstant(val);
- list.add(val);
- lastNode = node;
- } else {
- throw new WCPSException("Unknown node in ConstantList: " + nodeName);
- }
-
- node = node.getNextSibling();
- while ((node != null) && node.getNodeName().equals("#text")) {
- node = node.getNextSibling();
- }
- }
-
- System.err.println("Parsed constant list with " + list.size() + " elements !");
- }
-
- private void checkConstant(String val) throws WCPSException {
- boolean ok = false;
- try {
- Integer.parseInt(val);
- ok = true;
- } catch (NumberFormatException e1) {
- }
- try {
- Float.parseFloat(val);
- ok = true;
- } catch (NumberFormatException e2) {
- }
- try {
- new ComplexConstant(val);
- ok = true;
- } catch (WCPSException e1) {
- }
-
- if (ok == false) {
- throw new WCPSException("'" + val + "' is not an integer, float, or complex constant !");
- }
- }
-
- public String toRasQL() {
- String result = list.get(0);
- for (int i = 1; i < list.size(); i++) {
- result += ", " + list.get(i);
- }
- return result;
- }
-
- /** Size of all elements in the constant list **/
- public int getSize() {
- return list.size();
- }
-
- /** Return the last node of the constant list. **/
- public Node getLastNode() {
- return lastNode;
- }
-}
+package petascope.wcps.server.core;
+
+import petascope.exceptions.WCPSException;
+import java.math.BigInteger;
+import java.util.ArrayList;
+import org.w3c.dom.*;
+
+public class ConstantList implements IRasNode {
+
+ private ArrayList<String> list;
+ private String val;
+ private Node lastNode;
+
+ public ConstantList(Node node, XmlQuery xq) throws WCPSException {
+ list = new ArrayList<String>();
+
+ while ((node != null) && node.getNodeName().equals("#text")) {
+ node = node.getNextSibling();
+ }
+ System.err.println("Trying to parse ConstantList ");
+
+ while (node != null) {
+ String nodeName = node.getNodeName();
+
+ if (nodeName.equals("value")) {
+ val = node.getTextContent();
+ checkConstant(val);
+ list.add(val);
+ lastNode = node;
+ } else {
+ throw new WCPSException("Unknown node in ConstantList: " + nodeName);
+ }
+
+ node = node.getNextSibling();
+ while ((node != null) && node.getNodeName().equals("#text")) {
+ node = node.getNextSibling();
+ }
+ }
+
+ System.err.println("Parsed constant list with " + list.size() + " elements !");
+ }
+
+ private void checkConstant(String val) throws WCPSException {
+ boolean ok = false;
+ try {
+ Integer.parseInt(val);
+ ok = true;
+ } catch (NumberFormatException e1) {
+ }
+ try {
+ Float.parseFloat(val);
+ ok = true;
+ } catch (NumberFormatException e2) {
+ }
+ try {
+ new ComplexConstant(val);
+ ok = true;
+ } catch (WCPSException e1) {
+ }
+
+ if (ok == false) {
+ throw new WCPSException("'" + val + "' is not an integer, float, or complex constant !");
+ }
+ }
+
+ public String toRasQL() {
+ String result = list.get(0);
+ for (int i = 1; i < list.size(); i++) {
+ result += ", " + list.get(i);
+ }
+ return result;
+ }
+
+ /** Size of all elements in the constant list **/
+ public int getSize() {
+ return list.size();
+ }
+
+ /** Return the last node of the constant list. **/
+ public Node getLastNode() {
+ return lastNode;
+ }
+}
diff --git a/petascope/src/petascope/wcps/server/core/ConstructCoverageExpr.java b/petascope/src/petascope/wcps/server/core/ConstructCoverageExpr.java
index 2d3be92..b3b8e46 100644
--- a/petascope/src/petascope/wcps/server/core/ConstructCoverageExpr.java
+++ b/petascope/src/petascope/wcps/server/core/ConstructCoverageExpr.java
@@ -14,149 +14,149 @@
* 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.InvalidCrsException;
-import petascope.wcps.server.exceptions.WCPSException;
-import petascope.wcps.server.exceptions.InvalidMetadataException;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Vector;
-import org.w3c.dom.*;
-
-public class ConstructCoverageExpr implements IRasNode, ICoverageInfo {
-
- private String covName;
- private Vector<AxisIterator> iterators;
- private IRasNode values;
- private CoverageInfo info;
- private String axisIteratorString;
- private String newIteratorName;
-
- public ConstructCoverageExpr(Node node, XmlQuery xq)
- throws WCPSException, InvalidCrsException {
- while ((node != null) && node.getNodeName().equals("#text")) {
- node = node.getNextSibling();
- }
-
- iterators = new Vector();
- System.err.println("Parsing Construct Coverage Expr: " + node.getNodeName());
- newIteratorName = xq.registerNewExpressionWithVariables();
-
- while (node != null) {
- String name = node.getNodeName();
- if (name.equals("name")) {
- covName = node.getTextContent();
- } else if (name.equals("axisIterator")) {
- AxisIterator it = new AxisIterator(node.getFirstChild(), xq, newIteratorName);
- iterators.add(it);
- // Top level structures need to know about these iterators
- CoverageIterator dyn = new CoverageIterator(it.getVar(), covName);
- xq.addDynamicCoverageIterator(dyn);
- } else {
- /* The iterator is probably used in the "values" section,
- * so send the iterator to the top-level query */
- if (covName != null && iterators.size() > 0) {
- buildMetadata(xq);
- } else {
- throw new WCPSException("Cannot build coverage metadata !!!");
- }
- // And only then start parsing the "values" section
- values = new ScalarExpr(node, xq);
- }
-
- node = node.getNextSibling();
- while ((node != null) && node.getNodeName().equals("#text")) {
- node = node.getNextSibling();
- }
- }
-
- buildAxisIteratorDomain();
-
- // Sanity check: metadata should have already been build
- if (info == null) {
- throw new WCPSException("Could not build coverage metadata !!!");
- }
- }
-
- public String toRasQL() {
- String result = "marray ";
- result += axisIteratorString;
- result += " values " + values.toRasQL();
-
- return result;
- }
-
- public CoverageInfo getCoverageInfo() {
- return info;
- }
-
- /* Concatenates all the AxisIterators into one large multi-dimensional object,
- * that will be used to build to RasQL query */
- private void buildAxisIteratorDomain() {
- axisIteratorString = "";
- axisIteratorString += newIteratorName + " in [";
-
- for (int i = 0; i < iterators.size(); i++) {
- if (i > 0) {
- axisIteratorString += ", ";
- }
- AxisIterator ai = iterators.elementAt(i);
- axisIteratorString += ai.getInterval();
- }
-
- axisIteratorString += "]";
- }
-
- /** Builds full metadata for the newly constructed coverage **/
- private void buildMetadata(XmlQuery xq) throws WCPSException {
- List<CellDomainElement> cellDomainList = new LinkedList<CellDomainElement>();
- List<RangeElement> rangeList = new LinkedList<RangeElement>();
- HashSet<String> nullSet = new HashSet<String>();
- String nullDefault = "0";
- nullSet.add(nullDefault);
- HashSet<InterpolationMethod> interpolationSet = new HashSet<InterpolationMethod>();
- InterpolationMethod interpolationDefault = new InterpolationMethod("none", "none");
- interpolationSet.add(interpolationDefault);
- String coverageName = covName;
- List<DomainElement> domainList = new LinkedList<DomainElement>();
-
- Iterator<AxisIterator> i = iterators.iterator();
- while (i.hasNext()) {
- // Build domain metadata
- AxisIterator ai = i.next();
- cellDomainList.add(new CellDomainElement(ai.getLow(), ai.getHigh()));
- String axisName = ai.getVar();
- String axisType = ai.getAxisType();
- String crs = DomainElement.WGS84_CRS;
- HashSet<String> crsset = new HashSet<String>();
- crsset.add(crs);
- DomainElement domain = new DomainElement(axisName, axisType,
- ai.getLow().doubleValue(), ai.getHigh().doubleValue(),
- null, null, crsset, xq.getMetadataSource().getAxisNames());
- domainList.add(domain);
- }
- // "unsigned int" is default datatype
- rangeList.add(new RangeElement("dynamic_type", "unsigned int"));
-
- try {
- Metadata metadata = new Metadata(cellDomainList, rangeList, nullSet,
- nullDefault, interpolationSet, interpolationDefault,
- coverageName, domainList, null);
- // Let the top-level query know the full metadata about us
- xq.getMetadataSource().addDynamicMetadata(covName, metadata);
- info = new CoverageInfo(metadata);
- } catch (InvalidMetadataException e) {
- throw new WCPSException("Could not build coverage '" + covName
- + "' metadata !", e);
- }
- }
-}
+package petascope.wcps.server.core;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import petascope.core.Metadata;
+import petascope.exceptions.PetascopeException;
+import petascope.exceptions.WCPSException;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Vector;
+import org.w3c.dom.*;
+
+public class ConstructCoverageExpr implements IRasNode, ICoverageInfo {
+
+ private String covName;
+ private Vector<AxisIterator> iterators;
+ private IRasNode values;
+ private CoverageInfo info;
+ private String axisIteratorString;
+ private String newIteratorName;
+
+ public ConstructCoverageExpr(Node node, XmlQuery xq)
+ throws WCPSException {
+ while ((node != null) && node.getNodeName().equals("#text")) {
+ node = node.getNextSibling();
+ }
+
+ iterators = new Vector();
+ System.err.println("Parsing Construct Coverage Expr: " + node.getNodeName());
+ newIteratorName = xq.registerNewExpressionWithVariables();
+
+ while (node != null) {
+ String name = node.getNodeName();
+ if (name.equals("name")) {
+ covName = node.getTextContent();
+ } else if (name.equals("axisIterator")) {
+ AxisIterator it = new AxisIterator(node.getFirstChild(), xq, newIteratorName);
+ iterators.add(it);
+ // Top level structures need to know about these iterators
+ CoverageIterator dyn = new CoverageIterator(it.getVar(), covName);
+ xq.addDynamicCoverageIterator(dyn);
+ } else {
+ /* The iterator is probably used in the "values" section,
+ * so send the iterator to the top-level query */
+ if (covName != null && iterators.size() > 0) {
+ try {
+ buildMetadata(xq);
+ } catch (PetascopeException ex) {
+ throw new WCPSException("Cannot build coverage metadata !!!");
+ }
+ } else {
+ throw new WCPSException("Cannot build coverage metadata !!!");
+ }
+ // And only then start parsing the "values" section
+ values = new ScalarExpr(node, xq);
+ }
+
+ node = node.getNextSibling();
+ while ((node != null) && node.getNodeName().equals("#text")) {
+ node = node.getNextSibling();
+ }
+ }
+
+ buildAxisIteratorDomain();
+
+ // Sanity check: metadata should have already been build
+ if (info == null) {
+ throw new WCPSException("Could not build coverage metadata !!!");
+ }
+ }
+
+ public String toRasQL() {
+ String result = "marray ";
+ result += axisIteratorString;
+ result += " values " + values.toRasQL();
+
+ return result;
+ }
+
+ public CoverageInfo getCoverageInfo() {
+ return info;
+ }
+
+ /* Concatenates all the AxisIterators into one large multi-dimensional object,
+ * that will be used to build to RasQL query */
+ private void buildAxisIteratorDomain() {
+ axisIteratorString = "";
+ axisIteratorString += newIteratorName + " in [";
+
+ for (int i = 0; i < iterators.size(); i++) {
+ if (i > 0) {
+ axisIteratorString += ", ";
+ }
+ AxisIterator ai = iterators.elementAt(i);
+ axisIteratorString += ai.getInterval();
+ }
+
+ axisIteratorString += "]";
+ }
+
+ /** Builds full metadata for the newly constructed coverage **/
+ private void buildMetadata(XmlQuery xq) throws WCPSException, PetascopeException {
+ List<CellDomainElement> cellDomainList = new LinkedList<CellDomainElement>();
+ List<RangeElement> rangeList = new LinkedList<RangeElement>();
+ HashSet<String> nullSet = new HashSet<String>();
+ String nullDefault = "0";
+ nullSet.add(nullDefault);
+ HashSet<InterpolationMethod> interpolationSet = new HashSet<InterpolationMethod>();
+ InterpolationMethod interpolationDefault = new InterpolationMethod("none", "none");
+ interpolationSet.add(interpolationDefault);
+ String coverageName = covName;
+ List<DomainElement> domainList = new LinkedList<DomainElement>();
+
+ Iterator<AxisIterator> i = iterators.iterator();
+ while (i.hasNext()) {
+ // Build domain metadata
+ AxisIterator ai = i.next();
+ cellDomainList.add(new CellDomainElement(ai.getLow(), ai.getHigh()));
+ String axisName = ai.getVar();
+ String axisType = ai.getAxisType();
+ String crs = DomainElement.WGS84_CRS;
+ HashSet<String> crsset = new HashSet<String>();
+ crsset.add(crs);
+ DomainElement domain = new DomainElement(axisName, axisType,
+ ai.getLow().doubleValue(), ai.getHigh().doubleValue(),
+ null, null, crsset, xq.getMetadataSource().getAxisNames(), null); // FIXME uom = null
+ domainList.add(domain);
+ }
+
+ // "unsigned int" is default datatype
+ rangeList.add(new RangeElement("dynamic_type", "unsigned int", null));
+ Metadata metadata = new Metadata(cellDomainList, rangeList, nullSet,
+ nullDefault, interpolationSet, interpolationDefault,
+ coverageName, "GridCoverage", domainList, null); // FIXME
+ // Let the top-level query know the full metadata about us
+ xq.getMetadataSource().addDynamicMetadata(covName, metadata);
+ info = new CoverageInfo(metadata);
+ }
+}
diff --git a/petascope/src/petascope/wcps/server/core/CoverageExpr.java b/petascope/src/petascope/wcps/server/core/CoverageExpr.java
index da8b628..00c2df8 100644
--- a/petascope/src/petascope/wcps/server/core/CoverageExpr.java
+++ b/petascope/src/petascope/wcps/server/core/CoverageExpr.java
@@ -14,167 +14,168 @@
* 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.InvalidCrsException;
-import petascope.wcps.server.exceptions.WCPSException;
-import org.w3c.dom.*;
-
-import java.util.Iterator;
-
-public class CoverageExpr implements IRasNode, ICoverageInfo {
-
- private IRasNode child;
- private String childInfo;
- private CoverageInfo info;
- private boolean scalarExpr = false;
-// private String var;
- private boolean simpleCoverage; // True is the coverage is just a string
-
- public CoverageExpr(Node node, XmlQuery xq) throws WCPSException, InvalidCrsException {
- while ((node != null) && node.getNodeName().equals("#text")) {
- node = node.getNextSibling();
- }
-
- if (node == null) {
- throw new WCPSException("CoverageExprType parsing error!");
- }
-
- String nodeName = node.getNodeName();
-
- simpleCoverage = false;
- System.err.println("CoverageExprType: node " + nodeName);
-
- if (nodeName.equals("coverage")) {
- simpleCoverage = true;
- childInfo = node.getFirstChild().getNodeValue();
-
- if (!xq.isIteratorDefined(childInfo)) {
- throw new WCPSException("Iterator " + childInfo + " not defined!");
- }
-
- Iterator<String> coverages = xq.getCoverages(childInfo);
-
- info = new CoverageInfo(xq.getMetadataSource().read(coverages.next()));
-
- while (coverages.hasNext()) { // Check if all the coverages are compatible
- CoverageInfo tmp = new CoverageInfo(
- xq.getMetadataSource().read(
- coverages.next()));
-
- if (!tmp.isCompatible(info)) {
- throw new WCPSException(
- "Incompatible coverages within the same iterator");
- }
- }
-
- System.err.println("Found simple coverage definition: " + childInfo + ", "
- + info.toString());
- } else if (nodeName.equals("crsTransform")) {
- // TODO: implement CrsTransform class
- child = new CrsTransformCoverageExpr(node, xq);
- } else if (nodeName.equals("scale")) {
- // TODO: implement class ScaleCoverageExprType
- child = new ScaleCoverageExpr(node, xq);
- } else if (nodeName.equals("construct")) {
- child = new ConstructCoverageExpr(node.getFirstChild(), xq);
- } else if (nodeName.equals("const")) {
- child = new ConstantCoverageExpr(node.getFirstChild(), xq);
- } // else if (nodeName.equals("variableRef"))
- // {
- // child = new VariableReference(node, xq);
- // }
- else { // Try one of the groups
- child = null;
-
- if (child == null) {
- try {
- child = new SetMetadataCoverageExpr(node, xq);
- System.err.println("Matched set metadata operation.");
- } catch (WCPSException e) {
- System.err.println("Failed to match set metadata operation: "
- + e.toString() + "\nRetrying");
- child = null;
- }
- }
-
- if (child == null) {
- try {
- child = new InducedOperationCoverageExpr(node, xq);
- System.err.println("Matched induced coverage expression operation.");
- } catch (WCPSException e) {
- System.err.println("Failed to match induced coverage expression operation: "
- + e.toString() + "\nRetrying");
- child = null;
- if (e.getMessage().equals("Method not implemented")) {
- throw e;
- }
- }
- }
-
- if (child == null) {
- try {
- child = new SubsetOperationCoverageExpr(node, xq);
- System.err.println("Matched subset operation.");
- } catch (WCPSException e) {
- System.err.println("Failed to match subset operation: "
- + "\nRetrying");
- child = null;
- }
- }
-
- if (child == null) {
- try {
- child = new ScalarExpr(node, xq);
- this.scalarExpr = true;
- System.err.println("Matched scalar expression.");
- } catch (WCPSException e) {
- System.err.println("Failed to match scalar expression: "
- + "\nRetrying");
- child = null;
- }
- }
- }
-
- if (!simpleCoverage && (child == null)) {
- throw new WCPSException("Invalid coverage Expression, next node: "
- + node.getNodeName());
- }
-
- if (info == null) {
- System.err.println(node.getNodeName());
- info = new CoverageInfo(((ICoverageInfo) child).getCoverageInfo());
- }
- }
-
- public CoverageInfo getCoverageInfo() {
- return info;
- }
-
- public boolean isScalarExpr()
- {
- return scalarExpr;
- }
-
- public ScalarExpr getScalarExpr()
- {
- ScalarExpr r = null;
- if (scalarExpr)
- r = (ScalarExpr) child;
- return r;
- }
-
- public String toRasQL() {
- if (simpleCoverage) {
- return childInfo;
- } else {
- return child.toRasQL();
- }
- }
-};
+package petascope.wcps.server.core;
+
+import petascope.exceptions.WCPSException;
+import org.w3c.dom.*;
+import java.util.Iterator;
+
+public class CoverageExpr implements IRasNode, ICoverageInfo {
+
+ private IRasNode child;
+ private String childInfo;
+ private CoverageInfo info;
+ private boolean scalarExpr = false;
+// private String var;
+ private boolean simpleCoverage; // True is the coverage is just a string
+
+ public CoverageExpr(Node node, XmlQuery xq) throws WCPSException {
+ while ((node != null) && node.getNodeName().equals("#text")) {
+ node = node.getNextSibling();
+ }
+
+ if (node == null) {
+ throw new WCPSException("CoverageExprType parsing error!");
+ }
+
+ String nodeName = node.getNodeName();
+
+ simpleCoverage = false;
+ System.err.println("CoverageExprType: node " + nodeName);
+
+ if (nodeName.equals("coverage")) {
+ simpleCoverage = true;
+ childInfo = node.getFirstChild().getNodeValue();
+
+ if (!xq.isIteratorDefined(childInfo)) {
+ throw new WCPSException("Iterator " + childInfo + " not defined!");
+ }
+
+ Iterator<String> coverages = xq.getCoverages(childInfo);
+
+ try {
+ info = new CoverageInfo(xq.getMetadataSource().read(coverages.next()));
+
+ while (coverages.hasNext()) { // Check if all the coverages are compatible
+ CoverageInfo tmp = new CoverageInfo(
+ xq.getMetadataSource().read(
+ coverages.next()));
+
+ if (!tmp.isCompatible(info)) {
+ throw new WCPSException(
+ "Incompatible coverages within the same iterator");
+ }
+ }
+ } catch (Exception ex) {
+ throw new WCPSException(ex.getMessage(), ex);
+ }
+
+ System.err.println("Found simple coverage definition: " + childInfo + ", "
+ + info.toString());
+ } else if (nodeName.equals("crsTransform")) {
+ // TODO: implement CrsTransform class
+ child = new CrsTransformCoverageExpr(node, xq);
+ } else if (nodeName.equals("scale")) {
+ // TODO: implement class ScaleCoverageExprType
+ child = new ScaleCoverageExpr(node, xq);
+ } else if (nodeName.equals("construct")) {
+ child = new ConstructCoverageExpr(node.getFirstChild(), xq);
+ } else if (nodeName.equals("const")) {
+ child = new ConstantCoverageExpr(node.getFirstChild(), xq);
+ } // else if (nodeName.equals("variableRef"))
+ // {
+ // child = new VariableReference(node, xq);
+ // }
+ else { // Try one of the groups
+ child = null;
+
+ if (child == null) {
+ try {
+ child = new SetMetadataCoverageExpr(node, xq);
+ System.err.println("Matched set metadata operation.");
+ } catch (WCPSException e) {
+ System.err.println("Failed to match set metadata operation: "
+ + e.toString() + "\nRetrying");
+ child = null;
+ }
+ }
+
+ if (child == null) {
+ try {
+ child = new InducedOperationCoverageExpr(node, xq);
+ System.err.println("Matched induced coverage expression operation.");
+ } catch (WCPSException e) {
+ System.err.println("Failed to match induced coverage expression operation: "
+ + e.toString() + "\nRetrying");
+ child = null;
+ if (e.getMessage().equals("Method not implemented")) {
+ throw e;
+ }
+ }
+ }
+
+ if (child == null) {
+ try {
+ child = new SubsetOperationCoverageExpr(node, xq);
+ System.err.println("Matched subset operation.");
+ } catch (WCPSException e) {
+ System.err.println("Failed to match subset operation: "
+ + "\nRetrying");
+ child = null;
+ }
+ }
+
+ if (child == null) {
+ try {
+ child = new ScalarExpr(node, xq);
+ this.scalarExpr = true;
+ System.err.println("Matched scalar expression.");
+ } catch (WCPSException e) {
+ System.err.println("Failed to match scalar expression: "
+ + "\nRetrying");
+ child = null;
+ }
+ }
+ }
+
+ if (!simpleCoverage && (child == null)) {
+ throw new WCPSException("Invalid coverage Expression, next node: "
+ + node.getNodeName());
+ }
+
+ if (info == null) {
+ System.err.println(node.getNodeName());
+ info = new CoverageInfo(((ICoverageInfo) child).getCoverageInfo());
+ }
+ }
+
+ public CoverageInfo getCoverageInfo() {
+ return info;
+ }
+
+ public boolean isScalarExpr()
+ {
+ return scalarExpr;
+ }
+
+ public ScalarExpr getScalarExpr()
+ {
+ ScalarExpr r = null;
+ if (scalarExpr)
+ r = (ScalarExpr) child;
+ return r;
+ }
+
+ public String toRasQL() {
+ if (simpleCoverage) {
+ return childInfo;
+ } else {
+ return child.toRasQL();
+ }
+ }
+};
diff --git a/petascope/src/petascope/wcps/server/core/CoverageExprPairType.java b/petascope/src/petascope/wcps/server/core/CoverageExprPairType.java
index 71bd0ff..a97dc1e 100644
--- a/petascope/src/petascope/wcps/server/core/CoverageExprPairType.java
+++ b/petascope/src/petascope/wcps/server/core/CoverageExprPairType.java
@@ -14,91 +14,89 @@
* 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.InvalidCrsException;
-import petascope.wcps.server.exceptions.WCPSException;
-import org.w3c.dom.*;
-
-public class CoverageExprPairType implements IRasNode, ICoverageInfo {
-
- private IRasNode first, second;
- private CoverageInfo info;
- private boolean ok = false;
-
- public CoverageExprPairType(Node node, XmlQuery xq)
- throws WCPSException, InvalidCrsException {
- String nodeName = node.getNodeName();
-
- System.err.println("Trying to parse a coverage expression pair ... Starting at node "
- + nodeName);
-
- // Combination 1: CoverageExprType + ScalarExprType
- if (ok == false) {
- try {
- first = new CoverageExpr(node, xq);
- second = new ScalarExpr(node.getNextSibling(), xq);
- info = new CoverageInfo(((ICoverageInfo) first).getCoverageInfo());
- ok = true;
- } catch (WCPSException e) {
- System.err.println("Failed to parse CoverageExprType + ScalarExprType!");
- }
- }
-
- // Combination 2: ScalarExprType + CoverageExprType
- if (ok == false) {
- try {
- first = new ScalarExpr(node, xq);
- second = new CoverageExpr(node.getNextSibling(), xq);
- info = new CoverageInfo(((ICoverageInfo) second).getCoverageInfo());
- ok = true;
- } catch (WCPSException e) {
- System.err.println("Failed to parse ScalarExprType + CoverageExprType!");
- }
- }
-
- // Combination 3: CoverageExprType + CoverageExprType
- if (ok == false) {
- try {
- first = new CoverageExpr(node, xq);
- second = new CoverageExpr(node.getNextSibling(), xq);
- info = new CoverageInfo(((ICoverageInfo) first).getCoverageInfo());
- ok = true;
- } catch (WCPSException e) {
- System.err.println("Failed to parse a CoverageExprType + CoverageExprType!");
- }
- }
-
-
-
- if (ok == false) {
- throw new WCPSException("Could not parse a coverage expression pair !");
- }
- }
-
- public CoverageInfo getCoverageInfo() {
- return info;
- }
-
- public String toRasQL() {
- if (ok == true) {
- return first.toRasQL() + second.toRasQL();
- } else {
- return " error ";
- }
- }
-
- public IRasNode getFirst() {
- return first;
- }
-
- public IRasNode getSecond() {
- return second;
- }
-}
+package petascope.wcps.server.core;
+
+import petascope.exceptions.WCPSException;
+import org.w3c.dom.*;
+
+public class CoverageExprPairType implements IRasNode, ICoverageInfo {
+
+ private IRasNode first, second;
+ private CoverageInfo info;
+ private boolean ok = false;
+
+ public CoverageExprPairType(Node node, XmlQuery xq)
+ throws WCPSException {
+ String nodeName = node.getNodeName();
+
+ System.err.println("Trying to parse a coverage expression pair ... Starting at node "
+ + nodeName);
+
+ // Combination 1: CoverageExprType + ScalarExprType
+ if (ok == false) {
+ try {
+ first = new CoverageExpr(node, xq);
+ second = new ScalarExpr(node.getNextSibling(), xq);
+ info = new CoverageInfo(((ICoverageInfo) first).getCoverageInfo());
+ ok = true;
+ } catch (WCPSException e) {
+ System.err.println("Failed to parse CoverageExprType + ScalarExprType!");
+ }
+ }
+
+ // Combination 2: ScalarExprType + CoverageExprType
+ if (ok == false) {
+ try {
+ first = new ScalarExpr(node, xq);
+ second = new CoverageExpr(node.getNextSibling(), xq);
+ info = new CoverageInfo(((ICoverageInfo) second).getCoverageInfo());
+ ok = true;
+ } catch (WCPSException e) {
+ System.err.println("Failed to parse ScalarExprType + CoverageExprType!");
+ }
+ }
+
+ // Combination 3: CoverageExprType + CoverageExprType
+ if (ok == false) {
+ try {
+ first = new CoverageExpr(node, xq);
+ second = new CoverageExpr(node.getNextSibling(), xq);
+ info = new CoverageInfo(((ICoverageInfo) first).getCoverageInfo());
+ ok = true;
+ } catch (WCPSException e) {
+ System.err.println("Failed to parse a CoverageExprType + CoverageExprType!");
+ }
+ }
+
+
+
+ if (ok == false) {
+ throw new WCPSException("Could not parse a coverage expression pair !");
+ }
+ }
+
+ public CoverageInfo getCoverageInfo() {
+ return info;
+ }
+
+ public String toRasQL() {
+ if (ok == true) {
+ return first.toRasQL() + second.toRasQL();
+ } else {
+ return " error ";
+ }
+ }
+
+ public IRasNode getFirst() {
+ return first;
+ }
+
+ public IRasNode getSecond() {
+ return second;
+ }
+}
diff --git a/petascope/src/petascope/wcps/server/core/CoverageInfo.java b/petascope/src/petascope/wcps/server/core/CoverageInfo.java
index 93b99a2..b94b7cc 100644
--- a/petascope/src/petascope/wcps/server/core/CoverageInfo.java
+++ b/petascope/src/petascope/wcps/server/core/CoverageInfo.java
@@ -14,156 +14,156 @@
* 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.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-public class CoverageInfo {
-
- private List<CellDomainElement> cellDomains;
- private List<DomainElement> domains;
- private String coverageName;
-
- public CoverageInfo(CoverageInfo other) {
- cellDomains = new ArrayList<CellDomainElement>();
- domains = new ArrayList<DomainElement>();
- int N = other.getNumDimensions();
-
- for (int i = 0; i < N; ++i) {
- cellDomains.add(other.getCellDomainElement(i));
- domains.add(other.getDomainElement(i));
- }
-
- coverageName = other.getCoverageName();
- }
-
- public CoverageInfo(Metadata m) {
- cellDomains = new ArrayList<CellDomainElement>();
- domains = new ArrayList<DomainElement>();
- Iterator<CellDomainElement> itcde = m.getCellDomainIterator();
-
- while (itcde.hasNext()) {
- cellDomains.add(itcde.next());
- }
-
- Iterator<DomainElement> itde = m.getDomainIterator();
-
- while (itde.hasNext()) {
- domains.add(itde.next());
- }
-
- coverageName = m.getCoverageName();
- }
-
- public boolean isCompatible(CoverageInfo other) {
- if (getNumDimensions() != other.getNumDimensions()) {
- System.err.println("The number of dimensions doesn't match");
- return false;
- }
-
- {
- Iterator<CellDomainElement> it = cellDomains.iterator();
- int index = 0;
-
- while (it.hasNext()) {
- CellDomainElement me, you;
-
- me = it.next();
- you = other.getCellDomainElement(index++);
-
- if (!me.getHi().equals(you.getHi())) {
- System.err.println("High values don't match: "
- + me.getHi().toString() + ", "
- + you.getHi().toString());
- return false;
- }
-
- if (!me.getLo().equals(you.getLo())) {
- System.err.println("Low values don't match: "
- + me.getLo().toString() + ", "
- + you.getLo().toString());
- return false;
- }
- }
- }
- {
- Iterator<DomainElement> it = domains.iterator();
- int index = 0;
-
- while (it.hasNext()) {
- DomainElement me, you;
-
- me = it.next();
- you = other.getDomainElement(index++);
-
- if (!me.getName().equals(you.getName())) {
- System.err.println("Domain element names don't match: '"
- + me.getName() + "' and '"
- + you.getName() + "'.");
- return false;
- }
-
- // if (me.getName() != you.getName()) return false;
- }
- }
- return true;
- }
-
- int getNumDimensions() {
- return cellDomains.size();
- }
-
- public CellDomainElement getCellDomainElement(int dim) {
- return cellDomains.get(dim);
- }
-
- public DomainElement getDomainElement(int dim) {
- return domains.get(dim);
- }
-
- public String getCoverageName() {
- return coverageName;
- }
-
- public void removeDimension(int dim) {
- cellDomains.remove(dim);
- domains.remove(dim);
- }
-
- public void setDimension(int dim, CellDomainElement cde, DomainElement de) {
- cellDomains.set(dim, cde);
- domains.set(dim, de);
- }
-
- public void setCellDimension(int dim, CellDomainElement cde) {
- cellDomains.set(dim, cde);
- }
-
- public int getDomainIndexByName(String name) throws WCPSException {
- System.err.println("Searching for Domain name : " + name);
- System.err.println("Available domain names are: " + domains.toString());
-
- Iterator<DomainElement> it = domains.iterator();
- int index = 0;
-
- while (it.hasNext()) {
- if (name.equals(it.next().getName())) {
- return index;
- }
-
- index++;
- }
-
- System.err.println("ERROR: Axis name not found: " + name);
- throw new WCPSException("Domain name not found: " + name);
- }
-}
+package petascope.wcps.server.core;
+
+import petascope.core.Metadata;
+import petascope.exceptions.WCPSException;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+public class CoverageInfo {
+
+ private List<CellDomainElement> cellDomains;
+ private List<DomainElement> domains;
+ private String coverageName;
+
+ public CoverageInfo(CoverageInfo other) {
+ cellDomains = new ArrayList<CellDomainElement>();
+ domains = new ArrayList<DomainElement>();
+ int N = other.getNumDimensions();
+
+ for (int i = 0; i < N; ++i) {
+ cellDomains.add(other.getCellDomainElement(i));
+ domains.add(other.getDomainElement(i));
+ }
+
+ coverageName = other.getCoverageName();
+ }
+
+ public CoverageInfo(Metadata m) {
+ cellDomains = new ArrayList<CellDomainElement>();
+ domains = new ArrayList<DomainElement>();
+ Iterator<CellDomainElement> itcde = m.getCellDomainIterator();
+
+ while (itcde.hasNext()) {
+ cellDomains.add(itcde.next());
+ }
+
+ Iterator<DomainElement> itde = m.getDomainIterator();
+
+ while (itde.hasNext()) {
+ domains.add(itde.next());
+ }
+
+ coverageName = m.getCoverageName();
+ }
+
+ public boolean isCompatible(CoverageInfo other) {
+ if (getNumDimensions() != other.getNumDimensions()) {
+ System.err.println("The number of dimensions doesn't match");
+ return false;
+ }
+
+ {
+ Iterator<CellDomainElement> it = cellDomains.iterator();
+ int index = 0;
+
+ while (it.hasNext()) {
+ CellDomainElement me, you;
+
+ me = it.next();
+ you = other.getCellDomainElement(index++);
+
+ if (!me.getHi().equals(you.getHi())) {
+ System.err.println("High values don't match: "
+ + me.getHi().toString() + ", "
+ + you.getHi().toString());
+ return false;
+ }
+
+ if (!me.getLo().equals(you.getLo())) {
+ System.err.println("Low values don't match: "
+ + me.getLo().toString() + ", "
+ + you.getLo().toString());
+ return false;
+ }
+ }
+ }
+ {
+ Iterator<DomainElement> it = domains.iterator();
+ int index = 0;
+
+ while (it.hasNext()) {
+ DomainElement me, you;
+
+ me = it.next();
+ you = other.getDomainElement(index++);
+
+ if (!me.getName().equals(you.getName())) {
+ System.err.println("Domain element names don't match: '"
+ + me.getName() + "' and '"
+ + you.getName() + "'.");
+ return false;
+ }
+
+ // if (me.getName() != you.getName()) return false;
+ }
+ }
+ return true;
+ }
+
+ int getNumDimensions() {
+ return cellDomains.size();
+ }
+
+ public CellDomainElement getCellDomainElement(int dim) {
+ return cellDomains.get(dim);
+ }
+
+ public DomainElement getDomainElement(int dim) {
+ return domains.get(dim);
+ }
+
+ public String getCoverageName() {
+ return coverageName;
+ }
+
+ public void removeDimension(int dim) {
+ cellDomains.remove(dim);
+ domains.remove(dim);
+ }
+
+ public void setDimension(int dim, CellDomainElement cde, DomainElement de) {
+ cellDomains.set(dim, cde);
+ domains.set(dim, de);
+ }
+
+ public void setCellDimension(int dim, CellDomainElement cde) {
+ cellDomains.set(dim, cde);
+ }
+
+ public int getDomainIndexByName(String name) throws WCPSException {
+ System.err.println("Searching for Domain name : " + name);
+ System.err.println("Available domain names are: " + domains.toString());
+
+ Iterator<DomainElement> it = domains.iterator();
+ int index = 0;
+
+ while (it.hasNext()) {
+ if (name.equals(it.next().getName())) {
+ return index;
+ }
+
+ index++;
+ }
+
+ System.err.println("ERROR: Axis name not found: " + name);
+ throw new WCPSException("Domain name not found: " + name);
+ }
+}
diff --git a/petascope/src/petascope/wcps/server/core/CoverageIterator.java b/petascope/src/petascope/wcps/server/core/CoverageIterator.java
index 164f0ff..effb55a 100644
--- a/petascope/src/petascope/wcps/server/core/CoverageIterator.java
+++ b/petascope/src/petascope/wcps/server/core/CoverageIterator.java
@@ -14,82 +14,76 @@
* 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.ResourceException;
-import petascope.wcps.server.exceptions.WCPSException;
-import org.w3c.dom.*;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-public class CoverageIterator implements IRasNode {
-
- private List<String> coverageNames;
- private String iteratorName;
- private boolean dynamic = false; // created from a Construct Coverage expr?
-
- public CoverageIterator(Node x, XmlQuery xq) throws WCPSException {
- IDynamicMetadataSource source = xq.getMetadataSource();
- coverageNames = new ArrayList<String>();
- if (!x.getNodeName().equals("coverageIterator")) {
- throw new WCPSException("Invalid cast from " + x.getNodeName()
- + " XML node to CoverageIterator node");
- }
-
- Node it = x.getFirstChild();
- while (it != null) {
- if (it.getNodeName().equals("#text")) {
- it = it.getNextSibling();
- continue;
- }
-
- if (it.getNodeName().equals("iteratorVar")) {
- iteratorName = it.getFirstChild().getNodeValue();
- System.err.println("*** Iterator variable : " + iteratorName);
- } else if (it.getNodeName().equals("coverageName")) {
- String cn = it.getFirstChild().getNodeValue();
- System.err.println("*** Coverage reference : " + cn);
- try {
- if (!source.coverages().contains(cn)) {
- throw new WCPSException("Unknown coverage " + cn);
- }
- } catch (ResourceException e) {
- throw new WCPSException(
- "Cannot load coverage information!", e);
- }
-
- coverageNames.add(cn);
- }
-
- it = it.getNextSibling();
- }
- }
-
- public CoverageIterator(String iterator, String coverage) throws WCPSException {
- coverageNames = new ArrayList<String>();
- iteratorName = iterator;
- coverageNames.add(coverage);
- this.dynamic = true;
- }
-
- public Iterator<String> getCoverages() {
- return coverageNames.iterator();
- }
-
- public String getIteratorName() {
- return iteratorName;
- }
-
- public String toRasQL() {
- // TODO(andreia) : How to translate multiple coverages?
- return coverageNames.get(0) + " AS " + iteratorName;
- }
-}
+package petascope.wcps.server.core;
+
+import petascope.core.IDynamicMetadataSource;
+import petascope.exceptions.PetascopeException;
+import petascope.exceptions.WCPSException;
+import org.w3c.dom.*;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+public class CoverageIterator implements IRasNode {
+
+ private List<String> coverageNames;
+ private String iteratorName;
+ private boolean dynamic = false; // created from a Construct Coverage expr?
+
+ public CoverageIterator(Node x, XmlQuery xq) throws WCPSException, PetascopeException {
+ IDynamicMetadataSource source = xq.getMetadataSource();
+ coverageNames = new ArrayList<String>();
+ if (!x.getNodeName().equals("coverageIterator")) {
+ throw new WCPSException("Invalid cast from " + x.getNodeName()
+ + " XML node to CoverageIterator node");
+ }
+
+ Node it = x.getFirstChild();
+ while (it != null) {
+ if (it.getNodeName().equals("#text")) {
+ it = it.getNextSibling();
+ continue;
+ }
+
+ if (it.getNodeName().equals("iteratorVar")) {
+ iteratorName = it.getFirstChild().getNodeValue();
+ System.err.println("*** Iterator variable : " + iteratorName);
+ } else if (it.getNodeName().equals("coverageName")) {
+ String cn = it.getFirstChild().getNodeValue();
+ System.err.println("*** Coverage reference : " + cn);
+ if (!source.coverages().contains(cn)) {
+ throw new WCPSException("Unknown coverage " + cn);
+ }
+
+ coverageNames.add(cn);
+ }
+
+ it = it.getNextSibling();
+ }
+ }
+
+ public CoverageIterator(String iterator, String coverage) throws WCPSException {
+ coverageNames = new ArrayList<String>();
+ iteratorName = iterator;
+ coverageNames.add(coverage);
+ this.dynamic = true;
+ }
+
+ public Iterator<String> getCoverages() {
+ return coverageNames.iterator();
+ }
+
+ public String getIteratorName() {
+ return iteratorName;
+ }
+
+ public String toRasQL() {
+ // TODO(andreia) : How to translate multiple coverages?
+ return coverageNames.get(0) + " AS " + iteratorName;
+ }
+}
diff --git a/petascope/src/petascope/wcps/server/core/Crs.java b/petascope/src/petascope/wcps/server/core/Crs.java
index 4282574..d837cc6 100644
--- a/petascope/src/petascope/wcps/server/core/Crs.java
+++ b/petascope/src/petascope/wcps/server/core/Crs.java
@@ -14,112 +14,112 @@
* 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 java.util.Iterator;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import petascope.wcps.server.exceptions.WCPSException;
-import org.w3c.dom.*;
-import petascope.wcps.server.exceptions.InvalidCrsException;
-import petascope.wcs.server.exceptions.NoApplicableCodeException;
-
-public class Crs implements IRasNode {
-
- Logger LOG = LoggerFactory.getLogger(Crs.class);
- private String crsName;
-
- public Crs(Node node, XmlQuery xq) throws WCPSException, InvalidCrsException {
- System.err.println("Parsing crs name ...");
-
- while ((node != null) && node.getNodeName().equals("#text")) {
- node = node.getNextSibling();
- }
-
- if (node != null && node.getNodeName().equals("srsName")) {
- String val = node.getTextContent();
- this.crsName = val;
- if (crsName.equals(DomainElement.IMAGE_CRS) || crsName.equals(DomainElement.WGS84_CRS)) {
- System.err.println("Found CRS: " + crsName);
- } else {
- throw new InvalidCrsException("Invalid CRS: '" + crsName + "'");
- }
- } else {
- throw new WCPSException("Could not find a 'srsName' node !");
- }
- }
-
- /***
- * Converts an array of 4 coordinates (bounding box) expressed in the
- * current CRS to pixel coordinates.
- * @param u2 Left-most X point (CRS coordinate)
- * @param u3 Right-most X point (CRS coordinate)
- * @param v2 Lower-most Y point (CRS coordinate)
- * @param v3 Upper-most Y point (CRS coordinate)
- * @return array of integers, pixel coordinates that represent the given CRS
- * coordinates.
- */
- public long[] convertToPixelCoordinates(Metadata meta, String axisName, Double u2, Double u3, Double v2, Double v3) throws NoApplicableCodeException {
- Wgs84Crs crs = meta.getCrs();
- long px0 = -1, px1 = -1, py0 = -1, py1 = -1;
- // Convert bounding box values to pixel coordinates
- if (crsName.equals(DomainElement.WGS84_CRS)) {
- LOG.trace("Converting WGS84 axis {} interval to pixel coordinates ...", axisName);
- /* Image coordinates */
- Iterator<CellDomainElement> it = meta.getCellDomainIterator();
- CellDomainElement X = it.next();
- CellDomainElement Y = it.next();
- if (X == null || Y == null) {
- LOG.error("Could not find the X or Y axis for coverage: " + meta.getCoverageName());
- throw new NoApplicableCodeException("Could not find the X or Y axis for coverage: " + meta.getCoverageName());
- }
- int x0 = X.getLo().intValue();
- int x1 = X.getHi().intValue();
- int y0 = Y.getLo().intValue();
- int y1 = Y.getHi().intValue();
-
- LOG.trace("Pixel Coordinates: X01 (" + x0 + "," + x1 + ") + Y01 (" + y0 + "," + y1 + ")");
- /* CRS span */
- double x2 = crs.getLow1();
- double y2 = crs.getLow2();
- double x3 = crs.getHigh1();
- double y3 = crs.getHigh2();
- LOG.trace("CRS Coordinates: X23 (" + x2 + "," + x3 + ") + Y23 (" + y2 + "," + y3 + ")");
- /* For WGS84, the offset = (# pixels)/(CRS span) */
- double oX = crs.getOffset1();
- double oY = crs.getOffset2();
-
- /* The actual conversion is below: */
- if (axisName.equals("X")) {
- px0 = Math.round((u2 - x2) / oX) + x0;
- px1 = Math.round((u3 - u2) / oX) + px0;
- LOG.debug("CRS Coordinates on axis X: U23 (" + u2 + "," + u3 + ")");
- LOG.debug("Pixel Coordinates on axis X: U01 (" + px0 + "," + px1 + ") ");
- }
- if (axisName.equals("Y")) {
- py0 = Math.round((y3 - v3) / oY) + y0;
- py1 = Math.round((v3 - v2) / oY) + py0;
- LOG.debug("CRS Coordinates on axis Y: V23 (" + v2 + "," + v3 + ")");
- LOG.debug("Pixel Coordinates on axis Y: V01 (" + py0 + "," + py1 + ")");
- }
-
- }
- long[] longCoord = {px0, px1, py0, py1};
-
- return longCoord;
- }
-
- public String toRasQL() {
- return crsName;
- }
-
- public String getName() {
- return crsName;
- }
-}
+package petascope.wcps.server.core;
+
+import petascope.core.Metadata;
+import java.util.Iterator;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import petascope.exceptions.WCPSException;
+import org.w3c.dom.*;
+import petascope.exceptions.WCSException;
+import petascope.exceptions.ExceptionCode;
+
+public class Crs implements IRasNode {
+
+ Logger log = LoggerFactory.getLogger(Crs.class);
+ private String crsName;
+
+ public Crs(Node node, XmlQuery xq) throws WCPSException {
+ System.err.println("Parsing crs name ...");
+
+ while ((node != null) && node.getNodeName().equals("#text")) {
+ node = node.getNextSibling();
+ }
+
+ if (node != null && node.getNodeName().equals("srsName")) {
+ String val = node.getTextContent();
+ this.crsName = val;
+ if (crsName.equals(DomainElement.IMAGE_CRS) || crsName.equals(DomainElement.WGS84_CRS)) {
+ System.err.println("Found CRS: " + crsName);
+ } else {
+ throw new WCPSException("Invalid CRS: '" + crsName + "'");
+ }
+ } else {
+ throw new WCPSException("Could not find a 'srsName' node !");
+ }
+ }
+
+ /***
+ * Converts an array of 4 coordinates (bounding box) expressed in the
+ * current CRS to pixel coordinates.
+ * @param u2 Left-most X point (CRS coordinate)
+ * @param u3 Right-most X point (CRS coordinate)
+ * @param v2 Lower-most Y point (CRS coordinate)
+ * @param v3 Upper-most Y point (CRS coordinate)
+ * @return array of integers, pixel coordinates that represent the given CRS
+ * coordinates.
+ */
+ public long[] convertToPixelCoordinates(Metadata meta, String axisName, Double u2, Double u3, Double v2, Double v3) throws WCSException {
+ Wgs84Crs crs = meta.getCrs();
+ long px0 = -1, px1 = -1, py0 = -1, py1 = -1;
+ // Convert bounding box values to pixel coordinates
+ if (crsName.equals(DomainElement.WGS84_CRS)) {
+ log.trace("Converting WGS84 axis {} interval to pixel coordinates ...", axisName);
+ /* Image coordinates */
+ Iterator<CellDomainElement> it = meta.getCellDomainIterator();
+ CellDomainElement X = it.next();
+ CellDomainElement Y = it.next();
+ if (X == null || Y == null) {
+ log.error("Could not find the X or Y axis for coverage: " + meta.getCoverageName());
+ throw new WCSException(ExceptionCode.NoApplicableCode, "Could not find the X or Y axis for coverage: " + meta.getCoverageName());
+ }
+ int x0 = X.getLo().intValue();
+ int x1 = X.getHi().intValue();
+ int y0 = Y.getLo().intValue();
+ int y1 = Y.getHi().intValue();
+
+ log.trace("Pixel Coordinates: X01 (" + x0 + "," + x1 + ") + Y01 (" + y0 + "," + y1 + ")");
+ /* CRS span */
+ double x2 = crs.getLow1();
+ double y2 = crs.getLow2();
+ double x3 = crs.getHigh1();
+ double y3 = crs.getHigh2();
+ log.trace("CRS Coordinates: X23 (" + x2 + "," + x3 + ") + Y23 (" + y2 + "," + y3 + ")");
+ /* For WGS84, the offset = (# pixels)/(CRS span) */
+ double oX = crs.getOffset1();
+ double oY = crs.getOffset2();
+
+ /* The actual conversion is below: */
+ if (axisName.equals("X")) {
+ px0 = Math.round((u2 - x2) / oX) + x0;
+ px1 = Math.round((u3 - u2) / oX) + px0;
+ log.debug("CRS Coordinates on axis X: U23 (" + u2 + "," + u3 + ")");
+ log.debug("Pixel Coordinates on axis X: U01 (" + px0 + "," + px1 + ") ");
+ }
+ if (axisName.equals("Y")) {
+ py0 = Math.round((y3 - v3) / oY) + y0;
+ py1 = Math.round((v3 - v2) / oY) + py0;
+ log.debug("CRS Coordinates on axis Y: V23 (" + v2 + "," + v3 + ")");
+ log.debug("Pixel Coordinates on axis Y: V01 (" + py0 + "," + py1 + ")");
+ }
+
+ }
+ long[] longCoord = {px0, px1, py0, py1};
+
+ return longCoord;
+ }
+
+ public String toRasQL() {
+ return crsName;
+ }
+
+ public String getName() {
+ return crsName;
+ }
+}
diff --git a/petascope/src/petascope/wcps/server/core/CrsTransformCoverageExpr.java b/petascope/src/petascope/wcps/server/core/CrsTransformCoverageExpr.java
index d18609c..e07f213 100644
--- a/petascope/src/petascope/wcps/server/core/CrsTransformCoverageExpr.java
+++ b/petascope/src/petascope/wcps/server/core/CrsTransformCoverageExpr.java
@@ -14,30 +14,29 @@
* 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 org.w3c.dom.*;
-
-//TODO(smsorin): how do we do combine this ?
-public class CrsTransformCoverageExpr implements IRasNode, ICoverageInfo {
-
- public CrsTransformCoverageExpr(Node node, XmlQuery xq)
- throws WCPSException {
- throw new WCPSException("Method not implemented");
- }
-
- public String toRasQL() {
- return "";
- }
-
- public CoverageInfo getCoverageInfo() {
- return null;
- }
-}
+package petascope.wcps.server.core;
+
+import petascope.exceptions.WCPSException;
+import org.w3c.dom.*;
+
+//TODO(smsorin): how do we do combine this ?
+public class CrsTransformCoverageExpr implements IRasNode, ICoverageInfo {
+
+ public CrsTransformCoverageExpr(Node node, XmlQuery xq)
+ throws WCPSException {
+ throw new WCPSException("Method not implemented");
+ }
+
+ public String toRasQL() {
+ return "";
+ }
+
+ public CoverageInfo getCoverageInfo() {
+ return null;
+ }
+}
diff --git a/petascope/src/petascope/wcps/server/core/DbMetadataSource.java b/petascope/src/petascope/wcps/server/core/DbMetadataSource.java
deleted file mode 100644
index d6ccebf..0000000
--- a/petascope/src/petascope/wcps/server/core/DbMetadataSource.java
+++ /dev/null
@@ -1,1175 +0,0 @@
-/*
- * This file is part of rasdaman community.
- *
- * Rasdaman community is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Rasdaman community is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * 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.
- *
- * For more information please see <http://www.rasdaman.org>
- * or contact Peter Baumann via <baumann@rasdaman.com>.
- */
-package petascope.wcps.server.core;
-
-//~--- JDK imports ------------------------------------------------------------
-import petascope.wcps.server.exceptions.ResourceException;
-import petascope.wcps.server.exceptions.InvalidWcpsRequestException;
-import petascope.wcps.server.exceptions.InvalidMetadataException;
-import java.math.BigInteger;
-
-import java.sql.Connection;
-import java.sql.DriverManager;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Savepoint;
-import java.sql.Statement;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.Vector;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * The DbMetadataSource is a IMetadataSource that uses a relational database. It
- * keeps a global connection which is reused on future requests, as well as between
- * threads. Before each read, the connection is verified to be valid, and
- * recreated if necessary. This IMetadataSource is not particularly efficient,
- * because it accesses the database at least once for every read. To increase
- * efficiency, wrap a CachedMetadataSource around this one.
- *
- */
-public class DbMetadataSource implements IMetadataSource {
-
- private static Logger LOG = LoggerFactory.getLogger(DbMetadataSource.class);
-
- /* Status variables */
- private boolean initializing;
- private boolean checkAtInit;
-
- /* Contents of static tables */
- private Map<Integer, String> axisTypes;
- private Map<Integer, String> crss;
- private Map<Integer, String> dataTypes;
- private Map<Integer, String> interpolationTypes;
- private Map<Integer, String> nullResistances;
- private Map<String, String> supportedFormats;
-
- /* Contents of static tables (reversed, for easy access if you
- know the something's name and want to find out its id) */
- private Map<String, Integer> revAxisTypes;
- private Map<String, Integer> revCrss;
- private Map<String, Integer> revDataTypes;
- private Map<String, Integer> revInterpolationTypes;
- private Map<String, Integer> revNullResistances;
- private Map<String, String> revSupportedFormats; // Not used
-
- /* Database access info */
- private String driver;
- private String pass;
- private String url;
- private String user;
-
- /* Global database key variables */
- private Connection conn;
- private Savepoint savepoint;
- private String query;
-
- public DbMetadataSource(String driver, String url, String user, String pass) throws ResourceException, InvalidMetadataException {
- this(driver, url, user, pass, true);
- }
-
- public DbMetadataSource(String driver, String url, String user, String pass, boolean checkAtInit) throws ResourceException, InvalidMetadataException {
- try {
- this.driver = driver;
- Class.forName(driver).newInstance();
- } catch (ClassNotFoundException e) {
- throw new ResourceException("Metadata database error: Could not find JDBC driver: " + driver, e);
- } catch (InstantiationException e) {
- throw new ResourceException("Metadata database error: Could not instantiate JDBC driver: " + driver, e);
- } catch (IllegalAccessException e) {
- throw new ResourceException("Metadata database error: Access denied to JDBC driver: " + driver, e);
- }
-
- this.driver = driver;
- this.url = url;
- this.user = user;
- this.pass = pass;
- Statement s = null;
-
- try {
-
- /* Read contents of static metadata tables */
- ensureConnection();
-
- axisTypes = new HashMap<Integer, String>();
- revAxisTypes = new HashMap<String, Integer>();
- s = conn.createStatement();
- ResultSet r = s.executeQuery("SELECT id, axisType FROM PS_AxisType");
-
- while (r.next()) {
- axisTypes.put(r.getInt("id"), r.getString("axisType"));
- revAxisTypes.put(r.getString("axisType"), r.getInt("id"));
- }
-
- dataTypes = new HashMap<Integer, String>();
- revDataTypes = new HashMap<String, Integer>();
- r = s.executeQuery("SELECT id, dataType FROM PS_Datatype");
-
- while (r.next()) {
- dataTypes.put(r.getInt("id"), r.getString("dataType"));
- revDataTypes.put(r.getString("dataType"), r.getInt("id"));
- }
-
- interpolationTypes = new HashMap<Integer, String>();
- revInterpolationTypes = new HashMap<String, Integer>();
- r = s.executeQuery("SELECT id, interpolationType FROM PS_InterpolationType");
-
- while (r.next()) {
- interpolationTypes.put(r.getInt("id"), r.getString("interpolationType"));
- revInterpolationTypes.put(r.getString("interpolationType"), r.getInt("id"));
- }
-
- nullResistances = new HashMap<Integer, String>();
- revNullResistances = new HashMap<String, Integer>();
- r = s.executeQuery("SELECT id, nullResistance FROM PS_NullResistance");
-
- while (r.next()) {
- nullResistances.put(r.getInt("id"), r.getString("nullResistance"));
- revNullResistances.put(r.getString("nullResistance"), r.getInt("id"));
- }
-
- crss = new HashMap<Integer, String>();
- revCrss = new HashMap<String, Integer>();
- r = s.executeQuery("SELECT id, name FROM PS_Crs");
-
- while (r.next()) {
- crss.put(r.getInt("id"), r.getString("name"));
- revCrss.put(r.getString("name"), r.getInt("id"));
- }
-
- supportedFormats = new HashMap<String, String>();
- revSupportedFormats = new HashMap<String, String>();
- r = s.executeQuery("SELECT name, mimetype FROM PS_Format");
-
- while (r.next()) {
- supportedFormats.put(r.getString("name"), r.getString("mimetype"));
- revSupportedFormats.put(r.getString("mimetype"), r.getString("name"));
- }
-
- s.close();
-
- /* Debug checks for reverse static tables */
-// log(revAxisTypes.toString());
-// log(revCrss.toString());
-// log(revDataTypes.toString());
-// log(revInterpolationTypes.toString());
-// log(revNullResistances.toString());
-// log(revSupportedFormats.toString());
-
- /* Check Metadata consistency at startup, if needed */
- this.checkAtInit = checkAtInit;
-
- if (checkAtInit) {
- initializing = true;
- boolean coveragesOk = false;
-
- while (!coveragesOk) {
- try {
- Iterator<String> coverages = coverages().iterator();
-
- while (coverages.hasNext()) {
- read(coverages.next());
- }
- } catch (InvalidWcpsRequestException ire) {
- throw (InvalidMetadataException) ire.getCause();
- }
-
- coveragesOk = true;
- }
-
- initializing = false;
- }
-
- } catch (SQLException sqle) {
- if (s != null) {
- try {
- s.close();
- } catch (SQLException e) {
- }
- }
-
- close();
-
- throw new ResourceException("Metadata database error", sqle);
- }
-
- }
-
- public void close() {
- if (conn != null) {
- try {
- conn.close();
- } catch (SQLException sqle) {
- }
- conn = null;
- }
- }
-
- /* List all available coverages */
- @Override
- public Set<String> coverages() throws ResourceException {
- Statement s = null;
- Set<String> coverages;
-
- try {
- ensureConnection();
- s = conn.createStatement();
-
- ResultSet r = s.executeQuery("SELECT name FROM PS_Coverage");
-
- coverages = new HashSet<String>(r.getFetchSize());
-
- while (r.next()) {
- coverages.add(r.getString("name"));
- }
-
- s.close();
-
- return coverages;
- } catch (SQLException sqle) {
- if (s != null) {
- try {
- s.close();
- } catch (SQLException f) {
- }
- }
-
- close();
-
- throw new ResourceException("Metadata database error", sqle);
- }
-
- }
-
- @Override
- public String formatToMimetype(String format) {
- return supportedFormats.get(format);
- }
-
- @Override
- public Metadata read(String coverageName) throws InvalidWcpsRequestException, ResourceException {
- LOG.debug("Reading metadata for coverage '{}'", coverageName);
-
- if ((coverageName == null) || coverageName.equals("")) {
- throw new InvalidWcpsRequestException("Cannot retrieve coverage with null or empty name");
- }
-
- Statement s = null;
-
- try {
- ensureConnection();
- s = conn.createStatement();
-
- ResultSet r = s.executeQuery("SELECT id, nullDefault, interpolationTypeDefault, nullResistanceDefault FROM PS_Coverage WHERE name = '" + coverageName + "'");
-
- if (!r.next()) {
- throw new InvalidWcpsRequestException("Coverage '" + coverageName + "' is not served by this server");
- }
-
- int coverage = r.getInt("id");
- String nullDefault = r.getString("nullDefault");
- String interpolationTypeDefault = interpolationTypes.get(r.getInt("interpolationTypeDefault"));
- String nullResistanceDefault = nullResistances.get(r.getInt("nullResistanceDefault"));
-
- r = s.executeQuery("SELECT lo, hi FROM PS_CellDomain WHERE coverage = '" + coverage + "' ORDER BY i ASC");
- CellDomainElement X = null, Y = null, cell;
- boolean twoDCoverage = true;
- List<CellDomainElement> cellDomain = new ArrayList<CellDomainElement>(r.getFetchSize());
-
- while (r.next()) {
- cell = new CellDomainElement(BigInteger.valueOf(r.getInt("lo")), BigInteger.valueOf(r.getInt("hi")));
- cellDomain.add(cell);
- if (X == null) {
- X = cell;
- } else if (X != null && Y == null) {
- Y = cell;
- } else {
- twoDCoverage = false;
- }
- }
- if (X == null || Y == null) {
- twoDCoverage = false;
- }
-
- r = s.executeQuery("SELECT name, type FROM PS_Range WHERE coverage = '" + coverage + "' ORDER BY i ASC");
- List<RangeElement> range = new ArrayList<RangeElement>(r.getFetchSize());
-
- while (r.next()) {
- range.add(new RangeElement(r.getString("name"), dataTypes.get(r.getInt("type"))));
- }
-
- r = s.executeQuery("SELECT interpolationType, nullResistance FROM PS_InterpolationSet WHERE coverage = '" + coverage + "'");
- Set<InterpolationMethod> interpolationSet = new HashSet<InterpolationMethod>(r.getFetchSize());
-
- while (r.next()) {
- interpolationSet.add(new InterpolationMethod(interpolationTypes.get(r.getInt("interpolationType")), nullResistances.get(r.getInt("nullResistance"))));
- }
-
- r = s.executeQuery("SELECT nullValue FROM PS_NullSet WHERE coverage = '" + coverage + "'");
- Set<String> nullSet = new HashSet<String>(r.getFetchSize());
-
- while (r.next()) {
- nullSet.add(r.getString("nullValue"));
- }
-
- r = s.executeQuery("SELECT id, name, type, numLo, numHi, strLo, strHi FROM PS_Domain WHERE coverage = '" + coverage + "' ORDER BY i ASC");
- List<DomainElement> domain = new ArrayList<DomainElement>(r.getFetchSize());
- Statement ss = conn.createStatement();
-
- while (r.next()) {
- String strLo = r.getString("strLo");
- String strHi = r.getString("strHi");
-
- Double numLo = r.getDouble("numLo");
-
- if (r.wasNull()) {
- numLo = null;
- }
-
- Double numHi = r.getDouble("numHi");
-
- if (r.wasNull()) {
- numHi = null;
- }
-
- ResultSet rr = ss.executeQuery("SELECT crs FROM PS_CrsSet WHERE axis = '" + r.getInt("id") + "'");
- Set<String> crsSet = new HashSet<String>(rr.getFetchSize());
-
- while (rr.next()) {
- crsSet.add(crss.get(rr.getInt("crs")));
- }
-
- DomainElement d = new DomainElement(r.getString("name"), axisTypes.get(r.getInt("type")),
- numLo, numHi, strLo, strHi, crsSet, axisTypes.values());
- domain.add(d);
- }
-
- String abstr = "";
- String title = "";
- String keywords = "";
- r = s.executeQuery("SELECT title, abstract, keywords FROM PS_Descriptions WHERE coverage = '" + coverage + "'");
- if (r.next()) {
- abstr = r.getString("abstract");
- title = r.getString("title");
- keywords = r.getString("keywords");
- }
-
- /* WGS84 is the only CRS we understand (except IMAGE_CRS, of course) */
- Wgs84Crs crs = null;
- Double l1 = 0.0, l2 = 0.0, h1 = 0.0, h2 = 0.0;
- Double o1 = null, o2 = null;
- r = s.executeQuery("SELECT * FROM PS_CrsDetails WHERE coverage = '" + coverage + "'");
- if (r.next()) {
- /* Domain extent */
- int x0 = X.getLo().intValue();
- int y0 = Y.getLo().intValue();
- int x1 = X.getHi().intValue();
- int y1 = Y.getHi().intValue();
- /* CRS Bounding box */
- l1 = r.getDouble("low1");
- l2 = r.getDouble("low2");
- h1 = r.getDouble("high1");
- h2 = r.getDouble("high2");
- String off1 = r.getString("offset1");
- String off2 = r.getString("offset2");
- if (off1 != null) {
- o1 = Double.parseDouble(off1);
- }
- if (off2 != null) {
- o2 = Double.parseDouble(off2);
- }
- /* Compute axis offsets if not predefined */
- if (o1 == null && o2 == null) {
- o1 = (h1 - l1) / (double) (x1 - x0);
- o2 = (h2 - l2) / (double) (y1 - y0);
- LOG.debug("Calculated CRS axis offsets. For X: {}, for Y: {}", o1, o2);
- LOG.debug(X.toString());
- LOG.debug(Y.toString());
- }
- /* Only store CRS information if coverage is 2-D */
- if (twoDCoverage == true) {
- crs = new Wgs84Crs(l1, h1, l2, h2, o1, o2);
- LOG.trace("Found CRS : ", crs.toString());
- } else {
- LOG.warn("Found CRS '{}', but coverage is not 2-dimensional. "
- + "Ignoring CRS information.", crs.toString());
- }
- } else if (twoDCoverage) {
- LOG.warn(" WGS84 bounding box missing for 2-D coverage '" + coverageName + "'...");
- }
-
- /* Done with SQL statements */
- s.close();
-
- /* Build the complete metadata object */
- Metadata meta = new Metadata(cellDomain, range, nullSet, nullDefault, interpolationSet,
- new InterpolationMethod(interpolationTypeDefault, nullResistanceDefault),
- coverageName, domain, crs, title, abstr, keywords);
- meta.setCoverageId(coverage);
- return meta;
- } catch (InvalidMetadataException ime) {
- if (checkAtInit && !initializing) {
- throw new ResourceException("Previously valid metadata is now invalid. The metadata for coverage '" + coverageName + "' has been modified incorrectly.", ime);
- } else {
- throw new InvalidWcpsRequestException("Coverage '" + coverageName + "' has invalid metadata", ime);
- }
- } catch (SQLException sqle) {
- if (s != null) {
- try {
- s.close();
- } catch (SQLException f) {
- }
- }
-
- close();
-
- throw new ResourceException("Metadata database error", sqle);
- }
-
- }
-
- /** Write a coverage's metadata to the database. This function can be used
- * for both inserting new coverages and updating coverage metadata.
- *
- * @param meta Metadata container for the information to be stored in the metadata database
- * @param commit Boolean value, specifying if we want to commit immediately or not
- */
- private void write(Metadata meta, boolean commit) throws ResourceException {
- String coverageName = meta.getCoverageName();
- if (existsCoverageName(coverageName)) {
- updateCoverageMetadata(meta, commit);
- } else {
- insertNewCoverageMetadata(meta, commit);
- }
- }
-
- public void delete(Metadata meta, boolean commit) throws ResourceException {
- String coverageName = meta.getCoverageName();
- if (existsCoverageName(coverageName) == false) {
- throw new ResourceException("Cannot delete inexistent coverage: " + coverageName);
- }
-
- /* Delete main coverage entry from "PS_Coverage". Auxiliary metadata are
- * automatically deleted by the DB (via CASCADING) on
- * deletion of the main entry in ps_coverage */
- Statement s = null;
- try {
- s = conn.createStatement();
- setQuery("DELETE FROM PS_Coverage WHERE name = '" + coverageName + "'");
- int count = s.executeUpdate(query);
- LOG.trace("Affected rows: " + count);
- s.close();
-
- if (commit) {
- commitAndClose();
- }
- } catch (SQLException e) {
- e.printStackTrace();
- } finally {
- try {
- s.close();
- } catch (Exception e) {
- }
- }
- }
-
- /**
- * Check if there is metadata available for a given coverage name
- * @param name coverage name
- * @return true is coverage already exists
- */
- public boolean existsCoverageName(String name) {
- boolean result = false;
- Statement s = null;
- try {
- s = conn.createStatement();
- setQuery("SELECT * FROM PS_Coverage WHERE name = '" + name + "'");
- ResultSet r = s.executeQuery(query);
- if (r.next()) {
- result = true;
- } else {
- result = false;
- }
- s.close();
- } catch (SQLException e) {
- e.printStackTrace();
- } finally {
- try {
- s.close();
- } catch (Exception e) {
- }
- }
- return result;
- }
-
- /**
- * Check if there exists a coverage with a given ID in the metadata database.
- * @param id coverage id
- * @return true is coverage already exists
- */
- private boolean existsCoverageId(int id) {
- boolean result = false;
- Statement s = null;
- try {
- s = conn.createStatement();
- ResultSet r = s.executeQuery(
- "SELECT * FROM PS_Coverage WHERE id = '" + id + "'");
- if (r.next()) {
- result = true;
- } else {
- result = false;
- }
- s.close();
- } catch (SQLException e) {
- e.printStackTrace();
- } finally {
- try {
- s.close();
- } catch (Exception e) {
- }
- }
- System.out.println("Coverage with ID " + id + (result == false ? " does not " : "") + " exists.");
- return result;
- }
-
- /** Update metadata for an existing coverage. All information may change (including
- * name), but the ID of the tuple in PS_Coverage will stay the same.
- *
- * @param meta Metadata object, container of the new information.
- * @param commit True if we want to commit immediately, false to delay commit indefinitely
- */
- public void updateCoverageMetadata(Metadata meta, boolean commit) throws ResourceException {
- Statement s = null;
- int coverageId = meta.getCoverageId();
- int count = -1;
- String coverageName = meta.getCoverageName();
-
- try {
- ensureConnection();
- s = conn.createStatement();
-
- String name = coverageName;
- String nulldefault = meta.getNullDefault();
- int interpolatiotypendefault = revInterpolationTypes.get(meta.getInterpolationDefault());
- int nullresistancedefault = revNullResistances.get(meta.getNullResistanceDefault());
-
- // Table PS_Coverage
- setQuery("UPDATE PS_Coverage SET "
- + "(name, nullDefault, interpolationTypeDefault, nullResistanceDefault) "
- + " = ('" + name + "', '" + nulldefault + "', '"
- + interpolatiotypendefault + "', '" + nullresistancedefault + "')"
- + " WHERE id='" + coverageId + "'");
- count = s.executeUpdate(query);
- if (count <= 0) {
- throw new SQLException("Could not update table PS_Coverage.");
- }
-
- // Table PS_CellDomain
- /* Delete old data */
- setQuery("DELETE FROM PS_CellDomain WHERE coverage='" + coverageId + "'");
- count = s.executeUpdate(query);
- if (count <= 0) {
- throw new SQLException("Could not delete old entries from table PS_CellDomain.");
- }
- /* Insert new data */
- Iterator<CellDomainElement> cellIt = meta.getCellDomainIterator();
- int i = 0;
- while (cellIt.hasNext()) {
- CellDomainElement cell = cellIt.next();
- setQuery("INSERT INTO PS_CellDomain (coverage, i, lo, hi) VALUES "
- + " ('" + coverageId + "', '" + i + "', '" + cell.getLo() + "', '"
- + cell.getHi() + "')");
- if (s.executeUpdate(query) <= 0) {
- throw new SQLException("Could not insert axis " + i + " for coverage "
- + coverageName + "( id " + coverageId + ") into table PS_CellDomain");
- }
- i++;
- }
-
- // Table PS_Range
- /* Delete old data */
- setQuery("DELETE FROM PS_Range WHERE coverage='" + coverageId + "'");
- count = s.executeUpdate(query);
- if (count <= 0) {
- throw new SQLException("Could not delete old entries from table PS_Range.");
- }
- /* Insert new data */
- Iterator<RangeElement> rangeIt = meta.getRangeIterator();
- i = 0;
- while (rangeIt.hasNext()) {
- RangeElement range = rangeIt.next();
- System.out.println(range);
- int dataType = revDataTypes.get(range.getType());
- setQuery("INSERT INTO PS_Range (coverage, i, name, type) VALUES "
- + " ('" + coverageId + "', '" + i + "', '" + range.getName() + "', '"
- + dataType + "')");
- if (s.executeUpdate(query) <= 0) {
- throw new SQLException("Could not insert range " + range.getName()
- + "( id " + i + " ) for coverage "
- + coverageName + "( id " + coverageId + ") into table PS_Range");
- }
- i++;
- }
-
- // Table PS_InterpolationSet
- /* Delete old data */
- setQuery("DELETE FROM PS_InterpolationSet WHERE coverage='" + coverageId + "'");
- count = s.executeUpdate(query);
- if (count <= 0) {
- throw new SQLException("Could not delete old entries from table PS_InterpolationSet.");
- }
- /* Insert new data */
- Iterator<InterpolationMethod> methodIt = meta.getInterpolationMethodIterator();
- i = 0;
- while (methodIt.hasNext()) {
- InterpolationMethod method = methodIt.next();
- int interp = revInterpolationTypes.get(method.getInterpolationType());
- int nullRes = revNullResistances.get(method.getNullResistance());
- setQuery("INSERT INTO PS_InterpolationSet (coverage, interpolationType, nullResistance) VALUES "
- + " ('" + coverageId + "', '" + interp + "', '" + nullRes + "')");
- if (s.executeUpdate(query) <= 0) {
- throw new SQLException("Could not insert interpolation method (" + method.getInterpolationType()
- + ", " + method.getNullResistance() + " ) for coverage "
- + coverageName + "( id " + coverageId + ") into table PS_InterpolationSet");
- }
- i++;
- }
-
- // Table PS_NullSet
- /* Delete old data */
- setQuery("DELETE FROM PS_NullSet WHERE coverage='" + coverageId + "'");
- count = s.executeUpdate(query);
- if (count <= 0) {
- throw new SQLException("Could not delete old entries from table PS_NullSet.");
- }
- /* Insert new data */
- Iterator<String> nullIt = meta.getNullSetIterator();
- while (nullIt.hasNext()) {
- String nullValue = nullIt.next();
- setQuery("INSERT INTO PS_NullSet (coverage, nullValue) VALUES "
- + " ('" + coverageId + "', '" + nullValue + "')");
- if (s.executeUpdate(query) <= 0) {
- throw new SQLException("Could not insert null value '" + nullValue
- + "' for coverage " + coverageName + "( id " + coverageId
- + ") into table PS_NullSet");
- }
- }
-
- // Tables PS_Domain and PS_CrsSet
- /* Delete old data */
- setQuery("SELECT * FROM PS_Domain WHERE coverage='" + coverageId + "'");
- ResultSet r1 = s.executeQuery(query);
- Vector axes = new Vector(5);
- while (r1.next()) {
- int axisId = r1.getInt("id");
- axes.add((Integer) axisId);
- }
- System.out.println(axes);
- for (i = 0; i < axes.size(); i++) {
- int axisId = ((Integer) axes.elementAt(i)).intValue();
- setQuery("DELETE FROM PS_CrsSet WHERE axis='" + axisId + "'");
- count = s.executeUpdate(query);
- /* Do not worry about inexisting entries in CRS Sets: this implementation
- does not really use CRSs. */
-// if (count <= 0)
-// throw new SQLException("Could not delete old entries from table PS_CrsSet.");
-
- }
-
- setQuery("DELETE FROM PS_Domain WHERE coverage='" + coverageId + "'");
- count = s.executeUpdate(query);
- if (count <= 0) {
- throw new SQLException("Could not delete old entries from table PS_Domain.");
- }
- /* Insert new data */
- Iterator<DomainElement> domIt = meta.getDomainIterator();
- i = 0;
- while (domIt.hasNext()) {
- // Table PS_Domain
- DomainElement dom = domIt.next();
- int axisType = revAxisTypes.get(dom.getType());
- Double numLo = dom.getNumLo();
- Double numHi = dom.getNumHi();
- String sNumLo = numLo == null ? "null" : "'" + numLo.toString() + "'";
- String sNumHi = numHi == null ? "null" : "'" + numHi.toString() + "'";
- String strLo = dom.getStrLo();
- String strHi = dom.getStrHi();
- if (strLo != null && strLo.equals("null") == false) {
- strLo = "'" + strLo + "'";
- }
- if (strHi != null && strHi.equals("null") == false) {
- strHi = "'" + strHi + "'";
- }
-
- String sqlQuery = "INSERT INTO PS_Domain "
- + "(coverage, i, name, type, numLo, numHi, strLo, strHi) VALUES "
- + "('" + coverageId + "', '" + i + "', '" + dom.getName() + "', '"
- + axisType + "', " + sNumLo + ", " + sNumHi
- + ", " + strLo + ", " + strHi + ")";
- /* Need to get ID of the newly inserted tuple. Postgres has a cool construct (RETURNING),
- * but we can also fall-back to another generic JDBC driver */
- int axisId = -1;
- if (driver.equals("org.postgresql.Driver")) {
- /* RETURNING clause is not standard SQL, only PostgreSQL understands it*/
- setQuery(sqlQuery + " RETURNING id");
-
- ResultSet r = s.executeQuery(query);
- if (r.next() == false) {
- throw new SQLException("Could not insert domain element (i = " + i
- + ", name=" + dom.getName() + ", type=" + dom.getType()
- + ", numLo=" + dom.getNumLo() + ", numHi=" + dom.getNumHi()
- + ", strLo=" + dom.getStrLo() + ", strHi=" + dom.getStrHi()
- + ") for coverage " + coverageName + "( id " + coverageId
- + ") into table PS_Domain");
- }
- /* Retrieve the ID of the newly inserted tuple (PS_Domain) */
- axisId = r.getInt("id");
- } else {
- /* Fallback to specific driver support on returning autogenerated keys. */
- String[] keys = new String[1];
- keys[0] = "id";
- int c = s.executeUpdate(sqlQuery, keys);
- if (c <= 0) {
- throw new SQLException("Could not insert domain element (i = " + i
- + ", name=" + dom.getName() + ", type=" + dom.getType()
- + ", numLo=" + dom.getNumLo() + ", numHi=" + dom.getNumHi()
- + ", strLo=" + dom.getStrLo() + ", strHi=" + dom.getStrHi()
- + ") for coverage " + coverageName + "( id " + coverageId
- + ") into table PS_Domain");
- }
- /* Retrieve the ID of the newly inserted tuple (PS_Domain) */
- ResultSet rr = s.getGeneratedKeys();
- if (rr.next() == false) {
- throw new SQLException("Could not retrieve ID of the newly insterted tuple in table PS_Domain.");
- }
- axisId = rr.getInt("id");
- }
- /* check ID */
- if (axisId < 0) {
- throw new SQLException("Generated ID (" + axisId
- + ") for the tuple in PS_Domain is not valid !");
- }
-
- /* Increment axis number */
- i++;
-
- // Table PS_CrsSet
- Set<String> crsSet = dom.getCrsSet();
- System.out.println(crsSet);
- Iterator<String> crsIt = crsSet.iterator();
- while (crsIt.hasNext()) {
- String crs = crsIt.next();
- int crsId = revCrss.get(crs);
- setQuery("INSERT INTO PS_CrsSet (axis, crs) VALUES "
- + "('" + axisId + "', '" + crsId + "')");
- if (s.executeUpdate(query) <= 0) {
- throw new SQLException("Could not insert Crs " + crs
- + "for axis =" + axisId + " in table PS_CrsSet");
- }
- }
- }
-
- // Table PS_Descriptions
- /* Delete old data */
- setQuery("DELETE FROM PS_Descriptions WHERE coverage='" + coverageId + "'");
- count = s.executeUpdate(query);
- /* Coverage descriptions are not essential, do not throw an error if missing */
-// if (count <= 0)
-// throw new SQLException("Could not delete old data from table PS_Descriptions");
- /* Insert new data */
- String title = meta.getTitle();
- String abstr = meta.getAbstract();
- String keywords = meta.getKeywords();
- if (title != null) {
- title = "'" + title + "'";
- }
- if (abstr != null) {
- abstr = "'" + abstr + "'";
- }
- if (keywords != null) {
- keywords = "'" + keywords + "'";
- }
- setQuery("INSERT INTO PS_Descriptions (coverage, title, abstract, keywords)"
- + " VALUES ('" + coverageId + "', " + title + ", " + abstr + ", " + keywords + ")");
- if (s.executeUpdate(query) <= 0) {
- throw new SQLException("Could not insert descriptive metadata in table "
- + "PS_Descriptions for coverage " + coverageName + " (ID " + coverageId + ")");
- }
-
-
- s.close();
-
- if (commit) {
- commitAndClose();
- }
- } catch (SQLException sqle) {
- /* Abort this transaction */
- try {
- if (s != null) {
- s.close();
- }
- abortAndClose();
- } catch (SQLException f) {
- }
-
- throw new ResourceException("Metadata database error", sqle);
- }
- }
-
- /** Insert metadata for a new coverage.
- *
- * @param meta Metadata object, container of information
- * @param commit Boolean value, specifying if we want to commit immediately or not
- */
- public void insertNewCoverageMetadata(Metadata meta, boolean commit) throws ResourceException {
- Statement s = null;
- String coverageName = meta.getCoverageName();
- int coverageId = -1;
-
- try {
- ensureConnection();
- s = conn.createStatement();
-
- String name = coverageName;
- /* FIXME: Table PS_COVERAGE: nullValue and CRS fields not USED !!! */
-// String nullvalue = "";
-// String crs = "";
- String nulldefault = meta.getNullDefault();
- int interpolatiotypendefault = revInterpolationTypes.get(meta.getInterpolationDefault());
- int nullresistancedefault = revNullResistances.get(meta.getNullResistanceDefault());
-
- // Table PS_Coverage
- String sqlQuery = "INSERT INTO PS_Coverage "
- + "(name, nullDefault, interpolationTypeDefault, nullResistanceDefault) "
- + " VALUES ('" + name + "', '" + nulldefault + "', '"
- + interpolatiotypendefault + "', '" + nullresistancedefault + "')";
- /* Need to get ID of the newly inserted tuple. Postgres has a cool construct (RETURNING),
- * but we can also fall-back to another generic JDBC driver */
- if (driver.equals("org.postgresql.Driver")) {
- /* RETURNING clause is not standard SQL, only PostgreSQL understands it*/
- setQuery(sqlQuery + " RETURNING id");
-
- ResultSet r = s.executeQuery(query);
- if (r.next() == false) {
- throw new SQLException("Could not insert new coverage in table PS_Coverage.");
- }
- /* Retrieve the ID of the newly inserted tuple (PS_Coverage) */
- coverageId = r.getInt("id");
- } else {
- /* Fallback to specific driver support on returning autogenerated keys. */
- String[] keys = new String[1];
- keys[0] = "id";
- int c = s.executeUpdate(sqlQuery, keys);
- if (c <= 0) {
- throw new SQLException("Could not insert new coverage in table PS_Coverage.");
- }
- /* Retrieve the ID of the newly inserted tuple (PS_Coverage) */
- ResultSet rr = s.getGeneratedKeys();
- if (rr.next() == false) {
- throw new SQLException("Could not retrieve ID of the newly insterted tuple in table PS_Coverage.");
- }
- coverageId = rr.getInt("id");
- }
- /* check ID */
- if (coverageId < 0) {
- throw new SQLException("Generated ID (" + coverageId
- + ") for the tuple in PS_Coverage is not valid !");
- }
-
- // Table PS_CellDomain
- Iterator<CellDomainElement> cellIt = meta.getCellDomainIterator();
- int i = 0;
- while (cellIt.hasNext()) {
- CellDomainElement cell = cellIt.next();
- setQuery("INSERT INTO PS_CellDomain (coverage, i, lo, hi) VALUES "
- + " ('" + coverageId + "', '" + i + "', '" + cell.getLo() + "', '"
- + cell.getHi() + "')");
- if (s.executeUpdate(query) <= 0) {
- throw new SQLException("Could not insert axis " + i + " for coverage "
- + coverageName + "( id " + coverageId + ") into table PS_CellDomain");
- }
- i++;
- }
-
- // Table PS_Range
- Iterator<RangeElement> rangeIt = meta.getRangeIterator();
- i = 0;
- while (rangeIt.hasNext()) {
- RangeElement range = rangeIt.next();
- System.out.println(range);
- int dataType = revDataTypes.get(range.getType());
- setQuery("INSERT INTO PS_Range (coverage, i, name, type) VALUES "
- + " ('" + coverageId + "', '" + i + "', '" + range.getName() + "', '"
- + dataType + "')");
- if (s.executeUpdate(query) <= 0) {
- throw new SQLException("Could not insert range " + range.getName()
- + "( id " + i + " ) for coverage "
- + coverageName + "( id " + coverageId + ") into table PS_Range");
- }
- i++;
- }
-
- // Table PS_InterpolationSet
- Iterator<InterpolationMethod> methodIt = meta.getInterpolationMethodIterator();
- i = 0;
- while (methodIt.hasNext()) {
- InterpolationMethod method = methodIt.next();
- int interp = revInterpolationTypes.get(method.getInterpolationType());
- int nullRes = revNullResistances.get(method.getNullResistance());
- setQuery("INSERT INTO PS_InterpolationSet (coverage, interpolationType, nullResistance) VALUES "
- + " ('" + coverageId + "', '" + interp + "', '" + nullRes + "')");
- if (s.executeUpdate(query) <= 0) {
- throw new SQLException("Could not insert interpolation method (" + method.getInterpolationType()
- + ", " + method.getNullResistance() + " ) for coverage "
- + coverageName + "( id " + coverageId + ") into table PS_InterpolationSet");
- }
- i++;
- }
-
- // Table PS_NullSet
- Iterator<String> nullIt = meta.getNullSetIterator();
- while (nullIt.hasNext()) {
- String nullValue = nullIt.next();
- setQuery("INSERT INTO PS_NullSet (coverage, nullValue) VALUES "
- + " ('" + coverageId + "', '" + nullValue + "')");
- if (s.executeUpdate(query) <= 0) {
- throw new SQLException("Could not insert null value '" + nullValue
- + "' for coverage " + coverageName + "( id " + coverageId
- + ") into table PS_NullSet");
- }
- }
-
- Iterator<DomainElement> domIt = meta.getDomainIterator();
- i = 0;
- while (domIt.hasNext()) {
- // Table PS_Domain
- DomainElement dom = domIt.next();
- int axisType = revAxisTypes.get(dom.getType());
- Double numLo = dom.getNumLo();
- Double numHi = dom.getNumHi();
- String sNumLo = numLo == null ? "null" : "'" + numLo.toString() + "'";
- String sNumHi = numHi == null ? "null" : "'" + numHi.toString() + "'";
- String strLo = dom.getStrLo();
- String strHi = dom.getStrHi();
- if (strLo != null && strLo.equals("null") == false) {
- strLo = "'" + strLo + "'";
- }
- if (strHi != null && strHi.equals("null") == false) {
- strHi = "'" + strHi + "'";
- }
-
- sqlQuery = "INSERT INTO PS_Domain "
- + "(coverage, i, name, type, numLo, numHi, strLo, strHi) VALUES "
- + "('" + coverageId + "', '" + i + "', '" + dom.getName() + "', '"
- + axisType + "', " + sNumLo + ", " + sNumHi
- + ", " + strLo + ", " + strHi + ")";
- /* Need to get ID of the newly inserted tuple. Postgres has a cool construct (RETURNING),
- * but we can also fall-back to another generic JDBC driver */
- int axisId = -1;
- if (driver.equals("org.postgresql.Driver")) {
- /* RETURNING clause is not standard SQL, only PostgreSQL understands it*/
- setQuery(sqlQuery + " RETURNING id");
-
- ResultSet r = s.executeQuery(query);
- if (r.next() == false) {
- throw new SQLException("Could not insert domain element (i = " + i
- + ", name=" + dom.getName() + ", type=" + dom.getType()
- + ", numLo=" + dom.getNumLo() + ", numHi=" + dom.getNumHi()
- + ", strLo=" + dom.getStrLo() + ", strHi=" + dom.getStrHi()
- + ") for coverage " + coverageName + "( id " + coverageId
- + ") into table PS_Domain");
- }
- /* Retrieve the ID of the newly inserted tuple (PS_Domain) */
- axisId = r.getInt("id");
- } else {
- /* Fallback to specific driver support on returning autogenerated keys. */
- String[] keys = new String[1];
- keys[0] = "id";
- int c = s.executeUpdate(sqlQuery, keys);
- if (c <= 0) {
- throw new SQLException("Could not insert domain element (i = " + i
- + ", name=" + dom.getName() + ", type=" + dom.getType()
- + ", numLo=" + dom.getNumLo() + ", numHi=" + dom.getNumHi()
- + ", strLo=" + dom.getStrLo() + ", strHi=" + dom.getStrHi()
- + ") for coverage " + coverageName + "( id " + coverageId
- + ") into table PS_Domain");
- }
- /* Retrieve the ID of the newly inserted tuple (PS_Domain) */
- ResultSet rr = s.getGeneratedKeys();
- if (rr.next() == false) {
- throw new SQLException("Could not retrieve ID of the newly insterted tuple in table PS_Domain.");
- }
- axisId = rr.getInt("id");
- }
- /* check ID */
- if (axisId < 0) {
- throw new SQLException("Generated ID (" + axisId
- + ") for the tuple in PS_Domain is not valid !");
- }
-
- /* Increment axis number */
- i++;
-
- // Table PS_CrsSet
- Set<String> crsSet = dom.getCrsSet();
- Iterator<String> crsIt = crsSet.iterator();
- while (crsIt.hasNext()) {
- String crs = crsIt.next();
- int crsId = revCrss.get(crs);
- setQuery("INSERT INTO PS_CrsSet (axis, crs) VALUES "
- + "('" + axisId + "', '" + crsId + "')");
- if (s.executeUpdate(query) <= 0) {
- throw new SQLException("Could not insert Crs " + crs
- + "for axis =" + axisId + " in table PS_CrsSet");
- }
- }
- }
-
- // Table PS_Descriptions
- String title = meta.getTitle();
- String abstr = meta.getAbstract();
- String keywords = meta.getKeywords();
- if (title != null) {
- title = "'" + title + "'";
- }
- if (abstr != null) {
- abstr = "'" + abstr + "'";
- }
- if (keywords != null) {
- keywords = "'" + keywords + "'";
- }
- setQuery("INSERT INTO PS_Descriptions (coverage, title, abstract, keywords)"
- + " VALUES ('" + coverageId + "', " + title + ", " + abstr + ", " + keywords + ")");
- if (s.executeUpdate(query) <= 0) {
- throw new SQLException("Could not insert descriptive metadata in table "
- + "PS_Descriptions for coverage " + coverageName + " (ID " + coverageId + ")");
- }
-
- s.close();
-
- if (commit) {
- commitAndClose();
- }
- } catch (SQLException sqle) {
- /* Abort this transaction */
- try {
- if (s != null) {
- s.close();
- }
- abortAndClose();
- } catch (SQLException f) {
- }
-
- throw new ResourceException("Metadata database error", sqle);
- }
-
- }
-
- public void ensureConnection() throws SQLException {
- synchronized (this) {
- LOG.trace("Ensuring connection is valid...");
-// if( connection == null || !connection.isValid( CONNECTION_TIMEOUT ) ) { // Not implemented by PostgreSQL yet.
- if ((conn == null) || conn.isClosed()) {
- LOG.trace("*** Opening new DB connection !");
- close();
- openConnection();
- LOG.trace("*** ok.");
-// try { throw new Exception(""); } catch (Exception e) {e.printStackTrace();}
- }
- }
-
- }
-
- public void openConnection() throws SQLException {
- conn = DriverManager.getConnection(url, user, pass);
- conn.setAutoCommit(false);
- savepoint = conn.setSavepoint();
- }
-
- public void abortAndClose() throws SQLException {
- if (conn != null) {
- conn.rollback(savepoint);
- conn.close();
- conn = null;
- }
- }
-
- public void commitAndClose() throws SQLException {
- if (conn != null) {
- conn.commit();
- conn.close();
- conn = null;
- }
- }
-
- @Override
- public Collection<String> getAxisNames() {
- return axisTypes.values();
- }
-
- /* Logging function for SQL queries. */
- private void setQuery(String q) {
- this.query = q;
- LOG.trace("SQL Query: {}", q);
- }
-
- /* Returns the available formatToMimetype formats, as stored in the metadata database */
- public String[] getMimetypesList() {
- return supportedFormats.values().toArray(new String[1]);
- }
-
- /* Translate a mime-type to a format name, if known to rasdaman. */
- public String mimetypeToFormat(String mime) {
- LOG.debug(revSupportedFormats.toString());
- return revSupportedFormats.get(mime);
- }
-
- /**
- * @return the dataTypes
- */
- public Collection<String> getDataTypes() {
- return dataTypes.values();
- }
-
- /**
- * @return the interpolationTypes
- */
- public Collection<String> getInterpolationTypes() {
- return interpolationTypes.values();
- }
-
- /**
- * @return the nullResistances
- */
- public Collection<String> getNullResistances() {
- return nullResistances.values();
- }
-}
diff --git a/petascope/src/petascope/wcps/server/core/DimensionIntervalElement.java b/petascope/src/petascope/wcps/server/core/DimensionIntervalElement.java
index 7453e9b..c9385d4 100644
--- a/petascope/src/petascope/wcps/server/core/DimensionIntervalElement.java
+++ b/petascope/src/petascope/wcps/server/core/DimensionIntervalElement.java
@@ -14,209 +14,212 @@
* 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 org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import petascope.wcps.server.exceptions.InvalidCrsException;
-import petascope.wcps.server.exceptions.WCPSException;
-import org.w3c.dom.*;
-import petascope.wcs.server.exceptions.NoApplicableCodeException;
-
-public class DimensionIntervalElement implements IRasNode, ICoverageInfo {
-
- Logger LOG = LoggerFactory.getLogger(DimensionIntervalElement.class);
- private IRasNode child;
- private CoverageInfo info = null;
- private AxisName axis;
- private Crs crs;
- private ScalarExpr domain1, domain2; // lower and upper bound, or "DomainMetadataExprType" and null
- private long coord1, coord2;
- private int counter = 0; // counter for the domain vars
- private Metadata meta = null; // metadata about the current coverage
- private boolean finished = false;
- private Node nextNode;
- private boolean transformedCoordinates = false;
-
- /**
- * Constructs an element of a dimension interval.
- * @param node XML Node
- * @param xq WCPS Xml Query object
- * @param covInfo CoverageInfo object about the Trim parent object
- * @throws WCPSException
- */
- public DimensionIntervalElement(Node node, XmlQuery xq, CoverageInfo covInfo)
- throws WCPSException, InvalidCrsException {
-
- if (covInfo.getCoverageName() != null) {
- // Add WGS84 CRS information from coverage metadata, may be useful
- // for converting geo-coordinates to pixel-coordinates
- String coverageName = covInfo.getCoverageName();
- meta = xq.getMetadataSource().read(coverageName);
- }
-
- System.err.println("Trying to parse DimensionIntervalElement expression...");
- String name;
-
- while ((node != null) && node.getNodeName().equals("#text")) {
- node = node.getNextSibling();
- }
-
- while (node != null && finished == false) {
- if (node.getNodeName().equals("#text")) {
- node = node.getNextSibling();
- continue;
- }
-
- name = node.getNodeName();
- System.err.println("Current node is " + name);
-
- // Try Axis
- try {
- axis = new AxisName(node, xq);
- node = node.getNextSibling();
- continue;
- } catch (WCPSException e) {
- System.err.println("Failed to parse an axis!");
- }
-
- // Try CRS name
- try {
- crs = new Crs(node, xq);
- node = node.getNextSibling();
- if (axis == null) {
- throw new WCPSException("Expected Axis node before CRS !");
- }
- continue;
- } catch (WCPSException e) {
- System.err.println("Failed to parse a crs!");
- }
-
- // TODO: how to implement DomainMetadataExpr ?
-
-// // Try last thing
-// try
-// {
-// domain1 = new DomainMetadataExprType(node, xq);
-// counter = 1;
-// continue;
-// }
-// catch (WCPSException e)
-// {
-// System.err.println("Failed to parse domain metadata!");
-// }
-
- // Then it must be a pair of nodes "lowerBound" + "upperBound"
- if (node.getNodeName().equals("lowerBound")) {
- counter = 2;
- domain1 = new ScalarExpr(node.getFirstChild(), xq);
- if (axis == null) {
- throw new WCPSException("Expected <axis> node before <lowerBound> !");
- }
- } else if (node.getNodeName().equals("upperBound")) {
- counter = 2;
- domain2 = new ScalarExpr(node.getFirstChild(), xq);
- if (axis == null) {
- throw new WCPSException("Expected <lowerBound> node before <upperBound> !");
- }
- } else {
- throw new WCPSException("Unexpected node: " + node.getFirstChild().getNodeName());
- }
-
- if (axis != null && counter == 1 && domain1 != null) {
- finished = true;
- }
- if (axis != null && counter == 2 && domain1 != null && domain2 != null) {
- finished = true;
- }
-
- if (finished == true) {
- nextNode = node.getNextSibling();
- }
-
- node = node.getNextSibling();
- }
-
- if (finished == true) {
- convertToPixelCoordinates();
- }
- }
-
-
- /* If input coordinates are geo-, convert them to pixel coordinates. */
- private void convertToPixelCoordinates() {
- if (meta.getCrs() == null && crs != null && crs.getName().equals(DomainElement.WGS84_CRS)) {
- throw new RuntimeException("Coverage '" + meta.getCoverageName()
- + "' is not georeferenced with 'EPSG:4326' coordinate system.");
- }
- if (counter == 2 && crs != null && domain1.isSingleValue() && domain2.isSingleValue()) {
- if (crs.getName().equals(DomainElement.WGS84_CRS)) {
- LOG.debug("CRS is '{}' and should be equal to '{}'", crs.getName(), DomainElement.WGS84_CRS);
- try {
- this.transformedCoordinates = true;
- // Convert to pixel coordinates
- Double val1 = domain1.getSingleValue();
- Double val2 = domain2.getSingleValue();
- String axisName = axis.toRasQL().toUpperCase();
- if (axisName.equals("X")) {
- long[] pCoord = crs.convertToPixelCoordinates(meta, "X", val1, val2, null, null);
- coord1 = pCoord[0];
- coord2 = pCoord[1];
- }
- if (axisName.equals("Y")) {
- long[] pCoord = crs.convertToPixelCoordinates(meta, "Y", null, null, val1, val2);
- coord1 = pCoord[2];
- coord2 = pCoord[3];
- }
- } catch (NoApplicableCodeException e) {
- this.transformedCoordinates = false;
- LOG.error("Error while transforming geo-coordinates to pixel coordinates."
- + "The metadata is probably not valid.");
- }
- }
- }
- }
-
- /* Not used */
- public String toRasQL() {
- return "<DimensionIntervalElement Not Converted to RasQL>";
- }
-
- public CoverageInfo getCoverageInfo() {
- return info;
- }
-
- public Node getNextNode() {
- return nextNode;
- }
-
- public String getAxisName() {
- return this.axis.toRasQL();
- }
-
- public String getAxisCoords() {
- return this.domain1.toRasQL() + " : " + this.domain2.toRasQL();
- }
-
- public String getLowCoord() {
- if (transformedCoordinates) {
- return String.valueOf(coord1);
- } else {
- return this.domain1.toRasQL();
- }
- }
-
- public String getHighCoord() {
- if (transformedCoordinates) {
- return String.valueOf(coord2);
- } else {
- return this.domain2.toRasQL();
- }
- }
-}
+package petascope.wcps.server.core;
+
+import petascope.core.Metadata;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import petascope.exceptions.WCPSException;
+import org.w3c.dom.*;
+import petascope.exceptions.WCSException;
+
+public class DimensionIntervalElement implements IRasNode, ICoverageInfo {
+
+ Logger log = LoggerFactory.getLogger(DimensionIntervalElement.class);
+ private IRasNode child;
+ private CoverageInfo info = null;
+ private AxisName axis;
+ private Crs crs;
+ private ScalarExpr domain1, domain2; // lower and upper bound, or "DomainMetadataExprType" and null
+ private long coord1, coord2;
+ private int counter = 0; // counter for the domain vars
+ private Metadata meta = null; // metadata about the current coverage
+ private boolean finished = false;
+ private Node nextNode;
+ private boolean transformedCoordinates = false;
+
+ /**
+ * Constructs an element of a dimension interval.
+ * @param node XML Node
+ * @param xq WCPS Xml Query object
+ * @param covInfo CoverageInfo object about the Trim parent object
+ * @throws WCPSException
+ */
+ public DimensionIntervalElement(Node node, XmlQuery xq, CoverageInfo covInfo)
+ throws WCPSException {
+
+ if (covInfo.getCoverageName() != null) {
+ // Add WGS84 CRS information from coverage metadata, may be useful
+ // for converting geo-coordinates to pixel-coordinates
+ String coverageName = covInfo.getCoverageName();
+ try {
+ meta = xq.getMetadataSource().read(coverageName);
+ } catch (Exception ex) {
+ throw new WCPSException(ex.getMessage(), ex);
+ }
+ }
+
+ System.err.println("Trying to parse DimensionIntervalElement expression...");
+ String name;
+
+ while ((node != null) && node.getNodeName().equals("#text")) {
+ node = node.getNextSibling();
+ }
+
+ while (node != null && finished == false) {
+ if (node.getNodeName().equals("#text")) {
+ node = node.getNextSibling();
+ continue;
+ }
+
+ name = node.getNodeName();
+ System.err.println("Current node is " + name);
+
+ // Try Axis
+ try {
+ axis = new AxisName(node, xq);
+ node = node.getNextSibling();
+ continue;
+ } catch (WCPSException e) {
+ System.err.println("Failed to parse an axis!");
+ }
+
+ // Try CRS name
+ try {
+ crs = new Crs(node, xq);
+ node = node.getNextSibling();
+ if (axis == null) {
+ throw new WCPSException("Expected Axis node before CRS !");
+ }
+ continue;
+ } catch (WCPSException e) {
+ System.err.println("Failed to parse a crs!");
+ }
+
+ // TODO: how to implement DomainMetadataExpr ?
+
+// // Try last thing
+// try
+// {
+// domain1 = new DomainMetadataExprType(node, xq);
+// counter = 1;
+// continue;
+// }
+// catch (WCPSException e)
+// {
+// System.err.println("Failed to parse domain metadata!");
+// }
+
+ // Then it must be a pair of nodes "lowerBound" + "upperBound"
+ if (node.getNodeName().equals("lowerBound")) {
+ counter = 2;
+ domain1 = new ScalarExpr(node.getFirstChild(), xq);
+ if (axis == null) {
+ throw new WCPSException("Expected <axis> node before <lowerBound> !");
+ }
+ } else if (node.getNodeName().equals("upperBound")) {
+ counter = 2;
+ domain2 = new ScalarExpr(node.getFirstChild(), xq);
+ if (axis == null) {
+ throw new WCPSException("Expected <lowerBound> node before <upperBound> !");
+ }
+ } else {
+ throw new WCPSException("Unexpected node: " + node.getFirstChild().getNodeName());
+ }
+
+ if (axis != null && counter == 1 && domain1 != null) {
+ finished = true;
+ }
+ if (axis != null && counter == 2 && domain1 != null && domain2 != null) {
+ finished = true;
+ }
+
+ if (finished == true) {
+ nextNode = node.getNextSibling();
+ }
+
+ node = node.getNextSibling();
+ }
+
+ if (finished == true) {
+ convertToPixelCoordinates();
+ }
+ }
+
+
+ /* If input coordinates are geo-, convert them to pixel coordinates. */
+ private void convertToPixelCoordinates() {
+ if (meta.getCrs() == null && crs != null && crs.getName().equals(DomainElement.WGS84_CRS)) {
+ throw new RuntimeException("Coverage '" + meta.getCoverageName()
+ + "' is not georeferenced with 'EPSG:4326' coordinate system.");
+ }
+ if (counter == 2 && crs != null && domain1.isSingleValue() && domain2.isSingleValue()) {
+ if (crs.getName().equals(DomainElement.WGS84_CRS)) {
+ log.debug("CRS is '{}' and should be equal to '{}'", crs.getName(), DomainElement.WGS84_CRS);
+ try {
+ this.transformedCoordinates = true;
+ // Convert to pixel coordinates
+ Double val1 = domain1.getSingleValue();
+ Double val2 = domain2.getSingleValue();
+ String axisName = axis.toRasQL().toUpperCase();
+ if (axisName.equals("X")) {
+ long[] pCoord = crs.convertToPixelCoordinates(meta, "X", val1, val2, null, null);
+ coord1 = pCoord[0];
+ coord2 = pCoord[1];
+ }
+ if (axisName.equals("Y")) {
+ long[] pCoord = crs.convertToPixelCoordinates(meta, "Y", null, null, val1, val2);
+ coord1 = pCoord[2];
+ coord2 = pCoord[3];
+ }
+ } catch (WCSException e) {
+ this.transformedCoordinates = false;
+ log.error("Error while transforming geo-coordinates to pixel coordinates."
+ + "The metadata is probably not valid.");
+ }
+ }
+ }
+ }
+
+ /* Not used */
+ public String toRasQL() {
+ return "<DimensionIntervalElement Not Converted to RasQL>";
+ }
+
+ public CoverageInfo getCoverageInfo() {
+ return info;
+ }
+
+ public Node getNextNode() {
+ return nextNode;
+ }
+
+ public String getAxisName() {
+ return this.axis.toRasQL();
+ }
+
+ public String getAxisCoords() {
+ return this.domain1.toRasQL() + " : " + this.domain2.toRasQL();
+ }
+
+ public String getLowCoord() {
+ if (transformedCoordinates) {
+ return String.valueOf(coord1);
+ } else {
+ return this.domain1.toRasQL();
+ }
+ }
+
+ public String getHighCoord() {
+ if (transformedCoordinates) {
+ return String.valueOf(coord2);
+ } else {
+ return this.domain2.toRasQL();
+ }
+ }
+}
diff --git a/petascope/src/petascope/wcps/server/core/DimensionIntervalList.java b/petascope/src/petascope/wcps/server/core/DimensionIntervalList.java
index 21ce9e1..9e2a589 100644
--- a/petascope/src/petascope/wcps/server/core/DimensionIntervalList.java
+++ b/petascope/src/petascope/wcps/server/core/DimensionIntervalList.java
@@ -14,43 +14,41 @@
* 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.InvalidCrsException;
-import petascope.wcps.server.exceptions.WCPSException;
-import java.util.ArrayList;
-import java.util.List;
-import org.w3c.dom.*;
-
-public class DimensionIntervalList {
-
- private ArrayList<IRasNode> list;
-
- public DimensionIntervalList(Node node, XmlQuery xq, CoverageInfo info)
- throws WCPSException, InvalidCrsException {
- System.err.println("Parsing a Dimension Interval List ...");
-
- while (node != null) {
- list = new ArrayList<IRasNode>();
- try {
- System.err.println("Parsing one dimension interval element ...");
- DimensionIntervalElement elem = new DimensionIntervalElement(node, xq, info);
- node = elem.getNextNode();
- list.add(elem);
- } catch (WCPSException e) {
- System.err.println("Failed to parse this dimension interval element !");
- System.err.println("Current node: " + node);
- }
- }
- }
-
- public List getAxisList() {
- return list;
- }
-}
+package petascope.wcps.server.core;
+
+import petascope.exceptions.WCPSException;
+import java.util.ArrayList;
+import java.util.List;
+import org.w3c.dom.*;
+
+public class DimensionIntervalList {
+
+ private ArrayList<IRasNode> list;
+
+ public DimensionIntervalList(Node node, XmlQuery xq, CoverageInfo info)
+ throws WCPSException {
+ System.err.println("Parsing a Dimension Interval List ...");
+
+ while (node != null) {
+ list = new ArrayList<IRasNode>();
+ try {
+ System.err.println("Parsing one dimension interval element ...");
+ DimensionIntervalElement elem = new DimensionIntervalElement(node, xq, info);
+ node = elem.getNextNode();
+ list.add(elem);
+ } catch (WCPSException e) {
+ System.err.println("Failed to parse this dimension interval element !");
+ System.err.println("Current node: " + node);
+ }
+ }
+ }
+
+ public List getAxisList() {
+ return list;
+ }
+}
diff --git a/petascope/src/petascope/wcps/server/core/DimensionPointElement.java b/petascope/src/petascope/wcps/server/core/DimensionPointElement.java
index d4aa0eb..6bdbf67 100644
--- a/petascope/src/petascope/wcps/server/core/DimensionPointElement.java
+++ b/petascope/src/petascope/wcps/server/core/DimensionPointElement.java
@@ -14,118 +14,116 @@
* 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.InvalidCrsException;
-import petascope.wcps.server.exceptions.WCPSException;
-import org.w3c.dom.*;
-
-public class DimensionPointElement implements IRasNode {
-
- private IRasNode domain, child;
- private AxisName axis;
- private Crs crs;
- private boolean finished = false;
- private Node nextNode;
-
- public DimensionPointElement(Node node, XmlQuery xq)
- throws WCPSException, InvalidCrsException {
- System.err.println("Trying to parse DimensionPointElement expression...");
- String name;
-
- while ((node != null) && node.getNodeName().equals("#text")) {
- node = node.getNextSibling();
- }
-
- while (node != null && finished == false) {
- if (node.getNodeName().equals("#text")) {
- node = node.getNextSibling();
- continue;
- }
-
- name = node.getNodeName();
- System.err.println("Current node is " + name);
-
- // Try Axis
- try {
- axis = new AxisName(node, xq);
- node = node.getNextSibling();
- continue;
- } catch (WCPSException e) {
- System.err.println("Failed to parse an axis!");
- }
-
- // Try CRS name
- try {
- crs = new Crs(node, xq);
- node = node.getNextSibling();
- if (axis == null) {
- throw new WCPSException("Expected Axis node before CRS !");
- }
- continue;
- } catch (WCPSException e) {
- System.err.println("Failed to parse a crs!");
- }
-
- // TODO: how to implement DomainMetadataExpr ?
-
-// // Try last thing
-// try
-// {
-// domain1 = new DomainMetadataExprType(node, xq);
-// counter = 1;
-// continue;
-// }
-// catch (WCPSException e)
-// {
-// System.err.println("Failed to parse domain metadata!");
-// }
-
- // Then it must be a "slicingPosition"
- if (node.getNodeName().equals("slicingPosition")) {
- domain = new ScalarExpr(node.getFirstChild(), xq);
- if (axis == null) {
- throw new WCPSException("Expected <axis> node before <slicingPosition> !");
- }
- } else {
- throw new WCPSException("Unexpected node: " + node.getFirstChild().getNodeName());
- }
-
- if (axis != null && domain != null) {
- finished = true;
- }
-
- if (finished == true) {
- nextNode = node.getNextSibling();
- }
-
- node = node.getNextSibling();
- }
- }
-
- public String toRasQL() {
- return child.toRasQL();
- }
-
- public Node getNextNode() {
- return nextNode;
- }
-
- public String getAxisName() {
- return this.axis.toRasQL();
- }
-
- public String getCrsName() {
- return this.crs.toRasQL();
- }
-
- public String getSlicingPosition() {
- return this.domain.toRasQL();
- }
-}
+package petascope.wcps.server.core;
+
+import petascope.exceptions.WCPSException;
+import org.w3c.dom.*;
+
+public class DimensionPointElement implements IRasNode {
+
+ private IRasNode domain, child;
+ private AxisName axis;
+ private Crs crs;
+ private boolean finished = false;
+ private Node nextNode;
+
+ public DimensionPointElement(Node node, XmlQuery xq)
+ throws WCPSException {
+ System.err.println("Trying to parse DimensionPointElement expression...");
+ String name;
+
+ while ((node != null) && node.getNodeName().equals("#text")) {
+ node = node.getNextSibling();
+ }
+
+ while (node != null && finished == false) {
+ if (node.getNodeName().equals("#text")) {
+ node = node.getNextSibling();
+ continue;
+ }
+
+ name = node.getNodeName();
+ System.err.println("Current node is " + name);
+
+ // Try Axis
+ try {
+ axis = new AxisName(node, xq);
+ node = node.getNextSibling();
+ continue;
+ } catch (WCPSException e) {
+ System.err.println("Failed to parse an axis!");
+ }
+
+ // Try CRS name
+ try {
+ crs = new Crs(node, xq);
+ node = node.getNextSibling();
+ if (axis == null) {
+ throw new WCPSException("Expected Axis node before CRS !");
+ }
+ continue;
+ } catch (WCPSException e) {
+ System.err.println("Failed to parse a crs!");
+ }
+
+ // TODO: how to implement DomainMetadataExpr ?
+
+// // Try last thing
+// try
+// {
+// domain1 = new DomainMetadataExprType(node, xq);
+// counter = 1;
+// continue;
+// }
+// catch (WCPSException e)
+// {
+// System.err.println("Failed to parse domain metadata!");
+// }
+
+ // Then it must be a "slicingPosition"
+ if (node.getNodeName().equals("slicingPosition")) {
+ domain = new ScalarExpr(node.getFirstChild(), xq);
+ if (axis == null) {
+ throw new WCPSException("Expected <axis> node before <slicingPosition> !");
+ }
+ } else {
+ throw new WCPSException("Unexpected node: " + node.getFirstChild().getNodeName());
+ }
+
+ if (axis != null && domain != null) {
+ finished = true;
+ }
+
+ if (finished == true) {
+ nextNode = node.getNextSibling();
+ }
+
+ node = node.getNextSibling();
+ }
+ }
+
+ public String toRasQL() {
+ return child.toRasQL();
+ }
+
+ public Node getNextNode() {
+ return nextNode;
+ }
+
+ public String getAxisName() {
+ return this.axis.toRasQL();
+ }
+
+ public String getCrsName() {
+ return this.crs.toRasQL();
+ }
+
+ public String getSlicingPosition() {
+ return this.domain.toRasQL();
+ }
+}
diff --git a/petascope/src/petascope/wcps/server/core/DomainElement.java b/petascope/src/petascope/wcps/server/core/DomainElement.java
index 098797a..bbf534e 100644
--- a/petascope/src/petascope/wcps/server/core/DomainElement.java
+++ b/petascope/src/petascope/wcps/server/core/DomainElement.java
@@ -14,181 +14,187 @@
* 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.InvalidMetadataException;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-
-/**
- * This is an axis in geographic coordinates. See the WCPS standard.
- */
-public class DomainElement implements Cloneable {
-
- public static final String WGS84_CRS = "EPSG:4326";
- public static final String IMAGE_CRS = "CRS:1";
- private Set<String> crss;
- private String name;
- private Double numHi;
- private Double numLo;
- private String strHi;
- private String strLo;
- private String type;
- private Collection<String> allowedAxes;
-
- public DomainElement(String name, String type, Double numLo, Double numHi, String strLo,
- String strHi, Set<String> crss, Collection<String> axes)
- throws InvalidMetadataException {
- this.allowedAxes = axes;
-
- if ((name == null) || (type == null)) {
- throw new InvalidMetadataException(
- "Invalid domain element: Element name and type cannot be null");
- }
-
- if (name.equals("")) {
- throw new InvalidMetadataException(
- "Invalid domain element: Element name cannot be empty");
- }
-
- if (allowedAxes.contains(type) == false) {
- throw new InvalidMetadataException(
- "Invalid domain element: Invalid element type: " + type
- + ". Allowed element types are: " + allowedAxes.toString());
- }
-
- if ((numLo != null) && (numHi != null) && (strLo == null) && (strHi == null)) {
- if (numLo.compareTo(numHi) == 1) {
- throw new InvalidMetadataException(
- "Invalid domain element: Lower integer bound cannot be larger than upper integer bound");
- }
-
- this.numLo = numLo;
- this.numHi = numHi;
- } else if ((strLo != null) && (numHi != null) && (numLo == null) && (numHi == null)) {
- if (strLo.equals("") || strHi.equals("")) {
- throw new InvalidMetadataException(
- "Invalid domain element: String bounds cannot be empty");
- }
-
- this.strLo = strLo;
- this.strHi = strHi;
- } else {
- /* Allow both sources of info for time-axes */
- if (type.equals("t")) {
- this.strLo = strLo;
- this.strHi = strHi;
- this.numLo = numLo;
- this.numHi = numHi;
- } else {
- throw new InvalidMetadataException(
- "Invalid domain element: Integer bounds must both be non-null if string bounds are null, and vice versa at "
- + name + ":" + type);
- }
- }
-
- if ((type.equals("x") || type.equals("y")) && (numLo == null)) {
- throw new InvalidMetadataException(
- "Invalid domain element: A spatial axis must have integer extent");
- } else if (type.equals("temporal") && (strLo == null)) {
- throw new InvalidMetadataException(
- "Invalid domain element: A temporal axis must have string extent");
- } else if (type.equals("t") && (numLo == null) || (numHi == null)) {
- throw new InvalidMetadataException("Invalid domain element: A \"t\" axis must have integer extent and optionally, string extent");
- }
-
- this.name = name;
- this.type = type;
-
- if ((crss == null) || !crss.contains(IMAGE_CRS)) {
-// throw new InvalidMetadataException(
-// "Invalid domain element: CRS set does not contain image CRS '"
-// + IMAGE_CRS + "'");
- crss.add(IMAGE_CRS);
- }
-
- this.crss = crss;
-
- }
-
- @Override
- public DomainElement clone() {
- Set<String> c = new HashSet<String>(crss.size());
- Iterator<String> i = crss.iterator();
-
- while (i.hasNext()) {
- c.add(new String(i.next()));
- }
-
- try {
- String newName = name == null ? null : new String(name);
- String newType = type == null ? null : new String(type);
- Double newNumLo = numLo == null ? null : new Double(numLo);
- Double newNumHi = numHi == null ? null : new Double(numHi);
- String newStrLo = strLo == null ? null : new String(strLo);
- String newStrHi = strHi == null ? null : new String(strHi);
- return new DomainElement(newName, newType, newNumLo, newNumHi, newStrLo, newStrHi, c, allowedAxes);
- } catch (InvalidMetadataException ime) {
- throw new RuntimeException(
- "Invalid metadata while cloning DomainElement. This is a software bug in WCPS.",
- ime);
- }
-
- }
-
- public boolean equals(DomainElement de) {
- if ((numLo == null) && (de.numLo == null)) {
- return strLo.equals(de.strLo) && strHi.equals(strHi)
- && name.equals(de.name) && type.equals(de.type);
- } else if ((strLo == null) && (de.strLo == null)) {
- return numLo.equals(de.numLo) && numHi.equals(numHi)
- && name.equals(de.name) && type.equals(de.type);
- } else {
- return false;
- }
- }
-
- public String getName() {
- return name;
- }
-
- public Double getNumHi() {
- return numHi;
- }
-
- public Double getNumLo() {
- return numLo;
- }
-
- public String getStrHi() {
- return strHi;
- }
-
- public String getStrLo() {
- return strLo;
- }
-
- public String getType() {
- return type;
- }
-
- public Set<String> getCrsSet() {
- return crss;
- }
-
- @Override
- public String toString() {
- String d = "Domain Element { Name: '" + name + "', Type: '" + type
- + "', NumLow: '" + numLo + "', NumHi: '" + numHi + "', StrLow: '"
- + strLo + "', StrHi: '" + strHi + "', CrsSet: '" + crss + "'}";
- return d;
- }
-}
+package petascope.wcps.server.core;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+import petascope.exceptions.ExceptionCode;
+import petascope.exceptions.WCPSException;
+
+/**
+ * This is an axis in geographic coordinates. See the WCPS standard.
+ */
+public class DomainElement implements Cloneable {
+
+ public static final String WGS84_CRS = "EPSG:4326";
+ public static final String IMAGE_CRS = "CRS:1";
+ private Set<String> crss;
+ private String name;
+ private Double numHi;
+ private Double numLo;
+ private String strHi;
+ private String strLo;
+ private String type;
+ private String uom;
+ private Collection<String> allowedAxes;
+
+ public DomainElement(String name, String type, Double numLo, Double numHi, String strLo,
+ String strHi, Set<String> crss, Collection<String> axes, String uom) throws WCPSException
+ {
+ this.allowedAxes = axes;
+
+ if ((name == null) || (type == null)) {
+ throw new WCPSException(ExceptionCode.InvalidMetadata,
+ "Invalid domain element: Element name and type cannot be null");
+ }
+
+ if (name.equals("")) {
+ throw new WCPSException(ExceptionCode.InvalidMetadata,
+ "Invalid domain element: Element name cannot be empty");
+ }
+
+ if (allowedAxes.contains(type) == false) {
+ throw new WCPSException(ExceptionCode.InvalidMetadata,
+ "Invalid domain element: Invalid element type: " + type
+ + ". Allowed element types are: " + allowedAxes.toString());
+ }
+
+ if ((numLo != null) && (numHi != null) && (strLo == null) && (strHi == null)) {
+ if (numLo.compareTo(numHi) == 1) {
+ throw new WCPSException(ExceptionCode.InvalidMetadata,
+ "Invalid domain element: Lower integer bound cannot be larger than upper integer bound");
+ }
+
+ this.numLo = numLo;
+ this.numHi = numHi;
+ } else if ((strLo != null) && (numHi != null) && (numLo == null) && (numHi == null)) {
+ if (strLo.equals("") || strHi.equals("")) {
+ throw new WCPSException(ExceptionCode.InvalidMetadata,
+ "Invalid domain element: String bounds cannot be empty");
+ }
+
+ this.strLo = strLo;
+ this.strHi = strHi;
+ } else {
+ /* Allow both sources of info for time-axes */
+ if (type.equals("t")) {
+ this.strLo = strLo;
+ this.strHi = strHi;
+ this.numLo = numLo;
+ this.numHi = numHi;
+ } else {
+ throw new WCPSException(ExceptionCode.InvalidMetadata,
+ "Invalid domain element: Integer bounds must both be non-null if string bounds are null, and vice versa at "
+ + name + ":" + type);
+ }
+ }
+
+ if ((type.equals("x") || type.equals("y")) && (numLo == null)) {
+ throw new WCPSException(ExceptionCode.InvalidMetadata,
+ "Invalid domain element: A spatial axis must have integer extent");
+ } else if (type.equals("temporal") && (strLo == null)) {
+ throw new WCPSException(ExceptionCode.InvalidMetadata,
+ "Invalid domain element: A temporal axis must have string extent");
+ } else if (type.equals("t") && (numLo == null) || (numHi == null)) {
+ throw new WCPSException(ExceptionCode.InvalidMetadata, "Invalid domain element: A \"t\" axis must have integer extent and optionally, string extent");
+ }
+
+ this.name = name;
+ this.type = type;
+
+ if ((crss == null) || !crss.contains(IMAGE_CRS)) {
+// throw new WCPSException(ExceptionCode.InvalidMetadata,
+// "Invalid domain element: CRS set does not contain image CRS '"
+// + IMAGE_CRS + "'");
+ crss.add(IMAGE_CRS);
+ }
+
+ this.crss = crss;
+
+ }
+
+ @Override
+ public DomainElement clone() {
+ Set<String> c = new HashSet<String>(crss.size());
+ Iterator<String> i = crss.iterator();
+
+ while (i.hasNext()) {
+ c.add(new String(i.next()));
+ }
+
+ try {
+ String newName = name == null ? null : new String(name);
+ String newType = type == null ? null : new String(type);
+ Double newNumLo = numLo == null ? null : new Double(numLo);
+ Double newNumHi = numHi == null ? null : new Double(numHi);
+ String newStrLo = strLo == null ? null : new String(strLo);
+ String newStrHi = strHi == null ? null : new String(strHi);
+ String newUom = uom == null ? null : new String(uom);
+ return new DomainElement(newName, newType, newNumLo, newNumHi, newStrLo, newStrHi, c, allowedAxes, newUom);
+ } catch (WCPSException ime) {
+ throw new RuntimeException(
+ "Invalid metadata while cloning DomainElement. This is a software bug in WCPS.",
+ ime);
+ }
+
+ }
+
+ public boolean equals(DomainElement de) {
+ if ((numLo == null) && (de.numLo == null)) {
+ return strLo.equals(de.strLo) && strHi.equals(strHi)
+ && name.equals(de.name) && type.equals(de.type);
+ } else if ((strLo == null) && (de.strLo == null)) {
+ return numLo.equals(de.numLo) && numHi.equals(numHi)
+ && name.equals(de.name) && type.equals(de.type);
+ } else {
+ return false;
+ }
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public Double getNumHi() {
+ return numHi;
+ }
+
+ public Double getNumLo() {
+ return numLo;
+ }
+
+ public String getStrHi() {
+ return strHi;
+ }
+
+ public String getStrLo() {
+ return strLo;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public Set<String> getCrsSet() {
+ return crss;
+ }
+
+ public String getUom() {
+ return uom;
+ }
+
+ @Override
+ public String toString() {
+ String d = "Domain Element { Name: '" + name + "', Type: '" + type
+ + "', NumLow: '" + numLo + "', NumHi: '" + numHi + "', StrLow: '"
+ + strLo + "', StrHi: '" + strHi + "', CrsSet: '" + crss + "'}";
+ return d;
+ }
+}
diff --git a/petascope/src/petascope/wcps/server/core/DynamicMetadataSource.java b/petascope/src/petascope/wcps/server/core/DynamicMetadataSource.java
deleted file mode 100644
index 420899f..0000000
--- a/petascope/src/petascope/wcps/server/core/DynamicMetadataSource.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * This file is part of rasdaman community.
- *
- * Rasdaman community is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Rasdaman community is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * 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.
- *
- * 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.ResourceException;
-import petascope.wcps.server.exceptions.InvalidWcpsRequestException;
-import petascope.wcps.server.exceptions.InvalidMetadataException;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * A IMetadataSource that allows WCPS to store information about on-the-fly
- * constructed coverages (for example Construct Coverage expr).
- * Needs another MetadataSource as a backend, to retrieve metadata about
- * static coverages.
- */
-public class DynamicMetadataSource implements IDynamicMetadataSource {
- // Static coverages, served by the server at all times
-
- private Set<String> staticCoverageNames;
- // Dynamic coverages, built on-the-fly in a query
- private Set<String> dynamicCoverageNames;
- // Union of static and dynamic coverages
- private Set<String> allCoverageNames;
- // Metadata information for all available coverages
- private Map<String, Metadata> metadata;
- // Other metadata class that serves as backend
- private IMetadataSource metadataSource;
-
- public DynamicMetadataSource(IMetadataSource metadataSource)
- throws ResourceException, InvalidMetadataException {
- this.metadataSource = metadataSource;
- staticCoverageNames = metadataSource.coverages();
- dynamicCoverageNames = new HashSet<String>();
- allCoverageNames = staticCoverageNames;
- metadata = new HashMap<String, Metadata>();
-
- // Init metadata for static coverages
- Iterator<String> i = staticCoverageNames.iterator();
- try {
- while (i.hasNext()) {
- String coverage = i.next();
- metadata.put(coverage, metadataSource.read(coverage));
- }
- } catch (InvalidWcpsRequestException ire) {
- throw (InvalidMetadataException) ire.getCause();
- }
- }
-
- public Set<String> coverages() throws ResourceException {
- return metadataSource.coverages();
- }
-
- public String formatToMimetype(String format) {
- return metadataSource.formatToMimetype(format);
- }
-
- public Metadata read(String coverageName) throws InvalidWcpsRequestException, ResourceException {
- if ((coverageName == null) || coverageName.equals("")) {
- throw new InvalidWcpsRequestException(
- "Cannot retrieve coverage with null or empty name");
- }
-
- if (!this.coverages().contains(coverageName)) {
- throw new InvalidWcpsRequestException("Coverage '" + coverageName
- + "' is not served by this server");
- }
-
- return metadataSource.read(coverageName);
- }
-
- public void addDynamicMetadata(String coverageName, Metadata meta) {
- metadata.put(coverageName, meta);
- dynamicCoverageNames.add(coverageName);
- allCoverageNames = staticCoverageNames;
- allCoverageNames.addAll(dynamicCoverageNames);
- }
-
- public Collection<String> getAxisNames() {
- return metadataSource.getAxisNames();
- }
-}
diff --git a/petascope/src/petascope/wcps/server/core/EncodeDataExpr.java b/petascope/src/petascope/wcps/server/core/EncodeDataExpr.java
index dffccc0..4ee8642 100644
--- a/petascope/src/petascope/wcps/server/core/EncodeDataExpr.java
+++ b/petascope/src/petascope/wcps/server/core/EncodeDataExpr.java
@@ -14,84 +14,82 @@
* 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.InvalidCrsException;
-import petascope.wcps.server.exceptions.WCPSException;
-import org.w3c.dom.*;
-
-// This is the equivalent of the "ProcessingExprType" complex XML type.
-public class EncodeDataExpr implements IRasNode {
-
- private IRasNode coverageExprType;
- private String extraParams;
- private String format;
- private String mime;
- private Boolean store;
-
- public EncodeDataExpr(Node node, XmlQuery request) throws WCPSException, InvalidCrsException {
- Node child;
- String nodeName;
-
- for (child = node.getFirstChild(); child != null; child = child.getNextSibling()) {
- nodeName = child.getNodeName();
-
- if (nodeName.equals("#text")) {
- continue;
- }
-
- System.err.println("Encode : node : " + child.getNodeName());
-
- if (nodeName.equals("format")) {
- format = child.getFirstChild().getNodeValue();
- mime = request.getMetadataSource().formatToMimetype(format);
- continue;
- }
-
- if (nodeName.equals("extraParameters")) {
- extraParams = child.getFirstChild().getNodeValue();
- continue;
- }
-
- coverageExprType = new CoverageExpr(child, request);
- }
-
- Node _store = node.getAttributes().getNamedItem("store");
-
- if (_store != null) {
- store = _store.getNodeValue().equals("true");
- }
- }
-
- public String getMime() {
- return mime;
- }
-
- public String toRasQL() {
- // TODO: cjucovschi - implement store
-
- String result;
-
- if (format.equals("raw")) {
- result = coverageExprType.toRasQL();
- } else {
- result = format + "(" + coverageExprType.toRasQL();
-
- if (extraParams != null) {
- extraParams = '"' + extraParams + '"';
- result = result + ", " + extraParams;
- }
-
- result = result + ")";
- }
-
- System.err.println("Returning EncodeExpression:" + result);
- return result;
- }
-}
+package petascope.wcps.server.core;
+
+import petascope.exceptions.WCPSException;
+import org.w3c.dom.*;
+
+// This is the equivalent of the "ProcessingExprType" complex XML type.
+public class EncodeDataExpr implements IRasNode {
+
+ private IRasNode coverageExprType;
+ private String extraParams;
+ private String format;
+ private String mime;
+ private Boolean store;
+
+ public EncodeDataExpr(Node node, XmlQuery request) throws WCPSException {
+ Node child;
+ String nodeName;
+
+ for (child = node.getFirstChild(); child != null; child = child.getNextSibling()) {
+ nodeName = child.getNodeName();
+
+ if (nodeName.equals("#text")) {
+ continue;
+ }
+
+ System.err.println("Encode : node : " + child.getNodeName());
+
+ if (nodeName.equals("format")) {
+ format = child.getFirstChild().getNodeValue();
+ mime = request.getMetadataSource().formatToMimetype(format);
+ continue;
+ }
+
+ if (nodeName.equals("extraParameters")) {
+ extraParams = child.getFirstChild().getNodeValue();
+ continue;
+ }
+
+ coverageExprType = new CoverageExpr(child, request);
+ }
+
+ Node _store = node.getAttributes().getNamedItem("store");
+
+ if (_store != null) {
+ store = _store.getNodeValue().equals("true");
+ }
+ }
+
+ public String getMime() {
+ return mime;
+ }
+
+ public String toRasQL() {
+ // TODO: cjucovschi - implement store
+
+ String result;
+
+ if (format.equals("raw")) {
+ result = coverageExprType.toRasQL();
+ } else {
+ result = format + "(" + coverageExprType.toRasQL();
+
+ if (extraParams != null) {
+ extraParams = '"' + extraParams + '"';
+ result = result + ", " + extraParams;
+ }
+
+ result = result + ")";
+ }
+
+ System.err.println("Returning EncodeExpression:" + result);
+ return result;
+ }
+}
diff --git a/petascope/src/petascope/wcps/server/core/ExtendCoverageExpr.java b/petascope/src/petascope/wcps/server/core/ExtendCoverageExpr.java
index 7f8e4e3..af6e77a 100644
--- a/petascope/src/petascope/wcps/server/core/ExtendCoverageExpr.java
+++ b/petascope/src/petascope/wcps/server/core/ExtendCoverageExpr.java
@@ -14,120 +14,118 @@
* 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.InvalidCrsException;
-import petascope.wcps.server.exceptions.WCPSException;
-import java.math.BigInteger;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import org.w3c.dom.*;
-
-public class ExtendCoverageExpr implements IRasNode, ICoverageInfo {
-
- private List<DimensionIntervalElement> axisList;
- private CoverageExpr coverageExprType;
- private CoverageInfo coverageInfo;
- private String[] dim;
- private int dims;
- private DimensionIntervalElement elem;
-
- public ExtendCoverageExpr(Node node, XmlQuery xq) throws WCPSException, InvalidCrsException {
-
- Node child, axisNode;
- String nodeName;
-
- axisList = new ArrayList<DimensionIntervalElement>();
-
- child = node.getFirstChild();
- while (child != null) {
- nodeName = child.getNodeName();
-
- if (nodeName.equals("#text")) {
- child = child.getNextSibling();
- continue;
- }
-
- try {
- System.err.println("Trying out an CoverageExprType group...");
- coverageExprType = new CoverageExpr(child, xq);
- coverageInfo = coverageExprType.getCoverageInfo();
- child = child.getNextSibling();
- continue;
- } catch (WCPSException e) {
- System.err.println("This was no CoverageExprType: " + nodeName);
- }
-
- try {
- // Start a new axis and save it
- elem = new DimensionIntervalElement(child, xq, coverageInfo);
- axisList.add(elem);
- child = elem.getNextNode();
- continue;
- } catch (WCPSException e) {
- System.err.println("This was no Dimension Interval ELement: " + child.getNodeName());
- }
-
- // else unknown element
- throw new WCPSException("Unknown node for ExtendCoverage expression:" + child.getNodeName());
- }
-
- dims = coverageInfo.getNumDimensions();
- dim = new String[dims];
-
- for (int j = 0; j < dims; ++j) {
- dim[j] = "*:*";
- }
-
-
- Iterator<DimensionIntervalElement> i = axisList.iterator();
- DimensionIntervalElement axis;
- int axisId;
- int axisLo, axisHi;
-
- while (i.hasNext()) {
- axis = i.next();
- axisId = coverageInfo.getDomainIndexByName(axis.getAxisName());
- System.out.println("Axis ID: " + axisId);
- System.out.println("Axis name: " + axis.getAxisName());
- System.out.print("Axis coords: ");
-
- axisLo = Integer.parseInt(axis.getLowCoord());
- axisHi = Integer.parseInt(axis.getHighCoord());
- dim[axisId] = axisLo + ":" + axisHi;
- coverageInfo.setCellDimension(
- axisId,
- new CellDomainElement(
- BigInteger.valueOf(axisLo), BigInteger.valueOf(axisHi)));
- }
-
-
- }
-
- public CoverageInfo getCoverageInfo() {
- return coverageInfo;
- }
-
- public String toRasQL() {
- String result = "extend(" + coverageExprType.toRasQL() + ",[";
-
- for (int j = 0; j < dims; ++j) {
- if (j > 0) {
- result += ",";
- }
-
- result += dim[j];
- }
-
- result += "])";
-
- return result;
- }
-}
+package petascope.wcps.server.core;
+
+import petascope.exceptions.WCPSException;
+import java.math.BigInteger;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import org.w3c.dom.*;
+
+public class ExtendCoverageExpr implements IRasNode, ICoverageInfo {
+
+ private List<DimensionIntervalElement> axisList;
+ private CoverageExpr coverageExprType;
+ private CoverageInfo coverageInfo;
+ private String[] dim;
+ private int dims;
+ private DimensionIntervalElement elem;
+
+ public ExtendCoverageExpr(Node node, XmlQuery xq) throws WCPSException {
+
+ Node child, axisNode;
+ String nodeName;
+
+ axisList = new ArrayList<DimensionIntervalElement>();
+
+ child = node.getFirstChild();
+ while (child != null) {
+ nodeName = child.getNodeName();
+
+ if (nodeName.equals("#text")) {
+ child = child.getNextSibling();
+ continue;
+ }
+
+ try {
+ System.err.println("Trying out an CoverageExprType group...");
+ coverageExprType = new CoverageExpr(child, xq);
+ coverageInfo = coverageExprType.getCoverageInfo();
+ child = child.getNextSibling();
+ continue;
+ } catch (WCPSException e) {
+ System.err.println("This was no CoverageExprType: " + nodeName);
+ }
+
+ try {
+ // Start a new axis and save it
+ elem = new DimensionIntervalElement(child, xq, coverageInfo);
+ axisList.add(elem);
+ child = elem.getNextNode();
+ continue;
+ } catch (WCPSException e) {
+ System.err.println("This was no Dimension Interval ELement: " + child.getNodeName());
+ }
+
+ // else unknown element
+ throw new WCPSException("Unknown node for ExtendCoverage expression:" + child.getNodeName());
+ }
+
+ dims = coverageInfo.getNumDimensions();
+ dim = new String[dims];
+
+ for (int j = 0; j < dims; ++j) {
+ dim[j] = "*:*";
+ }
+
+
+ Iterator<DimensionIntervalElement> i = axisList.iterator();
+ DimensionIntervalElement axis;
+ int axisId;
+ int axisLo, axisHi;
+
+ while (i.hasNext()) {
+ axis = i.next();
+ axisId = coverageInfo.getDomainIndexByName(axis.getAxisName());
+ System.out.println("Axis ID: " + axisId);
+ System.out.println("Axis name: " + axis.getAxisName());
+ System.out.print("Axis coords: ");
+
+ axisLo = Integer.parseInt(axis.getLowCoord());
+ axisHi = Integer.parseInt(axis.getHighCoord());
+ dim[axisId] = axisLo + ":" + axisHi;
+ coverageInfo.setCellDimension(
+ axisId,
+ new CellDomainElement(
+ BigInteger.valueOf(axisLo), BigInteger.valueOf(axisHi)));
+ }
+
+
+ }
+
+ public CoverageInfo getCoverageInfo() {
+ return coverageInfo;
+ }
+
+ public String toRasQL() {
+ String result = "extend(" + coverageExprType.toRasQL() + ",[";
+
+ for (int j = 0; j < dims; ++j) {
+ if (j > 0) {
+ result += ",";
+ }
+
+ result += dim[j];
+ }
+
+ result += "])";
+
+ return result;
+ }
+}
diff --git a/petascope/src/petascope/wcps/server/core/FieldInterpolationElement.java b/petascope/src/petascope/wcps/server/core/FieldInterpolationElement.java
index e791d22..f74a6de 100644
--- a/petascope/src/petascope/wcps/server/core/FieldInterpolationElement.java
+++ b/petascope/src/petascope/wcps/server/core/FieldInterpolationElement.java
@@ -14,67 +14,65 @@
* 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 org.w3c.dom.*;
-import petascope.wcps.server.exceptions.InvalidWcpsRequestException;
-
-public class FieldInterpolationElement implements IRasNode {
-
- private FieldName name;
- private InterpolationMethod interp;
- private Node nextNode;
-
- public FieldInterpolationElement(Node node, XmlQuery xq) throws WCPSException {
-
- throw new InvalidWcpsRequestException("Currently, our implementation does not allow specifying " +
- "interpolation methods or null resistances for the scale operation.");
-
- /*
- while ((node != null) && node.getNodeName().equals("#text")) {
- node = node.getNextSibling();
- }
-
- if (node == null) {
- throw new WCPSException("FieldInterpolationElementType parsing error!");
- }
-
- while (node != null)
- {
- String nodeName = node.getNodeName();
- while (node.getNodeName().equals("#text"))
- node = node.getNextSibling();
-
- if (nodeName.equals("name")) {
- this.name = new FieldName(node, xq);
- node = node.getNextSibling();
- continue;
- }
- else
- {
- interp = new InterpolationMethod(node, xq);
- node = interp.getNextNode();
- }
- }
- nextNode = node;
-
- */
- }
-
- public Node getNextNode()
- {
- return nextNode;
- }
-
- public String toRasQL() {
- // Since we only accept the default rasdaman interpolation methods, we do not need to specify it further
- return "";
- }
-};
+package petascope.wcps.server.core;
+
+import petascope.exceptions.WCPSException;
+import org.w3c.dom.*;
+
+public class FieldInterpolationElement implements IRasNode {
+
+ private FieldName name;
+ private InterpolationMethod interp;
+ private Node nextNode;
+
+ public FieldInterpolationElement(Node node, XmlQuery xq) throws WCPSException {
+
+ throw new WCPSException("Currently, our implementation does not allow specifying " +
+ "interpolation methods or null resistances for the scale operation.");
+
+ /*
+ while ((node != null) && node.getNodeName().equals("#text")) {
+ node = node.getNextSibling();
+ }
+
+ if (node == null) {
+ throw new WCPSException("FieldInterpolationElementType parsing error!");
+ }
+
+ while (node != null)
+ {
+ String nodeName = node.getNodeName();
+ while (node.getNodeName().equals("#text"))
+ node = node.getNextSibling();
+
+ if (nodeName.equals("name")) {
+ this.name = new FieldName(node, xq);
+ node = node.getNextSibling();
+ continue;
+ }
+ else
+ {
+ interp = new InterpolationMethod(node, xq);
+ node = interp.getNextNode();
+ }
+ }
+ nextNode = node;
+
+ */
+ }
+
+ public Node getNextNode()
+ {
+ return nextNode;
+ }
+
+ public String toRasQL() {
+ // Since we only accept the default rasdaman interpolation methods, we do not need to specify it further
+ return "";
+ }
+};
diff --git a/petascope/src/petascope/wcps/server/core/FieldName.java b/petascope/src/petascope/wcps/server/core/FieldName.java
index 1c373ed..1174e44 100644
--- a/petascope/src/petascope/wcps/server/core/FieldName.java
+++ b/petascope/src/petascope/wcps/server/core/FieldName.java
@@ -14,40 +14,39 @@
* 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 org.w3c.dom.*;
-
-public class FieldName implements IRasNode {
-
- private String name;
-
- public FieldName(Node node, XmlQuery xq) throws WCPSException {
- while ((node != null) && node.getNodeName().equals("#text")) {
- node = node.getNextSibling();
- }
-
- if (node == null) {
- throw new WCPSException("FieldNameType parsing error!");
- }
-
- String nodeName = node.getNodeName();
-
- if (nodeName.equals("name")) {
- this.name = node.getTextContent();
-
- System.err.println("Found field name: " + name);
- }
- }
-
- public String toRasQL() {
- return this.name;
- }
-};
+package petascope.wcps.server.core;
+
+import petascope.exceptions.WCPSException;
+import org.w3c.dom.*;
+
+public class FieldName implements IRasNode {
+
+ private String name;
+
+ public FieldName(Node node, XmlQuery xq) throws WCPSException {
+ while ((node != null) && node.getNodeName().equals("#text")) {
+ node = node.getNextSibling();
+ }
+
+ if (node == null) {
+ throw new WCPSException("FieldNameType parsing error!");
+ }
+
+ String nodeName = node.getNodeName();
+
+ if (nodeName.equals("name")) {
+ this.name = node.getTextContent();
+
+ System.err.println("Found field name: " + name);
+ }
+ }
+
+ public String toRasQL() {
+ return this.name;
+ }
+};
diff --git a/petascope/src/petascope/wcps/server/core/ICoverageInfo.java b/petascope/src/petascope/wcps/server/core/ICoverageInfo.java
index 572fc9a..d31cab6 100644
--- a/petascope/src/petascope/wcps/server/core/ICoverageInfo.java
+++ b/petascope/src/petascope/wcps/server/core/ICoverageInfo.java
@@ -14,13 +14,12 @@
* 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;
+package petascope.wcps.server.core;
interface ICoverageInfo {
diff --git a/petascope/src/petascope/wcps/server/core/IDynamicMetadataSource.java b/petascope/src/petascope/wcps/server/core/IDynamicMetadataSource.java
deleted file mode 100644
index cfa701e..0000000
--- a/petascope/src/petascope/wcps/server/core/IDynamicMetadataSource.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * This file is part of rasdaman community.
- *
- * Rasdaman community is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Rasdaman community is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * 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.
- *
- * For more information please see <http://www.rasdaman.org>
- * or contact Peter Baumann via <baumann@rasdaman.com>.
- */
-package petascope.wcps.server.core;
-
-/**
- * A IDynamicMetadataSource is an IMetadataSource that can also add information
- * about new coverages on-the-fly. This is useful for queries that construct
- * new coverages (see ConstructCoverage expression) but are not stored in the
- * database.
- */
-public interface IDynamicMetadataSource extends IMetadataSource {
-
- public void addDynamicMetadata(String coverageName, Metadata meta);
-}
diff --git a/petascope/src/petascope/wcps/server/core/IMetadataSource.java b/petascope/src/petascope/wcps/server/core/IMetadataSource.java
deleted file mode 100644
index bf8e120..0000000
--- a/petascope/src/petascope/wcps/server/core/IMetadataSource.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * This file is part of rasdaman community.
- *
- * Rasdaman community is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Rasdaman community is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * 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.
- *
- * 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.ResourceException;
-import petascope.wcps.server.exceptions.InvalidWcpsRequestException;
-import java.util.Collection;
-import java.util.Set;
-
-/**
- * A IMetadataSource is anything that can read metadata for a given coverage
- * name. It must be able to list all coverages which it knows, return Metadata
- * for each one, and also map a format (e.g. "png") to its formatToMimetype
- * (e.g. "image/png").
- */
-public interface IMetadataSource {
-
- public Set<String> coverages() throws ResourceException;
-
- public String formatToMimetype(String format);
-
- public Metadata read(String coverageName) throws InvalidWcpsRequestException, ResourceException;
-
- public Collection<String> getAxisNames();
-}
diff --git a/petascope/src/petascope/wcps/server/core/IRasNode.java b/petascope/src/petascope/wcps/server/core/IRasNode.java
index f30f79e..68df7b6 100644
--- a/petascope/src/petascope/wcps/server/core/IRasNode.java
+++ b/petascope/src/petascope/wcps/server/core/IRasNode.java
@@ -14,13 +14,12 @@
* 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;
+package petascope.wcps.server.core;
interface IRasNode {
diff --git a/petascope/src/petascope/wcps/server/core/InducedOperationCoverageExpr.java b/petascope/src/petascope/wcps/server/core/InducedOperationCoverageExpr.java
index 581b551..ad99e77 100644
--- a/petascope/src/petascope/wcps/server/core/InducedOperationCoverageExpr.java
+++ b/petascope/src/petascope/wcps/server/core/InducedOperationCoverageExpr.java
@@ -14,76 +14,74 @@
* 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.InvalidCrsException;
-import petascope.wcps.server.exceptions.WCPSException;
-import org.w3c.dom.*;
-
-public class InducedOperationCoverageExpr implements IRasNode, ICoverageInfo {
-
- private IRasNode child;
- private CoverageInfo info;
- private String operation = "";
-
- public InducedOperationCoverageExpr(Node node, XmlQuery xq)
- throws WCPSException, InvalidCrsException {
- String nodeName = node.getNodeName();
-
- System.err.println("Trying induced operation: " + nodeName);
- boolean okay = false; // will be true if the node is recognized
-
- if (nodeName.equals("rangeConstructor")) {
- operation = nodeName;
- child = new RangeCoverageExpr(node, xq);
- info = new CoverageInfo((((ICoverageInfo) child).getCoverageInfo()));
- } else { // Try one of the groups
- child = null;
-
- if (child == null) {
- try {
- child = new UnaryOperationCoverageExpr(node, xq);
- info = new CoverageInfo((((ICoverageInfo) child).getCoverageInfo()));
- System.err.println("*** Induced Operation SUCCESS: " + node.getNodeName());
- } catch (WCPSException e) {
- System.err.println("InducedOperation failed: " + node.getNodeName());
- child = null;
- if (e.getMessage().equals("Method not implemented")) {
- throw e;
- }
- }
- }
-
- if (child == null) {
- try {
- child = new BinaryOperationCoverageExpr(node, xq);
- info = new CoverageInfo((((ICoverageInfo) child).getCoverageInfo()));
- System.err.println("*** Binary Operation SUCCESS: " + node.getNodeName());
- } catch (WCPSException e) {
- System.err.println("Binary operation failed: " + node.getNodeName());
- child = null;
- }
- }
-
- if (child == null) {
- throw new WCPSException("Invalid induced coverage expression, next node: "
- + node.getNodeName());
- }
- }
-
- }
-
- public CoverageInfo getCoverageInfo() {
- return info;
- }
-
- public String toRasQL() {
- return child.toRasQL();
- }
-}
+package petascope.wcps.server.core;
+
+import petascope.exceptions.WCPSException;
+import org.w3c.dom.*;
+
+public class InducedOperationCoverageExpr implements IRasNode, ICoverageInfo {
+
+ private IRasNode child;
+ private CoverageInfo info;
+ private String operation = "";
+
+ public InducedOperationCoverageExpr(Node node, XmlQuery xq)
+ throws WCPSException {
+ String nodeName = node.getNodeName();
+
+ System.err.println("Trying induced operation: " + nodeName);
+ boolean okay = false; // will be true if the node is recognized
+
+ if (nodeName.equals("rangeConstructor")) {
+ operation = nodeName;
+ child = new RangeCoverageExpr(node, xq);
+ info = new CoverageInfo((((ICoverageInfo) child).getCoverageInfo()));
+ } else { // Try one of the groups
+ child = null;
+
+ if (child == null) {
+ try {
+ child = new UnaryOperationCoverageExpr(node, xq);
+ info = new CoverageInfo((((ICoverageInfo) child).getCoverageInfo()));
+ System.err.println("*** Induced Operation SUCCESS: " + node.getNodeName());
+ } catch (WCPSException e) {
+ System.err.println("InducedOperation failed: " + node.getNodeName());
+ child = null;
+ if (e.getMessage().equals("Method not implemented")) {
+ throw e;
+ }
+ }
+ }
+
+ if (child == null) {
+ try {
+ child = new BinaryOperationCoverageExpr(node, xq);
+ info = new CoverageInfo((((ICoverageInfo) child).getCoverageInfo()));
+ System.err.println("*** Binary Operation SUCCESS: " + node.getNodeName());
+ } catch (WCPSException e) {
+ System.err.println("Binary operation failed: " + node.getNodeName());
+ child = null;
+ }
+ }
+
+ if (child == null) {
+ throw new WCPSException("Invalid induced coverage expression, next node: "
+ + node.getNodeName());
+ }
+ }
+
+ }
+
+ public CoverageInfo getCoverageInfo() {
+ return info;
+ }
+
+ public String toRasQL() {
+ return child.toRasQL();
+ }
+}
diff --git a/petascope/src/petascope/wcps/server/core/InterpolationMethod.java b/petascope/src/petascope/wcps/server/core/InterpolationMethod.java
index 2379bef..d295c8d 100644
--- a/petascope/src/petascope/wcps/server/core/InterpolationMethod.java
+++ b/petascope/src/petascope/wcps/server/core/InterpolationMethod.java
@@ -14,72 +14,73 @@
* 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;
-
-//A pair of an interpolation type and a null resistance. See the WCPS standard for an explanation of these.
-import petascope.wcps.server.exceptions.InvalidMetadataException;
-
-public class InterpolationMethod implements Cloneable {
-
- private String interpolationType;
- private String nullResistance;
-
- public InterpolationMethod(String interpolationType, String nullResistance)
- throws InvalidMetadataException {
- if ((interpolationType == null)
- || !(interpolationType.equals("nearest") || interpolationType.equals("linear")
- || interpolationType.equals("cubic")
- || interpolationType.equals("quadratic")
- || interpolationType.equals("none"))) {
- throw new InvalidMetadataException("Invalid interpolation method: "
- + interpolationType
- + " is not a legal interpolation type");
- }
-
- this.interpolationType = interpolationType;
-
- if ((nullResistance == null)
- || !(nullResistance.equals("full") || nullResistance.equals("none")
- || nullResistance.equals("half") || nullResistance.equals("other"))) {
- throw new InvalidMetadataException("Invalid interpolation method: "
- + nullResistance
- + " is not a legal null resistance");
- }
-
- this.nullResistance = nullResistance;
-
- }
-
- public InterpolationMethod clone() {
- try {
- return new InterpolationMethod(interpolationType, nullResistance);
- } catch (InvalidMetadataException ime) {
- throw new RuntimeException(
- "Invalid metadata while cloning InterpolationMethod. This is a software bug in WCPS.",
- ime);
- }
-
- }
-
- public boolean equals(InterpolationMethod im) {
- return interpolationType.equals(im.interpolationType)
- && nullResistance.equals(im.nullResistance);
-
- }
-
- public String getInterpolationType() {
- return interpolationType;
-
- }
-
- public String getNullResistance() {
- return nullResistance;
-
- }
-}
+package petascope.wcps.server.core;
+
+
+//A pair of an interpolation type and a null resistance. See the WCPS standard for an explanation of these.
+import petascope.exceptions.ExceptionCode;
+import petascope.exceptions.WCPSException;
+
+public class InterpolationMethod implements Cloneable {
+
+ private String interpolationType;
+ private String nullResistance;
+
+ public InterpolationMethod(String interpolationType, String nullResistance) throws WCPSException
+ {
+ if ((interpolationType == null)
+ || !(interpolationType.equals("nearest") || interpolationType.equals("linear")
+ || interpolationType.equals("cubic")
+ || interpolationType.equals("quadratic")
+ || interpolationType.equals("none"))) {
+ throw new WCPSException(ExceptionCode.InvalidMetadata, "Invalid interpolation method: "
+ + interpolationType
+ + " is not a legal interpolation type");
+ }
+
+ this.interpolationType = interpolationType;
+
+ if ((nullResistance == null)
+ || !(nullResistance.equals("full") || nullResistance.equals("none")
+ || nullResistance.equals("half") || nullResistance.equals("other"))) {
+ throw new WCPSException(ExceptionCode.InvalidMetadata, "Invalid interpolation method: "
+ + nullResistance
+ + " is not a legal null resistance");
+ }
+
+ this.nullResistance = nullResistance;
+
+ }
+
+ public InterpolationMethod clone() {
+ try {
+ return new InterpolationMethod(interpolationType, nullResistance);
+ } catch (WCPSException ime) {
+ throw new RuntimeException(
+ "Invalid metadata while cloning InterpolationMethod. This is a software bug in WCPS.",
+ ime);
+ }
+
+ }
+
+ public boolean equals(InterpolationMethod im) {
+ return interpolationType.equals(im.interpolationType)
+ && nullResistance.equals(im.nullResistance);
+
+ }
+
+ public String getInterpolationType() {
+ return interpolationType;
+
+ }
+
+ public String getNullResistance() {
+ return nullResistance;
+
+ }
+}
diff --git a/petascope/src/petascope/wcps/server/core/Metadata.java b/petascope/src/petascope/wcps/server/core/Metadata.java
deleted file mode 100644
index 175830a..0000000
--- a/petascope/src/petascope/wcps/server/core/Metadata.java
+++ /dev/null
@@ -1,705 +0,0 @@
-/*
- * This file is part of rasdaman community.
- *
- * Rasdaman community is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Rasdaman community is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * 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.
- *
- * For more information please see <http://www.rasdaman.org>
- * or contact Peter Baumann via <baumann@rasdaman.com>.
- */
-package petascope.wcps.server.core;
-
-//~--- JDK imports ------------------------------------------------------------
-import petascope.wcps.server.exceptions.InvalidMetadataException;
-import java.math.BigInteger;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-import petascope.wcs.server.core.TimeString;
-
-/**
- * This class implements WCPS metadata. For information on what each field
- * means, see the WCPS standard. This class provides extensive error cheching
- * and well as various utility functions.
- */
-public class Metadata implements Cloneable {
-
- private List<CellDomainElement> cellDomain;
- private String coverageName;
- private int coverageId = -1; // Used when reading metadata from the DB
- private List<DomainElement> domain;
- private InterpolationMethod interpolationDefault;
- private Set<InterpolationMethod> interpolationSet;
- private String nullDefault;
- private Set<String> nullSet;
- private List<RangeElement> range;
- private String titleStr = "";
- private String abstractStr = "";
- private String keywordsStr = "";
- private Wgs84Crs crs = null;
- private CellDomainElement cellX, cellY, cellT;
- private DomainElement domX, domY, domT;
-
- public Metadata(List<CellDomainElement> cellDomain, List<RangeElement> range, Set<String> nullSet, String nullDefault, Set<InterpolationMethod> interpolationSet, InterpolationMethod interpolationDefault, String coverageName, List<DomainElement> domain, Wgs84Crs crs, String title, String abstr, String keywords) throws InvalidMetadataException {
- this(cellDomain, range, nullSet, nullDefault, interpolationSet, interpolationDefault, coverageName, domain, crs);
- this.titleStr = title;
- this.abstractStr = abstr;
- this.keywordsStr = keywords;
- }
-
- public Metadata(List<CellDomainElement> cellDomain, List<RangeElement> range, Set<String> nullSet, String nullDefault, Set<InterpolationMethod> interpolationSet, InterpolationMethod interpolationDefault, String coverageName, List<DomainElement> domain, Wgs84Crs crs) throws InvalidMetadataException {
- if ((cellDomain == null) || (range == null) || (coverageName == null) || (nullSet == null) || (interpolationSet == null)) {
- throw new InvalidMetadataException("Cell domain, range list, "
- + "coverage name, null set, and interpolation set cannot be null for coverage " + coverageName);
- }
-
- if (cellDomain.size() == 0) {
- throw new InvalidMetadataException("Invalid cell domain: At least "
- + "one element is required for coverage " + coverageName);
- }
-
- this.cellDomain = cellDomain;
-
- if (range.size() == 0) {
- throw new InvalidMetadataException("At least one range element is "
- + "required for coverage " + coverageName);
- }
-
- this.range = new ArrayList<RangeElement>(range.size());
- Iterator<RangeElement> ir = range.iterator();
-
- while (ir.hasNext()) {
- RangeElement next = ir.next();
- Iterator<RangeElement> j = this.range.iterator();
-
- while (j.hasNext()) {
- if (j.next().getName().equals(next.getName())) {
- throw new InvalidMetadataException("Duplicate range element"
- + " name encountered for coverage " + coverageName);
- }
- }
-
- this.range.add(next);
- }
-
- if (nullSet.size() == 0) {
- throw new InvalidMetadataException("Invalid null set: At least one "
- + "null value is required for coverage " + coverageName);
- }
-
- if (nullDefault == null) {
- throw new InvalidMetadataException("Invalid null default: Null "
- + "default cannot be null for coverage " + coverageName);
- }
-
- if (!nullSet.contains(nullDefault)) {
- throw new InvalidMetadataException("Invalid null default: Default "
- + "null value " + nullDefault + " is not part of the null set"
- + " for coverage " + coverageName);
- }
-
- Iterator<String> ns = nullSet.iterator();
-
- while (ns.hasNext()) {
- String nullVal = ns.next();
- List<String> nulls = SDU.str2string(nullVal);
-
- if (nulls.size() != range.size()) {
- throw new InvalidMetadataException("Invalid null value: "
- + nullVal + " must have " + range.size() + " axes "
- + "according to the range specified for coverage " + coverageName);
- }
-
- Iterator<String> i = nulls.iterator();
- Iterator<RangeElement> j = range.iterator();
-
- while (j.hasNext()) {
- RangeElement re = j.next();
-
- if (re.isBoolean()) {
- SDU.str2boolean(i.next());
- } else if (re.isIntegral()) {
- SDU.str2integer(i.next());
- } else if (re.isFloating()) {
- SDU.str2double(i.next());
- } else if (re.isComplex()) {
- SDU.str2complex(i.next());
- }
- }
- }
-
- this.nullSet = nullSet;
- this.nullDefault = nullDefault;
-
- if (interpolationSet.size() == 0) {
- throw new InvalidMetadataException("Invalid interpolation set: "
- + "At least one interpolation method is required for "
- + "coverage " + coverageName);
- }
-
- if (interpolationDefault == null) {
- interpolationDefault = new InterpolationMethod("none", "none");
- }
-
- boolean defaultContainedInSet = false;
- Iterator<InterpolationMethod> is = interpolationSet.iterator();
-
- while (is.hasNext()) {
- if (interpolationDefault.equals(is.next())) {
- defaultContainedInSet = true;
- }
- }
-
- if (!defaultContainedInSet) {
- throw new InvalidMetadataException("Invalid interpolation default:"
- + " Default interpolation method ("
- + interpolationDefault.getInterpolationType() + ","
- + interpolationDefault.getNullResistance() + ") is not part "
- + "of the interpolation set for coverage " + coverageName);
- }
-
- this.interpolationSet = interpolationSet;
- this.interpolationDefault = interpolationDefault;
- this.crs = crs;
-
- this.coverageName = coverageName;
-
- if (domain != null) {
- if (domain.size() != cellDomain.size()) {
- throw new InvalidMetadataException("Domain and cell domain "
- + "must have equal number of elements for coverage " + coverageName);
- }
-
- this.domain = new ArrayList<DomainElement>(domain.size());
- Iterator<DomainElement> i = domain.iterator();
- Iterator<CellDomainElement> ci = cellDomain.iterator();
-
- while (i.hasNext() && ci.hasNext()) {
- DomainElement next = i.next();
- CellDomainElement cell = ci.next();
- Iterator<DomainElement> j = this.domain.iterator();
- if (next.getType().equals("x")) {
- cellX = cell;
- }
- if (next.getType().equals("y")) {
- cellY = cell;
- }
- if (next.getType().equals("t") // || next.getType().equals("temporal")
- ) {
- cellT = cell;
- domT = next;
- }
-
- while (j.hasNext()) {
- DomainElement previous = j.next();
-
- // don't compare same objects
- if (next == previous) {
- continue;
- }
-
- if (previous.getName().equals(next.getName())) {
- throw new InvalidMetadataException("Duplicate domain "
- + "element name encountered for coverage " + coverageName);
- }
-
- if (previous.getType().equals("temporal") && next.getType().equals("temporal")) {
- throw new InvalidMetadataException("Domain can contain"
- + " at most one temporal axis for coverage " + coverageName);
- }
-
- if (previous.getType().equals("elevation") && next.getType().equals("elevation")) {
- throw new InvalidMetadataException("Domain can contain"
- + " at most one elevation axis for coverage " + coverageName);
- }
-
- if (previous.getType().equals("x") && next.getType().equals("x")) {
- throw new InvalidMetadataException("Domain can contain"
- + " at most one x axis for coverage " + coverageName);
- }
-
- if (previous.getType().equals("y") && next.getType().equals("y")) {
- throw new InvalidMetadataException("Domain can contain"
- + " at most one y axis for coverage " + coverageName);
- }
-
- if (next.getType().equals("x")) {
- boolean l = false;
- Iterator<DomainElement> k = domain.iterator();
-
- while (k.hasNext()) {
- if (k.next().getType().equals("y")) {
- l = true;
- }
- }
-
- if (l == false) {
- throw new InvalidMetadataException("If domain "
- + "contains a x axis, it must contain a y "
- + "axis as well for coverage " + coverageName);
- }
- } else if (next.getType().equals("y")) {
- boolean l = false;
- Iterator<DomainElement> k = domain.iterator();
-
- while (k.hasNext()) {
- if (k.next().getType().equals("x")) {
- l = true;
- }
- }
-
- if (l == false) {
- throw new InvalidMetadataException("If domain "
- + "contains a y axis, it must contain a x "
- + "axis as well for coverage " + coverageName);
- }
- }
- }
-
- this.domain.add(next);
- }
- }
-
- }
-
- @Override
- public Metadata clone() {
- try {
- List<CellDomainElement> cd = new ArrayList<CellDomainElement>(cellDomain.size());
- Iterator<CellDomainElement> i = cellDomain.iterator();
-
- while (i.hasNext()) {
- cd.add(i.next().clone());
- }
-
- List<RangeElement> r = new ArrayList<RangeElement>(range.size());
- Iterator<RangeElement> j = range.iterator();
-
- while (j.hasNext()) {
- r.add(j.next().clone());
- }
-
- List<DomainElement> d = new ArrayList<DomainElement>(domain.size());
- Iterator<DomainElement> k = domain.iterator();
-
- while (k.hasNext()) {
- d.add(k.next().clone());
- }
-
- Set<String> ns = new HashSet<String>(nullSet.size());
- Iterator<String> l = nullSet.iterator();
-
- while (l.hasNext()) {
- ns.add(new String(l.next()));
- }
-
- Set<InterpolationMethod> is = new HashSet<InterpolationMethod>(interpolationSet.size());
- Iterator<InterpolationMethod> m = interpolationSet.iterator();
-
- while (m.hasNext()) {
- is.add(m.next().clone());
- }
-
- return new Metadata(cd, r, ns, new String(nullDefault), is, interpolationDefault.clone(), new String(coverageName), d, crs, getAbstract(), getTitle(), getKeywords());
- } catch (InvalidMetadataException ime) {
- throw new RuntimeException("Invalid metadata while cloning "
- + "Metadata. This is a software bug in WCPS.", ime);
- }
-
- }
-
-// public CellDomainElement getCellDomain( int index ) {
-//
-// return cellDomain.get( index );
-//
-// }
- protected void setCoverageId(int id) {
- this.coverageId = id;
- }
-
- public int getCoverageId() {
- return coverageId;
- }
-
- public String getCoverageName() {
- return coverageName;
- }
-
- public String getAbstract() {
- return abstractStr;
- }
-
- public String getTitle() {
- return titleStr;
- }
-
- public String getKeywords() {
- return keywordsStr;
- }
-
- public Iterator<CellDomainElement> getCellDomainIterator() {
- return cellDomain.iterator();
-
- }
-
- public Iterator<DomainElement> getDomainIterator() {
- return domain.iterator();
- }
-
- public Iterator<RangeElement> getRangeIterator() {
- return range.iterator();
- }
-
- public Iterator<InterpolationMethod> getInterpolationMethodIterator() {
- return interpolationSet.iterator();
- }
-
-// public Iterator<CrsName> getCrsSetIterator()
-// {
-// return crsset.iterator();
-// }
- public Iterator<String> getNullSetIterator() {
- return nullSet.iterator();
- }
-
- public int getDimension() {
- return cellDomain.size();
- }
-
- public int getDomainIndexByName(String name) {
- Iterator<DomainElement> i = domain.iterator();
-
- for (int index = 0; i.hasNext(); index++) {
- if (i.next().getName().equals(name)) {
- return index;
- }
- }
-
- return -1;
- }
-
- public DomainElement getDomainByName(String name) {
- Iterator<DomainElement> i = domain.iterator();
-
- for (int index = 0; i.hasNext(); index++) {
- DomainElement dom = i.next();
- if (dom.getName().equals(name)) {
- return dom;
- }
- }
-
- return null;
- }
-
- public String getNullDefault() {
- return nullDefault;
-
- }
-
- public Set<String> getNullSet() {
- return nullSet;
-
- }
-
- public boolean isRangeBoolean() {
- Iterator<RangeElement> i = range.iterator();
-
- while (i.hasNext()) {
- if (!i.next().isBoolean()) {
- return false;
- }
- }
-
- return true;
-
- }
-
- public boolean isRangeComplex() {
- Iterator<RangeElement> i = range.iterator();
-
- while (i.hasNext()) {
- if (!i.next().isComplex()) {
- return false;
- }
- }
-
- return true;
-
- }
-
- public boolean isRangeIntegral() {
- Iterator<RangeElement> i = range.iterator();
-
- while (i.hasNext()) {
- if (!i.next().isIntegral()) {
- return false;
- }
- }
-
- return true;
-
- }
-
- public boolean isRangeFloating() {
- Iterator<RangeElement> i = range.iterator();
-
- while (i.hasNext()) {
- if (!i.next().isFloating()) {
- return false;
- }
- }
-
- return true;
-
- }
-
- public boolean isRangeNumeric() {
- Iterator<RangeElement> i = range.iterator();
-
- while (i.hasNext()) {
- if (!i.next().isNumeric()) {
- return false;
- }
- }
-
- return true;
-
- }
-
- public void setCoverageName(String coverageName) throws InvalidMetadataException {
- if (coverageName == null) {
- throw new InvalidMetadataException("Metadata transformation: Coverage name cannot be null");
- }
-
- this.coverageName = coverageName;
-
- }
-
-// public void setCrs( String crs ) throws InvalidMetadataException {
-//
-// if( crs == null ) {
-// throw new InvalidMetadataException( "Metadata transformation: CRS cannot be null" );
-// }
-// if( !(crs.equals( "" ) || crs.startsWith( "urn:ogc:def:crs:EPSG::" )) ) {
-// throw new InvalidMetadataException( "Metadata transformation: Invalid CRS" );
-// }
-// this.crs = crs;
-//
-// }
-// public void setInterpolationMethodList( List<String> interpolationMethodList ) throws InvalidMetadataException {
-//
-// this.interpolationMethodList = interpolationMethodList;
-// Iterator<String> is = interpolationMethodList.iterator();
-// while( is.hasNext() ) {
-// String next = is.next();
-// if( !(next.equals( "nearest neighbor" ) || next.equals( "bilinear" ) || next.equals( "bicubic" ) || next.equals( "lost area" ) || next.equals( "barycentric" )) ) {
-// throw new InvalidMetadataException( "Metadata transformation: Invalid interpolation method" );
-// }
-// }
-//
-// }
-// public void setNullValue( String nullValue ) {
-//
-// this.nullValue = nullValue;
-//
-// }
- public void setRangeType(String type) throws InvalidMetadataException {
- Iterator<RangeElement> i = range.iterator();
-
- while (i.hasNext()) {
- i.next().setType(type);
- }
-
- }
-
-// public void setRangeType( List<String> types ) throws InvalidMetadataException {
-//
-// if( types.size() != range.size() ) {
-// throw new InvalidMetadataException( "Invalid range type: New type has " + types.size() + " elements, but range has " + range.size() + " elements" );
-// }
-// Iterator<RangeElement> i = range.iterator();
-// Iterator<String> j = types.iterator();
-// while( i.hasNext() ) {
-// i.next().setType( j.next() );
-// }
-//
-// }
-// public void updateCellDomain( int index, BigInteger lo, BigInteger hi ) throws InvalidMetadataException {
-//
-// cellDomain.set( index, new CellDomainElement( lo, hi ) );
-//
-// }
-// public void updateDomain( int index, Double numLo, Double numHi, String strLo, String strHi ) throws InvalidMetadataException {
-//
-// DomainElement old = domain.get( index );
-// domain.set( index, new DomainElement( old.getName(), old.getType(), numLo, numHi, strLo, strHi ) );
-//
-// }
- public void updateNulls(Set<String> nullSet, String nullDefault) throws InvalidMetadataException {
- if (nullSet.size() == 0) {
- throw new InvalidMetadataException("Invalid null set: At least one null value is required");
- }
-
- if (nullDefault == null) {
- nullDefault = "0";
- }
-
- if (!nullSet.contains(nullDefault)) {
- throw new InvalidMetadataException("Invalid null default: Default null value " + nullDefault + " is not part of the null set");
- }
-
- this.nullSet = nullSet;
- this.nullDefault = nullDefault;
-
- }
-
- public String getInterpolationDefault() {
- return interpolationDefault.getInterpolationType();
- }
-
- public String getNullResistanceDefault() {
- return interpolationDefault.getNullResistance();
- }
-
- public Wgs84Crs getCrs() {
- return crs;
- }
-
- /**
- * @return the X if it exists
- */
- public CellDomainElement getXCellDomain() {
- return cellX;
- }
-
- /**
- * @return the Y if it exists
- */
- public CellDomainElement getYCellDomain() {
- return cellY;
- }
-
- /**
- * @return the T if it exists
- */
- public CellDomainElement getTCellDomain() {
- return cellT;
- }
-
- /**
- * @param titleStr the titleStr to set
- */
- public void setTitle(String titleStr) {
- this.titleStr = titleStr;
- }
-
- /**
- * @param abstractStr the abstractStr to set
- */
- public void setAbstract(String abstractStr) {
- this.abstractStr = abstractStr;
- }
-
- /**
- * @param keywordsStr the keywordsStr to set
- */
- public void setKeywords(String keywordsStr) {
- this.keywordsStr = keywordsStr;
- }
-
- /**
- * @param cellDomain the cellDomain to set
- */
- public void setCellDomain(List<CellDomainElement> cellDomain) {
- this.cellDomain = cellDomain;
- }
-
- /**
- * @param domain the domain to set
- */
- public void setDomain(List<DomainElement> domain) {
- this.domain = domain;
- }
-
- /**
- * @param range the range to set
- */
- public void setRange(List<RangeElement> range) {
- this.range = range;
- }
-
- /**
- * @param interpolationSet the interpolationSet to set
- */
- public void setInterpolationSet(Set<InterpolationMethod> interpolationSet) {
- this.interpolationSet = interpolationSet;
- }
-
- /**
- * @param interpolationDefault the interpolationDefault to set
- */
- public void setDefaultInterpolation(InterpolationMethod interpolationDefault) {
- this.interpolationDefault = interpolationDefault;
- }
-
- /**
- * Returns the maximal time position of the current coverage in ISO 8601 format, as string.
- * If there is no time-axis, returns null
- */
- public String getTimePeriodBeginning() {
- if (domT == null) {
- return null;
- }
- return domT.getStrLo();
- }
-
- /**
- * Returns the minimal time position of the current coverage in ISO 8601 format, as string.
- * If there is no time-axis, returns null
- */
- public String getTimePeriodEnd() {
- if (domT == null) {
- return null;
- }
- return domT.getStrHi();
- }
-
- /**
- * Returns the time span of the current coverage, as described in the metadata (in miliseconds).
- * If there is no metadata, returns -1.
- * Note that this function returns the absolute difference. It is the administrator's
- * responsibility to make sure that the metadata values are correct.
- */
- public long getTimeSpan() {
- if (domT == null) {
- return -1;
- }
- long result = TimeString.difference(getTimePeriodEnd(), getTimePeriodBeginning());
- return Math.abs(result);
- }
-
- /* Returns the difference between the maximum and the minimum time axis index.
- Returns -1 if there is no metadata. */
- public long getTimeIndexesSpan() {
- if (cellT == null) {
- return -1;
- }
- BigInteger big = cellT.getHi().subtract(cellT.getLo());
- return big.longValue();
- }
-}
diff --git a/petascope/src/petascope/wcps/server/core/MetadataScalarExpr.java b/petascope/src/petascope/wcps/server/core/MetadataScalarExpr.java
index 87b3045..cdc1eee 100644
--- a/petascope/src/petascope/wcps/server/core/MetadataScalarExpr.java
+++ b/petascope/src/petascope/wcps/server/core/MetadataScalarExpr.java
@@ -14,25 +14,24 @@
* 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 org.w3c.dom.*;
-
-// TODO: implement class MetadataScalarExprType
-public class MetadataScalarExpr implements IRasNode {
-
- public MetadataScalarExpr(Node node, XmlQuery xq) throws WCPSException {
- throw new WCPSException("Method not yet implemented !");
- }
-
- public String toRasQL() {
- return "";
- }
-}
+package petascope.wcps.server.core;
+
+import petascope.exceptions.WCPSException;
+import org.w3c.dom.*;
+
+// TODO: implement class MetadataScalarExprType
+public class MetadataScalarExpr implements IRasNode {
+
+ public MetadataScalarExpr(Node node, XmlQuery xq) throws WCPSException {
+ throw new WCPSException("Method not yet implemented !");
+ }
+
+ public String toRasQL() {
+ return "";
+ }
+}
diff --git a/petascope/src/petascope/wcps/server/core/NumericScalarExpr.java b/petascope/src/petascope/wcps/server/core/NumericScalarExpr.java
index 67b21b2..2b09e4f 100644
--- a/petascope/src/petascope/wcps/server/core/NumericScalarExpr.java
+++ b/petascope/src/petascope/wcps/server/core/NumericScalarExpr.java
@@ -14,161 +14,159 @@
* 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.InvalidCrsException;
-import petascope.wcps.server.exceptions.WCPSException;
-import org.w3c.dom.*;
-
-public class NumericScalarExpr implements IRasNode {
-
- private IRasNode first, second;
- private String op, value;
- private boolean twoChildren;
- private double dvalue;
-
- public NumericScalarExpr(Node node, XmlQuery xq) throws WCPSException, InvalidCrsException {
- twoChildren = false;
- String nodeName = node.getNodeName();
-
- op = "";
-
- System.err.println("Trying to parse numeric scalar expression ...");
-
- while ((node != null) && node.getNodeName().equals("#text")) {
- node = node.getNextSibling();
- }
-
- if (nodeName.equals("numericConstant")) {
- twoChildren = false;
- op = code(nodeName);
- value = node.getFirstChild().getNodeValue();
- try {
- dvalue = Double.parseDouble(value);
- } catch (NumberFormatException e) {
- throw new WCPSException("Could not understand constant: " + value);
- }
- } else if (nodeName.equals("complexConstant")
- || nodeName.equals("condense")
- || nodeName.equals("reduce")) {
- op = code(nodeName);
- twoChildren = false;
- if (nodeName.equals("complexConstant")) {
- first = new ComplexConstant(node, xq);
- }
- if (nodeName.equals("condense")) {
- first = new CondenseScalarExpr(node, xq);
- }
- if (nodeName.equals("reduce")) {
- first = new ReduceScalarExpr(node, xq);
- }
- } else if (nodeName.equals("numericUnaryMinus")
- || nodeName.equals("numericSqrt")
- || nodeName.equals("numericAbs")) {
- op = code(nodeName);
- twoChildren = false;
- first = new NumericScalarExpr(node.getFirstChild(), xq);
- } else if (nodeName.equals("numericAdd")
- || nodeName.equals("numericMinus")
- || nodeName.equals("numericMult")
- || nodeName.equals("numericDiv")) {
- try {
- op = code(nodeName);
- twoChildren = true;
- Node child = node.getFirstChild();
- first = new NumericScalarExpr(child, xq);
- second = new NumericScalarExpr(child.getNextSibling(), xq);
- } catch (WCPSException e) {
- System.err.println("Failed to parse a numeric expression pair !");
- }
- } else if (nodeName.equals("variableRef")) {
- try {
- op = code(nodeName);
- twoChildren = false;
- first = new VariableReference(node, xq);
- System.err.println("Matched variable reference: " + first.toRasQL());
- } catch (WCPSException e) {
- System.err.println("Failed to match variable reference: "
- + e.toString());
- }
- } else {
- throw new WCPSException("Unexpected Numeric Scalar Expression node : "
- + node.getNodeName());
- }
- }
-
- public String toRasQL() {
- String result = "";
- if (twoChildren == false)
- {
- if (op.equals("variable")) {
- result = first.toRasQL();
- } else if (op.equals("value")) {
- result = value;
- } else if (op.equals("-")) {
- result = "-" + first.toRasQL();
- } else if (op.equals("sqrt")) {
- result = "sqrt(" + first.toRasQL() + ")";
- } else if (op.equals("child")) {
- result = first.toRasQL();
- } else if (op.equals("abs")) {
- result = "abs(" + first.toRasQL() + ")";
- }
- }else if (twoChildren == true) {
- result = "(" + first.toRasQL() + ")" + op
- + "(" + second.toRasQL() + ")";
- } else {
- return " error ";
- }
-
- return result;
- }
-
- private String code(String name) {
- String op = "";
- if (name.equals("numericConstant")) {
- op = "value";
- }
- if (name.equals("numericUnaryMinus") || name.equals("numericMinus")) {
- op = "-";
- }
- if (name.equals("numericAdd")) {
- op = "+";
- }
- if (name.equals("numericMult")) {
- op = "*";
- }
- if (name.equals("numericDiv")) {
- op = "/";
- }
- if (name.equals("numericSqrt")) {
- op = "sqrt";
- }
- if (name.equals("numericAbs")) {
- op = "abs";
- }
- if (name.equals("condense") || name.equals("reduce")
- || name.equals("complexConstant")) {
- op = "child";
- }
- if (name.equals("variableRef")) {
- op = "variable";
- }
-
- return op;
- }
-
- public boolean isSingleValue() {
- return op.equals("value");
- }
-
- public double getSingleValue() {
- return dvalue;
- }
-}
+package petascope.wcps.server.core;
+
+import petascope.exceptions.WCPSException;
+import org.w3c.dom.*;
+
+public class NumericScalarExpr implements IRasNode {
+
+ private IRasNode first, second;
+ private String op, value;
+ private boolean twoChildren;
+ private double dvalue;
+
+ public NumericScalarExpr(Node node, XmlQuery xq) throws WCPSException {
+ twoChildren = false;
+ String nodeName = node.getNodeName();
+
+ op = "";
+
+ System.err.println("Trying to parse numeric scalar expression ...");
+
+ while ((node != null) && node.getNodeName().equals("#text")) {
+ node = node.getNextSibling();
+ }
+
+ if (nodeName.equals("numericConstant")) {
+ twoChildren = false;
+ op = code(nodeName);
+ value = node.getFirstChild().getNodeValue();
+ try {
+ dvalue = Double.parseDouble(value);
+ } catch (NumberFormatException e) {
+ throw new WCPSException("Could not understand constant: " + value);
+ }
+ } else if (nodeName.equals("complexConstant")
+ || nodeName.equals("condense")
+ || nodeName.equals("reduce")) {
+ op = code(nodeName);
+ twoChildren = false;
+ if (nodeName.equals("complexConstant")) {
+ first = new ComplexConstant(node, xq);
+ }
+ if (nodeName.equals("condense")) {
+ first = new CondenseScalarExpr(node, xq);
+ }
+ if (nodeName.equals("reduce")) {
+ first = new ReduceScalarExpr(node, xq);
+ }
+ } else if (nodeName.equals("numericUnaryMinus")
+ || nodeName.equals("numericSqrt")
+ || nodeName.equals("numericAbs")) {
+ op = code(nodeName);
+ twoChildren = false;
+ first = new NumericScalarExpr(node.getFirstChild(), xq);
+ } else if (nodeName.equals("numericAdd")
+ || nodeName.equals("numericMinus")
+ || nodeName.equals("numericMult")
+ || nodeName.equals("numericDiv")) {
+ try {
+ op = code(nodeName);
+ twoChildren = true;
+ Node child = node.getFirstChild();
+ first = new NumericScalarExpr(child, xq);
+ second = new NumericScalarExpr(child.getNextSibling(), xq);
+ } catch (WCPSException e) {
+ System.err.println("Failed to parse a numeric expression pair !");
+ }
+ } else if (nodeName.equals("variableRef")) {
+ try {
+ op = code(nodeName);
+ twoChildren = false;
+ first = new VariableReference(node, xq);
+ System.err.println("Matched variable reference: " + first.toRasQL());
+ } catch (WCPSException e) {
+ System.err.println("Failed to match variable reference: "
+ + e.toString());
+ }
+ } else {
+ throw new WCPSException("Unexpected Numeric Scalar Expression node : "
+ + node.getNodeName());
+ }
+ }
+
+ public String toRasQL() {
+ String result = "";
+ if (twoChildren == false)
+ {
+ if (op.equals("variable")) {
+ result = first.toRasQL();
+ } else if (op.equals("value")) {
+ result = value;
+ } else if (op.equals("-")) {
+ result = "-" + first.toRasQL();
+ } else if (op.equals("sqrt")) {
+ result = "sqrt(" + first.toRasQL() + ")";
+ } else if (op.equals("child")) {
+ result = first.toRasQL();
+ } else if (op.equals("abs")) {
+ result = "abs(" + first.toRasQL() + ")";
+ }
+ }else if (twoChildren == true) {
+ result = "(" + first.toRasQL() + ")" + op
+ + "(" + second.toRasQL() + ")";
+ } else {
+ return " error ";
+ }
+
+ return result;
+ }
+
+ private String code(String name) {
+ String op = "";
+ if (name.equals("numericConstant")) {
+ op = "value";
+ }
+ if (name.equals("numericUnaryMinus") || name.equals("numericMinus")) {
+ op = "-";
+ }
+ if (name.equals("numericAdd")) {
+ op = "+";
+ }
+ if (name.equals("numericMult")) {
+ op = "*";
+ }
+ if (name.equals("numericDiv")) {
+ op = "/";
+ }
+ if (name.equals("numericSqrt")) {
+ op = "sqrt";
+ }
+ if (name.equals("numericAbs")) {
+ op = "abs";
+ }
+ if (name.equals("condense") || name.equals("reduce")
+ || name.equals("complexConstant")) {
+ op = "child";
+ }
+ if (name.equals("variableRef")) {
+ op = "variable";
+ }
+
+ return op;
+ }
+
+ public boolean isSingleValue() {
+ return op.equals("value");
+ }
+
+ public double getSingleValue() {
+ return dvalue;
+ }
+}
diff --git a/petascope/src/petascope/wcps/server/core/ProcessCoveragesRequest.java b/petascope/src/petascope/wcps/server/core/ProcessCoveragesRequest.java
index 1dbaedd..ed3b1ae 100644
--- a/petascope/src/petascope/wcps/server/core/ProcessCoveragesRequest.java
+++ b/petascope/src/petascope/wcps/server/core/ProcessCoveragesRequest.java
@@ -14,240 +14,236 @@
* 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.InvalidCrsException;
-import petascope.wcps.server.exceptions.ResourceException;
-import petascope.wcps.server.exceptions.WCPSException;
-import petascope.wcps.server.exceptions.InvalidWcpsRequestException;
-import petascope.wcps.grammar.WCPSRequest;
-import petascope.wcps.grammar.wcpsLexer;
-import petascope.wcps.grammar.wcpsParser;
-import petascope.wcps.grammar.wcpsParser.wcpsRequest_return;
-import java.io.IOException;
-import java.io.StringReader;
-import org.antlr.runtime.RecognitionException;
-import org.odmg.DBag;
-import org.odmg.Database;
-import org.odmg.Implementation;
-import org.odmg.ODMGException;
-import org.odmg.OQLQuery;
-import org.odmg.QueryException;
-import org.odmg.Transaction;
-
-import org.w3c.dom.*;
-
-import org.xml.sax.SAXException;
-import rasj.RasGMArray;
-import rasj.RasImplementation;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import org.antlr.runtime.ANTLRStringStream;
-import org.antlr.runtime.CharStream;
-import org.antlr.runtime.CommonTokenStream;
-import org.xml.sax.InputSource;
-
-/** A WCPS ProcessCoveragesRequest request provides a (just one) rasdaman query, that it executes.
- *
- * Internally, it relies on XmlRequest, which computes the RasQL query.
- *
- */
-public class ProcessCoveragesRequest {
-
- private String database;
- private IDynamicMetadataSource source;
- private String url;
- private WCPS wcps;
- private String rasqlQuery;
- private String mime;
- private XmlQuery xmlQuery;
-
- public ProcessCoveragesRequest(String url, String database, Node node, IDynamicMetadataSource source, WCPS wcps)
- throws WCPSException, InvalidWcpsRequestException, ResourceException, SAXException, IOException, InvalidCrsException {
- super();
- this.source = source;
- this.url = url;
- this.database = database;
- this.wcps = wcps;
- Node child = node.getFirstChild();
- this.rasqlQuery = null;
-
- System.err.println("Parsing ProcessCoveragesRequest node: " + child.getNodeName());
-
- if (child.getNodeName().equals("ProcessCoveragesRequest") == false) {
- throw new WCPSException("The document contains an unrecognized node : "
- + child.getNodeName());
- }
-
- child = child.getFirstChild();
- while (child.getNodeName().equals("#text")) {
- child = child.getNextSibling();
- }
-
- if (child.getNodeName().equals("query") == false) {
- throw new WCPSException("Could not find node <query>: " + child.getNodeName());
- }
-
- // "child" is now the node <query>.
- Node queryNode = child.getFirstChild();
- while (queryNode.getNodeName().equals("#text")) {
- queryNode = queryNode.getNextSibling();
- }
-
- /**
- * The following code is essential. It handles the two cases:
- * 1) the xml contains an <xmlSyntax> request
- * 2) the xml contains an <abstractSyntax> request
- */
- if (queryNode.getNodeName().equals("xmlSyntax")) {
- System.err.println("Found XML Syntax query");
- this.xmlQuery = new XmlQuery(this.source);
- xmlQuery.startParsing(queryNode);
- } else if (queryNode.getNodeName().equals("abstractSyntax")) {
- try {
- String abstractQuery = queryNode.getFirstChild().getNodeValue();
- System.err.println("Found Abstract Syntax query: " + abstractQuery);
- String xmlString = abstractQueryToXmlQuery(abstractQuery);
- InputSource xmlStringSource = new InputSource(new StringReader(xmlString));
- System.err.println("Coverted the Abstract syntax query to an XML query:");
- System.err.println("***********************************************");
- System.err.println(xmlString);
- System.err.println("***********************************************");
- ProcessCoveragesRequest newRequest = wcps.pcPrepare(url, database, xmlStringSource);
- this.xmlQuery = newRequest.getXmlRequestStructure();
- } catch (RecognitionException e) {
- throw new WCPSException("Abstract Syntax query is invalid: "
- + e.getMessage());
- }
- } else {
- throw new WCPSException("Error ! Unexpected node: " + queryNode.getNodeName());
- }
-
- // If everything went well, we now have a proper value for "xmlQuery"
- this.rasqlQuery = xmlQuery.toRasQL();
- System.err.println("Final RasQL query: " + rasqlQuery);
- this.mime = xmlQuery.getMimeType();
- }
-
- public static String abstractQueryToXmlQuery(String abstractQuery) throws RecognitionException {
- CharStream cs = new ANTLRStringStream(abstractQuery);
- wcpsLexer lexer = new wcpsLexer(cs);
- CommonTokenStream tokens = new CommonTokenStream();
- tokens.setTokenSource(lexer);
- wcpsParser parser = new wcpsParser(tokens);
- wcpsRequest_return rrequest = parser.wcpsRequest();
- WCPSRequest request = rrequest.value;
- String xmlRequest = request.toXML();
-
- return xmlRequest;
- }
-
- public String getMime() {
- return mime;
- }
-
- private XmlQuery getXmlRequestStructure() {
- return xmlQuery;
- }
-
- public String getRasqlQuery() {
- return this.rasqlQuery;
- }
-
- public List<byte[]> execute() throws ResourceException {
- ArrayList<byte[]> results = new ArrayList<byte[]>();
-
- if (this.rasqlQuery != null) {
- Implementation impl = new RasImplementation(url);
- Database db = impl.newDatabase();
-
- try {
- db.open(database, Database.OPEN_READ_ONLY);
- } catch (ODMGException odmge) {
- try {
- db.close();
- } catch (ODMGException e) {
- }
-
- throw new ResourceException("Could not connect to rasdaman at "
- + url + ", database "
- + database, odmge);
- }
-
- Transaction tr = impl.newTransaction();
-
- tr.begin();
- OQLQuery q = impl.newOQLQuery();
- DBag resultSet;
-
- try {
- q.create(this.getRasqlQuery());
- resultSet = (DBag) q.execute();
-
- if (resultSet != null) {
- Iterator resultIterator = resultSet.iterator();
-
- while (resultIterator.hasNext()) {
- Object current = resultIterator.next();
-
- try {
- RasGMArray resultArray =
- (RasGMArray) current;
-
- results.add(resultArray.getArray());
- } catch (ClassCastException e) { // not a RasGMarray
- if (!mime.equals("text/plain")) {
- throw new ResourceException(
- "Incompatible mime and data type!");
- }
-
- System.err.println("result="
- + current.toString());
- results.add(current.toString().getBytes());
-
- }
-
-
- /*
- * if (mime.equals("text/plain")) {
- * System.err.println("dataType is :" + resultArray.getBaseTypeSchema().toString());
- * }
- */
-
- }
- }
- } catch (QueryException qe) {
- tr.commit();
-
- try {
- db.close();
- } catch (ODMGException odmge) {
- }
-
- throw new ResourceException("Could not evaluate rasdaman query: '"
- + getRasqlQuery() + "'. Cause: " + qe.getMessage(), qe);
- }
-
- tr.commit();
-
- try {
- db.close();
- } catch (ODMGException odmge) {
- }
- }
-
- if (mime.equals("text/plain")) {
- }
-
- return results;
-
- }
-}
+package petascope.wcps.server.core;
+
+import petascope.core.IDynamicMetadataSource;
+import petascope.exceptions.PetascopeException;
+import petascope.exceptions.WCPSException;
+import petascope.wcps.grammar.WCPSRequest;
+import petascope.wcps.grammar.wcpsLexer;
+import petascope.wcps.grammar.wcpsParser;
+import petascope.wcps.grammar.wcpsParser.wcpsRequest_return;
+import java.io.IOException;
+import java.io.StringReader;
+import org.antlr.runtime.RecognitionException;
+import org.odmg.DBag;
+import org.odmg.Database;
+import org.odmg.Implementation;
+import org.odmg.ODMGException;
+import org.odmg.OQLQuery;
+import org.odmg.QueryException;
+import org.odmg.Transaction;
+import org.w3c.dom.*;
+import org.xml.sax.SAXException;
+import rasj.RasGMArray;
+import rasj.RasImplementation;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import org.antlr.runtime.ANTLRStringStream;
+import org.antlr.runtime.CharStream;
+import org.antlr.runtime.CommonTokenStream;
+import org.xml.sax.InputSource;
+import petascope.exceptions.ExceptionCode;
+
+/** A WCPS ProcessCoveragesRequest request provides a (just one) rasdaman query, that it executes.
+ *
+ * Internally, it relies on XmlRequest, which computes the RasQL query.
+ *
+ */
+public class ProcessCoveragesRequest {
+
+ private String database;
+ private IDynamicMetadataSource source;
+ private String url;
+ private WCPS wcps;
+ private String rasqlQuery;
+ private String mime;
+ private XmlQuery xmlQuery;
+
+ public ProcessCoveragesRequest(String url, String database, Node node, IDynamicMetadataSource source, WCPS wcps)
+ throws WCPSException, SAXException, IOException, PetascopeException {
+ super();
+ this.source = source;
+ this.url = url;
+ this.database = database;
+ this.wcps = wcps;
+ Node child = node.getFirstChild();
+ this.rasqlQuery = null;
+
+ System.err.println("Parsing ProcessCoveragesRequest node: " + child.getNodeName());
+
+ if (child.getNodeName().equals("ProcessCoveragesRequest") == false) {
+ throw new WCPSException("The document contains an unrecognized node : "
+ + child.getNodeName());
+ }
+
+ child = child.getFirstChild();
+ while (child.getNodeName().equals("#text")) {
+ child = child.getNextSibling();
+ }
+
+ if (child.getNodeName().equals("query") == false) {
+ throw new WCPSException("Could not find node <query>: " + child.getNodeName());
+ }
+
+ // "child" is now the node <query>.
+ Node queryNode = child.getFirstChild();
+ while (queryNode.getNodeName().equals("#text")) {
+ queryNode = queryNode.getNextSibling();
+ }
+
+ /**
+ * The following code is essential. It handles the two cases:
+ * 1) the xml contains an <xmlSyntax> request
+ * 2) the xml contains an <abstractSyntax> request
+ */
+ if (queryNode.getNodeName().equals("xmlSyntax")) {
+ System.err.println("Found XML Syntax query");
+ this.xmlQuery = new XmlQuery(this.source);
+ xmlQuery.startParsing(queryNode);
+ } else if (queryNode.getNodeName().equals("abstractSyntax")) {
+ try {
+ String abstractQuery = queryNode.getFirstChild().getNodeValue();
+ System.err.println("Found Abstract Syntax query: " + abstractQuery);
+ String xmlString = abstractQueryToXmlQuery(abstractQuery);
+ InputSource xmlStringSource = new InputSource(new StringReader(xmlString));
+ System.err.println("Coverted the Abstract syntax query to an XML query:");
+ System.err.println("***********************************************");
+ System.err.println(xmlString);
+ System.err.println("***********************************************");
+ ProcessCoveragesRequest newRequest = wcps.pcPrepare(url, database, xmlStringSource);
+ this.xmlQuery = newRequest.getXmlRequestStructure();
+ } catch (RecognitionException e) {
+ throw new WCPSException("Abstract Syntax query is invalid: "
+ + e.getMessage());
+ }
+ } else {
+ throw new WCPSException("Error ! Unexpected node: " + queryNode.getNodeName());
+ }
+
+ // If everything went well, we now have a proper value for "xmlQuery"
+ this.rasqlQuery = xmlQuery.toRasQL();
+ System.err.println("Final RasQL query: " + rasqlQuery);
+ this.mime = xmlQuery.getMimeType();
+ }
+
+ public static String abstractQueryToXmlQuery(String abstractQuery) throws RecognitionException {
+ CharStream cs = new ANTLRStringStream(abstractQuery);
+ wcpsLexer lexer = new wcpsLexer(cs);
+ CommonTokenStream tokens = new CommonTokenStream();
+ tokens.setTokenSource(lexer);
+ wcpsParser parser = new wcpsParser(tokens);
+ wcpsRequest_return rrequest = parser.wcpsRequest();
+ WCPSRequest request = rrequest.value;
+ String xmlRequest = request.toXML();
+
+ return xmlRequest;
+ }
+
+ public String getMime() {
+ return mime;
+ }
+
+ private XmlQuery getXmlRequestStructure() {
+ return xmlQuery;
+ }
+
+ public String getRasqlQuery() {
+ return this.rasqlQuery;
+ }
+
+ public List<byte[]> execute() throws WCPSException {
+ ArrayList<byte[]> results = new ArrayList<byte[]>();
+
+ if (this.rasqlQuery != null) {
+ Implementation impl = new RasImplementation(url);
+ Database db = impl.newDatabase();
+
+ try {
+ db.open(database, Database.OPEN_READ_ONLY);
+ } catch (ODMGException odmge) {
+ try {
+ db.close();
+ } catch (ODMGException e) {
+ }
+
+ throw new WCPSException(ExceptionCode.ResourceError, "Could not connect to rasdaman at "
+ + url + ", database "
+ + database, odmge);
+ }
+
+ Transaction tr = impl.newTransaction();
+
+ tr.begin();
+ OQLQuery q = impl.newOQLQuery();
+ DBag resultSet;
+
+ try {
+ q.create(this.getRasqlQuery());
+ resultSet = (DBag) q.execute();
+
+ if (resultSet != null) {
+ Iterator resultIterator = resultSet.iterator();
+
+ while (resultIterator.hasNext()) {
+ Object current = resultIterator.next();
+
+ try {
+ RasGMArray resultArray =
+ (RasGMArray) current;
+
+ results.add(resultArray.getArray());
+ } catch (ClassCastException e) { // not a RasGMarray
+ if (!mime.equals("text/plain")) {
+ throw new WCPSException(ExceptionCode.ResourceError,
+ "Incompatible mime and data type!");
+ }
+
+ System.err.println("result="
+ + current.toString());
+ results.add(current.toString().getBytes());
+
+ }
+
+
+ /*
+ * if (mime.equals("text/plain")) {
+ * System.err.println("dataType is :" + resultArray.getBaseTypeSchema().toString());
+ * }
+ */
+
+ }
+ }
+ } catch (QueryException qe) {
+ tr.commit();
+
+ try {
+ db.close();
+ } catch (ODMGException odmge) {
+ }
+
+ throw new WCPSException(ExceptionCode.ResourceError, "Could not evaluate rasdaman query: '"
+ + getRasqlQuery() + "'. Cause: " + qe.getMessage(), qe);
+ }
+
+ tr.commit();
+
+ try {
+ db.close();
+ } catch (ODMGException odmge) {
+ }
+ }
+
+ if (mime.equals("text/plain")) {
+ }
+
+ return results;
+
+ }
+}
diff --git a/petascope/src/petascope/wcps/server/core/RangeComponent.java b/petascope/src/petascope/wcps/server/core/RangeComponent.java
index 4933afc..fdb1eeb 100644
--- a/petascope/src/petascope/wcps/server/core/RangeComponent.java
+++ b/petascope/src/petascope/wcps/server/core/RangeComponent.java
@@ -14,75 +14,72 @@
* 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 org.w3c.dom.*;
-import petascope.wcps.server.exceptions.InvalidCrsException;
-
-
-/**
- * This is a component of a RangeStructure.
- * @author Andrei Aiordachioaie
- */
-public class RangeComponent implements IRasNode, ICoverageInfo {
-
- private String field = null;
- private CoverageInfo info = null;
- private CoverageExpr expr = null;
-
- public RangeComponent(Node node, XmlQuery xq)
- throws WCPSException {
-
- String nodeName = node.getNodeName();
- if (nodeName.equals("component"))
- node = node.getFirstChild();
-
- while (node != null)
- {
- nodeName = node.getNodeName();
- if (nodeName.equals("#text"))
- {
- node = node.getNextSibling();
- continue;
- }
-
- if (nodeName.equals("field"))
- this.field = node.getTextContent();
- else
- try
- {
- this.expr = new CoverageExpr(node, xq);
- this.info = expr.getCoverageInfo();
- }
- catch (InvalidCrsException e2)
- {}
- catch (WCPSException e)
- {
- System.err.println("Could not match CoverageExpr inside RangeExpr. Next node: " + nodeName);
- throw e;
- }
-
- node = node.getNextSibling();
- }
- }
-
- public CoverageInfo getCoverageInfo() {
- return info;
- }
-
- public String toRasQL() {
- String result = "";
-
- if (this.expr != null)
- result = expr.toRasQL();
-
- return result;
- }
-}
+package petascope.wcps.server.core;
+
+import petascope.exceptions.WCPSException;
+import org.w3c.dom.*;
+
+
+
+/**
+ * This is a component of a RangeStructure.
+ * @author Andrei Aiordachioaie
+ */
+public class RangeComponent implements IRasNode, ICoverageInfo {
+
+ private String field = null;
+ private CoverageInfo info = null;
+ private CoverageExpr expr = null;
+
+ public RangeComponent(Node node, XmlQuery xq)
+ throws WCPSException {
+
+ String nodeName = node.getNodeName();
+ if (nodeName.equals("component"))
+ node = node.getFirstChild();
+
+ while (node != null)
+ {
+ nodeName = node.getNodeName();
+ if (nodeName.equals("#text"))
+ {
+ node = node.getNextSibling();
+ continue;
+ }
+
+ if (nodeName.equals("field"))
+ this.field = node.getTextContent();
+ else
+ try
+ {
+ this.expr = new CoverageExpr(node, xq);
+ this.info = expr.getCoverageInfo();
+ }
+ catch (WCPSException e)
+ {
+ System.err.println("Could not match CoverageExpr inside RangeExpr. Next node: " + nodeName);
+ throw e;
+ }
+
+ node = node.getNextSibling();
+ }
+ }
+
+ public CoverageInfo getCoverageInfo() {
+ return info;
+ }
+
+ public String toRasQL() {
+ String result = "";
+
+ if (this.expr != null)
+ result = expr.toRasQL();
+
+ return result;
+ }
+}
diff --git a/petascope/src/petascope/wcps/server/core/RangeCoverageExpr.java b/petascope/src/petascope/wcps/server/core/RangeCoverageExpr.java
index 85dfbdc..3ddd4a9 100644
--- a/petascope/src/petascope/wcps/server/core/RangeCoverageExpr.java
+++ b/petascope/src/petascope/wcps/server/core/RangeCoverageExpr.java
@@ -14,71 +14,69 @@
* 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.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import org.w3c.dom.*;
-
-public class RangeCoverageExpr implements IRasNode, ICoverageInfo {
-
- private IRasNode child;
- private CoverageInfo info = null;
- List<IRasNode> components;
-
- public RangeCoverageExpr(Node node, XmlQuery xq)
- throws WCPSException {
-
- components = new ArrayList<IRasNode>();
-
- if (node.getNodeName().equals("rangeConstructor"))
- node = node.getFirstChild();
-
- if (node.getNodeName().equals("#text"))
- node = node.getNextSibling();
-
- String nodeName = node.getNodeName();
- System.err.println("Trying to parse a range coverage expression... Starting at node "
- + nodeName);
-
- while (node != null) {
- if (node.getNodeName().equals("#text")) {
- node = node.getNextSibling();
- continue;
- }
- if (node.getNodeName().equals("component")) {
- RangeComponent elem = new RangeComponent(node, xq);
- info = elem.getCoverageInfo();
- components.add(elem);
- }
-
- node = node.getNextSibling();
- }
-
- }
-
- public CoverageInfo getCoverageInfo() {
- // FIXME: Returns currently only the info for the last range component
- return info;
- }
-
- public String toRasQL() {
- String result = "";
- int length = components.size();
- for (int i = 0; i < length - 1; i++)
- result += components.get(i).toRasQL() + ",";
- result += components.get(length - 1).toRasQL();
-
- result = "{ " + result + " }";
-
- return result;
- }
-}
+package petascope.wcps.server.core;
+
+import petascope.exceptions.WCPSException;
+import java.util.ArrayList;
+import java.util.List;
+import org.w3c.dom.*;
+
+public class RangeCoverageExpr implements IRasNode, ICoverageInfo {
+
+ private IRasNode child;
+ private CoverageInfo info = null;
+ List<IRasNode> components;
+
+ public RangeCoverageExpr(Node node, XmlQuery xq)
+ throws WCPSException {
+
+ components = new ArrayList<IRasNode>();
+
+ if (node.getNodeName().equals("rangeConstructor"))
+ node = node.getFirstChild();
+
+ if (node.getNodeName().equals("#text"))
+ node = node.getNextSibling();
+
+ String nodeName = node.getNodeName();
+ System.err.println("Trying to parse a range coverage expression... Starting at node "
+ + nodeName);
+
+ while (node != null) {
+ if (node.getNodeName().equals("#text")) {
+ node = node.getNextSibling();
+ continue;
+ }
+ if (node.getNodeName().equals("component")) {
+ RangeComponent elem = new RangeComponent(node, xq);
+ info = elem.getCoverageInfo();
+ components.add(elem);
+ }
+
+ node = node.getNextSibling();
+ }
+
+ }
+
+ public CoverageInfo getCoverageInfo() {
+ // FIXME: Returns currently only the info for the last range component
+ return info;
+ }
+
+ public String toRasQL() {
+ String result = "";
+ int length = components.size();
+ for (int i = 0; i < length - 1; i++)
+ result += components.get(i).toRasQL() + ",";
+ result += components.get(length - 1).toRasQL();
+
+ result = "{ " + result + " }";
+
+ return result;
+ }
+}
diff --git a/petascope/src/petascope/wcps/server/core/RangeElement.java b/petascope/src/petascope/wcps/server/core/RangeElement.java
index f878d5a..6e2daf2 100644
--- a/petascope/src/petascope/wcps/server/core/RangeElement.java
+++ b/petascope/src/petascope/wcps/server/core/RangeElement.java
@@ -14,151 +14,157 @@
* 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;
-
-//A single component of a coverage's range. See the WCPS standard for more information.
-import petascope.wcps.server.exceptions.InvalidMetadataException;
-
-public class RangeElement implements Cloneable {
-
- private String name;
- private String type;
-
- public RangeElement(String name, String type) throws InvalidMetadataException {
- if ((name == null) || (type == null)) {
- throw new InvalidMetadataException(
- "Invalid range element: Element name and type cannot be null");
- }
-
- if (name.equals("")) {
- throw new InvalidMetadataException(
- "Invalid range element: Element name cannot be empty");
- }
-
- if (!(type.equals("boolean") || type.equals("char") || type.equals("unsigned char")
- || type.equals("short") || type.equals("unsigned short") || type.equals("int")
- || type.equals("unsigned int") || type.equals("long")
- || type.equals("unsigned long") || type.equals("float")
- || type.equals("double") || type.equals("complex") || type.equals("complex2"))) {
- throw new InvalidMetadataException(
- "Invalid range element: Invalid element type:" + type);
- }
-
- this.name = name;
- this.type = type;
-
- }
-
- public RangeElement clone() {
- try {
- return new RangeElement(new String(name), new String(type));
- } catch (InvalidMetadataException ime) {
- throw new RuntimeException(
- "Invalid metadata while cloning RangeElement. This is a software bug in WCPS.",
- ime);
- }
-
- }
-
- public boolean equals(RangeElement re) {
- return name.equals(re.type);
-
- }
-
- public String getName() {
- return name;
-
- }
-
- public String getType() {
- return type;
-
- }
-
- public boolean isBoolean() {
- return type.equals("boolean");
-
- }
-
- public static boolean isBoolean(String type) {
- return type.equals("boolean");
-
- }
-
- public boolean isComplex() {
- return type.equals("complex") || type.equals("complex2");
-
- }
-
- public static boolean isComplex(String type) {
- return type.equals("complex") || type.equals("complex2");
-
- }
-
- public boolean isIntegral() {
- return type.equals("char") || type.equals("short") || type.equals("unsigned short")
- || type.equals("int") || type.equals("unsigned int") || type.equals("long")
- || type.equals("unsigend long");
-
- }
-
- public static boolean isIntegral(String type) {
- return type.equals("char") || type.equals("short") || type.equals("unsigned short")
- || type.equals("int") || type.equals("unsigned int") || type.equals("long")
- || type.equals("unsigend long");
-
- }
-
- public boolean isFloating() {
- return type.equals("float") || type.equals("double");
-
- }
-
- public static boolean isFloating(String type) {
- return type.equals("float") || type.equals("double");
-
- }
-
- public boolean isNumeric() {
- return type.equals("char") || type.equals("short") || type.equals("unsigned short")
- || type.equals("int") || type.equals("unsigned int") || type.equals("long")
- || type.equals("unsigend long") || type.equals("float")
- || type.equals("double") || type.equals("complex")
- || type.equals("complex2");
-
- }
-
- public static boolean isNumeric(String type) {
- return type.equals("char") || type.equals("short") || type.equals("unsigned short")
- || type.equals("int") || type.equals("unsigned int") || type.equals("long")
- || type.equals("unsigend long") || type.equals("float")
- || type.equals("double") || type.equals("complex")
- || type.equals("complex2");
-
- }
-
- public void setType(String type) throws InvalidMetadataException {
- if (!(type.equals("boolean") || type.equals("char") || type.equals("unsigned char")
- || type.equals("short") || type.equals("unsigned short") || type.equals("int")
- || type.equals("unsigned int") || type.equals("long")
- || type.equals("unsigned long") || type.equals("float")
- || type.equals("double") || type.equals("complex") || type.equals("complex2"))) {
- throw new InvalidMetadataException(
- "Invalid range element: Invalid element type:" + type);
- }
-
- this.type = type;
-
- }
-
- public String toString() {
- String r = "Range Element { Name '" + name + "', Type '" + type + "'}";
- return r;
- }
-}
+package petascope.wcps.server.core;
+
+
+//A single component of a coverage's range. See the WCPS standard for more information.
+import petascope.exceptions.ExceptionCode;
+import petascope.exceptions.WCPSException;
+
+public class RangeElement implements Cloneable {
+
+ private String name;
+ private String type;
+ private String uom;
+
+ public RangeElement(String name, String type, String uom) throws WCPSException {
+ if ((name == null) || (type == null)) {
+ throw new WCPSException(ExceptionCode.InvalidMetadata,
+ "Invalid range element: Element name and type cannot be null");
+ }
+
+ if (name.equals("")) {
+ throw new WCPSException(ExceptionCode.InvalidMetadata,
+ "Invalid range element: Element name cannot be empty");
+ }
+
+ if (!(type.equals("boolean") || type.equals("char") || type.equals("unsigned char")
+ || type.equals("short") || type.equals("unsigned short") || type.equals("int")
+ || type.equals("unsigned int") || type.equals("long")
+ || type.equals("unsigned long") || type.equals("float")
+ || type.equals("double") || type.equals("complex") || type.equals("complex2"))) {
+ throw new WCPSException(ExceptionCode.InvalidMetadata,
+ "Invalid range element: Invalid element type:" + type);
+ }
+
+ this.name = name;
+ this.type = type;
+ this.uom = uom;
+ }
+
+ public String getUom() {
+ return uom;
+ }
+
+ public RangeElement clone() {
+ try {
+ return new RangeElement(new String(name), new String(type), new String(uom));
+ } catch (WCPSException ime) {
+ throw new RuntimeException(
+ "Invalid metadata while cloning RangeElement. This is a software bug in WCPS.",
+ ime);
+ }
+
+ }
+
+ public boolean equals(RangeElement re) {
+ return name.equals(re.type);
+
+ }
+
+ public String getName() {
+ return name;
+
+ }
+
+ public String getType() {
+ return type;
+
+ }
+
+ public boolean isBoolean() {
+ return type.equals("boolean");
+
+ }
+
+ public static boolean isBoolean(String type) {
+ return type.equals("boolean");
+
+ }
+
+ public boolean isComplex() {
+ return type.equals("complex") || type.equals("complex2");
+
+ }
+
+ public static boolean isComplex(String type) {
+ return type.equals("complex") || type.equals("complex2");
+
+ }
+
+ public boolean isIntegral() {
+ return type.equals("char") || type.equals("short") || type.equals("unsigned short")
+ || type.equals("int") || type.equals("unsigned int") || type.equals("long")
+ || type.equals("unsigend long");
+
+ }
+
+ public static boolean isIntegral(String type) {
+ return type.equals("char") || type.equals("short") || type.equals("unsigned short")
+ || type.equals("int") || type.equals("unsigned int") || type.equals("long")
+ || type.equals("unsigend long");
+
+ }
+
+ public boolean isFloating() {
+ return type.equals("float") || type.equals("double");
+
+ }
+
+ public static boolean isFloating(String type) {
+ return type.equals("float") || type.equals("double");
+
+ }
+
+ public boolean isNumeric() {
+ return type.equals("char") || type.equals("short") || type.equals("unsigned short")
+ || type.equals("int") || type.equals("unsigned int") || type.equals("long")
+ || type.equals("unsigend long") || type.equals("float")
+ || type.equals("double") || type.equals("complex")
+ || type.equals("complex2");
+
+ }
+
+ public static boolean isNumeric(String type) {
+ return type.equals("char") || type.equals("short") || type.equals("unsigned short")
+ || type.equals("int") || type.equals("unsigned int") || type.equals("long")
+ || type.equals("unsigend long") || type.equals("float")
+ || type.equals("double") || type.equals("complex")
+ || type.equals("complex2");
+
+ }
+
+ public void setType(String type) throws WCPSException {
+ if (!(type.equals("boolean") || type.equals("char") || type.equals("unsigned char")
+ || type.equals("short") || type.equals("unsigned short") || type.equals("int")
+ || type.equals("unsigned int") || type.equals("long")
+ || type.equals("unsigned long") || type.equals("float")
+ || type.equals("double") || type.equals("complex") || type.equals("complex2"))) {
+ throw new WCPSException(ExceptionCode.InvalidMetadata,
+ "Invalid range element: Invalid element type:" + type);
+ }
+
+ this.type = type;
+
+ }
+
+ public String toString() {
+ String r = "Range Element { Name '" + name + "', Type '" + type + "'}";
+ return r;
+ }
+}
diff --git a/petascope/src/petascope/wcps/server/core/RangeField.java b/petascope/src/petascope/wcps/server/core/RangeField.java
index 2a89875..4e7854d 100644
--- a/petascope/src/petascope/wcps/server/core/RangeField.java
+++ b/petascope/src/petascope/wcps/server/core/RangeField.java
@@ -14,42 +14,40 @@
* 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 org.w3c.dom.*;
-
-import java.util.Iterator;
-
-public class RangeField implements IRasNode {
-
- private String type;
-
- public RangeField(Node node, XmlQuery xq) throws WCPSException {
- while ((node != null) && node.getNodeName().equals("#text")) {
- node = node.getNextSibling();
- }
-
- if (node == null) {
- throw new WCPSException("RangeFieldType parsing error!");
- }
-
- String nodeName = node.getNodeName();
-
- if (nodeName.equals("type")) {
- this.type = node.getTextContent();
-
- System.err.println("Found range field type: " + type);
- }
- }
-
- public String toRasQL() {
- return this.type;
- }
-};
+package petascope.wcps.server.core;
+
+import petascope.exceptions.WCPSException;
+import org.w3c.dom.*;
+import java.util.Iterator;
+
+public class RangeField implements IRasNode {
+
+ private String type;
+
+ public RangeField(Node node, XmlQuery xq) throws WCPSException {
+ while ((node != null) && node.getNodeName().equals("#text")) {
+ node = node.getNextSibling();
+ }
+
+ if (node == null) {
+ throw new WCPSException("RangeFieldType parsing error!");
+ }
+
+ String nodeName = node.getNodeName();
+
+ if (nodeName.equals("type")) {
+ this.type = node.getTextContent();
+
+ System.err.println("Found range field type: " + type);
+ }
+ }
+
+ public String toRasQL() {
+ return this.type;
+ }
+};
diff --git a/petascope/src/petascope/wcps/server/core/ReduceScalarExpr.java b/petascope/src/petascope/wcps/server/core/ReduceScalarExpr.java
index b12c12f..2494dcd 100644
--- a/petascope/src/petascope/wcps/server/core/ReduceScalarExpr.java
+++ b/petascope/src/petascope/wcps/server/core/ReduceScalarExpr.java
@@ -14,56 +14,54 @@
* 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.InvalidCrsException;
-import petascope.wcps.server.exceptions.WCPSException;
-import org.w3c.dom.*;
-
-public class ReduceScalarExpr implements IRasNode {
-
- CoverageExpr expr;
- String op;
-
- public ReduceScalarExpr(Node node, XmlQuery xq) throws WCPSException, InvalidCrsException {
- if (node.getNodeName().equals("reduce")) {
- node = node.getFirstChild();
- }
- while ((node != null) && node.getNodeName().equals("#text")) {
- node = node.getNextSibling();
- }
-
- System.err.println("Trying to parse ReduceScalarExpr ");
- String nodeName = node.getNodeName();
-
- if (nodeName.equals("all") || nodeName.equals("some") || nodeName.equals("count")
- || nodeName.equals("add") || nodeName.equals("avg") || nodeName.equals("min")
- || nodeName.equals("max")) {
- op = nodeName;
-
- if (!op.equals("all") && !op.equals("some")) {
- op = op + "_cells";
- }
-
- node = node.getFirstChild();
-
- while ((node != null) && (node.getNodeName().equals("#text"))) {
- node = node.getNextSibling();
- }
-
- expr = new CoverageExpr(node, xq);
- } else {
- throw new WCPSException("invalid ReduceScalarExprType node : " + nodeName);
- }
- }
-
- public String toRasQL() {
- return op + "(" + expr.toRasQL() + ")";
- }
-}
+package petascope.wcps.server.core;
+
+import petascope.exceptions.WCPSException;
+import org.w3c.dom.*;
+
+public class ReduceScalarExpr implements IRasNode {
+
+ CoverageExpr expr;
+ String op;
+
+ public ReduceScalarExpr(Node node, XmlQuery xq) throws WCPSException {
+ if (node.getNodeName().equals("reduce")) {
+ node = node.getFirstChild();
+ }
+ while ((node != null) && node.getNodeName().equals("#text")) {
+ node = node.getNextSibling();
+ }
+
+ System.err.println("Trying to parse ReduceScalarExpr ");
+ String nodeName = node.getNodeName();
+
+ if (nodeName.equals("all") || nodeName.equals("some") || nodeName.equals("count")
+ || nodeName.equals("add") || nodeName.equals("avg") || nodeName.equals("min")
+ || nodeName.equals("max")) {
+ op = nodeName;
+
+ if (!op.equals("all") && !op.equals("some")) {
+ op = op + "_cells";
+ }
+
+ node = node.getFirstChild();
+
+ while ((node != null) && (node.getNodeName().equals("#text"))) {
+ node = node.getNextSibling();
+ }
+
+ expr = new CoverageExpr(node, xq);
+ } else {
+ throw new WCPSException("invalid ReduceScalarExprType node : " + nodeName);
+ }
+ }
+
+ public String toRasQL() {
+ return op + "(" + expr.toRasQL() + ")";
+ }
+}
diff --git a/petascope/src/petascope/wcps/server/core/SDU.java b/petascope/src/petascope/wcps/server/core/SDU.java
index 338d988..94963ab 100644
--- a/petascope/src/petascope/wcps/server/core/SDU.java
+++ b/petascope/src/petascope/wcps/server/core/SDU.java
@@ -14,23 +14,17 @@
* 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;
-
-//~--- non-JDK imports --------------------------------------------------------
-import org.apache.commons.math.complex.Complex;
-
-//~--- JDK imports ------------------------------------------------------------
-
-import java.math.BigInteger;
-
-import java.util.ArrayList;
-import java.util.Iterator;
+package petascope.wcps.server.core;
+
+import org.apache.commons.math.complex.Complex;
+import java.math.BigInteger;
+import java.util.ArrayList;
+import java.util.Iterator;
import java.util.List;
/**
diff --git a/petascope/src/petascope/wcps/server/core/ScalarExpr.java b/petascope/src/petascope/wcps/server/core/ScalarExpr.java
index a2ffc94..da6026b 100644
--- a/petascope/src/petascope/wcps/server/core/ScalarExpr.java
+++ b/petascope/src/petascope/wcps/server/core/ScalarExpr.java
@@ -14,159 +14,158 @@
* 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.InvalidCrsException;
-import petascope.wcps.server.exceptions.WCPSException;
-import petascope.wcps.server.exceptions.InvalidMetadataException;
-import java.math.BigInteger;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.LinkedList;
-import java.util.List;
-import org.w3c.dom.*;
-
-public class ScalarExpr implements IRasNode, ICoverageInfo {
-
- private IRasNode child;
- private CoverageInfo info;
- private boolean singleNumericValue = false;
- private double dvalue;
-
- public ScalarExpr(Node node, XmlQuery xq) throws WCPSException, InvalidCrsException {
- while ((node != null) && node.getNodeName().equals("#text")) {
- node = node.getNextSibling();
- }
-
- // Try one of the groups
- child = null;
-
-// TODO: Implement class MetadataScalarExprType
-// MetadataScalarExprType
- if (child == null) {
- try {
- child = new MetadataScalarExpr(node, xq);
- System.err.println("Matched metadata scalar expression.");
- } catch (WCPSException e) {
- System.err.println("Failed to match metadata scalar expression: "
- + e.toString() + "\nRetrying");
- child = null;
- }
- }
-
-// BooleanScalarExprType
- if (child == null) {
- try {
- child = new BooleanScalarExpr(node, xq);
- System.err.println("Matched boolean scalar expression.");
- } catch (WCPSException e) {
- System.err.println("Failed to match boolean scalar expression : "
- + e.toString() + "\nRetrying");
- child = null;
- }
- }
-
-// NumericScalarExprType
- if (child == null) {
- try {
- child = new NumericScalarExpr(node, xq);
- singleNumericValue = ((NumericScalarExpr) child).isSingleValue();
- dvalue = ((NumericScalarExpr) child).getSingleValue();
- System.err.println("Matched numeric scalar expression.");
- } catch (WCPSException e) {
- System.err.println("Failed to match numeric scalar expression : "
- + e.toString() + "\nRetrying");
- child = null;
- }
- }
-
-// ReduceScalarExprType
- if (child == null) {
- try {
- child = new ReduceScalarExpr(node, xq);
- System.err.println("Matched reduce scalar expression.");
- } catch (WCPSException e) {
- System.err.println("Failed to match reduce scalar expression: "
- + e.toString() + "\nRetrying");
- child = null;
- }
- }
-
-// StringScalarExprType
- if (child == null) {
- try {
- child = new StringScalarExpr(node, xq);
- System.err.println("Matched string scalar expression.");
- } catch (WCPSException e) {
- System.err.println("Failed to match string scalar expression: "
- + e.toString() + "\nRetrying");
- child = null;
- }
- }
-
- // Error check
- if (child == null) {
- throw new WCPSException("Invalid coverage Expression, next node: "
- + node.getNodeName());
- }
-
- Metadata meta = createScalarExprMetadata(xq);
- info = new CoverageInfo(meta);
- }
-
- public String toRasQL() {
- return child.toRasQL();
- }
-
- public CoverageInfo getCoverageInfo() {
- return info;
- }
-
- /** Builds full metadata for the newly constructed coverage **/
- private Metadata createScalarExprMetadata(XmlQuery xq) throws WCPSException {
- List<CellDomainElement> cellDomainList = new LinkedList<CellDomainElement>();
- List<RangeElement> rangeList = new LinkedList<RangeElement>();
- HashSet<String> nullSet = new HashSet<String>();
- String nullDefault = "0";
- nullSet.add(nullDefault);
- HashSet<InterpolationMethod> interpolationSet = new HashSet<InterpolationMethod>();
- InterpolationMethod interpolationDefault = new InterpolationMethod("none", "none");
- interpolationSet.add(interpolationDefault);
- String coverageName = "scalarExpr";
- List<DomainElement> domainList = new LinkedList<DomainElement>();
-
- // Build domain metadata
- cellDomainList.add(new CellDomainElement(new BigInteger("1"), new BigInteger("1")));
- String crs = DomainElement.IMAGE_CRS;
- HashSet<String> crsset = new HashSet<String>();
- crsset.add(crs);
- Collection<String> allowedAxes = xq.getMetadataSource().getAxisNames();
- DomainElement domain = new DomainElement("x", "x", 1.0, 1.0, null, null, crsset, allowedAxes);
- domainList.add(domain);
- // "unsigned int" is default datatype
- rangeList.add(new RangeElement("dynamic_type", "unsigned int"));
-
- try {
- Metadata metadata = new Metadata(cellDomainList, rangeList, nullSet,
- nullDefault, interpolationSet, interpolationDefault,
- coverageName, domainList, null);
- return metadata;
- } catch (InvalidMetadataException e) {
- throw new WCPSException("Could not build metadata for scalar expression !", e);
- }
- }
-
- public boolean isSingleValue() {
- return singleNumericValue;
- }
-
- public double getSingleValue() {
- return dvalue;
- }
-}
+package petascope.wcps.server.core;
+
+import petascope.core.Metadata;
+import petascope.exceptions.WCPSException;
+import java.math.BigInteger;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import org.w3c.dom.*;
+import petascope.exceptions.PetascopeException;
+
+public class ScalarExpr implements IRasNode, ICoverageInfo {
+
+ private IRasNode child;
+ private CoverageInfo info;
+ private boolean singleNumericValue = false;
+ private double dvalue;
+
+ public ScalarExpr(Node node, XmlQuery xq) throws WCPSException {
+ while ((node != null) && node.getNodeName().equals("#text")) {
+ node = node.getNextSibling();
+ }
+
+ // Try one of the groups
+ child = null;
+
+// TODO: Implement class MetadataScalarExprType
+// MetadataScalarExprType
+ if (child == null) {
+ try {
+ child = new MetadataScalarExpr(node, xq);
+ System.err.println("Matched metadata scalar expression.");
+ } catch (WCPSException e) {
+ System.err.println("Failed to match metadata scalar expression: "
+ + e.toString() + "\nRetrying");
+ child = null;
+ }
+ }
+
+// BooleanScalarExprType
+ if (child == null) {
+ try {
+ child = new BooleanScalarExpr(node, xq);
+ System.err.println("Matched boolean scalar expression.");
+ } catch (WCPSException e) {
+ System.err.println("Failed to match boolean scalar expression : "
+ + e.toString() + "\nRetrying");
+ child = null;
+ }
+ }
+
+// NumericScalarExprType
+ if (child == null) {
+ try {
+ child = new NumericScalarExpr(node, xq);
+ singleNumericValue = ((NumericScalarExpr) child).isSingleValue();
+ dvalue = ((NumericScalarExpr) child).getSingleValue();
+ System.err.println("Matched numeric scalar expression.");
+ } catch (WCPSException e) {
+ System.err.println("Failed to match numeric scalar expression : "
+ + e.toString() + "\nRetrying");
+ child = null;
+ }
+ }
+
+// ReduceScalarExprType
+ if (child == null) {
+ try {
+ child = new ReduceScalarExpr(node, xq);
+ System.err.println("Matched reduce scalar expression.");
+ } catch (WCPSException e) {
+ System.err.println("Failed to match reduce scalar expression: "
+ + e.toString() + "\nRetrying");
+ child = null;
+ }
+ }
+
+// StringScalarExprType
+ if (child == null) {
+ try {
+ child = new StringScalarExpr(node, xq);
+ System.err.println("Matched string scalar expression.");
+ } catch (WCPSException e) {
+ System.err.println("Failed to match string scalar expression: "
+ + e.toString() + "\nRetrying");
+ child = null;
+ }
+ }
+
+ // Error check
+ if (child == null) {
+ throw new WCPSException("Invalid coverage Expression, next node: "
+ + node.getNodeName());
+ }
+
+ Metadata meta = createScalarExprMetadata(xq);
+ info = new CoverageInfo(meta);
+ }
+
+ public String toRasQL() {
+ return child.toRasQL();
+ }
+
+ public CoverageInfo getCoverageInfo() {
+ return info;
+ }
+
+ /** Builds full metadata for the newly constructed coverage **/
+ private Metadata createScalarExprMetadata(XmlQuery xq) throws WCPSException {
+ List<CellDomainElement> cellDomainList = new LinkedList<CellDomainElement>();
+ List<RangeElement> rangeList = new LinkedList<RangeElement>();
+ HashSet<String> nullSet = new HashSet<String>();
+ String nullDefault = "0";
+ nullSet.add(nullDefault);
+ HashSet<InterpolationMethod> interpolationSet = new HashSet<InterpolationMethod>();
+ InterpolationMethod interpolationDefault = new InterpolationMethod("none", "none");
+ interpolationSet.add(interpolationDefault);
+ String coverageName = "scalarExpr";
+ List<DomainElement> domainList = new LinkedList<DomainElement>();
+
+ // Build domain metadata
+ cellDomainList.add(new CellDomainElement(new BigInteger("1"), new BigInteger("1")));
+ String crs = DomainElement.IMAGE_CRS;
+ HashSet<String> crsset = new HashSet<String>();
+ crsset.add(crs);
+ Collection<String> allowedAxes = xq.getMetadataSource().getAxisNames();
+ DomainElement domain = new DomainElement("x", "x", 1.0, 1.0, null, null, crsset, allowedAxes, null);
+ domainList.add(domain);
+ // "unsigned int" is default datatype
+ rangeList.add(new RangeElement("dynamic_type", "unsigned int", null));
+
+ try {
+ Metadata metadata = new Metadata(cellDomainList, rangeList, nullSet,
+ nullDefault, interpolationSet, interpolationDefault,
+ coverageName, "GridCoverage", domainList, null); // FIXME
+ return metadata;
+ } catch (PetascopeException ex) {
+ throw (WCPSException) ex;
+ }
+ }
+
+ public boolean isSingleValue() {
+ return singleNumericValue;
+ }
+
+ public double getSingleValue() {
+ return dvalue;
+ }
+}
diff --git a/petascope/src/petascope/wcps/server/core/ScaleCoverageExpr.java b/petascope/src/petascope/wcps/server/core/ScaleCoverageExpr.java
index 987ab18..436abbc 100644
--- a/petascope/src/petascope/wcps/server/core/ScaleCoverageExpr.java
+++ b/petascope/src/petascope/wcps/server/core/ScaleCoverageExpr.java
@@ -14,137 +14,127 @@
* 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 java.math.BigInteger;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import petascope.wcps.server.exceptions.InvalidCrsException;
-import petascope.wcps.server.exceptions.WCPSException;
-import org.w3c.dom.*;
-import petascope.wcps.server.exceptions.InvalidWcpsRequestException;
-
-
-public class ScaleCoverageExpr implements IRasNode, ICoverageInfo {
-
- private List<DimensionIntervalElement> axisList;
- private CoverageExpr coverageExprType;
- private CoverageInfo coverageInfo;
- private String[] dim;
- private int dims;
- private DimensionIntervalElement elem;
- private FieldInterpolationElement fieldInterp;
-
- public ScaleCoverageExpr(Node node, XmlQuery xq) throws WCPSException, InvalidCrsException
- {
- Node child;
- String nodeName;
-
- axisList = new ArrayList<DimensionIntervalElement>();
-
- child = node.getFirstChild();
- while (child != null) {
- nodeName = child.getNodeName();
-
- if (nodeName.equals("#text")) {
- child = child.getNextSibling();
- continue;
- }
-
- try {
- System.err.println("Trying out an CoverageExprType group...");
- coverageExprType = new CoverageExpr(child, xq);
- coverageInfo = coverageExprType.getCoverageInfo();
- child = child.getNextSibling();
- continue;
- } catch (WCPSException e) {
- System.err.println("This was no CoverageExprType: " + nodeName);
- }
-
- try {
- // Start a new axis and save it
- elem = new DimensionIntervalElement(child, xq, coverageInfo);
- axisList.add(elem);
- child = elem.getNextNode();
- continue;
- } catch (WCPSException e) {
- System.err.println("This was no Dimension Interval ELement: " + child.getNodeName());
- }
-
- try {
- fieldInterp = new FieldInterpolationElement(child, xq);
- child = fieldInterp.getNextNode();
- continue;
- }
- catch (InvalidWcpsRequestException e2)
- {
- throw e2;
- }
- catch (WCPSException e)
- {
- System.err.println("This was no Field Interpolation Element: " + child.getNodeName());
- }
-
- // else unknown element
- throw new WCPSException("Unknown node for ScaleCoverageExpr expression:" + child.getNodeName());
- }
-
- dims = coverageInfo.getNumDimensions();
- dim = new String[dims];
-
- for (int j = 0; j < dims; ++j) {
- dim[j] = "*:*";
- }
-
-
- Iterator<DimensionIntervalElement> i = axisList.iterator();
-
- System.out.println("Axis List count:" + axisList.size());
- DimensionIntervalElement axis;
- int axisId;
- int axisLo, axisHi;
-
- while (i.hasNext()) {
- axis = i.next();
- axisId = coverageInfo.getDomainIndexByName(axis.getAxisName());
- System.out.println("Axis ID: " + axisId);
- System.out.println("Axis name: " + axis.getAxisName());
- System.out.print("Axis coords: ");
-
- axisLo = Integer.parseInt(axis.getLowCoord());
- axisHi = Integer.parseInt(axis.getHighCoord());
- dim[axisId] = axisLo + ":" + axisHi;
- coverageInfo.setCellDimension(
- axisId,
- new CellDomainElement(
- BigInteger.valueOf(axisLo), BigInteger.valueOf(axisHi)));
- }
-
- }
-
- public String toRasQL() {
- String result = "scale( " + coverageExprType.toRasQL() + ", [";
-
- for (int j = 0; j < dims; ++j) {
- if (j > 0) {
- result += ",";
- }
-
- result += dim[j];
- }
-
- result += "] )";
- return result;
- }
-
- public CoverageInfo getCoverageInfo() {
- return coverageInfo;
- }
-}
+package petascope.wcps.server.core;
+
+import java.math.BigInteger;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import petascope.exceptions.WCPSException;
+import org.w3c.dom.*;
+import petascope.exceptions.ExceptionCode;
+
+public class ScaleCoverageExpr implements IRasNode, ICoverageInfo {
+
+ private List<DimensionIntervalElement> axisList;
+ private CoverageExpr coverageExprType;
+ private CoverageInfo coverageInfo;
+ private String[] dim;
+ private int dims;
+ private DimensionIntervalElement elem;
+ private FieldInterpolationElement fieldInterp;
+
+ public ScaleCoverageExpr(Node node, XmlQuery xq) throws WCPSException {
+ Node child;
+ String nodeName;
+
+ axisList = new ArrayList<DimensionIntervalElement>();
+
+ child = node.getFirstChild();
+ while (child != null) {
+ nodeName = child.getNodeName();
+
+ if (nodeName.equals("#text")) {
+ child = child.getNextSibling();
+ continue;
+ }
+
+ try {
+ System.err.println("Trying out an CoverageExprType group...");
+ coverageExprType = new CoverageExpr(child, xq);
+ coverageInfo = coverageExprType.getCoverageInfo();
+ child = child.getNextSibling();
+ continue;
+ } catch (WCPSException e) {
+ System.err.println("This was no CoverageExprType: " + nodeName);
+ }
+
+ try {
+ // Start a new axis and save it
+ elem = new DimensionIntervalElement(child, xq, coverageInfo);
+ axisList.add(elem);
+ child = elem.getNextNode();
+ continue;
+ } catch (WCPSException e) {
+ System.err.println("This was no Dimension Interval ELement: " + child.getNodeName());
+ }
+
+ try {
+ fieldInterp = new FieldInterpolationElement(child, xq);
+ child = fieldInterp.getNextNode();
+ continue;
+ } catch (WCPSException e) {
+ System.err.println("This was no Field Interpolation Element: " + child.getNodeName());
+ }
+
+ // else unknown element
+ throw new WCPSException(ExceptionCode.InvalidMetadata, "Unknown node for ScaleCoverageExpr expression:" + child.getNodeName());
+ }
+
+ dims = coverageInfo.getNumDimensions();
+ dim = new String[dims];
+
+ for (int j = 0; j < dims; ++j) {
+ dim[j] = "*:*";
+ }
+
+
+ Iterator<DimensionIntervalElement> i = axisList.iterator();
+
+ System.out.println("Axis List count:" + axisList.size());
+ DimensionIntervalElement axis;
+ int axisId;
+ int axisLo, axisHi;
+
+ while (i.hasNext()) {
+ axis = i.next();
+ axisId = coverageInfo.getDomainIndexByName(axis.getAxisName());
+ System.out.println("Axis ID: " + axisId);
+ System.out.println("Axis name: " + axis.getAxisName());
+ System.out.print("Axis coords: ");
+
+ axisLo = Integer.parseInt(axis.getLowCoord());
+ axisHi = Integer.parseInt(axis.getHighCoord());
+ dim[axisId] = axisLo + ":" + axisHi;
+ coverageInfo.setCellDimension(
+ axisId,
+ new CellDomainElement(
+ BigInteger.valueOf(axisLo), BigInteger.valueOf(axisHi)));
+ }
+
+ }
+
+ public String toRasQL() {
+ String result = "scale( " + coverageExprType.toRasQL() + ", [";
+
+ for (int j = 0; j < dims; ++j) {
+ if (j > 0) {
+ result += ",";
+ }
+
+ result += dim[j];
+ }
+
+ result += "] )";
+ return result;
+ }
+
+ public CoverageInfo getCoverageInfo() {
+ return coverageInfo;
+ }
+}
diff --git a/petascope/src/petascope/wcps/server/core/SetMetadataCoverageExpr.java b/petascope/src/petascope/wcps/server/core/SetMetadataCoverageExpr.java
index cb89bad..909a1b9 100644
--- a/petascope/src/petascope/wcps/server/core/SetMetadataCoverageExpr.java
+++ b/petascope/src/petascope/wcps/server/core/SetMetadataCoverageExpr.java
@@ -14,30 +14,29 @@
* 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 org.w3c.dom.*;
-
-// TODO: Implement class SetMetadataCoverageExprType
-public class SetMetadataCoverageExpr implements IRasNode, ICoverageInfo {
-
- public SetMetadataCoverageExpr(Node node, XmlQuery xq)
- throws WCPSException {
- throw new WCPSException("Method not implemented");
- }
-
- public String toRasQL() {
- return "";
- }
-
- public CoverageInfo getCoverageInfo() {
- return null;
- }
-}
+package petascope.wcps.server.core;
+
+import petascope.exceptions.WCPSException;
+import org.w3c.dom.*;
+
+// TODO: Implement class SetMetadataCoverageExprType
+public class SetMetadataCoverageExpr implements IRasNode, ICoverageInfo {
+
+ public SetMetadataCoverageExpr(Node node, XmlQuery xq)
+ throws WCPSException {
+ throw new WCPSException("Method not implemented");
+ }
+
+ public String toRasQL() {
+ return "";
+ }
+
+ public CoverageInfo getCoverageInfo() {
+ return null;
+ }
+}
diff --git a/petascope/src/petascope/wcps/server/core/SliceCoverageExpr.java b/petascope/src/petascope/wcps/server/core/SliceCoverageExpr.java
index ca6c478..42d1370 100644
--- a/petascope/src/petascope/wcps/server/core/SliceCoverageExpr.java
+++ b/petascope/src/petascope/wcps/server/core/SliceCoverageExpr.java
@@ -14,119 +14,117 @@
* 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.InvalidCrsException;
-import petascope.wcps.server.exceptions.WCPSException;
-import java.math.BigInteger;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import org.w3c.dom.Node;
-
-public class SliceCoverageExpr implements IRasNode, ICoverageInfo {
-
- private List<DimensionPointElement> axisList;
- private CoverageExpr coverageExprType;
- private CoverageInfo coverageInfo = null;
- private String[] dim;
- private DimensionPointElement elem;
- private int dims;
-
- public SliceCoverageExpr(Node node, XmlQuery xq) throws WCPSException, InvalidCrsException {
- Node child = node.getFirstChild();
- String nodeName;
-
- axisList = new ArrayList<DimensionPointElement>();
-
- while (child != null) {
- nodeName = child.getNodeName();
-
- if (nodeName.equals("#text")) {
- child = child.getNextSibling();
- continue;
- }
-
- try {
- System.err.println("Trying out an CoverageExprType group...");
- coverageExprType = new CoverageExpr(child, xq);
- coverageInfo = coverageExprType.getCoverageInfo();
- child = child.getNextSibling();
- continue;
- } catch (WCPSException e) {
- System.err.println("This was no CoverageExprType: " + nodeName);
- }
-
- try {
- // Start a new axis and save it
- elem = new DimensionPointElement(child, xq);
- axisList.add(elem);
- child = elem.getNextNode();
- continue;
- } catch (WCPSException e) {
- System.err.println("This was no Dimension Point ELement: " + child.getNodeName());
- }
-
- // else unknown element
- throw new WCPSException("Unknown node for TrimCoverage expression:" + child.getNodeName());
- }
-
- dims = coverageInfo.getNumDimensions();
- dim = new String[dims];
-
- for (int j = 0; j < dims; ++j) {
- dim[j] = "*:*";
- }
-
- Iterator<DimensionPointElement> i = axisList.iterator();
- DimensionPointElement axis;
- int axisId;
- int slicingPosInt;
- String slicingPosStr;
-
- while (i.hasNext()) {
- axis = i.next();
- /* TODO: BUG: This searches the axis types list using name, not type */
- axisId = coverageInfo.getDomainIndexByName(axis.getAxisName());
- slicingPosStr = axis.getSlicingPosition();
- dim[axisId] = slicingPosStr;
- // Slicing position can be a constant number or a variable reference
- try {
- slicingPosInt = Integer.parseInt(slicingPosStr);
- } catch (NumberFormatException e) {
- slicingPosInt = 1;
- }
- coverageInfo.setCellDimension(
- axisId,
- new CellDomainElement(
- BigInteger.valueOf(slicingPosInt), BigInteger.valueOf(slicingPosInt)));
-
- }
-
- }
-
- public CoverageInfo getCoverageInfo() {
- return coverageInfo;
- }
-
- public String toRasQL() {
- String result = "(" + coverageExprType.toRasQL() + ") [";
-
- for (int j = 0; j < dims; ++j) {
- if (j > 0) {
- result += ",";
- }
-
- result += dim[j];
- }
-
- result += "]";
- return result;
- }
-}
+package petascope.wcps.server.core;
+
+import petascope.exceptions.WCPSException;
+import java.math.BigInteger;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import org.w3c.dom.Node;
+
+public class SliceCoverageExpr implements IRasNode, ICoverageInfo {
+
+ private List<DimensionPointElement> axisList;
+ private CoverageExpr coverageExprType;
+ private CoverageInfo coverageInfo = null;
+ private String[] dim;
+ private DimensionPointElement elem;
+ private int dims;
+
+ public SliceCoverageExpr(Node node, XmlQuery xq) throws WCPSException {
+ Node child = node.getFirstChild();
+ String nodeName;
+
+ axisList = new ArrayList<DimensionPointElement>();
+
+ while (child != null) {
+ nodeName = child.getNodeName();
+
+ if (nodeName.equals("#text")) {
+ child = child.getNextSibling();
+ continue;
+ }
+
+ try {
+ System.err.println("Trying out an CoverageExprType group...");
+ coverageExprType = new CoverageExpr(child, xq);
+ coverageInfo = coverageExprType.getCoverageInfo();
+ child = child.getNextSibling();
+ continue;
+ } catch (WCPSException e) {
+ System.err.println("This was no CoverageExprType: " + nodeName);
+ }
+
+ try {
+ // Start a new axis and save it
+ elem = new DimensionPointElement(child, xq);
+ axisList.add(elem);
+ child = elem.getNextNode();
+ continue;
+ } catch (WCPSException e) {
+ System.err.println("This was no Dimension Point ELement: " + child.getNodeName());
+ }
+
+ // else unknown element
+ throw new WCPSException("Unknown node for TrimCoverage expression:" + child.getNodeName());
+ }
+
+ dims = coverageInfo.getNumDimensions();
+ dim = new String[dims];
+
+ for (int j = 0; j < dims; ++j) {
+ dim[j] = "*:*";
+ }
+
+ Iterator<DimensionPointElement> i = axisList.iterator();
+ DimensionPointElement axis;
+ int axisId;
+ int slicingPosInt;
+ String slicingPosStr;
+
+ while (i.hasNext()) {
+ axis = i.next();
+ /* TODO: BUG: This searches the axis types list using name, not type */
+ axisId = coverageInfo.getDomainIndexByName(axis.getAxisName());
+ slicingPosStr = axis.getSlicingPosition();
+ dim[axisId] = slicingPosStr;
+ // Slicing position can be a constant number or a variable reference
+ try {
+ slicingPosInt = Integer.parseInt(slicingPosStr);
+ } catch (NumberFormatException e) {
+ slicingPosInt = 1;
+ }
+ coverageInfo.setCellDimension(
+ axisId,
+ new CellDomainElement(
+ BigInteger.valueOf(slicingPosInt), BigInteger.valueOf(slicingPosInt)));
+
+ }
+
+ }
+
+ public CoverageInfo getCoverageInfo() {
+ return coverageInfo;
+ }
+
+ public String toRasQL() {
+ String result = "(" + coverageExprType.toRasQL() + ") [";
+
+ for (int j = 0; j < dims; ++j) {
+ if (j > 0) {
+ result += ",";
+ }
+
+ result += dim[j];
+ }
+
+ result += "]";
+ return result;
+ }
+}
diff --git a/petascope/src/petascope/wcps/server/core/StringScalarExpr.java b/petascope/src/petascope/wcps/server/core/StringScalarExpr.java
index 132e99d..93b94dc 100644
--- a/petascope/src/petascope/wcps/server/core/StringScalarExpr.java
+++ b/petascope/src/petascope/wcps/server/core/StringScalarExpr.java
@@ -14,51 +14,49 @@
* 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.InvalidCrsException;
-import petascope.wcps.server.exceptions.WCPSException;
-import org.w3c.dom.*;
-
-public class StringScalarExpr implements IRasNode {
-
- private String op, string;
- private CoverageExpr cov;
-
- public StringScalarExpr(Node node, XmlQuery xq) throws WCPSException, InvalidCrsException {
- while ((node != null) && (node.getNodeName().equals("#text"))) {
- node = node.getNextSibling();
- }
-
- System.err.println("Parsing String Scalar expr : " + node.getNodeName());
-
- if (node.getNodeName().equals("stringIdentifier")) {
- Node child = node.getFirstChild();
- cov = new CoverageExpr(child, xq);
- op = "id";
- } else if (node.getNodeName().equals("stringConstant")) {
- op = "constant";
- string = node.getNodeValue();
- } else {
- throw new WCPSException("Unknown String expr node: " + node.getNodeName());
- }
- }
-
- public String toRasQL() {
- String result = "";
- if (op.equals("constant")) {
- result = string;
- }
- if (op.equals("id")) {
- result = cov.toRasQL();
- }
-
- return result;
- }
-}
+package petascope.wcps.server.core;
+
+import petascope.exceptions.WCPSException;
+import org.w3c.dom.*;
+
+public class StringScalarExpr implements IRasNode {
+
+ private String op, string;
+ private CoverageExpr cov;
+
+ public StringScalarExpr(Node node, XmlQuery xq) throws WCPSException {
+ while ((node != null) && (node.getNodeName().equals("#text"))) {
+ node = node.getNextSibling();
+ }
+
+ System.err.println("Parsing String Scalar expr : " + node.getNodeName());
+
+ if (node.getNodeName().equals("stringIdentifier")) {
+ Node child = node.getFirstChild();
+ cov = new CoverageExpr(child, xq);
+ op = "id";
+ } else if (node.getNodeName().equals("stringConstant")) {
+ op = "constant";
+ string = node.getNodeValue();
+ } else {
+ throw new WCPSException("Unknown String expr node: " + node.getNodeName());
+ }
+ }
+
+ public String toRasQL() {
+ String result = "";
+ if (op.equals("constant")) {
+ result = string;
+ }
+ if (op.equals("id")) {
+ result = cov.toRasQL();
+ }
+
+ return result;
+ }
+}
diff --git a/petascope/src/petascope/wcps/server/core/SubsetOperationCoverageExpr.java b/petascope/src/petascope/wcps/server/core/SubsetOperationCoverageExpr.java
index 079aff7..0a98169 100644
--- a/petascope/src/petascope/wcps/server/core/SubsetOperationCoverageExpr.java
+++ b/petascope/src/petascope/wcps/server/core/SubsetOperationCoverageExpr.java
@@ -14,58 +14,56 @@
* 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.InvalidCrsException;
-import petascope.wcps.server.exceptions.WCPSException;
-import org.w3c.dom.*;
-
-// TODO: Implement class SubsetOperation
-public class SubsetOperationCoverageExpr implements IRasNode, ICoverageInfo {
-
- private IRasNode child;
- private CoverageInfo info = null;
-
- public SubsetOperationCoverageExpr(Node node, XmlQuery xq)
- throws WCPSException, InvalidCrsException {
-
- while ((node != null) && node.getNodeName().equals("#text")) {
- node = node.getNextSibling();
- }
-
- if (node == null) {
- throw new WCPSException("SubsetOperationCoverageExpr parsing error!");
- }
-
- String nodeName = node.getNodeName();
-
- System.err.println("SubsetOperationCoverageExpr: node " + nodeName);
-
- if (nodeName.equals("trim")) {
- child = new TrimCoverageExpr(node, xq);
- info = ((TrimCoverageExpr) child).getCoverageInfo();
- } else if (nodeName.equals("extend")) {
- child = new ExtendCoverageExpr(node, xq);
- info = ((ExtendCoverageExpr) child).getCoverageInfo();
- } else if (nodeName.equals("slice")) {
- child = new SliceCoverageExpr(node, xq);
- info = ((SliceCoverageExpr) child).getCoverageInfo();
- } else {
- throw new WCPSException("Failed to match SubsetOperation: " + nodeName);
- }
- }
-
- public String toRasQL() {
- return child.toRasQL();
- }
-
- public CoverageInfo getCoverageInfo() {
- return info;
- }
-}
+package petascope.wcps.server.core;
+
+import petascope.exceptions.WCPSException;
+import org.w3c.dom.*;
+
+// TODO: Implement class SubsetOperation
+public class SubsetOperationCoverageExpr implements IRasNode, ICoverageInfo {
+
+ private IRasNode child;
+ private CoverageInfo info = null;
+
+ public SubsetOperationCoverageExpr(Node node, XmlQuery xq)
+ throws WCPSException {
+
+ while ((node != null) && node.getNodeName().equals("#text")) {
+ node = node.getNextSibling();
+ }
+
+ if (node == null) {
+ throw new WCPSException("SubsetOperationCoverageExpr parsing error!");
+ }
+
+ String nodeName = node.getNodeName();
+
+ System.err.println("SubsetOperationCoverageExpr: node " + nodeName);
+
+ if (nodeName.equals("trim")) {
+ child = new TrimCoverageExpr(node, xq);
+ info = ((TrimCoverageExpr) child).getCoverageInfo();
+ } else if (nodeName.equals("extend")) {
+ child = new ExtendCoverageExpr(node, xq);
+ info = ((ExtendCoverageExpr) child).getCoverageInfo();
+ } else if (nodeName.equals("slice")) {
+ child = new SliceCoverageExpr(node, xq);
+ info = ((SliceCoverageExpr) child).getCoverageInfo();
+ } else {
+ throw new WCPSException("Failed to match SubsetOperation: " + nodeName);
+ }
+ }
+
+ public String toRasQL() {
+ return child.toRasQL();
+ }
+
+ public CoverageInfo getCoverageInfo() {
+ return info;
+ }
+}
diff --git a/petascope/src/petascope/wcps/server/core/TrimCoverageExpr.java b/petascope/src/petascope/wcps/server/core/TrimCoverageExpr.java
index 889780a..4ecb536 100644
--- a/petascope/src/petascope/wcps/server/core/TrimCoverageExpr.java
+++ b/petascope/src/petascope/wcps/server/core/TrimCoverageExpr.java
@@ -14,121 +14,117 @@
* 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.InvalidCrsException;
-import petascope.wcps.server.exceptions.WCPSException;
-import org.w3c.dom.*;
-
-import java.math.BigInteger;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-public class TrimCoverageExpr implements IRasNode, ICoverageInfo {
-
- private List<DimensionIntervalElement> axisList;
- private CoverageExpr coverageExprType;
- private CoverageInfo coverageInfo;
- private String[] dim;
- private int dims;
- private DimensionIntervalElement elem;
-
- public TrimCoverageExpr(Node node, XmlQuery xq) throws WCPSException, InvalidCrsException {
- Node child, axisNode;
- String nodeName;
-
- axisList = new ArrayList<DimensionIntervalElement>();
-
- child = node.getFirstChild();
- while (child != null) {
- nodeName = child.getNodeName();
-
- if (nodeName.equals("#text")) {
- child = child.getNextSibling();
- continue;
- }
-
- try {
- System.err.println("Trying out an CoverageExprType group...");
- coverageExprType = new CoverageExpr(child, xq);
- coverageInfo = coverageExprType.getCoverageInfo();
- child = child.getNextSibling();
- continue;
- } catch (WCPSException e) {
- System.err.println("This was no CoverageExprType: " + nodeName);
- }
-
- try {
- // Start a new axis and save it
- elem = new DimensionIntervalElement(child, xq, coverageInfo);
- axisList.add(elem);
- child = elem.getNextNode();
- continue;
- } catch (WCPSException e) {
- System.err.println("This was no Dimension Interval ELement: " + child.getNodeName());
- }
-
- // else unknown element
- throw new WCPSException("Unknown node for TrimCoverage expression:" + child.getNodeName());
- }
-
- dims = coverageInfo.getNumDimensions();
- dim = new String[dims];
-
- for (int j = 0; j < dims; ++j) {
- dim[j] = "*:*";
- }
-
-
- Iterator<DimensionIntervalElement> i = axisList.iterator();
-
- System.out.println("Axis List count:" + axisList.size());
- DimensionIntervalElement axis;
- int axisId;
- int axisLo, axisHi;
-
- while (i.hasNext()) {
- axis = i.next();
- axisId = coverageInfo.getDomainIndexByName(axis.getAxisName());
- System.out.println("Axis ID: " + axisId);
- System.out.println("Axis name: " + axis.getAxisName());
- System.out.print("Axis coords: ");
-
- axisLo = Integer.parseInt(axis.getLowCoord());
- axisHi = Integer.parseInt(axis.getHighCoord());
- dim[axisId] = axisLo + ":" + axisHi;
- coverageInfo.setCellDimension(
- axisId,
- new CellDomainElement(
- BigInteger.valueOf(axisLo), BigInteger.valueOf(axisHi)));
- }
-
- }
-
- public CoverageInfo getCoverageInfo() {
- return coverageInfo;
- }
-
- public String toRasQL() {
- String result = coverageExprType.toRasQL() + "[";
-
- for (int j = 0; j < dims; ++j) {
- if (j > 0) {
- result += ",";
- }
-
- result += dim[j];
- }
-
- result += "]";
- return result;
- }
-}
+package petascope.wcps.server.core;
+
+import petascope.exceptions.WCPSException;
+import org.w3c.dom.*;
+import java.math.BigInteger;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+public class TrimCoverageExpr implements IRasNode, ICoverageInfo {
+
+ private List<DimensionIntervalElement> axisList;
+ private CoverageExpr coverageExprType;
+ private CoverageInfo coverageInfo;
+ private String[] dim;
+ private int dims;
+ private DimensionIntervalElement elem;
+
+ public TrimCoverageExpr(Node node, XmlQuery xq) throws WCPSException {
+ Node child, axisNode;
+ String nodeName;
+
+ axisList = new ArrayList<DimensionIntervalElement>();
+
+ child = node.getFirstChild();
+ while (child != null) {
+ nodeName = child.getNodeName();
+
+ if (nodeName.equals("#text")) {
+ child = child.getNextSibling();
+ continue;
+ }
+
+ try {
+ System.err.println("Trying out an CoverageExprType group...");
+ coverageExprType = new CoverageExpr(child, xq);
+ coverageInfo = coverageExprType.getCoverageInfo();
+ child = child.getNextSibling();
+ continue;
+ } catch (WCPSException e) {
+ System.err.println("This was no CoverageExprType: " + nodeName);
+ }
+
+ try {
+ // Start a new axis and save it
+ elem = new DimensionIntervalElement(child, xq, coverageInfo);
+ axisList.add(elem);
+ child = elem.getNextNode();
+ continue;
+ } catch (WCPSException e) {
+ System.err.println("This was no Dimension Interval ELement: " + child.getNodeName());
+ }
+
+ // else unknown element
+ throw new WCPSException("Unknown node for TrimCoverage expression:" + child.getNodeName());
+ }
+
+ dims = coverageInfo.getNumDimensions();
+ dim = new String[dims];
+
+ for (int j = 0; j < dims; ++j) {
+ dim[j] = "*:*";
+ }
+
+
+ Iterator<DimensionIntervalElement> i = axisList.iterator();
+
+ System.out.println("Axis List count:" + axisList.size());
+ DimensionIntervalElement axis;
+ int axisId;
+ int axisLo, axisHi;
+
+ while (i.hasNext()) {
+ axis = i.next();
+ axisId = coverageInfo.getDomainIndexByName(axis.getAxisName());
+ System.out.println("Axis ID: " + axisId);
+ System.out.println("Axis name: " + axis.getAxisName());
+ System.out.print("Axis coords: ");
+
+ axisLo = Integer.parseInt(axis.getLowCoord());
+ axisHi = Integer.parseInt(axis.getHighCoord());
+ dim[axisId] = axisLo + ":" + axisHi;
+ coverageInfo.setCellDimension(
+ axisId,
+ new CellDomainElement(
+ BigInteger.valueOf(axisLo), BigInteger.valueOf(axisHi)));
+ }
+
+ }
+
+ public CoverageInfo getCoverageInfo() {
+ return coverageInfo;
+ }
+
+ public String toRasQL() {
+ String result = coverageExprType.toRasQL() + "[";
+
+ for (int j = 0; j < dims; ++j) {
+ if (j > 0) {
+ result += ",";
+ }
+
+ result += dim[j];
+ }
+
+ result += "]";
+ return result;
+ }
+}
diff --git a/petascope/src/petascope/wcps/server/core/UnaryOperationCoverageExpr.java b/petascope/src/petascope/wcps/server/core/UnaryOperationCoverageExpr.java
index af91897..f85283a 100644
--- a/petascope/src/petascope/wcps/server/core/UnaryOperationCoverageExpr.java
+++ b/petascope/src/petascope/wcps/server/core/UnaryOperationCoverageExpr.java
@@ -14,141 +14,139 @@
* 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.InvalidCrsException;
-import petascope.wcps.server.exceptions.WCPSException;
-import org.w3c.dom.*;
-
-public class UnaryOperationCoverageExpr implements IRasNode, ICoverageInfo {
-
- private CoverageExpr child;
- private CoverageInfo info;
- private String operation;
- private String params;
-
- public UnaryOperationCoverageExpr(Node node, XmlQuery xq)
- throws WCPSException, InvalidCrsException {
- String nodeName = node.getNodeName();
-
- System.err.println("Trying to parse unary operation: " + nodeName);
-
- if (nodeName.equals("unaryPlus")) {
- operation = "+";
- child = new CoverageExpr(node.getFirstChild(), xq);
- } else if (nodeName.equals("unaryMinus")) {
- operation = "-";
- child = new CoverageExpr(node.getFirstChild(), xq);
- } else if (nodeName.equals("sqrt") || nodeName.equals("abs")
- || nodeName.equals("exp") || nodeName.equals("log") || nodeName.equals("ln")
- || nodeName.equals("sin") || nodeName.equals("cos") || nodeName.equals("tan")
- || nodeName.equals("sinh") || nodeName.equals("cosh")
- || nodeName.equals("tanh") || nodeName.equals("arcsin")
- || nodeName.equals("arccos") || nodeName.equals("arctan")
- || nodeName.equals("not") || nodeName.equals("re") || nodeName.equals("im")) {
- operation = nodeName;
- child = new CoverageExpr(node.getFirstChild(), xq);
- } else if (nodeName.equals("bit")) {
- operation = "bit";
- Node c = node.getFirstChild();
-
- while (c != null) {
- if (c.getNodeName().equals("#text")) {
- c = c.getNextSibling();
- continue;
- }
-
- if (c.getNodeName().equals("bitIndex")) {
- try {
- params = c.getFirstChild().getNodeValue();
- int i = Integer.parseInt(params);
- System.err.println("Found bitIndex = " + params);
- } catch (NumberFormatException e) {
- throw new WCPSException("Invalid Number as bitIndex: " + params);
- }
- } else {
- child = new CoverageExpr(c, xq);
- }
-
- c = c.getNextSibling();
- }
- } else if (nodeName.equals("cast")) {
- operation = "cast";
- Node c = node.getFirstChild();
-
- while (c != null) {
- if (c.getNodeName().equals("#text")) {
- c = c.getNextSibling();
- continue;
- }
-
- if (c.getNodeName().equals("type")) {
- RangeField typeNode = new RangeField(c, xq);
- params = typeNode.toRasQL();
- } else {
- child = new CoverageExpr(c, xq);
- }
-
- c = c.getNextSibling();
- }
- } else if (nodeName.equals("fieldSelect")) {
- operation = "select";
- Node c = node.getFirstChild();
-
- while (c != null) {
- if (c.getNodeName().equals("#text")) {
- c = c.getNextSibling();
- continue;
- }
-
- if (c.getNodeName().equals("field")) {
- FieldName nameNode = new FieldName(c.getFirstChild(), xq);
- params = nameNode.toRasQL();
- } else {
- child = new CoverageExpr(c, xq);
- }
-
- c = c.getNextSibling();
- }
- } else {
- throw new WCPSException("Unknown unary operation: " + nodeName);
- }
-
- info = new CoverageInfo(child.getCoverageInfo());
- }
-
- public CoverageInfo getCoverageInfo() {
- return info;
- }
-
- public String toRasQL() {
- if (operation.equals("sqrt") || operation.equals("abs") || operation.equals("exp")
- || operation.equals("log") || operation.equals("ln") || operation.equals("sin")
- || operation.equals("cos") || operation.equals("tan")
- || operation.equals("sinh") || operation.equals("cosh")
- || operation.equals("tanh") || operation.equals("arcsin")
- || operation.equals("arccos") || operation.equals("arctan")
- || operation.equals("not") || operation.equals("+") || operation.equals("-")) {
- return operation + "(" + child.toRasQL() + ")";
- } else if (operation.equals("cast")) {
- // Use rasql's direct "type-casting" facility for constant scalar expressions
- // For example, (char)1 does not work, but 1c is a valid expression.
- if (child.isScalarExpr() && params.equals("char"))
- return child.toRasQL() + "c";
- else
- return "(" + params + ")(" + child.toRasQL() + ")";
- } else if (operation.equals("select")) {
- return "(" + child.toRasQL() + ")." + params;
- } else if (operation.equals("bit")) {
- return "bit(" + child.toRasQL() + "," + params + ")";
- }
-
- return " error ";
- }
-}
+package petascope.wcps.server.core;
+
+import petascope.exceptions.WCPSException;
+import org.w3c.dom.*;
+
+public class UnaryOperationCoverageExpr implements IRasNode, ICoverageInfo {
+
+ private CoverageExpr child;
+ private CoverageInfo info;
+ private String operation;
+ private String params;
+
+ public UnaryOperationCoverageExpr(Node node, XmlQuery xq)
+ throws WCPSException {
+ String nodeName = node.getNodeName();
+
+ System.err.println("Trying to parse unary operation: " + nodeName);
+
+ if (nodeName.equals("unaryPlus")) {
+ operation = "+";
+ child = new CoverageExpr(node.getFirstChild(), xq);
+ } else if (nodeName.equals("unaryMinus")) {
+ operation = "-";
+ child = new CoverageExpr(node.getFirstChild(), xq);
+ } else if (nodeName.equals("sqrt") || nodeName.equals("abs")
+ || nodeName.equals("exp") || nodeName.equals("log") || nodeName.equals("ln")
+ || nodeName.equals("sin") || nodeName.equals("cos") || nodeName.equals("tan")
+ || nodeName.equals("sinh") || nodeName.equals("cosh")
+ || nodeName.equals("tanh") || nodeName.equals("arcsin")
+ || nodeName.equals("arccos") || nodeName.equals("arctan")
+ || nodeName.equals("not") || nodeName.equals("re") || nodeName.equals("im")) {
+ operation = nodeName;
+ child = new CoverageExpr(node.getFirstChild(), xq);
+ } else if (nodeName.equals("bit")) {
+ operation = "bit";
+ Node c = node.getFirstChild();
+
+ while (c != null) {
+ if (c.getNodeName().equals("#text")) {
+ c = c.getNextSibling();
+ continue;
+ }
+
+ if (c.getNodeName().equals("bitIndex")) {
+ try {
+ params = c.getFirstChild().getNodeValue();
+ int i = Integer.parseInt(params);
+ System.err.println("Found bitIndex = " + params);
+ } catch (NumberFormatException e) {
+ throw new WCPSException("Invalid Number as bitIndex: " + params);
+ }
+ } else {
+ child = new CoverageExpr(c, xq);
+ }
+
+ c = c.getNextSibling();
+ }
+ } else if (nodeName.equals("cast")) {
+ operation = "cast";
+ Node c = node.getFirstChild();
+
+ while (c != null) {
+ if (c.getNodeName().equals("#text")) {
+ c = c.getNextSibling();
+ continue;
+ }
+
+ if (c.getNodeName().equals("type")) {
+ RangeField typeNode = new RangeField(c, xq);
+ params = typeNode.toRasQL();
+ } else {
+ child = new CoverageExpr(c, xq);
+ }
+
+ c = c.getNextSibling();
+ }
+ } else if (nodeName.equals("fieldSelect")) {
+ operation = "select";
+ Node c = node.getFirstChild();
+
+ while (c != null) {
+ if (c.getNodeName().equals("#text")) {
+ c = c.getNextSibling();
+ continue;
+ }
+
+ if (c.getNodeName().equals("field")) {
+ FieldName nameNode = new FieldName(c.getFirstChild(), xq);
+ params = nameNode.toRasQL();
+ } else {
+ child = new CoverageExpr(c, xq);
+ }
+
+ c = c.getNextSibling();
+ }
+ } else {
+ throw new WCPSException("Unknown unary operation: " + nodeName);
+ }
+
+ info = new CoverageInfo(child.getCoverageInfo());
+ }
+
+ public CoverageInfo getCoverageInfo() {
+ return info;
+ }
+
+ public String toRasQL() {
+ if (operation.equals("sqrt") || operation.equals("abs") || operation.equals("exp")
+ || operation.equals("log") || operation.equals("ln") || operation.equals("sin")
+ || operation.equals("cos") || operation.equals("tan")
+ || operation.equals("sinh") || operation.equals("cosh")
+ || operation.equals("tanh") || operation.equals("arcsin")
+ || operation.equals("arccos") || operation.equals("arctan")
+ || operation.equals("not") || operation.equals("+") || operation.equals("-")) {
+ return operation + "(" + child.toRasQL() + ")";
+ } else if (operation.equals("cast")) {
+ // Use rasql's direct "type-casting" facility for constant scalar expressions
+ // For example, (char)1 does not work, but 1c is a valid expression.
+ if (child.isScalarExpr() && params.equals("char"))
+ return child.toRasQL() + "c";
+ else
+ return "(" + params + ")(" + child.toRasQL() + ")";
+ } else if (operation.equals("select")) {
+ return "(" + child.toRasQL() + ")." + params;
+ } else if (operation.equals("bit")) {
+ return "bit(" + child.toRasQL() + "," + params + ")";
+ }
+
+ return " error ";
+ }
+}
diff --git a/petascope/src/petascope/wcps/server/core/VariableReference.java b/petascope/src/petascope/wcps/server/core/VariableReference.java
index 9c211c1..f6de89b 100644
--- a/petascope/src/petascope/wcps/server/core/VariableReference.java
+++ b/petascope/src/petascope/wcps/server/core/VariableReference.java
@@ -14,44 +14,43 @@
* 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 org.w3c.dom.*;
-
-public class VariableReference implements IRasNode {
-
- private String name;
- private String translatedName;
-
- public VariableReference(Node node, XmlQuery xq) throws WCPSException {
- System.err.println("Parsing variable reference: " + node.getNodeName());
-
- while ((node != null) && node.getNodeName().equals("#text")) {
- node = node.getNextSibling();
- }
-
- if (node != null && node.getNodeName().equals("variableRef")) {
- name = node.getTextContent();
- translatedName = xq.getReferenceVariableName(name);
- System.err.println("Variable " + name + " has been renamed into "
- + translatedName);
- } else {
- throw new WCPSException("Could not find any variable reference !");
- }
- }
-
- public String getName() {
- return name;
- }
-
- public String toRasQL() {
- return translatedName;
- }
-}
+package petascope.wcps.server.core;
+
+import petascope.exceptions.WCPSException;
+import org.w3c.dom.*;
+
+public class VariableReference implements IRasNode {
+
+ private String name;
+ private String translatedName;
+
+ public VariableReference(Node node, XmlQuery xq) throws WCPSException