Search in sources :

Example 1 with DfSchemaXmlReader

use of org.dbflute.logic.jdbc.schemaxml.DfSchemaXmlReader in project dbflute-core by dbflute.

the class DfFreeGenInitializer method setupReservedOption.

// ===================================================================================
// Reserved Option
// ===============
protected void setupReservedOption(String requestName, Map<String, Object> optionMap) {
    @SuppressWarnings("unchecked") final Map<String, Object> databaseMap = (Map<String, Object>) optionMap.get("databaseMap");
    if (databaseMap == null) {
        return;
    }
    for (Entry<String, Object> entry : databaseMap.entrySet()) {
        final String databaseName = entry.getKey();
        @SuppressWarnings("unchecked") final Map<String, Object> settingsMap = (Map<String, Object>) entry.getValue();
        final String schemaDir = (String) settingsMap.get("schemaDir");
        final String schemaXml;
        if (Srl.is_NotNull_and_NotTrimmedEmpty(schemaDir)) {
            schemaXml = schemaDir + "/project-schema-" + databaseName + ".xml";
        } else {
            final String schemaFile = (String) settingsMap.get("schemaFile");
            if (Srl.is_Null_or_TrimmedEmpty(schemaFile)) {
                String msg = "Not found the schemaDir or schemaFile property in the " + databaseName + " for " + requestName;
                throw new DfIllegalPropertySettingException(msg);
            }
            schemaXml = schemaFile;
        }
        final DfSchemaXmlReader reader = DfSchemaXmlReader.createAsFlexibleToManage(schemaXml);
        final Database database = prepareDatabase(reader);
        settingsMap.put("instance", database);
    }
}
Also used : Database(org.apache.torque.engine.database.model.Database) DfSchemaXmlReader(org.dbflute.logic.jdbc.schemaxml.DfSchemaXmlReader) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map) StringKeyMap(org.dbflute.helper.StringKeyMap) DfIllegalPropertySettingException(org.dbflute.exception.DfIllegalPropertySettingException)

Example 2 with DfSchemaXmlReader

use of org.dbflute.logic.jdbc.schemaxml.DfSchemaXmlReader in project dbflute-core by dbflute.

the class DfSql2EntityTask method setupSchemaInformation.

protected void setupSchemaInformation() {
    final DfSchemaXmlReader schemaFileReader = createSchemaFileReader();
    _schemaData = schemaFileReader.read();
}
Also used : DfSchemaXmlReader(org.dbflute.logic.jdbc.schemaxml.DfSchemaXmlReader)

Example 3 with DfSchemaXmlReader

use of org.dbflute.logic.jdbc.schemaxml.DfSchemaXmlReader in project dbflute-core by dbflute.

the class DfAbstractDbMetaTexenTask method initializeSchemaData.

protected void initializeSchemaData() {
    final DfSchemaXmlReader schemaXmlReader = createSchemaXmlReader();
    _schemaData = schemaXmlReader.read();
}
Also used : DfSchemaXmlReader(org.dbflute.logic.jdbc.schemaxml.DfSchemaXmlReader)

Example 4 with DfSchemaXmlReader

use of org.dbflute.logic.jdbc.schemaxml.DfSchemaXmlReader in project dbflute-core by dbflute.

the class DfLReverseProcess method prepareDatabase.

// ===================================================================================
// Prepare
// =======
protected Database prepareDatabase() {
    final String schemaXml = getLoadDataReverseSchemaXml();
    final DfSchemaXmlSerializer serializer = createSchemaXmlSerializer(schemaXml);
    serializer.serialize();
    final DfSchemaXmlReader reader = createSchemaXmlReader(schemaXml);
    final AppData appData = reader.read();
    return appData.getDatabase();
}
Also used : AppData(org.apache.torque.engine.database.model.AppData) DfSchemaXmlSerializer(org.dbflute.logic.jdbc.schemaxml.DfSchemaXmlSerializer) DfSchemaXmlReader(org.dbflute.logic.jdbc.schemaxml.DfSchemaXmlReader)

Example 5 with DfSchemaXmlReader

use of org.dbflute.logic.jdbc.schemaxml.DfSchemaXmlReader in project dbflute-core by dbflute.

the class DfLReverseSchemaMetaProvider method prepareDatabase.

// ===================================================================================
// Prepare
// =======
public Database prepareDatabase() {
    final String schemaXml = getReverseSchemaXml();
    final DfSchemaXmlSerializer serializer = createSchemaXmlSerializer(schemaXml);
    serializer.serialize();
    final DfSchemaXmlReader reader = createSchemaXmlReader(schemaXml);
    final AppData appData = reader.read();
    return appData.getDatabase();
}
Also used : AppData(org.apache.torque.engine.database.model.AppData) DfSchemaXmlSerializer(org.dbflute.logic.jdbc.schemaxml.DfSchemaXmlSerializer) DfSchemaXmlReader(org.dbflute.logic.jdbc.schemaxml.DfSchemaXmlReader)

Aggregations

DfSchemaXmlReader (org.dbflute.logic.jdbc.schemaxml.DfSchemaXmlReader)9 AppData (org.apache.torque.engine.database.model.AppData)3 Database (org.apache.torque.engine.database.model.Database)3 DfSchemaXmlSerializer (org.dbflute.logic.jdbc.schemaxml.DfSchemaXmlSerializer)3 LinkedHashMap (java.util.LinkedHashMap)1 Map (java.util.Map)1 DfIllegalPropertySettingException (org.dbflute.exception.DfIllegalPropertySettingException)1 StringKeyMap (org.dbflute.helper.StringKeyMap)1 DfSPolicyChecker (org.dbflute.logic.doc.spolicy.DfSPolicyChecker)1 DfSPolicyResult (org.dbflute.logic.doc.spolicy.result.DfSPolicyResult)1 DfReplaceSchemaProperties (org.dbflute.properties.DfReplaceSchemaProperties)1 DfSchemaPolicyProperties (org.dbflute.properties.DfSchemaPolicyProperties)1