org.apache.cayenne.jpa
Class JpaUnit

java.lang.Object
  extended by org.apache.cayenne.jpa.JpaUnit
All Implemented Interfaces:
javax.persistence.spi.PersistenceUnitInfo
Direct Known Subclasses:
InstrumentingUnit

public abstract class JpaUnit
extends Object
implements javax.persistence.spi.PersistenceUnitInfo

A javax.persistence.spi.PersistenceUnitInfo implementor used by Cayenne JPA provider.


Field Summary
protected  ClassLoader classLoader
           
protected  String description
           
protected  boolean excludeUnlistedClasses
           
protected  List<URL> jarFileUrls
           
protected  List<String> managedClassNames
           
protected  List<String> mappingFileNames
           
protected  String persistenceUnitName
           
protected  URL persistenceUnitRootUrl
           
protected  Properties properties
           
 
Constructor Summary
JpaUnit()
           
 
Method Summary
 void addJarFileUrl(String jarName)
           
 void addManagedClassName(String managedClassName)
           
 void addMappingFileName(String mappingFileName)
           
 void addProperties(Map<?,?> properties)
           
abstract  void addTransformer(javax.persistence.spi.ClassTransformer transformer)
          Adds a ClassTransformer to the persistence unit.
 boolean excludeUnlistedClasses()
          Returns whether classes not listed in the persistence.xml descriptor file should be excluded from persistence unit.
 ClassLoader getClassLoader()
           
 String getDescription()
           
 List<URL> getJarFileUrls()
           
 DataSource getJtaDataSource()
           
 List<String> getManagedClassNames()
           
 List<String> getMappingFileNames()
           
 ClassLoader getNewTempClassLoader()
          Creates and returns a child of the main unit ClassLoader.
 DataSource getNonJtaDataSource()
           
 String getPersistenceProviderClassName()
           
 String getPersistenceUnitName()
           
 URL getPersistenceUnitRootUrl()
           
 Properties getProperties()
           
 javax.persistence.spi.PersistenceUnitTransactionType getTransactionType()
           
 void putProperty(String key, String value)
           
 void setClassLoader(ClassLoader classLoader)
          Sets new "main" ClassLoader of this unit.
protected  void setDefaultClassLoader()
           
 void setDescription(String description)
           
 void setExcludeUnlistedClasses(boolean excludeUnlistedClasses)
           
 void setPersistenceUnitName(String persistenceUnitName)
           
 void setPersistenceUnitRootUrl(URL persistenceUnitRootUrl)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

persistenceUnitName

protected String persistenceUnitName

mappingFileNames

protected List<String> mappingFileNames

jarFileUrls

protected List<URL> jarFileUrls

managedClassNames

protected List<String> managedClassNames

persistenceUnitRootUrl

protected URL persistenceUnitRootUrl

excludeUnlistedClasses

protected boolean excludeUnlistedClasses

properties

protected Properties properties

description

protected String description

classLoader

protected ClassLoader classLoader
Constructor Detail

JpaUnit

public JpaUnit()
Method Detail

getPersistenceUnitName

public String getPersistenceUnitName()
Specified by:
getPersistenceUnitName in interface javax.persistence.spi.PersistenceUnitInfo

getPersistenceProviderClassName

public String getPersistenceProviderClassName()
Specified by:
getPersistenceProviderClassName in interface javax.persistence.spi.PersistenceUnitInfo

addTransformer

public abstract void addTransformer(javax.persistence.spi.ClassTransformer transformer)
Adds a ClassTransformer to the persistence unit.

JPA Specification, 7.1.4:

Add a transformer supplied by the provider that will be called for every new class definition or class redefinition that gets loaded by the loader returned by the PersistenceInfo.getClassLoader method. The transformer has no effect on the result returned by the PersistenceInfo.getTempClassLoader method. Classes are only transformed once within the same classloading scope, regardless of how many persistence units they may be a part of.

Specified by:
addTransformer in interface javax.persistence.spi.PersistenceUnitInfo
Parameters:
transformer - A provider-supplied transformer that the Container invokes at class-(re)definition time

getTransactionType

public javax.persistence.spi.PersistenceUnitTransactionType getTransactionType()
Specified by:
getTransactionType in interface javax.persistence.spi.PersistenceUnitInfo

getJtaDataSource

public DataSource getJtaDataSource()
Specified by:
getJtaDataSource in interface javax.persistence.spi.PersistenceUnitInfo

getNonJtaDataSource

public DataSource getNonJtaDataSource()
Specified by:
getNonJtaDataSource in interface javax.persistence.spi.PersistenceUnitInfo

getMappingFileNames

public List<String> getMappingFileNames()
Specified by:
getMappingFileNames in interface javax.persistence.spi.PersistenceUnitInfo

getJarFileUrls

public List<URL> getJarFileUrls()
Specified by:
getJarFileUrls in interface javax.persistence.spi.PersistenceUnitInfo

getPersistenceUnitRootUrl

public URL getPersistenceUnitRootUrl()
Specified by:
getPersistenceUnitRootUrl in interface javax.persistence.spi.PersistenceUnitInfo

getManagedClassNames

public List<String> getManagedClassNames()
Specified by:
getManagedClassNames in interface javax.persistence.spi.PersistenceUnitInfo

excludeUnlistedClasses

public boolean excludeUnlistedClasses()
Returns whether classes not listed in the persistence.xml descriptor file should be excluded from persistence unit. Should be ignored in J2SE environment.

Specified by:
excludeUnlistedClasses in interface javax.persistence.spi.PersistenceUnitInfo

getProperties

public Properties getProperties()
Specified by:
getProperties in interface javax.persistence.spi.PersistenceUnitInfo

getClassLoader

public ClassLoader getClassLoader()
Specified by:
getClassLoader in interface javax.persistence.spi.PersistenceUnitInfo

getNewTempClassLoader

public ClassLoader getNewTempClassLoader()
Creates and returns a child of the main unit ClassLoader.

Specified by:
getNewTempClassLoader in interface javax.persistence.spi.PersistenceUnitInfo

setExcludeUnlistedClasses

public void setExcludeUnlistedClasses(boolean excludeUnlistedClasses)

addJarFileUrl

public void addJarFileUrl(String jarName)

setPersistenceUnitName

public void setPersistenceUnitName(String persistenceUnitName)

setClassLoader

public void setClassLoader(ClassLoader classLoader)
Sets new "main" ClassLoader of this unit.


setDefaultClassLoader

protected void setDefaultClassLoader()

addManagedClassName

public void addManagedClassName(String managedClassName)

addMappingFileName

public void addMappingFileName(String mappingFileName)

setPersistenceUnitRootUrl

public void setPersistenceUnitRootUrl(URL persistenceUnitRootUrl)

addProperties

public void addProperties(Map<?,?> properties)

putProperty

public void putProperty(String key,
                        String value)

getDescription

public String getDescription()

setDescription

public void setDescription(String description)


Copyright © 2001-2008 Apache Cayenne. All Rights Reserved.