Package org.apache.ace.util

Examples of org.apache.ace.util.VersionRange


         * Creates an endpoint filter for an association. If there is a KEY_ASSOCIATION_VERSIONSTATEMENT, a filter
         * will be created that matches exactly the given range.
         */
        if ((properties != null) && properties.containsKey(KEY_ASSOCIATION_VERSIONSTATEMENT)) {
            String versions = properties.get(KEY_ASSOCIATION_VERSIONSTATEMENT);
            VersionRange versionRange = null;
            try {
                versionRange = VersionRange.parse(versions);
            }
            catch (IllegalArgumentException iae) {
                throw new IllegalArgumentException("version " + ((versions != null) ? versions + " " : "(null) ") + "cannot be parsed into a valid version range statement.");
            }

            StringBuilder bundleStatement = new StringBuilder("(&(" + KEY_SYMBOLICNAME + "=" + RepositoryUtil.escapeFilterValue(obj.getAttribute(KEY_SYMBOLICNAME)) + ")");

            bundleStatement.append("(" + KEY_VERSION + ">=" + versionRange.getLow() + ")");
            if (!versionRange.isLowInclusive()) {
                bundleStatement.append("(!(" + KEY_VERSION + "=" + versionRange.getLow() + "))");
            }

            if (versionRange.getHigh() != null) {
                bundleStatement.append("(" + KEY_VERSION + "<=" + versionRange.getHigh() + ")");
                if (!versionRange.isHighInclusive()) {
                    bundleStatement.append("(!(" + KEY_VERSION + "=" + versionRange.getHigh() + "))");
                }
            }

            bundleStatement.append(")");

View Full Code Here

TOP

Related Classes of org.apache.ace.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.