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 Details

    • newPersistenceContext

      K newPersistenceContext()
      Creates a new instance of XxxTopiaPersistenceContext (where Xxx is 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

      <T extends TopiaEntity> Class<T> getContractClass(Class<T> klass)
    • getImplementationClass

      <T extends TopiaEntity> Class<T> getImplementationClass(Class<T> klass)
    • getContractClasses

      Class<? extends TopiaEntity>[] getContractClasses()
    • getConfiguration

      TopiaConfiguration getConfiguration()
    • getPersistenceClasses

      List<Class<?>> 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

      boolean isTableExists(Class<?> clazz)
    • getSchemaName

      @Deprecated String getSchemaName()
      Deprecated.
      since 3.0.1, prefer use getSchemaNames().
      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 children TopiaPersistenceContext
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable