Class DataSetRegistrationTransaction<T extends ch.systemsx.cisd.openbis.dss.generic.shared.dto.DataSetInformation>
- java.lang.Object
-
- ch.systemsx.cisd.etlserver.registrator.api.v1.impl.DataSetRegistrationTransaction<T>
-
- All Implemented Interfaces:
IDataSetRegistrationTransaction
,DataSetRegistrationContext.IHolder
,ch.systemsx.cisd.etlserver.registrator.v1.DataSetStorageAlgorithmRunner.IDataSetInApplicationServerRegistrator<T>
,ch.systemsx.cisd.etlserver.registrator.v1.DataSetStorageAlgorithmRunner.IRollbackDelegate<T>
public class DataSetRegistrationTransaction<T extends ch.systemsx.cisd.openbis.dss.generic.shared.dto.DataSetInformation> extends java.lang.Object implements IDataSetRegistrationTransaction, ch.systemsx.cisd.etlserver.registrator.v1.DataSetStorageAlgorithmRunner.IRollbackDelegate<T>, ch.systemsx.cisd.etlserver.registrator.v1.DataSetStorageAlgorithmRunner.IDataSetInApplicationServerRegistrator<T>, DataSetRegistrationContext.IHolder
The implementation of a transaction. This class is designed to be used in one thread.A transaction tracks commands that are invoked on it so they can be reverted (rolledback) if necessary.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
SUCCESS_MESSAGE
-
Constructor Summary
Constructors Constructor Description DataSetRegistrationTransaction(java.io.File rollBackStackParentFolder, java.io.File workingDirectory, java.io.File stagingDirectory, ch.systemsx.cisd.etlserver.registrator.v1.DataSetRegistrationService<T> registrationService, ch.systemsx.cisd.etlserver.registrator.v1.IDataSetRegistrationDetailsFactory<T> registrationDetailsFactory)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
commit()
Commit the transaction.IDataSet
createNewDataSet()
Create a new data set for registration in openBIS.IDataSet
createNewDataSet(DataSetRegistrationDetails<T> registrationDetails)
IDataSet
createNewDataSet(ch.systemsx.cisd.etlserver.registrator.v1.IDataSetRegistrationDetailsFactory<T> factory, java.lang.String dataSetType)
IDataSet
createNewDataSet(java.lang.String dataSetType)
Create a new data set with the specified code.IDataSet
createNewDataSet(java.lang.String dataSetType, DataSetKind datasetKindOrNull)
IDataSet
createNewDataSet(java.lang.String dataSetType, java.lang.String dataSetCode)
Create a new data set with the specified type and code.IDataSet
createNewDataSet(java.lang.String dataSetType, java.lang.String dataSetCode, DataSetKind datasetKindOrNull)
java.lang.String
createNewDirectory(IDataSet dst, java.lang.String dirName)
Create a new directory and return the path.IExperiment
createNewExperiment(java.lang.String experimentIdentifierString, java.lang.String experimentTypeCode)
Create a new experiment to register with the openBIS AS.java.lang.String
createNewFile(IDataSet dst, java.lang.String fileName)
Create a new empty file and return the path.java.lang.String
createNewFile(IDataSet dst, java.lang.String dstInDataset, java.lang.String fileName)
Create a new empty file and return the path.IMaterial
createNewMaterial(java.lang.String materialCode, java.lang.String materialType)
Create a new material to register with the openBIS AS.IMetaproject
createNewMetaproject(java.lang.String name, java.lang.String description)
Creates the new metaproject for the current user.IMetaproject
createNewMetaproject(java.lang.String name, java.lang.String description, java.lang.String ownerId)
Creates the new metaproject for the specified user.IProject
createNewProject(java.lang.String projectIdentifier)
Create a new project to register with the openBIS AS.ISample
createNewSample(java.lang.String sampleIdentifierString, java.lang.String sampleTypeCode)
Create a new sample to register with the openBIS AS.ISample
createNewSampleWithGeneratedCode(java.lang.String spaceCode, java.lang.String sampleTypeCode)
Create a new sample to register with the openBIS AS.ISpace
createNewSpace(java.lang.String spaceCode, java.lang.String spaceAdminUserIdOrNull)
Create a new space to register with the openBIS AS.IVocabularyTerm
createNewVocabularyTerm()
Creates a new vocabulary term, which has to be assigned to aIVocabulary
.void
deleteFile(java.lang.String src)
ch.systemsx.cisd.openbis.generic.shared.basic.EntityOperationsState
didEntityOperationsSucceeded(ch.systemsx.cisd.openbis.generic.shared.basic.TechId registrationId)
void
didRollbackStorageAlgorithmRunner(ch.systemsx.cisd.etlserver.registrator.v1.DataSetStorageAlgorithmRunner<T> algorithm, java.lang.Throwable ex, ch.systemsx.cisd.etlserver.registrator.v1.IDataSetOnErrorActionDecision.ErrorType errorType)
Delegate method called by theDataSetStorageAlgorithmRunner
.static RollbackStack[]
findRollbackStacks(java.io.File rollBackStackParentFolder)
IAuthorizationService
getAuthorizationService()
net.lemnik.eodsql.DynamicTransactionQuery
getDatabaseQuery(java.lang.String dataSourceName)
Gets a database query object for the data source with the specified name.IDataSetImmutable
getDataSet(java.lang.String dataSetCode)
Get a data set from the openBIS AS.IDataSetUpdatable
getDataSetForUpdate(java.lang.String dataSetCode)
Get a data set from the openBIS AS for the purpose of modifying it.IExperimentImmutable
getExperiment(java.lang.String experimentIdentifierString)
Get an experiment from the openBIS AS.IExperimentUpdatable
getExperimentForUpdate(java.lang.String experimentIdentifierString)
Get an experiment from the openBIS AS for the purpose of modifying it.IExternalDataManagementSystemImmutable
getExternalDataManagementSystem(java.lang.String externalDataManagementSystemCode)
Get an external data management system from the openBIS AS.TopLevelDataSetRegistratorGlobalState
getGlobalState()
java.io.File
getIncoming()
DataSetFile
getIncomingDataSetFile()
IMaterialImmutable
getMaterial(java.lang.String identifier)
Get a material from the openBIS AS.IMaterialImmutable
getMaterial(java.lang.String materialCode, java.lang.String materialType)
Get a material from the openBIS AS.IMaterial
getMaterialForUpdate(java.lang.String identifier)
Get a material from the openBIS AS for the purpose of modifying it.IMaterial
getMaterialForUpdate(java.lang.String materialCode, java.lang.String materialType)
Get a material from the openBIS AS for the purpose of modifying it.IMetaproject
getMetaproject(java.lang.String name)
Only allowed when the user is available.IMetaproject
getMetaproject(java.lang.String name, java.lang.String ownerId)
Only allowed when the user is not available.IProjectImmutable
getProject(java.lang.String projectIdentifierString)
Get a project from the openBIS AS.IProject
getProjectForUpdate(java.lang.String projectIdentifier)
Get an project from the openBIS AS for the purpose of modifying it.DataSetRegistrationContext
getRegistrationContext()
Return a registration context object which can be used to store information that needs to be accessed through the registration process.ch.systemsx.cisd.etlserver.registrator.v1.AbstractOmniscientTopLevelDataSetRegistrator.OmniscientTopLevelDataSetRegistratorState
getRegistratorContext()
Returns the service registrator context.ISampleImmutable
getSample(java.lang.String sampleIdentifierString)
Get a sample from the openBIS AS.ISample
getSampleForUpdate(java.lang.String sampleIdentifierString)
Get a sample from the openBIS AS for the purpose of modifying it.ISearchService
getSearchService()
Retrieve the search service for this transaction.ISearchService
getSearchServiceFilteredForUser(java.lang.String userId)
Retrieve the search service for this transaction.ISearchService
getSearchServiceUnfiltered()
Retrieve the search service for this transaction.ISpaceImmutable
getSpace(java.lang.String spaceCode)
Get a space from the openBIS AS.java.lang.String
getUserId()
Get the id of the user on whose behalf this registration transaction is performed.IVocabularyImmutable
getVocabulary(java.lang.String code)
Get the read-only vocabulary with given codeIVocabulary
getVocabularyForUpdate(java.lang.String code)
Get the vocabulary with given codeboolean
isCommitted()
boolean
isCommittedOrRolledback()
boolean
isRolledback()
void
logInfo(java.lang.Object message)
Write something to the operation log.IDataSetUpdatable
makeDataSetMutable(IDataSetImmutable dataSet)
Given an immutable data set, make it mutable.IExperimentUpdatable
makeExperimentMutable(IExperimentImmutable experiment)
Given an immutable experiment, make it mutable.IMaterial
makeMaterialMutable(IMaterialImmutable material)
Given an immutable material, make it mutable.IProject
makeProjectMutable(IProjectImmutable project)
Given an immutable project, make it mutable.ISample
makeSampleMutable(ISampleImmutable sample)
Given an immutable sample, make it mutable.java.lang.String
moveFile(java.lang.String src, IDataSet dst)
Move a file from into the root of a data set.java.lang.String
moveFile(java.lang.String src, IDataSet dst, java.lang.String dstInDataset)
Move a file to a specified location in a data set.void
registerDataSetsInApplicationServer(ch.systemsx.cisd.openbis.generic.shared.basic.TechId registrationId, java.util.List<ch.systemsx.cisd.openbis.dss.generic.shared.dto.DataSetRegistrationInformation<T>> dataSetRegistrations)
Delegate method called by theDataSetStorageAlgorithmRunner
.void
rollback()
Rollback any commands that have been executed.static void
rollbackDeadTransactions(java.io.File rollBackStackParentFolder)
Check if there are any uncompleted transactions and roll them back.void
setUserId(java.lang.String userIdOrNull)
Set the id of the user on whose behalf this registration transaction is performed.
-
-
-
Field Detail
-
SUCCESS_MESSAGE
public static final java.lang.String SUCCESS_MESSAGE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DataSetRegistrationTransaction
public DataSetRegistrationTransaction(java.io.File rollBackStackParentFolder, java.io.File workingDirectory, java.io.File stagingDirectory, ch.systemsx.cisd.etlserver.registrator.v1.DataSetRegistrationService<T> registrationService, ch.systemsx.cisd.etlserver.registrator.v1.IDataSetRegistrationDetailsFactory<T> registrationDetailsFactory)
-
-
Method Detail
-
findRollbackStacks
public static RollbackStack[] findRollbackStacks(java.io.File rollBackStackParentFolder)
-
rollbackDeadTransactions
public static void rollbackDeadTransactions(java.io.File rollBackStackParentFolder)
Check if there are any uncompleted transactions and roll them back. To be called during startup of a thread.
-
getUserId
public java.lang.String getUserId()
Description copied from interface:IDataSetRegistrationTransaction
Get the id of the user on whose behalf this registration transaction is performed.- Specified by:
getUserId
in interfaceIDataSetRegistrationTransaction
- Returns:
- A userId or null, if there is none.
-
setUserId
public void setUserId(java.lang.String userIdOrNull)
Description copied from interface:IDataSetRegistrationTransaction
Set the id of the user on whose behalf this registration transaction is performed.- Specified by:
setUserId
in interfaceIDataSetRegistrationTransaction
- Parameters:
userIdOrNull
- The id of a user or null if this transaction should be performed as the system (etlserver).
-
createNewDataSet
public IDataSet createNewDataSet()
Description copied from interface:IDataSetRegistrationTransaction
Create a new data set for registration in openBIS.- Specified by:
createNewDataSet
in interfaceIDataSetRegistrationTransaction
-
createNewDataSet
public IDataSet createNewDataSet(java.lang.String dataSetType)
Description copied from interface:IDataSetRegistrationTransaction
Create a new data set with the specified code.- Specified by:
createNewDataSet
in interfaceIDataSetRegistrationTransaction
-
createNewDataSet
public IDataSet createNewDataSet(java.lang.String dataSetType, DataSetKind datasetKindOrNull)
- Specified by:
createNewDataSet
in interfaceIDataSetRegistrationTransaction
-
createNewDataSet
public IDataSet createNewDataSet(java.lang.String dataSetType, java.lang.String dataSetCode)
Description copied from interface:IDataSetRegistrationTransaction
Create a new data set with the specified type and code.- Specified by:
createNewDataSet
in interfaceIDataSetRegistrationTransaction
-
createNewDataSet
public IDataSet createNewDataSet(java.lang.String dataSetType, java.lang.String dataSetCode, DataSetKind datasetKindOrNull)
- Specified by:
createNewDataSet
in interfaceIDataSetRegistrationTransaction
-
createNewDataSet
public IDataSet createNewDataSet(DataSetRegistrationDetails<T> registrationDetails)
-
createNewDataSet
public IDataSet createNewDataSet(ch.systemsx.cisd.etlserver.registrator.v1.IDataSetRegistrationDetailsFactory<T> factory, java.lang.String dataSetType)
-
getDataSet
public IDataSetImmutable getDataSet(java.lang.String dataSetCode)
Description copied from interface:IDataSetRegistrationTransaction
Get a data set from the openBIS AS. Returns null if the data set does not exist.- Specified by:
getDataSet
in interfaceIDataSetRegistrationTransaction
- Returns:
- A data set or null
-
getDataSetForUpdate
public IDataSetUpdatable getDataSetForUpdate(java.lang.String dataSetCode)
Description copied from interface:IDataSetRegistrationTransaction
Get a data set from the openBIS AS for the purpose of modifying it. Returns null if the data set does not exist.- Specified by:
getDataSetForUpdate
in interfaceIDataSetRegistrationTransaction
- Returns:
- A data set or null
-
makeDataSetMutable
public IDataSetUpdatable makeDataSetMutable(IDataSetImmutable dataSet)
Description copied from interface:IDataSetRegistrationTransaction
Given an immutable data set, make it mutable.- Specified by:
makeDataSetMutable
in interfaceIDataSetRegistrationTransaction
- Returns:
- A data set
-
getSample
public ISampleImmutable getSample(java.lang.String sampleIdentifierString)
Description copied from interface:IDataSetRegistrationTransaction
Get a sample from the openBIS AS. Returns null if the sample does not exist.- Specified by:
getSample
in interfaceIDataSetRegistrationTransaction
- Returns:
- A sample or null
-
getSampleForUpdate
public ISample getSampleForUpdate(java.lang.String sampleIdentifierString)
Description copied from interface:IDataSetRegistrationTransaction
Get a sample from the openBIS AS for the purpose of modifying it. Returns null if the sample does not exist.- Specified by:
getSampleForUpdate
in interfaceIDataSetRegistrationTransaction
- Returns:
- A sample or null
-
makeSampleMutable
public ISample makeSampleMutable(ISampleImmutable sample)
Description copied from interface:IDataSetRegistrationTransaction
Given an immutable sample, make it mutable.- Specified by:
makeSampleMutable
in interfaceIDataSetRegistrationTransaction
- Returns:
- A sample
-
getExperimentForUpdate
public IExperimentUpdatable getExperimentForUpdate(java.lang.String experimentIdentifierString)
Description copied from interface:IDataSetRegistrationTransaction
Get an experiment from the openBIS AS for the purpose of modifying it.- Specified by:
getExperimentForUpdate
in interfaceIDataSetRegistrationTransaction
-
makeExperimentMutable
public IExperimentUpdatable makeExperimentMutable(IExperimentImmutable experiment)
Description copied from interface:IDataSetRegistrationTransaction
Given an immutable experiment, make it mutable.- Specified by:
makeExperimentMutable
in interfaceIDataSetRegistrationTransaction
- Returns:
- An experiment
-
createNewSample
public ISample createNewSample(java.lang.String sampleIdentifierString, java.lang.String sampleTypeCode)
Description copied from interface:IDataSetRegistrationTransaction
Create a new sample to register with the openBIS AS. The sample will have a permId.- Specified by:
createNewSample
in interfaceIDataSetRegistrationTransaction
- Parameters:
sampleIdentifierString
- The identifier for the new samplesampleTypeCode
- The code of the type for the new sample
-
createNewSampleWithGeneratedCode
public ISample createNewSampleWithGeneratedCode(java.lang.String spaceCode, java.lang.String sampleTypeCode)
Description copied from interface:IDataSetRegistrationTransaction
Create a new sample to register with the openBIS AS. The sample will have a permId and automatically generated identifier- Specified by:
createNewSampleWithGeneratedCode
in interfaceIDataSetRegistrationTransaction
- Parameters:
spaceCode
- The space in which to create the new sample.sampleTypeCode
- The code of the type for the new sample
-
getExperiment
public IExperimentImmutable getExperiment(java.lang.String experimentIdentifierString)
Description copied from interface:IDataSetRegistrationTransaction
Get an experiment from the openBIS AS.- Specified by:
getExperiment
in interfaceIDataSetRegistrationTransaction
-
createNewExperiment
public IExperiment createNewExperiment(java.lang.String experimentIdentifierString, java.lang.String experimentTypeCode)
Description copied from interface:IDataSetRegistrationTransaction
Create a new experiment to register with the openBIS AS. The experiment will have a permId.- Specified by:
createNewExperiment
in interfaceIDataSetRegistrationTransaction
- Parameters:
experimentIdentifierString
- The identifier for the new experimentexperimentTypeCode
- The code of the type for the new experiment
-
createNewProject
public IProject createNewProject(java.lang.String projectIdentifier)
Description copied from interface:IDataSetRegistrationTransaction
Create a new project to register with the openBIS AS.- Specified by:
createNewProject
in interfaceIDataSetRegistrationTransaction
- Parameters:
projectIdentifier
- .
-
getProject
public IProjectImmutable getProject(java.lang.String projectIdentifierString)
Description copied from interface:IDataSetRegistrationTransaction
Get a project from the openBIS AS. Returns null if the project does not exist.- Specified by:
getProject
in interfaceIDataSetRegistrationTransaction
- Returns:
- A project or null
-
getProjectForUpdate
public IProject getProjectForUpdate(java.lang.String projectIdentifier)
Description copied from interface:IDataSetRegistrationTransaction
Get an project from the openBIS AS for the purpose of modifying it.- Specified by:
getProjectForUpdate
in interfaceIDataSetRegistrationTransaction
-
makeProjectMutable
public IProject makeProjectMutable(IProjectImmutable project)
Description copied from interface:IDataSetRegistrationTransaction
Given an immutable project, make it mutable.- Specified by:
makeProjectMutable
in interfaceIDataSetRegistrationTransaction
- Returns:
- A mutable project.
-
createNewSpace
public ISpace createNewSpace(java.lang.String spaceCode, java.lang.String spaceAdminUserIdOrNull)
Description copied from interface:IDataSetRegistrationTransaction
Create a new space to register with the openBIS AS.- Specified by:
createNewSpace
in interfaceIDataSetRegistrationTransaction
- Parameters:
spaceCode
- the code of the spacespaceAdminUserIdOrNull
- the user id of the person, who will receive space admin priviliges.
-
getSpace
public ISpaceImmutable getSpace(java.lang.String spaceCode)
Description copied from interface:IDataSetRegistrationTransaction
Get a space from the openBIS AS. Returns null if the space does not exist.- Specified by:
getSpace
in interfaceIDataSetRegistrationTransaction
- Returns:
- A space or null
-
getMaterial
public IMaterialImmutable getMaterial(java.lang.String materialCode, java.lang.String materialType)
Description copied from interface:IDataSetRegistrationTransaction
Get a material from the openBIS AS. Returns null if the material does not exist.- Specified by:
getMaterial
in interfaceIDataSetRegistrationTransaction
- Returns:
- A material or null
-
getMaterial
public IMaterialImmutable getMaterial(java.lang.String identifier)
Description copied from interface:IDataSetRegistrationTransaction
Get a material from the openBIS AS. Returns null if the material does not exist.- Specified by:
getMaterial
in interfaceIDataSetRegistrationTransaction
- Returns:
- A material or null
-
getMaterialForUpdate
public IMaterial getMaterialForUpdate(java.lang.String materialCode, java.lang.String materialType)
Description copied from interface:IDataSetRegistrationTransaction
Get a material from the openBIS AS for the purpose of modifying it. Returns null if the material does not exist.- Specified by:
getMaterialForUpdate
in interfaceIDataSetRegistrationTransaction
- Returns:
- A material or null
-
getMaterialForUpdate
public IMaterial getMaterialForUpdate(java.lang.String identifier)
Description copied from interface:IDataSetRegistrationTransaction
Get a material from the openBIS AS for the purpose of modifying it. Returns null if the material does not exist.- Specified by:
getMaterialForUpdate
in interfaceIDataSetRegistrationTransaction
- Returns:
- A material or null
-
makeMaterialMutable
public IMaterial makeMaterialMutable(IMaterialImmutable material)
Description copied from interface:IDataSetRegistrationTransaction
Given an immutable material, make it mutable.- Specified by:
makeMaterialMutable
in interfaceIDataSetRegistrationTransaction
- Returns:
- A material
-
createNewMaterial
public IMaterial createNewMaterial(java.lang.String materialCode, java.lang.String materialType)
Description copied from interface:IDataSetRegistrationTransaction
Create a new material to register with the openBIS AS.- Specified by:
createNewMaterial
in interfaceIDataSetRegistrationTransaction
- Parameters:
materialCode
- the code of the materialmaterialType
- the type of the material
-
getExternalDataManagementSystem
public IExternalDataManagementSystemImmutable getExternalDataManagementSystem(java.lang.String externalDataManagementSystemCode)
Description copied from interface:IDataSetRegistrationTransaction
Get an external data management system from the openBIS AS. Returns null if the object does not exist.- Specified by:
getExternalDataManagementSystem
in interfaceIDataSetRegistrationTransaction
- Returns:
- external data management system or null
-
createNewMetaproject
public IMetaproject createNewMetaproject(java.lang.String name, java.lang.String description)
Description copied from interface:IDataSetRegistrationTransaction
Creates the new metaproject for the current user. Only allowed when there is a user available.- Specified by:
createNewMetaproject
in interfaceIDataSetRegistrationTransaction
-
createNewMetaproject
public IMetaproject createNewMetaproject(java.lang.String name, java.lang.String description, java.lang.String ownerId)
Description copied from interface:IDataSetRegistrationTransaction
Creates the new metaproject for the specified user. Only allowed when there is no user available.- Specified by:
createNewMetaproject
in interfaceIDataSetRegistrationTransaction
-
getMetaproject
public IMetaproject getMetaproject(java.lang.String name)
Description copied from interface:IDataSetRegistrationTransaction
Only allowed when the user is available.- Specified by:
getMetaproject
in interfaceIDataSetRegistrationTransaction
- Returns:
- metaproject with given name for current user.
-
getMetaproject
public IMetaproject getMetaproject(java.lang.String name, java.lang.String ownerId)
Description copied from interface:IDataSetRegistrationTransaction
Only allowed when the user is not available.- Specified by:
getMetaproject
in interfaceIDataSetRegistrationTransaction
- Returns:
- metaproject with given name for specified user.
-
getVocabulary
public IVocabularyImmutable getVocabulary(java.lang.String code)
Description copied from interface:IDataSetRegistrationTransaction
Get the read-only vocabulary with given code- Specified by:
getVocabulary
in interfaceIDataSetRegistrationTransaction
-
getVocabularyForUpdate
public IVocabulary getVocabularyForUpdate(java.lang.String code)
Description copied from interface:IDataSetRegistrationTransaction
Get the vocabulary with given code- Specified by:
getVocabularyForUpdate
in interfaceIDataSetRegistrationTransaction
-
createNewVocabularyTerm
public IVocabularyTerm createNewVocabularyTerm()
Description copied from interface:IDataSetRegistrationTransaction
Creates a new vocabulary term, which has to be assigned to aIVocabulary
.- Specified by:
createNewVocabularyTerm
in interfaceIDataSetRegistrationTransaction
-
moveFile
public java.lang.String moveFile(java.lang.String src, IDataSet dst)
Description copied from interface:IDataSetRegistrationTransaction
Move a file from into the root of a data set.- Specified by:
moveFile
in interfaceIDataSetRegistrationTransaction
- Parameters:
src
- The path of the file to move.dst
- The data set to add the file to.- Returns:
- The absolute path after the move.
-
moveFile
public java.lang.String moveFile(java.lang.String src, IDataSet dst, java.lang.String dstInDataset)
Description copied from interface:IDataSetRegistrationTransaction
Move a file to a specified location in a data set. Any necessary intermediate folders are automatically created.- Specified by:
moveFile
in interfaceIDataSetRegistrationTransaction
- Parameters:
src
- The path of the file to move.dst
- The data set to add the file to.dstInDataset
- The path of the file in the data set- Returns:
- The absolute path after the move.
-
createNewDirectory
public java.lang.String createNewDirectory(IDataSet dst, java.lang.String dirName)
Description copied from interface:IDataSetRegistrationTransaction
Create a new directory and return the path.- Specified by:
createNewDirectory
in interfaceIDataSetRegistrationTransaction
- Parameters:
dst
- The data set to add the file to.dirName
- The name of the new file to create. (Can be a simple file or directory.)- Returns:
- The absolute path of the new file.
-
createNewFile
public java.lang.String createNewFile(IDataSet dst, java.lang.String fileName)
Description copied from interface:IDataSetRegistrationTransaction
Create a new empty file and return the path.- Specified by:
createNewFile
in interfaceIDataSetRegistrationTransaction
- Parameters:
dst
- The data set to add the file to.fileName
- The name of the new file to create. (Can be a simple file or directory.)- Returns:
- The absolute path of the new file.
-
createNewFile
public java.lang.String createNewFile(IDataSet dst, java.lang.String dstInDataset, java.lang.String fileName)
Description copied from interface:IDataSetRegistrationTransaction
Create a new empty file and return the path.- Specified by:
createNewFile
in interfaceIDataSetRegistrationTransaction
- Parameters:
dst
- The data set to add the file to.dstInDataset
- The path of the file in the data setfileName
- The name of the new file to create. (Can be a simple file or directory.)- Returns:
- The absolute path of the new file.
-
deleteFile
public void deleteFile(java.lang.String src)
-
getRegistrationContext
public DataSetRegistrationContext getRegistrationContext()
Description copied from interface:IDataSetRegistrationTransaction
Return a registration context object which can be used to store information that needs to be accessed through the registration process.It is important to use the registration context, and not global variables, for communication between code in different parts of the registration process. This is because the registration process is not guaranteed to run in a single process.
- Specified by:
getRegistrationContext
in interfaceDataSetRegistrationContext.IHolder
- Specified by:
getRegistrationContext
in interfaceIDataSetRegistrationTransaction
- Returns:
- The context, a hash-map-like object.
-
commit
public boolean commit()
Commit the transaction. Does not throw exceptions if the commit fails on some datasets!- Returns:
- true if any datasets have been commited, false otherwise.
-
rollback
public void rollback()
Rollback any commands that have been executed. Rollback is done in the reverse order of execution.
-
didRollbackStorageAlgorithmRunner
public void didRollbackStorageAlgorithmRunner(ch.systemsx.cisd.etlserver.registrator.v1.DataSetStorageAlgorithmRunner<T> algorithm, java.lang.Throwable ex, ch.systemsx.cisd.etlserver.registrator.v1.IDataSetOnErrorActionDecision.ErrorType errorType)
Delegate method called by theDataSetStorageAlgorithmRunner
.- Specified by:
didRollbackStorageAlgorithmRunner
in interfacech.systemsx.cisd.etlserver.registrator.v1.DataSetStorageAlgorithmRunner.IRollbackDelegate<T extends ch.systemsx.cisd.openbis.dss.generic.shared.dto.DataSetInformation>
-
registerDataSetsInApplicationServer
public void registerDataSetsInApplicationServer(ch.systemsx.cisd.openbis.generic.shared.basic.TechId registrationId, java.util.List<ch.systemsx.cisd.openbis.dss.generic.shared.dto.DataSetRegistrationInformation<T>> dataSetRegistrations) throws java.lang.Throwable
Delegate method called by theDataSetStorageAlgorithmRunner
. This implementation asks the DataSetRegistrationService to register not just the data sets, but perform any creation or updates of Experiments and Samples as well.- Specified by:
registerDataSetsInApplicationServer
in interfacech.systemsx.cisd.etlserver.registrator.v1.DataSetStorageAlgorithmRunner.IDataSetInApplicationServerRegistrator<T extends ch.systemsx.cisd.openbis.dss.generic.shared.dto.DataSetInformation>
- Throws:
java.lang.Throwable
-
didEntityOperationsSucceeded
public ch.systemsx.cisd.openbis.generic.shared.basic.EntityOperationsState didEntityOperationsSucceeded(ch.systemsx.cisd.openbis.generic.shared.basic.TechId registrationId)
- Specified by:
didEntityOperationsSucceeded
in interfacech.systemsx.cisd.etlserver.registrator.v1.DataSetStorageAlgorithmRunner.IDataSetInApplicationServerRegistrator<T extends ch.systemsx.cisd.openbis.dss.generic.shared.dto.DataSetInformation>
-
isCommittedOrRolledback
public boolean isCommittedOrRolledback()
-
isCommitted
public boolean isCommitted()
-
isRolledback
public boolean isRolledback()
-
logInfo
public void logInfo(java.lang.Object message)
Write something to the operation log.
-
getSearchService
public ISearchService getSearchService()
Description copied from interface:IDataSetRegistrationTransaction
Retrieve the search service for this transaction. If the user is available for this transaction, then the search service results will be filtered for this user.- Specified by:
getSearchService
in interfaceIDataSetRegistrationTransaction
- Returns:
- The search service for this transaction.
-
getSearchServiceUnfiltered
public ISearchService getSearchServiceUnfiltered()
Description copied from interface:IDataSetRegistrationTransaction
Retrieve the search service for this transaction. It returns the results unfiltered by the user, even if the user is available.- Specified by:
getSearchServiceUnfiltered
in interfaceIDataSetRegistrationTransaction
- Returns:
- The search service for this transaction.
-
getSearchServiceFilteredForUser
public ISearchService getSearchServiceFilteredForUser(java.lang.String userId)
Description copied from interface:IDataSetRegistrationTransaction
Retrieve the search service for this transaction. The search service results will be filtered for the specified user.- Specified by:
getSearchServiceFilteredForUser
in interfaceIDataSetRegistrationTransaction
- Returns:
- The search service for this transaction.
-
getAuthorizationService
public IAuthorizationService getAuthorizationService()
- Specified by:
getAuthorizationService
in interfaceIDataSetRegistrationTransaction
- Returns:
- A service which can be used to get authorization information about a user.
-
getDatabaseQuery
public net.lemnik.eodsql.DynamicTransactionQuery getDatabaseQuery(java.lang.String dataSourceName) throws java.lang.IllegalArgumentException
Description copied from interface:IDataSetRegistrationTransaction
Gets a database query object for the data source with the specified name.After the rest of the transaction is committed, the queries are committed. Failures in these secondary queries are not fatal, but they are caught and the clients of the transaction are notified.
- Specified by:
getDatabaseQuery
in interfaceIDataSetRegistrationTransaction
- Parameters:
dataSourceName
- The name of the data source to query against, as declared in the service.properties file.- Returns:
- The query.
- Throws:
java.lang.IllegalArgumentException
-
getRegistratorContext
public ch.systemsx.cisd.etlserver.registrator.v1.AbstractOmniscientTopLevelDataSetRegistrator.OmniscientTopLevelDataSetRegistratorState getRegistratorContext()
Description copied from interface:IDataSetRegistrationTransaction
Returns the service registrator context.- Specified by:
getRegistratorContext
in interfaceIDataSetRegistrationTransaction
-
getIncomingDataSetFile
public DataSetFile getIncomingDataSetFile()
-
getIncoming
public java.io.File getIncoming()
- Specified by:
getIncoming
in interfaceIDataSetRegistrationTransaction
- Returns:
- The logical incoming file.
-
getGlobalState
public TopLevelDataSetRegistratorGlobalState getGlobalState()
- Specified by:
getGlobalState
in interfaceIDataSetRegistrationTransaction
- Returns:
- Global state for this dropbox, including configuration properties specified by the user.
-
-