示例#1
0
 /**
  * Construct a PollSpec from a CachedUrlSet.
  *
  * @param cus the CachedUrlSpec which defines the range of interest
  * @param pollType one of the types defined by Poll
  */
 public PollSpec(CachedUrlSet cus, int pollType) {
   CachedUrlSetSpec cuss = cus.getSpec();
   if (cuss instanceof RangeCachedUrlSetSpec) {
     RangeCachedUrlSetSpec rcuss = (RangeCachedUrlSetSpec) cuss;
     commonSetup(cus, rcuss.getLowerBound(), rcuss.getUpperBound(), pollType);
   } else if (cuss.isSingleNode()) {
     commonSetup(cus, SINGLE_NODE_LWRBOUND, null, pollType);
   } else {
     commonSetup(cus, null, null, pollType);
   }
 }
示例#2
0
 /** Setup common to most constructors */
 private void commonSetup(CachedUrlSet cus, String lwrBound, String uprBound, int pollType) {
   CachedUrlSetSpec cuss = cus.getSpec();
   if (cuss instanceof PrunedCachedUrlSetSpec) {
     throw new IllegalArgumentException("Polls do not support PrunedCachedUrlSetSpec");
   }
   this.cus = cus;
   ArchivalUnit au = cus.getArchivalUnit();
   auId = au.getAuId();
   this.pluginVersion = AuUtil.getPollVersion(au);
   url = cuss.getUrl();
   this.lwrBound = lwrBound;
   this.uprBound = uprBound;
   this.protocolVersion = protocolVersionFromPollType(pollType);
   this.pollType = pollType;
 }