Mercurial > dive4elements > gnv-client
comparison geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/connectionpool/ArcSDEPoolableObjectFactory.java @ 885:1c3efbd2fc5a
Removes trailing whitespace.
geo-backend/trunk@850 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Mon, 29 Mar 2010 07:49:16 +0000 |
parents | 12f88239fb33 |
children | 8b442223741c |
comparison
equal
deleted
inserted
replaced
884:12f88239fb33 | 885:1c3efbd2fc5a |
---|---|
11 import de.intevation.gnv.geobackend.sde.datasources.ArcSDEConnection; | 11 import de.intevation.gnv.geobackend.sde.datasources.ArcSDEConnection; |
12 | 12 |
13 /** | 13 /** |
14 * ArcSDE specific Implementation of an PoolableObjectFactory. | 14 * ArcSDE specific Implementation of an PoolableObjectFactory. |
15 * This factory instantiate Objects of type ArcSDEConnection. | 15 * This factory instantiate Objects of type ArcSDEConnection. |
16 * | 16 * |
17 * @author Tim Englich (tim.englich@intevation.de) | 17 * @author Tim Englich (tim.englich@intevation.de) |
18 * @author Sascha L. Teichmann (sascha.teichmann@intevation.de) | 18 * @author Sascha L. Teichmann (sascha.teichmann@intevation.de) |
19 */ | 19 */ |
20 public class ArcSDEPoolableObjectFactory implements PoolableObjectFactory { | 20 public class ArcSDEPoolableObjectFactory implements PoolableObjectFactory { |
21 | 21 |
26 ArcSDEPoolableObjectFactory.class); | 26 ArcSDEPoolableObjectFactory.class); |
27 | 27 |
28 /** | 28 /** |
29 * The 5 seconds are inspired by GeoTools's testServer() usage. | 29 * The 5 seconds are inspired by GeoTools's testServer() usage. |
30 */ | 30 */ |
31 private int serverRoundtripInterval = 5; | 31 private int serverRoundtripInterval = 5; |
32 /** | 32 /** |
33 * The value of the maximum Time a Connection is allowed to | 33 * The value of the maximum Time a Connection is allowed to |
34 * be inactive without the validation of the Connection. | 34 * be inactive without the validation of the Connection. |
35 */ | 35 */ |
36 private long serverInactiveInterval = 5L*60L*1000L; // 5 minutes | 36 private long serverInactiveInterval = 5L*60L*1000L; // 5 minutes |
37 /** | 37 /** |
38 * The URL to the ArcSDE Server | 38 * The URL to the ArcSDE Server |
52 private String username = null; | 52 private String username = null; |
53 /** | 53 /** |
54 * The Credentials which belongs to the User | 54 * The Credentials which belongs to the User |
55 */ | 55 */ |
56 private String credentials = null; | 56 private String credentials = null; |
57 | 57 |
58 /** | 58 /** |
59 * Constructor of this Class | 59 * Constructor of this Class |
60 * @param properties the Properties which includes the ConnectionParams to the Database | 60 * @param properties the Properties which includes the ConnectionParams to the Database |
61 */ | 61 */ |
62 public ArcSDEPoolableObjectFactory(Properties properties) { | 62 public ArcSDEPoolableObjectFactory(Properties properties) { |
71 | 71 |
72 String serverRoundtripIntervalValue = | 72 String serverRoundtripIntervalValue = |
73 properties.getProperty("serverRoundtripInterval"); | 73 properties.getProperty("serverRoundtripInterval"); |
74 String serverInactiveIntervalValue = | 74 String serverInactiveIntervalValue = |
75 properties.getProperty("serverInactiveInterval"); | 75 properties.getProperty("serverInactiveInterval"); |
76 | 76 |
77 try { | 77 try { |
78 if (serverRoundtripIntervalValue != null) { | 78 if (serverRoundtripIntervalValue != null) { |
79 serverRoundtripInterval = | 79 serverRoundtripInterval = |
80 Integer.parseInt(serverRoundtripIntervalValue); | 80 Integer.parseInt(serverRoundtripIntervalValue); |
81 } | 81 } |
91 } | 91 } |
92 } | 92 } |
93 catch (NumberFormatException e) { | 93 catch (NumberFormatException e) { |
94 log.error(e,e); | 94 log.error(e,e); |
95 } | 95 } |
96 | 96 |
97 log.info("ArcSDEPoolableObjectFactory initialized"); | 97 log.info("ArcSDEPoolableObjectFactory initialized"); |
98 log.info("Server: " + server); | 98 log.info("Server: " + server); |
99 log.info("Port: " + port); | 99 log.info("Port: " + port); |
100 log.info("Database: " + database); | 100 log.info("Database: " + database); |
101 log.info("User: " + username); | 101 log.info("User: " + username); |
128 public Object makeObject() throws Exception { | 128 public Object makeObject() throws Exception { |
129 log.debug("ArcSDEPoolableObjectFactory.makeObject"); | 129 log.debug("ArcSDEPoolableObjectFactory.makeObject"); |
130 Connection con; | 130 Connection con; |
131 try { | 131 try { |
132 con = new ArcSDEConnection( | 132 con = new ArcSDEConnection( |
133 server, | 133 server, |
134 port, | 134 port, |
135 database, | 135 database, |
136 username, | 136 username, |
137 credentials, | 137 credentials, |
138 serverRoundtripInterval, | 138 serverRoundtripInterval, |
139 serverInactiveInterval); | 139 serverInactiveInterval); |
140 } | 140 } |