Ignore:
Timestamp:
Aug 8, 2007, 12:42:55 PM (16 years ago)
Author:
dominic
Message:
 
Location:
trunk/uk/ac/ebi/AnnotationTypeCvImporter/src/uk/ac/ebi/nugo/plugins
Files:
2 added
2 deleted
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/uk/ac/ebi/AnnotationTypeCvImporter/src/uk/ac/ebi/nugo/plugins/AnnotationTypeCvImporter.java

    r359 r378  
    3434import net.sf.basedb.util.parser.FlatFileParser;
    3535import net.sf.basedb.util.parser.Mapper;
    36 import uk.ac.ebi.nugo.plugins.util.Values;
     36import net.sf.basedb.util.Values;
    3737
    3838
     
    419419  private ItemResultList<AnnotationTypeCategory> categories;
    420420  private ItemQuery<AnnotationTypeCategory> categoryQuery;
    421   private boolean updateExisting, enumeration,found;
     421  private boolean updateExisting, enumeration;
    422422  private String separator;
    423423  private int numInserted;
  • trunk/uk/ac/ebi/AnnotationTypeCvImporter/src/uk/ac/ebi/nugo/plugins/util/ZipUnpacker.java

    r359 r378  
    99import java.io.IOException;
    1010import java.io.InputStream;
    11 import java.text.SimpleDateFormat;
    12 import java.util.Date;
    13 import java.util.Locale;
    1411import java.util.zip.ZipEntry;
    1512import java.util.zip.ZipInputStream;
    16 
    17 import org.apache.log4j.Logger;
    18 
    19 import uk.ac.ebi.nugo.plugins.tab2mageimport.validation.Tab2MageValidationFactory;
    2013
    2114import net.sf.basedb.core.DbControl;
     
    2316import net.sf.basedb.core.File;
    2417import net.sf.basedb.core.Location;
    25 import net.sf.basedb.core.Path;
    26 import net.sf.basedb.core.SessionControl;
    27 import net.sf.basedb.core.Path.Type;
     18import net.sf.basedb.core.PluginDefinition;
    2819import net.sf.basedb.core.Quota;
    2920import net.sf.basedb.core.QuotaType;
     21import net.sf.basedb.core.SessionControl;
    3022import net.sf.basedb.core.SystemItems;
    3123import net.sf.basedb.core.User;
    32 import net.sf.basedb.core.PluginDefinition;
    3324import net.sf.basedb.util.zip.FileUnpacker;
     25
     26import org.apache.log4j.Logger;
    3427
    3528
     
    4639public class ZipUnpacker
    4740{
    48   protected static Logger log = Logger.getLogger(Tab2MageValidationFactory.class);
     41  protected static Logger log = Logger.getLogger(ZipUnpacker.class);
    4942  private User user;
    5043  private File file;
     
    5548  private SessionControl sc;
    5649 
    57   public ZipUnpacker(File zipFile, User user, DbControl dc)
     50  public ZipUnpacker(File zipFile, User user, SessionControl sc)
    5851  {
    5952    this.user = user;
    60     this.dc=dc;
     53    this.dc=sc.newDbControl();
    6154    this.file= zipFile;
    62     this.sc= dc.getSessionControl();
     55    //this.sc= dc.getSessionControl();
    6356  }
    6457  /**
    6558    Unpacks a zip file, checking that there is enough space to accommodate
    6659    the zip file once it is unpacked.
    67    * @throws NutribasePluginException
     60      @throws NutribasePluginException
    6861   */
    6962  public void unpack() throws NutribasePluginException
    7063  {
    71     System.out.println("Begin to unpack the files");
     64    log.info("Begin to unpack the files");
    7265    try
    7366    {
     
    9487    catch (Throwable exc)
    9588    {
     89      dc.close();
     90      log.info("File cannot be unpacked", exc);
    9691      new NutribasePluginException(exc.getMessage());
    9792    }
    9893    finally
    9994    {
    100      
     95      if (dc!=null)
     96        dc.close();
    10197    }
    10298  }
     
    160156      catch (IOException ioe)
    161157      {
    162         ioe.printStackTrace();
     158        //ioe.printStackTrace();
     159        log.error(ioe.getMessage());
    163160      }
    164161      return totalSize;
    165162    }
    166  
     163  /**
     164    create a sub-directory to contain the unzip files
     165    @param zipFile, the zip file to unpack
     166    @param user, currently logged-in user
     167    @param dc, the database control
     168   */
    167169  public void createSubDirectory(File zipFile, User user , DbControl dc)
    168170  {
     
    170172     
    171173        Directory zipFileDir = zipFile.getDirectory();
    172         System.out.println("zipFile is located in dir " + zipFileDir.toString());
     174        log.info("zipFile is located in dir " + zipFileDir.toString());
    173175        Directory subDir = Directory.getNew(dc, zipFileDir);
    174176        String fileName = zipFile.getName();
    175177        String fileNameNoExt = fileName.substring(0, fileName.indexOf("."));
    176         //System.out.println("new subDir = " + fileNameNoExt );
    177178        subDir.setName(fileNameNoExt);
    178  
    179         // save the new subDir
    180179        dc.saveItem(subDir);
    181180        unzippedFilesDirectory = subDir;
Note: See TracChangeset for help on using the changeset viewer.