Class SQLHandler<T extends DBHandlerConf>

    • Field Detail

      • DEBUG_ENABLED

        protected static final boolean DEBUG_ENABLED
        Indicates if debug is enabled.
      • configuration

        protected final T extends DBHandlerConf configuration
        Configuration of the connection.
    • Constructor Detail

      • SQLHandler

        public SQLHandler​(T connConfig)
        Constructor.
        Parameters:
        connConfig - Configuration.
    • Method Detail

      • open

        public void open()
        Open database.
        Specified by:
        open in interface DBHandler
      • initDataSource

        protected abstract void initDataSource()
      • databaseExists

        public abstract boolean databaseExists()
      • createDatabase

        public abstract void createDatabase()
      • dropAllDatabases

        public abstract void dropAllDatabases()
        Drop all databases. FOR TESTING PURPOSES.
      • createTables

        public void createTables()
        Initialize database
      • getConfiguration

        public T getConfiguration()
      • store

        public void store​(ObjectID objectID,
                          byte[] bytes)
        Description copied from interface: DBHandler
        Store the object.
        Specified by:
        store in interface DBHandler
        Parameters:
        objectID - ID of the object
        bytes - Bytes of the object
      • get

        public byte[] get​(ObjectID objectID)
        Description copied from interface: DBHandler
        Get serialized object identified by ObjectID
        Specified by:
        get in interface DBHandler
        Parameters:
        objectID - ID of the object
        Returns:
        Bytes of the serialized object with ID provided.
      • exists

        public boolean exists​(ObjectID objectID)
        Description copied from interface: DBHandler
        Check if object with ID provided exists.
        Specified by:
        exists in interface DBHandler
        Parameters:
        objectID - ID of the object
        Returns:
        TRUE if object exists.
      • count

        public int count()
        Description copied from interface: DBHandler
        Count number of objects in DB
        Specified by:
        count in interface DBHandler
        Returns:
        number of objects in DB
      • update

        public void update​(ObjectID objectID,
                           byte[] newbytes)
        Description copied from interface: DBHandler
        Updates an object identified by the ID provided with the new values provided.
        Specified by:
        update in interface DBHandler
        Parameters:
        objectID - ID of the object.
        newbytes - New byte values
      • delete

        public void delete​(ObjectID objectID)
        Description copied from interface: DBHandler
        Deletes and object from the database.
        Specified by:
        delete in interface DBHandler
        Parameters:
        objectID - ID of the object to delete
      • vacuum

        public void vacuum()
        Description copied from interface: DBHandler
        Vacuum database.
        Specified by:
        vacuum in interface DBHandler
      • isClosed

        public boolean isClosed()
        Description copied from interface: DBHandler
        Verify if database is closed.
        Specified by:
        isClosed in interface DBHandler
        Returns:
        TRUE if database is closed. FALSE, otherwise.
      • close

        public boolean close()
        Description copied from interface: DBHandler
        Close the database
        Specified by:
        close in interface DBHandler
        Returns:
        TRUE if database was closed successfully. FALSE otherwise.