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);
}
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);
}
}
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;
}
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();
}
}
Aggregations