Package net.bluemind.node.api
Class LocalNodeClient
java.lang.Object
net.bluemind.node.api.LocalNodeClient
- All Implemented Interfaces:
INodeClient
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidasyncExecute(ExecRequest req, ProcessHandler ph) voiddeleteFile(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.booleanCheck if path existsReturns a list of running process matching the given query object.getExecutionStatus(TaskRef task) Tracks the progress of a taskvoidinterrupt(ExecDescriptor runningTask) List files from path.List files from path matching extension.voidCreate a directory and all required parentsvoidMoves a file from a path, to anotheropenStream(String path) Opens a stream to a (maybe) remote file.voidping()Checks we can connect to a node.byte[]Fetches a file content into ram.voidwriteFile(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, waitMethods inherited from interface net.bluemind.node.api.INodeClient
executeCommand, executeCommandNoOut, mkdirs, mkdirs
-
Constructor Details
-
LocalNodeClient
public LocalNodeClient()
-
-
Method Details
-
ping
Description copied from interface:INodeClientChecks we can connect to a node.- Specified by:
pingin interfaceINodeClient- Throws:
ServerFault- if the connection does not work
-
read
Description copied from interface:INodeClientFetches a file content into ram. If the file does not exist, a zero-length byte array is returned.- Specified by:
readin interfaceINodeClient- Parameters:
path-- Returns:
- Throws:
ServerFault
-
exists
Description copied from interface:INodeClientCheck if path exists- Specified by:
existsin interfaceINodeClient- Parameters:
path-- Returns:
-
openStream
Description copied from interface:INodeClientOpens 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:
openStreamin 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:
writeFilein interfaceINodeClient- Parameters:
path-content-- Throws:
ServerFault
-
executeCommand
Description copied from interface:INodeClientStarts a command in backend and returns a ref to track its progress. Task return a String list as output.- Specified by:
executeCommandin interfaceINodeClient- Returns:
- Throws:
ServerFault
-
executeCommandNoOut
Description copied from interface:INodeClientStarts a command in backend and returns a ref to track its progress No output, receive "Done" when command finish.- Specified by:
executeCommandNoOutin interfaceINodeClient- Returns:
- Throws:
ServerFault
-
getExecutionStatus
Description copied from interface:INodeClientTracks the progress of a task- Specified by:
getExecutionStatusin interfaceINodeClient- Parameters:
task-- Returns:
- Throws:
ServerFault
-
listFiles
Description copied from interface:INodeClientList files from path matching extension. Task return a list of FileDescription as output- Specified by:
listFilesin interfaceINodeClient- Parameters:
path-extensionPattern-- Returns:
- empty list when the path does not exist
- Throws:
ServerFault
-
listFiles
Description copied from interface:INodeClientList files from path. Task return a FileDescription list as output.- Specified by:
listFilesin interfaceINodeClient- Parameters:
path-- Returns:
- empty list when the path does not exist
- Throws:
ServerFault
-
deleteFile
Description copied from interface:INodeClientDelete a file- Specified by:
deleteFilein interfaceINodeClient- Parameters:
path-- Throws:
ServerFault
-
moveFile
Description copied from interface:INodeClientMoves a file from a path, to another- Specified by:
moveFilein interfaceINodeClient- Parameters:
origin- : Original pathdestination- : Destination path
-
mkdirs
Description copied from interface:INodeClientCreate a directory and all required parents- Specified by:
mkdirsin interfaceINodeClient- Parameters:
dst- : directory to createpermissions- : "java" permissions, like: "rwxrwx---", or "rw--------"- Throws:
ServerFault
-