Search in sources :

Example 1 with AddMvnCommandResult

use of com.twosigma.beakerx.kernel.magic.command.MavenJarResolver.AddMvnCommandResult in project beakerx by twosigma.

the class ClasspathAddMvnMagicCommand method execute.

@Override
public MagicCommandOutcomeItem execute(MagicCommandExecutionParam param) {
    String command = param.getCommand();
    String[] split = MagicCommandUtils.splitPath(command);
    if (!(isGradleFormat(split) || isMavenFormat(split))) {
        return new MagicCommandOutput(MagicCommandOutput.Status.ERROR, ADD_MVN_FORMAT_ERROR_MESSAGE);
    }
    commandParams.setRepos(getRepos().get());
    MavenJarResolver classpathAddMvnCommand = new MavenJarResolver(commandParams, pomFactory);
    MvnLoggerWidget progress = new MvnLoggerWidget(param.getCode().getMessage());
    AddMvnCommandResult result = retrieve(getDependency(split), classpathAddMvnCommand, progress);
    if (result.isJarRetrieved()) {
        return handleAddedJars(classpathAddMvnCommand.getPathToMavenRepo() + "/*");
    }
    return new MagicCommandOutput(MagicCommandOutput.Status.ERROR, result.getErrorMessage());
}
Also used : MagicCommandOutput(com.twosigma.beakerx.kernel.magic.command.outcome.MagicCommandOutput) AddMvnCommandResult(com.twosigma.beakerx.kernel.magic.command.MavenJarResolver.AddMvnCommandResult) MavenJarResolver(com.twosigma.beakerx.kernel.magic.command.MavenJarResolver)

Aggregations

MavenJarResolver (com.twosigma.beakerx.kernel.magic.command.MavenJarResolver)1 AddMvnCommandResult (com.twosigma.beakerx.kernel.magic.command.MavenJarResolver.AddMvnCommandResult)1 MagicCommandOutput (com.twosigma.beakerx.kernel.magic.command.outcome.MagicCommandOutput)1