diff --git a/adagucserverEC/CDFObjectStore.cpp b/adagucserverEC/CDFObjectStore.cpp index ae684f4e..155fc152 100644 --- a/adagucserverEC/CDFObjectStore.cpp +++ b/adagucserverEC/CDFObjectStore.cpp @@ -226,6 +226,9 @@ CDFObject *CDFObjectStore::getCDFObject(CDataSource *dataSource, const char *fil CDFObject *CDFObjectStore::getCDFObject(CDataSource *dataSource, CServerParams *srvParams, const char *fileName, bool plain) { CT::string uniqueIDForFile = fileName; + if (dataSource != NULL && dataSource->layerName.empty() == false) { + uniqueIDForFile.concat(dataSource->layerName); + } if (srvParams == NULL && dataSource != NULL) { srvParams = dataSource->srvParams; } @@ -282,7 +285,6 @@ CDFObject *CDFObjectStore::getCDFObject(CDataSource *dataSource, CServerParams * CDFCache *cdfCache = NULL; if (srvParams != NULL) { - CT::string cacheDir = srvParams->cfg->TempDir[0]->attr.value.c_str(); // srvParams->getCacheDirectory(&cacheDir); if (cacheDir.length() > 0) { @@ -302,9 +304,9 @@ CDFObject *CDFObjectStore::getCDFObject(CDataSource *dataSource, CServerParams * CDBError("Exception thrown during opening of %s", fileLocationToOpen); } - /* Apply NCML file to the datamodel */ if (dataSource) { if (dataSource->cfgLayer) { + /* Apply NCML file to the datamodel */ if (dataSource->cfgLayer->FilePath.size() == 1) { CT::string ncmlFileName = dataSource->cfgLayer->FilePath[0]->attr.ncml; if (!ncmlFileName.empty()) { @@ -312,6 +314,10 @@ CDFObject *CDFObjectStore::getCDFObject(CDataSource *dataSource, CServerParams * cdfObject->applyNCMLFile(ncmlFileName.c_str()); } } + if (!dataSource->cfgLayer->Variable[0]->attr.orgname.empty()) { + CDF::Variable *var = cdfObject->getVariable(dataSource->cfgLayer->Variable[0]->attr.orgname); + var->name.copy(dataSource->cfgLayer->Variable[0]->value); + } } } diff --git a/adagucserverEC/CDataPostProcessors/CDataPostProcessor_IncludeLayer.cpp b/adagucserverEC/CDataPostProcessors/CDataPostProcessor_IncludeLayer.cpp index 06f5a4b4..b7dcca37 100644 --- a/adagucserverEC/CDataPostProcessors/CDataPostProcessor_IncludeLayer.cpp +++ b/adagucserverEC/CDataPostProcessors/CDataPostProcessor_IncludeLayer.cpp @@ -51,6 +51,7 @@ int CDPPIncludeLayer::execute(CServerConfig::XMLE_DataPostProc *proc, CDataSourc if ((isApplicable(proc, dataSource, mode) & mode) == false) { return -1; } + if (mode == CDATAPOSTPROCESSOR_RUNBEFOREREADING) { CDBDebug("CDATAPOSTPROCESSOR_RUNBEFOREREADING::Applying include_layer"); diff --git a/adagucserverEC/CRequest.cpp b/adagucserverEC/CRequest.cpp index 34766060..78931a76 100644 --- a/adagucserverEC/CRequest.cpp +++ b/adagucserverEC/CRequest.cpp @@ -1146,6 +1146,21 @@ int CRequest::fillDimValuesForDataSource(CDataSource *dataSource, CServerParams } } } + // Check and set value when the value is forced in the layer dimension configuration + for (size_t i = 0; i < dataSource->cfgLayer->Dimension.size(); i++) { + if (!dataSource->cfgLayer->Dimension[i]->attr.forcevalue.empty()) { + CT::string dimName(dataSource->cfgLayer->Dimension[i]->value.c_str()); + CT::string forceValue = dataSource->cfgLayer->Dimension[i]->attr.forcevalue; + dimName.toLowerCaseSelf(); + for (size_t l = 0; l < dataSource->requiredDims.size(); l++) { + if (dataSource->requiredDims[l]->name.equals(&dimName)) { + CDBDebug("Forcing dimension %s from %s to %s", dimName.c_str(), dataSource->requiredDims[i]->value.c_str(), forceValue.c_str()); + dataSource->requiredDims[i]->value = forceValue; + break; + } + } + } + } // STOP NOW } catch (int i) { diff --git a/adagucserverEC/CServerConfig_CPPXSD.h b/adagucserverEC/CServerConfig_CPPXSD.h index 61fbfb0d..7ad908e3 100644 --- a/adagucserverEC/CServerConfig_CPPXSD.h +++ b/adagucserverEC/CServerConfig_CPPXSD.h @@ -985,7 +985,19 @@ class CServerConfig : public CXMLSerializerInterface { }; class XMLE_Abstract : public CXMLObjectInterface {}; class XMLE_DataBaseTable : public CXMLObjectInterface {}; - class XMLE_Variable : public CXMLObjectInterface {}; + class XMLE_Variable : public CXMLObjectInterface { + public: + class Cattr { + public: + CT::string orgname; + } attr; + void addAttribute(const char *name, const char *value) { + if (equals("orgname", 7, name)) { + attr.orgname.copy(value); + return; + } + } + }; class XMLE_DataReader : public CXMLObjectInterface { public: class Cattr { @@ -1165,30 +1177,38 @@ class CServerConfig : public CXMLSerializerInterface { public: class Cattr { public: - CT::string name, interval, defaultV, units, quantizeperiod, quantizemethod; + CT::string name, interval, defaultV, units, quantizeperiod, quantizemethod, forcevalue; + bool hidden = false; } attr; void addAttribute(const char *attrname, const char *attrvalue) { if (equals("name", 4, attrname)) { attr.name.copy(attrvalue); return; - } - if (equals("units", 5, attrname)) { + } else if (equals("units", 5, attrname)) { attr.units.copy(attrvalue); return; - } - if (equals("default", 7, attrname)) { + } else if (equals("default", 7, attrname)) { attr.defaultV.copy(attrvalue); return; - } - if (equals("interval", 8, attrname)) { + } else if (equals("interval", 8, attrname)) { attr.interval.copy(attrvalue); return; - } - if (equals("quantizeperiod", 14, attrname)) { + } else if (equals("quantizeperiod", 14, attrname)) { attr.quantizeperiod.copy(attrvalue); return; - } - if (equals("quantizemethod", 14, attrname)) { + } else if (equals("forcevalue", 10, attrname)) { + attr.forcevalue.copy(attrvalue); + return; + } else if (equals("hidden", 6, attrname)) { + if (equals("false", 5, attrvalue)) { + attr.hidden = false; + } + if (equals("true", 4, attrvalue)) { + attr.hidden = true; + } + + return; + } else if (equals("quantizemethod", 14, attrname)) { attr.quantizemethod.copy(attrvalue); return; } diff --git a/adagucserverEC/CXMLGen.cpp b/adagucserverEC/CXMLGen.cpp index 8b5b68a7..eb9eaba1 100644 --- a/adagucserverEC/CXMLGen.cpp +++ b/adagucserverEC/CXMLGen.cpp @@ -693,6 +693,18 @@ int CXMLGen::getDimsForLayer(WMSLayer *myWMSLayer) { } } } + + // Check for forced values + if (!myWMSLayer->dataSource->cfgLayer->Dimension[i]->attr.forcevalue.empty()) { + dim->values = myWMSLayer->dataSource->cfgLayer->Dimension[i]->attr.forcevalue; + dim->defaultValue = myWMSLayer->dataSource->cfgLayer->Dimension[i]->attr.forcevalue; + dim->hasMultipleValues = false; + } + + // Check if it should be hidden + if (myWMSLayer->dataSource->cfgLayer->Dimension[i]->attr.hidden == true) { + dim->hidden = true; + } } } @@ -788,6 +800,7 @@ int CXMLGen::getWMS_1_0_0_Capabilities(CT::string *XMLDoc, std::vectordimList.size(); d++) { WMSLayer::Dim *dim = layer->dimList[d]; + if (dim->hidden) continue; XMLDoc->printconcat("\n", dim->name.c_str(), dim->units.c_str()); XMLDoc->printconcat("", dim->name.c_str(), dim->defaultValue.c_str(), 1); XMLDoc->concat(dim->values.c_str()); @@ -928,6 +941,7 @@ int CXMLGen::getWMS_1_1_1_Capabilities(CT::string *XMLDoc, std::vectordimList.size(); d++) { WMSLayer::Dim *dim = layer->dimList[d]; + if (dim->hidden) continue; XMLDoc->printconcat("\n", dim->name.c_str(), dim->units.c_str()); XMLDoc->printconcat("", dim->name.c_str(), dim->defaultValue.c_str(), 1); XMLDoc->concat(dim->values.c_str()); @@ -1347,6 +1361,7 @@ int CXMLGen::getWMS_1_3_0_Capabilities(CT::string *XMLDoc, std::vectordimList.size(); d++) { WMSLayer::Dim *dim = layer->dimList[d]; + if (dim->hidden) continue; if (dim->name.indexOf("time") != -1) { XMLDoc->printconcat("", dim->name.c_str(), dim->units.c_str(), dim->defaultValue.c_str(), 1); diff --git a/adagucserverEC/CXMLGen.h b/adagucserverEC/CXMLGen.h index 2edc7c95..678e8148 100644 --- a/adagucserverEC/CXMLGen.h +++ b/adagucserverEC/CXMLGen.h @@ -53,6 +53,7 @@ class WMSLayer { CT::string values; CT::string defaultValue; int hasMultipleValues; + bool hidden = false; }; class Projection { public: