Examples of DataSourceInfo


Examples of org.apache.cayenne.conn.DataSourceInfo

     */
    public DataSourceInfo getConnectionInfo(String name) {

        if (EMBEDDED_DATASOURCE.equals(name)) {
            // Create embedded data source instead
            DataSourceInfo connectionInfo = new DataSourceInfo();
            connectionInfo.setAdapterClassName(EMBEDDED_DATASOURCE_DBADAPTER);
            connectionInfo.setUserName(EMBEDDED_DATASOURCE_USERNAME);
            connectionInfo.setPassword(EMBEDDED_DATASOURCE_PASSWORD);
            connectionInfo.setDataSourceUrl(EMBEDDED_DATASOURCE_URL);
            connectionInfo.setJdbcDriver(EMBEDDED_DATASOURCE_JDBC_DRIVER);
            return connectionInfo;
        }

        synchronized (connectionInfos) {
            return connectionInfos.get(name);
View Full Code Here

Examples of org.apache.cayenne.conn.DataSourceInfo

    /**
     * Creates a DataSourceInfo object from a set of properties.
     */
    public DataSourceInfo buildDataSourceInfo(ExtendedProperties props) {
        DataSourceInfo dsi = new DataSourceInfo();

        String adapter = props.getString(ADAPTER_KEY);

        // try legacy adapter key
        if (adapter == null) {
            adapter = props.getString(ADAPTER20_KEY);
        }

        dsi.setAdapterClassName(adapter);
        dsi.setUserName(props.getString(USER_NAME_KEY));
        dsi.setPassword(props.getString(PASSWORD_KEY));
        dsi.setDataSourceUrl(props.getString(URL_KEY));
        dsi.setJdbcDriver(props.getString(DRIVER_KEY));

        return dsi;
    }
View Full Code Here

Examples of org.apache.cayenne.conn.DataSourceInfo

    public void testGetDataSourceFactory_Implicit() throws Exception {

        DataNodeDescriptor nodeDescriptor = new DataNodeDescriptor();
        nodeDescriptor.setName("node1");
        nodeDescriptor.setDataSourceDescriptor(new DataSourceInfo());

        Module testModule = new Module() {

            public void configure(Binder binder) {
                binder.bind(AdhocObjectFactory.class).to(DefaultAdhocObjectFactory.class);
View Full Code Here

Examples of org.apache.cayenne.conn.DataSourceInfo

    @Inject
    protected ResourceLocator resourceLocator;

    public DataSource getDataSource(DataNodeDescriptor nodeDescriptor) throws Exception {

        DataSourceInfo dataSourceDescriptor = nodeDescriptor.getDataSourceDescriptor();

        if (dataSourceDescriptor == null) {
            String message = "Null dataSourceDescriptor for nodeDescriptor '"
                    + nodeDescriptor.getName()
                    + "'";
            logger.info(message);
            throw new ConfigurationException(message);
        }

        ConnectionLogger logger = new ConnectionLogger();
        try {
            return new PoolManager(
                    dataSourceDescriptor.getJdbcDriver(),
                    dataSourceDescriptor.getDataSourceUrl(),
                    dataSourceDescriptor.getMinConnections(),
                    dataSourceDescriptor.getMaxConnections(),
                    dataSourceDescriptor.getUserName(),
                    dataSourceDescriptor.getPassword(),
                    logger);
        }
        catch (Exception e) {
            QueryLogger.logConnectFailure(e);
            throw e;
View Full Code Here

Examples of org.apache.cayenne.conn.DataSourceInfo

        }

        public void init(String name, Attributes attrs) {
            String className = attrs.getValue("", "class");
            logger.info("loading driver " + className);
            driverInfo = new DataSourceInfo();
            driverInfo.setJdbcDriver(className);
        }
View Full Code Here

Examples of org.apache.cayenne.conn.DataSourceInfo

    /**
     * Constructor for ConnectionProperties.
     */
    public ConnectionProperties(ExtendedProperties props) {
        for (final String name : extractNames(props)) {
            DataSourceInfo dsi = buildDataSourceInfo(props.subset(name));
            connectionInfos.put(name, dsi);
        }
    }
View Full Code Here

Examples of org.apache.cayenne.conn.DataSourceInfo

     */
    public DataSourceInfo getConnectionInfo(String name) {

        if (EMBEDDED_DATASOURCE.equals(name)) {
            // Create embedded data source instead
            DataSourceInfo connectionInfo = new DataSourceInfo();
            connectionInfo.setAdapterClassName(EMBEDDED_DATASOURCE_DBADAPTER);
            connectionInfo.setUserName(EMBEDDED_DATASOURCE_USERNAME);
            connectionInfo.setPassword(EMBEDDED_DATASOURCE_PASSWORD);
            connectionInfo.setDataSourceUrl(EMBEDDED_DATASOURCE_URL);
            connectionInfo.setJdbcDriver(EMBEDDED_DATASOURCE_JDBC_DRIVER);
            return connectionInfo;
        }

        synchronized (connectionInfos) {
            return connectionInfos.get(name);
View Full Code Here

Examples of org.apache.cayenne.conn.DataSourceInfo

    /**
     * Creates a DataSourceInfo object from a set of properties.
     */
    protected DataSourceInfo buildDataSourceInfo(ExtendedProperties props) {
        DataSourceInfo dsi = new DataSourceInfo();

        String adapter = props.getString(ADAPTER_KEY);
       
        // try legacy adapter key
        if(adapter == null) {
            adapter = props.getString(ADAPTER20_KEY);
        }
       
        dsi.setAdapterClassName(adapter);
        dsi.setUserName(props.getString(USER_NAME_KEY));
        dsi.setPassword(props.getString(PASSWORD_KEY));
        dsi.setDataSourceUrl(props.getString(URL_KEY));
        dsi.setJdbcDriver(props.getString(DRIVER_KEY));

        return dsi;
    }
View Full Code Here

Examples of org.apache.geronimo.console.databasemanager.DataSourceInfo

                }
            } catch (Exception e) {
                throw new PortletException(e);
            }

            DataSourceInfo info = new DataSourceInfo();
            info.setObjectName(gbeanName);
            info.setName(gbeanName.getKeyProperty("name"));
            try {
                info.setJndiName((String) kernel.getAttribute(gbeanName,
                        "globalJNDIName"));
                info.setState(new Integer(kernel.getGBeanState(gbeanName)));
                //check if user asked this connection to be tested
                if ((gbeanName.toString().equals(name)) && (check)) {
                    info.setWorking(true);
                    try {
                        Object cf = kernel.invoke(gbeanName, "$getResource");
                        testConnection(cf);
                        info.setMessage("Connected");
                    } catch (Exception e) {
                        Throwable t = e;
                        String message = "Failed: ";
                        if (t.getMessage() != null) {
                            message = message + t.getMessage();
                        } else {
                            while (t.getMessage() == null) {
                                t = t.getCause();
                                if (t != null) {
                                    message = message + t.getMessage();
                                } else {
                                    message = message + "Unknown reason";
                                }
                            }
                        }
                        info.setMessage(message);
                    }
                } else {
                    info.setWorking(false);
                }

            } catch (Exception e) {
                throw new PortletException(e);
            }
View Full Code Here

Examples of org.apache.geronimo.console.jmsmanager.DataSourceInfo

                }
            } catch (Exception e) {
                throw new PortletException(e);
            }

            DataSourceInfo info = new DataSourceInfo();
            info.setObjectName(gbeanName);
            info.setName(gbeanName.getKeyProperty("name"));
            try {
                info.setState(new Integer(kernel.getGBeanState(gbeanName)));
                //check if user asked this connection to be tested
                if ((gbeanName.toString().equals(name)) && (check)) {
                    info.setWorking(true);
                    try {
                        Object cf = kernel.invoke(gbeanName, "$getResource");
                        testConnection(cf);
                        info.setMessage("Connected");
                    } catch (Exception e) {
                        Throwable t = e;
                        String message = "Failed: ";
                        if (t.getMessage() != null) {
                            message = message + t.getMessage();
                        } else {
                            while (t.getMessage() == null) {
                                t = t.getCause();
                                if (t != null) {
                                    message = message + t.getMessage();
                                } else {
                                    message = message + "Unknown reason";
                                }
                            }
                        }
                        info.setMessage(message);
                    }
                } else {
                    info.setWorking(false);
                }

            } catch (Exception e) {
                throw new PortletException(e);
            }
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.