Package org.apache.maven.artifact.versioning

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


            File localPluginFile = new File(deploymentInfo.url.toURI());

            String pluginName = pluginDescriptor.getName();
            String displayName = pluginDescriptor.getDisplayName();
            String pluginNameDisplayName = pluginName + " (" + displayName + ")";
            ComparableVersion comparableVersion = this.pluginVersions.get(pluginName);
            String version = (comparableVersion != null) ? comparableVersion.toString() : null;
            log.debug("Registering RHQ plugin " + pluginNameDisplayName + ", "
                + ((version != null) ? "version " + version : "undefined version") + "...");
            checkVersionCompatibility(pluginDescriptor.getAmpsVersion());

            String filename = getPluginJarFilename(deploymentInfo); // make sure this is only the filename
View Full Code Here


    private String getAmpsVersion(PluginDescriptor pluginDescriptor) {
        if (pluginDescriptor.getAmpsVersion() == null) {
            return "2.0";
        }

        ComparableVersion version = new ComparableVersion(pluginDescriptor.getAmpsVersion());
        ComparableVersion version2 = new ComparableVersion("2.0");

        if (version.compareTo(version2) <= 0) {
            return "2.0";
        }
View Full Code Here

            descriptor = this.serverPluginsOnFilesystem.get(pluginFile).descriptor;

            String pluginName = descriptor.getName();
            String displayName = descriptor.getDisplayName();

            ComparableVersion version; // this must be non-null, the next line ensures this
            version = ServerPluginDescriptorUtil.getPluginVersion(pluginFile, descriptor);

            log.debug("Registering server plugin [" + pluginName + "], version " + version);

            ServerPlugin plugin = new ServerPlugin(pluginName, pluginFile.getName());
            plugin.setDisplayName((displayName != null) ? displayName : pluginName);
            plugin.setEnabled(!descriptor.isDisabledOnDiscovery());
            plugin.setDescription(descriptor.getDescription());
            plugin.setMtime(pluginFile.lastModified());
            plugin.setVersion(version.toString());
            plugin.setAmpsVersion(descriptor.getApiVersion());
            plugin.setMD5(MessageDigestGenerator.getDigestString(pluginFile));
            plugin.setPluginConfiguration(getDefaultPluginConfiguration(descriptor));
            plugin.setScheduledJobsConfiguration(getDefaultScheduledJobsConfiguration(descriptor));
            plugin.setType(new ServerPluginType(descriptor).stringify());
View Full Code Here

            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

TOP

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

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.