Package org.apache.derby.impl.io.vfmem

Examples of org.apache.derby.impl.io.vfmem.DataStore


     * @return {@code true} if the database was deleted, {@code false} otherwise
     */
    public static boolean purgeDatabase(final String dbName) {
        // TODO: Should we check if the database is booted / active?
        synchronized (DATABASES) {
            DataStore store = (DataStore)DATABASES.remove(dbName);
            if (store != null) {
                // Delete everything.
                store.purge();
                return true;
            }
            return false;
        }
    }
View Full Code Here


                if (DATABASES.containsKey(canonicalName)) {
                    // Fetch the existing data store.
                    this.dbData = (DataStore)DATABASES.get(canonicalName);
                } else {
                    // Create a new data store.
                    this.dbData = new DataStore(canonicalName);
                    DATABASES.put(canonicalName, dbData);
                }
            }
            // Specify the data directory and the temp directory.
            dataDirectory = new VirtualFile(canonicalName, dbData);
            tempDir = new VirtualFile(normalizePath(canonicalName, "tmp"),
                                      dbData);

        // Handle cases where the database name is null, but a system home
        // directory has been specified.
        } else if (home != null) {
            // Return the "system home directory" and create a temporary
            // directory for it.
            final String absHome = new File(home).getCanonicalPath();
            synchronized (DATABASES) {
                dbData = (DataStore)DATABASES.get(absHome);
                if (dbData == null) {
                    // Create a new data store for the specified home.
                    dbData = new DataStore(absHome);
                    DATABASES.put(absHome, dbData);
                }
            }
            dataDirectory = new VirtualFile(absHome, dbData);
            tempDir = new VirtualFile(getSeparator() + "tmp", dbData);
View Full Code Here

    public VirtualFileTest(String name) {
        super(name);
    }

    public void testCreateFileInRoot() {
        DataStore store = getStore();
        VirtualFile vFile = new VirtualFile("service.properties", store);
        assertFalse(new VirtualFile("service.properties", store).exists());
        assertFalse(vFile.exists());
    }
View Full Code Here

        assertFalse(new VirtualFile("service.properties", store).exists());
        assertFalse(vFile.exists());
    }

    public void testCreateDirInRoot() {
        DataStore store = getStore();
        VirtualFile vFile = new VirtualFile("seg0", store);
        assertFalse(vFile.exists());
        vFile.mkdir();
        assertTrue(vFile.exists());
        assertTrue(vFile.isDirectory());
View Full Code Here

        assertTrue(vFile.exists());
        assertTrue(vFile.isDirectory());
    }

    public void testCreateInvalidDir() {
        DataStore store = getStore();
        VirtualFile vFile = new VirtualFile(
                PathUtilTest.join(NON_EXISTING_DIRS),
                store);
        assertFalse(vFile.exists());
        VirtualFile tmp = new VirtualFile("", store);
View Full Code Here

        assertTrue(tmp.mkdir());
        assertFalse("Dir creation should have failed", vFile.mkdir());
    }

    public void testMkdirsValidRelative() {
        DataStore store = getStore();
        VirtualFile vFile = new VirtualFile(
                PathUtilTest.join(NON_EXISTING_DIRS),
                store);
        assertTrue(vFile.mkdirs());
    }
View Full Code Here

                store);
        assertTrue(vFile.mkdirs());
    }

    public void testMkdirsValidAbsolute() {
        DataStore store = getStore();
        VirtualFile vFile = new VirtualFile(
                PathUtilTest.joinAbs(NON_EXISTING_DIRS),
                store);
        assertTrue(vFile.mkdirs());
    }
View Full Code Here

        assertTrue(vFile.mkdirs());
    }

    public void testMkdirsInvalidAbsolute()
            throws IOException {
        DataStore store = getStore();
        VirtualFile tmp = new VirtualFile(PathUtilTest.abs("directory"), store);
        assertTrue(tmp.mkdir());
        tmp = new VirtualFile(
                PathUtilTest.joinAbs("directory", "afile"),
                store);
View Full Code Here

        assertFalse(vFile.mkdirs());
    }

    public void testMkdirsInvalidRelative()
            throws IOException {
        DataStore store = getStore();
        VirtualFile tmp = new VirtualFile("seg0", store);
        assertTrue(tmp.mkdir());
        tmp = new VirtualFile(PathUtilTest.join("seg0", "datafile"), store);
        assertTrue(tmp.createNewFile());
        assertTrue(tmp.exists());
View Full Code Here

        assertFalse(vFile.mkdir());
        assertFalse(vFile.mkdirs());
    }

    public void testGetParentRelative() {
        DataStore store = getStore();
        VirtualFile vFile = new VirtualFile(
                PathUtilTest.join(NON_EXISTING_DIRS), store);
        int count = 0;
        StorageFile parent = vFile.getParentDir();
        while (parent != null) {
View Full Code Here

TOP

Related Classes of org.apache.derby.impl.io.vfmem.DataStore

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.