Package org.apache.felix.framework.util

Examples of org.apache.felix.framework.util.VersionRange


     * @param versionRange the target version range.
     * @return an array of matching bundles sorted in descending version order.
    **/
    public Bundle[] getBundles(String symbolicName, String versionRange)
    {
        VersionRange vr = (versionRange == null) ? null : VersionRange.parse(versionRange);
        Bundle[] bundles = m_felix.getBundles();
        List list = new ArrayList();
        for (int i = 0; (bundles != null) && (i < bundles.length); i++)
        {
            String sym = bundles[i].getSymbolicName();
            if ((sym != null) && sym.equals(symbolicName))
            {
                Version v = bundles[i].adapt(BundleRevision.class).getVersion();
                if ((vr == null) || vr.isInRange(v))
                {
                    list.add(bundles[i]);
                }
            }
        }
View Full Code Here


        for (Entry<String, Object> entry : attrs.entrySet())
        {
            if (entry.getValue() instanceof VersionRange)
            {
                VersionRange vr = (VersionRange) entry.getValue();
                if (vr.isFloorInclusive())
                {
                    filters.add(
                        new SimpleFilter(
                            entry.getKey(),
                            vr.getFloor().toString(),
                            SimpleFilter.GTE));
                }
                else
                {
                    SimpleFilter not =
                        new SimpleFilter(null, new ArrayList(), SimpleFilter.NOT);
                    ((List) not.getValue()).add(
                        new SimpleFilter(
                            entry.getKey(),
                            vr.getFloor().toString(),
                            SimpleFilter.LTE));
                    filters.add(not);
                }

                if (vr.getCeiling() != null)
                {
                    if (vr.isCeilingInclusive())
                    {
                        filters.add(
                            new SimpleFilter(
                                entry.getKey(),
                                vr.getCeiling().toString(),
                                SimpleFilter.LTE));
                    }
                    else
                    {
                        SimpleFilter not =
                            new SimpleFilter(null, new ArrayList(), SimpleFilter.NOT);
                        ((List) not.getValue()).add(
                            new SimpleFilter(
                                entry.getKey(),
                                vr.getCeiling().toString(),
                                SimpleFilter.GTE));
                        filters.add(not);
                    }
                }
            }
View Full Code Here

            {
                // no specific version required, this export surely satisfies it
                return true;
            }

            VersionRange required = VersionRange.parse( versionAttr );
            return required.isInRange( exported.getVersion() );
        }

        // no this export does not satisfy the import
        return false;
    }
