Enum DefaultDriverManager

  • All Implemented Interfaces:
    Serializable, Comparable<DefaultDriverManager>, DriverManager

    public enum DefaultDriverManager
    extends Enum<DefaultDriverManager>
    implements DriverManager
    Default implementation of the DriverManger 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 to DefaultDriverManager (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 Detail

    • 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 name
        NullPointerException - 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 interface DriverManager
        Parameters:
        location - location of the resource; must not be null
      • removeDriverResource

        public void removeDriverResource​(URI location)
        Removes previously added database driver resource.
        Specified by:
        removeDriverResource in interface DriverManager
        Parameters:
        location - location of resource which is going to be removed; must not be null
      • 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 interface DriverManager
        Parameters:
        driverClassName - fully qualified name of the driver's class.
        Throws:
        ClassNotFoundException - thrown if the provided driver's class can not be found.