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

Examples of org.eclipse.equinox.internal.provisional.p2.engine.ProvisioningContext


                throw new AxisFault("failed.get.feature.information");
            }

            IInstallableUnit iu = installableUnits[0];
            ILicense license = IUPropertyUtils.getLicense(iu);
            ICopyright copyright = IUPropertyUtils.getCopyright(iu);
            featureInfo = ProvWSUtils.wrapIUsAsFeaturesWithDetails(iu, license, copyright);
        } catch (Exception e) {
            handleException("Error occured while quering feature information :" + featureID + "-" + featureVersion,
                    "failed.get.feature.information", e);
        }
View Full Code Here


                handleException("Error occured while quering feature information :" + featureID + "-" + featureVersion,
                        "failed.get.feature.information");
            }

            ILicense licence = IUPropertyUtils.getLicense(iu);
            ICopyright copyright = IUPropertyUtils.getCopyright(iu);
            featureInfo = ProvWSUtils.wrapIUsAsFeaturesWithDetails(iu, licence, copyright);
        } catch (Exception e) {
            handleException("Error occured while quering feature information :" + featureID + "-" + featureVersion,
                    "failed.get.feature.information", e);
        }
View Full Code Here

        }

        FeatureInfo[] features = new FeatureInfo[installableUnits.length];
        for (int index = 0; index < installableUnits.length; index++) {
            FeatureInfo feature = new FeatureInfo();
            IInstallableUnit installableUnit = installableUnits[index];
            features[index] = feature;

            feature.setFeatureID(installableUnit.getId());
            feature.setFeatureVersion(installableUnit.getVersion().toString());
            feature.setFeatureName(IUPropertyUtils.getIUProperty(installableUnit, IInstallableUnit.PROP_NAME));

            String provider = IUPropertyUtils.getIUProperty(installableUnit, IInstallableUnit.PROP_PROVIDER);
            if (provider == null) {
                provider = " ";
View Full Code Here

        featureStack = new Stack<Feature>();
        iuStack.add(iu);
        featureStack.add(groupFeature);

        while (!iuStack.isEmpty() && !featureStack.isEmpty()) {
            IInstallableUnit popedIU = iuStack.pop();
            Feature popedFeature = featureStack.pop();

            if (popedFeature.isInstalled()) {
                popedFeature.setRequiredFeatures(new Feature[0]);
                continue;
            }

            //Processing required Features.
            ArrayList<Feature> requiredFeaturesList = new ArrayList<Feature>();
            IRequiredCapability[] requiredCapabilities = popedIU.getRequiredCapabilities();
            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) {
                        Feature requiredFeature = wrapIU(requiredIU);
                        if (!ProvisioningUtils.isIUInstalled(requiredIU, installedFeaturesMap)) {
                            if (!requiredCapability.isOptional()) {
                                requiredFeature.setRequired(true);
View Full Code Here

            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 requiredIU = ProvisioningUtils.performIUQuery(installedIUQuery)[0];
                if (requiredIU != null) {
                    requiredIUList.add(requiredIU);
                }
            }
        }
View Full Code Here

        }
        return iuMap.values().toArray(new IInstallableUnit[iuMap.values().size()]);
    }

    private static void addIUtoMap(HashMap<String, IInstallableUnit> iuMap, IInstallableUnit iu) {
        IInstallableUnit addedIU = iuMap.get(iu.getId());
        if (addedIU == null) {
            iuMap.put(iu.getId(), iu);
        } else if (addedIU.getVersion().compareTo(iu.getVersion()) < 0) {
            iuMap.put(iu.getId(), iu);
        }
    }
View Full Code Here

        });
        return ius;
    }

    public static boolean isIUInstalled(IInstallableUnit iu, HashMap<String, IInstallableUnit> installedIUMap) {
        IInstallableUnit installedIU = installedIUMap.get(iu.getId());
        return installedIU != null && installedIU.getVersion().compareTo(iu.getVersion()) >= 0;
    }
