Search in sources :

Example 1 with MetacardTypeEnhancer

use of org.codice.ddf.spatial.ogc.wfs.catalog.MetacardTypeEnhancer in project ddf by codice.

the class WfsSource method createFeatureMetacardTypeRegistration.

private FeatureMetacardType createFeatureMetacardTypeRegistration(FeatureTypeType featureTypeType, String ftName, XmlSchema schema) {
    MetacardTypeEnhancer metacardTypeEnhancer = metacardTypeEnhancers.stream().filter(me -> me.getFeatureName() != null).filter(me -> me.getFeatureName().equalsIgnoreCase(ftName)).findAny().orElse(FeatureMetacardType.DEFAULT_METACARD_TYPE_ENHANCER);
    FeatureMetacardType ftMetacard = new FeatureMetacardType(schema, featureTypeType.getName(), nonQueryableProperties != null ? Arrays.stream(nonQueryableProperties).collect(toSet()) : new HashSet<>(), Wfs11Constants.GML_3_1_1_NAMESPACE, metacardTypeEnhancer);
    Dictionary<String, Object> props = new DictionaryMap<>();
    props.put(Metacard.CONTENT_TYPE, new String[] { ftName });
    LOGGER.debug("WfsSource {}: Registering MetacardType: {}", getId(), ftName);
    return ftMetacard;
}
Also used : SortByType(net.opengis.filter.v_1_1_0.SortByType) Arrays(java.util.Arrays) WfsMetadata(org.codice.ddf.spatial.ogc.wfs.featuretransformer.WfsMetadata) XmlSchemaMessageBodyReaderWfs11(org.codice.ddf.spatial.ogc.wfs.v110.catalog.source.reader.XmlSchemaMessageBodyReaderWfs11) StringUtils(org.apache.commons.lang3.StringUtils) MediaType(javax.ws.rs.core.MediaType) MarkableStreamInterceptor(org.codice.ddf.spatial.ogc.wfs.catalog.source.MarkableStreamInterceptor) ContentTypeImpl(ddf.catalog.data.impl.ContentTypeImpl) Map(java.util.Map) WfsFeatureCollection(org.codice.ddf.spatial.ogc.wfs.catalog.WfsFeatureCollection) BigInteger(java.math.BigInteger) JAXBElementProvider(org.apache.cxf.jaxrs.provider.JAXBElementProvider) ClientBuilderFactory(org.codice.ddf.cxf.client.ClientBuilderFactory) AvailabilityTask(org.codice.ddf.spatial.ogc.catalog.common.AvailabilityTask) ServiceReference(org.osgi.framework.ServiceReference) SSLHandshakeException(javax.net.ssl.SSLHandshakeException) Set(java.util.Set) DescribeFeatureTypeRequest(org.codice.ddf.spatial.ogc.wfs.v110.catalog.common.DescribeFeatureTypeRequest) StandardCharsets(java.nio.charset.StandardCharsets) Serializable(java.io.Serializable) IOUtils(org.apache.commons.io.IOUtils) MetacardMapper(org.codice.ddf.spatial.ogc.wfs.catalog.mapper.MetacardMapper) AvailabilityCommand(org.codice.ddf.spatial.ogc.catalog.common.AvailabilityCommand) WebApplicationException(javax.ws.rs.WebApplicationException) QName(javax.xml.namespace.QName) Dictionary(java.util.Dictionary) ResourceResponse(ddf.catalog.operation.ResourceResponse) SpatialOperatorType(net.opengis.filter.v_1_1_0.SpatialOperatorType) FilterAdapter(ddf.catalog.filter.FilterAdapter) Resource(ddf.catalog.resource.Resource) ArrayList(java.util.ArrayList) QueryRequest(ddf.catalog.operation.QueryRequest) ScheduledExecutorService(java.util.concurrent.ScheduledExecutorService) WfsMetadataImpl(org.codice.ddf.spatial.ogc.wfs.catalog.common.WfsMetadataImpl) ConnectException(java.net.ConnectException) Result(ddf.catalog.data.Result) ResultTypeType(net.opengis.wfs.v_1_1_0.ResultTypeType) DictionaryMap(org.codice.ddf.configuration.DictionaryMap) SortOrder(org.opengis.filter.sort.SortOrder) ContentType(ddf.catalog.data.ContentType) Properties(java.util.Properties) StringWriter(java.io.StringWriter) IOException(java.io.IOException) Query(ddf.catalog.operation.Query) Paths(java.nio.file.Paths) ScheduledFuture(java.util.concurrent.ScheduledFuture) QueryType(net.opengis.wfs.v_1_1_0.QueryType) UnsupportedQueryException(ddf.catalog.source.UnsupportedQueryException) GetFeatureType(net.opengis.wfs.v_1_1_0.GetFeatureType) LoggerFactory(org.slf4j.LoggerFactory) MetacardMapperImpl(org.codice.ddf.spatial.ogc.wfs.catalog.mapper.impl.MetacardMapperImpl) WfsMetacardTypeRegistry(org.codice.ddf.spatial.ogc.wfs.catalog.metacardtype.registry.WfsMetacardTypeRegistry) URI(java.net.URI) Collectors.toSet(java.util.stream.Collectors.toSet) PropertyNameType(net.opengis.filter.v_1_1_0.PropertyNameType) FeatureTypeType(net.opengis.wfs.v_1_1_0.FeatureTypeType) WfsException(org.codice.ddf.spatial.ogc.wfs.catalog.common.WfsException) InvalidSyntaxException(org.osgi.framework.InvalidSyntaxException) Predicate(java.util.function.Predicate) SourceResponseImpl(ddf.catalog.operation.impl.SourceResponseImpl) ResultImpl(ddf.catalog.data.impl.ResultImpl) ClientBuilder(org.codice.ddf.cxf.client.ClientBuilder) SourceMonitor(ddf.catalog.source.SourceMonitor) Collectors(java.util.stream.Collectors) JAXBException(javax.xml.bind.JAXBException) BundleContext(org.osgi.framework.BundleContext) CatalogTransformerException(ddf.catalog.transform.CatalogTransformerException) List(java.util.List) ObjectFactory(net.opengis.wfs.v_1_1_0.ObjectFactory) Response(javax.ws.rs.core.Response) FeatureMetacardType(org.codice.ddf.spatial.ogc.wfs.catalog.common.FeatureMetacardType) ResourceResponseImpl(ddf.catalog.operation.impl.ResourceResponseImpl) Entry(java.util.Map.Entry) FilterType(net.opengis.filter.v_1_1_0.FilterType) SecureCxfClientFactory(org.codice.ddf.cxf.client.SecureCxfClientFactory) WFSCapabilitiesType(net.opengis.wfs.v_1_1_0.WFSCapabilitiesType) FeatureTransformationService(org.codice.ddf.spatial.ogc.wfs.featuretransformer.FeatureTransformationService) GetCapabilitiesRequest(org.codice.ddf.spatial.ogc.wfs.v110.catalog.common.GetCapabilitiesRequest) LAT_LON_ORDER(org.codice.ddf.libs.geo.util.GeospatialUtil.LAT_LON_ORDER) Marshaller(javax.xml.bind.Marshaller) HashMap(java.util.HashMap) SortOrderType(net.opengis.filter.v_1_1_0.SortOrderType) HashSet(java.util.HashSet) SortBy(org.opengis.filter.sort.SortBy) MetadataTransformer(org.codice.ddf.spatial.ogc.catalog.MetadataTransformer) Constants(ddf.catalog.Constants) Metacard(ddf.catalog.data.Metacard) EncryptionService(ddf.security.encryption.EncryptionService) ResourceImpl(ddf.catalog.resource.impl.ResourceImpl) XmlSchema(org.apache.ws.commons.schema.XmlSchema) SortPropertyType(net.opengis.filter.v_1_1_0.SortPropertyType) JAXBContext(javax.xml.bind.JAXBContext) AbstractWfsSource(org.codice.ddf.spatial.ogc.wfs.catalog.common.AbstractWfsSource) QueryImpl(ddf.catalog.operation.impl.QueryImpl) Wfs11Constants(org.codice.ddf.spatial.ogc.wfs.v110.catalog.common.Wfs11Constants) Logger(org.slf4j.Logger) MetacardTypeEnhancer(org.codice.ddf.spatial.ogc.wfs.catalog.MetacardTypeEnhancer) TimeUnit(java.util.concurrent.TimeUnit) SourceResponse(ddf.catalog.operation.SourceResponse) ContentTypeFilterDelegate(org.codice.ddf.spatial.ogc.catalog.common.ContentTypeFilterDelegate) Collections(java.util.Collections) InputStream(java.io.InputStream) MetacardTypeEnhancer(org.codice.ddf.spatial.ogc.wfs.catalog.MetacardTypeEnhancer) FeatureMetacardType(org.codice.ddf.spatial.ogc.wfs.catalog.common.FeatureMetacardType) HashSet(java.util.HashSet) DictionaryMap(org.codice.ddf.configuration.DictionaryMap)

