use of org.talend.repository.ui.wizards.exportjob.scriptsmanager.JarBuilder in project tdi-studio-se by Talend.
the class JobJavaScriptOSGIForESBManager method addRoutinesResources.
@Override
protected void addRoutinesResources(ExportFileResource[] processes, ExportFileResource libResource) {
File jarFile = new File(getTmpFolder() + File.separatorChar + JavaUtils.ROUTINES_JAR);
// make a jar file of system routine classes
File classRootFileLocation = getClassRootFileLocation();
if (classRootFileLocation == null) {
return;
}
try {
JarBuilder jarbuilder = new JarBuilder(classRootFileLocation, jarFile);
jarbuilder.setIncludeDir(getRoutinesPaths());
Collection<File> includeRoutines = new ArrayList<File>(getRoutineDependince(processes, true, USER_ROUTINES_PATH));
includeRoutines.addAll(getRoutineDependince(processes, false, getIncludeRoutinesPath()));
jarbuilder.setIncludeRoutines(includeRoutines);
jarbuilder.buildJar();
libResource.addResources(Collections.singletonList(jarFile.toURI().toURL()));
} catch (IOException e) {
throw new RuntimeException(e);
}
}
use of org.talend.repository.ui.wizards.exportjob.scriptsmanager.JarBuilder in project tbd-studio-se by Talend.
the class HadoopConfsUtils method buildAndDeployConfsJar.
public static void buildAndDeployConfsJar(HadoopClusterConnectionItem connectionItem, String contextGroup, String dir, String jarName) {
try {
File parentFile = new File(getConfsJarTempFolder());
File jarFile = new File(parentFile, jarName);
File rootDir = new File(dir);
JarBuilder jarBuilder = new JarBuilder(rootDir, jarFile);
jarBuilder.setIncludeDir(null);
jarBuilder.setExcludeDir(null);
jarBuilder.buildJar();
byte[] confFileByteArray = FileUtils.readFileToByteArray(jarFile);
HadoopClusterConnection connection = (HadoopClusterConnection) connectionItem.getConnection();
if (connection.isContextMode()) {
if (contextGroup == null) {
// $NON-NLS-1$
throw new Exception("contextGroup cannot be null in context mode!");
}
connection.getConfFiles().put(contextGroup, confFileByteArray);
} else {
connection.setConfFile(confFileByteArray);
}
if (GlobalServiceRegister.getDefault().isServiceRegistered(ILibrariesService.class)) {
ILibrariesService service = GlobalServiceRegister.getDefault().getService(ILibrariesService.class);
if (service != null) {
// Only deploy a new jar, no need to reset all
service.deployLibrary(jarFile.toURI().toURL());
addToDeployedCache(connectionItem, jarName);
}
}
} catch (Exception e) {
ExceptionHandler.process(e);
}
}
Aggregations