use of com.qlangtech.tis.plugin.PluginStore in project tis by qlangtech.
the class DataxReader method createDataXReaderKey.
private static TIS.DataXReaderAppKey createDataXReaderKey(IPluginContext pluginContext, boolean db, String appname) {
return new TIS.DataXReaderAppKey(pluginContext, db, appname, new PluginStore.IPluginProcessCallback<DataxReader>() {
@Override
public void afterDeserialize(final DataxReader reader) {
List<PluginFormProperties> subFieldFormPropertyTypes = reader.getDescriptor().getSubPluginFormPropertyTypes();
if (subFieldFormPropertyTypes.size() > 0) {
// 加载子字段
subFieldFormPropertyTypes.forEach((pt) -> {
pt.accept(new PluginFormProperties.IVisitor() {
@Override
public Void visit(final SuFormProperties props) {
SubFieldFormAppKey<DataxReader> subFieldKey = new SubFieldFormAppKey<>(pluginContext, db, appname, props, DataxReader.class);
KeyedPluginStore<DataxReader> subFieldStore = KeyedPluginStore.getPluginStore(subFieldKey);
// 子表单中的内容更新了之后,要同步父表单中的状态
subFieldStore.addPluginsUpdateListener(new PluginStore.PluginsUpdateListener<DataxReader>(subFieldKey.getSerializeFileName(), reader) {
@Override
public void accept(PluginStore<DataxReader> pluginStore) {
setReaderSubFormProp(props, pluginStore.getPlugin());
}
});
DataxReader subFieldReader = subFieldStore.getPlugin();
if (subFieldReader == null) {
return null;
}
setReaderSubFormProp(props, subFieldReader);
return null;
}
private void setReaderSubFormProp(SuFormProperties props, DataxReader subFieldReader) {
setReaderSubFormProp(props, reader, subFieldReader);
}
private void setReaderSubFormProp(SuFormProperties props, DataxReader reader, DataxReader subFieldReader) {
if (reader == null) {
return;
}
try {
props.subFormField.set(reader, props.subFormField.get(subFieldReader));
} catch (IllegalAccessException e) {
throw new RuntimeException("get subField:" + props.getSubFormFieldName(), e);
}
}
});
});
}
}
});
}
use of com.qlangtech.tis.plugin.PluginStore in project plugins by qlangtech.
the class TestHdfsFileSystemFactory method testCreate.
public void testCreate() {
PluginStore pluginStore = TIS.getPluginStore(FileSystemFactory.class);
assertNotNull(pluginStore);
Describable<FileSystemFactory> plugin = pluginStore.getPlugin();
assertNotNull(plugin);
FileSystemFactory fsFactory = (FileSystemFactory) plugin;
ITISFileSystem fileSystem = fsFactory.getFileSystem();
List<IPathInfo> paths = fileSystem.listChildren(fileSystem.getPath("/"));
for (IPathInfo i : paths) {
System.out.println(i.getName());
}
// plugin.
//
// assertTrue("real class:" + plugin.getClass().getName(), plugin instanceof HdfsFileSystemFactory);
// HdfsFileSystemFactory fsFactory = (HdfsFileSystemFactory) plugin;
// ITISFileSystem fileSystem = fsFactory.getFileSystem();
// List<IPathInfo> paths = fileSystem.listChildren(fileSystem.getPath(fsFactory.getRootDir() + "/"));
// for (IPathInfo i : paths) {
// System.out.println(i.getName());
// }
}
Aggregations