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

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


    /** A counter used to obtain unique data store names. */
    private static int dbStoreIndex = 0;
    /** Utility method returning a fresh data store. */
    private static synchronized DataStore getStore() {
        DataStore store = new DataStore("testVFMemDB-" + dbStoreIndex++);
        // We need the root to exist.
        assertNotNull(store.createEntry(java.io.File.separator, true));
        return store;
    }
View Full Code Here


                    dbData = null;
                }
                if (dbData == null) {
                    if (uniqueName != null) {
                        // Create a new data store.
                        this.dbData = new DataStore(canonicalName);
                        DATABASES.put(canonicalName, dbData);
                    } else {
                        // We have a database name, but no unique name.
                        // Assume that the client only wants to do some
                        // "book-keeping" operations, like getting the
View Full Code Here

    public void shutdown() {
        // If the data store has been scheduled for deletion, which happens
        // when the store detects that the service root has been deleted, then
        // delete the whole store to release the memory.
        if (dbData.scheduledForDeletion()) {
            DataStore store;
            synchronized (DATABASES) {
                store = (DataStore)DATABASES.remove(canonicalName);
                // Must clean up the dummy while holding monitor.
                if (store != null && store == dbData) {
                    dbDropCleanupInDummy(canonicalName);
View Full Code Here

     * @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

                    dbData = null;
                }
                if (dbData == null) {
                    if (uniqueName != null) {
                        // Create a new data store.
                        this.dbData = new DataStore(canonicalName);
                        DATABASES.put(canonicalName, dbData);
                    } else {
                        // We have a database name, but no unique name.
                        // Assume that the client only wants to do some
                        // "book-keeping" operations, like getting the
View Full Code Here

    public void shutdown() {
        // If the data store has been scheduled for deletion, which happens
        // when the store detects that the service root has been deleted, then
        // delete the whole store to release the memory.
        if (dbData.scheduledForDeletion()) {
            DataStore store;
            synchronized (DATABASES) {
                store = (DataStore)DATABASES.remove(canonicalName);
                // Must clean up the dummy while holding monitor.
                if (store != null && store == dbData) {
                    dbDropCleanupInDummy(canonicalName);
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

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.