plugins/base2/net.sf.basedb.illumina/trunk/src/net/sf/basedb/illumina/filehandler/BgxValidationAction.java

Code
Comments
Other
Rev Date Author Line
1385 02 Sep 11 martin 1 /**
1385 02 Sep 11 martin 2   $Id:
1385 02 Sep 11 martin 3
1385 02 Sep 11 martin 4   Copyright (C) 2011 Martin Svensson
1385 02 Sep 11 martin 5
1385 02 Sep 11 martin 6   This file is part of BASE - BioArray Software Environment.
1385 02 Sep 11 martin 7   Available at http://base.thep.lu.se/
1385 02 Sep 11 martin 8
1385 02 Sep 11 martin 9   BASE is free software; you can redistribute it and/or
1385 02 Sep 11 martin 10   modify it under the terms of the GNU General Public License
1385 02 Sep 11 martin 11   as published by the Free Software Foundation; either version 3
1385 02 Sep 11 martin 12   of the License, or (at your option) any later version.
1385 02 Sep 11 martin 13
1385 02 Sep 11 martin 14   BASE is distributed in the hope that it will be useful,
1385 02 Sep 11 martin 15   but WITHOUT ANY WARRANTY; without even the implied warranty of
1385 02 Sep 11 martin 16   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1385 02 Sep 11 martin 17   GNU General Public License for more details.
1385 02 Sep 11 martin 18
1385 02 Sep 11 martin 19   You should have received a copy of the GNU General Public License
1385 02 Sep 11 martin 20   along with BASE. If not, see <http://www.gnu.org/licenses/>.
1385 02 Sep 11 martin 21 */
1385 02 Sep 11 martin 22 package net.sf.basedb.illumina.filehandler;
1385 02 Sep 11 martin 23
1385 02 Sep 11 martin 24 import net.sf.basedb.core.ArrayDesign;
1385 02 Sep 11 martin 25 import net.sf.basedb.core.DbControl;
1385 02 Sep 11 martin 26 import net.sf.basedb.core.FileSetMember;
1385 02 Sep 11 martin 27 import net.sf.basedb.core.InvalidDataException;
1385 02 Sep 11 martin 28 import net.sf.basedb.core.InvalidRelationException;
1385 02 Sep 11 martin 29 import net.sf.basedb.illumina.Illumina;
1385 02 Sep 11 martin 30 import net.sf.basedb.util.fileset.SingleFileValidationAction;
1385 02 Sep 11 martin 31
1385 02 Sep 11 martin 32 /**
1385 02 Sep 11 martin 33
1385 02 Sep 11 martin 34   @author Martin
1385 02 Sep 11 martin 35   @since 1.7
1385 02 Sep 11 martin 36   @base.modified $Date: 2011-05-06 14:09:13 +0200 (Fri, 06 May 2011) $ 
1385 02 Sep 11 martin 37 */
1385 02 Sep 11 martin 38 public class BgxValidationAction
1385 02 Sep 11 martin 39   extends SingleFileValidationAction
1385 02 Sep 11 martin 40 {
1385 02 Sep 11 martin 41   private final DbControl dc;
1385 02 Sep 11 martin 42   private final ArrayDesign design;
1385 02 Sep 11 martin 43   private final BgxValidator validator;
1385 02 Sep 11 martin 44   
1385 02 Sep 11 martin 45   public BgxValidationAction(DbControl dc, ArrayDesign design)
1385 02 Sep 11 martin 46   {
1385 02 Sep 11 martin 47     super(Illumina.BGX_FILE_ID);
1385 02 Sep 11 martin 48     this.dc = dc;
1385 02 Sep 11 martin 49     this.design = design;
1385 02 Sep 11 martin 50     this.validator = new BgxValidator();
1385 02 Sep 11 martin 51   }  
1385 02 Sep 11 martin 52   
1385 02 Sep 11 martin 53   @Override
1385 02 Sep 11 martin 54   public void resetMetadata() 
1385 02 Sep 11 martin 55   {
1385 02 Sep 11 martin 56     validator.resetMetadata(design);    
1385 02 Sep 11 martin 57   }
1385 02 Sep 11 martin 58
1385 02 Sep 11 martin 59   @Override
1385 02 Sep 11 martin 60   public void validateAndExtractMetadata() 
1385 02 Sep 11 martin 61     throws InvalidDataException,InvalidRelationException 
1385 02 Sep 11 martin 62   {
1385 02 Sep 11 martin 63     FileSetMember bgxMember = getAcceptedFile();
1385 02 Sep 11 martin 64     validator.copyMetaData(bgxMember.getFile(), design);
1385 02 Sep 11 martin 65   }
1385 02 Sep 11 martin 66 }