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

Examples of org.eclipse.equinox.internal.provisional.p2.metadata.ILicense


        }

    }

    public static boolean isRepositoryEnabled(URI location) throws ProvisioningException {
        IMetadataRepositoryManager metadataRepositoryManager = ServiceHolder.getMetadataRepositoryManager();
        IArtifactRepositoryManager artifactRepositoryManager = ServiceHolder.getArtifactRepositoryManager();
        return metadataRepositoryManager.isEnabled(location) && artifactRepositoryManager.isEnabled(location);
    }
View Full Code Here


        return metadataRepositoryManager.isEnabled(location) && artifactRepositoryManager.isEnabled(location);
    }

    public static URI[] getRepositoryList(int type) throws ProvisioningException {
        try {
            IMetadataRepositoryManager metadataRepositoryManager = ServiceHolder.getMetadataRepositoryManager();
            return metadataRepositoryManager.getKnownRepositories(type);
        } catch (Exception e) {
            throw ProvisioningException.makeExceptionFromErrorCode(
                    CompMgtMessages.FAILD_TO_GET_REPSITORY_LIST, e);
        }
    }
View Full Code Here

                    CompMgtMessages.FAILD_TO_GET_REPSITORY_LIST, e);
        }
    }

    public static String getMetadataRepositoryProperty(URI location, String key) throws ProvisioningException {
        IMetadataRepositoryManager metadataRepositoryManager = ServiceHolder.getMetadataRepositoryManager();
        return metadataRepositoryManager.getRepositoryProperty(location, key);
    }
View Full Code Here

        return installableUnits[0];
    }


    private static IMetadataRepository getMetadataRepository(URI location) throws ProvisioningException {
        IMetadataRepositoryManager metadataRepositoryManager = ServiceHolder.getMetadataRepositoryManager();
        try {
            return metadataRepositoryManager.loadRepository(location, null);
        } catch (ProvisionException e) {
            throw new ProvisioningException(e.getMessage(), e);
        }
    }
View Full Code Here

    }

    private static void setMetadataRepositoryProperty(URI location,
                                                      String key,
                                                      String value) throws ProvisioningException {
        IMetadataRepositoryManager metadataRepositoryManager = ServiceHolder.getMetadataRepositoryManager();
        metadataRepositoryManager.setRepositoryProperty(location, key, value);
    }
View Full Code Here

        IMetadataRepositoryManager metadataRepositoryManager = ServiceHolder.getMetadataRepositoryManager();
        metadataRepositoryManager.setRepositoryProperty(location, key, value);
    }

    private static void removeMetadataRepository(URI location) throws ProvisioningException {
        IMetadataRepositoryManager metadataRepositoryManager = ServiceHolder.getMetadataRepositoryManager();
        metadataRepositoryManager.removeRepository(location);
    }
View Full Code Here

        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

        }

        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

     * 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

        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

TOP

Related Classes of org.eclipse.equinox.internal.provisional.p2.metadata.ILicense

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.