use of org.talend.core.runtime.process.ITalendProcessJavaProject in project tdi-studio-se by Talend.
the class AbstractStandardJobBuildProviderTest method test_createPomCreator_nullItem.
@Test
public void test_createPomCreator_nullItem() {
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"));
RepositoryObjectTypeBuildProvider provider = createTestBuildProvider();
Assert.assertNull(provider.createPomCreator(parameters));
}
use of org.talend.core.runtime.process.ITalendProcessJavaProject in project tesb-studio-se by Talend.
the class RouteJavaScriptOSGIForESBManager method addOsgiDependencies.
@Override
protected void addOsgiDependencies(Analyzer analyzer, ExportFileResource libResource, ProcessItem processItem) throws IOException {
final DependenciesResolver resolver = new DependenciesResolver(processItem);
//exportPackage.append(getPackageName(processItem));
// Add Route Resource Export packages
// http://jira.talendforge.org/browse/TESB-6227
// add manifest items
analyzer.setProperty(Analyzer.REQUIRE_BUNDLE, resolver.getManifestRequireBundle(MANIFEST_ITEM_SEPARATOR));
analyzer.setProperty(Analyzer.IMPORT_PACKAGE, //$NON-NLS-1$
resolver.getManifestImportPackage(MANIFEST_ITEM_SEPARATOR) + ",*;resolution:=optional");
analyzer.setProperty(Analyzer.EXPORT_PACKAGE, resolver.getManifestExportPackage(MANIFEST_ITEM_SEPARATOR));
if (GlobalServiceRegister.getDefault().isServiceRegistered(IRunProcessService.class)) {
IRunProcessService processService = (IRunProcessService) GlobalServiceRegister.getDefault().getService(IRunProcessService.class);
ITalendProcessJavaProject talendProcessJavaProject = processService.getTalendProcessJavaProject();
if (talendProcessJavaProject != null) {
final IPath libPath = talendProcessJavaProject.getLibFolder().getLocation();
// process external libs
final List<URL> list = new ArrayList<URL>();
for (String s : resolver.getManifestBundleClasspath(MANIFEST_ITEM_SEPARATOR).split(Character.toString(MANIFEST_ITEM_SEPARATOR))) {
if (!s.isEmpty()) {
list.add(libPath.append(s).toFile().toURI().toURL());
}
}
libResource.addResources(list);
}
}
}
use of org.talend.core.runtime.process.ITalendProcessJavaProject in project tesb-studio-se by Talend.
the class RouteResourceUtil method synchronizeRouteResource.
public static Collection<IPath> synchronizeRouteResource(final ProcessItem item) {
final boolean routelet;
if (item.eClass() == CamelPropertiesPackage.Literals.CAMEL_PROCESS_ITEM) {
routelet = false;
} else if (item.eClass() == CamelPropertiesPackage.Literals.ROUTELET_PROCESS_ITEM) {
routelet = true;
} else {
return null;
}
if (!GlobalServiceRegister.getDefault().isServiceRegistered(IRunProcessService.class)) {
return null;
}
final IRunProcessService processService = (IRunProcessService) GlobalServiceRegister.getDefault().getService(IRunProcessService.class);
final ITalendProcessJavaProject talendProcessJavaProject = processService.getTalendProcessJavaProject();
if (talendProcessJavaProject == null) {
return null;
}
final IFolder routeResourceFolder = talendProcessJavaProject.getResourcesFolder();
final Collection<IPath> result = new ArrayList<IPath>();
// add spring file
if (!routelet) {
final IFolder metaInf = routeResourceFolder.getFolder("META-INF/spring/");
try {
prepareFolder(metaInf);
final IFile spring = metaInf.getFile(item.getProperty().getLabel().toLowerCase() + ".xml");
final InputStream inputStream = new ByteArrayInputStream(((CamelProcessItem) item).getSpringContent().getBytes());
if (spring.exists()) {
spring.setContents(inputStream, 0, null);
} else {
spring.create(inputStream, true, null);
}
result.add(spring.getLocation());
} catch (CoreException e) {
ExceptionHandler.process(e);
}
}
for (ResourceDependencyModel model : getResourceDependencies(item)) {
IFile file = copyResources(routeResourceFolder, model);
if (file != null) {
result.add(file.getLocation());
}
}
return result;
}
use of org.talend.core.runtime.process.ITalendProcessJavaProject in project tdi-studio-se by Talend.
the class TalendJavaSourceViewer method updateContents.
/*
* (non-Javadoc)
*
* @see org.talend.core.ui.viewer.ReconcilerViewer#setContents(org.eclipse.jface.text.IDocument)
*/
@Override
public void updateContents() {
if (getDocument() == null) {
return;
}
InputStream codeStream = new ByteArrayInputStream(getDocument().get().getBytes());
try {
IRunProcessService runProcessService = getRunProcessService();
if (file == null && runProcessService != null) {
ITalendProcessJavaProject talendProcessJavaProject = runProcessService.getTalendProcessJavaProject();
if (talendProcessJavaProject == null) {
return;
}
file = talendProcessJavaProject.getSrcFolder().getFile(JavaUtils.JAVA_INTERNAL_DIRECTORY + '/' + filename);
file.setContents(codeStream, true, false, null);
initializeModel();
} else {
// only happen sometimes with a "fast click" (file don't exist yet).
if (getViewerRegion().getLength() == 0) {
return;
} else {
file.setContents(codeStream, true, false, null);
}
}
} catch (CoreException e) {
// don't display any error.
}
}
use of org.talend.core.runtime.process.ITalendProcessJavaProject in project tdi-studio-se by Talend.
the class JavaSQLPatternSynchronizer method getSQLPatternFile.
/*
* (non-Javadoc)
*
* @see
* org.talend.designer.codegen.ISQLPatternSynchronizer#getSQLPattern(org.talend.core.model.properties.SQLPatternItem
* )
*/
@Override
public IFile getSQLPatternFile(SQLPatternItem item) throws SystemException {
IRunProcessService service = CodeGeneratorActivator.getDefault().getRunProcessService();
ITalendProcessJavaProject talendProcessJavaProject = service.getTalendProcessJavaProject();
if (talendProcessJavaProject == null) {
return null;
}
String basePath = JavaUtils.JAVA_SQLPATTERNS_DIRECTORY + '/' + item.getEltName();
// init user defined folder
talendProcessJavaProject.getResourceSubFolder(null, basePath + '/' + JavaUtils.JAVA_USER_DEFINED);
IFolder systemFolder = talendProcessJavaProject.getResourceSubFolder(null, basePath + '/' + JavaUtils.JAVA_SYSTEM_DIRECTORY);
IFile file = systemFolder.getFile(item.getProperty().getLabel() + JavaUtils.JAVA_SQLPATTERN_EXTENSION);
return file;
}
Aggregations