use of org.dbflute.logic.jdbc.urlanalyzer.factory.DfUrlAnalyzerFactory in project dbflute-core by dbflute.
the class DfReplaceSchemaProperties method getAdditionalDropSchema.
public UnifiedSchema getAdditionalDropSchema(Map<String, Object> additionalDropMap) {
final String url = getAdditionalDropUrl(additionalDropMap);
final String catalog;
if (Srl.is_NotNull_and_NotTrimmedEmpty(url)) {
final DfUrlAnalyzerFactory factory = new DfUrlAnalyzerFactory(getBasicProperties(), url);
final DfUrlAnalyzer analyzer = factory.createAnalyzer();
catalog = analyzer.extractCatalog();
} else {
catalog = getDatabaseProperties().getDatabaseCatalog();
}
final Object obj = additionalDropMap.get("schema");
if (obj == null) {
if (!isDatabaseAsSchemaSpecificationOmittable()) {
String msg = "The schema is required:";
msg = msg + " additionalDropMap=" + additionalDropMap;
throw new DfRequiredPropertyNotFoundException(msg);
}
return null;
}
final String schema = castToString(obj, "additionalDropMapList.schema");
final UnifiedSchema unifiedSchema = UnifiedSchema.createAsDynamicSchema(catalog, schema);
return unifiedSchema;
}
use of org.dbflute.logic.jdbc.urlanalyzer.factory.DfUrlAnalyzerFactory in project dbflute-core by dbflute.
the class DfReplaceSchemaProperties method createAdditionalUserConnection.
public Connection createAdditionalUserConnection(String additonalUser) {
final Map<String, String> propertyMap = getAdditionalUserPropertyMap(additonalUser);
if (propertyMap == null) {
return null;
}
final String title = "replaceSchemaDefinitionMap#additionalUserMap$";
final String driver = getDatabaseProperties().getDatabaseDriver();
final String url;
{
String property = resolveDispatchVariable(title + "url", propertyMap.get("url"));
if (property != null && property.trim().length() > 0) {
url = property;
} else {
url = getDatabaseProperties().getDatabaseUrl();
}
}
final DfUrlAnalyzerFactory factory = new DfUrlAnalyzerFactory(getBasicProperties(), url);
final DfUrlAnalyzer analyzer = factory.createAnalyzer();
final String catalog = analyzer.extractCatalog();
final String schema = propertyMap.get("schema");
final UnifiedSchema unifiedSchema = UnifiedSchema.createAsDynamicSchema(catalog, schema);
final String user = resolveDispatchVariable(title + "user", propertyMap.get("user"));
final String password = resolvePasswordVariable(title + "password", additonalUser, propertyMap.get("password"));
final Properties prop = getDatabaseProperties().getConnectionProperties();
prop.setProperty("user", user);
prop.setProperty("password", password);
_log.info("...Creating a connection for additional user: " + user);
return createConnection(driver, url, unifiedSchema, prop);
}
use of org.dbflute.logic.jdbc.urlanalyzer.factory.DfUrlAnalyzerFactory in project dbflute-core by dbflute.
the class DfDatabaseProperties method extractCatalogFromUrl.
public String extractCatalogFromUrl(String url) {
final DfUrlAnalyzerFactory factory = new DfUrlAnalyzerFactory(getBasicProperties(), url);
final DfUrlAnalyzer analyzer = factory.createAnalyzer();
final String extracted = analyzer.extractCatalog();
return Srl.is_NotNull_and_NotTrimmedEmpty(extracted) ? extracted : null;
}
Aggregations