return ft.toArray(new RecordDescriptor[ft.size()]);
}
@Override
public CloseableIterator<String> getDomain(Name typeName, final Name attributeName) throws IOException {
final RecordDescriptor rd = descriptorByType.get(typeName);
if (rd==null) {
throw new IOException(typeName + " is not a supported type");
}
// do we have such attribute?
final PropertyName property = rd.translateProperty(attributeName);
AttributeDescriptor ad = (AttributeDescriptor) property.evaluate(rd.getFeatureType());
if(ad == null) {
return new CloseableIteratorAdapter<String>(new ArrayList<String>().iterator());
}
// build the query against csw:record
Query q = new Query(typeName.getLocalPart());
q.setProperties(Arrays.asList(translateProperty(rd, attributeName)));
// collect the values without duplicates
final Set<String> values = new HashSet<String>();
getRecords(q, Transaction.AUTO_COMMIT, rd.getOutputSchema()).accepts(new FeatureVisitor() {
@Override
public void visit(Feature feature) {
Property prop = (Property) property.evaluate(feature);
if (prop != null)