org.apache.cayenne.jpa
Class JpaUnit

java.lang.Object
  extended by org.apache.cayenne.jpa.JpaUnit
Direct Known Subclasses:
InstrumentingUnit

public abstract class JpaUnit
extends Object

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

Author:
Andrus Adamchik

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(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()
           
 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()

getPersistenceProviderClassName

public String getPersistenceProviderClassName()

addTransformer

public abstract void addTransformer(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.

Parameters:
transformer - A provider-supplied transformer that the Container invokes at class-(re)definition time

getTransactionType

public PersistenceUnitTransactionType getTransactionType()

getJtaDataSource

public DataSource getJtaDataSource()

getNonJtaDataSource

public DataSource getNonJtaDataSource()

getMappingFileNames

public List<String> getMappingFileNames()

getJarFileUrls

public List<URL> getJarFileUrls()

getPersistenceUnitRootUrl

public URL getPersistenceUnitRootUrl()

getManagedClassNames

public List<String> getManagedClassNames()

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.


getProperties

public Properties getProperties()

getClassLoader

public ClassLoader getClassLoader()

getNewTempClassLoader

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


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-2007 Apache Cayenne. All Rights Reserved.