本文整理汇总了Java中org.apache.zeppelin.notebook.NotebookImportDeserializer类的典型用法代码示例。如果您正苦于以下问题:Java NotebookImportDeserializer类的具体用法?Java NotebookImportDeserializer怎么用?Java NotebookImportDeserializer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
NotebookImportDeserializer类属于org.apache.zeppelin.notebook包,在下文中一共展示了NotebookImportDeserializer类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getNote
import org.apache.zeppelin.notebook.NotebookImportDeserializer; //导入依赖的package包/类
private Note getNote(Path noteDir, DistributedFileSystemOps dfs) throws
IOException {
if (!dfs.getFilesystem().isDirectory(noteDir)) {
throw new IOException(noteDir.toString() + " is not a directory");
}
Path noteJson = new Path(noteDir, "note.json");
if (!dfs.getFilesystem().exists(noteJson)) {
throw new IOException(noteJson.toString() + " not found");
}
GsonBuilder gsonBuilder = new GsonBuilder();
gsonBuilder.setPrettyPrinting();
Gson gson = gsonBuilder.registerTypeAdapter(Date.class,
new NotebookImportDeserializer())
.create();
InputStream ins = dfs.open(noteJson);
String json = IOUtils.toString(ins, conf.getString(
ZeppelinConfiguration.ConfVars.ZEPPELIN_ENCODING));
ins.close();
Note note = gson.fromJson(json, Note.class);
for (Paragraph p : note.getParagraphs()) {
if (p.getStatus() == Job.Status.PENDING || p.getStatus()
== Job.Status.RUNNING) {
p.setStatus(Job.Status.ABORT);
}
}
return note;
}