Package edu.ucsb.nceas.metacat.admin
Class HashStoreConversionAdmin
java.lang.Object
edu.ucsb.nceas.metacat.admin.MetacatAdmin
edu.ucsb.nceas.metacat.admin.HashStoreConversionAdmin
An admin class to convert the old style file store to a HashStore
- Author:
- Tao
-
Field Summary
Fields inherited from class edu.ucsb.nceas.metacat.admin.MetacatAdmin
COMPLETE, FAILURE, IN_PROGRESS, NOT_REQUIRED, PENDING, SUCCESS, UNKNOWN
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
convert()
The method do the conversion jobprotected static void
Generate the final version-class ordered map which contains the versions and upgrade classes.getError()
Get the error message if the conversion failsgetInfo()
Get the information that some conversion failedstatic UpgradeStatus
Get the status of conversion.protected static UpgradeStatus
Get the upgrade status for the given versionprotected static String
getVersionFromPropertyName
(String propertyName, String prefix) Get the version from the update class property name with the convention like: solr.upgradeUtility.3.0.0protected static void
Initialize the map between version and the update class name from the metacat.properties filestatic boolean
Check if the hashstore was convertedprotected static void
setStatus
(String version, UpgradeStatus status) validateOptions
(javax.servlet.http.HttpServletRequest request) Require subclasses to implement a properties validator.Methods inherited from class edu.ucsb.nceas.metacat.admin.MetacatAdmin
updateUpgradeStatus
-
Field Details
-
finalVersionAndClassMap
-
versionAndClassMapInProperty
-
propertyPrefix
-
error
-
info
-
-
Constructor Details
-
HashStoreConversionAdmin
public HashStoreConversionAdmin()
-
-
Method Details
-
convert
public static void convert()The method do the conversion job -
validateOptions
Description copied from class:MetacatAdmin
Require subclasses to implement a properties validator.- Specified by:
validateOptions
in classMetacatAdmin
- Returns:
- a vector holding error message for any fields that fail validation.
-
getStatus
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
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
Check if the hashstore was converted- Returns:
- true if the status is complete; otherwise false.
- Throws:
AdminException
-
getError
Get the error message if the conversion fails- Returns:
- the error message
-
getInfo
Get the information that some conversion failed- Returns:
- the information
-
setStatus
- Throws:
AdminException
-
generateFinalVersionsAndClassesMap
protected static void generateFinalVersionsAndClassesMap() throws edu.ucsb.nceas.utilities.PropertyNotFoundException, AdminException, MetacatUtilExceptionGenerate 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.PropertyNotFoundExceptionInitialize the map between version and the update class name from the metacat.properties file- Throws:
edu.ucsb.nceas.utilities.PropertyNotFoundException
-
getVersionFromPropertyName
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.0prefix
- the prefix before the version part such as solr.upgradeUtility- Returns:
- the version part
-