Search in sources :

Example 6 with XmlFile

use of com.qlangtech.tis.extension.impl.XmlFile in project tis by qlangtech.

the class Plugin method save.

/**
 * Saves serializable fields of this instance to the persisted storage.
 *
 * @since 1.245
 */
public void save() throws IOException {
    // if(BulkChange.contains(this))   return;
    XmlFile config = getConfigXml();
    config.write(this, Collections.emptySet());
// SaveableListener.fireOnChange(this, config);
}
Also used : XmlFile(com.qlangtech.tis.extension.impl.XmlFile)

Example 7 with XmlFile

use of com.qlangtech.tis.extension.impl.XmlFile in project tis by qlangtech.

the class DataSourceFactoryPluginStore method loadTableMeta.

public TISTable loadTableMeta(String tableName) {
    try {
        TISTable tisTable = new TISTable();
        XmlFile tableReflectSerializer = this.getTableReflectSerializer(tableName);
        if (!tableReflectSerializer.exists()) {
            throw new IllegalStateException("file is not exist:" + tableReflectSerializer.getFile());
        }
        TableReflect tableMeta = (TableReflect) tableReflectSerializer.read();
        tisTable.setReflectCols(tableMeta.getCols());
        tisTable.setSelectSql(tableMeta.getSql());
        tisTable.setTableName(tableName);
        tisTable.setDbName(this.key.keyVal.getVal());
        return tisTable;
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
}
Also used : XmlFile(com.qlangtech.tis.extension.impl.XmlFile) IOException(java.io.IOException)

Example 8 with XmlFile

use of com.qlangtech.tis.extension.impl.XmlFile in project tis by qlangtech.

the class DataSourceFactoryPluginStore method saveTable.

private TableReflect saveTable(String tableName, List<ColumnMetaData> colMetas) throws Exception {
    if (CollectionUtils.isEmpty(colMetas)) {
        throw new IllegalStateException("tableName:" + tableName + " relevant colMetas can not be empty");
    }
    StringBuffer extractSQL = ColumnMetaData.buildExtractSQL(tableName, colMetas);
    XmlFile configFile = getTableReflectSerializer(tableName);
    TableReflect reflectTab = new TableReflect();
    reflectTab.setSql(extractSQL.toString());
    reflectTab.setCols(colMetas);
    configFile.write(reflectTab, Collections.emptySet());
    return reflectTab;
}
Also used : XmlFile(com.qlangtech.tis.extension.impl.XmlFile)

Example 9 with XmlFile

use of com.qlangtech.tis.extension.impl.XmlFile in project tis by qlangtech.

the class ComponentMeta method loadPluginMeta.

/**
 * 取得元数据信息
 *
 * @return
 */
public Set<XStream2.PluginMeta> loadPluginMeta() {
    synchronized (RobustReflectionConverter.usedPluginInfo) {
        RobustReflectionConverter.usedPluginInfo.remove();
        XStream2PluginInfoReader reader = new XStream2PluginInfoReader(XmlFile.DEFAULT_DRIVER);
        for (IRepositoryResource res : this.resources) {
            File targetFile = res.getTargetFile();
            if (!targetFile.exists()) {
                // throw new IllegalStateException("file:" + targetFile.getAbsolutePath() + " is not exist");
                continue;
            }
            try {
                XmlFile xmlFile = new XmlFile(reader, targetFile);
                xmlFile.read();
            } catch (IOException e) {
                throw new RuntimeException(targetFile.getAbsolutePath(), e);
            }
        }
        return RobustReflectionConverter.usedPluginInfo.get();
    }
}
Also used : XmlFile(com.qlangtech.tis.extension.impl.XmlFile) IOException(java.io.IOException) XStream2PluginInfoReader(com.qlangtech.tis.util.XStream2PluginInfoReader) XmlFile(com.qlangtech.tis.extension.impl.XmlFile) File(java.io.File)

Aggregations

XmlFile (com.qlangtech.tis.extension.impl.XmlFile)9 IOException (java.io.IOException)7 File (java.io.File)4 GlobalComponent (com.qlangtech.tis.component.GlobalComponent)1 IDataxProcessor (com.qlangtech.tis.datax.IDataxProcessor)1 KeyedPluginStore (com.qlangtech.tis.plugin.KeyedPluginStore)1 XStream2PluginInfoReader (com.qlangtech.tis.util.XStream2PluginInfoReader)1 Map (java.util.Map)1