Search in sources :

Example 1 with DfUrlAnalyzer

use of org.dbflute.logic.jdbc.urlanalyzer.DfUrlAnalyzer 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;
}
Also used : DfUrlAnalyzer(org.dbflute.logic.jdbc.urlanalyzer.DfUrlAnalyzer) DfRequiredPropertyNotFoundException(org.dbflute.exception.DfRequiredPropertyNotFoundException) UnifiedSchema(org.apache.torque.engine.database.model.UnifiedSchema) DfUrlAnalyzerFactory(org.dbflute.logic.jdbc.urlanalyzer.factory.DfUrlAnalyzerFactory)

Example 2 with DfUrlAnalyzer

use of org.dbflute.logic.jdbc.urlanalyzer.DfUrlAnalyzer in project dbflute-core by dbflute.

the class DfUrlAnalyzerDerbyTest method test_extractCatalog_nopath.

public void test_extractCatalog_nopath() throws Exception {
    // ## Arrange ##
    DfUrlAnalyzer analyzer = createTarget("jdbc:derby:exampledb;create=true");
    // ## Act ##
    String catalog = analyzer.extractCatalog();
    // ## Assert ##
    assertEquals("exampledb", catalog);
}
Also used : DfUrlAnalyzer(org.dbflute.logic.jdbc.urlanalyzer.DfUrlAnalyzer)

Example 3 with DfUrlAnalyzer

use of org.dbflute.logic.jdbc.urlanalyzer.DfUrlAnalyzer in project dbflute-core by dbflute.

the class DfUrlAnalyzerDerbyTest method test_extractCatalog_basic.

public void test_extractCatalog_basic() throws Exception {
    // ## Arrange ##
    DfUrlAnalyzer analyzer = createTarget("jdbc:derby:../src/main/resources/exampledb;create=true");
    // ## Act ##
    String catalog = analyzer.extractCatalog();
    // ## Assert ##
    assertEquals("exampledb", catalog);
}
Also used : DfUrlAnalyzer(org.dbflute.logic.jdbc.urlanalyzer.DfUrlAnalyzer)

Example 4 with DfUrlAnalyzer

use of org.dbflute.logic.jdbc.urlanalyzer.DfUrlAnalyzer in project dbflute-core by dbflute.

the class DfUrlAnalyzerDB2Test method test_extractCatalog_option.

public void test_extractCatalog_option() throws Exception {
    // ## Arrange ##
    DfUrlAnalyzer analyzer = createTarget("jdbc:db2://localhost:50000/exampledb?charSet=UTF-8");
    // ## Act ##
    String catalog = analyzer.extractCatalog();
    // ## Assert ##
    assertEquals("exampledb", catalog);
}
Also used : DfUrlAnalyzer(org.dbflute.logic.jdbc.urlanalyzer.DfUrlAnalyzer)

Example 5 with DfUrlAnalyzer

use of org.dbflute.logic.jdbc.urlanalyzer.DfUrlAnalyzer in project dbflute-core by dbflute.

the class DfUrlAnalyzerDB2Test method test_extractCatalog_basic.

public void test_extractCatalog_basic() throws Exception {
    // ## Arrange ##
    DfUrlAnalyzer analyzer = createTarget("jdbc:db2://localhost:50000/exampledb");
    // ## Act ##
    String catalog = analyzer.extractCatalog();
    // ## Assert ##
    assertEquals("exampledb", catalog);
}
Also used : DfUrlAnalyzer(org.dbflute.logic.jdbc.urlanalyzer.DfUrlAnalyzer)

Aggregations

DfUrlAnalyzer (org.dbflute.logic.jdbc.urlanalyzer.DfUrlAnalyzer)33 DfUrlAnalyzerFactory (org.dbflute.logic.jdbc.urlanalyzer.factory.DfUrlAnalyzerFactory)3 UnifiedSchema (org.apache.torque.engine.database.model.UnifiedSchema)2 Properties (java.util.Properties)1 DfRequiredPropertyNotFoundException (org.dbflute.exception.DfRequiredPropertyNotFoundException)1 DfConnectionProperties (org.dbflute.properties.assistant.database.DfConnectionProperties)1