Package org.eclipse.equinox.internal.provisional.p2.query

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


            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


     * @param iuQuery instance of an IUQuery on which the query is to be performed.
     * @return array of InstallableUnits
     */
    public static IInstallableUnit[] performIUQuery(IUQuery iuQuery) {
        if (iuQuery != null) {
            Collector collector = iuQuery.perform();
            IInstallableUnit[] collectedIUs = (IInstallableUnit[]) collector.toArray(IInstallableUnit.class);
            return sort(collectedIUs);
        }
        return new IInstallableUnit[0];
    }
View Full Code Here

    public AvailableIUQuery(QueryContext queryContext) {
        super(queryContext);
    }

    public Collector perform() {
        Collector collector = new Collector();
        IQueryable queryable = queryContext.getQueryable();
        IProfile profile = ProvisioningUtils.getProfile();
        if (queryable == null || profile == null) {
            return collector;
        }

        Query query = new IUPropertyQuery(IInstallableUnit.PROP_TYPE_GROUP, Boolean.TRUE.toString());

        if (queryContext.isShowLatestVersionsOnly()) {
            query = new CompositeQuery(new Query[]{query, new LatestIUVersionQuery()});
        }

        collector = queryable.query(query, collector, null);

        if (queryContext.isHideAlreadyInstalled()) {
            Collector filteredCollection = new Collector();
            for (Iterator itr = collector.iterator(); itr.hasNext();) {
                IInstallableUnit iu = (IInstallableUnit) itr.next();

                Collector tmpCollector = profile.query(new InstallableUnitQuery(iu.getId()), new Collector(), null);
                if (tmpCollector.size() == 0) {
                    filteredCollection.accept(iu);
                    continue;
                }
                Iterator iter = tmpCollector.iterator();

                while (iter.hasNext()) {
                    IInstallableUnit installed = (IInstallableUnit) iter.next();
                    if (installed.getVersion().compareTo(iu.getVersion()) < 0) {
                        filteredCollection.accept(iu);
View Full Code Here

    public InstalledIUQuery(QueryContext queryContext) {
        super(queryContext);
    }

    public Collector perform() {
        Collector collector = new Collector();
        IQueryable queryable = queryContext.getQueryable();
        IProfile profile = ProvisioningUtils.getProfile();
        Query query = queryContext.getQuery();

        if (queryable == null || profile == null) {
View Full Code Here

        }

        Query query = new IUPropertyQuery(IInstallableUnit.PROP_TYPE_GROUP, Boolean.TRUE.toString());

        if (queryContext.isShowLatestVersionsOnly()) {
            query = new CompositeQuery(new Query[]{query, new LatestIUVersionQuery()});
        }

        collector = queryable.query(query, collector, null);

        if (queryContext.isHideAlreadyInstalled()) {
View Full Code Here

     * @return The IUs that match the query
     * @throws ProvisioningException
     */
    public static Collector getInstallableUnitsInRepositories(URI location, Query query, Collector collector,
                                                              IProgressMonitor monitor) throws ProvisioningException {
        IQueryable queryable;
        if (location != null) {
            queryable = getMetadataRepository(location);
        } else {
            queryable = ServiceHolder.getMetadataRepositoryManager();
        }
        return queryable.query(query, collector, monitor);
    }
View Full Code Here

        }
        return queryable.query(query, collector, monitor);
    }

    public static IQueryable getQuerybleRepositoryManager(URI location) {
        IQueryable queryable;
        try {
            if (location != null) {
                queryable = getMetadataRepository(location);
            } else {
                queryable = ServiceHolder.getMetadataRepositoryManager();
View Full Code Here

        super(queryContext);
    }

    public Collector perform() {
        Collector collector = new Collector();
        IQueryable queryable = queryContext.getQueryable();
        IProfile profile = ProvisioningUtils.getProfile();
        if (queryable == null || profile == null) {
            return collector;
        }

        Query query = new IUPropertyQuery(IInstallableUnit.PROP_TYPE_GROUP, Boolean.TRUE.toString());

        if (queryContext.isShowLatestVersionsOnly()) {
            query = new CompositeQuery(new Query[]{query, new LatestIUVersionQuery()});
        }

        collector = queryable.query(query, collector, null);

        if (queryContext.isHideAlreadyInstalled()) {
            Collector filteredCollection = new Collector();
            for (Iterator itr = collector.iterator(); itr.hasNext();) {
                IInstallableUnit iu = (IInstallableUnit) itr.next();
View Full Code Here

        super(queryContext);
    }

    public Collector perform() {
        Collector collector = new Collector();
        IQueryable queryable = queryContext.getQueryable();
        IProfile profile = ProvisioningUtils.getProfile();
        Query query = queryContext.getQuery();

        if (queryable == null || profile == null) {
            return collector;
        }

        //If the query is not set, return the list of IUs which has the property "org.eclipse.equinox.p2.type.root"
        if (query == null) {
            query = new IUProfilePropertyQuery(profile, IInstallableUnit.PROP_PROFILE_ROOT_IU,
                    Boolean.TRUE.toString());
        }

        return queryable.query(query, collector, null);
    }
View Full Code Here

        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);
View Full Code Here

TOP

Related Classes of org.eclipse.equinox.internal.provisional.p2.query.IQueryable

Copyright © 2018 www.massapicom. 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.