/** 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); }
/** * Returns the factories to be used by {@link ManyAuthoritiesFactory}. If the registered * factories changed since the last time this method has been invoked, then this method recreate * the set. */ @Override Collection<AuthorityFactory> getFactories() { final Collection<String> authorities = ReferencingFactoryFinder.getAuthorityNames(); if (authorities != authorityNames) { authorityNames = authorities; final Hints hints = getHints(); final Set<AuthorityFactory> factories = new LinkedHashSet<AuthorityFactory>(); factories.addAll(ReferencingFactoryFinder.getCRSAuthorityFactories(hints)); factories.addAll(ReferencingFactoryFinder.getCSAuthorityFactories(hints)); factories.addAll(ReferencingFactoryFinder.getDatumAuthorityFactories(hints)); factories.addAll( ReferencingFactoryFinder.getCoordinateOperationAuthorityFactories(hints)); setFactories(factories); } return super.getFactories(); }