Search in sources :

Example 6 with JobExportAction

use of org.talend.repository.ui.wizards.exportjob.action.JobExportAction in project tesb-studio-se by Talend.

the class ExportServiceAction method exportJobsBundle.

private void exportJobsBundle(IProgressMonitor monitor, FeaturesModel feature) throws InvocationTargetException, InterruptedException {
    String directoryName = serviceManager.getRootFolderName(tempFolder);
    for (IRepositoryViewObject node : nodes) {
        JobScriptsManager manager = serviceManager.getJobManager(exportChoiceMap, tempFolder, node, getGroupId(), getServiceVersion());
        JobExportAction job = new JobExportAction(Collections.singletonList(new RepositoryNode(node, null, ENodeType.REPOSITORY_ELEMENT)), node.getVersion(), getBundleVersion(), manager, directoryName, //$NON-NLS-1$
        "Service");
        job.run(monitor);
        feature.addBundle(new BundleModel(getGroupId(), serviceManager.getNodeLabel(node), getServiceVersion(), new File(manager.getDestinationPath())));
    }
}
Also used : JobScriptsManager(org.talend.repository.ui.wizards.exportjob.scriptsmanager.JobScriptsManager) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) JobExportAction(org.talend.repository.ui.wizards.exportjob.action.JobExportAction) BundleModel(org.talend.designer.publish.core.models.BundleModel) RepositoryNode(org.talend.repository.model.RepositoryNode) IFile(org.eclipse.core.resources.IFile) File(java.io.File)

Example 7 with JobExportAction

use of org.talend.repository.ui.wizards.exportjob.action.JobExportAction in project tesb-studio-se by Talend.

the class KarafJavaScriptForESBWithMavenManager method addTalendJobsExportResources.

private void addTalendJobsExportResources(List<ExportFileResource> list) {
    // for cTalendJob
    Iterator<String> iterator = this.talendJobsMap.keySet().iterator();
    while (iterator.hasNext()) {
        String key = iterator.next();
        IRepositoryViewObject repObject = this.talendJobsMap.get(key);
        if (repObject == null) {
            continue;
        }
        final Item talendJobItem = repObject.getProperty().getItem();
        if (talendJobItem == null) {
            continue;
        }
        String contextgGroup = this.talendJobContextGroupsMap.get(key);
        if (contextgGroup == null) {
            contextgGroup = IContext.DEFAULT;
        }
        final String talendJobLabel = talendJobItem.getProperty().getLabel();
        final String talendJobVersion = talendJobItem.getProperty().getVersion();
        File talendJobDestFile = new File(getTmpFolder(), talendJobLabel + '_' + talendJobVersion + FileConstants.ZIP_FILE_SUFFIX);
        String talendJobPath = talendJobDestFile.getAbsolutePath();
        OSGIJavaScriptForESBWithMavenManager osgiWithMavenManager = getOsgiWithMavenManager(list, talendJobLabel, contextgGroup);
        osgiWithMavenManager.setDestinationPath(talendJobPath);
        osgiWithMavenManager.setJobVersion(talendJobVersion);
        talendJobOsgiWithMavenManagersMap.put(key, osgiWithMavenManager);
        //$NON-NLS-1$
        ExportFileResource talendJobResource = new ExportFileResource(talendJobItem, "");
        talendJobResource.setDirectoryName(talendJobPath);
        try {
            RepositoryNode node = new RepositoryNode(repObject, null, ENodeType.REPOSITORY_ELEMENT);
            JobExportAction job = new JobExportAction(Collections.singletonList(node), talendJobVersion, osgiWithMavenManager, talendJobPath) {

                @Override
                protected void doArchiveExport(IProgressMonitor monitor, List<ExportFileResource> resourcesToExport) {
                // TDI-23377, no need do archive, because will re-use the resources to export for route
                // super.doArchiveExport(monitor, resourcesToExport);
                }

                @Override
                protected void reBuildJobZipFile(List<ExportFileResource> processes) {
                // TDI-23377, no need do archive, because will re-use the resources to export for route
                // super.reBuildJobZipFile(processes);
                }

                @Override
                protected void clean() {
                // TDI-23377, will re-use the tmp. so don't clean
                // super.clean();
                }
            };
            job.run(this.progressMonitor != null ? this.progressMonitor : new NullProgressMonitor());
        } catch (Exception e) {
            ExceptionHandler.process(e);
        }
    }
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) JobExportAction(org.talend.repository.ui.wizards.exportjob.action.JobExportAction) RepositoryNode(org.talend.repository.model.RepositoryNode) ProcessorException(org.talend.designer.runprocess.ProcessorException) MalformedURLException(java.net.MalformedURLException) PersistenceException(org.talend.commons.exception.PersistenceException) CamelProcessItem(org.talend.camel.core.model.camelProperties.CamelProcessItem) Item(org.talend.core.model.properties.Item) ProcessItem(org.talend.core.model.properties.ProcessItem) OSGIJavaScriptForESBWithMavenManager(org.talend.repository.ui.wizards.exportjob.scriptsmanager.esb.OSGIJavaScriptForESBWithMavenManager) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) ExportFileResource(org.talend.repository.documentation.ExportFileResource) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) List(java.util.List) EList(org.eclipse.emf.common.util.EList) ZipFile(java.util.zip.ZipFile) File(java.io.File)

