Examples of DataSourceCreator


Examples of org.apache.openejb.resource.jdbc.pool.DataSourceCreator

    }

    // TODO: should we get a get and a clear method instead of a single one?
    public static ObjectRecipe forgetRecipe(final Object rawObject, final ObjectRecipe defaultValue) {
        final Object object = realInstance(rawObject);
        final DataSourceCreator creator = creatorByDataSource.get(object);
        ObjectRecipe recipe = null;
        if (creator != null) {
            recipe = creator.clearRecipe(object);
        }
        if (recipe == null) {
            return defaultValue;
        }
        return recipe;
View Full Code Here

Examples of org.apache.openejb.resource.jdbc.pool.DataSourceCreator

        return recipe;
    }

    public static void destroy(final Object o) throws Throwable {
        final Object instance = realInstance(o);
        final DataSourceCreator remove = creatorByDataSource.remove(instance);
        remove.destroy(instance);
    }
View Full Code Here

Examples of org.apache.openejb.resource.jdbc.pool.DataSourceCreator

            managed = Boolean.parseBoolean((String) properties.remove("transactional")) || managed;
        }

        boolean logSql = SystemInstance.get().getOptions().get(GLOBAL_LOG_SQL_PROPERTY,
                "true".equalsIgnoreCase((String) properties.remove(LOG_SQL_PROPERTY)));
        final DataSourceCreator creator = creator(properties.remove(DATA_SOURCE_CREATOR_PROP), logSql);


        DataSource ds;
        if (createDataSourceFromClass(impl)) { // opposed to "by driver"
            trimNotSupportedDataSourceProperties(properties);

            final ObjectRecipe recipe = new ObjectRecipe(impl);
            recipe.allow(Option.CASE_INSENSITIVE_PROPERTIES);
            recipe.allow(Option.IGNORE_MISSING_PROPERTIES);
            recipe.allow(Option.NAMED_PARAMETERS);
            recipe.setAllProperties(properties);

            final DataSource dataSource = (DataSource) recipe.create();

            if (managed) {
                if (usePool(properties)) {
                    ds = creator.poolManaged(name, dataSource, properties);
                } else {
                    ds = creator.managed(name, dataSource);
                }
            } else {
                if (usePool(properties)) {
                    ds = creator.pool(name, dataSource, properties);
                } else {
                    ds = dataSource;
                }
            }
        } else { // by driver
            if (managed) {
                final XAResourceWrapper xaResourceWrapper = SystemInstance.get().getComponent(XAResourceWrapper.class);
                if (xaResourceWrapper != null) {
                    ds = creator.poolManagedWithRecovery(name, xaResourceWrapper, impl.getName(), properties);
                } else {
                    ds = creator.poolManaged(name, impl.getName(), properties);
                }
            } else {
                ds = creator.pool(name, impl.getName(), properties);
            }
        }

        // ds and creator are associated here, not after the proxying of the next if if active
        creatorByDataSource.put(ds, creator);
View Full Code Here

