当前位置: 首页>>代码示例>>Java>>正文


Java CloseableIterator类代码示例

本文整理汇总了Java中mil.nga.giat.geowave.core.store.CloseableIterator的典型用法代码示例。如果您正苦于以下问题:Java CloseableIterator类的具体用法?Java CloseableIterator怎么用?Java CloseableIterator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


CloseableIterator类属于mil.nga.giat.geowave.core.store包,在下文中一共展示了CloseableIterator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: executeCQLQueryTest

import mil.nga.giat.geowave.core.store.CloseableIterator; //导入依赖的package包/类
@Test
public void executeCQLQueryTest() throws IOException, CQLException {
    System.out.println("Executing query, expecting to match two points...");

    final Filter cqlFilter = ECQL.toFilter("BBOX(geometry,-77.6167,38.6833,-76.6,38.9200) and locationName like 'W%'");

    final QueryOptions queryOptions = new QueryOptions(ADAPTER, INDEX);
    final CQLQuery cqlQuery = new CQLQuery(null, cqlFilter, ADAPTER);

    try (final CloseableIterator<SimpleFeature> iterator = dataStore.query(queryOptions, cqlQuery)) {
        int count = 0;
        while (iterator.hasNext()) {
            System.out.println("Query match: " + iterator.next().getID());
            count++;
        }
        System.out.println("executeCQLQueryTest count: " + count);
        // Should match "Washington Monument" and "White House"
        assertEquals(2, count);
    }
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:21,代码来源:GeoWaveGTQueryTest.java

示例2: executeBoundingBoxQueryTest

import mil.nga.giat.geowave.core.store.CloseableIterator; //导入依赖的package包/类
@Test
public void executeBoundingBoxQueryTest() throws IOException {
    System.out.println("Constructing bounding box for the area contained by [Baltimore, MD and Richmond, VA.");

    final Geometry boundingBox = GeometryUtils.GEOMETRY_FACTORY.toGeometry(new Envelope(
            BALTIMORE,
            RICHMOND));

    System.out.println("Executing query, expecting to match ALL points...");

    final QueryOptions queryOptions = new QueryOptions(ADAPTER, INDEX);
    final SpatialQuery spatialQuery = new SpatialQuery(boundingBox);

    try (final CloseableIterator<SimpleFeature> iterator = dataStore.query(queryOptions, spatialQuery)) {
        int count = 0;
        while (iterator.hasNext()) {
            System.out.println("Query match: " + iterator.next().getID());
            count++;
        }
        System.out.println("executeBoundingBoxQueryTest count: " + count);
        // Should match "FedEx Field", "Washington Monument", and "White House"
        assertEquals(3, count);
    }
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:25,代码来源:GeoWaveGTQueryTest.java

示例3: executeBoundingBoxQuery

import mil.nga.giat.geowave.core.store.CloseableIterator; //导入依赖的package包/类
private static void executeBoundingBoxQuery()
		throws IOException {

	System.out.println("Constructing bounding box for the area contained by [Baltimore, MD and Richmond, VA.");

	final Geometry boundingBox = GeometryUtils.GEOMETRY_FACTORY.toGeometry(new Envelope(
			baltimore,
			richmond));

	System.out.println("Executing query, expecting to match ALL points...");

	try (final CloseableIterator<SimpleFeature> iterator = dataStore.query(
			new QueryOptions(
					ADAPTER,
					index),
			new SpatialQuery(
					boundingBox))) {

		while (iterator.hasNext()) {
			System.out.println("Query match: " + iterator.next().getID());
		}
	}

}
 
开发者ID:locationtech,项目名称:geowave,代码行数:25,代码来源:GeotoolsQueryExample.java

示例4: executeCQLuery

import mil.nga.giat.geowave.core.store.CloseableIterator; //导入依赖的package包/类
private static void executeCQLuery()
		throws IOException,
		CQLException {

	System.out.println("Executing query, expecting to match two points...");

	try (final CloseableIterator<SimpleFeature> iterator = dataStore.query(
			new QueryOptions(
					ADAPTER,
					index),
			CQLQuery.createOptimalQuery(
					"BBOX(geometry,-77.6167,38.6833,-76.6,38.9200) and locationName like 'W%'",
					ADAPTER,
					index))) {

		while (iterator.hasNext()) {
			System.out.println("Query match: " + iterator.next().getID());
		}
	}

}
 
开发者ID:locationtech,项目名称:geowave,代码行数:22,代码来源:CQLQueryExample.java

示例5: map

import mil.nga.giat.geowave.core.store.CloseableIterator; //导入依赖的package包/类
@Override
protected void map(
		final AvroKey key,
		final NullWritable value,
		final org.apache.hadoop.mapreduce.Mapper.Context context )
		throws IOException,
		InterruptedException {
	try (CloseableIterator<GeoWaveData> data = ingestWithMapper.toGeoWaveData(
			key.datum(),
			primaryIndexIds,
			globalVisibility)) {
		while (data.hasNext()) {
			final GeoWaveData d = data.next();
			context.write(
					d.getOutputKey(),
					d.getValue());
		}
	}
}
 
开发者ID:locationtech,项目名称:geowave,代码行数:20,代码来源:IngestMapper.java

示例6: getStoredPointSet

import mil.nga.giat.geowave.core.store.CloseableIterator; //导入依赖的package包/类
protected static Set<Point> getStoredPointSet(
		final DataStore ds ) {
	final CloseableIterator itr = ds.query(
			new QueryOptions(),
			new BasicQuery(
					new BasicQuery.Constraints()));
	final Set<Point> readPoints = new TreeSet<Point>();
	while (itr.hasNext()) {
		final Object n = itr.next();
		if (n instanceof SimpleFeature) {
			final SimpleFeature gridCell = (SimpleFeature) n;
			final Point p = (Point) gridCell.getDefaultGeometry();
			readPoints.add(p);
		}
	}
	return readPoints;
}
 
开发者ID:locationtech,项目名称:geowave,代码行数:18,代码来源:SimpleHBaseIngestTest.java

示例7: getStoredPointSet

import mil.nga.giat.geowave.core.store.CloseableIterator; //导入依赖的package包/类
protected static Set<Point> getStoredPointSet(
		DataStore ds ) {
	CloseableIterator itr = ds.query(
			new QueryOptions(),
			new BasicQuery(
					new BasicQuery.Constraints()));
	Set<Point> readPoints = new TreeSet<Point>();
	while (itr.hasNext()) {
		Object n = itr.next();
		if (n instanceof SimpleFeature) {
			SimpleFeature gridCell = (SimpleFeature) n;
			Point p = (Point) gridCell.getDefaultGeometry();
			readPoints.add(p);
		}
	}
	return readPoints;
}
 
开发者ID:locationtech,项目名称:geowave,代码行数:18,代码来源:SimpleIngestTest.java

示例8: toGeoWaveDataInternal

import mil.nga.giat.geowave.core.store.CloseableIterator; //导入依赖的package包/类
@Override
protected CloseableIterator<GeoWaveData<SimpleFeature>> toGeoWaveDataInternal(
		final GpxTrack gpxTrack,
		final Collection<ByteArrayId> primaryIndexIds,
		final String globalVisibility ) {
	final InputStream in = new ByteArrayInputStream(
			gpxTrack.getGpxfile().array());
	// LOGGER.debug("Processing track [" + gpxTrack.getTimestamp() + "]");
	try {
		return new GPXConsumer(
				in,
				primaryIndexIds,
				gpxTrack.getTrackid() == null ? "" : gpxTrack.getTrackid().toString(),
				getAdditionalData(gpxTrack),
				false, // waypoints, even dups, are unique, due to QGis
						// behavior
				globalVisibility);
	}
	catch (final Exception e) {
		LOGGER.warn(
				"Unable to convert GpxTrack to GeoWaveData",
				e);
		return null;
	}
}
 
开发者ID:locationtech,项目名称:geowave,代码行数:26,代码来源:GpxIngestPlugin.java

示例9: getObjects

import mil.nga.giat.geowave.core.store.CloseableIterator; //导入依赖的package包/类
protected CloseableIterator<T> getObjects(
		final String... authorizations ) {
	try {
		final Scan scanner = getFullScanner(authorizations);
		final ResultScanner rS = operations.getScannedResults(
				scanner,
				getTablename(),
				authorizations);
		final Iterator<Result> it = rS.iterator();
		return new CloseableIteratorWrapper<T>(
				new ScannerClosableWrapper(
						rS),
				getNativeIteratorWrapper(it));
	}
	catch (final IOException e) {
		LOGGER.warn(
				"Unable to find objects in HBase table.",
				e);
	}
	return new CloseableIterator.Empty<T>();
}
 
开发者ID:locationtech,项目名称:geowave,代码行数:22,代码来源:AbstractHBasePersistence.java

示例10: getDataStatistics

import mil.nga.giat.geowave.core.store.CloseableIterator; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public Map<ByteArrayId, DataStatistics<SimpleFeature>> getDataStatistics() {
	final Map<ByteArrayId, DataStatistics<SimpleFeature>> stats = new HashMap<ByteArrayId, DataStatistics<SimpleFeature>>();
	final GeotoolsFeatureDataAdapter adapter = components.getAdapter();
	try (CloseableIterator<DataStatistics<?>> it = components.getStatsStore().getDataStatistics(
			adapter.getAdapterId(),
			composeAuthorizations())) {
		while (it.hasNext()) {
			final DataStatistics<?> stat = it.next();
			stats.put(
					stat.getStatisticsId(),
					(DataStatistics<SimpleFeature>) stat);
		}

	}
	catch (final Exception e) {
		GeoWaveTransactionManagement.LOGGER.error(
				"Failed to access statistics from data store",
				e);
	}
	return stats;
}
 
开发者ID:locationtech,项目名称:geowave,代码行数:24,代码来源:AbstractTransactionManagement.java

示例11: getAdapters

import mil.nga.giat.geowave.core.store.CloseableIterator; //导入依赖的package包/类
public CloseableIterator<DataAdapter<?>> getAdapters(
		final AdapterStore adapterStore ) {
	if ((adapterIds != null) && !adapterIds.isEmpty()) {
		if ((adapters == null) || adapters.isEmpty()) {
			adapters = new ArrayList<DataAdapter<Object>>();
			for (final ByteArrayId id : adapterIds) {
				final DataAdapter<Object> adapter = (DataAdapter<Object>) adapterStore.getAdapter(id);
				if (adapter != null) {
					adapters.add(adapter);
				}
			}
		}
		return new CloseableIterator.Wrapper(
				adapters.iterator());
	}
	return adapterStore.getAdapters();
}
 
开发者ID:locationtech,项目名称:geowave,代码行数:18,代码来源:QueryOptions.java

示例12: getData

import mil.nga.giat.geowave.core.store.CloseableIterator; //导入依赖的package包/类
public CloseableIterator<SimpleFeature> getData(
		final Geometry jtsBounds,
		final TemporalConstraintsSet timeBounds,
		final int width,
		final int height,
		final double pixelSize,
		final Filter filter,
		final ReferencedEnvelope envelope,
		final Integer limit ) {
	return issueQuery(
			jtsBounds,
			timeBounds,
			new EnvelopeQueryIssuer(
					width,
					height,
					pixelSize,
					filter,
					limit,
					envelope));
}
 
开发者ID:locationtech,项目名称:geowave,代码行数:21,代码来源:GeoWaveFeatureReader.java

示例13: testClientSideFiltering

import mil.nga.giat.geowave.core.store.CloseableIterator; //导入依赖的package包/类
@Test
public void testClientSideFiltering()
		throws IOException {

	final List<String> attributesSubset = Arrays.asList(
			CITY_ATTRIBUTE,
			POPULATION_ATTRIBUTE);

	final CloseableIterator<SimpleFeature> results = dataStore.createDataStore().query(
			new QueryOptions(
					dataAdapter,
					TestUtils.DEFAULT_SPATIAL_INDEX),
			spatialQuery);

	// query expects to match 3 cities from Texas, which should each contain
	// non-null values for a subset of attributes (city, population) and
	// nulls for the rest
	verifyResults(
			// performs filtering client side
			new FeatureTranslatingIterator(
					simpleFeatureType,
					attributesSubset,
					results),
			3,
			attributesSubset);
}
 
开发者ID:locationtech,项目名称:geowave,代码行数:27,代码来源:AttributesSubsetQueryIT.java

示例14: toGeoWaveData

import mil.nga.giat.geowave.core.store.CloseableIterator; //导入依赖的package包/类
@Override
public CloseableIterator<GeoWaveData<SimpleFeature>> toGeoWaveData(
		final URL input,
		final Collection<ByteArrayId> primaryIndexIds,
		final String globalVisibility ) {
	final I[] hdfsObjects = toAvroObjects(input);
	final List<CloseableIterator<GeoWaveData<SimpleFeature>>> allData = new ArrayList<CloseableIterator<GeoWaveData<SimpleFeature>>>();

	for (final I hdfsObject : hdfsObjects) {
		final CloseableIterator<GeoWaveData<SimpleFeature>> geowaveData = toGeoWaveDataInternal(
				hdfsObject,
				primaryIndexIds,
				globalVisibility);
		allData.add(wrapIteratorWithFilters(geowaveData));
	}
	return new CloseableIterator.Wrapper<GeoWaveData<SimpleFeature>>(
			Iterators.concat(allData.iterator()));
}
 
开发者ID:locationtech,项目名称:geowave,代码行数:19,代码来源:AbstractSimpleFeatureIngestPlugin.java

示例15: map

import mil.nga.giat.geowave.core.store.CloseableIterator; //导入依赖的package包/类
@Override
protected void map(
		final AvroKey key,
		final NullWritable value,
		final org.apache.hadoop.mapreduce.Mapper.Context context )
		throws IOException,
		InterruptedException {
	try (CloseableIterator<KeyValueData<WritableComparable<?>, Writable>> data = ingestWithReducer
			.toIntermediateMapReduceData(key.datum())) {
		while (data.hasNext()) {
			final KeyValueData<WritableComparable<?>, Writable> d = data.next();
			context.write(
					d.getKey(),
					d.getValue());
		}
	}
}
 
开发者ID:locationtech,项目名称:geowave,代码行数:18,代码来源:IntermediateKeyValueMapper.java


注:本文中的mil.nga.giat.geowave.core.store.CloseableIterator类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。