Package org.nuiton.topia.persistence
Interface TopiaApplicationContext<K extends TopiaPersistenceContext>
- All Superinterfaces:
AutoCloseable,Closeable,TopiaListenableSupport,TopiaServiceSupport
- All Known Implementing Classes:
AbstractTopiaApplicationContext
public interface TopiaApplicationContext<K extends TopiaPersistenceContext>
extends TopiaListenableSupport, TopiaServiceSupport, Closeable
This is the main entry point for ToPIA. This interface represents the root context of an application.
Most of the time, there is only one instance of this context during the entire lifecycle of a application.
This contract provides facility to :
- create a new
TopiaPersistenceContext; - get meta information about the application (model name, version);
- get meta information about the entities;
- do schema related operations;
- shutdown the application
This contract has an abstract implementation
(AbstractTopiaApplicationContext) which is itself extended by a
generated AbstractXxxTopiaApplicationContext (where Xxx is the project name), itself
extended by XxxTopiaApplicationContext.
The full hierarchy is :
TopiaApplicationContext (this contract)
\--AbstractTopiaApplicationContext
\--AbstractXxxTopiaApplicationContext (generated)
\--XxxTopiaApplicationContext (generated)
(where Xxx is the project name)
Created on 12/20/13.
- Since:
- 3.0
- Author:
- Tony Chemit - tchemit@codelutin.com
-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Method to call when the application is going for shutdown.voidvoid<T extends TopiaEntity>
Class<T>getContractClass(Class<T> klass) Class<? extends TopiaEntity>[]<T extends TopiaEntity>
Class<T>getImplementationClass(Class<T> klass) Get the list of entities (ToPIA or not) that Hibernate has to handle.Deprecated.com.google.common.collect.ImmutableSet<String>voidbooleanisClosed()booleanisOpened()booleanbooleanisTableExists(Class<?> clazz) Creates a new instance of XxxTopiaPersistenceContext (whereXxxis the project name).voidvoidMethods inherited from interface org.nuiton.topia.persistence.support.TopiaListenableSupport
addPropertyChangeListener, addTopiaEntitiesVetoable, addTopiaEntityListener, addTopiaEntityListener, addTopiaEntityVetoable, addTopiaEntityVetoable, addTopiaSchemaListener, addTopiaTransactionListener, addTopiaTransactionVetoable, removePropertyChangeListener, removeTopiaEntitiesVetoable, removeTopiaEntityListener, removeTopiaEntityListener, removeTopiaEntityVetoable, removeTopiaEntityVetoable, removeTopiaSchemaListener, removeTopiaTransactionListener, removeTopiaTransactionVetoableMethods inherited from interface org.nuiton.topia.persistence.support.TopiaServiceSupport
getServices, getServices
-
Method Details
-
newPersistenceContext
K newPersistenceContext()Creates a new instance of XxxTopiaPersistenceContext (whereXxxis the project name). This is the method to use in order to start a new transaction.- Returns:
- a newly created instance of your project's specific
TopiaPersistenceContext - See Also:
-
getModelVersion
String getModelVersion() -
getModelName
String getModelName() -
getContractClass
-
getImplementationClass
-
getContractClasses
Class<? extends TopiaEntity>[] getContractClasses() -
getConfiguration
TopiaConfiguration getConfiguration() -
getPersistenceClasses
Get the list of entities (ToPIA or not) that Hibernate has to handle. By default it only contains ToPIA entities but you may override it to add any other Hibernate entity. -
initSchema
void initSchema() -
isSchemaEmpty
boolean isSchemaEmpty() -
isTableExists
-
getSchemaName
Deprecated.since 3.0.1, prefer usegetSchemaNames().- Returns:
- the default schema name.
-
getSchemaNames
com.google.common.collect.ImmutableSet<String> getSchemaNames()- Returns:
- all schema names used by persistent entities.
- Since:
- 3.0.1
-
createSchema
void createSchema() -
showCreateSchema
void showCreateSchema() -
updateSchema
void updateSchema() -
dropSchema
void dropSchema() -
isOpened
boolean isOpened()- Returns:
- true is the application context is opened (ie not yet
isClosed())
-
isClosed
boolean isClosed()- Returns:
- true is the application context is already closed, false otherwise
-
close
void close()Method to call when the application is going for shutdown. It will trigger the shutdown of all the opened childrenTopiaPersistenceContext- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
getSchemaNames().