com.caucho.amber.cfg
Class PersistenceUnitConfig

java.lang.Object
  extended by com.caucho.amber.cfg.PersistenceUnitConfig
All Implemented Interfaces:
PersistenceUnitInfo

public class PersistenceUnitConfig
extends java.lang.Object
implements PersistenceUnitInfo

tag in the persistence.xml


Nested Class Summary
 class PersistenceUnitConfig.PropertiesConfig
           
static class PersistenceUnitConfig.PropertyConfig
           
static class PersistenceUnitConfig.TransformerAdapter
           
 
Constructor Summary
PersistenceUnitConfig(AmberContainer manager, java.net.URL rootUrl)
           
 
Method Summary
 void addAllClasses(java.util.Map<java.lang.String,java.lang.Class> classMap)
          Adds a map of configured classes.
 void addClass(java.lang.String cl)
          Adds a configured class.
 void addJarFile(java.lang.String fileName)
          Sets the jars with classes.
 void addMappingFile(java.lang.String fileName)
          Sets the mapping file.
 void addTransformer(ClassTransformer transformer)
          Adds a class transformer.
 PersistenceUnitConfig.PropertiesConfig createProperties()
          Adds the properties.
 boolean excludeUnlistedClasses()
          Returns true if only listed classes are allowed.
 java.lang.ClassLoader getClassLoader()
          Returns the classloader the provider should use to load classes, resources or URLs.
 java.util.ArrayList<java.lang.String> getJarFiles()
          Returns the jars with classes.
 java.util.List<java.net.URL> getJarFileUrls()
          Returns the list of jars for the managed classes.
 javax.sql.DataSource getJtaDataSource()
          Gets the transactional data source.
 java.lang.String getJtaDataSourceName()
          Gets the transactional data source.
 java.util.List<java.lang.String> getManagedClassNames()
          Returns the list of managed classes.
 java.util.List<java.lang.String> getMappingFileNames()
          Returns the mapping file names.
 java.util.ArrayList<java.lang.String> getMappingFiles()
          Returns the mapping files.
 java.lang.String getName()
          Returns the unit name.
 java.lang.ClassLoader getNewTempClassLoader()
          Returns a temporary class loader.
 javax.sql.DataSource getNonJtaDataSource()
          Sets the non-transactional data source.
 java.lang.String getPersistenceProviderClassName()
          Sets the provider class name.
 java.lang.String getPersistenceUnitName()
          Returns the name.
 java.net.URL getPersistenceUnitRootUrl()
          Returns the root persistence unit.
 java.util.Properties getProperties()
          Returns a properties object.
 java.lang.Class getProvider()
          Sets the provider class name.
 PersistenceUnitTransactionType getTransactionType()
          Returns the transaction handling.
 void init()
           
 AmberPersistenceUnit init(AmberContainer container, java.util.ArrayList<EntityMappingsConfig> entityMappings)
           
 boolean isExcludeUnlistedClasses()
          Returns true if only listed classes should be used.
protected  javax.sql.DataSource loadDataSource(java.lang.String name)
           
 void setDescription(java.lang.String description)
          Sets the description.
 void setExcludeUnlistedClasses(boolean isExclude)
          Sets true if only listed classes should be used.
 void setJtaDataSource(java.lang.String ds)
          Sets the transactional data source.
 void setName(java.lang.String name)
          Sets the unit name.
 void setNonJtaDataSource(java.lang.String ds)
          Sets the non-transactional data source.
 void setProvider(java.lang.Class provider)
          Sets the provider class name.
 void setTransactionType(java.lang.String type)
          Sets the transaction type.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PersistenceUnitConfig

public PersistenceUnitConfig(AmberContainer manager,
                             java.net.URL rootUrl)
Method Detail

getName

public java.lang.String getName()
Returns the unit name.


setName

public void setName(java.lang.String name)
Sets the unit name.


setTransactionType

public void setTransactionType(java.lang.String type)
Sets the transaction type.


setDescription

public void setDescription(java.lang.String description)
Sets the description.


setProvider

public void setProvider(java.lang.Class provider)
Sets the provider class name.


getProvider

public java.lang.Class getProvider()
Sets the provider class name.


getPersistenceProviderClassName

