Class LogicMetadataDB
- java.lang.Object
-
- es.bsc.dataclay.logic.logicmetadata.LogicMetadataDB
-
public final class LogicMetadataDB extends Object
Data base connection.
-
-
Constructor Summary
Constructors Constructor Description LogicMetadataDB(SQLiteDataSource dataSource)
LogicMetadataDB constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Close DB.void
createTables()
Create tables of LogicMetadata.void
deleteByID(ExecutionEnvironmentID execEnvID)
Delete execute environment identified by ID provided (ignored if it does not exist)void
deleteByID(StorageLocationID stLocID)
Delete storage location identified by ID provided (ignored if it does not exist)boolean
deleteDataClayInstance(String host, Integer port)
Delete dataclay instance addressvoid
dropTables()
Delete the tables.boolean
existsByID(ExecutionEnvironmentID execEnvID)
Check if there is a backend identified by ID providedboolean
existsByID(StorageLocationID stLocID)
Check if there is a backend identified by ID providedboolean
existsExecutionEnvironmentByHostPort(String hostname, int port)
Check if there is an execution environment identified by hostname and port providedboolean
existsMetaData()
Check if there is a LogicModuleboolean
existsStorageLocationByHostPort(String hostname, int port)
Check if there is a storage location identified by hostname and port providedList<ExecutionEnvironment>
getAllExecutionEnvironments()
Get all Execution EnvironmentsList<ExecutionEnvironment>
getAllExecutionEnvironmentsByLang(CommonMessages.Langs lang)
Get all Execution Environments of a specific languageSet<DataClayInstanceID>
getAllExternalDataClays()
Get all DataClayInstance ids representing external dataclaysList<StorageLocation>
getAllStorageLocations()
Get all Storage LocationsExecutionEnvironment
getByID(ExecutionEnvironmentID executionEnvironmentID)
Get ExecutionEnvironment by IDStorageLocation
getByID(StorageLocationID storageLocationID)
Get StorageLocation by IDDataClayInstanceID
getDataClayID(String host, int port)
Get dataClay id.DataClayInstance
getDataClayInfo(DataClayInstanceID dClayID)
Get dataClay info by idSet<ExecutionEnvironmentID>
getExecutionEnvironmentByHostnameAndLanguage(String hostname, CommonMessages.Langs language)
Get all Execution Environment by host name and languageExecutionEnvironment
getExecutionEnvironmentByHostNameAndPort(String hostname, int port)
Get a single (should be unique) Execution Environment by hostname and portSet<ExecutionEnvironmentID>
getExecutionEnvironmentsByNameAndLang(String name, CommonMessages.Langs lang)
Get all Execution Environments associated to DS name and languageLogicMetadataIDs
getLogicMetadata()
Get LogicModule metadata by IDStorageLocation
getStorageLocationByName(String name)
Get a single (should be unique) Storage Location by namevoid
insertDataClayInstance(DataClayInstance dataClayInstance)
Inserts the info of a new dataClay instancevoid
store(LogicMetadataIDs logicmoduleIDs)
Store into databasevoid
store(ExecutionEnvironment exeEnv)
Store a ExecutionEnvironment into databasevoid
store(StorageLocation stLoc)
Store a Storage Location into databasevoid
updateExecutionEnvironmentByID(ExecutionEnvironmentID id, String newhost, Integer newport)
Update execution environment host and port by IDvoid
updateStorageLocationByID(StorageLocationID id, String newhost, Integer newport)
Update storage location host and port by ID
-
-
-
Constructor Detail
-
LogicMetadataDB
public LogicMetadataDB(SQLiteDataSource dataSource)
LogicMetadataDB constructor.- Parameters:
dataSource
- db
-
-
Method Detail
-
createTables
public void createTables()
Create tables of LogicMetadata.
-
dropTables
public void dropTables()
Delete the tables. Just the other way around of createTables --much simpler.
-
store
public void store(LogicMetadataIDs logicmoduleIDs)
Store into database- Parameters:
logicmoduleIDs
- logic module ids
-
store
public void store(StorageLocation stLoc)
Store a Storage Location into database- Parameters:
stLoc
- Storage Location
-
store
public void store(ExecutionEnvironment exeEnv)
Store a ExecutionEnvironment into database- Parameters:
exeEnv
- Execution Environment
-
getByID
public StorageLocation getByID(StorageLocationID storageLocationID)
Get StorageLocation by ID- Parameters:
storageLocationID
- ID of the object- Returns:
- The StorageLocation or null if it does not exist
-
getByID
public ExecutionEnvironment getByID(ExecutionEnvironmentID executionEnvironmentID)
Get ExecutionEnvironment by ID- Parameters:
executionEnvironmentID
- ID of the object- Returns:
- The ExecutionEnvironment or null if it does not exist
-
existsByID
public boolean existsByID(StorageLocationID stLocID)
Check if there is a backend identified by ID provided- Parameters:
stLocID
- ID of the storage location- Returns:
- TRUE if exists. FALSE otherwise
-
existsByID
public boolean existsByID(ExecutionEnvironmentID execEnvID)
Check if there is a backend identified by ID provided- Parameters:
execEnvID
- ID of the execution environment- Returns:
- TRUE if exists. FALSE otherwise
-
deleteByID
public void deleteByID(StorageLocationID stLocID)
Delete storage location identified by ID provided (ignored if it does not exist)- Parameters:
stLocID
- ID of the storage location
-
deleteByID
public void deleteByID(ExecutionEnvironmentID execEnvID)
Delete execute environment identified by ID provided (ignored if it does not exist)- Parameters:
execEnvID
- ID of the backend
-
updateStorageLocationByID
public void updateStorageLocationByID(StorageLocationID id, String newhost, Integer newport) throws DbObjectNotExistException
Update storage location host and port by ID- Parameters:
id
- ID of storage locationnewhost
- new hostnewport
- new port- Throws:
DbObjectNotExistException
- if object does not exist
-
updateExecutionEnvironmentByID
public void updateExecutionEnvironmentByID(ExecutionEnvironmentID id, String newhost, Integer newport) throws DbObjectNotExistException
Update execution environment host and port by ID- Parameters:
id
- ID of storage locationnewhost
- new hostnewport
- new port- Throws:
DbObjectNotExistException
- if object does not exist
-
getAllStorageLocations
public List<StorageLocation> getAllStorageLocations()
Get all Storage Locations- Returns:
- The Storage Locations
-
getAllExecutionEnvironments
public List<ExecutionEnvironment> getAllExecutionEnvironments()
Get all Execution Environments- Returns:
- The Execution Environments
-
getAllExecutionEnvironmentsByLang
public List<ExecutionEnvironment> getAllExecutionEnvironmentsByLang(CommonMessages.Langs lang)
Get all Execution Environments of a specific language- Returns:
- a list of Execution Environments
-
getAllExternalDataClays
public Set<DataClayInstanceID> getAllExternalDataClays()
Get all DataClayInstance ids representing external dataclays- Returns:
- a set of DataClayInstances ids
-
getStorageLocationByName
public StorageLocation getStorageLocationByName(String name)
Get a single (should be unique) Storage Location by name- Parameters:
name
- Name- Returns:
- the storage location named with specified name (null if there is none).
-
getExecutionEnvironmentByHostnameAndLanguage
public Set<ExecutionEnvironmentID> getExecutionEnvironmentByHostnameAndLanguage(String hostname, CommonMessages.Langs language)
Get all Execution Environment by host name and language- Parameters:
hostname
- host namelanguage
- Language- Returns:
- all Execution Environment by host name and language
-
getExecutionEnvironmentsByNameAndLang
public Set<ExecutionEnvironmentID> getExecutionEnvironmentsByNameAndLang(String name, CommonMessages.Langs lang)
Get all Execution Environments associated to DS name and language- Parameters:
name
- Namelang
- Language- Returns:
- All execution environment associated to specified name
-
getExecutionEnvironmentByHostNameAndPort
public ExecutionEnvironment getExecutionEnvironmentByHostNameAndPort(String hostname, int port)
Get a single (should be unique) Execution Environment by hostname and port- Parameters:
hostname
- Host nameport
- port- Returns:
- the execution environment named with specified hostname and port
-
existsExecutionEnvironmentByHostPort
public boolean existsExecutionEnvironmentByHostPort(String hostname, int port)
Check if there is an execution environment identified by hostname and port provided- Parameters:
hostname
- Hostname of the backendport
- port of the backend- Returns:
- TRUE if exists. FALSE otherwise
-
existsStorageLocationByHostPort
public boolean existsStorageLocationByHostPort(String hostname, int port)
Check if there is a storage location identified by hostname and port provided- Parameters:
hostname
- Hostname of the backendport
- port of the backend- Returns:
- TRUE if exists. FALSE otherwise
-
insertDataClayInstance
public void insertDataClayInstance(DataClayInstance dataClayInstance)
Inserts the info of a new dataClay instance- Parameters:
dataClayInstance
- info of the dataClay instance
-
deleteDataClayInstance
public boolean deleteDataClayInstance(String host, Integer port)
Delete dataclay instance address- Parameters:
host
- Hostport
- Port- Returns:
- true if the object has been successfully deleted, false otherwise
-
getDataClayInfo
public DataClayInstance getDataClayInfo(DataClayInstanceID dClayID)
Get dataClay info by id- Parameters:
dClayID
- id of the dataClay instance- Returns:
- info of requested dataClay instance
-
getDataClayID
public DataClayInstanceID getDataClayID(String host, int port)
Get dataClay id. Retrieves id of an external dataClay instance identified by host and port- Parameters:
host
- hostport
- port- Returns:
- id of external dataClay instance
-
getLogicMetadata
public LogicMetadataIDs getLogicMetadata()
Get LogicModule metadata by ID- Returns:
- The LogicModule metadata
-
existsMetaData
public boolean existsMetaData()
Check if there is a LogicModule- Returns:
- TRUE if exists. FALSE otherwise
-
close
public void close()
Close DB.
-
-