use of com.twosigma.beakerx.kernel.AddImportStatus in project beakerx by twosigma.
the class AddImportMagicCommand method execute.
@Override
public MagicCommandOutcomeItem execute(MagicCommandExecutionParam param) {
String command = param.getCommand();
String[] parts = MagicCommandUtils.splitPath(command);
if (parts.length != 2) {
return new MagicCommandOutput(ERROR, WRONG_FORMAT_MSG + IMPORT);
}
ImportPath anImport = new ImportPath(parts[1]);
AddImportStatus status = this.kernel.addImport(anImport);
if (AddImportStatus.ERROR.equals(status)) {
return new MagicCommandOutput(ERROR, "Could not import " + parts[1]);
}
return new MagicCommandOutput(OK);
}
use of com.twosigma.beakerx.kernel.AddImportStatus in project beakerx by twosigma.
the class AddStaticImportMagicCommand method execute.
@Override
public MagicCommandOutcomeItem execute(MagicCommandExecutionParam param) {
String command = param.getCommand();
String[] parts = MagicCommandUtils.splitPath(command);
if (parts.length != 3) {
return new MagicCommandOutput(MagicCommandOutput.Status.ERROR, WRONG_FORMAT_MSG);
}
AddImportStatus status = this.kernel.addImport(new ImportPath(parts[1] + " " + parts[2]));
if (AddImportStatus.ERROR.equals(status)) {
return new MagicCommandOutput(ERROR, "Could not import static " + parts[2]);
}
return new MagicCommandOutput(MagicCommandOutput.Status.OK);
}
Aggregations