Example 2 with MetacardTypeEnhancer

use of org.codice.ddf.spatial.ogc.wfs.catalog.MetacardTypeEnhancer in project ddf by codice.

the class FeatureMetacardTypeTest method testMetacardTypeEnhancer.

@Test
public void testMetacardTypeEnhancer() {
    final AttributeDescriptor attributeDescriptor = new AttributeDescriptorImpl("foo", true, true, true, true, BasicTypes.STRING_TYPE);
    final MetacardTypeEnhancer metacardTypeEnhancer = mock(MetacardTypeEnhancer.class);
    doReturn(Collections.singleton(attributeDescriptor)).when(metacardTypeEnhancer).getAttributeDescriptors();
    final QName featureTypeName = new QName("http://codice.org/test", "TheFeatureType");
    final FeatureMetacardType featureMetacardType = new FeatureMetacardType(new XmlSchema(), featureTypeName, EMPTY_NON_QUERYABLE_PROPS, GML_3_1_1_NAMESPACE, metacardTypeEnhancer);
    assertThat(featureMetacardType.getAttributeDescriptor("foo"), is(attributeDescriptor));
}
Also used : MetacardTypeEnhancer(org.codice.ddf.spatial.ogc.wfs.catalog.MetacardTypeEnhancer) XmlSchema(org.apache.ws.commons.schema.XmlSchema) QName(javax.xml.namespace.QName) AttributeDescriptor(ddf.catalog.data.AttributeDescriptor) AttributeDescriptorImpl(ddf.catalog.data.impl.AttributeDescriptorImpl) Test(org.junit.Test)

