Search in sources :

Example 1 with AriesTransactionManager

use of org.apache.aries.transaction.AriesTransactionManager in project aries by apache.

the class Activator method start.

public void start(BundleContext ctx) {
    context = ctx;
    // Expose blueprint namespace handler if xbean is present
    try {
        nshReg = JdbcNamespaceHandler.register(ctx);
    } catch (NoClassDefFoundError e) {
        LOGGER.warn("Unable to register JDBC blueprint namespace handler (xbean-blueprint not available).");
    } catch (Exception e) {
        LOGGER.error("Unable to register JDBC blueprint namespace handler", e);
    }
    Filter filter;
    String flt = "(&(|(objectClass=javax.sql.XADataSource)(objectClass=javax.sql.DataSource))(!(aries.managed=true)))";
    try {
        filter = context.createFilter(flt);
    } catch (InvalidSyntaxException e) {
        throw new IllegalStateException(e);
    }
    t = new ServiceTracker<CommonDataSource, ManagedDataSourceFactory>(ctx, filter, this);
    tm = new SingleServiceTracker<AriesTransactionManager>(ctx, AriesTransactionManager.class, this);
    tm.open();
}
Also used : Filter(org.osgi.framework.Filter) InvalidSyntaxException(org.osgi.framework.InvalidSyntaxException) AriesTransactionManager(org.apache.aries.transaction.AriesTransactionManager) InvalidSyntaxException(org.osgi.framework.InvalidSyntaxException) CommonDataSource(javax.sql.CommonDataSource)

Aggregations

CommonDataSource (javax.sql.CommonDataSource)1 AriesTransactionManager (org.apache.aries.transaction.AriesTransactionManager)1 Filter (org.osgi.framework.Filter)1 InvalidSyntaxException (org.osgi.framework.InvalidSyntaxException)1