Package de.xima.fc.plugin.entities
Class EntitiesRuntime
java.lang.Object
de.xima.fc.plugin.entities.EntitiesRuntime
A class that encapsulates a running
IPluginEntities
. This class is responsible for performing any
initialization processes specific to entities plugins, and also for cleaning up when the plugin is deactivated or
uninstalled. Specifically, tasks this class performs include scanning the plugin for entity classes, initializing the
connection to the database, applying any unrun liquibase changesets and creating the entity manager factory.- Author:
- XIMA MEDIA GmbH
-
Constructor Summary
ConstructorsConstructorDescriptionEntitiesRuntime
(PluginRuntime pluginRuntime, IPluginEntities plugin) Creates a new entities runtime with the given plugin. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Initializes this entities runtime.void
shutdown()
Called when the plugin is deactivated or uninstalled.
-
Constructor Details
-
EntitiesRuntime
Creates a new entities runtime with the given plugin. The JPA entities are read from the plugin via reflection.- Parameters:
pluginRuntime
- The runtime of the plugin.plugin
- The actual entities plugin.
-
-
Method Details
-
getJpaEntities
- Returns:
- All JPA entities that are available to this runtime.
-
getPersistenceUnitName
- Returns:
- The persistence unit name of this runtime, used by the entity manager.
-
getPlugin
- Returns:
- The entities plugin wrapped by this runtime.
-
getPluginRuntime
- Returns:
- The plugin runtime of the entities plugin wrapped by this runtime.
-
initialize
Initializes this entities runtime. This- evaluates the connections details specified by the plugin and acquires a data source,
- runs all liquibase scripts specified by the plugin, if any, using that data source,
- then creates the entity manager factory, and finally
- initializes the entities plugin by passing it that factory
- Throws:
FCPluginException
- When the above steps could not be performed, such as due to a database connection error or a wrong plugin configuration.
-
shutdown
public void shutdown()Called when the plugin is deactivated or uninstalled. Closes the entity manager factory and all open connections to the database.
-