Class SolrAdmin

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

public class SolrAdmin extends MetacatAdmin
Control the display of the Solr configuration page and the processing of the configuration values.
  • Field Details

  • Method Details

    • getInstance

      public static SolrAdmin getInstance() throws AdminException
      Get the single instance of SolrDAdmin.
      Returns:
      the single instance of SolrAdmin
      Throws:
      AdminException
    • configureSolr

      public void configureSolr(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws AdminException
      Handle configuration of the solr the first time that Metacat starts or when it is explicitly called. Collect necessary update information from the administrator.
      Parameters:
      request - the http request information
      response - the http response to be sent back to the client
      Throws:
      AdminException
    • checkSolrStatus

      protected void checkSolrStatus(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws AdminException
      Check the current solr status - such as if the solr core/solr-home directory exists, and send back actions which user can choose based on the status.
      Parameters:
      request - the request from the client
      response - the response which will be sent back to the client
      Throws:
      AdminException
    • processResponse

      protected void processResponse(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws AdminException
      Process the user's choices to the solr server
      Parameters:
      request - the request from the client
      response - the response which will be sent back to the client
      Throws:
      AdminException
    • handleWarningActions

      protected void handleWarningActions(String action, javax.servlet.http.HttpServletRequest request, Vector<String> processingErrors) throws edu.ucsb.nceas.utilities.GeneralPropertyException, AdminException, org.dataone.service.exceptions.UnsupportedType, ParserConfigurationException, IOException, SAXException, org.apache.solr.client.solrj.SolrServerException, ServiceException, edu.ucsb.nceas.utilities.UtilException
      Method to handle a warning message in the request, which have user's response.
      Parameters:
      action - the action needs to be handled
      request - the request from the client
      processingErrors - the vector to store error message
      Throws:
      edu.ucsb.nceas.utilities.GeneralPropertyException
      AdminException
      org.dataone.service.exceptions.UnsupportedType
      ParserConfigurationException
      IOException
      SAXException
      org.apache.solr.client.solrj.SolrServerException
      ServiceException
      edu.ucsb.nceas.utilities.UtilException
    • validateOptions

      protected Vector<String> validateOptions(javax.servlet.http.HttpServletRequest request)
      Validate the most important configuration options submitted by the user.
      Specified by:
      validateOptions in class MetacatAdmin
      Returns:
      a vector holding error message for any fields that fail validation.
    • getSolrUpdateClasses

      protected static Map<String,String> getSolrUpdateClasses() throws SQLException, edu.ucsb.nceas.utilities.PropertyNotFoundException
      Get the map of upgrade classes should be run in the upgrade. If this is a fresh installation, no classes will be added to it. The key of map is the db version and the value is the update class.
      Returns:
      the map of upgrade classes. An empty map will be return if nothing is found.
      Throws:
      SQLException
      edu.ucsb.nceas.utilities.PropertyNotFoundException
    • getNonUpgradedSolrVersions

      protected static Vector<DBVersion> getNonUpgradedSolrVersions() throws SQLException, edu.ucsb.nceas.utilities.PropertyNotFoundException
      Get a list of db versions in which the solr db hasn't been upgraded
      Returns:
      the list of db versions in which the solr db hasn't been upgraded. An empty vector will be returned if nothing was found.
      Throws:
      SQLException
      edu.ucsb.nceas.utilities.PropertyNotFoundException
    • isFreshInstall

      protected static boolean isFreshInstall() throws SQLException
      Check if the db is a fresh installation. If the db_version has only one row, we consider it a fresh installation.
      Returns:
      ture if it is; otherwise false.
      Throws:
      SQLException
    • updateSolrStatus

      protected static void updateSolrStatus(String version, boolean status) throws SQLException
      Update the solr_upgraded status for the given metacat version
      Parameters:
      version - the version of Metacat will be updated in the db_version table.
      status - the status will be applied.
      Throws:
      SQLException