use of org.codice.ddf.spatial.ogc.wfs.catalog.common.FeatureMetacardType in project ddf by codice.
the class WfsSource method registerFeatureMetacardTypes.
private void registerFeatureMetacardTypes(Map<String, MetacardTypeRegistration> mcTypeRegs) {
// Unregister all MetacardType services - the DescribeFeatureTypeRequest should
// have returned all of the most current metacard types that will now be registered.
// As Source(s) are added/removed from this instance or to other Source(s)
// that this instance is federated to, the list of metacard types will change.
// This is done here vs. inside the above loop so that minimal time is spent clearing and
// registering the MetacardTypes - the concern is that if this registration is too lengthy
// a query could come in that is handled while the MetacardType registrations are
// in a state of flux.
unregisterAllMetacardTypes();
if (!mcTypeRegs.isEmpty()) {
for (MetacardTypeRegistration registration : mcTypeRegs.values()) {
FeatureMetacardType ftMetacard = registration.getFtMetacard();
String simpleName = ftMetacard.getFeatureType().getLocalPart();
ServiceRegistration serviceRegistration = context.registerService(MetacardType.class.getName(), ftMetacard, registration.getProps());
this.metacardTypeServiceRegistrations.put(simpleName, serviceRegistration);
}
}
}
use of org.codice.ddf.spatial.ogc.wfs.catalog.common.FeatureMetacardType in project ddf by codice.
the class FeatureMetacardTypeTest method testfeatureMetacardTypeFindDateProperties.
@Test
public void testfeatureMetacardTypeFindDateProperties() {
XmlSchema schema = new XmlSchema();
XmlSchemaElement dateElement = new XmlSchemaElement(schema, true);
dateElement.setSchemaType(new XmlSchemaSimpleType(schema, false));
dateElement.setSchemaTypeName(Constants.XSD_DATE);
dateElement.setName(ELEMENT_NAME_1);
XmlSchemaElement dateTimeElement = new XmlSchemaElement(schema, true);
dateTimeElement.setSchemaType(new XmlSchemaSimpleType(schema, false));
dateTimeElement.setSchemaTypeName(Constants.XSD_DATETIME);
dateTimeElement.setName(ELEMENT_NAME_2);
schema.getElements().put(new QName(ELEMENT_NAME_1), dateElement);
schema.getElements().put(new QName(ELEMENT_NAME_2), dateTimeElement);
FeatureMetacardType featureMetacardType = new FeatureMetacardType(schema, FEATURE_TYPE, NON_QUERYABLE_PROPS, Wfs10Constants.GML_NAMESPACE);
assertAttributeDescriptor(featureMetacardType, ELEMENT_NAME_1, BasicTypes.DATE_TYPE);
assertAttributeDescriptor(featureMetacardType, ELEMENT_NAME_2, BasicTypes.DATE_TYPE);
}
use of org.codice.ddf.spatial.ogc.wfs.catalog.common.FeatureMetacardType in project ddf by codice.
the class FeatureMetacardTypeTest method testFeatureMetacardTypeComplexContentWithStringAndGmlProperties.
@Test
public void testFeatureMetacardTypeComplexContentWithStringAndGmlProperties() {
XmlSchema schema = new XmlSchema();
// Create the GML and String types
XmlSchemaElement gmlElement = new XmlSchemaElement(schema, true);
gmlElement.setSchemaType(new XmlSchemaComplexType(schema, false));
gmlElement.setSchemaTypeName(new QName(Wfs10Constants.GML_NAMESPACE, GML));
gmlElement.setName(ELEMENT_NAME_1);
XmlSchemaElement stringElement = new XmlSchemaElement(schema, true);
stringElement.setSchemaType(new XmlSchemaSimpleType(schema, false));
stringElement.setSchemaTypeName(Constants.XSD_STRING);
stringElement.setName(ELEMENT_NAME_2);
// build the complex objects
XmlSchemaElement complexElement = new XmlSchemaElement(schema, true);
XmlSchemaComplexType complexType = new XmlSchemaComplexType(schema, false);
XmlSchemaComplexContent complexContent = new XmlSchemaComplexContent();
XmlSchemaComplexContentExtension contentExtension = new XmlSchemaComplexContentExtension();
XmlSchemaSequence particle = new XmlSchemaSequence();
particle.getItems().add(stringElement);
contentExtension.setParticle(particle);
complexContent.setContent(contentExtension);
complexType.setContentModel(complexContent);
complexElement.setSchemaType(complexType);
complexElement.setSchemaTypeName(new QName("Complex"));
schema.getElements().put(new QName(ELEMENT_NAME_2), complexElement);
FeatureMetacardType featureMetacardType = new FeatureMetacardType(schema, FEATURE_TYPE, NON_QUERYABLE_PROPS, Wfs10Constants.GML_NAMESPACE);
assertTrue(featureMetacardType.getTextualProperties().size() == 1);
assertTrue(featureMetacardType.getGmlProperties().size() == 1);
assertAttributeDescriptor(featureMetacardType, ELEMENT_NAME_2, BasicTypes.STRING_TYPE);
assertAttributeDescriptor(featureMetacardType, ELEMENT_NAME_1, BasicTypes.GEO_TYPE);
}
use of org.codice.ddf.spatial.ogc.wfs.catalog.common.FeatureMetacardType in project ddf by codice.
the class FeatureMetacardTypeTest method testfeatureMetacardTypeFindShortProperties.
@Test
public void testfeatureMetacardTypeFindShortProperties() {
XmlSchema schema = new XmlSchema();
XmlSchemaElement shortElement = new XmlSchemaElement(schema, true);
shortElement.setSchemaType(new XmlSchemaSimpleType(schema, false));
shortElement.setSchemaTypeName(Constants.XSD_SHORT);
shortElement.setName(ELEMENT_NAME_1);
schema.getElements().put(new QName(ELEMENT_NAME_1), shortElement);
FeatureMetacardType featureMetacardType = new FeatureMetacardType(schema, FEATURE_TYPE, NON_QUERYABLE_PROPS, Wfs10Constants.GML_NAMESPACE);
assertAttributeDescriptor(featureMetacardType, ELEMENT_NAME_1, BasicTypes.SHORT_TYPE);
}
use of org.codice.ddf.spatial.ogc.wfs.catalog.common.FeatureMetacardType in project ddf by codice.
the class FeatureMetacardTypeTest method testFeatureMetacardTypeStringNonQueryProperty.
@Test
public void testFeatureMetacardTypeStringNonQueryProperty() {
XmlSchema schema = new XmlSchema();
XmlSchemaElement stringElement = new XmlSchemaElement(schema, true);
stringElement.setSchemaType(new XmlSchemaSimpleType(schema, false));
stringElement.setSchemaTypeName(Constants.XSD_STRING);
stringElement.setName(ELEMENT_NAME_1);
XmlSchemaElement stringElement2 = new XmlSchemaElement(schema, true);
stringElement2.setSchemaType(new XmlSchemaSimpleType(schema, false));
stringElement2.setSchemaTypeName(Constants.XSD_STRING);
stringElement2.setName(ELEMENT_NAME_2);
List<String> nonQueryProps = new ArrayList<String>();
nonQueryProps.add(ELEMENT_NAME_1);
FeatureMetacardType featureMetacardType = new FeatureMetacardType(schema, FEATURE_TYPE, nonQueryProps, Wfs10Constants.GML_NAMESPACE);
assertTrue(featureMetacardType.getTextualProperties().size() == 2);
AttributeDescriptor attrDesc = featureMetacardType.getAttributeDescriptor(prefix(ELEMENT_NAME_1));
assertNotNull(attrDesc);
assertFalse(attrDesc.isIndexed());
AttributeDescriptor attrDesc2 = featureMetacardType.getAttributeDescriptor(prefix(ELEMENT_NAME_2));
assertNotNull(attrDesc2);
assertTrue(attrDesc2.isIndexed());
}
Aggregations