Changeset 736


Ignore:
Timestamp:
Aug 5, 2008, 1:54:30 PM (14 years ago)
Author:
Martin Svensson
Message:

Fixes #112. Changed the property validation when installing a data file-type which already exists.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • plugins/base2/net.sf.basedb.illumina/trunk/src/net/sf/basedb/illumina/install/Install.java

    r732 r736  
    467467    //Data file types
    468468    Map<String, DataFileType> dataFileTypes = new HashMap<String, DataFileType>();     
    469     DataFileType bgx = createDataFileType(dc,
    470       Illumina.BGX_FILE_ID, "BGX file", "Illumina Sentrix Array binary manifest file",
    471       Item.ARRAYDESIGN, BGX_FILEYTPE_EXTENSION, reporterMapType,
    472       Illumina.BGX_VALIDATOR_METADATAREADER, Illumina.BGX_VALIDATOR_METADATAREADER,
    473       jarPath, ignoreExistingItems);
     469    DataFileType bgx = null;
     470    //Create bgx-datafile type if there are one or more expression platforms.
     471    if (largestNumOfStrips > 0)
     472    {
     473      bgx = createDataFileType(dc,
     474        Illumina.BGX_FILE_ID, "BGX file", "Illumina Sentrix Array binary manifest file",
     475        Item.ARRAYDESIGN, BGX_FILEYTPE_EXTENSION, reporterMapType,
     476        Illumina.BGX_VALIDATOR_METADATAREADER, Illumina.BGX_VALIDATOR_METADATAREADER,
     477        jarPath, ignoreExistingItems);
     478    }
    474479    for (int i = 1; i <= largestNumOfStrips; i++ )
    475480    {
     
    739744 
    740745  /**
    741     Create a new data file type. If an item with the given external ID already exists
    742     it will be updated if updateExistingItem=true, otherwise an ItemAlreadyExistsException
    743     is thrown. If an existing item can't be updated, and ItemAlreadyExistsException
    744     is thrown.
     746    Create a new data file type. If an item with the given external ID already exists and ignoreExistingItem=true
     747    the existing data file type will be updated with new jarPath for validator and metadata reader and then returned,
     748    otherwise, if ignoreExistingItem=false, an ItemAlreadyExistsException is thrown.
    745749    @return The new or existing data file type
    746750  */
     
    759763        throw new ItemAlreadyExistsException(dft.getExternalId());
    760764      }
    761      
    762       dft = DataFileType.getByExternalId(dc, externalId);
    763765      if (extension != null && !extension.equals(dft.getExtension())) message += dft.getName() + " has invalid extension.\n";
    764766      if (!itemType.equals(dft.getItemType())) message += dft.getName() + " has invalid item type.\n";
     767      if (validatorClass != null && !validatorClass.equals(dft.getValidatorClass())) message += "Validator class used: " + dft.getValidatorClass() + ", expected: " + validatorClass;
     768      if (metadataReaderClass != null && !metadataReaderClass.equals(dft.getMetadataReaderClass())) message += "Metadata class used: " + dft.getMetadataReaderClass() + ", expected: " + metadataReaderClass;
     769      if (message != null) throw new ItemAlreadyExistsException(message + " The existing datafiletype, '" + dft.getName() + "' can not be used.");
     770     
     771      // Update the jar path of the data file type's meta-data reader and validator
    765772      if (jarPath != null)
    766773      {
    767         if (dft.getMetadataReaderJarPath() == null)
    768         {
    769           dft.setMetadataReaderJarPath(jarPath);         
    770         }
    771         if (dft.getValidatorJarPath() == null)
    772         {
    773           dft.setValidatorJarPath(jarPath);   
    774         }
    775         if (!jarPath.equals(dft.getValidatorJarPath()) || !jarPath.equals(dft.getMetadataReaderJarPath()))
    776         {
    777           message += "Validator/meta-data reader has not the expected jar-path: " + jarPath + ".\n";
    778         }
    779       }
    780       if (message != null) throw new ItemAlreadyExistsException(message + " The existing datafiletype, '" + dft.getName() + "' can not be used."); 
     774        dft.setMetadataReaderJarPath(jarPath);
     775        dft.setValidatorJarPath(jarPath);
     776      }
    781777    }
    782778    catch (ItemNotFoundException infe)
Note: See TracChangeset for help on using the changeset viewer.