use of com.qlangtech.tis.manage.spring.aop.Func in project tis by qlangtech.
the class DataxAction method doCreateDatax.
/**
* 创建DataX实例
*
* @param context
*/
@Func(value = PermissionConstant.DATAX_MANAGE)
public void doCreateDatax(Context context) throws Exception {
String dataxName = this.getString(PARAM_KEY_DATAX_NAME);
DataxProcessor dataxProcessor = IAppSource.load(null, dataxName);
Application app = dataxProcessor.buildApp();
SchemaAction.CreateAppResult createAppResult = this.createNewApp(context, app, false, (newAppId) -> {
SchemaAction.CreateAppResult appResult = new SchemaAction.CreateAppResult();
appResult.setSuccess(true);
appResult.setNewAppId(newAppId);
return appResult;
});
}
use of com.qlangtech.tis.manage.spring.aop.Func in project tis by qlangtech.
the class DataxAction method doGetTableMapper.
/**
* 取得表映射
*
* @param context
*/
@Func(value = PermissionConstant.DATAX_MANAGE, sideEffect = false)
public void doGetTableMapper(Context context) {
String dataxName = this.getString(PARAM_KEY_DATAX_NAME);
KeyedPluginStore<DataxReader> readerStore = DataxReader.getPluginStore(this, dataxName);
DataxReader dataxReader = readerStore.getPlugin();
Objects.requireNonNull(dataxReader, "dataReader:" + dataxName + " relevant instance can not be null");
IDataxProcessor.TableAlias tableAlias;
Optional<DataxProcessor> dataXAppSource = IAppSource.loadNullable(this, dataxName);
Map<String, IDataxProcessor.TableAlias> tabMaps = Collections.emptyMap();
if (dataXAppSource.isPresent()) {
DataxProcessor dataxSource = dataXAppSource.get();
tabMaps = dataxSource.getTabAlias();
}
if (!dataxReader.hasMulitTable()) {
throw new IllegalStateException("reader has not set table at least");
}
List<IDataxProcessor.TableAlias> tmapList = Lists.newArrayList();
for (ISelectedTab selectedTab : dataxReader.getSelectedTabs()) {
tableAlias = tabMaps.get(selectedTab.getName());
if (tableAlias == null) {
tmapList.add(new IDataxProcessor.TableAlias(selectedTab.getName()));
} else {
tmapList.add(tableAlias);
}
}
this.setBizResult(context, tmapList);
}
use of com.qlangtech.tis.manage.spring.aop.Func in project tis by qlangtech.
the class FullbuildWorkflowAction method doFeedbackAsynTaskStatus.
/**
* 接收异步执行任务执行状态
*
* @param context
*/
@Func(value = PermissionConstant.DATAFLOW_MANAGE, sideEffect = false)
public void doFeedbackAsynTaskStatus(Context context) {
Integer taskid = this.getInt(IParamContext.KEY_TASK_ID);
String jobName = this.getString(IParamContext.KEY_ASYN_JOB_NAME);
boolean execSuccess = this.getBoolean(IParamContext.KEY_ASYN_JOB_SUCCESS);
this.updateAsynTaskState(taskid, jobName, execSuccess, 0);
this.setBizResult(context, new CreateNewTaskResult(taskid, null));
}
use of com.qlangtech.tis.manage.spring.aop.Func in project tis by qlangtech.
the class StreamScriptRepo method execute.
@Override
@Func(value = PermissionConstant.PERMISSION_PLUGIN_GET_CONFIG, sideEffect = false)
public void execute(Context context) throws Exception {
File rootDir = Config.getDataDir();
String path = this.getString("path");
if (StringUtils.isEmpty(path)) {
throw new IllegalArgumentException("illegal argument 'path'");
}
HttpServletResponse response = (HttpServletResponse) DefaultFilter.getRespone();
File targetFile = new File(rootDir, path);
if (!targetFile.exists()) {
// throw new IllegalStateException("target file not exist:" + targetFile.getAbsolutePath());
response.addHeader(ConfigFileContext.KEY_HEAD_FILE_NOT_EXIST, String.valueOf(Boolean.TRUE.booleanValue()));
return;
}
boolean getMeta = Boolean.parseBoolean(this.getRequest().getHeader(ConfigFileContext.StreamProcess.HEADER_KEY_GET_FILE_META));
logger.info("path:{},getChildren:{},local file exist:{},getMeta:{}", path, !targetFile.isFile(), targetFile.exists(), getMeta);
if (targetFile.isFile()) {
// 是否取文件meta信息
response = HdfsAction.getDownloadResponse(targetFile, !getMeta);
if (!getMeta) {
try (InputStream input = FileUtils.openInputStream(targetFile)) {
IOUtils.copyLarge(input, response.getOutputStream());
}
}
} else {
response.addHeader(ConfigFileContext.KEY_HEAD_FILE_DOWNLOAD, String.valueOf(false));
List<String> subs = new ArrayList<>();
File sub = null;
for (String d : targetFile.list((d, fn) -> !StringUtils.endsWith(fn, CenterResource.KEY_LAST_MODIFIED_EXTENDION))) {
sub = new File(targetFile, d);
subs.add(d + ":" + (sub.isDirectory() ? "d" : "f"));
}
response.addHeader(ConfigFileContext.KEY_HEAD_FILES, subs.stream().collect(Collectors.joining(",")));
// this.setBizResult(context, targetFile.list());
}
}
use of com.qlangtech.tis.manage.spring.aop.Func in project tis by qlangtech.
the class CoreAction method doIncrDelete.
/**
* 删除增量通道
*
* @param context
* @throws Exception
*/
@Func(value = PermissionConstant.PERMISSION_INCR_PROCESS_MANAGE)
public void doIncrDelete(Context context) throws Exception {
IndexStreamCodeGenerator indexStreamCodeGenerator = getIndexStreamCodeGenerator(this);
indexStreamCodeGenerator.deleteScript();
TISK8sDelegate k8sDelegate = TISK8sDelegate.getK8SDelegate(this.getCollectionName());
// 删除增量实例
k8sDelegate.removeIncrProcess();
}
Aggregations