/** * Returns the service registry. The registry will be created the first * time this method is invoked. */ private static FactoryRegistry getServiceRegistry() { synchronized (Processors.class) { if (registry == null) { registry = new FactoryCreator(ProcessFactory.class); } } return registry; }
final int modifiers = type.getModifiers(); if (!Modifier.isAbstract(modifiers)) { final T candidate = createSafe(category, type, hints); if (candidate == null) { continue; if (isAcceptable(candidate, category, hints, filter)) { cache(category, candidate); return candidate; dispose(candidate); for (final Iterator<T> it=getUnfilteredProviders(category); it.hasNext();) { final T factory = it.next(); final Class<?> implementation = factory.getClass(); if (types!=null && !isTypeOf(types, implementation)) { continue; candidate = createSafe(category, implementation, hints); } catch (FactoryNotFoundException exception) { continue; if (isAcceptable(candidate, category, hints, filter)) { cache(category, candidate); return candidate; dispose(candidate);
/** * Invokes {@link #createServiceProvider}, but checks against recursive calls. If the specified * implementation is already under construction, returns {@code null} in order to tell to * {@link #getServiceProvider} that it need to search for an other implementation. This is * needed for avoiding infinite recursivity when a factory is a wrapper around an ther factory * of the same category. For example this is the case of * {@link org.geotools.referencing.operation.BufferedCoordinateOperationFactory}. */ private Object createSafe(final Class category, final Class implementation, final Hints hints) { if (!underConstruction.add(implementation)) { return null; } try { return createServiceProvider(category, implementation, hints); } finally { if (!underConstruction.remove(implementation)) { throw new AssertionError(); } } }
return super.isAcceptable(provider, category, hints);
final int modifiers = type.getModifiers(); if (!Modifier.isAbstract(modifiers)) { final Object candidate = createSafe(category, type, hints); if (candidate == null) { continue; if (isAcceptable(candidate, category, hints, filter)) { cache(category, candidate); return candidate; dispose(candidate); for (final Iterator it=getUnfilteredProviders(category); it.hasNext();) { final Object factory = it.next(); final Class implementation = factory.getClass(); if (types!=null && !isTypeOf(types, implementation)) { continue; candidate = createSafe(category, implementation, hints); } catch (FactoryRegistryException exception) { if (exception.getCause() instanceof NoSuchMethodException) { if (isAcceptable(candidate, category, hints, filter)) { cache(category, candidate); return candidate; dispose(candidate);
/** * Invokes {@link #createServiceProvider}, but checks against recursive calls. If the specified * implementation is already under construction, returns {@code null} in order to tell to * {@link #getServiceProvider} that it need to search for an other implementation. This is * needed for avoiding infinite recursivity when a factory is a wrapper around an ther factory * of the same category. For example this is the case of * {@link org.geotools.referencing.operation.BufferedCoordinateOperationFactory}. */ private <T> T createSafe(final Class<T> category, final Class<?> implementation, final Hints hints) { if (!underConstruction.add(implementation)) { return null; } try { return createServiceProvider(category, implementation, hints); } finally { if (!underConstruction.remove(implementation)) { throw new AssertionError(); } } }
return super.isAcceptable(provider, category, hints);
/** * Returns the service registry. The registry will be created the first time this method is * invoked. */ private static FactoryRegistry getServiceRegistry() { if (registry == null) { registry = new FactoryCreator(Arrays.asList(new Class<?>[] { DXFWriter.class })); } return registry; } }
/** * Creates a new instance of the specified factory using the specified hints. * * @param category The category to instantiate. * @param implementation The factory class to instantiate. * @param hints The implementation hints. * @return The factory. * @throws FactoryRegistryException if the factory creation failed. */ protected Object createServiceProvider(final Class category, final Class implementation, final Hints hints) throws FactoryRegistryException { if (GeometryFactory.class.isAssignableFrom(category) && GeometryFactory.class.equals(implementation)) { return new GeometryFactory(getPrecisionModel(hints), getSRID(hints), getCoordinateSequenceFactory(hints)); } return super.createServiceProvider(category, implementation, hints); }
/** * Returns the service registry. The registry will be created the first time * this method is invoked. */ private static FactoryRegistry getServiceRegistry() { assert Thread.holdsLock(GridFormatFinder.class); if (registry == null) { registry = new FactoryCreator(Arrays .asList(new Class<?>[] { GridFormatFactorySpi.class })); } return registry; }
/** * Creates a new instance of the specified factory using the specified hints. * * @param category The category to instantiate. * @param implementation The factory class to instantiate. * @param hints The implementation hints. * @return The factory. * @throws FactoryRegistryException if the factory creation failed. */ protected Object createServiceProvider(final Class category, final Class implementation, final Hints hints) throws FactoryRegistryException { if (GeometryFactory.class.isAssignableFrom(category) && GeometryFactory.class.equals(implementation)) { return new GeometryFactory(getPrecisionModel(hints), getSRID(hints), getCoordinateSequenceFactory(hints)); } return super.createServiceProvider(category, implementation, hints); }
/** * Returns the service registry. The registry will be created the first time * this method is invoked. */ private static FactoryRegistry getServiceRegistry() { assert Thread.holdsLock(DataStoreFinder.class); if (registry == null) { registry = new FactoryCreator(Arrays .asList(new Class<?>[] { DataStoreFactorySpi.class })); } return registry; }
/** * Returns the service registry. The registry will be created the first time * this method is invoked. */ private static FactoryRegistry getServiceRegistry() { assert Thread.holdsLock(DataAccessFinder.class); if (registry == null) { registry = new FactoryCreator(Arrays.asList(new Class<?>[] { DataAccessFactory.class })); } return registry; }
/** * Returns the service registry. The registry will be created the first * time this method is invoked. */ private static FactoryRegistry getServiceRegistry() { assert Thread.holdsLock(CoverageFactoryFinder.class); if (registry == null) { registry = new FactoryCreator(Arrays.asList(new Class<?>[] { GridCoverageFactory.class})); } return registry; }
/** * Returns the service registry. The registry will be created the first * time this method is invoked. */ private static FactoryRegistry getServiceRegistry() { assert Thread.holdsLock(Converters.class); if (registry == null) { registry = new FactoryCreator(Arrays.asList(new Class[] { ConverterFactory.class,})); } return registry; }
/** * Returns the service registry. The registry will be created the first time this method is * invoked. */ private static FactoryRegistry getServiceRegistry() { assert Thread.holdsLock(DataSourceFinder.class); if (registry == null) { registry = new FactoryCreator(Arrays.asList(new Class<?>[] { DataSourceFactorySpi.class, UnWrapper.class })); } return registry; }
/** * Returns the service registry. The registry will be created the first time * this method is invoked. */ private static FactoryRegistry getServiceRegistry() { assert Thread.holdsLock(DynamicSymbolFactoryFinder.class); if (registry == null) { registry = new FactoryCreator(Arrays.asList(new Class<?>[] { MarkFactory.class, ExternalGraphicFactory.class })); } return registry; }
/** * Returns the service registry. The registry will be created the first time * this method is invoked. */ private static FactoryRegistry getServiceRegistry() { assert Thread.holdsLock(GridFormatFinder.class); if (registry == null) { registry = new FactoryCreator(Arrays .asList(new Class[] { GridFormatFactorySpi.class })); } return registry; }
/** * Returns the service registry. The registry will be created the first time * this method is invoked. */ private static FactoryRegistry getServiceRegistry() { assert Thread.holdsLock(PropertiesCollectorFinder.class); if (registry == null) { registry = new FactoryCreator(Arrays.asList(new Class<?>[] { PropertiesCollectorSPI.class })); } return registry; }
/** * Returns the service registry. The registry will be created the first time * this method is invoked. */ private static FactoryRegistry getServiceRegistry() { assert Thread.holdsLock(DataStoreFinder.class); if (registry == null) { registry = new FactoryCreator(Arrays .asList(new Class[] { DataStoreFactorySpi.class })); } return registry; }