/** * Get SQL query for specific database type and version. * * @param dbType Database type * @param dbVersion Database version * @param key Query key * @return SQL query * @throws SQLException */ public String getQuery(String dbType, String dbVersion, String key) throws SQLException { String dbKey = dbType + "_" + dbVersion; Map<String, String> queries = queryMap.get(dbKey); if (queries == null) { try { queries = QueryProvider.mergeMapping(dbType, dbVersion, componentQueries, deploymentQueries); } catch (QueryMappingNotAvailableException e) { throw new SQLException("Cannot find database queries for " + dbType + " " + dbVersion + ".", e); } queryMap.put(dbKey, queries); } String query = queries.get(key); if (query == null) { throw new SQLException("Cannot find query for " + key + " in " + dbType + " " + dbVersion + "."); } return queryMap.get(dbKey).get(key); }
/** * Get SQL query for specific database type and version. * * @param dbType Database type * @param dbVersion Database version * @param key Query key * @return SQL query * @throws SQLException */ public String getQuery(String dbType, String dbVersion, String key) throws SQLException { String dbKey = dbType + "_" + dbVersion; Map<String, String> queries = queryMap.get(dbKey); if (queries == null) { try { queries = QueryProvider.mergeMapping(dbType, dbVersion, componentQueries, deploymentQueries); } catch (QueryMappingNotAvailableException e) { throw new SQLException("Cannot find database queries for " + dbType + " " + dbVersion + ".", e); } queryMap.put(dbKey, queries); } String query = queries.get(key); if (query == null) { throw new SQLException("Cannot find query for " + key + " in " + dbType + " " + dbVersion + "."); } return queryMap.get(dbKey).get(key); }
public static Map<String, String> getQueries(String databaseType, String databaseVersion, List<Queries> deploymentQueries) throws QueryMappingNotAvailableException, IOException { try { List<Queries> componentQueries; URL url = ExternalIdPClientUtil.class.getClassLoader().getResource("queries.yaml"); if (url != null) { IdPClientConfiguration idPClientConfiguration = readYamlContent(url.openStream()); componentQueries = idPClientConfiguration.getQueries(); } else { throw new RuntimeException("Unable to load queries.yaml file."); } return QueryProvider.mergeMapping(databaseType, databaseVersion, componentQueries, deploymentQueries); } catch (QueryMappingNotAvailableException e) { throw new QueryMappingNotAvailableException("Unable to load queries.", e); } catch (IOException e) { throw new IOException("Unable to load content from queries.yaml file.", e); } }
private Map<String, String> readConfigs(String databaseType, String databaseVersion) throws IOException, QueryMappingNotAvailableException { try { StrategyConfig deploymentConfigurations = deploymentConfigProvider.getStrategyConfig(); List<Queries> deploymentQueries = deploymentConfigurations.getQueries(); List<Queries> componentQueries; URL url = this.getClass().getClassLoader().getResource("queries.yaml"); if (url != null) { StrategyConfig componentConfigurations = readYamlContent(url.openStream()); componentQueries = componentConfigurations.getQueries(); } else { throw new ClusterCoordinationException("Unable to load queries.yaml file."); } queries = QueryProvider.mergeMapping(databaseType, databaseVersion, componentQueries, deploymentQueries); } catch (QueryMappingNotAvailableException e) { throw new QueryMappingNotAvailableException("Unable to load queries.", e); } catch (IOException e) { throw new IOException("Unable to load content from queries.yaml file.", e); } return queries; }
private Map<String, String> readConfigs(String databaseType, String databaseVersion) throws ConfigurationException, QueryMappingNotAvailableException, IOException { try { BusinessRulesQueryConfigs deploymentConfigurations = deploymentConfigProvider .getConfigurationObject(BusinessRulesQueryConfigs.class); List<Queries> deploymentQueries = deploymentConfigurations.getQueries(); List<Queries> componentQueries; URL url = this.getClass().getClassLoader().getResource("queries.yaml"); if (url != null) { BusinessRulesQueryConfigs componentConfigurations = readYamlContent(url.openStream()); componentQueries = componentConfigurations.getQueries(); } else { throw new RuntimeException("Unable to load queries.yaml file."); } queries = QueryProvider.mergeMapping(databaseType, databaseVersion, (ArrayList<Queries>) componentQueries, (ArrayList<Queries>) deploymentQueries); } catch (ConfigurationException e) { throw new ConfigurationException("Unable to read queries.yaml configurations: " + e.getMessage(), e); } catch (QueryMappingNotAvailableException e) { throw new QueryMappingNotAvailableException("Unable to load queries.", e); } catch (IOException e) { throw new IOException("Unable to load content from queries.yaml file.", e); } return queries; }
private Map<String, String> readConfigs(String databaseType, String databaseVersion) throws ConfigurationException, QueryMappingNotAvailableException, IOException { try { PersistenceStoreConfigs deploymentConfigurations = deploymentConfigProvider .getConfigurationObject(PersistenceStoreConfigs.class); List<Queries> deploymentQueries = deploymentConfigurations.getQueries(); List<Queries> componentQueries; URL url = this.getClass().getClassLoader().getResource("queries.yaml"); if (url != null) { PersistenceStoreConfigs componentConfigurations = readYamlContent(url.openStream()); componentQueries = componentConfigurations.getQueries(); } else { throw new ConfigurationException("Unable to load queries.yaml file."); } queries = QueryProvider.mergeMapping(databaseType, databaseVersion, (ArrayList<Queries>) componentQueries, (ArrayList<Queries>) deploymentQueries); } catch (ConfigurationException e) { throw new ConfigurationException("Unable to read queries.yaml configurations: " + e.getMessage(), e); } catch (QueryMappingNotAvailableException e) { throw new QueryMappingNotAvailableException("Unable to load queries.", e); } catch (IOException e) { throw new IOException("Unable to load content from queries.yaml file.", e); } return queries; }
private Map<String, String> readConfigs(String databaseType, String databaseVersion) throws ConfigurationException, QueryMappingNotAvailableException, IOException { try { RDBMSDataProviderConfBean deploymentConfigurations = getDataProviderHelper().getConfigProvider() .getConfigurationObject(RDBMSDataProviderConfBean.class); ArrayList<Queries> deploymentQueries = deploymentConfigurations.getQueries(); ArrayList<Queries> componentQueries; URL url = this.getClass().getClassLoader().getResource("queries.yaml"); if (url != null) { RDBMSDataProviderConfBean componentConfigurations = readYamlContent(url.openStream()); componentQueries = componentConfigurations.getQueries(); } else { throw new RuntimeException("Unable to load queries.yaml file."); } queries = QueryProvider.mergeMapping(databaseType, databaseVersion, componentQueries, deploymentQueries); } catch (ConfigurationException e) { throw new ConfigurationException("Unable to read queries.yaml configurations: " + e.getMessage(), e); } catch (QueryMappingNotAvailableException e) { throw new QueryMappingNotAvailableException("Unable to load queries: " + e.getMessage(), e); } catch (IOException e) { throw new IOException("Unable to load content from queries.yaml file: " + e.getMessage(), e); } return queries; }
try { conn = this.datasource.getConnection(); queries = QueryProvider.mergeMapping(conn.getMetaData().getDatabaseProductName(), conn.getMetaData().getDatabaseProductVersion(), componentQueries, deploymentQueries); } catch (QueryMappingNotAvailableException e) {