Examples of Collector


Examples of org.apache.lucene.search.Collector

  private Collector optionallyEnableFacetingCollectors(Collector collector) {
    if ( facetRequests == null || facetRequests.isEmpty() ) {
      return collector;
    }
    facetCollectors = new ArrayList<FacetCollector>();
    Collector nextInChain = collector;
    for ( FacetingRequestImpl entry : facetRequests.values() ) {
      FacetCollector facetCollector = new FacetCollector( nextInChain, entry );
      nextInChain = facetCollector;
      facetCollectors.add( facetCollector );
    }
View Full Code Here

Examples of org.apache.lucene.search.Collector

    }
    return timeoutAt0;
  }

  private Collector decorateWithTimeOutCollector(Collector collector) {
    Collector maybeTimeLimitingCollector = collector;
    if ( timeoutManager.getType() == TimeoutManager.Type.LIMIT ) {
      final Long timeoutLeft = timeoutManager.getTimeoutLeftInMilliseconds();
      if ( timeoutLeft != null ) {
        Counter counter = timeoutManager.getLuceneTimeoutCounter();
        maybeTimeLimitingCollector = new TimeLimitingCollector( collector, counter, timeoutLeft);
View Full Code Here

Examples of org.eclipse.equinox.internal.provisional.p2.query.Collector

        queryContext.setQueryable(RepositoryUtils.getQuerybleRepositoryManager(null));

        HashMap<String, IInstallableUnit> iuMap = new HashMap<String, IInstallableUnit>();

        for (FeatureInfo featureInfo : features) {
            Collector collector = new Collector();
            Query query = new InstallableUnitQuery(featureInfo.getFeatureID(),
                    new VersionRange(Version.create(featureInfo.getFeatureVersion()),
                            true, Version.create(featureInfo.getFeatureVersion()), true));
            collector = RepositoryUtils.getInstallableUnitsInRepositories(null, query, collector, null);
            IInstallableUnit[] units = (IInstallableUnit[]) collector.toArray(IInstallableUnit.class);

            if (units[0] == null) {
                continue;
            }
View Full Code Here

Examples of org.eclipse.equinox.internal.provisional.p2.query.Collector

        }

        final List locales = buildLocaleVariants(locale);
        final IInstallableUnit theUnit = iu;

        Collector localizationFragments = getLocalizationFragments(locale, locales);

        Collector hostLocalizationCollector = new Collector() {
            public boolean accept(Object object) {
                boolean haveHost = false;
                if (object instanceof IInstallableUnitFragment) {
                    IInstallableUnitFragment fragment = (IInstallableUnitFragment) object;
                    IRequiredCapability[] hosts = fragment.getHost();
                    for (int i = 0; i < hosts.length; i++) {
                        IRequiredCapability nextHost = hosts[i];
                        if (IInstallableUnit.NAMESPACE_IU_ID.equals(nextHost.getNamespace()) && //
                                theUnit.getId().equals(nextHost.getName()) && //
                                nextHost.getRange() != null && //
                                nextHost.getRange().isIncluded(theUnit.getVersion())) {
                            haveHost = true;
                            break;
                        }
                    }
                }
                return (haveHost ? super.accept(object) : true);
            }
        };

        IUPropertyQuery iuQuery = new IUPropertyQuery(IInstallableUnit.PROP_TYPE_FRAGMENT, "true"); //$NON-NLS-1$
        Collector collected = iuQuery.perform(localizationFragments.iterator(), hostLocalizationCollector);

        if (!collected.isEmpty()) {
            String translation = null;
            for (Iterator iter = collected.iterator(); iter.hasNext() && translation == null;) {
                IInstallableUnit localizationIU = (IInstallableUnit) iter.next();
                for (Iterator jter = locales.iterator(); jter.hasNext();) {
                    String localeKey = makeLocalizedKey(actualKey, (String) jter.next());
                    translation = localizationIU.getProperty(localeKey);
                    if (translation != null) {
View Full Code Here

Examples of org.eclipse.equinox.internal.provisional.p2.query.Collector

     * Collects the installable unit fragments that contain locale data for the given locales.
     */
    private static synchronized Collector getLocalizationFragments(Locale locale, List localeVariants) {
        SoftReference collectorRef = (SoftReference) LocaleCollectorCache.get(locale);
        if (collectorRef != null) {
            Collector cached = (Collector) collectorRef.get();
            if (cached != null) {
                return cached;
            }
        }

        final List locales = localeVariants;

        Collector localeFragmentCollector = new Collector() {
            public boolean accept(Object object) {
                boolean haveLocale = false;
                if (object instanceof IInstallableUnitFragment) {
                    IInstallableUnitFragment fragment = (IInstallableUnitFragment) object;
                    IProvidedCapability[] provides = fragment.getProvidedCapabilities();
                    for (int j = 0; j < provides.length && !haveLocale; j++) {
                        IProvidedCapability nextProvide = provides[j];
                        if (NAMESPACE_IU_LOCALIZATION.equals(nextProvide.getNamespace())) {
                            String providedLocale = nextProvide.getName();
                            if (providedLocale != null) {
                                for (Iterator iter = locales.iterator(); iter.hasNext();) {
                                    if (providedLocale.equals(iter.next())) {
                                        haveLocale = true;
                                        break;
                                    }
                                }
                            }
                        }
                    }
                }
                return (haveLocale ? super.accept(object) : true);
            }
        };

        //Due to performance problems we restrict locale lookup to the current profile (see bug 233958)
        IProfileRegistry profileRegistry = null;
        try {
            profileRegistry = (IProfileRegistry) ServiceHolder.getProfileRegistry();
        } catch (ProvisioningException e) {
            log.warn("Profile registry unavailable. Default language will be used.");
            return new Collector();
        }

        IProfile profile = profileRegistry.getProfile(IProfileRegistry.SELF);
        if (profile == null) {
            log.warn("Profile unavailable. Default language will be used.");
            return new Collector();
        }
        IUPropertyQuery iuQuery = new IUPropertyQuery(IInstallableUnit.PROP_TYPE_FRAGMENT, "true"); //$NON-NLS-1$
        Collector collected = profile.query(iuQuery, localeFragmentCollector, null);
        LocaleCollectorCache.put(locale, new SoftReference(collected));
        return collected;
    }
View Full Code Here

Examples of org.eclipse.equinox.internal.provisional.p2.query.Collector

        InstallableUnitQuery query = new InstallableUnitQuery(id, Version.create(version));
        return getInstallableUnit(query);
    }

    public static IInstallableUnit getInstallableUnit(Query query) throws ProvisioningException {
        Collector collector = RepositoryUtils.getInstallableUnitsInRepositories(null, query, new Collector(), null);
        IInstallableUnit[] installableUnits = (IInstallableUnit[]) collector.toArray(IInstallableUnit.class);

        if (installableUnits == null || installableUnits.length == 0) {
            return null;
        }
        return installableUnits[0];
View Full Code Here

Examples of org.eclipse.equinox.internal.provisional.p2.query.Collector

            if (Boolean.toString(true).equals(iu.getProperty(IInstallableUnit.PROP_TYPE_PATCH))) {
                request.setInstallableUnitInclusionRules(iu, PlannerHelper.createOptionalInclusionRule(iu));
            }

            // Check to see if it is already installed.  This may alter the request.
            Collector alreadyInstalled = profile.query(new InstallableUnitQuery(iu.getId()), new Collector(), null);

            if (alreadyInstalled.size() > 0) {
                IInstallableUnit installedIU = (IInstallableUnit) alreadyInstalled.iterator().next();
                int compareTo = iu.getVersion().compareTo(installedIU.getVersion());
                // If the iu is a newer version of something already installed, consider this an
                // update request
                if (compareTo > 0) {
                    boolean lockedForUpdate = false;
View Full Code Here

Examples of org.geotools.gce.imagemosaic.catalog.index.Indexer.Collectors.Collector

                    }
                }
   
                // property names
                final String propertyNames[] = pcDef.substring(roundLPos + 1, roundRPos).split(",");
                Collector collector = Utils.OBJECT_FACTORY.createIndexerCollectorsCollector();
                collector.setSpi(spi);
               
                // only 1 propertyCollector for property
                collector.setMapped(propertyNames[0]);
                collector.setValue(value);
                collectorList.add(collector);
            }
        }
    }
View Full Code Here

Examples of org.jberet.job.Collector

            if (!oldVal.equals(newVal)) {
                analyzer.setRef(newVal);
            }
            resolve(analyzer.getProperties(), true);
        }
        Collector collector = partition.getCollector();
        if (collector != null) {
            oldVal = collector.getRef();
            newVal = resolve(oldVal);
            if (!oldVal.equals(newVal)) {
                collector.setRef(newVal);
            }
            resolve(collector.getProperties(), true);

        }
        PartitionReducer reducer = partition.getReducer();
        if (reducer != null) {
            oldVal = reducer.getRef();
View Full Code Here

Examples of org.jsmdr.collector.Collector

    Document doc = XMLUtil.parseXmlFile(fileName, false);
    NodeList collectorElts = doc.getDocumentElement().getElementsByTagName("Collector");
    NodeList processorElts = doc.getDocumentElement().getElementsByTagName("Processor");
    NodeList parserElts = doc.getDocumentElement().getElementsByTagName("Parser");

    Collector col = CollectorFactory.getInstance().createCollector((Element)collectorElts.item(0));
    PreProcessor processor = null;
    if (processorElts.getLength()>0)
      processor = new PreProcessor((Element)processorElts.item(0));
    else
      processor = new PreProcessor();
   
    col.addListener(processor);
    for (int i=0; i<parserElts.getLength(); i++) {
      SMDRParser parser = ParserFactory.getParser((Element)parserElts.item(i));
      processor.addListener(parser);
      parser.addListener(listener);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.