Package com.espertech.esper.client

Examples of com.espertech.esper.client.ConfigurationDBRef


    }

    private static void handleConnection(ConfigurationDBAdapter configuration, Node parentNode)
    {
        DOMElementIterator eventTypeNodeIterator = new DOMElementIterator(parentNode.getChildNodes());
        ConfigurationDBRef connection = new ConfigurationDBRef();
        String name = getRequiredAttribute(parentNode, "name");
        configuration.getJdbcConnections().put(name, connection);

        while (eventTypeNodeIterator.hasNext())
        {
            Element subElement = eventTypeNodeIterator.next();

            if (subElement.getNodeName().equals("datasource-connection"))
            {
                String lookup = subElement.getAttributes().getNamedItem("context-lookup-name").getTextContent();
                Properties properties = handleProperties(subElement, "env-property");
                connection.setDataSourceConnection(lookup, properties);
            }
            if (subElement.getNodeName().equals("datasourcefactory-connection"))
            {
                String className = subElement.getAttributes().getNamedItem("class-name").getTextContent();
                Properties properties = handleProperties(subElement, "env-property");
                connection.setDataSourceFactory(properties, className);
            }
            else if (subElement.getNodeName().equals("drivermanager-connection"))
            {
                String className = subElement.getAttributes().getNamedItem("class-name").getTextContent();
                String url = subElement.getAttributes().getNamedItem("url").getTextContent();
                String userName = subElement.getAttributes().getNamedItem("user").getTextContent();
                String password = subElement.getAttributes().getNamedItem("password").getTextContent();
                Properties properties = handleProperties(subElement, "connection-arg");
                connection.setDriverManagerConnection(className, url, userName, password, properties);
            }
            else if (subElement.getNodeName().equals("connection-settings"))
            {
                if (subElement.getAttributes().getNamedItem("auto-commit") != null)
                {
                    String autoCommit = subElement.getAttributes().getNamedItem("auto-commit").getTextContent();
                    connection.setConnectionAutoCommit(Boolean.parseBoolean(autoCommit));
                }
                if (subElement.getAttributes().getNamedItem("transaction-isolation") != null)
                {
                    String transactionIsolation = subElement.getAttributes().getNamedItem("transaction-isolation").getTextContent();
                    connection.setConnectionTransactionIsolation(Integer.parseInt(transactionIsolation));
                }
                if (subElement.getAttributes().getNamedItem("catalog") != null)
                {
                    String catalog = subElement.getAttributes().getNamedItem("catalog").getTextContent();
                    connection.setConnectionCatalog(catalog);
                }
                if (subElement.getAttributes().getNamedItem("read-only") != null)
                {
                    String readOnly = subElement.getAttributes().getNamedItem("read-only").getTextContent();
                    connection.setConnectionReadOnly(Boolean.parseBoolean(readOnly));
                }
            }
        }
    }
View Full Code Here


        this.scheduleBucket = scheduleBucket;
    }

    public ConnectionCache getConnectionCache(String databaseName, String preparedStatementText) throws DatabaseConfigException
    {
        ConfigurationDBRef config = mapDatabaseRef.get(databaseName);
        if (config == null)
        {
            throw new DatabaseConfigException("Cannot locate configuration information for database '" + databaseName + '\'');
        }

        DatabaseConnectionFactory connectionFactory = getConnectionFactory(databaseName);

        boolean retain = config.getConnectionLifecycleEnum().equals(ConfigurationDBRef.ConnectionLifecycleEnum.RETAIN);
        if (retain)
        {
            return new ConnectionCacheImpl(connectionFactory, preparedStatementText);
        }
        else
View Full Code Here

        if (factory != null)
        {
            return factory;
        }

        ConfigurationDBRef config = mapDatabaseRef.get(databaseName);
        if (config == null)
        {
            throw new DatabaseConfigException("Cannot locate configuration information for database '" + databaseName + '\'');
        }

        ConfigurationDBRef.ConnectionSettings settings = config.getConnectionSettings();
        if (config.getConnectionFactoryDesc() instanceof ConfigurationDBRef.DriverManagerConnection)
        {
            ConfigurationDBRef.DriverManagerConnection dmConfig = (ConfigurationDBRef.DriverManagerConnection) config.getConnectionFactoryDesc();
            factory = new DatabaseDMConnFactory(dmConfig, settings);
        }
        else if (config.getConnectionFactoryDesc() instanceof ConfigurationDBRef.DataSourceConnection)
        {
            ConfigurationDBRef.DataSourceConnection dsConfig = (ConfigurationDBRef.DataSourceConnection) config.getConnectionFactoryDesc();
            factory = new DatabaseDSConnFactory(dsConfig, settings);
        }
        else if (config.getConnectionFactoryDesc() instanceof ConfigurationDBRef.DataSourceFactory)
        {
            ConfigurationDBRef.DataSourceFactory dsConfig = (ConfigurationDBRef.DataSourceFactory) config.getConnectionFactoryDesc();
            factory = new DatabaseDSFactoryConnFactory(dsConfig, settings);
        }
        else if (config.getConnectionFactoryDesc() == null)
        {
            throw new DatabaseConfigException("No connection factory setting provided in configuration");
        }
        else
        {
View Full Code Here

        return factory;
    }

    public DataCache getDataCache(String databaseName, EPStatementHandle epStatementHandle) throws DatabaseConfigException
    {
        ConfigurationDBRef config = mapDatabaseRef.get(databaseName);
        if (config == null)
        {
            throw new DatabaseConfigException("Cannot locate configuration information for database '" + databaseName + '\'');
        }

        ConfigurationDataCache dataCacheDesc = config.getDataCacheDesc();
        return DataCacheFactory.getDataCache(dataCacheDesc, epStatementHandle, schedulingService, scheduleBucket);
    }
View Full Code Here

        return DataCacheFactory.getDataCache(dataCacheDesc, epStatementHandle, schedulingService, scheduleBucket);
    }

    public ColumnSettings getQuerySetting(String databaseName) throws DatabaseConfigException
    {
        ConfigurationDBRef config = mapDatabaseRef.get(databaseName);
        if (config == null)
        {
            throw new DatabaseConfigException("Cannot locate configuration information for database '" + databaseName + '\'');
        }
        return new ColumnSettings(config.getMetadataRetrievalEnum(), config.getColumnChangeCase(), config.getSqlTypesMapping());
    }
