Class DBURI


  • public class DBURI
    extends Object
    Provide a single parameter to specify database objects to process.

    Wrap JDBC settings for use by PMD: optional parameters specify the source code to be passed to PMD, or are inherited from the associated DBType.

    A DBURI is a faux-URI: it does not have a formal specification and comprises a JDBC(-ish) URL and an optional query, e.g. jdbc : subprotocol [ : subname ] : connection details [ query ] .

    The subprotocol and optional subname parts should be a valid DBType JDBC(-ish) URL jdbc:oracle:thin:username/password@//192.168.100.21:1521/ORCL JDBC(-ish) URL jdbc:thin:username/password@//192.168.100.21:1521/ORCL

    The query includes one or more of these:

    characterset
    utf8
    languages
    comma-separated list of desired PMD languages
    schemas
    comma-separated list of database schemas
    sourcecodetypes
    comma-separated list of database source code types
    sourcecodenames
    comma-separated list of database source code names
    Author:
    sturton
    See Also:
    URI
    • Constructor Detail

      • DBURI

        public DBURI​(String string)
              throws URISyntaxException
        Create DBURI from a string, combining a JDBC URL and query parameters.

        From the JDBC URL component, infer:

        • JDBC driver class
        • supported languages
        • default source code types
        • default schemas

        From the query component, define these values, overriding any defaults:

        • parsing language
        • source code types
        • schemas
        • source code
        Parameters:
        string - URL string
        Throws:
        URISyntaxException
      • DBURI

        public DBURI​(String scheme,
                     String userInfo,
                     String host,
                     int port,
                     String path,
                     String query,
                     String fragment)
              throws URISyntaxException
        Create a DBURI from standard individual URI components.

        From the JDBC URL components, infer:

        • JDBC driver class
        • supported languages
        • default source code types
        • default schemas

        From the query component, define these values, overriding any defaults:

        • parsing language
        • source code types
        • schemas
        • source code
        Parameters:
        scheme -
        userInfo -
        host -
        port -
        path -
        query -
        fragment -
        Throws:
        URISyntaxException
    • Method Detail

      • getUri

        public URI getUri()
      • setUri

        public void setUri​(URI uri)
      • getDbType

        public DBType getDbType()
      • setDbType

        public void setDbType​(DBType dbType)
      • getSchemasList

        public List<String> getSchemasList()
      • setSchemasList

        public void setSchemasList​(List<String> schemasList)
      • getSourceCodeTypesList

        public List<String> getSourceCodeTypesList()
      • setSourceCodeTypesList

        public void setSourceCodeTypesList​(List<String> sourceCodeTypesList)
      • getSourceCodeNamesList

        public List<String> getSourceCodeNamesList()
      • setSourceCodeNamesList

        public void setSourceCodeNamesList​(List<String> sourceCodeNamesList)
      • getLanguagesList

        public List<String> getLanguagesList()
      • setLanguagesList

        public void setLanguagesList​(List<String> languagesList)
      • getDriverClass

        public String getDriverClass()
      • setDriverClass

        public void setDriverClass​(String driverClass)
      • getCharacterSet

        public String getCharacterSet()
      • setCharacterSet

        public void setCharacterSet​(String characterSet)
      • getSourceCodeType

        public int getSourceCodeType()
      • setSourceCodeType

        public void setSourceCodeType​(int sourceCodeType)
      • getSubprotocol

        public String getSubprotocol()
      • setSubprotocol

        public void setSubprotocol​(String subprotocol)
      • getSubnamePrefix

        public String getSubnamePrefix()
      • setSubnamePrefix

        public void setSubnamePrefix​(String subnamePrefix)
      • setParameters

        public void setParameters​(Map<String,​String> parameters)
      • getURL

        public String getURL()
        Returns:
        the url
      • setURL

        public void setURL​(String jdbcURL)
        Parameters:
        jdbcURL - the url to set