|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sourceforge.pmd.util.database.DBMSMetadata
public class DBMSMetadata
Wrap JDBC connection for use by PMD: DBURI
parameters specify the source code to
be passed to PMD.
Field Summary | |
---|---|
protected CallableStatement |
callableStatement
CallableStatement to return source code. |
protected Connection |
connection
Connection management |
protected DBURI |
dburi
DBURI |
protected String |
returnSourceCodeObjectsStatement
Procedural statement to return list of source code objects. |
protected 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 Summary | |
---|---|
DBMSMetadata(Connection c)
Minimal constructor |
|
DBMSMetadata(DBURI dbURI)
Define database connection and source code to retrieve. |
|
DBMSMetadata(Properties properties,
DBURI dbURI)
Define database connection and source code to retrieve with database properties. |
|
DBMSMetadata(String user,
String password,
DBURI dbURI)
Define database connection and source code to retrieve with explicit database username and password. |
Method Summary | |
---|---|
Connection |
getConnection()
Return JDBC Connection for direct JDBC access to the specified database. |
Reader |
getSourceCode(SourceObject sourceObject)
Return source code text from the database. |
Reader |
getSourceCode(String objectType,
String name,
String schema)
return source code text |
List<SourceObject> |
getSourceObjectList()
Return all source code objects associated with any associated DBURI. |
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected DBURI dburi
protected Connection connection
protected String returnSourceCodeObjectsStatement
protected String returnSourceCodeStatement
protected 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 supported
Constructor Detail |
---|
public DBMSMetadata(Connection c) throws SQLException
c
- JDBC Connection
SQLException
public DBMSMetadata(String user, String password, DBURI dbURI) throws SQLException, MalformedURLException, ClassNotFoundException
user
- Database usernamepassword
- Database passworddbURI
- DBURI
containing JDBC connection plus parameters to specify source code.
SQLException
- on failing to create JDBC connection
MalformedURLException
- on attempting to connect with malformed JDBC URL
ClassNotFoundException
- on failing to locate the JDBC driver class.public DBMSMetadata(Properties properties, DBURI dbURI) throws SQLException, MalformedURLException, ClassNotFoundException
properties
- database settings such as database username, passworddbURI
- DBURI
containing JDBC connection plus parameters to specify source code.
SQLException
- on failing to create JDBC connection
MalformedURLException
- on attempting to connect with malformed JDBC URL
ClassNotFoundException
- on failing to locate the JDBC driver class.public DBMSMetadata(DBURI dbURI) throws SQLException, ClassNotFoundException
This constructor is reliant on database username and password embedded in the JDBC URL
or defaulted from the DBURI
's DriverType
.
user
- Database usernamepassword
- Database passworddbURI
- DBURI
containing JDBC connection plus parameters to specify source code.
SQLException
- on failing to create JDBC connection
ClassNotFoundException
- on failing to locate the JDBC driver class.Method Detail |
---|
public Connection getConnection() throws SQLException
SQLException
public Reader getSourceCode(SourceObject sourceObject) throws SQLException
source
- object
SQLException
public Reader getSourceCode(String objectType, String name, String schema) throws SQLException
objectType
- name
- Source Code nameschema
- Owner of the code
SQLException
- on failing to retrieve the source Code textpublic List<SourceObject> getSourceObjectList()
public List<SourceObject> getSourceObjectList(List<String> languages, List<String> schemas, List<String> sourceCodeTypes, List<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 for
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |