/*
(non-Javadoc)

@see org.archive.wayback.resourceindex.SearchResultSource#getPrefixIterator(java.lang.String)
514118
public CloseableIterator<CaptureSearchResult> getPrefixIterator(String prefix)
			throws ResourceIndexNotAvailableException {
		
		try {
			return adaptIterator(recordIterator(prefix,true));
		} catch (DatabaseException e) {
			throw new ResourceIndexNotAvailableException(e.getMessage()); 
		}
	}
882632
protected final OnDemandStatsProducer getProducer(Class producerClass, String producerId, String category, String subsystem, boolean tracingSupported){
        OnDemandStatsProducer<T> producer = (OnDemandStatsProducer<T>) ProducerRegistryFactory.getProducerRegistryInstance().getProducer(producerId);

        if (producer == null) {
            producer = new OnDemandStatsProducer<T>(producerId, category, subsystem, getStatsFactory());
            producer.setTracingSupported(tracingSupported);
            ProducerRegistryFactory.getProducerRegistryInstance().registerProducer(producer);

            //check for annotations
            createClassLevelAccumulators(producer, producerClass);

            for (Method method : producerClass.getMethods()){
                createMethodLevelAccumulators(producer, method);
            }
        }

        try {
            return  (OnDemandStatsProducer) ProducerRegistryFactory.getProducerRegistryInstance().getProducer(producerId);
        } catch (ClassCastException e) {
            LOGGER.error("getProducer(): Unexpected producer type", e);
            return null;
        }
    }
658200
public String getPrefix(String namespaceURI)
   {
      String prefix = null;
      try
      {
         prefix = namespaceRegistry.getPrefix(namespaceURI);
      }
      catch (NamespaceException exc)
      {
         prefix = prefixes.get(namespaceURI);
      }
      catch (RepositoryException exc)
      {
         log.error(exc.getMessage(), exc);
      }
      return prefix;

   }
1114758
@Override
	public String getPrefixedKey(final String prefixString, final String key) {
		lock.readLock().lock();
		try {
			if (prefixString != null && prefixes.contains(prefixString) && key != null) {
				return new StringBuilder(prefixString).append(getPrefixDelimiter()).append(key).toString();
			}
		} finally {
			lock.readLock().unlock();
		}
		throw new IllegalArgumentException("The given prefix is not part of this PrefixConfig or the key is null.");
	}
41764
String getKeyPrefix(StatementPartitioning partitioning, DeterminismMode detMode, String joinOrder) {
        // no caching for inferred yet
        if (partitioning.isInferred()) {
            return null;
        }

        String joinOrderPrefix = "#";
        if (joinOrder != null) {
            joinOrderPrefix += joinOrder;
        }

        boolean partitioned = partitioning.wasSpecifiedAsSingle();

        return joinOrderPrefix + String.valueOf(detMode.toChar()) + (partitioned ? "P#" : "R#");
    }
793230
public static Provider resourceProvider(String pathToResource, Charset encoding) throws IOException {
        ClassLoader classLoader = Provider.class.getClassLoader();
        return resourceProvider(classLoader, pathToResource, encoding);
    }
802714
public final String getExplicitPrefix(String uri)
    {
        if (mNsMapping != null) {
            String prefix = mNsMapping.findPrefixByUri(uri);
            if (prefix != null) {
                return prefix;
            }
        }
        if (mRootNsContext != null) {
            String prefix = mRootNsContext.getPrefix(uri);
            if (prefix != null) {
                // Hmmh... still can't use the default NS:
                if (prefix.length() > 0) {
                    return prefix;
                }
                // ... should we try to find an explicit one?
            }
        }
        return null;
    }
217060
public static Resource getResource(String location) {
        Resource resource = resolver.getResource(location);
        return resource.exists() ? resource : null;
    }
1174427
public Extractor getExtractor() {
    try {
      this.rawSourceExtractor = getSource().getExtractor(this.taskState);
      boolean throttlingEnabled = this.taskState.getPropAsBoolean(ConfigurationKeys.EXTRACT_LIMIT_ENABLED_KEY,
          ConfigurationKeys.DEFAULT_EXTRACT_LIMIT_ENABLED);
      if (throttlingEnabled) {
        Limiter limiter = DefaultLimiterFactory.newLimiter(this.taskState);
        if (!(limiter instanceof NonRefillableLimiter)) {
          throw new IllegalArgumentException("The Limiter used with an Extractor should be an instance of "
              + NonRefillableLimiter.class.getSimpleName());
        }
        return new LimitingExtractorDecorator<>(this.rawSourceExtractor, limiter, this.taskState);
      }
      return this.rawSourceExtractor;
    } catch (IOException ioe) {
      throw new RuntimeException(ioe);
    }
  }
248306
@Nullable
  public IndexSearcher getSearcher () throws IOException
  {
    _checkClosing ();
    final IndexReader aReader = getReader ();
    if (aReader == null)
    {
      // Index not readable
      LOGGER.warn ("Index not readable");
      return null;
    }

    if (m_aSearchReader == aReader)
    {
      // Reader did not change - use cached searcher
      assert m_aSearcher != null;
    }
    else
    {
      // Create new searcher only if necessary
      m_aSearchReader = aReader;
      m_aSearcher = new IndexSearcher (aReader);
    }
    return m_aSearcher;
  }
773650
protected LocPathIterator createDTMIterator(
          Compiler compiler, int opPos) throws javax.xml.transform.TransformerException
  {
    LocPathIterator lpi = (LocPathIterator)WalkerFactory.newDTMIterator(compiler, opPos, 
                                      (compiler.getLocationPathDepth() <= 0));
    return lpi;
  }
1251545
public com.google.iam.v1.BindingOrBuilder getBindingsOrBuilder(
      int index) {
    return bindings_.get(index);
  }
1181204
public com.google.api.ads.adwords.axis.v201809.cm.PredicateOperator getOperator() {
        return operator;
    }
402812
public String getPrefixPreamble(final PrefixMapping mapping) {
        return mapping.getNsPrefixMap().entrySet().stream()
                .map(e -> "PREFIX " + e.getKey() + ": <" + e.getValue() + ">").collect(joining("\n", "", "\n\n"));
    }
1221740
private IProvider getProviderFromTemplate(eu.atos.sla.parser.data.wsag.Template templateXML) throws ModelConversionException {
        
        Context context = templateXML.getContext();
        
        String provider = null;
        try {
            ServiceProvider ctxProvider = ServiceProvider.fromString(context.getServiceProvider());
             
            switch (ctxProvider) {
            case AGREEMENT_RESPONDER:
                provider= context.getAgreementResponder();
                break;
            case AGREEMENT_INITIATOR:
                provider= context.getAgreementInitiator();
                break;
            }
        } catch (IllegalArgumentException e) {
            throw new ModelConversionException("The Context/ServiceProvider field must match with the word "+ServiceProvider.AGREEMENT_RESPONDER+ " or "+ServiceProvider.AGREEMENT_INITIATOR);
        }
        IProvider providerObj = providerDAO.getByUUID(provider);
        return providerObj;
    }
1075805
public CloseableIterator<CaptureSearchResult> getPrefixIterator(String prefix)
			throws ResourceIndexNotAvailableException {

		Comparator<CaptureSearchResult> comparator = new SearchResultComparator();
		CompositeSortedIterator<CaptureSearchResult> itr = new CompositeSortedIterator<CaptureSearchResult>(comparator);
		
		int added = 0;
		ResourceIndexNotAvailableException lastExc = null;
		
		for (int i = 0; i < sources.size(); i++) {
			SearchResultSource source = sources.get(i);
			
			try {
				itr.addComponent(source.getPrefixIterator(prefix));
				added++;
			} catch (ResourceIndexNotAvailableException e) {
				if (source instanceof ZipNumClusterSearchResultSource) {
					if (((ZipNumClusterSearchResultSource)source).getCluster().isRequired()) {
						throw e;
					}
				}
				
				lastExc = e;
			}
		}
		
		if ((lastExc != null) && (added == 0)) {
			try {
				itr.close();
			} catch (IOException io) {
				
			}
			throw lastExc;
		}
		
		return itr;
	}
598222
public CloseableIterator<CaptureSearchResult> getPrefixReverseIterator(
			String prefix) throws ResourceIndexNotAvailableException {

		Comparator<CaptureSearchResult> comparator = new SearchResultComparator(true);
		CompositeSortedIterator<CaptureSearchResult> itr = 
			new CompositeSortedIterator<CaptureSearchResult>(comparator);
		for (int i = 0; i < sources.size(); i++) {
			itr.addComponent(sources.get(i).getPrefixReverseIterator(prefix));
		}
		return itr;
	}