use of org.talend.core.ICoreService in project tdi-studio-se by Talend.
the class JobJavaScriptsManager method getSystemRoutine.
/**
* Gets system routine.
*
* @param needSystemRoutine
* @return
*/
protected List<URL> getSystemRoutine(ExportFileResource[] process) {
try {
List<String> include = new ArrayList<String>();
include.add(SYSTEM_ROUTINES_PATH);
if (needMappingInSystemRoutine) {
include.add(JavaUtils.JAVA_XML_MAPPING);
if (GlobalServiceRegister.getDefault().isServiceRegistered(ICoreService.class)) {
ICoreService coreService = (ICoreService) GlobalServiceRegister.getDefault().getService(ICoreService.class);
coreService.synchronizeMapptingXML();
coreService.syncLog4jSettings();
}
}
File jarFile = new File(getTmpFolder() + File.separatorChar + SYSTEMROUTINE_JAR);
// make a jar file of system routine classes
File classRootFileLocation = getClassRootFileLocation();
if (classRootFileLocation == null) {
return Collections.emptyList();
}
JarBuilder jarbuilder = new JarBuilder(classRootFileLocation, jarFile);
jarbuilder.setIncludeDir(include);
jarbuilder.setIncludeRoutines(getRoutineDependince(process, true, USER_ROUTINES_PATH));
jarbuilder.buildJar();
return Collections.singletonList(jarFile.toURI().toURL());
} catch (Exception e) {
ExceptionHandler.process(e);
return Collections.emptyList();
}
}
Aggregations