some comment stripping
[sdbl4j] / src / java / org / gc / sdbl4j / ConnectionParameters.java
1 /*
2  *
3  * Copyright (C) 2010 Guillaume Cottenceau and MNC S.A.
4  *
5  * This file is part of sdbl4j, and is licensed under the Apache 2.0 license.
6  *
7  */
8
9 package org.gc.sdbl4j;
10
11 import java.sql.Connection;
12
13 public class ConnectionParameters {
14
15     private int preOpenedConnections;
16     private int alertLevel;
17     private int maxConnections;
18     private ConnectionCreator connectionCreator;
19     
20     public interface ConnectionCreator {
21         public Connection createConnection();
22     }
23     
24     public ConnectionParameters( int preOpenedConnections, int alertLevel, int maxConnections,
25                                  ConnectionCreator connectionCreator ) {
26         this.preOpenedConnections = preOpenedConnections;
27         this.alertLevel = alertLevel;
28         this.maxConnections = maxConnections;
29         this.connectionCreator = connectionCreator;
30     }
31
32     public int getPreOpenedConnections() {
33         return preOpenedConnections;
34     }
35     
36     public int getAlertLevel() {
37         return alertLevel;
38     }
39     
40     public int getMaxConnections() {
41         return maxConnections;
42     }
43     
44     public Connection createConnection() {
45         return connectionCreator.createConnection();
46     }
47     
48     public String toString() {
49         return "connectionParameters{preOpenedConnections=" + preOpenedConnections + ",alertLevel=" + alertLevel
50                + ",maxConnections=" + maxConnections + ",connectionCreator=" + connectionCreator + "}";
51     }
52 }