/** * Checks each available datasource implementation in turn and returns the first one which * claims to support the resource identified by the params object. * * @param params A Map object which contains a defenition of the resource to connect to. for * file based resources the property 'url' should be set within this Map. * @return The first datasource which claims to process the required resource, returns null if * none can be found. * @throws IOException If a suitable loader can be found, but it can not be attached to the * specified resource without errors. */ public static synchronized DataSource getDataSource(Map params) throws IOException { Iterator ps = getAvailableDataSources(); DataSourceFactorySpi fac; while (ps.hasNext()) { fac = (DataSourceFactorySpi) ps.next(); try { if (fac.canProcess(params)) { return fac.createDataSource(params); } } catch (Throwable t) { /** The logger for the filter module. */ LOGGER.log(Level.WARNING, "Could not acquire " + fac.getDescription() + ":" + t, t); // Protect against DataStores that don't carefully // code canProcess } } return null; }
Iterator ps = getAvailableDataSources(); DataSourceFactorySpi fac; while (ps.hasNext()) {
Iterator ps = getAvailableDataSources(); DataSourceFactorySpi fac; while (ps.hasNext()) {