Class NotebookReader
java.lang.Object
io.deephaven.enterprise.dnd.notebook.NotebookReader
Tools for getting Files and Folders out of the Web IDE notebooks that are stored in DbInternal.WebClientData.
This is exposed from the deephaven_enterprise.notebook Python module.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
A record class that represents a file or folder.static final class
An exception thrown when a Notebook is not found. -
Method Summary
Modifier and TypeMethodDescriptionstatic NotebookReader.FileOrFolder
getFileOrFolder
(Database database, String path, boolean usesSlash, String suffix) Gets a FileOrFolder pointed to by path.static String
getNotebookText
(Database database, String notebookName) Get the text of a notebook at the given path.
-
Method Details
-
getNotebookText
@NotNull public static String getNotebookText(@NotNull Database database, @NotNull String notebookName) Get the text of a notebook at the given path.- Parameters:
database
- the database object to retrieve tables and the user context from (must be aDatabaseInternal
)notebookName
- the name of the notebook, starting with "/"- Returns:
- the text of the notebook, if not found an Exception is thrown
-
getFileOrFolder
@NotNull public static NotebookReader.FileOrFolder getFileOrFolder(@NotNull Database database, @NotNull String path, boolean usesSlash, @NotNull String suffix) Gets a FileOrFolder pointed to by path.This is used by the
getNotebookText(io.deephaven.enterprise.database.Database, java.lang.String)
and Python import machinery. In each case you must begin your path with a separator (e.g. "/bill.py" or ".bill"). The optional suffix is used for the imports to search for folders followed by files along the imported path.- Parameters:
database
- the database object to retrieve tables and the user context from (must be aDatabaseInternal
)path
- the path to retrieveusesSlash
- use "/+" for the path separator, otherwises uses "\." for Python importssuffix
- the optional suffix to append to the last component (e.g., ".py" for an import); or empty if no suffix searching should be performed- Returns:
- the FileOrFolder that was found at the given path, or an exception is thrown
-