Class ApiUtils

java.lang.Object
org.lockss.laaws.crawler.impl.ApiUtils

public class ApiUtils extends Object
  • Constructor Details

    • ApiUtils

      public ApiUtils()
  • Method Details

    • validateLimit

      public static Integer validateLimit(Integer limit) throws IllegalArgumentException
      Checks that a limit field is valid.
      Parameters:
      limit - An Integer with the limit value to validate.
      Returns:
      an Integer with the validated limit value.
      Throws:
      IllegalArgumentException - if the passed limit value is not valid.
    • getPluggableCrawlManager

      public static PluggableCrawlManager getPluggableCrawlManager()
      Provides the Pluggable Crawl manager.
      Returns:
      a PluggableCrawlManager with the crawl manager implementation.
    • getLockssCrawlManager

      public static org.lockss.crawler.CrawlManagerImpl getLockssCrawlManager()
      Provide the Lockss CrawlManager
      Returns:
      CrawlManagerImpl
    • getRepositoryManager

      public static org.lockss.repository.RepositoryManager getRepositoryManager()
      Provide the Lockss RepositoryManager
      Returns:
      CrawlManagerImpl
    • getPageInfo

      public static PageInfo getPageInfo(Integer resultsPerPage, Long lastElement, int totalCount, Long timeStamp)
    • makeCrawlDesc

      public static org.lockss.util.rest.crawler.CrawlDesc makeCrawlDesc(org.lockss.crawler.CrawlerStatus cs)
    • makeJobStatus

      public static org.lockss.util.rest.crawler.JobStatus makeJobStatus(org.lockss.crawler.CrawlerStatus crawlerStatus)
    • makeCrawlStatus

      public static CrawlStatus makeCrawlStatus(org.lockss.crawler.CrawlerStatus cs)
    • getCrawlerIds

      public static List<String> getCrawlerIds()
    • validateContinuationToken

      public static void validateContinuationToken(long timeStamp, ContinuationToken continuationToken) throws IllegalArgumentException
      Checks that a continuation token is valid.
      Parameters:
      timeStamp - A long with the timestamp used to validate the continuation token.
      continuationToken - A ContinuationToken with the continuation token to be validated.
      Throws:
      IllegalArgumentException - if the passed continuation token is not valid.
    • makeCrawlLink

      public static String makeCrawlLink(String jobId)
    • makeCounter

      public static Counter makeCounter(org.lockss.laaws.crawler.impl.ApiUtils.COUNTER_KIND kind, String jobId, org.lockss.crawler.CrawlerStatus.UrlCount urlCount)
      Parameters:
      kind - the type of counter we will be returning
      jobId - A String with the identifier assigned to the crawl when added.
      urlCount - the number of urls
      Returns:
      an newly constructed Counter
    • getCrawlStatus

      public static CrawlStatus getCrawlStatus(String jobId)
    • getCrawlerStatus

      public static org.lockss.crawler.CrawlerStatus getCrawlerStatus(String jobId) throws javax.ws.rs.NotFoundException
      Parameters:
      jobId - A String with the identifier assigned to the crawl when added.
      Returns:
      The CrawlerStatus for thi if the s job
      Throws:
      javax.ws.rs.NotFoundException - if there is no crawl status for this job
    • getV2Repo

      public static org.lockss.util.rest.repo.LockssRepository getV2Repo()
    • getV2Namespace

      public static String getV2Namespace()