Class DatabaseConnectionPoolMethods


  • public final class DatabaseConnectionPoolMethods
    extends Object
    Provides methods for managing the lifecycle of database pools and connections.
    • 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:
        true if Martini has a connection pool with the given name; false otherwise
        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:
        true if the driver is supported; false otherwise
        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