本文整理匯總了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;
}