Class DBMSMetadata


  • public class DBMSMetadata
    extends Object
    Wrap JDBC connection for use by PMD: DBURI parameters specify the source code to be passed to PMD.
    Author:
    sturton
    • Field Detail

      • dburi

        protected DBURI dburi
        DBURI
      • connection

        protected Connection connection
        Connection management
      • returnSourceCodeObjectsStatement

        protected String returnSourceCodeObjectsStatement
        Procedural statement to return list of source code objects.
      • returnSourceCodeStatement

        protected String returnSourceCodeStatement
        Procedural statement to return source code.
      • callableStatement

        protected CallableStatement callableStatement
        CallableStatement to return source code.
      • returnType

        protected int returnType
        Types value representing the type returned by callableStatement Currently only java.sql.Types.String and java.sql.Types.Clob are supported
    • Method Detail

      • getConnection

        public Connection getConnection()
                                 throws SQLException
        Return JDBC Connection for direct JDBC access to the specified database.
        Returns:
        I=JDBC Connection
        Throws:
        SQLException
      • getSourceCode

        public Reader getSourceCode​(SourceObject sourceObject)
                             throws SQLException
        Return source code text from the database.
        Parameters:
        sourceObject - object
        Returns:
        source code
        Throws:
        SQLException
      • getSourceCode

        public Reader getSourceCode​(String objectType,
                                    String name,
                                    String schema)
                             throws SQLException
        return source code text
        Parameters:
        objectType -
        name - Source Code name
        schema - Owner of the code
        Returns:
        Source code text.
        Throws:
        SQLException - on failing to retrieve the source Code text
      • getSourceObjectList

        public List<SourceObject> getSourceObjectList()
        Return all source code objects associated with any associated DBURI.
        Returns:
      • getSourceObjectList

        public List<SourceObject> getSourceObjectList​(List<String> languages,
                                                      List<String> schemas,
                                                      List<String> sourceCodeTypes,
                                                      List<String> sourceCodeNames)
        Return all source code objects associated with the specified languages, schemas, source code types and source code names.

        Each parameter may be null and the appropriate field from any related DBURI is assigned, defaulting to the normal SQL wildcard expression ("%").

        Parameters:
        languages - Optional list of languages to search for
        schemas - Optional list of schemas to search for
        sourceCodeTypes - Optional list of source code types to search for
        sourceCodeNames - Optional list of source code names to search for