Search in sources :

Example 21 with FeatureMetacardType

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);
        }
    }
}
Also used : FeatureMetacardType(org.codice.ddf.spatial.ogc.wfs.catalog.common.FeatureMetacardType) MetacardType(ddf.catalog.data.MetacardType) FeatureMetacardType(org.codice.ddf.spatial.ogc.wfs.catalog.common.FeatureMetacardType) ServiceRegistration(org.osgi.framework.ServiceRegistration)

Example 22 with FeatureMetacardType

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);
}
Also used : XmlSchema(org.apache.ws.commons.schema.XmlSchema) XmlSchemaElement(org.apache.ws.commons.schema.XmlSchemaElement) XmlSchemaSimpleType(org.apache.ws.commons.schema.XmlSchemaSimpleType) QName(javax.xml.namespace.QName) FeatureMetacardType(org.codice.ddf.spatial.ogc.wfs.catalog.common.FeatureMetacardType) Test(org.junit.Test)

Example 23 with FeatureMetacardType

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);
}
Also used : XmlSchemaComplexContentExtension(org.apache.ws.commons.schema.XmlSchemaComplexContentExtension) XmlSchemaSequence(org.apache.ws.commons.schema.XmlSchemaSequence) XmlSchema(org.apache.ws.commons.schema.XmlSchema) XmlSchemaElement(org.apache.ws.commons.schema.XmlSchemaElement) QName(javax.xml.namespace.QName) XmlSchemaSimpleType(org.apache.ws.commons.schema.XmlSchemaSimpleType) XmlSchemaComplexType(org.apache.ws.commons.schema.XmlSchemaComplexType) XmlSchemaComplexContent(org.apache.ws.commons.schema.XmlSchemaComplexContent) FeatureMetacardType(org.codice.ddf.spatial.ogc.wfs.catalog.common.FeatureMetacardType) Test(org.junit.Test)

Example 24 with FeatureMetacardType

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);
}
Also used : XmlSchema(org.apache.ws.commons.schema.XmlSchema) XmlSchemaElement(org.apache.ws.commons.schema.XmlSchemaElement) XmlSchemaSimpleType(org.apache.ws.commons.schema.XmlSchemaSimpleType) QName(javax.xml.namespace.QName) FeatureMetacardType(org.codice.ddf.spatial.ogc.wfs.catalog.common.FeatureMetacardType) Test(org.junit.Test)

Example 25 with FeatureMetacardType

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());
}
Also used : XmlSchema(org.apache.ws.commons.schema.XmlSchema) XmlSchemaElement(org.apache.ws.commons.schema.XmlSchemaElement) XmlSchemaSimpleType(org.apache.ws.commons.schema.XmlSchemaSimpleType) ArrayList(java.util.ArrayList) AttributeDescriptor(ddf.catalog.data.AttributeDescriptor) FeatureMetacardType(org.codice.ddf.spatial.ogc.wfs.catalog.common.FeatureMetacardType) Test(org.junit.Test)

Aggregations

FeatureMetacardType (org.codice.ddf.spatial.ogc.wfs.catalog.common.FeatureMetacardType)40 XmlSchema (org.apache.ws.commons.schema.XmlSchema)37 QName (javax.xml.namespace.QName)34 XmlSchemaElement (org.apache.ws.commons.schema.XmlSchemaElement)32 Test (org.junit.Test)32 XmlSchemaSimpleType (org.apache.ws.commons.schema.XmlSchemaSimpleType)26 XmlSchemaComplexType (org.apache.ws.commons.schema.XmlSchemaComplexType)10 AttributeDescriptor (ddf.catalog.data.AttributeDescriptor)7 ArrayList (java.util.ArrayList)6 MetacardType (ddf.catalog.data.MetacardType)2 HashMap (java.util.HashMap)2 Hashtable (java.util.Hashtable)2 WebApplicationException (javax.ws.rs.WebApplicationException)2 XmlSchemaComplexContent (org.apache.ws.commons.schema.XmlSchemaComplexContent)2 XmlSchemaComplexContentExtension (org.apache.ws.commons.schema.XmlSchemaComplexContentExtension)2 XmlSchemaSequence (org.apache.ws.commons.schema.XmlSchemaSequence)2 WfsException (org.codice.ddf.spatial.ogc.wfs.catalog.common.WfsException)2 ServiceRegistration (org.osgi.framework.ServiceRegistration)2 HierarchicalStreamReader (com.thoughtworks.xstream.io.HierarchicalStreamReader)1 MetacardImpl (ddf.catalog.data.impl.MetacardImpl)1