Examples of org.apache.openejb.resource.jdbc.pool.DataSourceCreator

        final long milliseconds = TimeUnit.MILLISECONDS.convert(duration.getTime(), duration.getUnit());
        properties.put(oldKey, milliseconds + "");
    }

    public static DataSourceCreator creator(final Object creatorName, boolean willBeProxied) {
        final DataSourceCreator defaultCreator = SystemInstance.get().getComponent(DataSourceCreator.class);
        final ClassLoader loader = Thread.currentThread().getContextClassLoader();
        if (creatorName != null && creatorName instanceof String
                && (defaultCreator == null || !creatorName.equals(defaultCreator.getClass().getName()))) {
            String clazz = KNOWN_CREATORS.get(creatorName);
            if (clazz == null) {
                clazz = (String) creatorName;
            }
            if (willBeProxied && clazz.equals(DefaultDataSourceCreator.class.getName())) {
View Full Code Here

Examples of org.apache.openejb.resource.jdbc.pool.DataSourceCreator

    }

    // TODO: should we get a get and a clear method instead of a single one?
    public static ObjectRecipe forgetRecipe(final Object rawObject, final ObjectRecipe defaultValue) {
        final Object object = realInstance(rawObject);
        final DataSourceCreator creator = creatorByDataSource.get(object);
        ObjectRecipe recipe = null;
        if (creator != null) {
            recipe = creator.clearRecipe(object);
        }
        if (recipe == null) {
            return defaultValue;
        }
        return recipe;
View Full Code Here

Examples of org.apache.openejb.resource.jdbc.pool.DataSourceCreator

            managed = Boolean.parseBoolean((String) properties.remove("transactional")) || managed;
        }

        boolean logSql = SystemInstance.get().getOptions().get(GLOBAL_LOG_SQL_PROPERTY,
                "true".equalsIgnoreCase((String) properties.remove(LOG_SQL_PROPERTY)));
        final DataSourceCreator creator = creator(properties.remove(DATA_SOURCE_CREATOR_PROP), logSql);


        DataSource ds;
        if (createDataSourceFromClass(impl)) { // opposed to "by driver"
            trimNotSupportedDataSourceProperties(properties);

            final ObjectRecipe recipe = new ObjectRecipe(impl);
            recipe.allow(Option.CASE_INSENSITIVE_PROPERTIES);
            recipe.allow(Option.IGNORE_MISSING_PROPERTIES);
            recipe.allow(Option.NAMED_PARAMETERS);
            recipe.setAllProperties(properties);
            if (!properties.containsKey("url") && properties.containsKey("JdbcUrl")) { // depend on the datasource class so add all well known keys
                recipe.setProperty("url", properties.getProperty("JdbcUrl"));
            }

            final DataSource dataSource = (DataSource) recipe.create();

            if (managed) {
                if (usePool(properties)) {
                    ds = creator.poolManaged(name, dataSource, properties);
                } else {
                    ds = creator.managed(name, dataSource);
                }
            } else {
                if (usePool(properties)) {
                    ds = creator.pool(name, dataSource, properties);
                } else {
                    ds = dataSource;
                }
            }
        } else { // by driver
            if (managed) {
                final XAResourceWrapper xaResourceWrapper = SystemInstance.get().getComponent(XAResourceWrapper.class);
                if (xaResourceWrapper != null) {
                    ds = creator.poolManagedWithRecovery(name, xaResourceWrapper, impl.getName(), properties);
                } else {
                    ds = creator.poolManaged(name, impl.getName(), properties);
                }
            } else {
                ds = creator.pool(name, impl.getName(), properties);
            }
        }

        // ds and creator are associated here, not after the proxying of the next if if active
        creatorByDataSource.put(ds, creator);
View Full Code Here

Examples of org.apache.openejb.resource.jdbc.pool.DataSourceCreator

        final long milliseconds = TimeUnit.MILLISECONDS.convert(duration.getTime(), duration.getUnit());
        properties.put(oldKey, milliseconds + "");
    }

    public static DataSourceCreator creator(final Object creatorName, boolean willBeProxied) {
        final DataSourceCreator defaultCreator = SystemInstance.get().getComponent(DataSourceCreator.class);
        final ClassLoader loader = Thread.currentThread().getContextClassLoader();
        if (creatorName != null && creatorName instanceof String
                && (defaultCreator == null || !creatorName.equals(defaultCreator.getClass().getName()))) {
            String clazz = KNOWN_CREATORS.get(creatorName);
            if (clazz == null) {
                clazz = (String) creatorName;
            }
            if (willBeProxied && clazz.equals(DefaultDataSourceCreator.class.getName())) {
View Full Code Here

Examples of org.apache.openejb.resource.jdbc.pool.DataSourceCreator

    }

    // TODO: should we get a get and a clear method instead of a single one?
    public static ObjectRecipe forgetRecipe(final Object rawObject, final ObjectRecipe defaultValue) {
        final Object object = realInstance(rawObject);
        final DataSourceCreator creator = creatorByDataSource.get(object);
        ObjectRecipe recipe = null;
        if (creator != null) {
            recipe = creator.clearRecipe(object);
        }
        if (recipe == null) {
            return defaultValue;
        }
        return recipe;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.