AggregatingDataStore extends ContentDataStore { public void autoConfigureStores(List<String> storeNames) throws IOException { if (storeNames == null || storeNames.size() == 0) { return; } Map<String, Set<String>> allNames = new LinkedHashMap<String, Set<String>>(); for (String storeName : storeNames) { DataStore store = getStore(storeName, tolerant); if (store != null) { Set<String> typeNames = new LinkedHashSet<String>(Arrays.asList(store .getTypeNames())); allNames.put(storeName, typeNames); } else { allNames.put(storeName, (Set<String>) Collections.EMPTY_SET); } } for (int i = 0; i < storeNames.size(); i++) { String storeName = storeNames.get(i); Set<String> baseNames = allNames.get(storeName); for (String baseName : baseNames) { AggregateTypeConfiguration config = new AggregateTypeConfiguration(baseName); config.addSourceType(storeName, baseName); for (int j = i + 1; j < storeNames.size(); j++) { String otherStore = storeNames.get(j); if (allNames.get(otherStore).remove(baseName)) { config.addSourceType(otherStore, baseName); } } addType(config); } } } AggregatingDataStore(Repository repository, ExecutorService executor); boolean isTolerant(); void setTolerant(boolean tolerant); void autoConfigureStores(List<String> storeNames); void addType(AggregateTypeConfiguration config); AggregateTypeConfiguration getConfiguration(String name); AggregateTypeConfiguration removeType(String name); void resetConfiguration(); Map<String, AggregateTypeConfiguration> getConfigurations();  }
@Test public void testReadSorted() throws Exception { store.autoConfigureStores(Arrays.asList("store1", "store2")); Query q = new Query(BASIC_POLYGONS); q.setSortBy(new SortBy[] { ff.sort("ID", SortOrder.DESCENDING) }); List<SimpleFeature> features = listFeatures(q); assertEquals(4, features.size()); String prev = null; for (SimpleFeature f : features) { String id = (String) f.getAttribute("ID"); if(prev != null) { assertTrue(prev.compareTo(id) >= 0); } prev = id; } }