View Full Code Here

            // 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;
                    String value = profile.getInstallableUnitProperty(installedIU,
                            IInstallableUnit.PROP_PROFILE_LOCKED_IU);
                    if (value != null) {
                        lockedForUpdate = (Integer.parseInt(value) & IInstallableUnit.LOCK_UPDATE) ==
                                IInstallableUnit.LOCK_UPDATE;
                    }
                    if (lockedForUpdate) {
                        // Add a status telling the user that this implies an update, but the
                        // iu should not be updated
                        status.merge(new Status(IStatus.WARNING, "temp", 10013, installedIU.getId() + "-" +
                                installedIU.getVersion() +
                                " will be ignored because it is already installed, " +
                                "and updates are not permitted.", null));
                    } else {
                        request.addInstallableUnits(new IInstallableUnit[]{iu});
                        request.removeInstallableUnits(new IInstallableUnit[]{installedIU});
                        // Add a status informing the user that the update has been inferred
                        status.merge(new Status(IStatus.WARNING, "temp", 10013, installedIU.getId() + "-" +
                                installedIU.getVersion() +
                                " is already installed, so an update will be performed instead.", null));
                        // Mark it as a root if it hasn't been already
                        if (!Boolean.toString(true).equals(profile.getInstallableUnitProperty(installedIU,
                                IInstallableUnit.PROP_PROFILE_ROOT_IU))) {
                            request.setInstallableUnitProfileProperty(iu, IInstallableUnit.PROP_PROFILE_ROOT_IU,
                                    Boolean.toString(true));
                        }
                    }
                } else if (compareTo < 0) {
                    // An implied downgrade.  We will not put this in the plan, add a status informing the user
                    status.merge(new Status(IStatus.WARNING, "temp", 10004, installedIU.getId() + "-" +
                            installedIU.getVersion() +
                            " will be ignored because a newer version is already installed.", null));
                } else {
                    if (Boolean.toString(true).equals(profile.getInstallableUnitProperty(installedIU,
                            IInstallableUnit.PROP_PROFILE_ROOT_IU)))
                    // It is already a root, nothing to do. We tell the user it was already installed
                    {
                        status.merge(new Status(IStatus.WARNING, "temp", 10005, installedIU.getId() + "-" +
                                installedIU.getVersion() + " will be ignored because it is already installed.", null));
                    } else {
                        // It was already installed but not as a root.
                        // Tell the user that parts of it are already installed and mark it as a root.
                        status.merge(new Status(IStatus.WARNING, "temp", 10006, installedIU.getId() + "-" +
                                installedIU.getVersion() +
                                " is already present because other installed software requires it.  " +
                                "It will be added to the installed software list.", null));
                        request.setInstallableUnitProfileProperty(iu, "org.eclipse.equinox.p2.type.root",
                                Boolean.toString(true));
                    }
View Full Code Here

            if (installableUnits == null || installableUnits.length == 0) {
                log.error("Error occured while quering feature information :" + featureID + "-" + featureVersion);
                throw new AxisFault("failed.get.feature.information");
            }

            IInstallableUnit iu = installableUnits[0];
            ILicense license = IUPropertyUtils.getLicense(iu);
            ICopyright copyright = IUPropertyUtils.getCopyright(iu);
            featureInfo = ProvWSUtils.wrapIUsAsFeaturesWithDetails(iu, license, copyright);
        } catch (Exception e) {
            handleException("Error occured while quering feature information :" + featureID + "-" + featureVersion,
View Full Code Here

    }

    public FeatureInfo getInstallableFeatureInfo(String featureID, String featureVersion) throws AxisFault {
        FeatureInfo featureInfo = null;
        try {
            IInstallableUnit iu = RepositoryUtils.getInstallableUnit(featureID, featureVersion);
            if (iu == null) {
                handleException("Error occured while quering feature information :" + featureID + "-" + featureVersion,
                        "failed.get.feature.information");
            }
View Full Code Here

TOP

Related Classes of org.eclipse.equinox.internal.provisional.p2.engine.ProvisioningContext

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.