Get the real data-source selected. <br>
This overrides to return data-source for MasterDB as default.
@return The instance of real data-source. (NotNull)
358451
@Override
    public DataSource getSelectedDataSource() {
        final String dataSourceName = selectableDataSourceHolder.getCurrentSelectableDataSourceKey();
        if (dataSourceName != null) {
            return selectableDataSourceHolder.getSelectedDataSource();
        } else { // means no name set on thread local
            try {
                selectableDataSourceHolder.switchSelectableDataSourceKey(SlaveDBAccessor.MASTER_DB); // as default
                return selectableDataSourceHolder.getSelectedDataSource();
            } finally {
                selectableDataSourceHolder.switchSelectableDataSourceKey(null); // restore
            }
        }
    }
801607
public String getDatabase() {

        if (m_databaseKey == null) {
            m_databaseKey = getExtProperty("db.name");
        }
        if (CmsStringUtil.isEmpty(m_databaseKey)) {
            m_databaseKey = getSortedDatabases().get(0);
        }
        return m_databaseKey;
    }
637493
Connection getDataSourceConnection() {
        Connection connection = null;
        try {
            connection = dataSource.getConnection();
        } catch (SQLException ex) {
            throw new InitializationException("Could not obtain the db connection: Cannot get connection", ex);
        }
        return connection;
    }
1121784
public static DataSource getDataSource(String source) {
		DataSource ds = dataSources.get(source);
		if (ds == null){
			synchronized (dataSourcesStructureLock){
				ds = dataSources.get(source);
				if (ds == null){
					ds = createDataSource(source);
					if (ds != null){
						dataSources.put(source, ds);
					}
				}
			}
		}
		return ds;
	}
999414
public String getDatabaseName()
    {
        // ****Override this****, If not, try to figure it out
        if (m_vRecordList != null)
            if (this.getRecordlistAt(0) != null)
                return this.getRecordlistAt(0).getDatabaseName();
        return DBConstants.BLANK; // Blank
    }
908081
@Bean
  public DataSource dataSource() {
    DriverManagerDataSource dataSource = new DriverManagerDataSource(dbUrl, userName, password);
    dataSource.setDriverClassName(Driver.class.getName());

    // no need shutdown, EmbeddedDatabaseFactoryBean will take care of this
    // EmbeddedDatabaseBuilder builder = new EmbeddedDatabaseBuilder();
    // EmbeddedDatabase dataSource = builder.setType(EmbeddedDatabaseType.H2).setName("h2_example").build();
    return dataSource;
  }
579811
public Object getControlValue()
    {
        int iIndex = this.getSelectedIndex();
        try   {
            FieldTable table = m_record.getTable();
            if (m_strIndexValue != null)
                if (iIndex != 0)
                    if (table.get(iIndex - 1) != null)  // I use get, so the index matches the index of JComboBox
            {
                FieldInfo field = m_record.getField(m_strIndexValue);
                if (field == null)
                    field = m_record.getField(0);
                return field.getData();
            }
        } catch (Exception ex)  {
            ex.printStackTrace();
        }
        if (iIndex == 0)
            return null;    // None selected.
        return this.getSelectedItem();
    }
208888
public function getDataSource()
    {
        $this->dataSource->bindCellsset($this->getCells());

        if (null != $this->getDefaultOrderDirection() && null != $this->getDefaultOrderField() && ($this->dataSource instanceof \DataGrid\DataSource\DataSourceSortableInterface)) {
            $this->dataSource->addOrderBy($this->getDefaultOrderField(), $this->getDefaultOrderDirection());
        }

        if ($this->hasFilter()) {
            $this->getFilter()->applyTo($this->dataSource);
        }

        if (null != $this->getPaginator()) {
            $this->getPaginator()->applyTo($this->dataSource);
        }
        return $this->dataSource;
    }
1308328
public String getDataset() {
    if (isReference()) {
      final LibrarySet master = (LibrarySet) getCheckedRef(LibrarySet.class, "LibrarySet");
      return master.getDataset();
    }
    return this.dataset;
  }
