/** @deprecated Replaced wtih {@link #deregisterFactory(Object)} */ @Deprecated public void registerServiceProvider(final Object provider) { registerFactory(provider); }
/** @deprecated Replaced with {@link #registerFactory(Object, Class)} */ @Deprecated public <T> boolean registerServiceProvider(final T provider, final Class<T> category) { return registerFactory(provider, category); } /**
/** * Dynamically register a new process factory into SPI * * @param factory */ public static void addProcessFactory(ProcessFactory factory) { getServiceRegistry().registerFactory(factory); }
/** * Returns the service registry. The registry will be created the first time this method is * invoked. */ private static FactoryRegistry getServiceRegistry() { assert Thread.holdsLock(JTSFactoryFinder.class); if (registry == null) { registry = new FactoryCreator(Arrays.asList(new Class<?>[] {GeometryFactory.class})); registry.registerFactory(new GeometryFactory(), GeometryFactory.class); } return registry; }
/** * Programmatic management of authority factories. Needed for user managed, not plug-in managed, * authority factory. Also useful for test cases. * * @param authority The authority factory to add. */ public static synchronized void addAuthorityFactory(final AuthorityFactory authority) { if (registry == null) { scanForPlugins(); } getServiceRegistry().registerFactory(authority); authorityNames = null; }
if (registerFactory(factory, category)) {
try { factory = factoryClass.newInstance(); if (registerFactory(factory, category)) { message.append(System.getProperty("line.separator", "\n")); message.append(" ");
/** * Creates an instance from the specified hints. This method recognizes the {@link * Hints#CRS_FACTORY CRS}, {@link Hints#CS_FACTORY CS}, {@link Hints#DATUM_FACTORY DATUM} and * {@link Hints#MATH_TRANSFORM_FACTORY MATH_TRANSFORM} {@code FACTORY} hints. * * @param hints The hints, or {@code null} if none. * @return A factory group created from the specified set of hints. */ public static ReferencingFactoryContainer instance(final Hints hints) { final Hints completed = GeoTools.getDefaultHints(); if (hints != null) { completed.add(hints); } /* * Use the same synchronization lock than ReferencingFactoryFinder (instead of this class) * in order to reduce the risk of dead lock. This is because ReferencingFactoryContainer * creation may queries ReferencingFactoryFinder, and some implementations managed by * ReferencingFactoryFinder may ask for a ReferencingFactoryContainer in turn. */ synchronized (ReferencingFactoryFinder.class) { if (cache == null) { cache = new FactoryCreator( Arrays.asList(new Class<?>[] {ReferencingFactoryContainer.class})); cache.registerFactory( new ReferencingFactoryContainer(null), ReferencingFactoryContainer.class); } return cache.getFactory(ReferencingFactoryContainer.class, null, completed, null); } }