Search in sources :

Example 1 with ISparkJobletProviderService

use of org.talend.core.ui.ISparkJobletProviderService in project tdi-studio-se by Talend.

the class UpdateCheckResult method handleJoblet.

private void handleJoblet(Item item) {
    boolean isSpark = false;
    boolean isSparkStreaming = false;
    if (GlobalServiceRegister.getDefault().isServiceRegistered(ISparkJobletProviderService.class)) {
        ISparkJobletProviderService sparkJobletService = (ISparkJobletProviderService) GlobalServiceRegister.getDefault().getService(ISparkJobletProviderService.class);
        if (sparkJobletService != null && sparkJobletService.isSparkJobletItem(item)) {
            isSpark = true;
        }
    }
    if (GlobalServiceRegister.getDefault().isServiceRegistered(ISparkStreamingJobletProviderService.class)) {
        ISparkStreamingJobletProviderService sparkStreamingJobletService = (ISparkStreamingJobletProviderService) GlobalServiceRegister.getDefault().getService(ISparkStreamingJobletProviderService.class);
        if (sparkStreamingJobletService != null && sparkStreamingJobletService.isSparkStreamingJobletItem(item)) {
            isSparkStreaming = true;
        }
    }
    if (isSpark) {
        isSparkJoblet = true;
    } else if (isSparkStreaming) {
        isSparkStreamingJoblet = true;
    } else {
        isJoblet = true;
    }
}
Also used : ISparkJobletProviderService(org.talend.core.ui.ISparkJobletProviderService) ISparkStreamingJobletProviderService(org.talend.core.ui.ISparkStreamingJobletProviderService)

Example 2 with ISparkJobletProviderService

use of org.talend.core.ui.ISparkJobletProviderService in project tdi-studio-se by Talend.

the class UpdateContentProvider method getElements.

@Override
@SuppressWarnings("unchecked")
public Object[] getElements(Object inputElement) {
    List<Job> jobs = new ArrayList<Job>();
    if (inputElement instanceof Collection) {
        for (UpdateResult result : (List<UpdateResult>) inputElement) {
            String jobName = result.getJobInfor();
            if (jobName == null) {
                jobName = UpdatesConstants.EMPTY;
            }
            Job job = getJob(jobs, jobName);
            if (job == null) {
                job = new Job(jobName);
                Object job2 = result.getJob();
                if (job2 != null) {
                    if (job2 instanceof IProcess2) {
                        // ?? joblet
                        job.setJoblet(((IProcess2) job2).disableRunJobView());
                        job.setReadOnlyProcess(result.isReadOnlyProcess());
                        IProcess2 process = (IProcess2) job2;
                        org.talend.core.model.properties.Item processItem = process.getProperty().getItem();
                        job.setModelItem(processItem);
                        boolean isMRProcess = false;
                        if (GlobalServiceRegister.getDefault().isServiceRegistered(IMRProcessService.class)) {
                            IMRProcessService mrProcessService = (IMRProcessService) GlobalServiceRegister.getDefault().getService(IMRProcessService.class);
                            isMRProcess = mrProcessService.isMapReduceItem(processItem);
                        }
                        boolean isStreamingProcess = false;
                        if (GlobalServiceRegister.getDefault().isServiceRegistered(IStormProcessService.class)) {
                            IStormProcessService streamingService = (IStormProcessService) GlobalServiceRegister.getDefault().getService(IStormProcessService.class);
                            isStreamingProcess = streamingService.isStormItem(processItem);
                        }
                        if (isMRProcess) {
                            job.setMR(isMRProcess);
                        } else if (isStreamingProcess) {
                            job.setStreaming(isStreamingProcess);
                        } else if (processItem instanceof ProcessItem) {
                            job.setJoblet(false);
                            job.setMR(false);
                            job.setStreaming(false);
                            job.setSparkJoblet(false);
                            job.setSparkStreamingJoblet(false);
                        } else if (processItem instanceof JobletProcessItem) {
                            boolean isSpark = false;
                            boolean isSparkStreaming = false;
                            if (GlobalServiceRegister.getDefault().isServiceRegistered(ISparkJobletProviderService.class)) {
                                ISparkJobletProviderService sparkJobletService = (ISparkJobletProviderService) GlobalServiceRegister.getDefault().getService(ISparkJobletProviderService.class);
                                if (sparkJobletService != null && sparkJobletService.isSparkJobletItem(processItem)) {
                                    isSpark = true;
                                }
                            }
                            if (GlobalServiceRegister.getDefault().isServiceRegistered(ISparkStreamingJobletProviderService.class)) {
                                ISparkStreamingJobletProviderService sparkStreamingJobletService = (ISparkStreamingJobletProviderService) GlobalServiceRegister.getDefault().getService(ISparkStreamingJobletProviderService.class);
                                if (sparkStreamingJobletService != null && sparkStreamingJobletService.isSparkStreamingJobletItem(processItem)) {
                                    isSparkStreaming = true;
                                }
                            }
                            if (isSpark) {
                                job.setSparkJoblet(true);
                                job.setJoblet(false);
                            } else if (isSparkStreaming) {
                                job.setSparkStreamingJoblet(true);
                                job.setJoblet(false);
                            } else {
                                job.setJoblet(true);
                            }
                        }
                    }
                } else {
                    String itemId = result.getObjectId();
                    if (itemId != null) {
                        IProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
                        try {
                            IRepositoryViewObject repoViewObject = factory.getLastVersion(itemId);
                            if (repoViewObject != null) {
                                Property property = repoViewObject.getProperty();
                                if (property != null) {
                                    job.setModelItem(property.getItem());
                                }
                            }
                        } catch (PersistenceException e) {
                            CommonExceptionHandler.process(e, Priority.WARN);
                        }
                    }
                    job.setJoblet(result.isJoblet());
                    job.setMR(result.isMR());
                    job.setStreaming(result.isStreaming());
                    job.setSparkJoblet(result.isSparkJoblet());
                    job.setSparkStreamingJoblet(result.isSparkStreamingJoblet());
                }
                jobs.add(job);
            }
            Category category = job.getCategory(result.getCategory());
            if (category == null) {
                category = new Category(job, result.getCategory());
                // for icon
                category.setType(result.getUpdateType());
                if (result.getUpdateObject() instanceof Node) {
                    // for node icon
                    category.setNode(result.getUpdateObject());
                }
                if (result.getUpdateObject() instanceof NodeType) {
                    // for node icon
                    category.setNode(result.getUpdateObject());
                }
                if (result.getUpdateObject() instanceof List) {
                    // for node icon
                    List list = (List) result.getUpdateObject();
                    if (list.size() > 0) {
                        Object object = list.get(0);
                        if (object instanceof Node) {
                            category.setNode(object);
                        }
                    }
                }
                job.addCategory(category);
            }
            Item item = new Item(category, result);
            category.addItem(item);
        }
    }
    return jobs.toArray();
}
Also used : IMRProcessService(org.talend.core.service.IMRProcessService) IStormProcessService(org.talend.core.service.IStormProcessService) Node(org.talend.designer.core.ui.editor.nodes.Node) ArrayList(java.util.ArrayList) ProcessItem(org.talend.core.model.properties.ProcessItem) JobletProcessItem(org.talend.core.model.properties.JobletProcessItem) ArrayList(java.util.ArrayList) List(java.util.List) Property(org.talend.core.model.properties.Property) UpdateResult(org.talend.core.model.update.UpdateResult) IProxyRepositoryFactory(org.talend.repository.model.IProxyRepositoryFactory) ISparkJobletProviderService(org.talend.core.ui.ISparkJobletProviderService) ProcessItem(org.talend.core.model.properties.ProcessItem) JobletProcessItem(org.talend.core.model.properties.JobletProcessItem) JobletProcessItem(org.talend.core.model.properties.JobletProcessItem) ISparkStreamingJobletProviderService(org.talend.core.ui.ISparkStreamingJobletProviderService) NodeType(org.talend.designer.core.model.utils.emf.talendfile.NodeType) IProcess2(org.talend.core.model.process.IProcess2) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) PersistenceException(org.talend.commons.exception.PersistenceException) Collection(java.util.Collection) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject)

Example 3 with ISparkJobletProviderService

use of org.talend.core.ui.ISparkJobletProviderService in project tdi-studio-se by Talend.

the class ComponentsFactory method reset.

@Override
public void reset() {
    componentList = null;
    skeletonList = null;
    customComponentList = null;
    Collection<IComponentFactoryFilter> filters = ComponentsFactoryProviderManager.getInstance().getProviders();
    for (IComponentFactoryFilter filter : filters) {
        filter.cleanCache();
    }
    if (GlobalServiceRegister.getDefault().isServiceRegistered(IJobletProviderService.class)) {
        IJobletProviderService jobletService = (IJobletProviderService) GlobalServiceRegister.getDefault().getService(IJobletProviderService.class);
        if (jobletService != null) {
            jobletService.clearJobletComponent();
        }
    }
    if (GlobalServiceRegister.getDefault().isServiceRegistered(ISparkJobletProviderService.class)) {
        ISparkJobletProviderService jobletService = (ISparkJobletProviderService) GlobalServiceRegister.getDefault().getService(ISparkJobletProviderService.class);
        if (jobletService != null) {
            jobletService.clearSparkJobletComponent();
        }
    }
    if (GlobalServiceRegister.getDefault().isServiceRegistered(ISparkStreamingJobletProviderService.class)) {
        ISparkStreamingJobletProviderService jobletService = (ISparkStreamingJobletProviderService) GlobalServiceRegister.getDefault().getService(ISparkStreamingJobletProviderService.class);
        if (jobletService != null) {
            jobletService.clearSparkStreamingJobletComponent();
        }
    }
}
Also used : IJobletProviderService(org.talend.core.ui.IJobletProviderService) ISparkJobletProviderService(org.talend.core.ui.ISparkJobletProviderService) IComponentFactoryFilter(org.talend.core.model.components.filters.IComponentFactoryFilter) ISparkStreamingJobletProviderService(org.talend.core.ui.ISparkStreamingJobletProviderService)

Example 4 with ISparkJobletProviderService

use of org.talend.core.ui.ISparkJobletProviderService in project tdi-studio-se by Talend.

the class PartFactory method createEditPart.

/*
     * (non-Javadoc)
     * 
     * @see org.eclipse.gef.EditPartFactory#createEditPart(org.eclipse.gef.EditPart, java.lang.Object)
     */
@Override
public EditPart createEditPart(EditPart context, Object model) {
    EditPart part = null;
    if (model instanceof SubjobContainer) {
        part = new SubjobContainerPart();
    } else if (model instanceof Process) {
        part = new ProcessPart();
    } else if (model instanceof Node) {
        part = new NodePart();
    } else if (model instanceof Connection) {
        part = new ConnectionPart();
    } else if (model instanceof ConnectionLabel) {
        part = new ConnLabelEditPart();
    } else if (model instanceof MonitorConnectionLabel) {
        part = new MonitorConnectionLabelPart();
    } else if (model instanceof ConnectionPerformance) {
        part = new ConnectionPerformanceEditPart();
    } else if (model instanceof ConnectionTrace) {
        part = new ConnectionTraceEditPart();
    } else if (model instanceof ConnectionResuming) {
        part = new ConnectionResumingEditPart();
    } else if (model instanceof NodeLabel) {
        part = new NodeLabelEditPart();
    } else if (model instanceof NodeContainer) {
        if (GlobalServiceRegister.getDefault().isServiceRegistered(ITestContainerGEFService.class)) {
            ITestContainerGEFService testContainerService = (ITestContainerGEFService) GlobalServiceRegister.getDefault().getService(ITestContainerGEFService.class);
            if (testContainerService != null) {
                part = testContainerService.createEditorPart(model);
                if (part != null) {
                    part.setModel(model);
                    return part;
                }
            }
        }
        if (((NodeContainer) model).getNode().isSparkJoblet()) {
            if (GlobalServiceRegister.getDefault().isServiceRegistered(ISparkJobletProviderService.class)) {
                ISparkJobletProviderService sparkService = (ISparkJobletProviderService) GlobalServiceRegister.getDefault().getService(ISparkJobletProviderService.class);
                if (sparkService != null) {
                    part = (EditPart) sparkService.createEditorPart(model);
                    if (part != null) {
                        part.setModel(model);
                        return part;
                    }
                }
            }
        } else if (((NodeContainer) model).getNode().isSparkStreamingJoblet()) {
            if (GlobalServiceRegister.getDefault().isServiceRegistered(ISparkStreamingJobletProviderService.class)) {
                ISparkStreamingJobletProviderService sparkService = (ISparkStreamingJobletProviderService) GlobalServiceRegister.getDefault().getService(ISparkStreamingJobletProviderService.class);
                if (sparkService != null) {
                    part = (EditPart) sparkService.createEditorPart(model);
                    if (part != null) {
                        part.setModel(model);
                        return part;
                    }
                }
            }
        } else if (((NodeContainer) model).getNode().isStandardJoblet()) {
            part = new JobletContainerPart();
        } else if (((NodeContainer) model).getNode().isMapReduce()) {
            part = new JobletContainerPart();
        } else {
            part = new NodeContainerPart();
        }
    } else if (model instanceof Note) {
        part = new NoteEditPart();
    } else if (model instanceof NodeError) {
        part = new NodeErrorEditPart();
    } else if (model instanceof NodeProgressBar) {
        part = new NodeProgressBarPart();
    } else {
        return null;
    }
    // tell the newly created part about the model object
    part.setModel(model);
    return part;
}
Also used : NodeError(org.talend.designer.core.ui.editor.nodes.NodeError) NodeProgressBar(org.talend.designer.core.ui.editor.nodes.NodeProgressBar) NodeContainerPart(org.talend.designer.core.ui.editor.nodecontainer.NodeContainerPart) NodeProgressBarPart(org.talend.designer.core.ui.editor.nodes.NodeProgressBarPart) Node(org.talend.designer.core.ui.editor.nodes.Node) NodeLabelEditPart(org.talend.designer.core.ui.editor.nodes.NodeLabelEditPart) Process(org.talend.designer.core.ui.editor.process.Process) NodeContainer(org.talend.designer.core.ui.editor.nodecontainer.NodeContainer) ConnectionLabel(org.talend.designer.core.ui.editor.connections.ConnectionLabel) MonitorConnectionLabel(org.talend.designer.core.ui.editor.connections.MonitorConnectionLabel) SubjobContainerPart(org.talend.designer.core.ui.editor.subjobcontainer.SubjobContainerPart) ConnectionResuming(org.talend.designer.core.ui.editor.connections.ConnectionResuming) ConnectionResumingEditPart(org.talend.designer.core.ui.editor.connections.ConnectionResumingEditPart) NodeLabel(org.talend.designer.core.ui.editor.nodes.NodeLabel) SubjobContainer(org.talend.designer.core.ui.editor.subjobcontainer.SubjobContainer) MonitorConnectionLabel(org.talend.designer.core.ui.editor.connections.MonitorConnectionLabel) ITestContainerGEFService(org.talend.designer.core.ITestContainerGEFService) ProcessPart(org.talend.designer.core.ui.editor.process.ProcessPart) ISparkJobletProviderService(org.talend.core.ui.ISparkJobletProviderService) NodeErrorEditPart(org.talend.designer.core.ui.editor.nodes.NodeErrorEditPart) ConnectionPerformanceEditPart(org.talend.designer.core.ui.editor.connections.ConnectionPerformanceEditPart) ConnectionResumingEditPart(org.talend.designer.core.ui.editor.connections.ConnectionResumingEditPart) NodeErrorEditPart(org.talend.designer.core.ui.editor.nodes.NodeErrorEditPart) NodeLabelEditPart(org.talend.designer.core.ui.editor.nodes.NodeLabelEditPart) ConnectionPerformanceEditPart(org.talend.designer.core.ui.editor.connections.ConnectionPerformanceEditPart) ConnectionTraceEditPart(org.talend.designer.core.ui.editor.connections.ConnectionTraceEditPart) NoteEditPart(org.talend.designer.core.ui.editor.notes.NoteEditPart) EditPart(org.eclipse.gef.EditPart) ConnLabelEditPart(org.talend.designer.core.ui.editor.connections.ConnLabelEditPart) Connection(org.talend.designer.core.ui.editor.connections.Connection) NoteEditPart(org.talend.designer.core.ui.editor.notes.NoteEditPart) JobletContainerPart(org.talend.designer.core.ui.editor.jobletcontainer.JobletContainerPart) ConnectionPart(org.talend.designer.core.ui.editor.connections.ConnectionPart) ConnectionPerformance(org.talend.designer.core.ui.editor.connections.ConnectionPerformance) ConnectionTrace(org.talend.designer.core.ui.editor.connections.ConnectionTrace) ConnectionTraceEditPart(org.talend.designer.core.ui.editor.connections.ConnectionTraceEditPart) ISparkStreamingJobletProviderService(org.talend.core.ui.ISparkStreamingJobletProviderService) Note(org.talend.designer.core.ui.editor.notes.Note) NodePart(org.talend.designer.core.ui.editor.nodes.NodePart) MonitorConnectionLabelPart(org.talend.designer.core.ui.editor.connections.MonitorConnectionLabelPart) ConnLabelEditPart(org.talend.designer.core.ui.editor.connections.ConnLabelEditPart)

Aggregations

ISparkJobletProviderService (org.talend.core.ui.ISparkJobletProviderService)4 ISparkStreamingJobletProviderService (org.talend.core.ui.ISparkStreamingJobletProviderService)4 Node (org.talend.designer.core.ui.editor.nodes.Node)2 ArrayList (java.util.ArrayList)1 Collection (java.util.Collection)1 List (java.util.List)1 EditPart (org.eclipse.gef.EditPart)1 PersistenceException (org.talend.commons.exception.PersistenceException)1 IComponentFactoryFilter (org.talend.core.model.components.filters.IComponentFactoryFilter)1 IProcess2 (org.talend.core.model.process.IProcess2)1 JobletProcessItem (org.talend.core.model.properties.JobletProcessItem)1 ProcessItem (org.talend.core.model.properties.ProcessItem)1 Property (org.talend.core.model.properties.Property)1 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)1 UpdateResult (org.talend.core.model.update.UpdateResult)1 IMRProcessService (org.talend.core.service.IMRProcessService)1 IStormProcessService (org.talend.core.service.IStormProcessService)1 IJobletProviderService (org.talend.core.ui.IJobletProviderService)1 ITestContainerGEFService (org.talend.designer.core.ITestContainerGEFService)1 NodeType (org.talend.designer.core.model.utils.emf.talendfile.NodeType)1