Package es.bsc.dataclay.logic.datasetmgr
Class DataSetManager
- java.lang.Object
-
- es.bsc.dataclay.util.management.AbstractManager
-
- es.bsc.dataclay.logic.datasetmgr.DataSetManager
-
- All Implemented Interfaces:
CommonManager
public final class DataSetManager extends AbstractManager
This class is responsible for managing datasets (add and remove).
-
-
Field Summary
-
Fields inherited from class es.bsc.dataclay.util.management.AbstractManager
dataSource
-
-
Constructor Summary
Constructors Constructor Description DataSetManager(SQLiteDataSource dataSource)Instantiates a DataSet Manager that uses the DataSet DB in the provided path.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancheckDataSetIsPublic(DataSetID datasetID)This operation checks whether a dataset is p ublic or notbooleancheckDataSetResponsible(DataSetID datasetID, AccountID responsible)This operation checks whether an account is responsible for a datasetvoidcleanCaches()Method that cleans the caches of the manager.List<DataSet>getAllDataSetsOfAccount(AccountID accountID)Get all DataSets of accountDataSetIDgetDataSetID(String datasetName)Returns the datasetID of the specified dataset nameDataSetgetDataSetInfo(DataSetID dataSetID)DataSetgetDataSetInfo(String datasetName)Map<String,DataSet>getDataSetsInfo(Set<DataSetID> datasetIDs)Returns the datasetIDs of the specified datasets namesDataSetManagerDBgetDbHandler()Method used for unit testing.Set<DataSet>getPublicDataSets()This operation retrieves all public datasetsDataSetIDnewDataSet(DataSet newDataSet)This operation creates a new dataset.voidremoveDataSet(DataSetID datasetID)This operation removes the indicated dataset
-
-
-
Constructor Detail
-
DataSetManager
public DataSetManager(SQLiteDataSource dataSource)
Instantiates a DataSet Manager that uses the DataSet DB in the provided path.- Parameters:
managerName- Manager/service name.
-
-
Method Detail
-
newDataSet
public DataSetID newDataSet(DataSet newDataSet)
This operation creates a new dataset.- Parameters:
newDataSet- Information of the dataset to create- Returns:
- datasetID of the new dataset if the it was successfully created.
- Throws:
Exception- if an exception occurs:
DataSetExistsException if the dataset already exists
-
getAllDataSetsOfAccount
public List<DataSet> getAllDataSetsOfAccount(AccountID accountID)
Get all DataSets of account- Parameters:
accountID- ID of account- Returns:
- DataSets of the account.
-
getDataSetID
public DataSetID getDataSetID(String datasetName)
Returns the datasetID of the specified dataset name- Parameters:
datasetName- the name of the dataset- Returns:
- the datasetID of the dataset
- Throws:
Exception- if an exception occurs:
DataSetDoesNotExistException: if the dataset does not exist
-
getDataSetsInfo
public Map<String,DataSet> getDataSetsInfo(Set<DataSetID> datasetIDs)
Returns the datasetIDs of the specified datasets names- Parameters:
datasetsNames- the names of the datasets- Returns:
- the info related with the given datasets
- Throws:
Exception- if an exception occurs:
DataSetDoesNotExistException: if a dataset does not exist
-
removeDataSet
public void removeDataSet(DataSetID datasetID)
This operation removes the indicated dataset- Parameters:
datasetID- DataSetID of the dataset to be removed- Throws:
Exception- if an exception occurs:
DataSetDoesNotExistException: if the dataset does not exist
-
checkDataSetResponsible
public boolean checkDataSetResponsible(DataSetID datasetID, AccountID responsible)
This operation checks whether an account is responsible for a dataset- Parameters:
responsible- AccountID of the responsible to be checkeddatasetID- ID of the dataset to be checked- Returns:
- true if accountID is responsible for datasetID, false if not.
- Throws:
Exception- if an exception occurs:
DataSetDoesNotExistException: if the dataset does not exist
-
checkDataSetIsPublic
public boolean checkDataSetIsPublic(DataSetID datasetID)
This operation checks whether a dataset is p ublic or not- Parameters:
datasetID- ID of the dataset to be checked- Returns:
- true if the dataset is public, false otherwise.
- Throws:
Exception- if an exception occurs:
DataSetDoesNotExistException: if the dataset does not exist
-
getPublicDataSets
public Set<DataSet> getPublicDataSets()
This operation retrieves all public datasets- Returns:
- set of dataset names that are public
-
getDbHandler
public DataSetManagerDB getDbHandler()
Method used for unit testing.- Returns:
- The db handler reference of this manager.
-
cleanCaches
public void cleanCaches()
Description copied from interface:CommonManagerMethod that cleans the caches of the manager. Used on testing.- Specified by:
cleanCachesin interfaceCommonManager- Specified by:
cleanCachesin classAbstractManager
-
-