use of com.qlangtech.tis.plugin.ComponentMeta in project tis by qlangtech.
the class DataxExecutor method synchronizeDataXPluginsFromRemoteRepository.
public static void synchronizeDataXPluginsFromRemoteRepository(String dataxName, String jobName) {
if (CenterResource.notFetchFromCenterRepository()) {
return;
}
TIS.permitInitialize = false;
try {
if (StringUtils.isBlank(dataxName)) {
throw new IllegalArgumentException("param dataXName can not be null");
}
if (StringUtils.isBlank(jobName)) {
throw new IllegalArgumentException("param jobName can not be null");
}
KeyedPluginStore<DataxProcessor> processStore = IAppSource.getPluginStore(null, dataxName);
// Lists.newArrayList(DataxReader.getPluginStore(dataxName), DataxWriter.getPluginStore(dataxName));
List<IRepositoryResource> keyedPluginStores = Lists.newArrayList();
keyedPluginStores.add(TIS.getPluginStore(ParamsConfig.class));
// keyedPluginStores.add(TIS.getPluginStore(FileSystemFactory.class));
keyedPluginStores.add(processStore);
keyedPluginStores.add(DataxReader.getPluginStore(null, dataxName));
keyedPluginStores.add(DataxWriter.getPluginStore(null, dataxName));
ComponentMeta dataxComponentMeta = new ComponentMeta(keyedPluginStores);
dataxComponentMeta.synchronizePluginsFromRemoteRepository();
CenterResource.copyFromRemote2Local(TIS.KEY_TIS_PLUGIN_CONFIG + "/" + processStore.key.getSubDirPath() + "/" + DataxProcessor.DATAX_CFG_DIR_NAME + "/" + jobName, true);
CenterResource.synchronizeSubFiles(TIS.KEY_TIS_PLUGIN_CONFIG + "/" + processStore.key.getSubDirPath() + "/" + DataxProcessor.DATAX_CREATE_DDL_DIR_NAME);
} finally {
TIS.permitInitialize = true;
}
}
use of com.qlangtech.tis.plugin.ComponentMeta in project plugins by qlangtech.
the class TISFlinClassLoaderFactory method synchronizeIncrPluginsFromRemoteRepository.
public static void synchronizeIncrPluginsFromRemoteRepository(String appName) {
if (CenterResource.notFetchFromCenterRepository()) {
return;
}
TIS.permitInitialize = false;
try {
if (StringUtils.isBlank(appName)) {
throw new IllegalArgumentException("param appName can not be null");
}
List<IRepositoryResource> keyedPluginStores = Lists.newArrayList();
keyedPluginStores.add(new KeyedPluginStore(new KeyedPluginStore.AppKey(null, false, appName, MQListenerFactory.class)));
keyedPluginStores.add(new KeyedPluginStore(new KeyedPluginStore.AppKey(null, false, appName, IncrStreamFactory.class)));
keyedPluginStores.add(new KeyedPluginStore(new KeyedPluginStore.AppKey(null, false, appName, TISSinkFactory.class)));
// keyedPluginStores.add(DataxWriter.getPluginStore(null, dataxName));
ComponentMeta dataxComponentMeta = new ComponentMeta(keyedPluginStores);
dataxComponentMeta.synchronizePluginsFromRemoteRepository();
} finally {
TIS.permitInitialize = true;
}
}
use of com.qlangtech.tis.plugin.ComponentMeta in project tis by qlangtech.
the class TisServlet method init.
@Override
public void init(ServletConfig config) throws ServletException {
super.init(config);
this.indexSwapTaskflowLauncher = IndexSwapTaskflowLauncher.getIndexSwapTaskflowLauncher(config.getServletContext());
ComponentMeta assembleComponent = TIS.getAssembleComponent();
assembleComponent.synchronizePluginsFromRemoteRepository();
logger.info("synchronize Plugins FromRemoteRepository success");
}
use of com.qlangtech.tis.plugin.ComponentMeta in project tis by qlangtech.
the class TestXmlFile method testMashall.
// public void testArrayPropSave() throws Exception {
// File testFile = new File("/tmp/test_file.xml");
// XmlFile xmlFile = new XmlFile(testFile);
// TestObject tstObject = new TestObject();
// tstObject.setCols(Collections.singletonList("hello"));
// xmlFile.write(tstObject, Collections.emptySet());
// }
/**
* 测试序列化
*/
public void testMashall() throws Exception {
File testFile = new File("/tmp/test_file.xml");
XmlFile xmlFile = new XmlFile(testFile);
List<TestBean> plugins = Lists.newArrayList();
plugins.add(new TestBean("baisui"));
plugins.add(new TestBean("dabao"));
plugins.add(new TestBean("xiaobao"));
Set<XStream2.PluginMeta> pluginsMeta = Sets.newHashSet();
pluginsMeta.addAll(XStream2.PluginMeta.parse("test1@1.1"));
pluginsMeta.addAll(XStream2.PluginMeta.parse("mock2@1.2"));
xmlFile.write(plugins, pluginsMeta);
List<IRepositoryResource> resources = Lists.newArrayList();
resources.add(new FileRepositoryResource(testFile));
ComponentMeta componentMeta = new ComponentMeta(resources);
Set<XStream2.PluginMeta> pluginMetaSet = componentMeta.loadPluginMeta();
assertEquals(2, pluginMetaSet.size());
for (XStream2.PluginMeta pm : pluginsMeta) {
assertTrue(pm.toString(), pluginMetaSet.contains(pm));
}
FileUtils.deleteQuietly(testFile);
}
Aggregations