jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thomas Mueller" <thomas.tom.muel...@gmail.com>
Subject Re: Reset repository on server startup?
Date Wed, 11 Jul 2007 08:13:37 GMT
Hi,

I got only 8 tables, and use this method:

    public static Connection deleteRepository(Connection conn) throws
Exception {
        Statement stat = conn.createStatement();
        executeSilently(stat, "DROP TABLE default_binval", false);
        executeSilently(stat, "DROP TABLE default_node", false);
        executeSilently(stat, "DROP TABLE default_prop", false);
        executeSilently(stat, "DROP TABLE default_refs", false);
        executeSilently(stat, "DROP TABLE version_binval", false);
        executeSilently(stat, "DROP TABLE version_node", false);
        executeSilently(stat, "DROP TABLE version_prop", false);
        executeSilently(stat, "DROP TABLE version_refs", false);
        return conn;
    }

To delete the whole repository, you probably also want to delete the
repository directory:

    static void deleteRecursive(File file) throws IOException {
        if(file.isDirectory()) {
            File[] list = file.listFiles();
            for(int i=0; i<list.length; i++) {
                deleteRecursive(list[i]);
            }
        }
        if(file.exists() && !file.delete()) {
            throw new IOException("Could not delete " + file.getAbsolutePath());
        }
    }

I hope that helps,
Thomas

On 7/10/07, Mihai Anescu <manescu@totalsoft.ro> wrote:
> Hi again
>
> I have set up my repository in a DB.
> I'm using a JBoss server.
>
> So now I have about 10 tables in a schema, for the JR repository,
> workspace and versioning.
>
> I would like to know if there is a way to run a SQL script when I start
> the server. I want to clean the repository of existing data.
>

Mime
View raw message