Package org.apache.maven.artifact.versioning

Examples of org.apache.maven.artifact.versioning.ComparableVersion$Item


            boolean isSupported;

            //if no list of supportedBuilds provident then,
            if (supportedAgentBuilds == null || supportedAgentBuilds.isEmpty()) {
                // we weren't given a regex of supported versions, make a simple string equality test on latest agent version
                ComparableVersion agent = new ComparableVersion(agentVersionInfo.getVersion());
                ComparableVersion server = new ComparableVersion(latestAgentVersion);
                isSupported = agent.equals(server);
            } else {
                // we were given a regex of supported builds, check the agent build to see if it matches the regex
                isSupported = agentVersionInfo.getBuild().matches(supportedAgentBuilds);
            }
View Full Code Here


    private boolean validatePluginVersion(ServerPluginEnvironment env) {
        boolean success = true;

        try {
            File pluginFile = new File(env.getPluginUrl().toURI());
            ComparableVersion version;
            version = ServerPluginDescriptorUtil.getPluginVersion(pluginFile, env.getPluginDescriptor());
            if (version == null) {
                throw new NullPointerException("version is null");
            }
        } catch (Exception e) {
View Full Code Here

    @Override
    public BundleVersion createBundleVersionInternal(Bundle bundle, String name, String version, String description,
        String recipe, ConfigurationDefinition configurationDefinition) throws Exception {
        // ensure we have a version
        version = getVersion(version, bundle);
        ComparableVersion comparableVersion = new ComparableVersion(version);

        Query q = entityManager.createNamedQuery(BundleVersion.QUERY_FIND_VERSION_INFO_BY_BUNDLE_ID);
        q.setParameter("bundleId", bundle.getId());
        @SuppressWarnings("unchecked")
        List<Object[]> list = (List<Object[]>) q.getResultList();
        int versionOrder = list.size();
        boolean needToUpdateOrder = false;
        // find out where in the order of versions this new version should be placed (e.g. 2.0 is after 1.0).
        // the query returns a list of arrays - first element in array is version; second is versionOrder
        // the query returns list in desc order - since the normal case is we are creating the latest, highest version,
        // starting at the current highest version is the most efficient (we'll break the for loop after 1 iteration).
        for (Object[] bv : list) {
            ComparableVersion bvv = new ComparableVersion(bv[0].toString());
            int comparison = comparableVersion.compareTo(bvv);
            if (comparison == 0) {
                throw new RuntimeException("Cannot create bundle with version [" + version + "], it already exists");
            } else if (comparison < 0) {
                versionOrder = ((Number) bv[1]).intValue();
View Full Code Here

        if (plugin1.getMd5().equals(plugin2.getMd5())) {
            return null;
        } else {
            String version1Str = plugin1.getVersion();
            String version2Str = plugin2.getVersion();
            ComparableVersion plugin1Version = new ComparableVersion((version1Str != null) ? version1Str : "0");
            ComparableVersion plugin2Version = new ComparableVersion((version2Str != null) ? version2Str : "0");
            if (plugin1Version.equals(plugin2Version)) {
                if (plugin1.getMtime() == plugin2.getMtime()) {
                    LOG.info("Plugins [" + plugin1 + ", " + plugin2
                        + "] are the same logical plugin but have different content. The plugin [" + plugin1
                        + "] will be considered obsolete.");
View Full Code Here

                + "]. A version must be defined either via the MANIFEST.MF [" + Attributes.Name.IMPLEMENTATION_VERSION
                + "] attribute or via the plugin descriptor 'version' attribute.");
        }

        try {
            return new ComparableVersion(version);
        } catch (RuntimeException e) {
            throw new Exception("Version [" + version + "] for [" + pluginFile + "] did not parse", e);
        }
    }
View Full Code Here

     * This method does not compare build numbers - see {@link #isAgentOutOfDateStrict()} for that.
     *
     * @return <code>true</code> if the agent's version is older than the update's version
     */
    public boolean isAgentOutOfDate() {
        ComparableVersion agent = new ComparableVersion(getAgentVersion());
        ComparableVersion update = new ComparableVersion(getUpdateVersion());
        return agent.compareTo(update) < 0;
    }
View Full Code Here

     * To compare only version strings and ignore build numbers, see {@link #isAgentOutOfDate()}.
     *
     * @return <code>true</code> if the agent's version/build is older than the update's version/build
     */
    public boolean isAgentOutOfDateStrict() {
        ComparableVersion agent = new ComparableVersion(getAgentVersion());
        ComparableVersion update = new ComparableVersion(getUpdateVersion());

        int comparision = agent.compareTo(update);

        if (comparision == 0) {
            // versions are equal, compare build numbers;
View Full Code Here

            logEventSources.add(serverLogEventSource);
        }
    }

    private boolean isSupportedProduct(JBossInstallationInfo installInfo) {
        ComparableVersion version = new ComparableVersion(installInfo.getVersion());
        JBossProductType productType = installInfo.getProductType();
        ComparableVersion minimumVersion = MINIMUM_PRODUCT_VERSIONS.get(productType);
        boolean supported;
        if (minimumVersion != null) {
            // The product is supported if the version is greater than or equal to the minimum version.
            supported = (version.compareTo(minimumVersion) >= 0);
            if (!supported) {
View Full Code Here

            }
            if (clientVersionString == null) {
                clientVersionString = " undefined ";
            }
            serverVersionString = this.serverInfo.getVersion();
            ComparableVersion clientVersion = new ComparableVersion(clientVersionString);
            ComparableVersion serverVersion = new ComparableVersion(serverVersionString);
            int laterVersionCheck = clientVersion.compareTo(serverVersion);
            if (laterVersionCheck >= 0) {
                supported = true; //Ex. 3.2.0.GA-redhat-N represent supported non-breaking api patches/changes.
            } else {
                supported = false;
View Full Code Here

        }
        return spaceIndex;
    }

    private static String getDefaultServerName(String serverVersion) {
        ComparableVersion comparableVersion = new ComparableVersion(serverVersion);
        return (comparableVersion.compareTo(VERSION_4_2) >= 0) ? LOCALHOST_ADDRESS : ANY_ADDRESS;
    }
View Full Code Here

TOP

Related Classes of org.apache.maven.artifact.versioning.ComparableVersion$Item

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.