featureType.setNativeName(ftInfoReader.name()); if (ftInfoReader.alias() != null) { featureType.setName(ftInfoReader.alias()); } else { featureType.setName(ftInfoReader.name()); featureType.setSRS("EPSG:" + ftInfoReader.srs()); featureType.setProjectionPolicy(pp); featureType.setTitle(ftInfoReader.title()); featureType.setAbstract(ftInfoReader.abstrct()); for (String kw : ftInfoReader.keywords()) { featureType.getKeywords().add(new Keyword(kw)); link.setMetadataType((String) m.get("metadataType")); link.setType((String) m.get("type")); featureType.getMetadataLinks().add(link); featureType.setLatLonBoundingBox( new ReferencedEnvelope( ftInfoReader.latLonBoundingBox(), DefaultGeographicCRS.WGS84)); featureType.setEnabled(true); featureType.setMaxFeatures(ftInfoReader.maxFeatures()); featureType.getMetadata().put("dirName", ftInfoReader.parentDirectoryName()); featureType.getMetadata().put("indexingEnabled", ftInfoReader.searchable()); featureType.getMetadata().put(ResourceInfo.CACHING_ENABLED, ftInfoReader.cachingEnabled()); featureType.getMetadata().put(ResourceInfo.CACHE_AGE_MAX, ftInfoReader.cacheAgeMax()); featureType.getMetadata().put("kml.regionateAttribute", ftInfoReader.regionateAttribute());
public FeatureType getFeatureType() throws IOException { return delegate.getFeatureType(); }
public void setNativeBox(Catalog catalog, String name) throws Exception { FeatureTypeInfo fti = catalog.getFeatureTypeByName(name); fti.setNativeBoundingBox(fti.getFeatureSource(null, null).getBounds()); fti.setLatLonBoundingBox( new ReferencedEnvelope(fti.getNativeBoundingBox(), DefaultGeographicCRS.WGS84)); catalog.save(fti); }
if (info.getAttributes() != null && !info.getAttributes().isEmpty() && info.getAttributes().get(0).getBinding() != null) { return info.getAttributes(); List<AttributeTypeInfo> atts = featureTypeAttributeCache.get(info.getId()); if (atts == null) { synchronized (featureTypeAttributeCache) { atts = featureTypeAttributeCache.get(info.getId()); if (atts == null) { LOGGER.log( Level.WARNING, "Error occured applying schema override for " + info.getName(), e); if (info.getId() != null) { featureTypeAttributeCache.put(info.getId(), atts);
CoordinateReferenceSystem crs = ftinfo.getNativeCRS(); if (crs == null) { if (data != null) { crs = data.getSchema().getCoordinateReferenceSystem(); } else { crs = ftinfo.getFeatureType().getCoordinateReferenceSystem(); try { Integer code = CRS.lookupEpsgCode(crs, extensive); if (code != null) ftinfo.setSRS("EPSG:" + code); } catch (FactoryException e) { throw (IOException) new IOException().initCause(e); ftinfo.setSRS(DEFAULT_SRS);
protected FeatureTypeInfo newFeatureType(String name, DataStoreInfo ds) { FeatureTypeInfo ft2 = catalog.getFactory().createFeatureType(); ft2.setNamespace(ns); ft2.setName(name); ft2.setStore(ds); return ft2; }
String namespace = ft.getNamespace().getURI(); Name qualifiedName = new NameImpl(namespace, _layerInfo.getName()); LayerInfo layerInfo = catalog.getLayerByName(qualifiedName); boolean isNew = ft.getId() == null || app.getCatalog().getResource(ft.getId(),ResourceInfo.class) == null; dsInfo = catalog.getStore(ft.getStore().getId(), DataStoreInfo.class); ElasticDataStore ds = (ElasticDataStore) dsInfo.getDataStore(null); CatalogBuilder builder = new CatalogBuilder(catalog); typeInfo.setName(_layerInfo.getName()); typeInfo.getMetadata().put(ElasticLayerConfiguration.KEY, layerConfig); typeInfo.setEnabled(_typeInfo.isEnabled()); typeInfo.setAdvertised(_typeInfo.isAdvertised()); typeInfo.setTitle(_typeInfo.getTitle()); typeInfo.setDescription(_typeInfo.getDescription()); typeInfo.setAbstract(_typeInfo.getAbstract()); typeInfo.getKeywords().addAll(_typeInfo.getKeywords()); typeInfo.getMetadataLinks().addAll(_typeInfo.getMetadataLinks()); typeInfo.getDataLinks().addAll(_typeInfo.getDataLinks()); typeInfo.setSRS(_typeInfo.getSRS()); typeInfo.setProjectionPolicy(_typeInfo.getProjectionPolicy()); typeInfo.setNativeBoundingBox(_typeInfo.getNativeBoundingBox()); typeInfo.setLatLonBoundingBox(_typeInfo.getLatLonBoundingBox()); typeInfo.setCircularArcPresent(_typeInfo.isCircularArcPresent()); typeInfo.setLinearizationTolerance(_typeInfo.getLinearizationTolerance()); typeInfo.getMetadata().put(ElasticLayerConfiguration.KEY, _layerConfig);
ft.setStore(ds); ft.setNamespace(ns); ft.setName("ft"); ft.setAbstract("abstract"); ft.setSRS("EPSG:4326"); ft.setNativeCRS(CRS.decode("EPSG:4326")); ft.setLinearizationTolerance(new Measure(10, SI.METRE)); assertNotNull(ft); assertEquals("ft", ft.getName()); assertEquals(ds, ft.getStore()); assertEquals(ns, ft.getNamespace()); assertEquals("EPSG:4326", ft.getSRS()); assertEquals(new Measure(10, SI.METRE), ft.getLinearizationTolerance()); assertTrue(CRS.equalsIgnoreMetadata(CRS.decode("EPSG:4326"), ft.getNativeCRS()));
featureType.setStore(store); featureType.setNamespace(catalog.getNamespaceByPrefix(prefix)); featureType.setName(LayerProperty.NAME.get(props, name)); featureType.setNativeName(FilenameUtils.getBaseName(filename)); featureType.setTitle(name); featureType.setAbstract("abstract about " + name); srs = 4326; featureType.setSRS("EPSG:" + srs); try { featureType.setNativeCRS(CRS.decode("EPSG:" + srs)); } catch (Exception e) { LOGGER.warning("Failed to decode EPSG:" + srs + ", setting the native SRS to null"); featureType.setNumDecimals(8); featureType.getKeywords().add(new Keyword(name)); featureType.setEnabled(true); featureType.setProjectionPolicy( LayerProperty.PROJECTION_POLICY.get(props, ProjectionPolicy.NONE)); featureType.setLatLonBoundingBox( LayerProperty.LATLON_ENVELOPE.get(props, DEFAULT_LATLON_ENVELOPE)); featureType.setNativeBoundingBox(LayerProperty.ENVELOPE.get(props, null));
ft.setStore(ds); ft.setNamespace(ns); ft.setName("ft"); ft.setAbstract("abstract"); ft.setSRS("EPSG:4326"); ft.setNativeCRS(CRS.decode("EPSG:4326")); ft.getMetadata().put(FeatureTypeInfo.JDBC_VIRTUAL_TABLE, vt); catalog.add(ft); VirtualTable vt2 = (VirtualTable) ft.getMetadata().get(FeatureTypeInfo.JDBC_VIRTUAL_TABLE); assertNotNull(vt2); assertEquals(vt, vt2);
FeatureTypeInfo info, Hints hints) throws IOException { DataAccess<? extends FeatureType, ? extends Feature> dataAccess = getDataStore(info.getStore()); return dataAccess.getFeatureSource(info.getQualifiedName()); final String typeName = info.getNativeName(); final String alias = info.getName(); final SimpleFeatureType nativeFeatureType = dataStore.getSchema(typeName); final SimpleFeatureType renamedFeatureType = fs = dataStore.getFeatureSource(info.getQualifiedName()); ProjectionPolicy ppolicy = info.getProjectionPolicy(); List<AttributeTypeInfo> attributes = info.attributes(); if (attributes == null || attributes.isEmpty()) { return fs; resultCRS = nativeCRS; } else { resultCRS = getCRS(info.getSRS()); fs, schema, info.filter(), resultCRS, info.getProjectionPolicy().getCode()); } catch (Exception e) {
DataStoreInfo ds = catalog.getFactory().createDataStore(); FeatureTypeInfo ftFoo = catalog.getFactory().createFeatureType(); ftFoo.setName("foo"); ftFoo.setSRS("EPSG:4326"); ftFoo.setNamespace(ns); ftFoo.setStore(ds); catalog.add(ftFoo); FeatureTypeInfo ftBar = catalog.getFactory().createFeatureType(); ftBar.setName("bar"); ftBar.setSRS("EPSG:3348"); ftBar.setNamespace(ns); ftBar.setStore(ds); catalog.add(ftBar);
private void updateSolrConfiguration(FeatureTypeInfo ft, SolrLayerConfiguration slc) { // go directly to the resource pool to avoid security wrappers try { DataAccess<? extends FeatureType, ? extends Feature> dataStore = catalog.getResourcePool().getDataStore(ft.getStore()); if (dataStore instanceof SolrDataStore) { SolrDataStore solr = (SolrDataStore) dataStore; solr.getSolrConfigurations().remove(slc.getLayerName()); slc.setLayerName(ft.getName()); solr.setSolrConfigurations(slc); } } catch (IOException e) { throw new CatalogException("Failed to remove layer configuration from data store", e); } FeatureTypeInfo proxy = catalog.getFeatureType(ft.getId()); proxy.setNativeName(ft.getName()); proxy.getMetadata().put(SolrLayerConfiguration.KEY, slc); catalog.save(proxy); }
@Test public void testGetLayerByNameWithColon() { addNamespace(); addDataStore(); FeatureTypeInfo ft = catalog.getFactory().createFeatureType(); ft.setEnabled(true); ft.setName("foo:bar"); ft.setAbstract("ftAbstract"); ft.setDescription("ftDescription"); ft.setStore(ds); ft.setNamespace(ns); catalog.add(ft); addStyle(); LayerInfo l = catalog.getFactory().createLayer(); l.setResource(ft); l.setEnabled(true); l.setDefaultStyle(s); catalog.add(l); assertNotNull(catalog.getLayerByName("foo:bar")); }
ftinfo.setStore(store); ftinfo.setEnabled(true); name = featureType.getName(); ftinfo.setNativeName(name.getLocalPart()); ftinfo.setName(name.getLocalPart()); ftinfo.setNamespace(namespace); crs = featureType.getGeometryDescriptor().getCoordinateReferenceSystem(); ftinfo.setNativeCRS(crs);
@Override public void visit(FeatureTypeInfo featureType) { FeatureTypeInfo otherFeatureType = otherCatalog.getFeatureType(featureType.getId()); if (otherFeatureType != null) { otherFeatureType.setProjectionPolicy(featureType.getProjectionPolicy()); } if (!(Objects.equals(featureType, otherFeatureType) && checkEquals(featureType.getAttributes(), otherFeatureType.getAttributes()) && checkEquals(featureType.getResponseSRS(), otherFeatureType.getResponseSRS()) && checkEquals(featureType.getAlias(), otherFeatureType.getAlias()) && checkEquals(featureType.getKeywords(), otherFeatureType.getKeywords()) && checkEquals(featureType.getDataLinks(), otherFeatureType.getDataLinks()) && checkEquals(featureType.getMetadataLinks(), otherFeatureType.getMetadataLinks()) && checkEquals(featureType.getMetadata(), otherFeatureType.getMetadata()))) { differences.add(new InfoDiff(featureType, otherFeatureType)); } }
@Test public void testForce() throws Exception { FeatureTypeInfo fti = getCatalog().getFeatureTypeByName(MockData.BASIC_POLYGONS.getLocalPart()); assertEquals("EPSG:4269", fti.getSRS()); assertEquals(ProjectionPolicy.FORCE_DECLARED, fti.getProjectionPolicy()); FeatureCollection fc = fti.getFeatureSource(null, null).getFeatures(); assertEquals(CRS.decode("EPSG:4269"), fc.getSchema().getCoordinateReferenceSystem()); FeatureIterator fi = fc.features(); Feature f = fi.next(); fi.close(); assertEquals(CRS.decode("EPSG:4269"), f.getType().getCoordinateReferenceSystem()); }
@Test public void testGetFeatureTypeByName() { addFeatureType(); FeatureTypeInfo ft2 = catalog.getFeatureTypeByName(ft.getName()); assertNotNull(ft2); assertFalse(ft == ft2); assertEquals(ft, ft2); NamespaceInfo ns2 = catalog.getFactory().createNamespace(); ns2.setPrefix("ns2Prefix"); ns2.setURI("ns2URI"); catalog.add(ns2); FeatureTypeInfo ft3 = catalog.getFactory().createFeatureType(); ft3.setName("ft3Name"); ft3.setStore(ds); ft3.setNamespace(ns2); catalog.add(ft3); FeatureTypeInfo ft4 = catalog.getFeatureTypeByName(ns2.getPrefix(), ft3.getName()); assertNotNull(ft4); assertFalse(ft4 == ft3); assertEquals(ft3, ft4); ft4 = catalog.getFeatureTypeByName(ns2.getURI(), ft3.getName()); assertNotNull(ft4); assertFalse(ft4 == ft3); assertEquals(ft3, ft4); }
public String getName() { return delegate.getName(); }
@Test public void testDefaultGeometry() throws IOException { FeatureTypeInfo featureType = getCatalog().getResourceByName("cdf", "Nulls", FeatureTypeInfo.class); GeometryDescriptor schemaDefaultGeometry = featureType.getFeatureType().getGeometryDescriptor(); FeatureIterator i = featureType.getFeatureSource(null, null).getFeatures().features(); GeometryDescriptor featureDefaultGeometry = i.next().getDefaultGeometryProperty().getDescriptor(); assertNotNull(schemaDefaultGeometry); assertNotNull(featureDefaultGeometry); assertEquals("pointProperty", schemaDefaultGeometry.getLocalName()); assertEquals(schemaDefaultGeometry, featureDefaultGeometry); } }