Package org.apache.openejb.jee

Examples of org.apache.openejb.jee.DataSource


            dataSource.setName(d.name());
            dataSource.setClassName(d.className());
            dataSource.setTransactional(d.transactional());

            final DataSource existing = consumer.getDataSourceMap().get(dataSource.getKey());

            if (existing != null) return;

            // Optional properties
            if (!d.databaseName().isEmpty()) dataSource.setDatabaseName(d.databaseName());
View Full Code Here


            throw new DeploymentException("Could not construct Reference for datasource " + dsDescription, e);
        }
    }

    private DataSource processDefinition(DataSourceDefinition dsDefinition, JndiConsumer annotatedApp) {
        DataSource dataSource = findDataSource(dsDefinition, annotatedApp);
        boolean existing = dataSource != null;
        if (!existing) {
            dataSource = new DataSource();
            dataSource.setName(dsDefinition.name());
        }

        if (dataSource.getClassName() == null) {
            dataSource.setClassName(dsDefinition.className());
        }

        if (dataSource.getDescription() == null && dsDefinition.description().trim().length() > 0) {
            dataSource.setDescriptions(new Text[]{new Text(null, dsDefinition.description().trim())});
        }

        if (dataSource.getUser() == null && dsDefinition.user().trim().length() > 0) {
            dataSource.setUser(dsDefinition.user().trim());
        }

        if (dataSource.getPassword() == null && dsDefinition.password().trim().length() > 0) {
            dataSource.setPassword(dsDefinition.password().trim());
        }

        if (dataSource.getDatabaseName() == null && dsDefinition.databaseName().trim().length() > 0) {
            dataSource.setDatabaseName(dsDefinition.databaseName().trim());
        }

        if (dataSource.getPortNumber() == null && dsDefinition.portNumber() != -1) {
            dataSource.setPortNumber(dsDefinition.portNumber());
        }

        if (dataSource.getServerName() == null && dsDefinition.serverName().trim().length() > 0) {
            dataSource.setServerName(dsDefinition.serverName().trim());
        }

        if (dataSource.getUrl() == null && dsDefinition.url().trim().length() > 0) {
            dataSource.setUrl(dsDefinition.url().trim());
        }

        if (dataSource.getInitialPoolSize() == null && dsDefinition.initialPoolSize() != -1) {
            dataSource.setInitialPoolSize(dsDefinition.initialPoolSize());
        }

        if (dataSource.getMaxPoolSize() == null && dsDefinition.maxPoolSize() != -1) {
            dataSource.setMaxPoolSize(dsDefinition.maxPoolSize());
        }

        if (dataSource.getMinPoolSize() == null && dsDefinition.minPoolSize() != -1) {
            dataSource.setMinPoolSize(dsDefinition.minPoolSize());
        }

        if (dataSource.getMaxIdleTime() == null && dsDefinition.maxIdleTime() != -1) {
            dataSource.setMaxIdleTime(dsDefinition.maxIdleTime());
        }

        if (dataSource.getMaxStatements() == null && dsDefinition.maxStatements() != -1) {
            dataSource.setMaxStatements(dsDefinition.maxStatements());
        }

        if (dataSource.getLoginTimeout() == null && dsDefinition.loginTimeout() != 0) {
            dataSource.setLoginTimeout(dsDefinition.loginTimeout());
        }

        if (dataSource.getIsolationLevel() == null) {
            dataSource.setIsolationLevel(IsolationLevel.fromFlag(dsDefinition.isolationLevel()));
        }

        if (dataSource.getTransactional() == null) {
            dataSource.setTransactional(dsDefinition.transactional());
        }

        if (dataSource.getProperty().size() == 0) {
            String[] properties = dsDefinition.properties();
            if (properties != null) {
                for (String property : properties) {
                    String[] tokens = property.split("=");
                    Property prop = new Property();
                    prop.setName(tokens[0]);
                    prop.setValue(tokens[1]);
                    dataSource.getProperty().add(prop);
                }
            }
        }
        if (!existing) {
            annotatedApp.getDataSource().add(dataSource);
View Full Code Here

            dataSource.setName(d.name());
            dataSource.setClassName(d.className());
            dataSource.setTransactional(d.transactional());

            final DataSource existing = consumer.getDataSourceMap().get(dataSource.getKey());

            if (existing != null) return;

            // Optional properties
            if (!d.databaseName().isEmpty()) dataSource.setDatabaseName(d.databaseName());
View Full Code Here

            dataSource.setName(d.name());
            dataSource.setClassName(d.className());
            dataSource.setTransactional(d.transactional());

            final DataSource existing = consumer.getDataSourceMap().get(dataSource.getKey());

            if (existing != null) return;

            // Optional properties
            if (!d.databaseName().isEmpty()) dataSource.setDatabaseName(d.databaseName());
View Full Code Here

                }
            }
        }

        private void buildDataSourceDefinition(final JndiConsumer consumer, final DataSourceDefinition d) {
            final DataSource dataSource = new DataSource();

            dataSource.setName(d.name());
            dataSource.setClassName(d.className());
            dataSource.setTransactional(d.transactional());

            final DataSource existing = consumer.getDataSourceMap().get(dataSource.getKey());

            if (existing != null) {
                return;
            }
View Full Code Here

                }
            }
        }

        private void buildDataSourceDefinition(final JndiConsumer consumer, final DataSourceDefinition d) {
            final DataSource dataSource = new DataSource();

            dataSource.setName(d.name());
            dataSource.setClassName(d.className());
            dataSource.setTransactional(d.transactional());

            final DataSource existing = consumer.getDataSourceMap().get(dataSource.getKey());

            if (existing != null) {
                return;
            }
View Full Code Here

                }
            }
        }

        private void buildDataSourceDefinition(final JndiConsumer consumer, final DataSourceDefinition d) {
            final DataSource dataSource = new DataSource();

            dataSource.setName(d.name());
            dataSource.setClassName(d.className());
            dataSource.setTransactional(d.transactional());

            final DataSource existing = consumer.getDataSourceMap().get(dataSource.getKey());

            if (existing != null) {
                return;
            }
View Full Code Here

                }
            }
        }

        private void buildDataSourceDefinition(final JndiConsumer consumer, final DataSourceDefinition d) {
            final DataSource dataSource = new DataSource();

            dataSource.setName(d.name());
            dataSource.setClassName(d.className());
            dataSource.setTransactional(d.transactional());

            final DataSource existing = consumer.getDataSourceMap().get(dataSource.getKey());

            if (existing != null) {
                return;
            }
View Full Code Here

                }
            }
        }

        private void buildDataSourceDefinition(final JndiConsumer consumer, final DataSourceDefinition d) {
            final DataSource dataSource = new DataSource();

            dataSource.setName(d.name());
            dataSource.setClassName(d.className());
            dataSource.setTransactional(d.transactional());

            final DataSource existing = consumer.getDataSourceMap().get(dataSource.getKey());

            if (existing != null) {
                return;
            }
View Full Code Here

            dataSource.setName(d.name());
            dataSource.setClassName(d.className());
            dataSource.setTransactional(d.transactional());

            final DataSource existing = consumer.getDataSourceMap().get(dataSource.getKey());

            if (existing != null) return;

            // Optional properties
            if (!d.databaseName().isEmpty()) dataSource.setDatabaseName(d.databaseName());
View Full Code Here

TOP

Related Classes of org.apache.openejb.jee.DataSource

Copyright © 2018 www.massapicom. 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.