Search in sources :

Example 1 with LifecycleAware

use of org.apache.aries.tx.control.resource.common.impl.LifecycleAware in project aries by apache.

the class AbstractJPAManagedServiceFactory method getConfigurationDrivenResource.

@Override
protected LifecycleAware getConfigurationDrivenResource(BundleContext context, String pid, Map<String, Object> properties) throws Exception {
    Properties jdbcProps = getJdbcProps(pid, properties);
    Map<String, Object> jpaProps = getJPAProps(pid, properties);
    try {
        LifecycleAware worker;
        if (properties.containsKey(OSGI_JDBC_DRIVER_CLASS) || properties.containsKey(DSF_TARGET_FILTER)) {
            worker = dataSourceTracking(context, pid, properties, jdbcProps, jpaProps);
        } else {
            if (!jdbcProps.isEmpty()) {
                LOG.warn("The configuration {} contains raw JDBC configuration, but no osgi.jdbc.driver.class or aries.dsf.target.filter properties. No DataSourceFactory will be used byt this bundle, so the JPA provider must be able to directly create the datasource, and these configuration properties will likely be ignored. {}", pid, jdbcProps.stringPropertyNames());
            }
            worker = emfTracking(context, pid, properties, jpaProps);
        }
        return worker;
    } catch (InvalidSyntaxException e) {
        LOG.error("The configuration {} contained an invalid target filter {}", pid, e.getFilter());
        throw new ConfigurationException(DSF_TARGET_FILTER, "The target filter was invalid", e);
    }
}
Also used : LifecycleAware(org.apache.aries.tx.control.resource.common.impl.LifecycleAware) ConfigurationException(org.osgi.service.cm.ConfigurationException) InvalidSyntaxException(org.osgi.framework.InvalidSyntaxException) Properties(java.util.Properties)

Aggregations

Properties (java.util.Properties)1 LifecycleAware (org.apache.aries.tx.control.resource.common.impl.LifecycleAware)1 InvalidSyntaxException (org.osgi.framework.InvalidSyntaxException)1 ConfigurationException (org.osgi.service.cm.ConfigurationException)1