Examples of OSGiVersionComparator


Examples of org.rhq.core.domain.util.OSGiVersionComparator

        public int compare(PackageVersion p1, PackageVersion p2) {
            String v1 = p1.getVersion();
            String v2 = p2.getVersion();

            OSGiVersionComparator c = new OSGiVersionComparator();

            if (v1 != null && v2 != null) {
                try {
                    return c.compare(v1, v2);
                } catch (IllegalArgumentException e) {
                    //well, this can happen.. not all packages have OSGi type versions.
                }
            }
View Full Code Here

Examples of org.rhq.core.domain.util.OSGiVersionComparator

                            + " with regex version comparison in IfVersion directive.");
                        return null;
                    }
                }

                OSGiVersionComparator comp = new OSGiVersionComparator();

                boolean hasVersion = false;
                if ("=".equals(operator)) {
                    if (regex) {
                        hasVersion = Pattern.matches(version, state.httpdVersion);
                    } else {
                        hasVersion = comp.compare(version, state.httpdVersion) == 0;
                    }
                } else if ("~".equals(operator)) {
                    hasVersion = Pattern.matches(version, state.httpdVersion);
                } else if (">".equals(operator)) {
                    hasVersion = comp.compare(state.httpdVersion, version) > 0;
                } else if (">=".equals(operator)) {
                    hasVersion = comp.compare(state.httpdVersion, version) >= 0;
                } else if ("<".equals(operator)) {
                    hasVersion = comp.compare(state.httpdVersion, version) < 0;
                } else if ("<=".equals(operator)) {
                    hasVersion = comp.compare(state.httpdVersion, version) <= 0;
                } else {
                    LOG.warn("Unknown operator " + operator + " in an IfVersion directive.");
                    return null;
                }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.