Package io.toro.martini
Class DatabaseConnectionPoolMethods
- java.lang.Object
-
- io.toro.martini.DatabaseConnectionPoolMethods
-
public final class DatabaseConnectionPoolMethods extends Object
Provides methods for managing the lifecycle of database pools and connections.
-
-
Constructor Summary
Constructors Constructor Description DatabaseConnectionPoolMethods(io.toro.martini.database.DataSourceManager dataSourceManager)
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleancontainsConnectionWithName(String name)Check if the instance has a connection pool with the provided name.static voiddeletePool(String name)Delete an existing connection pool by name.static voiddisablePool(String name)Disable a connection pool by namestatic voidenablePool(String name)Enable a connection pool by name.static GloopModelgetConnectionPoolInfo(String name)Get an existing connection pool by name.static GloopModelgetConnectionPoolInfos()Get all existing connection pools in the instance.static GloopModelgetSystemConnectionPoolInfo(String name)Get the information for a system data source.static voidsavePool(GloopModel connectionPoolInfo)Create a new connection pool.static voidstartPool(String name)Start a connection pool by name.static voidstopPool(String name)Stop a connection pool by name.static booleansupportsDriver(Class driverClass)Determine whether Martini supports a database or not using its corresponding driver class.static voidtestConnection(GloopModel connectionPoolInfo)Test if a connection can be established to the database using the provided information.
-
-
-
Constructor Detail
-
DatabaseConnectionPoolMethods
@Autowired DatabaseConnectionPoolMethods(io.toro.martini.database.DataSourceManager dataSourceManager)
-
-
Method Detail
-
getConnectionPoolInfos
@GloopObjectParameter("connectionPoolInfos{\n connectionPoolInfos#io.toro.martini.jdbc.JDBCConnectionPoolInfo[]{\n }\n}") public static GloopModel getConnectionPoolInfos()
Get all existing connection pools in the instance.- Returns:
- array of existing connection pools
- Since:
- 1.0
-
getConnectionPoolInfo
@GloopObjectParameter("connectionPoolInfo{\n connectionPoolInfo#io.toro.martini.jdbc.JDBCConnectionPoolInfo{\n }\n}") public static GloopModel getConnectionPoolInfo(@GloopParameter(allowNull=false) String name)
Get an existing connection pool by name.- Parameters:
name- name of the connection pool- Returns:
- the connection pool, if it exists
- Since:
- 1.0
-
containsConnectionWithName
public static boolean containsConnectionWithName(@GloopParameter(allowNull=false) String name)
Check if the instance has a connection pool with the provided name.- Parameters:
name- name of the connection pool- Returns:
trueif Martini has a connection pool with the given name;falseotherwise- Since:
- 1.0
-
enablePool
public static void enablePool(@GloopParameter(allowNull=false) String name)
Enable a connection pool by name.- Parameters:
name- name of the connection pool- Since:
- 1.0
-
startPool
public static void startPool(@GloopParameter(allowNull=false) String name)
Start a connection pool by name.- Parameters:
name- name of the connection pool- Since:
- 1.0
-
stopPool
public static void stopPool(@GloopParameter(allowNull=false) String name)
Stop a connection pool by name.- Parameters:
name- name of the connection pool- Since:
- 1.0
-
disablePool
public static void disablePool(@GloopParameter(allowNull=false) String name)
Disable a connection pool by name- Parameters:
name- name of the connection pool- Since:
- 1.0
-
savePool
public static void savePool(@GloopObjectParameter("connectionPoolInfo#io.toro.martini.jdbc.JDBCConnectionPoolInfo{\n}") GloopModel connectionPoolInfo)
Create a new connection pool.- Parameters:
connectionPoolInfo- the new connection pool- Since:
- 1.0
-
deletePool
public static void deletePool(@GloopParameter(allowNull=false) String name)
Delete an existing connection pool by name.- Parameters:
name- name of the connection pool- Since:
- 1.0
-
testConnection
public static void testConnection(@GloopObjectParameter("connectionPoolInfo#io.toro.martini.jdbc.JDBCConnectionPoolInfo{\n}") GloopModel connectionPoolInfo) throws Exception
Test if a connection can be established to the database using the provided information.- Parameters:
connectionPoolInfo- the connection pool to test- Throws:
Exception- if a connection could not be established- Since:
- 1.0
-
supportsDriver
public static boolean supportsDriver(@GloopParameter(allowNull=false) Class driverClass)
Determine whether Martini supports a database or not using its corresponding driver class.- Parameters:
driverClass- the driver class of the database to check- Returns:
trueif the driver is supported;falseotherwise- Since:
- 1.0
-
getSystemConnectionPoolInfo
@GloopObjectParameter("connectionPoolInfo{\n connectionPoolInfo#io.toro.martini.jdbc.JDBCConnectionPoolInfo{\n }\n}") public static GloopModel getSystemConnectionPoolInfo(@GloopParameter(allowNull=false) String name)
Get the information for a system data source. If none exists with the given name, one is created.- Parameters:
name- the name of the data source- Returns:
- data source information
- Since:
- 1.0
-
-