public class JdbcProfile extends Object
JdbcResourceMirror.| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_BATCH_GET_UNIT
The default value of
KEY_BATCH_GET_UNIT. |
static long |
DEFAULT_BATCH_PUT_UNIT
The default value of
KEY_BATCH_PUT_UNIT. |
static int |
DEFAULT_CONNECT_RETRY_COUNT
The default value of
KEY_CONNECT_RETRY_COUNT. |
static int |
DEFAULT_CONNECT_RETRY_INTERVAL
The default value of
KEY_CONNECT_RETRY_INTERVAL. |
static String |
DEFAULT_TRUNCATE_STATEMENT
The default value of
KEY_TRUNCATE_STATEMENT. |
static String |
KEY_BATCH_GET_UNIT
The profile key of
getBatchGetUnit(). |
static String |
KEY_BATCH_PUT_UNIT
The profile key of
getBatchPutUnit(). |
static String |
KEY_CONNECT_RETRY_COUNT
The profile key of
getConnectRetryCount(). |
static String |
KEY_CONNECT_RETRY_INTERVAL
The profile key of
getConnectRetryInterval(). |
static String |
KEY_DRIVER
The profile key of fully qualified JDBC driver class name.
|
static String |
KEY_OPTIMIZATIONS
The profile key of
getOptimizations(). |
static String |
KEY_PASSWORD
The profile key of database connection password.
|
static String |
KEY_PREFIX_PROPERTIES
The profile key of
getConnectionProperties(). |
static String |
KEY_TRUNCATE_STATEMENT
The profile key of
getTruncateStatement(String). |
static String |
KEY_URL
The profile key of database URL.
|
static String |
KEY_USER
The profile key of database user name.
|
| Constructor and Description |
|---|
JdbcProfile(String resourceName,
ClassLoader classLoader,
String driver,
String url,
String user,
String password,
long batchPutUnit)
Creates a new instance.
|
JdbcProfile(String resourceName,
ClassLoader classLoader,
String driver,
String url,
String user,
String password,
Map<String,String> connectionProperties)
Creates a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
static JdbcProfile |
convert(ResourceProfile profile)
Converts
ResourceProfile into JdbcProfile. |
int |
getBatchGetUnit()
Return the number of rows on each fetch (
fetch-size). |
long |
getBatchPutUnit()
Return the number of rows on each batch insertion.
|
ClassLoader |
getClassLoader()
Returns the class loader for the resources.
|
Map<String,String> |
getConnectionProperties()
Return extra configuration properties.
|
int |
getConnectRetryCount()
Returns the retry count on create connection.
|
int |
getConnectRetryInterval()
Returns the retry interval (in second).
|
Set<String> |
getOptimizations()
Returns the optimizations.
|
String |
getResourceName()
Returns the resource name.
|
String |
getTruncateStatement(String tableName)
Returns the truncate statement.
|
Connection |
openConnection()
Creates a new connection using this configuration.
|
void |
setBatchGetUnit(int value)
Configures
KEY_BATCH_GET_UNIT. |
void |
setBatchPutUnit(long value)
Configures
KEY_BATCH_PUT_UNIT. |
void |
setConnectRetryCount(int value)
Configures
KEY_CONNECT_RETRY_COUNT. |
void |
setConnectRetryInterval(int value)
Configures
KEY_CONNECT_RETRY_INTERVAL. |
void |
setOptimizations(Collection<String> optimizations)
Sets the enabled optimization symbols.
|
void |
setTruncateStatement(String pattern)
Configures
KEY_TRUNCATE_STATEMENT. |
public static final String KEY_DRIVER
public static final String KEY_URL
public static final String KEY_USER
public static final String KEY_PASSWORD
public static final String KEY_BATCH_PUT_UNIT
getBatchPutUnit().public static final String KEY_BATCH_GET_UNIT
getBatchGetUnit().public static final String KEY_CONNECT_RETRY_COUNT
getConnectRetryCount().public static final String KEY_CONNECT_RETRY_INTERVAL
getConnectRetryInterval().public static final String KEY_TRUNCATE_STATEMENT
getTruncateStatement(String).public static final String KEY_PREFIX_PROPERTIES
getConnectionProperties().public static final String KEY_OPTIMIZATIONS
getOptimizations().public static final int DEFAULT_BATCH_GET_UNIT
KEY_BATCH_GET_UNIT.public static final long DEFAULT_BATCH_PUT_UNIT
KEY_BATCH_PUT_UNIT.public static final int DEFAULT_CONNECT_RETRY_COUNT
KEY_CONNECT_RETRY_COUNT.public static final int DEFAULT_CONNECT_RETRY_INTERVAL
KEY_CONNECT_RETRY_INTERVAL.public static final String DEFAULT_TRUNCATE_STATEMENT
KEY_TRUNCATE_STATEMENT.public JdbcProfile(String resourceName, ClassLoader classLoader, String driver, String url, String user, String password, long batchPutUnit)
resourceName - the target resource nameclassLoader - a class loader, or null to use the system class loaderdriver - a fully qualified class name of JDBC Driver implementationurl - database URLuser - database connection user (nullable)password - database connection password (nullable)batchPutUnit - the number of rows on each batch insertionIllegalArgumentException - if some parameters were nullpublic JdbcProfile(String resourceName, ClassLoader classLoader, String driver, String url, String user, String password, Map<String,String> connectionProperties)
resourceName - the target resource nameclassLoader - a class loader, or null to use the system class loaderdriver - a fully qualified class name of JDBC Driver implementationurl - database URLuser - database connection user (nullable)password - database connection password (nullable)connectionProperties - extra connection propertiesIllegalArgumentException - if some parameters were nullpublic static JdbcProfile convert(ResourceProfile profile)
ResourceProfile into JdbcProfile.profile - target profileIllegalArgumentException - if profile is not valid, or any parameter is nullpublic String getResourceName()
public ClassLoader getClassLoader()
public Connection openConnection() throws IOException
IOException - if failed to create a new connectionpublic Map<String,String> getConnectionProperties()
public int getBatchGetUnit()
fetch-size).public void setBatchGetUnit(int value)
KEY_BATCH_GET_UNIT.value - to setIllegalArgumentException - if < 0public long getBatchPutUnit()
public void setBatchPutUnit(long value)
KEY_BATCH_PUT_UNIT.value - to setIllegalArgumentException - if <= 0public int getConnectRetryCount()
0 for no retrypublic void setConnectRetryCount(int value)
KEY_CONNECT_RETRY_COUNT.value - to setIllegalArgumentException - if < 0public int getConnectRetryInterval()
getConnectRetryCount()public void setConnectRetryInterval(int value)
KEY_CONNECT_RETRY_INTERVAL.value - to setIllegalArgumentException - if < 0public String getTruncateStatement(String tableName)
tableName - target table namepublic void setTruncateStatement(String pattern)
KEY_TRUNCATE_STATEMENT.pattern - to setIllegalArgumentException - if the pattern is not in form of message formatpublic Set<String> getOptimizations()
JdbcProcess.OptionSymbolspublic void setOptimizations(Collection<String> optimizations)
optimizations - the symbolsJdbcProcess.OptionSymbolsCopyright © 2011–2019 Asakusa Framework Team. All rights reserved.