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.WorkspaceData.
 
This is exposed from the deephaven_enterprise.notebook Python module.
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic final classA record class that represents a file or folder.static final classAn exception thrown when a Notebook is not found.
- 
Method SummaryModifier and TypeMethodDescriptionstatic NotebookReaderCreates a notebook reader that takes a static snapshot of notebook state as the basis for its operations.static NotebookReaderFunctions likecreate(Database), except notebook state is live and a callback is executed when notebooks are added or removed.static @NotNull NotebookReader.FileOrFoldergetFileOrFolder(@NotNull Database database, @NotNull String path, boolean usesSlash, @NotNull String suffix) Functions asgetFileOrFolder(Database, String, boolean, String, Table), except without providing workspace data.static @NotNull NotebookReader.FileOrFoldergetFileOrFolder(@NotNull Database database, @NotNull String path, boolean usesSlash, @NotNull String suffix, @Nullable Table workspaceData) Gets a FileOrFolder pointed to by path.Get the available notebook path names.getNotebookPaths(@NotNull String suffix) Functions likegetNotebookPaths(), except notebooks will be filtered by the supplied suffix.static @NotNull StringgetNotebookText(@NotNull Database database, @NotNull String notebookName) Functions asgetNotebookText(Database, String, Table), except without providing workspace data.static @NotNull StringgetNotebookText(@NotNull Database database, @NotNull String notebookName, @Nullable Table workspaceData) Get the text of a notebook at the given path.getNotebookText(@NotNull String notebookName) Get the text of a notebook at the given path.
- 
Method Details- 
createCreates a notebook reader that takes a static snapshot of notebook state as the basis for its operations.- Parameters:
- database- the database object to retrieve tables and the user context from (must be a- DatabaseInternal)
- Returns:
- a new notebook reader
 
- 
createpublic static NotebookReader create(@NotNull @NotNull Database database, @NotNull @NotNull Runnable callback) Functions likecreate(Database), except notebook state is live and a callback is executed when notebooks are added or removed.- Parameters:
- database- the database object to retrieve tables and the user context from (must be a- DatabaseInternal)
- callback- logic to execute upon notebook addition or removal
- Returns:
- a new notebook reader
 
- 
getNotebookPathsGet the available notebook path names.- Returns:
- the available notebook path names, or an empty set if none are available
 
- 
getNotebookPathsFunctions likegetNotebookPaths(), except notebooks will be filtered by the supplied suffix.- Parameters:
- suffix- optional suffix to filter notebook names
- Returns:
- the available notebook path names, or an empty set if none are available
 
- 
getNotebookTextGet the text of a notebook at the given path.- Parameters:
- notebookName- the name of the notebook, starting with "/"
- Returns:
- the text of the notebook, if not found an Exception is thrown
 
- 
getNotebookText@NotNull public static @NotNull String getNotebookText(@NotNull @NotNull Database database, @NotNull @NotNull String notebookName, @Nullable @Nullable Table workspaceData) 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 a- DatabaseInternal)
- notebookName- the name of the notebook, starting with "/"
- workspaceData- optional source of workspace data to base processing on
- Returns:
- the text of the notebook, if not found an Exception is thrown
 
- 
getNotebookText@NotNull public static @NotNull String getNotebookText(@NotNull @NotNull Database database, @NotNull @NotNull String notebookName) Functions asgetNotebookText(Database, String, Table), except without providing workspace data.- Parameters:
- database- the database object to retrieve tables and the user context from (must be a- DatabaseInternal)
- 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 @NotNull NotebookReader.FileOrFolder getFileOrFolder(@NotNull @NotNull Database database, @NotNull @NotNull String path, boolean usesSlash, @NotNull @NotNull String suffix, @Nullable @Nullable Table workspaceData) Gets a FileOrFolder pointed to by path.This is used by the getNotebookText(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 a- DatabaseInternal)
- path- the path to retrieve
- usesSlash- use "/+" for the path separator, otherwises uses "\." for Python imports
- suffix- the optional suffix to append to the last component (e.g., ".py" for an import); or empty if no suffix searching should be performed
- workspaceData- optional source of workspace data to base processing on
- Returns:
- the FileOrFolder that was found at the given path, or an exception is thrown
 
- 
getFileOrFolder@NotNull public static @NotNull NotebookReader.FileOrFolder getFileOrFolder(@NotNull @NotNull Database database, @NotNull @NotNull String path, boolean usesSlash, @NotNull @NotNull String suffix) Functions asgetFileOrFolder(Database, String, boolean, String, Table), except without providing workspace data.- Parameters:
- database- the database object to retrieve tables and the user context from (must be a- DatabaseInternal)
- path- the path to retrieve
- usesSlash- use "/+" for the path separator, otherwises uses "\." for Python imports
- suffix- 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
 
 
-