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.tar.gz
rasdaman-upstream-master.tar.xz
rasdaman-upstream-master.zip
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 {
+ 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;
+ }
+}
diff --git a/petascope/src/petascope/wcps/server/core/WCPS.java b/petascope/src/petascope/wcps/server/core/WCPS.java
index 1dde6f5..24f87ce 100644
--- a/petascope/src/petascope/wcps/server/core/WCPS.java
+++ b/petascope/src/petascope/wcps/server/core/WCPS.java
@@ -14,172 +14,169 @@
* 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.server.exceptions.InvalidMetadataException;
-import javax.xml.parsers.ParserConfigurationException;
-import org.w3c.dom.*;
-
-import org.xml.sax.*;
-import org.xml.sax.SAXException;
-
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-
-
-import java.util.List;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-
-/**
- * This is the WCPS entry point. Processing a ProcessCoverage request happens in two stages.
-The first stage is the various pcPrepare functions, where XML is parsed, metadata is loaded,
-and the request is translated into an instance of a ProcessCoverageRequest. This data structure,
-for the time being, is just a list of rasdaman queries (RasQuery). The second stage is pcExecute,
-which executes a ProcessCoverageRequests and returns data.
- */
-public class WCPS {
-
- private static final String SCHEMA_PACKAGE_PROCESSCOVERAGE = "wcps.xml.processcoverage";
- private IMetadataSource metadataSource;
- private IDynamicMetadataSource dynamicMetadataSource;
- private DocumentBuilder wcpsDocumentBuilder;
-
- public WCPS(File pcSchema, IMetadataSource metadataSource) throws WCPSException {
- try {
- System.out.println("WCPS: Loading and parsing XML Schema ...");
- DocumentBuilderFactory dbconfig = DocumentBuilderFactory.newInstance();
-
- dbconfig.setValidating(false); // use XML schema not DTD
- dbconfig.setIgnoringComments(true); // comments are not relevant
- dbconfig.setIgnoringElementContentWhitespace(true); // remve the ignorable whitespace
-// Schema wcpsProcessCoverageSchema =
-// SchemaFactory.newInstance(
-// XMLConstants.W3C_XML_SCHEMA_NS_URI).newSchema(pcSchema);
-
-// dbconfig.setSchema(wcpsProcessCoverageSchema);
-
- wcpsDocumentBuilder = dbconfig.newDocumentBuilder();
- System.out.println("WCPS: Finished loading the schema !");
- } catch (Exception e) {
- throw new WCPSException(
- "Error while loading the document builder interface!", e);
- }
-
- this.dynamicMetadataSource = new DynamicMetadataSource(metadataSource);
- }
-
- public WCPS(IMetadataSource metadataSource) throws ParserConfigurationException,
- ResourceException, InvalidMetadataException {
- this.dynamicMetadataSource = new DynamicMetadataSource(metadataSource);
- wcpsDocumentBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
- }
-
- public List<byte[]> pcExecute(String url, String database, ProcessCoveragesRequest pcRequest)
- throws ResourceException {
- throw new ResourceException("Mothod not implemented! pcExecute");
-
- /*
- * List<RasQuery> queries = pcRequest.getQueries();
- * List<byte[]> results = new ArrayList<byte[]>( queries.size() );
- * synchronized( this ) {
- * 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();
- * Iterator<RasQuery> queryIterator = queries.iterator();
- * while( queryIterator.hasNext() ) {
- * String query = queryIterator.next().toString();
- * OQLQuery q = impl.newOQLQuery();
- * DBag resultSet;
- * try {
- * q.create( query );
- * resultSet = (DBag) q.execute();
- * if( resultSet != null ) {
- * Iterator resultIterator = resultSet.iterator();
- * while( resultIterator.hasNext() ) {
- * RasGMArray result = (RasGMArray) resultIterator.next();
- * results.add( result.getArray() );
- * }
- * }
- * }
- * catch (QueryException qe) {
- * tr.commit();
- * try {
- * db.close();
- * }
- * catch (ODMGException odmge) {}
- * throw new ResourceException ( "Could not evaluate rasdaman query: '" + query + "'", qe );
- * }
- * }
- * tr.commit();
- * try {
- * db.close();
- * }
- * catch (ODMGException odmge) {}
- * }
- * return results;
- */
- }
-
- public ProcessCoveragesRequest pcPrepare(String url, String database, File f)
- throws WCPSException, InvalidWcpsRequestException, ResourceException, SAXException,
- IOException, InvalidCrsException {
- return pcPrepare(url, database, wcpsDocumentBuilder.parse(f));
- }
-
- public ProcessCoveragesRequest pcPrepare(String url, String database, InputStream is,
- String systemId)
- throws WCPSException, InvalidWcpsRequestException, ResourceException, SAXException,
- IOException, InvalidCrsException {
- return pcPrepare(url, database, wcpsDocumentBuilder.parse(is, systemId));
- }
-
- public ProcessCoveragesRequest pcPrepare(String url, String database, String uri)
- throws WCPSException, InvalidWcpsRequestException, ResourceException, SAXException,
- IOException, InvalidCrsException {
- return pcPrepare(url, database, wcpsDocumentBuilder.parse(uri));
- }
-
- public ProcessCoveragesRequest pcPrepare(String url, String database, InputSource is)
- throws WCPSException, InvalidWcpsRequestException, ResourceException, SAXException,
- IOException, InvalidCrsException {
- return pcPrepare(url, database, wcpsDocumentBuilder.parse(is));
- }
-
- public ProcessCoveragesRequest pcPrepare(String url, String database, InputStream is)
- throws WCPSException, InvalidWcpsRequestException, ResourceException, SAXException,
- IOException, InvalidCrsException {
- return pcPrepare(url, database, wcpsDocumentBuilder.parse(is));
- }
-
- private ProcessCoveragesRequest pcPrepare(String url, String database, Document doc)
- throws WCPSException, InvalidWcpsRequestException, ResourceException, SAXException, IOException, InvalidCrsException {
- ProcessCoveragesRequest req = new ProcessCoveragesRequest(url, database, doc, dynamicMetadataSource, this);
- return req;
- }
-}
+package petascope.wcps.server.core;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import petascope.core.IMetadataSource;
+import petascope.core.DynamicMetadataSource;
+import petascope.core.IDynamicMetadataSource;
+import petascope.exceptions.PetascopeException;
+import petascope.exceptions.WCPSException;
+import javax.xml.parsers.ParserConfigurationException;
+import org.w3c.dom.*;
+import org.xml.sax.*;
+import org.xml.sax.SAXException;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.List;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import petascope.exceptions.ExceptionCode;
+
+/**
+ * This is the WCPS entry point. Processing a ProcessCoverage request happens in two stages.
+The first stage is the various pcPrepare functions, where XML is parsed, metadata is loaded,
+and the request is translated into an instance of a ProcessCoverageRequest. This data structure,
+for the time being, is just a list of rasdaman queries (RasQuery). The second stage is pcExecute,
+which executes a ProcessCoverageRequests and returns data.
+ */
+public class WCPS {
+
+ private static final String SCHEMA_PACKAGE_PROCESSCOVERAGE = "wcps.xml.processcoverage";
+ private IMetadataSource metadataSource;
+ private IDynamicMetadataSource dynamicMetadataSource;
+ private DocumentBuilder wcpsDocumentBuilder;
+
+ public WCPS(File pcSchema, IMetadataSource metadataSource) throws WCPSException, PetascopeException {
+ try {
+ System.out.println("WCPS: Loading and parsing XML Schema ...");
+ DocumentBuilderFactory dbconfig = DocumentBuilderFactory.newInstance();
+
+ dbconfig.setValidating(false); // use XML schema not DTD
+ dbconfig.setIgnoringComments(true); // comments are not relevant
+ dbconfig.setIgnoringElementContentWhitespace(true); // remve the ignorable whitespace
+// Schema wcpsProcessCoverageSchema =
+// SchemaFactory.newInstance(
+// XMLConstants.W3C_XML_SCHEMA_NS_URI).newSchema(pcSchema);
+
+// dbconfig.setSchema(wcpsProcessCoverageSchema);
+
+ wcpsDocumentBuilder = dbconfig.newDocumentBuilder();
+ System.out.println("WCPS: Finished loading the schema !");
+ } catch (Exception e) {
+ throw new WCPSException(
+ "Error while loading the document builder interface!", e);
+ }
+
+ this.dynamicMetadataSource = new DynamicMetadataSource(metadataSource);
+ }
+
+ public WCPS(IMetadataSource metadataSource) throws ParserConfigurationException, PetascopeException {
+ this.dynamicMetadataSource = new DynamicMetadataSource(metadataSource);
+ wcpsDocumentBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
+ }
+
+ public List<byte[]> pcExecute(String url, String database, ProcessCoveragesRequest pcRequest) throws WCPSException {
+ throw new WCPSException(ExceptionCode.ResourceError, "Mothod not implemented! pcExecute");
+
+ /*
+ * List<RasQuery> queries = pcRequest.getQueries();
+ * List<byte[]> results = new ArrayList<byte[]>( queries.size() );
+ * synchronized( this ) {
+ * 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();
+ * Iterator<RasQuery> queryIterator = queries.iterator();
+ * while( queryIterator.hasNext() ) {
+ * String query = queryIterator.next().toString();
+ * OQLQuery q = impl.newOQLQuery();
+ * DBag resultSet;
+ * try {
+ * q.create( query );
+ * resultSet = (DBag) q.execute();
+ * if( resultSet != null ) {
+ * Iterator resultIterator = resultSet.iterator();
+ * while( resultIterator.hasNext() ) {
+ * RasGMArray result = (RasGMArray) resultIterator.next();
+ * results.add( result.getArray() );
+ * }
+ * }
+ * }
+ * catch (QueryException qe) {
+ * tr.commit();
+ * try {
+ * db.close();
+ * }
+ * catch (ODMGException odmge) {}
+ * throw new ResourceException ( "Could not evaluate rasdaman query: '" + query + "'", qe );
+ * }
+ * }
+ * tr.commit();
+ * try {
+ * db.close();
+ * }
+ * catch (ODMGException odmge) {}
+ * }
+ * return results;
+ */
+ }
+
+ public ProcessCoveragesRequest pcPrepare(String url, String database, File f)
+ throws WCPSException, SAXException,
+ IOException {
+ return pcPrepare(url, database, wcpsDocumentBuilder.parse(f));
+ }
+
+ public ProcessCoveragesRequest pcPrepare(String url, String database, InputStream is,
+ String systemId)
+ throws WCPSException, SAXException,
+ IOException {
+ return pcPrepare(url, database, wcpsDocumentBuilder.parse(is, systemId));
+ }
+
+ public ProcessCoveragesRequest pcPrepare(String url, String database, String uri)
+ throws WCPSException, SAXException,
+ IOException {
+ return pcPrepare(url, database, wcpsDocumentBuilder.parse(uri));
+ }
+
+ public ProcessCoveragesRequest pcPrepare(String url, String database, InputSource is)
+ throws WCPSException, SAXException,
+ IOException {
+ return pcPrepare(url, database, wcpsDocumentBuilder.parse(is));
+ }
+
+ public ProcessCoveragesRequest pcPrepare(String url, String database, InputStream is)
+ throws WCPSException, SAXException,
+ IOException {
+ return pcPrepare(url, database, wcpsDocumentBuilder.parse(is));
+ }
+
+ private ProcessCoveragesRequest pcPrepare(String url, String database, Document doc)
+ throws WCPSException, SAXException, IOException {
+ try {
+ return new ProcessCoveragesRequest(url, database, doc, dynamicMetadataSource, this);
+ } catch (PetascopeException ex) {
+ throw (WCPSException) ex;
+ }
+ }
+}
diff --git a/petascope/src/petascope/wcps/server/core/Wgs84Crs.java b/petascope/src/petascope/wcps/server/core/Wgs84Crs.java
index 9b6af44..bd5a54d 100644
--- a/petascope/src/petascope/wcps/server/core/Wgs84Crs.java
+++ b/petascope/src/petascope/wcps/server/core/Wgs84Crs.java
@@ -14,111 +14,110 @@
* 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;
-
-/**
- * Represents a WGS Coordinate Reference System (CRS) and its bounding box.
- *
- *
- * @version 10.Sep 2009
- * @author Andrei Aiordachioaie
- */
-public class Wgs84Crs implements Cloneable {
-
- private String name = "WGS84";
- private Double low1, high1, low2, high2;
- private Double offset1, offset2; // precomputed world-to-crs offsets
-
- public Wgs84Crs(Double l1, Double h1, Double l2, Double h2, Double o1, Double o2)
- throws InvalidMetadataException {
- if ((l1 == null) || (h1 == null) || (l2 == null) || (h2 == null)) {
- throw new InvalidMetadataException(
- "Invalid WGS 84 bounding box: null element encountered.");
- }
- if ((o1 == null) || (o2 == null)) {
- throw new InvalidMetadataException("Invalid WGS 84 offsets: null element encountered.");
- }
-
- low1 = l1;
- low2 = l2;
- high1 = h1;
- high2 = h2;
-
- offset1 = o1;
- offset2 = o2;
- }
-
- public Wgs84Crs clone() {
- try {
- return new Wgs84Crs(new Double(getLow1()), new Double(getHigh1()),
- new Double(getLow2()), new Double(getHigh2()),
- new Double(getOffset1()), new Double(getOffset2()));
- } catch (InvalidMetadataException e) {
- return null;
- }
- }
-
- public String toString() {
- String d = "CRS '" + getName() + "' { Bounding Box [X(" + getLow1() + ", " + getHigh1() + "), "
- + "Y(" + getLow2() + ", " + getHigh2() + ")], "
- + "Offsets [X(" + getOffset1() + "), Y(" + getOffset2() + ")]}";
- return d;
- }
-
- /**
- * @return the low1
- */
- public Double getLow1() {
- return low1;
- }
-
- /**
- * @return the high1
- */
- public Double getHigh1() {
- return high1;
- }
-
- /**
- * @return the low2
- */
- public Double getLow2() {
- return low2;
- }
-
- /**
- * @return the high2
- */
- public Double getHigh2() {
- return high2;
- }
-
- /**
- * @return the offset1
- */
- public Double getOffset1() {
- return offset1;
- }
-
- /**
- * @return the offset2
- */
- public Double getOffset2() {
- return offset2;
- }
-
- /**
- * @return the name
- */
- public String getName() {
- return name;
- }
-}
+package petascope.wcps.server.core;
+
+import petascope.exceptions.ExceptionCode;
+import petascope.exceptions.WCPSException;
+
+/**
+ * Represents a WGS Coordinate Reference System (CRS) and its bounding box.
+ *
+ *
+ * @version 10.Sep 2009
+ * @author Andrei Aiordachioaie
+ */
+public class Wgs84Crs implements Cloneable {
+
+ private String name = "WGS84";
+ private Double low1, high1, low2, high2;
+ private Double offset1, offset2; // precomputed world-to-crs offsets
+
+ public Wgs84Crs(Double l1, Double h1, Double l2, Double h2, Double o1, Double o2) throws WCPSException {
+ if ((l1 == null) || (h1 == null) || (l2 == null) || (h2 == null)) {
+ throw new WCPSException(ExceptionCode.InvalidMetadata,
+ "Invalid WGS 84 bounding box: null element encountered.");
+ }
+ if ((o1 == null) || (o2 == null)) {
+ throw new WCPSException(ExceptionCode.InvalidMetadata, "Invalid WGS 84 offsets: null element encountered.");
+ }
+
+ low1 = l1;
+ low2 = l2;
+ high1 = h1;
+ high2 = h2;
+
+ offset1 = o1;
+ offset2 = o2;
+ }
+
+ public Wgs84Crs clone() {
+ try {
+ return new Wgs84Crs(new Double(getLow1()), new Double(getHigh1()),
+ new Double(getLow2()), new Double(getHigh2()),
+ new Double(getOffset1()), new Double(getOffset2()));
+ } catch (WCPSException e) {
+ return null;
+ }
+ }
+
+ public String toString() {
+ String d = "CRS '" + getName() + "' { Bounding Box [X(" + getLow1() + ", " + getHigh1() + "), "
+ + "Y(" + getLow2() + ", " + getHigh2() + ")], "
+ + "Offsets [X(" + getOffset1() + "), Y(" + getOffset2() + ")]}";
+ return d;
+ }
+
+ /**
+ * @return the low1
+ */
+ public Double getLow1() {
+ return low1;
+ }
+
+ /**
+ * @return the high1
+ */
+ public Double getHigh1() {
+ return high1;
+ }
+
+ /**
+ * @return the low2
+ */
+ public Double getLow2() {
+ return low2;
+ }
+
+ /**
+ * @return the high2
+ */
+ public Double getHigh2() {
+ return high2;
+ }
+
+ /**
+ * @return the offset1
+ */
+ public Double getOffset1() {
+ return offset1;
+ }
+
+ /**
+ * @return the offset2
+ */
+ public Double getOffset2() {
+ return offset2;
+ }
+
+ /**
+ * @return the name
+ */
+ public String getName() {
+ return name;
+ }
+}
diff --git a/petascope/src/petascope/wcps/server/core/XmlQuery.java b/petascope/src/petascope/wcps/server/core/XmlQuery.java
index 3271892..4530a3b 100644
--- a/petascope/src/petascope/wcps/server/core/XmlQuery.java
+++ b/petascope/src/petascope/wcps/server/core/XmlQuery.java
@@ -14,18 +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;
-import petascope.wcps.server.exceptions.InvalidCrsException;
-import petascope.wcps.server.exceptions.WCPSException;
+import petascope.core.IDynamicMetadataSource;
+import petascope.exceptions.PetascopeException;
+import petascope.exceptions.WCPSException;
import org.w3c.dom.*;
-
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
@@ -73,7 +72,7 @@ public class XmlQuery implements IRasNode {
varDimension = new HashMap<String, Integer>();
}
- public XmlQuery(Node node) throws WCPSException, InvalidCrsException {
+ public XmlQuery(Node node) throws WCPSException, PetascopeException {
iterators = new ArrayList<CoverageIterator>();
dynamicIterators = new ArrayList<CoverageIterator>();
variableTranslator = new HashMap<String, String>();
@@ -81,7 +80,7 @@ public class XmlQuery implements IRasNode {
this.startParsing(node);
}
- public void startParsing(Node node) throws WCPSException, InvalidCrsException {
+ public void startParsing(Node node) throws WCPSException, PetascopeException {
System.err.println("Processing XML Request: " + node.getNodeName());
Node x = node.getFirstChild();
diff --git a/petascope/src/petascope/wcps/server/exceptions/InvalidCrsException.java b/petascope/src/petascope/wcps/server/exceptions/InvalidCrsException.java
deleted file mode 100644
index a888785..0000000
--- a/petascope/src/petascope/wcps/server/exceptions/InvalidCrsException.java
+++ /dev/null
@@ -1,30 +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.exceptions;
-
-public class InvalidCrsException extends Exception {
-
- public InvalidCrsException(String message) {
- super(message);
- }
-}
diff --git a/petascope/src/petascope/wcps/server/exceptions/InvalidMetadataException.java b/petascope/src/petascope/wcps/server/exceptions/InvalidMetadataException.java
deleted file mode 100644
index 4e1bd32..0000000
--- a/petascope/src/petascope/wcps/server/exceptions/InvalidMetadataException.java
+++ /dev/null
@@ -1,37 +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.exceptions;
-
-/**
- * Thrown when WCPS received a request, but could not evaluate it because the
- * metadata for some coverage does not conform to the WCPS standard.
- */
-public class InvalidMetadataException extends WCPSException {
-
- private static final long serialVersionUID = 48924938L;
-
- public InvalidMetadataException(String message) {
- super(message, null);
-
- }
-}
diff --git a/petascope/src/petascope/wcps/server/exceptions/InvalidWcpsRequestException.java b/petascope/src/petascope/wcps/server/exceptions/InvalidWcpsRequestException.java
deleted file mode 100644
index ea1cc05..0000000
--- a/petascope/src/petascope/wcps/server/exceptions/InvalidWcpsRequestException.java
+++ /dev/null
@@ -1,39 +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.exceptions;
-
-/**
- * This exception is throws whenever a user submits a request that is not valid in some way.
- */
-public class InvalidWcpsRequestException extends WCPSException {
-
- private static final long serialVersionUID = 65492846L;
-
- public InvalidWcpsRequestException(String message) {
- super(message, null);
- }
-
- public InvalidWcpsRequestException(String message, Throwable cause) {
- super(message, cause);
- }
-}
diff --git a/petascope/src/petascope/wcps/server/exceptions/ResourceException.java b/petascope/src/petascope/wcps/server/exceptions/ResourceException.java
deleted file mode 100644
index b8186eb..0000000
--- a/petascope/src/petascope/wcps/server/exceptions/ResourceException.java
+++ /dev/null
@@ -1,41 +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.exceptions;
-
-/**
- * This exception is thrown whenever some required resource is not available -
- * a database connection, a file, etc.
- */
-public class ResourceException extends WCPSException {
-
- private static final long serialVersionUID = 45562458L;
-
- public ResourceException(String message) {
- super(message);
- }
-
- public ResourceException(String message, Throwable cause) {
- super(message, cause);
-
- }
-}
diff --git a/petascope/src/petascope/wcps/server/exceptions/WCPSException.java b/petascope/src/petascope/wcps/server/exceptions/WCPSException.java
deleted file mode 100644
index 0dbd5db..0000000
--- a/petascope/src/petascope/wcps/server/exceptions/WCPSException.java
+++ /dev/null
@@ -1,40 +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.exceptions;
-
-/**
- * This is the superclass of all WCPS exceptions.
- */
-public class WCPSException extends Exception {
-
- private static final long serialVersionUID = 113213254L;
-
- public WCPSException(String message) {
- super(message);
- }
-
- public WCPSException(String message, Throwable cause) {
- super(message, cause);
-
- }
-}
diff --git a/petascope/src/petascope/wcps/server/servlet/WCPSServlet.java b/petascope/src/petascope/wcps/server/servlet/WCPSServlet.java
index 74f8d1b..708d028 100644
--- a/petascope/src/petascope/wcps/server/servlet/WCPSServlet.java
+++ b/petascope/src/petascope/wcps/server/servlet/WCPSServlet.java
@@ -14,245 +14,237 @@
* 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.servlet;
-
-import org.apache.commons.fileupload.FileItem;
-import org.apache.commons.fileupload.disk.DiskFileItemFactory;
-import org.apache.commons.fileupload.servlet.ServletFileUpload;
-
-
-//This is the servlet interface of WCPS. It mostly consists of sanity checks and initialization,
-//the meat is onyl a few lines. The WCPS class does the actual work.
-
-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.IOException;
-import java.io.OutputStream;
-import java.io.PrintWriter;
-
-
-import java.util.Iterator;
-import java.util.List;
-import java.util.Properties;
-
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.io.IOUtils;
-
-//Note an important limitation: this will only return the first result if several are available.
-//The reason is that WCPS currently has no standardized way to return multiple byte streams to
-//the user.
-public class WCPSServlet extends HttpServlet {
-
- private Properties dbParams;
- private DbMetadataSource metadataSource;
- private String rasdamanDatabase;
- private String rasdamanUrl;
- private WCPS wcps;
- // path to the default HTML response of the servlet
- private String servletHtmlPath = "/templates/wcps-servlet.html";
- // String containing the HTML code for the default response
- private String defaultHtmlResponse;
-
- public void init() throws ServletException {
- try {
- dbParams = new Properties();
- System.out.println("WCPS: loading database properties");
- dbParams.load(
- new FileInputStream(
- getServletContext().getRealPath("/settings.properties")));
- rasdamanUrl = dbParams.getProperty("rasdaman_url");
- rasdamanDatabase = dbParams.getProperty("rasdaman_database");
-
- System.out.println("WCPS: initializing metadata database");
- metadataSource =
- new DbMetadataSource(dbParams.getProperty("metadata_driver"),
- dbParams.getProperty("metadata_url"),
- dbParams.getProperty("metadata_user"),
- dbParams.getProperty("metadata_pass"), false);
-
- System.out.println("WCPS: initializing WCPS core");
- wcps = new WCPS(
- new File(getServletContext().getRealPath("/xml/ogc/wcps/1.0.0/wcpsProcessCoverages.xsd")),
- // new CachedMetadataSource(metadataSource)); // removed metadata caching (andrei)
- metadataSource);
-
- servletHtmlPath = getServletContext().getRealPath(servletHtmlPath);
- defaultHtmlResponse = FileUtils.readFileToString(new File(servletHtmlPath));
-
- System.out.println("WCPS: initialization complete");
- } catch (Exception e) {
- System.out.println("WCPS: initialization error");
- System.out.println("WCPS: closing metadata database");
-
- if (metadataSource != null) {
- metadataSource.close();
- }
-
- System.out.println("WCPS: done with init error");
- throw new ServletException("WCPS initialization error", e);
- }
-
- }
-
- public void doGet(HttpServletRequest request, HttpServletResponse response)
- throws ServletException, IOException {
- System.out.println("WCPS: invoked with GET");
- printUsage(response);
- }
-
- public void doPost(HttpServletRequest request, HttpServletResponse response)
- throws ServletException, IOException {
- System.out.println("WCPS: invoked with POST");
- OutputStream webOut = null;
-
- try {
- String xmlRequest = null;
-
- if (ServletFileUpload.isMultipartContent(request)) {
- @SuppressWarnings("unchecked")
- Iterator<FileItem> fileItems =
- (Iterator<FileItem>) (new ServletFileUpload(
- new DiskFileItemFactory())).parseRequest(
- request).iterator();
-
- if (!fileItems.hasNext()) {
- throw new IOException(
- "Multipart POST request contains no parts");
- }
-
- FileItem fileItem = fileItems.next();
-
- if (fileItems.hasNext()) {
- throw new IOException(
- "Multipart POST request contains too many parts");
- }
-
- if (!fileItem.isFormField()
- && fileItem.getContentType().equals("text/xml")) {
- xmlRequest = fileItem.getString();
- }
-
- if (xmlRequest == null) {
- System.out.println(
- "WCPS: no XML file was uploaded within multipart POST request");
- printUsage(response);
- return;
- }
-
- System.out.println(
- "WCPS: received XML via a multipart POST request");
- } else {
- String xml = request.getParameter("xml");
- String query = request.getParameter("query");
-
- if (xml != null) {
- System.out.println("WCPS: received XML via a 'xml' parameter in a POST request");
- xmlRequest = xml;
- } else if (query != null) {
- System.out.println("WCPS: received the following query via a 'query' "
- + "parameter in a POST request:");
- System.out.println(query);
-
- xmlRequest = ProcessCoveragesRequest.abstractQueryToXmlQuery(query);
- System.out.println("WCPS: transformed the abstract syntax query into an XML query!");
- } else {
- System.out.println("WCPS: no request was received");
- printUsage(response);
- return;
- }
- }
-
- System.out.println("WCPS: received the following request:");
- System.out.println(xmlRequest);
-
- System.out.println("WCPS: preparing request");
- ProcessCoveragesRequest processCoverageRequest =
- wcps.pcPrepare(rasdamanUrl, rasdamanDatabase, IOUtils.toInputStream(xmlRequest));
-
- String query = processCoverageRequest.getRasqlQuery();
- String mime = processCoverageRequest.getMime();
-
- System.out.println("[" + mime + "] " + query);
-
- System.out.println("Resulting RasQL query: " + query);
-
- System.out.println("WCPS: executing request");
-
- List<byte[]> results = processCoverageRequest.execute();
-
- System.out.println("WCPS: setting response mimetype to " + mime);
- response.setContentType(mime);
- System.out.println("WCPS: returning response");
- webOut = response.getOutputStream();
- webOut.write(results.get(0));
- System.out.println("WCPS: done");
- } catch (Exception e) {
- printError(response, "Error: " + e.getMessage(), e);
- } finally {
- if (webOut != null) {
- try {
- webOut.close();
- } catch (IOException e) {
- }
- }
- }
- }
-
- public void destroy() {
- super.destroy();
-
- }
-
- public String getServletInfo() {
- return "Web Coverage Processing Service (Project PetaScope)";
-
- }
-
- private void printError(HttpServletResponse response, String message, Exception e)
- throws IOException {
- System.out.println("WCPS: error");
- System.out.println("WCPS: setting response mimetype to text/html; charset=utf-8");
- response.setContentType("text/html; charset=utf-8");
- System.out.println("WCPS: returning the following error message");
- e.printStackTrace(System.out);
- System.out.println("WCPS: end of error message");
- PrintWriter out = new PrintWriter(response.getOutputStream());
-
- out.println(
- "<html><head><title>Web Coverage Processing Service</title></head><body>");
- out.println("<h1>An error has occured</h1>");
- out.println("<p>" + message + "</p>");
- out.println("<p>Stack trace:<br/><small>");
- e.printStackTrace(out);
- out.println("</small></p></body></html>");
- out.close();
- System.out.println("WCPS: done with error");
- }
-
- private void printUsage(HttpServletResponse response) throws IOException {
- System.out.println("WCPS: setting response mimetype to text/html; charset=utf-8");
- System.out.println("WCPS: returning usage message");
- response.setContentType("text/html; charset=utf-8");
- PrintWriter out = new PrintWriter(response.getOutputStream());
-
- out.println(defaultHtmlResponse);
-
- out.close();
- System.out.println("WCPS: done nothing");
-
- }
-}
+package petascope.wcps.server.servlet;
+
+import org.apache.commons.fileupload.FileItem;
+import org.apache.commons.fileupload.disk.DiskFileItemFactory;
+import org.apache.commons.fileupload.servlet.ServletFileUpload;
+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.IOException;
+import java.io.OutputStream;
+import java.io.PrintWriter;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Properties;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.IOUtils;
+
+//important limitation: this will only return the first result if several are available.
+//The reason is that WCPS currently has no standardized way to return multiple byte streams to
+//the user.
+//This is the servlet interface of WCPS. It mostly consists of sanity checks and initialization,
+//the meat is onyl a few lines. The WCPS class does the actual work.
+public class WCPSServlet extends HttpServlet {
+
+ private Properties dbParams;
+ private DbMetadataSource metadataSource;
+ private String rasdamanDatabase;
+ private String rasdamanUrl;
+ private WCPS wcps;
+ // path to the default HTML response of the servlet
+ private String servletHtmlPath = "/templates/wcps-servlet.html";
+ // String containing the HTML code for the default response
+ private String defaultHtmlResponse;
+
+ public void init() throws ServletException {
+ try {
+ dbParams = new Properties();
+ System.out.println("WCPS: loading database properties");
+ dbParams.load(
+ new FileInputStream(
+ getServletContext().getRealPath("/settings.properties")));
+ rasdamanUrl = dbParams.getProperty("rasdaman_url");
+ rasdamanDatabase = dbParams.getProperty("rasdaman_database");
+
+ System.out.println("WCPS: initializing metadata database");
+ metadataSource =
+ new DbMetadataSource(dbParams.getProperty("metadata_driver"),
+ dbParams.getProperty("metadata_url"),
+ dbParams.getProperty("metadata_user"),
+ dbParams.getProperty("metadata_pass"), false);
+
+ System.out.println("WCPS: initializing WCPS core");
+ wcps = new WCPS(
+ new File(getServletContext().getRealPath("/xml/ogc/wcps/1.0.0/wcpsProcessCoverages.xsd")),
+ // new CachedMetadataSource(metadataSource)); // removed metadata caching (andrei)
+ metadataSource);
+
+ servletHtmlPath = getServletContext().getRealPath(servletHtmlPath);
+ defaultHtmlResponse = FileUtils.readFileToString(new File(servletHtmlPath));
+
+ System.out.println("WCPS: initialization complete");
+ } catch (Exception e) {
+ System.out.println("WCPS: initialization error");
+ System.out.println("WCPS: closing metadata database");
+
+ if (metadataSource != null) {
+ metadataSource.close();
+ }
+
+ System.out.println("WCPS: done with init error");
+ throw new ServletException("WCPS initialization error", e);
+ }
+
+ }
+
+ public void doGet(HttpServletRequest request, HttpServletResponse response)
+ throws ServletException, IOException {
+ System.out.println("WCPS: invoked with GET");
+ printUsage(response);
+ }
+
+ public void doPost(HttpServletRequest request, HttpServletResponse response)
+ throws ServletException, IOException {
+ System.out.println("WCPS: invoked with POST");
+ OutputStream webOut = null;
+
+ try {
+ String xmlRequest = null;
+
+ if (ServletFileUpload.isMultipartContent(request)) {
+ @SuppressWarnings("unchecked")
+ Iterator<FileItem> fileItems =
+ (Iterator<FileItem>) (new ServletFileUpload(
+ new DiskFileItemFactory())).parseRequest(
+ request).iterator();
+
+ if (!fileItems.hasNext()) {
+ throw new IOException(
+ "Multipart POST request contains no parts");
+ }
+
+ FileItem fileItem = fileItems.next();
+
+ if (fileItems.hasNext()) {
+ throw new IOException(
+ "Multipart POST request contains too many parts");
+ }
+
+ if (!fileItem.isFormField()
+ && fileItem.getContentType().equals("text/xml")) {
+ xmlRequest = fileItem.getString();
+ }
+
+ if (xmlRequest == null) {
+ System.out.println(
+ "WCPS: no XML file was uploaded within multipart POST request");
+ printUsage(response);
+ return;
+ }
+
+ System.out.println(
+ "WCPS: received XML via a multipart POST request");
+ } else {
+ String xml = request.getParameter("xml");
+ String query = request.getParameter("query");
+
+ if (xml != null) {
+ System.out.println("WCPS: received XML via a 'xml' parameter in a POST request");
+ xmlRequest = xml;
+ } else if (query != null) {
+ System.out.println("WCPS: received the following query via a 'query' "
+ + "parameter in a POST request:");
+ System.out.println(query);
+
+ xmlRequest = ProcessCoveragesRequest.abstractQueryToXmlQuery(query);
+ System.out.println("WCPS: transformed the abstract syntax query into an XML query!");
+ } else {
+ System.out.println("WCPS: no request was received");
+ printUsage(response);
+ return;
+ }
+ }
+
+ System.out.println("WCPS: received the following request:");
+ System.out.println(xmlRequest);
+
+ System.out.println("WCPS: preparing request");
+ ProcessCoveragesRequest processCoverageRequest =
+ wcps.pcPrepare(rasdamanUrl, rasdamanDatabase, IOUtils.toInputStream(xmlRequest));
+
+ String query = processCoverageRequest.getRasqlQuery();
+ String mime = processCoverageRequest.getMime();
+
+ System.out.println("[" + mime + "] " + query);
+
+ System.out.println("Resulting RasQL query: " + query);
+
+ System.out.println("WCPS: executing request");
+
+ List<byte[]> results = processCoverageRequest.execute();
+
+ System.out.println("WCPS: setting response mimetype to " + mime);
+ response.setContentType(mime);
+ System.out.println("WCPS: returning response");
+ webOut = response.getOutputStream();
+ webOut.write(results.get(0));
+ System.out.println("WCPS: done");
+ } catch (Exception e) {
+ printError(response, "Error: " + e.getMessage(), e);
+ } finally {
+ if (webOut != null) {
+ try {
+ webOut.close();
+ } catch (IOException e) {
+ }
+ }
+ }
+ }
+
+ public void destroy() {
+ super.destroy();
+
+ }
+
+ public String getServletInfo() {
+ return "Web Coverage Processing Service (Project PetaScope)";
+
+ }
+
+ private void printError(HttpServletResponse response, String message, Exception e)
+ throws IOException {
+ System.out.println("WCPS: error");
+ System.out.println("WCPS: setting response mimetype to text/html; charset=utf-8");
+ response.setContentType("text/html; charset=utf-8");
+ System.out.println("WCPS: returning the following error message");
+ e.printStackTrace(System.out);
+ System.out.println("WCPS: end of error message");
+ PrintWriter out = new PrintWriter(response.getOutputStream());
+
+ out.println(
+ "<html><head><title>Web Coverage Processing Service</title></head><body>");
+ out.println("<h1>An error has occured</h1>");
+ out.println("<p>" + message + "</p>");
+ out.println("<p>Stack trace:<br/><small>");
+ e.printStackTrace(out);
+ out.println("</small></p></body></html>");
+ out.close();
+ System.out.println("WCPS: done with error");
+ }
+
+ private void printUsage(HttpServletResponse response) throws IOException {
+ System.out.println("WCPS: setting response mimetype to text/html; charset=utf-8");
+ System.out.println("WCPS: returning usage message");
+ response.setContentType("text/html; charset=utf-8");
+ PrintWriter out = new PrintWriter(response.getOutputStream());
+
+ out.println(defaultHtmlResponse);
+
+ out.close();
+ System.out.println("WCPS: done nothing");
+
+ }
+}
diff --git a/petascope/src/petascope/wcps/server/test/FullTestsOnline.java b/petascope/src/petascope/wcps/server/test/FullTestsOnline.java
index bc2aab1..61c1737 100644
--- a/petascope/src/petascope/wcps/server/test/FullTestsOnline.java
+++ b/petascope/src/petascope/wcps/server/test/FullTestsOnline.java
@@ -14,32 +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.test;
-//~--- non-JDK imports --------------------------------------------------------
import org.apache.commons.io.FileUtils;
-
import petascope.wcps.server.cli.grammar;
-
-//~--- JDK imports ------------------------------------------------------------
-
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.File;
import java.io.FilenameFilter;
import java.io.IOException;
import java.io.InputStreamReader;
-
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
-
import java.util.Arrays;
import java.util.HashMap;
import javax.xml.parsers.DocumentBuilder;
diff --git a/petascope/src/petascope/wcps/server/test/GrammarTest.java b/petascope/src/petascope/wcps/server/test/GrammarTest.java
index 6f3a25f..19a636d 100644
--- a/petascope/src/petascope/wcps/server/test/GrammarTest.java
+++ b/petascope/src/petascope/wcps/server/test/GrammarTest.java
@@ -14,8 +14,7 @@
* 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>.
diff --git a/petascope/src/petascope/wcps/server/test/GrammarTestOnline.java b/petascope/src/petascope/wcps/server/test/GrammarTestOnline.java
index 472488f..9aad16e 100644
--- a/petascope/src/petascope/wcps/server/test/GrammarTestOnline.java
+++ b/petascope/src/petascope/wcps/server/test/GrammarTestOnline.java
@@ -14,8 +14,7 @@
* 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>.
diff --git a/petascope/src/petascope/wcps/server/test/XmlTestOnline.java b/petascope/src/petascope/wcps/server/test/XmlTestOnline.java
index f297b2d..d050c75 100644
--- a/petascope/src/petascope/wcps/server/test/XmlTestOnline.java
+++ b/petascope/src/petascope/wcps/server/test/XmlTestOnline.java
@@ -14,8 +14,7 @@
* 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>.
diff --git a/petascope/src/petascope/wcs/server/WcsServer.java b/petascope/src/petascope/wcs/server/WcsServer.java
index fddb549..12625bd 100644
--- a/petascope/src/petascope/wcs/server/WcsServer.java
+++ b/petascope/src/petascope/wcs/server/WcsServer.java
@@ -14,15 +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.wcs.server;
-//~--- non-JDK imports --------------------------------------------------------
import javax.servlet.ServletException;
import net.opengis.ows.v_1_0_0.ExceptionReport;
import net.opengis.wcs.v_1_1_0.Capabilities;
@@ -30,23 +28,19 @@ import net.opengis.wcs.v_1_1_0.CoverageDescriptions;
import net.opengis.wcs.v_1_1_0.DescribeCoverage;
import net.opengis.wcs.v_1_1_0.GetCapabilities;
import net.opengis.wcs.v_1_1_0.GetCoverage;
-
-import petascope.wcps.server.core.DbMetadataSource;
+import petascope.core.DbMetadataSource;
+import petascope.exceptions.PetascopeException;
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.wcs.server.core.convertGetCoverage;
import petascope.wcs.server.core.executeDescribeCoverage;
import petascope.wcs.server.core.executeGetCapabilities;
-
import petascope.ConfigManager;
import petascope.PetascopeXmlNamespaceMapper;
-
-//~--- JDK imports ------------------------------------------------------------
-
import java.io.StringReader;
import java.io.StringWriter;
-
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
@@ -55,8 +49,6 @@ import javax.xml.stream.XMLOutputFactory;
import javax.xml.stream.XMLStreamWriter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import petascope.wcs.server.exceptions.InternalComponentException;
-import petascope.wcs.server.exceptions.XmlStructuresException;
/**
* The Web Coverage Service (WcsServer)
@@ -69,7 +61,7 @@ import petascope.wcs.server.exceptions.XmlStructuresException;
*/
public class WcsServer {
- private static Logger LOG = LoggerFactory.getLogger(WcsServer.class);
+ private static Logger log = LoggerFactory.getLogger(WcsServer.class);
/* Status variable */
private static Boolean ok;
@@ -91,26 +83,26 @@ public class WcsServer {
/**
* WcsServer GetCapabilities operation
*/
- public String GetCapabilities(String stringXml) throws WCSException {
+ public String GetCapabilities(String stringXml) throws WCSException, PetascopeException {
String output = "Default output. ";
try {
// read the input XML
- LOG.trace("Reading the input XML file ... ");
+ log.trace("Reading the input XML file ... ");
JAXBContext context = JAXBContext.newInstance("net.opengis.wcs.v_1_1_0");
Unmarshaller unmarshaller = context.createUnmarshaller();
Object xml = unmarshaller.unmarshal(new StringReader(stringXml));
// Find out which class to execute ...
- LOG.trace("It is a " + xml.getClass().getSimpleName() + " request.");
+ log.trace("It is a " + xml.getClass().getSimpleName() + " request.");
- LOG.trace("Compiling data into XML format for GetCapabilities ... ");
+ log.trace("Compiling data into XML format for GetCapabilities ... ");
GetCapabilities input = (GetCapabilities) xml;
Capabilities cap = new executeGetCapabilities(input, meta).get();
// Write the output
- LOG.trace("MArshalling with context: " + cap.getClass().getPackage().getName());
+ log.trace("MArshalling with context: " + cap.getClass().getPackage().getName());
final StringWriter writer = new StringWriter();
try {
context = JAXBContext.newInstance(cap.getClass());
@@ -127,15 +119,15 @@ public class WcsServer {
throw new RuntimeException(e.getMessage(), e);
}
output = writer.toString();
- LOG.trace("Done! User has the GetCapabilities result !");
+ log.trace("Done! User has the GetCapabilities result !");
} catch (javax.xml.bind.JAXBException ex) {
- throw new XmlStructuresException("Could not marshall/unmarshall XML structures.", ex);
+ throw new WCSException(ExceptionCode.XmlStructuresError, "Could not marshall/unmarshall XML structures.", ex);
}
- LOG.trace("---------------------OUTPUT--------------------------");
- LOG.trace(output);
- LOG.trace("-----------------------------------------------------");
+ log.trace("---------------------OUTPUT--------------------------");
+ log.trace(output);
+ log.trace("-----------------------------------------------------");
return output;
}
@@ -148,28 +140,28 @@ public class WcsServer {
try {
// read the input XML
- LOG.trace("Reading the input XML file ... ");
+ log.trace("Reading the input XML file ... ");
JAXBContext context = JAXBContext.newInstance("net.opengis.wcs.v_1_1_0");
Unmarshaller unmarshaller = context.createUnmarshaller();
Object xml = unmarshaller.unmarshal(new StringReader(stringXml));
- LOG.trace("It is a " + xml.getClass().getSimpleName() + " request.");
+ log.trace("It is a " + xml.getClass().getSimpleName() + " request.");
// Convert the WcsServer into WCPS
- LOG.trace("Converting to WCPS request ... please wait");
+ log.trace("Converting to WCPS request ... please wait");
GetCoverage wcs = (GetCoverage) xml;
output = new convertGetCoverage(wcs, meta).get();
- LOG.trace("Done! User has his WCPS request !");
+ log.trace("Done! User has his WCPS request !");
} catch (JAXBException ex) {
- throw new XmlStructuresException("Could not marshall/unmarshall XML structures.", ex);
+ throw new WCSException(ExceptionCode.XmlStructuresError, "Could not marshall/unmarshall XML structures.", ex);
} catch (WCPSException e) {
- throw new InternalComponentException(e.getMessage(), e);
+ throw new WCSException(ExceptionCode.InternalComponentError, e.getMessage(), e);
}
- LOG.trace("---------------------OUTPUT--------------------------");
- LOG.trace(output);
- LOG.trace("-----------------------------------------------------");
+ log.trace("---------------------OUTPUT--------------------------");
+ log.trace(output);
+ log.trace("-----------------------------------------------------");
return output;
}
@@ -182,19 +174,19 @@ public class WcsServer {
try {
// read the input XML
- LOG.trace("Reading the input XML file ... ");
+ log.trace("Reading the input XML file ... ");
JAXBContext context = JAXBContext.newInstance("net.opengis.wcs.v_1_1_0");
Unmarshaller unmarshaller = context.createUnmarshaller();
Object xml = unmarshaller.unmarshal(new StringReader(stringXml));
- LOG.trace("It is a " + xml.getClass().getSimpleName() + " request.");
+ log.trace("It is a " + xml.getClass().getSimpleName() + " request.");
- LOG.trace("Querying the WCPS architecture for the details on this coverage ...");
+ log.trace("Querying the WCPS architecture for the details on this coverage ...");
DescribeCoverage input = (DescribeCoverage) xml;
CoverageDescriptions covs = new executeDescribeCoverage(input, meta).get();
// Write the output file
- LOG.trace("Marshalling with context: " + covs.getClass().getPackage().getName());
+ log.trace("Marshalling with context: " + covs.getClass().getPackage().getName());
final StringWriter writer = new StringWriter();
try {
context = JAXBContext.newInstance(covs.getClass());
@@ -211,14 +203,14 @@ public class WcsServer {
throw new RuntimeException(e.getMessage(), e);
}
output = writer.toString();
- LOG.trace("Done! User has the DescribeCoverage result !");
+ log.trace("Done! User has the DescribeCoverage result !");
} catch (JAXBException ex) {
- throw new XmlStructuresException("Could not marshall/unmarshall XML structures.", ex);
+ throw new WCSException(ExceptionCode.XmlStructuresError, "Could not marshall/unmarshall XML structures.", ex);
}
- LOG.trace("---------------------OUTPUT--------------------------");
- LOG.trace(output);
- LOG.trace("-----------------------------------------------------");
+ log.trace("---------------------OUTPUT--------------------------");
+ log.trace(output);
+ log.trace("-----------------------------------------------------");
return output;
}
@@ -239,10 +231,10 @@ public class WcsServer {
marshaller.marshal(report, strWriter);
output = strWriter.toString();
ok = true;
- LOG.trace("Done marshalling Error Report.");
+ log.trace("Done marshalling Error Report.");
} catch (Exception e2) {
- LOG.error("Error marshalling Exception Report.");
- LOG.error("Stack trace: " + e2);
+ log.error("Error marshalling Exception Report.");
+ log.error("Stack trace: " + e2);
}
return output;
diff --git a/petascope/src/petascope/wcs/server/cli/CLI.java b/petascope/src/petascope/wcs/server/cli/CLI.java
index e6312d5..0c33d1e 100644
--- a/petascope/src/petascope/wcs/server/cli/CLI.java
+++ b/petascope/src/petascope/wcs/server/cli/CLI.java
@@ -1,22 +1,8 @@
package petascope.wcs.server.cli;
-import petascope.wcs.server.core.executeGetCapabilities;
-import petascope.wcs.server.exceptions.WCSException;
-import petascope.wcs.server.core.convertGetCoverage;
-import petascope.wcs.server.core.executeDescribeCoverage;
import java.io.FileInputStream;
-import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Properties;
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.Unmarshaller;
-import net.opengis.ows.v_1_0_0.ExceptionReport;
-import net.opengis.wcs.v_1_1_0.Capabilities;
-import net.opengis.wcs.v_1_1_0.CoverageDescriptions;
-import net.opengis.wcs.v_1_1_0.DescribeCoverage;
-import net.opengis.wcs.v_1_1_0.GetCapabilities;
-import net.opengis.wcs.v_1_1_0.GetCoverage;
-//import wcs.server.core.ProcessCoverage;
/**
* Command Line Interface class, for testing the WCS Server operation
diff --git a/petascope/src/petascope/wcs/server/core/TimeString.java b/petascope/src/petascope/wcs/server/core/TimeString.java
index 6e5d04f..d93d98a 100644
--- a/petascope/src/petascope/wcs/server/core/TimeString.java
+++ b/petascope/src/petascope/wcs/server/core/TimeString.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.wcs.server.core;
-
-//~--- non-JDK imports --------------------------------------------------------
-import org.joda.time.DateTime;
-import org.joda.time.format.DateTimeFormat;
-import org.joda.time.format.DateTimeFormatter;
-
+package petascope.wcs.server.core;
+
+import org.joda.time.DateTime;
+import org.joda.time.format.DateTimeFormat;
+import org.joda.time.format.DateTimeFormatter;
import org.joda.time.format.ISODateTimeFormat;
/**
diff --git a/petascope/src/petascope/wcs/server/core/convertGetCoverage.java b/petascope/src/petascope/wcs/server/core/convertGetCoverage.java
index 92262e6..153728c 100644
--- a/petascope/src/petascope/wcs/server/core/convertGetCoverage.java
+++ b/petascope/src/petascope/wcs/server/core/convertGetCoverage.java
@@ -14,16 +14,15 @@
* 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.wcs.server.core;
-//~--- non-JDK imports --------------------------------------------------------
-import petascope.wcs.server.exceptions.WCSException;
+import petascope.exceptions.WCSException;
+import petascope.exceptions.ExceptionCode;
import net.opengis.gml.v_3_1_1.TimePositionType;
import net.opengis.ows.v_1_0_0.BoundingBoxType;
import net.opengis.wcs.v_1_1_0.DomainSubsetType;
@@ -31,27 +30,18 @@ import net.opengis.wcs.v_1_1_0.GetCoverage;
import net.opengis.wcs.v_1_1_0.GridCrsType;
import net.opengis.wcs.v_1_1_0.RangeSubsetType;
import net.opengis.wcs.v_1_1_0.TimePeriodType;
-
-import petascope.wcps.server.core.DbMetadataSource;
+import petascope.core.DbMetadataSource;
import petascope.wcps.server.core.ProcessCoveragesRequest;
-import petascope.wcps.server.exceptions.WCPSException;
+import petascope.exceptions.WCPSException;
import petascope.wcps.server.core.DomainElement;
-
import petascope.ConfigManager;
-
-//~--- JDK imports ------------------------------------------------------------
-
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.antlr.runtime.RecognitionException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import petascope.wcps.server.core.Metadata;
-import petascope.wcs.server.exceptions.InvalidParameterValueException;
-import petascope.wcs.server.exceptions.InvalidTemporalMetadataException;
-import petascope.wcs.server.exceptions.MissingParameterValueException;
-import petascope.wcs.server.exceptions.NoApplicableCodeException;
+import petascope.core.Metadata;
/**
* This class takes a WCS GetCoverage XML request and converts this request into
@@ -62,7 +52,7 @@ import petascope.wcs.server.exceptions.NoApplicableCodeException;
*/
public class convertGetCoverage {
- private static Logger LOG = LoggerFactory.getLogger(convertGetCoverage.class);
+ private static Logger log = LoggerFactory.getLogger(convertGetCoverage.class);
// Trimming
private boolean xAxisTrim = false;
private boolean yAxisTrim = false;
@@ -125,11 +115,11 @@ public class convertGetCoverage {
}
/* Convert the abstract syntax query to a ProcessCoveragesRequest */
- LOG.debug("Converting WCPS abstract query '{}' to xml", abstractRequest);
+ log.debug("Converting WCPS abstract query '{}' to xml", abstractRequest);
xmlRequest = ProcessCoveragesRequest.abstractQueryToXmlQuery(abstractRequest);
- LOG.debug("Resulting XML query is: \n{}", xmlRequest);
+ log.debug("Resulting XML query is: \n{}", xmlRequest);
} catch (RecognitionException re) {
- throw new NoApplicableCodeException("Internal error: Generated abstract syntax query was not valid.", re);
+ throw new WCSException(ExceptionCode.NoApplicableCode, "Internal error: Generated abstract syntax query was not valid.", re);
}
return xmlRequest;
@@ -149,10 +139,10 @@ public class convertGetCoverage {
*/
private void readField2() throws WCSException {
if (!wcs.isSetDomainSubset()) {
- throw new MissingParameterValueException("DomainSubset");
+ throw new WCSException(ExceptionCode.MissingParameterValue, "DomainSubset");
}
if (!wcs.getDomainSubset().isSetBoundingBox()) {
- throw new MissingParameterValueException("BoundingBox");
+ throw new WCSException(ExceptionCode.MissingParameterValue, "BoundingBox");
}
DomainSubsetType domain = wcs.getDomainSubset();
@@ -166,27 +156,27 @@ public class convertGetCoverage {
crsName = bbox.getCrs();
if (crsName != null) {
if (crsName.equals(DomainElement.IMAGE_CRS)) {
- LOG.trace("CRS: NATIVE_IMAGE_CRS");
+ log.trace("CRS: NATIVE_IMAGE_CRS");
} else if (crsName.equals(DomainElement.WGS84_CRS)) {
- LOG.trace("CRS: WGS84");
+ log.trace("CRS: WGS84");
} else {
- throw new InvalidParameterValueException("BoundingBox.crs. Explanation: "
+ throw new WCSException(ExceptionCode.InvalidParameterValue, "BoundingBox.crs. Explanation: "
+ "CRS '" + crsName + "' not available on this server.");
}
} else {
- LOG.debug("CRS: None specified for bounding box");
- LOG.debug("CRS: Using default IMAGE_CRS");
+ log.debug("CRS: None specified for bounding box");
+ log.debug("CRS: Using default IMAGE_CRS");
crsName = DomainElement.IMAGE_CRS;
}
/* BBox declarations */
if (bbox.getLowerCorner().size() != 2) {
- throw new InvalidParameterValueException("LowerCorner. Explanation: "
+ throw new WCSException(ExceptionCode.InvalidParameterValue, "LowerCorner. Explanation: "
+ "BoundingBox -> LowerCorner should have exactly two "
+ "values, not " + bbox.getLowerCorner().size());
}
if (bbox.getUpperCorner().size() != 2) {
- throw new InvalidParameterValueException("UpperCorner. Explanation: "
+ throw new WCSException(ExceptionCode.InvalidParameterValue, "UpperCorner. Explanation: "
+ "BoundingBox -> UpperCorner should have exactly two "
+ "values, not " + bbox.getUpperCorner().size());
}
@@ -194,13 +184,13 @@ public class convertGetCoverage {
xAxisTrim = true;
int u2 = bbox.getLowerCorner().get(0).intValue();
int u3 = bbox.getUpperCorner().get(0).intValue();
- LOG.trace("Added X-axis trimming ! (DomainSubset->BoundingBox): " + u2 + " ... "
+ log.trace("Added X-axis trimming ! (DomainSubset->BoundingBox): " + u2 + " ... "
+ u3);
yAxisTrim = true;
int v2 = bbox.getLowerCorner().get(1).intValue();
int v3 = bbox.getUpperCorner().get(1).intValue();
- LOG.trace("Added Y-axis trimming ! (DomainSubset->BoundingBox): " + v2 + " ... "
+ log.trace("Added Y-axis trimming ! (DomainSubset->BoundingBox): " + v2 + " ... "
+ v3);
/* Use bounding-box values as they are given */
@@ -211,7 +201,7 @@ public class convertGetCoverage {
if (crsName.equals(DomainElement.IMAGE_CRS) == false
&& crsName.equals(DomainElement.WGS84_CRS) == false) {
- throw new NoApplicableCodeException("Unknown CRS: " + crsName);
+ throw new WCSException(ExceptionCode.NoApplicableCode, "Unknown CRS: " + crsName);
}
}
@@ -220,7 +210,7 @@ public class convertGetCoverage {
// TemporalSubset is of type TimeSequenceType = choice(gml:TimePosition, wcs:TimePeriodType)
Object one = domain.getTemporalSubset().getTimePositionOrTimePeriod().get(0);
- LOG.trace("Inside TemporalSubset there is " + one.getClass());
+ log.trace("Inside TemporalSubset there is " + one.getClass());
if (one instanceof net.opengis.gml.v_3_1_1.TimePositionType) {
// TemporalSubset = gml:TimePosition
// use WCPS:slice
@@ -232,7 +222,7 @@ public class convertGetCoverage {
/* Default syntax is ISO 8601.
However, we also accept direct time-axis coordinates, as a fail-back solution. */
timePos = parseTimePosition(pos);
- LOG.trace("Added time-axis slicing ! ( DomainSubset->TemporalSubset->gml:TimePositionType): position "
+ log.trace("Added time-axis slicing ! ( DomainSubset->TemporalSubset->gml:TimePositionType): position "
+ timePos);
} else if (one instanceof net.opengis.wcs.v_1_1_0.TimePeriodType) {
// TemporalSubset = wcs:TimePeriodType
@@ -248,7 +238,7 @@ public class convertGetCoverage {
time1 = parseTimePosition(pos1);
time2 = parseTimePosition(pos2);
- LOG.trace("Added time-axis trimming ! ( DomainSubset->TemporalSubset->wcs:TimePeriodType): "
+ log.trace("Added time-axis trimming ! ( DomainSubset->TemporalSubset->wcs:TimePeriodType): "
+ time1 + " ... " + time2);
}
}
@@ -270,9 +260,9 @@ public class convertGetCoverage {
RangeSubsetType.FieldSubset field = it.next();
fields.add(field.getIdentifier().getValue());
- LOG.trace("RangeSubsetType->FieldSubset->Identifier is "
+ log.trace("RangeSubsetType->FieldSubset->Identifier is "
+ field.getIdentifier().getValue());
- LOG.trace("RangeSubsetType->FieldSubset->Interpolation is "
+ log.trace("RangeSubsetType->FieldSubset->Interpolation is "
+ field.getInterpolationType());
/* NOTE: We ignore interpolation instructions (optional) */
/* NOTE: We ignore axis subset lists (optional) */
@@ -287,26 +277,26 @@ public class convertGetCoverage {
*/
private void readField4() throws WCSException {
if (!wcs.isSetOutput()) {
- throw new MissingParameterValueException("Output");
+ throw new WCSException(ExceptionCode.MissingParameterValue, "Output");
}
- LOG.trace("Format: " + wcs.getOutput().getFormat());
+ log.trace("Format: " + wcs.getOutput().getFormat());
if (wcs.getOutput().isSetGridCRS()) {
GridCrsType crs = wcs.getOutput().getGridCRS();
- throw new NoApplicableCodeException("Currently, the Output->GridCRS node is not supported !");
+ throw new WCSException(ExceptionCode.NoApplicableCode, "Currently, the Output->GridCRS node is not supported !");
}
String wcsMimeFormat = wcs.getOutput().getFormat();
format = meta.mimetypeToFormat(wcsMimeFormat);
- LOG.trace("New format: " + format);
+ log.trace("New format: " + format);
if ((format == null) || format.equals("")) {
- throw new InvalidParameterValueException("Output format");
+ throw new WCSException(ExceptionCode.InvalidParameterValue, "Output format");
}
- LOG.trace("issetstore = " + wcs.getOutput().isSetStore());
- LOG.trace("isstore = " + wcs.getOutput().isStore());
+ log.trace("issetstore = " + wcs.getOutput().isSetStore());
+ log.trace("isstore = " + wcs.getOutput().isStore());
store = false;
if (wcs.getOutput().isSetStore() && wcs.getOutput().isStore()) {
store = true;
@@ -314,7 +304,7 @@ public class convertGetCoverage {
/* WCPS does not support "store=true" */
if (store) {
- throw new InvalidParameterValueException("Output Store. Explanation: "
+ throw new WCSException(ExceptionCode.InvalidParameterValue, "Output Store. Explanation: "
+ "Cannot store result image on server.");
}
}
@@ -327,50 +317,50 @@ public class convertGetCoverage {
public void process() throws WCSException {
/** * Processing starts here ... with the nodes of the WCS * */
// Service Description
- LOG.debug("WCS service: \"" + wcs.SERVICE + "\"");
- LOG.debug("WCS version: \"" + wcs.VERSION + "\"");
+ log.debug("WCS service: \"" + wcs.SERVICE + "\"");
+ log.debug("WCS version: \"" + wcs.VERSION + "\"");
if (!wcs.SERVICE.equalsIgnoreCase("WCS")) {
- throw new InvalidParameterValueException("Service. Explanation: "
+ throw new WCSException(ExceptionCode.InvalidParameterValue, "Service. Explanation: "
+ "Only the WCS service is supported.");
}
if (!wcs.VERSION.equals("1.1.0")) {
- throw new InvalidParameterValueException("Version. Explanation: "
+ throw new WCSException(ExceptionCode.InvalidParameterValue, "Version. Explanation: "
+ "Only WCS Version 1.1.0 is currently supported.");
}
// First of all, error checking: is the coverage offered by the server?
if (!wcs.isSetIdentifier()) {
- throw new MissingParameterValueException("Identifier");
+ throw new WCSException(ExceptionCode.MissingParameterValue, "Identifier");
}
try {
if (!meta.existsCoverageName(wcs.getIdentifier().getValue())) {
- throw new InvalidParameterValueException("Identifier. Explanation: "
+ throw new WCSException(ExceptionCode.InvalidParameterValue, "Identifier. Explanation: "
+ "Coverage " + wcs.getIdentifier().getValue()
+ " is not served by this server.");
}
covMeta = meta.read(wcs.getIdentifier().getValue());
- } catch (WCPSException e) {
- throw new InvalidParameterValueException("Identifier. Explanation: "
+ } catch (Exception e) {
+ throw new WCSException(ExceptionCode.InvalidParameterValue, "Identifier. Explanation: "
+ "Coverage " + wcs.getIdentifier().getValue()
+ " is not served by this server.");
}
// Convert all the child nodes of WCS GetCoverage XML node
- LOG.trace("*** Reading WCS node 1 ... ");
+ log.trace("*** Reading WCS node 1 ... ");
readField1();
- LOG.trace("*** Reading WCS node 2 ...");
+ log.trace("*** Reading WCS node 2 ...");
readField2();
- LOG.trace("*** Reading WCS node 3 ...");
+ log.trace("*** Reading WCS node 3 ...");
readField3();
- LOG.trace("*** Reading WCS node 4 ...");
+ log.trace("*** Reading WCS node 4 ...");
readField4();
- LOG.trace("*** Assembling WCPS abstract syntax query ...");
+ log.trace("*** Assembling WCPS abstract syntax query ...");
assembleFinalWcpsQuery();
/* Done building WCPS abstract query. */
finished = true;
- LOG.trace("Done Converting WCS GetCoverage into WCPS ProcessCoverage.");
+ log.trace("Done Converting WCS GetCoverage into WCPS ProcessCoverage.");
}
/**
@@ -442,55 +432,55 @@ public class convertGetCoverage {
private String parseTimePosition(TimePositionType pos) throws WCSException {
String result;
- LOG.trace("TimePosition has length " + pos.getValue().size());
+ log.trace("TimePosition has length " + pos.getValue().size());
if (pos.getValue().size() != 1) {
- throw new InvalidParameterValueException("TimePosition. Explanation: "
+ throw new WCSException(ExceptionCode.InvalidParameterValue, "TimePosition. Explanation: "
+ "The TimePosition element should have exactly one item, and not "
+ pos.getValue().size());
}
String timeStr = pos.getValue().get(0);
- LOG.debug("Parsing time position: " + timeStr);
+ log.debug("Parsing time position: " + timeStr);
try {
// ISO 8601 parsing
TimeString ts = new TimeString(timeStr);
- LOG.debug("Found time position (ISO 8601): " + timeStr);
+ log.debug("Found time position (ISO 8601): " + timeStr);
if (ts.subtract(covMeta.getTimePeriodBeginning()) < 0
|| TimeString.difference(covMeta.getTimePeriodEnd(), timeStr) < 0) {
- throw new InvalidParameterValueException("TimePosition: value " + timeStr
+ throw new WCSException(ExceptionCode.InvalidParameterValue, "TimePosition: value " + timeStr
+ " is outside this coverage's time range.");
}
String begin = covMeta.getTimePeriodBeginning();
if (begin == null) {
- throw new InvalidTemporalMetadataException("Coverage '" + covMeta.getCoverageName()
+ throw new WCSException(ExceptionCode.InvalidTemporalMetadata, "Coverage '" + covMeta.getCoverageName()
+ "' has no time axis beginning or end in table PS_Domain.");
}
long diff1 = ts.subtract(begin);
- LOG.trace("Selected time span (ISO 8601, in ms) : " + diff1);
+ log.trace("Selected time span (ISO 8601, in ms) : " + diff1);
long diff2 = covMeta.getTimeSpan();
if (diff2 == -1) {
- throw new InvalidTemporalMetadataException("Coverage '" + covMeta.getCoverageName()
+ throw new WCSException(ExceptionCode.InvalidTemporalMetadata, "Coverage '" + covMeta.getCoverageName()
+ "' has no time axis beginning or end in table PS_Domain.");
}
- LOG.trace("Coverage " + covMeta.getCoverageName() + " has time span (ISO 8601, in ms) : " + diff2);
- LOG.trace("Coverage " + covMeta.getCoverageName() + " has time indexes span : " + covMeta.getTimeIndexesSpan());
+ log.trace("Coverage " + covMeta.getCoverageName() + " has time span (ISO 8601, in ms) : " + diff2);
+ log.trace("Coverage " + covMeta.getCoverageName() + " has time indexes span : " + covMeta.getTimeIndexesSpan());
Double dIndex = covMeta.getTimeIndexesSpan() * diff1 * new Double(1.0) / diff2;
if (dIndex == -1) {
- throw new InvalidTemporalMetadataException("Coverage '" + covMeta.getCoverageName()
+ throw new WCSException(ExceptionCode.InvalidTemporalMetadata, "Coverage '" + covMeta.getCoverageName()
+ "' has no time axis.");
}
- LOG.trace("Computed time axis index: " + dIndex);
+ log.trace("Computed time axis index: " + dIndex);
long timeIndex = dIndex.longValue();
result = String.valueOf(timeIndex);
} catch (IllegalArgumentException e) {
- LOG.warn("Time position '" + timeStr + "' was not in ISO 8601 format. Trying to parse integer...");
+ log.warn("Time position '" + timeStr + "' was not in ISO 8601 format. Trying to parse integer...");
try {
Integer tPos = Integer.parseInt(timeStr);
- LOG.debug("Found time position in integer coordinates: " + tPos);
+ log.debug("Found time position in integer coordinates: " + tPos);
result = tPos.toString();
} catch (NumberFormatException e2) {
- throw new InvalidParameterValueException("TimePosition: " + timeStr, e2);
+ throw new WCSException(ExceptionCode.InvalidParameterValue, "TimePosition: " + timeStr, e2);
}
}
diff --git a/petascope/src/petascope/wcs/server/core/executeDescribeCoverage.java b/petascope/src/petascope/wcs/server/core/executeDescribeCoverage.java
index 1a7f882..5847559 100644
--- a/petascope/src/petascope/wcs/server/core/executeDescribeCoverage.java
+++ b/petascope/src/petascope/wcs/server/core/executeDescribeCoverage.java
@@ -14,16 +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.wcs.server.core;
-//~--- non-JDK imports --------------------------------------------------------
-import petascope.wcs.server.exceptions.WCSException;
+import petascope.core.Metadata;
+import petascope.core.DbMetadataSource;
+import petascope.exceptions.WCSException;
+import petascope.exceptions.ExceptionCode;
import net.opengis.ows.v_1_0_0.BoundingBoxType;
import net.opengis.wcs.ows.v_1_1_0.DomainMetadataType;
import net.opengis.wcs.ows.v_1_1_0.InterpolationMethodType;
@@ -36,13 +37,8 @@ import net.opengis.wcs.v_1_1_0.DescribeCoverage;
import net.opengis.wcs.v_1_1_0.FieldType;
import net.opengis.wcs.v_1_1_0.RangeType;
import net.opengis.wcs.v_1_1_0.SpatialDomainType;
-
import petascope.wcps.server.core.*;
-
-//~--- JDK imports ------------------------------------------------------------
-
import java.util.Iterator;
-
import javax.xml.XMLConstants;
import javax.xml.bind.JAXBElement;
import javax.xml.namespace.QName;
@@ -51,8 +47,6 @@ import net.opengis.wcs.ows.v_1_1_0.AnyValue;
import net.opengis.wcs.v_1_1_0.TimeSequenceType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import petascope.wcs.server.exceptions.InvalidParameterValueException;
-import petascope.wcs.server.exceptions.NoApplicableCodeException;
/**
* This class takes a WCS DescribeCoverage XML request and executes request,
@@ -62,7 +56,7 @@ import petascope.wcs.server.exceptions.NoApplicableCodeException;
*/
public class executeDescribeCoverage {
- private static Logger LOG = LoggerFactory.getLogger(executeDescribeCoverage.class);
+ private static Logger log = LoggerFactory.getLogger(executeDescribeCoverage.class);
private boolean finished;
private DescribeCoverage input;
private DbMetadataSource meta;
@@ -92,7 +86,7 @@ public class executeDescribeCoverage {
process();
}
if (finished == false) {
- throw new NoApplicableCodeException("Could not execute the GetCapabilities request! "
+ throw new WCSException(ExceptionCode.NoApplicableCode, "Could not execute the GetCapabilities request! "
+ "Please see the other errors...");
}
@@ -118,12 +112,12 @@ public class executeDescribeCoverage {
* @return CoverageDescriptionType object, that can just be plugged in the respose object
*/
private CoverageDescriptionType getCoverageDescription(String name) throws WCSException {
- LOG.trace("Building coverage description for coverage '" + name + "' ...");
+ log.trace("Building coverage description for coverage '" + name + "' ...");
CoverageDescriptionType desc = new CoverageDescriptionType();
// Error checking: is the coverage available?
if (meta.existsCoverageName(name) == false) {
- throw new InvalidParameterValueException("Identifier. Explanation: Coverage "
+ throw new WCSException(ExceptionCode.InvalidParameterValue, "Identifier. Explanation: Coverage "
+ name + " is not served by this server !");
}
@@ -133,7 +127,7 @@ public class executeDescribeCoverage {
try {
cov = meta.read(name);
} catch (Exception e) {
- throw new NoApplicableCodeException("Metadata for coverage " + name + " is not valid.");
+ throw new WCSException(ExceptionCode.NoApplicableCode, "Metadata for coverage " + name + " is not valid.");
}
desc.setIdentifier(name);
@@ -169,7 +163,7 @@ public class executeDescribeCoverage {
bbox.getUpperCorner().add(hi1);
bbox.getUpperCorner().add(hi2);
} else {
- throw new NoApplicableCodeException("Internal error: Could "
+ throw new WCSException(ExceptionCode.NoApplicableCode, "Internal error: Could "
+ "not find X and Y cell domain extents.");
}
@@ -202,7 +196,7 @@ public class executeDescribeCoverage {
/* Find a time-axis if exists */
CellDomainElement T = cov.getTCellDomain();
if (T != null) {
- LOG.trace("Found time-axis for coverage: [" + T.getLo() + ", " + T.getHi() + "]");
+ log.trace("Found time-axis for coverage: [" + T.getLo() + ", " + T.getHi() + "]");
TimeSequenceType temporal = new TimeSequenceType();
temporal.getTimePositionOrTimePeriod().add(T.getLo().intValue());
temporal.getTimePositionOrTimePeriod().add(T.getHi().intValue());
@@ -269,7 +263,7 @@ public class executeDescribeCoverage {
desc.getSupportedCRS().add(DomainElement.WGS84_CRS);
}
- LOG.trace("Done building the Coverage Description for coverage '" + name + "'.");
+ log.trace("Done building the Coverage Description for coverage '" + name + "'.");
return desc;
}
diff --git a/petascope/src/petascope/wcs/server/core/executeGetCapabilities.java b/petascope/src/petascope/wcs/server/core/executeGetCapabilities.java
index 846f2c8..e000f9e 100644
--- a/petascope/src/petascope/wcs/server/core/executeGetCapabilities.java
+++ b/petascope/src/petascope/wcs/server/core/executeGetCapabilities.java
@@ -14,15 +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.wcs.server.core;
-import petascope.wcs.server.exceptions.WCSException;
+import petascope.exceptions.PetascopeException;
+import petascope.exceptions.WCSException;
+import petascope.exceptions.ExceptionCode;
import java.sql.SQLException;
import java.util.Iterator;
import javax.xml.bind.JAXBElement;
@@ -44,17 +45,12 @@ import net.opengis.wcs.v_1_1_0.Capabilities;
import net.opengis.wcs.v_1_1_0.Contents;
import net.opengis.wcs.v_1_1_0.CoverageSummaryType;
import net.opengis.wcs.v_1_1_0.GetCapabilities;
-import petascope.wcps.server.core.DbMetadataSource;
-import petascope.wcps.server.core.Metadata;
-import petascope.wcps.server.exceptions.ResourceException;
-
+import petascope.core.DbMetadataSource;
+import petascope.core.Metadata;
import javax.xml.XMLConstants;
import net.opengis.ows.v_1_0_0.AddressType;
import net.opengis.wcs.ows.v_1_1_0.RequestMethodType;
import petascope.ConfigManager;
-import petascope.wcs.server.exceptions.InternalSqlException;
-import petascope.wcs.server.exceptions.InvalidParameterValueException;
-import petascope.wcs.server.exceptions.NoApplicableCodeException;
/**
* This class takes a WCS GetCapabilities XML request and executes request,
@@ -87,12 +83,12 @@ public class executeGetCapabilities {
* @return a Capabilities object.
* @throws wcs_web_service.WCSException
*/
- public Capabilities get() throws WCSException {
+ public Capabilities get() throws WCSException, PetascopeException {
if (finished == false) {
process();
}
if (finished == false) {
- throw new NoApplicableCodeException("Could not execute the GetCapabilities request! "
+ throw new WCSException(ExceptionCode.NoApplicableCode, "Could not execute the GetCapabilities request! "
+ "Please see the other errors...");
}
return output;
@@ -102,9 +98,9 @@ public class executeGetCapabilities {
* Computes the response to the GetCapabilities request given to the constructor.
* @throws wcs_web_service.WCSException
*/
- public void process() throws WCSException {
+ public void process() throws WCSException, PetascopeException {
if (!input.SERVICE.equalsIgnoreCase("WCS")) {
- throw new InvalidParameterValueException("Service");
+ throw new WCSException(ExceptionCode.InvalidParameterValue, "Service");
}
try {
@@ -117,7 +113,7 @@ public class executeGetCapabilities {
finished = true;
} catch (SQLException se) {
finished = false;
- throw new InternalSqlException(se.getMessage(), se);
+ throw new WCSException(ExceptionCode.InternalSqlError, se.getMessage(), se);
}
}
@@ -252,14 +248,11 @@ public class executeGetCapabilities {
* Builds the output node "Contents"
* @throws java.sql.SQLException
*/
- private void buildField4() {
+ private void buildField4() throws PetascopeException {
Contents cont = new Contents();
Iterator<String> coverages = null;
- try {
- coverages = meta.coverages().iterator();
- } catch (ResourceException e) {
- }
+ coverages = meta.coverages().iterator();
while (coverages.hasNext()) {
Metadata metadata = null;
try {
diff --git a/petascope/src/petascope/wcs/server/exceptions/ActionNotSupportedException.java b/petascope/src/petascope/wcs/server/exceptions/ActionNotSupportedException.java
deleted file mode 100644
index 3211bb6..0000000
--- a/petascope/src/petascope/wcs/server/exceptions/ActionNotSupportedException.java
+++ /dev/null
@@ -1,42 +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.wcs.server.exceptions;
-
-/**
- *
- * @author Andrei Aiordachioaie
- */
-public class ActionNotSupportedException extends WCSException
-{
- private final static String error = "ActionNotSupported";
-
- public ActionNotSupportedException(String message)
- {
- super(error, message);
- }
-
- public ActionNotSupportedException(String message, Exception e)
- {
- super(error, message, e);
- }
-}
diff --git a/petascope/src/petascope/wcs/server/exceptions/BadResponseHandlerException.java b/petascope/src/petascope/wcs/server/exceptions/BadResponseHandlerException.java
deleted file mode 100644
index 5fa186c..0000000
--- a/petascope/src/petascope/wcs/server/exceptions/BadResponseHandlerException.java
+++ /dev/null
@@ -1,42 +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.wcs.server.exceptions;
-
-/**
- *
- * @author Andrei Aiordachioaie
- */
-public class BadResponseHandlerException extends WCSException
-{
- private static final String error = "BadResponseHandler";
-
- public BadResponseHandlerException(String message)
- {
- super(error, message);
- }
-
- public BadResponseHandlerException(String message, Exception e)
- {
- super(error, message, e);
- }
-}
diff --git a/petascope/src/petascope/wcs/server/exceptions/InputOutputException.java b/petascope/src/petascope/wcs/server/exceptions/InputOutputException.java
deleted file mode 100644
index f3a8667..0000000
--- a/petascope/src/petascope/wcs/server/exceptions/InputOutputException.java
+++ /dev/null
@@ -1,42 +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.wcs.server.exceptions;
-
-/**
- *
- * @author Andrei Aiordachioaie
- */
-public class InputOutputException extends WCSException
-{
- private static final String error = "InputOutputError";
-
- public InputOutputException(String message)
- {
- super(error, message);
- }
-
- public InputOutputException(String message, Exception e)
- {
- super(error, message, e);
- }
-}
diff --git a/petascope/src/petascope/wcs/server/exceptions/InternalComponentException.java b/petascope/src/petascope/wcs/server/exceptions/InternalComponentException.java
deleted file mode 100644
index 367ad3e..0000000
--- a/petascope/src/petascope/wcs/server/exceptions/InternalComponentException.java
+++ /dev/null
@@ -1,42 +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.wcs.server.exceptions;
-
-/**
- *
- * @author Andrei Aiordachioaie
- */
-public class InternalComponentException extends WCSException
-{
- private static final String error = "InternalComponentError";
-
- public InternalComponentException(String message)
- {
- super(error, message);
- }
-
- public InternalComponentException(String message, Exception e)
- {
- super(error, message, e);
- }
-}
diff --git a/petascope/src/petascope/wcs/server/exceptions/InternalSqlException.java b/petascope/src/petascope/wcs/server/exceptions/InternalSqlException.java
deleted file mode 100644
index d415864..0000000
--- a/petascope/src/petascope/wcs/server/exceptions/InternalSqlException.java
+++ /dev/null
@@ -1,42 +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.wcs.server.exceptions;
-
-/**
- *
- * @author Andrei Aiordachioaie
- */
-public class InternalSqlException extends WCSException
-{
- private static final String error = "InternalSQLError";
-
- public InternalSqlException(String message)
- {
- super(error, message);
- }
-
- public InternalSqlException(String message, Exception e)
- {
- super(error, message, e);
- }
-}
diff --git a/petascope/src/petascope/wcs/server/exceptions/InvalidParameterValueException.java b/petascope/src/petascope/wcs/server/exceptions/InvalidParameterValueException.java
deleted file mode 100644
index 5f03a72..0000000
--- a/petascope/src/petascope/wcs/server/exceptions/InvalidParameterValueException.java
+++ /dev/null
@@ -1,42 +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.wcs.server.exceptions;
-
-/**
- *
- * @author Andrei Aiordachioaie
- */
-public class InvalidParameterValueException extends WCSException
-{
- private static final String error = "InvalidParameterValue";
-
- public InvalidParameterValueException(String message)
- {
- super(error, message);
- }
-
- public InvalidParameterValueException(String message, Exception e)
- {
- super(error, message, e);
- }
-}
diff --git a/petascope/src/petascope/wcs/server/exceptions/InvalidPropertyValueException.java b/petascope/src/petascope/wcs/server/exceptions/InvalidPropertyValueException.java
deleted file mode 100644
index 9c036b3..0000000
--- a/petascope/src/petascope/wcs/server/exceptions/InvalidPropertyValueException.java
+++ /dev/null
@@ -1,42 +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.wcs.server.exceptions;
-
-/**
- *
- * @author Andrei Aiordachioaie
- */
-public class InvalidPropertyValueException extends WCSException
-{
- private static final String error = "InvalidParameterValue";
-
- public InvalidPropertyValueException(String message)
- {
- super(error, message);
- }
-
- public InvalidPropertyValueException(String message, Exception e)
- {
- super(error, message, e);
- }
-}
diff --git a/petascope/src/petascope/wcs/server/exceptions/InvalidRequestException.java b/petascope/src/petascope/wcs/server/exceptions/InvalidRequestException.java
deleted file mode 100644
index e357684..0000000
--- a/petascope/src/petascope/wcs/server/exceptions/InvalidRequestException.java
+++ /dev/null
@@ -1,42 +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.wcs.server.exceptions;
-
-/**
- *
- * @author Andrei Aiordachioaie
- */
-public class InvalidRequestException extends WCSException
-{
- private static final String error = "InvalidRequest";
-
- public InvalidRequestException(String message)
- {
- super(error, message);
- }
-
- public InvalidRequestException(String message, Exception e)
- {
- super(error, message, e);
- }
-}
diff --git a/petascope/src/petascope/wcs/server/exceptions/InvalidServiceConfigurationException.java b/petascope/src/petascope/wcs/server/exceptions/InvalidServiceConfigurationException.java
deleted file mode 100644
index 4f84673..0000000
--- a/petascope/src/petascope/wcs/server/exceptions/InvalidServiceConfigurationException.java
+++ /dev/null
@@ -1,42 +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.wcs.server.exceptions;
-
-/**
- *
- * @author Andrei Aiordachioaie
- */
-public class InvalidServiceConfigurationException extends WCSException
-{
- private final static String error = "ActionNotSupported";
-
- public InvalidServiceConfigurationException(String message)
- {
- super(error, message);
- }
-
- public InvalidServiceConfigurationException(String message, Exception e)
- {
- super(error, message, e);
- }
-}
diff --git a/petascope/src/petascope/wcs/server/exceptions/InvalidTemporalMetadataException.java b/petascope/src/petascope/wcs/server/exceptions/InvalidTemporalMetadataException.java
deleted file mode 100644
index 1ad11de..0000000
--- a/petascope/src/petascope/wcs/server/exceptions/InvalidTemporalMetadataException.java
+++ /dev/null
@@ -1,42 +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.wcs.server.exceptions;
-
-/**
- *
- * @author Andrei Aiordachioaie
- */
-public class InvalidTemporalMetadataException extends WCSException
-{
- private static final String error = "InvalidParameterValue";
-
- public InvalidTemporalMetadataException(String message)
- {
- super(error, message);
- }
-
- public InvalidTemporalMetadataException(String message, Exception e)
- {
- super(error, message, e);
- }
-}
diff --git a/petascope/src/petascope/wcs/server/exceptions/MaliciousQueryException.java b/petascope/src/petascope/wcs/server/exceptions/MaliciousQueryException.java
deleted file mode 100644
index bc00baa..0000000
--- a/petascope/src/petascope/wcs/server/exceptions/MaliciousQueryException.java
+++ /dev/null
@@ -1,42 +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.wcs.server.exceptions;
-
-/**
- *
- * @author Andrei Aiordachioaie
- */
-public class MaliciousQueryException extends WCSException
-{
- private static final String error = "InvalidParameterValue";
-
- public MaliciousQueryException(String message)
- {
- super(error, message);
- }
-
- public MaliciousQueryException(String message, Exception e)
- {
- super(error, message, e);
- }
-}
diff --git a/petascope/src/petascope/wcs/server/exceptions/MissingParameterValueException.java b/petascope/src/petascope/wcs/server/exceptions/MissingParameterValueException.java
deleted file mode 100644
index deb4390..0000000
--- a/petascope/src/petascope/wcs/server/exceptions/MissingParameterValueException.java
+++ /dev/null
@@ -1,42 +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.wcs.server.exceptions;
-
-/**
- *
- * @author Andrei Aiordachioaie
- */
-public class MissingParameterValueException extends WCSException
-{
- private static final String error = "InvalidParameterValue";
-
- public MissingParameterValueException(String message)
- {
- super(error, message);
- }
-
- public MissingParameterValueException(String message, Exception e)
- {
- super(error, message, e);
- }
-}
diff --git a/petascope/src/petascope/wcs/server/exceptions/MultiBandImagesNotSupportedException.java b/petascope/src/petascope/wcs/server/exceptions/MultiBandImagesNotSupportedException.java
deleted file mode 100644
index 63a9919..0000000
--- a/petascope/src/petascope/wcs/server/exceptions/MultiBandImagesNotSupportedException.java
+++ /dev/null
@@ -1,42 +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.wcs.server.exceptions;
-
-/**
- *
- * @author Andrei Aiordachioaie
- */
-public class MultiBandImagesNotSupportedException extends WCSException
-{
- private static final String error = "InvalidParameterValue";
-
- public MultiBandImagesNotSupportedException(String message)
- {
- super(error, message);
- }
-
- public MultiBandImagesNotSupportedException(String message, Exception e)
- {
- super(error, message, e);
- }
-}
diff --git a/petascope/src/petascope/wcs/server/exceptions/NoApplicableCodeException.java b/petascope/src/petascope/wcs/server/exceptions/NoApplicableCodeException.java
deleted file mode 100644
index 0568ece..0000000
--- a/petascope/src/petascope/wcs/server/exceptions/NoApplicableCodeException.java
+++ /dev/null
@@ -1,42 +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.wcs.server.exceptions;
-
-/**
- *
- * @author Andrei Aiordachioaie
- */
-public class NoApplicableCodeException extends WCSException
-{
- private static final String error = "InvalidParameterValue";
-
- public NoApplicableCodeException(String message)
- {
- super(error, message);
- }
-
- public NoApplicableCodeException(String message, Exception e)
- {
- super(error, message, e);
- }
-}
diff --git a/petascope/src/petascope/wcs/server/exceptions/NodeParsingNotImplementedException.java b/petascope/src/petascope/wcs/server/exceptions/NodeParsingNotImplementedException.java
deleted file mode 100644
index d1e278d..0000000
--- a/petascope/src/petascope/wcs/server/exceptions/NodeParsingNotImplementedException.java
+++ /dev/null
@@ -1,42 +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.wcs.server.exceptions;
-
-/**
- *
- * @author Andrei Aiordachioaie
- */
-public class NodeParsingNotImplementedException extends WCSException
-{
- private static final String error = "NodeParsingNotImplemented";
-
- public NodeParsingNotImplementedException(String message)
- {
- super(error, message);
- }
-
- public NodeParsingNotImplementedException(String message, Exception e)
- {
- super(error, message, e);
- }
-}
diff --git a/petascope/src/petascope/wcs/server/exceptions/NotEnoughStorageException.java b/petascope/src/petascope/wcs/server/exceptions/NotEnoughStorageException.java
deleted file mode 100644
index f1a668a..0000000
--- a/petascope/src/petascope/wcs/server/exceptions/NotEnoughStorageException.java
+++ /dev/null
@@ -1,42 +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.wcs.server.exceptions;
-
-/**
- *
- * @author Andrei Aiordachioaie
- */
-public class NotEnoughStorageException extends WCSException
-{
- private static final String error = "InvalidParameterValue";
-
- public NotEnoughStorageException(String message)
- {
- super(error, message);
- }
-
- public NotEnoughStorageException(String message, Exception e)
- {
- super(error, message, e);
- }
-}
diff --git a/petascope/src/petascope/wcs/server/exceptions/RasdamanRequestFailedException.java b/petascope/src/petascope/wcs/server/exceptions/RasdamanRequestFailedException.java
deleted file mode 100644
index 0960247..0000000
--- a/petascope/src/petascope/wcs/server/exceptions/RasdamanRequestFailedException.java
+++ /dev/null
@@ -1,42 +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.wcs.server.exceptions;
-
-/**
- *
- * @author Andrei Aiordachioaie
- */
-public class RasdamanRequestFailedException extends WCSException
-{
- private final static String error = "InvalidParameterValue";
-
- public RasdamanRequestFailedException(String message)
- {
- super(error, message);
- }
-
- public RasdamanRequestFailedException(String message, Exception e)
- {
- super(error, message, e);
- }
-}
diff --git a/petascope/src/petascope/wcs/server/exceptions/RasdamanUnavailableException.java b/petascope/src/petascope/wcs/server/exceptions/RasdamanUnavailableException.java
deleted file mode 100644
index db700c6..0000000
--- a/petascope/src/petascope/wcs/server/exceptions/RasdamanUnavailableException.java
+++ /dev/null
@@ -1,42 +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.wcs.server.exceptions;
-
-/**
- *
- * @author Andrei Aiordachioaie
- */
-public class RasdamanUnavailableException extends WCSException
-{
- private final static String error = "InvalidParameterValue";
-
- public RasdamanUnavailableException(String message)
- {
- super(error, message);
- }
-
- public RasdamanUnavailableException(String message, Exception e)
- {
- super(error, message, e);
- }
-}
diff --git a/petascope/src/petascope/wcs/server/exceptions/ServletConnectionException.java b/petascope/src/petascope/wcs/server/exceptions/ServletConnectionException.java
deleted file mode 100644
index d458cd2..0000000
--- a/petascope/src/petascope/wcs/server/exceptions/ServletConnectionException.java
+++ /dev/null
@@ -1,42 +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.wcs.server.exceptions;
-
-/**
- *
- * @author Andrei Aiordachioaie
- */
-public class ServletConnectionException extends WCSException
-{
- private static final String error = "InvalidParameterValue";
-
- public ServletConnectionException(String message)
- {
- super(error, message);
- }
-
- public ServletConnectionException(String message, Exception e)
- {
- super(error, message, e);
- }
-}
diff --git a/petascope/src/petascope/wcs/server/exceptions/UnsupportedCombinationException.java b/petascope/src/petascope/wcs/server/exceptions/UnsupportedCombinationException.java
deleted file mode 100644
index d9c388e..0000000
--- a/petascope/src/petascope/wcs/server/exceptions/UnsupportedCombinationException.java
+++ /dev/null
@@ -1,42 +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.wcs.server.exceptions;
-
-/**
- *
- * @author Andrei Aiordachioaie
- */
-public class UnsupportedCombinationException extends WCSException
-{
- private final static String error = "UnsupportedCombination";
-
- public UnsupportedCombinationException(String message)
- {
- super(error, message);
- }
-
- public UnsupportedCombinationException(String message, Exception e)
- {
- super(error, message, e);
- }
-}
diff --git a/petascope/src/petascope/wcs/server/exceptions/WCSException.java b/petascope/src/petascope/wcs/server/exceptions/WCSException.java
deleted file mode 100644
index 14e957a..0000000
--- a/petascope/src/petascope/wcs/server/exceptions/WCSException.java
+++ /dev/null
@@ -1,149 +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.wcs.server.exceptions;
-
-//~--- non-JDK imports --------------------------------------------------------
-
-import net.opengis.ows.v_1_0_0.ExceptionReport;
-import net.opengis.ows.v_1_0_0.ExceptionType;
-
-//~--- JDK imports ------------------------------------------------------------
-
-import java.util.Arrays;
-import petascope.ConfigManager;
-
-/**
- * Private Exception superclass for the WCS server.
- * This class can return an error report, than can be marshalled into a
- * WCS-standard compliant XML structure describing the error that has happened.
- *
- * @author Andrei Aiordachioaie
- */
-public class WCSException extends Exception
-{
-// private static Logger LOG = LoggerFactory.getLogger(WCSException.class);
-
- /*
- private String[] errorCodes =
- {
- "MissingParameterValue", "InvalidParameterValue", "NoApplicableCode",
- "UnsupportedCombination", "NotEnoughStorage",
- "MaliciousQuery", "ActionNotSupported", "XmlStructuresError",
- "BadResponseHandler", "MultiBandImagesNotSupported", "RasdamanUnavailable",
- "ServletConnectionError", "XmlInputNotValid", "InvalidPropertyValue",
- "InternalWcpsError", "InternalSqlError", "RasdamanRequestFailed",
- "NodeParsingNotImplemented", "IOConnectionError", "InvalidTemporalMetadata",
- "InvalidRequestString"
- };
- */
- private ExceptionType item;
- private ExceptionReport report;
- private String errorCode;
- private String errorDetail = "";
-
- /**
- * Default (minimal) constructor
- * @param error Error Code
- * @param detail Detailed message about the error
- */
- protected WCSException(String error, String detail)
- {
- super();
- errorCode = error;
- errorDetail = detail;
-
- createReport();
- }
-
- /**
- * Convenience Constructor
- * @param error Error Code
- * @param detail Detailed message about the error
- * @param e The cause of the current exception.
- */
- protected WCSException(String error, String detail, Exception e)
- {
- super(e);
- errorCode = error;
- errorDetail = detail;
- createReport();
- }
-
- private void createReport()
- {
- report = new ExceptionReport();
- report.setLanguage(ConfigManager.WCST_LANGUAGE);
- report.setVersion(ConfigManager.WCST_VERSION);
-
- item = new ExceptionType();
- item.setExceptionCode(errorCode);
- item.setLocator(errorDetail);
- report.getException().add(item);
- }
-
- /** Return the error code.
- *
- * @return
- */
- public String getErrorCode()
- {
- return errorCode;
- }
-
- /** Return the detailed error message.
- *
- * @return
- */
- public String getErrorDetail()
- {
- return errorDetail;
- }
-
- /**
- * Retrieves a data structure that can be later marshalled into a XML
- * "ExceptionReport" document.
- * @return ExceptionReport object
- */
- public ExceptionReport getReport()
- {
- return report;
- }
-
- /**
- * Adds text to this exception's detail message.
- * @param msg
- */
- public void appendErrorDetail(String msg)
- {
- this.errorDetail += msg;
- createReport();
- }
-
- @Override
- public String getMessage()
- {
- return this.errorDetail;
- }
-}
diff --git a/petascope/src/petascope/wcs/server/exceptions/WcsRuntimeException.java b/petascope/src/petascope/wcs/server/exceptions/WcsRuntimeException.java
deleted file mode 100644
index 4f37277..0000000
--- a/petascope/src/petascope/wcs/server/exceptions/WcsRuntimeException.java
+++ /dev/null
@@ -1,42 +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.wcs.server.exceptions;
-
-/**
- *
- * @author Andrei Aiordachioaie
- */
-public class WcsRuntimeException extends WCSException
-{
- private static final String error = "RuntimeException";
-
- public WcsRuntimeException(String message)
- {
- super(error, message);
- }
-
- public WcsRuntimeException(String message, Exception e)
- {
- super(error, message, e);
- }
-}
diff --git a/petascope/src/petascope/wcs/server/exceptions/XmlNotValidException.java b/petascope/src/petascope/wcs/server/exceptions/XmlNotValidException.java
deleted file mode 100644
index ba49b3a..0000000
--- a/petascope/src/petascope/wcs/server/exceptions/XmlNotValidException.java
+++ /dev/null
@@ -1,42 +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.wcs.server.exceptions;
-
-/**
- *
- * @author Andrei Aiordachioaie
- */
-public class XmlNotValidException extends WCSException
-{
- private static final String error = "XmlDocumentNotValid";
-
- public XmlNotValidException(String message)
- {
- super(error, message);
- }
-
- public XmlNotValidException(String message, Exception e)
- {
- super(error, message, e);
- }
-}
diff --git a/petascope/src/petascope/wcs/server/exceptions/XmlStructuresException.java b/petascope/src/petascope/wcs/server/exceptions/XmlStructuresException.java
deleted file mode 100644
index 6016a51..0000000
--- a/petascope/src/petascope/wcs/server/exceptions/XmlStructuresException.java
+++ /dev/null
@@ -1,42 +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.wcs.server.exceptions;
-
-/**
- *
- * @author Andrei Aiordachioaie
- */
-public class XmlStructuresException extends WCSException
-{
- private static final String error = "XmlStructuresError";
-
- public XmlStructuresException(String message)
- {
- super(error, message);
- }
-
- public XmlStructuresException(String message, Exception e)
- {
- super(error, message, e);
- }
-}
diff --git a/petascope/src/petascope/wcs2/schemas/Examples/requestDescribeCoverage.xml b/petascope/src/petascope/wcs2/schemas/Examples/requestDescribeCoverage.xml
deleted file mode 100644
index c1224e7..0000000
--- a/petascope/src/petascope/wcs2/schemas/Examples/requestDescribeCoverage.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<wcs:DescribeCoverage xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
- xmlns:wcs='http://www.opengis.net/wcs/2.0'
- xmlns:gml='http://www.opengis.net/gml/3.2'
- xsi:schemaLocation='http://www.opengis.net/wcs/2.0 ../wcsAll.xsd'
- service="WCS" version="2.0.0">
- <wcs:id gml:id="rgb"/>
-</wcs:DescribeCoverage>
diff --git a/petascope/src/petascope/wcs2/schemas/Examples/requestGetCapabilities.xml b/petascope/src/petascope/wcs2/schemas/Examples/requestGetCapabilities.xml
deleted file mode 100644
index b7966cb..0000000
--- a/petascope/src/petascope/wcs2/schemas/Examples/requestGetCapabilities.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<wcs:GetCapabilities xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
- xmlns:ows='http://www.opengis.net/ows/1.1'
- xmlns:wcs='http://www.opengis.net/wcs/2.0'
- xsi:schemaLocation='http://www.opengis.net/wcs/2.0 ../wcsAll.xsd'
- service="WCS" version="2.0.0">
- <ows:AcceptVersions>
- <ows:Version>2.0.0</ows:Version>
- </ows:AcceptVersions>
-</wcs:GetCapabilities>
diff --git a/petascope/src/petascope/wcs2/schemas/Examples/requestGetCoverage.xml b/petascope/src/petascope/wcs2/schemas/Examples/requestGetCoverage.xml
deleted file mode 100644
index 5195d36..0000000
--- a/petascope/src/petascope/wcs2/schemas/Examples/requestGetCoverage.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<wcs:GetCoverage xmlns:wcs="http://www.opengis.net/wcs/2.0"
- xmlns:gml="http://www.opengis.net/gml/3.2"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.opengis.net/wcs/2.0 ../wcsAll.xsd"
- service="WCS" version="2.0.0">
- <wcs:id gml:id="rgb"/>
- <wcs:trimDimension>
- <wcs:dimension>x</wcs:dimension>
- <wcs:trimLow>200</wcs:trimLow>
- <wcs:trimHigh>299</wcs:trimHigh>
- </wcs:trimDimension>
- <wcs:trimDimension>
- <wcs:dimension>y</wcs:dimension>
- <wcs:trimLow>200</wcs:trimLow>
- <wcs:trimHigh>300</wcs:trimHigh>
- </wcs:trimDimension>
-</wcs:GetCoverage>
diff --git a/petascope/src/petascope/wcs2/schemas/Examples/responseDescribeCoverage.xml b/petascope/src/petascope/wcs2/schemas/Examples/responseDescribeCoverage.xml
deleted file mode 100644
index 544e62f..0000000
--- a/petascope/src/petascope/wcs2/schemas/Examples/responseDescribeCoverage.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<wcs:CoverageDescriptions xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
- xmlns:gmlwcs='http://www.opengis.net/wcs/2.0/gml'
- xmlns:gml='http://www.opengis.net/gml/3.2'
- xmlns:wcs='http://www.opengis.net/wcs/2.0'
- xmlns='http://www.opengis.net/gml/3.2'
- xsi:schemaLocation='http://www.opengis.net/wcs/2.0 ../wcsAll.xsd'>
- <wcs:CoverageDescription gml:id="coverage1">
- <domainSet>
- <Grid dimension="2" gml:id="grid1">
- <limits>
- <GridEnvelope>
- <!-- This is a 5-by-3 matrix -->
- <low>1 1</low>
- <high>5 3</high>
- </GridEnvelope>
- </limits>
- <axisLabels>xAxis yAxis</axisLabels>
- </Grid>
- </domainSet>
- <gmlwcs:rangeStructure>
- <gmlwcs:RangeStructure gml:id="RangeStructure1">
- <gmlwcs:rangeField >
- <gmlwcs:RangeField gml:id="Band1" uom="W/cm^2">
- <gml:name>band1</gml:name>
- <gmlwcs:dataType>urn:ogc:def:dataType:OGC:1.1:unsignedByte</gmlwcs:dataType>
- <gmlwcs:nilValueList>000 255</gmlwcs:nilValueList>
- </gmlwcs:RangeField>
- </gmlwcs:rangeField>
- </gmlwcs:RangeStructure>
- </gmlwcs:rangeStructure>
- <wcs:ServiceParameters>
- <wcs:supportedCrsList></wcs:supportedCrsList>
- <wcs:supportedFormatList>application/xml</wcs:supportedFormatList>
- </wcs:ServiceParameters>
- </wcs:CoverageDescription>
-</wcs:CoverageDescriptions>
diff --git a/petascope/src/petascope/wcs2/schemas/Examples/responseGetCapabilities.xml b/petascope/src/petascope/wcs2/schemas/Examples/responseGetCapabilities.xml
deleted file mode 100644
index c5485e9..0000000
--- a/petascope/src/petascope/wcs2/schemas/Examples/responseGetCapabilities.xml
+++ /dev/null
@@ -1,60 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<wcs:Capabilities xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
- xmlns:ows='http://www.opengis.net/ows/1.1'
- xmlns:wcs='http://www.opengis.net/wcs/2.0'
- xmlns:gml='http://www.opengis.net/gml/3.2'
- xmlns='http://www.opengis.net/ows/1.1'
- xmlns:xlink='http://www.w3.org/1999/xlink'
- xsi:schemaLocation='http://www.opengis.net/wcs/2.0 ../wcsAll.xsd' version="2.0.0">
- <ServiceIdentification>
- <Title>petascope</Title>
- <Abstract>WCS Server developed at jacobs University</Abstract>
- <ServiceType>OGC WCS</ServiceType>
- <ServiceTypeVersion>2.0.0</ServiceTypeVersion>
- <Profile>urn:ogc:def:extension:OGC-WCS:2.0:protocol:post</Profile>
- <Profile>urn:ogc:def:extension:OGC-WCS:2.0:coverageFormat:netcdf</Profile>
- <Profile>urn:ogc:def:extension:OGC-WCS:2.0:serviceModel:wcps:1.0</Profile>
- <Profile>urn:ogc:def:extension:OGC-WCS:2.0:serviceModel:wcst:1.0</Profile>
- </ServiceIdentification>
- <ServiceProvider>
- <ProviderName>Jacobs University Bremen</ProviderName>
- <ProviderSite xlink:href="http://www.jacobs-university.de/"/>
- <ServiceContact>
- <IndividualName>Mr. X</IndividualName>
- <PositionName>Developer</PositionName>
- <ContactInfo>
- <Phone>
- <Voice></Voice>
- </Phone>
- </ContactInfo>
- </ServiceContact>
- </ServiceProvider>
- <OperationsMetadata>
- <Operation name="GetCapabilities">
- <DCP>
- <HTTP>
- <Get xlink:href="http://server:port/GetCapabilitiesURL"/>
- </HTTP>
- </DCP>
- </Operation>
- <Operation name="DescribeCoverage">
- <DCP>
- <HTTP>
- <Get xlink:href="http://server:port/DescribeCoverageURL"/>
- </HTTP>
- </DCP>
- </Operation>
- <Operation name="GetCoverage">
- <DCP>
- <HTTP>
- <Get xlink:href="http://server:port/GetCoverageURL"/>
- </HTTP>
- </DCP>
- </Operation>
- </OperationsMetadata>
- <wcs:Contents>
- <wcs:id gml:id="coverage1"/>
- <wcs:id gml:id="coverage2"/>
- <wcs:id gml:id="coverage3"/>
- </wcs:Contents>
-</wcs:Capabilities>
diff --git a/petascope/src/petascope/wcs2/schemas/Examples/responseGetCoverage.xml b/petascope/src/petascope/wcs2/schemas/Examples/responseGetCoverage.xml
deleted file mode 100644
index a4c6fd3..0000000
--- a/petascope/src/petascope/wcs2/schemas/Examples/responseGetCoverage.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<gmlwcs:GridCoverage xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
- xmlns:gml='http://www.opengis.net/gml/3.2'
- xmlns='http://www.opengis.net/gml/3.2'
- xmlns:gmlwcs='http://www.opengis.net/wcs/2.0/gml'
- xsi:schemaLocation='http://www.opengis.net/wcs/2.0/gml ../gml/gmlwcsAll.xsd' gml:id="coverage1">
- <domainSet>
- <Grid dimension="2" gml:id="grid1">
- <limits>
- <GridEnvelope>
- <!-- This is a 5-by-3 matrix -->
- <low>1 1</low>
- <high>5 3</high>
- </GridEnvelope>
- </limits>
- <axisLabels>xAxis yAxis</axisLabels>
- </Grid>
- </domainSet>
- <rangeSet>
- <DataBlock>
- <rangeParameters/>
- <tupleList>
- 1 2 3 4 5
- 6 7 8 9 10
- 11 12 13 14 15
- </tupleList>
- </DataBlock>
- </rangeSet>
- <gmlwcs:rangeStructure>
- <gmlwcs:RangeStructure gml:id="RangeStructure1">
- <gmlwcs:rangeField >
- <gmlwcs:RangeField gml:id="Band1" uom="W/cm^2">
- <gml:name>band1</gml:name>
- <gmlwcs:dataType>urn:ogc:def:dataType:OGC:1.1:unsignedByte</gmlwcs:dataType>
- <gmlwcs:nilValueList>000 255</gmlwcs:nilValueList>
- </gmlwcs:RangeField>
- </gmlwcs:rangeField>
- </gmlwcs:RangeStructure>
- </gmlwcs:rangeStructure>
-</gmlwcs:GridCoverage>
diff --git a/petascope/src/petascope/wcs2/schemas/Examples/wcsDescribeCoverage.xml b/petascope/src/petascope/wcs2/schemas/Examples/wcsDescribeCoverage.xml
deleted file mode 100644
index 047caed..0000000
--- a/petascope/src/petascope/wcs2/schemas/Examples/wcsDescribeCoverage.xml
+++ /dev/null
@@ -1,57 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<wcs:CoverageDescriptions xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
- xmlns:gmlwcs='http://www.opengis.net/wcs/2.0/gml'
- xmlns:gml='http://www.opengis.net/gml/3.2'
- xmlns:wcs='http://www.opengis.net/wcs/2.0'
- xmlns='http://www.opengis.net/gml/3.2'
- xsi:schemaLocation='http://www.opengis.net/wcs/2.0 http://localhost:8080/PetaScope/schemas/wcsAll.xsd'>
- <wcs:CoverageDescription gml:id="rgb">
- <domainSet>
- <Grid dimension="2" gml:id="gridrgb">
- <limits>
- <GridEnvelope>
- <low>0 0 </low>
- <high>399 343 </high>
-
- </GridEnvelope>
- </limits>
- <axisLabels>x y </axisLabels>
- </Grid>
- </domainSet>
- <gmlwcs:rangeStructure>
- <gmlwcs:RangeStructure gml:id="rangeStructure-rgb">
- <gmlwcs:rangeField>
-
- <gmlwcs:RangeField gml:id="range-1-red" uom="none">
- <gml:name>red</gml:name>
- <gmlwcs:dataType>urn:ogc:def:dataType:OGC:1.1:unsigned int</gmlwcs:dataType>
- <gmlwcs:nilValueList></gmlwcs:nilValueList>
- </gmlwcs:RangeField>
- </gmlwcs:rangeField>
- <gmlwcs:rangeField>
- <gmlwcs:RangeField gml:id="range-1-green" uom="none">
- <gml:name>green</gml:name>
-
- <gmlwcs:dataType>urn:ogc:def:dataType:OGC:1.1:unsigned int</gmlwcs:dataType>
- <gmlwcs:nilValueList></gmlwcs:nilValueList>
- </gmlwcs:RangeField>
- </gmlwcs:rangeField>
- <gmlwcs:rangeField>
- <gmlwcs:RangeField gml:id="range-1-blue" uom="none">
- <gml:name>blue</gml:name>
- <gmlwcs:dataType>urn:ogc:def:dataType:OGC:1.1:unsigned int</gmlwcs:dataType>
-
- <gmlwcs:nilValueList></gmlwcs:nilValueList>
- </gmlwcs:RangeField>
- </gmlwcs:rangeField>
-
- </gmlwcs:RangeStructure>
- </gmlwcs:rangeStructure>
- <wcs:ServiceParameters>
- <wcs:supportedCrsList/>
- <wcs:supportedFormatList>application/xml</wcs:supportedFormatList>
-
- </wcs:ServiceParameters>
- </wcs:CoverageDescription>
-
-</wcs:CoverageDescriptions>
diff --git a/petascope/src/petascope/wcs2/schemas/Examples/wcsGetCapabilities.xml b/petascope/src/petascope/wcs2/schemas/Examples/wcsGetCapabilities.xml
deleted file mode 100644
index 3d33e03..0000000
--- a/petascope/src/petascope/wcs2/schemas/Examples/wcsGetCapabilities.xml
+++ /dev/null
@@ -1,125 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<wcs:Capabilities xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
- xmlns:ows='http://www.opengis.net/ows/1.1'
- xmlns:wcs='http://www.opengis.net/wcs/2.0'
- xmlns:gml='http://www.opengis.net/gml/3.2'
- xmlns='http://www.opengis.net/ows/1.1'
- xmlns:xlink='http://www.w3.org/1999/xlink'
- xsi:schemaLocation='http://www.opengis.net/wcs/2.0 http://localhost:8080/PetaScope/schemas/wcsAll.xsd' version="2.0.0">
- <ServiceIdentification>
- <Title>WCS 2.0 Coverage Server @ Jacobs University</Title>
- <Abstract>WCS 2.0 Server developed at jacobs University</Abstract>
- <ServiceType>OGC WCS</ServiceType>
- <ServiceTypeVersion>2.0.0</ServiceTypeVersion>
- <Profile>urn:ogc:def:extension:OGC-WCS:2.0:protocol:post</Profile>
-
- <Profile>urn:ogc:def:extension:OGC-WCS:2.0:serviceModel:wcps:1.0</Profile>
- <Profile>urn:ogc:def:extension:OGC-WCS:2.0:serviceModel:wcst:1.0</Profile>
- </ServiceIdentification>
- <ServiceProvider>
- <ProviderName>Jacobs University Bremen</ProviderName>
- <ows:ProviderSite xlink:href="http://www.petascope.org/"/>
- <ServiceContact>
-
- <ows:IndividualName>Prof. Dr. Peter Baumann</ows:IndividualName>
- <ows:ContactInfo>
- <ows:Address>
- <ows:City>Bremen</ows:City>
- <ows:PostalCode>28717</ows:PostalCode>
- <ows:Country>Germany</ows:Country>
- <ows:ElectronicMailAddress>p.baumann@jacobs-university.de</ows:ElectronicMailAddress>
-
- </ows:Address>
- </ows:ContactInfo>
- <ows:Role>Project Leader</ows:Role>
- </ServiceContact>
- </ServiceProvider>
- <OperationsMetadata>
- <Operation name="GetCapabilities">
- <DCP>
-
- <HTTP>
- <Get xlink:href="http://localhost:8080/PetaScope/earthlook"/>
- </HTTP>
- </DCP>
- <Parameter name="Format">
- <AllowedValues>
- <Value>text/xml</Value>
- </AllowedValues>
-
- </Parameter>
- <Constraint name="PostEncoding">
- <AllowedValues>
- <Value>XML</Value>
- </AllowedValues>
- </Constraint>
- </Operation>
- <Operation name="DescribeCoverage">
-
- <DCP>
- <HTTP>
- <Get xlink:href="http://localhost:8080/PetaScope/earthlook"/>
- </HTTP>
- </DCP>
- <Parameter name="Format">
- <AllowedValues>
- <Value>text/xml</Value>
-
- </AllowedValues>
- </Parameter>
- <Constraint name="PostEncoding">
- <AllowedValues>
- <Value>XML</Value>
- </AllowedValues>
- </Constraint>
- </Operation>
-
- <Operation name="GetCoverage">
- <DCP>
- <HTTP>
- <Get xlink:href="http://localhost:8080/PetaScope/earthlook"/>
- </HTTP>
- </DCP>
- <Parameter name="Format">
- <AllowedValues>
- <Value>text/xml</Value>
-
- </AllowedValues>
- </Parameter>
- <Constraint name="PostEncoding">
- <AllowedValues>
- <Value>XML</Value>
- </AllowedValues>
- </Constraint>
- </Operation>
-
- </OperationsMetadata>
- <wcs:Contents>
- <wcs:id gml:id="NIR"/>
- <wcs:id gml:id="Waha_SEGY"/>
- <wcs:id gml:id="mr"/>
- <wcs:id gml:id="climate_clouds"/>
- <wcs:id gml:id="rgb"/>
- <wcs:id gml:id="climate_earth"/>
- <wcs:id gml:id="climate_temperature"/>
- <wcs:id gml:id="Modis"/>
- <wcs:id gml:id="TP"/>
- <wcs:id gml:id="whatevereeeee"/>
- <wcs:id gml:id="Boonsville_SEGY"/>
- <wcs:id gml:id="mowglie"/>
- <wcs:id gml:id="NN3_2"/>
- <wcs:id gml:id="NN3_3"/>
- <wcs:id gml:id="NN3_1"/>
- <wcs:id gml:id="NN3_6"/>
- <wcs:id gml:id="NN3_7"/>
- <wcs:id gml:id="NN3_4"/>
- <wcs:id gml:id="NN3_10"/>
- <wcs:id gml:id="NN3_5"/>
- <wcs:id gml:id="nrg"/>
- <wcs:id gml:id="NN3_11"/>
- <wcs:id gml:id="NN3_8"/>
- <wcs:id gml:id="NN3_9"/>
- </wcs:Contents>
- <wcs:WcsServiceMetadata />
-
-</wcs:Capabilities>
diff --git a/petascope/src/petascope/wcs2/schemas/Examples/wcsGetCoverage.xml b/petascope/src/petascope/wcs2/schemas/Examples/wcsGetCoverage.xml
deleted file mode 100644
index 371a714..0000000
--- a/petascope/src/petascope/wcs2/schemas/Examples/wcsGetCoverage.xml
+++ /dev/null
@@ -1,57 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<gmlwcs:GridCoverage xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
- xmlns:gml='http://www.opengis.net/gml/3.2'
- xmlns='http://www.opengis.net/gml/3.2'
- xmlns:gmlwcs='http://www.opengis.net/wcs/2.0/gml'
- xsi:schemaLocation='http://www.opengis.net/wcs/2.0/gml http://kahlua.eecs.jacobs-university.de:8080/petascope/schemas/gml/gmlwcsAll.xsd' gml:id="rgb0.2964005133273092">
- <domainSet>
- <Grid dimension="2" gml:id="grid-rgb">
- <limits>
- <GridEnvelope>
- <low>200 200</low>
- <high>219 209</high>
- </GridEnvelope>
-
- </limits>
- <axisLabels>x y</axisLabels>
- </Grid>
- </domainSet>
- <rangeSet>
- <DataBlock>
- <rangeParameters/>
- <tupleList>
-
- 242,27,103 242,27,103 242,27,103 242,27,103 242,27,103 242,27,103 242,27,103 242,27,103 204,0,88 242,27,103 242,27,103 242,27,103 242,27,103 242,27,103 242,27,103 242,27,103 242,27,103 204,0,88 242,27,103 242,27,103 242,27,103 242,27,103 242,27,103 242,27,103 242,27,103 242,27,103 204,0,88 242,27,103 242,27,103 242,27,103 242,27,103 242,27,103 242,27,103 242,27,103 242,27,103 204,0,88 242,27,103 242,27,103 242,27,103 242,27,103 242,27,103 242,27,103 242,27,103 242,27,103 204,0,88 242,27,103 242,27,103 242,27,103 242,27,103 242,27,103 242,27,103 242,27,103 242,27,103 204,0,88 242,27,103 242,27,103 242,27,103 242,27,103 242,27,103 242,27,103 242,27,103 242,27,103 204,0,88 242,27,103 242,27,103 242,27,103 242,27,103 242,27,103 242,27,103 204,0,88 242,27,103 204,0,88 242,27,103 242,27,103 242,27,103 242,27,103 242,27,103 242,27,103 242,27,103 204,0,88 204,0,88 242,27,103 242,27,103 242,27,103 242,27,103 242,27,103 242,27,103 242,27,103 204,0,88 242,27,103 242,27,103 242,27,103 242,27,103 242,27,103 242,27,103 242,27,103 242,27,103 204,0,88 204,0,88 242,27,103 242,27,103 242,27,103 242,27,103 242,27,103 242,27,103 242,27,103 204,0,88 204,0,88 242,27,103 242,27,103 242,27,103 242,27,103 242,27,103 242,27,103 242,27,103 204,0,88 204,0,88 242,27,103 242,27,103 242,27,103 242,27,103 242,27,103 242,27,103 242,27,103 204,0,88 204,0,88 242,27,103 242,27,103 242,27,103 242,27,103 242,27,103 242,27,103 242,27,103 204,0,88 204,0,88 242,27,103 242,27,103 242,27,103 242,27,103 242,27,103 242,27,103 242,27,103 204,0,88 204,0,88 242,27,103 242,27,103 242,27,103 242,27,103 242,27,103 204,0,88 242,27,103 204,0,88 204,0,88 242,27,103 242,27,103 242,27,103 242,27,103 242,27,103 242,27,103 204,0,88 204,0,88 204,0,88 242,27,103 242,27,103 242,27,103 242,27,103 242,27,103 242,27,103 204,0,88 242,27,103 204,0,88 242,27,103 242,27,103 242,27,103 242,27,103 242,27,103 242,27,103 204,0,88 204,0,88 242,27,103 242,27,103 242,27,103 242,27,103 242,27,103 242,27,103 242,27,103 204,0,88 204,0,88 242,27,103 242,27,103 242,27,103 242,27,103 242,27,103 242,27,103 242,27,103 204,0,88 204,0,88 242,27,103 242,27,103 242,27,10
- </tupleList>
- </DataBlock>
- </rangeSet>
- <gmlwcs:rangeStructure>
- <gmlwcs:RangeStructure gml:id="rangeStructure-1">
- <gmlwcs:rangeField>
- <gmlwcs:RangeField gml:id="range-1-red">
- <gml:name>red</gml:name>
-
- <gmlwcs:dataType>urn:ogc:def:dataType:OGC:1.1:unsigned int</gmlwcs:dataType>
- <gmlwcs:nilValueList>0</gmlwcs:nilValueList>
- </gmlwcs:RangeField>
- </gmlwcs:rangeField>
- <gmlwcs:rangeField>
- <gmlwcs:RangeField gml:id="range-1-green">
- <gml:name>green</gml:name>
- <gmlwcs:dataType>urn:ogc:def:dataType:OGC:1.1:unsigned int</gmlwcs:dataType>
-
- <gmlwcs:nilValueList>0</gmlwcs:nilValueList>
- </gmlwcs:RangeField>
- </gmlwcs:rangeField>
- <gmlwcs:rangeField>
- <gmlwcs:RangeField gml:id="range-1-blue">
- <gml:name>blue</gml:name>
- <gmlwcs:dataType>urn:ogc:def:dataType:OGC:1.1:unsigned int</gmlwcs:dataType>
- <gmlwcs:nilValueList>0</gmlwcs:nilValueList>
-
- </gmlwcs:RangeField>
- </gmlwcs:rangeField>
-
- </gmlwcs:RangeStructure>
- </gmlwcs:rangeStructure>
-</gmlwcs:GridCoverage>
diff --git a/petascope/src/petascope/wcs2/schemas/SchemaServlet.java b/petascope/src/petascope/wcs2/schemas/SchemaServlet.java
deleted file mode 100644
index f2c874f..0000000
--- a/petascope/src/petascope/wcs2/schemas/SchemaServlet.java
+++ /dev/null
@@ -1,97 +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.wcs2.schemas;
-
-import java.io.File;
-import java.io.FileReader;
-import java.io.IOException;
-import java.io.PrintWriter;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import org.apache.commons.io.IOUtils;
-
-/** Servlet that handles GET requests for the WCS 2.0 schema files.
- *
- * @author Andrei Aiordachioaie
- */
-public class SchemaServlet extends HttpServlet {
-
- /**
- * Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods.
- * @param request servlet request
- * @param response servlet response
- * @throws ServletException if a servlet-specific error occurs
- * @throws IOException if an I/O error occurs
- */
- protected void processRequest(HttpServletRequest request, HttpServletResponse response)
- throws ServletException, IOException {
- response.setContentType("application/xml;charset=UTF-8");
- PrintWriter out = response.getWriter();
- try {
- String schemaFile = request.getPathInfo();
- String pathPrefix = "/xml/ogc/wcs/2.0.0/";
- File file = new File(getServletContext().getRealPath(pathPrefix + schemaFile));
- String fileContents = IOUtils.toString(new FileReader(file));
- out.write(fileContents);
- } finally {
- out.close();
- }
- }
-
- /**
- * Handles the HTTP <code>GET</code> method.
- * @param request servlet request
- * @param response servlet response
- * @throws ServletException if a servlet-specific error occurs
- * @throws IOException if an I/O error occurs
- */
- @Override
- protected void doGet(HttpServletRequest request, HttpServletResponse response)
- throws ServletException, IOException {
- processRequest(request, response);
- }
-
- /**
- * Handles the HTTP <code>POST</code> method.
- * @param request servlet request
- * @param response servlet response
- * @throws ServletException if a servlet-specific error occurs
- * @throws IOException if an I/O error occurs
- */
- @Override
- protected void doPost(HttpServletRequest request, HttpServletResponse response)
- throws ServletException, IOException {
- processRequest(request, response);
- }
-
- /**
- * Returns a short description of the servlet.
- * @return a String containing servlet description
- */
- @Override
- public String getServletInfo() {
- return "Short description";
- }
-}
diff --git a/petascope/src/petascope/wcs2/schemas/gml/Examples/2dIdentityConversion.xml b/petascope/src/petascope/wcs2/schemas/gml/Examples/2dIdentityConversion.xml
deleted file mode 100644
index 994917e..0000000
--- a/petascope/src/petascope/wcs2/schemas/gml/Examples/2dIdentityConversion.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<Conversion xmlns="http://www.opengis.net/gml/3.2"
- xmlns:gml="http://www.opengis.net/gml/3.2"
- xmlns:xlink="http://www.w3.org/1999/xlink"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.opengis.net/gml/3.2 http://schemas.opengis.net/gml/3.2.1/gml.xsd"
- gml:id="IdentityConversion2D">
- <!-- Example for a 2-D CRS identity conversion as defined in the GML 3.2.1 Application Schema for WCS 2.0 -->
- <!-- Last updated 2010-01-11 -->
- <!-- =============================================== -->
- <identifier codeSpace="urn:ogc:def:method:WCS-SWG:2.0:">IdentityConversion2D</identifier>
- <name>Identity Conversion 2D</name>
- <remarks>none provided </remarks>
- <scope>not known</scope>
- <method xlink:href="urn:ogc:def:method:WCS-SWG:2.0:IdentityMethod2D"/>
-</Conversion>
diff --git a/petascope/src/petascope/wcs2/schemas/gml/Examples/2dIdentityMethod.xml b/petascope/src/petascope/wcs2/schemas/gml/Examples/2dIdentityMethod.xml
deleted file mode 100644
index 949036f..0000000
--- a/petascope/src/petascope/wcs2/schemas/gml/Examples/2dIdentityMethod.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<OperationMethod xmlns="http://www.opengis.net/gml/3.2"
- xmlns:gml="http://www.opengis.net/gml/3.2"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.opengis.net/gml/3.2 http://schemas.opengis.net/gml/3.2.1/gml.xsd"
- gml:id="IdentityMethod2D">
- <!-- Example for a 2-D CRS identity transformation as defined in the GML 3.2.1 Application Schema for WCS 2.0 -->
- <!-- Last updated 2010-01-11 -->
- <!-- =============================================== -->
- <identifier codeSpace="urn:ogc:def:method:WCS-SWG:2.0:">IdentityMethod2D</identifier>
- <name>Identity Method 2D</name>
- <remarks>Method for use by a Coordinate Conversion for the identity transformation of two coordinates </remarks>
- <methodFormula>This coordinate converion shall be as specified by the equations:
- BaseX = DerivedX
- BaseY = DerivedY
-where
- DerivedX, DerivedY are position coordinates in the derived 2D CRS
- BaseX, BaseY are position coordinates in the 2D base CRS
- </methodFormula>
- <sourceDimensions>2</sourceDimensions>
- <targetDimensions>2</targetDimensions>
-</OperationMethod>
diff --git a/petascope/src/petascope/wcs2/schemas/gml/Examples/exampleRangeStructure.xml b/petascope/src/petascope/wcs2/schemas/gml/Examples/exampleRangeStructure.xml
deleted file mode 100644
index 519a5a5..0000000
--- a/petascope/src/petascope/wcs2/schemas/gml/Examples/exampleRangeStructure.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<gmlwcs:rangeStructure
- xmlns:gmlwcs="http://www.opengis.net/wcs/2.0/gml"
- xmlns:gml="http://www.opengis.net/gml/3.2"
- xmlns="http://www.w3.org/2001/XMLSchema"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.opengis.net/wcs/2.0/gml ../gmlwcsAll.xsd">
- <!-- Example for a coverage range structure as defined in the GML 3.2.1 Application Schema for WCS 2.0 -->
- <!-- It models the red, green, and blue channel of a Landsat scene. Pixels are defined as unsigned 8-bit quantities where 0 and 255 denote null values. -->
- <!-- Last updated 2010-01-11 -->
- <!-- =============================================== -->
- <gmlwcs:RangeStructure gml:id="RGB">
- <gmlwcs:rangeField >
- <gmlwcs:RangeField gml:id="Red" uom="W/cm^2">
- <gml:name>red</gml:name>
- <gmlwcs:dataType>UnsignedChar</gmlwcs:dataType>
- <gmlwcs:nilValueList>000 255</gmlwcs:nilValueList>
- </gmlwcs:RangeField>
- </gmlwcs:rangeField>
- <gmlwcs:rangeField >
- <gmlwcs:RangeField gml:id="Green" uom="W/cm^2">
- <gml:name>green</gml:name>
- <gmlwcs:dataType>UnsignedChar</gmlwcs:dataType>
- <gmlwcs:nilValueList>000 255</gmlwcs:nilValueList>
- </gmlwcs:RangeField>
- </gmlwcs:rangeField>
- <gmlwcs:rangeField >
- <gmlwcs:RangeField gml:id="Blue" uom="W/cm^2">
- <gml:name>blue</gml:name>
- <gmlwcs:dataType>UnsignedChar</gmlwcs:dataType>
- <gmlwcs:nilValueList>000 255</gmlwcs:nilValueList>
- </gmlwcs:RangeField>
- </gmlwcs:rangeField>
- </gmlwcs:RangeStructure>
-</gmlwcs:rangeStructure>
diff --git a/petascope/src/petascope/wcs2/schemas/gml/Examples/exampleRectifiedGridCoverage.xml b/petascope/src/petascope/wcs2/schemas/gml/Examples/exampleRectifiedGridCoverage.xml
deleted file mode 100644
index 9514ae7..0000000
--- a/petascope/src/petascope/wcs2/schemas/gml/Examples/exampleRectifiedGridCoverage.xml
+++ /dev/null
@@ -1,56 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<gmlwcs:RectifiedGridCoverage
- xmlns:gmlwcs="http://www.opengis.net/wcs/2.0/gml"
- xmlns:gml="http://www.opengis.net/gml/3.2"
- xmlns:xlink="http://www.w3.org/1999/xlink"
- xmlns="http://www.w3.org/2001/XMLSchema"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.opengis.net/wcs/2.0/gml ../gmlwcsAll.xsd"
- gml:id="Coverage1">
- <!-- Example for a domain set for a rectified grid coverage as defined in the GML 3.2.1 Application Schema for WCS 2.0 -->
- <!-- Last updated 2010-01-11 -->
- <!-- =============================================== -->
- <gml:domainSet>
- <gml:RectifiedGrid gml:id="RectifiedGrid1" dimension="2" srsName="urn:ogc:def:crs:EPSG::4326">
- <gml:limits>
- <gml:GridEnvelope>
- <gml:low>0 0</gml:low>
- <gml:high>9999 9999</gml:high>
- </gml:GridEnvelope>
- </gml:limits>
- <gml:axisLabels>column row</gml:axisLabels>
- <gml:origin>
- <gml:Point gml:id="Origin1" srsName="urn:ogc:def:crs:EPSG::4326">
- <gml:pos>99.9 99.9</gml:pos>
- </gml:Point>
- </gml:origin>
- <gml:offsetVector>1 0</gml:offsetVector>
- <gml:offsetVector>0 1</gml:offsetVector>
- </gml:RectifiedGrid>
- </gml:domainSet>
- <gml:rangeSet>
- <gml:File>
- <gml:rangeParameters xlink:href="TBDurl"/>
- <gml:fileReference>TBDurlOfFile</gml:fileReference>
- <gml:fileStructure>TBD</gml:fileStructure>
- </gml:File>
- </gml:rangeSet>
- <gmlwcs:rangeStructure>
- <gmlwcs:RangeStructure gml:id="RangeStructure1">
- <gmlwcs:rangeField >
- <gmlwcs:RangeField gml:id="White" uom="W/cm^2">
- <gml:name>white</gml:name>
- <gmlwcs:dataType>UnsignedChar</gmlwcs:dataType>
- <gmlwcs:nilValueList>000 255</gmlwcs:nilValueList>
- </gmlwcs:RangeField>
- </gmlwcs:rangeField>
- </gmlwcs:RangeStructure>
- </gmlwcs:rangeStructure>
- <gml:coverageFunction>
- <gml:GridFunction>
- <gml:sequenceRule axisOrder="+1 +2">Linear</gml:sequenceRule>
- <gml:startPoint>0 0</gml:startPoint>
- </gml:GridFunction>
- </gml:coverageFunction>
-</gmlwcs:RectifiedGridCoverage>
-
diff --git a/petascope/src/petascope/wcs2/schemas/gml/Examples/exampleReferenceablGridCoverage.xml b/petascope/src/petascope/wcs2/schemas/gml/Examples/exampleReferenceablGridCoverage.xml
deleted file mode 100644
index bc9de96..0000000
--- a/petascope/src/petascope/wcs2/schemas/gml/Examples/exampleReferenceablGridCoverage.xml
+++ /dev/null
@@ -1,60 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<gmlwcs:ReferenceableGridCoverage
- xmlns:gmlwcs="http://www.opengis.net/wcs/2.0/gml"
- xmlns:gml="http://www.opengis.net/gml/3.2"
- xmlns:xlink="http://www.w3.org/1999/xlink"
- xmlns="http://www.w3.org/2001/XMLSchema"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.opengis.net/wcs/2.0/gml ../gmlwcsAll.xsd"
- gml:id="Coverage1">
- <!-- Example for a domain set for a rectified grid coverage containing a ReferencedGridByTransformation as defined in the GML 3.2.1 Application Schema for WCS 2.0 -->
- <!-- Last updated 2010-01-11 -->
- <!-- =============================================== -->
- <gml:domainSet>
- <gmlwcs:ReferencedGridByTransformation gml:id="ReferencedGrid1" dimension="2" srsName="InternalCRS1">
- <gml:limits>
- <gml:GridEnvelope>
- <gml:low>0 0</gml:low>
- <gml:high>9999 9999</gml:high>
- </gml:GridEnvelope>
- </gml:limits>
- <gml:axisLabels>Column Row</gml:axisLabels>
- <gmlwcs:gridCRS>
- <gml:DerivedCRS gml:id="InternalCRS1">
- <gml:identifier codeSpace="">InternalCRS1</gml:identifier>
- <gml:scope>not known</gml:scope>
- <gml:definedByConversion xlink:href="urn:ogc:coordinateOperation:WCS:2.0:IdentityConversion2D"/>
- <gml:baseCRS xlink:href="urn:ogc:crs:OGC:1.0:Image:AAA999"/>
- <gml:derivedCRSType codeSpace="">image</gml:derivedCRSType>
- <gml:usesCS xlink:href="urn:ogc:def:cs:OGC:1.0:GridCS2d"/>
- </gml:DerivedCRS>
- </gmlwcs:gridCRS>
- <gmlwcs:transformation xlink:href="TBDurl"/>
- </gmlwcs:ReferencedGridByTransformation>
- </gml:domainSet>
- <gml:rangeSet>
- <gml:File>
- <gml:rangeParameters xlink:href="TBDurl"/>
- <gml:fileReference>TBDurlOfFile</gml:fileReference>
- <gml:fileStructure>TBD</gml:fileStructure>
- </gml:File>
- </gml:rangeSet>
- <gmlwcs:rangeStructure>
- <gmlwcs:RangeStructure gml:id="Panchromatic">
- <gmlwcs:rangeField >
- <gmlwcs:RangeField gml:id="White" uom="w/cm^2">
- <gml:name>white</gml:name>
- <gmlwcs:dataType>unsignedInteger</gmlwcs:dataType>
- <gmlwcs:nilValueList>000 255</gmlwcs:nilValueList>
- </gmlwcs:RangeField>
- </gmlwcs:rangeField>
- </gmlwcs:RangeStructure>
- </gmlwcs:rangeStructure>
- <gml:coverageFunction>
- <gml:GridFunction>
- <gml:sequenceRule axisOrder="+1 +2">Linear</gml:sequenceRule>
- <gml:startPoint>0 0</gml:startPoint>
- </gml:GridFunction>
- </gml:coverageFunction>
-</gmlwcs:ReferenceableGridCoverage>
-
diff --git a/petascope/src/petascope/wcs2/schemas/gml/gmlwcsAll.xsd b/petascope/src/petascope/wcs2/schemas/gml/gmlwcsAll.xsd
deleted file mode 100644
index ae0d949..0000000
--- a/petascope/src/petascope/wcs2/schemas/gml/gmlwcsAll.xsd
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<schema targetNamespace="http://www.opengis.net/wcs/2.0/gml"
- xmlns:wcsgml="http://www.opengis.net/wcs/2.0/gml"
- xmlns="http://www.w3.org/2001/XMLSchema"
- xmlns:gml="http://www.opengis.net/gml/3.2"
- elementFormDefault="qualified" version="1.0.0">
- <annotation>
- <appinfo>gmlwcsAll.xsd</appinfo>
- <documentation>This is the XML Schema for the GML 3.2.1 Application schema for WCS 2.0.
- This XML Schema Document includes, directly and indirectly, all the XML Schema Documents defined by the GML 3.2.1 Application schema for WCS 2.0.
- Last updated: 2010-jan-11
- Copyright (c) 2010 Open Geospatial Consortium, Inc, All Rights Reserved.
- To obtain additional rights of use, visit http://www.opengeospatial.org/legal/.
- </documentation>
- </annotation>
- <!-- ========================================================= -->
- <!-- Includes and imports -->
- <!-- ========================================================= -->
- <include schemaLocation="wcsCoverage.xsd"/>
- <include schemaLocation="wcsGrids.xsd"/>
-</schema>
diff --git a/petascope/src/petascope/wcs2/schemas/gml/wcsCoverage.xsd b/petascope/src/petascope/wcs2/schemas/gml/wcsCoverage.xsd
deleted file mode 100644
index 5643a1d..0000000
--- a/petascope/src/petascope/wcs2/schemas/gml/wcsCoverage.xsd
+++ /dev/null
@@ -1,160 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<schema targetNamespace="http://www.opengis.net/wcs/2.0/gml"
- xmlns:gmlwcs="http://www.opengis.net/wcs/2.0/gml"
- xmlns:gml="http://www.opengis.net/gml/3.2"
- xmlns:xlink="http://www.w3.org/1999/xlink"
- xmlns="http://www.w3.org/2001/XMLSchema"
- elementFormDefault="qualified" version="1.0.0">
- <annotation>
- <appinfo source="urn:x-ogc:specification:wcs:gml-app-schema:schema-xsd:coverage:3.2.1">coverage.xsd</appinfo>
- <documentation>Part of GML 3.2.1 Application schema for WCS 2.0.
- Last updated: 2010-jan-11
- Copyright (c) 2010 Open Geospatial Consortium, Inc. All Rights Reserved.
- To obtain additional rights of use, visit http://www.opengeospatial.org/legal/.
- </documentation>
- </annotation>
- <!-- ============================= -->
- <!-- Includes and imports -->
- <!-- ============================= -->
- <import namespace="http://www.opengis.net/gml/3.2" schemaLocation="http://schemas.opengis.net/gml/3.2.1/gml.xsd"/>
- <!-- ============================= -->
- <!-- Body of this schema -->
- <!-- ============================= -->
- <element name="AbstractCoverage" type="gmlwcs:CoverageType" abstract="true" substitutionGroup="gml:AbstractCoverage">
- <annotation>
- <documentation>Extends gml:AbstractCoverage as needed for WCS 2.0, by adding a rangeStructure property. </documentation>
- </annotation>
- </element>
- <!-- ============================================================= -->
- <complexType name="CoverageType">
- <annotation>
- <documentation>The gml:coverageFunction property is included here, because it is included in both discrete and continuous coverages. This permits coverages in the gmlwcs:AbstractCoverage substitutionGroup to be used for either discrete and continuous coverages, in preparation for expected future elimination of this distinction. </documentation>
- </annotation>
- <complexContent>
- <extension base="gml:AbstractCoverageType">
- <sequence>
- <element ref="gmlwcs:rangeStructure"/>
- <element ref="gml:coverageFunction" minOccurs="0"/>
- </sequence>
- </extension>
- </complexContent>
- </complexType>
- <!-- ============================================================= -->
- <element name="GridCoverage" type="gmlwcs:CoverageType" substitutionGroup="gmlwcs:AbstractCoverage">
- <annotation>
- <documentation>A GridCoverage is a discrete point coverage in which the domain is a geometric grid of points.
-Note that this is the same as the MultiPointCoverage except that we have a gml:Grid to describe the domain.
-This simple grid coverage is not geometrically referenced to the earth, and hence no geometric positions are assignable to the points in the grid. Such geometric positioning is introduced in the RectifiedGridCoverage.
-Redefinition needed in order to benefit from the changes to the abstract ancestor AbstractCoverage.
- </documentation>
- <documentation>Since this GridCoverage uses the gmlwcs:CoverageType, it can be used for both discrete and continuous coverages. </documentation>
- </annotation>
- </element>
- <!-- ============================================================= -->
- <element name="RectifiedGridCoverage" type="gmlwcs:CoverageType" substitutionGroup="gmlwcs:AbstractCoverage">
- <annotation>
- <documentation>A RectifiedGridCoverage is a discrete point coverage based on a rectified grid. It is similar to the grid coverage except that the points of the grid are geometrically referenced. The rectified grid coverage has a domain that is a gml:RectifiedGrid geometry.
- Redefinition needed in order to benefit from the changes to the abstract ancestor AbstractCoverage.
- </documentation>
- <documentation>Since this RectifiedGridCoverage uses the gmlwcs:CoverageType, it can be used for both discrete and continuous coverages. </documentation>
- </annotation>
- </element>
- <!-- ============================================================= -->
- <element name="ReferenceableGridCoverage" type="gmlwcs:CoverageType" substitutionGroup="gmlwcs:AbstractCoverage">
- <annotation>
- <documentation>A ReferenceableGridCoverage is an implementation of ISO 19123 CV_DiscreteGridPointCoverage for a CV_ReferenceableGrid domain. It is a coverage based on a referenceable grid and has a domain geometry that is in the substitution group of AbstractReferenceableGrid.</documentation>
- <documentation>This equivalent of this element is being added to GML 3.2.1 by approved Change Request 07-112r3. </documentation>
- <documentation>Since this ReferenceableGridCoverage uses the gmlwcs:CoverageType, it can be used for both discrete and continuous coverages. </documentation>
- </annotation>
- </element>
- <!-- =============================================================
- RangeStructure defines the structure of a coverage in WCS 2.0
- ============================================================= -->
- <element name="rangeStructure" type="gmlwcs:RangeStructurePropertyType">
- <annotation>
- <documentation>The rangeStructure property includes or references the RangeStructure, introduced for coverage definitions used by WCS 2.0. </documentation>
- </annotation>
- </element>
- <!-- ============================================================= -->
- <complexType name="RangeStructurePropertyType">
- <sequence minOccurs="0">
- <element ref="gmlwcs:RangeStructure"/>
- </sequence>
- <attributeGroup ref="gml:OwnershipAttributeGroup"/>
- <attributeGroup ref="gml:AssociationAttributeGroup"/>
- </complexType>
- <!-- ============================================================= -->
- <element name="RangeStructure" type="gmlwcs:RangeStructureType" substitutionGroup="gml:AbstractGML">
- <annotation>
- <documentation>The RangeStructure element describes the structure of a coverage's range, introduced for coverage definitions used by WCS 2.0. </documentation>
- </annotation>
- </element>
- <!-- ============================================================= -->
- <complexType name="RangeStructureType">
- <complexContent>
- <extension base="gml:AbstractGMLType">
- <sequence>
- <element ref="gmlwcs:rangeField" maxOccurs="unbounded"/>
- </sequence>
- </extension>
- </complexContent>
- </complexType>
- <!-- ============================================================= -->
- <element name="rangeField" type="gmlwcs:RangeFieldPropertyType">
- <annotation>
- <documentation>The RangeField property includes or references one RangeField element. </documentation>
- </annotation>
- </element>
- <!-- ============================================================= -->
- <complexType name="RangeFieldPropertyType">
- <sequence minOccurs="0">
- <element name="RangeField" type="gmlwcs:RangeFieldType"/>
- </sequence>
- <attributeGroup ref="gml:OwnershipAttributeGroup"/>
- <attributeGroup ref="gml:AssociationAttributeGroup"/>
- </complexType>
- <!-- ============================================================= -->
- <element name="RangeField" type="gmlwcs:RangeFieldType" substitutionGroup="gml:AbstractGML">
- <annotation>
- <documentation>The RangeField element describes the structure of one Field of a coverage's range. </documentation>
- </annotation>
- </element>
- <!-- ============================================================= -->
- <complexType name="RangeFieldType">
- <complexContent>
- <extension base="gml:AbstractGMLType">
- <annotation>
- <documentation>The gml:name should be used for the unique identifier of this RangeField. </documentation>
- </annotation>
- <sequence>
- <element name="dataType" type="gmlwcs:DataType"/>
- <element ref="gmlwcs:nilValueList"/>
- </sequence>
- <attribute name="uom" type="gml:UomIdentifier" use="optional">
- <annotation>
- <documentation>Identifier of the Unit of Measure applicable to values of this RangeField. </documentation>
- </annotation>
- </attribute>
- </extension>
- </complexContent>
- </complexType>
- <!-- ============================================================= -->
- <complexType name="DataType">
- <simpleContent>
- <restriction base="gml:CodeType">
- <attribute name="codeSpace" type="anyURI" use="optional" default="http://schemas.opengis.net/wcs/2.0/gml/wcsDataTypeIdentifiers.xml">
- <annotation>
- <documentation>This element will contain an URN that identifies the datatype of this field. The default gml:Dictionary of allowed values of this dataType is wcsDataTypeIdentifiers.xml. </documentation>
- </annotation>
- </attribute>
- </restriction>
- </simpleContent>
- </complexType>
- <!-- ============================================================= -->
- <element name="nilValueList" type="gml:doubleList">
- <annotation>
- <documentation>List of the specific values of this RangeField that are used to designate non-valid values. </documentation>
- </annotation>
- </element>
- <!-- ============================================================= -->
-</schema>
diff --git a/petascope/src/petascope/wcs2/schemas/gml/wcsDataTypeIdentifiers.xml b/petascope/src/petascope/wcs2/schemas/gml/wcsDataTypeIdentifiers.xml
deleted file mode 100644
index bf10663..0000000
--- a/petascope/src/petascope/wcs2/schemas/gml/wcsDataTypeIdentifiers.xml
+++ /dev/null
@@ -1,111 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<Dictionary xmlns="http://www.opengis.net/gml/3.2"
- xmlns:gml="http://www.opengis.net/gml/3.2"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.opengis.net/gml/3.2 http://schemas.opengis.net/gml/3.2.1/gml.xsd"
- gml:id="DataTypeIdentifiers">
- <description>This dictionary specifies the standard values for dataType, specified in the WCS 2.0 GML 3.2.1 application schema. This dataType is for values of a RangeField. In addition, this dictionary specifies definition URNs in the "ogc" URN namespace for these values. This dictionary uses a currently unspecified simple dictionary profile of GML 3.2.1.
- Definitions are compatible with XML Schema as of 28 October 2004 [http://www.w3.org/TR/2004/REC-xmlschema-2-20041028/].
- Identifiers do not have an associated unit of measure.
- Last updated: 2010-jan-11
- Copyright (c) 2010 Open Geospatial Consortium, Inc. All Rights Reserved.
- To obtain additional rights of use, visit http://www.opengeospatial.org/legal/.
- </description>
- <identifier codeSpace="">DataTypeIdentifiers</identifier>
- <!-- ===================================================== -->
- <dictionaryEntry>
- <Definition gml:id="boolean">
- <description>Logical value; admissible values are "true" and "false" (in whatever case), as well as 0 (which shall represent "false") and 1 (which shall represent "true"). </description>
- <identifier codeSpace="urn:ogc:def:dataType:OGC:1.1">boolean</identifier>
- </Definition>
- </dictionaryEntry>
- <!-- ===================================================== -->
- <!-- ===================================================== -->
- <dictionaryEntry>
- <Definition gml:id="integer">
- <description>Positive or negative integer number without any limitation on maximum and minimum values. For expressing certain value range limitations the specialized types byte, shortInteger, int, and LongInteger are available. </description>
- <identifier codeSpace="urn:ogc:def:dataType:OGC:1.1">long</identifier>
- </Definition>
- </dictionaryEntry>
- <!-- ===================================================== -->
- <dictionaryEntry>
- <Definition gml:id="unsignedInteger">
- <description>Non-negative integer number without any limitation on minimum values. For expressing certain value range limitations the specialized types unsignedByte, unsignedShort, unsignedInt, and unsignedLong are available. </description>
- <identifier codeSpace="urn:ogc:def:dataType:OGC:1.1">unsignedInteger</identifier>
- </Definition>
- </dictionaryEntry>
- <!-- ===================================================== -->
- <!-- ===================================================== -->
- <dictionaryEntry>
- <Definition gml:id="byte">
- <description>Positive or negative integer number with values between -128 anf 127. </description>
- <identifier codeSpace="urn:ogc:def:dataType:OGC:1.1">byte</identifier>
- </Definition>
- </dictionaryEntry>
- <!-- ===================================================== -->
- <dictionaryEntry>
- <Definition gml:id="unsignedByte">
- <description>Non-negative integer number with values between 0 and 255. </description>
- <identifier codeSpace="urn:ogc:def:dataType:OGC:1.1">unsignedByte</identifier>
- </Definition>
- </dictionaryEntry>
- <!-- ===================================================== -->
- <dictionaryEntry>
- <Definition gml:id="short">
- <description>Positive or negative integer number with values between -32768 and 32767, which allows for a representation with 16 bits. </description>
- <identifier codeSpace="urn:ogc:def:dataType:OGC:1.1">short</identifier>
- </Definition>
- </dictionaryEntry>
- <!-- ===================================================== -->
- <dictionaryEntry>
- <Definition gml:id="unsignedShort">
- <description>Non-negative integer number with values between 0 and 65535, which allows for a representation with 16 bits. </description>
- <identifier codeSpace="urn:ogc:def:dataType:OGC:1.1">unsignedShort</identifier>
- </Definition>
- </dictionaryEntry>
- <!-- ===================================================== -->
- <dictionaryEntry>
- <Definition gml:id="int">
- <description>Positive or negative integer number with values between -2147483648 and 2147483647, which allows for a representation with 32 bits. </description>
- <identifier codeSpace="urn:ogc:def:dataType:OGC:1.1">int</identifier>
- </Definition>
- </dictionaryEntry>
- <!-- ===================================================== -->
- <dictionaryEntry>
- <Definition gml:id="unsignedInt">
- <description>Non-negative integer number with values between 0 and 4294967295, which allows for a representation with 32 bits. </description>
- <identifier codeSpace="urn:ogc:def:dataType:OGC:1.1">unsignedInt</identifier>
- </Definition>
- </dictionaryEntry>
- <!-- ===================================================== -->
- <dictionaryEntry>
- <Definition gml:id="long">
- <description>Positive or negative integer number with values between -9223372036854775808 and 9223372036854775807, which allows for a representation with 64 bits. </description>
- <identifier codeSpace="urn:ogc:def:dataType:OGC:1.1">long</identifier>
- </Definition>
- </dictionaryEntry>
- <!-- ===================================================== -->
- <dictionaryEntry>
- <Definition gml:id="unsignedLong">
- <description>Non-negative integer number with values between 0 and 18446744073709551616, which allows for a representation with 64 bits. </description>
- <identifier codeSpace="urn:ogc:def:dataType:OGC:1.1">unsignedLong</identifier>
- </Definition>
- </dictionaryEntry>
- <!-- ===================================================== -->
- <!-- ===================================================== -->
- <dictionaryEntry>
- <Definition gml:id="float">
- <description>Single-precision floating point number according to IEEE 754-1985. </description>
- <identifier codeSpace="urn:ogc:def:dataType:OGC:1.1">double</identifier>
- </Definition>
- </dictionaryEntry>
- <!-- ===================================================== -->
- <dictionaryEntry>
- <Definition gml:id="double">
- <description>Double-precision floating point number according to IEEE 754-1985. </description>
- <identifier codeSpace="urn:ogc:def:dataType:OGC:1.1">double</identifier>
- </Definition>
- </dictionaryEntry>
- <!-- ===================================================== -->
-</Dictionary>
-
diff --git a/petascope/src/petascope/wcs2/schemas/gml/wcsGrids.xsd b/petascope/src/petascope/wcs2/schemas/gml/wcsGrids.xsd
deleted file mode 100644
index 587e25d..0000000
--- a/petascope/src/petascope/wcs2/schemas/gml/wcsGrids.xsd
+++ /dev/null
@@ -1,156 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<schema targetNamespace="http://www.opengis.net/wcs/2.0/gml"
- xmlns:gmlwcs="http://www.opengis.net/wcs/2.0/gml"
- xmlns:gml="http://www.opengis.net/gml/3.2"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns="http://www.w3.org/2001/XMLSchema"
- elementFormDefault="qualified" version="1.0.0" xml:lang="en">
- <annotation>
- <appinfo>wcsGrids.xsd</appinfo>
- <documentation>This XML Schema Document encodes extensions to GML 3.2.1 for grids that are referenced by a Transformation, named "ReferencedGridByTransformation". This document also extends the alternatives allowed in gml:ParameterValueType as expected to be needed by such Transformations.
- Last updated: 2010-jan-11
- Copyright (c) 2010 Open Geospatial Consortium, Inc. All Rights Reserved.
- To obtain additional rights of use, visit http://www.opengeospatial.org/legal/.
- </documentation>
- </annotation>
- <!-- ============================================================== -->
- <!-- Includes and imports -->
- <!-- ============================================================== -->
- <import namespace="http://www.opengis.net/gml/3.2" schemaLocation="http://schemas.opengis.net/gml/3.2.1/gml.xsd"/>
- <!-- ============================================================== -->
- <!-- Elements and types -->
- <!-- ============================================================== -->
- <element name="AbstractReferenceableGrid" type="gmlwcs:AbstractReferenceableGridType" abstract="true" substitutionGroup="gml:Grid">
- <annotation>
- <documentation>AbstractReferenceableGrid is an encoding of CV_ReferenceableGrid in ISO 19123. AbstractReferenceableGrid is the head of a substitution group that may include multiple concrete implementations.
-
-A referenceable grid is a grid associated with a transformation that can be used to convert grid coordinate values to values of coordinates referenced to an external coordinate reference system [ISO 19123]. The transformation between grid coordinates and ‘external’ coordinates is usually non-affine, and may take different forms. It may be described analytically (e.g., through parametrised mathematical image rectification models); or it may provided in a table, for instance, relating the grid points to coordinates in the external coordinate reference system [ISO 19123, §8.2.1].
-
-The inherited attribute group gml:SRSReferenceGroup shall link the referenceable grid to the internal coordinate reference system of the grid.
- </documentation>
- <documentation>This element and its type are copied from approved Change Request 07-112r3, which adds them to GML 3.2.1. </documentation>
- </annotation>
- </element>
- <!-- =========================================================== -->
- <complexType name="AbstractReferenceableGridType" abstract="true">
- <complexContent>
- <extension base="gml:GridType"/>
- </complexContent>
- </complexType>
- <!-- =========================================================== -->
- <element name="referenceableGridProperty" type="gmlwcs:ReferenceableGridPropertyType">
- <annotation>
- <documentation>This element and its type are copied from approved Change Request 07-112r3, which adds them to GML 3.2.1. </documentation>
- </annotation>
- </element>
- <!-- =========================================================== -->
- <complexType name="ReferenceableGridPropertyType">
- <sequence>
- <element ref="gmlwcs:AbstractReferenceableGrid"/>
- </sequence>
- <attributeGroup ref="gml:AssociationAttributeGroup"/>
- <attributeGroup ref="gml:OwnershipAttributeGroup"/>
- </complexType>
- <!-- =========================================================== -->
- <element name="ReferencedGridByTransformation" type="gmlwcs:ReferencedGridByTransformationType" substitutionGroup="gmlwcs:AbstractReferenceableGrid">
- <annotation>
- <documentation>ReferencedGridByTransformation encodes one type of CV_ReferenceableGrid as defined in ISO 19123, using a gml:Transformation or gml:ConcatenatedOperation to specify the relationship between positions in the grid and corresponding positions in another CRS. This encoding also generalises CV_ReferenceableGrid to allow including more than one referencing Transformation. </documentation>
- <documentation>This element and its type are copied from Change Request 09-091r1, which adds them to GML 3.2.1. </documentation>
- </annotation>
- </element>
- <!-- =========================================================== -->
- <complexType name="ReferencedGridByTransformationType">
- <complexContent>
- <extension base="gmlwcs:AbstractReferenceableGridType">
- <sequence>
- <element ref="gmlwcs:gridCRS" minOccurs="0">
- <annotation>
- <documentation>The gridCRS is a composition association to the definition of the internal CRS for this extended gml:Grid. This definition shall be the one referenced by the gml:srsName attribute in the gml:GridType. This CRS definition shall be included here if its definition is needed by some data receivers and is not otherwise available using that gml:srsName value. </documentation>
- </annotation>
- </element>
- <choice maxOccurs="unbounded">
- <annotation>
- <documentation>This choice encodes an unordered list of associations to coordinate Transformations or Concatenated Operations that each (geo)reference this ReferenceableGrid. Each of these Transformations or Concatenated Operations shall reference the internal CRS for this extended gml:Grid, as either its sourceCRS or targetCRS. This transformation association may be repeated when this ReferencedGridByTransformation is referenced to more than one other CRS, and/or is referenced to the same other CRS by multiple Transformation versions. </documentation>
- </annotation>
- <element name="transformation" type="gml:TransformationPropertyType"/>
- <element name="concatenatedOperation" type="gml:ConcatenatedOperationPropertyType"/>
- </choice>
- </sequence>
- </extension>
- </complexContent>
- </complexType>
- <!-- =========================================================== -->
- <element name="gridCRS" type="gmlwcs:GridCRSPropertyType">
- <annotation>
- <documentation>The gridCRS is a composition association to the definition of the internal CRS for this extended gml:Grid. This internal CRS may be a DerivedCRS, EngineeringCRS, ImageCRS, or CompoundCRS. However, proposed OGC Best Practices Paper 09-085r1 recommends that this internal CRS always be a DerivedCRS. </documentation>
- <documentation>This element and its type are copied from Change Request 09-091r1, which adds them to GML 3.2.1. </documentation>
- </annotation>
- </element>
- <!-- =========================================================== -->
- <complexType name="GridCRSPropertyType">
- <sequence>
- <element ref="gml:AbstractCRS"/>
- </sequence>
- </complexType>
- <!-- =========================================================== -->
- <!-- =========================================================== -->
- <element name="ParameterValue" type="gmlwcs:ParameterValueType" substitutionGroup="gml:AbstractGeneralParameterValue">
- <annotation>
- <documentation>Extends gml:ParameterValue to also allow values that are a gml:Geometry or a gml:vector. </documentation>
- <documentation>This element and its type are copied from Change Request 09-091r1, which adds them to GML 3.2.1. </documentation>
- </annotation>
- </element>
- <!-- =========================================================== -->
- <complexType name="ParameterValueType">
- <complexContent>
- <extension base="gml:AbstractGeneralParameterValueType">
- <sequence>
- <choice>
- <element ref="gml:value"/>
- <element ref="gml:dmsAngleValue"/>
- <element ref="gml:stringValue"/>
- <element ref="gml:integerValue"/>
- <element ref="gml:booleanValue"/>
- <element ref="gml:valueList"/>
- <element ref="gml:integerValueList"/>
- <element ref="gml:valueFile"/>
- <element ref="gmlwcs:geometryValue"/>
- <element ref="gmlwcs:vectorValue"/>
- </choice>
- <element ref="gml:operationParameter"/>
- </sequence>
- </extension>
- </complexContent>
- </complexType>
- <!-- =========================================================== -->
- <element name="geometryValue" type="gml:GeometryPropertyType">
- <annotation>
- <documentation>A geometry used as a coordinate operation parameter value, which contains any type of geometry element, with a reference to its associated coordinate reference system. </documentation>
- <documentation>This element and its type are copied from Change Request 09-091r1, which adds them to GML 3.2.1. </documentation>
- </annotation>
- </element>
- <!-- =========================================================== -->
- <element name="vectorValue" type="gml:VectorType">
- <annotation>
- <documentation>Vector value of a coordinate operation parameter. A vectorValue can represent a distance in a direction (when the magnitude of the vector is significant) or just a direction (when the magnitude of the vector is not considered significant). This vectorValue shall use the coordinate axes directions and units of the coordinate system in the referenced coordinate reference system. This coordinate reference system will often be the same as referenced by an associated geometryValue coordinate operation parameter. </documentation>
- </annotation>
- </element>
- <!-- =========================================================== -->
- <!-- =========================================================== -->
- <element name="SimpleMultiPoint" type="gmlwcs:SimpleMultiPointType" substitutionGroup="gml:AbstractGeometricAggregate">
- <annotation>
- <documentation>gml:SimpleMultiPoint implements, and provides a simplified encoding for, ISO 19107 GM_MultiPoint (see ISO 19107:2003, 6.5.4). A gml:SimpleMultiPoint consists of a list of DirectPositions. </documentation>
- </annotation>
- </element>
- <!-- =========================================================== -->
- <complexType name="SimpleMultiPointType">
- <complexContent>
- <extension base="gml:AbstractGeometricAggregateType">
- <sequence>
- <element name="positions" type="gml:DirectPositionListType"/>
- </sequence>
- </extension>
- </complexContent>
- </complexType>
- <!-- =========================================================== -->
-</schema>
diff --git a/petascope/src/petascope/wcs2/schemas/wcsAll.xsd b/petascope/src/petascope/wcs2/schemas/wcsAll.xsd
deleted file mode 100644
index 21f0e83..0000000
--- a/petascope/src/petascope/wcs2/schemas/wcsAll.xsd
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<schema targetNamespace="http://www.opengis.net/wcs/2.0"
- xmlns:wcs="http://www.opengis.net/wcs/2.0"
- xmlns="http://www.w3.org/2001/XMLSchema"
- elementFormDefault="qualified" version="2.0.0" xml:lang="en">
- <annotation>
- <appinfo>wcsAll.xsd</appinfo>
- <documentation>This XML Schema Document includes, directly and indirectly, all the XML Schema Documents defined by the OGC Web Coverage Service (WCS).
- Last updated: 2010-jan-11
- Copyright (c) 2010 Open Geospatial Consortium, Inc, All Rights Reserved.
- To obtain additional rights of use, visit http://www.opengeospatial.org/legal/.
- </documentation>
- </annotation>
- <!-- ============================================================== -->
- <!-- includes and imports -->
- <!-- ============================================================== -->
- <import namespace="http://www.opengis.net/wcs/2.0/gml" schemaLocation="gml/gmlwcsAll.xsd"/>
- <include schemaLocation="wcsGetCoverage.xsd"/>
- <include schemaLocation="wcsDescribeCoverage.xsd"/>
- <include schemaLocation="wcsGetCapabilities.xsd"/>
-</schema>
diff --git a/petascope/src/petascope/wcs2/schemas/wcsCommon.xsd b/petascope/src/petascope/wcs2/schemas/wcsCommon.xsd
deleted file mode 100644
index c1d5b33..0000000
--- a/petascope/src/petascope/wcs2/schemas/wcsCommon.xsd
+++ /dev/null
@@ -1,87 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<schema targetNamespace="http://www.opengis.net/wcs/2.0"
- xmlns:wcs="http://www.opengis.net/wcs/2.0"
- xmlns:ows="http://www.opengis.net/ows/1.1"
- xmlns:gml="http://www.opengis.net/gml/3.2"
- xmlns="http://www.w3.org/2001/XMLSchema"
- elementFormDefault="qualified" version="2.0.0" xml:lang="en">
- <annotation>
- <appinfo>wcsContents.xsd</appinfo>
- <appinfo>
- <GMLProfileSchema>http://schemas.opengis.net/wcs/2.0/gml/gmlwcsAll.xsd</GMLProfileSchema>
- </appinfo>
- <documentation>This XML Schema Document encodes the elements and types that are shared by multiple WCS operations.
- Last updated: 2010-jan-11
- Copyright (c) 2010 Open Geospatial Consortium, Inc, All Rights Reserved.
- To obtain additional rights of use, visit http://www.opengeospatial.org/legal/.
- </documentation>
- </annotation>
- <!-- ============================================================== -->
- <!-- includes and imports -->
- <!-- ============================================================== -->
- <import namespace="http://www.opengis.net/gml/3.2" schemaLocation="http://schemas.opengis.net/gml/3.2.1/gml.xsd"/>
- <import namespace="http://www.opengis.net/ows/1.1" schemaLocation="http://schemas.opengis.net/ows/1.1.0/owsAll.xsd"/>
- <!-- ============================================================== -->
- <!-- elements and types -->
- <!-- ============================================================== -->
- <complexType name="RequestBaseType">
- <annotation>
- <documentation>XML encoded WCS operation request base, for all operations except GetCapabilities. In this XML encoding, no "request" parameter is included, since the element name specifies the specific operation. </documentation>
- </annotation>
- <sequence/>
- <attribute name="service" type="string" use="required" fixed="WCS">
- <annotation>
- <documentation>Service type identifier, where the value is the OWS type abbreviation. For WCS operation requests, the value is "WCS". </documentation>
- </annotation>
- </attribute>
- <attribute name="version" type="wcs:VersionStringType" use="required">
- <annotation>
- <documentation>Specification version for WCS version and operation. See Version parameter Subclause 7.3.1 of OWS Common for more information. </documentation>
- </annotation>
- </attribute>
- </complexType>
- <simpleType name="VersionStringType">
- <restriction base="string">
- <pattern value="2\.0\.\d+"/>
- </restriction>
- </simpleType>
- <!-- =========================================================== -->
- <element name="id" type="wcs:CoverageIdType">
- <annotation>
- <documentation>This element is a wrapper for the gml:id attribute. Needed to allow lists of identifiers. </documentation>
- </annotation>
- </element>
- <complexType name="CoverageIdType">
- <attribute ref="gml:id"/>
- </complexType>
- <!-- =========================================================== -->
- <element name="ServiceParameters" type="wcs:ServiceParametersType"/>
- <complexType name="ServiceParametersType">
- <sequence>
- <element name="supportedCrsList" type="wcs:CrsListType"/>
- <element name="supportedFormatList" type="wcs:FormatListType"/>
- </sequence>
- </complexType>
-
- <simpleType name="CrsListType">
- <list itemType="anyURI"/>
- </simpleType>
- <simpleType name="FormatListType">
- <list itemType="ows:MimeType"/>
- </simpleType>
- <!-- =========================================================== -->
- <element name="WcsServiceMetadata" type="wcs:ServiceMetadataType"/>
- <complexType name="ServiceMetadataType">
- <sequence>
- <!-- nothing defined here, it is a container for potential additions done by extensions -->
- </sequence>
- </complexType>
- <!-- =========================================================== -->
- <element name="Contents" type="wcs:ContentsType"/>
- <complexType name="ContentsType">
- <sequence>
- <element ref="wcs:id" minOccurs="0" maxOccurs="unbounded"/>
- </sequence>
- </complexType>
-</schema>
-
diff --git a/petascope/src/petascope/wcs2/schemas/wcsDescribeCoverage.xsd b/petascope/src/petascope/wcs2/schemas/wcsDescribeCoverage.xsd
deleted file mode 100644
index c3c4ec3..0000000
--- a/petascope/src/petascope/wcs2/schemas/wcsDescribeCoverage.xsd
+++ /dev/null
@@ -1,73 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<schema targetNamespace="http://www.opengis.net/wcs/2.0"
- xmlns:wcs="http://www.opengis.net/wcs/2.0"
- xmlns:gml="http://www.opengis.net/gml/3.2"
- xmlns:gmlwcs="http://www.opengis.net/wcs/2.0/gml"
- xmlns="http://www.w3.org/2001/XMLSchema"
- elementFormDefault="qualified" version="2.0.0" xml:lang="en">
- <annotation>
- <appinfo>wcsDescribeCoverage.xsd</appinfo>
- <appinfo>
- <GMLProfileSchema>http://schemas.opengis.net/wcs/2.0/gml/gmlwcsAll.xsd</GMLProfileSchema>
- </appinfo>
- <documentation>This XML Schema Document defines the DescribeCoverage operation request and response XML elements and types, used by the OGC Web Coverage Service (WCS).
- Last updated: 2010-jan-11
- Copyright (c) 2010 Open Geospatial Consortium, Inc, All Rights Reserved.
- To obtain additional rights of use, visit http://www.opengeospatial.org/legal/.
- </documentation>
- </annotation>
- <!-- ============================================================== -->
- <!-- includes and imports -->
- <!-- ============================================================== -->
- <import namespace="http://www.opengis.net/gml/3.2" schemaLocation="http://schemas.opengis.net/gml/3.2.1/gml.xsd"></import>
- <import namespace="http://www.opengis.net/wcs/2.0/gml" schemaLocation="gml/gmlwcsAll.xsd"/>
- <include schemaLocation="wcsCommon.xsd"/>
- <!-- ============================================================== -->
- <!-- elements and types -->
- <!-- ============================================================== -->
- <element name="DescribeCoverage" type="wcs:DescribeCoverageType">
- <annotation>
- <documentation>Request to a WCS to perform the DescribeCoverage operation. This operation allows a client to retrieve descriptions of one or more coverages. In this XML encoding, no "request" parameter is included, since the element name specifies the specific operation. </documentation>
- </annotation>
- </element>
- <complexType name="DescribeCoverageType">
- <complexContent>
- <extension base="wcs:RequestBaseType">
- <sequence>
- <element ref="wcs:id" maxOccurs="unbounded">
- <annotation>
- <documentation>Unordered list of identifiers of desired coverages. A client can obtain identifiers by a prior GetCapabilities request, or from a third-party source. </documentation>
- </annotation>
- </element>
- </sequence>
- <attribute name="request" type="string" fixed="DescribeCoverage"/>
- </extension>
- </complexContent>
- </complexType>
- <!-- =========================================================== -->
- <element name="CoverageDescriptions" type="wcs:CoverageDescriptionsType">
- <annotation>
- <documentation>Response from a WCS DescribeCoverage operation, containing one or more coverage descriptions. </documentation>
- </annotation>
- </element>
- <complexType name="CoverageDescriptionsType">
- <sequence>
- <element name="CoverageDescription" type="wcs:CoverageDescriptionType" minOccurs="0" maxOccurs="unbounded"/>
- </sequence>
- </complexType>
- <!-- =========================================================== -->
- <complexType name="CoverageDescriptionType">
- <annotation>
- <documentation>Full description of coverages available from a WCS server. This description shall include sufficient information to allow all valid GetCoverage operation requests to be prepared by a WCS client. </documentation>
- </annotation>
- <complexContent>
- <extension base="gml:AbstractFeatureType">
- <sequence>
- <element ref="gml:domainSet"/>
- <element ref="gmlwcs:rangeStructure"/>
- <element ref="wcs:ServiceParameters"/>
- </sequence>
- </extension>
- </complexContent>
- </complexType>
-</schema>
diff --git a/petascope/src/petascope/wcs2/schemas/wcsExtensions.xml b/petascope/src/petascope/wcs2/schemas/wcsExtensions.xml
deleted file mode 100644
index eff982d..0000000
--- a/petascope/src/petascope/wcs2/schemas/wcsExtensions.xml
+++ /dev/null
@@ -1,125 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<Dictionary
- xmlns:wcs="http://www.opengis.net/wcs/2.0"
- xmlns:gml="http://www.opengis.net/gml/3.2"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns="http://www.opengis.net/gml/3.2"
- xsi:schemaLocation="http://www.opengis.net/gml/3.2 http://schemas.opengis.net/gml/3.2.1/gml.xsd"
- gml:id="WcsExtensions">
- <description>
- This dictionary specifies URNs and identifiers for WCS 2.0 extensions, to be communicated as part of a WCS GetCapabilities response. The dictionary is situated in the "ogc" namespace and uses a currently unspecified simple dictionary profile of GML 3.2.1.
-
- Last updated: 2010-jan-11
- Copyright (c) 2010 Open Geospatial Consortium, Inc. All Rights Reserved.
- To obtain additional rights of use, visit http://www.opengeospatial.org/legal/.
- </description>
- <identifier codeSpace="">WcsExtensions</identifier>
- <!-- ===================================================== -->
- <!-- data model extensions -->
- <!-- ===================================================== -->
- <dictionaryEntry>
- <Definition gml:id="wcs_dataModel_nilValues">
- <description>WCS 2.0 extension defining handling of nil values in a coverage. </description>
- <identifier codeSpace="urn:ogc:def:extension:OGC-WCS:2.0:dataModel:nilValues">1.0</identifier>
- </Definition>
- </dictionaryEntry>
- <!-- ===================================================== -->
- <dictionaryEntry>
- <Definition gml:id="wcs_dataModel_uncertainty">
- <description>WCS 2.0 extension defining handling of uncertainty in a coverage. </description>
- <identifier codeSpace="urn:ogc:def:extension:OGC-WCS:2.0:dataModel:uncertainty">1.0</identifier>
- </Definition>
- </dictionaryEntry>
- <!-- ===================================================== -->
- <!-- service model extensions -->
- <!-- ===================================================== -->
- <dictionaryEntry>
- <Definition gml:id="wcs_serviceModel_metadata">
- <description>WCS 2.0 extension defining advanced service metadata concepts. </description>
- <identifier codeSpace="urn:ogc:def:extension:OGC-WCS:2.0:serviceModel:metadata">1.0</identifier>
- </Definition>
- </dictionaryEntry>
- <!-- ===================================================== -->
- <dictionaryEntry>
- <Definition gml:id="wcs_serviceModel_scaling">
- <description>WCS 2.0 extension defining scaling and interpolation of coverages. </description>
- <identifier codeSpace="urn:ogc:def:extension:OGC-WCS:2.0:serviceModel:scaling">1.0</identifier>
- </Definition>
- </dictionaryEntry>
- <!-- ===================================================== -->
- <dictionaryEntry>
- <Definition gml:id="wcs_serviceModel_crs">
- <description>WCS 2.0 extension defining coordinate reference system (CRS) handling within coverages. </description>
- <identifier codeSpace="urn:ogc:def:extension:OGC-WCS:2.0:serviceModel:crs">1.0</identifier>
- </Definition>
- </dictionaryEntry>
- <!-- ===================================================== -->
- <dictionaryEntry>
- <Definition gml:id="wcs_serviceModel_wcst">
- <description>WCS 2.0 extension defining transactional (ie, update) services. </description>
- <identifier codeSpace="urn:ogc:def:extension:OGC-WCS:2.0:serviceModel:wcst">1.0</identifier>
- </Definition>
- </dictionaryEntry>
- <!-- ===================================================== -->
- <dictionaryEntry>
- <Definition gml:id="wcs_serviceModel_wcps">
- <description>WCS 2.0 extension defining coverage processing services. </description>
- <identifier codeSpace="urn:ogc:def:extension:OGC-WCS:2.0:serviceModel:wcps">1.0</identifier>
- </Definition>
- </dictionaryEntry>
- <!-- ===================================================== -->
- <!-- protocol binding extensions -->
- <!-- ===================================================== -->
- <dictionaryEntry>
- <Definition gml:id="wcs_protocol_get">
- <description>WCS 2.0 extension defining the HTTP GET / KVP protocol encoding. </description>
- <identifier codeSpace="urn:ogc:def:extension:OGC-WCS:2.0:protocol:get">1.0</identifier>
- </Definition>
- </dictionaryEntry>
- <!-- ===================================================== -->
- <dictionaryEntry>
- <Definition gml:id="wcs_protocol_post">
- <description>WCS 2.0 extension defining the HTTP POST / XML protocol encoding. </description>
- <identifier codeSpace="urn:ogc:def:extension:OGC-WCS:2.0:protocol:post">1.0</identifier>
- </Definition>
- </dictionaryEntry>
- <!-- ===================================================== -->
- <dictionaryEntry>
- <Definition gml:id="wcs_protocol_soap">
- <description>WCS 2.0 extension defining the SOAP protocol encoding. </description>
- <identifier codeSpace="urn:ogc:def:extension:OGC-WCS:2.0:protocol:soap">1.0</identifier>
- </Definition>
- </dictionaryEntry>
- <!-- ===================================================== -->
- <!-- coverage encoding format extensions -->
- <!-- ===================================================== -->
- <dictionaryEntry>
- <Definition gml:id="wcs_coverageFormat_gml">
- <description>WCS 2.0 extension defining use of the GML coverage encoding format. </description>
- <identifier codeSpace="urn:ogc:def:extension:OGC-WCS:2.0:coverageFormat:gml">1.0</identifier>
- </Definition>
- </dictionaryEntry>
- <!-- ===================================================== -->
- <dictionaryEntry>
- <Definition gml:id="wcs_coverageFormat_geotiff">
- <description>WCS 2.0 extension defining use of the GeoTIFF coverage encoding format. </description>
- <identifier codeSpace="urn:ogc:def:extension:OGC-WCS:2.0:coverageFormat:geotiff">1.0</identifier>
- </Definition>
- </dictionaryEntry>
- <!-- ===================================================== -->
- <dictionaryEntry>
- <Definition gml:id="wcs_coverageFormat_netcdf">
- <description>WCS 2.0 extension defining use of the NetCDF coverage encoding format. </description>
- <identifier codeSpace="urn:ogc:def:extension:OGC-WCS:2.0:coverageFormat:netcdf">1.0</identifier>
- </Definition>
- </dictionaryEntry>
- <!-- ===================================================== -->
- <!-- usability extensions -->
- <!-- ===================================================== -->
- <dictionaryEntry>
- <Definition gml:id="wcs_usability_multilinguality">
- <description>WCS 2.0 extension defining multilingual access to a WCS. </description>
- <identifier codeSpace="urn:ogc:def:extension:OGC-WCS:2.0:usability:multilinguality">1.0</identifier>
- </Definition>
- </dictionaryEntry>
-</Dictionary>
diff --git a/petascope/src/petascope/wcs2/schemas/wcsGetCapabilities.xsd b/petascope/src/petascope/wcs2/schemas/wcsGetCapabilities.xsd
deleted file mode 100644
index 9996063..0000000
--- a/petascope/src/petascope/wcs2/schemas/wcsGetCapabilities.xsd
+++ /dev/null
@@ -1,56 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<schema targetNamespace="http://www.opengis.net/wcs/2.0"
- xmlns:wcs="http://www.opengis.net/wcs/2.0"
- xmlns:ows="http://www.opengis.net/ows/1.1"
- xmlns:gml="http://www.opengis.net/gml/3.2"
- xmlns="http://www.w3.org/2001/XMLSchema"
- elementFormDefault="qualified" version="2.0.0" xml:lang="en">
- <annotation>
- <appinfo>wcsGetCapabilities.xsd</appinfo>
- <documentation>This XML Schema Document encodes the GetCapabilities operation request and response used by the OGC Web Coverage Service (WCS).
- Last updated: 2010-jan-11
- Copyright (c) 2010 Open Geospatial Consortium, Inc, All Rights Reserved.
- To obtain additional rights of use, visit http://www.opengeospatial.org/legal/.
- </documentation>
- </annotation>
- <!-- ============================================================== -->
- <!-- includes and imports -->
- <!-- ============================================================== -->
- <import namespace="http://www.opengis.net/ows/1.1" schemaLocation="http://schemas.opengis.net/ows/1.1.0/owsAll.xsd"/>
- <import namespace="http://www.opengis.net/gml/3.2" schemaLocation="http://schemas.opengis.net/gml/3.2.1/gml.xsd"/>
- <include schemaLocation="wcsCommon.xsd"/>
- <!-- ============================================================== -->
- <!-- elements and types -->
- <!-- ============================================================== -->
- <element name="GetCapabilities" type="wcs:GetCapabilitiesType">
- <annotation>
- <documentation>Request to a WCS server to perform the GetCapabilities operation. This operation allows a client to retrieve a Capabilities XML document providing metadata for the specific WCS server. In this XML encoding, no "request" parameter is included, since the element name specifies the specific operation. </documentation>
- </annotation>
- </element>
- <complexType name="GetCapabilitiesType">
- <complexContent>
- <extension base="ows:GetCapabilitiesType">
- <sequence/>
- <attribute name="request" type="string" fixed="GetCapabilities"/>
- <attribute name="service" type="ows:ServiceType" use="required" fixed="WCS"/>
- <attribute name="version" type="wcs:VersionStringType" use="required"/>
- </extension>
- </complexContent>
- </complexType>
- <!-- =========================================================== -->
- <element name="Capabilities" type="wcs:CapabilitiesType">
- <annotation>
- <documentation>XML encoded WCS GetCapabilities operation response. The Capabilities document provides clients with service metadata about a specific service instance, including metadata about the coverages served. If the server does not implement the updateSequence parameter, the server shall always return the Capabilities document, without the updateSequence parameter. When the server implements the updateSequence parameter and the GetCapabilities operation request included the updateSequence parameter with the current value, the server shall return this element with only the "version" and "updateSequence" attributes. Otherwise, all optional sections shall be included or not depending on the actual value of the Contents parameter in the GetCapabilities operation request. </documentation>
- </annotation>
- </element>
- <complexType name="CapabilitiesType">
- <complexContent>
- <extension base="ows:CapabilitiesBaseType">
- <sequence>
- <element ref="wcs:Contents"/>
- <element ref="wcs:WcsServiceMetadata" minOccurs="0"/>
- </sequence>
- </extension>
- </complexContent>
- </complexType>
-</schema>
diff --git a/petascope/src/petascope/wcs2/schemas/wcsGetCoverage.xsd b/petascope/src/petascope/wcs2/schemas/wcsGetCoverage.xsd
deleted file mode 100644
index 57ef8ed..0000000
--- a/petascope/src/petascope/wcs2/schemas/wcsGetCoverage.xsd
+++ /dev/null
@@ -1,88 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<schema targetNamespace="http://www.opengis.net/wcs/2.0"
- xmlns:wcs="http://www.opengis.net/wcs/2.0"
- xmlns:gml="http://www.opengis.net/gml/3.2"
- xmlns:gmlwcs="http://www.opengis.net/wcs/2.0/gml"
- xmlns="http://www.w3.org/2001/XMLSchema"
- elementFormDefault="qualified" version="2.0.0" xml:lang="en">
- <annotation>
- <appinfo>wcsGetCoverage.xsd</appinfo>
- <documentation>This XML Schema Document defines the GetCoverage operation request elements and types, for the OGC Web Coverage Service (WCS).
- The GetCoverage request element is GetCoverage. The GetCoverage response element is a specialization of gmlwcs:AbstractCoverage.
- Last updated: 2010-jan-11
- Copyright (c) 2007 Open Geospatial Consortium, Inc. All Rights Reserved.
- To obtain additional rights of use, visit http://www.opengeospatial.org/legal/.
- </documentation>
- </annotation>
- <!-- ============================================================== -->
- <!-- includes and imports -->
- <!-- ============================================================== -->
- <import namespace="http://www.opengis.net/wcs/2.0/gml" schemaLocation="gml/gmlwcsAll.xsd"/>
- <include schemaLocation="wcsCommon.xsd"/>
- <!-- ============================================================== -->
- <!-- elements and types -->
- <!-- ============================================================== -->
- <element name="GetCoverage" type="wcs:GetCoverageType">
- <annotation>
- <documentation>Request to a WCS to perform the GetCoverage operation. This operation allows a client to retrieve a subset of one coverage. </documentation>
- </annotation>
- </element>
- <complexType name="GetCoverageType">
- <complexContent>
- <extension base="wcs:RequestBaseType">
- <sequence>
- <element ref="wcs:id">
- <annotation>
- <documentation>Identifier of the coverage that this GetCoverage operation request shall draw from. </documentation>
- </annotation>
- </element>
- <choice minOccurs="0" maxOccurs="unbounded">
- <element name="trimDimension" type="wcs:DimensionTrimType"/>
- <element name="sliceDimension" type="wcs:DimensionSliceType"/>
- </choice>
- </sequence>
- <attribute name="request" type="string" fixed="GetCoverage"/>
- </extension>
- </complexContent>
- </complexType>
- <!-- ======================================================= -->
- <!-- Domain subset types and elements -->
- <!-- ======================================================= -->
- <complexType name="DimensionSubsetType" abstract="true">
- <annotation>
- <documentation>Definition of the desired subset of the domain of the coverage. This is either a Trim operation, or a Slice operation.</documentation>
- </annotation>
- <sequence>
- <element name="dimension" type="NCName"/>
- </sequence>
- </complexType>
- <!-- ======================================================= -->
- <complexType name="DimensionTrimType">
- <annotation>
- <documentation>Describes the trimming of a coverage's domain axis, between two values.</documentation>
- </annotation>
- <complexContent>
- <extension base="wcs:DimensionSubsetType">
- <sequence>
- <element name="trimLow" type="double" minOccurs="0"/>
- <element name="trimHigh" type="double" minOccurs="0"/>
- </sequence>
- </extension>
- </complexContent>
- </complexType>
- <!-- ======================================================= -->
- <complexType name="DimensionSliceType">
- <annotation>
- <documentation>Describes the slicing of a coverage's domain axis at a particular point.</documentation>
- </annotation>
- <complexContent>
- <extension base="wcs:DimensionSubsetType">
- <sequence>
- <element name="slicePoint" type="double"/>
- </sequence>
- </extension>
- </complexContent>
- </complexType>
- <!-- ======================================================= -->
-</schema>
-
diff --git a/petascope/src/petascope/wcs2/server/Wcs2Server.java b/petascope/src/petascope/wcs2/server/Wcs2Server.java
deleted file mode 100644
index cb5f6f9..0000000
--- a/petascope/src/petascope/wcs2/server/Wcs2Server.java
+++ /dev/null
@@ -1,120 +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.wcs2.server;
-
-//~--- non-JDK imports --------------------------------------------------------
-import javax.servlet.ServletException;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import petascope.ConfigManager;
-
-import petascope.wcps.server.core.DbMetadataSource;
-
-import petascope.wcs.server.exceptions.WCSException;
-
-import petascope.wcs2.server.ops.DescribeCoverage;
-import petascope.wcs2.server.ops.GetCapabilities;
-import petascope.wcs2.server.ops.GetCoverage;
-
-//~--- JDK imports ------------------------------------------------------------
-/**
- * The Web Coverage Service (WcsServer)
- * This class provides methods for each of the WCS operations:
- * - GetCapabilities
- * - DescribeCoverage
- * - GetCoverage
- *
- * @author Andrei Aiordachioaie
- */
-public class Wcs2Server {
-
- private static Logger LOG = LoggerFactory.getLogger(Wcs2Server.class);
-
- /* The Operations to delegate to */
- private GetCapabilities capa;
- private DescribeCoverage desc;
- private GetCoverage getcov;
-
- /* Globals */
- private DbMetadataSource meta;
-
- /**
- * constructor
- * @param settingsPath path to the "settings.properties" file
- */
- public Wcs2Server(String settingsPath, DbMetadataSource source) throws ServletException {
- ConfigManager.getInstance(settingsPath, null);
- meta = source;
-
- try {
- capa = new GetCapabilities(meta);
- desc = new DescribeCoverage(meta);
- getcov = new GetCoverage(meta);
- } catch (Exception e) {
- LOG.error("Could not init WCS 2.0");
-
- throw new RuntimeException("Could not initialize WCS 2.0", e);
- }
- }
-
- /**
- * WcsServer GetCapabilities operation
- */
- public String GetCapabilities(String stringXml) throws WCSException {
- LOG.trace("Received input:\n{}", stringXml);
- LOG.info("Executing operation GetCapabilities...");
- String result = capa.execute(stringXml);
-
- LOG.info("GetCapabilities finished");
-
- return result;
- }
-
- /**
- * WcsServer DescribeCoverage operation
- */
- public String DescribeCoverage(String stringXml) throws WCSException {
- LOG.trace("Received input:\n{}", stringXml);
- LOG.info("Executing operation DescribeCoverage...");
- String result = desc.execute(stringXml);
-
- LOG.info("DescribeCoverage finished");
-
- return result;
- }
-
- /**
- * WcsServer GetCoverage operation
- */
- public String GetCoverage(String stringXml) throws WCSException {
- LOG.trace("Received input:\n{}", stringXml);
- LOG.info("Executing operation GetCoverage...");
- String result = getcov.execute(stringXml);
-
- LOG.info("GetCoverage finished");
-
- return result;
- }
-}
diff --git a/petascope/src/petascope/wcs2/server/ops/DescribeCoverage.java b/petascope/src/petascope/wcs2/server/ops/DescribeCoverage.java
deleted file mode 100644
index 6f4e752..0000000
--- a/petascope/src/petascope/wcs2/server/ops/DescribeCoverage.java
+++ /dev/null
@@ -1,204 +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.wcs2.server.ops;
-
-//~--- non-JDK imports --------------------------------------------------------
-import java.util.HashSet;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import petascope.ConfigManager;
-
-import petascope.wcps.server.core.CellDomainElement;
-import petascope.wcps.server.core.DbMetadataSource;
-import petascope.wcps.server.core.DomainElement;
-import petascope.wcps.server.core.Metadata;
-import petascope.wcps.server.core.RangeElement;
-
-import petascope.wcs.server.exceptions.WCSException;
-
-//~--- JDK imports ------------------------------------------------------------
-
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-import petascope.wcps.server.core.SDU;
-import petascope.wcs.server.exceptions.InvalidParameterValueException;
-import petascope.wcs.server.exceptions.InvalidServiceConfigurationException;
-import petascope.wcs.server.exceptions.NoApplicableCodeException;
-
-/**
- * Describe Coverage operation for WCS 2.0
- *
- * @author Andrei Aiordachioaie
- */
-public class DescribeCoverage implements WcsOperation {
-
- public static String DATATYPE_URN_PREFIX = "urn:ogc:def:dataType:OGC:1.1:";
- private static Logger LOG = LoggerFactory.getLogger(DescribeCoverage.class);
- /* Template XMLs for response types */
- private String DescribeCoverageResponse;
- /* Other useful stuff */
- private String coverageDescriptionTemplate;
- private String listOfFormats;
- private String low, high, axisLabels;
- private DbMetadataSource meta;
- private String rangeComponentTemplate;
- private String rangeComponents, gridDimension, gridId;
-
- public DescribeCoverage(DbMetadataSource metadata) throws InvalidServiceConfigurationException {
- meta = metadata;
-
- DescribeCoverageResponse = ConfigManager.WCS2_DESCRIBE_COVERAGE_TEMPLATE;
- if (DescribeCoverageResponse == null) {
- throw new InvalidServiceConfigurationException("Could not find template file.");
- }
- listOfFormats = "application/xml";
-
- /* Find the CoverageDescription template string */
- String starttag = "<wcs:CoverageDescription ", endtag = "</wcs:CoverageDescription>";
- int start = DescribeCoverageResponse.indexOf(starttag);
- int end = DescribeCoverageResponse.indexOf(endtag);
-
- coverageDescriptionTemplate = DescribeCoverageResponse.substring(start, end + endtag.length());
- String newResponse = DescribeCoverageResponse.substring(0, start - 1) + DescribeCoverageResponse.substring(end + endtag.length());
-
- DescribeCoverageResponse = newResponse;
-
- /* Find the RangeComponent template string */
- starttag = "<gmlwcs:rangeField";
- endtag = "</gmlwcs:rangeField>";
- start = coverageDescriptionTemplate.indexOf(starttag);
- end = coverageDescriptionTemplate.indexOf(endtag);
- rangeComponentTemplate = coverageDescriptionTemplate.substring(start, end + endtag.length());
- String newTemplate = coverageDescriptionTemplate.substring(0, start - 1) + coverageDescriptionTemplate.substring(end + endtag.length());
-
- coverageDescriptionTemplate = newTemplate;
- }
-
- @Override
- public String execute(String stringXml) throws WCSException {
- String output;
- String desc = "";
-
- String listOfCoverageDescriptions = "";
- int start, end;
-
- start = stringXml.indexOf("gml:id=\"");
- while (start != -1) {
- end = stringXml.substring(start + 8).indexOf("\"");
- String coverageId = stringXml.substring(start + 8, start + 8 + end);
-
- stringXml = stringXml.substring(start + 8 + end + 1);
- start = stringXml.indexOf("gml:id=\"");
-
- // Describe "coverageId"
- if (meta.existsCoverageName(coverageId)) {
- Metadata cov = null;
-
- // Read in coverage metadata
- try {
- cov = meta.read(coverageId);
- } catch (Exception e) {
- e.printStackTrace();
-
- throw new NoApplicableCodeException("Metadata for coverage '" + coverageId + "' is not valid.");
- }
-
- // Analyze the grid components and their values
- Iterator<DomainElement> it = cov.getDomainIterator();
- Iterator<CellDomainElement> it2 = cov.getCellDomainIterator();
-
- low = "";
- high = "";
- axisLabels = "";
- while (it.hasNext() && it2.hasNext()) {
- DomainElement dom = it.next();
- CellDomainElement cell = it2.next();
-
- axisLabels += dom.getName() + " ";
- low += cell.getLo() + " ";
- high += cell.getHi() + " ";
- }
-
- // Build the range components data structure
- Iterator<RangeElement> it3 = cov.getRangeIterator();
- Iterator<String> nilIterator = cov.getNullSetIterator();
-
-
- rangeComponents = "";
- int i = -1;
- while (it3.hasNext()) {
- String component = rangeComponentTemplate;
- RangeElement range = it3.next();
- i++;
- String rangeId = "range-" + cov.getCoverageId() + "-" + range.getName();
-
- component = component.replaceAll("\\{rangeFieldId\\}", rangeId);
- component = component.replaceAll("\\{fieldName\\}", range.getName());
- component = component.replaceAll("\\{datatype\\}", DATATYPE_URN_PREFIX + range.getType());
-
- // Compute the null values for this range field
- Set<String> nullVals = new HashSet<String>();
- Iterator<String> it4 = cov.getNullSetIterator();
- while (it4.hasNext()) {
- List<String> nilVal = SDU.str2string(it4.next());
- nullVals.add(nilVal.get(i));
- }
- StringBuffer nullValsString = new StringBuffer();
- it4 = nullVals.iterator();
- while (it4.hasNext()) {
- nullValsString.append(" " + it4.next());
- }
- component = component.replaceAll("\\{nilValues\\}", nullValsString.toString().substring(1));
-
- // And add this range field to the range structure
- rangeComponents += component;
- }
-
- desc = coverageDescriptionTemplate.replaceAll("\\{coverageId\\}", coverageId);
- gridId = "grid" + coverageId;
- desc = desc.replaceAll("\\{gridId\\}", gridId);
- gridDimension = String.valueOf(cov.getDimension());
- desc = desc.replaceAll("\\{gridDimension\\}", gridDimension);
- desc = desc.replaceAll("\\{low\\}", low);
- desc = desc.replaceAll("\\{high\\}", high);
- desc = desc.replaceAll("\\{axisLabels\\}", axisLabels);
- desc = desc.replaceAll("\\{rangeFields\\}", rangeComponents);
- desc = desc.replaceAll("\\{rangeStructureId\\}", "rangeStructure-" + coverageId);
- desc = desc.replaceAll("\\{supportedFormats\\}", listOfFormats);
-
- listOfCoverageDescriptions += desc;
- } else {
- throw new InvalidParameterValueException("gml:id");
- }
- }
-
- output = DescribeCoverageResponse.replaceAll("\\{listOfCoverageDescriptions\\}",
- listOfCoverageDescriptions);
-
- output = output.replaceAll("\\{wcsSchemaUrl\\}", ConfigManager.WCS2_SCHEMA_URL);
-
- return output;
- }
-}
diff --git a/petascope/src/petascope/wcs2/server/ops/GetCapabilities.java b/petascope/src/petascope/wcs2/server/ops/GetCapabilities.java
deleted file mode 100644
index b64d3f2..0000000
--- a/petascope/src/petascope/wcs2/server/ops/GetCapabilities.java
+++ /dev/null
@@ -1,85 +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.wcs2.server.ops;
-
-//~--- non-JDK imports --------------------------------------------------------
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import petascope.ConfigManager;
-
-import petascope.wcps.server.core.DbMetadataSource;
-import petascope.wcps.server.exceptions.ResourceException;
-
-//~--- JDK imports ------------------------------------------------------------
-
-import java.util.Iterator;
-import petascope.wcs.server.exceptions.InvalidServiceConfigurationException;
-
-/**
- * GetCapabilities operation for The Web Coverage Service 2.0
- *
- * @author Andrei Aiordachioaie
- */
-public class GetCapabilities implements WcsOperation {
-
- private static Logger LOG = LoggerFactory.getLogger(GetCapabilities.class);
- /* Template XMLs for response types */
- private String GetCapabilitiesResponse;
- private DbMetadataSource meta;
- /* Other useful vars */
- private String xmlListOfCoverages;
-
- public GetCapabilities(DbMetadataSource metadata) throws InvalidServiceConfigurationException {
- meta = metadata;
-
- GetCapabilitiesResponse = ConfigManager.WCS2_GET_CAPABILITIES_TEMPLATE;
- if (GetCapabilitiesResponse == null) {
- throw new InvalidServiceConfigurationException("Could not find template file.");
- }
- }
-
- @Override
- public String execute(String input) {
- String output;
-
- // Create the output by replacing placeholders
- output = GetCapabilitiesResponse.replaceAll("\\{URL\\}",
- ConfigManager.PETASCOPE_SERVLET_URL);
- Iterator<String> it;
-
- try {
- it = meta.coverages().iterator();
- xmlListOfCoverages = "";
- while (it.hasNext()) {
- xmlListOfCoverages += "<wcs:id gml:id=\"" + it.next() + "\"/>";
- }
- } catch (ResourceException ex) {
- ex.printStackTrace();
- }
- output = output.replaceAll("\\{Coverages\\}", xmlListOfCoverages);
- output = output.replaceAll("\\{wcsSchemaUrl\\}", ConfigManager.WCS2_SCHEMA_URL);
-
- return output;
- }
-}
diff --git a/petascope/src/petascope/wcs2/server/ops/GetCoverage.java b/petascope/src/petascope/wcs2/server/ops/GetCoverage.java
deleted file mode 100644
index a6ddcff..0000000
--- a/petascope/src/petascope/wcs2/server/ops/GetCoverage.java
+++ /dev/null
@@ -1,529 +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.wcs2.server.ops;
-
-//~--- non-JDK imports --------------------------------------------------------
-import org.apache.commons.io.IOUtils;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-import org.xml.sax.SAXException;
-
-import petascope.ConfigManager;
-
-import petascope.wcps.server.core.DbMetadataSource;
-import petascope.wcps.server.core.Metadata;
-
-import petascope.wcs.server.exceptions.WCSException;
-
-//~--- JDK imports ------------------------------------------------------------
-
-import java.io.IOException;
-
-import java.math.BigInteger;
-import java.util.HashSet;
-import java.util.Iterator;
-
-import java.util.List;
-import java.util.Set;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.xpath.XPath;
-import javax.xml.xpath.XPathConstants;
-import javax.xml.xpath.XPathExpressionException;
-import javax.xml.xpath.XPathFactory;
-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 rasj.RasGMArray;
-import rasj.RasImplementation;
-import petascope.wcps.server.core.CellDomainElement;
-import petascope.wcps.server.core.DomainElement;
-import petascope.wcps.server.core.RangeElement;
-import petascope.wcps.server.core.SDU;
-import petascope.wcs.server.exceptions.InputOutputException;
-import petascope.wcs.server.exceptions.InternalComponentException;
-import petascope.wcs.server.exceptions.InvalidParameterValueException;
-import petascope.wcs.server.exceptions.InvalidServiceConfigurationException;
-import petascope.wcs.server.exceptions.NoApplicableCodeException;
-import petascope.wcs.server.exceptions.WcsRuntimeException;
-import petascope.wcs.server.exceptions.XmlNotValidException;
-import petascope.wcs2.server.templates.WcsNamespaceContext;
-
-/**
- * Get Coverage operation for WCS 2.0
- *
- * @author Andrei Aiordachioaie
- */
-public class GetCoverage implements WcsOperation {
-
- private static Logger LOG = LoggerFactory.getLogger(GetCoverage.class);
- private DocumentBuilder builder = null;
- private XPathFactory xpathFactory = XPathFactory.newInstance();
- /* Template XMLs for response types */
- private String GetCoverageResponse;
- private String rangeComponentTemplate;
- /* Xml request */
- private Document doc;
- /* for Metadata */
- private DbMetadataSource meta;
- /* The new coverage domain */
- private String lowPoint, highPoint, newAxesLabels;
-
- public GetCoverage(DbMetadataSource metadata) throws WCSException {
- meta = metadata;
- GetCoverageResponse = ConfigManager.WCS2_GET_COVERAGE_TEMPLATE;
- if (GetCoverageResponse == null) {
- throw new InvalidServiceConfigurationException("Could not find template file.");
- }
-
- /* Find the RangeField template string */
- String starttag = "<gmlwcs:rangeField", endtag = "</gmlwcs:rangeField>";
- int start = GetCoverageResponse.indexOf(starttag);
- int end = GetCoverageResponse.indexOf(endtag);
- rangeComponentTemplate = GetCoverageResponse.substring(start, end + endtag.length());
- String newTemplate = GetCoverageResponse.substring(0, start - 1) + GetCoverageResponse.substring(end + endtag.length());
- GetCoverageResponse = newTemplate;
-
- /* init XML parser */
- DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance();
- domFactory.setNamespaceAware(true); // never forget this!
- try {
- builder = domFactory.newDocumentBuilder();
- } catch (Exception e) {
- throw new NoApplicableCodeException("Error initializing XML parser", e);
- }
- }
-
- @Override
- public String execute(String stringXml) throws WCSException {
- String output;
- Metadata cov;
-
- try {
- doc = builder.parse(IOUtils.toInputStream(stringXml));
- cov = readCoverageMetadata();
- } catch (SAXException e) {
- throw new XmlNotValidException("Could not parse input request.", e);
- } catch (IOException e) {
- throw new InputOutputException("Could not read input request", e);
- } catch (XPathExpressionException e) {
- throw new InternalComponentException("Invalid XPath expression", e);
- }
-
- // Analyze input and build trim/slice info structures
- String subsetting = computeRequestSubsettingLimits(cov);
- String coverageName = cov.getCoverageName();
-
- // Evaluate all bands and then perform string processing to get coverage data
- String coverageData = buildCoverageData(cov, subsetting);
-
- // Build response xml document
- output = buildOutputXml(coverageData, cov);
-
- return output;
- }
-
- private NodeList evalXPathList(String query, Object context) throws WCSException {
- try {
- LOG.debug("Evaluating XPath: {}", query);
- XPath xpath = xpathFactory.newXPath();
-
- xpath.setNamespaceContext(new WcsNamespaceContext());
- NodeList result = (NodeList) xpath.evaluate(query, context, XPathConstants.NODESET);
-
- for (int i = 0; i < result.getLength(); i++) {
- LOG.trace("Result {}: {}", i, result.item(i).getNodeValue());
- }
-
- return (NodeList) result;
- } catch (XPathExpressionException e) {
- LOG.error("Could not execute XPath expression '{}'", query);
-
- throw new WcsRuntimeException("Could not execute XPath expression", e);
- }
- }
-
- private String getCoverageName(Document doc) throws WCSException {
- NodeList nodes = evalXPathList("//wcs:id/@gml:id", doc);
-
- if (nodes.getLength() != 1) {
- LOG.error("Could not retrieve coverage name from XML document.");
-
- return null;
- }
-
- return nodes.item(0).getNodeValue();
- }
-
- private Metadata readCoverageMetadata() throws WCSException, XPathExpressionException {
- String coverageId = getCoverageName(doc);
-
- if (meta.existsCoverageName(coverageId)) {
- try {
- Metadata cov = meta.read(coverageId);
-
- return cov;
- } catch (Exception e) {
- e.printStackTrace();
-
- throw new NoApplicableCodeException("Metadata for coverage '"
- + coverageId + "' is not valid.");
- }
- } else {
- throw new InvalidParameterValueException("gml:id");
- }
- }
-
- /** Computes the domain of the new coverage, and returns a string that can be
- * used to do subsetting on the original coverage. Also computes the low, high
- * and the axis labels for the new coverage.
- *
- * @param coverage
- * @return
- * @throws WCSException
- */
- private String computeRequestSubsettingLimits(Metadata coverage) throws WCSException {
- int dims = coverage.getDimension(), i = 0;
- String[] limits = new String[dims];
- BigInteger[] high = new BigInteger[dims];
- BigInteger[] low = new BigInteger[dims];
- String[] axesLabels = new String[dims];
- boolean[] sliced = new boolean[dims];
- boolean[] trimmed = new boolean[dims];
-
- Iterator<CellDomainElement> it = coverage.getCellDomainIterator();
- Iterator<DomainElement> it2 = coverage.getDomainIterator();
- i = 0;
- while (it.hasNext() && it2.hasNext()) {
- CellDomainElement cell = it.next();
- DomainElement dom = it2.next();
- LOG.trace(cell.toString());
- LOG.trace(dom.toString());
- high[i] = cell.getHi();
- low[i] = cell.getLo();
- axesLabels[i] = dom.getName();
- limits[i] = low[i] + ":" + high[i];
- sliced[i] = false;
- trimmed[i] = false;
- i++;
- }
-
- NodeList list = null;
- int axisIndex;
- String axis, root;
- NodeList trims, slices;
-
- trims = evalXPathList("//wcs:trimDimension", doc);
- for (i = 0; i < trims.getLength(); i++) {
- Node trim = trims.item(i);
-
- list = evalXPathList("wcs:dimension/text()", trim);
- axis = list.item(0).getNodeValue();
- axisIndex = coverage.getDomainIndexByName(axis);
- if (axisIndex == -1) {
- throw new InvalidParameterValueException("dimension. Explanation: Unknown axis: " + axis);
- }
- if (trimmed[axisIndex] || sliced[axisIndex]) {
- throw new NoApplicableCodeException("Already performed one subsetting operation on axis: " + axis);
- }
-
- list = evalXPathList("wcs:trimLow/text()", trim);
- if (list.getLength() > 0) {
- try {
- long val = Long.parseLong(list.item(0).getNodeValue());
- low[axisIndex] = BigInteger.valueOf(val);
- } catch (NumberFormatException e) {
- throw new InvalidParameterValueException("trimLow. Explanation: invalid integer number: " + list.item(0).getNodeValue());
- }
- }
- list = evalXPathList("wcs:trimHigh/text()", trim);
- if (list.getLength() > 0) {
- try {
- long val = Long.parseLong(list.item(0).getNodeValue());
- high[axisIndex] = BigInteger.valueOf(val);
- } catch (NumberFormatException e) {
- throw new InvalidParameterValueException("trimHigh. Explanation: invalid integer number: " + list.item(0).getNodeValue());
- }
- }
-
- trimmed[axisIndex] = true;
- limits[axisIndex] = low[axisIndex] + ":" + high[axisIndex];
- LOG.debug("New limits for axis {}: {}", axis, limits[axisIndex]);
- }
-
- slices = evalXPathList("//wcs:sliceDimension", doc);
- for (i = 0; i < slices.getLength(); i++) {
- Node slice = slices.item(i);
-
- list = evalXPathList("wcs:dimension/text()", slice);
- axis = list.item(0).getNodeValue();
- axisIndex = coverage.getDomainIndexByName(axis);
- if (axisIndex == -1) {
- throw new InvalidParameterValueException("dimension. Explanation: Unknown axis name: " + axis);
- }
- if (trimmed[axisIndex] || sliced[axisIndex]) {
- throw new NoApplicableCodeException("Already performed one subsetting operation on axis: " + axis);
- }
-
- list = evalXPathList("wcs:slicePoint/text()", slice);
- if (list.getLength() > 0) {
- try {
- long point = Long.parseLong(list.item(0).getNodeValue());
- low[axisIndex] = BigInteger.valueOf(point);
- } catch (NumberFormatException e) {
- throw new InvalidParameterValueException("slicePoint. Explanation: invalid integer number: " + list.item(0).getNodeValue());
- }
- high[axisIndex] = low[axisIndex];
- limits[axisIndex] = list.item(0).getNodeValue();
- }
-
- sliced[axisIndex] = true;
- LOG.debug("New limits for axis {}: {}", axis, limits[axisIndex]);
- }
-
- // Compute the lowest, highest point and the labels
- lowPoint = "";
- highPoint = "";
- newAxesLabels = "";
- int first = 0;
- for (i = 0; i < dims; i++) {
- if (sliced[i] == false) {
- if (first == 0) {
- lowPoint = low[i].toString();
- highPoint = high[i].toString();
- newAxesLabels = axesLabels[i];
- first++;
- } else {
- lowPoint += " " + low[i];
- highPoint += " " + high[i];
- newAxesLabels += " " + axesLabels[i];
- }
- }
- }
-
- // Concatenate all limits into a single string
- String result = limits[0];
-
- for (i = 1; i < dims; i++) {
- result += ", " + limits[i];
- }
-
- return result;
- }
-
- public String executeRasqlQuery(String query) throws WCSException {
- byte[] result = null;
-
- Implementation impl = new RasImplementation(ConfigManager.RASDAMAN_URL);
- Database db = impl.newDatabase();
-
- try {
- db.open(ConfigManager.RASDAMAN_DATABASE, Database.OPEN_READ_ONLY);
- } catch (ODMGException odmge) {
- try {
- db.close();
- } catch (ODMGException e) {
- }
-
- throw new InternalComponentException("Could not connect to rasdaman server at " + ConfigManager.RASDAMAN_URL + ", database " + ConfigManager.RASDAMAN_DATABASE, odmge);
- }
-
- Transaction tr = impl.newTransaction();
-
- tr.begin();
- OQLQuery q = impl.newOQLQuery();
- DBag resultSet;
-
- try {
- q.create(query);
- resultSet = (DBag) q.execute();
-
- if (resultSet != null) {
- Iterator resultIterator = resultSet.iterator();
-
- if (resultIterator.hasNext()) {
- Object current = resultIterator.next();
-
- try {
- RasGMArray resultArray = (RasGMArray) current;
- result = resultArray.getArray();
- } catch (ClassCastException e) {
- LOG.error("result=" + current.toString());
- result = current.toString().getBytes();
- }
- }
- }
- } catch (QueryException qe) {
- tr.commit();
-
- try {
- db.close();
- } catch (ODMGException odmge) {
- }
-
- throw new InternalComponentException("Could not evaluate rasdaman query: '" + query + "'. Cause: " + qe.getMessage(), qe);
- }
-
- tr.commit();
-
- try {
- db.close();
- } catch (ODMGException odmge) {
- }
-
- return new String(result);
- }
-
- /** Creates a string with the contents of the GetCoverage response XML */
- private String buildOutputXml(String coverageData, Metadata coverage) {
- String xml = GetCoverageResponse;
- xml = xml.replaceAll("\\{coverageId\\}", coverage.getCoverageName() + Math.random());
- xml = xml.replaceAll("\\{gridDimension\\}", String.valueOf(coverage.getDimension()));
- xml = xml.replaceAll("\\{gridId\\}", "grid-" + coverage.getCoverageName());
- // low
- xml = xml.replaceAll("\\{low\\}", lowPoint);
- // high
- xml = xml.replaceAll("\\{high\\}", highPoint);
- // axisLabels
- xml = xml.replaceAll("\\{axisLabels\\}", newAxesLabels);
- // coverageData
- xml = xml.replaceAll("\\{coverageData\\}", coverageData);
-
-
-
- // Build the range structure
- Iterator<RangeElement> it3 = coverage.getRangeIterator();
- int i = -1;
- String rangeComponents = "";
- while (it3.hasNext()) {
- String component = rangeComponentTemplate;
- RangeElement range = it3.next();
- i++;
- String rangeId = "range-" + coverage.getCoverageId() + "-" + range.getName();
- LOG.trace(range.toString());
-
- component = component.replaceAll("\\{rangeFieldId\\}", rangeId);
- component = component.replaceAll("\\{fieldName\\}", range.getName());
- component = component.replaceAll("\\{datatype\\}", DescribeCoverage.DATATYPE_URN_PREFIX + range.getType());
-
- // Compute the null values for this range field
- Set<String> nullVals = new HashSet<String>();
- Iterator<String> it = coverage.getNullSetIterator();
- while (it.hasNext()) {
- List<String> nilVal = SDU.str2string(it.next());
- nullVals.add(nilVal.get(i));
- }
- StringBuffer nullValsString = new StringBuffer();
- it = nullVals.iterator();
- while (it.hasNext()) {
- nullValsString.append(" " + it.next());
- }
- component = component.replaceAll("\\{nilValues\\}", nullValsString.toString().substring(1));
-
- // And add this range field to the range structure
- rangeComponents += component;
- }
-
- xml = xml.replaceAll("\\{rangeFields\\}", rangeComponents);
- xml = xml.replaceAll("\\{rangeStructureId\\}", "rangeStructure-" + coverage.getCoverageId());
-
- xml = xml.replaceAll("\\{wcsSchemaUrl\\}", ConfigManager.WCS2_SCHEMA_URL);
-
- return xml;
- }
-
- /**
- * Retrieve the coverage data for a multi-band coverage,
- * with particular subsetting parameters.
- * @param coverage metadata for the coverage we want
- * @param subsetting subsetting string, to be used in the RasQL query
- * @return a string of space-separated values, where various bands of one
- * pixel are comma-separated. For example, the string "1,2 3,4 5,6" can
- * be the coverage data of a 1-by-3 coverage, with two bands
- */
- private String buildCoverageData(Metadata coverage, String subsetting) throws WCSException {
- String coverageName = coverage.getCoverageName();
- Iterator<RangeElement> it = coverage.getRangeIterator();
- int bandcount = 0;
- while (it.hasNext()) {
- it.next();
- bandcount++;
- }
- LOG.debug("Coverage {} has {} bands", coverageName, bandcount);
- String[][] pixels = new String[bandcount][];
- String currentBand = "";
- /* For all bands of the coverage, execute a rasql query */
- for (int band = 0; band < bandcount; band++) {
- LOG.trace("Processing band {}", band);
- // Construct rasql query
- currentBand = "." + band;
- // If this is a one-band image, then band-subsetting would result in an error
- if (bandcount == 1) {
- currentBand = "";
- }
- String rasqlQuery = "select csv(cov[" + subsetting + "]" + currentBand + ") "
- + "from " + coverageName + " as cov";
-
- // Execute RasQl query => coverage data
- LOG.trace("Executing query {}", rasqlQuery);
- String output = executeRasqlQuery(rasqlQuery);
-
- // Remove the curly braces from the rasql output
- LOG.trace("Removing curly braces...");
- output = output.replaceAll("\\{", "");
- output = output.replaceAll("\\}", "");
-
- // Tokenize the input to get the pixel values of the current band
- LOG.trace("Splitting values with comma...");
- pixels[band] = output.split(",");
-
- LOG.trace("Done processing band {}.", band);
- }
-
- /* Combine all bands into one single string */
- int pixelcount = pixels[0].length;
- StringBuilder data = new StringBuilder(pixelcount * bandcount);
- LOG.debug("Going to combine {} pixels with {} bands...", pixelcount, bandcount);
- for (int pix = 0; pix < pixelcount; pix++) {
- if (pixelcount > 20 && pix % (pixelcount / 20) == 0) {
- LOG.debug("Processing Pixel {} of " + pixelcount + " - {}%", pix, pix * 100 / (pixelcount - 1));
- }
- for (int b = 0; b < bandcount - 1; b++) {
- data.append(pixels[b][pix] + ",");
- }
- data.append(pixels[bandcount - 1][pix]);
- data.append(" ");
- }
- return data.substring(0, data.length() - 2);
- }
-}
diff --git a/petascope/src/petascope/wcs2/server/ops/WcsOperation.java b/petascope/src/petascope/wcs2/server/ops/WcsOperation.java
deleted file mode 100644
index 1ad8eae..0000000
--- a/petascope/src/petascope/wcs2/server/ops/WcsOperation.java
+++ /dev/null
@@ -1,36 +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.wcs2.server.ops;
-
-//~--- non-JDK imports --------------------------------------------------------
-import petascope.wcs.server.exceptions.WCSException;
-
-/**
- * Interface for all WCS Operations.
- * @author Andrei Aiordachioaie
- */
-public interface WcsOperation {
-
- /** Execute the operation */
- public String execute(String input) throws WCSException;
-}
diff --git a/petascope/src/petascope/wcs2/server/templates/DescribeCoverageTemplate.xml b/petascope/src/petascope/wcs2/server/templates/DescribeCoverageTemplate.xml
deleted file mode 100644
index c431723..0000000
--- a/petascope/src/petascope/wcs2/server/templates/DescribeCoverageTemplate.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<wcs:CoverageDescriptions xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
- xmlns:gmlwcs='http://www.opengis.net/wcs/2.0/gml'
- xmlns:gml='http://www.opengis.net/gml/3.2'
- xmlns:wcs='http://www.opengis.net/wcs/2.0'
- xmlns='http://www.opengis.net/gml/3.2'
- xsi:schemaLocation='http://www.opengis.net/wcs/2.0 {wcsSchemaUrl}/wcsAll.xsd'>
- {listOfCoverageDescriptions}
- <wcs:CoverageDescription gml:id="{coverageId}">
- <domainSet>
- <Grid dimension="{gridDimension}" gml:id="{gridId}">
- <limits>
- <GridEnvelope>
- <low>{low}</low>
- <high>{high}</high>
- </GridEnvelope>
- </limits>
- <axisLabels>{axisLabels}</axisLabels>
- </Grid>
- </domainSet>
- <gmlwcs:rangeStructure>
- <gmlwcs:RangeStructure gml:id="{rangeStructureId}">
- {rangeFields}
- <gmlwcs:rangeField>
- <gmlwcs:RangeField gml:id="{rangeFieldId}">
- <gml:name>{fieldName}</gml:name>
- <gmlwcs:dataType>{datatype}</gmlwcs:dataType>
- <gmlwcs:nilValueList>{nilValues}</gmlwcs:nilValueList>
- </gmlwcs:RangeField>
- </gmlwcs:rangeField>
- </gmlwcs:RangeStructure>
- </gmlwcs:rangeStructure>
- <wcs:ServiceParameters>
- <wcs:supportedCrsList/>
- <wcs:supportedFormatList>{supportedFormats}</wcs:supportedFormatList>
- </wcs:ServiceParameters>
- </wcs:CoverageDescription>
-</wcs:CoverageDescriptions>
diff --git a/petascope/src/petascope/wcs2/server/templates/GetCapabilitiesTemplate.xml b/petascope/src/petascope/wcs2/server/templates/GetCapabilitiesTemplate.xml
deleted file mode 100644
index 86631bf..0000000
--- a/petascope/src/petascope/wcs2/server/templates/GetCapabilitiesTemplate.xml
+++ /dev/null
@@ -1,92 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<wcs:Capabilities xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
- xmlns:ows='http://www.opengis.net/ows/1.1'
- xmlns:wcs='http://www.opengis.net/wcs/2.0'
- xmlns:gml='http://www.opengis.net/gml/3.2'
- xmlns='http://www.opengis.net/ows/1.1'
- xmlns:xlink='http://www.w3.org/1999/xlink'
- xsi:schemaLocation='http://www.opengis.net/wcs/2.0 {wcsSchemaUrl}/wcsAll.xsd' version="2.0.0">
- <ServiceIdentification>
- <Title>WCS 2.0 Coverage Server @ Jacobs University</Title>
- <Abstract>WCS 2.0 Server developed at jacobs University</Abstract>
- <ServiceType>OGC WCS</ServiceType>
- <ServiceTypeVersion>2.0.0</ServiceTypeVersion>
- <Profile>urn:ogc:def:extension:OGC-WCS:2.0:protocol:post</Profile>
- <Profile>urn:ogc:def:extension:OGC-WCS:2.0:serviceModel:wcps:1.0</Profile>
- <Profile>urn:ogc:def:extension:OGC-WCS:2.0:serviceModel:wcst:1.0</Profile>
- </ServiceIdentification>
- <ServiceProvider>
- <ProviderName>Jacobs University Bremen</ProviderName>
- <ows:ProviderSite xlink:href="http://www.petascope.org/"/>
- <ServiceContact>
- <ows:IndividualName>Prof. Dr. Peter Baumann</ows:IndividualName>
- <ows:ContactInfo>
- <ows:Address>
- <ows:City>Bremen</ows:City>
- <ows:PostalCode>28717</ows:PostalCode>
- <ows:Country>Germany</ows:Country>
- <ows:ElectronicMailAddress>p.baumann@jacobs-university.de</ows:ElectronicMailAddress>
- </ows:Address>
- </ows:ContactInfo>
- <ows:Role>Project Leader</ows:Role>
- </ServiceContact>
- </ServiceProvider>
- <OperationsMetadata>
- <Operation name="GetCapabilities">
- <DCP>
- <HTTP>
- <Get xlink:href="{URL}"/>
- </HTTP>
- </DCP>
- <Parameter name="Format">
- <AllowedValues>
- <Value>text/xml</Value>
- </AllowedValues>
- </Parameter>
- <Constraint name="PostEncoding">
- <AllowedValues>
- <Value>XML</Value>
- </AllowedValues>
- </Constraint>
- </Operation>
- <Operation name="DescribeCoverage">
- <DCP>
- <HTTP>
- <Get xlink:href="{URL}"/>
- </HTTP>
- </DCP>
- <Parameter name="Format">
- <AllowedValues>
- <Value>text/xml</Value>
- </AllowedValues>
- </Parameter>
- <Constraint name="PostEncoding">
- <AllowedValues>
- <Value>XML</Value>
- </AllowedValues>
- </Constraint>
- </Operation>
- <Operation name="GetCoverage">
- <DCP>
- <HTTP>
- <Get xlink:href="{URL}"/>
- </HTTP>
- </DCP>
- <Parameter name="Format">
- <AllowedValues>
- <Value>text/xml</Value>
- </AllowedValues>
- </Parameter>
- <Constraint name="PostEncoding">
- <AllowedValues>
- <Value>XML</Value>
- </AllowedValues>
- </Constraint>
- </Operation>
- </OperationsMetadata>
- <wcs:Contents>
- {Coverages}
- </wcs:Contents>
- <wcs:WcsServiceMetadata />
-
-</wcs:Capabilities>
diff --git a/petascope/src/petascope/wcs2/server/templates/GetCoverageTemplate.xml b/petascope/src/petascope/wcs2/server/templates/GetCoverageTemplate.xml
deleted file mode 100644
index 9b76cc9..0000000
--- a/petascope/src/petascope/wcs2/server/templates/GetCoverageTemplate.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<gmlwcs:GridCoverage xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
- xmlns:gml='http://www.opengis.net/gml/3.2'
- xmlns='http://www.opengis.net/gml/3.2'
- xmlns:gmlwcs='http://www.opengis.net/wcs/2.0/gml'
- xsi:schemaLocation='http://www.opengis.net/wcs/2.0/gml {wcsSchemaUrl}/gml/gmlwcsAll.xsd' gml:id="{coverageId}">
- <domainSet>
- <Grid dimension="{gridDimension}" gml:id="{gridId}">
- <limits>
- <GridEnvelope>
- <low>{low}</low>
- <high>{high}</high>
- </GridEnvelope>
- </limits>
- <axisLabels>{axisLabels}</axisLabels>
- </Grid>
- </domainSet>
- <rangeSet>
- <DataBlock>
- <rangeParameters/>
- <tupleList>
- {coverageData}
- </tupleList>
- </DataBlock>
- </rangeSet>
- <gmlwcs:rangeStructure>
- <gmlwcs:RangeStructure gml:id="{rangeStructureId}">
- {rangeFields}
- <gmlwcs:rangeField>
- <gmlwcs:RangeField gml:id="{rangeFieldId}">
- <gml:name>{fieldName}</gml:name>
- <gmlwcs:dataType>{datatype}</gmlwcs:dataType>
- <gmlwcs:nilValueList>{nilValues}</gmlwcs:nilValueList>
- </gmlwcs:RangeField>
- </gmlwcs:rangeField>
- </gmlwcs:RangeStructure>
- </gmlwcs:rangeStructure>
-</gmlwcs:GridCoverage>
diff --git a/petascope/src/petascope/wcs2/server/templates/WcsNamespaceContext.java b/petascope/src/petascope/wcs2/server/templates/WcsNamespaceContext.java
deleted file mode 100644
index 1f713e4..0000000
--- a/petascope/src/petascope/wcs2/server/templates/WcsNamespaceContext.java
+++ /dev/null
@@ -1,59 +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.wcs2.server.templates;
-
-import java.util.Iterator;
-import javax.xml.XMLConstants;
-import javax.xml.namespace.NamespaceContext;
-
-/**
- *
- * @author Andrei Aiordachioaie
- */
-public class WcsNamespaceContext implements NamespaceContext {
-
- @Override
- public String getNamespaceURI(String prefix) {
- if (prefix == null) {
- throw new NullPointerException("Null prefix");
- } else if ("wcs".equals(prefix)) {
- return "http://www.opengis.net/wcs/2.0";
- } else if ("gml".equals(prefix)) {
- return "http://www.opengis.net/gml/3.2";
- }
-
- return XMLConstants.NULL_NS_URI;
- }
-
- // This method isn't necessary for XPath processing.
- @Override
- public String getPrefix(String uri) {
- throw new UnsupportedOperationException();
- }
-
- // This method isn't necessary for XPath processing either.
- @Override
- public Iterator getPrefixes(String uri) {
- throw new UnsupportedOperationException();
- }
-}
diff --git a/petascope/src/petascope/wcst/server/WcstServer.java b/petascope/src/petascope/wcst/server/WcstServer.java
index fc2cb9e..13a5ff7 100644
--- a/petascope/src/petascope/wcst/server/WcstServer.java
+++ b/petascope/src/petascope/wcst/server/WcstServer.java
@@ -14,33 +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.wcst.server;
-//~--- non-JDK imports --------------------------------------------------------
import petascope.ConfigManager;
import net.opengis.ows.v_1_0_0.ExceptionReport;
-
+import petascope.exceptions.PetascopeException;
+import petascope.exceptions.RasdamanException;
+import petascope.exceptions.WCPSException;
+import petascope.exceptions.WCSTException;
import petascope.wcst.transaction.ServiceFirewall;
import petascope.wcst.transaction.executeAsyncTransaction;
import petascope.wcst.transaction.executeTransaction;
import wcst.transaction.schema.AcknowledgementType;
import wcst.transaction.schema.TransactionResponseType;
import wcst.transaction.schema.TransactionType;
-
-//~--- JDK imports ------------------------------------------------------------
-
import java.io.StringReader;
import java.io.StringWriter;
-
import java.util.Date;
import java.util.GregorianCalendar;
-
import javax.xml.XMLConstants;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBElement;
@@ -56,11 +52,9 @@ import javax.xml.stream.XMLStreamWriter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import petascope.PetascopeXmlNamespaceMapper;
-import petascope.wcps.server.core.DbMetadataSource;
-import petascope.wcs.server.exceptions.InvalidPropertyValueException;
-import petascope.wcs.server.exceptions.MaliciousQueryException;
-import petascope.wcs.server.exceptions.WCSException;
-import petascope.wcs.server.exceptions.XmlStructuresException;
+import petascope.core.DbMetadataSource;
+import petascope.exceptions.WCSException;
+import petascope.exceptions.ExceptionCode;
/**
* The Web Coverage Service, with the Transactional extension (WcstServer)
@@ -69,7 +63,7 @@ import petascope.wcs.server.exceptions.XmlStructuresException;
*/
public class WcstServer {
- private static Logger LOG = LoggerFactory.getLogger(WcstServer.class);
+ private static Logger log = LoggerFactory.getLogger(WcstServer.class);
private static Boolean finished;
private boolean synchronous = true;
private String responseHandler;
@@ -85,22 +79,22 @@ public class WcstServer {
/* Check user settings */
String cfg = ConfigManager.WCST_DEFAULT_DATATYPE;
if (source.getDataTypes().contains(cfg) == false) {
- throw new InvalidPropertyValueException("The following setting is not a valid datatype: " + cfg);
+ throw new WCSException(ExceptionCode.InvalidPropertyValue, "The following setting is not a valid datatype: " + cfg);
}
cfg = ConfigManager.WCST_DEFAULT_INTERPOLATION;
if (source.getInterpolationTypes().contains(cfg) == false) {
- throw new InvalidPropertyValueException("The following setting is not a valid interpolation method: " + cfg);
+ throw new WCSException(ExceptionCode.InvalidPropertyValue, "The following setting is not a valid interpolation method: " + cfg);
}
cfg = ConfigManager.WCST_DEFAULT_NULL_RESISTANCE;
if (source.getNullResistances().contains(cfg) == false) {
- throw new InvalidPropertyValueException("The following setting is not a valid null resistance: " + cfg);
+ throw new WCSException(ExceptionCode.InvalidPropertyValue, "The following setting is not a valid null resistance: " + cfg);
}
}
/**
* Web service operation
*/
- public String Transaction(String stringXml) {
+ public String Transaction(String stringXml) throws WCSTException, RasdamanException, WCPSException, PetascopeException {
// Actual contents of these two strings do not matter
String output = "Default output. ";
String errmsg = "No error. ";
@@ -110,12 +104,12 @@ public class WcstServer {
try {
// Check if Firewall allows the query
if (ServiceFirewall.reject(stringXml)) {
- throw new MaliciousQueryException("WCS-T Service Firewall "
+ throw new WCSException(ExceptionCode.MaliciousQuery, "WCS-T Service Firewall "
+ "refused to run possibly malitious query.");
}
// read the input XML
- LOG.debug("Reading the input XML file ... ");
+ log.debug("Reading the input XML file ... ");
JAXBContext context = JAXBContext.newInstance(
TransactionType.class.getPackage().getName());
Unmarshaller unmarshaller = context.createUnmarshaller();
@@ -149,7 +143,8 @@ public class WcstServer {
/** Synchronous operation */
if (synchronous == true) {
- TransactionResponseType response = exec.get();
+ TransactionResponseType response = null;
+ exec.get();
JAXBElement jaxbOutput =
new JAXBElement(
new QName("http://www.opengis.net/wcs/1.1/wcst",
@@ -157,7 +152,7 @@ public class WcstServer {
TransactionResponseType.class, response);
// Write the output xml to a string
- LOG.debug("Marshalling with context: " + response.getClass().getPackage().getName());
+ log.debug("Marshalling with context: " + response.getClass().getPackage().getName());
final StringWriter writer = new StringWriter();
try {
context = JAXBContext.newInstance(response.getClass());
@@ -173,7 +168,7 @@ public class WcstServer {
throw new RuntimeException(e.getMessage(), e);
}
output = writer.toString();
- LOG.debug("Done! User has the TransactionResponse result !");
+ log.debug("Done! User has the TransactionResponse result !");
} else /** Asynchronous operation */
{
/* (1) Create acknowledgement that we received the request */
@@ -200,8 +195,8 @@ public class WcstServer {
marshaller.marshal(jaxbOutput, strWriter);
output = strWriter.toString();
- LOG.debug("Created the acknowledgement of the request !");
- LOG.debug("Now starting to asynchronously execute the transaction...");
+ log.debug("Created the acknowledgement of the request !");
+ log.debug("Now starting to asynchronously execute the transaction...");
/* (3) Start asynchronous processing */
executeAsyncTransaction execAsync = new executeAsyncTransaction(exec,
@@ -212,12 +207,12 @@ public class WcstServer {
finished = true;
} catch (JAXBException e) {
- throw new XmlStructuresException("Could not marshall/unmarshall XML structures.", e);
+ throw new WCSException(ExceptionCode.XmlStructuresError, "Could not marshall/unmarshall XML structures.", e);
} catch (DatatypeConfigurationException e) {
- throw new XmlStructuresException("Could not build request acknowledgement. ", e);
+ throw new WCSException(ExceptionCode.XmlStructuresError, "Could not build request acknowledgement. ", e);
}
} catch (WCSException e) {
- LOG.info("Caught WCST Exception");
+ log.info("Caught WCST Exception");
ExceptionReport report = e.getReport();
try {
@@ -232,12 +227,12 @@ public class WcstServer {
marshaller.marshal(report, strWriter);
output = strWriter.toString();
finished = true;
- LOG.error("WCS-T Exception: " + e.getErrorCode() + ", with message '"
- + e.getErrorDetail() + "'");
- LOG.debug("Done with the Error Report !");
+ log.error("WCS-T Exception: " + e.getExceptionCode() + ", with message '"
+ + e.getExceptionText() + "'");
+ log.debug("Done with the Error Report !");
} catch (JAXBException e2) {
errmsg = e2.getMessage();
- LOG.error("Could not build XML error report. Stack trace: " + e2);
+ log.error("Could not build XML error report. Stack trace: " + e2);
}
}
diff --git a/petascope/src/petascope/wcst/server/servlet/wcstServlet.java b/petascope/src/petascope/wcst/server/servlet/wcstServlet.java
index 17850a0..fbef25e 100644
--- a/petascope/src/petascope/wcst/server/servlet/wcstServlet.java
+++ b/petascope/src/petascope/wcst/server/servlet/wcstServlet.java
@@ -14,32 +14,26 @@
* 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.wcst.server.servlet;
-//~--- non-JDK imports --------------------------------------------------------
import petascope.wcst.server.*;
import petascope.ConfigManager;
import org.apache.commons.io.FileUtils;
-
-//~--- JDK imports ------------------------------------------------------------
-
import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
-
-
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import petascope.wcps.server.core.DbMetadataSource;
-import petascope.wcs.server.exceptions.WCSException;
+import petascope.core.DbMetadataSource;
+import petascope.exceptions.WCSException;
+import petascope.exceptions.ExceptionCode;
/** Servlet interface for the WCS-Transactional server.
*
diff --git a/petascope/src/petascope/wcst/transaction/ServiceFirewall.java b/petascope/src/petascope/wcst/transaction/ServiceFirewall.java
index f8cd6aa..28d64e3 100644
--- a/petascope/src/petascope/wcst/transaction/ServiceFirewall.java
+++ b/petascope/src/petascope/wcst/transaction/ServiceFirewall.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.wcst.transaction;
+
/** Firewall class for WCS-T. It's job is to detect malitious queries and reject them.
* Currently, it only checks that queries do not occur too often.
*
diff --git a/petascope/src/petascope/wcst/transaction/executeAsyncTransaction.java b/petascope/src/petascope/wcst/transaction/executeAsyncTransaction.java
index b1f2766..6583208 100644
--- a/petascope/src/petascope/wcst/transaction/executeAsyncTransaction.java
+++ b/petascope/src/petascope/wcst/transaction/executeAsyncTransaction.java
@@ -14,8 +14,7 @@
* 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>.
@@ -29,6 +28,7 @@ import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLEncoder;
+import java.util.logging.Level;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.JAXBException;
@@ -37,10 +37,11 @@ import javax.xml.namespace.QName;
import net.opengis.ows.v_1_0_0.ExceptionReport;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import petascope.wcs.server.exceptions.BadResponseHandlerException;
-import petascope.wcs.server.exceptions.InputOutputException;
-import petascope.wcs.server.exceptions.WCSException;
-import petascope.wcs.server.exceptions.XmlStructuresException;
+import petascope.exceptions.PetascopeException;
+import petascope.exceptions.WCPSException;
+import petascope.exceptions.WCSException;
+import petascope.exceptions.ExceptionCode;
+import petascope.exceptions.WCSTException;
import wcst.transaction.schema.TransactionResponseType;
/**
@@ -50,7 +51,7 @@ import wcst.transaction.schema.TransactionResponseType;
*/
public class executeAsyncTransaction extends Thread {
- private static Logger LOG = LoggerFactory.getLogger(executeAsyncTransaction.class);
+ private static Logger log = LoggerFactory.getLogger(executeAsyncTransaction.class);
private String responseHandler;
private executeTransaction exec;
@@ -66,18 +67,23 @@ public class executeAsyncTransaction extends Thread {
/** Run the current thread. */
public void run() {
- LOG.info("Started async thread...");
+ log.info("Started async thread...");
String outString = null;
try // only for WCSException
{
try {
/* (1) Do the actual processing of the Transaction */
- LOG.debug("Starting async execution ...");
- TransactionResponseType output = exec.get();
+ log.debug("Starting async execution ...");
+ TransactionResponseType output;
+ try {
+ output = exec.get();
+ } catch (Exception ex) {
+ throw new RuntimeException("Error executing transaction", ex);
+ }
JAXBElement jaxbOutput = new JAXBElement(new QName("", "TransactionResponse"), TransactionResponseType.class, output);
/* (2) Marshall the output XML into a String */
- LOG.debug("Marshalling transaction response into a string ...");
+ log.debug("Marshalling transaction response into a string ...");
JAXBContext jaxbCtx = JAXBContext.newInstance(output.getClass().getPackage().getName());
Marshaller marshaller = jaxbCtx.createMarshaller();
marshaller.setProperty(Marshaller.JAXB_ENCODING, "UTF-8"); //NOI18N
@@ -90,17 +96,17 @@ public class executeAsyncTransaction extends Thread {
/* (3) Send the output to the destination response handler */
sendPostRequest(outString, responseHandler);
} catch (MalformedURLException ex) {
- LOG.error("Stack trace: " + ex);
- throw new BadResponseHandlerException("Response Handler URL is malformed.");
+ log.error("Stack trace: " + ex);
+ throw new WCSException(ExceptionCode.BadResponseHandler, "Response Handler URL is malformed.", ex);
} catch (IOException ex) {
- LOG.error("Stack trace: " + ex);
- throw new InputOutputException("Could not send asynchronous response to URL: " + responseHandler);
+ log.error("Stack trace: " + ex);
+ throw new WCSException(ExceptionCode.IOConnectionError, "Could not send asynchronous response to URL: " + responseHandler);
} catch (JAXBException ex) {
- LOG.error("Stack trace: " + ex);
- throw new XmlStructuresException("Could not marshall the XML to a string !");
+ log.error("Stack trace: " + ex);
+ throw new WCSException(ExceptionCode.XmlStructuresError, "Could not marshall the XML to a string !");
}
} catch (WCSException e) {
- LOG.error("Caught WCS Exception: " + e);
+ log.error("Caught WCS Exception: " + e);
ExceptionReport report = e.getReport();
try {
/* Build the error report */
@@ -111,14 +117,14 @@ public class executeAsyncTransaction extends Thread {
StringWriter strWriter = new StringWriter();
marshaller.marshal(report, strWriter);
outString = strWriter.toString();
- LOG.trace("Done with the Error Report !");
+ log.trace("Done with the Error Report !");
/* Send the error report to the responseHandler */
sendPostRequest(outString, responseHandler);
} catch (JAXBException e2) {
- LOG.error("Stack trace: " + e2);
+ log.error("Stack trace: " + e2);
} catch (IOException e2) {
- LOG.error("Stack trace: " + e2);
+ log.error("Stack trace: " + e2);
}
}
}
@@ -131,7 +137,7 @@ public class executeAsyncTransaction extends Thread {
* @throws IOException
*/
private void sendPostRequest(String content, String destinationUrl) throws MalformedURLException, IOException {
- LOG.debug("sendPostRequest() ... to URL: " + destinationUrl);
+ log.debug("sendPostRequest() ... to URL: " + destinationUrl);
// connect to the destination
URL servlet = new URL(destinationUrl);
@@ -158,6 +164,6 @@ public class executeAsyncTransaction extends Thread {
out.flush();
out.close();
- LOG.debug("Sent request to URL.");
+ log.debug("Sent request to URL.");
}
}
diff --git a/petascope/src/petascope/wcst/transaction/executeTransaction.java b/petascope/src/petascope/wcst/transaction/executeTransaction.java
index 7b42442..7c4fc63 100644
--- a/petascope/src/petascope/wcst/transaction/executeTransaction.java
+++ b/petascope/src/petascope/wcst/transaction/executeTransaction.java
@@ -14,15 +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.wcst.transaction;
-//~--- non-JDK imports --------------------------------------------------------
import java.sql.SQLException;
import net.opengis.ows.v_1_0_0.BoundingBoxType;
import net.opengis.wcs.ows.v_1_1_0.InterpolationMethodType;
@@ -31,25 +29,20 @@ import net.opengis.wcs.v_1_1_0.CoverageDescriptions;
import net.opengis.wcs.v_1_1_0.CoverageSummaryType;
import net.opengis.wcs.v_1_1_0.FieldType;
import net.opengis.wcs.v_1_1_0.RangeType;
-
import org.apache.commons.io.IOUtils;
-
+import petascope.exceptions.PetascopeException;
+import petascope.exceptions.RasdamanException;
+import petascope.exceptions.WCPSException;
import petascope.wcps.server.core.SDU;
-
-//~--- JDK imports ------------------------------------------------------------
-
import java.awt.image.BufferedImage;
-
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.StringReader;
-
import java.math.BigInteger;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
-
import java.security.InvalidParameterException;
import java.util.ArrayList;
import java.util.HashSet;
@@ -58,10 +51,7 @@ import java.util.List;
import java.util.Random;
import java.util.Set;
import java.util.UUID;
-
import javax.imageio.ImageIO;
-
-
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.Unmarshaller;
@@ -69,29 +59,15 @@ import net.opengis.wcs.ows.v_1_1_0.InterpolationMethods;
import org.odmg.ODMGException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import petascope.wcps.server.core.DbMetadataSource;
-import petascope.wcps.server.core.Metadata;
-import petascope.wcs.server.exceptions.WCSException;
+import petascope.core.DbMetadataSource;
+import petascope.core.Metadata;
+import petascope.exceptions.ExceptionCode;
import petascope.ConfigManager;
import petascope.wcps.server.core.CellDomainElement;
import petascope.wcps.server.core.DomainElement;
import petascope.wcps.server.core.InterpolationMethod;
-import petascope.wcps.server.exceptions.InvalidMetadataException;
-import petascope.wcps.server.exceptions.InvalidWcpsRequestException;
import petascope.wcps.server.core.RangeElement;
-import petascope.wcps.server.exceptions.ResourceException;
-import petascope.wcs.server.exceptions.ActionNotSupportedException;
-import petascope.wcs.server.exceptions.InputOutputException;
-import petascope.wcs.server.exceptions.InternalComponentException;
-import petascope.wcs.server.exceptions.InternalSqlException;
-import petascope.wcs.server.exceptions.InvalidParameterValueException;
-import petascope.wcs.server.exceptions.InvalidRequestException;
-import petascope.wcs.server.exceptions.MissingParameterValueException;
-import petascope.wcs.server.exceptions.MultiBandImagesNotSupportedException;
-import petascope.wcs.server.exceptions.NoApplicableCodeException;
-import petascope.wcs.server.exceptions.NodeParsingNotImplementedException;
-import petascope.wcs.server.exceptions.XmlNotValidException;
-import petascope.wcs.server.exceptions.XmlStructuresException;
+import petascope.exceptions.WCSTException;
import wcst.transaction.schema.CodeType;
import wcst.transaction.schema.CoverageType;
import wcst.transaction.schema.KeywordsType;
@@ -110,7 +86,7 @@ import petascope.wcst.transaction.tools.RasdamanUtils;
*/
public class executeTransaction {
- private static Logger LOG = LoggerFactory.getLogger(executeTransaction.class);
+ private static Logger log = LoggerFactory.getLogger(executeTransaction.class);
// private static boolean printLog = true;
private boolean finished;
private TransactionType input;
@@ -125,7 +101,7 @@ public class executeTransaction {
* @param tr Transaction object, a WCS-T request
* @param metadataDbPath Path to the "dbparams.properties" file
*/
- public executeTransaction(TransactionType tr, DbMetadataSource source) throws WCSException {
+ public executeTransaction(TransactionType tr, DbMetadataSource source) throws WCSTException, RasdamanException {
input = tr;
output = new TransactionResponseType();
finished = false;
@@ -156,19 +132,19 @@ public class executeTransaction {
* Main method of this class: Computes the response to the TransactionResponse
* request given to the constructor. If needed, it also calls <b>process()</b>
* @return a TransactionResponse object.
- * @throws WCSException
+ * @throws WCSTException
*/
- public TransactionResponseType get() throws WCSException {
+ public TransactionResponseType get() throws WCSTException, WCPSException, PetascopeException {
try {
if (finished == false) {
metaDb.ensureConnection();
process();
}
} catch (SQLException e) {
- throw new InternalSqlException("Could not ensure connection to database is valid", e);
+ throw new WCSTException(ExceptionCode.InternalSqlError, "Could not ensure connection to database is valid", e);
}
if (finished == false) {
- throw new NoApplicableCodeException("Could not execute the Transaction request! "
+ throw new WCSTException(ExceptionCode.NoApplicableCode, "Could not execute the Transaction request! "
+ "Please see the other errors...");
}
@@ -178,12 +154,12 @@ public class executeTransaction {
/**
* Computes the response to the Transaction request given to the constructor.
*/
- public void process() throws WCSException {
+ public void process() throws WCSTException, WCPSException, PetascopeException {
if (!input.getService().equalsIgnoreCase("WCS")) {
- throw new InvalidParameterValueException("Service. Explanation: Service must be \"WCS\" !");
+ throw new WCSTException(ExceptionCode.InvalidParameterValue, "Service. Explanation: Service must be \"WCS\" !");
}
if (!input.getVersion().equalsIgnoreCase("1.1")) {
- throw new InvalidParameterValueException("Service. Explanation: Service Version must be \"1.1\" !");
+ throw new WCSTException(ExceptionCode.InvalidParameterValue, "Service. Explanation: Service Version must be \"1.1\" !");
}
// Set the output request ID
@@ -212,43 +188,43 @@ public class executeTransaction {
/* Commit rasdaman changes */
try {
- LOG.debug("Commit rasdaman changes ...");
+ log.debug("Commit rasdaman changes ...");
rasUtils.commitAndClose();
- LOG.debug("Rasdaman coverages saved successfully !");
+ log.debug("Rasdaman coverages saved successfully !");
} catch (ODMGException e) {
- throw new InternalComponentException("Could not commit Rasdaman changes !", e);
+ throw new WCSTException(ExceptionCode.InternalComponentError, "Could not commit Rasdaman changes !", e);
}
/* Commit metadata changes */
try {
- LOG.debug("Commit metadata changes ...");
+ log.debug("Commit metadata changes ...");
metaDb.commitAndClose();
- LOG.debug("Metadata has been saved !");
+ log.debug("Metadata has been saved !");
} catch (SQLException e) {
- throw new InternalSqlException("Could not commit metadata changes", e);
+ throw new WCSTException(ExceptionCode.InternalSqlError, "Could not commit metadata changes", e);
}
- } catch (WCSException e) {
+ } catch (WCSTException e) {
// One action failed, therefore all actions have failed
/* Abort metadata changes */
finished = false;
try {
- LOG.debug("Rolling back metadata database changes ...");
+ log.debug("Rolling back metadata database changes ...");
metaDb.abortAndClose();
- LOG.debug("Metadata rollback completed!");
+ log.debug("Metadata rollback completed!");
} catch (SQLException ex) {
- LOG.error("Could not rollback metadata changes.");
- e.appendErrorDetail(" Could not rollback metadata changes!");
+ log.error("Could not rollback metadata changes.");
+ e.appendExceptionText(" Could not rollback metadata changes!");
}
/* Abort rasdaman changes */
try {
- LOG.debug("Aborting rasdaman changes ...");
+ log.debug("Aborting rasdaman changes ...");
rasUtils.abortAndClose();
- LOG.debug("Rasdaman changes aborted !");
+ log.debug("Rasdaman changes aborted !");
} catch (ODMGException ex) {
- LOG.error("Could not abort rasdaman changes.");
- e.appendErrorDetail(" Could not rollback rasdaman changes!");
+ log.error("Could not abort rasdaman changes.");
+ e.appendExceptionText(" Could not rollback rasdaman changes!");
}
throw e;
@@ -262,12 +238,12 @@ public class executeTransaction {
*/
private void deleteCoverageFromRasdaman(String identifier) throws Exception {
try {
- LOG.trace("Deleting coverage from Rasdaman ...");
+ log.trace("Deleting coverage from Rasdaman ...");
rasUtils.deleteCollection(identifier);
- LOG.trace("Rasdaman Collection '" + identifier + "' is now deleted !");
+ log.trace("Rasdaman Collection '" + identifier + "' is now deleted !");
} catch (ODMGException e) {
- LOG.error("Failed to delete rasdaman collection " + identifier);
- throw new InternalComponentException("Failed to delete collection from Rasdaman !", e);
+ log.error("Failed to delete rasdaman collection " + identifier);
+ throw new WCSTException(ExceptionCode.InternalComponentError, "Failed to delete collection from Rasdaman !", e);
}
}
@@ -278,14 +254,14 @@ public class executeTransaction {
* @param href The location of the pixels for the new image
*/
private void insertImageIntoRasdaman(String identifier, BufferedImage img)
- throws WCSException {
- LOG.trace("Inserting image into Rasdaman raster server...");
+ throws WCSTException, RasdamanException {
+ log.trace("Inserting image into Rasdaman raster server...");
try {
rasUtils.insertGrayImageAsArray(identifier, img);
- LOG.debug("Inserted image into Rasdaman !");
+ log.debug("Inserted image into Rasdaman !");
} catch (ODMGException e) {
- LOG.error("Could not insert image into Rasdaman !");
- throw new InternalComponentException("Could not insert image into Rasdaman.", e);
+ log.error("Could not insert image into Rasdaman !");
+ throw new WCSTException(ExceptionCode.InternalComponentError, "Could not insert image into Rasdaman.", e);
}
}
@@ -293,17 +269,17 @@ public class executeTransaction {
*
* @param pixels Reference object
* @return available image
- * @throws WCSException
+ * @throws WCSTException
*/
- private BufferedImage loadPixelsReference(ReferenceType pixels) throws WCSException {
+ private BufferedImage loadPixelsReference(ReferenceType pixels) throws WCSTException {
URL url = null;
BufferedImage img = null;
try {
url = new URL(pixels.getHref());
} catch (MalformedURLException e) {
- LOG.error("URL " + url.toString() + " is not valid.");
- throw new InvalidParameterValueException("Reference pixels. "
+ log.error("URL " + url.toString() + " is not valid.");
+ throw new WCSTException(ExceptionCode.InvalidParameterValue, "Reference pixels. "
+ "Explanation: URL " + url.toString() + " is not valid.");
}
@@ -313,8 +289,8 @@ public class executeTransaction {
throw new IOException("Empty stream while reading image.");
}
} catch (IOException e) {
- LOG.error(e.getMessage());
- throw new InputOutputException("Reference Pixels. Explanation: "
+ log.error(e.getMessage());
+ throw new WCSTException(ExceptionCode.IOConnectionError, "Reference Pixels. Explanation: "
+ "Could not read image from URL '" + url, e);
}
@@ -327,10 +303,10 @@ public class executeTransaction {
* @param identifier Name of coverage
* @param desc Reference to a CoverageDescriptions xml
* @return coverage description
- * @throws WCSException
+ * @throws WCSTException
*/
private CoverageDescriptionType loadDescriptionReference(String identifier,
- ReferenceType desc) throws WCSException {
+ ReferenceType desc) throws WCSTException, WCSTException {
URL url = null;
String xmlString = null;
CoverageDescriptions descs = null;
@@ -340,8 +316,8 @@ public class executeTransaction {
try {
url = new URL(desc.getHref());
} catch (MalformedURLException e) {
- LOG.error("URL " + url.toString() + " is not valid !");
- throw new InvalidParameterValueException("Reference pixels. Explanation: "
+ log.error("URL " + url.toString() + " is not valid !");
+ throw new WCSTException(ExceptionCode.InvalidParameterValue, "Reference pixels. Explanation: "
+ "URL " + url.toString() + " is not valid.");
}
@@ -352,7 +328,7 @@ public class executeTransaction {
xmlString = IOUtils.toString(in);
} catch (IOException ex) {
- throw new InputOutputException("Description Reference. Explanation: error loading the "
+ throw new WCSTException(ExceptionCode.IOConnectionError, "Description Reference. Explanation: error loading the "
+ "coverage description from URL " + url.toString(), ex);
}
@@ -367,13 +343,13 @@ public class executeTransaction {
} else if (obj instanceof CoverageDescriptions) {
descs = (CoverageDescriptions) obj;
} else {
- LOG.error("Coverage description metadata is not a valid xml document.");
- throw new XmlNotValidException("Coverage "
+ log.error("Coverage description metadata is not a valid xml document.");
+ throw new WCSTException(ExceptionCode.XmlNotValid, "Coverage "
+ "description metadata is not a valid xml document.");
}
} catch (javax.xml.bind.JAXBException ex) {
- throw new XmlStructuresException("Could not marshall/unmarshall XML structures.", ex);
+ throw new WCSTException(ExceptionCode.XmlStructuresError, "Could not marshall/unmarshall XML structures.", ex);
}
// Filter by coverage name
@@ -390,13 +366,13 @@ public class executeTransaction {
}
if (desc0 == null) {
- throw new InvalidRequestException("Could not find a CoverageDescription for coverage: " + identifier);
+ throw new WCSTException(ExceptionCode.InvalidRequest, "Could not find a CoverageDescription for coverage: " + identifier);
}
return desc0;
}
- private CoverageSummaryType loadSummaryReference(ReferenceType pixels) throws WCSException {
+ private CoverageSummaryType loadSummaryReference(ReferenceType pixels) throws WCSTException {
URL url = null;
String xmlString = null;
CoverageSummaryType xml = null;
@@ -404,7 +380,7 @@ public class executeTransaction {
try {
url = new URL(pixels.getHref());
} catch (MalformedURLException e) {
- throw new InvalidParameterValueException("Reference summary. Explanation: URL is not valid.", e);
+ throw new WCSTException(ExceptionCode.InvalidParameterValue, "Reference summary. Explanation: URL is not valid.", e);
}
// Read the contents of the URL
@@ -414,7 +390,7 @@ public class executeTransaction {
xmlString = IOUtils.toString(in);
} catch (IOException ex) {
- throw new InputOutputException("Summary Reference. Explanation: "
+ throw new WCSTException(ExceptionCode.IOConnectionError, "Summary Reference. Explanation: "
+ "Error loading the " + "coverage summary from URL " + url.toString(), ex);
}
@@ -429,10 +405,10 @@ public class executeTransaction {
} else if (obj instanceof CoverageSummaryType) {
xml = (CoverageSummaryType) obj;
} else {
- throw new XmlNotValidException("Coverage Summary metadata is not a valid xml document.");
+ throw new WCSTException(ExceptionCode.XmlNotValid, "Coverage Summary metadata is not a valid xml document.");
}
} catch (javax.xml.bind.JAXBException ex) {
- throw new XmlStructuresException("Could not marshall/unmarshall XML structures.", ex);
+ throw new WCSTException(ExceptionCode.XmlStructuresError, "Could not marshall/unmarshall XML structures.", ex);
}
return xml;
@@ -447,8 +423,8 @@ public class executeTransaction {
* @return modified metadata object
*/
private Metadata updateMetadataWithSummary(Metadata meta,
- CoverageSummaryType summary) throws WCSException {
- LOG.debug("Updating metadata with values from Coverage Summary...");
+ CoverageSummaryType summary) throws WCSTException {
+ log.debug("Updating metadata with values from Coverage Summary...");
String title = null, abstr = null, keywords = null;
@@ -504,7 +480,7 @@ public class executeTransaction {
*/
private void insertSomePixelsIntoRasdaman(String identifier, String pixHref, String descHref) {
// TODO: Implement !
- LOG.error("Partial update is not yet implemented");
+ log.error("Partial update is not yet implemented");
throw new UnsupportedOperationException("Partial Rasdaman update is not yet implemented.");
}
@@ -513,12 +489,11 @@ public class executeTransaction {
*
* @param identifier ID of the coverage
* @param img The image, fetched from external reference
- * @throws WCSException on error
+ * @throws WCSTException on error
*/
- private Metadata createNewCoverageMetadata(String identifier, BufferedImage img)
- throws InvalidMetadataException {
+ private Metadata createNewCoverageMetadata(String identifier, BufferedImage img) throws WCPSException, PetascopeException {
Metadata m = null;
- LOG.debug("Creating metadata with default values...");
+ log.debug("Creating metadata with default values...");
// TODO: When we accept multi-band images, update nullDefault
String nullDefault = "0";
@@ -539,15 +514,15 @@ public class executeTransaction {
crsSet.add(DomainElement.IMAGE_CRS);
String str1 = null, str2 = null;
/* Since we currently do not use the Domain sizes, we can set them to 0 and 1 */
- DomainElement domX = new DomainElement("x", "x", 0.0, 1.0, str1, str2, crsSet, metaDb.getAxisNames());
- DomainElement domY = new DomainElement("y", "y", 0.0, 1.0, str1, str2, crsSet, metaDb.getAxisNames());
+ DomainElement domX = new DomainElement("x", "x", 0.0, 1.0, str1, str2, crsSet, metaDb.getAxisNames(), null);
+ DomainElement domY = new DomainElement("y", "y", 0.0, 1.0, str1, str2, crsSet, metaDb.getAxisNames(), null);
List<DomainElement> domList = new ArrayList<DomainElement>(2);
domList.add(domX);
domList.add(domY);
// Ranges
/* TODO: When multiple-field images are supported, update ranges */
- RangeElement range = new RangeElement("intensity", ConfigManager.WCST_DEFAULT_DATATYPE);
+ RangeElement range = new RangeElement("intensity", ConfigManager.WCST_DEFAULT_DATATYPE, null);
List<RangeElement> rList = new ArrayList<RangeElement>(1);
rList.add(range);
@@ -567,14 +542,14 @@ public class executeTransaction {
// Descriptions
String abstr = null;
String title = "Coverage " + identifier;
+ String type = "GridCoverage"; // FIXME
String keywords = null;
- m =
- new Metadata(cellList, rList, nullSet, nullDefault, interpList,
- interp, identifier, domList, null, title, abstr, keywords);
+ m = new Metadata(cellList, rList, nullSet, nullDefault, interpList,
+ interp, identifier, type, domList, null, title, abstr, keywords);
- LOG.debug("Done creating default metadata");
+ log.debug("Done creating default metadata");
return m;
}
@@ -583,9 +558,9 @@ public class executeTransaction {
*
* @param elem the JAXB node equivalent to the <Coverage> node
*/
- private void processInputCoverageNode(CoverageType elem) throws WCSException {
+ private void processInputCoverageNode(CoverageType elem) throws WCSTException, WCPSException, PetascopeException {
if (elem.getAction() == null) {
- throw new InvalidParameterValueException("Action. Explanation: "
+ throw new WCSTException(ExceptionCode.InvalidParameterValue, "Action. Explanation: "
+ "Every <Coverage> node must contain an <Action> child node.");
}
@@ -609,7 +584,7 @@ public class executeTransaction {
} else if (action.equalsIgnoreCase("UpdateAll")) {
actionUpdateAll(identifier, references);
} else if (action.equalsIgnoreCase("UpdateDataPart")) {
- throw new ActionNotSupportedException("Action \"UpdateDataPart\" is not supported yet.");
+ throw new WCSTException(ExceptionCode.OperationNotSupported, "\"UpdateDataPart\" is not supported yet.");
/* TODO: UpdateDataPart is not yet functional. The Rasdaman server
* returns with an unexpected internal error (code: 10000) when
* a partial update query is sent. */
@@ -623,11 +598,11 @@ public class executeTransaction {
* @param identifier Name of coverage to update
* @param references List of references with data for update
*/
- private void actionUpdateAll(String identifier, List references) throws WCSException {
- LOG.trace("Executing action Update All ...");
+ private void actionUpdateAll(String identifier, List references) throws WCSTException, PetascopeException {
+ log.trace("Executing action Update All ...");
actionUpdateDataPart(identifier, references);
actionUpdateMetadata(identifier, references);
- LOG.trace("Finished action Update All!");
+ log.trace("Finished action Update All!");
}
/**
@@ -636,8 +611,8 @@ public class executeTransaction {
* @param identifier ID of the coverage
* @param desc object that contains the coverage description.
*/
- private Metadata updateMetadataWithDescription(Metadata meta, CoverageDescriptionType desc) throws WCSException {
- LOG.debug("Updating metadata with values from CoverageDescription...");
+ private Metadata updateMetadataWithDescription(Metadata meta, CoverageDescriptionType desc) throws WCPSException, WCSTException {
+ log.debug("Updating metadata with values from CoverageDescription...");
/* (B) Table ps_descriptions: Update coverage title, abstract, keywords */
String title = desc.getTitle();
@@ -654,38 +629,34 @@ public class executeTransaction {
Set<InterpolationMethod> interpSet = new HashSet<InterpolationMethod>();
RangeType range = desc.getRange();
List<FieldType> fields = range.getField();
- try {
- LOG.debug("Updating range information...");
- Iterator<FieldType> i = fields.iterator();
- ArrayList<RangeElement> rangeList = new ArrayList<RangeElement>();
-
- while (i.hasNext()) {
- FieldType field = i.next();
-
- String name = field.getIdentifier();
- String datatype = field.getDefinition().getDataType().getValue();
- RangeElement fieldRange = new RangeElement(name, datatype);
- rangeList.add(fieldRange);
-
- InterpolationMethods methods = field.getInterpolationMethods();
- String interpType = methods.getDefaultMethod().getValue();
- String nullResist = methods.getDefaultMethod().getNullResistance();
- InterpolationMethod interp = new InterpolationMethod(interpType, nullResist);
+ log.debug("Updating range information...");
+ Iterator<FieldType> i = fields.iterator();
+ ArrayList<RangeElement> rangeList = new ArrayList<RangeElement>();
+
+ while (i.hasNext()) {
+ FieldType field = i.next();
+
+ String name = field.getIdentifier();
+ String datatype = field.getDefinition().getDataType().getValue();
+ RangeElement fieldRange = new RangeElement(name, datatype, null); // FIXME uom = null
+ rangeList.add(fieldRange);
+
+ InterpolationMethods methods = field.getInterpolationMethods();
+ String interpType = methods.getDefaultMethod().getValue();
+ String nullResist = methods.getDefaultMethod().getNullResistance();
+ InterpolationMethod interp = new InterpolationMethod(interpType, nullResist);
+ interpSet.add(interp);
+
+ Iterator<InterpolationMethodType> it = methods.getOtherMethod().iterator();
+ while (it.hasNext()) {
+ InterpolationMethodType imt = it.next();
+ String type = imt.getValue();
+ String resis = imt.getNullResistance();
+ interp = new InterpolationMethod(type, resis);
interpSet.add(interp);
-
- Iterator<InterpolationMethodType> it = methods.getOtherMethod().iterator();
- while (it.hasNext()) {
- InterpolationMethodType imt = it.next();
- String type = imt.getValue();
- String resis = imt.getNullResistance();
- interp = new InterpolationMethod(type, resis);
- interpSet.add(interp);
- }
}
- meta.setRange(rangeList);
- } catch (InvalidMetadataException e) {
- throw new InternalComponentException("Invalid metadata.", e);
}
+ meta.setRange(rangeList);
meta.setInterpolationSet(interpSet);
}
@@ -697,53 +668,45 @@ public class executeTransaction {
* and use it on the whole coverage
*/
if (desc.isSetRange()) {
- try {
- LOG.debug("Updating default interpolation method...");
- InterpolationMethodType def1 = desc.getRange().getField().get(0).getInterpolationMethods().getDefaultMethod();
- String method = def1.getValue();
- String resist = def1.getNullResistance();
-
- InterpolationMethod meth = new InterpolationMethod(method, resist);
- meta.setDefaultInterpolation(meth);
- } catch (InvalidMetadataException e) {
- throw new InternalComponentException("Invalid metadata.", e);
- }
+ log.debug("Updating default interpolation method...");
+ InterpolationMethodType def1 = desc.getRange().getField().get(0).getInterpolationMethods().getDefaultMethod();
+ String method = def1.getValue();
+ String resist = def1.getNullResistance();
+
+ InterpolationMethod meth = new InterpolationMethod(method, resist);
+ meta.setDefaultInterpolation(meth);
}
/* (E) Table ps_celldomain: Update cell domain of the coverage. */
/* NOTE: Only works for 2-D (x/y) or 3-D (x/y/t) coverages */
if (desc.isSetDomain()) {
- LOG.debug("Updating spatial bounding box of coverage ...");
- try {
- List<JAXBElement<? extends BoundingBoxType>> list =
- desc.getDomain().getSpatialDomain().getBoundingBox();
- if (list.size() == 1) {
- BoundingBoxType bbox = (BoundingBoxType) list.get(0).getValue();
- if (bbox.getCrs() == null || bbox.getCrs().equals(DomainElement.IMAGE_CRS)) {
- meta = updateImageCrsBoundingBox(meta, bbox);
- } else {
- throw new InvalidParameterValueException("crs. Explanation: Unknown CRS " + bbox.getCrs());
- }
+ log.debug("Updating spatial bounding box of coverage ...");
+ List<JAXBElement<? extends BoundingBoxType>> list =
+ desc.getDomain().getSpatialDomain().getBoundingBox();
+ if (list.size() == 1) {
+ BoundingBoxType bbox = (BoundingBoxType) list.get(0).getValue();
+ if (bbox.getCrs() == null || bbox.getCrs().equals(DomainElement.IMAGE_CRS)) {
+ meta = updateImageCrsBoundingBox(meta, bbox);
} else {
- Iterator i = list.iterator();
- while (i.hasNext()) {
- BoundingBoxType bbox = (BoundingBoxType) i.next();
- if (bbox.getCrs().equals(DomainElement.IMAGE_CRS)) {
- meta = updateImageCrsBoundingBox(meta, bbox);
- }
- // TODO: Implement WGS84 update
- // if (bbox.getCrs().equals(DomainElement.WGS84_CRS))
- // updateWgs84CrsBoundingBox(meta, bbox);
+ throw new WCSTException(ExceptionCode.InvalidParameterValue, "crs. Explanation: Unknown CRS " + bbox.getCrs());
+ }
+ } else {
+ Iterator i = list.iterator();
+ while (i.hasNext()) {
+ BoundingBoxType bbox = (BoundingBoxType) i.next();
+ if (bbox.getCrs().equals(DomainElement.IMAGE_CRS)) {
+ meta = updateImageCrsBoundingBox(meta, bbox);
}
+ // TODO: Implement WGS84 update
+ // if (bbox.getCrs().equals(DomainElement.WGS84_CRS))
+ // updateWgs84CrsBoundingBox(meta, bbox);
}
- } catch (InvalidMetadataException e) {
- throw new InternalComponentException("Invalid metadata.", e);
}
}
if (desc.getDomain().isSetTemporalDomain()) {
- LOG.debug("Updating temporal bounding box of coverage ...");
+ log.debug("Updating temporal bounding box of coverage ...");
/*
try
{
@@ -761,18 +724,19 @@ public class executeTransaction {
}
else
{
- throw new WCSException("InvalidParameterValue", "TemporalDomain",
+ throw new WCSTException("InvalidParameterValue", "TemporalDomain",
"Exactly one time-period should be present in the " +
"Temporal Domain of coverage: " + meta.getCoverageName());
}
}
catch (InvalidMetadataException e)
{
- throw new WCSException("InvalidParameterValue", "Unknown, please look at the root cause exception.", e);
+ throw new WCSTException("InvalidParameterValue", "Unknown, please look at the root cause exception.", e);
}
*/
- LOG.error("This server did not implement the parsing of 'TimePeriod' nodes.");
- throw new NodeParsingNotImplementedException("This server did not implement the parsing of 'TimePeriod' nodes.");
+ log.error("This server did not implement the parsing of 'TimePeriod' nodes.");
+ throw new WCSTException(ExceptionCode.NodeParsingNotImplemented,
+ "This server did not implement the parsing of 'TimePeriod' nodes.");
}
/* (F) Table ps_crss: Update supported CRS */
@@ -787,19 +751,12 @@ public class executeTransaction {
* @param identifier
* @param references
*/
- private void actionUpdateDataPart(String identifier, List references) throws WCSException {
- LOG.trace("Executing action UpdateDataPart ...");
+ private void actionUpdateDataPart(String identifier, List references) throws WCSTException, PetascopeException {
+ log.trace("Executing action UpdateDataPart ...");
// Error checking
// Only change the metadata for an existing coverage
- Metadata m = null;
- try {
- m = metaDb.read(identifier);
- } catch (ResourceException e) {
- throw new InternalComponentException("Invalid metadata for coverage: " + identifier, e);
- } catch (InvalidWcpsRequestException e) {
- throw new InternalComponentException("Could not read metadata for coverage: " + identifier, e);
- }
+ Metadata m = metaDb.read(identifier);
// Obtain the references
ReferenceType pixels, desc;
@@ -809,17 +766,17 @@ public class executeTransaction {
// References check. We are updating a coverage values, mandatory are: pixels, description
if (pixels == null) {
- throw new MissingParameterValueException("Reference role='" + getUrnCode("pixels") + "'");
+ throw new WCSTException(ExceptionCode.MissingParameterValue, "Reference role='" + getUrnCode("pixels") + "'");
}
if (desc == null) {
- throw new MissingParameterValueException("Reference role='" + getUrnCode("description") + "'");
+ throw new WCSTException(ExceptionCode.MissingParameterValue, "Reference role='" + getUrnCode("description") + "'");
}
// (2) Do the actual processing
try {
insertSomePixelsIntoRasdaman(identifier, pixels.getHref(), desc.getHref());
} catch (Exception e) {
- throw new NoApplicableCodeException(e.getMessage(), e);
+ throw new WCSTException(ExceptionCode.NoApplicableCode, e.getMessage(), e);
}
}
@@ -828,17 +785,17 @@ public class executeTransaction {
*
* @param identifier
* @param references
- * @throws wcs.server.core.WCSException
+ * @throws wcs.server.core.WCSTException
*/
- private void actionUpdateMetadata(String identifier, List references) throws WCSException {
- LOG.trace("Executing action Update Metadata...");
+ private void actionUpdateMetadata(String identifier, List references) throws WCSTException {
+ log.trace("Executing action Update Metadata...");
// Only change the metadata for an existing coverage
Metadata m = null;
try {
m = metaDb.read(identifier);
} catch (Exception e) {
- throw new InternalComponentException("Invalid metadata for coverage: " + identifier, e);
+ throw new WCSTException(ExceptionCode.InternalComponentError, "Invalid metadata for coverage: " + identifier, e);
}
// Obtain the references
@@ -849,20 +806,20 @@ public class executeTransaction {
// References check. We are updating metadata, mandatory is only the description
if (descRef == null) {
- throw new MissingParameterValueException("Reference role='" + getUrnCode("description") + "'");
+ throw new WCSTException(ExceptionCode.MissingParameterValue, "Reference role='" + getUrnCode("description") + "'");
}
- LOG.trace("Loading reference: coverage description ...");
+ log.trace("Loading reference: coverage description ...");
CoverageDescriptionType desc = loadDescriptionReference(identifier, descRef);
CoverageSummaryType summ = null;
if (summRef != null) {
- LOG.trace("Loading reference: coverage summary ...");
+ log.trace("Loading reference: coverage summary ...");
summ = loadSummaryReference(summRef);
}
- LOG.trace("Done loading references !");
+ log.trace("Done loading references !");
// (2) Do the actual processing
try {
@@ -875,10 +832,10 @@ public class executeTransaction {
metaDb.updateCoverageMetadata(m, false);
} catch (Exception e) {
- throw new NoApplicableCodeException("Error while updating metadata.", e);
+ throw new WCSTException(ExceptionCode.NoApplicableCode, "Error while updating metadata.", e);
}
- LOG.trace("Finished action Update Metadata !");
+ log.trace("Finished action Update Metadata !");
}
/**
@@ -886,10 +843,10 @@ public class executeTransaction {
*
* @param identifier
* @param references
- * @throws wcs.server.core.WCSException
+ * @throws wcs.server.core.WCSTException
*/
- private void actionAddCoverage(String identifier, List references) throws WCSException {
- LOG.trace("Executing action AddCoverage ...");
+ private void actionAddCoverage(String identifier, List references) throws WCSTException, WCPSException, PetascopeException {
+ log.trace("Executing action AddCoverage ...");
// Obtain the references
ReferenceType pixelsRef, descRef, summRef;
@@ -900,26 +857,26 @@ public class executeTransaction {
// References check. We are adding a coverage, mandatory are: pixels, description
if (pixelsRef == null) {
- throw new MissingParameterValueException("Reference role='" + getUrnCode("pixels") + "'");
+ throw new WCSTException(ExceptionCode.MissingParameterValue, "Reference role='" + getUrnCode("pixels") + "'");
}
if (descRef == null) {
- throw new MissingParameterValueException("Reference role='" + getUrnCode("description") + "'");
+ throw new WCSTException(ExceptionCode.MissingParameterValue, "Reference role='" + getUrnCode("description") + "'");
}
- LOG.trace("Loading reference: coverage pixels ...");
+ log.trace("Loading reference: coverage pixels ...");
BufferedImage img = loadPixelsReference(pixelsRef);
- LOG.trace("Loading reference: coverage description ...");
+ log.trace("Loading reference: coverage description ...");
CoverageDescriptionType desc = loadDescriptionReference(identifier, descRef);
CoverageSummaryType summ = null;
if (summRef != null) {
- LOG.trace("Loading reference: coverage summary ...");
+ log.trace("Loading reference: coverage summary ...");
summ = loadSummaryReference(summRef);
}
- LOG.trace("Done loading references !");
+ log.trace("Done loading references !");
/**
* (1) Check coverage name
@@ -927,12 +884,12 @@ public class executeTransaction {
boolean changeId = false;
if (newCoverages.contains(identifier)) {
- throw new InvalidParameterValueException("Identifier: You cannot use the same identifier twice.");
+ throw new WCSTException(ExceptionCode.InvalidParameterValue, "Identifier: You cannot use the same identifier twice.");
}
if (metaDb.existsCoverageName(identifier)) {
changeId = true;
- LOG.warn("Changing coverage identifier since coverage '" + identifier + "' already exists !");
+ log.warn("Changing coverage identifier since coverage '" + identifier + "' already exists !");
}
// Generate new coverage name ?
@@ -947,40 +904,34 @@ public class executeTransaction {
try {
/* Currently we only support one-band (gray-scale) images. */
if (img.getColorModel().getNumComponents() != 1) {
- throw new MultiBandImagesNotSupportedException(
+ throw new WCSTException(ExceptionCode.MultiBandImagesNotSupported,
"This server currently only supports one-band images (grayscale). "
+ "This coverage has " + img.getColorModel().getNumComponents() + " bands.");
}
insertImageIntoRasdaman(identifier, img);
} catch (Exception e) {
- throw new InternalComponentException("Error while inserting image in rasdaman.", e);
+ throw new WCSTException(ExceptionCode.InternalComponentError, "Error while inserting image in rasdaman.", e);
}
/**
* (3) Build the metadata object and store it in the db.
*/
- try {
- Metadata m = createNewCoverageMetadata(identifier, img);
- m = updateMetadataWithDescription(m, desc);
- /* Top level descriptions overwrite other metadata sources */
- if (summ != null) {
- m = updateMetadataWithSummary(m, summ);
- }
-
- metaDb.insertNewCoverageMetadata(m, false);
- } catch (InvalidMetadataException e) {
- throw new InternalComponentException("Metadata to be inserted is invalid.", e);
- } catch (ResourceException e) {
- throw new InternalComponentException("Could not insert metadata into database.", e);
+ Metadata m = createNewCoverageMetadata(identifier, img);
+ m = updateMetadataWithDescription(m, desc);
+ /* Top level descriptions overwrite other metadata sources */
+ if (summ != null) {
+ m = updateMetadataWithSummary(m, summ);
}
+ metaDb.insertNewCoverageMetadata(m, false);
+
/**
* (4) Indicate success: Add this ID to the output XML document
*/
CodeType id = new CodeType();
id.setValue(identifier);
output.getIdentifier().add(id);
- LOG.trace("Finished action Add !");
+ log.trace("Finished action Add !");
}
/**
@@ -988,13 +939,13 @@ public class executeTransaction {
*
* @param identifier
* @param references
- * @throws wcs.server.core.WCSException
+ * @throws wcs.server.core.WCSTException
*/
- private void actionDeleteCoverage(String identifier, List references) throws WCSException {
- LOG.trace("Executing action Delete Coverage ...");
+ private void actionDeleteCoverage(String identifier, List references) throws WCSTException {
+ log.trace("Executing action Delete Coverage ...");
if (metaDb.existsCoverageName(identifier) == false) {
- throw new InvalidParameterValueException("Identifier");
+ throw new WCSTException(ExceptionCode.InvalidParameterValue, "Identifier");
}
// (2) Do the actual processing
@@ -1003,7 +954,7 @@ public class executeTransaction {
deleteCoverageFromRasdaman(identifier);
metaDb.delete(m, false);
} catch (Exception e) {
- throw new NoApplicableCodeException("Error while deleting coverage.", e);
+ throw new WCSTException(ExceptionCode.NoApplicableCode, "Error while deleting coverage.", e);
}
// Indicate success: Add this ID to the output XML document
@@ -1012,7 +963,7 @@ public class executeTransaction {
id.setValue(identifier);
output.getIdentifier().add(id);
- LOG.trace("Finished action Delete !");
+ log.trace("Finished action Delete !");
}
/**
@@ -1021,7 +972,7 @@ public class executeTransaction {
* @param key Internal representation of a URN code
* @return the URN code
*/
- private String getUrnCode(String key) throws WCSException {
+ private String getUrnCode(String key) throws WCSTException {
if (key.equalsIgnoreCase("pixels")) {
return "urn:ogc:def:role:WCS:1.1:Pixels";
}
@@ -1038,7 +989,7 @@ public class executeTransaction {
return "urn:ogc:def:role:WCS:1.1:OtherSource";
}
- throw new InternalComponentException("Unknown URN key '" + key + "'");
+ throw new WCSTException(ExceptionCode.InternalComponentError, "Unknown URN key '" + key + "'");
}
/**
@@ -1047,7 +998,7 @@ public class executeTransaction {
* @param references List of References
* @return the Pixels Reference
*/
- private ReferenceType getPixelsRef(List references) throws WCSException {
+ private ReferenceType getPixelsRef(List references) throws WCSTException {
ReferenceType result = searchReferenceList("pixels", references);
return result;
@@ -1059,7 +1010,7 @@ public class executeTransaction {
* @param references List of References
* @return the Coverage Description Reference
*/
- private ReferenceType getDescriptionRef(List references) throws WCSException {
+ private ReferenceType getDescriptionRef(List references) throws WCSTException {
ReferenceType result = searchReferenceList("description", references);
return result;
@@ -1071,7 +1022,7 @@ public class executeTransaction {
* @param references List of References
* @return the Coverage Summary Reference
*/
- private ReferenceType getSummaryRef(List references) throws WCSException {
+ private ReferenceType getSummaryRef(List references) throws WCSTException {
ReferenceType result = searchReferenceList("summary", references);
return result;
@@ -1083,7 +1034,7 @@ public class executeTransaction {
* @param references List of References
* @return the Georeferencing Transform Reference
*/
- private ReferenceType getTransformRef(List references) throws WCSException {
+ private ReferenceType getTransformRef(List references) throws WCSTException {
ReferenceType result = searchReferenceList("transform", references);
return result;
@@ -1095,7 +1046,7 @@ public class executeTransaction {
* @param references List of References
* @return the "Other" Reference
*/
- private ReferenceType getOtherRef(List references) throws WCSException {
+ private ReferenceType getOtherRef(List references) throws WCSTException {
ReferenceType result = searchReferenceList("other", references);
return result;
@@ -1107,7 +1058,7 @@ public class executeTransaction {
* @param references List of references
* @return a Reference object
*/
- private ReferenceType searchReferenceList(String key, List references) throws WCSException {
+ private ReferenceType searchReferenceList(String key, List references) throws WCSTException {
String urn = getUrnCode(key);
Iterator i = references.iterator();
@@ -1125,7 +1076,7 @@ public class executeTransaction {
return null;
}
- private Metadata updateImageCrsBoundingBox(Metadata meta, BoundingBoxType bbox) throws WCSException, InvalidMetadataException {
+ private Metadata updateImageCrsBoundingBox(Metadata meta, BoundingBoxType bbox) throws WCPSException {
List<Double> lower = bbox.getLowerCorner();
List<Double> upper = bbox.getUpperCorner();
diff --git a/petascope/src/petascope/wcst/transaction/tools/RasdamanUtils.java b/petascope/src/petascope/wcst/transaction/tools/RasdamanUtils.java
index 1836987..401b213 100644
--- a/petascope/src/petascope/wcst/transaction/tools/RasdamanUtils.java
+++ b/petascope/src/petascope/wcst/transaction/tools/RasdamanUtils.java
@@ -14,40 +14,31 @@
* 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.wcst.transaction.tools;
-//~--- non-JDK imports --------------------------------------------------------
import org.odmg.DBag;
import org.odmg.Database;
import org.odmg.Implementation;
import org.odmg.ODMGException;
import org.odmg.OQLQuery;
import org.odmg.Transaction;
-
import rasj.RasGMArray;
import rasj.RasImplementation;
import rasj.RasMInterval;
import rasj.RasResultIsNoIntervalException;
-
-import petascope.wcs.server.exceptions.WCSException;
-
-//~--- JDK imports ------------------------------------------------------------
-
+import petascope.exceptions.WCSException;
+import petascope.exceptions.ExceptionCode;
import java.awt.Graphics;
import java.awt.image.BufferedImage;
import java.awt.image.DataBuffer;
-
import java.io.ByteArrayInputStream;
-
import java.util.Iterator;
-import org.odmg.QueryException;
-import petascope.wcs.server.exceptions.InternalComponentException;
+import petascope.exceptions.RasdamanException;
/**
* Utility class for doing various tasks that involve the Rasdaman server.
@@ -83,7 +74,7 @@ public class RasdamanUtils {
* Opens a new connection to the Rasdaman server, and starts a new transaction.
* @throws WCSException on connection error
*/
- public void init() throws WCSException {
+ public void init() throws RasdamanException {
try {
if (myApp == null) {
myApp = new RasImplementation(server);
@@ -99,7 +90,8 @@ public class RasdamanUtils {
myTa.begin();
}
} catch (ODMGException e) {
- throw new InternalComponentException("Could not connect to the Rasdaman server !", e);
+ throw new RasdamanException(ExceptionCode.InternalComponentError,
+ "Could not connect to the Rasdaman server !", e);
}
}
@@ -257,7 +249,7 @@ public class RasdamanUtils {
}
}
- public void insertGrayImageAsArray(String name, BufferedImage img) throws ODMGException, InternalComponentException {
+ public void insertGrayImageAsArray(String name, BufferedImage img) throws ODMGException, RasdamanException {
log("Creating grey image ...");
RasGMArray myMDD = createMddFromImage(img);
// set up query object for collection creation:
@@ -422,7 +414,7 @@ public class RasdamanUtils {
// commitAndClose();
}
- public RasGMArray createMddFromImage(BufferedImage img) throws InternalComponentException {
+ public RasGMArray createMddFromImage(BufferedImage img) throws RasdamanException {
String interval = null;
try {
int cols = img.getWidth();
@@ -456,7 +448,7 @@ public class RasdamanUtils {
return myMDD;
} catch (RasResultIsNoIntervalException e) {
- throw new InternalComponentException("Illegal Interval String: " + interval, e);
+ throw new RasdamanException(ExceptionCode.InternalComponentError, "Illegal Interval String: " + interval, e);
}
}
diff --git a/petascope/src/petascope/wcst/transaction/tools/TestRasdamanUtils.java b/petascope/src/petascope/wcst/transaction/tools/TestRasdamanUtils.java
index 0b6d794..f40bedd 100644
--- a/petascope/src/petascope/wcst/transaction/tools/TestRasdamanUtils.java
+++ b/petascope/src/petascope/wcst/transaction/tools/TestRasdamanUtils.java
@@ -14,31 +14,21 @@
* 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.wcst.transaction.tools;
-//~--- non-JDK imports --------------------------------------------------------
import java.awt.Graphics;
import java.awt.Panel;
import org.odmg.*;
-
import rasj.*;
-
-//~--- JDK imports ------------------------------------------------------------
-
import java.awt.image.BufferedImage;
-
import java.io.IOException;
-
import java.net.URL;
-
import javax.imageio.ImageIO;
-
import javax.swing.JFrame;
/** Test class for various Rasdaman tasks. Comment/uncomment the lines in the
diff --git a/petascope/src/petascope/wps/server/WpsServer.java b/petascope/src/petascope/wps/server/WpsServer.java
index 854b983..313ec16 100644
--- a/petascope/src/petascope/wps/server/WpsServer.java
+++ b/petascope/src/petascope/wps/server/WpsServer.java
@@ -14,8 +14,7 @@
* 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>.
@@ -36,7 +35,8 @@ import org.apache.commons.io.IOUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import petascope.wcps.server.core.ProcessCoveragesRequest;
-import petascope.wcs.server.exceptions.InputOutputException;
+import petascope.exceptions.WCSException;
+import petascope.exceptions.ExceptionCode;
/**
*
@@ -44,10 +44,10 @@ import petascope.wcs.server.exceptions.InputOutputException;
*/
public class WpsServer {
- private static Logger LOG = LoggerFactory.getLogger(WpsServer.class);
+ private static Logger log = LoggerFactory.getLogger(WpsServer.class);
public String request = null;
- public WpsServer(HttpServletResponse httpResponse, HttpServletRequest httpRequest) throws URISyntaxException, IOException, InputOutputException, RecognitionException {
+ public WpsServer(HttpServletResponse httpResponse, HttpServletRequest httpRequest) throws URISyntaxException, IOException, WCSException, RecognitionException {
if ((httpRequest.getParameter("Request") != null) && httpRequest.getParameter("Request").equalsIgnoreCase("GetCapabilities")) {
GetCapabilities(httpResponse);
@@ -74,10 +74,10 @@ public class WpsServer {
}
}
- public void GetCapabilities(HttpServletResponse httpResponse) throws URISyntaxException, IOException, InputOutputException {
+ public void GetCapabilities(HttpServletResponse httpResponse) throws URISyntaxException, IOException, WCSException {
URI GetCapabilitiesURI = this.getClass().getResource("../templates/GetCapabilities.xml").toURI();
String GetCapabilitiesResponse = loadFile(GetCapabilitiesURI);
- LOG.info("Executing operation GetCapabilities...");
+ log.info("Executing operation GetCapabilities...");
System.out.println("GetCapabilities Response is " + GetCapabilitiesResponse);
PrintWriter out;
try {
@@ -87,14 +87,14 @@ public class WpsServer {
out.flush();
out.close();
} catch (IOException e) {
- throw new InputOutputException(e.getMessage(), e);
+ throw new WCSException(ExceptionCode.IOConnectionError, e.getMessage(), e);
}
}
- public void DescribeProcess(HttpServletResponse httpResponse) throws URISyntaxException, IOException, InputOutputException {
+ public void DescribeProcess(HttpServletResponse httpResponse) throws URISyntaxException, IOException, WCSException {
URI DesribeProcessURI = this.getClass().getResource("../templates/DescribeProcess.xml").toURI();
String DescribeProcessResponse = loadFile(DesribeProcessURI);
- LOG.info("Executing operation DescribeProcess...");
+ log.info("Executing operation DescribeProcess...");
System.out.println("DescribeProcess Document is " + DescribeProcessResponse);
PrintWriter out;
try {
@@ -104,7 +104,7 @@ public class WpsServer {
out.flush();
out.close();
} catch (IOException e) {
- throw new InputOutputException(e.getMessage(), e);
+ throw new WCSException(ExceptionCode.IOConnectionError, e.getMessage(), e);
}
}
@@ -112,7 +112,7 @@ public class WpsServer {
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/web/WEB-INF/web.xml b/petascope/web/WEB-INF/web.xml
index 5ea7948..4113edd 100644
--- a/petascope/web/WEB-INF/web.xml
+++ b/petascope/web/WEB-INF/web.xml
@@ -3,6 +3,11 @@
<description>PetaScope project offers WCS, WCPS and WCS-T services.</description>
<display-name>PetaScope</display-name>
<servlet>
+ <description>WCS 2.0 Service</description>
+ <servlet-name>Wcs2Servlet</servlet-name>
+ <servlet-class>petascope.wcs2.Wcs2Servlet</servlet-class>
+ </servlet>
+ <servlet>
<description>WCPS Service</description>
<servlet-name>wcpsServlet</servlet-name>
<servlet-class>wcps.server.servlet.WCPSServlet</servlet-class>
@@ -25,6 +30,10 @@
<url-pattern>/wcst</url-pattern>
</servlet-mapping>
<servlet-mapping>
+ <servlet-name>Wcs2Servlet</servlet-name>
+ <url-pattern>/wcs2</url-pattern>
+ </servlet-mapping>
+ <servlet-mapping>
<servlet-name>PetaScope Interface</servlet-name>
<url-pattern>/earthlook</url-pattern>
</servlet-mapping>