Examples of DataSourceInfo


Examples of com.googlecode.psiprobe.model.DataSourceInfo

* Time: 00:49:42
* To change this template use File | Settings | File Templates.
*/
public class TomcatDbcpDatasourceAccessor implements DatasourceAccessor {
    public DataSourceInfo getInfo(Object resource) throws Exception {
        DataSourceInfo dataSourceInfo = null;
        if (canMap(resource)) {
            BasicDataSource source = (BasicDataSource) resource;
            dataSourceInfo = new DataSourceInfo();
            dataSourceInfo.setBusyConnections(source.getNumActive());
            dataSourceInfo.setEstablishedConnections(source.getNumIdle() + source.getNumActive());
            dataSourceInfo.setMaxConnections(source.getMaxActive());
            dataSourceInfo.setJdbcURL(source.getUrl());
            dataSourceInfo.setUsername(source.getUsername());
            dataSourceInfo.setResettable(false);
        }
        return dataSourceInfo;
    }
View Full Code Here

Examples of com.googlecode.psiprobe.model.DataSourceInfo

        });

        // group datasources by JDBC URL and calculate aggregated totals
        DataSourceInfoGroup dsGroup = null;
        for (Iterator i = dataSources.iterator(); i.hasNext();) {
            DataSourceInfo ds = (DataSourceInfo) i.next();

            if (dsGroup == null || !dsGroup.getJdbcURL().equalsIgnoreCase(ds.getJdbcURL())) {
                dsGroup = new DataSourceInfoGroup(ds);
                dataSourceGroups.add(dsGroup);
            } else {
                dsGroup.addDataSourceInfo(ds);
            }
View Full Code Here

Examples of com.odb.collector.DataSourceInfo

      if (ds.getDataSourceID().isEmpty()) {
        ds.setDataSourceID(addDataSource(ds.getDataConfig()));
        storeConfig(ps);
      } else { // Check if the presented data source is valid
        try {
          DataSourceInfo dsInfo = inqWS.getDataSourceInfo(ds.getDataSourceID());
          if (dsInfo == null) {
            log.warn("Invalid DataSourceID:" + ds.getDataSourceID() + " in the configuration file. Re-registering dataSource");
            ds.setDataSourceID(addDataSource(ds.getDataConfig()));
            storeConfig(ps);
          }
View Full Code Here

Examples of com.odb.core.dao.dto.DataSourceInfo

  /* (non-Javadoc)
   * @see org.springframework.jdbc.core.ResultSetExtractor#extractData(java.sql.ResultSet)
   */
  public DataSourceInfo extractData(ResultSet rs) throws SQLException,
      DataAccessException {
    DataSourceInfo dsInfo = null;
    if(rs.next()){
      dsInfo = new DataSourceInfo();
      dsInfo.setDataSourceID(rs.getString("DATASOURCE_ID"));
      dsInfo.setDataSourceName(rs.getString("DATASOURCE_NAME"));
      dsInfo.setPublisherID(rs.getString("PUBLISHER_ID"));
      dsInfo.setTimeoutInterval(rs.getLong("TIMEOUT_INTERVAL"));
      dsInfo.setSeriesCount(rs.getInt("NUM_OF_SERIES"));
    }
    return dsInfo;
  }
View Full Code Here

Examples of com.odb.view.dashboard.client.dto.DataSourceInfo

   *
   * @param dataSourceInfo the data source info
   * @return the client data source info
   */
  public static DataSourceInfo getClientDataSourceInfo(com.odb.core.dao.dto.DataSourceInfo dataSourceInfo){
    DataSourceInfo dsi = new DataSourceInfo()
    dsi.setDataSourceID(dataSourceInfo.getDataSourceID());
    dsi.setPublisherID(dataSourceInfo.getPublisherID());
    dsi.setDataSourceName(dataSourceInfo.getDataSourceName());
    dsi.setTimeoutInterval(dataSourceInfo.getTimeoutInterval());
    dsi.setSeriesCount(dataSourceInfo.getSeriesCount());
    return dsi;
  }
View Full Code Here

Examples of org.apache.cayenne.conn.DataSourceInfo

    /**
     * Returns a {@link DataSourceInfo} object, loading it from XML file if the factory is
     * configured to do so.
     */
    protected DataSourceInfo getDriverInfo(String location) throws Exception {
        DataSourceInfo info = null;

        if (loadFromXML) {
            try {
                info = new XMLConfigLoader().loadDriverInfo(location);
            }
            catch (ConfigurationException e) {
                // ignoring...
            }
        }

        return info != null ? info : new DataSourceInfo();
    }
View Full Code Here

Examples of org.apache.cayenne.conn.DataSourceInfo

        this.resources = resources;
    }

    public DbAdapter get() throws ConfigurationException {

        DataSourceInfo connectionInfo = resources.getConnectionInfo();
        AccessStackAdapter adapter = resources.getAccessStackAdapter(connectionInfo
                .getAdapterClassName());

        return adapter.getAdapter();
    }
View Full Code Here

Examples of org.apache.cayenne.conn.DataSourceInfo

    public CayenneResourcesAccessStackAdapterProvider(CayenneResources resources) {
        this.resources = resources;
    }

    public AccessStackAdapter get() throws ConfigurationException {
        DataSourceInfo connectionInfo = resources.getConnectionInfo();
        return resources.getAccessStackAdapter(connectionInfo.getAdapterClassName());
    }
View Full Code Here

Examples of org.apache.cayenne.conn.DataSourceInfo

    /**
     * Loads connection properties from $HOME/.cayenne/connection.properties.
     */
    protected static ConnectionProperties loadDefaultProperties() {

        DataSourceInfo dsi = new DataSourceInfo();

        String adapter = System.getProperty(ADAPTER_KEY_MAVEN);
        String usr = System.getProperty(USER_NAME_KEY_MAVEN);
        String pass = System.getProperty(PASSWORD_KEY_MAVEN);
        String url = System.getProperty(URL_KEY_MAVEN);
        String driver = System.getProperty(DRIVER_KEY_MAVEN);

        File f = new File(cayenneUserDir(), PROPERTIES_FILE);

        try {
            if (f.exists()) {

                ConnectionProperties cp = new ConnectionProperties(
                        new ExtendedProperties(f.getAbsolutePath()));

                if (((adapter != null && !adapter.startsWith("$"))
                        || (usr != null && !usr.startsWith("$"))
                        || (pass != null && !pass.startsWith("$"))
                        || (url != null && !url.startsWith("$")) || (driver != null && !driver
                        .startsWith("$")))
                        && (System.getProperty("cayenneTestConnection") != null && !System
                                .getProperty("cayenneTestConnection")
                                .equals("null"))) {

                    DataSourceInfo dsiOld = null;
                    if (connectionInfos.get(System.getProperty("cayenneTestConnection")) != null) {
                        dsiOld = connectionInfos.get(System
                                .getProperty("cayenneTestConnection"));
                        connectionInfos.remove(System
                                .getProperty("cayenneTestConnection"));
                    }

                    if (adapter != null && !adapter.startsWith("$")) {
                        dsi.setAdapterClassName(adapter);
                    }
                    else if (dsiOld != null) {
                        dsi.setAdapterClassName(dsiOld.getAdapterClassName());
                    }
                    if (usr != null && !usr.startsWith("$")) {
                        dsi.setUserName(usr);
                    }
                    else if (dsiOld != null) {
                        dsi.setUserName(dsiOld.getUserName());
                    }
                    if (pass != null && !pass.startsWith("$")) {
                        dsi.setPassword(pass);
                    }
                    else if (dsiOld != null) {
                        dsi.setPassword(dsiOld.getPassword());
                    }
                    if (url != null && !url.startsWith("$")) {
                        dsi.setDataSourceUrl(url);
                    }
                    else if (dsiOld != null) {
                        dsi.setDataSourceUrl(dsiOld.getDataSourceUrl());
                    }
                    if (driver != null && !driver.startsWith("$")) {
                        dsi.setJdbcDriver(driver);
                    }
                    else if (dsiOld != null) {
                        dsi.setJdbcDriver(dsiOld.getJdbcDriver());
                    }
                    connectionInfos.put(System.getProperty("cayenneTestConnection"), dsi);
                }
                else {
                    return cp;
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
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.