/** Set whatever an exhaustive scan against all registered objects is allowed. */ @Override public void setFullScanAllowed(final boolean fullScan) { finder.setFullScanAllowed(fullScan); super.setFullScanAllowed(fullScan); }
/** Returns the next finder in the specified set of factories, or {@code null} if none. */ final IdentifiedObjectFinder next(final Iterator<AuthorityFactory> it) throws FactoryException { while (it.hasNext()) { final AuthorityFactory factory = it.next(); if (exclude(factory)) { continue; } if (factory instanceof AbstractAuthorityFactory) { final IdentifiedObjectFinder finder = ((AbstractAuthorityFactory) factory) .getIdentifiedObjectFinder(getProxy().getType()); if (finder != null) { finder.setFullScanAllowed(isFullScanAllowed()); return finder; } } } return null; }
private Identifier identifySubObject( AbstractAuthorityFactory factory, IdentifiedObject dependency) throws FactoryException { IdentifiedObjectFinder identifiedObjectFinder = factory.getIdentifiedObjectFinder(dependency.getClass()); identifiedObjectFinder.setFullScanAllowed(isFullScanAllowed()); IdentifiedObject identifiedDependency = identifiedObjectFinder.find(dependency); Identifier id = AbstractIdentifiedObject.getIdentifier(identifiedDependency, getAuthority()); return id; }
/** Makes sure that {@link #fallback} is initialized. */ private void ensureFallback() throws FactoryException { if (fallback == null) { fallback = FallbackAuthorityFactory.this.fallback.getIdentifiedObjectFinder( getProxy().getType()); } fallback.setFullScanAllowed(isFullScanAllowed()); }
final IdentifiedObjectFinder finder = xyFactory.getIdentifiedObjectFinder(object.getClass()); finder.setFullScanAllowed(fullScan); return finder.findIdentifier(object);
finder.setFullScanAllowed(fullScan); final String code = finder.findIdentifier(crs); if (code != null) {
factory.getIdentifiedObjectFinder(CoordinateReferenceSystem.class); finder.setFullScanAllowed(false); assertSame( "Should find without the need for scan, since we can use the CRS:84 identifier.", finder.find(CRS84)); finder.setFullScanAllowed(false); assertNull( "Should not find WGS84 without a full scan, since it doesn't contains the CRS:84 identifier.", finder.find(DefaultGeographicCRS.WGS84)); finder.setFullScanAllowed(true); assertSame( "A full scan should allow us to find WGS84, since it is equals ignoring metadata to CRS:84.", finder.find(DefaultGeographicCRS.WGS84)); finder.setFullScanAllowed(false); assertSame( "At the contrary of testFind(), the scan result should be cached.",
finder.setFullScanAllowed(false); assertSame( "Should find without the need for scan, since we can use the CRS:84 identifier.", finder.setFullScanAllowed(true); assertSame( "Allowing scanning should not make any difference for this CRS84 instance.", finder.setFullScanAllowed(false); assertNull( "Should not find WGS84 without a full scan, since it doesn't contains the CRS:84 identifier.", finder.find(DefaultGeographicCRS.WGS84)); finder.setFullScanAllowed(true); assertSame( "A full scan should allow us to find WGS84, since it is equals ignoring metadata to CRS:84.", finder.setFullScanAllowed(false); assertNull( "The scan result should not be cached.", finder.find(DefaultGeographicCRS.WGS84)); finder.setFullScanAllowed(false); assertNull( "Should not find WGS84 without a full scan, since it doesn't contains the CRS:84 identifier.", finder.find(search)); finder.setFullScanAllowed(true); assertSame( "A full scan should allow us to find WGS84, since it is equals ignoring metadata to CRS:84.",
/** Tests the {@link IdentifiedObjectFinder#find} method. */ @Test public void testFind() throws FactoryException { final AbstractAuthorityFactory all = AllAuthoritiesFactory.DEFAULT; final IdentifiedObjectFinder finder = all.getIdentifiedObjectFinder(CoordinateReferenceSystem.class); finder.setFullScanAllowed(false); assertNull( "Should not find the CRS without a scan.", finder.find(DefaultGeographicCRS.WGS84)); finder.setFullScanAllowed(true); final IdentifiedObject find = finder.find(DefaultGeographicCRS.WGS84); assertNotNull("With scan allowed, should find the CRS.", find); assertTrue(CRS.equalsIgnoreMetadata(find, DefaultGeographicCRS.WGS84)); assertSame(all.createCoordinateReferenceSystem("CRS:84"), find); assertEquals("CRS:84", finder.findIdentifier(DefaultGeographicCRS.WGS84)); } }