Java Doc for AbstractRoutingDataSource.java in  » J2EE » spring-framework-2.5 » org » springframework » jdbc » datasource » lookup » 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 » J2EE » spring framework 2.5 » org.springframework.jdbc.datasource.lookup 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.springframework.jdbc.datasource.AbstractDataSource
      org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource

All known Subclasses:   org.springframework.jdbc.datasource.lookup.IsolationLevelDataSourceRouter,
AbstractRoutingDataSource
abstract public class AbstractRoutingDataSource extends AbstractDataSource implements InitializingBean(Code)
Abstract DataSource implementation that routes AbstractRoutingDataSource.getConnection() calls to one of various target DataSources based on a lookup key. The latter is usually (but not necessarily) determined through some thread-bound transaction context.
author:
   Juergen Hoeller
since:
   2.0.1
See Also:   AbstractRoutingDataSource.setTargetDataSources
See Also:   AbstractRoutingDataSource.setDefaultTargetDataSource
See Also:   AbstractRoutingDataSource.determineCurrentLookupKey()




Method Summary
public  voidafterPropertiesSet()
    
abstract protected  ObjectdetermineCurrentLookupKey()
     Determine the current lookup key.
protected  DataSourcedetermineTargetDataSource()
     Retrieve the current target DataSource.
public  ConnectiongetConnection()
    
public  ConnectiongetConnection(String username, String password)
    
protected  DataSourceresolveSpecifiedDataSource(Object dataSource)
     Resolve the specified data source object into a DataSource instance.
protected  ObjectresolveSpecifiedLookupKey(Object lookupKey)
     Resolve the given lookup key object, as specified in the AbstractRoutingDataSource.setTargetDataSources targetDataSources map, into the actual lookup key to be used for matching with the AbstractRoutingDataSource.determineCurrentLookupKey() current lookup key .
public  voidsetDataSourceLookup(DataSourceLookup dataSourceLookup)
     Set the DataSourceLookup implementation to use for resolving data source name Strings in the AbstractRoutingDataSource.setTargetDataSources targetDataSources map.
public  voidsetDefaultTargetDataSource(Object defaultTargetDataSource)
     Specify the default target DataSource, if any.
public  voidsetTargetDataSources(Map targetDataSources)
     Specify the map of target DataSources, with the lookup key as key. The mapped value can either be a corresponding javax.sql.DataSource instance or a data source name String (to be resolved via a AbstractRoutingDataSource.setDataSourceLookup DataSourceLookup .

The key can be of arbitrary type; this class implements the generic lookup process only.




Method Detail
afterPropertiesSet
public void afterPropertiesSet()(Code)



determineCurrentLookupKey
abstract protected Object determineCurrentLookupKey()(Code)
Determine the current lookup key. This will typically be implemented to check a thread-bound transaction context.

Allows for arbitrary keys. The returned key needs to match the stored lookup key type, as resolved by the AbstractRoutingDataSource.resolveSpecifiedLookupKey method.




determineTargetDataSource
protected DataSource determineTargetDataSource()(Code)
Retrieve the current target DataSource. Determines the AbstractRoutingDataSource.determineCurrentLookupKey() current lookup key , performs a lookup in the AbstractRoutingDataSource.setTargetDataSources targetDataSources map, falls back to the specified AbstractRoutingDataSource.setDefaultTargetDataSource default target DataSource if necessary.
See Also:   AbstractRoutingDataSource.determineCurrentLookupKey()



getConnection
public Connection getConnection() throws SQLException(Code)



getConnection
public Connection getConnection(String username, String password) throws SQLException(Code)



resolveSpecifiedDataSource
protected DataSource resolveSpecifiedDataSource(Object dataSource) throws IllegalArgumentException(Code)
Resolve the specified data source object into a DataSource instance.

The default implementation handles DataSource instances and data source names (to be resolved via a AbstractRoutingDataSource.setDataSourceLookup DataSourceLookup ).
Parameters:
  dataSource - the data source value object as specified in theAbstractRoutingDataSource.setTargetDataSources targetDataSources map the resolved DataSource (never null)
throws:
  IllegalArgumentException - in case of an unsupported value type




resolveSpecifiedLookupKey
protected Object resolveSpecifiedLookupKey(Object lookupKey)(Code)
Resolve the given lookup key object, as specified in the AbstractRoutingDataSource.setTargetDataSources targetDataSources map, into the actual lookup key to be used for matching with the AbstractRoutingDataSource.determineCurrentLookupKey() current lookup key .

The default implementation simply returns the given key as-is.
Parameters:
  lookupKey - the lookup key object as specified by the user the lookup key as needed for matching




setDataSourceLookup
public void setDataSourceLookup(DataSourceLookup dataSourceLookup)(Code)
Set the DataSourceLookup implementation to use for resolving data source name Strings in the AbstractRoutingDataSource.setTargetDataSources targetDataSources map.

Default is a JndiDataSourceLookup , allowing the JNDI names of application server DataSources to be specified directly.




setDefaultTargetDataSource
public void setDefaultTargetDataSource(Object defaultTargetDataSource)(Code)
Specify the default target DataSource, if any. The mapped value can either be a corresponding javax.sql.DataSource instance or a data source name String (to be resolved via a AbstractRoutingDataSource.setDataSourceLookup DataSourceLookup .

This DataSource will be used as target if none of the keyed AbstractRoutingDataSource.setTargetDataSources targetDataSources match the AbstractRoutingDataSource.determineCurrentLookupKey() current lookup key}.




setTargetDataSources
public void setTargetDataSources(Map targetDataSources)(Code)
Specify the map of target DataSources, with the lookup key as key. The mapped value can either be a corresponding javax.sql.DataSource instance or a data source name String (to be resolved via a AbstractRoutingDataSource.setDataSourceLookup DataSourceLookup .

The key can be of arbitrary type; this class implements the generic lookup process only. The concrete key representation will be handled by AbstractRoutingDataSource.resolveSpecifiedLookupKey(Object) and AbstractRoutingDataSource.determineCurrentLookupKey() .




Fields inherited from org.springframework.jdbc.datasource.AbstractDataSource
final protected Log logger(Code)(Java Doc)

Methods inherited from org.springframework.jdbc.datasource.AbstractDataSource
public PrintWriter getLogWriter()(Code)(Java Doc)
public int getLoginTimeout() throws SQLException(Code)(Java Doc)
public boolean isWrapperFor(Class iface) throws SQLException(Code)(Java Doc)
public void setLogWriter(PrintWriter pw) throws SQLException(Code)(Java Doc)
public void setLoginTimeout(int timeout) throws SQLException(Code)(Java Doc)
public Object unwrap(Class iface) throws SQLException(Code)(Java Doc)

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.