Java Doc for DefaultPersistenceUnitManager.java in  » J2EE » spring-framework-2.0.6 » org » springframework » orm » jpa » persistenceunit » 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.0.6 » org.springframework.orm.jpa.persistenceunit 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager

DefaultPersistenceUnitManager
public class DefaultPersistenceUnitManager implements PersistenceUnitManager,ResourceLoaderAware,InitializingBean(Code)
Default implementation of the PersistenceUnitManager interface. Used as internal default by org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean .

Supports standard JPA scanning for persistence.xml files, with configurable file locations, JDBC DataSource lookup and load-time weaving.

The default XML file location is classpath:META-INF/persistence.xml, scanning for all matching files in the class path (as defined in the JPA specification). DataSource names are by default interpreted as JNDI names, and no load time weaving is available (which requires weaving to be turned off in the persistence provider).
author:
   Juergen Hoeller
since:
   2.0
See Also:   DefaultPersistenceUnitManager.setPersistenceXmlLocations
See Also:   DefaultPersistenceUnitManager.setDataSourceLookup
See Also:   DefaultPersistenceUnitManager.setLoadTimeWeaver
See Also:   org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.setPersistenceUnitManager



Field Summary
final public static  StringDEFAULT_PERSISTENCE_XML_LOCATION
     Default location of the persistence.xml file: "classpath*:META-INF/persistence.xml".
final public static  StringORIGINAL_DEFAULT_PERSISTENCE_UNIT_ROOT_LOCATION
     Default location for the persistence unit root URL: "classpath:", indicating the root of the class path.


Method Summary
public  voidafterPropertiesSet()
    
public  DataSourceLookupgetDataSourceLookup()
     Return the JDBC DataSourceLookup that provides DataSources for the persistence provider, resolving data source names in persistence.xml against Spring-managed DataSource instances.
public  DataSourcegetDefaultDataSource()
     Return the JDBC DataSource that the JPA persistence provider is supposed to use for accessing the database if none has been specified in persistence.xml.
public  LoadTimeWeavergetLoadTimeWeaver()
     Return the Spring LoadTimeWeaver to use for class instrumentation according to the JPA class transformer contract.
final protected  MutablePersistenceUnitInfogetPersistenceUnitInfo(String persistenceUnitName)
     Return the specified PersistenceUnitInfo from this manager's cache of processed persistence units, keeping it in the cache (i.e.
public  PersistenceUnitPostProcessor[]getPersistenceUnitPostProcessors()
     Return the PersistenceUnitPostProcessors to be applied to each PersistenceUnitInfo that has been parsed by this manager.
public  PersistenceUnitInfoobtainDefaultPersistenceUnitInfo()
    
public  PersistenceUnitInfoobtainPersistenceUnitInfo(String persistenceUnitName)
    
protected  voidpostProcessPersistenceUnitInfo(MutablePersistenceUnitInfo pui)
     Hook method allowing subclasses to customize each PersistenceUnitInfo.
public  voidpreparePersistenceUnitInfos()
     Prepare the PersistenceUnitInfos according to the configuration of this manager: scanning for persistence.xml files, parsing all matching files, configurating and post-processing them.
public  voidsetDataSourceLookup(DataSourceLookup dataSourceLookup)
     Specify the JDBC DataSourceLookup that provides DataSources for the persistence provider, resolving data source names in persistence.xml against Spring-managed DataSource instances.

Default is JndiDataSourceLookup, which resolves DataSource names as JNDI names (as defined by standard JPA).

public  voidsetDataSources(Map<String, DataSource> dataSources)
     Specify the JDBC DataSources that the JPA persistence provider is supposed to use for accessing the database, resolving data source names in persistence.xml against Spring-managed DataSources.
public  voidsetDefaultDataSource(DataSource defaultDataSource)
     Specify the JDBC DataSource that the JPA persistence provider is supposed to use for accessing the database if none has been specified in persistence.xml.
public  voidsetDefaultPersistenceUnitRootLocation(String defaultPersistenceUnitRootLocation)
     Set the default persistence unit root location, to be applied if no unit-specific persistence unit root could be determined.

Default is "classpath:", that is, the root of the current class path (nearest root directory).