View Full Code Here

        this.scheduleBucket = scheduleBucket;
    }

    public ConnectionCache getConnectionCache(String databaseName, String preparedStatementText) throws DatabaseConfigException
    {
        ConfigurationDBRef config = mapDatabaseRef.get(databaseName);
        if (config == null)
        {
            throw new DatabaseConfigException("Cannot locate configuration information for database '" + databaseName + '\'');
        }

        DatabaseConnectionFactory connectionFactory = getConnectionFactory(databaseName);

        boolean retain = config.getConnectionLifecycleEnum().equals(ConfigurationDBRef.ConnectionLifecycleEnum.RETAIN);
        if (retain)
        {
            return new ConnectionCacheImpl(connectionFactory, preparedStatementText);
        }
        else
View Full Code Here

        if (factory != null)
        {
            return factory;
        }

        ConfigurationDBRef config = mapDatabaseRef.get(databaseName);
        if (config == null)
        {
            throw new DatabaseConfigException("Cannot locate configuration information for database '" + databaseName + '\'');
        }

        ConfigurationDBRef.ConnectionSettings settings = config.getConnectionSettings();
        if (config.getConnectionFactoryDesc() instanceof ConfigurationDBRef.DriverManagerConnection)
        {
            ConfigurationDBRef.DriverManagerConnection dmConfig = (ConfigurationDBRef.DriverManagerConnection) config.getConnectionFactoryDesc();
            factory = new DatabaseDMConnFactory(dmConfig, settings);
        }
        else if (config.getConnectionFactoryDesc() instanceof ConfigurationDBRef.DataSourceConnection)
        {
            ConfigurationDBRef.DataSourceConnection dsConfig = (ConfigurationDBRef.DataSourceConnection) config.getConnectionFactoryDesc();
            factory = new DatabaseDSConnFactory(dsConfig, settings);
        }
        else if (config.getConnectionFactoryDesc() instanceof ConfigurationDBRef.DataSourceFactory)
        {
            ConfigurationDBRef.DataSourceFactory dsConfig = (ConfigurationDBRef.DataSourceFactory) config.getConnectionFactoryDesc();
            factory = new DatabaseDSFactoryConnFactory(dsConfig, settings);
        }
        else if (config.getConnectionFactoryDesc() == null)
        {
            throw new DatabaseConfigException("No connection factory setting provided in configuration");
        }
        else
        {
View Full Code Here

        return factory;
    }

    public DataCache getDataCache(String databaseName, EPStatementAgentInstanceHandle epStatementAgentInstanceHandle) throws DatabaseConfigException
    {
        ConfigurationDBRef config = mapDatabaseRef.get(databaseName);
        if (config == null)
        {
            throw new DatabaseConfigException("Cannot locate configuration information for database '" + databaseName + '\'');
        }

        ConfigurationDataCache dataCacheDesc = config.getDataCacheDesc();
        return DataCacheFactory.getDataCache(dataCacheDesc, epStatementAgentInstanceHandle, schedulingService, scheduleBucket);
    }
View Full Code Here

        return DataCacheFactory.getDataCache(dataCacheDesc, epStatementAgentInstanceHandle, schedulingService, scheduleBucket);
    }

    public ColumnSettings getQuerySetting(String databaseName) throws DatabaseConfigException
    {
        ConfigurationDBRef config = mapDatabaseRef.get(databaseName);
        if (config == null)
        {
            throw new DatabaseConfigException("Cannot locate configuration information for database '" + databaseName + '\'');
        }
        return new ColumnSettings(config.getMetadataRetrievalEnum(), config.getColumnChangeCase(), config.getSqlTypesMapping());
    }
View Full Code Here

TOP

Related Classes of com.espertech.esper.client.ConfigurationDBRef

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.