1
|
|
/* Generated by AspectJ version 1.0.5 */
|
2
|
|
package org.apache.cactus.client;
|
3
|
|
import org.apache.cactus.util.Configuration;
|
4
|
|
import org.apache.cactus.util.ChainedRuntimeException;
|
5
|
|
import java.lang.reflect.Constructor;
|
6
|
|
|
7
|
|
/**
|
8
|
|
* Factory that returns the <code>ConnectionHelper</code> specified in Cactus
|
9
|
|
* configuration or the default one if none has been specified.
|
10
|
|
*
|
11
|
|
* @see Configuration
|
12
|
|
*
|
13
|
|
* @author <a href="mailto:vmassol@apache.org">Vincent Massol</a>
|
14
|
|
*
|
15
|
|
* @version $Id: ConnectionHelperFactory.java,v 1.2 2002/07/26 18:50:29 vmassol Exp $
|
16
|
|
*/
|
17
|
|
public class ConnectionHelperFactory {
|
18
|
|
/**
|
19
|
|
* @return a <code>ConnectionHelper</code> instance of the type specified
|
20
|
|
* in Cactus configuration or the default one
|
21
|
|
* (<code>JdkConnectionHelper</code>)
|
22
|
|
* @param theUrl the URL to connect to as a String
|
23
|
|
*/
|
24
|
128
|
public static ConnectionHelper getConnectionHelper(String theUrl) {
|
25
|
128
|
ConnectionHelper connectionHelper;
|
26
|
128
|
try {
|
27
|
128
|
Class connectionHelperClass = Class.forName(Configuration.getConnectionHelper());
|
28
|
128
|
Constructor constructor = connectionHelperClass.getConstructor(new java.lang.Class[] {
|
29
|
|
String.class});
|
30
|
128
|
connectionHelper = (ConnectionHelper)constructor.newInstance(new java.lang.Object[] {
|
31
|
|
theUrl});
|
32
|
|
} catch (Exception e) {
|
33
|
0
|
throw new ChainedRuntimeException("Failed to load the [" + Configuration.getConnectionHelper(
|
34
|
|
) + "] ConnectionHelper " + "class", e);
|
35
|
|
}
|
36
|
128
|
return connectionHelper;
|
37
|
|
}
|
38
|
|
|
39
|
|
/**
|
40
|
|
* Factory that returns the <code>ConnectionHelper</code> specified in Cactus
|
41
|
|
* configuration or the default one if none has been specified.
|
42
|
|
*
|
43
|
|
* @see Configuration
|
44
|
|
*
|
45
|
|
* @author <a href="mailto:vmassol@apache.org">Vincent Massol</a>
|
46
|
|
*
|
47
|
|
* @version $Id: ConnectionHelperFactory.java,v 1.2 2002/07/26 18:50:29 vmassol Exp $
|
48
|
|
*/
|
49
|
0
|
public ConnectionHelperFactory() {
|
50
|
0
|
super();
|
51
|
|
}
|
52
|
|
}
|