public  voidsetLoadTimeWeaver(LoadTimeWeaver loadTimeWeaver)
     Specify the Spring LoadTimeWeaver to use for class instrumentation according to the JPA class transformer contract.
public  voidsetPersistenceUnitPostProcessors(PersistenceUnitPostProcessor[] postProcessors)
     Set the PersistenceUnitPostProcessors to be applied to each PersistenceUnitInfo that has been parsed by this manager.
public  voidsetPersistenceXmlLocations(String[] persistenceXmlLocations)
     Set the locations of the persistence.xml files to load.
public  voidsetResourceLoader(ResourceLoader resourceLoader)
    

Field Detail
DEFAULT_PERSISTENCE_XML_LOCATION
final public static String DEFAULT_PERSISTENCE_XML_LOCATION(Code)
Default location of the persistence.xml file: "classpath*:META-INF/persistence.xml".



ORIGINAL_DEFAULT_PERSISTENCE_UNIT_ROOT_LOCATION
final public static String ORIGINAL_DEFAULT_PERSISTENCE_UNIT_ROOT_LOCATION(Code)
Default location for the persistence unit root URL: "classpath:", indicating the root of the class path.





Method Detail
afterPropertiesSet
public void afterPropertiesSet()(Code)



getDataSourceLookup
public DataSourceLookup getDataSourceLookup()(Code)
Return the JDBC DataSourceLookup that provides DataSources for the persistence provider, resolving data source names in persistence.xml against Spring-managed DataSource instances.



getDefaultDataSource
public DataSource getDefaultDataSource()(Code)
Return the JDBC DataSource that the JPA persistence provider is supposed to use for accessing the database if none has been specified in persistence.xml.



getLoadTimeWeaver
public LoadTimeWeaver getLoadTimeWeaver()(Code)
Return the Spring LoadTimeWeaver to use for class instrumentation according to the JPA class transformer contract.



getPersistenceUnitInfo
final protected MutablePersistenceUnitInfo getPersistenceUnitInfo(String persistenceUnitName)(Code)
Return the specified PersistenceUnitInfo from this manager's cache of processed persistence units, keeping it in the cache (i.e. not 'obtaining' it for use but rather just accessing it for post-processing).

This can be used in DefaultPersistenceUnitManager.postProcessPersistenceUnitInfo implementations, detecting existing persistence units of the same name and potentially merging them.
Parameters:
  persistenceUnitName - the name of the desired persistence unit the PersistenceUnitInfo in mutable form,or null if not available




getPersistenceUnitPostProcessors
public PersistenceUnitPostProcessor[] getPersistenceUnitPostProcessors()(Code)
Return the PersistenceUnitPostProcessors to be applied to each PersistenceUnitInfo that has been parsed by this manager.



obtainDefaultPersistenceUnitInfo
public PersistenceUnitInfo obtainDefaultPersistenceUnitInfo()(Code)



obtainPersistenceUnitInfo
public PersistenceUnitInfo obtainPersistenceUnitInfo(String persistenceUnitName)(Code)



postProcessPersistenceUnitInfo
protected void postProcessPersistenceUnitInfo(MutablePersistenceUnitInfo pui)(Code)
Hook method allowing subclasses to customize each PersistenceUnitInfo.

Default implementation delegates to all registered PersistenceUnitPostProcessors. It is usually preferable to register further entity classes, jar files etc there rather than in a subclass of this manager, to be able to reuse the post-processors.
Parameters:
  pui - the chosen PersistenceUnitInfo, as read from persistence.xml.Passed in as MutablePersistenceUnitInfo.
See Also:   DefaultPersistenceUnitManager.setPersistenceUnitPostProcessors




preparePersistenceUnitInfos
public void preparePersistenceUnitInfos()(Code)
Prepare the PersistenceUnitInfos according to the configuration of this manager: scanning for persistence.xml files, parsing all matching files, configurating and post-processing them.

PersistenceUnitInfos cannot be obtained before this preparation method has been invoked.
See Also:   DefaultPersistenceUnitManager.obtainDefaultPersistenceUnitInfo()
See Also:   DefaultPersistenceUnitManager.obtainPersistenceUnitInfo(String)




