本文整理汇总了Java中mil.nga.giat.geowave.core.store.CloseableIterator.next方法的典型用法代码示例。如果您正苦于以下问题:Java CloseableIterator.next方法的具体用法?Java CloseableIterator.next怎么用?Java CloseableIterator.next使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mil.nga.giat.geowave.core.store.CloseableIterator
的用法示例。
在下文中一共展示了CloseableIterator.next方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testQuery
import mil.nga.giat.geowave.core.store.CloseableIterator; //导入方法依赖的package包/类
private int testQuery(
final DataAdapter<?> adapter,
final Query query )
throws Exception {
final mil.nga.giat.geowave.core.store.DataStore geowaveStore = dataStore.createDataStore();
final CloseableIterator<?> accumuloResults = geowaveStore.query(
new QueryOptions(
adapter,
TestUtils.DEFAULT_SPATIAL_INDEX),
query);
int resultCount = 0;
while (accumuloResults.hasNext()) {
accumuloResults.next();
resultCount++;
}
accumuloResults.close();
return resultCount;
}
示例2: testPolygonDataIdQueryResults
import mil.nga.giat.geowave.core.store.CloseableIterator; //导入方法依赖的package包/类
@Test
public void testPolygonDataIdQueryResults() {
final CloseableIterator<SimpleFeature> matches = dataStore.createDataStore().query(
new QueryOptions(
dataAdapter,
TestUtils.DEFAULT_SPATIAL_INDEX),
new DataIdQuery(
dataAdapter.getAdapterId(),
new ByteArrayId(
StringUtils.stringToBinary(DATA_ID))));
int numResults = 0;
while (matches.hasNext()) {
matches.next();
numResults++;
}
Assert.assertTrue(
"Expected 1 result, but returned " + numResults,
numResults == 1);
}
示例3: testQuery
import mil.nga.giat.geowave.core.store.CloseableIterator; //导入方法依赖的package包/类
private int testQuery(
final DataAdapter<?> adapter,
final Query query )
throws Exception {
final mil.nga.giat.geowave.core.store.DataStore geowaveStore = dataStorePluginOptions.createDataStore();
final CloseableIterator<?> accumuloResults = geowaveStore.query(
new QueryOptions(
adapter,
TestUtils.DEFAULT_SPATIAL_INDEX),
query);
int resultCount = 0;
while (accumuloResults.hasNext()) {
accumuloResults.next();
resultCount++;
}
accumuloResults.close();
return resultCount;
}
示例4: getExpectedResults
import mil.nga.giat.geowave.core.store.CloseableIterator; //导入方法依赖的package包/类
public static ExpectedResults getExpectedResults(
final CloseableIterator<?> results )
throws IOException {
final Set<Long> hashedCentroids = new HashSet<Long>();
int expectedResultCount = 0;
try {
while (results.hasNext()) {
final Object obj = results.next();
if (obj instanceof SimpleFeature) {
expectedResultCount++;
final SimpleFeature feature = (SimpleFeature) obj;
hashedCentroids.add(hashCentroid((Geometry) feature.getDefaultGeometry()));
}
}
}
finally {
results.close();
}
return new ExpectedResults(
hashedCentroids,
expectedResultCount);
}
示例5: listVectors
import mil.nga.giat.geowave.core.store.CloseableIterator; //导入方法依赖的package包/类
public static String[] listVectors(final ProviderProperties providerProperties) throws IOException
{
initConnectionInfo();
List<String> results = new ArrayList<String>();
for (String storeName : getConnectionInfo().getStoreNames())
{
initDataSource(null, storeName);
DataSourceEntry entry = getDataSourceEntry(storeName);
CloseableIterator<DataAdapter<?>> iter = entry.adapterStore.getAdapters();
try
{
while (iter.hasNext())
{
DataAdapter<?> adapter = iter.next();
if (adapter != null)
{
ByteArrayId adapterId = adapter.getAdapterId();
if (checkAuthorizations(adapterId, storeName, providerProperties))
{
results.add(adapterId.getString());
}
}
}
}
finally
{
if (iter != null)
{
iter.close();
}
}
}
String[] resultArray = new String[results.size()];
return results.toArray(resultArray);
}
示例6: canOpen
import mil.nga.giat.geowave.core.store.CloseableIterator; //导入方法依赖的package包/类
@SuppressWarnings("squid:S1166") // Exception caught and handled
public static boolean canOpen(String input,
ProviderProperties providerProperties) throws IOException
{
log.debug("Inside canOpen with " + input);
initConnectionInfo();
ParseResults results = parseResourceName(input);
try
{
initDataSource(null, results.storeName);
DataSourceEntry entry = getDataSourceEntry(results.storeName);
CloseableIterator<DataAdapter<?>> iter = entry.adapterStore.getAdapters();
while (iter.hasNext())
{
DataAdapter<?> da = iter.next();
log.debug("GeoWave adapter: " + da.getAdapterId().toString());
}
ByteArrayId adapterId = new ByteArrayId(results.name);
DataAdapter<?> adapter = entry.adapterStore.getAdapter(adapterId);
if (adapter == null)
{
return false;
}
return checkAuthorizations(adapterId, results.storeName, providerProperties);
}
catch (IOException ignored)
{
}
catch (IllegalArgumentException e)
{
log.info("Unable to open " + input + " with the GeoWave data provider", e);
}
return false;
}
示例7: testIngest
import mil.nga.giat.geowave.core.store.CloseableIterator; //导入方法依赖的package包/类
@Test
public void testIngest()
throws IOException {
final URL toIngest = this.getClass().getClassLoader().getResource(
filePath);
assertTrue(GeoLifeUtils.validate(toIngest));
final Collection<ByteArrayId> indexIds = new ArrayList<ByteArrayId>();
indexIds.add(new ByteArrayId(
"123".getBytes(StringUtils.UTF8_CHAR_SET)));
final CloseableIterator<GeoWaveData<SimpleFeature>> features = ingester.toGeoWaveData(
toIngest,
indexIds,
"");
assertTrue((features != null) && features.hasNext());
int featureCount = 0;
while (features.hasNext()) {
final GeoWaveData<SimpleFeature> feature = features.next();
if (isValidGeoLifeFeature(feature)) {
featureCount++;
}
}
features.close();
final boolean readExpectedCount = (featureCount == expectedCount);
if (!readExpectedCount) {
System.out.println("Expected " + expectedCount + " features, ingested " + featureCount);
}
assertTrue(readExpectedCount);
}
示例8: testIngest
import mil.nga.giat.geowave.core.store.CloseableIterator; //导入方法依赖的package包/类
@Test
public void testIngest()
throws IOException {
final URL toIngest = this.getClass().getClassLoader().getResource(
filePath);
assertTrue(validate(toIngest));
final Collection<ByteArrayId> indexIds = new ArrayList<ByteArrayId>();
indexIds.add(new ByteArrayId(
"123".getBytes(StringUtils.UTF8_CHAR_SET)));
final CloseableIterator<GeoWaveData<SimpleFeature>> features = ingester.toGeoWaveData(
toIngest,
indexIds,
"");
assertTrue((features != null) && features.hasNext());
int featureCount = 0;
while (features.hasNext()) {
final GeoWaveData<SimpleFeature> feature = features.next();
if (isValidAVROFeature(feature)) {
featureCount++;
}
}
features.close();
final boolean readExpectedCount = (featureCount == expectedCount);
if (!readExpectedCount) {
System.out.println("Expected " + expectedCount + " features, ingested " + featureCount);
}
assertTrue(readExpectedCount);
}
示例9: verifyResults
import mil.nga.giat.geowave.core.store.CloseableIterator; //导入方法依赖的package包/类
private void verifyResults(
final CloseableIterator<SimpleFeature> results,
final int numExpectedResults,
final Collection<String> attributesExpected )
throws IOException {
int numResults = 0;
SimpleFeature currentFeature;
Object currentAttributeValue;
while (results.hasNext()) {
currentFeature = results.next();
numResults++;
for (final String currentAttribute : ALL_ATTRIBUTES) {
currentAttributeValue = currentFeature.getAttribute(currentAttribute);
if (attributesExpected.contains(currentAttribute)) {
Assert.assertNotNull(
"Expected non-null " + currentAttribute + " value!",
currentAttributeValue);
}
else {
Assert.assertNull(
"Expected null " + currentAttribute + " value!",
currentAttributeValue);
}
}
}
results.close();
Assert.assertEquals(
"Unexpected number of query results",
numExpectedResults,
numResults);
}
示例10: createTypeNames
import mil.nga.giat.geowave.core.store.CloseableIterator; //导入方法依赖的package包/类
@Override
protected List<Name> createTypeNames()
throws IOException {
final List<Name> names = new ArrayList<>();
final CloseableIterator<DataAdapter<?>> adapters = adapterStore.getAdapters();
while (adapters.hasNext()) {
final DataAdapter<?> adapter = adapters.next();
if (adapter instanceof GeotoolsFeatureDataAdapter) {
names.add(((GeotoolsFeatureDataAdapter) adapter).getFeatureType().getName());
}
}
adapters.close();
return names;
}
示例11: getFeatureAdapterCount
import mil.nga.giat.geowave.core.store.CloseableIterator; //导入方法依赖的package包/类
public static int getFeatureAdapterCount(
final DataStorePluginOptions dataStore ) {
final CloseableIterator<DataAdapter<?>> adapterIt = dataStore.createAdapterStore().getAdapters();
int featureAdapters = 0;
while (adapterIt.hasNext()) {
final DataAdapter adapter = adapterIt.next();
if (adapter instanceof GeotoolsFeatureDataAdapter) {
featureAdapters++;
}
}
return featureAdapters;
}
示例12: testEncompass
import mil.nga.giat.geowave.core.store.CloseableIterator; //导入方法依赖的package包/类
@Test
public void testEncompass() {
final Query encompassQuery = new SpatialQuery(
factory.createPolygon(new Coordinate[] {
new Coordinate(
1.0249,
1.0319),
new Coordinate(
1.0261,
1.0319),
new Coordinate(
1.0261,
1.0331),
new Coordinate(
1.0249,
1.0319)
}));
final CloseableIterator<TestGeometry> resultOfIntersect = mockDataStore.query(
new QueryOptions(
adapter,
index),
encompassQuery);
Assert.assertTrue(resultOfIntersect.hasNext());
final TestGeometry geom1 = resultOfIntersect.next();
Assert.assertEquals(
"test_shape_1",
geom1.id);
}
示例13: testDeleteCQL
import mil.nga.giat.geowave.core.store.CloseableIterator; //导入方法依赖的package包/类
protected void testDeleteCQL(
final String cqlStr,
final PrimaryIndex index )
throws Exception {
LOGGER.warn("bulk deleting from " + index.getId() + " index using CQL: '" + cqlStr + "'");
final mil.nga.giat.geowave.core.store.DataStore geowaveStore = getDataStorePluginOptions().createDataStore();
// Retrieve the feature adapter for the CQL query generator
AdapterStore adapterStore = getDataStorePluginOptions().createAdapterStore();
final CloseableIterator<DataAdapter<?>> it = adapterStore.getAdapters();
GeotoolsFeatureDataAdapter adapter = (GeotoolsFeatureDataAdapter) it.next();
it.close();
// Create the CQL query
Query query = CQLQuery.createOptimalQuery(
cqlStr,
adapter,
null,
null);
deleteInternal(
geowaveStore,
index,
query);
}
示例14: computeResults
import mil.nga.giat.geowave.core.store.CloseableIterator; //导入方法依赖的package包/类
@Override
public String computeResults(
final OperationParams params ) {
if (parameters.size() < 1) {
throw new ParameterException(
"Must specify store name");
}
final String inputStoreName = parameters.get(0);
// Get the config options from the properties file
final File configFile = getGeoWaveConfigFile(params);
// Attempt to load the desired input store
String result;
final StoreLoader inputStoreLoader = new StoreLoader(
inputStoreName);
if (!inputStoreLoader.loadFromConfig(configFile)) {
result = "Cannot find store name: " + inputStoreLoader.getStoreName();
}
else {
// Now that store is loaded, pull the list of indexes
final DataStorePluginOptions inputStoreOptions = inputStoreLoader.getDataStorePlugin();
final CloseableIterator<Index<?, ?>> it = inputStoreOptions.createIndexStore().getIndices();
final StringBuffer buffer = new StringBuffer();
while (it.hasNext()) {
final Index<?, ?> index = it.next();
buffer.append(
index.getId().getString()).append(
' ');
}
try {
it.close();
}
catch (final IOException e) {
LOGGER.error(
"Unable to close Iterator",
e);
}
result = "Available indexes: " + buffer.toString();
}
return result;
}
示例15: testIngest
import mil.nga.giat.geowave.core.store.CloseableIterator; //导入方法依赖的package包/类
@Test
public void testIngest()
throws IOException {
final URL toIngest = this.getClass().getClassLoader().getResource(
filePath);
assertTrue(GDELTUtils.validate(toIngest));
final Collection<ByteArrayId> indexIds = new ArrayList<ByteArrayId>();
indexIds.add(new ByteArrayId(
"123".getBytes(StringUtils.UTF8_CHAR_SET)));
final CloseableIterator<GeoWaveData<SimpleFeature>> features = ingester.toGeoWaveData(
toIngest,
indexIds,
"");
assertTrue((features != null) && features.hasNext());
int featureCount = 0;
while (features.hasNext()) {
final GeoWaveData<SimpleFeature> feature = features.next();
if (isValidGDELTFeature(feature)) {
featureCount++;
}
}
features.close();
final CloseableIterator<GeoWaveData<SimpleFeature>> featuresExt = ingesterExt.toGeoWaveData(
toIngest,
indexIds,
"");
assertTrue((featuresExt != null) && featuresExt.hasNext());
int featureCountExt = 0;
while (featuresExt.hasNext()) {
final GeoWaveData<SimpleFeature> featureExt = featuresExt.next();
if (isValidGDELTFeatureExt(featureExt)) {
featureCountExt++;
}
}
featuresExt.close();
final boolean readExpectedCount = (featureCount == expectedCount);
if (!readExpectedCount) {
System.out.println("Expected " + expectedCount + " features, ingested " + featureCount);
}
final boolean readExpectedCountExt = (featureCountExt == expectedCount);
if (!readExpectedCount) {
System.out.println("Expected " + expectedCount + " features, ingested " + featureCountExt);
}
assertTrue(readExpectedCount);
assertTrue(readExpectedCountExt);
}