/** * Returns the list of data store providers available at this method invocation time. * More providers may be added later if new modules are added on the classpath. * * @return descriptions of available data stores. * * @since 0.8 */ public Set<DataStoreProvider> providers() { synchronized (loader) { final Iterator<DataStoreProvider> providers = loader.iterator(); return new LazySet<>(new Iterator<DataStoreProvider>() { @Override public boolean hasNext() { synchronized (loader) { return providers.hasNext(); } } @Override public DataStoreProvider next() { synchronized (loader) { return providers.next(); } } }); } }
/** * Returns the list of data store providers available at this method invocation time. * More providers may be added later if new modules are added on the classpath. * * @return descriptions of available data stores. * * @since 0.8 */ public Collection<DataStoreProvider> providers() { synchronized (loader) { final Iterator<DataStoreProvider> providers = loader.iterator(); return new LazySet<>(new Iterator<DataStoreProvider>() { @Override public boolean hasNext() { synchronized (loader) { return providers.hasNext(); } } @Override public DataStoreProvider next() { synchronized (loader) { return providers.next(); } } @Override public void remove() { throw new UnsupportedOperationException(); } }); } }
/** * Returns all known factories specialized in the creation of coordinate operations between some particular * pairs of CRS. */ final SpecializedOperationFactory[] getSpecializedFactories() { SpecializedOperationFactory[] factories = specializedFactories; if (factories == null) { final LazySet<SpecializedOperationFactory> set = new LazySet<>(ServiceLoader.load(SpecializedOperationFactory.class).iterator()); specializedFactories = factories = set.toArray(new SpecializedOperationFactory[set.size()]); } return factories; }
/** * Returns all known factories specialized in the creation of coordinate operations between some particular * pairs of CRS. */ final SpecializedOperationFactory[] getSpecializedFactories() { SpecializedOperationFactory[] factories = specializedFactories; if (factories == null) { final LazySet<SpecializedOperationFactory> set = new LazySet<>(ServiceLoader.load(SpecializedOperationFactory.class).iterator()); specializedFactories = factories = set.toArray(new SpecializedOperationFactory[set.size()]); } return factories; }
/** * Creates the set to use for testing purpose. */ private static LazySet<String> create() { return new LazySet<>(Arrays.asList(LABELS).iterator()); }
/** * Returns some map projection methods supported by {@literal Proj.4}. * Current implementation can not return the complete list of Proj.4 method, but returns the main ones. * For each operation method in the returned set, the Proj.4 projection name can be obtained as below: * * {@preformat java * String proj = IdentifiedObjects.getName(method, Citations.PROJ4); * } * * The {@code proj} names obtained as above can be given in argument to the * {@link #getOperationMethod(String)} and {@link #getDefaultParameters(String)} methods. * * @param type <code>{@linkplain SingleOperation}.class</code> for fetching all operation methods, or * <code>{@linkplain Projection}.class</code> for fetching only map projection methods. * @return methods available in this factory for coordinate operations of the given type. * * @see org.apache.sis.referencing.operation.transform.DefaultMathTransformFactory#getAvailableMethods(Class) */ public Set<OperationMethod> getAvailableMethods(final Class<? extends SingleOperation> type) { return new LazySet<>(CollectionsExt.filter(mtFactory.getAvailableMethods(type).iterator(), Proj4Factory::isSupported)); }
/** * Returns some map projection methods supported by {@literal Proj.4}. * Current implementation can not return the complete list of Proj.4 method, but returns the main ones. * For each operation method in the returned set, the Proj.4 projection name can be obtained as below: * * {@preformat java * String proj = IdentifiedObjects.getName(method, Citations.PROJ4); * } * * The {@code proj} names obtained as above can be given in argument to the * {@link #getOperationMethod(String)} and {@link #getDefaultParameters(String)} methods. * * @param type <code>{@linkplain SingleOperation}.class</code> for fetching all operation methods, or * <code>{@linkplain Projection}.class</code> for fetching only map projection methods. * @return methods available in this factory for coordinate operations of the given type. * * @see org.apache.sis.referencing.operation.transform.DefaultMathTransformFactory#getAvailableMethods(Class) */ public Set<OperationMethod> getAvailableMethods(final Class<? extends SingleOperation> type) { return new LazySet<>(CollectionsExt.filter(mtFactory.getAvailableMethods(type).iterator(), new Predicate<IdentifiedObject>() { @Override public boolean test(final IdentifiedObject method) { return isSupported(method); } })); }
LazySet<DummyFactory> c; c = new LazySet<>(registry.getServiceProviders(DummyFactory.class, null, hints, key)); assertTrue(c.contains(factory1)); assertTrue(c.contains(factory2)); c = new LazySet<>(registry.getServiceProviders(DummyFactory.class, null, hints, key)); assertTrue(c.contains(factory1)); assertTrue(c.contains(factory2)); c = new LazySet<>(registry.getServiceProviders(DummyFactory.class, null, hints, key)); assertFalse(c.contains(factory1)); assertTrue (c.contains(factory2)); c = new LazySet<>(registry.getServiceProviders(DummyFactory.class, null, hints, key)); assertTrue (c.contains(factory1)); assertTrue (c.contains(factory2)); c = new LazySet<>(registry.getServiceProviders(DummyFactory.class, null, hints, key)); assertFalse(c.contains(factory1)); assertFalse(c.contains(factory2));