Changeset 378 for trunk/uk/ac/ebi/AnnotationTypeCvImporter
- Timestamp:
- Aug 8, 2007, 12:42:55 PM (16 years ago)
- 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 34 34 import net.sf.basedb.util.parser.FlatFileParser; 35 35 import net.sf.basedb.util.parser.Mapper; 36 import uk.ac.ebi.nugo.plugins.util.Values;36 import net.sf.basedb.util.Values; 37 37 38 38 … … 419 419 private ItemResultList<AnnotationTypeCategory> categories; 420 420 private ItemQuery<AnnotationTypeCategory> categoryQuery; 421 private boolean updateExisting, enumeration ,found;421 private boolean updateExisting, enumeration; 422 422 private String separator; 423 423 private int numInserted; -
trunk/uk/ac/ebi/AnnotationTypeCvImporter/src/uk/ac/ebi/nugo/plugins/util/ZipUnpacker.java
r359 r378 9 9 import java.io.IOException; 10 10 import java.io.InputStream; 11 import java.text.SimpleDateFormat;12 import java.util.Date;13 import java.util.Locale;14 11 import java.util.zip.ZipEntry; 15 12 import java.util.zip.ZipInputStream; 16 17 import org.apache.log4j.Logger;18 19 import uk.ac.ebi.nugo.plugins.tab2mageimport.validation.Tab2MageValidationFactory;20 13 21 14 import net.sf.basedb.core.DbControl; … … 23 16 import net.sf.basedb.core.File; 24 17 import 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; 18 import net.sf.basedb.core.PluginDefinition; 28 19 import net.sf.basedb.core.Quota; 29 20 import net.sf.basedb.core.QuotaType; 21 import net.sf.basedb.core.SessionControl; 30 22 import net.sf.basedb.core.SystemItems; 31 23 import net.sf.basedb.core.User; 32 import net.sf.basedb.core.PluginDefinition;33 24 import net.sf.basedb.util.zip.FileUnpacker; 25 26 import org.apache.log4j.Logger; 34 27 35 28 … … 46 39 public class ZipUnpacker 47 40 { 48 protected static Logger log = Logger.getLogger( Tab2MageValidationFactory.class);41 protected static Logger log = Logger.getLogger(ZipUnpacker.class); 49 42 private User user; 50 43 private File file; … … 55 48 private SessionControl sc; 56 49 57 public ZipUnpacker(File zipFile, User user, DbControl dc)50 public ZipUnpacker(File zipFile, User user, SessionControl sc) 58 51 { 59 52 this.user = user; 60 this.dc= dc;53 this.dc=sc.newDbControl(); 61 54 this.file= zipFile; 62 this.sc= dc.getSessionControl();55 //this.sc= dc.getSessionControl(); 63 56 } 64 57 /** 65 58 Unpacks a zip file, checking that there is enough space to accommodate 66 59 the zip file once it is unpacked. 67 *@throws NutribasePluginException60 @throws NutribasePluginException 68 61 */ 69 62 public void unpack() throws NutribasePluginException 70 63 { 71 System.out.println("Begin to unpack the files");64 log.info("Begin to unpack the files"); 72 65 try 73 66 { … … 94 87 catch (Throwable exc) 95 88 { 89 dc.close(); 90 log.info("File cannot be unpacked", exc); 96 91 new NutribasePluginException(exc.getMessage()); 97 92 } 98 93 finally 99 94 { 100 95 if (dc!=null) 96 dc.close(); 101 97 } 102 98 } … … 160 156 catch (IOException ioe) 161 157 { 162 ioe.printStackTrace(); 158 //ioe.printStackTrace(); 159 log.error(ioe.getMessage()); 163 160 } 164 161 return totalSize; 165 162 } 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 */ 167 169 public void createSubDirectory(File zipFile, User user , DbControl dc) 168 170 { … … 170 172 171 173 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()); 173 175 Directory subDir = Directory.getNew(dc, zipFileDir); 174 176 String fileName = zipFile.getName(); 175 177 String fileNameNoExt = fileName.substring(0, fileName.indexOf(".")); 176 //System.out.println("new subDir = " + fileNameNoExt );177 178 subDir.setName(fileNameNoExt); 178 179 // save the new subDir180 179 dc.saveItem(subDir); 181 180 unzippedFilesDirectory = subDir;
Note: See TracChangeset
for help on using the changeset viewer.