Class DBRepository

    • Constructor Detail

      • DBRepository

        public DBRepository()
    • Method Detail

      • getNbSavedObjects

        public int getNbSavedObjects()
        Returns the number of save operation to repository.
        Specified by:
        getNbSavedObjects in interface Repository
        Returns:
        The number of save operation to repository.
      • getNbDeletedObjects

        public int getNbDeletedObjects()
        Returns the number of delete operation on repository.
        Specified by:
        getNbDeletedObjects in interface Repository
        Returns:
        The number of delete operation on repository.
      • getNbBadDeletedObjects

        public int getNbBadDeletedObjects()
        Returns the number of useless delete operation on repository.
        Specified by:
        getNbBadDeletedObjects in interface Repository
        Returns:
        The number of useless delete operation on repository.
      • getNbLoadedObjects

        public int getNbLoadedObjects()
        Returns the number of load operation from repository.
        Specified by:
        getNbLoadedObjects in interface Repository
        Returns:
        The number of load operation from repository.
      • init

        public void init​(Transaction transaction,
                         File dir)
                  throws IOException
        Initializes the repository. Opens the connection, evntually creates the database and tables.
        Specified by:
        init in interface Repository
        Parameters:
        transaction - the transaction object.
        dir - the directory.
        Throws:
        IOException - an error occurs.
      • list

        public String[] list​(String prefix)
                      throws IOException
        Gets a list of persistent objects that name corresponds to prefix.
        Specified by:
        list in interface Repository
        Parameters:
        prefix - the prefix.
        Returns:
        The list of corresponding names.
        Throws:
        IOException - an error occurs.
      • save

        public void save​(String dirName,
                         String name,
                         byte[] content)
                  throws IOException
        Save the corresponding bytes array.
        Specified by:
        save in interface Repository
        Parameters:
        dirName - the directory.
        name - the object name.
        content - the serialized object view.
        Throws:
        IOException - an error occurs.
      • load

        public byte[] load​(String dirName,
                           String name)
                    throws IOException
        Loads the byte array.
        Specified by:
        load in interface Repository
        Parameters:
        dirName - the directory.
        name - the object name.
        Returns:
        The loaded bytes array.
        Throws:
        IOException - an error occurs.
      • delete

        public void delete​(String dirName,
                           String name)
                    throws IOException
        Deletes the corresponding objects in repository.
        Specified by:
        delete in interface Repository
        Parameters:
        dirName - the directory.
        name - the object name.
        Throws:
        IOException - an error occurs.