Search in sources :

Example 1 with DbcpTemplate

use of com.pamirs.attach.plugin.dynamic.template.DbcpTemplate in project LinkAgent by shulieTech.

the class DataSourceWrapUtil method attachment.

public static void attachment(Advice advice) {
    try {
        BasicDataSource target = (BasicDataSource) advice.getTarget();
        ResourceManager.set(new Attachment(target.getUrl(), "dbcp", Type.DataBaseType.types(), new DbcpTemplate().setUrl(target.getUrl()).setUsername(target.getUsername()).setPassword(target.getPassword()).setDriverClassName(target.getDriverClassName())));
    } catch (Throwable t) {
        logger.error(Throwables.getStackTraceAsString(t));
    }
}
Also used : Attachment(com.pamirs.attach.plugin.dynamic.Attachment) BasicDataSource(org.apache.commons.dbcp.BasicDataSource) DbcpTemplate(com.pamirs.attach.plugin.dynamic.template.DbcpTemplate)

Example 2 with DbcpTemplate

use of com.pamirs.attach.plugin.dynamic.template.DbcpTemplate in project LinkAgent by shulieTech.

the class DataSourceWrapUtil method attachment.

public static void attachment(Advice advice) {
    try {
        BasicDataSource target = (BasicDataSource) advice.getTarget();
        ResourceManager.set(new Attachment(target.getUrl(), "dbcp2", Type.DataBaseType.types(), new DbcpTemplate().setUrl(target.getUrl()).setUsername(target.getUsername()).setPassword(target.getPassword()).setDriverClassName(target.getDriverClassName())));
    } catch (Throwable t) {
        logger.error(Throwables.getStackTraceAsString(t));
    }
}
Also used : Attachment(com.pamirs.attach.plugin.dynamic.Attachment) BasicDataSource(org.apache.commons.dbcp2.BasicDataSource) DbcpTemplate(com.pamirs.attach.plugin.dynamic.template.DbcpTemplate)

Aggregations

Attachment (com.pamirs.attach.plugin.dynamic.Attachment)2 DbcpTemplate (com.pamirs.attach.plugin.dynamic.template.DbcpTemplate)2 BasicDataSource (org.apache.commons.dbcp.BasicDataSource)1 BasicDataSource (org.apache.commons.dbcp2.BasicDataSource)1