Changeset 5623


Ignore:
Timestamp:
May 6, 2011, 2:09:13 PM (10 years ago)
Author:
Nicklas Nordborg
Message:

References #1598: Use the extensions system for data file validators and metadata readers

There are major changes in this function. To summarize:

  • The metadata extraction has been merged with the validation. There are no longer need for separate implementations.
  • All information about which classes to use have been removed from the DataFileType class. Instead, each extension need to check if it can be used in a given context (eg. check the platform of the item).
  • The net.sf.basedb.core.filehandler package has been removed. Generic classes has been moved to net.sf.basedb.util.fileset (but with big changes in the actual classes). Affymetrix-related classes have been moved to net.sf.basedb.util.Affymetrix. The existing functionality can be found with some minor changes plus that we have additions to hook into the extensions system.
  • The docbook documentation we have about this needs to be updated
  • The update scripts need to remove the four columns in the DateFileTypes table and all filters, etc. referencing those columns from the gui context information.
Location:
trunk
Files:
15 added
2 deleted
30 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/clients/web/net/sf/basedb/clients/web/Base.java

    r5590 r5623  
    14231423    @param item The item the files should be associated with
    14241424    @param request The request object containing the selected files
    1425     @param validate If {@link FileSet#validate(DbControl, boolean)}
     1425    @param validate If {@link FileSet#validate(DbControl)}
    14261426      should be called or not
    1427     @param extractMetadata If meta data should be extracted or not
    1428       (requires that validate is true)
    14291427    @param cc Save the current context information. Null is allowed.
    14301428    @param maxRecent The maximum of recent items to remember.
    1431     @since 2.5
     1429    @since 3.0
    14321430  */
    14331431  @SuppressWarnings("unchecked")
    14341432  public static void updateFiles(DbControl dc, FileStoreEnabled item,
    1435     HttpServletRequest request, boolean validate, boolean extractMetadata,
     1433    HttpServletRequest request, boolean validate,
    14361434    ItemContext cc, int maxRecent)
    14371435  {
     
    14641462    if (validate)
    14651463    {
    1466       fileSet.validate(dc, extractMetadata);
     1464      fileSet.validate(dc);
    14671465    }
    14681466  }
  • trunk/src/core/core-extensions.xml

    r5609 r5623  
    5959  </extension-point>
    6060 
     61  <extension-point
     62    id="net.sf.basedb.core.filehandler.validator"
     63    >
     64    <action-class>net.sf.basedb.util.fileset.ValidationAction</action-class>
     65    <name>File set validators</name>
     66    <description>
     67      Extension point for validating and extracting metadata from files in a FileSet.
     68      Extensions can be invoked in three different contexts:
     69      1) Validation of a file set: The current item in the context is the owner of
     70        the file set (eg. the FileStoreEnabled item).
     71      2) Removing a file from a file set: The current item in the context
     72        is the owner of the file set (eg. the FileStoreEnabled item). The
     73        extension is supposed to remove metadata that was extracted from the
     74        given file.
     75      3) Checking if a given data file type can be validated or not: The current
     76        item in the context is a DataFileType and the core will only check if
     77        the action factory returns TRUE from the prepareContext method. The
     78        extensions will not actually be invoked.
     79    </description>
     80  </extension-point>
     81 
    6182  <extension
    6283    id="net.sf.basedb.core.uri.http-connection-manager"
     
    7697      <factory-class>net.sf.basedb.util.uri.http.HttpConnectionManagerActionFactory</factory-class>
    7798    </action-factory>
     99  </extension>
    78100 
     101  <extension
     102    id="net.sf.basedb.util.affymetrix.cel-validator"
     103    extends="net.sf.basedb.core.filehandler.validator"
     104    >
     105    <about>
     106      <name>CEL file validator</name>
     107      <description>
     108        Validator and metadata extractor implementation for Affymetrix CEL files.
     109        The validation is done by trying to open the file with the Affymetrix
     110        Fusion SDK. If this was successful some metadata information is extracted
     111        from the headers including chip type and algorithm parameters. The number
     112        of spots for the raw bioassay is set to the number of cells in the file.
     113      </description>
     114    </about>
     115    <index>1</index>
     116    <action-factory>
     117      <factory-class>net.sf.basedb.util.affymetrix.CelValidationFactory</factory-class>
     118    </action-factory>
    79119  </extension>
    80120
     121  <extension
     122    id="net.sf.basedb.util.affymetrix.cdf-validator"
     123    extends="net.sf.basedb.core.filehandler.validator"
     124    >
     125    <about>
     126      <name>CDF file validator</name>
     127      <description>
     128        Validator and metadata extractor implementation for Affymetrix CDF files.
     129        The validation is done by trying to open the file with the Affymetrix
     130        Fusion SDK. If this was successful some metadata information is extracted
     131        from the headers including
     132       
     133        chip type and algoritm parameters. The number
     134        of spots for the raw bioassay is set to the number of cells in the file.
     135      </description>
     136    </about>
     137    <index>1</index>
     138    <action-factory>
     139      <factory-class>net.sf.basedb.util.affymetrix.CdfValidationFactory</factory-class>
     140    </action-factory>
     141  </extension>
     142
     143  <!--
     144  <extension
     145    id="net.sf.basedb.core.filehandler.cdf-validator"
     146    extends="net.sf.basedb.core.filehandler.affymetrix.cdf"
     147    >
     148    <about>
     149      <name>CDF file validator</name>
     150      <description>
     151        Validator and metadata extractor implementation for Affymetrix CDF files.
     152        The validation is done by trying to open the file with the Affymetrix
     153        Fusion SDK. If this was successful the number of features for the array design
     154        is set to the number of probesets in the file.
     155      </description>
     156    </about>
     157    <index>1</index>
     158    <action-factory>
     159      <factory-class>net.sf.basedb.util.extensions.debug.BeanActionFactory</factory-class>
     160      <parameters>
     161        <beanClassName>net.sf.basedb.core.filehandler.CdfFileHandler</beanClassName>
     162      </parameters>
     163    </action-factory>
     164  </extension>
     165  -->
    81166</extensions>
  • trunk/src/core/net/sf/basedb/core/DataFileType.java

    r5595 r5623  
    2424import java.util.Set;
    2525
     26import net.sf.basedb.core.Transactional.Action;
    2627import net.sf.basedb.core.data.DataFileTypeData;
    27 import net.sf.basedb.core.filehandler.DataFileMetadataReader;
    28 import net.sf.basedb.core.filehandler.DataFileValidator;
    2928import net.sf.basedb.core.query.Expressions;
    3029import net.sf.basedb.core.query.Hql;
     
    3231import net.sf.basedb.info.DataFileTypeInfo;
    3332import net.sf.basedb.info.ToTransferable;
    34 import net.sf.basedb.util.ClassUtil;
    35 import net.sf.basedb.util.JarClassLoader;
     33import net.sf.basedb.util.extensions.ClientContext;
     34import net.sf.basedb.util.extensions.ExtensionsInvoker;
     35import net.sf.basedb.util.extensions.Registry;
     36import net.sf.basedb.util.extensions.manager.ExtensionsManager;
     37import net.sf.basedb.util.fileset.ValidationAction;
    3638
    3739/**
    3840  This class is used to represent types of files that are used
    3941  to hold data instead of importing the data into into the database.
    40   <p>
    41   This class can define a {@link DataFileValidator} and a
    42   {@link DataFileMetadataReader} that can be used to validate the if a
    43   file is actually of the correct type and, if it is, extract metadata from it.
    4442
    4543  @author Nicklas
     
    137135  */
    138136  public static final int MAX_EXTENSION_LENGTH = DataFileTypeData.MAX_EXTENSION_LENGTH;
    139 
    140   /**
    141     The maximum length of the class names that can be stored in the database.
    142     @see #setValidatorClass(String)
    143     @see #setMetadataReaderClass(String)
    144   */
    145   public static final int MAX_CLASSNAME_LENGTH = DataFileTypeData.MAX_CLASSNAME_LENGTH;
    146 
    147   /**
    148     The maximum length of the jar paths that can be stored in the database.
    149     @see #setValidatorJarPath(String)
    150     @see #setMetadataReaderJarPath(String)
    151   */
    152   public static final int MAX_JARPATH_LENGTH = DataFileTypeData.MAX_JARPATH_LENGTH;
    153137 
    154138  /**
     
    452436    return using;
    453437  }
    454  
    455  
    456 
    457   /**
    458     Check that the validator and meta data reader classes implement the
    459     correct interfaces.
    460     @since 2.6
     438
     439  /**
     440    Register/unregister extension points when the data file type is created
     441    or deleted.
    461442  */
    462443  @Override
    463   void validate()
    464     throws InvalidDataException, BaseException
    465   {
    466     super.validate();
    467     getValidator();
    468     getMetadataReader();
     444  void onAfterCommit(Action action)
     445  {
     446    super.onAfterCommit(action);
     447    if (action == Action.CREATE)
     448    {
     449      //register(Application.getExtensionsManager().getRegistry(), getData());
     450    }
     451    else if (action == Action.DELETE)
     452    {
     453      //unregister(Application.getExtensionsManager().getRegistry(), getData());
     454    }
    469455  }
    470456
     
    567553    return Item.fromValue(getData().getItemType());
    568554  }
    569  
    570   /**
    571     Get the class name of the Java class that is used to validate the files of
    572     this type. The class must implement the {@link DataFileValidator} interface.
    573     @return A class name or null if no validator exists
    574   */
    575   public String getValidatorClass()
    576   {
    577     return getData().getValidatorClass();
    578   }
    579  
    580   /**
    581     Set the class name of the Java class that is used to validate the files of
    582     this type. The class must implement the {@link DataFileValidator} interface.
    583     @param validatorClass The name of the class or null to disable validation
    584     @throws PermissionDeniedException If the logged in user doesn't
    585       have write permission
    586     @throws StringTooLongException If the string is longer that {@link #MAX_CLASSNAME_LENGTH}.
    587   */
    588   public void setValidatorClass(String validatorClass)
    589   {
    590     checkPermission(Permission.WRITE);
    591     getData().setValidatorClass(StringUtil.setNullableString(validatorClass,
    592         "validatorClass", MAX_CLASSNAME_LENGTH));
    593   }
    594  
    595   /**
    596     Get the path to the JAR file where the validator class is located. If the
    597     path is null the validator must be in the class path.
    598     @return The JAR path or null
    599     @since 2.6
    600   */
    601   public String getValidatorJarPath()
    602   {
    603     return getData().getValidatorJarPath();
    604   }
    605  
    606   /**
    607     Set the path to the JAR file where the validator class is located.
    608     @param validatorJarPath The path to the JAR file or null if the validator is in the class path
    609     @throws PermissionDeniedException If the logged in user doesn't
    610       have write permission
    611     @throws StringTooLongException If the string is longer that {@link #MAX_JARPATH_LENGTH}.
    612     @since 2.6
    613   */
    614   public void setValidatorJarPath(String validatorJarPath)
    615   {
    616     checkPermission(Permission.WRITE);
    617     getData().setValidatorJarPath(StringUtil.setNullableString(validatorJarPath,
    618       "validatorJarPath", MAX_JARPATH_LENGTH));
    619   }
    620  
    621  
    622   /**
    623     Create a new instance of the {@link DataFileValidator} class specified
    624     by {@link #getValidatorClass()}.
    625     @return A validator instance or null if no class has been specified
    626     @throws BaseException If an instance of the class can't be created
    627   */
    628   public DataFileValidator getValidator()
    629   {
    630     String validatorClass = getValidatorClass();
    631     if (validatorClass == null) return null;
    632     DataFileValidator validator = null;
    633     try
    634     {
    635       String jarPath = getValidatorJarPath();
    636       ClassLoader loader = jarPath == null ? null :JarClassLoader.getInstance(jarPath);
    637       validator = (DataFileValidator)ClassUtil.checkAndLoadClass(
    638           loader, validatorClass, true, DataFileValidator.class).newInstance();
    639     }
    640     catch (Throwable t)
    641     {
    642       throw new BaseException(t);
    643     }
    644     return validator;
    645   }
    646  
    647   /**
    648     Get the class name of the Java class that is used to extract metadata from files of
    649     this type. The class must implement the {@link DataFileMetadataReader} interface.
    650     @return A class name or null if no validator exists
    651   */
    652   public String getMetadataReaderClass()
    653   {
    654     return getData().getMetadataReaderClass();
    655   }
    656  
    657   /**
    658     Set the class name of the Java class that is used to extract metadata from files of
    659     this type. The class must implement the {@link DataFileMetadataReader} interface.
    660     @param metadataReaderClass The name of the class or null to disable validation
    661     @throws PermissionDeniedException If the logged in user doesn't
    662       have write permission
    663     @throws StringTooLongException If the string is longer that {@link #MAX_CLASSNAME_LENGTH}.
    664   */
    665   public void setMetadataReaderClass(String metadataReaderClass)
    666   {
    667     checkPermission(Permission.WRITE);
    668     getData().setMetadataReaderClass(StringUtil.setNullableString(metadataReaderClass,
    669       "metadataReaderClass", MAX_CLASSNAME_LENGTH));
    670   }
    671  
    672   /**
    673     Get the path to the JAR file where the meta data reader class is located. If the
    674     path is null the reader must be in the class path.
    675     @return The JAR path or null
    676     @since 2.6
    677   */
    678   public String getMetadataReaderJarPath()
    679   {
    680     return getData().getMetadataReaderJarPath();
    681   }
    682  
    683   /**
    684     Set the path to the JAR file where the meta data reader class is located.
    685     @param metadataReaderJarPath The path to the JAR file or null if the reader is in the class path
    686     @throws PermissionDeniedException If the logged in user doesn't
    687       have write permission
    688     @throws StringTooLongException If the string is longer that {@link #MAX_JARPATH_LENGTH}.
    689     @since 2.6
    690   */
    691   public void setMetadataReaderJarPath(String metadataReaderJarPath)
    692   {
    693     checkPermission(Permission.WRITE);
    694     getData().setMetadataReaderJarPath(StringUtil.setNullableString(metadataReaderJarPath,
    695       "metadataReaderJarPath", MAX_JARPATH_LENGTH));
    696   }
    697  
    698   /**
    699     Create a new instance of the {@link DataFileMetadataReader} class specified
    700     by {@link #getMetadataReaderClass()}.
    701     @return A metadata reader instance or null if no class has been specified
    702     @throws BaseException If an instance of the class can't be created
    703   */
    704   public DataFileMetadataReader getMetadataReader()
    705   {
    706     String readerClass = getMetadataReaderClass();
    707     if (readerClass == null) return null;
    708     DataFileMetadataReader reader = null;
    709     try
    710     {
    711       String jarPath = getMetadataReaderJarPath();
    712       ClassLoader loader = jarPath == null ? null : JarClassLoader.getInstance(jarPath);
    713       reader = (DataFileMetadataReader)ClassUtil.checkAndLoadClass(
    714           loader, readerClass, true, DataFileMetadataReader.class).newInstance();
    715     }
    716     catch (Throwable t)
    717     {
    718       throw new BaseException(t);
    719     }
    720     return reader;
    721   }
    722 
     555
     556  /**
     557    Check if there is at least one extension that claims to support
     558    validation of files of this type. The extensions are not actually
     559    invoked, only prepared.
     560    @since 3.0
     561  */
     562  @SuppressWarnings("unchecked")
     563  public boolean hasActiveValidator(DbControl dc)
     564  {
     565    ExtensionsManager manager = Application.getExtensionsManager();
     566    Registry registry = manager.getRegistry();
     567    ClientContext context = new ClientContext(dc, this);
     568    ExtensionsInvoker<ValidationAction> invoker =
     569          (ExtensionsInvoker<ValidationAction>)registry.useExtensions(context, manager.getSettings(), "net.sf.basedb.core.filehandler.validator");
     570    return invoker.getNumExtensions() > 0;
     571  }
     572 
    723573  /**
    724574    Get a query that returns all platforms/variants that are using this
  • trunk/src/core/net/sf/basedb/core/FileSet.java

    r4517 r5623  
    2323
    2424import java.util.ArrayList;
    25 import java.util.HashMap;
     25import java.util.Collections;
    2626import java.util.HashSet;
    2727import java.util.LinkedList;
     
    3434import net.sf.basedb.core.query.Hql;
    3535import net.sf.basedb.core.query.Restrictions;
    36 import net.sf.basedb.core.signal.ThreadSignalHandler;
    3736
    3837import net.sf.basedb.core.data.FileSetData;
    3938import net.sf.basedb.core.data.FileSetMemberData;
    4039import net.sf.basedb.core.data.DataFileTypeData;
    41 import net.sf.basedb.core.filehandler.DataFileHandler;
    42 import net.sf.basedb.core.filehandler.DataFileMetadataReader;
    43 import net.sf.basedb.core.filehandler.DataFileValidator;
     40import net.sf.basedb.util.extensions.ClientContext;
     41import net.sf.basedb.util.extensions.ExtensionsInvoker;
     42import net.sf.basedb.util.extensions.Registry;
     43import net.sf.basedb.util.extensions.manager.ExtensionsManager;
     44import net.sf.basedb.util.extensions.manager.Settings;
     45import net.sf.basedb.util.fileset.ResetMetadataRenderer;
     46import net.sf.basedb.util.fileset.ValidatingFileSetMember;
     47import net.sf.basedb.util.fileset.ValidationAction;
     48import net.sf.basedb.util.fileset.ValidationRenderer;
    4449
    4550/**
     
    312317    else
    313318    {
     319      member = getDbControl().getItem(FileSetMember.class, memberData);
    314320      if (!file.getData().equals(memberData.getFile()))
    315321      {
     322        // The file has changed -- reset metadata
    316323        memberData.setFile(file.getData());
    317324        memberData.setValid(null);
     325        memberData.setErrorMessage(null);
     326       
     327        // Create context and invoke the extensions system
     328        ExtensionsInvoker<ValidationAction> invoker = getInvoker(getDbControl());
     329       
     330        // Reset the metadata
     331        invoker.render(new ResetMetadataRenderer(Collections.singletonList(new ValidatingFileSetMember(member))));
    318332      }
    319       member = getDbControl().getItem(FileSetMember.class, memberData);
    320333    }
    321334    return member;
     
    349362 
    350363  /**
    351     Remove the member of the given type. If a {@link DataFileMetadataReader}
    352     is associated with the file type this method will call
    353     {@link DataFileMetadataReader#resetMetadata(DbControl)}.
     364    Remove the member of the given type.
    354365
    355366    @param type A <code>DataFileType</code> object
     
    362373    checkPermission(Permission.WRITE);
    363374    if (type == null) throw new InvalidUseOfNullException("type");
    364     if (getData().getMembers().containsKey(type.getData()))
     375    FileSetMemberData member = getData().getMembers().remove(type.getData());
     376    if (member != null)
    365377    {
    366378      DbControl dc = getDbControl();
    367       FileSetMemberData member = getData().getMembers().remove(type.getData());
    368       if (member != null)
    369       {
    370         FileSetMember m = dc.getItem(FileSetMember.class, member);
    371         dc.deleteItem(m);
    372         DataFileMetadataReader metadataReader = type.getMetadataReader();
    373         if (metadataReader != null)
    374         {
    375           metadataReader.setItem(getItem());
    376           metadataReader.setFile(m);
    377           metadataReader.resetMetadata(dc);
    378         }
    379       }
     379      FileSetMember m = dc.getItem(FileSetMember.class, member);
     380      dc.deleteItem(m);
     381     
     382      // Create context and invoke the extensions system
     383      ExtensionsInvoker<ValidationAction> invoker = getInvoker(dc);
     384     
     385      // Reset the metadata
     386      invoker.render(new ResetMetadataRenderer(Collections.singletonList(new ValidatingFileSetMember(m))));
    380387    }
    381388  }
     
    389396  {
    390397    checkPermission(Permission.WRITE);
     398   
     399    // Load all members of the file set
     400    DbControl dc = getDbControl();
     401    List<ValidatingFileSetMember> members = new ArrayList<ValidatingFileSetMember>(getData().getMembers().size());
     402    for (FileSetMemberData memberData : getData().getMembers().values())
     403    {
     404      FileSetMember member = dc.getItem(FileSetMember.class, memberData);
     405      members.add(new ValidatingFileSetMember(member));
     406    }
     407   
     408    // Clear the file set
    391409    getData().getMembers().clear();
     410   
     411    // Create context and invoke the extensions system
     412    ExtensionsInvoker<ValidationAction> invoker = getInvoker(dc);
     413   
     414    // Reset the metadata
     415    invoker.render(new ResetMetadataRenderer(members));
    392416  }
    393417 
     
    488512 
    489513  /**
    490     Validate the files in this file set. This method will
    491     load the validator and metadata reader for the {@link DataFileType}
    492     for each member in the file set. If more than one file type
    493     uses the same validator or metadata reader, they will all
    494     share the same instance. This method will not throw any errors
    495     that have been caused by the validation process. Errors are returned
    496     as a list of {@link Throwable}:s and is also reported by setting the
    497     {@link FileSetMember#isValid()} and {@link FileSetMember#getErrorMessage()}
    498     properties for each file.
     514    Validate the files in this file set. This method will invoke extensions
     515    for the "net.sf.basedb.core.filehandler.validator" extension point and
     516    let them handle the actual validation.
     517   
     518    This method will not throw any errors that have been caused by the validation
     519    process. Errors are returned as a list of {@link Throwable}:s and is also
     520    reported by setting the {@link FileSetMember#isValid()} and
     521    {@link FileSetMember#getErrorMessage()} properties for each file.
    499522    <p>
    500523    Note! {@link PermissionDeniedException}:s are not considered validation errors.
     
    506529    been attached to a raw bioassay, but it doesn't match the CDF file attached
    507530    to the array design. If a validator throws this exception the member status
    508     will be set to invalid, but metadata extraction is still done.
     531    will be set to invalid, but metadata is not reset.
    509532   
    510533    @param dc The DbControl to use in the validation process
    511     @param extractMetadata TRUE to also extract metadata, FALSE otherwise
    512534    @return A list of validation errors, if everything is successful the
    513535      list is empty
    514536  */
    515   public List<Throwable> validate(DbControl dc, boolean extractMetadata)
     537  public List<Throwable> validate(DbControl dc)
    516538  {
    517539    checkPermission(Permission.WRITE);
    518     // Map: Classname --> DataFileHandler instance
    519     Map<String, DataFileHandlerWrapper> handlers =
    520       new HashMap<String, DataFileHandlerWrapper>();
    521  
    522     // All validation errors
     540
     541    // List that collects all validation errors
    523542    List<Throwable> errors = new LinkedList<Throwable>();
    524543   
    525     // First pass, create validator/metadata reader instances
     544    // Load all members of the file set
     545    List<ValidatingFileSetMember> members = new ArrayList<ValidatingFileSetMember>(getData().getMembers().size());
    526546    for (FileSetMemberData memberData : getData().getMembers().values())
    527547    {
    528       ThreadSignalHandler.checkInterrupted();
    529548      FileSetMember member = dc.getItem(FileSetMember.class, memberData);
    530       DataFileType dft = member.getDataFileType();
    531       String validatorClass = dft.getValidatorClass();
    532       String metadataReaderClass = dft.getMetadataReaderClass();
    533       DataFileHandlerWrapper validator = null;
    534       DataFileHandlerWrapper metadataReader = null;
    535      
    536       // Only one instance of each type is created
    537       if (validatorClass != null)
     549      members.add(new ValidatingFileSetMember(member));
     550    }
     551 
     552    // Create context and invoke the extensions system
     553    ExtensionsInvoker<ValidationAction> invoker = getInvoker(dc);
     554   
     555    // Perform the validation
     556    invoker.render(new ValidationRenderer(members, errors));
     557   
     558    // Update flags, etc on member data items
     559    for (ValidatingFileSetMember member : members)
     560    {
     561      if (member.hasBeenAccepted())
    538562      {
    539         validator = handlers.get(validatorClass);
    540         if (validator == null)
    541         {
    542           validator = new DataFileHandlerWrapper(dft.getValidator(), getItem());
    543           handlers.put(validatorClass, validator);
    544         }
    545         validator.setFile(member);
     563        FileSetMemberData memberData = member.getMember().getData();
     564        memberData.setValid(member.isValidSoFar());
     565        memberData.setErrorMessage(member.getMessage());
    546566      }
    547       if (extractMetadata && metadataReaderClass != null)
    548       {
    549         metadataReader = handlers.get(metadataReaderClass);
    550         if (metadataReader == null)
    551         {
    552           metadataReader = new DataFileHandlerWrapper(dft.getMetadataReader(), getItem());
    553           handlers.put(metadataReaderClass, metadataReader);
    554         }
    555         if (metadataReader != validator) metadataReader.setFile(member);
    556       }
    557     }
    558    
    559     // Second pass - validate and extract metadata
    560     for (DataFileHandlerWrapper handler : handlers.values())
    561     {
    562       ThreadSignalHandler.checkInterrupted();
    563       boolean ignore = false;
    564       boolean isValid = true;
    565       boolean invalidRelation = false;
    566       String errorMessage = null;
    567       if (handler.isValidator)
    568       {
    569         try
    570         {
    571           handler.validate(dc);
    572         }
    573         catch (Throwable t)
    574         {
    575           invalidRelation = t instanceof InvalidRelationException;
    576           ignore = t instanceof PermissionDeniedException;
    577           isValid = invalidRelation;
    578           errorMessage = t.getMessage();
    579           if (!ignore)
    580           {
    581             errors.add(t);
    582             if (!invalidRelation) handler.resetMetadata(dc);
    583           }
    584         }
    585       }
    586       if (extractMetadata && handler.isMetadataReader && isValid)
    587       {
    588         try
    589         {
    590           handler.extractMetadata(dc);
    591         }
    592         catch (Throwable t)
    593         {
    594           ignore = t instanceof PermissionDeniedException;
    595           isValid = false;
    596           errorMessage = t.getMessage();
    597           if (!ignore)
    598           {
    599             errors.add(t);
    600             handler.resetMetadata(dc);
    601           }
    602         }
    603       }
    604       if (!ignore) handler.setValid(isValid, errorMessage);
    605567    }
    606568    return errors;
     569  }
     570 
     571 
     572  @SuppressWarnings("unchecked")
     573  private ExtensionsInvoker<ValidationAction> getInvoker(DbControl dc)
     574  {
     575    // Create context and invoke the extensions system
     576    FileStoreEnabled ownerItem = getItem();
     577    ClientContext context = new ClientContext(dc, ownerItem);
     578    ExtensionsManager xtManager = Application.getExtensionsManager();
     579    Registry registry = xtManager.getRegistry();
     580    Settings settings = xtManager.getSettings();
     581    ExtensionsInvoker<ValidationAction> invoker =
     582      (ExtensionsInvoker<ValidationAction>)registry.useExtensions(context, settings, "net.sf.basedb.core.filehandler.validator");
     583    return invoker;
    607584  }
    608585 
     
    618595 
    619596 
    620   /**
    621     Wraps a {@link DataFileValidator} and /or {@link DataFileMetadataReader}.
    622     as a single item. This class takes care of calling the validator/metadata reader
    623     and to set validation status and error messages on the associated file set members.
    624   */
     597 
     598 
     599  /**
     600    Wraps a {@link DataFileValidator}. This class takes care of calling the validator
     601    to validate, extract metadata and set validation status and error messages on the
     602    associated file set members.
     603  */
     604  /*
    625605  private static class DataFileHandlerWrapper
    626606  {
    627     private final DataFileHandler handler;
    628     private final boolean isValidator;
    629     private final boolean isMetadataReader;
     607    private final DataFileValidator validator;
    630608    private final FileStoreEnabled item;
    631609    private final List<FileSetMember> files;
    632610   
    633     DataFileHandlerWrapper(DataFileHandler handler, FileStoreEnabled item)
    634     {
    635       this.handler = handler;
     611    DataFileHandlerWrapper(DataFileValidator validator, FileStoreEnabled item)
     612    {
     613      this.validator = validator;
    636614      this.item = item;
    637       this.isValidator = handler instanceof DataFileValidator;
    638       this.isMetadataReader = handler instanceof DataFileMetadataReader;
    639       this.handler.setItem(item);
     615      this.validator.setItem(item);
    640616      this.files = new ArrayList<FileSetMember>();
    641617    }
     
    643619    void setFile(FileSetMember member)
    644620    {
    645       handler.setFile(member);
     621      validator.setFile(member);
    646622      this.files.add(member);
    647623    }
     
    649625    void validate(DbControl dc)
    650626    {
    651       if (isValidator) ((DataFileValidator)handler).validate(dc);
     627      validator.validate(dc);
    652628    }
    653629   
    654630    void extractMetadata(DbControl dc)
    655631    {
    656       if (isMetadataReader) ((DataFileMetadataReader)handler).extractMetadata(dc);
     632      validator.extractMetadata(dc);
    657633    }
    658634   
    659635    void resetMetadata(DbControl dc)
    660636    {
    661       if (isMetadataReader) ((DataFileMetadataReader)handler).resetMetadata(dc);
     637      validator.resetMetadata(dc);
    662638    }
    663639   
     
    672648   
    673649  }
    674  
     650  */
     651 
     652 
     653
    675654}
  • trunk/src/core/net/sf/basedb/core/FileStoreUtil.java

    r4517 r5623  
    8080   
    8181    // If data file type has no validator we accept the file as valid
    82     DataFileTypeData dft = member.getDataFileType();
    83     return dft.getValidatorClass() == null;
     82    DataFileType dft = dc.getItem(DataFileType.class, member.getDataFileType());
     83    return dft.hasActiveValidator(dc);
    8484  }
    8585
     
    9191    @param item The {@link FileStoreEnabled} item to check
    9292    @param dataFileType The external ID of the {@link DataFileType} to check for
    93     @return The file item, or null if no file of the given type exists
     93    @param requireValid TRUE to only get the data file if is a valid or unvalidated
     94      file
     95    @return The file item, or null if no (valid) file of the given type exists
    9496    @throws PermissionDeniedException If the logged in user doesn't have
    9597      read permission to the file
    96   */
    97   public static File getDataFile(DbControl dc, FileStoreEnabled item, String dataFileType)
     98    @since 3.0
     99  */
     100  public static File getDataFile(DbControl dc, FileStoreEnabled item, String dataFileType, boolean requireValid)
    98101  {
    99102    FileData file = null;
     
    105108      DataFileTypeData dft = HibernateUtil.loadData(DataFileTypeData.class, query);
    106109      FileSetMemberData member = item.getFileSet().getData().getMembers().get(dft);
    107       if (member != null) file = member.getFile();
     110      if (member != null)
     111      {
     112        if (!requireValid || !Boolean.FALSE.equals(member.isValid()))
     113        {
     114          file = member.getFile();
     115        }
     116      }
    108117    }
    109118    return file == null ? null : dc.getItem(File.class, file);
  • trunk/src/core/net/sf/basedb/core/Install.java

    r5621 r5623  
    768768      DataFileTypeData celFile = createDataFileType(
    769769        DataFileType.AFFYMETRIX_CEL, "CEL file", "Affymetrix CEL file",
    770         Item.RAWBIOASSAY, "cel", rawDataType, 
    771         "net.sf.basedb.core.filehandler.CelFileHandler",
    772         "net.sf.basedb.core.filehandler.CelFileHandler");
     770        Item.RAWBIOASSAY, "cel", rawDataType);
    773771      DataFileTypeData cdfFile = createDataFileType(
    774772        DataFileType.AFFYMETRIX_CDF, "CDF file", "Affymetrix CDF file",
    775         Item.ARRAYDESIGN, "cdf", reporterMapType, 
    776         "net.sf.basedb.core.filehandler.CdfFileHandler",
    777         "net.sf.basedb.core.filehandler.CdfFileHandler");
     773        Item.ARRAYDESIGN, "cdf", reporterMapType);
    778774      DataFileTypeData reporterMapFile = createDataFileType(
    779775        DataFileType.GENERIC_REPORTER_MAP, "Reporter map",
    780776        "Generic file that contains information about the reporters present on an array design",
    781         Item.ARRAYDESIGN, null, reporterMapType, null, null);
     777        Item.ARRAYDESIGN, null, reporterMapType);
    782778      DataFileTypeData printMapFile = createDataFileType(
    783779        DataFileType.GENERIC_PRINT_MAP, "Print map",
    784780        "Generic file that contains information about how the plates was printed on the array design",
    785         Item.ARRAYDESIGN, null, printMapType, null, null);
     781        Item.ARRAYDESIGN, null, printMapType);
    786782      DataFileTypeData rawDataFile = createDataFileType(
    787783        DataFileType.GENERIC_RAW_DATA, "Generic raw data",
    788784        "Generic file that contains the raw data of this raw bioassay",
    789         Item.RAWBIOASSAY, null, rawDataType, null, null);
     785        Item.RAWBIOASSAY, null, rawDataType);
    790786      DataFileTypeData spotDataFile = createDataFileType(
    791787        DataFileType.GENERIC_SPOT_DATA, "Generic spot data",
    792788        "Generic file that contains analysed spot data",
    793         Item.BIOASSAYSET, null, spotDataType, null, null);
     789        Item.BIOASSAYSET, null, spotDataType);
    794790      DataFileTypeData extraValueFile = createDataFileType(
    795791        DataFileType.GENERIC_EXTRAVALUE_DATA, "Generic extra value data",
    796792        "Generic file that contains extra value data",
    797         Item.EXTRAVALUE, null, extraValueType, null, null);
     793        Item.EXTRAVALUE, null, extraValueType);
    798794      DataFileTypeData baseFileSerial = createDataFileType(
    799795        DataFileType.BASEFILE_SERIAL, "Serial BASEFile",
    800796        "A serial BASEFile with spot data",
    801         Item.BIOASSAYSET, null, spotDataType, null, null);
     797        Item.BIOASSAYSET, null, spotDataType);
    802798      DataFileTypeData baseFileMatrix = createDataFileType(
    803799        DataFileType.BASEFILE_MATRIX, "Matrix BASEFile",
    804800        "A matrix BASEFile with spot data",
    805         Item.BIOASSAYSET, null, spotDataType, null, null);
     801        Item.BIOASSAYSET, null, spotDataType);
    806802      DataFileTypeData bfsMetadataFile = createDataFileType(
    807803          DataFileType.BFS_METADATA, "BFS metadata file",
    808804          "The metadata file of a BASE file set. The metadata " +
    809805          "file may reference additional files in the [files] section.",
    810           Item.BIOASSAYSET, null, spotDataType, null, null);
     806          Item.BIOASSAYSET, null, spotDataType);
    811807      DataFileTypeData mevTdmsFile = createDataFileType(
    812808        DataFileType.MEV_TDMS, "MeV TDMS",
    813809        "A MeV Tab-Delimited Multiple Sample file",
    814         Item.BIOASSAYSET, null, spotDataType, null, null);
     810        Item.BIOASSAYSET, null, spotDataType);
    815811     
    816812      // Platforms and variants
     
    27302726  private static DataFileTypeData createDataFileType(
    27312727    String externalId, String name, String description,
    2732     Item itemType, String extension, FileTypeData genericType,
    2733     String validatorClass, String metadataReaderClass)
     2728    Item itemType, String extension, FileTypeData genericType)
    27342729    throws BaseException
    27352730  {
     
    27622757        fileType.setExtension(extension);
    27632758        fileType.setGenericType(genericType);
    2764         fileType.setValidatorClass(validatorClass);
    2765         fileType.setMetadataReaderClass(metadataReaderClass);
    27662759 
    27672760        HibernateUtil.saveData(session, fileType);
  • trunk/src/core/net/sf/basedb/core/InvalidRelationException.java

    r4889 r5623  
    2222package net.sf.basedb.core;
    2323
    24 import net.sf.basedb.core.filehandler.DataFileValidator;
     24import net.sf.basedb.util.fileset.ValidationAction;
     25
    2526
    2627/**
    27   Exceptions of this type are thrown when a
    28   {@link DataFileValidator} has detected that a related
    29   file is invalid.
     28  Exceptions of this type are thrown when a 
     29  {@link ValidationAction} has detected that a file
     30  related to the main file is invalid.
    3031
    3132  @author Nicklas
  • trunk/src/core/net/sf/basedb/core/RawBioAssay.java

    r5590 r5623  
    803803
    804804    // Re-validate files
    805     if (hasFileSet()) getFileSet().validate(getDbControl(), true);
     805    if (hasFileSet()) getFileSet().validate(getDbControl());
    806806  }
    807807
  • trunk/src/core/net/sf/basedb/core/data/DataFileTypeData.java

    r4517 r5623  
    124124  }
    125125
    126   /**
    127     The maximum length of the class name that can be stored in the
    128     database.
    129   */
    130   public static final int MAX_CLASSNAME_LENGTH = 255;
    131   private String validatorClass;
    132   /**
    133     Get the class name of the Java class that is the validator for
    134     this file type. The class must implement the {@link net.sf.basedb.core.filehandler.DataFileValidator}
    135     interface. Null if there is no validator for this file type.
    136     @hibernate.property column="`validator_class`" type="string" length="255" not-null="false"
    137   */
    138   public String getValidatorClass()
    139   {
    140     return validatorClass;
    141   }
    142   public void setValidatorClass(String validatorClass)
    143   {
    144     this.validatorClass = validatorClass;
    145   }
    146  
    147   public static final int MAX_JARPATH_LENGTH = 65535;
    148   private String validatorJarPath;
    149   /**
    150     Get the path to the JAR file where the validator class is located. If the
    151     value is null the value must be in the classpath.
    152     @return The path to the JAR file
    153     @hibernate.property column="`validator_jarpath`" type="text" not-null="false"
    154     @since 2.6
    155   */
    156   public String getValidatorJarPath()
    157   {
    158     return validatorJarPath;
    159   }
    160   public void setValidatorJarPath(String validatorJarPath)
    161   {
    162     this.validatorJarPath = validatorJarPath;
    163   }
    164  
    165  
    166   private String metadataReaderClass;
    167   /**
    168     Get the class name of the Java class that extracts metadata from
    169     this file type. The class must implement the {@link net.sf.basedb.core.filehandler.DataFileMetadataReader}
    170     interface. Null if there is no extractor for this file type.
    171     @hibernate.property column="`extractor_class`" type="string" length="255" not-null="false"
    172   */
    173   public String getMetadataReaderClass()
    174   {
    175     return metadataReaderClass;
    176   }
    177   public void setMetadataReaderClass(String metadataReaderClass)
    178   {
    179     this.metadataReaderClass = metadataReaderClass;
    180   }
    181  
    182   private String metadataReaderJarPath;
    183   /**
    184     Get the path to the JAR file where the validator class is located. If the
    185     value is null the value must be in the classpath.
    186     @return The path to the JAR file
    187     @hibernate.property column="`extractor_jarpath`" type="text" not-null="false"
    188     @since 2.6
    189   */
    190   public String getMetadataReaderJarPath()
    191   {
    192     return metadataReaderJarPath;
    193   }
    194   public void setMetadataReaderJarPath(String metadataReaderJarPath)
    195   {
    196     this.metadataReaderJarPath = metadataReaderJarPath;
    197   }
    198  
    199126  private int itemType;
    200127  /**
  • trunk/src/core/net/sf/basedb/util/overview/validator/DataFileValidator.java

    r4816 r5623  
    125125    {
    126126      // Check if the file hasn't been validated even if a validator exists
    127       if (fileType.getValidatorClass() != null && member.isValid() == null)
     127      if (fileType.hasActiveValidator(dc) && member.isValid() == null)
    128128      {
    129129        context.createFailure(Validator.DATAFILE_NOTVALIDATED, node,
  • trunk/src/plugins/core/net/sf/basedb/plugins/CdfFileReporterImporter.java

    r5612 r5623  
    4040import affymetrix.fusion.cdf.FusionCDFData;
    4141
    42 import net.sf.basedb.core.Affymetrix;
    4342import net.sf.basedb.core.ArrayDesign;
    4443import net.sf.basedb.core.BaseException;
     
    6665import net.sf.basedb.core.StringParameterType;
    6766import net.sf.basedb.core.Type;
    68 import net.sf.basedb.core.filehandler.CdfFileHandler;
    6967import net.sf.basedb.core.plugin.AbstractPlugin;
    7068import net.sf.basedb.core.plugin.AutoDetectingImporter;
     
    8078import net.sf.basedb.core.signal.ThreadSignalHandler;
    8179import net.sf.basedb.util.FileUtil;
     80import net.sf.basedb.util.affymetrix.CdfValidator;
    8281
    8382/**
    8483  This plug-in can import probesets from Affymetrix CDF files as reporters.
    85   The plug-in uses the {@link Affymetrix} class for the actual work.
     84  The plug-in uses the {@link CdfValidator} class for the actual work.
    8685 
    8786  @base.developer
     
    165164      cdfFile = File.getById(dc, cdfFile.getId());
    166165      ThreadSignalHandler.checkInterrupted();
    167       FusionCDFData cdf = new CdfFileHandler().loadCdfFile(cdfFile);
     166      FusionCDFData cdf = new CdfValidator().loadCdfFile(cdfFile);
    168167 
    169168      // Import data from it
     
    263262        // Verify that the file is a CDF file
    264263        File cdfFile = (File)request.getParameterValue("file");
    265         new CdfFileHandler().loadCdfFile(cdfFile);
     264        new CdfValidator().loadCdfFile(cdfFile);
    266265       
    267266        storeValue(job, request, ri.getParameter("file"));
     
    388387          int currentArrayDesignId = sc.getCurrentContext(Item.ARRAYDESIGN).getId();
    389388          design = ArrayDesign.getById(dc, currentArrayDesignId);
    390           cdfFile = FileStoreUtil.getDataFile(dc, design, DataFileType.AFFYMETRIX_CDF);
     389          cdfFile = FileStoreUtil.getDataFile(dc, design, DataFileType.AFFYMETRIX_CDF, false);
    391390          presets = Arrays.asList(new File[] { cdfFile } );
    392391        }
     
    469468    ReporterType type = (ReporterType)job.getValue("reporterType");
    470469    String mode = (String)job.getValue("mode");
    471     int numCreated = Affymetrix.checkIfReportersExists(cdf, batcher, !"verify".equals(mode),
     470    int numCreated = new CdfValidator().checkIfReportersExists(cdf, batcher, !"verify".equals(mode),
    472471      type, progress);
    473472    return numCreated;
  • trunk/src/plugins/core/net/sf/basedb/plugins/ManualTransformCreator.java

    r5612 r5623  
    198198          }
    199199        }
    200         fs.validate(dc, true);
     200        fs.validate(dc);
    201201      }
    202202      if (allowMoreFiles)
  • trunk/src/plugins/core/net/sf/basedb/plugins/batchimport/ArrayDesignImporter.java

    r5612 r5623  
    330330  protected void doneWithItem(DbControl dc, ArrayDesign design, int numMultiLines)
    331331  {
    332     if (design.hasFileSet()) design.getFileSet().validate(dc, true);
     332    if (design.hasFileSet()) design.getFileSet().validate(dc);
    333333  }
    334334  // ------------------------------------
  • trunk/src/plugins/core/net/sf/basedb/plugins/batchimport/RawBioAssayImporter.java

    r5612 r5623  
    460460  protected void doneWithItem(DbControl dc, RawBioAssay rba, int numMultiLines)
    461461  {
    462     if (rba.hasFileSet()) rba.getFileSet().validate(dc, true);
     462    if (rba.hasFileSet()) rba.getFileSet().validate(dc);
    463463  }
    464464  // ------------------------------------
  • trunk/src/test/TestArrayDesign.java

    r5340 r5623  
    663663      File file = File.getById(dc, fileId);
    664664      ad.getFileSet().setMember(file, type);
    665       ad.getFileSet().validate(dc, true);
     665      ad.getFileSet().validate(dc);
    666666      dc.commit();
    667667      write("--Set file OK ("+fileType+")");
  • trunk/src/test/net/sf/basedb/test/FileUtil.java

    r4514 r5623  
    120120  */
    121121  public static FileSetMember addDataFile(DbControl dc, FileStoreEnabled item,
    122     String dataFileType, File file, boolean validate, boolean extractMetadata)
     122    String dataFileType, File file, boolean validate)
    123123  {
    124124    TestUtil.write("--Adding file to " + ((Nameable)item).getName() + ": " + file.getName() + "\n");
    125125    FileSetMember member = FileStoreUtil.setDataFile(dc, item, dataFileType, file);
    126     if (validate) item.getFileSet().validate(dc, extractMetadata);
     126    if (validate) item.getFileSet().validate(dc);
    127127    return member;
    128128  }
  • trunk/src/test/net/sf/basedb/test/roles/PowerUserTest.java

    r5456 r5623  
    205205      {
    206206        design = createArrayDesign(dc, genericPlatform, "Array design A");
    207         FileUtil.addDataFile(dc, design, DataFileType.GENERIC_PRINT_MAP, printMap, true, true);
     207        FileUtil.addDataFile(dc, design, DataFileType.GENERIC_PRINT_MAP, printMap, true);
    208208        affyDesign = createArrayDesign(dc, affymetrixPlatform, "Affymetrix A");
    209         FileUtil.addDataFile(dc, affyDesign, DataFileType.AFFYMETRIX_CDF, cdfFile, true, true);
     209        FileUtil.addDataFile(dc, affyDesign, DataFileType.AFFYMETRIX_CDF, cdfFile, true);
    210210      }
    211211      else
  • trunk/src/test/net/sf/basedb/test/roles/UserTest.java

    r5260 r5623  
    258258 
    259259        // Assign Affymetrix CEL files
    260         FileUtil.addDataFile(dc, affyRaw1, DataFileType.AFFYMETRIX_CEL, affy1, true, true);
    261         FileUtil.addDataFile(dc, affyRaw2, DataFileType.AFFYMETRIX_CEL, affy2, true, true);
    262         FileUtil.addDataFile(dc, affyRaw3, DataFileType.AFFYMETRIX_CEL, affy3, true, true);
     260        FileUtil.addDataFile(dc, affyRaw1, DataFileType.AFFYMETRIX_CEL, affy1, true);
     261        FileUtil.addDataFile(dc, affyRaw2, DataFileType.AFFYMETRIX_CEL, affy2, true);
     262        FileUtil.addDataFile(dc, affyRaw3, DataFileType.AFFYMETRIX_CEL, affy3, true);
    263263        dc.commit();
    264264      }
  • trunk/www/admin/datafiletypes/edit_filetype.jsp

    r5508 r5623  
    239239        </td>
    240240      </tr>
    241       <tr>
    242         <td class="prompt">Validator</td>
    243         <td><input <%=clazz%> type="text" name="validatorClass"
    244           value="<%=HTML.encodeTags(fileType == null ? Values.getString(cc.getPropertyValue("validatorClass")) : fileType.getValidatorClass())%>"
    245           size="40" maxlength="<%=DataFileType.MAX_CLASSNAME_LENGTH%>"></td>
    246       </tr>
    247       <tr>
    248         <td class="subprompt">- jar path</td>
    249         <td><input <%=clazz%> type="text" name="validatorJarPath"
    250           value="<%=HTML.encodeTags(fileType == null ? cc.getPropertyValue("validatorJarPath") : fileType.getValidatorJarPath())%>"
    251           size="50" maxlength="<%=DataFileType.MAX_JARPATH_LENGTH%>">
    252         </td>
    253       </tr>
    254       <tr>
    255         <td class="prompt">Metadata reader</td>
    256         <td><input <%=clazz%> type="text" name="metadataReaderClass"
    257           value="<%=HTML.encodeTags(fileType == null ? Values.getString(cc.getPropertyValue("metadataReaderClass")) : fileType.getMetadataReaderClass())%>"
    258           size="40" maxlength="<%=DataFileType.MAX_CLASSNAME_LENGTH%>"></td>
    259       </tr>
    260       <tr>
    261         <td class="subprompt">- jar path</td>
    262         <td><input <%=clazz%> type="text" name="metadataReaderJarPath"
    263           value="<%=HTML.encodeTags(fileType == null ? cc.getPropertyValue("metadataReaderJarPath") : fileType.getMetadataReaderJarPath())%>"
    264           size="50" maxlength="<%=DataFileType.MAX_JARPATH_LENGTH%>">
    265         </td>
    266       </tr>
    267241      <tr valign=top>
    268242        <td class="prompt">Description</td>
  • trunk/www/admin/datafiletypes/index.jsp

    r5590 r5623  
    153153      fileType.setDescription(Values.getStringOrNull(request.getParameter("description")));
    154154      fileType.setExtension(Values.getStringOrNull(request.getParameter("extension")));
    155       fileType.setValidatorClass(Values.getStringOrNull(request.getParameter("validatorClass")));
    156       fileType.setValidatorJarPath(Values.getStringOrNull(request.getParameter("validatorJarPath")));
    157       fileType.setMetadataReaderClass(Values.getStringOrNull(request.getParameter("metadataReaderClass")));
    158       fileType.setMetadataReaderJarPath(Values.getStringOrNull(request.getParameter("metadataReaderJarPath")));
    159155      int genericTypeId = Values.getInt(request.getParameter("generictype_id"), -1);
    160156      if (genericTypeId >= 0) // < 0 = denied or unchanged
  • trunk/www/admin/datafiletypes/list_filetypes.jsp

    r5590 r5623  
    287287        exportable="true"
    288288      /> 
    289       <tbl:columndef
    290         id="validatorClass"
    291         property="validatorClass"
    292         datatype="string"
    293         title="Validator"
    294         sortable="true"
    295         filterable="true"
    296         exportable="true"
    297       />
    298       <tbl:columndef
    299         id="validatorJarPath"
    300         property="validatorJarPath"
    301         datatype="string"
    302         title="Validator path"
    303         sortable="true"
    304         filterable="true"
    305         exportable="true"
    306       />
    307       <tbl:columndef
    308         id="metadataReaderClass"
    309         property="metadataReaderClass"
    310         datatype="string"
    311         title="Metadata reader"
    312         sortable="true"
    313         filterable="true"
    314         exportable="true"
    315       />
    316       <tbl:columndef
    317         id="metadataReaderJarPath"
    318         property="metadataReaderJarPath"
    319         datatype="string"
    320         title="Metadata reader path"
    321         sortable="true"
    322         filterable="true"
    323         exportable="true"
    324       />
    325289      <tbl:columndef
    326290        id="platforms"
     
    495459                    enablePropertyLink="<%=mode.hasPropertyLink()%>"
    496460                  /></tbl:cell>
    497                 <tbl:cell column="validatorClass"><%=Values.getString(item.getValidatorClass())%></tbl:cell>
    498                 <tbl:cell column="validatorJarPath"><%=Values.getString(item.getValidatorJarPath(), "<i>-&nbsp;internal&nbsp;-</i>")%></tbl:cell>
    499                 <tbl:cell column="metadataReaderClass"><%=Values.getString(item.getMetadataReaderClass())%></tbl:cell>
    500                 <tbl:cell column="metadataReaderJarPath"><%=Values.getString(item.getMetadataReaderJarPath(), "<i>-&nbsp;internal&nbsp;-</i>")%></tbl:cell>
    501461                <tbl:cell column="platforms">
    502462                  <%
  • trunk/www/admin/datafiletypes/view_filetype.jsp

    r5509 r5623  
    231231        <td class="prompt">Generic file type</td>
    232232        <td><base:propertyvalue item="<%=fileType%>" property="genericType" /></td>
    233       </tr>
    234       <tr>
    235         <td class="prompt">Validator</td>
    236         <td><%=HTML.encodeTags(fileType.getValidatorClass())%></td>
    237       </tr>
    238       <tr>
    239         <td class="subprompt">- jar path</td>
    240         <td><%=fileType.getValidatorJarPath() == null ? "<i>- internal -</i>" : fileType.getValidatorJarPath()%></td>
    241       </tr>
    242       <tr>
    243         <td class="prompt">Meta data reader</td>
    244         <td><%=HTML.encodeTags(fileType.getMetadataReaderClass())%></td>
    245       </tr>
    246       <tr>
    247         <td class="subprompt">- jar path</td>
    248         <td><%=fileType.getMetadataReaderJarPath() == null ? "<i>- internal -</i>" : fileType.getMetadataReaderJarPath()%></td>
    249233      </tr>
    250234      <tr valign="baseline">
  • trunk/www/common/datafiles/list_files.jsp

    r5426 r5623  
    280280              else if (Boolean.TRUE.equals(validFile))
    281281              {
    282                 validationMessage = "Ok";
    283                 icon = "ok.gif";
     282                if (member.getErrorMessage() != null)
     283                {
     284                  validationMessage = HTML.encodeTags(member.getErrorMessage());
     285                  icon = "warning.gif";
     286                }
     287                else
     288                {
     289                  validationMessage = "Ok";
     290                  icon = "ok.gif";
     291                }
    284292              }
    285293              else
  • trunk/www/common/datafiles/select_files.jsp

    r5451 r5623  
    162162    var frm = document.forms['datafiles'];
    163163    var validateCheckbox = frm['datafiles.validate'];
    164     var metadataCheckbox = frm['datafiles.metadata'];
    165164
    166165    // Check boxes should be updated if the data file type
     
    176175          validateCheckbox.checked = "1";
    177176        }
    178         // Data filetype supports metadata extraction
    179         if (metadataCheckbox)
    180         {     
    181           if (metadataCheckbox.disabled) metadataCheckbox.disabled = false; 
    182           metadataCheckbox.checked = "1";
    183         }
    184177      }
    185178    }   
     
    233226
    234227      boolean validationSupport = false;
    235       boolean metadataSupport = false;
    236228     
    237229      for (DataFileType dft : fileTypes)
     
    249241        String extension = dft.getExtension();
    250242       
    251         boolean hasValidator = dft.getValidatorClass() != null;
    252         boolean hasMetadataExtractor = dft.getMetadataReaderClass() != null;
    253         boolean affectCheckboxes = hasValidator || hasMetadataExtractor;
    254         validationSupport = hasValidator ? true : validationSupport;
    255         metadataSupport = hasMetadataExtractor ? true : metadataSupport;
     243        boolean hasValidator = dft.hasActiveValidator(dc);
     244        boolean affectCheckboxes = hasValidator;
     245        validationSupport |= hasValidator;
    256246        if (member != null)
    257247        {
     
    270260        {
    271261          path = file.getPath().toString();
    272           activateCheckBoxes = activateCheckBoxes || hasValidator || hasMetadataExtractor;
     262          activateCheckBoxes |= hasValidator;
    273263        }
    274264        else if (deniedFile || deniedPlatform)
     
    277267        }
    278268        String inputName= "datafile."+dft.getId();
    279         recentFiles = (List<File>)cc.getRecent(dc, Item.FILE, dft.getExternalId());       
    280        
     269        recentFiles = (List<File>)cc.getRecent(dc, Item.FILE, dft.getExternalId());
    281270        %>
    282271        <tr>
     
    347336      <%
    348337      }
    349       if (metadataSupport)
    350       {
    351       %>
    352       <tr>
    353         <td class="prompt">Extract metadata</td>
    354         <td><input type="checkbox" value="1" <%=activateCheckBoxes ? "" : "disabled"%> name="datafiles.metadata"></td>
    355       </tr>
    356       <%
    357       }
    358338      %>
    359339      </table>
  • trunk/www/lims/arraydesigns/index.jsp

    r5590 r5623  
    3232  import="net.sf.basedb.core.ArrayBatch"
    3333  import="net.sf.basedb.core.ArrayDesign"
    34   import="net.sf.basedb.core.Affymetrix"
    3534  import="net.sf.basedb.core.Platform"
    3635  import="net.sf.basedb.core.PlatformVariant"
     
    210209      // Data files tab
    211210      boolean validate = Values.getBoolean(request.getParameter("datafiles.validate"));
    212       boolean metadata = Values.getBoolean(request.getParameter("datafiles.metadata"));
    213       Base.updateFiles(dc, design, request, validate, metadata, cc, maxRecent);
     211      Base.updateFiles(dc, design, request, validate, cc, maxRecent);
    214212     
    215213      // Annotations tab
  • trunk/www/lims/arraydesigns/list_designs.jsp

    r5426 r5623  
    3030  import="net.sf.basedb.core.ArrayDesign"
    3131  import="net.sf.basedb.core.ArrayBatch"
    32   import="net.sf.basedb.core.Affymetrix"
    3332  import="net.sf.basedb.core.Platform"
    3433  import="net.sf.basedb.core.PlatformVariant"
  • trunk/www/lims/arraydesigns/view_design.jsp

    r5590 r5623  
    4040  import="net.sf.basedb.core.ArrayDesign"
    4141  import="net.sf.basedb.core.ArrayBatch"
    42   import="net.sf.basedb.core.Affymetrix"
    4342  import="net.sf.basedb.core.File"
    4443  import="net.sf.basedb.core.ArrayDesignPlate"
  • trunk/www/views/rawbioassays/index.jsp

    r5590 r5623  
    3333  import="net.sf.basedb.core.Include"
    3434  import="net.sf.basedb.core.RawBioAssay"
    35   import="net.sf.basedb.core.Affymetrix"
    3635  import="net.sf.basedb.core.Scan"
    3736  import="net.sf.basedb.core.Protocol"
     
    360359      // Data files tab
    361360      boolean validate = Values.getBoolean(request.getParameter("datafiles.validate"));
    362       boolean metadata = Values.getBoolean(request.getParameter("datafiles.metadata"));
    363       Base.updateFiles(dc, rba, request, validate, metadata, cc, maxRecent);
     361      Base.updateFiles(dc, rba, request, validate, cc, maxRecent);
    364362     
    365363      // Annotations tab
  • trunk/www/views/rawbioassays/list_rawbioassays.jsp

    r5426 r5623  
    3434  import="net.sf.basedb.core.RawDataTypes"
    3535  import="net.sf.basedb.core.Experiment"
    36   import="net.sf.basedb.core.Affymetrix"
    3736  import="net.sf.basedb.core.AnnotationType"
    3837  import="net.sf.basedb.core.AnnotationSet"
  • trunk/www/views/rawbioassays/view_rawbioassay.jsp

    r5590 r5623  
    3939  import="net.sf.basedb.core.Experiment"
    4040  import="net.sf.basedb.core.RawDataType"
    41   import="net.sf.basedb.core.Affymetrix"
    4241  import="net.sf.basedb.core.SpotImages"
    4342  import="net.sf.basedb.core.Scan"
Note: See TracChangeset for help on using the changeset viewer.