Package adams.db

Class ConnectionParameters

    • Constructor Detail

      • ConnectionParameters

        public ConnectionParameters()
        Initializes the container.
    • Method Detail

      • initialize

        protected void initialize()
        Initializes the members.
      • getURL

        public String getURL()
        Returns the URL.
        Returns:
        the URL
      • getUser

        public String getUser()
        Returns the user.
        Returns:
        the user
      • getPassword

        public BasePassword getPassword()
        Returns the password.
        Returns:
        the password
      • getLoggingLevel

        public LoggingLevel getLoggingLevel()
        Returns the logging level.
        Returns:
        the logging level
      • getConnectOnStartUp

        public boolean getConnectOnStartUp()
        Returns whether to connect on startup.
        Returns:
        true if to connect on startup
      • getAutoCommit

        public boolean getAutoCommit()
        Returns whether to use auto-commit.
        Returns:
        true if to use auto-commit
      • parameters

        public Enumeration<String> parameters()
        Returns the available parameter keys.
        Returns:
        the parameter keys
      • getParameter

        public String getParameter​(String key)
        Returns the parameter for the specified key.
        Parameters:
        key - the key of the parameter to retrieve
        Returns:
        the associated value, null if not available
      • setParameter

        public void setParameter​(String key,
                                 String value)
        Sets the parameter for the specified key.
        Parameters:
        key - the key of the parameter to set
        value - the associated value
      • newInstance

        protected ConnectionParameters newInstance()
        Returns a new (empty) instance of a ConnectionParameters object.
        Returns:
        the empty instance
      • compareTo

        public int compareTo​(ConnectionParameters o)
        Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
        Specified by:
        compareTo in interface Comparable<ConnectionParameters>
        Parameters:
        o - the object to be compared.
        Returns:
        a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
        Throws:
        ClassCastException - if the specified object's type prevents it from being compared to this object.
      • equals

        public boolean equals​(Object obj)
        Indicates whether some other object is "equal to" this one.
        Overrides:
        equals in class Object
        Parameters:
        obj - the reference object with which to compare.
        Returns:
        true if this object is the same as the obj argument; false otherwise.
      • hashCode

        public int hashCode()
        Hashcode so can be used as hashtable key. Returns the hashcode of the "url \t user \t password" string.
        Overrides:
        hashCode in class Object
        Returns:
        the hashcode
      • toString

        public String toString()
        Returns a shortened URL.
        Overrides:
        toString in class Object
        Returns:
        the shortened URL
      • toDatabaseConnection

        public AbstractDatabaseConnection toDatabaseConnection​(Class dbcon)
        Returns the instance of a new database connection object.
        Parameters:
        dbcon - the database connection object class to instantiate
        Returns:
        the new database connection object
      • forName

        public static ConnectionParameters forName​(String classname)
        Creates a new object based on the classname, falls back to the default class, if instantiation fails.
        Parameters:
        classname - the class to instantiate
        Returns:
        the new object