Get a Datasource object

        :rtype: Datasource
509299
def get_datasource(self, source_id, datasource_id):
        
        target_url = self.client.get_url('DATASOURCE', 'GET', 'single', {'source_id': source_id, 'datasource_id': datasource_id})
        return self.client.get_manager(Datasource)._get(target_url)
1163549
def get_resource(id):
    ''''''
    dataset = Dataset.objects(resources__id=id).first()
    if dataset:
        return get_by(dataset.resources, 'id', id)
    else:
        return CommunityResource.objects(id=id).first()
564069
public function getDatasourceService()
    {
        if ($this->datasourceService == null) {
            $this->datasourceService = $this->newService('AppserverIo\Appserver\Core\Api\DatasourceService');
        }
        return $this->datasourceService;
    }
641482
public static Database getDatabase(DataSource dataSource) {
		if (dataSource == null) {
			return Database.DEFAULT;
		}
		try {
			String url = JdbcUtils.extractDatabaseMetaData(dataSource, "getURL");
			DatabaseDriver driver = DatabaseDriver.fromJdbcUrl(url);
			Database database = LOOKUP.get(driver);
			if (database != null) {
				return database;
			}
		}
		catch (MetaDataAccessException ex) {
			logger.warn("Unable to determine jdbc url from datasource", ex);
		}
		return Database.DEFAULT;
	}
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;
	}
1106022
def getConnection(self):
        

        klass = self.entities.keys()
        if not klass:
            raise AttributeError('No class found from entities. Did you add entities to the Populator ?')
        klass = list(klass)[0]

        return klass.objects._db
707349
DataSource getDataSource() {
        if (com.ibm.websphere.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINER)) {
            LoggingUtil.SESSION_LOGGER_WAS.entering(methodClassName, methodNames[GET_DATA_SOURCE]);
        }

        if (dataSource != null)
            return dataSource;

        try {

            //            Properties p = new Properties();
            //
            //            p.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY, "com.ibm.websphere.naming.WsnInitialContextFactory");
            //            InitialContext ic = new javax.naming.InitialContext(p);
            beginDBContext(); // PK06395/d321615
            //            dataSource = (DataSource) ic.lookup(_smc.getJNDIDataSourceName());

            ResourceConfig rc = this.getDatabaseStoreService().getResourceConfigFactory().createResourceConfig("javax.sql.DataSource");
            rc.setResAuthType(ResourceConfig.AUTH_CONTAINER);
            rc.setSharingScope(ResourceConfig.SHARING_SCOPE_SHAREABLE);
            rc.setIsolationLevel(Connection.TRANSACTION_READ_COMMITTED);
            //            ResRef.APPLICATION, // resAuth - org.eclipse.jst.j2ee.common.ResAuthTypeBase.APPLICATION=
            //            ResRef.SHAREABLE, // resSharingScope - org.eclipse.jst.j2ee.common.ResSharingScopeType.SHAREABLE
            //            ResRef.TRANSACTION_READ_COMMITTED); // resIsolationLevel - com.ibm.ejs.models.base.extensions.commonext.IsolationLevelKind.TRANSACTION_READ_COMMITTED
            dataSource = (DataSource) this.getDatabaseStoreService().getDataSourceFactory().createResource(rc);

            //            dataSource = (DataSource)SessionMgrComponentImpl.getDataSourceFactory().createResource(null); // direct JNDI lookup
            endDBContext(); // PK06395/d321615
            return dataSource;

        } catch (Exception e) {
            com.ibm.ws.ffdc.FFDCFilter.processException(e, "com.ibm.ws.session.store.db.DatabaseHashMap.getDataSource", "558", this);
            LoggingUtil.SESSION_LOGGER_WAS.logp(Level.SEVERE, methodClassName, methodNames[GET_DATA_SOURCE], "DatabaseHashMap.dataSrcErr");
            LoggingUtil.SESSION_LOGGER_WAS.logp(Level.SEVERE, methodClassName, methodNames[GET_DATA_SOURCE], "CommonMessage.exception", e);
            dataSource = null;
        }
        return null;
    }
