Package org.webharvest.runtime.database
Enum DefaultDriverManager
- java.lang.Object
-
- java.lang.Enum<DefaultDriverManager>
-
- org.webharvest.runtime.database.DefaultDriverManager
-
- All Implemented Interfaces:
Serializable
,Comparable<DefaultDriverManager>
,DriverManager
public enum DefaultDriverManager extends Enum<DefaultDriverManager> implements DriverManager
Default implementation of theDriverManger
interface. Allows to load database drivers from the arbitrary location. Database driver being registered must be available on classpath or in any of previously added driver resources. If no resources has been added toDefaultDriverManager
(as it is in most cases when web harvest is embedded into enterprise application running within container), all drivers being registered must be accessible within container's default class loader.- Since:
- 2.1.0-SNAPSHOT
- Version:
- %I%, %G%
- Author:
- Piotr Dyraga
- See Also:
DefaultDriverManager
-
-
Enum Constant Summary
Enum Constants Enum Constant Description INSTANCE
Singleton instance reference
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addDriverResource(URI location)
Adds resource containing database driver (in most cases it is a JAR file).void
registerDriver(String driverClassName)
Registers driver with the provided class name.void
removeDriverResource(URI location)
Removes previously added database driver resource.static DefaultDriverManager
valueOf(String name)
Returns the enum constant of this type with the specified name.static DefaultDriverManager[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
INSTANCE
public static final DefaultDriverManager INSTANCE
Singleton instance reference
-
-
Method Detail
-
values
public static DefaultDriverManager[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (DefaultDriverManager c : DefaultDriverManager.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static DefaultDriverManager valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-
addDriverResource
public void addDriverResource(URI location)
Adds resource containing database driver (in most cases it is a JAR file).- Specified by:
addDriverResource
in interfaceDriverManager
- Parameters:
location
- location of the resource; must not benull
-
removeDriverResource
public void removeDriverResource(URI location)
Removes previously added database driver resource.- Specified by:
removeDriverResource
in interfaceDriverManager
- Parameters:
location
- location of resource which is going to be removed; must not benull
-
registerDriver
public void registerDriver(String driverClassName) throws ClassNotFoundException
Registers driver with the provided class name. Driver must be already accessible on classpath or in any of previously added resources.- Specified by:
registerDriver
in interfaceDriverManager
- Parameters:
driverClassName
- fully qualified name of the driver's class.- Throws:
ClassNotFoundException
- thrown if the provided driver's class can not be found.
-
-