Package net.bluemind.node.api
Interface INodeClient
- All Known Implementing Classes:
LocalNodeClient
public interface INodeClient
local or remote BM
manipulation API.
invalid reference
Host
-
Method Summary
Modifier and TypeMethodDescriptionvoid
asyncExecute
(ExecRequest req, ProcessHandler ph) void
deleteFile
(String path) Delete a filedefault TaskRef
executeCommand
(String... argv) executeCommand
(List<String> argv) Starts a command in backend and returns a ref to track its progress.Runs a command.default TaskRef
executeCommandNoOut
(String... argv) executeCommandNoOut
(List<String> argv) Starts a command in backend and returns a ref to track its progress No output, receive "Done" when command finish.boolean
Check if path existsReturns a list of running process matching the given query object.getExecutionStatus
(TaskRef task) Tracks the progress of a taskvoid
interrupt
(ExecDescriptor runningTask) List files from path.List files from path matching extension.default void
default void
void
Create a directory and all required parentsvoid
Moves a file from a path, to anotheropenStream
(String path) Opens a stream to a (maybe) remote file.void
ping()
Checks we can connect to a node.byte[]
Fetches a file content into ram.void
writeFile
(String path, InputStream content) (Over)writes the file at path with content.
-
Method Details
-
ping
Checks we can connect to a node.- Throws:
ServerFault
- if the connection does not work
-
read
Fetches a file content into ram. If the file does not exist, a zero-length byte array is returned.- Parameters:
path
-- Returns:
- Throws:
ServerFault
-
exists
Check if path exists- Parameters:
path
-- Returns:
-
openStream
Opens a stream to a (maybe) remote file. Use this one when you can't predict the size of the file you want to read. WARNING: If you forget to close this stream, your BM Core will die from out of memory, too many open files, etc sooner or later.- Parameters:
path
-- Returns:
- Throws:
ServerFault
-
writeFile
(Over)writes the file at path with content. Content is closed by this method. You don't need to do it in your code.- Parameters:
path
-content
-- Throws:
ServerFault
-
executeCommand
Starts a command in backend and returns a ref to track its progress. Task return a String list as output.- Parameters:
cmd
-- Returns:
- Throws:
ServerFault
-
executeCommand
- Throws:
ServerFault
-
executeCommandNoOut
Starts a command in backend and returns a ref to track its progress No output, receive "Done" when command finish.- Parameters:
cmd
-- Returns:
- Throws:
ServerFault
-
executeCommandNoOut
- Throws:
ServerFault
-
getExecutionStatus
Tracks the progress of a task- Parameters:
task
-- Returns:
- Throws:
ServerFault
-
listFiles
List files from path matching extension. Task return a list of FileDescription as output- Parameters:
path
-extensionPattern
-- Returns:
- empty list when the path does not exist
- Throws:
ServerFault
-
listFiles
List files from path. Task return a FileDescription list as output.- Parameters:
path
-extensionPattern
-- Returns:
- empty list when the path does not exist
- Throws:
ServerFault
-
deleteFile
Delete a file- Parameters:
path
-- Throws:
ServerFault
-
moveFile
Moves a file from a path, to another- Parameters:
origin
- : Original pathdestination
- : Destination path- Throws:
ServerFault
-
mkdirs
Create a directory and all required parents- Parameters:
dst
- : directory to createpermissions
- : "java" permissions, like: "rwxrwx---", or "rw--------"- Throws:
ServerFault
-
mkdirs
- Throws:
ServerFault
-
mkdirs
- Throws:
ServerFault
-