Package com.arpnetworking.utility
Class Database
java.lang.Object
com.arpnetworking.utility.Database
- All Implemented Interfaces:
Launchable
Database instance abstraction across database technologies: HikariCP, Flyway and EBean.
NOTE: The current configuration process of mapping to classes and then instantiating components from "safe"
configuration is a complete falacy. Only by attempting to apply (e.g. restart) the system with the new configuration
can you determine if it is truly safe. Once rewritten that way configuration classes can be eliminated in many cases
and the raw Configuration object mapped directly to the consumer of that configuration. For example, in this class we
could read a subkey for Hikari thus decoupling our configuration from Hikari's. The same can be done for Flyway by
automatically converting a subkey into a Properties instance and giving it to Flyway.
- Author:
- Ville Koskela (ville dot koskela at inscopemetrics dot com)
-
Constructor Summary
ConstructorsConstructorDescriptionDatabase
(String name, DatabaseConfiguration configuration) Public constructor. -
Method Summary
-
Constructor Details
-
Database
Public constructor.- Parameters:
name
- The name of the database instance.configuration
- Configuration for the database instance.
-
-
Method Details
-
launch
public void launch()Description copied from interface:Launchable
Launch the component.- Specified by:
launch
in interfaceLaunchable
-
shutdown
public void shutdown()Description copied from interface:Launchable
Shutdown the component.- Specified by:
shutdown
in interfaceLaunchable
-
getName
-
getDataSource
-
getEbeanServer
public io.ebean.Database getEbeanServer() -
getFlyway
-
toString
-