Class IndexGenerator

java.lang.Object
edu.ucsb.nceas.metacat.shared.BaseService
edu.ucsb.nceas.metacat.index.queue.IndexGenerator

public class IndexGenerator extends BaseService
The IndexGenerator class will publish (send) the index information to a RabbitMQ queue. A index worker will consume the information.
Author:
tao
  • Field Details

  • Method Details

    • getLastSubdir

      protected static String getLastSubdir(String path)
      Get the last sub-directory in the path. If the path is /var/data, data will be returned.
      Parameters:
      path - the path will be analyzed.
      Returns:
      the last part of path
    • getInstance

      public static IndexGenerator getInstance() throws ServiceException
      Implement a Singleton pattern using "double checked locking" pattern.
      Returns:
      a singleton instance of the RabbitMQService class.
      Throws:
      ServiceException
    • refreshInstance

      public static void refreshInstance()
      This method sets the instance to null and forces the getInstance method to create a new instance. This method is only used for a testing purpose!
    • publish

      public void publish(org.dataone.service.types.v1.Identifier id, String index_type, int priority) throws ServiceException, org.dataone.service.exceptions.InvalidRequest
      Publish the given information to the index queue
      Parameters:
      id - the identifier of the object which will be indexed
      index_type - the type of indexing, it can be delete, create or sysmeta
      priority - the priority of the index task
      Throws:
      ServiceException
      org.dataone.service.exceptions.InvalidRequest
    • refreshable

      public boolean refreshable()
      This service is not refreshable
      Specified by:
      refreshable in class BaseService
    • doRefresh

      protected void doRefresh() throws ServiceException
      Specified by:
      doRefresh in class BaseService
      Throws:
      ServiceException
    • stop

      public void stop() throws ServiceException
      Stop the service
      Specified by:
      stop in class BaseService
      Throws:
      ServiceException
    • size

      public int size()
      Get the number of messages in the index queue
      Returns:
      the number of messages