private void deleteBlock(CachedUrl cu) throws IOException { log.info("deleting " + cu.getUrl()); CachedUrlSetSpec cuss = new SingleNodeCachedUrlSetSpec(cu.getUrl()); ArchivalUnit au = cu.getArchivalUnit(); CachedUrlSet cus = au.makeCachedUrlSet(cuss); NodeManager nm = au.getPlugin().getDaemon().getNodeManager(au); nm.deleteNode(cus); }
/** * Provides the status information of an archival unit in the system. * * @param auId A String with the identifier of the archival unit. * @return an AuStatus with the status information of the archival unit. * @throws LockssWebServicesFault */ AuStatus getAuStatus(String auId) throws LockssWebServicesFault { final String DEBUG_HEADER = "getAuStatus(): "; LockssDaemon theDaemon = LockssDaemon.getLockssDaemon(); PluginManager pluginMgr = theDaemon.getPluginManager(); ArchivalUnit au = pluginMgr.getAuFromId(auId); if (au == null) { throw new LockssWebServicesFault( "No Archival Unit with provided identifier", new LockssWebServicesFaultInfo("Archival Unit identifier = " + auId)); } AuStatus result = new AuStatus(); result.setVolume(au.getName()); TitleConfig tc = au.getTitleConfig(); if (tc != null) { result.setJournalTitle(tc.getJournalTitle()); } Plugin plugin = au.getPlugin(); result.setPluginName(plugin.getPluginName()); result.setYear(AuUtil.getTitleAttribute(au, "year")); NodeManager nodeMgr = theDaemon.getNodeManager(au); AuState state = nodeMgr.getAuState(); AuState.AccessType atype = state.getAccessType(); if (atype != null) { result.setAccessType(atype.toString()); } long contentSize = AuUtil.getAuContentSize(au, false); if (contentSize != -1) { result.setContentSize(contentSize); } long du = AuUtil.getAuDiskUsage(au, false); if (du != -1) { result.setDiskUsage(du); } String spec = LockssRepositoryImpl.getRepositorySpec(au); String repo = LockssRepositoryImpl.mapAuToFileLocation( LockssRepositoryImpl.getLocalRepositoryPath(spec), au); result.setRepository(repo); CachedUrlSet auCus = au.getAuCachedUrlSet(); NodeState topNode = nodeMgr.getNodeState(auCus); if (AuUtil.getProtocolVersion(au) == Poll.V3_PROTOCOL) { if (state.getV3Agreement() < 0) { if (state.getLastCrawlTime() < 0) { result.setStatus("Waiting for Crawl"); } else { result.setStatus("Waiting for Poll"); } } else { result.setStatus(doubleToPercent(state.getHighestV3Agreement()) + "% Agreement"); if (state.getHighestV3Agreement() != state.getV3Agreement()) { result.setRecentPollAgreement(state.getV3Agreement()); } } } else { result.setStatus(topNode.hasDamage() ? "Repairing" : "Ok"); } String publishingPlatform = plugin.getPublishingPlatform(); if (!StringUtil.isNullString(publishingPlatform)) { result.setPublishingPlatform(publishingPlatform); } String publisher = AuUtil.getTitleAttribute(au, "publisher"); if (!StringUtil.isNullString(publisher)) { result.setPublisher(publisher); } result.setAvailableFromPublisher(!AuUtil.isPubDown(au)); result.setSubstanceState(state.getSubstanceState().toString()); result.setCreationTime(state.getAuCreationTime()); AuUtil.AuProxyInfo aupinfo = AuUtil.getAuProxyInfo(au); if (aupinfo.isAuOverride()) { String disp = (aupinfo.getHost() == null ? "Direct connection" : aupinfo.getHost() + ":" + aupinfo.getPort()); result.setCrawlProxy(disp); } CrawlWindow window = au.getCrawlWindow(); if (window != null) { String wmsg = window.toString(); if (wmsg.length() > 140) { wmsg = "(not displayable)"; } if (!window.canCrawl()) { wmsg = "Currently closed: " + wmsg; } result.setCrawlWindow(wmsg); } String crawlPool = au.getFetchRateLimiterKey(); if (crawlPool == null) { crawlPool = "(none)"; } result.setCrawlPool(crawlPool); result.setLastCompletedCrawl(state.getLastCrawlTime()); long lastCrawlAttempt = state.getLastCrawlAttempt(); if (lastCrawlAttempt > 0) { result.setLastCrawl(lastCrawlAttempt); result.setLastCrawlResult(state.getLastCrawlResultMsg()); } long lastTopLevelPollTime = state.getLastTopLevelPollTime(); if (lastTopLevelPollTime > 0) { result.setLastCompletedPoll(lastTopLevelPollTime); } long lastPollStart = state.getLastPollStart(); if (lastPollStart > 0) { result.setLastPoll(lastPollStart); String pollResult = state.getLastPollResultMsg(); if (!StringUtil.isNullString(pollResult)) { result.setLastPollResult(state.getLastPollResultMsg()); } } result.setCurrentlyCrawling( theDaemon.getCrawlManager().getStatusSource().getStatus().isRunningNCCrawl(au)); result.setCurrentlyPolling(theDaemon.getPollManager().isPollRunning(au)); if (theDaemon.isDetectClockssSubscription()) { result.setSubscriptionStatus(AuUtil.getAuState(au).getClockssSubscriptionStatusString()); } if (log.isDebug2()) log.debug2(DEBUG_HEADER + "result = " + result); return result; }