mirror of
https://github.com/datahub-project/datahub.git
synced 2025-08-22 16:18:10 +00:00
Add all jython directories found in class path to jython interpreter's path (#751)
This commit is contained in:
parent
3a16b6e280
commit
c7d4130fab
@ -14,7 +14,9 @@
|
||||
package metadata.etl;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.Enumeration;
|
||||
import java.util.Properties;
|
||||
import org.python.core.PyDictionary;
|
||||
import org.python.core.PyString;
|
||||
@ -50,7 +52,17 @@ public abstract class EtlJob extends BaseJob {
|
||||
}
|
||||
|
||||
private void addJythonToPath(PySystemState pySystemState) {
|
||||
URL url = classLoader.getResource("jython");
|
||||
Enumeration<URL> urls;
|
||||
try {
|
||||
urls = classLoader.getResources("jython/");
|
||||
} catch (IOException e) {
|
||||
logger.info("Failed to get resource: {}", e.getMessage());
|
||||
return;
|
||||
}
|
||||
|
||||
while (urls.hasMoreElements()) {
|
||||
URL url = urls.nextElement();
|
||||
logger.debug("jython url: {}", url.getPath());
|
||||
if (url != null) {
|
||||
File file = new File(url.getFile());
|
||||
String path = file.getPath();
|
||||
@ -60,6 +72,7 @@ public abstract class EtlJob extends BaseJob {
|
||||
pySystemState.path.append(new PyString(path.replace("!", "")));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy all properties into jython environment
|
||||
|
Loading…
x
Reference in New Issue
Block a user