Package net.bluemind.node.api
Class LocalNodeClient
java.lang.Object
net.bluemind.node.api.LocalNodeClient
- All Implemented Interfaces:
INodeClient
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
asyncExecute
(ExecRequest req, ProcessHandler ph) void
deleteFile
(String path) Delete a fileexecuteCommand
(List<String> argv) Starts a command in backend and returns a ref to track its progress.Runs a command.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.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.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.bluemind.node.api.INodeClient
executeCommand, executeCommandNoOut, mkdirs, mkdirs
-
Constructor Details
-
LocalNodeClient
public LocalNodeClient()
-
-
Method Details
-
ping
Description copied from interface:INodeClient
Checks we can connect to a node.- Specified by:
ping
in interfaceINodeClient
- Throws:
ServerFault
- if the connection does not work
-
read
Description copied from interface:INodeClient
Fetches a file content into ram. If the file does not exist, a zero-length byte array is returned.- Specified by:
read
in interfaceINodeClient
- Parameters:
path
-- Returns:
- Throws:
ServerFault
-
exists
Description copied from interface:INodeClient
Check if path exists- Specified by:
exists
in interfaceINodeClient
- Parameters:
path
-- Returns:
-
openStream
Description copied from interface:INodeClient
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.- Specified by:
openStream
in interfaceINodeClient
- Parameters:
path
-- Returns:
- Throws:
ServerFault
-
writeFile
Description copied from interface:INodeClient
(Over)writes the file at path with content. Content is closed by this method. You don't need to do it in your code.- Specified by:
writeFile
in interfaceINodeClient
- Parameters:
path
-content
-- Throws:
ServerFault
-
executeCommand
Description copied from interface:INodeClient
Starts a command in backend and returns a ref to track its progress. Task return a String list as output.- Specified by:
executeCommand
in interfaceINodeClient
- Returns:
- Throws:
ServerFault
-
executeCommandNoOut
Description copied from interface:INodeClient
Starts a command in backend and returns a ref to track its progress No output, receive "Done" when command finish.- Specified by:
executeCommandNoOut
in interfaceINodeClient
- Returns:
- Throws:
ServerFault
-
getExecutionStatus
Description copied from interface:INodeClient
Tracks the progress of a task- Specified by:
getExecutionStatus
in interfaceINodeClient
- Parameters:
task
-- Returns:
- Throws:
ServerFault
-
listFiles
Description copied from interface:INodeClient
List files from path matching extension. Task return a list of FileDescription as output- Specified by:
listFiles
in interfaceINodeClient
- Parameters:
path
-extensionPattern
-- Returns:
- empty list when the path does not exist
- Throws:
ServerFault
-
listFiles
Description copied from interface:INodeClient
List files from path. Task return a FileDescription list as output.- Specified by:
listFiles
in interfaceINodeClient
- Parameters:
path
-- Returns:
- empty list when the path does not exist
- Throws:
ServerFault
-
deleteFile
Description copied from interface:INodeClient
Delete a file- Specified by:
deleteFile
in interfaceINodeClient
- Parameters:
path
-- Throws:
ServerFault
-
moveFile
Description copied from interface:INodeClient
Moves a file from a path, to another- Specified by:
moveFile
in interfaceINodeClient
- Parameters:
origin
- : Original pathdestination
- : Destination path
-
mkdirs
Description copied from interface:INodeClient
Create a directory and all required parents- Specified by:
mkdirs
in interfaceINodeClient
- Parameters:
dst
- : directory to createpermissions
- : "java" permissions, like: "rwxrwx---", or "rw--------"- Throws:
ServerFault
-