@@ -0,0 +1,2578 @@
+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%0Aimport java.io.InputStream;%0Aimport java.io.FileInputStream;%0Aimport java.io.FileOutputStream;%0Aimport java.util.Properties;%0A%0Aimport org.intermine.objectstore.ObjectStore;%0Aimport org.intermine.objectstore.ObjectStoreSummaryGenerator;%0Aimport org.intermine.objectstore.ObjectStoreFactory;%0A%0Aimport org.apache.tools.ant.BuildException;%0Aimport org.apache.tools.ant.Task;%0A%0A/**%0A * Summarise an ObjectStore into a particular properties file.  The summary contains:%0A * %3Cp%3E counts of the number of objects of each class%0A * %3Cp%3E for class fields that have a small number of value, a list of those values.%0A * @author Kim Rutherford%0A */%0A%0Apublic class SummariseObjectStoreTask extends Task%0A%7B%0A    protected String alias, outputFile, inputFile;%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     * Set the input file - a Properties file containing the names of the classes and fields to%0A     * summarise.%0A     * @see ObjectStoreSummaryGenerator#getAsProperties%0A     * @param inputFile the properties file%0A     */%0A    public void setInputFile(String inputFile) %7B%0A        this.inputFile = inputFile;%0A    %7D%0A%0A    /**%0A     * Set the name of the file to write the summary into%0A     * @param outputFile the output file%0A     */%0A    public void setOutputFile(String outputFile) %7B%0A        this.outputFile = outputFile;%0A    %7D%0A%0A    /**%0A     * @see Task#execute%0A     */%0A    public void execute() throws BuildException %7B%0A        try %7B%0A            InputStream is = new FileInputStream(inputFile);%0A            Properties configProperties = new Properties();%0A            configProperties.load(is);%0A            ObjectStore os = ObjectStoreFactory.getObjectStore(alias);%0A            Properties outputProperties =%0A                ObjectStoreSummaryGenerator.getAsProperties(os, configProperties);%0A            FileOutputStream fos = new FileOutputStream(outputFile);%0A            outputProperties.store(fos, %22automatically generated from %22 + alias%0A                                   + %22 with settings from %22 + inputFile);%0A        %7D catch (Exception e) %7B%0A            org.intermine.web.LogMe.log(%22i%22, e);%0A            throw new BuildException(e);%0A        %7D%0A    %7D%0A%7D%0A

Task for summarising an ObjectStore into a properties file.