setDataSourceLookup
public void setDataSourceLookup(DataSourceLookup dataSourceLookup)(Code)
Specify the JDBC DataSourceLookup that provides DataSources for the persistence provider, resolving data source names in persistence.xml against Spring-managed DataSource instances.

Default is JndiDataSourceLookup, which resolves DataSource names as JNDI names (as defined by standard JPA). Specify a BeanFactoryDataSourceLookup instance if you want DataSource names to be resolved against Spring bean names.

Alternatively, consider passing in a map from names to DataSource instances via the "dataSources" property. If the persistence.xml file does not define DataSource names at all, specify a default DataSource via the "defaultDataSource" property.
See Also:   org.springframework.jdbc.datasource.lookup.JndiDataSourceLookup
See Also:   org.springframework.jdbc.datasource.lookup.BeanFactoryDataSourceLookup
See Also:   DefaultPersistenceUnitManager.setDataSources
See Also:   DefaultPersistenceUnitManager.setDefaultDataSource




setDataSources
public void setDataSources(Map<String, DataSource> dataSources)(Code)
Specify the JDBC DataSources that the JPA persistence provider is supposed to use for accessing the database, resolving data source names in persistence.xml against Spring-managed DataSources.

The specified Map needs to define data source names for specific DataSource objects, matching the data source names used in persistence.xml. If not specified, data source names will be resolved as JNDI names instead (as defined by standard JPA).
See Also:   org.springframework.jdbc.datasource.lookup.MapDataSourceLookup




setDefaultDataSource
public void setDefaultDataSource(DataSource defaultDataSource)(Code)
Specify the JDBC DataSource that the JPA persistence provider is supposed to use for accessing the database if none has been specified in persistence.xml.

In JPA speak, a DataSource passed in here will be uses as "nonJtaDataSource" on the PersistenceUnitInfo passed to the PersistenceProvider, provided that none has been registered before.
See Also:   javax.persistence.spi.PersistenceUnitInfo.getNonJtaDataSource




setDefaultPersistenceUnitRootLocation
public void setDefaultPersistenceUnitRootLocation(String defaultPersistenceUnitRootLocation)(Code)
Set the default persistence unit root location, to be applied if no unit-specific persistence unit root could be determined.

Default is "classpath:", that is, the root of the current class path (nearest root directory). To be overridden if unit-specific resolution does not work and the class path root is not appropriate either.




setLoadTimeWeaver
public void setLoadTimeWeaver(LoadTimeWeaver loadTimeWeaver)(Code)
Specify the Spring LoadTimeWeaver to use for class instrumentation according to the JPA class transformer contract.

It is not required to specify a LoadTimeWeaver: Most providers will be able to provide a subset of their functionality without class instrumentation as well, or operate with their VM agent specified on JVM startup.

In terms of Spring-provided weaving options, the most important ones are InstrumentationLoadTimeWeaver, which requires a Spring-specific (but very general) VM agent specified on JVM startup, and ReflectiveLoadTimeWeaver, which interacts with an underlying ClassLoader based on specific extended methods being available on it (for example, interacting with Spring's TomcatInstrumentableClassLoader).
See Also:   org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver
See Also:   org.springframework.instrument.classloading.ReflectiveLoadTimeWeaver
See Also:   org.springframework.instrument.classloading.tomcat.TomcatInstrumentableClassLoader




setPersistenceUnitPostProcessors
public void setPersistenceUnitPostProcessors(PersistenceUnitPostProcessor[] postProcessors)(Code)
Set the PersistenceUnitPostProcessors to be applied to each PersistenceUnitInfo that has been parsed by this manager.

Such post-processors can, for example, register further entity classes and jar files, in addition to the metadata read in from persistence.xml.




setPersistenceXmlLocations
public void setPersistenceXmlLocations(String[] persistenceXmlLocations)(Code)
Set the locations of the persistence.xml files to load. These can be specified as Spring resource locations and/or location patterns.

Default is "classpath*:META-INF/persistence.xml".
Parameters:
  persistenceXmlLocations - an array of Spring resource Stringsidentifying the location of the persistence.xml files to read




setResourceLoader
public void setResourceLoader(ResourceLoader resourceLoader)(Code)



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.