Compare commits
7 Commits
patchrelea
...
bugfix/mai
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5bfdb83188 | ||
|
|
92b7c835d0 | ||
|
|
a5614fcd2d | ||
|
|
26c42d5768 | ||
|
|
9722fc3b42 | ||
|
|
aaab1123c0 | ||
|
|
4508bfe46b |
@@ -150,6 +150,28 @@ public class NetworkUtil {
|
||||
|
||||
@Override
|
||||
protected PasswordAuthentication getPasswordAuthentication() {
|
||||
String httpProxyHost = System.getProperty("http.proxyHost"); //$NON-NLS-1$
|
||||
String httpProxyPort = System.getProperty("http.proxyPort"); //$NON-NLS-1$
|
||||
String httpsProxyHost = System.getProperty("https.proxyHost"); //$NON-NLS-1$
|
||||
String httpsProxyPort = System.getProperty("https.proxyPort"); //$NON-NLS-1$
|
||||
String requestingHost = getRequestingHost();
|
||||
int requestingPort = getRequestingPort();
|
||||
String proxyHost = null;
|
||||
String proxyPort = null;
|
||||
boolean isHttp = false;
|
||||
if ("http".equalsIgnoreCase(getRequestingScheme())) {
|
||||
isHttp = true;
|
||||
}
|
||||
if (isHttp && StringUtils.isNotBlank(httpProxyHost)) {
|
||||
proxyHost = httpProxyHost;
|
||||
proxyPort = httpProxyPort;
|
||||
} else {
|
||||
proxyHost = httpsProxyHost;
|
||||
proxyPort = httpsProxyPort;
|
||||
}
|
||||
if (!StringUtils.equals(proxyHost, requestingHost) || !StringUtils.equals(proxyPort, "" + requestingPort)) {
|
||||
return null;
|
||||
}
|
||||
String httpProxyUser = System.getProperty("http.proxyUser"); //$NON-NLS-1$
|
||||
String httpProxyPassword = System.getProperty("http.proxyPassword"); //$NON-NLS-1$
|
||||
String httpsProxyUser = System.getProperty("https.proxyUser"); //$NON-NLS-1$
|
||||
@@ -167,7 +189,11 @@ public class NetworkUtil {
|
||||
proxyPassword = httpsProxyPassword.toCharArray();
|
||||
}
|
||||
}
|
||||
return new PasswordAuthentication(proxyUser, proxyPassword);
|
||||
if (StringUtils.isBlank(proxyUser)) {
|
||||
return null;
|
||||
} else {
|
||||
return new PasswordAuthentication(proxyUser, proxyPassword);
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
@@ -132,6 +132,7 @@ 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.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.service.ICoreUIService;
|
||||
@@ -2140,6 +2141,14 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
|
||||
|
||||
ProjectDataJsonProvider.checkAndRectifyRelationShipSetting(project.getEmfProject());
|
||||
|
||||
// load additional jdbc
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IGenericWizardService.class)) {
|
||||
IGenericWizardService service = GlobalServiceRegister.getDefault().getService(IGenericWizardService.class);
|
||||
if (service != null) {
|
||||
service.loadAdditionalJDBC();
|
||||
}
|
||||
}
|
||||
|
||||
// init dynamic distirbution after `beforeLogon`, before loading libraries.
|
||||
initDynamicDistribution(monitor);
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ import org.talend.core.database.EDatabaseTypeName;
|
||||
import org.talend.core.database.conn.version.EDatabaseVersion4Drivers;
|
||||
import org.talend.core.model.repository.ERepositoryObjectType;
|
||||
import org.talend.core.runtime.services.IGenericDBService;
|
||||
import org.talend.core.runtime.services.IGenericWizardService;
|
||||
|
||||
/**
|
||||
* cli class global comment. Detailled comment
|
||||
@@ -326,6 +327,16 @@ public enum EDatabaseConnTemplate {
|
||||
databaseType.add(typeName);
|
||||
}
|
||||
}
|
||||
// add additional jdbc (actually JDBC RepositoryObjectType)
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IGenericWizardService.class)) {
|
||||
IGenericWizardService service = GlobalServiceRegister.getDefault().getService(IGenericWizardService.class);
|
||||
if (service != null) {
|
||||
List<String> allAdditionalJDBCTypes = service.getAllAdditionalJDBCTypes();
|
||||
if (!allAdditionalJDBCTypes.isEmpty()) {
|
||||
databaseType.addAll(allAdditionalJDBCTypes);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (sort) {
|
||||
String[] sortedArray = databaseType.toArray(new String[0]);
|
||||
Arrays.sort(sortedArray, new Comparator<String>() {
|
||||
|
||||
@@ -31,6 +31,7 @@ import org.talend.core.database.conn.ConnParameterKeys;
|
||||
import org.talend.core.database.conn.DatabaseConnStrUtil;
|
||||
import org.talend.core.database.conn.version.EDatabaseVersion4Drivers;
|
||||
import org.talend.core.model.components.EComponentType;
|
||||
import org.talend.core.model.metadata.Dbms;
|
||||
import org.talend.core.model.metadata.IMetadataTable;
|
||||
import org.talend.core.model.metadata.MetadataTalendType;
|
||||
import org.talend.core.model.metadata.builder.ConvertionHelper;
|
||||
@@ -155,6 +156,17 @@ public class ComponentToRepositoryProperty {
|
||||
conn.setDbmsId(mapping);
|
||||
}
|
||||
}
|
||||
// set default mapping for additional jdbc
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IGenericWizardService.class)) {
|
||||
IGenericWizardService service = GlobalServiceRegister.getDefault().getService(IGenericWizardService.class);
|
||||
if (service != null) {
|
||||
Dbms dbms4AdditionalJDBC = service.getDbms4AdditionalJDBC(conn.getProductId());
|
||||
if (dbms4AdditionalJDBC != null) {
|
||||
conn.setDbmsId(dbms4AdditionalJDBC.getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
for (IElementParameter param : node.getElementParameters()) {
|
||||
String repositoryValue = param.getRepositoryValue();
|
||||
@@ -368,19 +380,18 @@ public class ComponentToRepositoryProperty {
|
||||
if (para.getRepositoryValue().endsWith(EDatabaseTypeName.GENERAL_JDBC.getProduct())) {
|
||||
connection.setDatabaseType(EDatabaseTypeName.GENERAL_JDBC.getProduct());
|
||||
connection.setProductId(EDatabaseTypeName.GENERAL_JDBC.getProduct());
|
||||
if (!node.getComponent().getDisplayName().equals(node.getComponent().getName())) {
|
||||
// additional JDBC e.g. Delta Lake
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IGenericWizardService.class)) {
|
||||
IGenericWizardService service = GlobalServiceRegister.getDefault()
|
||||
.getService(IGenericWizardService.class);
|
||||
if (service != null) {
|
||||
String database = service.getDatabseNameByNode(node);
|
||||
if (StringUtils.isNotBlank(database)) {
|
||||
connection.setProductId(database);
|
||||
}
|
||||
}
|
||||
|
||||
// additional JDBC e.g. Delta Lake
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IGenericWizardService.class)) {
|
||||
IGenericWizardService service = GlobalServiceRegister.getDefault()
|
||||
.getService(IGenericWizardService.class);
|
||||
if (service != null) {
|
||||
String database = service.getDatabseNameByNode(node);
|
||||
if (StringUtils.isNotBlank(database) && service.getIfAdditionalJDBCDBType(database)) {
|
||||
connection.setProductId(database);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1003,4 +1003,12 @@ public final class ProcessUtils {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isChildRouteProcess(IProcess process) {
|
||||
List n = process.getNodesOfType("tRouteInput");
|
||||
if (n!=null && n.size()!=0) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ package org.talend.core.model.utils;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.talend.core.GlobalServiceRegister;
|
||||
import org.talend.core.model.metadata.builder.connection.Connection;
|
||||
import org.talend.core.model.metadata.builder.connection.DatabaseConnection;
|
||||
import org.talend.core.model.metadata.designerproperties.RepositoryToComponentProperty;
|
||||
@@ -23,6 +24,7 @@ import org.talend.core.model.properties.ContextItem;
|
||||
import org.talend.core.model.properties.Item;
|
||||
import org.talend.core.model.repository.ERepositoryObjectType;
|
||||
import org.talend.core.model.update.UpdatesConstants;
|
||||
import org.talend.core.runtime.services.IGenericWizardService;
|
||||
|
||||
/**
|
||||
* ggu class global comment. Detailled comment
|
||||
@@ -47,6 +49,14 @@ public final class UpdateRepositoryHelper {
|
||||
if (connection instanceof DatabaseConnection) {
|
||||
String currentDbType = (String) RepositoryToComponentProperty.getValue(connection, UpdatesConstants.TYPE,
|
||||
null);
|
||||
String productId = ((DatabaseConnection) connection).getProductId();
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IGenericWizardService.class)) {
|
||||
IGenericWizardService service = GlobalServiceRegister.getDefault()
|
||||
.getService(IGenericWizardService.class);
|
||||
if (service != null && service.getIfAdditionalJDBCDBType(productId)) {
|
||||
currentDbType = productId;
|
||||
}
|
||||
}
|
||||
aliasName += " (" + currentDbType + ")"; //$NON-NLS-1$ //$NON-NLS-2$
|
||||
}
|
||||
if (repositoryObjectType.getType().equals("SERVICES")) {
|
||||
|
||||
@@ -20,6 +20,7 @@ import org.eclipse.swt.widgets.Composite;
|
||||
import org.talend.commons.ui.swt.actions.ITreeContextualAction;
|
||||
import org.talend.components.api.properties.ComponentProperties;
|
||||
import org.talend.core.IService;
|
||||
import org.talend.core.model.metadata.Dbms;
|
||||
import org.talend.core.model.metadata.IMetadataTable;
|
||||
import org.talend.core.model.metadata.builder.connection.Connection;
|
||||
import org.talend.core.model.metadata.builder.connection.DatabaseConnection;
|
||||
@@ -149,13 +150,18 @@ public interface IGenericWizardService extends IService {
|
||||
*/
|
||||
public ITreeContextualAction getDefaultAction(RepositoryNode node);
|
||||
|
||||
public void initAdditionalJDBCRepositoryObjType();
|
||||
public void loadAdditionalJDBC();
|
||||
|
||||
public List<String> getAllAdditionalJDBCTypes();
|
||||
|
||||
public boolean getIfAdditionalJDBCDBType(String dbType);
|
||||
|
||||
public void initAdditonalJDBCConnectionValue(DatabaseConnection connection, Composite dynamicForm, String dbType,
|
||||
String propertyId);
|
||||
|
||||
public String getDefinitionName4AdditionalJDBC(IElement element);
|
||||
|
||||
public String getDatabseNameByNode(IElement node);
|
||||
|
||||
public Dbms getDbms4AdditionalJDBC(String typeName);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2019 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.core.runtime.util;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.talend.commons.exception.ExceptionHandler;
|
||||
import org.talend.core.GlobalServiceRegister;
|
||||
import org.talend.core.service.IUpdateService;
|
||||
import org.talend.utils.io.FilesUtils;
|
||||
|
||||
public class SharedStudioUtils {
|
||||
|
||||
public static final String FILE_EXTRA_FEATURE_INDEX = "extra_feature.index"; //$NON-NLS-1$
|
||||
|
||||
public static final String SIGNATURE_FILE_NAME_SUFFIX = ".sig"; //$NON-NLS-1$
|
||||
|
||||
public static boolean updateExtraFeatureFile() {
|
||||
File userConfigFolder = new File(Platform.getConfigurationLocation().getURL().getPath());
|
||||
File studioConfigFolder = new File(Platform.getInstallLocation().getURL().getPath(), "configuration");//$NON-NLS-1$
|
||||
if (!userConfigFolder.getAbsolutePath().equals(studioConfigFolder.getAbsolutePath())) {
|
||||
File studioExtraFile = new File(studioConfigFolder, FILE_EXTRA_FEATURE_INDEX);
|
||||
File studioExtraSignFile = new File(studioConfigFolder, FILE_EXTRA_FEATURE_INDEX + SIGNATURE_FILE_NAME_SUFFIX);
|
||||
File userExtraFile = new File(userConfigFolder, FILE_EXTRA_FEATURE_INDEX);
|
||||
File userExtraSignFile = new File(userConfigFolder, FILE_EXTRA_FEATURE_INDEX + SIGNATURE_FILE_NAME_SUFFIX);
|
||||
boolean isNeedUpdate = false;
|
||||
if (!studioExtraSignFile.exists() && userExtraSignFile.exists()) {
|
||||
userExtraSignFile.delete();
|
||||
if (userExtraFile.exists()) {
|
||||
userExtraFile.delete();
|
||||
}
|
||||
return true;
|
||||
} else if (studioExtraSignFile.exists()) {
|
||||
isNeedUpdate = true;
|
||||
}
|
||||
if (isNeedUpdate) {
|
||||
try {
|
||||
FilesUtils.copyFile(studioExtraFile, userExtraFile);
|
||||
FilesUtils.copyFile(studioExtraSignFile, userExtraSignFile);
|
||||
} catch (IOException ex) {
|
||||
ExceptionHandler.process(ex);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isSharedStudioMode() {
|
||||
File configFolder = new File (Platform.getConfigurationLocation().getURL().getFile());
|
||||
File studioFolder = new File (Platform.getInstallLocation().getURL().getFile());
|
||||
if (configFolder != null && studioFolder != null && configFolder.getParentFile() != null
|
||||
&& configFolder.getParentFile().getAbsolutePath().equals(studioFolder.getAbsolutePath())) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean installedPatch() {
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IUpdateService.class)) {
|
||||
IUpdateService updateService = GlobalServiceRegister.getDefault().getService(IUpdateService.class);
|
||||
try {
|
||||
return updateService.syncSharedStudioLibraryInPatch(new NullProgressMonitor());
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -20,5 +20,7 @@ public interface IUpdateService extends IService {
|
||||
boolean checkComponentNexusUpdate();
|
||||
|
||||
void syncComponentM2Jars(IProgressMonitor monitor);
|
||||
|
||||
public boolean syncSharedStudioLibraryInPatch(IProgressMonitor monitor) throws Exception;
|
||||
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
package org.talend.core.ui;
|
||||
|
||||
import org.talend.core.IService;
|
||||
import org.talend.core.runtime.maven.MavenArtifact;
|
||||
|
||||
/**
|
||||
* @author hwang
|
||||
@@ -21,5 +22,7 @@ import org.talend.core.IService;
|
||||
public interface IInstalledPatchService extends IService {
|
||||
|
||||
public String getLatestInstalledVersion(boolean isBar);
|
||||
|
||||
public MavenArtifact getLastIntalledP2Patch();
|
||||
|
||||
}
|
||||
|
||||
@@ -91,6 +91,10 @@ public class PluginUtil {
|
||||
return "org.talend.camel.testcontainer.ui.editor.CamelTestContainerMultiPageEditor".equals(getActiveEditorId()); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
public static boolean isRouteletEditor() {
|
||||
return "org.talend.repository.routelets.editor.RouteletMultiPageTalendEditor".equals(getActiveEditorId()); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
/**
|
||||
* DOC yyan Get active editor ID.
|
||||
*
|
||||
|
||||
@@ -45,6 +45,7 @@ import org.talend.core.model.utils.JavaResourcesHelper;
|
||||
import org.talend.core.runtime.maven.MavenArtifact;
|
||||
import org.talend.core.runtime.maven.MavenConstants;
|
||||
import org.talend.core.runtime.maven.MavenUrlHelper;
|
||||
import org.talend.core.runtime.process.LastGenerationInfo;
|
||||
import org.talend.core.runtime.process.TalendProcessArgumentConstant;
|
||||
import org.talend.core.runtime.projectsetting.IProjectSettingTemplateConstants;
|
||||
import org.talend.core.runtime.repository.build.IMavenPomCreator;
|
||||
@@ -52,6 +53,7 @@ import org.talend.core.ui.ITestContainerProviderService;
|
||||
import org.talend.designer.maven.model.TalendMavenConstants;
|
||||
import org.talend.designer.maven.template.ETalendMavenVariables;
|
||||
import org.talend.designer.maven.tools.ProcessorDependenciesManager;
|
||||
import org.talend.designer.maven.utils.JobUtils;
|
||||
import org.talend.designer.maven.utils.PomIdsHelper;
|
||||
import org.talend.designer.maven.utils.PomUtil;
|
||||
import org.talend.designer.runprocess.IBigDataProcessor;
|
||||
@@ -134,9 +136,16 @@ public abstract class AbstractMavenProcessorPom extends CreateMavenBundleTemplat
|
||||
|
||||
Map<ETalendMavenVariables, String> variablesValuesMap = new HashMap<ETalendMavenVariables, String>();
|
||||
// no need check property is null or not, because if null, will get default ids.
|
||||
variablesValuesMap.put(ETalendMavenVariables.JobGroupId, PomIdsHelper.getJobGroupId(property));
|
||||
variablesValuesMap.put(ETalendMavenVariables.JobArtifactId, PomIdsHelper.getJobArtifactId(property));
|
||||
variablesValuesMap.put(ETalendMavenVariables.JobVersion, PomIdsHelper.getJobVersion(property));
|
||||
|
||||
if (JobUtils.isJob(property) && ProcessUtils.isChildRouteProcess(process)) {
|
||||
JobInfo lastMainJob = LastGenerationInfo.getInstance().getLastMainJob();
|
||||
variablesValuesMap.put(ETalendMavenVariables.JobGroupId, PomIdsHelper.getJobGroupId(lastMainJob.getProcessor().getProperty()));
|
||||
variablesValuesMap.put(ETalendMavenVariables.JobVersion, PomIdsHelper.getJobVersion(lastMainJob.getProcessor().getProperty()));
|
||||
}else {
|
||||
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);
|
||||
|
||||
@@ -19,11 +19,14 @@ import java.util.Set;
|
||||
|
||||
import org.talend.commons.exception.PersistenceException;
|
||||
import org.talend.core.GlobalServiceRegister;
|
||||
import org.talend.core.model.process.INode;
|
||||
import org.talend.core.model.process.IProcess;
|
||||
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.ProcessItem;
|
||||
import org.talend.core.model.properties.Property;
|
||||
import org.talend.core.model.repository.ERepositoryObjectType;
|
||||
import org.talend.core.model.repository.IRepositoryViewObject;
|
||||
import org.talend.core.model.utils.JavaResourcesHelper;
|
||||
import org.talend.core.runtime.CoreRuntimePlugin;
|
||||
@@ -97,5 +100,22 @@ public class JobUtils {
|
||||
}
|
||||
return clonedJobInfos;
|
||||
}
|
||||
|
||||
public static boolean isJob(JobInfo job) {
|
||||
if (job != null && job.getProcessItem() != null) {
|
||||
Property p = job.getProcessItem().getProperty();
|
||||
if (p != null) {
|
||||
return isJob(p);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isJob(Property p) {
|
||||
if (p != null) {
|
||||
return ERepositoryObjectType.getType(p).equals(ERepositoryObjectType.PROCESS);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -247,6 +247,17 @@ public class PomIdsHelper {
|
||||
return version;
|
||||
}
|
||||
|
||||
public static String getCustomJobVersion(Property property) {
|
||||
String version = null;
|
||||
if (property != null) {
|
||||
if (property.getAdditionalProperties() != null) {
|
||||
version = (String) property.getAdditionalProperties().get(MavenConstants.NAME_USER_VERSION);
|
||||
}
|
||||
}
|
||||
return version;
|
||||
}
|
||||
|
||||
|
||||
public static String getJobVersion(JobInfo jobInfo) {
|
||||
if (jobInfo != null) {
|
||||
return jobInfo.getJobVersion();
|
||||
|
||||
@@ -41,6 +41,7 @@ public class LocaleProvider {
|
||||
|
||||
}
|
||||
|
||||
//though not thread safe here, but we syn in the client side, so ok
|
||||
public static Locale getLocale(String languageOrCountyCode) {
|
||||
if (cache == null) {
|
||||
initCache();
|
||||
@@ -72,7 +73,11 @@ public class LocaleProvider {
|
||||
key = language;
|
||||
}
|
||||
if (key != null) {
|
||||
cache.put(key.toLowerCase(), locale);
|
||||
String k = key.toLowerCase();
|
||||
Locale old = cache.put(k, locale);
|
||||
if(old != null && old.getCountry() !=null && old.getCountry().equalsIgnoreCase(old.getLanguage())) {
|
||||
cache.put(k, old);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,9 +72,6 @@ public class ResumeUtil {
|
||||
if (sharedWriter == null) {
|
||||
this.csvWriter = new SimpleCsvWriter(new FileWriter(logFileName, createNewFile));
|
||||
|
||||
// shared
|
||||
sharedWriterMap.put(this.root_pid, this.csvWriter);
|
||||
|
||||
// output the header part
|
||||
if (file.length() == 0) {
|
||||
if (genDynamicPart) {
|
||||
@@ -100,7 +97,12 @@ public class ResumeUtil {
|
||||
csvWriter.write("dynamicData");// dynamicData
|
||||
csvWriter.endRecord();
|
||||
csvWriter.flush();
|
||||
csvWriter.close();
|
||||
// To avoid use File.delete() as it cannot make sure file being deleted.
|
||||
this.csvWriter = new SimpleCsvWriter(new FileWriter(logFileName, true));
|
||||
}
|
||||
// shared
|
||||
sharedWriterMap.put(this.root_pid, this.csvWriter);
|
||||
} else {
|
||||
csvWriter = sharedWriter;
|
||||
}
|
||||
|
||||
@@ -912,7 +912,13 @@ public class LocalLibraryManager implements ILibraryManagerService, IChangedLibr
|
||||
fileToDeploy = null;
|
||||
found = false;
|
||||
}
|
||||
if (!found) {
|
||||
boolean isCIMode = false;
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IRunProcessService.class)) {
|
||||
IRunProcessService runProcessService = GlobalServiceRegister.getDefault()
|
||||
.getService(IRunProcessService.class);
|
||||
isCIMode = runProcessService.isCIMode();
|
||||
}
|
||||
if (!found && !isCIMode) {
|
||||
ExceptionHandler.log("missing jar:" + module.getModuleName());
|
||||
}
|
||||
if (fileToDeploy != null) {
|
||||
|
||||
@@ -40,8 +40,8 @@ import org.eclipse.ui.PlatformUI;
|
||||
import org.osgi.service.prefs.BackingStoreException;
|
||||
import org.osgi.service.prefs.Preferences;
|
||||
import org.talend.commons.exception.BusinessException;
|
||||
import org.talend.commons.runtime.helper.LocalComponentInstallHelper;
|
||||
import org.talend.commons.exception.ExceptionHandler;
|
||||
import org.talend.commons.runtime.helper.LocalComponentInstallHelper;
|
||||
import org.talend.commons.runtime.helper.PatchComponentHelper;
|
||||
import org.talend.commons.runtime.service.ComponentsInstallComponent;
|
||||
import org.talend.commons.runtime.service.PatchComponent;
|
||||
@@ -57,6 +57,7 @@ import org.talend.core.model.migration.IMigrationToolService;
|
||||
import org.talend.core.model.utils.TalendPropertiesUtil;
|
||||
import org.talend.core.repository.CoreRepositoryPlugin;
|
||||
import org.talend.core.runtime.services.IMavenUIService;
|
||||
import org.talend.core.runtime.util.SharedStudioUtils;
|
||||
import org.talend.core.services.ICoreTisService;
|
||||
import org.talend.core.ui.branding.IBrandingService;
|
||||
import org.talend.core.ui.workspace.ChooseWorkspaceData;
|
||||
@@ -94,7 +95,7 @@ public class Application implements IApplication {
|
||||
@SuppressWarnings("restriction")
|
||||
@Override
|
||||
public Object start(IApplicationContext context) throws Exception {
|
||||
if (Boolean.getBoolean(EclipseCommandLine.PROP_TALEND_BUNDLES_DO_CLEAN)) {
|
||||
if (SharedStudioUtils.installedPatch() || Boolean.getBoolean(EclipseCommandLine.PROP_TALEND_BUNDLES_DO_CLEAN)) {
|
||||
System.setProperty(EclipseCommandLine.PROP_TALEND_BUNDLES_DO_CLEAN, Boolean.FALSE.toString());
|
||||
EclipseCommandLine.updateOrCreateExitDataPropertyWithCommand(EclipseCommandLine.CLEAN, null, false);
|
||||
EclipseCommandLine.updateOrCreateExitDataPropertyWithCommand(EclipseCommandLine.ARG_TALEND_BUNDLES_CLEANED,
|
||||
|
||||
@@ -31,7 +31,8 @@ Require-Bundle: org.eclipse.core.runtime,
|
||||
org.eclipse.ui.forms,
|
||||
org.talend.core.repository,
|
||||
org.talend.core,
|
||||
org.talend.utils
|
||||
org.talend.utils,
|
||||
org.talend.libraries.jackson
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Service-Component: OSGI-INF/components_install.xml
|
||||
Export-Package: org.talend.updates.runtime,
|
||||
|
||||
@@ -25,6 +25,8 @@ public interface ITaCoKitCarFeature extends ExtraFeature {
|
||||
File getCarFile(IProgressMonitor progress) throws Exception;
|
||||
|
||||
void setAutoReloadAfterInstalled(boolean autoReload);
|
||||
|
||||
void setDeployCommand(boolean isDeployCommand);
|
||||
|
||||
boolean isAutoReloadAfterInstalled();
|
||||
|
||||
|
||||
@@ -38,6 +38,8 @@ public interface ITaCoKitUpdateService extends IService {
|
||||
|
||||
ICarInstallationResult installCars(Collection<File> files, boolean share, IProgressMonitor monitor) throws Exception;
|
||||
|
||||
ICarInstallationResult deployCars(Collection<File> files, boolean share, IProgressMonitor monitor) throws Exception;
|
||||
|
||||
ICarInstallationResult installCarFeatures(Collection<ITaCoKitCarFeature> features, boolean share, IProgressMonitor monitor)
|
||||
throws Exception;
|
||||
|
||||
|
||||
@@ -0,0 +1,202 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2019 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.updates.runtime.service;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.talend.commons.exception.ExceptionHandler;
|
||||
import org.talend.commons.utils.resource.FileExtensions;
|
||||
import org.talend.core.GlobalServiceRegister;
|
||||
import org.talend.core.runtime.maven.MavenArtifact;
|
||||
import org.talend.core.ui.IInstalledPatchService;
|
||||
import org.talend.updates.runtime.utils.PathUtils;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude.Include;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
public class SharedStudioPatchInfoProvider {
|
||||
|
||||
private static final String INSTALLED_PATCH_RECORD_FILE = "installed_patch.json";
|
||||
|
||||
private static final String PATCH_TYPE_STUDIO = "studio";
|
||||
|
||||
private static final String PATCH_TYPE_CAR = "car";
|
||||
|
||||
private File dataFile = null;
|
||||
|
||||
private InstalledPatchInfo installedPatchInfo;
|
||||
|
||||
private static SharedStudioPatchInfoProvider instance;
|
||||
|
||||
private SharedStudioPatchInfoProvider() {
|
||||
File configFolder = new File(Platform.getConfigurationLocation().getURL().getFile());
|
||||
dataFile = new File(configFolder, INSTALLED_PATCH_RECORD_FILE);
|
||||
loadData();
|
||||
}
|
||||
|
||||
public static SharedStudioPatchInfoProvider getInstance() {
|
||||
if (instance == null) {
|
||||
synchronized (SharedStudioPatchInfoProvider.class) {
|
||||
if (instance == null) {
|
||||
instance = new SharedStudioPatchInfoProvider();
|
||||
}
|
||||
}
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
public boolean isInstalled(String patchName, String patchType) {
|
||||
for (InstalledPatch patchInfo : installedPatchInfo.getInstalledPatchList()) {
|
||||
if (StringUtils.equals(patchName, patchInfo.getFileName()) && StringUtils.equals(patchType, patchInfo.getType())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void installedStudioPatch(String patchName) {
|
||||
installedPatch(patchName, PATCH_TYPE_STUDIO);
|
||||
}
|
||||
|
||||
public void installedCarPatch(String patchName) {
|
||||
installedPatch(patchName, PATCH_TYPE_CAR);
|
||||
}
|
||||
|
||||
private void installedPatch(String patchName, String patchType) {
|
||||
if (!isInstalled(patchName, patchType)) {
|
||||
InstalledPatch patch = new InstalledPatch();
|
||||
patch.setFileName(patchName);
|
||||
patch.setType(patchType);
|
||||
installedPatchInfo.getInstalledPatchList().add(patch);
|
||||
saveData();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public File getNeedInstallStudioPatchFiles() {
|
||||
File patchFolder = PathUtils.getPatchesFolder();
|
||||
String patchName = getStudioInstalledLatestPatch();
|
||||
if (patchFolder.exists() && patchFolder.isDirectory() && patchName != null) {
|
||||
for (File file : patchFolder.listFiles()) {
|
||||
if (file.getName().startsWith(patchName) && file.getName().endsWith(FileExtensions.ZIP_FILE_SUFFIX)
|
||||
&& !isInstalled(file.getName(), PATCH_TYPE_STUDIO)) {
|
||||
return file;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<File> getNeedInstallCarFiles() {
|
||||
List<File> files = new ArrayList<File>();
|
||||
File patchFolder = PathUtils.getComponentsInstalledFolder();
|
||||
if (patchFolder.exists() && patchFolder.isDirectory()) {
|
||||
for (File file : patchFolder.listFiles()) {
|
||||
if (file.getName().endsWith(FileExtensions.CAR_EXTENSION) && !isInstalled(file.getName(), PATCH_TYPE_CAR)) {
|
||||
files.add(file);
|
||||
}
|
||||
}
|
||||
}
|
||||
return files;
|
||||
}
|
||||
|
||||
private String getStudioInstalledLatestPatch() {
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IInstalledPatchService.class)) {
|
||||
IInstalledPatchService installedPatchService = GlobalServiceRegister.getDefault()
|
||||
.getService(IInstalledPatchService.class);
|
||||
MavenArtifact artifact = installedPatchService.getLastIntalledP2Patch();
|
||||
if (artifact != null) {
|
||||
return artifact.getArtifactId();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void loadData() {
|
||||
TypeReference<InstalledPatchInfo> typeReference = new TypeReference<InstalledPatchInfo>() {
|
||||
// no need to overwrite
|
||||
};
|
||||
if (dataFile.exists()) {
|
||||
try {
|
||||
installedPatchInfo = new ObjectMapper().readValue(dataFile, typeReference);
|
||||
} catch (IOException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
if (installedPatchInfo == null) {
|
||||
installedPatchInfo = new InstalledPatchInfo();
|
||||
}
|
||||
}
|
||||
|
||||
private synchronized void saveData() {
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
try {
|
||||
if (!dataFile.exists()) {
|
||||
dataFile.createNewFile();
|
||||
}
|
||||
objectMapper.writerWithDefaultPrettyPrinter().writeValue(dataFile, installedPatchInfo);
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class InstalledPatchInfo {
|
||||
|
||||
@JsonProperty("installedPatch")
|
||||
private List<InstalledPatch> installedPatchList = new ArrayList<InstalledPatch>();
|
||||
|
||||
public List<InstalledPatch> getInstalledPatchList() {
|
||||
return installedPatchList;
|
||||
}
|
||||
|
||||
public void setInstalledPatchList(List<InstalledPatch> installedPatchList) {
|
||||
this.installedPatchList = installedPatchList;
|
||||
}
|
||||
}
|
||||
|
||||
class InstalledPatch {
|
||||
|
||||
@JsonInclude(Include.NON_DEFAULT)
|
||||
@JsonProperty("fileName")
|
||||
private String fileName;
|
||||
|
||||
@JsonInclude(Include.NON_DEFAULT)
|
||||
@JsonProperty("type")
|
||||
private String type;
|
||||
|
||||
public String getFileName() {
|
||||
return fileName;
|
||||
}
|
||||
|
||||
public void setFileName(String fileName) {
|
||||
this.fileName = fileName;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
}
|
||||
@@ -14,13 +14,17 @@ package org.talend.updates.runtime.service;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.codehaus.plexus.util.FileUtils;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
import org.talend.commons.utils.resource.FileExtensions;
|
||||
import org.talend.core.nexus.ArtifactRepositoryBean;
|
||||
import org.talend.core.runtime.util.SharedStudioUtils;
|
||||
import org.talend.core.service.IUpdateService;
|
||||
import org.talend.updates.runtime.engine.component.InstallComponentMessages;
|
||||
import org.talend.updates.runtime.engine.factory.ComponentsLocalNexusInstallFactory;
|
||||
@@ -30,12 +34,12 @@ import org.talend.updates.runtime.model.FeatureCategory;
|
||||
import org.talend.updates.runtime.nexus.component.ComponentIndexManager;
|
||||
import org.talend.updates.runtime.nexus.component.NexusServerManager;
|
||||
import org.talend.updates.runtime.utils.PathUtils;
|
||||
import org.talend.updates.runtime.utils.UpdateTools;
|
||||
import org.talend.utils.io.FilesUtils;
|
||||
|
||||
public class UpdateService implements IUpdateService {
|
||||
|
||||
private static Logger log = Logger.getLogger(UpdateService.class);
|
||||
|
||||
@Override
|
||||
public boolean checkComponentNexusUpdate() {
|
||||
IProgressMonitor monitor = new NullProgressMonitor();
|
||||
@@ -99,4 +103,45 @@ public class UpdateService implements IUpdateService {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean syncSharedStudioLibraryInPatch(IProgressMonitor monitor) throws Exception {
|
||||
boolean isNeedRestart = false;
|
||||
if (SharedStudioUtils.isSharedStudioMode()) {
|
||||
File studioPatch = SharedStudioPatchInfoProvider.getInstance().getNeedInstallStudioPatchFiles();
|
||||
if (studioPatch != null && studioPatch.getName().endsWith(FileExtensions.ZIP_FILE_SUFFIX)) {
|
||||
File tmpInstallFolder = File.createTempFile("StudioPatchInstaller", "");
|
||||
if (tmpInstallFolder.exists()) {
|
||||
tmpInstallFolder.delete();
|
||||
}
|
||||
tmpInstallFolder.mkdirs();
|
||||
FilesUtils.unzip(studioPatch.getAbsolutePath(), tmpInstallFolder.getAbsolutePath());
|
||||
UpdateTools.syncLibraries(tmpInstallFolder);
|
||||
UpdateTools.syncM2Repository(tmpInstallFolder);
|
||||
File carFolder = new File(tmpInstallFolder, ITaCoKitUpdateService.FOLDER_CAR);
|
||||
UpdateTools.deployCars(monitor, carFolder, false);
|
||||
SharedStudioPatchInfoProvider.getInstance().installedStudioPatch(studioPatch.getName());
|
||||
tmpInstallFolder.delete();
|
||||
isNeedRestart = true;
|
||||
}
|
||||
List<File> carFiles = SharedStudioPatchInfoProvider.getInstance().getNeedInstallCarFiles();
|
||||
if (carFiles.size() > 0) {
|
||||
File tmpInstallFolder = File.createTempFile("CarPatchInstaller", "");
|
||||
if (tmpInstallFolder.exists()) {
|
||||
tmpInstallFolder.delete();
|
||||
}
|
||||
tmpInstallFolder.mkdirs();
|
||||
for (File carFile : carFiles) {
|
||||
FileUtils.copyFile(carFile, new File (tmpInstallFolder, carFile.getName()));
|
||||
SharedStudioPatchInfoProvider.getInstance().installedCarPatch(carFile.getName());
|
||||
}
|
||||
UpdateTools.deployCars(monitor, tmpInstallFolder, false);
|
||||
tmpInstallFolder.delete();
|
||||
}
|
||||
if (isNeedRestart) {
|
||||
SharedStudioUtils.updateExtraFeatureFile();
|
||||
}
|
||||
}
|
||||
return isNeedRestart;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -81,7 +81,8 @@ public class PathUtils {
|
||||
}
|
||||
|
||||
public static File getComponentsFolder() throws IOException {
|
||||
File componentsFolder = new File(Platform.getConfigurationLocation().getDataArea(FOLDER_COMPS).getPath());
|
||||
File configurationFolder = new File(Platform.getInstallLocation().getURL().getPath(), "configuration"); //$NON-NLS-1$
|
||||
File componentsFolder = new File(configurationFolder, FOLDER_COMPS);
|
||||
if (!componentsFolder.exists()) {
|
||||
componentsFolder.mkdirs();
|
||||
}
|
||||
@@ -114,7 +115,12 @@ public class PathUtils {
|
||||
}
|
||||
|
||||
public static File getComponentsM2TempFolder() {
|
||||
return createComponentFolder(FOLDER_M2TEMP);
|
||||
File componentsFolder = new File(Platform.getConfigurationLocation().getURL().getFile(), FOLDER_COMPS);
|
||||
File m2TempFolder = new File(componentsFolder, FOLDER_M2TEMP);
|
||||
if (!m2TempFolder.exists()) {
|
||||
m2TempFolder.mkdirs();
|
||||
}
|
||||
return m2TempFolder;
|
||||
}
|
||||
|
||||
public static File getPatchesFolder() {
|
||||
|
||||
@@ -67,10 +67,50 @@ public class TaCoKitCarUtils {
|
||||
if (proxyMonitor == null) {
|
||||
proxyMonitor = new NullProgressMonitor();
|
||||
}
|
||||
|
||||
return tckUpdateService.installCars(fileList, false, proxyMonitor);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static ICarInstallationResult deployCars(File carFolder, final IProgressMonitor monitor, boolean cancellable)
|
||||
throws Exception {
|
||||
if (carFolder.exists()) {
|
||||
File[] files = carFolder.listFiles();
|
||||
if (files != null && 0 < files.length) {
|
||||
ITaCoKitUpdateService tckUpdateService = ITaCoKitUpdateService.getInstance();
|
||||
if (tckUpdateService == null) {
|
||||
throw new Exception(Messages.getString("ITaCoKitUpdateService.exception.notFound", //$NON-NLS-1$
|
||||
ITaCoKitUpdateService.class.getSimpleName()));
|
||||
}
|
||||
List<File> fileList = Arrays.asList(files);
|
||||
|
||||
IProgressMonitor proxyMonitor = monitor;
|
||||
if (monitor != null && !cancellable) {
|
||||
proxyMonitor = (IProgressMonitor) Proxy.newProxyInstance(monitor.getClass().getClassLoader(),
|
||||
new Class[] { IProgressMonitor.class }, new InvocationHandler() {
|
||||
|
||||
@Override
|
||||
public Object invoke(Object obj, Method method, Object[] args) throws Throwable {
|
||||
if (method == null) {
|
||||
return null;
|
||||
}
|
||||
if (StringUtils.equals(method.getName(), "isCanceled")) { //$NON-NLS-1$
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
return method.invoke(monitor, args);
|
||||
}
|
||||
});
|
||||
}
|
||||
if (proxyMonitor == null) {
|
||||
proxyMonitor = new NullProgressMonitor();
|
||||
}
|
||||
|
||||
return tckUpdateService.deployCars(fileList, false, proxyMonitor);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -206,6 +206,14 @@ public class UpdateTools {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean deployCars(IProgressMonitor monitor, File carFolder, boolean cancellable)
|
||||
throws Exception {
|
||||
if (carFolder != null && carFolder.exists()) {
|
||||
TaCoKitCarUtils.deployCars(carFolder, monitor, cancellable);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void syncLibraries(File installingPatchFolder) throws IOException {
|
||||
// sync to product lib/java
|
||||
|
||||
Reference in New Issue
Block a user