Compare commits
18 Commits
release/6.
...
patch/6.0.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5de14c8edc | ||
|
|
b676bc86b8 | ||
|
|
3ee66a30e1 | ||
|
|
3e1fca96ad | ||
|
|
1296a50621 | ||
|
|
ea54f3dbbd | ||
|
|
893354dd81 | ||
|
|
49bd9c3149 | ||
|
|
d64374a94a | ||
|
|
869c17466e | ||
|
|
d1c73a41a5 | ||
|
|
b518c88dd5 | ||
|
|
e0fd6c43e9 | ||
|
|
e5dbf6fedb | ||
|
|
1f2556a765 | ||
|
|
b9be941723 | ||
|
|
cb6794362b | ||
|
|
ad570daf80 |
@@ -115,9 +115,11 @@ import org.talend.core.repository.recyclebin.RecycleBinManager;
|
||||
import org.talend.core.repository.utils.RepositoryPathProvider;
|
||||
import org.talend.core.repository.utils.XmiResourceManager;
|
||||
import org.talend.core.runtime.CoreRuntimePlugin;
|
||||
import org.talend.core.runtime.process.ITalendProcessJavaProject;
|
||||
import org.talend.core.service.ICoreUIService;
|
||||
import org.talend.cwm.helper.SubItemHelper;
|
||||
import org.talend.cwm.helper.TableHelper;
|
||||
import org.talend.designer.runprocess.IRunProcessService;
|
||||
import org.talend.repository.ProjectManager;
|
||||
import org.talend.repository.RepositoryWorkUnit;
|
||||
import org.talend.repository.documentation.ERepositoryActionName;
|
||||
@@ -1789,7 +1791,9 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
|
||||
|
||||
currentMonitor = subMonitor.newChild(1, SubMonitor.SUPPRESS_NONE);
|
||||
currentMonitor.beginTask(Messages.getString("ProxyRepositoryFactory.initializeProjectConnection"), 1); //$NON-NLS-1$
|
||||
ProjectManager.getInstance().getBeforeLogonRecords().clear();
|
||||
this.repositoryFactoryFromProvider.beforeLogon(project);
|
||||
ProjectManager.getInstance().getBeforeLogonRecords().clear();
|
||||
|
||||
// monitorWrap.worked(1);
|
||||
TimeMeasure.step("logOnProject", "beforeLogon"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
@@ -1799,13 +1803,17 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
|
||||
|
||||
currentMonitor = subMonitor.newChild(1, SubMonitor.SUPPRESS_NONE);
|
||||
currentMonitor.beginTask("Execute before logon migrations tasks", 1); //$NON-NLS-1$
|
||||
ProjectManager.getInstance().getMigrationRecords().clear();
|
||||
executeMigrations(project, true, currentMonitor);
|
||||
ProjectManager.getInstance().getMigrationRecords().clear();
|
||||
// monitorWrap.worked(1);
|
||||
TimeMeasure.step("logOnProject", "executeMigrations(beforeLogonTasks)"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
|
||||
currentMonitor = subMonitor.newChild(1, SubMonitor.SUPPRESS_NONE);
|
||||
currentMonitor.beginTask(Messages.getString("ProxyRepositoryFactory.logonInProgress"), 1); //$NON-NLS-1$
|
||||
ProjectManager.getInstance().getLogonRecords().clear();
|
||||
this.repositoryFactoryFromProvider.logOnProject(project);
|
||||
ProjectManager.getInstance().getLogonRecords().clear();
|
||||
// monitorWrap.worked(1);
|
||||
TimeMeasure.step("logOnProject", "logOnProject"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
|
||||
@@ -1823,7 +1831,9 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
|
||||
|
||||
currentMonitor = subMonitor.newChild(1, SubMonitor.SUPPRESS_NONE);
|
||||
currentMonitor.beginTask(Messages.getString("ProxyRepositoryFactory.exec.migration.tasks"), 1); //$NON-NLS-1$
|
||||
ProjectManager.getInstance().getMigrationRecords().clear();
|
||||
executeMigrations(project, false, currentMonitor);
|
||||
ProjectManager.getInstance().getMigrationRecords().clear();
|
||||
TimeMeasure.step("logOnProject", "executeMigrations(afterLogonTasks)"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
if (monitor != null && monitor.isCanceled()) {
|
||||
throw new OperationCanceledException(""); //$NON-NLS-1$
|
||||
@@ -1841,6 +1851,11 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
|
||||
|
||||
currentMonitor = subMonitor.newChild(1, SubMonitor.SUPPRESS_NONE);
|
||||
currentMonitor.beginTask(Messages.getString("ProxyRepositoryFactory.synch.repo.items"), 1); //$NON-NLS-1$
|
||||
|
||||
// for commandline to clear routines,pigudf,beans.
|
||||
if(CommonsPlugin.isHeadless()) {
|
||||
deleteAllRoutinesAndBeans();
|
||||
}
|
||||
try {
|
||||
coreService.syncAllRoutines();
|
||||
// PTODO need refactor later, this is not good, I think
|
||||
@@ -2178,4 +2193,27 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
|
||||
String folderName, int options) throws PersistenceException {
|
||||
return repositoryFactoryFromProvider.getObjectFromFolder(project, type, folderName, options);
|
||||
}
|
||||
|
||||
private void deleteAllRoutinesAndBeans() {
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IRunProcessService.class)) {
|
||||
IRunProcessService runProcessService = (IRunProcessService) GlobalServiceRegister.getDefault().getService(
|
||||
IRunProcessService.class);
|
||||
ITalendProcessJavaProject project = runProcessService.getTalendProcessJavaProject();
|
||||
IFolder src = project.getSrcFolder();
|
||||
try {
|
||||
IResource[] childrenResources = src.members();
|
||||
for (IResource child : childrenResources) {
|
||||
Object folderName = child.getName();
|
||||
if ("routines".equals(folderName) //$NON-NLS-1$
|
||||
|| "pigudf".equals(folderName) //$NON-NLS-1$
|
||||
|| "beans".equals(folderName)) { //$NON-NLS-1$
|
||||
child.delete(true, null);
|
||||
}
|
||||
}
|
||||
} catch (CoreException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -283,7 +283,7 @@ public class JobInfo {
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((contextName == null) ? 0 : contextName.hashCode());
|
||||
// result = prime * result + ((contextName == null) ? 0 : contextName.hashCode());
|
||||
result = prime * result + ((jobId == null) ? 0 : jobId.hashCode());
|
||||
result = prime * result + ((jobVersion == null) ? 0 : jobVersion.hashCode());
|
||||
return result;
|
||||
@@ -292,13 +292,13 @@ public class JobInfo {
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
final JobInfo other = (JobInfo) obj;
|
||||
if (contextName == null) {
|
||||
if (other.contextName != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!contextName.equals(other.contextName)) {
|
||||
return false;
|
||||
}
|
||||
// if (contextName == null) {
|
||||
// if (other.contextName != null) {
|
||||
// return false;
|
||||
// }
|
||||
// } else if (!contextName.equals(other.contextName)) {
|
||||
// return false;
|
||||
// }
|
||||
if (jobId == null) {
|
||||
if (other.jobId != null) {
|
||||
return false;
|
||||
|
||||
@@ -19,6 +19,8 @@ import java.util.List;
|
||||
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
import org.eclipse.ui.IEditorReference;
|
||||
import org.eclipse.ui.IWorkbenchPage;
|
||||
import org.eclipse.ui.IWorkbenchWindow;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
|
||||
/**
|
||||
@@ -129,8 +131,15 @@ public class Problem {
|
||||
public void run() {
|
||||
// workbench should be created,bug 22659
|
||||
if (PlatformUI.isWorkbenchRunning()) {
|
||||
IEditorReference[] reference = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
|
||||
.getEditorReferences();
|
||||
IWorkbenchWindow activeWorkbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
|
||||
if (activeWorkbenchWindow == null) {
|
||||
return;
|
||||
}
|
||||
IWorkbenchPage activePage = activeWorkbenchWindow.getActivePage();
|
||||
if (activePage == null) {
|
||||
return;
|
||||
}
|
||||
IEditorReference[] reference = activePage.getEditorReferences();
|
||||
list.addAll(Arrays.asList(reference));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ package org.talend.core.model.process;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.core.resources.IMarker;
|
||||
import org.talend.commons.CommonsPlugin;
|
||||
import org.talend.core.model.properties.Item;
|
||||
import org.talend.core.runtime.CoreRuntimePlugin;
|
||||
|
||||
@@ -44,16 +45,17 @@ public class TalendProblem extends Problem {
|
||||
setDescription(markerErrorMessage);
|
||||
setStatus(status);
|
||||
|
||||
List<IProcess2> openedProcessList = CoreRuntimePlugin.getInstance().getDesignerCoreService()
|
||||
.getOpenedProcess(getEditors());
|
||||
for (IProcess2 process : openedProcessList) {
|
||||
if (javaUnitName != null && javaUnitName.equals(process.getName())) {
|
||||
BasicJobInfo jobInfo = new BasicJobInfo(process.getId(), null, process.getVersion());
|
||||
jobInfo.setJobName(process.getName());
|
||||
setJobInfo(jobInfo);
|
||||
if (!CommonsPlugin.isHeadless()) {
|
||||
List<IProcess2> openedProcessList = CoreRuntimePlugin.getInstance().getDesignerCoreService()
|
||||
.getOpenedProcess(getEditors());
|
||||
for (IProcess2 process : openedProcessList) {
|
||||
if (javaUnitName != null && javaUnitName.equals(process.getName())) {
|
||||
BasicJobInfo jobInfo = new BasicJobInfo(process.getId(), null, process.getVersion());
|
||||
jobInfo.setJobName(process.getName());
|
||||
setJobInfo(jobInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.javaUnitName = javaUnitName;
|
||||
this.marker = marker;
|
||||
this.lineNumber = lineNumber;
|
||||
@@ -108,7 +110,7 @@ public class TalendProblem extends Problem {
|
||||
return javaUnitName;
|
||||
}
|
||||
|
||||
private Integer getLineNumber() {
|
||||
public Integer getLineNumber() {
|
||||
return lineNumber;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,8 +16,14 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.resources.IMarker;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.talend.commons.exception.ExceptionHandler;
|
||||
import org.talend.commons.exception.PersistenceException;
|
||||
import org.talend.commons.exception.SystemException;
|
||||
import org.talend.core.GlobalServiceRegister;
|
||||
import org.talend.core.model.general.Project;
|
||||
import org.talend.core.model.properties.Item;
|
||||
import org.talend.core.model.properties.Property;
|
||||
@@ -26,6 +32,8 @@ import org.talend.core.model.repository.ERepositoryObjectType;
|
||||
import org.talend.core.model.repository.IRepositoryViewObject;
|
||||
import org.talend.core.prefs.ITalendCorePrefConstants;
|
||||
import org.talend.core.runtime.CoreRuntimePlugin;
|
||||
import org.talend.designer.codegen.ICodeGeneratorService;
|
||||
import org.talend.designer.codegen.ITalendSynchronizer;
|
||||
import org.talend.designer.core.IDesignerCoreService;
|
||||
import org.talend.designer.core.model.utils.emf.talendfile.ItemInforType;
|
||||
import org.talend.designer.core.model.utils.emf.talendfile.RoutinesParameterType;
|
||||
@@ -282,4 +290,67 @@ public final class RoutinesUtil {
|
||||
}
|
||||
return itemInfors;
|
||||
}
|
||||
|
||||
public static List<RoutineItem> getCompileErrorCodeItems(ERepositoryObjectType type) throws SystemException, CoreException {
|
||||
List<RoutineItem> errorItems = new ArrayList<RoutineItem>(10);
|
||||
if (type == null) {
|
||||
return errorItems;
|
||||
}
|
||||
ICodeGeneratorService codegenService = null;
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(ICodeGeneratorService.class)) {
|
||||
codegenService = (ICodeGeneratorService) GlobalServiceRegister.getDefault().getService(ICodeGeneratorService.class);
|
||||
}
|
||||
if (codegenService == null) {
|
||||
return errorItems;
|
||||
}
|
||||
final ITalendSynchronizer synchronizer = codegenService.createRoutineSynchronizer();
|
||||
|
||||
final IProxyRepositoryFactory factory = CoreRuntimePlugin.getInstance().getProxyRepositoryFactory();
|
||||
List<IRepositoryViewObject> routinesObjects = factory.getAll(ProjectManager.getInstance().getCurrentProject(), type);
|
||||
collectErrorCodesItems(errorItems, synchronizer, routinesObjects);
|
||||
// for ref-projects
|
||||
for (Project project : ProjectManager.getInstance().getAllReferencedProjects()) {
|
||||
routinesObjects = factory.getAll(project, type);
|
||||
collectErrorCodesItems(errorItems, synchronizer, routinesObjects);
|
||||
}
|
||||
return errorItems;
|
||||
}
|
||||
|
||||
public static void collectErrorCodesItems(List<RoutineItem> errorItems, ITalendSynchronizer synchronizer,
|
||||
List<IRepositoryViewObject> routinesObjects) throws SystemException, CoreException {
|
||||
if (routinesObjects == null || errorItems == null) {
|
||||
return;
|
||||
}
|
||||
if (synchronizer == null && GlobalServiceRegister.getDefault().isServiceRegistered(ICodeGeneratorService.class)) {
|
||||
ICodeGeneratorService codegenService = (ICodeGeneratorService) GlobalServiceRegister.getDefault().getService(
|
||||
ICodeGeneratorService.class);
|
||||
synchronizer = codegenService.createRoutineSynchronizer();
|
||||
}
|
||||
if (synchronizer == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (IRepositoryViewObject obj : routinesObjects) {
|
||||
Property property = obj.getProperty();
|
||||
if (property == null) {
|
||||
continue;
|
||||
}
|
||||
boolean foundError = false;
|
||||
Item item = property.getItem();
|
||||
IFile file = synchronizer.getFile(item);
|
||||
IMarker[] markers = file.findMarkers(IMarker.PROBLEM, true, IResource.DEPTH_ONE);
|
||||
for (IMarker marker : markers) {
|
||||
Integer severity = (Integer) marker.getAttribute(IMarker.SEVERITY);
|
||||
if (severity != null && IMarker.SEVERITY_ERROR == severity.intValue()) {
|
||||
foundError = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (foundError) {
|
||||
if (item instanceof RoutineItem) {
|
||||
errorItems.add((RoutineItem) item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,6 +52,12 @@ public interface TalendProcessArgumentConstant {
|
||||
|
||||
static final String ARG_ENABLE_WATCH = "ENABLE_WATCH";
|
||||
|
||||
static final String CMD_ARG_STATS_PORT_PARAM = "stat_port";
|
||||
|
||||
static final String CMD_ARG_TRACE_PORT_PARAM = "trace_port";
|
||||
|
||||
static final String CMD_ARG_TRACE_HOST_PARAM = "client_host";
|
||||
|
||||
/*
|
||||
* command
|
||||
*/
|
||||
@@ -61,9 +67,9 @@ public interface TalendProcessArgumentConstant {
|
||||
|
||||
static final String CMD_ARG_LOG4J_LEVEL = "--log4jLevel=";
|
||||
|
||||
static final String CMD_ARG_STATS_PORT = "--stat_port=";
|
||||
static final String CMD_ARG_STATS_PORT = "--" + CMD_ARG_STATS_PORT_PARAM + "=";
|
||||
|
||||
static final String CMD_ARG_TRACE_PORT = "--trace_port=";
|
||||
static final String CMD_ARG_TRACE_PORT = "--" + CMD_ARG_TRACE_PORT_PARAM + "=";
|
||||
|
||||
static final String CMD_ARG_WATCH = "--watch";
|
||||
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package org.talend.core.runtime.services;
|
||||
|
||||
import java.io.PipedInputStream;
|
||||
import java.io.PipedOutputStream;
|
||||
import java.util.Map;
|
||||
|
||||
import org.talend.core.IService;
|
||||
import org.talend.core.model.process.ITargetExecutionConfig;
|
||||
import org.talend.designer.runprocess.IProcessMessageManager;
|
||||
|
||||
public interface IRemoteRunService extends IService {
|
||||
|
||||
public void executeJobOnServer(IProcessMessageManager processMessageManager, ITargetExecutionConfig config,
|
||||
PipedInputStream stdInputStream, PipedInputStream errInputStream, PipedOutputStream stdOutputStream,
|
||||
PipedOutputStream errOutputStream, String remoteJobId, String jobName, Map<String, String> jobParams,
|
||||
Map<String, String> contextParams) throws Exception;
|
||||
}
|
||||
@@ -45,6 +45,8 @@ public interface ITestContainerProviderService extends IService {
|
||||
public boolean isTestContainerItem(Item item);
|
||||
|
||||
public ProcessType getTestContainerProcess(Item item);
|
||||
|
||||
public void setTestContainerProcess(ProcessType process,Item item);
|
||||
|
||||
public Item getParentJobItem(Item item) throws PersistenceException;
|
||||
|
||||
|
||||
@@ -15,9 +15,11 @@ package org.talend.repository;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.resources.ResourcesPlugin;
|
||||
@@ -71,7 +73,16 @@ public final class ProjectManager {
|
||||
|
||||
private Map<String, List<FolderItem>> foldersMap = new HashMap<String, List<FolderItem>>();
|
||||
|
||||
private Set<String> beforeLogonRecords;
|
||||
|
||||
private Set<String> logonRecords;
|
||||
|
||||
private Set<String> migrationRecords;
|
||||
|
||||
private ProjectManager() {
|
||||
beforeLogonRecords = new HashSet<String>();
|
||||
logonRecords = new HashSet<String>();
|
||||
migrationRecords = new HashSet<String>();
|
||||
initCurrentProject();
|
||||
}
|
||||
|
||||
@@ -569,4 +580,17 @@ public final class ProjectManager {
|
||||
mapProjectUrlToBranchUrl.clear();
|
||||
foldersMap.clear();
|
||||
}
|
||||
|
||||
public Set<String> getBeforeLogonRecords() {
|
||||
return this.beforeLogonRecords;
|
||||
}
|
||||
|
||||
public Set<String> getLogonRecords() {
|
||||
return this.logonRecords;
|
||||
}
|
||||
|
||||
public Set<String> getMigrationRecords() {
|
||||
return this.migrationRecords;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@ import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.layout.GridLayout;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.ui.IEditorInput;
|
||||
import org.eclipse.ui.IWorkbenchPart;
|
||||
import org.eclipse.ui.part.EditorPart;
|
||||
import org.eclipse.ui.part.ViewPart;
|
||||
import org.talend.core.model.process.IContextManager;
|
||||
@@ -287,6 +288,17 @@ public abstract class AbstractContextView extends ViewPart {
|
||||
|
||||
public void refresh() {
|
||||
getPart();
|
||||
refreshPart();
|
||||
}
|
||||
|
||||
public void refresh(IWorkbenchPart editorPart) {
|
||||
if (editorPart instanceof EditorPart) {
|
||||
part = (EditorPart) editorPart;
|
||||
refreshPart();
|
||||
}
|
||||
}
|
||||
|
||||
private void refreshPart() {
|
||||
if (part != null) {
|
||||
boolean modified = updateContextFromRepository();
|
||||
if (modified) {
|
||||
|
||||
@@ -18,6 +18,7 @@ import java.util.Set;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.eclipse.ui.IViewPart;
|
||||
import org.eclipse.ui.IWorkbenchPage;
|
||||
import org.eclipse.ui.IWorkbenchPart;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
import org.talend.core.ui.branding.IBrandingConfiguration;
|
||||
|
||||
@@ -34,15 +35,26 @@ public class Contexts {
|
||||
private static final String PERSPECTIVE_DI_ID = "org.talend.rcp.perspective"; //$NON-NLS-1$
|
||||
|
||||
public static void switchToCurContextsView() {
|
||||
AbstractContextView cxtView = getViewWithPerspectiveIDs();
|
||||
if (cxtView != null) {
|
||||
updateTitle(cxtView);
|
||||
refreshView(cxtView);
|
||||
}
|
||||
}
|
||||
|
||||
public static void switchToCurContextsView(IWorkbenchPart part) {
|
||||
AbstractContextView cxtView = getViewWithPerspectiveIDs();
|
||||
if (cxtView != null) {
|
||||
updateTitle(cxtView);
|
||||
cxtView.refresh(part);
|
||||
}
|
||||
}
|
||||
|
||||
private static AbstractContextView getViewWithPerspectiveIDs() {
|
||||
Set<String> perspIDs = new HashSet<String>();
|
||||
perspIDs.add(PERSPECTIVE_DI_ID);
|
||||
perspIDs.add(IBrandingConfiguration.PERSPECTIVE_CAMEL_ID);
|
||||
AbstractContextView cxtView = getView(perspIDs, AbstractContextView.CTX_ID_DESIGNER);
|
||||
if (cxtView == null) {
|
||||
return;
|
||||
}
|
||||
updateTitle(cxtView);
|
||||
refreshView(cxtView);
|
||||
return getView(perspIDs, AbstractContextView.CTX_ID_DESIGNER);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -17,6 +17,7 @@ import java.util.List;
|
||||
import org.talend.core.IService;
|
||||
import org.talend.core.model.process.IContextParameter;
|
||||
import org.talend.core.model.process.ITargetExecutionConfig;
|
||||
import org.talend.designer.runprocess.IProcessMessageManager;
|
||||
import org.talend.designer.runprocess.ProcessorException;
|
||||
|
||||
/**
|
||||
@@ -27,4 +28,9 @@ public interface ICommandlineClientService extends IService {
|
||||
public Process deployAndRunByCommandline(final ITargetExecutionConfig config, String jobName, String jobVersion,
|
||||
String jobContextName, int statisticsPort, int tracePort, String watchParam, final boolean runnable,
|
||||
List<IContextParameter> jobContextParams) throws ProcessorException;
|
||||
|
||||
public Process deployByCommandlineAndRunByStudio(final IProcessMessageManager processMessageManager,
|
||||
final ITargetExecutionConfig config, String jobName, String jobVersion, String jobContextName, int statisticsPort,
|
||||
int tracePort, String watchParam, List<IContextParameter> jobContextParams) throws ProcessorException;
|
||||
|
||||
}
|
||||
|
||||
@@ -123,9 +123,9 @@ public class ProjectPomManager {
|
||||
|
||||
if (processor != null) {
|
||||
for (JobInfo childJob : processor.getBuildChildrenJobs()) {
|
||||
modulesList.add(PomUtil.getPomFileName(childJob.getJobName()));
|
||||
modulesList.add(PomUtil.getPomFileName(childJob.getJobName(), childJob.getJobVersion()));
|
||||
}
|
||||
modulesList.add(PomUtil.getPomFileName(processor.getProperty().getLabel()));
|
||||
modulesList.add(PomUtil.getPomFileName(processor.getProperty().getLabel(), processor.getProperty().getVersion()));
|
||||
}
|
||||
// check the modules
|
||||
List<String> modules = projectModel.getModules();
|
||||
|
||||
@@ -372,6 +372,7 @@ public class CreateMavenJobPom extends AbstractMavenProcessorPom {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean validChildrenJob(JobInfo jobInfo) {
|
||||
// for job, ignore test container for children.
|
||||
return jobInfo != null && !jobInfo.isTestContainer();
|
||||
@@ -416,6 +417,7 @@ public class CreateMavenJobPom extends AbstractMavenProcessorPom {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void afterCreate(IProgressMonitor monitor) throws Exception {
|
||||
generateAssemblyFile(monitor);
|
||||
|
||||
@@ -427,6 +429,7 @@ public class CreateMavenJobPom extends AbstractMavenProcessorPom {
|
||||
|
||||
}
|
||||
|
||||
|
||||
protected void generateAssemblyFile(IProgressMonitor monitor) throws Exception {
|
||||
IFile assemblyFile = this.getAssemblyFile();
|
||||
if (assemblyFile != null) {
|
||||
@@ -528,7 +531,7 @@ public class CreateMavenJobPom extends AbstractMavenProcessorPom {
|
||||
child.getJobVersion());
|
||||
}
|
||||
// children poms
|
||||
childrenPomsIncludes.add(PomUtil.getPomFileName(child.getJobName()));
|
||||
childrenPomsIncludes.add(PomUtil.getPomFileName(child.getJobName(), child.getJobVersion()));
|
||||
|
||||
if (!child.isTestContainer()) { // for test, it have add the in assembly, so no need.
|
||||
// conext resources
|
||||
|
||||
@@ -19,6 +19,7 @@ import java.io.IOException;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.maven.model.Dependency;
|
||||
import org.apache.maven.model.Model;
|
||||
import org.apache.maven.model.Parent;
|
||||
@@ -90,24 +91,42 @@ public class PomUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* main for the codes pom without version.
|
||||
*
|
||||
* get the pom name, if name is null, return default one "pom.xml", else will be "pom_<name>.xml"
|
||||
*/
|
||||
public static String getPomFileName(String name) {
|
||||
return getPomFileName(name, null);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* get the pom name, if name is null, return default one "pom.xml", else will be "pom_<name>_<version>.xml"
|
||||
*/
|
||||
public static String getPomFileName(String name, String version) {
|
||||
String pomFileName = TalendMavenConstants.POM_FILE_NAME;
|
||||
if (name != null && name.length() > 0) {
|
||||
pomFileName = TalendMavenConstants.POM_NAME + '_' + name + TalendMavenConstants.XML_EXT;
|
||||
if (StringUtils.isNotBlank(name)) {
|
||||
pomFileName = TalendMavenConstants.POM_NAME + '_' + name.trim();
|
||||
if (StringUtils.isNotBlank(version)) {
|
||||
pomFileName += '_' + version.trim();
|
||||
}
|
||||
pomFileName += TalendMavenConstants.XML_EXT;
|
||||
}
|
||||
return pomFileName;
|
||||
}
|
||||
|
||||
/**
|
||||
* get the assembly name, if name is null, return default one "assembly.xml", else will be "assembly_<name>.xml"
|
||||
* get the assembly name, if name is null, return default one "assembly.xml", else will be
|
||||
* "assembly_<name>_<version>.xml"
|
||||
*/
|
||||
public static String getAssemblyFileName(String name) {
|
||||
public static String getAssemblyFileName(String name, String version) {
|
||||
String assemblyFileName = TalendMavenConstants.ASSEMBLY_FILE_NAME;
|
||||
if (name != null && name.length() > 0) {
|
||||
assemblyFileName = TalendMavenConstants.ASSEMBLY_NAME + '_' + name + TalendMavenConstants.XML_EXT;
|
||||
if (StringUtils.isNotBlank(name)) {
|
||||
assemblyFileName = TalendMavenConstants.ASSEMBLY_NAME + '_' + name.trim();
|
||||
if (StringUtils.isNotBlank(version)) {
|
||||
assemblyFileName += '_' + version.trim();
|
||||
}
|
||||
assemblyFileName += TalendMavenConstants.XML_EXT;
|
||||
}
|
||||
return assemblyFileName;
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ package org.talend.librariesmanager.model;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
@@ -35,10 +36,6 @@ import org.eclipse.emf.ecore.resource.Resource;
|
||||
import org.eclipse.emf.ecore.util.EcoreUtil;
|
||||
import org.eclipse.emf.ecore.xmi.XMLResource;
|
||||
import org.eclipse.emf.ecore.xmi.impl.XMLParserPoolImpl;
|
||||
import org.ops4j.pax.url.mvn.MavenResolver;
|
||||
import org.osgi.framework.Bundle;
|
||||
import org.osgi.framework.FrameworkUtil;
|
||||
import org.osgi.framework.ServiceReference;
|
||||
import org.talend.commons.exception.CommonExceptionHandler;
|
||||
import org.talend.commons.exception.PersistenceException;
|
||||
import org.talend.commons.runtime.model.repository.ERepositoryStatus;
|
||||
@@ -49,6 +46,7 @@ import org.talend.core.GlobalServiceRegister;
|
||||
import org.talend.core.ILibraryManagerUIService;
|
||||
import org.talend.core.PluginChecker;
|
||||
import org.talend.core.database.conn.version.EDatabaseVersion4Drivers;
|
||||
import org.talend.core.language.ECodeLanguage;
|
||||
import org.talend.core.language.LanguageManager;
|
||||
import org.talend.core.model.component_cache.ComponentCachePackage;
|
||||
import org.talend.core.model.component_cache.ComponentInfo;
|
||||
@@ -70,7 +68,7 @@ import org.talend.core.model.properties.Property;
|
||||
import org.talend.core.model.properties.RoutineItem;
|
||||
import org.talend.core.model.repository.ERepositoryObjectType;
|
||||
import org.talend.core.model.repository.IRepositoryViewObject;
|
||||
import org.talend.core.runtime.maven.MavenConstants;
|
||||
import org.talend.core.model.routines.IRoutinesProvider;
|
||||
import org.talend.core.utils.TalendCacheUtils;
|
||||
import org.talend.designer.core.model.utils.emf.component.IMPORTType;
|
||||
import org.talend.designer.core.model.utils.emf.talendfile.RoutinesParameterType;
|
||||
@@ -507,6 +505,9 @@ public class ModulesNeededProvider {
|
||||
private static List<ModuleNeeded> collectModuleNeeded(List<IRepositoryViewObject> routineItems, Set<String> routineIdOrNames,
|
||||
boolean system) {
|
||||
List<ModuleNeeded> importNeedsList = new ArrayList<ModuleNeeded>();
|
||||
if (org.talend.commons.utils.platform.PluginChecker.isOnlyTopLoaded()) {
|
||||
return importNeedsList;
|
||||
}
|
||||
if (!routineItems.isEmpty()) {
|
||||
for (IRepositoryViewObject object : routineItems) {
|
||||
if (routineIdOrNames.contains(object.getLabel()) && system || routineIdOrNames.contains(object.getId())
|
||||
@@ -525,11 +526,31 @@ public class ModulesNeededProvider {
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(ILibraryManagerUIService.class)) {
|
||||
ILibraryManagerUIService libUiService = (ILibraryManagerUIService) GlobalServiceRegister.getDefault().getService(
|
||||
ILibraryManagerUIService.class);
|
||||
Set<String> routinesName = new HashSet<>();
|
||||
for (IRoutinesProvider routineProvider : libUiService.getRoutinesProviders(ECodeLanguage.JAVA)) {
|
||||
for (URL url : routineProvider.getSystemRoutines()) {
|
||||
String[] fragments = url.toString().split("/"); //$NON-NLS-1$
|
||||
String label = fragments[fragments.length - 1];
|
||||
String[] tmp = label.split("\\."); //$NON-NLS-1$
|
||||
String routineName = tmp[0];
|
||||
routinesName.add(routineName);
|
||||
}
|
||||
for (URL url : routineProvider.getTalendRoutines()) {
|
||||
String[] fragments = url.toString().split("/"); //$NON-NLS-1$
|
||||
String label = fragments[fragments.length - 1];
|
||||
String[] tmp = label.split("\\."); //$NON-NLS-1$
|
||||
String routineName = tmp[0];
|
||||
routinesName.add(routineName);
|
||||
}
|
||||
}
|
||||
Map<String, List<LibraryInfo>> routineAndJars = libUiService.getRoutineAndJars();
|
||||
Iterator<Map.Entry<String, List<LibraryInfo>>> iter = routineAndJars.entrySet().iterator();
|
||||
while (iter.hasNext()) {
|
||||
Map.Entry<String, List<LibraryInfo>> entry = iter.next();
|
||||
String routineName = entry.getKey();
|
||||
if (!routinesName.contains(routineName)) {
|
||||
continue;
|
||||
}
|
||||
List<LibraryInfo> needJars = entry.getValue();
|
||||
for (LibraryInfo jar : needJars) {
|
||||
ModuleNeeded toAdd = new ModuleNeeded("Routine " + routineName, jar.getLibName(), //$NON-NLS-1$
|
||||
@@ -689,42 +710,15 @@ public class ModulesNeededProvider {
|
||||
List<ModuleNeeded> allPluginsRequiredModules = getAllModulesNeededExtensionsForPlugin();
|
||||
List<ModuleNeeded> allUninstalledModules = new ArrayList<ModuleNeeded>(allPluginsRequiredModules.size());
|
||||
SubMonitor subMonitor = SubMonitor.convert(monitor, allPluginsRequiredModules.size());
|
||||
Bundle bundle = FrameworkUtil.getBundle(ModulesNeededProvider.class);
|
||||
if (bundle != null && bundle.getBundleContext() != null) {
|
||||
ServiceReference<org.ops4j.pax.url.mvn.MavenResolver> mavenResolverService = bundle.getBundleContext()
|
||||
.getServiceReference(org.ops4j.pax.url.mvn.MavenResolver.class);
|
||||
if (mavenResolverService != null) {
|
||||
MavenResolver mavenResolver = bundle.getBundleContext().getService(mavenResolverService);
|
||||
|
||||
if (mavenResolver != null) {
|
||||
|
||||
for (ModuleNeeded module : allPluginsRequiredModules) {
|
||||
// maven uri must not have any url attached to them
|
||||
// we inject a special url to only look for local libs
|
||||
String mvnUri = module.getMavenUriSnapshot().replace("mvn:",
|
||||
"mvn:" + MavenConstants.LOCAL_RESOLUTION_URL + "!");
|
||||
try {
|
||||
// if the resolve succeed it means the artifact is installed.
|
||||
mavenResolver.resolve(mvnUri);
|
||||
} catch (IOException ioe) {
|
||||
// if the resolve fails, it means the module is not installed
|
||||
allUninstalledModules.add(module);
|
||||
}
|
||||
if (subMonitor.isCanceled()) {
|
||||
return Collections.EMPTY_LIST;
|
||||
}// else keep going
|
||||
subMonitor.worked(1);
|
||||
}
|
||||
} else {// throw an exception to tell that install folder was not properly initialised
|
||||
throw new IllegalStateException(
|
||||
"Could not get the maven resolver service, the bundle org.ops4j.pax.url.mvn man not be loaded");
|
||||
}
|
||||
} else {// throw an exception to tell that install folder was not properly initialised
|
||||
throw new IllegalStateException(
|
||||
"Could not get the maven resolver service referecne, the bundle org.ops4j.pax.url.mvn man not be loaded");
|
||||
for (ModuleNeeded module : allPluginsRequiredModules) {
|
||||
if (module.getStatus() == ELibraryInstallStatus.NOT_INSTALLED) {
|
||||
allUninstalledModules.add(module);
|
||||
}
|
||||
} else {// throw an exception to tell that install folder was not properly initialised
|
||||
throw new IllegalStateException("Could not find the current bundle context");
|
||||
if (subMonitor.isCanceled()) {
|
||||
return Collections.EMPTY_LIST;
|
||||
}// else keep going
|
||||
subMonitor.worked(1);
|
||||
}
|
||||
return allUninstalledModules;
|
||||
}
|
||||
|
||||
@@ -241,11 +241,11 @@ public class ApplicationWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor {
|
||||
CommonExceptionHandler.process(e1);
|
||||
}
|
||||
|
||||
if (!JavaHomeUtil.isJDKSetup()) {
|
||||
MessageDialog.openWarning(DisplayUtils.getDefaultShell(),
|
||||
Messages.getString("ApplicationWorkbenchWindowAdvisor.wrongJavaSetup"), //$NON-NLS-1$
|
||||
Messages.getString("ApplicationWorkbenchWindowAdvisor.jdkRequired")); //$NON-NLS-1$
|
||||
}
|
||||
// if (!JavaHomeUtil.isJDKSetup()) {
|
||||
// MessageDialog.openWarning(DisplayUtils.getDefaultShell(),
|
||||
// Messages.getString("ApplicationWorkbenchWindowAdvisor.wrongJavaSetup"), //$NON-NLS-1$
|
||||
// Messages.getString("ApplicationWorkbenchWindowAdvisor.jdkRequired")); //$NON-NLS-1$
|
||||
// }
|
||||
|
||||
createActions();
|
||||
registerActions();
|
||||
|
||||
@@ -23,6 +23,7 @@ import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
@@ -1998,8 +1999,27 @@ public class LocalRepositoryFactory extends AbstractEMFRepositoryFactory impleme
|
||||
@Override
|
||||
public void setMigrationTasksDone(Project project, List<MigrationTask> list) throws PersistenceException {
|
||||
List oldMigrationTasks = project.getEmfProject().getMigrationTask();
|
||||
// use LinkedHashMap to keep the order
|
||||
Map<String, MigrationTask> refreshedTaskMap = new LinkedHashMap<String, MigrationTask>();
|
||||
if (list != null) {
|
||||
Iterator<MigrationTask> iter = list.iterator();
|
||||
while (iter.hasNext()) {
|
||||
MigrationTask task = iter.next();
|
||||
refreshedTaskMap.put(task.getId(), task);
|
||||
}
|
||||
}
|
||||
if (oldMigrationTasks != null) {
|
||||
Iterator<MigrationTask> iter = oldMigrationTasks.iterator();
|
||||
while (iter.hasNext()) {
|
||||
MigrationTask task = iter.next();
|
||||
String key = task.getId();
|
||||
if (refreshedTaskMap.containsKey(key)) {
|
||||
refreshedTaskMap.put(key, task);
|
||||
}
|
||||
}
|
||||
}
|
||||
project.getEmfProject().getMigrationTask().clear();
|
||||
project.getEmfProject().getMigrationTask().addAll(list);
|
||||
project.getEmfProject().getMigrationTask().addAll(refreshedTaskMap.values());
|
||||
saveProject(project);
|
||||
}
|
||||
|
||||
|
||||
4
pom.xml
4
pom.xml
@@ -18,7 +18,7 @@
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
<url>http://newbuild.talend.com:8081/nexus/content/repositories/TalendOpenSourceRelease/</url>
|
||||
<url>https://artifacts-oss.talend.com/nexus/content/repositories/TalendOpenSourceRelease/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>talend_open_snapshots</id>
|
||||
@@ -28,7 +28,7 @@
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
<url>http://newbuild.talend.com:8081/nexus/content/repositories/TalendOpenSourceSnapshot/</url>
|
||||
<url>https://artifacts-oss.talend.com/nexus/content/repositories/TalendOpenSourceSnapshot/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
<modules>
|
||||
|
||||
@@ -42,16 +42,46 @@ public class PomUtilTest {
|
||||
Assert.assertEquals("pom_ABC.xml", pomFileName);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetPomFileNameVersion() {
|
||||
String pomFileName = PomUtil.getPomFileName(null, null);
|
||||
Assert.assertEquals("pom.xml", pomFileName);
|
||||
|
||||
pomFileName = PomUtil.getPomFileName("", null);
|
||||
Assert.assertEquals("pom.xml", pomFileName);
|
||||
|
||||
pomFileName = PomUtil.getPomFileName(" ", " ");
|
||||
Assert.assertEquals("pom.xml", pomFileName);
|
||||
|
||||
pomFileName = PomUtil.getPomFileName("ABC", null);
|
||||
Assert.assertEquals("pom_ABC.xml", pomFileName);
|
||||
|
||||
pomFileName = PomUtil.getPomFileName("ABC", " ");
|
||||
Assert.assertEquals("pom_ABC.xml", pomFileName);
|
||||
|
||||
pomFileName = PomUtil.getPomFileName("ABC", "1.0");
|
||||
Assert.assertEquals("pom_ABC_1.0.xml", pomFileName);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetAssemblyFileName() {
|
||||
String assemblyFileName = PomUtil.getAssemblyFileName(null);
|
||||
String assemblyFileName = PomUtil.getAssemblyFileName(null, null);
|
||||
Assert.assertEquals("assembly.xml", assemblyFileName);
|
||||
|
||||
assemblyFileName = PomUtil.getAssemblyFileName("");
|
||||
assemblyFileName = PomUtil.getAssemblyFileName("", null);
|
||||
Assert.assertEquals("assembly.xml", assemblyFileName);
|
||||
|
||||
assemblyFileName = PomUtil.getAssemblyFileName("ABC");
|
||||
assemblyFileName = PomUtil.getAssemblyFileName(" ", null);
|
||||
Assert.assertEquals("assembly.xml", assemblyFileName);
|
||||
|
||||
assemblyFileName = PomUtil.getAssemblyFileName("ABC", null);
|
||||
Assert.assertEquals("assembly_ABC.xml", assemblyFileName);
|
||||
|
||||
assemblyFileName = PomUtil.getAssemblyFileName("ABC", " ");
|
||||
Assert.assertEquals("assembly_ABC.xml", assemblyFileName);
|
||||
|
||||
assemblyFileName = PomUtil.getAssemblyFileName("ABC", "1.0");
|
||||
Assert.assertEquals("assembly_ABC_1.0.xml", assemblyFileName);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user