public function load(AbstractMetaModel $environment_metamodel, array $filters = NULL) { LogHelper::log_notice(t('Loading Environment Meta Model from settings.php ...')); $datasourceCount = 0; $configurationDataSources = Environment::getInstance()->getConfigurationSection('Data Sources'); if (isset($configurationDataSources)) { foreach ($configurationDataSources as $namespace => $sourceDataSources) { foreach ($sourceDataSources as $datasourceName => $sourceDataSource) { $datasourceName = NameSpaceHelper::resolveNameSpace($namespace, $datasourceName); $datasource = new DataSourceMetaData(); $datasource->name = $datasourceName; $datasource->initializeFrom($sourceDataSource); // it is possible that configuration contains 'readonly' property. We need to honor it // ... and only when it is not set we mark the data source as read only if (!isset($datasource->readonly)) { $datasource->readonly = TRUE; } $environment_metamodel->registerDataSource($datasource); $datasourceCount++; } } } LogHelper::log_info(t('Processed @datasourceCount data sources', array('@datasourceCount' => $datasourceCount))); }
public function load(AbstractMetaModelFactory $factory, AbstractMetaModel $environment_metamodel, array $filters = NULL, $finalAttempt) { LogHelper::log_notice(t('Loading Environment Meta Model from settings.php ...')); $datasourceCount = 0; $configurationDataSources = Environment::getInstance()->getConfigurationSection('Data Sources'); if (isset($configurationDataSources)) { foreach ($configurationDataSources as $namespace => $sourceDataSources) { foreach ($sourceDataSources as $datasourceName => $sourceDataSource) { $datasourceName = NameSpaceHelper::resolveNameSpace($namespace, $datasourceName); $datasource = new DataSourceMetaData(); $datasource->name = $datasourceName; $datasource->system = TRUE; $datasource->readonly = TRUE; $datasource->initializeFrom($sourceDataSource); $environment_metamodel->registerDataSource($datasource); $datasourceCount++; } } } LogHelper::log_info(t('Processed @datasourceCount data sources', array('@datasourceCount' => $datasourceCount))); return self::LOAD_STATE__SUCCESSFUL; }
protected function mergeWithCube(AbstractMetaModel $metamodel, array $filters = NULL, $namespace, $sourceCubeName, $sourceCube) { $cubeName = NameSpaceHelper::resolveNameSpace($namespace, $sourceCubeName); // cube/sourceDataset/Name if (!isset($sourceCube->sourceDatasetName)) { throw new IllegalStateException(t("'@cubeName' cube definition does not contain a reference to source dataset", array('@cubeName' => isset($sourceCube->publicName) ? $sourceCube->publicName : $cubeName))); } $sourceCube->sourceDatasetName = NameSpaceHelper::resolveNameSpace($namespace, $sourceCube->sourceDatasetName); // fix dimensions if (isset($sourceCube->dimensions)) { foreach ($sourceCube->dimensions as $dimension) { if (isset($dimension->levels)) { foreach ($dimension->levels as $level) { // cube/dimension/level/dataset/name if (!isset($level->datasetName)) { continue; } $level->datasetName = NameSpaceHelper::resolveNameSpace($namespace, $level->datasetName); } } } } // cube/region/dataset/name if (isset($sourceCube->regions)) { foreach ($sourceCube->regions as $regionName => $region) { if (!isset($region->datasetName)) { throw new IllegalStateException(t("'@regionName' region of '@cubeName' cube does not contain a reference to dataset", array('@cubeName' => isset($sourceCube->publicName) ? $sourceCube->publicName : $cubeName, '@regionName' => $regionName))); } $region->datasetName = NameSpaceHelper::resolveNameSpace($namespace, $region->datasetName); } } $cube = new CubeMetaData(); $cube->name = $cubeName; $cube->initializeFrom($sourceCube); $metamodel->registerCube($cube); return $cube; }
protected function mergeWithCube(AbstractMetaModel $metamodel, array $filters = NULL, $namespace, $sourceCubeName, $sourceCube) { $cubeName = NameSpaceHelper::resolveNameSpace($namespace, $sourceCubeName); // cube/sourceDataset/Name if (!isset($sourceCube->factsDatasetName)) { throw new IllegalStateException(t( '%cubeName cube definition does not contain a reference to facts dataset', array('%cubeName' => (isset($sourceCube->publicName) ? $sourceCube->publicName : $cubeName)))); } $sourceCube->factsDatasetName = NameSpaceHelper::resolveNameSpace($namespace, $sourceCube->factsDatasetName); // fix dimensions if (isset($sourceCube->dimensions)) { foreach ($sourceCube->dimensions as $dimension) { // cube/dimension/dataset/name if (!isset($dimension->datasetName)) { continue; } $dimension->datasetName = NameSpaceHelper::resolveNameSpace($namespace, $dimension->datasetName); } } $cube = new CubeMetaData(); $cube->name = $cubeName; $cube->initializeFrom($sourceCube); $isCubeAcceptable = $this->isMetaDataAcceptable($cube, $filters); // TODO eliminate this check in the future. Use different approach if ($isCubeAcceptable) { $isCubeAcceptable = $metamodel->findDataset($cube->factsDatasetName) !== NULL; } if ($isCubeAcceptable) { $metamodel->registerCube($cube); } return $cube; }