public java.lang.String getPersistenceProviderClassName()
Sets the provider class name.

Specified by:
getPersistenceProviderClassName in interface PersistenceUnitInfo

setJtaDataSource

public void setJtaDataSource(java.lang.String ds)
Sets the transactional data source.


getJtaDataSource

public javax.sql.DataSource getJtaDataSource()
Gets the transactional data source.

Specified by:
getJtaDataSource in interface PersistenceUnitInfo

getJtaDataSourceName

public java.lang.String getJtaDataSourceName()
Gets the transactional data source.


setNonJtaDataSource

public void setNonJtaDataSource(java.lang.String ds)
Sets the non-transactional data source.


getNonJtaDataSource

public javax.sql.DataSource getNonJtaDataSource()
Sets the non-transactional data source.

Specified by:
getNonJtaDataSource in interface PersistenceUnitInfo

addMappingFile

public void addMappingFile(java.lang.String fileName)
Sets the mapping file.


getMappingFiles

public java.util.ArrayList<java.lang.String> getMappingFiles()
Returns the mapping files.


addJarFile

public void addJarFile(java.lang.String fileName)
Sets the jars with classes.


getJarFiles

public java.util.ArrayList<java.lang.String> getJarFiles()
Returns the jars with classes.


addClass

public void addClass(java.lang.String cl)
Adds a configured class.


addAllClasses

public void addAllClasses(java.util.Map<java.lang.String,java.lang.Class> classMap)
Adds a map of configured classes.


isExcludeUnlistedClasses

public boolean isExcludeUnlistedClasses()
Returns true if only listed classes should be used.


setExcludeUnlistedClasses

public void setExcludeUnlistedClasses(boolean isExclude)
Sets true if only listed classes should be used.


createProperties

public PersistenceUnitConfig.PropertiesConfig createProperties()
Adds the properties.


init

public void init()

init

public AmberPersistenceUnit init(AmberContainer container,
                                 java.util.ArrayList<EntityMappingsConfig> entityMappings)
                          throws java.lang.Exception
Throws:
java.lang.Exception

getPersistenceUnitName

public java.lang.String getPersistenceUnitName()
Returns the name.

Specified by:
getPersistenceUnitName in interface PersistenceUnitInfo

getTransactionType

public PersistenceUnitTransactionType getTransactionType()
Returns the transaction handling.

Specified by:
getTransactionType in interface PersistenceUnitInfo

getMappingFileNames

public java.util.List<java.lang.String> getMappingFileNames()
Returns the mapping file names. The files are resource-loadable from the classpath.

Specified by:
getMappingFileNames in interface PersistenceUnitInfo

getJarFileUrls

public java.util.List<java.net.URL> getJarFileUrls()
Returns the list of jars for the managed classes.

Specified by:
getJarFileUrls in interface PersistenceUnitInfo

getPersistenceUnitRootUrl

public java.net.URL getPersistenceUnitRootUrl()
Returns the root persistence unit.

Specified by:
getPersistenceUnitRootUrl in interface PersistenceUnitInfo

getManagedClassNames

public java.util.List<java.lang.String> getManagedClassNames()
Returns the list of managed classes.

Specified by:
getManagedClassNames in interface PersistenceUnitInfo

excludeUnlistedClasses

public boolean excludeUnlistedClasses()
Returns true if only listed classes are allowed.

Specified by:
excludeUnlistedClasses in interface PersistenceUnitInfo

getProperties

public java.util.Properties getProperties()
Returns a properties object.

Specified by:
getProperties in interface PersistenceUnitInfo

getClassLoader

public java.lang.ClassLoader getClassLoader()
Returns the classloader the provider should use to load classes, resources or URLs.

Specified by:
getClassLoader in interface PersistenceUnitInfo

addTransformer

public void addTransformer(ClassTransformer transformer)
Adds a class transformer.

Specified by:
addTransformer in interface PersistenceUnitInfo

getNewTempClassLoader

public java.lang.ClassLoader getNewTempClassLoader()
Returns a temporary class loader.

Specified by:
getNewTempClassLoader in interface PersistenceUnitInfo

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

loadDataSource

protected javax.sql.DataSource loadDataSource(java.lang.String name)