|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectch.systemsx.cisd.openbis.dss.client.api.v1.impl.DssComponent
public class DssComponent
Implementation of the IDssComponent interface. It is a facade for interacting with openBIS and multiple DSS servers.
The DssComponent manages a connection to openBIS (IETLLIMSService) as well as connections to data store servers (IDssServiceRpc) to present a simplified interface to downloading datasets.
Constructor Summary | |
---|---|
DssComponent(IGeneralInformationService service,
IRpcServiceFactory dssServiceFactory,
java.lang.String sessionTokenOrNull)
Constructor for clients that already have an IETLLIMSService; also used for testing. |
Method Summary | |
---|---|
void |
checkSession()
Checks whether the session is alive. |
boolean |
deleteSessionWorkspaceFile(java.lang.String path)
Delete a file or directory in the session workspace. |
java.util.Map<java.lang.String,java.lang.String> |
extractMetadata(NewDataSetDTO newDataset,
java.io.File dataSetFile)
Tries to extract the data set property key-values (metadata) from the data. |
IDataSetDss |
getDataSet(java.lang.String code)
Get a proxy to the data set designated by the given data set code. |
java.io.InputStream |
getFileFromSessionWorkspace(java.lang.String filePath)
Downloads a file from the session workspace. |
void |
getFileFromSessionWorkspace(java.lang.String filePath,
java.io.File localFile)
Downloads a file from the session workspace. |
java.lang.String |
getSessionToken()
Returns the session token. |
void |
logout()
Logs the current user out. |
IDataSetDss |
putDataSet(NewDataSetDTO newDataset,
java.io.File dataSetFile)
Upload a new data set to the DSS. |
void |
putFileToSessionWorkspace(java.lang.String directory,
java.io.File file)
Uploads a file to the session workspace. |
void |
putFileToSessionWorkspace(java.lang.String filePath,
java.io.InputStream inputStream)
Uploads a file to the session workspace. |
static DssComponent |
tryCreate(java.lang.String sessionToken,
java.lang.String openBISUrl,
long timeoutInMillis)
Public factory method for creating a DssComponent for a user that has already been authenticated. |
static DssComponent |
tryCreate(java.lang.String user,
java.lang.String password,
java.lang.String openBISUrl,
long timeoutInMillis)
Public factory method for creating a DssComponent with a username and password. |
java.util.List<ValidationError> |
validateDataSet(NewDataSetDTO newDataset,
java.io.File dataSetFile)
Validate a data set. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DssComponent(IGeneralInformationService service, IRpcServiceFactory dssServiceFactory, java.lang.String sessionTokenOrNull)
service
- A proxy to the openBIS application server.dssServiceFactory
- A proxy to the DSS server.sessionTokenOrNull
- A session token, if the user has already logged in, or null
otherwise.Method Detail |
---|
public static DssComponent tryCreate(java.lang.String user, java.lang.String password, java.lang.String openBISUrl, long timeoutInMillis)
user
- The user namepassword
- The user's passwordopenBISUrl
- The URL to openBIStimeoutInMillis
- network timeout when connecting to remote servicespublic static DssComponent tryCreate(java.lang.String sessionToken, java.lang.String openBISUrl, long timeoutInMillis)
sessionToken
- The session token provided by authenticationopenBISUrl
- The URL to openBIStimeoutInMillis
- network timeout when connecting to remote servicespublic java.lang.String getSessionToken()
IDssComponent
getSessionToken
in interface IDssComponent
public void checkSession() throws InvalidSessionException
IDssComponent
checkSession
in interface IDssComponent
InvalidSessionException
- If the session is not alive.public IDataSetDss getDataSet(java.lang.String code) throws EnvironmentFailureException, java.lang.IllegalStateException
IDssComponent
getDataSet
in interface IDssComponent
EnvironmentFailureException
- Thrown in cases where it is not possible to connect to
the server.
java.lang.IllegalStateException
- Thrown if the user has not yet been authenticated.public void logout()
IDssComponent
logout
in interface IDssComponent
public IDataSetDss putDataSet(NewDataSetDTO newDataset, java.io.File dataSetFile) throws java.lang.IllegalStateException, EnvironmentFailureException
IDssComponent
putDataSet
in interface IDssComponent
newDataset
- The new data set that should be registereddataSetFile
- A file or folder containing the data
java.lang.IllegalStateException
- Thrown if the user has not yet been authenticated.
EnvironmentFailureException
- Thrown in cases where it is not possible to connect to
the server.public void putFileToSessionWorkspace(java.lang.String filePath, java.io.InputStream inputStream) throws ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked
IDssComponent
putFileToSessionWorkspace
in interface IDssComponent
filePath
- The path (directory and name) of the file to upload.inputStream
- The content of the file to upload.
ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked
- If the file transfer fails.public void putFileToSessionWorkspace(java.lang.String directory, java.io.File file) throws ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked
IDssComponent
putFileToSessionWorkspace
in interface IDssComponent
directory
- The directory in the session workspace where the file should be uploaded.file
- The file to upload.
ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked
- If the file cannot be written.public java.io.InputStream getFileFromSessionWorkspace(java.lang.String filePath) throws ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked
IDssComponent
getFileFromSessionWorkspace
in interface IDssComponent
filePath
- The path (directory and name) of the file to download.
ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked
- If the file does not exist, is a directory or cannot be opened.public void getFileFromSessionWorkspace(java.lang.String filePath, java.io.File localFile) throws ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked
IDssComponent
getFileFromSessionWorkspace
in interface IDssComponent
filePath
- The path (directory and name) of the file to download.localFile
- The local file to write the file from the session workspace to.
ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked
- If the file does not exist.public boolean deleteSessionWorkspaceFile(java.lang.String path)
IDssComponent
deleteSessionWorkspaceFile
in interface IDssComponent
true
if the path doesn't exist anymore.public java.util.List<ValidationError> validateDataSet(NewDataSetDTO newDataset, java.io.File dataSetFile) throws java.lang.IllegalStateException, EnvironmentFailureException
IDssComponent
validateDataSet
in interface IDssComponent
newDataset
- The new data set that should be registereddataSetFile
- A file or folder containing the data
java.lang.IllegalStateException
- Thrown if the user has not yet been authenticated.
EnvironmentFailureException
- Thrown in cases where it is not possible to connect to
the server.public java.util.Map<java.lang.String,java.lang.String> extractMetadata(NewDataSetDTO newDataset, java.io.File dataSetFile) throws java.lang.IllegalStateException, EnvironmentFailureException
IDssComponent
extractMetadata
in interface IDssComponent
newDataset
- The new data set that should be registereddataSetFile
- A file or folder containing the data
java.lang.IllegalStateException
- Thrown if the user has not yet been authenticated.
EnvironmentFailureException
- Thrown in cases where it is not possible to connect to
the server.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |