Package org.apache.ivy.osgi.util

Examples of org.apache.ivy.osgi.util.Version


        handler.startElement("", CapabilityHandler.CAPABILITY, CapabilityHandler.CAPABILITY, atts);
        if (type.equals(BundleInfo.BUNDLE_TYPE)) {
            // nothing to do, already handled with the resource tag
        } else if (type.equals(BundleInfo.PACKAGE_TYPE)) {
            saxCapabilityProperty("package", capability.getName(), handler);
            Version v = capability.getRawVersion();
            if (v != null) {
                saxCapabilityProperty("version", v.toString(), handler);
            }
            Set/* <String> */uses = ((ExportPackage) capability).getUses();
            if (uses != null && !uses.isEmpty()) {
                StringBuffer builder = new StringBuffer();
                Iterator itUse = uses.iterator();
                while (itUse.hasNext()) {
                    String use = (String) itUse.next();
                    if (builder.length() != 0) {
                        builder.append(',');
                    }
                    builder.append(use);
                }
                saxCapabilityProperty("uses", builder.toString(), handler);
            }
        } else if (type.equals(BundleInfo.SERVICE_TYPE)) {
            saxCapabilityProperty("service", capability.getName(), handler);
            Version v = capability.getRawVersion();
            if (v != null) {
                saxCapabilityProperty("version", v.toString(), handler);
            }
        } else {
            // oups
        }
        handler.endElement("", CapabilityHandler.CAPABILITY, CapabilityHandler.CAPABILITY);
View Full Code Here


        return filter.toString();
    }

    private static void appendVersion(StringBuffer filter, VersionRange v) {
        filter.append("(&");
        Version start = v.getStartVersion();
        if (start != null) {
            if (!v.isStartExclusive()) {
                filter.append("(version>=");
                filter.append(start.toString());
                filter.append(')');
            } else {
                filter.append("(!");
                filter.append("(version<=");
                filter.append(start.toString());
                filter.append("))");
            }
        }
        Version end = v.getEndVersion();
        if (end != null) {
            if (!v.isEndExclusive()) {
                filter.append("(version<=");
                filter.append(end.toString());
                filter.append(')');
            } else {
                filter.append("(!");
                filter.append("(version>=");
                filter.append(end.toString());
                filter.append("))");
            }
        }
    }
View Full Code Here

                        "Filtering is only supported with the operator '='");
            }
            name = compareFilter.getRightValue();
        } else if ("version".equals(att)) {
            String v = compareFilter.getRightValue();
            Version version;
            try {
                version = new Version(v);
            } catch (ParseException e) {
                throw new ParseException("Ill formed version: " + v, 0);
            }
            Operator operator = compareFilter.getOperator();
            if (not) {
View Full Code Here

    }

    private static ExportPackage getExportPackage(BundleInfo bundleInfo, Capability capability)
            throws ParseException {
        String pkgName = null;
        Version version = null;
        String uses = null;
        Iterator itCapability = capability.getProperties().iterator();
        while (itCapability.hasNext()) {
            CapabilityProperty property = (CapabilityProperty) itCapability.next();
            String propName = property.getName();
            if ("package".equals(propName)) {
                pkgName = property.getValue();
            } else if ("version".equals(propName)) {
                version = new Version(property.getValue());
            } else if ("uses".equals(propName)) {
                uses = property.getValue();
            } else {
                Message.warn("Unsupported property '" + propName
                        + "' on the 'package' capability of the bundle '"
View Full Code Here

    }

    private static BundleCapability getOSGiService(BundleInfo bundleInfo, Capability capability)
            throws ParseException {
        String name = null;
        Version version = null;

        Iterator itCapability = capability.getProperties().iterator();
        while (itCapability.hasNext()) {
            CapabilityProperty property = (CapabilityProperty) itCapability.next();
            String propName = property.getName();
            if ("service".equals(propName)) {
                name = property.getValue();
            } else if ("version".equals(propName)) {
                version = new Version(property.getValue());
            } else {
                Message.warn("Unsupported property '" + propName
                        + "' on the 'package' capability of the bundle '"
                        + bundleInfo.getSymbolicName() + "'");
            }
View Full Code Here

            }
            String version = (String) tokenValues.get(IvyPatternHelper.REVISION_KEY);
            if (version == null) {
                return Collections.EMPTY_LIST;
            }
            Version v;
            try {
                v = new Version(version);
            } catch (ParseException e) {
                return Collections.EMPTY_LIST;
            }
            BundleCapabilityAndLocation found = null;
            Iterator itBundle = bundleCapabilities.iterator();
View Full Code Here

            Set/* <BundleCapabilityAndLocation> */bundleCapabilities = getRepoDescriptor()
                    .findModule(osgiType, module);
            if (bundleCapabilities == null) {
                return Collections.EMPTY_SET;
            }
            Version v;
            try {
                v = new Version(rev);
            } catch (ParseException e) {
                return Collections.EMPTY_SET;
            }
            BundleCapabilityAndLocation found = null;
            Iterator itBundle = bundleCapabilities.iterator();
View Full Code Here

        protected void handleAttributes(Attributes atts) throws SAXException {
            String id = atts.getValue(ID);
            String version = atts.getValue(VERSION);
            try {
                feature = new EclipseFeature(id, new Version(version));
            } catch (ParseException e) {
                throw new SAXException("Incorrect version on feature '" + id + "': " + version
                        + " (" + e.getMessage() + ")");
            }
View Full Code Here

            String id = atts.getValue(ID);
            String version = atts.getValue(VERSION);

            plugin.setId(id);
            try {
                plugin.setVersion(new Version(version));
            } catch (ParseException e) {
                throw new SAXException("Incorrect version on feature's plugin '" + id + "': "
                        + version + " (" + e.getMessage() + ")");
            }
            plugin.setUnpack(Boolean.valueOf(atts.getValue(UNPACK)).booleanValue());
View Full Code Here

            String version = atts.getValue(VERSION);

            require.setFeature(atts.getValue(FEATURE));
            require.setPlugin(atts.getValue(PLUGIN));
            try {
                require.setVersion(new Version(version));
            } catch (ParseException e) {
                throw new SAXException("Incorrect version on feature's import: " + version + " ("
                        + e.getMessage() + ")");
            }
            require.setMatch(atts.getValue(MATCH));
View Full Code Here

TOP

Related Classes of org.apache.ivy.osgi.util.Version

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.