Java Doc for RDBMServices.java in  » Portal » uPortal_rel-2-6-1-GA » org » jasig » portal » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Portal » uPortal_rel 2 6 1 GA » org.jasig.portal 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.jasig.portal.RDBMServices

RDBMServices
public class RDBMServices (Code)
Provides relational database access and helper methods. A static routine determines if the database/driver supports prepared statements and/or outer joins.

This class provides database access as a service. Via the class, uPortal code can obtain a connection to the core uPortal database as well as to other databases available via JNDI. (Doing that JNDI lookup directly allows your code to avoid dependence upon this class.) This class provides traditional getConnection() methods as well as static covers for getting a reference to the backing DataSource.

This class also provides helper methods for manipulating connections. Mostof the methods are wrappers around methods on the underlying Connection that handle (log and swallow) the SQLExceptions that the underlying methods declare to be thrown (these helpers also catch and log RuntimeExceptions encountered). They provide an alternative to trying and catching those methods using the JDBC APIs directly.


author:
   Ken Weiner, kweiner@unicon.net
author:
   George Lindholm, george.lindholm@ubc.ca
author:
   Eric Dalquist edalquist@unicon.net
author:
   Susan Bramhall susan.bramhall@yale.edu
version:
   $Revision: 36804 $ $Date: 2007-02-12 16:23:45 -0700 (Mon, 12 Feb 2007) $

Inner Class :public static class GenericDataSource implements DataSource
Inner Class :final public static class PreparedStatement

Field Summary
final public static  StringBASE_JNDI_CONTEXT
    
final public static  StringDEFAULT_DATABASE
    
final public static  StringPORTAL_DB
    
public static  MovingAverageSamplelastDatabase
    


Method Summary
public static  voidclosePreparedStatement(java.sql.PreparedStatement pst)
     Close a PreparedStatement.
public static  voidcloseResultSet(ResultSet rs)
    
public static  voidcloseStatement(Statement st)
    
final public static  voidcommit(Connection connection)
     Commit pending transactions. Unlike the underlying commit(), this method does not throw SQLException or any other exception.
final public static  StringdbFlag(boolean flag)
     Return DB format of a boolean.
final public static  booleandbFlag(String flag)
     Return boolean value of DB flag, "Y" or "N".
public static  intgetActiveConnectionCount()
    
public static  ConnectiongetConnection()
     Gets a database connection to the portal database.
public static  ConnectiongetConnection(String dbName)
     Returns a connection produced by a DataSource found in the JNDI context.
public static  DataSourcegetDataSource()
     Gets the default DataSource.
public static  DataSourcegetDataSource(String name)
     Gets a named DataSource from JNDI, with special handling for the PORTAL_DB datasource.
public static  IDatabaseMetadatagetDbMetaData()
     Get metadata about the default DataSource.
public static  StringgetJdbcDriver()
     Returns the name of the JDBC driver being used for the default uPortal database connections.
public static  StringgetJdbcUrl()
     Gets the JDBC URL of the default uPortal database connections.
public static  StringgetJdbcUser()
     Get the username under which we are connecting for the default uPortal database connections.
public static  intgetMaxConnectionCount()
    
public static  booleanisGetDatasourceFromJndi()
    
public static  voidreleaseConnection(Connection con)
     Releases database connection. Unlike the underlying connection.close(), this method does not throw SQLException or any other exception.
final public static  voidrollback(Connection connection)
    
final public static  voidsetAutoCommit(Connection connection, boolean autocommit)
     Set auto commit state for the connection. Unlike the underlying connection.setAutoCommit(), this method does not throw SQLException or any other Exception.
public static  voidsetGetDatasourceFromJndi(boolean getDatasourceFromJndi)
    
final public static  StringsqlEscape(String sql)
    

Field Detail
BASE_JNDI_CONTEXT
final public static String BASE_JNDI_CONTEXT(Code)



DEFAULT_DATABASE
final public static String DEFAULT_DATABASE(Code)



PORTAL_DB
final public static String PORTAL_DB(Code)



lastDatabase
public static MovingAverageSample lastDatabase(Code)





Method Detail
closePreparedStatement
public static void closePreparedStatement(java.sql.PreparedStatement pst)(Code)
Close a PreparedStatement. Simply delegates the call to RDBMServices.closeStatement(Statement)
Parameters:
  pst - a database PreparedStatement objectRDBMServices.closeStatement(Statement)



closeResultSet
public static void closeResultSet(ResultSet rs)(Code)
Close a ResultSet
Parameters:
  rs - a database ResultSet object



