Package org.apache.ivy.osgi.util

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


                    .getSingleValue();
        }

        String vBundle = new ManifestHeaderValue(mainAttributes.getValue(BUNDLE_VERSION))
                .getSingleValue();
        Version version;
        try {
            version = versionOf(vBundle);
        } catch (NumberFormatException e) {
            throw new ParseException("The " + BUNDLE_VERSION + " has an incorrect version: "
                    + vBundle + " (" + e.getMessage() + ")", 0);
        }

        BundleInfo bundleInfo = new BundleInfo(symbolicName, version);

        bundleInfo.setDescription(description);

        List/* <String> */environments = new ManifestHeaderValue(
                mainAttributes.getValue(BUNDLE_REQUIRED_EXECUTION_ENVIRONMENT)).getValues();
        bundleInfo.setExecutionEnvironments(environments);

        parseRequirement(bundleInfo, mainAttributes, REQUIRE_BUNDLE, BundleInfo.BUNDLE_TYPE,
            ATTR_BUNDLE_VERSION);
        parseRequirement(bundleInfo, mainAttributes, IMPORT_PACKAGE, BundleInfo.PACKAGE_TYPE,
            ATTR_VERSION);
        parseRequirement(bundleInfo, mainAttributes, IMPORT_SERVICE, BundleInfo.SERVICE_TYPE,
            ATTR_VERSION);

        ManifestHeaderValue exportElements = new ManifestHeaderValue(
                mainAttributes.getValue(EXPORT_PACKAGE));
        Iterator itExports = exportElements.getElements().iterator();
        while (itExports.hasNext()) {
            ManifestHeaderElement exportElement = (ManifestHeaderElement) itExports.next();
            String vExport = (String) exportElement.getAttributes().get(ATTR_VERSION);
            Version v = null;
            try {
                v = versionOf(vExport);
            } catch (NumberFormatException e) {
                throw new ParseException("The " + EXPORT_PACKAGE + " has an incorrect version: "
                        + vExport + " (" + e.getMessage() + ")", 0);
View Full Code Here


        ManifestHeaderValue elements = new ManifestHeaderValue(mainAttributes.getValue(headerName));
        Iterator itElement = elements.getElements().iterator();
        while (itElement.hasNext()) {
            ManifestHeaderElement element = (ManifestHeaderElement) itElement.next();
            String attVersion = (String) element.getAttributes().get(ATTR_VERSION);
            Version version = null;
            try {
                version = versionOf(attVersion);
            } catch (NumberFormatException e) {
                throw new ParseException("The " + headerName + " has an incorrect version: "
                        + attVersion + " (" + e.getMessage() + ")", 0);
View Full Code Here

    private static Version versionOf(String v) throws ParseException {
        if (v == null) {
            return null;
        }
        return new Version(v);
    }
View Full Code Here

        public int compare(Object o1, Object o2) {
            return compare((ModuleRevisionId) o1, (ModuleRevisionId) o2);
        }

        public int compare(ModuleRevisionId o1, ModuleRevisionId o2) {
            Version v1;
            Version v2;
            try {
                v1 = new Version(o1.getRevision());
                v2 = new Version(o2.getRevision());
            } catch (ParseException e) {
                throw new RuntimeException("Uncomparable versions:" + o1.getRevision() + " and "
                        + o2.getRevision() + " (" + e.getMessage() + ")");
            }
            return v1.compareTo(v2);
View Full Code Here

        protected void handleAttributes(Attributes atts) throws SAXException {
            String id = atts.getValue(ID);
            String version = atts.getValue(VERSION);
            // Boolean singleton = Boolean.valueOf(atts.getValue(SINGLETON));
            try {
                bundleInfo = new BundleInfo(id, new Version(version));
            } catch (ParseException e) {
                throw new SAXException("Incorrect version on bundle '" + id + "': " + version
                        + " (" + e.getMessage() + ")");
            }
        }
View Full Code Here

        public ProvidesHandler() {
            super(PROVIDES);
            addChild(new ProvidedHandler(), new ChildElementHandler() {
                public void childHanlded(DelegetingHandler child) {
                    String name = ((ProvidedHandler) child).name;
                    Version version = ((ProvidedHandler) child).version;
                    String type = namespace2Type(((ProvidedHandler) child).namespace);
                    if (type == null) {
                        Message.debug("Unsupported provided capability "
                                + ((ProvidedHandler) child).namespace + " " + name + " " + version);
                        return;
View Full Code Here

        protected void handleAttributes(Attributes atts) throws SAXException {
            namespace = atts.getValue(NAMESPACE);
            name = atts.getValue(NAME);
            try {
                version = new Version(atts.getValue(VERSION));
            } catch (ParseException e) {
                throw new SAXException("Incorrect version on provided capability: " + version
                        + " (" + e.getMessage() + ")");
            }
        }
View Full Code Here

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

            });
        }

        protected void handleAttributes(Attributes atts) throws SAXException {
            String id = atts.getValue(ID);
            Version version;
            try {
                version = new Version(atts.getValue(VERSION));
            } catch (ParseException e) {
                throw new SAXException("Incorrect version attribute on artifact '" + id + "': "
                        + atts.getValue(VERSION) + " (" + e.getMessage() + ")");
            }
            String classifier = atts.getValue(CLASSIFIER);
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.