Search in sources :

Example 1 with LatestVersionNotAvailableException

use of org.jboss.galleon.universe.LatestVersionNotAvailableException in project galleon by wildfly.

the class MavenChannel method getAllBuilds.

@Override
public List<String> getAllBuilds(FeaturePackLocation fpl) throws ProvisioningException {
    final MavenArtifact artifact = new MavenArtifact();
    artifact.setGroupId(producer.getFeaturePackGroupId());
    artifact.setArtifactId(producer.getFeaturePackArtifactId());
    artifact.setExtension(MavenArtifact.EXT_ZIP);
    artifact.setVersionRange(versionRange);
    try {
        return producer.getRepo().getAllVersions(artifact, versionIncludePattern, versionExcludePattern);
    } catch (MavenLatestVersionNotAvailableException e) {
        if (fpl.getFrequency() == null && producer.hasDefaultFrequency()) {
            fpl = new FeaturePackLocation(fpl.getUniverse(), fpl.getProducerName(), fpl.getChannelName(), producer.getDefaultFrequency(), null);
        }
        throw new LatestVersionNotAvailableException(fpl);
    } catch (MavenUniverseException e) {
        throw e;
    }
}
Also used : FeaturePackLocation(org.jboss.galleon.universe.FeaturePackLocation) LatestVersionNotAvailableException(org.jboss.galleon.universe.LatestVersionNotAvailableException)

Example 2 with LatestVersionNotAvailableException

use of org.jboss.galleon.universe.LatestVersionNotAvailableException in project galleon by wildfly.

the class PmSessionCommand method handleCommandExecutionException.

private static Throwable handleCommandExecutionException(Throwable t) {
    if (t instanceof CommandExecutionException) {
        CommandExecutionException cex = (CommandExecutionException) t;
        if (cex.getPmSession() != null) {
            // Handle default and named universes
            if (cex.getCause() instanceof LatestVersionNotAvailableException) {
                LatestVersionNotAvailableException cause = (LatestVersionNotAvailableException) cex.getCause();
                FeaturePackLocation fpl = cex.getPmSession().getExposedLocation(null, cause.getLocation());
                t = new LatestVersionNotAvailableException(fpl);
            }
        }
    }
    return t;
}
Also used : LatestVersionNotAvailableException(org.jboss.galleon.universe.LatestVersionNotAvailableException) FeaturePackLocation(org.jboss.galleon.universe.FeaturePackLocation)

Example 3 with LatestVersionNotAvailableException

use of org.jboss.galleon.universe.LatestVersionNotAvailableException in project galleon by wildfly.

the class MavenChannel method getLatestBuild.

@Override
public String getLatestBuild(FeaturePackLocation fpl) throws ProvisioningException {
    final MavenArtifact artifact = new MavenArtifact();
    artifact.setGroupId(producer.getFeaturePackGroupId());
    artifact.setArtifactId(producer.getFeaturePackArtifactId());
    artifact.setExtension(MavenArtifact.EXT_ZIP);
    artifact.setVersionRange(versionRange);
    try {
        return producer.getRepo().getLatestVersion(artifact, getFrequency(fpl), versionIncludePattern, versionExcludePattern);
    } catch (MavenLatestVersionNotAvailableException e) {
        if (fpl.getFrequency() == null && producer.hasDefaultFrequency()) {
            fpl = new FeaturePackLocation(fpl.getUniverse(), fpl.getProducerName(), fpl.getChannelName(), producer.getDefaultFrequency(), null);
        }
        throw new LatestVersionNotAvailableException(fpl);
    } catch (MavenUniverseException e) {
        throw e;
    }
}
Also used : FeaturePackLocation(org.jboss.galleon.universe.FeaturePackLocation) LatestVersionNotAvailableException(org.jboss.galleon.universe.LatestVersionNotAvailableException)

Example 4 with LatestVersionNotAvailableException

use of org.jboss.galleon.universe.LatestVersionNotAvailableException in project galleon by wildfly.

the class MavenChannel method getLatestBuild.

@Override
public String getLatestBuild(FeaturePackLocation.FPID fpid) throws ProvisioningException {
    final MavenArtifact artifact = new MavenArtifact();
    artifact.setGroupId(producer.getFeaturePackGroupId());
    artifact.setArtifactId(producer.getFeaturePackArtifactId());
    artifact.setExtension(MavenArtifact.EXT_ZIP);
    artifact.setVersionRange(versionRange);
    try {
        return producer.getRepo().getLatestVersion(artifact, null, versionIncludePattern, versionExcludePattern);
    } catch (MavenLatestVersionNotAvailableException e) {
        throw new LatestVersionNotAvailableException(fpid.getLocation());
    } catch (MavenUniverseException e) {
        throw e;
    }
}
Also used : LatestVersionNotAvailableException(org.jboss.galleon.universe.LatestVersionNotAvailableException)

Example 5 with LatestVersionNotAvailableException

use of org.jboss.galleon.universe.LatestVersionNotAvailableException in project galleon by wildfly.

the class CliTestUtils method checkNoVersionAvailable.

public static void checkNoVersionAvailable(CliWrapper cli, FeaturePackLocation toInstall, FeaturePackLocation expected) throws Exception {
    Path dir = cli.newDir("install" + System.currentTimeMillis(), false);
    FeaturePackLocation loc = null;
    try {
        cli.execute("install " + toInstall + " --dir=" + dir.toString());
        throw new Exception("Install should have failed");
    } catch (CommandException ex) {
        if (ex.getCause() instanceof CommandExecutionException) {
            if (ex.getCause().getCause() != null) {
                if (ex.getCause().getCause() instanceof LatestVersionNotAvailableException) {
                    LatestVersionNotAvailableException lex = (LatestVersionNotAvailableException) ex.getCause().getCause();
                    loc = lex.getLocation();
                }
            }
        }
    }
    if (loc == null) {
        throw new Exception("Expected exception not found");
    }
    Assert.assertEquals(loc.toString(), expected, loc);
    Assert.assertFalse(dir.toFile().exists());
}
Also used : Path(java.nio.file.Path) FeaturePackLocation(org.jboss.galleon.universe.FeaturePackLocation) LatestVersionNotAvailableException(org.jboss.galleon.universe.LatestVersionNotAvailableException) CommandException(org.aesh.command.CommandException) LatestVersionNotAvailableException(org.jboss.galleon.universe.LatestVersionNotAvailableException) CommandException(org.aesh.command.CommandException) ProvisioningException(org.jboss.galleon.ProvisioningException)

Aggregations

LatestVersionNotAvailableException (org.jboss.galleon.universe.LatestVersionNotAvailableException)5 FeaturePackLocation (org.jboss.galleon.universe.FeaturePackLocation)4 Path (java.nio.file.Path)1 CommandException (org.aesh.command.CommandException)1 ProvisioningException (org.jboss.galleon.ProvisioningException)1