Search in sources :

Example 6 with ICoreService

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();
    }
}
Also used : ArrayList(java.util.ArrayList) ICoreService(org.talend.core.ICoreService) IFile(org.eclipse.core.resources.IFile) File(java.io.File) CoreException(org.eclipse.core.runtime.CoreException) IOException(java.io.IOException) DocumentException(org.dom4j.DocumentException) ProcessorException(org.talend.designer.runprocess.ProcessorException) MalformedURLException(java.net.MalformedURLException) PersistenceException(org.talend.commons.exception.PersistenceException)

Aggregations

ICoreService (org.talend.core.ICoreService)6 File (java.io.File)2 IOException (java.io.IOException)2 MalformedURLException (java.net.MalformedURLException)2 URL (java.net.URL)2 ArrayList (java.util.ArrayList)2 DocumentException (org.dom4j.DocumentException)2 CoreException (org.eclipse.core.runtime.CoreException)2 PersistenceException (org.talend.commons.exception.PersistenceException)2 IRunProcessService (org.talend.designer.runprocess.IRunProcessService)2 ProcessorException (org.talend.designer.runprocess.ProcessorException)2 IFile (org.eclipse.core.resources.IFile)1 IFolder (org.eclipse.core.resources.IFolder)1 IProject (org.eclipse.core.resources.IProject)1 IResource (org.eclipse.core.resources.IResource)1 ProjectScope (org.eclipse.core.resources.ProjectScope)1 JobInfo (org.talend.core.model.process.JobInfo)1 ProcessItem (org.talend.core.model.properties.ProcessItem)1 ITalendProcessJavaProject (org.talend.core.runtime.process.ITalendProcessJavaProject)1 ServiceItem (org.talend.repository.services.model.services.ServiceItem)1