View Full Code Here

                if (!clause.m_attrs.isEmpty())
                {
                    // R3 package requirements should only have version attributes.
                    Object pkgVersion = clause.m_attrs.get(BundleCapabilityImpl.VERSION_ATTR);
                    pkgVersion = (pkgVersion == null)
                        ? new VersionRange(Version.emptyVersion, true, null, true)
                        : pkgVersion;
                    for (Entry<String, Object> entry : clause.m_attrs.entrySet())
                    {
                        if (!entry.getKey().equals(BundleCapabilityImpl.VERSION_ATTR))
                        {
View Full Code Here

            {
                selection.add("" + indexList.get(i));
            }
            for (int k = 0; (osversions != null) && (k < osversions.length); k++)
            {
                VersionRange range = VersionRange.parse(osversions[k]);
                if ((range.getFloor()).compareTo(osVersionRangeMaxFloor) >= 0)
                {
                    osVersionRangeMaxFloor = range.getFloor();
                }
            }
        }

        if (selection.size() == 1)
        {
            return Integer.parseInt(selection.get(0).toString());
        }
        else if (selection.size() > 1)
        {
            // Keep only selected clauses with an 'osversion'
            // equal to the max floor of 'osversion' ranges.
            indexList = selection;
            selection = new ArrayList();
            for (int i = 0; i < indexList.size(); i++)
            {
                int index = Integer.parseInt(indexList.get(i).toString());
                String[] osversions = ((R4LibraryClause) clauseList.get(index)).getOSVersions();
                for (int k = 0; k < osversions.length; k++)
                {
                    VersionRange range = VersionRange.parse(osversions[k]);
                    if ((range.getFloor()).compareTo(osVersionRangeMaxFloor) >= 0)
                    {
                        selection.add("" + indexList.get(i));
                    }
                }
            }
View Full Code Here

    {
        for (int i = 0; (osversions != null) && (i < osversions.length); i++)
        {
            try
            {
                VersionRange range = VersionRange.parse(osversions[i]);
                if (range.isInRange(new Version(currentOSVersion)))
                {
                    return true;
                }
            }
            catch (Exception ex)
View Full Code Here

    {
        for (int i = 0; (osversions != null) && (i < osversions.length); i++)
        {
            try
            {
                VersionRange range = VersionRange.parse(osversions[i]);
                if (range.isInRange(new Version(currentOSVersion)))
                {
                    return true;
                }
            }
            catch (Exception ex)
View Full Code Here

                if (!clause.m_attrs.isEmpty())
                {
                    // R3 package requirements should only have version attributes.
                    Object pkgVersion = clause.m_attrs.get(BundleCapabilityImpl.VERSION_ATTR);
                    pkgVersion = (pkgVersion == null)
                        ? new VersionRange(Version.emptyVersion, true, null, true)
                        : pkgVersion;
                    for (Entry<String, Object> entry : clause.m_attrs.entrySet())
                    {
                        if (!entry.getKey().equals(BundleCapabilityImpl.VERSION_ATTR))
                        {
View Full Code Here

            {
                selection.add("" + indexList.get(i));
            }
            for (int k = 0; (osversions != null) && (k < osversions.length); k++)
            {
                VersionRange range = VersionRange.parse(osversions[k]);
                if ((range.getFloor()).compareTo(osVersionRangeMaxFloor) >= 0)
                {
                    osVersionRangeMaxFloor = range.getFloor();
                }
            }
        }

        if (selection.size() == 1)
        {
            return Integer.parseInt(selection.get(0).toString());
        }
        else if (selection.size() > 1)
        {
            // Keep only selected clauses with an 'osversion'
            // equal to the max floor of 'osversion' ranges.
            indexList = selection;
            selection = new ArrayList();
            for (int i = 0; i < indexList.size(); i++)
            {
                int index = Integer.parseInt(indexList.get(i).toString());
                String[] osversions = ((R4LibraryClause) clauseList.get(index)).getOSVersions();
                for (int k = 0; k < osversions.length; k++)
                {
                    VersionRange range = VersionRange.parse(osversions[k]);
                    if ((range.getFloor()).compareTo(osVersionRangeMaxFloor) >= 0)
                    {
                        selection.add("" + indexList.get(i));
                    }
                }
            }
View Full Code Here

        for (Entry<String, Object> entry : attrs.entrySet())
        {
            if (entry.getValue() instanceof VersionRange)
            {
                VersionRange vr = (VersionRange) entry.getValue();
                if (vr.isFloorInclusive())
                {
                    filters.add(
                        new SimpleFilter(
                            entry.getKey(),
                            vr.getFloor().toString(),
                            SimpleFilter.GTE));
                }
                else
                {
                    SimpleFilter not =
                        new SimpleFilter(null, new ArrayList(), SimpleFilter.NOT);
                    ((List) not.getValue()).add(
                        new SimpleFilter(
                            entry.getKey(),
                            vr.getFloor().toString(),
                            SimpleFilter.LTE));
                    filters.add(not);
                }

                if (vr.getCeiling() != null)
                {
                    if (vr.isCeilingInclusive())
                    {
                        filters.add(
                            new SimpleFilter(
                                entry.getKey(),
                                vr.getCeiling().toString(),
                                SimpleFilter.LTE));
                    }
                    else
                    {
                        SimpleFilter not =
                            new SimpleFilter(null, new ArrayList(), SimpleFilter.NOT);
                        ((List) not.getValue()).add(
                            new SimpleFilter(
                                entry.getKey(),
                                vr.getCeiling().toString(),
                                SimpleFilter.GTE));
                        filters.add(not);
                    }
                }
            }
View Full Code Here

TOP

Related Classes of org.apache.felix.framework.util.VersionRange

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.