Compare commits
24 Commits
release/7.
...
release/7.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
89ac637904 | ||
|
|
6d8b1b51c7 | ||
|
|
e30b1a45d2 | ||
|
|
e3e23006ed | ||
|
|
0e04133323 | ||
|
|
a8f2e79338 | ||
|
|
6950d5cf6a | ||
|
|
5d8dc7531f | ||
|
|
8a6b2ab76a | ||
|
|
5d277417ae | ||
|
|
c4c8ab5ba6 | ||
|
|
f660181adf | ||
|
|
46bb67ab7e | ||
|
|
22891b2e99 | ||
|
|
4b208e9fe4 | ||
|
|
2387b83d0f | ||
|
|
aec62af46c | ||
|
|
34a0e52678 | ||
|
|
274bfb2d40 | ||
|
|
984814d620 | ||
|
|
bbc6e17412 | ||
|
|
6665603efc | ||
|
|
ae1b013c5f | ||
|
|
8b0ea868e9 |
@@ -46,7 +46,7 @@ public class MyURLClassLoader extends URLClassLoader {
|
||||
private Map pclasses = new HashMap();
|
||||
|
||||
public MyURLClassLoader(String fileName) throws IOException {
|
||||
this(new File(fileName).toURL());
|
||||
this(new File(fileName).toURI().toURL());
|
||||
}
|
||||
|
||||
public MyURLClassLoader(URL url) {
|
||||
|
||||
@@ -85,6 +85,7 @@ import org.talend.core.context.Context;
|
||||
import org.talend.core.context.RepositoryContext;
|
||||
import org.talend.core.exception.TalendInternalPersistenceException;
|
||||
import org.talend.core.hadoop.BigDataBasicUtil;
|
||||
import org.talend.core.hadoop.IHadoopDistributionService;
|
||||
import org.talend.core.model.general.ILibrariesService;
|
||||
import org.talend.core.model.general.ModuleNeeded;
|
||||
import org.talend.core.model.general.Project;
|
||||
@@ -133,14 +134,15 @@ import org.talend.core.repository.utils.ProjectDataJsonProvider;
|
||||
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.hd.IDynamicDistributionManager;
|
||||
import org.talend.core.runtime.repository.item.ItemProductKeys;
|
||||
import org.talend.core.runtime.services.IGenericWizardService;
|
||||
import org.talend.core.runtime.services.IMavenUIService;
|
||||
import org.talend.core.runtime.util.ItemDateParser;
|
||||
import org.talend.core.runtime.util.SharedStudioUtils;
|
||||
import org.talend.core.service.ICoreUIService;
|
||||
import org.talend.core.service.IUpdateService;
|
||||
import org.talend.core.service.IDetectCVEService;
|
||||
import org.talend.core.service.IUpdateService;
|
||||
import org.talend.core.utils.CodesJarResourceCache;
|
||||
import org.talend.cwm.helper.SubItemHelper;
|
||||
import org.talend.cwm.helper.TableHelper;
|
||||
@@ -2449,6 +2451,15 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
|
||||
runProcessService.clearProjectRelatedSettings();
|
||||
}
|
||||
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IHadoopDistributionService.class)) {
|
||||
IHadoopDistributionService hdService = GlobalServiceRegister.getDefault()
|
||||
.getService(IHadoopDistributionService.class);
|
||||
if (hdService != null) {
|
||||
IDynamicDistributionManager dynamicDistrManager = hdService.getDynamicDistributionManager();
|
||||
dynamicDistrManager.reset(null);
|
||||
}
|
||||
}
|
||||
|
||||
// clear detect CVE cache
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IDetectCVEService.class)) {
|
||||
IDetectCVEService detectCVESvc = GlobalServiceRegister.getDefault().getService(IDetectCVEService.class);
|
||||
|
||||
@@ -39,6 +39,9 @@ import org.talend.core.GlobalServiceRegister;
|
||||
import org.talend.core.runtime.CoreRuntimePlugin;
|
||||
import org.talend.core.runtime.projectsetting.ProjectPreferenceManager;
|
||||
import org.talend.designer.runprocess.IRunProcessService;
|
||||
import org.talend.utils.JavaVersion;
|
||||
import org.talend.utils.StudioKeysFileCheck;
|
||||
import org.talend.utils.VersionException;
|
||||
|
||||
/**
|
||||
* Utilities around perl stuff. <br/>
|
||||
@@ -280,6 +283,10 @@ public final class JavaUtils {
|
||||
if (version == null) {
|
||||
return defaultCompliance;
|
||||
}
|
||||
JavaVersion ver = new JavaVersion(version);
|
||||
if (ver.getMajor() > 8) {
|
||||
return String.valueOf(ver.getMajor());
|
||||
}
|
||||
if (version.startsWith(JavaCore.VERSION_1_8)) {
|
||||
return JavaCore.VERSION_1_8;
|
||||
}
|
||||
@@ -361,4 +368,26 @@ public final class JavaUtils {
|
||||
}
|
||||
}
|
||||
|
||||
public static void validateJavaVersion() {
|
||||
try {
|
||||
// validate jvm which is used to start studio
|
||||
StudioKeysFileCheck.validateJavaVersion();
|
||||
|
||||
// validate default complier's compliance level
|
||||
IVMInstall install = JavaRuntime.getDefaultVMInstall();
|
||||
String ver = getCompilerCompliance((IVMInstall2) install, JavaCore.VERSION_1_8);
|
||||
|
||||
if (new JavaVersion(ver).compareTo(new JavaVersion(StudioKeysFileCheck.JAVA_VERSION_MAXIMUM_STRING)) > 0) {
|
||||
VersionException e = new VersionException(VersionException.ERR_JAVA_VERSION_NOT_SUPPORTED,
|
||||
"The maximum Java version supported by Studio is " + StudioKeysFileCheck.JAVA_VERSION_MAXIMUM_STRING
|
||||
+ ". Your compiler's compliance level is " + ver);
|
||||
throw e;
|
||||
}
|
||||
} catch (Exception e1) {
|
||||
if (e1 instanceof VersionException) {
|
||||
throw e1;
|
||||
}
|
||||
ExceptionHandler.process(e1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -728,8 +728,8 @@ public final class ProcessUtils {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static boolean isRoute(Property property) {
|
||||
|
||||
public static boolean isRoute(Property property) {
|
||||
return property!= null && (ERepositoryObjectType.getType(property).equals(ERepositoryObjectType.PROCESS_ROUTE) ||
|
||||
ERepositoryObjectType.getType(property).equals(ERepositoryObjectType.PROCESS_ROUTE_MICROSERVICE));
|
||||
}
|
||||
@@ -768,6 +768,39 @@ public final class ProcessUtils {
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
public static boolean isRouteWithRoutelets(Item item) {
|
||||
if (item!= null && item instanceof ProcessItem) {
|
||||
for (Object obj : ((ProcessItem) item).getProcess().getNode()) {
|
||||
if (obj instanceof NodeType) {
|
||||
if (isRouteletNode((NodeType) obj)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isRouteletNode(NodeType node) {
|
||||
String jobIds = getParameterValue(node.getElementParameter(), "PROCESS_TYPE:PROCESS_TYPE_PROCESS");
|
||||
String jobVersion = getParameterValue(node.getElementParameter(), "PROCESS_TYPE:PROCESS_TYPE_VERSION"); //$NON-NLS-1$
|
||||
ProcessItem processItem = ItemCacheManager.getProcessItem(jobIds, jobVersion);
|
||||
if (processItem != null) {
|
||||
return ERepositoryObjectType.getType(processItem.getProperty()).equals(
|
||||
ERepositoryObjectType.PROCESS_ROUTELET);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static String getParameterValue(EList<ElementParameterType> listParamType, String paramName) {
|
||||
for (ElementParameterType pType : listParamType) {
|
||||
if (pType != null && paramName.equals(pType.getName())) {
|
||||
return pType.getValue();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static int getAssertAmount(IProcess process) {
|
||||
int count = 0;
|
||||
@@ -1058,6 +1091,28 @@ public final class ProcessUtils {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isChildRouteProcess(Item item) {
|
||||
|
||||
if (item!= null && item instanceof ProcessItem) {
|
||||
for (Object obj : ((ProcessItem) item).getProcess().getNode()) {
|
||||
if (obj instanceof NodeType) {
|
||||
if (((NodeType) obj).getComponentName().equals("tRouteInput")) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
public static boolean isRoutelet(Property p) {
|
||||
if (p != null) {
|
||||
return ERepositoryObjectType.getType(p).equals(ERepositoryObjectType.PROCESS_ROUTELET);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static String escapeJava(String input) {
|
||||
return StringEscapeUtils.escapeJava(input);
|
||||
|
||||
@@ -31,6 +31,8 @@ public interface IDynamicDistributionManager {
|
||||
|
||||
public void reloadAllDynamicDistributions(IProgressMonitor monitor) throws Exception;
|
||||
|
||||
public void reset(IProgressMonitor monitor);
|
||||
|
||||
public boolean isLoaded();
|
||||
|
||||
public void load(IProgressMonitor monitor, boolean resetModulesCache) throws Exception;
|
||||
|
||||
@@ -42,6 +42,8 @@ public class JobInfoProperties extends Properties {
|
||||
public static final String PROJECT_NAME = "project"; //$NON-NLS-1$
|
||||
|
||||
public static final String JOB_ID = "jobId"; //$NON-NLS-1$
|
||||
|
||||
public static final String JOB_PARENT_ID = "jobParentId"; //$NON-NLS-1$
|
||||
|
||||
public static final String JOB_NAME = "job"; //$NON-NLS-1$
|
||||
|
||||
@@ -92,6 +94,10 @@ public class JobInfoProperties extends Properties {
|
||||
setProperty(BRANCH, branchSelection);
|
||||
}
|
||||
|
||||
if (processItem.getProperty() != null && processItem.getProperty().getParentItem() != null) {
|
||||
setProperty(JOB_PARENT_ID, processItem.getProperty().getParentItem().getProperty().getId());
|
||||
}
|
||||
|
||||
setProperty(JOB_ID, jobInfo.getJobId());
|
||||
setProperty(JOB_NAME, jobInfo.getJobName());
|
||||
String jobType = processItem.getProcess().getJobType();
|
||||
|
||||
@@ -22,6 +22,8 @@ public interface IBuildParametes {
|
||||
static final String SERVICE = "Service"; //$NON-NLS-1$
|
||||
|
||||
static final String ITEM = "Item"; //$NON-NLS-1$
|
||||
|
||||
static final String PARENT_ITEM = "ParentItem"; //$NON-NLS-1$
|
||||
|
||||
static final String VERSION = "Version"; //$NON-NLS-1$
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ import org.eclipse.jface.preference.IPreferenceStore;
|
||||
import org.talend.commons.utils.VersionUtils;
|
||||
import org.talend.core.GlobalServiceRegister;
|
||||
import org.talend.core.prefs.ITalendCorePrefConstants;
|
||||
import org.talend.core.runtime.util.SharedStudioUtils;
|
||||
import org.talend.core.ui.CoreUIPlugin;
|
||||
import org.talend.core.ui.branding.IBrandingService;
|
||||
import org.talend.daikon.token.TokenGenerator;
|
||||
@@ -41,6 +42,8 @@ public class DefaultTokenCollector extends AbstractTokenCollector {
|
||||
|
||||
private static final TokenKey OS = new TokenKey("os"); //$NON-NLS-1$
|
||||
|
||||
private static final TokenKey SHARE_MODE = new TokenKey("share.mode"); //$NON-NLS-1$
|
||||
|
||||
public static final String COLLECTOR_SYNC_NB = "COLLECTOR_SYNC_NB"; //$NON-NLS-1$
|
||||
|
||||
public DefaultTokenCollector() {
|
||||
@@ -70,7 +73,7 @@ public class DefaultTokenCollector extends AbstractTokenCollector {
|
||||
|
||||
// typeStudio
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IBrandingService.class)) {
|
||||
IBrandingService brandingService = (IBrandingService) GlobalServiceRegister.getDefault().getService(
|
||||
IBrandingService brandingService = GlobalServiceRegister.getDefault().getService(
|
||||
IBrandingService.class);
|
||||
tokenStudioObject.put(TYPE_STUDIO.getKey(), brandingService.getAcronym());
|
||||
// tokenStudioObject.put(TYPE_STUDIO.getKey(), brandingService.getShortProductName());
|
||||
@@ -92,6 +95,8 @@ public class DefaultTokenCollector extends AbstractTokenCollector {
|
||||
tokenStudioObject.put(STOP_COLLECTOR.getKey(), "0"); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
// Share mode
|
||||
tokenStudioObject.put(SHARE_MODE.getKey(), SharedStudioUtils.isSharedStudioMode());
|
||||
return tokenStudioObject;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1608,6 +1608,11 @@ public class ProcessorUtilities {
|
||||
}
|
||||
}
|
||||
|
||||
// if (isCIMode() && "Routelets".equals(node.getComponent().getOriginalFamilyName())) {
|
||||
if ("Routelets".equals(node.getComponent().getOriginalFamilyName())) {
|
||||
processItem.getProperty().setParentItem(ItemCacheManager.getProcessItem(currentProcess.getId(), currentProcess.getVersion()));
|
||||
}
|
||||
|
||||
int subJobOption = GENERATE_ALL_CHILDS;
|
||||
if (BitwiseOptionUtils.containOption(option, GENERATE_WITH_FIRST_CHILD)) {
|
||||
subJobOption = GENERATE_MAIN_ONLY;
|
||||
@@ -2547,7 +2552,7 @@ public class ProcessorUtilities {
|
||||
return jobInfos;
|
||||
}
|
||||
|
||||
private static boolean isRouteletNode(NodeType node) {
|
||||
public static boolean isRouteletNode(NodeType node) {
|
||||
String jobIds = getParameterValue(node.getElementParameter(), "PROCESS_TYPE:PROCESS_TYPE_PROCESS");
|
||||
String jobVersion = getParameterValue(node.getElementParameter(), "PROCESS_TYPE:PROCESS_TYPE_VERSION"); //$NON-NLS-1$
|
||||
ProcessItem processItem = ItemCacheManager.getProcessItem(jobIds, jobVersion);
|
||||
@@ -2945,4 +2950,12 @@ public class ProcessorUtilities {
|
||||
public static boolean isNeedExportItemsForDQ() {
|
||||
return needExportItemsForDQ;
|
||||
}
|
||||
|
||||
public static boolean isMicroservice(Item item) {
|
||||
if (item == null || item.getProperty() == null || item.getProperty().getAdditionalProperties() == null) {
|
||||
return false;
|
||||
}
|
||||
return "ROUTE_MICROSERVICE".equals(item.getProperty().getAdditionalProperties()
|
||||
.get(TalendProcessArgumentConstant.ARG_BUILD_TYPE));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,6 +44,11 @@
|
||||
<artifactId>maven-core</artifactId>
|
||||
<version>3.8.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
<version>32.0.1-jre</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
|
||||
@@ -39,12 +39,22 @@
|
||||
<groupId>org.jsoup</groupId>
|
||||
<artifactId>jsoup</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-utils</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-compat</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-utils</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
@@ -88,10 +98,35 @@
|
||||
<artifactId>commons-io</artifactId>
|
||||
<version>2.8.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-utils</artifactId>
|
||||
<version>4.0.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-xml</artifactId>
|
||||
<version>4.0.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-archiver</artifactId>
|
||||
<version>3.6.0</version>
|
||||
<version>4.8.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-io</artifactId>
|
||||
<version>3.2.0</version>
|
||||
<exclusions><!-- fix CVE to plexus-io:3.2.0-->
|
||||
<exclusion>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
@@ -104,6 +139,11 @@
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
<version>32.0.1-jre</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.shared</groupId>
|
||||
<artifactId>maven-shared-utils</artifactId>
|
||||
|
||||
@@ -26,12 +26,16 @@
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-archiver</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-utils</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-archiver</artifactId>
|
||||
<version>3.6.0</version>
|
||||
<version>4.8.0</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
@@ -39,6 +43,16 @@
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-utils</artifactId>
|
||||
<version>4.0.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-xml</artifactId>
|
||||
<version>4.0.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
||||
@@ -19,8 +19,17 @@
|
||||
<groupId>org.apache.maven.shared</groupId>
|
||||
<artifactId>maven-shared-utils</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-utils</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
<version>32.0.1-jre</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.shared</groupId>
|
||||
<artifactId>maven-shared-utils</artifactId>
|
||||
@@ -48,7 +57,7 @@
|
||||
<dependency>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-archiver</artifactId>
|
||||
<version>3.6.0</version>
|
||||
<version>4.8.0</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
@@ -56,6 +65,16 @@
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-utils</artifactId>
|
||||
<version>4.0.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-xml</artifactId>
|
||||
<version>4.0.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
|
||||
@@ -41,6 +41,11 @@
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
<version>32.0.1-jre</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.shared</groupId>
|
||||
<artifactId>maven-shared-utils</artifactId>
|
||||
@@ -98,7 +103,7 @@
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<version>3.0.0</version>
|
||||
<version>3.6.0</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>commons-codec</groupId>
|
||||
@@ -107,15 +112,23 @@
|
||||
<exclusion>
|
||||
<groupId>org.apache.maven.shared</groupId>
|
||||
<artifactId>maven-shared-utils</artifactId>
|
||||
</exclusion>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-core</artifactId>
|
||||
</exclusion>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-compat</artifactId>
|
||||
</exclusion>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-archiver</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-utils</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
@@ -183,6 +196,21 @@
|
||||
<artifactId>jboss-marshalling</artifactId>
|
||||
<version>2.0.12.Final</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-archiver</artifactId>
|
||||
<version>4.8.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-utils</artifactId>
|
||||
<version>4.0.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-xml</artifactId>
|
||||
<version>4.0.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
<dependency>
|
||||
<groupId>org.json</groupId>
|
||||
<artifactId>json</artifactId>
|
||||
<version>20230227</version>
|
||||
<version>20231013</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.dataformat</groupId>
|
||||
@@ -221,6 +221,11 @@
|
||||
<artifactId>commons-text</artifactId>
|
||||
<version>1.10.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
<version>32.0.1-jre</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<artifactId>studio-tacokit-dependencies</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<properties>
|
||||
<tacokit.components.version>1.27.25</tacokit.components.version>
|
||||
<tacokit.components.version>1.27.28</tacokit.components.version>
|
||||
</properties>
|
||||
<repositories>
|
||||
<repository>
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<properties>
|
||||
<tcomp.version>1.38.9</tcomp.version>
|
||||
<tcomp.version>1.38.12</tcomp.version>
|
||||
<slf4j.version>1.7.32</slf4j.version>
|
||||
<log4j2.version>2.17.1</log4j2.version>
|
||||
<reload4j.version>1.2.19</reload4j.version>
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<packaging>pom</packaging>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>Talend OpenSource Release</id>
|
||||
<id>talend_open</id>
|
||||
<url>https://artifacts-oss.talend.com/nexus/content/repositories/TalendOpenSourceRelease/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
@@ -44,7 +44,17 @@
|
||||
<dependency>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-utils</artifactId>
|
||||
<version>3.0.24</version>
|
||||
<version>4.0.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-xml</artifactId>
|
||||
<version>4.0.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-io</artifactId>
|
||||
<version>3.4.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
@@ -64,13 +74,18 @@
|
||||
<dependency>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-archiver</artifactId>
|
||||
<version>3.6.0</version>
|
||||
<version>4.8.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-core</artifactId>
|
||||
<version>3.8.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
<version>32.0.1-jre</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</plugin>
|
||||
<plugin>
|
||||
@@ -93,6 +108,11 @@
|
||||
<artifactId>maven-core</artifactId>
|
||||
<version>3.8.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
<version>32.0.1-jre</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</plugin>
|
||||
<plugin>
|
||||
@@ -103,9 +123,14 @@
|
||||
<dependency>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-utils</artifactId>
|
||||
<version>3.0.24</version>
|
||||
<version>4.0.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-xml</artifactId>
|
||||
<version>4.0.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-compress</artifactId>
|
||||
<version>1.21</version>
|
||||
@@ -118,12 +143,12 @@
|
||||
<dependency>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-archiver</artifactId>
|
||||
<version>3.6.0</version>
|
||||
<version>4.8.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-io</artifactId>
|
||||
<version>3.0.0</version>
|
||||
<version>3.4.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.shared</groupId>
|
||||
@@ -135,6 +160,11 @@
|
||||
<artifactId>maven-core</artifactId>
|
||||
<version>3.8.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
<version>32.0.1-jre</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<configuration>
|
||||
<archive>
|
||||
@@ -145,7 +175,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<version>3.0.0</version>
|
||||
<version>3.6.0</version>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.shared</groupId>
|
||||
@@ -155,7 +185,12 @@
|
||||
<dependency>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-utils</artifactId>
|
||||
<version>3.0.24</version>
|
||||
<version>4.0.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-xml</artifactId>
|
||||
<version>4.0.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
@@ -170,13 +205,18 @@
|
||||
<dependency>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-archiver</artifactId>
|
||||
<version>3.6.0</version>
|
||||
<version>4.8.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-core</artifactId>
|
||||
<version>3.8.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
<version>32.0.1-jre</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</plugin>
|
||||
<plugin>
|
||||
@@ -204,11 +244,21 @@
|
||||
<artifactId>maven-shared-utils</artifactId>
|
||||
<version>3.3.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-core</artifactId>
|
||||
<version>3.8.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-core</artifactId>
|
||||
<version>3.8.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.code.findbugs</groupId>
|
||||
<artifactId>jsr305</artifactId>
|
||||
<version>3.0.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
<version>32.0.1-jre</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</plugin>
|
||||
<plugin>
|
||||
|
||||
@@ -45,6 +45,7 @@ public enum ETalendMavenVariables {
|
||||
JobletName,
|
||||
|
||||
JobId,
|
||||
JobParentId,
|
||||
JobName,
|
||||
JobType,
|
||||
JobFinalName,
|
||||
|
||||
@@ -25,7 +25,6 @@ import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -35,7 +34,6 @@ import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
|
||||
import org.apache.maven.model.Activation;
|
||||
import org.apache.maven.model.Dependency;
|
||||
import org.apache.maven.model.Model;
|
||||
import org.apache.maven.model.Plugin;
|
||||
import org.apache.maven.model.Profile;
|
||||
import org.eclipse.core.resources.IContainer;
|
||||
import org.eclipse.core.resources.IFile;
|
||||
@@ -58,6 +56,7 @@ import org.eclipse.swt.widgets.Display;
|
||||
import org.talend.commons.exception.ExceptionHandler;
|
||||
import org.talend.commons.exception.PersistenceException;
|
||||
import org.talend.commons.utils.MojoType;
|
||||
import org.talend.commons.utils.VersionUtils;
|
||||
import org.talend.core.GlobalServiceRegister;
|
||||
import org.talend.core.IESBService;
|
||||
import org.talend.core.ILibraryManagerService;
|
||||
@@ -67,6 +66,7 @@ import org.talend.core.model.general.ILibrariesService;
|
||||
import org.talend.core.model.general.ModuleNeeded;
|
||||
import org.talend.core.model.general.ModuleNeeded.ELibraryInstallStatus;
|
||||
import org.talend.core.model.general.Project;
|
||||
import org.talend.core.model.process.JobInfo;
|
||||
import org.talend.core.model.process.ProcessUtils;
|
||||
import org.talend.core.model.properties.Item;
|
||||
import org.talend.core.model.properties.ProjectReference;
|
||||
@@ -99,6 +99,7 @@ import org.talend.designer.maven.utils.MavenProjectUtils;
|
||||
import org.talend.designer.maven.utils.PomIdsHelper;
|
||||
import org.talend.designer.maven.utils.PomUtil;
|
||||
import org.talend.designer.runprocess.IRunProcessService;
|
||||
import org.talend.designer.runprocess.ProcessorUtilities;
|
||||
import org.talend.repository.ProjectManager;
|
||||
import org.talend.repository.RepositoryWorkUnit;
|
||||
import org.talend.repository.model.RepositoryConstants;
|
||||
@@ -631,9 +632,37 @@ public class AggregatorPomsHelper {
|
||||
public String getJobProjectName(Property property) {
|
||||
return projectTechName + "_" + getJobProjectFolderName(property).toUpperCase(); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
public static String getJobLabel(Property property) {
|
||||
|
||||
if (property == null) {
|
||||
return "";
|
||||
}
|
||||
|
||||
if (property.getParentItem() != null) {
|
||||
Property parentProperty = property.getParentItem().getProperty();
|
||||
return parentProperty.getLabel() + "_" + parentProperty.getVersion().replace(".", "_") + "_" + property.getLabel();
|
||||
}
|
||||
|
||||
return property.getLabel();
|
||||
}
|
||||
|
||||
public static String getJobId(Property property) {
|
||||
|
||||
if (property == null) {
|
||||
return "";
|
||||
}
|
||||
|
||||
if (property.getParentItem() != null) {
|
||||
Property parentProperty = property.getParentItem().getProperty();
|
||||
return property.getId() + "_" + parentProperty.getId() + "_" + parentProperty.getVersion().replace(".", "_");
|
||||
}
|
||||
|
||||
return property.getId();
|
||||
}
|
||||
|
||||
public static String getJobProjectFolderName(Property property) {
|
||||
return getJobProjectFolderName(property.getLabel(), property.getVersion());
|
||||
return getJobProjectFolderName(getJobLabel(property), property.getVersion());
|
||||
}
|
||||
|
||||
public static String getJobProjectFolderName(String label, String version) {
|
||||
@@ -642,7 +671,7 @@ public class AggregatorPomsHelper {
|
||||
|
||||
public static String getJobProjectId(Property property) {
|
||||
String _projectTechName = ProjectManager.getInstance().getProject(property).getTechnicalLabel();
|
||||
return getJobProjectId(_projectTechName, property.getId(), property.getVersion());
|
||||
return getJobProjectId(_projectTechName, getJobId(property), property.getVersion());
|
||||
}
|
||||
|
||||
public static String getJobProjectId(String projectTechName, String id, String version) {
|
||||
@@ -683,7 +712,7 @@ public class AggregatorPomsHelper {
|
||||
AggregatorPomsHelper helper = new AggregatorPomsHelper(projectTechName);
|
||||
IPath itemRelativePath = getItemRelativePath.apply(property);
|
||||
String version = realVersion == null ? property.getVersion() : realVersion;
|
||||
String jobFolderName = getJobProjectFolderName(property.getLabel(), version);
|
||||
String jobFolderName = getJobProjectFolderName(getJobLabel(property), version);
|
||||
ERepositoryObjectType type = ERepositoryObjectType.getItemType(property.getItem());
|
||||
IFolder jobFolder = null;
|
||||
if (PomIdsHelper.skipFolders()) {
|
||||
@@ -978,6 +1007,12 @@ public class AggregatorPomsHelper {
|
||||
}
|
||||
Item item = object.getProperty().getItem();
|
||||
if (ProjectManager.getInstance().isInCurrentMainProject(item)) {
|
||||
|
||||
// remove original child routelets projects as they will be created during parent Route generation
|
||||
if (ProcessUtils.isRoutelet(item.getProperty())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
monitor.subTask("Synchronize job pom: " + item.getProperty().getLabel() //$NON-NLS-1$
|
||||
+ "_" + item.getProperty().getVersion()); //$NON-NLS-1$
|
||||
if (runProcessService != null) {
|
||||
@@ -993,11 +1028,92 @@ public class AggregatorPomsHelper {
|
||||
modules.add(getModulePath(pomFile));
|
||||
}
|
||||
}
|
||||
}
|
||||
monitor.worked(1);
|
||||
if (monitor.isCanceled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
monitor.worked(1);
|
||||
if (monitor.isCanceled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Generate individual routelet projects/poms for each Route (CI mode only)
|
||||
|
||||
if (ProcessUtils.isRoute(item.getProperty()) && ProcessUtils.isRouteWithRoutelets(item)) {
|
||||
|
||||
Set<JobInfo> allJobInfos = ProcessorUtilities.getChildrenJobInfo(item, true, true);
|
||||
|
||||
for (JobInfo childJob : allJobInfos) {
|
||||
|
||||
if (childJob.getProcessItem() != null && childJob.getProcessItem().getProperty() != null ) {
|
||||
|
||||
if (!ProcessUtils.isRoutelet(childJob.getProcessItem().getProperty())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Property childJobProperty = childJob.getProcessItem().getProperty();
|
||||
String jobGroupID = (String) childJob.getProcessItem().getProperty().getAdditionalProperties().get(MavenConstants.NAME_GROUP_ID);
|
||||
String jobCustomVersion = (String) childJob.getProcessItem().getProperty().getAdditionalProperties().get(MavenConstants.NAME_USER_VERSION);
|
||||
boolean jobUseSnapshot = childJob.getProcessItem().getProperty().getAdditionalProperties().containsKey(MavenConstants.NAME_PUBLISH_AS_SNAPSHOT);
|
||||
|
||||
Property routeProperty = item.getProperty();
|
||||
String routeGroupID = PomIdsHelper.getJobGroupId(routeProperty);
|
||||
String routeVersion = VersionUtils.getPublishVersion(routeProperty.getVersion());
|
||||
String routeCustomVersion = (String) routeProperty.getAdditionalProperties().get(MavenConstants.NAME_USER_VERSION);
|
||||
boolean routeUseSnapshot = routeProperty.getAdditionalProperties().containsKey(MavenConstants.NAME_PUBLISH_AS_SNAPSHOT);
|
||||
|
||||
IFile routePomFile = getItemPomFolder(item.getProperty()).getFile(TalendMavenConstants.POM_FILE_NAME);
|
||||
|
||||
// Inherit child job parameters from parent route
|
||||
|
||||
childJobProperty.setParentItem(item);
|
||||
childJobProperty.getAdditionalProperties().put(MavenConstants.NAME_GROUP_ID, routeGroupID);
|
||||
|
||||
if (routeCustomVersion != null) {
|
||||
childJobProperty.getAdditionalProperties().put(MavenConstants.NAME_USER_VERSION, routeCustomVersion);
|
||||
} else {
|
||||
childJobProperty.getAdditionalProperties().put(MavenConstants.NAME_USER_VERSION, routeVersion);
|
||||
}
|
||||
|
||||
if (routeUseSnapshot) {
|
||||
childJobProperty.getAdditionalProperties().put(MavenConstants.NAME_PUBLISH_AS_SNAPSHOT, "true");
|
||||
} else {
|
||||
childJobProperty.getAdditionalProperties().remove(MavenConstants.NAME_PUBLISH_AS_SNAPSHOT);
|
||||
}
|
||||
|
||||
|
||||
runProcessService.generatePom(childJob.getProcessItem(), TalendProcessOptionConstants.GENERATE_POM_NO_FILTER);
|
||||
|
||||
IFile childPomFile = getItemPomFolder(childJobProperty).getFile(TalendMavenConstants.POM_FILE_NAME);
|
||||
if (childPomFile.getProject().getName().equalsIgnoreCase(routePomFile.getProject().getName())) {
|
||||
modules.add(getModulePath(childPomFile));
|
||||
}
|
||||
|
||||
// restore original Job parameters
|
||||
childJobProperty.setParentItem(null);
|
||||
|
||||
if ( jobGroupID!= null) {
|
||||
childJobProperty.getAdditionalProperties().put(MavenConstants.NAME_GROUP_ID, jobGroupID);
|
||||
}else {
|
||||
childJobProperty.getAdditionalProperties().remove(MavenConstants.NAME_GROUP_ID);
|
||||
}
|
||||
|
||||
if (jobUseSnapshot) {
|
||||
childJobProperty.getAdditionalProperties().put(MavenConstants.NAME_PUBLISH_AS_SNAPSHOT, "true");
|
||||
}else {
|
||||
childJobProperty.getAdditionalProperties().remove(MavenConstants.NAME_PUBLISH_AS_SNAPSHOT);
|
||||
}
|
||||
|
||||
if (jobCustomVersion!=null) {
|
||||
childJobProperty.getAdditionalProperties().put(MavenConstants.NAME_USER_VERSION, jobCustomVersion);
|
||||
} else {
|
||||
childJobProperty.getAdditionalProperties().remove(MavenConstants.NAME_USER_VERSION);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
monitor.worked(1);
|
||||
if (monitor.isCanceled()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
// sync project pom again with all modules.
|
||||
monitor.subTask("Synchronize project pom with modules"); //$NON-NLS-1$
|
||||
|
||||
@@ -149,10 +149,30 @@ public abstract class AbstractMavenProcessorPom extends CreateMavenBundleTemplat
|
||||
variablesValuesMap.put(ETalendMavenVariables.JobGroupId, PomIdsHelper.getJobGroupId(property));
|
||||
variablesValuesMap.put(ETalendMavenVariables.JobVersion, PomIdsHelper.getJobVersion(property));
|
||||
}
|
||||
variablesValuesMap.put(ETalendMavenVariables.JobArtifactId, PomIdsHelper.getJobArtifactId(property));
|
||||
variablesValuesMap.put(ETalendMavenVariables.TalendJobVersion, property.getVersion());
|
||||
final String jobName = JavaResourcesHelper.escapeFileName(process.getName());
|
||||
variablesValuesMap.put(ETalendMavenVariables.JobName, jobName);
|
||||
if(ProcessUtils.isRoutelet(property)) {
|
||||
if(property.getParentItem() != null) {
|
||||
String routeArtifactID = PomIdsHelper.getJobArtifactId(property.getParentItem().getProperty());
|
||||
String jobArtifactID = PomIdsHelper.getJobArtifactId(property);
|
||||
String routeVersion = property.getParentItem().getProperty().getVersion().replace(".", "_");
|
||||
|
||||
String jobName = (jobArtifactID.startsWith(routeArtifactID))? jobArtifactID :
|
||||
routeArtifactID + "_" + routeVersion + "_" + jobArtifactID;
|
||||
|
||||
variablesValuesMap.put(ETalendMavenVariables.JobGroupId, PomIdsHelper.getJobGroupId(property.getParentItem().getProperty()));
|
||||
variablesValuesMap.put(ETalendMavenVariables.JobArtifactId, jobName);
|
||||
variablesValuesMap.put(ETalendMavenVariables.JobName, jobName);
|
||||
variablesValuesMap.put(ETalendMavenVariables.JobVersion, PomIdsHelper.getJobVersion(property.getParentItem().getProperty()));
|
||||
} else {
|
||||
variablesValuesMap.put(ETalendMavenVariables.JobArtifactId, PomIdsHelper.getJobArtifactId(property));
|
||||
final String jobName = JavaResourcesHelper.escapeFileName(process.getName());
|
||||
variablesValuesMap.put(ETalendMavenVariables.JobName, jobName);
|
||||
}
|
||||
} else {
|
||||
variablesValuesMap.put(ETalendMavenVariables.JobArtifactId, PomIdsHelper.getJobArtifactId(property));
|
||||
final String jobName = JavaResourcesHelper.escapeFileName(process.getName());
|
||||
variablesValuesMap.put(ETalendMavenVariables.JobName, jobName);
|
||||
}
|
||||
|
||||
if (property != null) {
|
||||
Project currentProject = ProjectManager.getInstance().getProject(property);
|
||||
|
||||
@@ -267,6 +267,8 @@ public class CreateMavenJobPom extends AbstractMavenProcessorPom {
|
||||
jobInfoProp.getProperty(JobInfoProperties.CONTEXT_NAME, context.getName()));
|
||||
checkPomProperty(properties, "talend.job.id", ETalendMavenVariables.JobId,
|
||||
jobInfoProp.getProperty(JobInfoProperties.JOB_ID, process.getId()));
|
||||
checkPomProperty(properties, "talend.job.parent.id", ETalendMavenVariables.JobParentId,
|
||||
jobInfoProp.getProperty(JobInfoProperties.JOB_PARENT_ID, ""));
|
||||
checkPomProperty(properties, "talend.job.type", ETalendMavenVariables.JobType,
|
||||
jobInfoProp.getProperty(JobInfoProperties.JOB_TYPE));
|
||||
|
||||
|
||||
@@ -10,4 +10,5 @@ bin.includes = META-INF/,\
|
||||
templates/,\
|
||||
lib/crypto-utils.jar,\
|
||||
lib/slf4j-api-1.7.25.jar,\
|
||||
distribution/license.json
|
||||
distribution/license.json,\
|
||||
lib/jboss-marshalling-2.0.12.Final.jar
|
||||
|
||||
@@ -278,8 +278,8 @@ public class ModulesNeededProvider {
|
||||
public static void reset() {
|
||||
// clean the cache
|
||||
ExtensionModuleManager.getInstance().clearCache();
|
||||
getModulesNeeded().clear();
|
||||
getAllManagedModules().clear();
|
||||
componentImportNeedsList.clear();
|
||||
allManagedModules.clear();
|
||||
systemModules = null;
|
||||
}
|
||||
|
||||
|
||||
@@ -229,7 +229,6 @@ public abstract class AbstractLibrariesService implements ILibrariesService {
|
||||
public void resetModulesNeeded() {
|
||||
ModulesNeededProvider.reset();
|
||||
ModuleStatusProvider.reset();
|
||||
ModulesNeededProvider.getModulesNeeded().clear();
|
||||
checkLibraries();
|
||||
}
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ public class HotClassLoader extends URLClassLoader {
|
||||
if (pathToAdd2 != null && pathToAdd2.length() > 0) {
|
||||
try {
|
||||
File pathToAdd = new File(pathToAdd2).getCanonicalFile();
|
||||
addURL(pathToAdd.toURL());
|
||||
addURL(pathToAdd.toURI().toURL());
|
||||
} catch (IOException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
|
||||
@@ -400,6 +400,36 @@ public interface PropertiesPackage extends EPackage {
|
||||
*/
|
||||
int ITEM = 6;
|
||||
|
||||
/**
|
||||
* The meta object id for the parent '{@link org.talend.core.model.properties.impl.ItemImpl <em>Item</em>}' class. <!--
|
||||
* begin-user-doc --> <!-- end-user-doc -->
|
||||
*
|
||||
* @see org.talend.core.model.properties.impl.ItemImpl
|
||||
* @see org.talend.core.model.properties.impl.PropertiesPackageImpl#getParentItem()
|
||||
* @generated
|
||||
*/
|
||||
int PARENT_ITEM = 109;
|
||||
|
||||
|
||||
/**
|
||||
* The meta object id for the '{@link org.talend.core.model.properties.impl.ItemImpl <em>Item</em>}' class. <!--
|
||||
* begin-user-doc --> <!-- end-user-doc -->
|
||||
*
|
||||
* @see org.talend.core.model.properties.impl.ItemImpl
|
||||
* @see org.talend.core.model.properties.impl.PropertiesPackageImpl#getParentItem()
|
||||
* @generated
|
||||
*/
|
||||
int PARENT_ITEM__PROPERTY = 110;
|
||||
|
||||
|
||||
/**
|
||||
* The feature id for the parent '<em><b>Item</b></em>' reference.
|
||||
* <!-- begin-user-doc --> <!-- end-user-doc -->
|
||||
* @generated
|
||||
* @ordered
|
||||
*/
|
||||
int PROPERTY__PARENT_ITEM = 111;
|
||||
|
||||
/**
|
||||
* The meta object id for the '{@link org.talend.core.model.properties.impl.BusinessProcessItemImpl <em>Business Process Item</em>}' class.
|
||||
* <!-- begin-user-doc --> <!-- end-user-doc -->
|
||||
|
||||
@@ -419,5 +419,33 @@ public interface Property extends EObject {
|
||||
* @generated
|
||||
*/
|
||||
void setItem(Item value);
|
||||
|
||||
/**
|
||||
* Returns the value of the parent '<em><b>Item</b></em>' reference. It is bidirectional and its opposite is '
|
||||
* {@link org.talend.core.model.properties.Item#getProperty <em>Property</em>}'. <!-- begin-user-doc -->
|
||||
* <p>
|
||||
* If the meaning of the parent '<em>Item</em>' reference isn't clear, there really should be more of a description here...
|
||||
* </p>
|
||||
* <!-- end-user-doc -->
|
||||
*
|
||||
* @return the value of the parent'<em>Item</em>' reference.
|
||||
* @see #setParentItem(Item)
|
||||
* @see org.talend.core.model.properties.PropertiesPackage#getProperty_Item()
|
||||
* @see org.talend.core.model.properties.Item#getProperty
|
||||
* @model opposite="property"
|
||||
* @generated
|
||||
*/
|
||||
Item getParentItem();
|
||||
|
||||
/**
|
||||
* Sets the value of the parent '{@link org.talend.core.model.properties.Property#getItem <em>Item</em>}' reference. <!--
|
||||
* begin-user-doc --> <!-- end-user-doc -->
|
||||
*
|
||||
* @param value the new value of the parent '<em>Item</em>' reference.
|
||||
* @see #getParentItem()
|
||||
* @generated
|
||||
*/
|
||||
void setParentItem(Item value);
|
||||
|
||||
|
||||
} // Property
|
||||
|
||||
@@ -227,6 +227,17 @@ public class PropertyImpl extends EObjectImpl implements Property {
|
||||
* @ordered
|
||||
*/
|
||||
protected Item item;
|
||||
|
||||
|
||||
/**
|
||||
* The cached value of the parent '{@link #getParentItem() <em>Item</em>}' reference.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @see #getParentItem()
|
||||
* @generated
|
||||
* @ordered
|
||||
*/
|
||||
protected Item parentItem;
|
||||
|
||||
/**
|
||||
* The cached value of the '{@link #getAuthor() <em>Author</em>}' reference.
|
||||
@@ -542,6 +553,23 @@ public class PropertyImpl extends EObjectImpl implements Property {
|
||||
}
|
||||
return item;
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
public Item getParentItem() {
|
||||
if (parentItem != null && parentItem.eIsProxy()) {
|
||||
InternalEObject oldItem = (InternalEObject)parentItem;
|
||||
parentItem = (Item)eResolveProxy(oldItem);
|
||||
if (parentItem != oldItem) {
|
||||
if (eNotificationRequired())
|
||||
eNotify(new ENotificationImpl(this, Notification.RESOLVE, PropertiesPackage.PROPERTY__PARENT_ITEM, oldItem, parentItem));
|
||||
}
|
||||
}
|
||||
return parentItem;
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
@@ -551,6 +579,15 @@ public class PropertyImpl extends EObjectImpl implements Property {
|
||||
public Item basicGetItem() {
|
||||
return item;
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
public Item basicGetParentItem() {
|
||||
return parentItem;
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
@@ -585,6 +622,13 @@ public class PropertyImpl extends EObjectImpl implements Property {
|
||||
else if (eNotificationRequired())
|
||||
eNotify(new ENotificationImpl(this, Notification.SET, PropertiesPackage.PROPERTY__ITEM, newItem, newItem));
|
||||
}
|
||||
|
||||
public void setParentItem(Item newItem) {
|
||||
Item oldItem = parentItem;
|
||||
parentItem = newItem;
|
||||
if (eNotificationRequired())
|
||||
eNotify(new ENotificationImpl(this, Notification.SET, PropertiesPackage.PROPERTY__PARENT_ITEM, oldItem, newItem));
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
|
||||
@@ -122,4 +122,6 @@ DataTransferMessages.DataTransfer_browse=B&rowse...
|
||||
DataTransferMessages.ArchiveExport_selectDestinationTitle=Export to Archive File
|
||||
WorkbenchMessages.ShowView_errorTitle=Problems Showing View
|
||||
ComponentsManager.form.install.dialog.restart.title=Restarting Studio
|
||||
ComponentsManager.form.install.dialog.restart.message=We need to restart studio to finish the installation.\n\nDo you want to restart studio right now?
|
||||
ComponentsManager.form.install.dialog.restart.message=We need to restart studio to finish the installation.\n\nDo you want to restart studio right now?
|
||||
JavaVersion.CheckError=Java upgrade required, minimal required java version is {0}, current version is {1}.
|
||||
JavaVersion.CheckError.notSupported=The maximum Java version supported by Studio is {0}. Your current version is {1}.
|
||||
@@ -457,7 +457,41 @@ public class ExportLogsWizardPage extends WizardPage {
|
||||
for (Entry<Object, Object> en : p.entrySet()) {
|
||||
sb.append(en.getKey() + "=" + en.getValue() + "\n"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
}
|
||||
writeToFile(dest, ".sysConfig", sb); //$NON-NLS-1$
|
||||
StringBuffer processedData = processSensitiveDataHidden(sb.toString());
|
||||
writeToFile(dest, ".sysConfig", processedData); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
private StringBuffer processSensitiveDataHidden(String data) {
|
||||
StringBuffer processedData = new StringBuffer();
|
||||
while (true) {
|
||||
String line;
|
||||
int index = data.indexOf("\n");
|
||||
if (index == -1) {
|
||||
line = data.toString();
|
||||
String processedLine = line;
|
||||
int equalsIndex = line.indexOf('=');
|
||||
if (equalsIndex != -1) {
|
||||
String key = line.substring(0, equalsIndex).trim();
|
||||
if (key.toLowerCase().contains("password")) {
|
||||
processedLine = key + "=" + "***";
|
||||
}
|
||||
}
|
||||
processedData.append(processedLine);
|
||||
break;
|
||||
}
|
||||
line = data.substring(0, index);
|
||||
String processedLine = line;
|
||||
int equalsIndex = line.indexOf('=');
|
||||
if (equalsIndex != -1) {
|
||||
String key = line.substring(0, equalsIndex).trim();
|
||||
if (key.toLowerCase().contains("password")) {
|
||||
processedLine = key + "=" + "***";
|
||||
}
|
||||
}
|
||||
processedData.append(processedLine).append("\n");
|
||||
data = data.substring(index + 1);
|
||||
}
|
||||
return processedData;
|
||||
}
|
||||
|
||||
private void writeToFile(File dest, String fileName, StringBuffer sb) {
|
||||
|
||||
@@ -78,6 +78,7 @@ import org.talend.repository.ProjectManager;
|
||||
import org.talend.repository.model.IRepositoryService;
|
||||
import org.talend.repository.ui.login.LoginHelper;
|
||||
import org.talend.utils.StudioKeysFileCheck;
|
||||
import org.talend.utils.VersionException;
|
||||
|
||||
/**
|
||||
* This class controls all aspects of the application's execution.
|
||||
@@ -112,6 +113,23 @@ public class Application implements IApplication {
|
||||
StudioKeysFileCheck.check(ConfigurationScope.INSTANCE.getLocation().toFile());
|
||||
|
||||
Display display = PlatformUI.createDisplay();
|
||||
|
||||
try {
|
||||
StudioKeysFileCheck.validateJavaVersion();
|
||||
} catch (Exception e) {
|
||||
Shell shell = new Shell(display, SWT.NONE);
|
||||
if (e instanceof VersionException) {
|
||||
String msg = Messages.getString("JavaVersion.CheckError", StudioKeysFileCheck.JAVA_VERSION_MINIMAL_STRING,
|
||||
StudioKeysFileCheck.getJavaVersion());
|
||||
if (!((VersionException) e).requireUpgrade()) {
|
||||
msg = Messages.getString("JavaVersion.CheckError.notSupported",
|
||||
StudioKeysFileCheck.JAVA_VERSION_MAXIMUM_STRING, StudioKeysFileCheck.getJavaVersion());
|
||||
}
|
||||
MessageDialog.openError(shell, null, msg);
|
||||
}
|
||||
return IApplication.EXIT_OK;
|
||||
}
|
||||
|
||||
try {
|
||||
// TUP-5816 don't put any code ahead of this part unless you make sure it won't trigger workspace
|
||||
// initialization.
|
||||
|
||||
@@ -22,6 +22,7 @@ import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.talend.commons.runtime.utils.io.FileCopyUtils;
|
||||
import org.talend.core.GlobalServiceRegister;
|
||||
import org.talend.core.model.process.JobInfo;
|
||||
import org.talend.core.model.process.ProcessUtils;
|
||||
import org.talend.core.model.properties.ProcessItem;
|
||||
import org.talend.core.runtime.process.ITalendProcessJavaProject;
|
||||
import org.talend.core.runtime.repository.build.IBuildResourcesProvider;
|
||||
@@ -70,6 +71,9 @@ public class SyncChildrenContextsResourcesProvider implements IBuildResourcesPro
|
||||
final IFolder mainResourcesFolder = processJavaProject.getExternalResourcesFolder();
|
||||
final File targetFolder = mainResourcesFolder.getLocation().toFile();
|
||||
dependenciesItems.stream().filter(jobInfo -> !jobInfo.isJoblet()).map(JobInfo::getProcessItem).forEach(item -> {
|
||||
if (ProcessUtils.isRoutelet(item.getProperty())) {
|
||||
item.getProperty().setParentItem(processItem);
|
||||
}
|
||||
ITalendProcessJavaProject childJavaProject = runProcessService.getTalendJobJavaProject(item.getProperty());
|
||||
if (childJavaProject != null) {
|
||||
final IFolder childResourcesFolder = childJavaProject.getExternalResourcesFolder();
|
||||
|
||||
@@ -22,6 +22,7 @@ import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.talend.commons.runtime.utils.io.FileCopyUtils;
|
||||
import org.talend.core.GlobalServiceRegister;
|
||||
import org.talend.core.model.process.JobInfo;
|
||||
import org.talend.core.model.process.ProcessUtils;
|
||||
import org.talend.core.model.properties.ProcessItem;
|
||||
import org.talend.core.runtime.process.ITalendProcessJavaProject;
|
||||
import org.talend.core.runtime.repository.build.IBuildResourcesProvider;
|
||||
@@ -67,6 +68,9 @@ public class SyncChildrenSourceCodeProvider implements IBuildResourcesProvider {
|
||||
final File targetFolder = mainSrcFolder.getLocation().toFile();
|
||||
|
||||
dependenciesItems.stream().filter(jobInfo -> !jobInfo.isJoblet()).map(JobInfo::getProcessItem).forEach(item -> {
|
||||
if (ProcessUtils.isRoutelet(item.getProperty())) {
|
||||
item.getProperty().setParentItem(processItem);
|
||||
}
|
||||
ITalendProcessJavaProject childJavaProject = runProcessService.getTalendJobJavaProject(item.getProperty());
|
||||
if (childJavaProject != null) {
|
||||
final IFolder childSrcFolder = childJavaProject.getSrcFolder();
|
||||
|
||||
@@ -22,6 +22,7 @@ import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.talend.commons.runtime.utils.io.FileCopyUtils;
|
||||
import org.talend.core.GlobalServiceRegister;
|
||||
import org.talend.core.model.process.JobInfo;
|
||||
import org.talend.core.model.process.ProcessUtils;
|
||||
import org.talend.core.model.properties.ProcessItem;
|
||||
import org.talend.core.runtime.process.ITalendProcessJavaProject;
|
||||
import org.talend.core.runtime.repository.build.IBuildResourcesProvider;
|
||||
@@ -65,6 +66,9 @@ public class SyncChildrenTestReportsProvider implements IBuildResourcesProvider
|
||||
if (jobInfo.isJoblet()) {
|
||||
continue;
|
||||
}
|
||||
if (ProcessUtils.isRoutelet(jobInfo.getProcessItem().getProperty())) {
|
||||
jobInfo.getProcessItem().getProperty().setParentItem(processItem);
|
||||
}
|
||||
ITalendProcessJavaProject childJavaProject = runProcessService
|
||||
.getTalendJobJavaProject(jobInfo.getProcessItem().getProperty());
|
||||
if (childJavaProject != null) {
|
||||
|
||||
@@ -2848,7 +2848,7 @@ public class DatabaseForm extends AbstractForm {
|
||||
File file = new File(stringToFile);
|
||||
if (file != null) {
|
||||
try {
|
||||
MyURLClassLoader cl = new MyURLClassLoader(file.toURL());
|
||||
MyURLClassLoader cl = new MyURLClassLoader(new URL[] {file.toURI().toURL()},this.getClass().getClassLoader());
|
||||
Class[] classes = cl.getAssignableClasses(Driver.class);
|
||||
for (Class classe : classes) {
|
||||
driverClassTxt.add(classe.getName());
|
||||
@@ -6109,7 +6109,7 @@ public class DatabaseForm extends AbstractForm {
|
||||
File file = new File(stringToFile);
|
||||
if (file != null) {
|
||||
try {
|
||||
MyURLClassLoader cl = new MyURLClassLoader(file.toURL());
|
||||
MyURLClassLoader cl = new MyURLClassLoader(new URL[] {file.toURI().toURL()},this.getClass().getClassLoader());
|
||||
Class[] classes = cl.getAssignableClasses(Driver.class);
|
||||
for (Class classe : classes) {
|
||||
generalJdbcClassNameText.add(classe.getName());
|
||||
|
||||
@@ -27,6 +27,11 @@
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
</exclusion>
|
||||
<!-- for TUP-39614 -->
|
||||
<exclusion>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-core</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
@@ -44,7 +49,29 @@
|
||||
<artifactId>plexus-component-annotations</artifactId>
|
||||
<version>1.7.1</version>
|
||||
</dependency>
|
||||
|
||||
<!-- TUP-39924 start-->
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<version>3.6.0</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-archiver</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<version>1.7.36</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.enterprise</groupId>
|
||||
<artifactId>cdi-api</artifactId>
|
||||
<version>1.2</version>
|
||||
</dependency>
|
||||
<!-- TUP-39924 end -->
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
@@ -102,6 +129,56 @@
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>copy-artifact</id>
|
||||
<phase>generate-sources</phase>
|
||||
<goals>
|
||||
<goal>copy</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<artifactItems>
|
||||
<artifactItem>
|
||||
<groupId>org.junit</groupId>
|
||||
<artifactId>junit-bom</artifactId>
|
||||
<version>5.9.3</version>
|
||||
<type>pom</type>
|
||||
<overWrite>false</overWrite>
|
||||
<outputDirectory>${project.basedir}/tmp/org/junit/junit-bom/5.9.3</outputDirectory>
|
||||
</artifactItem>
|
||||
<artifactItem>
|
||||
<groupId>org.junit</groupId>
|
||||
<artifactId>junit-bom</artifactId>
|
||||
<version>5.7.2</version>
|
||||
<type>pom</type>
|
||||
<overWrite>false</overWrite>
|
||||
<outputDirectory>${project.basedir}/tmp/org/junit/junit-bom/5.7.2</outputDirectory>
|
||||
</artifactItem>
|
||||
<artifactItem>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-bom</artifactId>
|
||||
<version>4.0.0-alpha-5</version>
|
||||
<type>pom</type>
|
||||
<overWrite>false</overWrite>
|
||||
<outputDirectory>${project.basedir}/tmp/org/apache/maven/maven-bom/4.0.0-alpha-5</outputDirectory>
|
||||
</artifactItem>
|
||||
<artifactItem>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-io</artifactId>
|
||||
<version>3.2.0</version>
|
||||
<type>jar</type>
|
||||
<overWrite>false</overWrite>
|
||||
<outputDirectory>${project.basedir}/tmp/org/codehaus/plexus/plexus-io/3.2.0</outputDirectory>
|
||||
</artifactItem>
|
||||
</artifactItems>
|
||||
<outputDirectory>${project.basedir}/tmp</outputDirectory>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-antrun-plugin</artifactId>
|
||||
|
||||
@@ -12,40 +12,106 @@
|
||||
// ============================================================================
|
||||
package org.talend.utils;
|
||||
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
/*
|
||||
* Created by bhe on Dec 24, 2019
|
||||
*/
|
||||
public class JavaVersion implements Comparable<JavaVersion> {
|
||||
|
||||
private int major, minor, security;
|
||||
private static final Logger LOGGER = Logger.getLogger(JavaVersion.class.getCanonicalName());
|
||||
|
||||
private int major, minor, buildNumber, security;
|
||||
|
||||
public JavaVersion(String v) {
|
||||
parseVersion(v);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the major
|
||||
*/
|
||||
public int getMajor() {
|
||||
return major;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the minor
|
||||
*/
|
||||
public int getMinor() {
|
||||
return minor;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the buildNumber
|
||||
*/
|
||||
public int getBuildNumber() {
|
||||
return buildNumber;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the security
|
||||
*/
|
||||
public int getSecurity() {
|
||||
return security;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(JavaVersion o) {
|
||||
if (this.major - o.major == 0) {
|
||||
if (this.minor - o.minor == 0) {
|
||||
return this.security - o.security;
|
||||
if (this.buildNumber - o.buildNumber == 0) {
|
||||
return this.security - o.security;
|
||||
}
|
||||
return this.buildNumber - o.buildNumber;
|
||||
}
|
||||
return this.minor - o.minor;
|
||||
}
|
||||
return this.major - o.major;
|
||||
}
|
||||
|
||||
private String normalizeVersion(String v) {
|
||||
v = v.replaceAll("[^\\d._]", "");
|
||||
if (v.isEmpty()) {
|
||||
v = "0";
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
private void parseVersion(String v) {
|
||||
if (v == null || v.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
String[] version = v.split("[\\._]");
|
||||
this.major = Integer.parseInt(version[0]);
|
||||
if (version.length > 1) {
|
||||
this.minor = Integer.parseInt(version[1]);
|
||||
|
||||
try {
|
||||
this.major = Integer.parseInt(normalizeVersion(version[0]));
|
||||
} catch (Exception e) {
|
||||
LOGGER.log(Level.WARNING, "Major version parse error of " + v, e);
|
||||
}
|
||||
if (version.length > 2) {
|
||||
|
||||
if (version.length > 1 && !StringUtils.isEmpty(version[1])) {
|
||||
try {
|
||||
this.minor = Integer.parseInt(normalizeVersion(version[1]));
|
||||
} catch (Exception e) {
|
||||
LOGGER.log(Level.WARNING, "Minor version parse error of " + v, e);
|
||||
}
|
||||
}
|
||||
|
||||
if (version.length > 2 && !StringUtils.isEmpty(version[2])) {
|
||||
try {
|
||||
this.buildNumber = Integer.parseInt(normalizeVersion(version[2]));
|
||||
} catch (Exception e) {
|
||||
LOGGER.log(Level.WARNING, "Build number parse error of " + v, e);
|
||||
}
|
||||
}
|
||||
|
||||
if (version.length > 3 && !StringUtils.isEmpty(version[3])) {
|
||||
// strip non number part if any
|
||||
String securityNumber = version[version.length - 1];
|
||||
String securityNumber = version[3];
|
||||
for (int i = 0; i < securityNumber.length(); i++) {
|
||||
char c = securityNumber.charAt(i);
|
||||
if (c > '9' || c < '0') {
|
||||
@@ -53,8 +119,11 @@ public class JavaVersion implements Comparable<JavaVersion> {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
this.security = Integer.parseInt(securityNumber);
|
||||
try {
|
||||
this.security = Integer.parseInt(securityNumber);
|
||||
} catch (Exception e) {
|
||||
LOGGER.log(Level.WARNING, "Security version parse error of " + v, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,6 +132,7 @@ public class JavaVersion implements Comparable<JavaVersion> {
|
||||
int result = 1;
|
||||
result = result * prime + this.major;
|
||||
result = result * prime + this.minor;
|
||||
result = result * prime + this.buildNumber;
|
||||
result = result * prime + this.security;
|
||||
return result;
|
||||
}
|
||||
@@ -84,10 +154,11 @@ public class JavaVersion implements Comparable<JavaVersion> {
|
||||
sb.append(".");
|
||||
sb.append(this.minor);
|
||||
sb.append(".");
|
||||
if (this.major == 1) {
|
||||
sb.append("0_");
|
||||
sb.append(this.buildNumber);
|
||||
if (this.security > 0) {
|
||||
sb.append("_");
|
||||
sb.append(this.security);
|
||||
}
|
||||
sb.append(this.security);
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -32,10 +32,14 @@ public class StudioKeysFileCheck {
|
||||
|
||||
private static final String JAVA_VERSION_PROP = "java.version";
|
||||
|
||||
private static final String JAVA_VERSION_MINIMAL_STRING = "1.8.0_161";
|
||||
public static final String JAVA_VERSION_MINIMAL_STRING = "1.8.0_161";
|
||||
|
||||
private static final JavaVersion JAVA_VERSION_MINIMAL = new JavaVersion(JAVA_VERSION_MINIMAL_STRING);
|
||||
|
||||
public static final String JAVA_VERSION_MAXIMUM_STRING = "11";
|
||||
|
||||
private static final JavaVersion JAVA_VERSION_MAXIMUM = new JavaVersion(JAVA_VERSION_MAXIMUM_STRING);
|
||||
|
||||
private StudioKeysFileCheck() {
|
||||
|
||||
}
|
||||
@@ -64,11 +68,24 @@ public class StudioKeysFileCheck {
|
||||
String currentVersion = System.getProperty(JAVA_VERSION_PROP);
|
||||
JavaVersion cv = new JavaVersion(currentVersion);
|
||||
if (cv.compareTo(JAVA_VERSION_MINIMAL) < 0) {
|
||||
RuntimeException e = new RuntimeException(
|
||||
VersionException e = new VersionException(VersionException.ERR_JAVA_VERSION_UPGRADE_REQUIRED,
|
||||
"Java upgrade required, minimal required java version is " + JAVA_VERSION_MINIMAL_STRING
|
||||
+ ", current version is " + currentVersion);
|
||||
LOGGER.error(e);
|
||||
LOGGER.error(e.getMessage(), e);
|
||||
throw e;
|
||||
}
|
||||
|
||||
JavaVersion currentMajor = new JavaVersion(String.valueOf(cv.getMajor()));
|
||||
if (currentMajor.compareTo(JAVA_VERSION_MAXIMUM) > 0) {
|
||||
VersionException e = new VersionException(VersionException.ERR_JAVA_VERSION_NOT_SUPPORTED,
|
||||
"The maximum Java version supported by Studio is " + JAVA_VERSION_MAXIMUM_STRING
|
||||
+ ". Your current version is " + currentVersion);
|
||||
LOGGER.error(e.getMessage(), e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
public static String getJavaVersion() {
|
||||
return System.getProperty(JAVA_VERSION_PROP);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2023 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.utils;
|
||||
|
||||
/**
|
||||
* @author PCW created on Nov 20, 2023
|
||||
*
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class VersionException extends RuntimeException {
|
||||
|
||||
public static final int ERR_JAVA_VERSION_UPGRADE_REQUIRED = 0;
|
||||
|
||||
public static final int ERR_JAVA_VERSION_NOT_SUPPORTED = 1;
|
||||
|
||||
private int errID;
|
||||
|
||||
public VersionException(String msg) {
|
||||
super(msg);
|
||||
}
|
||||
|
||||
public VersionException(int errID, String msg) {
|
||||
this(msg);
|
||||
this.errID = errID;
|
||||
}
|
||||
|
||||
public int getErrID() {
|
||||
return this.errID;
|
||||
}
|
||||
|
||||
public boolean requireUpgrade() {
|
||||
return this.errID == ERR_JAVA_VERSION_UPGRADE_REQUIRED;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user