Example 8 with JobExportAction

use of org.talend.repository.ui.wizards.exportjob.action.JobExportAction in project tesb-studio-se by Talend.

the class JavaCamelJobScriptsExportWSAction method exportRouteBundle.

private void exportRouteBundle(IRepositoryNode node, File filePath, String version, String bundleName, String bundleSymbolicName, String bundleVersion, String idSuffix, Collection<String> routelets, String context) throws InvocationTargetException, InterruptedException {
    final RouteJavaScriptOSGIForESBManager talendJobManager = new RouteJavaScriptOSGIForESBManager(getExportChoice(), context, routelets, statisticPort, tracePort);
    talendJobManager.setBundleName(bundleName);
    talendJobManager.setBundleSymbolicName(bundleSymbolicName);
    talendJobManager.setBundleVersion(bundleVersion);
    talendJobManager.setOsgiServiceIdSuffix(idSuffix);
    talendJobManager.setMultiNodes(false);
    talendJobManager.setDestinationPath(filePath.getAbsolutePath());
    JobExportAction action = new JobExportAction(Collections.singletonList(node), version, bundleVersion, talendJobManager, getTempDir(), "Route");
    action.run(monitor);
}
Also used : RouteJavaScriptOSGIForESBManager(org.talend.camel.designer.ui.wizards.export.RouteJavaScriptOSGIForESBManager) JobExportAction(org.talend.repository.ui.wizards.exportjob.action.JobExportAction)

Aggregations

JobExportAction (org.talend.repository.ui.wizards.exportjob.action.JobExportAction)8 File (java.io.File)5 RepositoryNode (org.talend.repository.model.RepositoryNode)4 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)3 IOException (java.io.IOException)2 InvocationTargetException (java.lang.reflect.InvocationTargetException)2 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)2 Item (org.talend.core.model.properties.Item)2 ProcessItem (org.talend.core.model.properties.ProcessItem)2 ZipToFile (org.talend.repository.ui.utils.ZipToFile)2 JobScriptsManager (org.talend.repository.ui.wizards.exportjob.scriptsmanager.JobScriptsManager)2 OSGIJavaScriptForESBWithMavenManager (org.talend.repository.ui.wizards.exportjob.scriptsmanager.esb.OSGIJavaScriptForESBWithMavenManager)2 MalformedURLException (java.net.MalformedURLException)1 List (java.util.List)1 Map (java.util.Map)1 ZipFile (java.util.zip.ZipFile)1 Document (org.dom4j.Document)1 Element (org.dom4j.Element)1 IFile (org.eclipse.core.resources.IFile)1 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)1