Search in sources :

Example 1 with ComponentMeta

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;
    }
}
Also used : DataxProcessor(com.qlangtech.tis.datax.impl.DataxProcessor) ComponentMeta(com.qlangtech.tis.plugin.ComponentMeta) IRepositoryResource(com.qlangtech.tis.plugin.IRepositoryResource) ParamsConfig(com.qlangtech.tis.config.ParamsConfig)

Example 2 with ComponentMeta

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;
    }
}
Also used : ComponentMeta(com.qlangtech.tis.plugin.ComponentMeta) IRepositoryResource(com.qlangtech.tis.plugin.IRepositoryResource) KeyedPluginStore(com.qlangtech.tis.plugin.KeyedPluginStore)

Example 3 with ComponentMeta

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");
}
Also used : ComponentMeta(com.qlangtech.tis.plugin.ComponentMeta)

Example 4 with ComponentMeta

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);
}
Also used : ComponentMeta(com.qlangtech.tis.plugin.ComponentMeta) IRepositoryResource(com.qlangtech.tis.plugin.IRepositoryResource) File(java.io.File) XStream2(com.qlangtech.tis.util.XStream2)

Aggregations

ComponentMeta (com.qlangtech.tis.plugin.ComponentMeta)4 IRepositoryResource (com.qlangtech.tis.plugin.IRepositoryResource)3 ParamsConfig (com.qlangtech.tis.config.ParamsConfig)1 DataxProcessor (com.qlangtech.tis.datax.impl.DataxProcessor)1 KeyedPluginStore (com.qlangtech.tis.plugin.KeyedPluginStore)1 XStream2 (com.qlangtech.tis.util.XStream2)1 File (java.io.File)1