1065605
function dataSource(type) {
  if (arguments.length === 1 && (utils.isObject(type) || typeof type === 'string')) {
    return type
  }
  else if (!ds.hasOwnProperty(type)) {
    throw new FieldError('Unknown data source type: ' + type)
  }

  var args = utils.args(arguments, 1)
    , dataSource = {
      type: type
    }

  ds[type].apply(dataSource, args)

  return dataSource
}
756529
function findDataSource(connections, dataSource, cb) {
  var query = {

  };

  //Searching By ID.
  query[CONSTANTS.DATA_SOURCE_ID] = dataSource[CONSTANTS.DATA_SOURCE_ID];

  //Looking up a full data source document as we are updating
  lookUpDataSources(connections, {
    query: query,
    lean: false
  }, function(err, dataSources) {
    if (err) {
      return cb(buildErrorResponse({
        error: err,
        userDetail: "Unexpected Error When Searching For A Data Source",
        code: ERROR_CODES.FH_FORMS_UNEXPECTED_ERROR
      }));
    }

    //Should only be one data source
    if (dataSources.length !== 1) {
      return cb(buildErrorResponse({
        error: new Error("Data Source Not Found"),
        systemDetail: "Requested ID: "  + dataSource[CONSTANTS.DATA_SOURCE_ID],
        code: ERROR_CODES.FH_FORMS_NOT_FOUND
      }));
    }

    return cb(undefined, dataSource, dataSources[0]);
  });
}
1056456
public function getDataSource()
    {
        foreach (self::$data_file_names as $name) {
            $path = $this->getPath() . '/' . $name;
            if (file_exists($path)) {
                return new DataSource($path);
            }
        }

        return false;
    }
1357060
public DataSource getDataSource() {
        if(dataSource == null) {
            LOG.info("Having to construct a new DataSource");

            dataSource = new DataSource();

            dataSource.setDriverClassName(dbSettings.getDriver());
            dataSource.setUrl(dbSettings.getJdbcUrl());
            dataSource.setUsername(dbSettings.getUser());
            dataSource.setPassword(dbSettings.getPass());

            dataSource.setMaxActive(dbSettings.getMaxActive());
            dataSource.setMaxIdle(dbSettings.getMaxIdle());
            dataSource.setMinIdle(dbSettings.getMinIdle());
            dataSource.setInitialSize(dbSettings.getInitialSize());
            dataSource.setTestOnBorrow(dbSettings.getTestOnBorrow());
            dataSource.setTestOnReturn(dbSettings.getTestOnReturn());
            dataSource.setTestWhileIdle(dbSettings.getTestWhileIdle());
            dataSource.setValidationQuery(dbSettings.getValidationQuery());
            dataSource.setLogValidationErrors(dbSettings.getLogValidationErrors());

            // a catch-all for any other properties that are needed
            dataSource.setDbProperties(dbSettings.getProperties());
        }

        return dataSource;
    }
759233
def get(self, dataset_name):
        
        url = "{0}/{1}".format(self._cached_datasets_url, dataset_name)
        return self._get_json(HTTPMethods.GET, url, self._get_read_key())
1325673
private DataSource getDataSource(ComponentHelper cmp, Resource resource) {
    try {
      /*
       * by default the path is read from request "path" parameter
       * here we overwrite it via a synthetic resource because the path may be overwritten by validation logic
       * to ensure the path is not beyond the configured root path
       */
      ValueMap overwriteProperties = new ValueMapDecorator(ImmutableMap.<String, Object>of("path", resource.getPath()));
      Resource dataSourceResourceWrapper = GraniteUiSyntheticResource.wrapMerge(request.getResource(), overwriteProperties);
      return cmp.getItemDataSource(dataSourceResourceWrapper);
    }
    catch (ServletException | IOException ex) {
      throw new RuntimeException("Unable to get data source.", ex);
    }
  }
56172
private byte[] getDataSourceMetadataWithHandleAsBytes(
      final Handle handle,
      final String dataSource
  )
  {
    return connector.lookupWithHandle(
        handle,
        dbTables.getDataSourceTable(),
        "dataSource",
        "commit_metadata_payload",
        dataSource
    );
  }
572227
def getDataset(self, itemId):
        """"""
        if self._url.lower().find('datasets') > -1:
            url = self._url
        else:
            url = self._url + "/datasets"
        return OpenDataItem(url=url,
                            itemId=itemId,
                            securityHandler=self._securityHandler,
                            proxy_url=self._proxy_url,
                            proxy_port=self._proxy_port)
751146
def get(self):
        
        resource = dict()
        resource.update(self._parse_config())
        resource.update(self._parse_interfaces())

        return resource
162038
def _load_source_object(self):
		
		if hasattr(self, "source_obj"):
			self.source_text = getattr(self.source_obj, self.field)
			return self.source_obj

		self._load_source_model()
		self.source_obj = self.source_model.objects.get(id=self.object_id)
		return self.source_obj