public class DBMSMetadata
extends java.lang.Object
DBURI
parameters specify the
source code to be passed to PMD.Modifier and Type | Field | Description |
---|---|---|
protected java.sql.CallableStatement |
callableStatement |
CallableStatement to return source code.
|
protected java.sql.Connection |
connection |
Connection management
|
protected DBURI |
dburi |
DBURI
|
protected java.lang.String |
returnSourceCodeObjectsStatement |
Procedural statement to return list of source code objects.
|
protected java.lang.String |
returnSourceCodeStatement |
Procedural statement to return source code.
|
protected int |
returnType |
Types value representing the type returned by
callableStatement
Currently only java.sql.Types.String and java.sql.Types.Clob are
supported |
Constructor | Description |
---|---|
DBMSMetadata(java.lang.String user,
java.lang.String password,
DBURI dbURI) |
Define database connection and source code to retrieve with explicit
database username and password.
|
DBMSMetadata(java.sql.Connection c) |
Minimal constructor
|
DBMSMetadata(java.util.Properties properties,
DBURI dbURI) |
Define database connection and source code to retrieve with database
properties.
|
DBMSMetadata(DBURI dbURI) |
Define database connection and source code to retrieve.
|
Modifier and Type | Method | Description |
---|---|---|
java.sql.Connection |
getConnection() |
Return JDBC Connection for direct JDBC access to the specified database.
|
java.io.Reader |
getSourceCode(java.lang.String objectType,
java.lang.String name,
java.lang.String schema) |
return source code text
|
java.io.Reader |
getSourceCode(SourceObject sourceObject) |
Return source code text from the database.
|
java.util.List<SourceObject> |
getSourceObjectList() |
Return all source code objects associated with any associated DBURI.
|
java.util.List<SourceObject> |
getSourceObjectList(java.util.List<java.lang.String> languages,
java.util.List<java.lang.String> schemas,
java.util.List<java.lang.String> sourceCodeTypes,
java.util.List<java.lang.String> sourceCodeNames) |
Return all source code objects associated with the specified languages,
schemas, source code types and source code names.
|
protected DBURI dburi
protected java.sql.Connection connection
protected java.lang.String returnSourceCodeObjectsStatement
protected java.lang.String returnSourceCodeStatement
protected java.sql.CallableStatement callableStatement
protected int returnType
Types
value representing the type returned by
callableStatement
Currently only java.sql.Types.String and java.sql.Types.Clob are
supportedpublic DBMSMetadata(java.sql.Connection c) throws java.sql.SQLException
c
- JDBC Connectionjava.sql.SQLException
public DBMSMetadata(java.lang.String user, java.lang.String password, DBURI dbURI) throws java.sql.SQLException, java.net.MalformedURLException, java.lang.ClassNotFoundException
user
- Database usernamepassword
- Database passworddbURI
- DBURI
containing JDBC connection plus parameters to
specify source code.java.sql.SQLException
- on failing to create JDBC connectionjava.net.MalformedURLException
- on attempting to connect with malformed JDBC URLjava.lang.ClassNotFoundException
- on failing to locate the JDBC driver class.public DBMSMetadata(java.util.Properties properties, DBURI dbURI) throws java.sql.SQLException, java.net.MalformedURLException, java.lang.ClassNotFoundException
properties
- database settings such as database username, passworddbURI
- DBURI
containing JDBC connection plus parameters to
specify source code.java.sql.SQLException
- on failing to create JDBC connectionjava.net.MalformedURLException
- on attempting to connect with malformed JDBC URLjava.lang.ClassNotFoundException
- on failing to locate the JDBC driver class.public DBMSMetadata(DBURI dbURI) throws java.sql.SQLException, java.lang.ClassNotFoundException
This constructor is reliant on database username and password embedded in
the JDBC URL or defaulted from the DBURI
's DriverType
.
dbURI
- DBURI
containing JDBC connection plus parameters to
specify source code.java.sql.SQLException
- on failing to create JDBC connectionjava.lang.ClassNotFoundException
- on failing to locate the JDBC driver class.public java.sql.Connection getConnection() throws java.sql.SQLException
java.sql.SQLException
public java.io.Reader getSourceCode(SourceObject sourceObject) throws java.sql.SQLException
sourceObject
- objectjava.sql.SQLException
public java.io.Reader getSourceCode(java.lang.String objectType, java.lang.String name, java.lang.String schema) throws java.sql.SQLException
objectType
- name
- Source Code nameschema
- Owner of the codejava.sql.SQLException
- on failing to retrieve the source Code textpublic java.util.List<SourceObject> getSourceObjectList()
public java.util.List<SourceObject> getSourceObjectList(java.util.List<java.lang.String> languages, java.util.List<java.lang.String> schemas, java.util.List<java.lang.String> sourceCodeTypes, java.util.List<java.lang.String> sourceCodeNames)
Each parameter may be null and the appropriate field from any related DBURI is assigned, defaulting to the normal SQL wildcard expression ("%").
languages
- Optional list of languages to search forschemas
- Optional list of schemas to search forsourceCodeTypes
- Optional list of source code types to search forsourceCodeNames
- Optional list of source code names to search forCopyright © 2002–2018 PMD. All rights reserved.