//文件:dbconnectionprovider.java
package com.qingtuo.db.pool;
import java.sql.*;
import java.util.*;
public abstract class dbconnectionprovider {
/** dummy values. override in subclasses. **/
private static final string name = "";
private static final string description = "";
private static final string author = "";
private static final int major_version = 0;
private static final int minor_version = 0;
private static final boolean pooled = false;
/**
* returns the name of the connection provider.
*/
public string getname() {
return name;
}
/**
* returns a description of the connection provider.
*/
public string getdescription() {
return description;
}
/**
* returns the author of the connection provider.
*/
public string getauthor() {
return author;
}
/**
* returns the major version of the connection provider, i.e. the 1 in 1.0.
*/
public int getmajorversion() {
return major_version;
}
public int getminorversion() {
return minor_version;
}
/**
* returns true if this connection provider provides connections out
* of a connection pool.
*/
public boolean ispooled() {
return pooled;
}
/**
* returns a database connection. when a jive component is done with a
* connection, it will call the close method of that connection. therefore,
* connection pools with special release methods are not directly
* supported by the connection provider infrastructure. instead, connections
* from those pools should be wrapped such that calling the close method
* on the wrapper class will release the connection from the pool.
*/
public abstract connection getconnection();
/**
* starts the connection provider. for some connection providers, this
* will be a no-op. however, connection provider users should always call
* this method to make sure the connection provider is started.
*/
protected abstract void start();
/**
* this method should be called whenever properties have been changed so
* that the changes will take effect.
*/
protected abstract void restart();
/**
* tells the connection provider to destroy itself. for many connection
* providers, this will essentially result in a no-op. however,
* connection provider users should always call this method when changing
* from one connection provider to another to ensure that there are no
* dangling database connections.
*/
protected abstract void destroy();
/**
* returns the value of a property of the connection provider.
*
* @param name the name of the property.
* @returns the value of the property.
*/
public abstract string getproperty(string name);
/**
* returns the description of a property of the connection provider.
*
* @param name the name of the property.
* @return the description of the property.
*/
public abstract string getpropertydescription(string name);
/**
* returns an enumeration of the property names for the connection provider.
*/
public abstract enumeration propertynames();
/**
* sets a property of the connection provider. each provider has a set number
* of properties that are determined by the author. trying to set a non-
* existant property will result in an illegalargumentexception.
*
* @param name the name of the property to set.
* @param value the new value for the property.
*/
public abstract void setproperty(string name, string value);
}