closeStatement
public static void closeStatement(Statement st)(Code)
Close a Statement
Parameters:
  st - a database Statement object



commit
final public static void commit(Connection connection)(Code)
Commit pending transactions. Unlike the underlying commit(), this method does not throw SQLException or any other exception. It will fail silently from the perspective of calling code, logging any errors using Commons Logging.
Parameters:
  connection -



dbFlag
final public static String dbFlag(boolean flag)(Code)
Return DB format of a boolean. "Y" for true and "N" for false.
Parameters:
  flag - true or false either "Y" or "N"



dbFlag
final public static boolean dbFlag(String flag)(Code)
Return boolean value of DB flag, "Y" or "N".
Parameters:
  flag - either "Y" or "N" boolean true or false



getActiveConnectionCount
public static int getActiveConnectionCount()(Code)
Return the current number of active connections int



getConnection
public static Connection getConnection()(Code)
Gets a database connection to the portal database. If datasource not available a runtime exception is thrown a database Connection object
throws:
  DataAccessException - if unable to return a connection



getConnection
public static Connection getConnection(String dbName)(Code)
Returns a connection produced by a DataSource found in the JNDI context. The DataSource should be configured and loaded into JNDI by the J2EE container or may be the portal default database.
Parameters:
  dbName - the database name which will be retrieved fromthe JNDI context relative to "jdbc/" a database Connection object or null if no Connection



getDataSource
public static DataSource getDataSource()(Code)
Gets the default DataSource. If no server is found a runtime exception will be thrown. This method will never return null. the core uPortal DataSource
throws:
  RuntimeException - on failure



getDataSource
public static DataSource getDataSource(String name)(Code)
Gets a named DataSource from JNDI, with special handling for the PORTAL_DB datasource. Successful lookups are cached and not done again. Lookup failure is remembered and blocks retry for a number of milliseconds specified by RDBMServices.JNDI_RETRY_TIME to reduce JNDI overhead and log spam. There are two ways in which we handle the core uPortal DataSource specially. We determine and remember metadata in an DbMetaData object for the core uPortal DataSource. We do not compute this DbMetaData for any other DataSource. We fall back on using rdbm.properties to construct our core uPortal DataSource in the case where we cannot find it from JNDI. If the portal property org.jasig.portal.RDBMServices.getDatasourceFromJNDI is true, we first first try to get the connection by looking in the JNDI context for the name defined by the portal property org.jasig.portal.RDBMServices.PortalDatasourceJndiName . If we were not configured to check JNDI or we didn't find it in JNDI having checked, we then fall back on rdbm.properties.
Parameters:
  name - The name of the DataSource to get. A named DataSource or null if one cannot be found.



getDbMetaData
public static IDatabaseMetadata getDbMetaData()(Code)
Get metadata about the default DataSource. metadata about the default DataSource.



getJdbcDriver
public static String getJdbcDriver()(Code)
Returns the name of the JDBC driver being used for the default uPortal database connections. the name of the JDBC Driver.



getJdbcUrl
public static String getJdbcUrl()(Code)
Gets the JDBC URL of the default uPortal database connections.



getJdbcUser
public static String getJdbcUser()(Code)
Get the username under which we are connecting for the default uPortal database connections.



getMaxConnectionCount
public static int getMaxConnectionCount()(Code)
Return the maximum number of connections int



isGetDatasourceFromJndi
public static boolean isGetDatasourceFromJndi()(Code)
Returns the getDatasourceFromJndi.



releaseConnection
public static void releaseConnection(Connection con)(Code)
Releases database connection. Unlike the underlying connection.close(), this method does not throw SQLException or any other exception. It will fail silently from the perspective of calling code, logging errors using Commons Logging.
Parameters:
  con - a database Connection object



rollback
final public static void rollback(Connection connection) throws SQLException(Code)
rollback unwanted changes to the database
Parameters:
  connection -



setAutoCommit
final public static void setAutoCommit(Connection connection, boolean autocommit)(Code)
Set auto commit state for the connection. Unlike the underlying connection.setAutoCommit(), this method does not throw SQLException or any other Exception. It fails silently from the perspective of calling code, logging any errors encountered using Commons Logging.
Parameters:
  connection -
Parameters:
  autocommit -



setGetDatasourceFromJndi
public static void setGetDatasourceFromJndi(boolean getDatasourceFromJndi)(Code)

Parameters:
  getDatasourceFromJndi - The getDatasourceFromJndi to set.



sqlEscape
final public static String sqlEscape(String sql)(Code)
Make a string SQL safe
Parameters:
  sql - SQL safe string



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.