Example usage for org.apache.commons.dbcp2.managed BasicManagedDataSource BasicManagedDataSource

List of usage examples for org.apache.commons.dbcp2.managed BasicManagedDataSource BasicManagedDataSource

Introduction

In this page you can find the example usage for org.apache.commons.dbcp2.managed BasicManagedDataSource BasicManagedDataSource.

Prototype

BasicManagedDataSource

Source Link

Usage

From source file:org.everit.blobstore.jdbc.test.AbstractJdbcBlobstoreTest.java

protected BasicManagedDataSource createManagedDataSource(final GeronimoTransactionManager transactionManager,
        final XADataSource xaDataSource) {
    BasicManagedDataSource lManagedDataSource = new BasicManagedDataSource();
    lManagedDataSource.setTransactionManager(transactionManager);
    lManagedDataSource.setXaDataSourceInstance(xaDataSource);
    return lManagedDataSource;
}

From source file:org.everit.osgi.jdbc.commons.dbcp.internal.ManagedDataSourceComponent.java

@Activate
public void activate(BundleContext bundleContext, Map<String, Object> componentProperties) {
    managedDataSource = new BasicManagedDataSource();
    managedDataSource.setXaDataSourceInstance(xaDataSource);
    managedDataSource.setTransactionManager(transactionManager);
    Util.applyPropertiesOnBasicDataSource(managedDataSource, componentProperties);

    Dictionary<String, Object> serviceProperties = new Hashtable<String, Object>(componentProperties);
    Util.addReferenceIdsToServiceProperties("xaDataSource", xaDataSourceServiceProperties, serviceProperties);
    Util.addReferenceIdsToServiceProperties("transactionManager", tmServiceProperties, serviceProperties);

    serviceRegistration = bundleContext.registerService(DataSource.class, managedDataSource, serviceProperties);
}

From source file:org.everit.persistence.jdbc.commons.dbcp.ecm.internal.ManagedDataSourceComponent.java

/**
 * Component activator method.//from   ww  w .j  av  a 2 s.c  o m
 */
@Activate
public void activate(final ComponentContext<ManagedDataSourceComponent> componentContext) {
    managedDataSource = new BasicManagedDataSource();
    managedDataSource.setXaDataSourceInstance(xaDataSource);
    managedDataSource.setTransactionManager(transactionManager);

    Map<String, Object> componentProperties = componentContext.getProperties();

    Util.applyPropertiesOnBasicDataSource(managedDataSource, componentProperties);

    Dictionary<String, Object> serviceProperties = new Hashtable<String, Object>(componentProperties);

    serviceRegistration = componentContext.registerService(DataSource.class, managedDataSource,
            serviceProperties);
}