/**
 * 
 */
package com.airnoise.services;

import java.sql.SQLException;

import com.airnoise.core.exception.PersistenceException;
import com.airnoise.dao.DataBaseManager;

/**
 * @author tomio
 * 
 */
public class DataBaseManagementService {
    private DataBaseManager manager;
    
    public DataBaseManagementService(DataBaseManager manager) {
        this.manager = manager;
    }
    
    public void createDB() throws PersistenceException {
        try {
            this.manager.getDataBaseManagementDAO().createDB();
        } catch (SQLException e) {
            throw new PersistenceException("Error creating database", e);
        }
    }
    
    public void reinitializeDB() throws PersistenceException {
        try {
            this.manager.getDataBaseManagementDAO().reinitializeDB();
        } catch (SQLException e) {
            throw new PersistenceException("Error reinitializing the database", e);
        }
    }
    
}
