use of org.talend.core.runtime.process.ITalendProcessJavaProject in project tdi-studio-se by Talend.
the class StandardJobStandaloneBuildProviderTest method test_createPomCreator_nullLinuxCP.
@Test
public void test_createPomCreator_nullLinuxCP() {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put(IBuildPomCreatorParameters.PROCESSOR, new TestProcessor());
ITalendProcessJavaProject talendProcessJavaProject = RepositoryPlugin.getDefault().getRunProcessService().getTalendProcessJavaProject();
parameters.put(IBuildPomCreatorParameters.FILE_POM, talendProcessJavaProject.getProject().getFile("pom_abc.xml"));
parameters.put(IBuildParametes.ITEM, PropertiesFactory.eINSTANCE.createProcessItem());
parameters.put(IBuildPomCreatorParameters.FILE_ASSEMBLY, talendProcessJavaProject.getProject().getFile("pom_abc.xml"));
parameters.put(IBuildPomCreatorParameters.CP_WIN, "");
RepositoryObjectTypeBuildProvider provider = createTestBuildProvider();
Assert.assertNull(provider.createPomCreator(parameters));
}
use of org.talend.core.runtime.process.ITalendProcessJavaProject in project tdi-studio-se by Talend.
the class StandardJobStandaloneBuildProviderTest method test_createPomCreator_nullWinCP.
@Test
public void test_createPomCreator_nullWinCP() {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put(IBuildPomCreatorParameters.PROCESSOR, new TestProcessor());
ITalendProcessJavaProject talendProcessJavaProject = RepositoryPlugin.getDefault().getRunProcessService().getTalendProcessJavaProject();
parameters.put(IBuildPomCreatorParameters.FILE_POM, talendProcessJavaProject.getProject().getFile("pom_abc.xml"));
parameters.put(IBuildParametes.ITEM, PropertiesFactory.eINSTANCE.createProcessItem());
parameters.put(IBuildPomCreatorParameters.FILE_ASSEMBLY, talendProcessJavaProject.getProject().getFile("pom_abc.xml"));
RepositoryObjectTypeBuildProvider provider = createTestBuildProvider();
Assert.assertNull(provider.createPomCreator(parameters));
}
use of org.talend.core.runtime.process.ITalendProcessJavaProject in project tdi-studio-se by Talend.
the class ConfigExternalLibPage method finish.
/**
* Subclasses should implement this for its own business.
*
* @return
*/
public boolean finish() {
// maybe need process the pig udf and bean also. not only for routine.
if (GlobalServiceRegister.getDefault().isServiceRegistered(IRunProcessService.class)) {
IRunProcessService service = (IRunProcessService) GlobalServiceRegister.getDefault().getService(IRunProcessService.class);
ITalendProcessJavaProject talendProcessJavaProject = service.getTalendProcessJavaProject();
if (talendProcessJavaProject != null) {
talendProcessJavaProject.updateRoutinesPom(true, true);
}
}
return true;
}
use of org.talend.core.runtime.process.ITalendProcessJavaProject in project tesb-studio-se by Talend.
the class RouteJavaScriptOSGIForESBManager method addResources.
// Add Route Resource http://jira.talendforge.org/browse/TESB-6227
@Override
protected void addResources(ExportFileResource osgiResource, ProcessItem processItem) throws Exception {
IFolder srcFolder = null;
if (GlobalServiceRegister.getDefault().isServiceRegistered(IRunProcessService.class)) {
IRunProcessService processService = (IRunProcessService) GlobalServiceRegister.getDefault().getService(IRunProcessService.class);
ITalendProcessJavaProject talendProcessJavaProject = processService.getTalendProcessJavaProject();
if (talendProcessJavaProject != null) {
srcFolder = talendProcessJavaProject.getResourcesFolder();
}
}
if (srcFolder == null) {
return;
}
IPath srcPath = srcFolder.getLocation();
// https://jira.talendforge.org/browse/TESB-7893
for (IPath path : RouteResourceUtil.synchronizeRouteResource(processItem)) {
osgiResource.addResource(path.removeLastSegments(1).makeRelativeTo(srcPath).toString(), path.toFile().toURI().toURL());
}
}
use of org.talend.core.runtime.process.ITalendProcessJavaProject in project tdi-studio-se by Talend.
the class JobJavaScriptsManager method getExternalLibraries.
/**
* Gets required java jars.
*
* @param process
*
* @param boolean1
* @return
*/
protected List<URL> getExternalLibraries(boolean needLibraries, ExportFileResource[] process, final Set<String> neededLibraries) {
List<URL> list = new ArrayList<URL>();
if (!needLibraries) {
return list;
}
IFolder libFolder = null;
if (GlobalServiceRegister.getDefault().isServiceRegistered(IRunProcessService.class)) {
IRunProcessService processService = (IRunProcessService) GlobalServiceRegister.getDefault().getService(IRunProcessService.class);
ITalendProcessJavaProject talendProcessJavaProject = processService.getTalendProcessJavaProject();
if (talendProcessJavaProject != null) {
libFolder = talendProcessJavaProject.getLibFolder();
}
}
if (libFolder == null) {
return list;
}
File file = libFolder.getLocation().toFile();
File[] files = file.listFiles(FilesUtils.getAcceptModuleFilesFilter());
// Lists all the needed jar files
Set<String> listModulesReallyNeeded = new HashSet<String>();
if (neededLibraries == null) {
// in case export as been done with option "not recompile", then libraires can't be retrieved when build.
IDesignerCoreService designerService = RepositoryPlugin.getDefault().getDesignerCoreService();
for (ExportFileResource resource : process) {
ProcessItem item = (ProcessItem) resource.getItem();
String version = item.getProperty().getVersion();
if (!isMultiNodes() && this.getSelectedJobVersion() != null) {
version = this.getSelectedJobVersion();
}
ProcessItem selectedProcessItem;
if (resource.getNode() != null) {
selectedProcessItem = ItemCacheManager.getProcessItem(resource.getNode().getRoot().getProject(), item.getProperty().getId(), version);
} else {
// if no node given, take in the current project only
selectedProcessItem = ItemCacheManager.getProcessItem(item.getProperty().getId(), version);
}
IProcess iProcess = designerService.getProcessFromProcessItem(selectedProcessItem);
Set<String> processNeededLibraries = iProcess.getNeededLibraries(true);
if (processNeededLibraries != null) {
listModulesReallyNeeded.addAll(processNeededLibraries);
}
}
} else {
listModulesReallyNeeded.addAll(neededLibraries);
}
// jar from routines
List<IRepositoryViewObject> collectRoutines = new ArrayList<IRepositoryViewObject>();
boolean useBeans = false;
if (GlobalServiceRegister.getDefault().isServiceRegistered(ICamelDesignerCoreService.class)) {
ICamelDesignerCoreService camelService = (ICamelDesignerCoreService) GlobalServiceRegister.getDefault().getService(ICamelDesignerCoreService.class);
if (camelService.isInstanceofCamel(process[0].getItem())) {
useBeans = true;
}
}
String include = null;
if (useBeans) {
include = USER_BEANS_PATH;
} else {
include = USER_ROUTINES_PATH;
}
collectRoutines.addAll(collectRoutines(process, include));
collectRoutines.addAll(collectRoutines(process, USER_PIGUDF_PATH));
for (IRepositoryViewObject object : collectRoutines) {
Item item = object.getProperty().getItem();
if (item instanceof RoutineItem) {
RoutineItem routine = (RoutineItem) item;
EList imports = routine.getImports();
for (Object o : imports) {
IMPORTType type = (IMPORTType) o;
listModulesReallyNeeded.add(type.getMODULE());
}
}
}
if (Log4jPrefsSettingManager.getInstance().isLog4jEnable()) {
addLog4jToJarList(listModulesReallyNeeded);
}
for (File tempFile : files) {
try {
if (listModulesReallyNeeded.contains(tempFile.getName())) {
list.add(tempFile.toURL());
}
} catch (MalformedURLException e) {
ExceptionHandler.process(e);
}
}
return list;
// List<URL> libraries = new ArrayList<URL>();
// if (needLibraries) {
// try {
// ILibrariesService service = CorePlugin.getDefault().getLibrariesService();
// libraries = service.getTalendRoutines();
// } catch (Exception e) {
// ExceptionHandler.process(e);
// }
// }
// return libraries;
}
Aggregations