Aggregations

QName (javax.xml.namespace.QName)2 XmlSchema (org.apache.ws.commons.schema.XmlSchema)2 MetacardTypeEnhancer (org.codice.ddf.spatial.ogc.wfs.catalog.MetacardTypeEnhancer)2 Constants (ddf.catalog.Constants)1 AttributeDescriptor (ddf.catalog.data.AttributeDescriptor)1 ContentType (ddf.catalog.data.ContentType)1 Metacard (ddf.catalog.data.Metacard)1 Result (ddf.catalog.data.Result)1 AttributeDescriptorImpl (ddf.catalog.data.impl.AttributeDescriptorImpl)1 ContentTypeImpl (ddf.catalog.data.impl.ContentTypeImpl)1 ResultImpl (ddf.catalog.data.impl.ResultImpl)1 FilterAdapter (ddf.catalog.filter.FilterAdapter)1 Query (ddf.catalog.operation.Query)1 QueryRequest (ddf.catalog.operation.QueryRequest)1 ResourceResponse (ddf.catalog.operation.ResourceResponse)1 SourceResponse (ddf.catalog.operation.SourceResponse)1 QueryImpl (ddf.catalog.operation.impl.QueryImpl)1 ResourceResponseImpl (ddf.catalog.operation.impl.ResourceResponseImpl)1 SourceResponseImpl (ddf.catalog.operation.impl.SourceResponseImpl)1 Resource (ddf.catalog.resource.Resource)1