@PublicAPI public class DataSpaceNodeClient extends Object implements RemoteSpace, Serializable
Constructor and Description |
---|
DataSpaceNodeClient(SchedulerNodeClient schedulerNodeClient,
IDataSpaceClient.Dataspace space,
String schedulerRestUrl) |
Modifier and Type | Method and Description |
---|---|
void |
connect()
Connects to the dataspace at the default schedulerRestUrl, using the current user credentials
|
void |
connect(String url)
Connects to the server at the specified schedulerRestUrl, using the current user credentials
|
void |
deleteFile(String remotePath)
Delete the given file or folder(including its content) inside the remote space
|
void |
deleteFiles(String remotePath,
String pattern)
Delete the remote files described by the given pattern
The following special characters can be used inside the pattern :
** matches zero or more directories * matches zero or more characters ? matches one character |
void |
disconnect()
Disconnect from the server
|
ConnectionInfo |
getConnectionInfo()
Returns the connection info, if initialized previously
|
InputStream |
getInputStream(String remotePath)
Returns an input stream on the specified remote file.
|
OutputStream |
getOutputStream(String remotePath)
Returns an output stream on the specified remote file.
|
String |
getSession()
Retrieves the current session identifier, or null if the session was not initialized yet.
|
List<String> |
getSpaceURLs()
Returns the URLs of the RemoteSpace
|
boolean |
isConnected()
Check connection with the server
return true if the current session is connected, false otherwise
|
List<String> |
listFiles(String remotePath,
String pattern)
List the content of the given remote directory, using a glob pattern
|
File |
pullFile(String remotePath,
File localPath)
Pull the given file or folder(including its content) from the remote space to the local space
|
Set<File> |
pullFiles(String remotePath,
String pattern,
File localPath)
Pull the remote files described by the given pattern to the local space
The following special characters can be used inside the pattern :
** matches zero or more directories * matches zero or more characters ? matches one character |
void |
pushFile(File localPath,
String remotePath)
Push the given file or directory(including its content) from the local space to the remote space.
|
void |
pushFiles(File localDirectory,
String pattern,
String remotePath)
Push the local files described by the given pattern to the remote space
The following special characters can be used inside the pattern :
** matches zero or more directories * matches zero or more characters ? matches one character |
void |
renewSession()
To renew the current server session.
|
void |
setSession(String sid)
Sets the session identifier explicitly.
|
public DataSpaceNodeClient(SchedulerNodeClient schedulerNodeClient, IDataSpaceClient.Dataspace space, String schedulerRestUrl)
public void connect() throws Exception
Exception
- if any error occurs during the connection.public void connect(String url) throws Exception
url
- schedulerRestUrl of the schedulerException
- if any error occurs during the connectionpublic void disconnect() throws NotConnectedException, PermissionException
NotConnectedException
- if the current session is not connectedPermissionException
- in case of permission issuepublic boolean isConnected()
public ConnectionInfo getConnectionInfo()
public void setSession(String sid)
sid
- session identifierpublic String getSession()
public void renewSession()
public List<String> listFiles(String remotePath, String pattern) throws FileSystemException
RemoteSpace
The following special characters can be used inside the pattern :
** matches zero or more directories
* matches zero or more characters
? matches one character
listFiles
in interface RemoteSpace
remotePath
- path in the RemoteSpace where files should be listed. Use "." for remote root path.pattern
- pattern to locate filesFileSystemException
public void pushFile(File localPath, String remotePath) throws FileSystemException
RemoteSpace
pushFile
in interface RemoteSpace
localPath
- path to the local file or directoryremotePath
- path in the RemoteSpace where to put the file or folder. Use "." for remote root path.FileSystemException
public void pushFiles(File localDirectory, String pattern, String remotePath) throws FileSystemException
RemoteSpace
pushFiles
in interface RemoteSpace
localDirectory
- local directory used as basepattern
- pattern to locate files inside the localDirectoryremotePath
- path in the RemoteSpace where to put the files. Use "." for remote root path.FileSystemException
public File pullFile(String remotePath, File localPath) throws FileSystemException
RemoteSpace
pullFile
in interface RemoteSpace
remotePath
- path to the remote file (relative to the RemoteSpace root)localPath
- path in the local file system where to put the file or folderFileSystemException
public Set<File> pullFiles(String remotePath, String pattern, File localPath) throws FileSystemException
RemoteSpace
pullFiles
in interface RemoteSpace
remotePath
- path in the RemoteSpace used as base for the pattern (e.g. "/")pattern
- pattern to locate files inside the RemoteSpacelocalPath
- path in the local file system where to put the filesFileSystemException
public void deleteFile(String remotePath) throws FileSystemException
RemoteSpace
deleteFile
in interface RemoteSpace
remotePath
- path to the remote file (relative to the RemoteSpace root) to deleteFileSystemException
public void deleteFiles(String remotePath, String pattern) throws FileSystemException
RemoteSpace
deleteFiles
in interface RemoteSpace
remotePath
- path in the RemoteSpace used as base for the pattern (e.g. "/")pattern
- pattern to locate files inside the RemoteSpaceFileSystemException
public List<String> getSpaceURLs() throws NotConnectedException, PermissionException, FileSystemException
RemoteSpace
getSpaceURLs
in interface RemoteSpace
NotConnectedException
PermissionException
FileSystemException
public InputStream getInputStream(String remotePath) throws FileSystemException
RemoteSpace
getInputStream
in interface RemoteSpace
remotePath
- path to the remote fileFileSystemException
public OutputStream getOutputStream(String remotePath) throws FileSystemException
RemoteSpace
getOutputStream
in interface RemoteSpace
remotePath
- path to the remote fileFileSystemException