protected function createSqlDbMap()
    {
        if ($this->getSqlDbMap() === null) {
            return;
        }

        // Produce the sql -> database map
        $sqldbmap = new Properties();

        // Check to see if the sqldbmap has already been created.
        if ($this->getSqlDbMap()->exists()) {
            $sqldbmap->load($this->getSqlDbMap());
        }

        if ($this->packageObjectModel) {
            // in this case we'll get the sql file name from the package attribute
            $dataModels = $this->packageDataModels();
            foreach ($dataModels as $package => $dataModel) {
                foreach ($dataModel->getDatabases() as $database) {
                    $name = ($package ? $package . '.' : '') . 'schema.xml';
                    $sqlFile = $this->getMappedFile($name);
                    $sqldbmap->setProperty($sqlFile->getName(), $database->getName());
                }
            }
        } else {
            // the traditional way is to map the schema.xml filenames
            $dmMap = $this->getDataModelDbMap();
            foreach (array_keys($dmMap) as $dataModelName) {
                $sqlFile = $this->getMappedFile($dataModelName);
                if ($this->getDatabase() === null) {
                    $databaseName = $dmMap[$dataModelName];
                } else {
                    $databaseName = $this->getDatabase();
                }
                $sqldbmap->setProperty($sqlFile->getName(), $databaseName);
            }
        }

        try {
            $sqldbmap->store($this->getSqlDbMap(), "Sqlfile -> Database map");
        } catch (IOException $e) {
            throw new IOException("Unable to store properties: " . $e->getMessage());
        }
    }