Class MDDBWriter


  • @PublicAPI
    public class MDDBWriter
    extends MDWriter
    Class for inserting Molecular Descriptors into database tables.
    Since:
    JChem 2.0
    • Constructor Detail

      • MDDBWriter

        public MDDBWriter()
      • MDDBWriter

        public MDDBWriter​(boolean indexTable)
        Used internally.
        Parameters:
        indexTable - true, if writer operates on an index table.
    • Method Detail

      • setConnectionHandler

        public void setConnectionHandler​(ConnectionHandler ch)
        Sets the ConnectionHandler object used to reach the database.
        Parameters:
        ch - the ConnectionHandler with an open connection to the database.
      • getConnectionHandler

        public ConnectionHandler getConnectionHandler()
        Gets the ConnectionHandler object used to reach the database.
        Returns:
        the ConnectionHandler
      • setStructureTable

        public void setStructureTable​(String strucTableName)
        Sets the name of the structure table
        Parameters:
        strucTableName - the name of the structure table
      • getStructureTable

        public String getStructureTable()
        Gets the name of the structure table
        Returns:
        the name of the structure table
      • setMDNames

        public void setMDNames​(String[] mdNames)
        Sets the names of the Molecular Descriptors in database
        Parameters:
        mdNames - the name of the Molecular Descriptors
      • getMDNames

        public String[] getMDNames()
        Gets the names of the Molecular Descriptors in database
        Returns:
        the name of the Molecular Descriptors
      • getMDParameters

        public MDParameters getMDParameters​(int id)
        Gets the actual parameter settings of the specified component.
        Specified by:
        getMDParameters in class MDWriter
        Parameters:
        id - component index
        Returns:
        parameter settings
        Since:
        JChem 2.1
      • setUpdateMode

        public void setUpdateMode​(boolean updateMode)
        Specifies whether new records will be added, or existing records updated.
        Parameters:
        updateMode - set to true for updateing existing rows.
      • put

        public void put​(String molString,
                        int id)
                 throws MDWriterException
        Inserts descriptor data into the database
        Parameters:
        molString - the string representation of molecule to generate descriptor data from
        id - the cd_id of the table rows : should be the same, as in the structure table
        Throws:
        MDWriterException - all exceptions (mainly io) are reinterpreted
        Since:
        JChem 5.3
      • put

        public void put​(Molecule mol,
                        int id)
                 throws MDWriterException
        Inserts descriptor data into the database
        Specified by:
        put in class MDWriter
        Parameters:
        mol - the molecule to generate descriptor data from
        id - the cd_id of the table rows : should be the same, as in the structure table
        Throws:
        MDWriterException - all exceptions (mainly io) are reinterpreted
      • close

        public void close()
                   throws MDWriterException
        Closes down the descriptor output stream. After this, no more operation is permitted on the stream. Calling close guarantees that all data put so far are permanently saved in the stream.
        NOTE: Doesn't close the database connection specified in the ConnectionHandler.
        Specified by:
        close in class MDWriter
        Throws:
        MDWriterException - all exceptions (mainly io) are reinterpreted