/** * Provides GeoTools with the JNDI context for resource lookup. * * @param applicationContext The initial context to use. * @see #getInitialContext * @since 2.4 */ public static void init(final InitialContext applicationContext) { synchronized (GeoTools.class) { context = applicationContext; } fireConfigurationChanged(); }
/** * Adds a class loader to be included in the list of class loaders that are used to locate * GeoTools plug-ins. * * <p>Client code that calls this method may also need to call {@link * FactoryRegistry#scanForPlugins()} on any existing registry to force it to clear its cache and * use the added class loader to locate plugins. * * @param classLoader The class loader. */ public static void addClassLoader(ClassLoader classLoader) { addedClassLoaders.add(classLoader); fireConfigurationChanged(); }
/** * Returns the hint {@linkplain GeoTools#getDefaultHints default value} for the specified key. * * @param key The hints key. * @return The value for the specified key, or {@code null} if the key did not have a mapping. * @since 2.4 */ public static Object getSystemDefault(final RenderingHints.Key key) { final boolean changed; final Object value; changed = ensureSystemDefaultLoaded(); value = GLOBAL.get(key); if (changed) { GeoTools.fireConfigurationChanged(); } return value; }
/** * Scans for factory plug-ins on the application class path. This method is needed because the * application class path can theoretically change, or additional plug-ins may become available. * Rather than re-scanning the classpath on every invocation of the API, the class path is * scanned automatically only on the first invocation. Clients can call this method to prompt a * re-scan. Thus this method need only be invoked by sophisticated applications which * dynamically make new plug-ins available at runtime. */ public static void scanForPlugins() { synchronized (ReferencingFactoryFinder.class) { authorityNames = null; if (registry != null) { registry.scanForPlugins(); } } GeoTools.fireConfigurationChanged(); }
/** * Removes the specified hints from the set of {@linkplain GeoTools#getDefaultHints default * hints}. * * @param key The hints key that needs to be removed. * @return The value to which the key had previously been mapped, or {@code null} if the key did * not have a mapping. * @since 2.4 */ public static Object removeSystemDefault(final RenderingHints.Key key) { final boolean changed; final Object old; changed = ensureSystemDefaultLoaded(); old = GLOBAL.remove(key); if (changed || old != null) { GeoTools.fireConfigurationChanged(); } return old; }
/** * Adds all specified hints to the system hints. This is for {@link GeoTools#init} * implementation only. */ static void putSystemDefault(final RenderingHints hints) { ensureSystemDefaultLoaded(); Map<RenderingHints.Key, Object> map = toMap(hints); GLOBAL.putAll(map); GeoTools.fireConfigurationChanged(); }
/** * Adds a hint value to the set of {@linkplain GeoTools#getDefaultHints default hints}. Default * hints can be added by call to this {@code putDefaultHint} method, to the {@link * GeoTools#init} method or by {@linkplain System#getProperties system properties} with keys * defined by the {@link String} constants in the {@link GeoTools} class. * * @param key The hint key. * @param value The hint value. * @return The previous value of the specified key, or {@code null} if none. * @throws IllegalArgumentException If {@link Hints.Key#isCompatibleValue()} returns {@code * false} for the specified value. * @since 2.4 */ public static Object putSystemDefault(final RenderingHints.Key key, final Object value) { final boolean changed; final Object old; changed = ensureSystemDefaultLoaded(); old = GLOBAL.put(key, value); if (changed || !Utilities.equals(value, old)) { GeoTools.fireConfigurationChanged(); } return old; }
/** * Returns a copy of the system hints. This is for {@link GeoTools#getDefaultHints} * implementation only. */ static Hints getDefaults(final boolean strict) { final Hints hints; final boolean changed = ensureSystemDefaultLoaded(); if (strict) { hints = new StrictHints(GLOBAL); } else { hints = new Hints(GLOBAL); } if (changed) { GeoTools.fireConfigurationChanged(); } return hints; }
protected void setUp() throws Exception { // this is the only thing that actually forces CRS object to give up // its configuration, necessary when tests are run by Maven, one JVM for all // the tests in this module Hints.putSystemDefault(Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER, Boolean.TRUE); GeoTools.fireConfigurationChanged(); ft = DataUtilities.createType( "testType", "geom:Point:srid=4326,line:LineString,name:String,id:int"); ff = CommonFactoryFinder.getFilterFactory2(GeoTools.getDefaultHints()); reprojector = new ReprojectingFilterVisitor(ff, ft); }