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

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


        for (int i = 0; i < features.length; i++) {
            FeatureInfo feature = features[i];
            QueryContext queryContext = new QueryContext();
            queryContext.setQueryable(ProvisioningUtils.getProfile());
            queryContext.setQuery(new InstallableUnitQuery(feature.getFeatureID(), new VersionRange(feature.getFeatureVersion())));
            InstalledIUQuery installedIUQuery = new InstalledIUQuery(queryContext);
            IInstallableUnit[] units = ProvisioningUtils.performIUQuery(installedIUQuery);
            ius[i] = units[0];
        }
        return ius;
View Full Code Here


            for (IRequiredCapability requiredCapability : requiredCapabilities) {
                String namespace = requiredCapability.getNamespace();
                String name = requiredCapability.getName();
                if (IInstallableUnit.NAMESPACE_IU_ID.equals(namespace) && name.endsWith("feature.group") && !name.startsWith("org.eclipse.equinox")) {
                    QueryContext queryContext = new QueryContext();
                    queryContext.setQuery(new InstallableUnitQuery(name, requiredCapability.getRange()));
                    queryContext.setQueryable(queryable);
                    InstalledIUQuery installedIUQuery = new InstalledIUQuery(queryContext);
                    IInstallableUnit[] requiredIUs = (ProvisioningUtils.performIUQuery(installedIUQuery));
                    IInstallableUnit requiredIU = (requiredIUs.length == 0) ? null : requiredIUs[0];
                    if (requiredIU != null) {
View Full Code Here

            return null;
        }
    }

    public static IInstallableUnit getInstallableUnit(String id, String version) throws ProvisioningException {
        InstallableUnitQuery query = new InstallableUnitQuery(id, Version.create(version));
        return getInstallableUnit(query);
    }
View Full Code Here

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

     */
    public static boolean areAllFeaturesInstalled(List<Feature> features) {
        for (Feature feature : features) {
            QueryContext queryContext = new QueryContext();
            queryContext.setQueryable(ProvisioningUtils.getProfile());
            queryContext.setQuery(new InstallableUnitQuery(feature.getId(),
                    feature.getVersionRange()));
            InstalledIUQuery installedIUQuery = new InstalledIUQuery(queryContext);
            IInstallableUnit[] installableUnits = ProvisioningUtils.
                    performIUQuery(installedIUQuery);
            if (installableUnits == null || installableUnits.length == 0) {
View Full Code Here

    public FeatureInfo getInstalledFeatureInfo(String featureID, String featureVersion) throws AxisFault {
        FeatureInfo featureInfo = null;
        try {
            QueryContext queryContext = new QueryContext();
            queryContext.setQueryable(ProvisioningUtils.getProfile());
            queryContext.setQuery(new InstallableUnitQuery(featureID, Version.create(featureVersion)));
            InstalledIUQuery installedIUQuery = new InstalledIUQuery(queryContext);
            IInstallableUnit[] installableUnits = ProvisioningUtils.performIUQuery(installedIUQuery);
            if (installableUnits == null || installableUnits.length == 0) {
                log.error("Error occured while quering feature information :" + featureID + "-" + featureVersion);
                throw new AxisFault("failed.get.feature.information");
View Full Code Here

        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();
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

            throw ProvisioningException.makeExceptionFromErrorCode(CompMgtMessages.INVALID_REPO_NAME,
                    (nickName == null) ? "null value" : nickName);
        }

        try {
            IMetadataRepositoryManager metadataRepositoryManager = ServiceHolder.getMetadataRepositoryManager();
            IArtifactRepositoryManager artifactRepositoryManager = ServiceHolder.getArtifactRepositoryManager();

            if (metadataRepositoryManager.contains(location)) {
                return;
            }

            //Validating the repositories
            status = metadataRepositoryManager.validateRepositoryLocation(location, null);
            if (!status.isOK()) {
                throw ProvisioningException.makeExceptionFromErrorCode(
                        CompMgtMessages.INVALID_REPO_LOCATION, location);
            }

            //Loading the metadata repository
            metadataRepositoryManager.loadRepository(location, null);
            metadataRepositoryManager.setRepositoryProperty(location, IRepository.PROP_NICKNAME, nickName);

            //Loading the artifact repository
            artifactRepositoryManager.loadRepository(location, null);
            artifactRepositoryManager.setRepositoryProperty(location, IRepository.PROP_NICKNAME, nickName);
        } catch (Exception e) {
View Full Code Here

                    CompMgtMessages.FAILD_TO_REMOVE_REPSITORY, e, location);
        }
    }

    public static void enableRepository(URI location, boolean enable) throws ProvisioningException {
        IMetadataRepositoryManager metadataRepositoryManager;
        IArtifactRepositoryManager artifactRepositoryManager;

        if (location == null) {
            throw ProvisioningException.makeExceptionFromErrorCode(CompMgtMessages.INVALID_REPO_LOCATION,
                    "null value");
        }

        try {
            metadataRepositoryManager = ServiceHolder.getMetadataRepositoryManager();
            artifactRepositoryManager = ServiceHolder.getArtifactRepositoryManager();
            metadataRepositoryManager.setEnabled(location, enable);
            artifactRepositoryManager.setEnabled(location, enable);
        } catch (Exception e) {
            throw ProvisioningException.makeExceptionFromErrorCode(
                    CompMgtMessages.FAILD_TO_ENABLE_REPSITORY, e, location);
        }
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.