All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.zoodb.jdo.api.DataStoreManager Maven / Gradle / Ivy

The newest version!
/*
 * Copyright 2009-2013 Tilmann Zaeschke. All rights reserved.
 * 
 * This file is part of ZooDB.
 * 
 * ZooDB 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.
 * 
 * ZooDB 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 ZooDB.  If not, see .
 * 
 * See the README and COPYING files for further information. 
 */
package org.zoodb.jdo.api;


/**
 * This interface provides functionality to perform database management operations, such as
 * creating and removing database.
 * 
 * By default databases are create in %USER_HOME%/zoodb on Windows or ~/zoodb on Linux/UNIX.
 * 
 * @author ztilmann
 */
public interface DataStoreManager {

	/**
	 * Create a database file.
	 * 
	 * If only a file name is given, the database will create in %USER_HOME%/zoodb on Windows 
	 * or ~/zoodb on Linux/UNIX.
	 * 
	 * If a full path is given, the full path will be used instead.
	 * 
     * Any necessary parent folders are created automatically.

     * It is recommended to use .zdb as file extension, for example 
     * myDatabase.zdb.
     * 
	 * @param dbName
	 * @see ZooJdoProperties#ZooJdoProperties(String)
	 */
	public void createDb(String dbName);
	
	/**
	 * Check if a database exists. This checks only whether the file exists, not whether it is a 
	 * valid database file.
	 * 
	 * @param dbName
	 * @return true if the database exists.
	 */
    public boolean dbExists(String dbName);

    /**
     * Delete a database(-file).
     * @param dbName
     */
    public void removeDb(String dbName);
	
    /**
     * 
     * @return The default database folder.
     */
	public String getDefaultDbFolder();
	
	/**
	 * Calculates the full path for the given database name, whether the database exists or not.
	 * @param dbName
	 * @return The full path of the database given by dbName.
	 */
	public String getDbPath(String dbName);
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy