Search in sources :

Example 1 with FeatureModel

use of org.talend.designer.publish.core.models.FeatureModel in project tesb-studio-se by Talend.

the class ExportServiceAction method addRequiredFeatures.

private void addRequiredFeatures(FeaturesModel features) {
    // add correlation feature
    ServiceConnection connection = (ServiceConnection) serviceItem.getConnection();
    String useRegistry = connection.getAdditionalInfo().get(ServiceMetadataDialog.USE_SERVICE_REGISTRY);
    if (!"true".equals(useRegistry)) {
        String useCorrelation = connection.getAdditionalInfo().get(ServiceMetadataDialog.USE_BUSINESS_CORRELATION);
        if ("true".equals(useCorrelation)) {
            features.addFeature(new FeatureModel(FeaturesModel.CORRELATION_FEATURE_NAME));
        }
    }
    // add talend-data-mapper feature
    for (IRepositoryViewObject node : nodes) {
        ProcessItem processItem = (ProcessItem) node.getProperty().getItem();
        if (null != EmfModelUtils.getComponentByName(processItem, THMAP_COMPONENT_NAME)) {
            features.addFeature(new FeatureModel(FeaturesModel.TALEND_DATA_MAPPER_FEATURE_NAME));
            break;
        }
    }
}
Also used : ServiceConnection(org.talend.repository.services.model.services.ServiceConnection) ProcessItem(org.talend.core.model.properties.ProcessItem) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) FeatureModel(org.talend.designer.publish.core.models.FeatureModel)

Example 2 with FeatureModel

use of org.talend.designer.publish.core.models.FeatureModel in project tesb-studio-se by Talend.

the class CamelFeatureUtil method addFeatureAndBundles.

/**
	 * Add feature and bundle to Feature Model
	 * 
	 * @param node
	 * @param featuresModel
	 */
public static void addFeatureAndBundles(ProcessItem routeProcess, FeaturesModel featuresModel) {
    IDesignerCoreService designerService = RepositoryPlugin.getDefault().getDesignerCoreService();
    IProcess process = designerService.getProcessFromProcessItem(routeProcess, false);
    Collection<FeatureModel> features = new HashSet<FeatureModel>();
    for (String lib : process.getNeededLibraries(true)) {
        Collection<FeatureModel> featureModel = computeFeature(getNameWithoutVersion(lib));
        if (featureModel != null) {
            features.addAll(featureModel);
        }
    }
    addNodesSpecialFeatures(features, routeProcess.getProcess());
    addConnectionsSpecialFeatures(features, routeProcess.getProcess());
    for (FeatureModel model : features) {
        featuresModel.addFeature(model);
    }
}
Also used : IDesignerCoreService(org.talend.designer.core.IDesignerCoreService) IProcess(org.talend.core.model.process.IProcess) FeatureModel(org.talend.designer.publish.core.models.FeatureModel) HashSet(java.util.HashSet)

Example 3 with FeatureModel

use of org.talend.designer.publish.core.models.FeatureModel in project tdi-studio-se by Talend.

the class AbstractPublishJobAction method exportJobForOSGI.

private void exportJobForOSGI(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
    File tmpJob = null;
    final ProcessItem processItem = (ProcessItem) node.getObject().getProperty().getItem();
    try {
        tmpJob = File.createTempFile("job", ".jar", null);
        jobScriptsManager = JobScriptsManagerFactory.createManagerInstance(JobScriptsManagerFactory.getDefaultExportChoiceMap(), processItem.getProcess().getDefaultContext(), JobScriptsManager.LAUNCHER_ALL, IProcessor.NO_STATISTICS, IProcessor.NO_TRACES, JobExportType.OSGI);
        // generate
        jobScriptsManager.setDestinationPath(tmpJob.getAbsolutePath());
        JobExportAction action = new JobExportAction(Collections.singletonList(node), jobVersion, bundleVersion, jobScriptsManager, System.getProperty("java.io.tmpdir"));
        action.run(monitor);
        if (!action.isBuildSuccessful()) {
            return;
        }
        monitor.beginTask("Deploy to Artifact Repository....", IProgressMonitor.UNKNOWN);
        FeaturesModel featuresModel = getFeatureModel(tmpJob);
        // [TESB-12036] add talend-data-mapper feature
        NodeType tHMapNode = EmfModelUtils.getComponentByName(processItem, THMAP_COMPONENT_NAME);
        if (tHMapNode != null) {
            featuresModel.addFeature(new FeatureModel(FeaturesModel.TALEND_DATA_MAPPER_FEATURE_NAME));
        }
        processModules(featuresModel, ((JobJavaScriptOSGIForESBManager) jobScriptsManager).getExcludedModuleNeededs());
        process(processItem, featuresModel, monitor);
    } catch (IOException e) {
        throw new InvocationTargetException(e);
    } finally {
        if (tmpJob != null && tmpJob.exists()) {
            tmpJob.delete();
        }
    }
}
Also used : ProcessItem(org.talend.core.model.properties.ProcessItem) FeaturesModel(org.talend.designer.publish.core.models.FeaturesModel) NodeType(org.talend.designer.core.model.utils.emf.talendfile.NodeType) JobExportAction(org.talend.repository.ui.wizards.exportjob.action.JobExportAction) IOException(java.io.IOException) File(java.io.File) FeatureModel(org.talend.designer.publish.core.models.FeatureModel) InvocationTargetException(java.lang.reflect.InvocationTargetException)

Aggregations

FeatureModel (org.talend.designer.publish.core.models.FeatureModel)3 ProcessItem (org.talend.core.model.properties.ProcessItem)2 File (java.io.File)1 IOException (java.io.IOException)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 HashSet (java.util.HashSet)1 IProcess (org.talend.core.model.process.IProcess)1 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)1 IDesignerCoreService (org.talend.designer.core.IDesignerCoreService)1 NodeType (org.talend.designer.core.model.utils.emf.talendfile.NodeType)1 FeaturesModel (org.talend.designer.publish.core.models.FeaturesModel)1 ServiceConnection (org.talend.repository.services.model.services.ServiceConnection)1 JobExportAction (org.talend.repository.ui.wizards.exportjob.action.JobExportAction)1