Class HashStoreConversionAdmin

java.lang.Object
edu.ucsb.nceas.metacat.admin.MetacatAdmin
edu.ucsb.nceas.metacat.admin.HashStoreConversionAdmin

public class HashStoreConversionAdmin extends MetacatAdmin
An admin class to convert the old style file store to a HashStore
Author:
Tao
  • Field Details

    • finalVersionAndClassMap

      protected static org.apache.commons.collections4.map.ListOrderedMap<String,String> finalVersionAndClassMap
    • versionAndClassMapInProperty

      protected static org.apache.commons.collections4.map.ListOrderedMap<String,String> versionAndClassMapInProperty
    • propertyPrefix

      protected static String propertyPrefix
    • error

      protected static Vector<String> error
    • info

      protected static Vector<String> info
  • Constructor Details

    • HashStoreConversionAdmin

      public HashStoreConversionAdmin()
  • Method Details

    • convert

      public static void convert()
      The method do the conversion job
    • validateOptions

      protected Vector<String> validateOptions(javax.servlet.http.HttpServletRequest request)
      Description copied from class: MetacatAdmin
      Require subclasses to implement a properties validator.
      Specified by:
      validateOptions in class MetacatAdmin
      Returns:
      a vector holding error message for any fields that fail validation.
    • getStatus

      public static UpgradeStatus getStatus() throws AdminException
      Get the status of conversion. It is the combined status of different versions
      Returns:
      the status. It can be pending, not required, complete, in_progress, unknown and failed. The UNKNOWN status will be default one.
      Throws:
      AdminException
    • getStatus

      protected static UpgradeStatus getStatus(String version) throws AdminException
      Get the upgrade status for the given version
      Parameters:
      version - the version will check
      Returns:
      the status. UNKNOWN will be the default
      Throws:
      AdminException
    • isConverted

      public static boolean isConverted() throws AdminException
      Check if the hashstore was converted
      Returns:
      true if the status is complete; otherwise false.
      Throws:
      AdminException
    • getError

      public static Vector<String> getError()
      Get the error message if the conversion fails
      Returns:
      the error message
    • getInfo

      public static Vector<String> getInfo()
      Get the information that some conversion failed
      Returns:
      the information
    • setStatus

      protected static void setStatus(String version, UpgradeStatus status) throws AdminException
      Throws:
      AdminException
    • generateFinalVersionsAndClassesMap

      protected static void generateFinalVersionsAndClassesMap() throws edu.ucsb.nceas.utilities.PropertyNotFoundException, AdminException, MetacatUtilException
      Generate the final version-class ordered map which contains the versions and upgrade classes. This map removed the upgrade classes which are not in the db upgrade range from the candidate classes. If there is no db upgrade, it will use the versionAndClass map from the property file and take a look the database - choose the one whose upgrade status is pending, unknown and failed
      Throws:
      edu.ucsb.nceas.utilities.PropertyNotFoundException
      AdminException
      MetacatUtilException
    • initVersionAndClassFromProperty

      protected static void initVersionAndClassFromProperty() throws edu.ucsb.nceas.utilities.PropertyNotFoundException
      Initialize the map between version and the update class name from the metacat.properties file
      Throws:
      edu.ucsb.nceas.utilities.PropertyNotFoundException
    • getVersionFromPropertyName

      protected static String getVersionFromPropertyName(String propertyName, String prefix)
      Get the version from the update class property name with the convention like: solr.upgradeUtility.3.0.0
      Parameters:
      propertyName - the property name like solr.upgradeUtility.3.0.0
      prefix - the prefix before the version part such as solr.upgradeUtility
      Returns:
      the version part