Class LogicMetadataDB


  • public final class LogicMetadataDB
    extends Object
    Data base connection.
    • 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
      • 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 name
        language - 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 - Name
        lang - 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 name
        port - 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 backend
        port - 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 backend
        port - 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 - Host
        port - 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 - host
        port - 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.