public class AmberContainer extends java.lang.Object implements ScanListener, EnvironmentListener
Modifier and Type | Method and Description |
---|---|
void |
addDefaultListener(java.lang.String className,
ListenerType type)
Adds a default listener.
|
void |
addEmbeddable(java.lang.String className,
EmbeddableType type)
Adds an embeddable for an introspected class.
|
void |
addEntity(java.lang.String className,
EntityType type)
Adds an entity for an introspected class.
|
void |
addEntityException(java.lang.String className,
java.lang.Throwable e)
Adds an entity for an introspected class.
|
void |
addEntityListener(java.lang.String entityClassName,
ListenerType listenerType)
Adds an entity listener.
|
void |
addException(java.lang.Throwable e)
Adds an entity for an introspected class.
|
void |
addMappedSuperclass(java.lang.String className,
MappedSuperclassType type)
Adds a mapped superclass for an introspected class.
|
void |
addPersistenceUnit(Path root)
Adds a persistence root.
|
void |
addPersistenceUnitDefault(ConfigProgram program)
Adds a persistence-unit default
|
void |
addPersistenceUnitProxy(java.lang.String name,
java.util.ArrayList<ConfigProgram> program)
Adds a persistence-unit default
|
void |
classMatchEvent(EnvironmentClassLoader loader,
Path root,
java.lang.String className)
Callback to note the class matches
|
static AmberContainer |
create()
Returns the local container.
|
static AmberContainer |
create(java.lang.ClassLoader loader)
Returns the local container.
|
EntityManagerFactory |
createEntityManagerFactory(PersistenceUnitInfo info) |
AmberPersistenceUnit |
createPersistenceUnit(java.lang.String name) |
void |
environmentBind(EnvironmentClassLoader loader)
Handles the environment config phase
|
void |
environmentConfigure(EnvironmentClassLoader loader)
Handles the environment config phase
|
void |
environmentStart(EnvironmentClassLoader loader)
Handles the case where the environment is starting (after init).
|
void |
environmentStop(EnvironmentClassLoader loader)
Handles the case where the environment is stopping
|
java.lang.Throwable |
getConfigException() |
boolean |
getCreateDatabaseTables()
True if database tables should be created automatically.
|
static AmberContainer |
getCurrent()
Returns the local container.
|
static AmberContainer |
getCurrent(java.lang.ClassLoader loader)
Returns the current environment container.
|
javax.sql.DataSource |
getDataSource()
Gets the primary data source.
|
ListenerType |
getDefaultListener(java.lang.String className)
Returns the default ListenerType for an introspected class.
|
EmbeddableType |
getEmbeddable(java.lang.String className)
Returns the EmbeddableType for an introspected class.
|
java.lang.ClassLoader |
getEnhancedLoader()
Returns the parent loader
|
EntityType |
getEntity(java.lang.String className)
Returns the EntityType for an introspected class.
|
ListenerType |
getEntityListener(java.lang.String className)
Returns the entity ListenerType for an introspected class.
|
java.util.ArrayList<ListenerType> |
getEntityListeners(java.lang.String entityClassName)
Returns the entity listeners for an entity.
|
EntityManagerFactory |
getEntityManagerFactory(java.lang.String name) |
EntityManager |
getExtendedPersistenceContext(java.lang.String name) |
AmberGenerator |
getGenerator()
Returns the enhancer.
|
ListenerType |
getListener(java.lang.String className)
Returns the listener for an introspected class.
|
MappedSuperclassType |
getMappedSuperclass(java.lang.String className)
Returns the MappedSuperclassType for an introspected class.
|
java.lang.ClassLoader |
getParentClassLoader()
Returns the parent loader
|
EntityManager |
getPersistenceContext(java.lang.String name) |
static java.lang.String |
getPersistenceContextJndiPrefix()
Returns the persistence unit JNDI context.
|
AmberPersistenceUnit |
getPersistenceUnit(java.lang.String name) |
java.util.ArrayList<ConfigProgram> |
getPersistenceUnitDefaultList()
Returns the persistence-unit default list.
|
static java.lang.String |
getPersistenceUnitJndiPrefix()
Returns the persistence unit JNDI context.
|
java.util.ArrayList<ConfigProgram> |
getProxyProgram(java.lang.String name) |
javax.sql.DataSource |
getReadDataSource()
Gets the read data source.
|
int |
getScanPriority()
Since Amber enhances it's priority 0
|
java.lang.ClassLoader |
getTempClassLoader()
Returns the JClassLoader.
|
javax.sql.DataSource |
getXADataSource()
Gets the XA data source.
|
void |
init() |
void |
initEntityHomes()
Initialize the entity homes.
|
boolean |
isRootScannable(Path root,
java.lang.String packageRoot)
Returns true if the root is a valid scannable root.
|
boolean |
isScanMatchAnnotation(CharBuffer annotationName)
Returns true if the string matches an annotation class.
|
java.lang.Class |
loadTempClass(java.lang.String name) |
ScanClass |
scanClass(Path root,
java.lang.String packageRoot,
java.lang.String className,
int modifiers)
Returns the state when scanning the class
|
void |
setCreateDatabaseTables(boolean isCreate)
True if database tables should be created automatically.
|
void |
setDataSource(javax.sql.DataSource dataSource)
Sets the primary data source.
|
void |
setReadDataSource(javax.sql.DataSource dataSource)
Sets the read data source.
|
void |
setXADataSource(javax.sql.DataSource dataSource)
Sets the xa data source.
|
void |
start() |
void |
startPersistenceUnits()
Adds the URLs for the classpath.
|
java.lang.String |
toString() |
public static AmberContainer create()
public static AmberContainer create(java.lang.ClassLoader loader)
public static AmberContainer getCurrent()
public static AmberContainer getCurrent(java.lang.ClassLoader loader)
public void setDataSource(javax.sql.DataSource dataSource)
public javax.sql.DataSource getDataSource()
public void setReadDataSource(javax.sql.DataSource dataSource)
public javax.sql.DataSource getReadDataSource()
public void setXADataSource(javax.sql.DataSource dataSource)
public javax.sql.DataSource getXADataSource()
public boolean getCreateDatabaseTables()
public void setCreateDatabaseTables(boolean isCreate)
public java.lang.ClassLoader getParentClassLoader()
public java.lang.ClassLoader getEnhancedLoader()
public AmberGenerator getGenerator()
public static java.lang.String getPersistenceUnitJndiPrefix()
public void addPersistenceUnitDefault(ConfigProgram program)
public java.util.ArrayList<ConfigProgram> getPersistenceUnitDefaultList()
public void addPersistenceUnitProxy(java.lang.String name, java.util.ArrayList<ConfigProgram> program)
public java.util.ArrayList<ConfigProgram> getProxyProgram(java.lang.String name)
public static java.lang.String getPersistenceContextJndiPrefix()
public java.lang.ClassLoader getTempClassLoader()
public java.lang.Class loadTempClass(java.lang.String name) throws java.lang.ClassNotFoundException
java.lang.ClassNotFoundException
public void init()
public EmbeddableType getEmbeddable(java.lang.String className)
public EntityType getEntity(java.lang.String className)
public MappedSuperclassType getMappedSuperclass(java.lang.String className)
public ListenerType getDefaultListener(java.lang.String className)
public ListenerType getEntityListener(java.lang.String className)
public ListenerType getListener(java.lang.String className)
public java.util.ArrayList<ListenerType> getEntityListeners(java.lang.String entityClassName)
public void addEntityException(java.lang.String className, java.lang.Throwable e)
public void addException(java.lang.Throwable e)
public java.lang.Throwable getConfigException()
public void addEmbeddable(java.lang.String className, EmbeddableType type)
public void addEntity(java.lang.String className, EntityType type)
public void addMappedSuperclass(java.lang.String className, MappedSuperclassType type)
public void addDefaultListener(java.lang.String className, ListenerType type)
public void addEntityListener(java.lang.String entityClassName, ListenerType listenerType)
public void initEntityHomes()
public EntityManagerFactory createEntityManagerFactory(PersistenceUnitInfo info)
public AmberPersistenceUnit createPersistenceUnit(java.lang.String name)
public void start()
public AmberPersistenceUnit getPersistenceUnit(java.lang.String name)
public EntityManagerFactory getEntityManagerFactory(java.lang.String name)
public EntityManager getPersistenceContext(java.lang.String name)
public EntityManager getExtendedPersistenceContext(java.lang.String name)
public void addPersistenceUnit(Path root)
public void startPersistenceUnits()
public int getScanPriority()
getScanPriority
in interface ScanListener
public boolean isRootScannable(Path root, java.lang.String packageRoot)
isRootScannable
in interface ScanListener
public ScanClass scanClass(Path root, java.lang.String packageRoot, java.lang.String className, int modifiers)
ScanListener
scanClass
in interface ScanListener
root
- the module/jar's root pathpackageRoot
- the virtual package root (usually for Testing)className
- the class namemodifiers
- the class modifierspublic boolean isScanMatchAnnotation(CharBuffer annotationName)
ScanListener
isScanMatchAnnotation
in interface ScanListener
public void classMatchEvent(EnvironmentClassLoader loader, Path root, java.lang.String className)
classMatchEvent
in interface ScanListener
public void environmentConfigure(EnvironmentClassLoader loader)
environmentConfigure
in interface EnvironmentListener
public void environmentBind(EnvironmentClassLoader loader)
environmentBind
in interface EnvironmentListener
public void environmentStart(EnvironmentClassLoader loader)
environmentStart
in interface EnvironmentListener
public void environmentStop(EnvironmentClassLoader loader)
environmentStop
in interface EnvironmentListener
public java.lang.String toString()
toString
in class java.lang.Object