@@ -0,0 +1,2126 @@
+package org.intermine.task;%0A%0A/*%0A * Copyright (C) 2002-2004 FlyMine%0A *%0A * This code may be freely distributed and modified under the%0A * terms of the GNU Lesser General Public Licence.  This should%0A * be distributed with the code.  See the LICENSE file for more%0A * information or http://www.gnu.org/copyleft/lesser.html.%0A *%0A */%0A%0A%0Aimport java.sql.SQLException;%0A%0Aimport org.apache.tools.ant.BuildException;%0Aimport org.apache.tools.ant.Task;%0A%0Aimport org.intermine.sql.Database;%0Aimport org.intermine.objectstore.ObjectStore;%0Aimport org.intermine.objectstore.intermine.ObjectStoreInterMineImpl;%0Aimport org.intermine.objectstore.ObjectStoreFactory;%0Aimport org.intermine.sql.precompute.PrecomputedTableManager;%0A%0A/**%0A * A Task that drops all precomputed tables in an ObjectStore.%0A *%0A * @author Kim Rutherford%0A */%0A%0Apublic class DropPrecomputedTablesTask extends Task%0A%7B%0A    protected String alias;%0A%0A    /**%0A     * Set the ObjectStore alias%0A     * @param alias the ObjectStore alias%0A     */%0A    public void setAlias(String alias) %7B%0A        this.alias = alias;%0A    %7D%0A%0A    /**%0A     * @see Task#execute%0A     */%0A    public void execute() throws BuildException %7B%0A        if (alias == null) %7B%0A            throw new BuildException(%22alias attribute is not set%22);%0A        %7D%0A%0A        ObjectStore objectStore;%0A%0A        try %7B%0A            objectStore = ObjectStoreFactory.getObjectStore(alias);%0A        %7D catch (Exception e) %7B%0A            throw new BuildException(%22Exception while creating ObjectStore%22, e);%0A        %7D%0A%0A        if (objectStore instanceof ObjectStoreInterMineImpl) %7B%0A            Database db = ((ObjectStoreInterMineImpl) objectStore).getDatabase();%0A%0A            try %7B%0A                PrecomputedTableManager ptm = PrecomputedTableManager.getInstance(db);%0A                ptm.dropEverything();%0A            %7D catch (SQLException e) %7B%0A                throw new BuildException(%22failed to drop precomputed tables%22, e);%0A            %7D%0A        %7D else %7B%0A            throw new BuildException(%22ObjectStore specified by %5C%22%22 + alias + %22%5C%22 is not an %22%0A                                     + %22instance of ObjectStoreInterMineImpl%22);%0A        %7D%0A%0A    %7D%0A%7D%0A

A Task that drops all precomputed tables in an ObjectStore.