本文整理汇总了Java中org.apache.zeppelin.helium.HeliumPackage.fromJson方法的典型用法代码示例。如果您正苦于以下问题:Java HeliumPackage.fromJson方法的具体用法?Java HeliumPackage.fromJson怎么用?Java HeliumPackage.fromJson使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.zeppelin.helium.HeliumPackage
的用法示例。
在下文中一共展示了HeliumPackage.fromJson方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: load
import org.apache.zeppelin.helium.HeliumPackage; //导入方法依赖的package包/类
@POST
@Path("load/{noteId}/{paragraphId}")
public Response load(@PathParam("noteId") String noteId,
@PathParam("paragraphId") String paragraphId,
String heliumPackage) {
Note note = notebook.getNote(noteId);
if (note == null) {
return new JsonResponse(Response.Status.NOT_FOUND, "Note " + noteId + " not found").build();
}
Paragraph paragraph = note.getParagraph(paragraphId);
if (paragraph == null) {
return new JsonResponse(Response.Status.NOT_FOUND, "Paragraph " + paragraphId + " not found")
.build();
}
HeliumPackage pkg = HeliumPackage.fromJson(heliumPackage);
try {
return new JsonResponse<>(Response.Status.OK, "",
helium.getApplicationFactory().loadAndRun(pkg, paragraph)).build();
}
catch (RuntimeException e) {
logger.error(e.getMessage(), e);
return new JsonResponse(Response.Status.INTERNAL_SERVER_ERROR, e.getMessage()).build();
}
}
示例2: load
import org.apache.zeppelin.helium.HeliumPackage; //导入方法依赖的package包/类
@POST
@Path("load/{noteId}/{paragraphId}")
public Response load(@PathParam("noteId") String noteId,
@PathParam("paragraphId") String paragraphId,
String heliumPackage) {
Note note = notebook.getNote(noteId);
if (note == null) {
return new JsonResponse(Response.Status.NOT_FOUND, "Note " + noteId + " not found").build();
}
Paragraph paragraph = note.getParagraph(paragraphId);
if (paragraph == null) {
return new JsonResponse(Response.Status.NOT_FOUND, "Paragraph " + paragraphId + " not found")
.build();
}
HeliumPackage pkg = HeliumPackage.fromJson(heliumPackage);
try {
return new JsonResponse<>(Response.Status.OK, "",
helium.getApplicationFactory().loadAndRun(pkg, paragraph)).build();
} catch (RuntimeException e) {
logger.error(e.getMessage(), e);
return new JsonResponse(Response.Status.INTERNAL_SERVER_ERROR, e.getMessage()).build();
}
}
示例3: loadApplication
import org.apache.zeppelin.helium.HeliumPackage; //导入方法依赖的package包/类
@Override
public RemoteApplicationResult loadApplication(
String applicationInstanceId, String packageInfo, String noteId, String paragraphId)
throws TException {
if (runningApplications.containsKey(applicationInstanceId)) {
logger.warn("Application instance {} is already running");
return new RemoteApplicationResult(true, "");
}
HeliumPackage pkgInfo = HeliumPackage.fromJson(packageInfo);
ApplicationContext context = getApplicationContext(
pkgInfo, noteId, paragraphId, applicationInstanceId);
try {
Application app = null;
logger.info(
"Loading application {}({}), artifact={}, className={} into note={}, paragraph={}",
pkgInfo.getName(),
applicationInstanceId,
pkgInfo.getArtifact(),
pkgInfo.getClassName(),
noteId,
paragraphId);
app = appLoader.load(pkgInfo, context);
runningApplications.put(
applicationInstanceId,
new RunningApplication(pkgInfo, app, noteId, paragraphId));
return new RemoteApplicationResult(true, "");
} catch (Exception e) {
logger.error(e.getMessage(), e);
return new RemoteApplicationResult(false, e.getMessage());
}
}