/** * Notifies the caller the requested operation is not supported, using a plain {@link * UnsupportedOperationException} in case we have to conceal the fact the data is actually * writable, using an Spring security exception otherwise to force an authentication from the * user */ protected RuntimeException unsupportedOperation() { String typeName = getSchema().getName().getLocalPart(); if (policy.response == Response.CHALLENGE) { return SecureCatalogImpl.unauthorizedAccess(typeName); } else { return new UnsupportedOperationException(typeName + " is read only"); } } }
@Test public void testMetadataFromFeatueSource() throws Exception { CatalogBuilder cb = new CatalogBuilder(getCatalog()); cb.setStore(cb.buildDataStore("fooStore")); FeatureType ft = createMock(FeatureType.class); expect(ft.getName()).andReturn(new NameImpl("foo")).anyTimes(); expect(ft.getCoordinateReferenceSystem()).andReturn(null).anyTimes(); expect(ft.getGeometryDescriptor()).andReturn(null).anyTimes(); replay(ft); ResourceInfo rInfo = createMock(ResourceInfo.class); expect(rInfo.getTitle()).andReturn("foo title"); expect(rInfo.getDescription()).andReturn("foo description"); expect(rInfo.getKeywords()) .andReturn(new LinkedHashSet<String>(Arrays.asList("foo", "bar", "baz", ""))) .anyTimes(); replay(rInfo); FeatureSource fs = createMock(FeatureSource.class); expect(fs.getSchema()).andReturn(ft).anyTimes(); expect(fs.getInfo()).andReturn(rInfo).anyTimes(); expect(fs.getName()).andReturn(ft.getName()).anyTimes(); replay(fs); FeatureTypeInfo ftInfo = cb.buildFeatureType(fs); assertEquals("foo title", ftInfo.getTitle()); assertEquals("foo description", ftInfo.getDescription()); assertTrue(ftInfo.getKeywords().contains(new Keyword("foo"))); assertTrue(ftInfo.getKeywords().contains(new Keyword("bar"))); assertTrue(ftInfo.getKeywords().contains(new Keyword("baz"))); }
final String localName = names[i].getLocalPart(); if (queryNames.contains(localName)) { String typeName = getSchema().getName().getLocalPart(); if (policy.getResponse() == Response.CHALLENGE) { throw SecureCatalogImpl.unauthorizedAccess(typeName);
public void put(FeatureType type) { FeatureType other = map.putIfAbsent(type.getName(), type); if (other != null) { if (!other.equals(type)) { String msg = "Type with same name already exists in cache."; throw new IllegalArgumentException(msg); } } } }
new FilteringFeatureCollection<T, F>(collection, writeQuery.getFilter()); if (filtered.size() < collection.size()) { String typeName = getSchema().getName().getLocalPart(); if (policy.response == Response.CHALLENGE) { throw SecureCatalogImpl.unauthorizedAccess(typeName);
name = featureType.getName();
public DefaultResourceInfo(FeatureSource fs) { this.fs = fs; words = new HashSet<String>(); { words.add("features"); words.add(fs.getSchema().getName().toString()); } }
assertEquals("sf_archsites", type.getName().getLocalPart()); assertEquals( "sf_archsites", ftInfo.getFeatureSource(null, null).getName().getLocalPart());
public URI getSchema() { Name name = WFSContentComplexFeatureSource.this.getSchema().getName(); URI namespace; try { namespace = new URI(name.getNamespaceURI()); return namespace; } catch (URISyntaxException e) { return null; } }
@Override public URI getSchema() { Name name = fs.getSchema().getName(); URI namespace; try { namespace = new URI(name.getNamespaceURI()); return namespace; } catch (URISyntaxException e) { return null; } }
public static Element AbstractFeatureType_encode( Object object, Document document, Element value) { Feature feature = (Feature) object; FeatureType featureType = feature.getType(); String namespace = featureType.getName().getNamespaceURI(); String typeName = featureType.getName().getLocalPart(); Element encoding = document.createElementNS(namespace, typeName); encoding.setAttributeNS(null, "fid", feature.getIdentifier().getID()); return encoding; }
@Override public String getTitle() { Name name = fs.getSchema().getName(); return name.getLocalPart(); } }
public String getTitle() { Name name = WFSContentComplexFeatureSource.this.getSchema().getName(); return name.getLocalPart(); } };
@Override public String getName() { return fs.getSchema().getName().getLocalPart(); }
private FeatureChainLink(FeatureTypeMapping featureType) { if (featureType == null) { throw new NullPointerException("featureType is null"); } this.featureTypeMapping = featureType; this.nestedFeatureAttribute = null; this.chainingByReference = false; this.alias = featureType.getSource().getSchema().getName().getLocalPart(); this.nextStep = null; this.previousStep = null; }
private boolean isFeatureTypeStyleActive(FeatureType ftype, FeatureTypeStyle fts) { // TODO: find a complex feature equivalent for this check return fts.featureTypeNames().isEmpty() || ((ftype.getName().getLocalPart() != null) && (ftype.getName() .getLocalPart() .equalsIgnoreCase(fts.getFeatureTypeName()) || FeatureTypes.isDecendedFrom( ftype, null, fts.getFeatureTypeName()))); }
public void check(int index, SimpleFeature feature) { assertEquals( tname(features.getSchema().getName().getLocalPart()) + "." + index, feature.getID()); } });
public void check(int index, SimpleFeature feature) { assertEquals( tname(features.getSchema().getName().getLocalPart()) + "." + index, feature.getIdentifier().getID()); } });
@Test public void testGetAncestors() { SimpleFeatureTypeBuilder builder = new SimpleFeatureTypeBuilder(); builder.setName("SomeFeature"); builder.setCRS(null); builder.add("name", String.class); builder.add("geom", Point.class); SimpleFeatureType ft = builder.buildFeatureType(); List<FeatureType> types = FeatureTypes.getAncestors(ft); Assert.assertEquals(1, types.size()); Assert.assertEquals("Feature", types.get(0).getName().getLocalPart()); }