use of com.dtstack.taier.pluginapi.exception.PluginDefineException in project Taier by DTStack.
the class PrepareOperator method parseJarFile.
public static JarFileInfo parseJarFile(String sql) {
Matcher matcher = jarFilePattern.matcher(sql);
if (!matcher.find()) {
throw new PluginDefineException("not a addJar operator:" + sql);
}
JarFileInfo jarFileInfo = new JarFileInfo();
jarFileInfo.setJarPath(matcher.group(1));
if (matcher.groupCount() == 3) {
jarFileInfo.setMainClass(matcher.group(3));
}
return jarFileInfo;
}
use of com.dtstack.taier.pluginapi.exception.PluginDefineException in project Taier by DTStack.
the class PrepareOperator method getResourceFileName.
public static String getResourceFileName(String sql) {
Matcher matcher = resourceFilePattern.matcher(sql);
if (!matcher.find()) {
throw new PluginDefineException("Get Resource File Name Error: " + sql);
}
String fileName = matcher.group(3);
if (StringUtils.isBlank(fileName)) {
fileName = getResourceFile(sql).getName();
}
return fileName;
}
use of com.dtstack.taier.pluginapi.exception.PluginDefineException in project Taier by DTStack.
the class SqlPluginInfo method getCoreJarFileName.
private String getCoreJarFileName() {
String coreJarFileName = null;
File pluginDir = new File(localSqlPluginDir);
if (pluginDir.exists() && pluginDir.isDirectory()) {
File[] jarFiles = pluginDir.listFiles(new FilenameFilter() {
@Override
public boolean accept(File dir, String name) {
return name.toLowerCase().startsWith(ConfigConstrant.FLINKSQl_CORE_JAR_PREFIX) && name.toLowerCase().endsWith(".jar");
}
});
if (jarFiles != null && jarFiles.length > 0) {
coreJarFileName = jarFiles[0].getName();
}
}
if (StringUtils.isEmpty(coreJarFileName)) {
throw new PluginDefineException("Can not find core jar file in sqlPlugin path: " + localSqlPluginDir);
}
return coreJarFileName;
}
use of com.dtstack.taier.pluginapi.exception.PluginDefineException in project Taier by DTStack.
the class SyncPluginInfo method getCoreJarFileName.
private String getCoreJarFileName() {
String coreJarFileName = null;
File pluginDir = new File(localSyncPluginDir);
if (pluginDir.exists() && pluginDir.isDirectory()) {
File[] jarFiles = pluginDir.listFiles(new FilenameFilter() {
@Override
public boolean accept(File dir, String name) {
return name.toLowerCase().startsWith(ConfigConstrant.FLINKX_CORE_JAR_PREFIX) && name.toLowerCase().endsWith(".jar");
}
});
if (jarFiles != null && jarFiles.length > 0) {
coreJarFileName = jarFiles[0].getName();
}
}
if (StringUtils.isEmpty(coreJarFileName)) {
throw new PluginDefineException("Can not find core jar file in syncPlugin path: " + localSyncPluginDir);
}
return coreJarFileName;
}
use of com.dtstack.taier.pluginapi.exception.PluginDefineException in project Taier by DTStack.
the class FileUtil method readStreamFromFile.
public static InputStream readStreamFromFile(String filePath, Configuration hadoopConf) throws URISyntaxException, IOException {
Pair<String, String> pair = parseHdfsUri(filePath);
if (pair == null) {
throw new PluginDefineException("can't parse hdfs url from given uriStr:" + filePath);
}
String hdfsUri = pair.getLeft();
String hdfsFilePathStr = pair.getRight();
URI uri = new URI(hdfsUri);
FileSystem fs = FileSystem.get(uri, hadoopConf);
Path hdfsFilePath = new Path(hdfsFilePathStr);
if (!fs.exists(hdfsFilePath)) {
throw new RuntimeException(String.format("File[%s] not exit in hdfs", filePath));
}
return fs.open(hdfsFilePath);
}
Aggregations