/** * Returns the {@linkplain CSAuthorityFactory CS authority factory} singleton. * * @throws FactoryNotFoundException if no factory was found for the requested type. * @throws FactoryRegistryException if the factory can't be obtained for an other reason. */ public CSAuthorityFactory getCSAuthorityFactory() throws FactoryRegistryException { return ReferencingFactoryFinder.getCSAuthorityFactory(DEFAULT_AUTHORITY, hints); }
/** Returns a factory for the specified authority and type. */ @Override final <T extends AuthorityFactory> T fromFactoryRegistry( final String authority, final Class<T> type) throws FactoryRegistryException { final AuthorityFactory f; if (CRSAuthorityFactory.class.equals(type)) { f = ReferencingFactoryFinder.getCRSAuthorityFactory(authority, getHints()); } else if (CSAuthorityFactory.class.equals(type)) { f = ReferencingFactoryFinder.getCSAuthorityFactory(authority, getHints()); } else if (DatumAuthorityFactory.class.equals(type)) { f = ReferencingFactoryFinder.getDatumAuthorityFactory(authority, getHints()); } else if (CoordinateOperationAuthorityFactory.class.equals(type)) { f = ReferencingFactoryFinder.getCoordinateOperationAuthorityFactory( authority, getHints()); } else { f = super.fromFactoryRegistry(authority, type); } return type.cast(f); }
/** * Creates a wrappers around the default factories for the specified authority. The factories * are fetched using {@link ReferencingFactoryFinder}. * * @param authority The authority to wraps (example: {@code "EPSG"}). If {@code null}, then all * authority factories must be explicitly specified in the set of hints. * @param userHints An optional set of hints, or {@code null} if none. * @throws FactoryRegistryException if at least one factory can not be obtained. * @since 2.4 */ protected AuthorityFactoryAdapter(final String authority, final Hints userHints) throws FactoryRegistryException { this( ReferencingFactoryFinder.getCRSAuthorityFactory( authority, trim(userHints, Hints.CRS_AUTHORITY_FACTORY)), ReferencingFactoryFinder.getCSAuthorityFactory( authority, trim(userHints, Hints.CS_AUTHORITY_FACTORY)), ReferencingFactoryFinder.getDatumAuthorityFactory( authority, trim(userHints, Hints.DATUM_AUTHORITY_FACTORY)), ReferencingFactoryFinder.getCoordinateOperationAuthorityFactory( authority, trim(userHints, Hints.COORDINATE_OPERATION_AUTHORITY_FACTORY))); }
/** * Returns the {@linkplain CSAuthorityFactory CS authority factory} singleton. * * @throws FactoryNotFoundException if no factory was found for the requested type. * @throws FactoryRegistryException if the factory can't be obtained for an other reason. */ public CSAuthorityFactory getCSAuthorityFactory() throws FactoryRegistryException { return ReferencingFactoryFinder.getCSAuthorityFactory(DEFAULT_AUTHORITY, hints); }
/** * Returns the {@linkplain CSAuthorityFactory CS authority factory} singleton. * * @throws FactoryNotFoundException if no factory was found for the requested type. * @throws FactoryRegistryException if the factory can't be obtained for an other reason. */ public CSAuthorityFactory getCSAuthorityFactory() throws FactoryRegistryException { return ReferencingFactoryFinder.getCSAuthorityFactory(DEFAULT_AUTHORITY, hints); }
/** Make sure that a singleton instance is registered. */ @Test public void testRegistration() { String authority = "http://www.opengis.net/def"; AuthorityFactory factory = ReferencingFactoryFinder.getCRSAuthorityFactory(authority, null); assertSame(factory, ReferencingFactoryFinder.getCRSAuthorityFactory(authority, null)); assertSame(factory, ReferencingFactoryFinder.getCSAuthorityFactory(authority, null)); assertSame(factory, ReferencingFactoryFinder.getDatumAuthorityFactory(authority, null)); }
/** Make sure that a singleton instance is registered. */ @Test public void testRegistration() { String authority = "URN:OGC:DEF"; final AuthorityFactory factory = ReferencingFactoryFinder.getCRSAuthorityFactory(authority, null); assertSame(factory, ReferencingFactoryFinder.getCRSAuthorityFactory(authority, null)); assertSame(factory, ReferencingFactoryFinder.getCSAuthorityFactory(authority, null)); assertSame(factory, ReferencingFactoryFinder.getDatumAuthorityFactory(authority, null)); /* * Tests the X-OGC namespace, which should be synonymous. */ authority = "URN:X-OGC:DEF"; assertSame(factory, ReferencingFactoryFinder.getCRSAuthorityFactory(authority, null)); assertSame(factory, ReferencingFactoryFinder.getCSAuthorityFactory(authority, null)); assertSame(factory, ReferencingFactoryFinder.getDatumAuthorityFactory(authority, null)); }