9956
public SQLDialect determineSqlDialect(DataSource dataSource) {
		if (this.sqlDialect != null) {
			return this.sqlDialect;
		}
		return SqlDialectLookup.getDialect(dataSource);
	}
527290
public Reference getReference() throws NamingException {
    Reference ref = super.getReference();
    ref.add(new StringRefAddr("dataSourceName", dataSourceName));
    if (initialConnections > 0) {
      ref.add(new StringRefAddr("initialConnections", Integer.toString(initialConnections)));
    }
    if (maxConnections > 0) {
      ref.add(new StringRefAddr("maxConnections", Integer.toString(maxConnections)));
    }
    return ref;
  }
86557
@SneakyThrows
    public DataSource createDataSource() {
        DataSource result = (DataSource) Class.forName(dataSourceClassName).newInstance();
        Method[] methods = result.getClass().getMethods();
        for (Entry<String, Object> entry : properties.entrySet()) {
            if (SKIPPED_PROPERTY_NAMES.contains(entry.getKey())) {
                continue;
            }
            Optional<Method> setterMethod = findSetterMethod(methods, entry.getKey());
            if (setterMethod.isPresent()) {
                setterMethod.get().invoke(result, entry.getValue());
            }
        }
        return result;
    }
358019
public String getRawMasterDataSourceName(final String dataSourceName) {
        for (MasterSlaveRuleConfiguration each : shardingRuleConfig.getMasterSlaveRuleConfigs()) {
            if (each.getName().equals(dataSourceName)) {
                return each.getMasterDataSourceName();
            }
        }
        return dataSourceName;
    }
300453
public List<SourceCount> getSources() {
        final SQLiteDatabase db = getDb();
        List<SourceCount> ret = new ArrayList<>();
        if (db == null) {
            return ret;
        }
        Cursor cur = null;
        try {
            cur = db.rawQuery(
                    "select "
                            + COLUMN_PROVIDER
                            + ",count(*) "
                            + ",min(length(" + COLUMN_TILE + ")) "
                            + ",max(length(" + COLUMN_TILE + ")) "
                            + ",sum(length(" + COLUMN_TILE + ")) "
                    + "from " + TABLE + " "
                    + "group by " + COLUMN_PROVIDER, null);
            while (cur.moveToNext()) {
                final SourceCount c = new SourceCount();
                c.source = cur.getString(0);
                c.rowCount = cur.getLong(1);
                c.sizeMin = cur.getLong(2);
                c.sizeMax = cur.getLong(3);
                c.sizeTotal = cur.getLong(4);
                c.sizeAvg = c.sizeTotal / c.rowCount;
                ret.add(c);
            }
        } catch(Exception e) {
            catchException(e);
        } finally {
            if (cur != null) {
                cur.close();
            }
        }
        return ret;
    }
157135
public function getDb()
    {
        if (!$this->db) {
            $this->db = $this->source;

            if (!$this->db instanceof AbstractDatabaseDriver) {
                $this->db = Ioc::getDatabase();
            }
        }

        return $this->db;
    }
1238811
@Override
  public final synchronized DataSource lazyGetDataSource() throws Exception {
    String beanName = getDataSourceName();
    HikariDataSource dataSource =
      (HikariDataSource) getBeansMap().get(beanName);
    if (dataSource == null) {
      dataSource = new HikariDataSource();
      dataSource.setJdbcUrl(getDatabaseName());
      dataSource.setDriverClassName("org.sqlite.JDBC");
      getBeansMap().put(beanName, dataSource);
      lazyGetLogger().info(null, FactoryAppBeansSqlite.class, beanName
        + " has been created.");
    }
    return dataSource;
  }
46648
public static <T> Source<T> empty() {
        return new AbstractSource<T>() {
            @Override
            public T computeNext() {
                return endOfData();
            }
        };
    }