@Deprecated
public abstract class MojoReaderBackend
extends java.lang.Object
implements java.io.Closeable
Interface representing a class capable of reading mojos. Usually the class implementing this interface will have a constructor taking an “address” of the mojo file that should be read. The class would then have to implement the logic for reading the referred mojo from the source.
For example, a hypothetical MysqlMojoReaderBackend may have a constructor taking the URL of the server, connection credentials, and a SQL query for retrieving the mojo record. The class would then implement the logic for connecting to the database and fetching the mojo (whole or in parts). It would also throw an IOException if anything fails.
The actual interface that the class needs to implement is for reading either text or binary fragments from within the mojo. This is because a .mojo file is actually a zip archive, and hence it contains several “files” inside. The user may decide to repackage the mojo contents into a different container: a plain directory for easier access, a .7z file for better compression, an encrypted Zip file for better security, etc. If the reader doesn’t wish to re-package the mojo contents and only retrieve it from non-filesystem source, then it may create a temporary .mojo file and pass it to the MojofileMojoReaderBackend reader.
| Modifier and Type | Field and Description |
|---|---|
protected ai.h2o.mojos.runtime.api.backend.ReaderBackend |
backend
Deprecated.
|
static java.lang.String |
DEFAULT_BASE_DIR
Deprecated.
Default top-level directory, where mojo content is stored.
|
static java.lang.String |
DEFAULT_PROTO_PIPELINE_FILE_PATH
Deprecated.
Default file path for proto-based pipeline
|
static java.lang.String |
DEFAULT_PROTO_PIPELINE_FILENAME
Deprecated.
|
static java.lang.String |
DEFAULT_TOML_PIPELINE_FILE_PATH
Deprecated.
Default file path for toml-based pipeline
|
static java.lang.String |
DEFAULT_TOML_PIPELINE_FILENAME
Deprecated.
|
| Modifier | Constructor and Description |
|---|---|
protected |
MojoReaderBackend(ai.h2o.mojos.runtime.api.backend.ReaderBackend backend,
java.lang.String baseDir,
java.lang.String ignored,
java.lang.String pipelineFileName)
Deprecated.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Deprecated.
|
static boolean |
endsWithSeparator(java.lang.String path)
Deprecated.
This is very safe way to check if a path ends with separator character, no matter which platform was used to produce the path and which platform we use it on.
|
boolean |
exists(java.lang.String filename)
Deprecated.
|
java.lang.String |
getBaseDir()
Deprecated.
|
byte[] |
getBinaryFile(java.lang.String filename)
Deprecated.
Retrieve binary content inside the mojo, as a
byte[] array. |
java.io.InputStream |
getFile(java.lang.String filename)
Deprecated.
Retrieve content inside the mojo, as a
InputStream. |
java.lang.String |
getPipelineFileName()
Deprecated.
Get pipeline file path relative to baseDir.
|
java.lang.String |
getSeparator()
Deprecated.
use just slash (
/) instead, it is supported on all systems equally well, or use File.separator if that makes you feel better |
java.io.BufferedReader |
getTextFile(java.lang.String filename)
Deprecated.
Retrieve text content inside the mojo, as a
BufferedReader. |
ai.h2o.mojos.runtime.api.backend.ReaderBackend |
internalGetReaderBackend()
Deprecated.
Do not use.
|
public static java.lang.String DEFAULT_BASE_DIR
Default top-level directory, where mojo content is stored.
public static java.lang.String DEFAULT_PROTO_PIPELINE_FILENAME
public static java.lang.String DEFAULT_TOML_PIPELINE_FILENAME
public static java.lang.String DEFAULT_PROTO_PIPELINE_FILE_PATH
Default file path for proto-based pipeline
public static java.lang.String DEFAULT_TOML_PIPELINE_FILE_PATH
Default file path for toml-based pipeline
protected final ai.h2o.mojos.runtime.api.backend.ReaderBackend backend
protected MojoReaderBackend(ai.h2o.mojos.runtime.api.backend.ReaderBackend backend,
java.lang.String baseDir,
java.lang.String ignored,
java.lang.String pipelineFileName)
public final void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseablejava.io.IOExceptionpublic final java.io.InputStream getFile(java.lang.String filename)
throws java.io.IOException
Retrieve content inside the mojo, as a InputStream.
java.io.IOExceptionpublic final java.io.BufferedReader getTextFile(java.lang.String filename)
throws java.io.IOException
Retrieve text content inside the mojo, as a BufferedReader.
java.io.IOExceptionpublic final byte[] getBinaryFile(java.lang.String filename)
throws java.io.IOException
Retrieve binary content inside the mojo, as a byte[] array.
java.io.IOExceptionpublic final boolean exists(java.lang.String filename)
public ai.h2o.mojos.runtime.api.backend.ReaderBackend internalGetReaderBackend()
Do not use. Not useful outside mojo2 project.
Exists only for retaining API compatibility inside mojo2 classes, and will be removed in future versions, without notice, deprecation phase and replacement.
public java.lang.String getPipelineFileName()
Get pipeline file path relative to baseDir.
public java.lang.String getBaseDir()
@Deprecated public java.lang.String getSeparator()
/) instead, it is supported on all systems equally well, or use File.separator if that makes you feel betterpublic static boolean endsWithSeparator(java.lang.String path)
This is very safe way to check if a path ends with separator character, no matter which platform was used to produce the path and which platform we use it on.
path - -