Package org.lockss.laaws.crawler.impl
Class ApiUtils
java.lang.Object
org.lockss.laaws.crawler.impl.ApiUtils
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic org.lockss.crawler.CrawlerStatusgetCrawlerStatus(String jobId) static CrawlStatusgetCrawlStatus(String jobId) static org.lockss.crawler.CrawlManagerImplProvide the Lockss CrawlManagerstatic PageInfogetPageInfo(Integer resultsPerPage, Long lastElement, int totalCount, Long timeStamp) static PluggableCrawlManagerProvides the Pluggable Crawl manager.static org.lockss.repository.RepositoryManagerProvide the Lockss RepositoryManagerstatic Stringstatic org.lockss.util.rest.repo.LockssRepositorystatic CountermakeCounter(org.lockss.laaws.crawler.impl.ApiUtils.COUNTER_KIND kind, String jobId, org.lockss.crawler.CrawlerStatus.UrlCount urlCount) static org.lockss.util.rest.crawler.CrawlDescmakeCrawlDesc(org.lockss.crawler.CrawlerStatus cs) static StringmakeCrawlLink(String jobId) static CrawlStatusmakeCrawlStatus(org.lockss.crawler.CrawlerStatus cs) static org.lockss.util.rest.crawler.JobStatusmakeJobStatus(org.lockss.crawler.CrawlerStatus crawlerStatus) static voidvalidateContinuationToken(long timeStamp, ContinuationToken continuationToken) Checks that a continuation token is valid.static IntegervalidateLimit(Integer limit) Checks that a limit field is valid.
-
Constructor Details
-
ApiUtils
public ApiUtils()
-
-
Method Details
-
validateLimit
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
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
-
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
-
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
-
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 returningjobId- A String with the identifier assigned to the crawl when added.urlCount- the number of urls- Returns:
- an newly constructed Counter
-
getCrawlStatus
-
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
-