Class SQLHandler<T extends DBHandlerConf>

    • Field Detail

      • DEBUG_ENABLED

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

        protected org.apache.commons.dbcp2.BasicDataSource dataSource
        Data sources.
      • rootDataSource

        protected org.apache.commons.dbcp2.BasicDataSource rootDataSource
        Root data source for superuser operations (drop db, create db...).
      • 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
      • openRoot

        public void openRoot()
        Open root session to database.
      • initDataSource

        protected abstract void initDataSource()
      • initRootDataSource

        protected abstract void initRootDataSource()
      • 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
      • getRootConnection

        protected Connection getRootConnection()
      • 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.
      • 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
      • 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.
      • getDataSource

        public org.apache.commons.dbcp2.BasicDataSource getDataSource()