Compare commits

..

1 Commits

Author SHA1 Message Date
hwang
6e50548725 bugfix(TUP-23809):can not change the order 2019-07-13 15:14:19 +08:00
192 changed files with 2458 additions and 4693 deletions

View File

@@ -20,10 +20,8 @@
<import plugin="org.apache.servicemix.bundles.avro" version="0.0.0" match="greaterOrEqual"/>
<import plugin="org.junit" version="0.0.0" match="greaterOrEqual"/>
<import plugin="org.slf4j.api" version="0.0.0" match="greaterOrEqual"/>
<import plugin="org.apache.commons.configuration" version="2.0.0" match="greaterOrEqual"/>
</requires>
<plugin id="org.talend.daikon" download-size="0" install-size="0" version="0.0.0" unpack="false"/>
<plugin id="org.talend.daikon.exception" download-size="0" install-size="0" version="0.0.0" unpack="false"/>
<plugin id="org.talend.daikon.crypto.utils" download-size="0" install-size="0" version="0.0.0" unpack="false"/>
<plugin id="org.talend.utils" download-size="0" install-size="0" version="0.0.0" unpack="false"/>
</feature>

View File

@@ -21,25 +21,29 @@ import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.DESKeySpec;
import org.apache.commons.codec.binary.Base64;
import org.talend.utils.security.StudioEncryption;
import org.talend.utils.security.AESEncryption;
/**
* DOC chuang class global comment. Detailled comment
*/
public class PasswordEncryptUtil {
public static final String ENCRYPT_KEY = "Encrypt"; //$NON-NLS-1$
public static String ENCRYPT_KEY = "Encrypt"; //$NON-NLS-1$
private static final String RAWKEY = "Talend-Key"; //$NON-NLS-1$
private static String rawKey = "Talend-Key"; //$NON-NLS-1$
public static String PREFIX_PASSWORD = "ENC:["; //$NON-NLS-1$
public static String POSTFIX_PASSWORD = "]"; //$NON-NLS-1$
private static SecretKey key = null;
private static final SecureRandom SECURERANDOM = new SecureRandom();
private static SecureRandom secureRandom = new SecureRandom();
private static SecretKey getSecretKey() throws Exception {
if (key == null) {
byte rawKeyData[] = RAWKEY.getBytes();
byte rawKeyData[] = rawKey.getBytes();
DESKeySpec dks = new DESKeySpec(rawKeyData);
SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DES"); //$NON-NLS-1$
key = keyFactory.generateSecret(dks);
@@ -61,7 +65,7 @@ public class PasswordEncryptUtil {
SecretKey key = getSecretKey();
Cipher c = Cipher.getInstance("DES"); //$NON-NLS-1$
c.init(Cipher.ENCRYPT_MODE, key, SECURERANDOM);
c.init(Cipher.ENCRYPT_MODE, key, secureRandom);
byte[] cipherByte = c.doFinal(input.getBytes());
String dec = new String(Base64.encodeBase64(cipherByte));
return dec;
@@ -81,7 +85,7 @@ public class PasswordEncryptUtil {
byte[] dec = Base64.decodeBase64(input.getBytes());
SecretKey key = getSecretKey();
Cipher c = Cipher.getInstance("DES"); //$NON-NLS-1$
c.init(Cipher.DECRYPT_MODE, key, SECURERANDOM);
c.init(Cipher.DECRYPT_MODE, key, secureRandom);
byte[] clearByte = c.doFinal(dec);
return new String(clearByte);
}
@@ -95,7 +99,7 @@ public class PasswordEncryptUtil {
if (input == null) {
return input;
}
return StudioEncryption.getStudioEncryption(StudioEncryption.EncryptionKeyName.ROUTINE).encrypt(input);
return PREFIX_PASSWORD + AESEncryption.encryptPassword(input) + POSTFIX_PASSWORD;
}
/**

View File

@@ -19,7 +19,6 @@ import java.io.InputStream;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.Properties;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.commons.lang3.StringUtils;
@@ -193,27 +192,6 @@ public class VersionUtils {
return talendVersion;
}
public static String getTalendPureVersion(String fullProductVersion) {
String version = fullProductVersion;
String[] splitStr = fullProductVersion.split("-"); //$NON-NLS-1$
Pattern pattern = Pattern.compile("((\\d+\\.){2}\\d.*)"); //$NON-NLS-1$
StringBuffer versionStr = new StringBuffer();
boolean find = false;
for (String str : splitStr) {
if (find) {
versionStr.append("-").append(str); //$NON-NLS-1$
}else {
Matcher matcher = pattern.matcher(str);
if (matcher.find()) {
find = true;
versionStr.append(str); // $NON-NLS-1$
}
}
}
return getTalendVersion(versionStr.toString());
}
public static String getTalendVersion(String productVersion) {
try {
org.osgi.framework.Version v = new org.osgi.framework.Version(productVersion);

View File

@@ -22,7 +22,6 @@ import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.ScrollBar;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.Tree;
@@ -112,7 +111,7 @@ public class BackgroundRefresher implements IBackgroundRefresher {
*/
@Override
protected void execute(final boolean isFinalExecution, Object data) {
Display.getDefault().syncExec(new Runnable() {
drawableComposite.getBgDrawableComposite().getDisplay().syncExec(new Runnable() {
public void run() {
if (isFinalExecution) {
@@ -340,7 +339,7 @@ public class BackgroundRefresher implements IBackgroundRefresher {
}
if ((WindowSystem.isGTK() || EnvironmentUtils.isMacOsSytem()) && child instanceof Tree) {
returnedPoint.y += ((Tree) child).getHeaderHeight();
returnedPoint.y += ((Tree) child).getItemHeight();
returnedPoint.y += ((Table) child).getItemHeight();
}
child = child.getParent();
ScrollBar vScrollBar = child.getVerticalBar();

View File

@@ -33,7 +33,6 @@ import org.eclipse.swt.widgets.TreeItem;
import org.talend.commons.ui.runtime.i18n.Messages;
import org.talend.commons.ui.runtime.utils.TableUtils;
import org.talend.commons.ui.runtime.ws.WindowSystem;
import org.talend.commons.ui.swt.advanced.dataeditor.AbstractDataTableEditorView;
import org.talend.commons.ui.swt.drawing.background.IBackgroundRefresher;
import org.talend.commons.ui.swt.drawing.background.IBgDrawableComposite;
import org.talend.commons.ui.swt.drawing.link.BezierHorizontalLink;
@@ -465,19 +464,4 @@ public class TreeToTablesLinker<D1, D2> extends BgDrawableComposite implements I
}
}
protected <B> void loadItemDataForLazyLoad(AbstractDataTableEditorView<B> tableEditorView) {
if (!tableEditorView.getTableViewerCreator().isLazyLoad()) {
return;
}
List<B> beansList = tableEditorView.getExtendedTableModel().getBeansList();
Table table = tableEditorView.getTable();
for (TableItem tableItem : table.getItems()) {
if (tableItem.getData() == null) {
int index = table.indexOf(tableItem);
B schemaTarget = beansList.get(index);
tableItem.setData(schemaTarget);
}
}
}
}

View File

@@ -212,5 +212,4 @@ RenameFolderAction.warning.cannotFind.message=Cannot rename folder, it may have
RenameFolderAction.warning.cannotFind.title=Action not available
ConvertJobsUtil.warning.title=Warning
ConvertJobsUtil.warning.message=The target framework is not fully supported for this release.
SyncLibrariesLoginTask.createStatsLogAndImplicitParamter=Create stats log and implicit parameters
ConvertJobsUtil.warning.message=The target framework is not fully supported for this release.

View File

@@ -2,25 +2,12 @@ package org.talend.core.repository.logintask;
import java.lang.reflect.InvocationTargetException;
import org.eclipse.core.resources.IResourceRuleFactory;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.IWorkspaceRunnable;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.jobs.ISchedulingRule;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.talend.commons.exception.ExceptionHandler;
import org.talend.commons.exception.LoginException;
import org.talend.commons.exception.PersistenceException;
import org.talend.core.GlobalServiceRegister;
import org.talend.core.ICoreService;
import org.talend.core.repository.i18n.Messages;
import org.talend.core.repository.model.ProxyRepositoryFactory;
import org.talend.core.repository.utils.ProjectDataJsonProvider;
import org.talend.login.AbstractLoginTask;
import org.talend.repository.ProjectManager;
import org.talend.repository.RepositoryWorkUnit;
public class SyncLibrariesLoginTask extends AbstractLoginTask implements IRunnableWithProgress {
@@ -33,38 +20,7 @@ public class SyncLibrariesLoginTask extends AbstractLoginTask implements IRunnab
@Override
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
try {
if (ProjectDataJsonProvider.hasFilledProjectSettingFile(ProjectManager.getInstance().getCurrentProject())) {
return;
}
} catch (PersistenceException e1) {
ExceptionHandler.process(e1);
return;
}
ProxyRepositoryFactory.getInstance().executeRepositoryWorkUnit(
new RepositoryWorkUnit<Void>(Messages.getString("SyncLibrariesLoginTask.createStatsLogAndImplicitParamter")) {
@Override
protected void run() throws LoginException, PersistenceException {
try {
IWorkspace workspace = ResourcesPlugin.getWorkspace();
IResourceRuleFactory ruleFactory = workspace.getRuleFactory();
ProjectManager projectManager = ProjectManager.getInstance();
ISchedulingRule refreshRule = ruleFactory.refreshRule(
projectManager.getResourceProject(projectManager.getCurrentProject().getEmfProject()));
workspace.run(new IWorkspaceRunnable() {
@Override
public void run(IProgressMonitor monitor) throws CoreException {
coreService
.createStatsLogAndImplicitParamter(ProjectManager.getInstance().getCurrentProject());
}
}, refreshRule, IWorkspace.AVOID_UPDATE, monitor);
} catch (Exception e) {
ExceptionHandler.process(e);
}
}
});
coreService.createStatsLogAndImplicitParamter(ProjectManager.getInstance().getCurrentProject());
}
}

View File

@@ -406,38 +406,6 @@ public class ProjectDataJsonProvider {
return null;
}
public static boolean hasFilledProjectSettingFile(org.talend.core.model.general.Project project) throws PersistenceException {
FileInputStream InputStream = null;
boolean hasFilled = false;
try {
IProject physProject = ResourceUtils.getProject(project);
IPath location = physProject.getLocation();
File file = ProjectDataJsonProvider.getLoadingConfigurationFile(location, FileConstants.PROJECTSETTING_FILE_NAME);
if (file != null && file.exists()) {
InputStream = new FileInputStream(file);
ProjectSettings projectSetting = new ObjectMapper().readValue(new FileInputStream(file), ProjectSettings.class);
if (projectSetting != null) {
ImplicitContextSettingJson implicitContextSettingJson = projectSetting.getImplicitContextSettingJson();
if (implicitContextSettingJson != null) {
ParametersTypeJson parametersTypeJson = implicitContextSettingJson.getParametersTypeJson();
if (parametersTypeJson != null) {
List<ElementParameterTypeJson> elementParameters = parametersTypeJson.getElementParameters();
if (elementParameters.size() > 0) {
hasFilled = true;
}
}
}
}
}
} catch (Exception e1) {
throw new PersistenceException(e1);
} finally {
closeInputStream(InputStream);
}
return hasFilled;
}
protected static ImplicitContextSettingJson getImplicitContextSettingJson(ImplicitContextSettings implicitContextSettings) {
if (implicitContextSettings != null) {
ImplicitContextSettingJson implicitContextSettingJson = new ImplicitContextSettingJson(implicitContextSettings);

View File

@@ -131,22 +131,4 @@ public class ProjectHelper {
}
return null;
}
/**
* define the different value for the project types the string value in the licence files Matcht the java enum name
* this is a copy of org.talend.commons.model.KeyConstants.ProjectType to avoid adding the all library
*
*/
public static enum ProjectType {
DI,
DQ,
MDM;
}
public static int getProjectTypeOrdinal(org.talend.core.model.properties.Project project) {
if (project != null && project.getType() != null) {
return ProjectType.valueOf(project.getType()).ordinal();
}
return 0;
}
}

View File

@@ -12,14 +12,11 @@
// ============================================================================
package org.talend.core;
import java.util.List;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IWorkbenchPart;
import org.talend.core.model.process.INode;
import org.talend.core.model.process.IProcess;
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.utils.IXSDPopulationUtil;
@@ -50,8 +47,6 @@ public interface IESBService extends IService {
public StringBuffer getAllTheJObNames(IRepositoryNode jobList);
public List<String> getSerivceRelatedJobIds(Item serviceItem);
public void deleteOldRelation(String jobID);
// public void setSelectedItem(Item, )
@@ -64,8 +59,6 @@ public interface IESBService extends IService {
public void copyDataServiceRelateJob(Item newItem);
public boolean isRESTService(ProcessItem processItem);
public IXSDPopulationUtil getXSDPopulationUtil();
public boolean isWSDLEditor(IWorkbenchPart part);

View File

@@ -89,8 +89,6 @@ public interface ILibraryManagerService extends IService {
* @return
*/
public boolean retrieve(String jarNeeded, String pathToStore, IProgressMonitor... monitorWrap);
public boolean retrieve(String jarNeeded, String jarURL, String pathToStore, IProgressMonitor... monitorWrap);
public boolean retrieve(String jarNeeded, String pathToStore, boolean showDialog, IProgressMonitor... monitorWrap);

View File

@@ -210,9 +210,4 @@ public interface ITDQRepositoryService extends IService {
* @param ruManager: RepositoryUpdateManager
*/
void updateAllContextInAnalysisAndReport(RepositoryUpdateManager ruManager, Object parameter, boolean isUpdated);
/**
* @param chooseContext the context name which want to swtich
*/
void popupSwitchContextFailedMessage(String chooseContext);
}

View File

@@ -164,11 +164,11 @@ public enum EDatabaseVersion4Drivers {
MAPRDB(new DbVersion4Drivers(EDatabaseTypeName.MAPRDB, new String[] {})),
REDSHIFT(new DbVersion4Drivers(EDatabaseTypeName.REDSHIFT, "redshift", "REDSHIFT", //$NON-NLS-1$ //$NON-NLS-2$
"redshift-jdbc42-no-awssdk-1.2.32.1056.jar")), //$NON-NLS-1$
"redshift-jdbc42-no-awssdk-1.2.20.1043.jar")), //$NON-NLS-1$
REDSHIFT_SSO(new DbVersion4Drivers(EDatabaseTypeName.REDSHIFT_SSO, "redshift sso", "REDSHIFT_SSO", //$NON-NLS-1$ //$NON-NLS-2$
new String[] { "redshift-jdbc42-no-awssdk-1.2.32.1056.jar", "aws-java-sdk-1.11.406.jar", "jackson-core-2.9.9.jar", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
"jackson-databind-2.9.9.jar", "jackson-annotations-2.9.0.jar", "httpcore-4.4.9.jar", "httpclient-4.5.5.jar", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$//$NON-NLS-4$
"joda-time-2.8.1.jar", "commons-logging-1.1.3.jar", "commons-codec-1.6.jar" })), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
new String[] { "redshift-jdbc42-no-awssdk-1.2.20.1043.jar", "aws-java-sdk-1.11.406.jar", "jackson-core-2.9.5.jar", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
"jackson-databind-2.9.5.jar", "jackson-annotations-2.9.0.jar", "httpcore-4.4.9.jar", "httpclient-4.5.5.jar", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$//$NON-NLS-4$
"joda-time-2.8.1.jar", "commons-logging-1.1.3.jar" })), //$NON-NLS-1$ //$NON-NLS-2$
AMAZON_AURORA(new DbVersion4Drivers(EDatabaseTypeName.AMAZON_AURORA, "mysql-connector-java-5.1.30-bin.jar")); //$NON-NLS-1$

View File

@@ -60,15 +60,6 @@ public interface IComponent {
public String getOriginalName();
/**
* Only for component display (palette,search)
*
* @return
*/
default public String getDisplayName() {
return getName();
}
public String getLongName();
public String getOriginalFamilyName();

View File

@@ -98,15 +98,6 @@ public class JobContext implements IContext, Cloneable {
return true;
}
public boolean containsSameParameterIgnoreCase(String parameterName) {
for (IContextParameter contextParam : contextParameterList) {
if (contextParam.getName() != null && contextParam.getName().equalsIgnoreCase(parameterName)) {
return true;
}
}
return false;
}
/**
* Commented by Marvin Wang on Mar.2, 2012, the user who invokes the method should notice that if the
* <code>JobContext</code> has more than one <code>ContextParameter</code>s which names are same, this case will

View File

@@ -108,4 +108,8 @@ public interface IMetadataTable {
public boolean isRepository();
public void setRepository(boolean isRepository);
public boolean isNodeCheck();
public void setNodeCheck(boolean isNodeCheck);
}

View File

@@ -56,6 +56,8 @@ public class MetadataTable implements IMetadataTable, Cloneable {
private Map<String, String> additionalProperties = new HashMap<String, String>();
private boolean isRepository = false;
private boolean isNodeCheck = false;
private String tableType;
@@ -153,7 +155,7 @@ public class MetadataTable implements IMetadataTable, Cloneable {
List<IMetadataColumn> temp = new ArrayList<IMetadataColumn>();
temp.addAll(this.listColumns);
temp.addAll(this.unusedColumns);
if (originalColumns != null && isRepository) {
if (originalColumns != null && (isRepository || isNodeCheck)) {
Collections.sort(temp, new Comparator<IMetadataColumn>() {
@Override
@@ -515,4 +517,13 @@ public class MetadataTable implements IMetadataTable, Cloneable {
public List<String> getOriginalColumns() {
return this.originalColumns;
}
public boolean isNodeCheck() {
return isNodeCheck;
}
public void setNodeCheck(boolean isNodeCheck) {
this.isNodeCheck = isNodeCheck;
}
}

View File

@@ -585,6 +585,11 @@ public final class MetadataToolHelper {
public static void copyTable(IMetadataTable source, IMetadataTable target, String targetDbms,
boolean avoidUsedColumnsFromInput) {
copyTable(source, target, targetDbms, avoidUsedColumnsFromInput, false);
}
public static void copyTable(IMetadataTable source, IMetadataTable target, String targetDbms,
boolean avoidUsedColumnsFromInput, boolean withCustoms) {
if (source == null || target == null) {
return;
}
@@ -604,7 +609,7 @@ public final class MetadataToolHelper {
List<IMetadataColumn> columnsTAdd = new ArrayList<IMetadataColumn>();
for (IMetadataColumn column : source.getListColumns(!avoidUsedColumnsFromInput)) {
IMetadataColumn targetColumn = target.getColumn(column.getLabel());
IMetadataColumn newTargetColumn = column.clone();
IMetadataColumn newTargetColumn = column.clone(withCustoms);
if (targetColumn == null) {
columnsTAdd.add(newTargetColumn);
newTargetColumn
@@ -669,7 +674,7 @@ public final class MetadataToolHelper {
List<IMetadataColumn> targetColumns = target.getListColumns();
List<String> temp = new ArrayList<String>(tColumns);
if (targetColumns != null) {
final List<String> columnNames = new ArrayList<String>();
List<String> columnNames = new ArrayList<String>();
for(IMetadataColumn column : targetColumns){
columnNames.add(column.getLabel());
}

View File

@@ -1697,11 +1697,6 @@ public class RepositoryToComponentProperty {
return "STANDARD";
}
}
if (value.equals("DBTYPE")) {
String repositoryType = connection.getDatabaseType();
EDatabaseTypeName typeFromDbType = EDatabaseTypeName.getTypeFromDbType(repositoryType);
return typeFromDbType.getXMLType();
}
return null;

View File

@@ -39,7 +39,7 @@ public abstract class AbstractNode implements INode {
private ComponentProperties componentProperties;
List<? extends IElementParameter> elementParameters = new ArrayList<IElementParameter>();
List<? extends IElementParameter> elementParameters;
private List<? extends IConnection> outgoingConnections = new ArrayList<IConnection>();

View File

@@ -123,8 +123,7 @@ public enum EParameterFieldType {
TACOKIT_GUESS_SCHEMA,
TACOKIT_BUTTON,
TACOKIT_SUGGESTABLE_TABLE,
TACOKIT_VALUE_SELECTION,
TACOKIT_TEXT_AREA_SELECTION;
TACOKIT_VALUE_SELECTION;
public String getName() {
return toString();

View File

@@ -62,6 +62,4 @@ public interface IContext {
public IContext clone();
public boolean sameAs(IContext context);
public boolean containsSameParameterIgnoreCase(String parameterName);
}

View File

@@ -25,7 +25,6 @@ import org.talend.commons.exception.ExceptionHandler;
import org.talend.commons.exception.PersistenceException;
import org.talend.commons.utils.VersionUtils;
import org.talend.core.GlobalServiceRegister;
import org.talend.core.IESBService;
import org.talend.core.ITDQItemService;
import org.talend.core.PluginChecker;
import org.talend.core.hadoop.IHadoopClusterService;
@@ -34,6 +33,7 @@ import org.talend.core.model.general.Project;
import org.talend.core.model.properties.Item;
import org.talend.core.model.properties.JobletProcessItem;
import org.talend.core.model.properties.ProcessItem;
import org.talend.core.model.properties.ProjectReference;
import org.talend.core.model.properties.Property;
import org.talend.core.model.properties.SQLPatternItem;
import org.talend.core.model.relationship.Relation;
@@ -904,7 +904,27 @@ public final class ProcessUtils {
}
}
}
return needBeans && GlobalServiceRegister.getDefault().isServiceRegistered(IESBService.class);
if (needBeans && GlobalServiceRegister.getDefault().isServiceRegistered(IProxyRepositoryService.class)) {
IProxyRepositoryService service = (IProxyRepositoryService) GlobalServiceRegister.getDefault()
.getService(IProxyRepositoryService.class);
ERepositoryObjectType beansType = ERepositoryObjectType.valueOf("BEANS"); //$NON-NLS-1$
try {
IProxyRepositoryFactory factory = service.getProxyRepositoryFactory();
List<IRepositoryViewObject> all = factory.getAll(project, beansType);
List<ProjectReference> references = ProjectManager.getInstance().getCurrentProject()
.getProjectReferenceList(true);
for (ProjectReference ref : references) {
all.addAll(factory.getAll(new Project(ref.getReferencedProject()), beansType));
}
if (!all.isEmpty()) { // has bean
return true;
}
} catch (PersistenceException e) {
ExceptionHandler.process(e);
}
}
return false;
}
public static boolean isRequiredPigUDFs(IProcess process) {

View File

@@ -575,8 +575,6 @@ public class ERepositoryObjectType extends DynaEnum<ERepositoryObjectType> {
public final static ERepositoryObjectType METADATA_SAP_BW_INFOOBJECT = ERepositoryObjectType
.valueOf("METADATA_SAP_BW_INFOOBJECT"); //$NON-NLS-1$
public final static ERepositoryObjectType JDBC = ERepositoryObjectType.valueOf("JDBC"); //$NON-NLS-1$
private static Map<String, ERepositoryObjectType> typeCacheById = new HashMap<String, ERepositoryObjectType>();
ERepositoryObjectType(String key, String folder, String type, boolean isStaticNode, int ordinal, String[] products,

View File

@@ -684,15 +684,16 @@ public class NodeUtil {
}
List<? extends IConnection> listInConns = node.getIncomingConnections();
if (listInConns != null && listInConns.size() > 0) {
for (IConnection connection : listInConns) {
if (EConnectionType.FLOW_REF != connection.getLineStyle()) {
String retResult = getPrivateConnClassName(connection);
return retResult != null ? retResult : conn.getName();
}
String retResult = getPrivateConnClassName(listInConns.get(0));
if (retResult == null) {
return conn.getName();
} else {
return retResult;
}
}
}
return null;
}
/**

View File

@@ -41,11 +41,11 @@ import org.talend.core.model.process.EParameterFieldType;
import org.talend.core.model.process.IContextParameter;
import org.talend.core.model.process.IElementParameter;
import org.talend.core.utils.TalendQuoteUtils;
import org.talend.daikon.security.CryptoHelper;
import org.talend.designer.core.model.utils.emf.talendfile.ContextParameterType;
import org.talend.designer.core.model.utils.emf.talendfile.ElementParameterType;
import org.talend.designer.core.model.utils.emf.talendfile.ElementValueType;
import org.talend.repository.ProjectManager;
import org.talend.utils.security.StudioEncryption;
/**
* cli class global comment. Detailled comment
@@ -842,8 +842,7 @@ public final class ParameterValueUtil {
if (contextParam != null) {
String docValue = contextParam.getValue();
if (docValue != null) {
String encryptValue = StudioEncryption.getStudioEncryption(StudioEncryption.EncryptionKeyName.SYSTEM)
.encrypt(docValue);
String encryptValue = CryptoHelper.getDefault().encrypt(docValue);
if (encryptValue != null) {
return encryptValue;
}
@@ -879,8 +878,7 @@ public final class ParameterValueUtil {
if (param != null) {
Object docValue = param.getValue();
if (docValue != null && docValue instanceof String) {
String encryptValue = StudioEncryption.getStudioEncryption(StudioEncryption.EncryptionKeyName.SYSTEM)
.encrypt(docValue.toString());
String encryptValue = CryptoHelper.getDefault().encrypt(docValue.toString());
if (encryptValue != null) {
return encryptValue;
}

View File

@@ -1,33 +0,0 @@
// ============================================================================
//
// 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.nexus;
import java.io.IOException;
public class ResolverExceptionHandler {
public static IOException hideCredential(IOException e) {
// hide the user/password in the error
String regex = "\\://(.+)\\:(.+)@"; //$NON-NLS-1$
String message = e.getMessage();
message = message.replaceAll(regex, "://"); //$NON-NLS-1$
Exception cause = null;
if (e.getCause() != null) {
String causeMessage = e.getCause().getMessage();
causeMessage = causeMessage.replaceAll(regex, "://"); //$NON-NLS-1$
cause = new Exception(causeMessage);
}
return new IOException(message, cause);
}
}

View File

@@ -101,12 +101,8 @@ public class TalendMavenResolver {
}
public static File resolve(String mvnUri) throws IOException {
try {
return getMavenResolver().resolve(mvnUri);
} catch (IOException e) {
throw ResolverExceptionHandler.hideCredential(e);
}
public static File resolve(String mvnUri) throws IOException, RuntimeException {
return getMavenResolver().resolve(mvnUri);
}
public static void upload(String groupId, String artifactId, String classifier, String extension, String version,
@@ -114,11 +110,7 @@ public class TalendMavenResolver {
getMavenResolver().upload(groupId, artifactId, classifier, extension, version, artifact);
}
public static void initMavenResovler() throws RuntimeException {
getMavenResolver();
}
private static MavenResolver getMavenResolver() throws RuntimeException {
public static MavenResolver getMavenResolver() throws RuntimeException {
if (mavenResolver == null) {
final BundleContext context = CoreRuntimePlugin.getInstance().getBundle().getBundleContext();
ServiceReference<org.ops4j.pax.url.mvn.MavenResolver> mavenResolverService = context

View File

@@ -23,10 +23,6 @@ public interface IAdditionalInfo {
void onEvent(final String event, final Object... parameters);
default Object func(final String funcName, final Object... params) throws Exception {
throw new UnsupportedOperationException();
}
void cloneAddionalInfoTo(final IAdditionalInfo targetAdditionalInfo);
}

View File

@@ -42,8 +42,6 @@ public interface MavenConstants {
static final String POM_FILTER = "POM_FILTER";
static final String USE_PROFILE_MODULE = "USE_PROFILE_MODULE";
/*
* for lib
*/

View File

@@ -19,7 +19,7 @@ import java.net.URLDecoder;
import org.apache.commons.lang.StringUtils;
import org.eclipse.core.runtime.Assert;
import org.talend.commons.exception.ExceptionHandler;
import org.talend.utils.security.StudioEncryption;
import org.talend.daikon.security.CryptoHelper;
/**
* DOC ggu class global comment. Detailled comment
@@ -47,6 +47,8 @@ public class MavenUrlHelper {
public static final String USER_PASSWORD_SPLITER = ":";
private static CryptoHelper cryptoHelper;
public static MavenArtifact parseMvnUrl(String mvnUrl) {
return parseMvnUrl(mvnUrl, true);
}
@@ -330,12 +332,19 @@ public class MavenUrlHelper {
return uri;
}
private static CryptoHelper getCryptoHelper() {
if (cryptoHelper == null) {
cryptoHelper = CryptoHelper.getDefault();
}
return cryptoHelper;
}
public static String encryptPassword(String password) {
return StudioEncryption.getStudioEncryption(StudioEncryption.EncryptionKeyName.SYSTEM).encrypt(password);
return getCryptoHelper().encrypt(password);
}
public static String decryptPassword(String password) {
return StudioEncryption.getStudioEncryption(StudioEncryption.EncryptionKeyName.SYSTEM).decrypt(password);
return getCryptoHelper().decrypt(password);
}
public static String generateModuleNameByMavenURI(String uri) {

View File

@@ -19,7 +19,6 @@ import java.util.Set;
import org.talend.core.model.general.ModuleNeeded;
import org.talend.core.model.process.JobInfo;
import org.talend.core.model.process.ProcessUtils;
/**
* DOC nrousseau class global comment. Detailled comment
@@ -79,7 +78,7 @@ public class LastGenerationInfo {
* @return the modulesNeededPerJob
*/
public Set<ModuleNeeded> getModulesNeededWithSubjobPerJob(String jobId, String jobVersion) {
String key = this.getProcessKey(jobId, jobVersion);
String key = jobId + "_" + jobVersion; //$NON-NLS-1$
if (!modulesNeededWithSubjobPerJob.containsKey(key)) {
modulesNeededWithSubjobPerJob.put(key, new HashSet<ModuleNeeded>());
}
@@ -91,7 +90,7 @@ public class LastGenerationInfo {
* @return the modulesNeededPerJob
*/
public Set<ModuleNeeded> getModulesNeededPerJob(String jobId, String jobVersion) {
String key = this.getProcessKey(jobId, jobVersion);
String key = jobId + "_" + jobVersion; //$NON-NLS-1$
if (!modulesNeededPerJob.containsKey(key)) {
modulesNeededPerJob.put(key, new HashSet<ModuleNeeded>());
}
@@ -104,7 +103,7 @@ public class LastGenerationInfo {
* @return the contextPerJob
*/
public Set<String> getContextPerJob(String jobId, String jobVersion) {
String key = this.getProcessKey(jobId, jobVersion);
String key = jobId + "_" + jobVersion; //$NON-NLS-1$
if (!contextPerJob.containsKey(key)) {
contextPerJob.put(key, new HashSet<String>());
}
@@ -117,7 +116,7 @@ public class LastGenerationInfo {
* @param modulesNeededPerJob the modulesNeededPerJob to set
*/
public void setModulesNeededPerJob(String jobId, String jobVersion, Set<ModuleNeeded> modulesNeeded) {
String key = this.getProcessKey(jobId, jobVersion);
String key = jobId + "_" + jobVersion; //$NON-NLS-1$
modulesNeededPerJob.put(key, new HashSet<ModuleNeeded>(modulesNeeded));
}
@@ -126,8 +125,8 @@ public class LastGenerationInfo {
*
* @param modulesNeededWithSubjobPerJob the modulesNeededWithSubjobPerJob to set
*/
public void setModulesNeededWithSubjobPerJob(String jobId, String jobVersion, Set<ModuleNeeded> modulesNeeded) {
String key = this.getProcessKey(jobId, jobVersion);
public void setModulesNeededWithSubjobPerJob(String jobId, String jobVersion, Set<ModuleNeeded> modulesNeeded) {
String key = jobId + "_" + jobVersion; //$NON-NLS-1$
if (modulesNeeded == null) {
modulesNeededWithSubjobPerJob.put(key, null);
} else {
@@ -141,17 +140,17 @@ public class LastGenerationInfo {
* @param contextPerJob the contextPerJob to set
*/
public void setContextPerJob(String jobId, String jobVersion, Set<String> contexts) {
String key = this.getProcessKey(jobId, jobVersion);
String key = jobId + "_" + jobVersion; //$NON-NLS-1$
contextPerJob.put(key, new HashSet<String>(contexts));
}
public void setUseDynamic(String jobId, String jobVersion, boolean dynamic) {
String key = this.getProcessKey(jobId, jobVersion);
String key = jobId + "_" + jobVersion; //$NON-NLS-1$
useDynamic.put(key, dynamic);
}
public boolean isUseDynamic(String jobId, String jobVersion) {
String key = this.getProcessKey(jobId, jobVersion);
String key = jobId + "_" + jobVersion; //$NON-NLS-1$
if (!useDynamic.containsKey(key)) {
return false;
}
@@ -163,12 +162,12 @@ public class LastGenerationInfo {
}
public void setUseRules(String jobId, String jobVersion, boolean useRules) {
String key = this.getProcessKey(jobId, jobVersion);
String key = jobId + "_" + jobVersion; //$NON-NLS-1$
this.useRules.put(key, useRules);
}
public boolean isUseRules(String jobId, String jobVersion) {
String key = this.getProcessKey(jobId, jobVersion);
String key = jobId + "_" + jobVersion; //$NON-NLS-1$
if (!useRules.containsKey(key)) {
return false;
}
@@ -180,12 +179,12 @@ public class LastGenerationInfo {
}
public void setUsePigUDFs(String jobId, String jobVersion, boolean useRules) {
String key = this.getProcessKey(jobId, jobVersion);
String key = jobId + "_" + jobVersion; //$NON-NLS-1$
this.usedPigUDFs.put(key, useRules);
}
public boolean isUsePigUDFs(String jobId, String jobVersion) {
String key = this.getProcessKey(jobId, jobVersion);
String key = jobId + "_" + jobVersion; //$NON-NLS-1$
if (!usedPigUDFs.containsKey(key)) {
return false;
}
@@ -252,7 +251,7 @@ public class LastGenerationInfo {
* @return the modulesNeededPerJob
*/
public Set<String> getRoutinesNeededPerJob(String jobId, String jobVersion) {
String key = this.getProcessKey(jobId, jobVersion);
String key = jobId + "_" + jobVersion; //$NON-NLS-1$
if (!routinesNeededPerJob.containsKey(key)) {
routinesNeededPerJob.put(key, new HashSet<String>());
}
@@ -280,8 +279,7 @@ public class LastGenerationInfo {
}
private String getProcessKey(String jobId, String jobVersion) {
String pureJobId = ProcessUtils.getPureItemId(jobId);
return pureJobId + "_" + jobVersion; //$NON-NLS-1$
return jobId + "_" + jobVersion; //$NON-NLS-1$
}
/**
@@ -290,7 +288,7 @@ public class LastGenerationInfo {
* @return the pigudfNeededPerJob
*/
public Set<String> getPigudfNeededPerJob(String jobId, String jobVersion) {
String key = this.getProcessKey(jobId, jobVersion);
String key = jobId + "_" + jobVersion; //$NON-NLS-1$
if (!pigudfNeededPerJob.containsKey(key)) {
pigudfNeededPerJob.put(key, new HashSet<String>());
}
@@ -304,7 +302,7 @@ public class LastGenerationInfo {
* @param modulesNeededPerJob the modulesNeededPerJob to set
*/
public void setRoutinesNeededPerJob(String jobId, String jobVersion, Set<String> modulesNeeded) {
String key = this.getProcessKey(jobId, jobVersion);
String key = jobId + "_" + jobVersion; //$NON-NLS-1$
routinesNeededPerJob.put(key, new HashSet<String>(modulesNeeded));
}
@@ -314,7 +312,7 @@ public class LastGenerationInfo {
* @param pigudfNeededPerJob the pigudfNeededPerJob to set
*/
public void setPigudfNeededPerJob(String jobId, String jobVersion, Set<String> modulesNeeded) {
String key = this.getProcessKey(jobId, jobVersion);
String key = jobId + "_" + jobVersion; //$NON-NLS-1$
pigudfNeededPerJob.put(key, new HashSet<String>(modulesNeeded));
}
@@ -323,7 +321,7 @@ public class LastGenerationInfo {
* @return the modulesNeededPerJob
*/
public Set<String> getRoutinesNeededWithSubjobPerJob(String jobId, String jobVersion) {
String key = this.getProcessKey(jobId, jobVersion);
String key = jobId + "_" + jobVersion; //$NON-NLS-1$
if (!routinesNeededWithSubjobPerJob.containsKey(key)) {
routinesNeededWithSubjobPerJob.put(key, new HashSet<String>());
}
@@ -336,7 +334,7 @@ public class LastGenerationInfo {
* @return the pigudfNeededWithSubjobPerJob
*/
public Set<String> getPigudfNeededWithSubjobPerJob(String jobId, String jobVersion) {
String key = this.getProcessKey(jobId, jobVersion);
String key = jobId + "_" + jobVersion; //$NON-NLS-1$
if (!pigudfNeededWithSubjobPerJob.containsKey(key)) {
pigudfNeededWithSubjobPerJob.put(key, new HashSet<String>());
}
@@ -350,7 +348,7 @@ public class LastGenerationInfo {
* @param modulesNeededPerJob the modulesNeededPerJob to set
*/
public void setRoutinesNeededWithSubjobPerJob(String jobId, String jobVersion, Set<String> modulesNeeded) {
String key = this.getProcessKey(jobId, jobVersion);
String key = jobId + "_" + jobVersion; //$NON-NLS-1$
routinesNeededWithSubjobPerJob.put(key, new HashSet<String>(modulesNeeded));
}
@@ -360,7 +358,7 @@ public class LastGenerationInfo {
* @param pigudfNeededWithSubjobPerJob the pigudfNeededWithSubjobPerJob to set
*/
public void setPigudfNeededWithSubjobPerJob(String jobId, String jobVersion, Set<String> modulesNeeded) {
String key = this.getProcessKey(jobId, jobVersion);
String key = jobId + "_" + jobVersion; //$NON-NLS-1$
pigudfNeededWithSubjobPerJob.put(key, new HashSet<String>(modulesNeeded));
}

View File

@@ -99,8 +99,6 @@ public interface IJobletProviderService extends IService {
public IEditorPart openJobletItem(JobletProcessItem item);
public boolean isJobletItem(Item item);
public boolean isJobletProcess(IProcess process);
public Action getMoveToJobletAction(IWorkbenchPart part, INode jobletNode, Map<INode, IConnection> nodeMap);

View File

@@ -22,8 +22,8 @@ import org.eclipse.jface.preference.IPreferenceStore;
import org.talend.commons.exception.ExceptionHandler;
import org.talend.core.prefs.SSLPreferenceConstants;
import org.talend.core.runtime.CoreRuntimePlugin;
import org.talend.daikon.security.CryptoHelper;
import org.talend.daikon.security.SSLContextProvider;
import org.talend.utils.security.StudioEncryption;
/**
*
@@ -34,7 +34,7 @@ public class StudioSSLContextProvider {
private static SSLContext context;
private static final IPreferenceStore STORE = CoreRuntimePlugin.getInstance().getCoreService().getPreferenceStore();
private static final IPreferenceStore store = CoreRuntimePlugin.getInstance().getCoreService().getPreferenceStore();
public static synchronized SSLContext getContext() throws Exception {
if (null == context) {
@@ -44,14 +44,15 @@ public class StudioSSLContextProvider {
}
public static synchronized void buildContext() throws Exception {
String keypath = STORE.getString(SSLPreferenceConstants.KEYSTORE_FILE);
String keypass = STORE.getString(SSLPreferenceConstants.KEYSTORE_PASSWORD);
String keytype = STORE.getString(SSLPreferenceConstants.KEYSTORE_TYPE);
String trustpath = STORE.getString(SSLPreferenceConstants.TRUSTSTORE_FILE);
String trustpass = STORE.getString(SSLPreferenceConstants.TRUSTSTORE_PASSWORD);
String trusttype = STORE.getString(SSLPreferenceConstants.TRUSTSTORE_TYPE);
keypass = StudioEncryption.getStudioEncryption(StudioEncryption.EncryptionKeyName.SYSTEM).decrypt(keypass);
trustpass = StudioEncryption.getStudioEncryption(StudioEncryption.EncryptionKeyName.SYSTEM).decrypt(trustpass);
String keypath = store.getString(SSLPreferenceConstants.KEYSTORE_FILE);
String keypass = store.getString(SSLPreferenceConstants.KEYSTORE_PASSWORD);
String keytype = store.getString(SSLPreferenceConstants.KEYSTORE_TYPE);
String trustpath = store.getString(SSLPreferenceConstants.TRUSTSTORE_FILE);
String trustpass = store.getString(SSLPreferenceConstants.TRUSTSTORE_PASSWORD);
String trusttype = store.getString(SSLPreferenceConstants.TRUSTSTORE_TYPE);
CryptoHelper cryptoHelper = CryptoHelper.getDefault();
keypass = cryptoHelper.decrypt(keypass);
trustpass = cryptoHelper.decrypt(trustpass);
try {
if (StringUtils.isEmpty(keypath) && StringUtils.isEmpty(trustpath)) {
context = null;
@@ -87,12 +88,12 @@ public class StudioSSLContextProvider {
private static void changeProperty() {
final IPreferenceStore sslStore = CoreRuntimePlugin.getInstance().getCoreService().getPreferenceStore();
CryptoHelper cryptoHelper = CryptoHelper.getDefault();
String keyStore = sslStore.getString(SSLPreferenceConstants.KEYSTORE_FILE);
if (keyStore != null && !"".equals(keyStore.trim())) {
System.setProperty(SSLPreferenceConstants.KEYSTORE_FILE, keyStore);
System.setProperty(SSLPreferenceConstants.KEYSTORE_PASSWORD,
StudioEncryption.getStudioEncryption(StudioEncryption.EncryptionKeyName.SYSTEM)
.decrypt(sslStore.getString(SSLPreferenceConstants.KEYSTORE_PASSWORD)));
cryptoHelper.decrypt(sslStore.getString(SSLPreferenceConstants.KEYSTORE_PASSWORD)));
System.setProperty(SSLPreferenceConstants.KEYSTORE_TYPE, sslStore.getString(SSLPreferenceConstants.KEYSTORE_TYPE));
} else {
System.clearProperty(SSLPreferenceConstants.KEYSTORE_FILE);
@@ -103,8 +104,7 @@ public class StudioSSLContextProvider {
if (trustStore != null && !"".equals(trustStore.trim())) {
System.setProperty(SSLPreferenceConstants.TRUSTSTORE_FILE, trustStore);
System.setProperty(SSLPreferenceConstants.TRUSTSTORE_PASSWORD,
StudioEncryption.getStudioEncryption(StudioEncryption.EncryptionKeyName.SYSTEM)
.decrypt(sslStore.getString(SSLPreferenceConstants.TRUSTSTORE_PASSWORD)));
cryptoHelper.decrypt(sslStore.getString(SSLPreferenceConstants.TRUSTSTORE_PASSWORD)));
System.setProperty(SSLPreferenceConstants.TRUSTSTORE_TYPE, sslStore.getString(SSLPreferenceConstants.TRUSTSTORE_TYPE));
} else {
System.clearProperty(SSLPreferenceConstants.TRUSTSTORE_FILE);

View File

@@ -19,9 +19,7 @@ import java.util.Collection;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
@@ -81,8 +79,6 @@ public abstract class AbstractRoutineSynchronizer implements ITalendSynchronizer
}
private Collection<RoutineItem> getAll(ERepositoryObjectType type, boolean syncRef) throws SystemException {
// init code project
getRunProcessService().getTalendCodeJavaProject(type);
// remove routine with same name in reference project
final Map<String, RoutineItem> beansList = new HashMap<String, RoutineItem>();
for (IRepositoryViewObject obj : getRepositoryService().getProxyRepositoryFactory().getAll(type)) {
@@ -99,37 +95,27 @@ public abstract class AbstractRoutineSynchronizer implements ITalendSynchronizer
return (IRepositoryService) GlobalServiceRegister.getDefault().getService(IRepositoryService.class);
}
private Set<IRepositoryViewObject> getReferencedProjectRoutine(final Map<String, RoutineItem> beansList,
final Project project, ERepositoryObjectType routineType, boolean syncRef) throws SystemException {
// init ref code project
if (syncRef) {
getRunProcessService().getTalendCodeJavaProject(routineType, project.getTechnicalLabel());
}
Set<IRepositoryViewObject> routines = new HashSet<>();
routines.addAll(getRepositoryService().getProxyRepositoryFactory().getAll(project, routineType));
for (IRepositoryViewObject obj : routines) {
private void getReferencedProjectRoutine(final Map<String, RoutineItem> beansList, final Project project,
ERepositoryObjectType routineType, boolean syncRef) throws SystemException {
for (IRepositoryViewObject obj : getRepositoryService().getProxyRepositoryFactory().getAll(project, routineType)) {
final String key = obj.getProperty().getLabel();
// it does not have a routine with same name
if (!beansList.containsKey(key)) {
beansList.put(key, (RoutineItem) obj.getProperty().getItem());
}
}
for (ProjectReference projectReference : project.getProjectReferenceList()) {
routines.addAll(getReferencedProjectRoutine(beansList, new Project(projectReference.getReferencedProject()),
routineType, syncRef));
if (syncRef) {
// sync routine
syncRoutine((RoutineItem) obj.getProperty().getItem(), false, true, true);
}
}
if (syncRef) {
routines.stream().forEach(obj -> {
try {
syncRoutine((RoutineItem) obj.getProperty().getItem(), project.getTechnicalLabel(), true, true);
} catch (SystemException e) {
ExceptionHandler.process(e);
}
});
// sync system routine
syncSystemRoutine(project);
}
return routines;
for (ProjectReference projectReference : project.getProjectReferenceList()) {
getReferencedProjectRoutine(beansList, new Project(projectReference.getReferencedProject()), routineType, syncRef);
}
}
protected void syncSystemRoutine(Project project) throws SystemException {
@@ -142,17 +128,24 @@ public abstract class AbstractRoutineSynchronizer implements ITalendSynchronizer
}
protected IFile getRoutineFile(RoutineItem routineItem) throws SystemException {
return getRoutineFile(routineItem, ProjectManager.getInstance().getCurrentProject().getTechnicalLabel());
return getRoutineFile(routineItem, true);
}
protected IFile getRoutineFile(RoutineItem routineItem, String projectTechName) throws SystemException {
protected IFile getRoutineFile(RoutineItem routineItem, boolean currentProject) throws SystemException {
String projectTechName;
if (currentProject) {
projectTechName = ProjectManager.getInstance().getCurrentProject().getTechnicalLabel();
} else {
projectTechName = ProjectManager.getInstance().getProject(routineItem).getTechnicalLabel();
}
ITalendProcessJavaProject talendProcessJavaProject = getRunProcessService()
.getTalendCodeJavaProject(ERepositoryObjectType.getItemType(routineItem), projectTechName);
if (talendProcessJavaProject == null) {
return null;
}
IFolder routineFolder = talendProcessJavaProject.getSrcSubFolder(null, routineItem.getPackageType());
return routineFolder.getFile(routineItem.getProperty().getLabel() + JavaUtils.JAVA_EXTENSION);
IFile file = routineFolder.getFile(routineItem.getProperty().getLabel() + JavaUtils.JAVA_EXTENSION);
return file;
}
private IFile getProcessFile(ProcessItem item) throws SystemException {
@@ -200,31 +193,30 @@ public abstract class AbstractRoutineSynchronizer implements ITalendSynchronizer
@Override
public void syncRoutine(RoutineItem routineItem, boolean copyToTemp) throws SystemException {
syncRoutine(routineItem, ProjectManager.getInstance().getCurrentProject().getTechnicalLabel(), copyToTemp, false);
syncRoutine(routineItem, true, copyToTemp, false);
}
@Override
public void syncRoutine(RoutineItem routineItem, boolean copyToTemp, boolean forceUpdate) throws SystemException {
syncRoutine(routineItem, ProjectManager.getInstance().getCurrentProject().getTechnicalLabel(), copyToTemp, forceUpdate);
syncRoutine(routineItem, true, copyToTemp, forceUpdate);
}
@Override
public void syncRoutine(RoutineItem routineItem, String projectTechName, boolean copyToTemp, boolean forceUpdate)
throws SystemException {
public void syncRoutine(RoutineItem routineItem, boolean currentProject, boolean copyToTemp, boolean forceUpdate) throws SystemException {
boolean needSync = false;
if (routineItem != null) {
if (forceUpdate || !isRoutineUptodate(routineItem)) {
needSync = true;
} else {
IFile file = getRoutineFile(routineItem, projectTechName);
IFile file = getRoutineFile(routineItem, currentProject);
if (file != null && !file.exists()) {
needSync = true;
}
}
}
if (needSync) {
doSyncRoutine(routineItem, projectTechName, copyToTemp);
if (ProjectManager.getInstance().getCurrentProject().getTechnicalLabel().equals(projectTechName)) {
doSyncRoutine(routineItem, currentProject, copyToTemp);
if (currentProject) {
setRoutineAsUptodate(routineItem);
}
}
@@ -232,14 +224,14 @@ public abstract class AbstractRoutineSynchronizer implements ITalendSynchronizer
public void syncRoutine(RoutineItem routineItem) throws SystemException {
if (routineItem != null) {
doSyncRoutine(routineItem, ProjectManager.getInstance().getCurrentProject().getTechnicalLabel(), true);
doSyncRoutine(routineItem, true, true);
setRoutineAsUptodate(routineItem);
}
}
private void doSyncRoutine(RoutineItem routineItem, String projectTechName, boolean copyToTemp) throws SystemException {
private void doSyncRoutine(RoutineItem routineItem, boolean currentProject, boolean copyToTemp) throws SystemException {
try {
IFile file = getRoutineFile(routineItem, projectTechName);
IFile file = getRoutineFile(routineItem, currentProject);
if (file == null) {
return;
}
@@ -382,7 +374,7 @@ public abstract class AbstractRoutineSynchronizer implements ITalendSynchronizer
@Override
public void syncAllBeansForLogOn() throws SystemException {
for (RoutineItem beanItem : getBeans(true)) {
syncRoutine(beanItem, true, true);
syncRoutine(beanItem, true, true, true);
}
}

View File

@@ -45,8 +45,7 @@ public interface ITalendSynchronizer {
void syncRoutine(RoutineItem routineItem, boolean copyToTemp, boolean forceUpdate) throws SystemException;
void syncRoutine(RoutineItem routineItem, String projectTechName, boolean copyToTemp, boolean forceUpdate)
throws SystemException;
void syncRoutine(RoutineItem routineItem, boolean currentProject, boolean copyToTemp, boolean forceUpdate) throws SystemException;
IFile getFile(Item item) throws SystemException;

View File

@@ -195,7 +195,4 @@ public interface IDesignerCoreService extends IService {
public void setTACReadTimeout(int timeout);
boolean isDelegateNode(INode node);
boolean isNeedContextInJar(IProcess process);
}

View File

@@ -12,7 +12,6 @@
// ============================================================================
package org.talend.designer.runprocess;
import java.util.Collection;
import java.util.Map;
import java.util.Set;
@@ -255,9 +254,6 @@ public interface IProcessor {
public String[] getCommandLine(boolean needContext, boolean externalUse, int statOption, int traceOption,
String... codeOptions);
public String[] getCommandLine(boolean needContext, boolean externalUse, int statOption, int traceOption, boolean ignoreCustomJVMSetting,
String... codeOptions);
public void setContext(IContext context);
@@ -299,8 +295,6 @@ public interface IProcessor {
String[] getJVMArgs();
Set<ModuleNeeded> getNeededModules(int options);
public void updateModulesAfterSetLog4j(Collection<ModuleNeeded> modulesNeeded);
Set<JobInfo> getBuildChildrenJobs();

View File

@@ -216,8 +216,6 @@ public interface IRunProcessService extends IService {
ITalendProcessJavaProject getTalendJobJavaProject(Property property);
IFolder getCodeSrcFolder(ERepositoryObjectType type, String projectTechName);
ITalendProcessJavaProject getTempJavaProject();
void clearProjectRelatedSettings();

View File

@@ -71,12 +71,7 @@ public class ItemCacheManager {
processItem = getRefProcessItem(ProjectManager.getInstance().getCurrentProject(), parsedArray[1]);
} else {
Project project = ProjectManager.getInstance().getProjectFromProjectTechLabel(parsedArray[0]);
if (project != null) {
processItem = getProcessItem(project, parsedArray[1]);
}
if (processItem == null) {
processItem = getRefProcessItem(ProjectManager.getInstance().getCurrentProject(), parsedArray[1]);
}
processItem = getProcessItem(project, parsedArray[1]);
}
return processItem;
}
@@ -117,12 +112,7 @@ public class ItemCacheManager {
refProcessItem = getRefProcessItem(ProjectManager.getInstance().getCurrentProject(), parsedArray[1], version);
} else {
Project project = ProjectManager.getInstance().getProjectFromProjectTechLabel(parsedArray[0]);
if (project != null) {
refProcessItem = getProcessItem(project, parsedArray[1], version);
}
if (refProcessItem == null) {
refProcessItem = getRefProcessItem(ProjectManager.getInstance().getCurrentProject(), parsedArray[1], version);
}
refProcessItem = getProcessItem(project, parsedArray[1], version);
}
return refProcessItem;
}

View File

@@ -200,10 +200,6 @@ public final class ProjectManager {
* return all the referenced projects of current project.
*/
public List<Project> getAllReferencedProjects(boolean force) {
return getAllReferencedProjects(getCurrentProject(), force);
}
public List<Project> getAllReferencedProjects(Project targetProject, boolean force) {
List<Project> allReferencedprojects = new ArrayList<Project>();
if (GlobalServiceRegister.getDefault().isServiceRegistered(IProxyRepositoryService.class)) {
if (this.getCurrentProject() == null) {
@@ -216,7 +212,7 @@ public final class ProjectManager {
IProxyRepositoryFactory factory = service.getProxyRepositoryFactory();
if (factory != null) {
List<org.talend.core.model.properties.Project> rProjects = factory
.getReferencedProjects(targetProject);
.getReferencedProjects(this.getCurrentProject());
if (rProjects != null) {
for (org.talend.core.model.properties.Project p : rProjects) {
Project project = new Project(p);

View File

@@ -138,6 +138,4 @@ public interface IRepositoryService extends IService {
boolean isGIT();
public void setShouldCheckRepoViewCommonNavigatorDirty(IRepositoryView repView, boolean shouldFlag);
}

View File

@@ -98,8 +98,6 @@ public class RepositoryConstants {
public static final String REPOSITORY_CLOUD_APAC_ID = "cloud_apac"; //$NON-NLS-1$
public static final String REPOSITORY_CLOUD_US_WEST_ID = "cloud_us_west"; //$NON-NLS-1$
public static final String REPOSITORY_CLOUD_CUSTOM_ID = "cloud_custom"; //$NON-NLS-1$
public static final String REPOSITORY_URL = "url"; //$NON-NLS-1$

View File

@@ -35,7 +35,6 @@ import org.talend.core.model.general.ConnectionBean;
import org.talend.utils.json.JSONArray;
import org.talend.utils.json.JSONException;
import org.talend.utils.json.JSONObject;
import org.talend.utils.security.EncryptedProperties;
/**
* DOC hwang class global comment. Detailled comment
@@ -127,8 +126,8 @@ public class ConnectionUserPerReader {
if (!isHaveUserPer()) {
createPropertyFile();
}
try (FileInputStream fi = new FileInputStream(perfile)) {
proper.load(fi);
try {
proper.load(new FileInputStream(perfile));
isRead = true;
} catch (FileNotFoundException e) {
e.printStackTrace();
@@ -177,7 +176,9 @@ public class ConnectionUserPerReader {
}
proper.setProperty("connection.define", usersJsonArray.toString());//$NON-NLS-1$
}
try (FileOutputStream out = new FileOutputStream(perfile)) {
try {
FileOutputStream out = new FileOutputStream(perfile);
proper.store(out, null);
} catch (Exception e) {
e.printStackTrace();
@@ -201,8 +202,9 @@ public class ConnectionUserPerReader {
proper.remove("connection.lastConnection"); //$NON-NLS-1$
}
}
;
try (FileOutputStream out = new FileOutputStream(perfile)) {
FileOutputStream out;
try {
out = new FileOutputStream(perfile);
proper.store(out, null);
} catch (Exception e) {
e.printStackTrace();
@@ -284,7 +286,9 @@ public class ConnectionUserPerReader {
IPreferenceStore prefStore = PlatformUI.getPreferenceStore();
proper.setProperty("connection.readRegistration", Integer.toString(prefStore.getInt("REGISTRATION_TRIES")));
proper.setProperty("connection.readRegistrationDone", Integer.toString(prefStore.getInt("REGISTRATION_DONE")));
try (FileOutputStream out = new FileOutputStream(perfile)) {
try {
FileOutputStream out = new FileOutputStream(perfile);
proper.store(out, null);
} catch (Exception e) {
e.printStackTrace();
@@ -313,7 +317,8 @@ public class ConnectionUserPerReader {
String val = entry.getValue();
proper.setProperty(key, val);
}
try (FileOutputStream out = new FileOutputStream(perfile)) {
try {
FileOutputStream out = new FileOutputStream(perfile);
proper.store(out, null);
} catch (Exception e) {
e.printStackTrace();
@@ -329,7 +334,9 @@ public class ConnectionUserPerReader {
}
IPreferenceStore prefStore = PlatformUI.getPreferenceStore();
proper.setProperty("connection.licenseManagement", Integer.toString(prefStore.getInt("LICENSE_VALIDATION_DONE")));
try (FileOutputStream out = new FileOutputStream(perfile)) {
try {
FileOutputStream out = new FileOutputStream(perfile);
proper.store(out, null);
} catch (Exception e) {
e.printStackTrace();
@@ -355,7 +362,8 @@ public class ConnectionUserPerReader {
this.readProperties();
}
proper.setProperty("connection.installDone", Boolean.TRUE.toString()); //$NON-NLS-1$
try (FileOutputStream out = new FileOutputStream(perfile)) {
try {
FileOutputStream out = new FileOutputStream(perfile);
proper.store(out, null);
} catch (Exception e) {
e.printStackTrace();

View File

@@ -10,11 +10,11 @@
// 9 rue Pages 92150 Suresnes, France
//
// ============================================================================
package org.talend.utils.security;
package org.talend.repository.ui.login.connections;
import java.util.Properties;
import org.talend.utils.security.StudioEncryption;
import org.talend.daikon.security.CryptoHelper;
/**
@@ -22,10 +22,15 @@ import org.talend.utils.security.StudioEncryption;
*/
public class EncryptedProperties extends Properties {
private CryptoHelper crypto;
public EncryptedProperties() {
crypto = new CryptoHelper("Il faudrait trouver une passphrase plus originale que celle-ci!");
}
public String getProperty(String key) {
try {
return StudioEncryption.getStudioEncryption(StudioEncryption.EncryptionKeyName.SYSTEM)
.decrypt(super.getProperty(key));
return crypto.decrypt(super.getProperty(key));
} catch (Exception e) {
throw new RuntimeException("Couldn't decrypt property");
}
@@ -33,8 +38,7 @@ public class EncryptedProperties extends Properties {
public synchronized Object setProperty(String key, String value) {
try {
return super.setProperty(key,
StudioEncryption.getStudioEncryption(StudioEncryption.EncryptionKeyName.SYSTEM).encrypt(value));
return super.setProperty(key, crypto.encrypt(value));
} catch (Exception e) {
throw new RuntimeException("Couldn't encrypt property");
}

View File

@@ -152,11 +152,11 @@ public class FilteredCheckboxTree extends Composite {
*/
static {
ImageDescriptor descriptor = AbstractUIPlugin.imageDescriptorFromPlugin(PlatformUI.PLUGIN_ID,
"$nl$/icons/full/etool16/clear_co.png"); //$NON-NLS-1$
"$nl$/icons/full/etool16/clear_co.gif"); //$NON-NLS-1$
if (descriptor != null) {
JFaceResources.getImageRegistry().put(CLEAR_ICON, descriptor);
}
descriptor = AbstractUIPlugin.imageDescriptorFromPlugin(PlatformUI.PLUGIN_ID, "$nl$/icons/full/dtool16/clear_co.png"); //$NON-NLS-1$
descriptor = AbstractUIPlugin.imageDescriptorFromPlugin(PlatformUI.PLUGIN_ID, "$nl$/icons/full/dtool16/clear_co.gif"); //$NON-NLS-1$
if (descriptor != null) {
JFaceResources.getImageRegistry().put(DCLEAR_ICON, descriptor);
}

View File

@@ -472,7 +472,7 @@ public class ContextNebulaGridComposite extends AbstractContextTabEditComposite
paramNameFound = true;
paramName = NEW_PARAM_NAME + numParam;
for (int i = 0; i < listParams.size(); i++) {
if (paramName.equalsIgnoreCase(listParams.get(i).getName())) {
if (paramName.equals(listParams.get(i).getName())) {
paramNameFound = false;
}
}

View File

@@ -715,13 +715,6 @@ public class SelectRepositoryContextDialog extends SelectionDialog {
if (param != null && param.isBuiltIn()) {
return false;
}
if (param == null) {
boolean containsSameParameterIgnoreCase = manager.getDefaultContext()
.containsSameParameterIgnoreCase(paramType.getName());
if (containsSameParameterIgnoreCase) {
return false;
}
}
}
return true;
}

View File

@@ -47,9 +47,7 @@ import org.talend.commons.utils.VersionUtils;
import org.talend.core.CorePlugin;
import org.talend.core.model.genhtml.FileCopyUtils;
import org.talend.core.prefs.ITalendCorePrefConstants;
import org.talend.core.repository.model.ProxyRepositoryFactory;
import org.talend.core.ui.i18n.Messages;
import org.talend.repository.model.IProxyRepositoryFactory;
public abstract class I18nPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage {
@@ -140,27 +138,19 @@ public abstract class I18nPreferencePage extends FieldEditorPreferencePage imple
serbian = "Serbian"; //$NON-NLS-1$
}
String slovak = "Sloven\u010dina";//$NON-NLS-1$
try {
utf8Bytes = slovak.getBytes("UTF8");//$NON-NLS-1$
slovak = new String(utf8Bytes, "UTF8");//$NON-NLS-1$
} catch (UnsupportedEncodingException e2) {
slovak = "Slovak";//$NON-NLS-1$
}
String[][] entryNamesAndValues = { { Locale.ENGLISH.getDisplayLanguage(Locale.ENGLISH), Locale.ENGLISH.getLanguage() },
{ Locale.FRENCH.getDisplayLanguage(Locale.FRENCH) + " (French)", Locale.FRENCH.getLanguage() }, //$NON-NLS-1$
{ Locale.CHINESE.getDisplayLanguage(Locale.CHINESE) + " (Chinese)", "zh_CN" }, //$NON-NLS-1$ //$NON-NLS-2$
{ Locale.GERMAN.getDisplayLanguage(Locale.GERMAN) + " (German)", Locale.GERMAN.getLanguage() }, //$NON-NLS-1$
{ Locale.JAPANESE.getDisplayLanguage(Locale.JAPANESE) + " (Japanese)", Locale.JAPANESE.getLanguage() }, //$NON-NLS-1$
{ Locale.ITALIAN.getDisplayLanguage(Locale.ITALIAN) + " (Italian)", Locale.ITALIAN.getLanguage() }, //$NON-NLS-1$
{ "Brasil (Brazilian)", "pt_BR" }, //$NON-NLS-1$ //$NON-NLS-2$
{ spanish + " (Spanish)", "es" }, { russian + " (Russion)", "ru" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
{ Locale.KOREA.getDisplayLanguage(Locale.KOREA) + " (Korean)", "kr" }, { "Turkish (Turkish)", "tr" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
{ greek + " (Greek)", "el" }, { "Hrvatski (Croatian)", "hr" }, { arabic + " (Arabic)", "ar" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$//$NON-NLS-5$ //$NON-NLS-6$
{ serbian + " (Serbian)", "sr" }, { "Polski (Polish)", "pl" }, { "Romanian (Romanian)", "ro" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$//$NON-NLS-5$ //$NON-NLS-6$
{ "Netherlands (Netherlands)", "nl" }, { slovak + " (Slovak)", "sk" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
{ "Current OS Language", Locale.getDefault().getLanguage() } };//$NON-NLS-1$
String[][] entryNamesAndValues =
{ { Locale.ENGLISH.getDisplayLanguage(Locale.ENGLISH), Locale.ENGLISH.getLanguage() },
{ Locale.FRENCH.getDisplayLanguage(Locale.FRENCH), Locale.FRENCH.getLanguage() },
{ Locale.CHINESE.getDisplayLanguage(Locale.CHINESE), "zh_CN" },
{ Locale.GERMAN.getDisplayLanguage(Locale.GERMAN), Locale.GERMAN.getLanguage() },
{ Locale.JAPANESE.getDisplayLanguage(Locale.JAPANESE), Locale.JAPANESE.getLanguage() },
{ Locale.ITALIAN.getDisplayLanguage(Locale.ITALIAN), Locale.ITALIAN.getLanguage() },
{ "Brasil", "pt_BR" }, //$NON-NLS-1$ //$NON-NLS-2$
{ spanish, "es" }, { russian, "ru" }, //$NON-NLS-1$ //$NON-NLS-2$
{ Locale.KOREA.getDisplayLanguage(Locale.KOREA), "kr" }, { "Turkish", "tr" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
{ greek, "el" }, { "Hrvatski", "hr" }, { arabic, "ar" }, { serbian, "sr" }, { "Polski", "pl" },
{ "Romanian", "ro" }, { "Netherlands", "nl" } }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
// // /$NON-NLS-7$
languageSelectionEditor = new OneLineComboFieldEditor(ITalendCorePrefConstants.LANGUAGE_SELECTOR,
Messages.getString("I18nPreferencePage.needRestart"), entryNamesAndValues, getFieldEditorParent()); //$NON-NLS-1$
addField(languageSelectionEditor);
@@ -229,8 +219,6 @@ public abstract class I18nPreferencePage extends FieldEditorPreferencePage imple
}
}
});
handleUserReadOnlyStatus(composite);
}
private void applyBabiliResource(String zipFileName) {
@@ -661,27 +649,4 @@ public abstract class I18nPreferencePage extends FieldEditorPreferencePage imple
fields.add(editor);
}
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.preference.PreferencePage#contributeButtons(org.eclipse.swt.widgets.Composite)
*/
@Override
protected void contributeButtons(Composite parent) {
super.contributeButtons(parent);
handleUserReadOnlyStatus(parent);
}
/**
*
* When the user is read only for current project then setting composite is disable
*
* @param mainComposite
*/
public void handleUserReadOnlyStatus(Composite mainComposite) {
IProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
if (factory.isUserReadOnlyOnCurrentProject()) {
mainComposite.setEnabled(false);
}
}
}

View File

@@ -18,8 +18,8 @@ import org.talend.core.GlobalServiceRegister;
import org.talend.core.prefs.ITalendCorePrefConstants;
import org.talend.core.ui.CoreUIPlugin;
import org.talend.core.ui.branding.IBrandingService;
import org.talend.daikon.security.CryptoHelper;
import org.talend.daikon.token.TokenGenerator;
import org.talend.utils.security.StudioEncryption;
import us.monoid.json.JSONObject;
@@ -47,7 +47,7 @@ public class DefaultTokenCollector extends AbstractTokenCollector {
}
public static String calcUniqueId() {
return TokenGenerator.generateMachineToken((src) -> StudioEncryption.getStudioEncryption(StudioEncryption.EncryptionKeyName.SYSTEM).encrypt(src));
return TokenGenerator.generateMachineToken(new CryptoHelper(CryptoHelper.PASSPHRASE));
}
/*

View File

@@ -54,7 +54,6 @@ import org.talend.core.model.metadata.QueryUtil;
import org.talend.core.model.metadata.builder.ConvertionHelper;
import org.talend.core.model.metadata.builder.connection.MetadataTable;
import org.talend.core.model.process.ElementParameterParser;
import org.talend.core.model.process.ProcessUtils;
import org.talend.core.model.properties.Item;
import org.talend.core.model.relationship.RelationshipItemBuilder;
import org.talend.core.model.repository.IRepositoryViewObject;
@@ -281,10 +280,9 @@ public class CoreService implements ICoreService {
ICodeGeneratorService codeGenService = (ICodeGeneratorService) GlobalServiceRegister.getDefault().getService(
ICodeGeneratorService.class);
codeGenService.createRoutineSynchronizer().syncAllRoutinesForLogOn();
if (ProcessUtils.isRequiredPigUDFs(null)) {
codeGenService.createRoutineSynchronizer().syncAllPigudfForLogOn();
}
codeGenService.createRoutineSynchronizer().syncAllPigudfForLogOn();
}
}
@Override

View File

@@ -16,7 +16,7 @@ import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import org.talend.commons.exception.ExceptionHandler;
import org.talend.commons.exception.WarningException;
/**
* cli class global comment. Detailled comment
@@ -104,31 +104,26 @@ public final class ProcessStreamTrashReaderUtil {
public static void readAndForget(final Process process) {
try {
final String encoding = "UTF-8";
// input stream thread
new Thread() {
public void run() {
InputStream is = process.getInputStream();
InputStreamReader din = new InputStreamReader(is);
BufferedReader reader = new BufferedReader(din);
try {
InputStream is = process.getInputStream();
InputStreamReader din = new InputStreamReader(is, encoding);
BufferedReader reader = new BufferedReader(din);
String line = null;
while ((line = reader.readLine()) != null) {
System.out.println("getInputStream " + line); //$NON-NLS-1$
}
} catch (Exception ex) {
// nothing to do
} finally {
try {
String line = null;
while ((line = reader.readLine()) != null) {
System.out.println("getInputStream " + line); //$NON-NLS-1$
}
is.close();
} catch (Exception ex) {
// nothing to do
} finally {
try {
is.close();
} catch (Exception ex) {
// nothing to do
}
}
} catch (Exception e) {
ExceptionHandler.process(e);
}
}
}.start();
@@ -137,31 +132,23 @@ public final class ProcessStreamTrashReaderUtil {
new Thread() {
public void run() {
InputStream is = process.getErrorStream();
InputStreamReader din = new InputStreamReader(is);
BufferedReader reader = new BufferedReader(din);
try {
InputStream is = process.getErrorStream();
InputStreamReader din = new InputStreamReader(is, encoding);
BufferedReader reader = new BufferedReader(din);
StringBuilder strBuilder = new StringBuilder();
String line = null;
while ((line = reader.readLine()) != null) {
System.out.println("getErrorStream " + line); //$NON-NLS-1$
throw new WarningException("AAAAA");
}
} catch (Exception ex) {
// nothing to do
} finally {
try {
String line = null;
while ((line = reader.readLine()) != null) {
System.out.println("getErrorStream " + line); //$NON-NLS-1$
strBuilder.append(line).append("\n");
}
is.close();
} catch (Exception ex) {
// nothing to do
} finally {
try {
is.close();
} catch (Exception ex) {
// nothing to do
}
}
if (!strBuilder.toString().replaceAll("[\n]", " ").trim().isEmpty()) {
throw new Exception(strBuilder.toString());
}
} catch (Exception e) {
ExceptionHandler.process(e);
}
}
}.start();

View File

@@ -756,7 +756,7 @@ public class ProcessorUtilities {
public static boolean hasMetadataDynamic(IProcess currentProcess, JobInfo jobInfo) {
boolean hasDynamicMetadata = false;
if (GlobalServiceRegister.getDefault().isServiceRegistered(IDesignerCoreService.class) && !isExportConfig()) {
if (GlobalServiceRegister.getDefault().isServiceRegistered(IDesignerCoreService.class)) {
IDesignerCoreService designerCoreService =
(IDesignerCoreService) GlobalServiceRegister.getDefault().getService(IDesignerCoreService.class);
for (INode node : currentProcess.getGraphicalNodes()) {
@@ -1073,11 +1073,9 @@ public class ProcessorUtilities {
JobInfo parentJob = jobInfo.getFatherJobInfo();
if (parentJob != null && (parentJob.getProcessor() != null)) {
for (JobInfo subJob : parentJob.getProcessor().getBuildChildrenJobs()) {
if (ProcessUtils.isSameProperty(subJob.getJobId(), jobInfo.getJobId(), false)) {
subJob.setProcessor(processor);
}
}
}
if (!timerStarted) {
@@ -1231,23 +1229,14 @@ public class ProcessorUtilities {
public static void cleanSourceFolder(IProgressMonitor progressMonitor, IProcess currentProcess,
IProcessor processor) {
try {
ITalendProcessJavaProject jobProject = processor.getTalendJavaProject();
// clean up source code
IPath codePath = processor.getSrcCodePath().removeLastSegments(2);
IFolder srcFolder = jobProject.getProject().getFolder(codePath);
IFolder srcFolder = processor.getTalendJavaProject().getProject().getFolder(codePath);
String jobPackageFolder = JavaResourcesHelper.getJobClassPackageFolder(currentProcess);
for (IResource resource : srcFolder.members()) {
if (!resource.getProjectRelativePath().toPortableString().endsWith(jobPackageFolder)) {
resource.delete(true, progressMonitor);
}
}
// clean up resources folder if needed
if (ProcessorUtilities.isExportConfig() && !designerCoreService.isNeedContextInJar(currentProcess)) {
for (IResource resource : jobProject.getResourcesFolder().members()) {
if (resource.exists()) {
resource.delete(true, progressMonitor);
}
if (resource.getProjectRelativePath().toPortableString().endsWith(jobPackageFolder)) {
break;
}
resource.delete(true, progressMonitor);
}
} catch (CoreException e) {
ExceptionHandler.process(e);
@@ -2037,15 +2026,7 @@ public class ProcessorUtilities {
public static String[] getCommandLine(String targetPlatform, boolean skipClasspathJar, boolean externalUse,
String processId, String contextName, int statisticPort, int tracePort, String... codeOptions)
throws ProcessorException {
return getCommandLine(targetPlatform, skipClasspathJar, externalUse,
processId, contextName, statisticPort, tracePort, false, codeOptions);
}
//ignoreCustomJVMSetting mean will generate the java command without the job VM setting in studio "Run job" setting and studio preferences "Run/Debug" setting
//only use for TDI-42443 in tRunJob
public static String[] getCommandLine(String targetPlatform, boolean skipClasspathJar, boolean externalUse,
String processId, String contextName, int statisticPort, int tracePort, boolean ignoreCustomJVMSetting, String... codeOptions)
throws ProcessorException {
IProcessor processor = findProcessorFromJobList(processId, contextName, null);
if (processor != null && targetPlatform.equals(processor.getTargetPlatform())) {
if (processor.isProcessUnloaded()) {
@@ -2054,7 +2035,7 @@ public class ProcessorUtilities {
boolean oldSkipClasspathJar = processor.isSkipClasspathJar();
processor.setSkipClasspathJar(skipClasspathJar);
try {
return processor.getCommandLine(true, externalUse, statisticPort, tracePort, ignoreCustomJVMSetting, codeOptions);
return processor.getCommandLine(true, externalUse, statisticPort, tracePort, codeOptions);
} finally {
processor.setSkipClasspathJar(oldSkipClasspathJar);
}
@@ -2072,7 +2053,7 @@ public class ProcessorUtilities {
}
// because all jobs are based one new way, set the flag "oldBuildJob" to false.
return getCommandLine(false, skipClasspathJar, targetPlatform, externalUse, process,
selectedProcessItem.getProperty(), contextName, true, statisticPort, tracePort, ignoreCustomJVMSetting, codeOptions);
selectedProcessItem.getProperty(), contextName, true, statisticPort, tracePort, codeOptions);
}
/**
@@ -2146,14 +2127,6 @@ public class ProcessorUtilities {
public static String[] getCommandLine(boolean oldBuildJob, boolean skipClasspathJar, String targetPlatform,
boolean externalUse, IProcess currentProcess, Property property, String contextName, boolean needContext,
int statisticPort, int tracePort, String... codeOptions) throws ProcessorException {
return getCommandLine(oldBuildJob, skipClasspathJar, targetPlatform,
externalUse, currentProcess, property, contextName, needContext,
statisticPort, tracePort, false, codeOptions);
}
private static String[] getCommandLine(boolean oldBuildJob, boolean skipClasspathJar, String targetPlatform,
boolean externalUse, IProcess currentProcess, Property property, String contextName, boolean needContext,
int statisticPort, int tracePort, boolean ignoreCustomJVMSetting, String... codeOptions) throws ProcessorException {
if (currentProcess == null) {
return new String[] {};
}
@@ -2166,7 +2139,7 @@ public class ProcessorUtilities {
processor.setSkipClasspathJar(skipClasspathJar);
processor.setTargetPlatform(targetPlatform);
processor.setOldBuildJob(oldBuildJob);
return processor.getCommandLine(needContext, externalUse, statisticPort, tracePort, ignoreCustomJVMSetting, codeOptions);
return processor.getCommandLine(needContext, externalUse, statisticPort, tracePort, codeOptions);
}
public static String[] getCommandLine(boolean oldBuildJob, String targetPlatform, boolean externalUse,
@@ -2615,44 +2588,15 @@ public class ProcessorUtilities {
return doSupportDynamicHadoopConfLoading(property) && !isExportAsOSGI();
}
public static boolean isEsbJob(IProcess process) {
return isEsbJob(process, false);
}
public static boolean isEsbJob(IProcess process, boolean checkCurrentProcess) {
if (process instanceof IProcess2) {
if (checkCurrentProcess) {
for (INode n : process.getGraphicalNodes()) {
if (isEsbComponentName(n.getComponent().getName())) {
return true;
}
}
} else {
Set<JobInfo> infos = ProcessorUtilities.getChildrenJobInfo(((IProcess2) process).getProperty().getItem(), false);
for (JobInfo jobInfo : infos) {
ProcessType processType = jobInfo.getProcessItem().getProcess();
EList<NodeType> nodes = processType.getNode();
for (NodeType nodeType : nodes) {
if (isEsbComponentName(nodeType.getComponentName())) {
return true;
}
}
}
}
return false;
}
return false;
public static boolean isEsbJob(String processId, String version) {
return esbJobs.contains(esbJobKey(processId, version));
}
private static void addEsbJob(JobInfo jobInfo) {
if (esbJobs.contains(esbJobKey(jobInfo.getJobId(), jobInfo.getJobVersion()))) {
return;
}
esbJobs.add(esbJobKey(jobInfo.getJobId(), jobInfo.getJobVersion()));
if (jobInfo.getFatherJobInfo() != null) {
addEsbJob(jobInfo.getFatherJobInfo());
@@ -2684,4 +2628,5 @@ public class ProcessorUtilities {
public static boolean isNeedProjectProcessId(String componentName) {
return "tRunJob".equalsIgnoreCase(componentName) || "cTalendJob".equalsIgnoreCase(componentName);
}
}

View File

@@ -1,33 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry exported="true" kind="lib" path="lib/maven-resolver-transport-file.jar"/>
<classpathentry exported="true" kind="lib" path="lib/maven-resolver-transport-http.jar"/>
<classpathentry exported="true" kind="lib" path="lib/wagon-file.jar"/>
<classpathentry exported="true" kind="lib" path="lib/jsoup.jar"/>
<classpathentry exported="true" kind="lib" path="lib/wagon-http-shared.jar"/>
<classpathentry exported="true" kind="lib" path="lib/wagon-http.jar"/>
<classpathentry exported="true" kind="lib" path="lib/commons-codec.jar"/>
<classpathentry exported="true" kind="lib" path="lib/httpclient.jar"/>
<classpathentry exported="true" kind="lib" path="lib/httpcore.jar"/>
<classpathentry exported="true" kind="lib" path="lib/jcl-over-slf4j.jar"/>
<classpathentry exported="true" kind="lib" path="lib/maven-resolver-api.jar"/>
<classpathentry exported="true" kind="lib" path="lib/maven-resolver-connector-basic.jar"/>
<classpathentry exported="true" kind="lib" path="lib/maven-resolver-impl.jar"/>
<classpathentry exported="true" kind="lib" path="lib/maven-resolver-spi.jar"/>
<classpathentry exported="true" kind="lib" path="lib/maven-resolver-transport-classpath.jar"/>
<classpathentry exported="true" kind="lib" path="lib/maven-resolver-transport-wagon.jar"/>
<classpathentry exported="true" kind="lib" path="lib/maven-resolver-util.jar"/>
<classpathentry exported="true" kind="lib" path="lib/plexus-utils.jar"/>
<classpathentry exported="true" kind="lib" path="lib/slf4j-api.jar"/>
<classpathentry exported="true" kind="lib" path="lib/wagon-provider-api.jar"/>
<classpathentry exported="true" kind="lib" path="lib/maven-aether-provider-3.2.1.jar"/>
<classpathentry exported="true" kind="lib" path="lib/maven-model-3.2.1.jar"/>
<classpathentry exported="true" kind="lib" path="lib/maven-model-builder-3.2.1.jar"/>
<classpathentry exported="true" kind="lib" path="lib/maven-repository-metadata-3.2.1.jar"/>
<classpathentry exported="true" kind="lib" path="lib/plexus-interpolation-1.19.jar"/>
<classpathentry exported="true" kind="lib" path="lib/plexus-utils-3.0.17.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src/main/java"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry exported="true" kind="lib" path="lib/commons-codec.jar"/>
<classpathentry exported="true" kind="lib" path="lib/httpclient.jar"/>
<classpathentry exported="true" kind="lib" path="lib/httpcore.jar"/>
<classpathentry exported="true" kind="lib" path="lib/jcl-over-slf4j.jar"/>
<classpathentry exported="true" kind="lib" path="lib/maven-resolver-api.jar"/>
<classpathentry exported="true" kind="lib" path="lib/maven-resolver-connector-basic.jar"/>
<classpathentry exported="true" kind="lib" path="lib/maven-resolver-impl.jar"/>
<classpathentry exported="true" kind="lib" path="lib/maven-resolver-spi.jar"/>
<classpathentry exported="true" kind="lib" path="lib/maven-resolver-transport-classpath.jar"/>
<classpathentry exported="true" kind="lib" path="lib/maven-resolver-transport-file.jar"/>
<classpathentry exported="true" kind="lib" path="lib/maven-resolver-transport-http.jar"/>
<classpathentry exported="true" kind="lib" path="lib/maven-resolver-transport-wagon.jar"/>
<classpathentry exported="true" kind="lib" path="lib/maven-resolver-util.jar"/>
<classpathentry exported="true" kind="lib" path="lib/plexus-utils.jar"/>
<classpathentry exported="true" kind="lib" path="lib/slf4j-api.jar"/>
<classpathentry exported="true" kind="lib" path="lib/wagon-provider-api.jar"/>
<classpathentry exported="true" kind="lib" path="lib/maven-aether-provider-3.2.1.jar"/>
<classpathentry exported="true" kind="lib" path="lib/maven-model-3.2.1.jar"/>
<classpathentry exported="true" kind="lib" path="lib/maven-model-builder-3.2.1.jar"/>
<classpathentry exported="true" kind="lib" path="lib/maven-repository-metadata-3.2.1.jar"/>
<classpathentry exported="true" kind="lib" path="lib/plexus-interpolation-1.19.jar"/>
<classpathentry exported="true" kind="lib" path="lib/plexus-utils-3.0.17.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src/main/java"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>

View File

@@ -26,17 +26,13 @@ Bundle-ClassPath: .,
lib/maven-resolver-impl.jar,
lib/maven-resolver-spi.jar,
lib/maven-resolver-transport-classpath.jar,
lib/maven-resolver-transport-file.jar,
lib/maven-resolver-transport-http.jar,
lib/maven-resolver-transport-wagon.jar,
lib/maven-resolver-util.jar,
lib/plexus-utils.jar,
lib/slf4j-api.jar,
lib/wagon-provider-api.jar,
lib/jsoup.jar,
lib/wagon-http-shared.jar,
lib/wagon-http.jar,
lib/wagon-file.jar,
lib/maven-resolver-transport-file.jar,
lib/maven-resolver-transport-http.jar
lib/wagon-provider-api.jar
Export-Package: org.talend.designer.maven.aether,
org.talend.designer.maven.aether.comparator,
org.talend.designer.maven.aether.node,

View File

@@ -2,10 +2,4 @@ source.. = src/main/java/
output.. = target/classes/
bin.includes = META-INF/,\
.,\
lib/,\
lib/jsoup.jar,\
lib/wagon-http-shared.jar,\
lib/wagon-http.jar,\
lib/wagon-file.jar,\
lib/maven-resolver-transport-file.jar,\
lib/maven-resolver-transport-http.jar
lib/

View File

@@ -11,7 +11,6 @@
<packaging>eclipse-plugin</packaging>
<properties>
<maven.resolver.version>1.3.1</maven.resolver.version>
<wagon.version>3.0.0</wagon.version>
</properties>
<dependencies>
@@ -46,20 +45,10 @@
<version>${maven.resolver.version}</version>
</dependency>
<dependency>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-file</artifactId>
<version>${wagon.version}</version>
</dependency>
<dependency>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-http</artifactId>
<version>${wagon.version}</version>
</dependency>
<dependency>
<groupId>org.apache.maven.resolver</groupId>
<groupId>org.apache.maven.resolver</groupId>
<artifactId>maven-resolver-transport-file</artifactId>
<version>${maven.resolver.version}</version>
</dependency>
</dependency>
<dependency>
<groupId>org.apache.maven.resolver</groupId>
<artifactId>maven-resolver-transport-http</artifactId>

View File

@@ -17,20 +17,24 @@ import java.util.HashMap;
import java.util.Map;
import org.apache.maven.repository.internal.MavenRepositorySystemUtils;
import org.codehaus.plexus.PlexusContainerException;
import org.eclipse.aether.DefaultRepositorySystemSession;
import org.eclipse.aether.RepositorySystem;
import org.eclipse.aether.artifact.Artifact;
import org.eclipse.aether.artifact.DefaultArtifact;
import org.eclipse.aether.connector.basic.BasicRepositoryConnectorFactory;
import org.eclipse.aether.deployment.DeployRequest;
import org.eclipse.aether.impl.DefaultServiceLocator;
import org.eclipse.aether.repository.Authentication;
import org.eclipse.aether.repository.LocalRepository;
import org.eclipse.aether.repository.RemoteRepository;
import org.eclipse.aether.spi.connector.RepositoryConnectorFactory;
import org.eclipse.aether.spi.connector.transport.TransporterFactory;
import org.eclipse.aether.transport.file.FileTransporterFactory;
import org.eclipse.aether.transport.http.HttpTransporterFactory;
import org.eclipse.aether.util.artifact.SubArtifact;
import org.eclipse.aether.util.listener.ChainedRepositoryListener;
import org.eclipse.aether.util.listener.ChainedTransferListener;
import org.eclipse.aether.util.repository.AuthenticationBuilder;
import org.talend.designer.maven.aether.util.MavenLibraryResolverProvider;
/**
* created by wchen on Aug 10, 2017 Detailled comment
@@ -40,16 +44,32 @@ public class RepositorySystemFactory {
private static Map<LocalRepository, DefaultRepositorySystemSession> sessions = new HashMap<LocalRepository, DefaultRepositorySystemSession>();
private static DefaultRepositorySystemSession newRepositorySystemSession(String localRepositoryPath)
throws PlexusContainerException {
private static RepositorySystem system;
private static RepositorySystem newRepositorySystem() {
DefaultServiceLocator locator = MavenRepositorySystemUtils.newServiceLocator();
locator.addService(RepositoryConnectorFactory.class, BasicRepositoryConnectorFactory.class);
locator.addService(TransporterFactory.class, FileTransporterFactory.class);
locator.addService(TransporterFactory.class, HttpTransporterFactory.class);
locator.setErrorHandler(new DefaultServiceLocator.ErrorHandler() {
@Override
public void serviceCreationFailed(Class<?> type, Class<?> impl, Throwable exception) {
exception.printStackTrace();
}
});
return locator.getService(RepositorySystem.class);
}
private static DefaultRepositorySystemSession newRepositorySystemSession(String localRepositoryPath) {
LocalRepository localRepo = new LocalRepository(localRepositoryPath);
DefaultRepositorySystemSession repositorySystemSession = sessions.get(localRepo);
if (repositorySystemSession == null) {
repositorySystemSession = MavenRepositorySystemUtils.newSession();
repositorySystemSession
.setLocalRepositoryManager(
MavenLibraryResolverProvider.newRepositorySystem().newLocalRepositoryManager(repositorySystemSession,
localRepo));
.setLocalRepositoryManager(system.newLocalRepositoryManager(repositorySystemSession, localRepo));
repositorySystemSession.setTransferListener(new ChainedTransferListener());
repositorySystemSession.setRepositoryListener(new ChainedRepositoryListener());
}
@@ -61,7 +81,9 @@ public class RepositorySystemFactory {
String userName, String password, String groupId, String artifactId, String classifier, String extension,
String version) throws Exception {
DefaultRepositorySystemSession session = null;
RepositorySystem system = MavenLibraryResolverProvider.newRepositorySystem();
if (system == null) {
system = newRepositorySystem();
}
session = newRepositorySystemSession(localRepository);
DeployRequest deployRequest = new DeployRequest();

View File

@@ -36,11 +36,10 @@ import org.eclipse.aether.artifact.Artifact;
import org.eclipse.aether.artifact.DefaultArtifact;
import org.eclipse.aether.collection.CollectRequest;
import org.eclipse.aether.collection.DependencySelector;
import org.eclipse.aether.connector.basic.BasicRepositoryConnectorFactory;
import org.eclipse.aether.graph.DefaultDependencyNode;
import org.eclipse.aether.graph.Exclusion;
import org.eclipse.aether.impl.DefaultServiceLocator;
import org.eclipse.aether.internal.transport.wagon.PlexusWagonConfigurator;
import org.eclipse.aether.internal.transport.wagon.PlexusWagonProvider;
import org.eclipse.aether.repository.Authentication;
import org.eclipse.aether.repository.LocalRepository;
import org.eclipse.aether.repository.RemoteRepository;
@@ -49,6 +48,10 @@ import org.eclipse.aether.resolution.ArtifactRequest;
import org.eclipse.aether.resolution.ArtifactResult;
import org.eclipse.aether.resolution.VersionRangeRequest;
import org.eclipse.aether.resolution.VersionRangeResult;
import org.eclipse.aether.spi.connector.RepositoryConnectorFactory;
import org.eclipse.aether.spi.connector.transport.TransporterFactory;
import org.eclipse.aether.transport.file.FileTransporterFactory;
import org.eclipse.aether.transport.http.HttpTransporterFactory;
import org.eclipse.aether.util.artifact.JavaScopes;
import org.eclipse.aether.util.graph.selector.AndDependencySelector;
import org.eclipse.aether.util.graph.selector.OptionalDependencySelector;
@@ -108,11 +111,11 @@ public class DynamicDistributionAetherUtils {
RepositorySystem repoSystem = null;
if (multiThread) {
repoSystem = MavenLibraryResolverProvider.newRepositorySystemForResolver();
repoSystem = newRepositorySystem();
} else {
repoSystem = repoSystemMap.get(key);
if (repoSystem == null) {
repoSystem = MavenLibraryResolverProvider.newRepositorySystemForResolver();
repoSystem = newRepositorySystem();
repoSystemMap.put(key, repoSystem);
}
}
@@ -280,7 +283,7 @@ public class DynamicDistributionAetherUtils {
if (monitor == null) {
monitor = new DummyDynamicMonitor();
}
RepositorySystem repSystem = MavenLibraryResolverProvider.newRepositorySystemForResolver();
RepositorySystem repSystem = newRepositorySystem();
RepositorySystemSession repSysSession = newSession(repSystem, localPath, monitor);
updateDependencySelector((DefaultRepositorySystemSession) repSysSession, monitor);
@@ -326,7 +329,7 @@ public class DynamicDistributionAetherUtils {
if (monitor == null) {
monitor = new DummyDynamicMonitor();
}
RepositorySystem repSystem = MavenLibraryResolverProvider.newRepositorySystemForResolver();
RepositorySystem repSystem = newRepositorySystem();
RepositorySystemSession repSysSession = newSession(repSystem, localPath, monitor);
updateDependencySelector((DefaultRepositorySystemSession) repSysSession, monitor);
@@ -408,6 +411,15 @@ public class DynamicDistributionAetherUtils {
// }
// }
private static RepositorySystem newRepositorySystem() {
DefaultServiceLocator locator = MavenRepositorySystemUtils.newServiceLocator();
locator.addService(RepositoryConnectorFactory.class, BasicRepositoryConnectorFactory.class);
locator.addService(TransporterFactory.class, FileTransporterFactory.class);
locator.addService(TransporterFactory.class, HttpTransporterFactory.class);
return locator.getService(RepositorySystem.class);
}
private static RepositorySystemSession newSession(RepositorySystem system, String repositoryPath, IDynamicMonitor monitor)
throws CoreException {
DefaultRepositorySystemSession session = MavenRepositorySystemUtils.newSession();

View File

@@ -18,12 +18,6 @@ import java.util.Map;
import org.apache.maven.model.License;
import org.apache.maven.model.Model;
import org.apache.maven.repository.internal.MavenRepositorySystemUtils;
import org.apache.maven.wagon.Wagon;
import org.apache.maven.wagon.providers.file.FileWagon;
import org.apache.maven.wagon.providers.http.HttpWagon;
import org.codehaus.plexus.DefaultPlexusContainer;
import org.codehaus.plexus.PlexusContainer;
import org.codehaus.plexus.PlexusContainerException;
import org.eclipse.aether.DefaultRepositorySystemSession;
import org.eclipse.aether.RepositorySystem;
import org.eclipse.aether.RepositorySystemSession;
@@ -31,8 +25,6 @@ import org.eclipse.aether.artifact.Artifact;
import org.eclipse.aether.artifact.DefaultArtifact;
import org.eclipse.aether.connector.basic.BasicRepositoryConnectorFactory;
import org.eclipse.aether.impl.DefaultServiceLocator;
import org.eclipse.aether.internal.transport.wagon.PlexusWagonConfigurator;
import org.eclipse.aether.internal.transport.wagon.PlexusWagonProvider;
import org.eclipse.aether.repository.Authentication;
import org.eclipse.aether.repository.LocalRepository;
import org.eclipse.aether.repository.RemoteRepository;
@@ -42,7 +34,6 @@ import org.eclipse.aether.spi.connector.RepositoryConnectorFactory;
import org.eclipse.aether.spi.connector.transport.TransporterFactory;
import org.eclipse.aether.transport.file.FileTransporterFactory;
import org.eclipse.aether.transport.http.HttpTransporterFactory;
import org.eclipse.aether.transport.wagon.WagonTransporterFactory;
import org.eclipse.aether.util.repository.AuthenticationBuilder;
import org.eclipse.m2e.core.MavenPlugin;
import org.talend.core.nexus.ArtifactRepositoryBean;
@@ -79,8 +70,8 @@ public class MavenLibraryResolverProvider {
return instance;
}
private MavenLibraryResolverProvider() throws PlexusContainerException {
defaultRepoSystem = newRepositorySystemForResolver();
private MavenLibraryResolverProvider() {
defaultRepoSystem = newRepositorySystem();
defaultRepoSystemSession = newSession(defaultRepoSystem, getLocalMVNRepository());
ArtifactRepositoryBean talendServer = TalendLibsServerManager.getInstance().getTalentArtifactServer();
if (talendServer.getUserName() == null && talendServer.getPassword() == null) {
@@ -155,44 +146,12 @@ public class MavenLibraryResolverProvider {
return repository;
}
public static RepositorySystem newRepositorySystem() throws PlexusContainerException {
DefaultServiceLocator locator = MavenRepositorySystemUtils.newServiceLocator();
locator.addService(RepositoryConnectorFactory.class, BasicRepositoryConnectorFactory.class);
// TUP-24695 change to wagon transporters
locator.addService(TransporterFactory.class, WagonTransporterFactory.class);
PlexusContainer pc = new DefaultPlexusContainer();
pc.addComponent(new HttpWagon(), Wagon.class, "http");
pc.addComponent(new FileWagon(), Wagon.class, "file");
WagonTransporterFactory tf = (WagonTransporterFactory) locator.getService(TransporterFactory.class);
tf.setWagonConfigurator(new PlexusWagonConfigurator(pc));
tf.setWagonProvider(new PlexusWagonProvider(pc));
locator.setErrorHandler(new DefaultServiceLocator.ErrorHandler() {
@Override
public void serviceCreationFailed(Class<?> type, Class<?> impl, Throwable exception) {
exception.printStackTrace();
}
});
return locator.getService(RepositorySystem.class);
}
public static RepositorySystem newRepositorySystemForResolver() {
private RepositorySystem newRepositorySystem() {
DefaultServiceLocator locator = MavenRepositorySystemUtils.newServiceLocator();
locator.addService(RepositoryConnectorFactory.class, BasicRepositoryConnectorFactory.class);
locator.addService(TransporterFactory.class, FileTransporterFactory.class);
locator.addService(TransporterFactory.class, HttpTransporterFactory.class);
locator.setErrorHandler(new DefaultServiceLocator.ErrorHandler() {
@Override
public void serviceCreationFailed(Class<?> type, Class<?> impl, Throwable exception) {
exception.printStackTrace();
}
});
return locator.getService(RepositorySystem.class);
}

View File

@@ -46,6 +46,12 @@
<version>${project.version}</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.talend.studio</groupId>
<artifactId>features-maven-plugin-2-2-9-tos</artifactId>
<version>${project.version}</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.talend.studio</groupId>
<artifactId>maven-bundle-plugin-2-3-7-tos</artifactId>
@@ -70,30 +76,18 @@
<version>${project.version}</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.talend.studio</groupId>
<artifactId>build-helper-maven-plugin-3-0-0-tos</artifactId>
<version>${project.version}</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.talend.studio</groupId>
<artifactId>karaf-maven-plugin-4-2-4-tos</artifactId>
<version>${project.version}</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.talend.studio</groupId>
<artifactId>studio-maven-repository-zip</artifactId>
<version>${project.version}</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.talend.studio</groupId>
<artifactId>karaf-maven-plugin-4-2-4-tos</artifactId>
<version>${project.version}</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.talend.studio</groupId>
<artifactId>build-helper-maven-plugin-3-0-0-tos</artifactId>
<version>${project.version}</version>
<type>pom</type>
</dependency>
</dependencies>
<profiles>
<profile>

View File

@@ -7,30 +7,41 @@
<version>7.3.1-SNAPSHOT</version>
<relativePath>../../../</relativePath>
</parent>
<artifactId>karaf-maven-plugin-4-2-4-tos</artifactId>
<artifactId>features-maven-plugin-2-2-9-tos</artifactId>
<packaging>pom</packaging>
<dependencies>
<dependency>
<groupId>org.apache.karaf.tooling</groupId>
<artifactId>karaf-maven-plugin</artifactId>
<version>4.2.4</version>
<artifactId>features-maven-plugin</artifactId>
<version>2.2.9</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>1.7.12</version>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.bundlerepository</artifactId>
<version>1.6.4</version>
</dependency>
<dependency>
<groupId>org.apache.maven.shared</groupId>
<artifactId>maven-dependency-tree</artifactId>
<version>3.0.1</version>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
<version>4.2.0</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-framework-bom</artifactId>
<version>5.0.2.RELEASE</version>
<type>pom</type>
<groupId>org.easymock</groupId>
<artifactId>easymock</artifactId>
<version>3.1</version>
</dependency>
<!-- Required by commons-lang-2.6.pom -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-parent</artifactId>
<version>17</version>
<type>pom</type>
</dependency>
</dependencies>
<build>
<plugins>

View File

@@ -10,9 +10,9 @@
<artifactId>studio-maven-repository-build</artifactId>
<packaging>pom</packaging>
<modules>
<module>plugins/features-maven-plugin-2-2-9</module>
<module>plugins/maven-bundle-plugin-2-3-7</module>
<module>plugins/maven-bundle-plugin-2-5-3</module>
<module>plugins/karaf-maven-plugin-4-2-4</module>
<module>plugins/maven-install-plugin-2-5-1</module>
<module>plugins/talend-compiler-plugin</module>
<module>plugins/build-helper-maven-plugin-3-0-0</module>

View File

@@ -11,7 +11,7 @@
<packaging>pom</packaging>
<properties>
<tcomp.version>1.1.14</tcomp.version>
<tcomp.version>1.1.10</tcomp.version>
<slf4j.version>1.7.25</slf4j.version>
</properties>

View File

@@ -11,5 +11,4 @@ ProjectPomProjectSettingPage_FilterPomLabel=Filter to use to generate poms:
ProjectPomProjectSettingPage_FilterErrorMessage=Invalid filter: {0}
ProjectPomProjectSettingPage.syncAllPomsButtonText=Force full re-synchronize poms
AbstractPersistentProjectSettingPage.syncAllPoms=Do you want to update all poms? \n This operation might take long time depends on your project size.
MavenProjectSettingPage.filterExampleMessage=Filter examples:\nlabel=myJob \t\t\t\t=> Generate only the job named "myJob"\n!(label=myJob) \t\t\t\t=> Generate any job except the one named "myJob"\n(path=folder1/folder2) \t\t\t=> Generate any job in the folder "folder1/folder2"\n(path=folder1/folder2)or(label=myJob)\t=> Generate any job in the folder "folder1/folder2" or named "myJob"\n(label=myJob)and(version=0.2) \t=> Generate only the job named "myJob" with version 0.2\n!((label=myJob)and(version=0.1)) \t=> Generate every jobs except the "myJob" version 0.1
MavenProjectSettingPage.refModuleText=Set reference project modules in profile
MavenProjectSettingPage.filterExampleMessage=Filter examples:\nlabel=myJob \t\t\t\t=> Generate only the job named "myJob"\n!(label=myJob) \t\t\t\t=> Generate any job except the one named "myJob"\n(path=folder1/folder2) \t\t\t=> Generate any job in the folder "folder1/folder2"\n(path=folder1/folder2)or(label=myJob)\t=> Generate any job in the folder "folder1/folder2" or named "myJob"\n(label=myJob)and(version=0.2) \t=> Generate only the job named "myJob" with version 0.2\n!((label=myJob)and(version=0.1)) \t=> Generate every jobs except the "myJob" version 0.1

View File

@@ -294,25 +294,20 @@ public class M2eUserSettingForTalendLoginTask extends AbstractLoginTask {
boolean isLocal = isLocalRepository();
IPath localRepoPath = null;
if (!isLocal) {
String customMavenRepoistory = System.getProperty("maven.local.repository");
if (customMavenRepoistory != null) {
localRepoPath = new Path(customMavenRepoistory);
} else {
String mvnHome = System.getenv("M2_HOME"); //$NON-NLS-1$
if (mvnHome == null) {
mvnHome = System.getenv("MAVEN_HOME"); //$NON-NLS-1$
}
if (StringUtils.isNotBlank(mvnHome)) {
File globalSettings = new File(mvnHome).toPath().resolve("conf").resolve("settings.xml").toFile(); //$NON-NLS-1$ //$NON-NLS-2$
if (globalSettings.exists()) {
DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
Document document = builder.parse(globalSettings);
Node node = document.getElementsByTagName("localRepository").item(0); //$NON-NLS-1$
if (node != null) {
String repoPath = node.getTextContent();
if (StringUtils.isNotBlank(repoPath)) {
localRepoPath = new Path(repoPath);
}
String mvnHome = System.getenv("M2_HOME"); //$NON-NLS-1$
if (mvnHome == null) {
mvnHome = System.getenv("MAVEN_HOME"); //$NON-NLS-1$
}
if (StringUtils.isNotBlank(mvnHome)) {
File globalSettings = new File(mvnHome).toPath().resolve("conf").resolve("settings.xml").toFile(); //$NON-NLS-1$ //$NON-NLS-2$
if (globalSettings.exists()) {
DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
Document document = builder.parse(globalSettings);
Node node = document.getElementsByTagName("localRepository").item(0); //$NON-NLS-1$
if (node != null) {
String repoPath = node.getTextContent();
if (StringUtils.isNotBlank(repoPath)) {
localRepoPath = new Path(repoPath);
}
}
}

View File

@@ -50,8 +50,6 @@ public class MavenProjectSettingPage extends AbstractProjectSettingPage {
private IPreferenceStore preferenceStore;
private Button useProfileModuleCheckbox;
public MavenProjectSettingPage() {
noDefaultAndApplyButton();
}
@@ -86,10 +84,6 @@ public class MavenProjectSettingPage extends AbstractProjectSettingPage {
filterExampleLable.setText(Messages.getString("MavenProjectSettingPage.filterExampleMessage")); //$NON-NLS-1$
filterExampleLable.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
useProfileModuleCheckbox = new Button(parent, SWT.CHECK);
useProfileModuleCheckbox.setText(Messages.getString("MavenProjectSettingPage.refModuleText")); //$NON-NLS-1$
useProfileModuleCheckbox.setSelection(preferenceStore.getBoolean(MavenConstants.USE_PROFILE_MODULE));
filterText.setText(filter);
filterText.addModifyListener(new ModifyListener() {
@@ -121,7 +115,6 @@ public class MavenProjectSettingPage extends AbstractProjectSettingPage {
public void widgetSelected(SelectionEvent event) {
try {
preferenceStore.setValue(MavenConstants.POM_FILTER, getRealVersionFilter(filter));
preferenceStore.setValue(MavenConstants.USE_PROFILE_MODULE, useProfileModuleCheckbox.getSelection());
new AggregatorPomsHelper().syncAllPoms();
} catch (Exception e) {
ExceptionHandler.process(e);
@@ -140,7 +133,6 @@ public class MavenProjectSettingPage extends AbstractProjectSettingPage {
boolean ok = super.performOk();
if (preferenceStore != null) {
preferenceStore.setValue(MavenConstants.POM_FILTER, getRealVersionFilter(filter));
preferenceStore.setValue(MavenConstants.USE_PROFILE_MODULE, useProfileModuleCheckbox.getSelection());
}
return ok;
}

View File

@@ -12,23 +12,24 @@
// ============================================================================
package org.talend.designer.maven.tools;
import static org.talend.designer.maven.model.TalendJavaProjectConstants.*;
import static org.talend.designer.maven.model.TalendJavaProjectConstants.DIR_AGGREGATORS;
import static org.talend.designer.maven.model.TalendJavaProjectConstants.DIR_BEANS;
import static org.talend.designer.maven.model.TalendJavaProjectConstants.DIR_CODES;
import static org.talend.designer.maven.model.TalendJavaProjectConstants.DIR_JOBS;
import static org.talend.designer.maven.model.TalendJavaProjectConstants.DIR_PIGUDFS;
import static org.talend.designer.maven.model.TalendJavaProjectConstants.DIR_POMS;
import static org.talend.designer.maven.model.TalendJavaProjectConstants.DIR_ROUTINES;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
import java.util.Map;
import java.util.Set;
import java.util.function.Function;
import java.util.stream.Collectors;
import org.apache.commons.lang3.StringUtils;
import org.apache.maven.model.Activation;
import org.apache.maven.model.Model;
import org.apache.maven.model.Profile;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
@@ -55,6 +56,7 @@ import org.talend.core.context.Context;
import org.talend.core.context.RepositoryContext;
import org.talend.core.model.general.ILibrariesService;
import org.talend.core.model.general.ModuleNeeded;
import org.talend.core.model.general.Project;
import org.talend.core.model.process.ProcessUtils;
import org.talend.core.model.properties.Item;
import org.talend.core.model.properties.ProjectReference;
@@ -75,7 +77,6 @@ import org.talend.core.runtime.services.IFilterService;
import org.talend.core.ui.ITestContainerProviderService;
import org.talend.designer.core.ICamelDesignerCoreService;
import org.talend.designer.maven.launch.MavenPomCommandLauncher;
import org.talend.designer.maven.model.MavenSystemFolders;
import org.talend.designer.maven.model.TalendJavaProjectConstants;
import org.talend.designer.maven.model.TalendMavenConstants;
import org.talend.designer.maven.template.MavenTemplateManager;
@@ -109,25 +110,27 @@ public class AggregatorPomsHelper {
return projectTechName;
}
public void createRootPom(Model model, boolean force, IProgressMonitor monitor)
throws Exception {
public void createRootPom(List<String> modules, boolean force, IProgressMonitor monitor) throws Exception {
IFile pomFile = getProjectRootPom();
if (force || !pomFile.exists()) {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put(MavenTemplateManager.KEY_PROJECT_NAME, projectTechName);
Model model = MavenTemplateManager.getCodeProjectTemplateModel(parameters);
if (modules != null && !modules.isEmpty()) {
model.setModules(modules);
}
PomUtil.savePom(monitor, model, pomFile);
}
}
public void createRootPom(IProgressMonitor monitor) throws Exception {
Model newModel = getCodeProjectTemplateModel();
IFile pomFile = getProjectRootPom();
List<String> modules = null;
if (pomFile != null && pomFile.exists()) {
Model oldModel = MavenPlugin.getMavenModelManager().readMavenModel(pomFile);
List<Profile> profiles = oldModel.getProfiles().stream()
.filter(profile -> matchModuleProfile(profile.getId(), projectTechName)).collect(Collectors.toList());
newModel.setModules(oldModel.getModules());
newModel.getProfiles().addAll(profiles);
Model model = MavenPlugin.getMavenModelManager().readMavenModel(pomFile);
modules = model.getModules();
}
createRootPom(newModel, true, monitor);
createRootPom(modules, true, monitor);
}
public void installRootPom(boolean force) throws Exception {
@@ -287,40 +290,37 @@ public class AggregatorPomsHelper {
}
}
public void updateRefProjectModules(List<ProjectReference> references, IProgressMonitor monitor) {
public void updateRefProjectModules(List<ProjectReference> references) {
if (!needUpdateRefProjectModules()) {
return;
}
try {
Model model = MavenPlugin.getMavenModelManager().readMavenModel(getProjectRootPom());
if (PomIdsHelper.useProfileModule()) {
List<Profile> profiles = collectRefProjectProfiles(references);
Iterator<Profile> iterator = model.getProfiles().listIterator();
while (iterator.hasNext()) {
Profile profile = iterator.next();
if (matchModuleProfile(profile.getId(), projectTechName)) {
iterator.remove();
}
}
model.getProfiles().addAll(profiles);
} else {
List<String> refPrjectModules = new ArrayList<>();
references.forEach(reference -> {
String refProjectTechName = reference.getReferencedProject().getTechnicalLabel();
String modulePath = "../../" + refProjectTechName + "/" + TalendJavaProjectConstants.DIR_POMS; //$NON-NLS-1$ //$NON-NLS-2$
refPrjectModules.add(modulePath);
});
List<String> modules = model.getModules();
Iterator<String> iterator = modules.listIterator();
while (iterator.hasNext()) {
String modulePath = iterator.next();
if (modulePath.startsWith("../../")) { //$NON-NLS-1$
iterator.remove();
}
}
modules.addAll(refPrjectModules);
List<String> modules = new ArrayList<>();
for (ProjectReference reference : references) {
String refProjectTechName = reference.getReferencedProject().getTechnicalLabel();
String modulePath = "../../" + refProjectTechName + "/" + TalendJavaProjectConstants.DIR_POMS; //$NON-NLS-1$ //$NON-NLS-2$
modules.add(modulePath);
}
createRootPom(model, true, monitor);
Project mainProject = ProjectManager.getInstance().getCurrentProject();
IFolder mainPomsFolder = new AggregatorPomsHelper(mainProject.getTechnicalLabel()).getProjectPomsFolder();
IFile mainPomFile = mainPomsFolder.getFile(TalendMavenConstants.POM_FILE_NAME);
Model model = MavenPlugin.getMavenModelManager().readMavenModel(mainPomFile);
List<String> oldModules = model.getModules();
if (oldModules == null) {
oldModules = new ArrayList<>();
}
ListIterator<String> iterator = oldModules.listIterator();
while (iterator.hasNext()) {
String modulePath = iterator.next();
if (modulePath.startsWith("../../")) { //$NON-NLS-1$
iterator.remove();
}
}
oldModules.addAll(modules);
PomUtil.savePom(null, model, mainPomFile);
} catch (Exception e) {
ExceptionHandler.process(e);
}
@@ -494,10 +494,6 @@ public class AggregatorPomsHelper {
return null;
}
public IFolder getCodeSrcFolder(ERepositoryObjectType codeType) {
return getCodeFolder(codeType).getFolder(MavenSystemFolders.JAVA.getPath());
}
public IFolder getProcessFolder(ERepositoryObjectType type) {
return getProjectPomsFolder().getFolder(DIR_JOBS).getFolder(type.getFolder());
}
@@ -688,23 +684,6 @@ public class AggregatorPomsHelper {
new ProgressMonitorDialog(Display.getDefault().getActiveShell()).run(true, true, runnableWithProgress);
}
public void syncParentJobPomsForPropertyChange(Property property) {
IRunProcessService runProcessService = getRunProcessService();
ProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
List<Relation> itemsHaveRelationWith = RelationshipItemBuilder.getInstance().getItemsHaveRelationWith(property.getId(),
property.getVersion());
try {
for (Relation relation : itemsHaveRelationWith) {
IRepositoryViewObject object = factory.getSpecificVersion(relation.getId(), relation.getVersion(), true);
if (runProcessService != null) {
runProcessService.generatePom(object.getProperty().getItem());
}
}
} catch (Exception e) {
ExceptionHandler.process(e);
}
}
private String getModulePath(IFile pomFile) {
IFile parentPom = getProjectRootPom();
if (parentPom != null) {
@@ -714,48 +693,47 @@ public class AggregatorPomsHelper {
return null;
}
private List<Profile> collectRefProjectProfiles(List<ProjectReference> references) throws CoreException {
if (!needUpdateRefProjectModules()) {
Model model = MavenPlugin.getMavenModelManager().readMavenModel(getProjectRootPom());
List<Profile> profiles = model.getProfiles();
return profiles.stream().filter(profile -> matchModuleProfile(profile.getId(), projectTechName))
.collect(Collectors.toList());
private void collectModules(List<String> modules) {
IRunProcessService service = getRunProcessService();
if (service != null) {
modules.add(
getModulePath(service.getTalendCodeJavaProject(ERepositoryObjectType.ROUTINES).getProjectPom()));
if (ProcessUtils.isRequiredPigUDFs(null)) {
modules.add(
getModulePath(service.getTalendCodeJavaProject(ERepositoryObjectType.PIG_UDF).getProjectPom()));
}
if (ProcessUtils.isRequiredBeans(null)) {
modules.add(getModulePath(service
.getTalendCodeJavaProject(ERepositoryObjectType.valueOf("BEANS")) //$NON-NLS-1$
.getProjectPom()));
}
}
if (references == null) {
references = ProjectManager.getInstance().getCurrentProject().getProjectReferenceList(true);
if (needUpdateRefProjectModules()) {
List<ProjectReference> references =
ProjectManager.getInstance().getCurrentProject().getProjectReferenceList(true);
for (ProjectReference reference : references) {
String refProjectTechName = reference.getReferencedProject().getTechnicalLabel();
String modulePath = "../../" + refProjectTechName + "/" + TalendJavaProjectConstants.DIR_POMS; //$NON-NLS-1$ //$NON-NLS-2$
modules.add(modulePath);
}
} else {
Project mainProject = ProjectManager.getInstance().getCurrentProject();
IFolder mainPomsFolder = new AggregatorPomsHelper(mainProject.getTechnicalLabel()).getProjectPomsFolder();
IFile mainPomFile = mainPomsFolder.getFile(TalendMavenConstants.POM_FILE_NAME);
try {
Model model = MavenPlugin.getMavenModelManager().readMavenModel(mainPomFile);
List<String> oldModules = model.getModules();
if (oldModules != null) {
for (String modulePath : oldModules) {
if (modulePath.startsWith("../../")) { //$NON-NLS-1$
modules.add(modulePath);
}
}
}
} catch (CoreException e) {
ExceptionHandler.process(e);
}
}
List<Profile> profiles = new ArrayList<>();
references.forEach(reference -> {
String refProjectTechName = reference.getReferencedProject().getTechnicalLabel();
String modulePath = "../../" + refProjectTechName + "/" + TalendJavaProjectConstants.DIR_POMS; //$NON-NLS-1$ //$NON-NLS-2$
Profile profile = new Profile();
profile.setId((projectTechName + "_" + refProjectTechName).toLowerCase()); //$NON-NLS-1$
Activation activation = new Activation();
activation.setActiveByDefault(true);
profile.setActivation(activation);
profile.getModules().add(modulePath);
profiles.add(profile);
});
return profiles;
}
private List<String> collectRefProjectModules(List<ProjectReference> references) throws CoreException {
if (!needUpdateRefProjectModules()) {
Model model = MavenPlugin.getMavenModelManager().readMavenModel(getProjectRootPom());
return model.getModules().stream().filter(modulePath -> modulePath.startsWith("../../")) //$NON-NLS-1$
.collect(Collectors.toList());
}
if (references == null) {
references = ProjectManager.getInstance().getCurrentProject().getProjectReferenceList(true);
}
List<String> modules = new ArrayList<>();
references.forEach(reference -> {
String refProjectTechName = reference.getReferencedProject().getTechnicalLabel();
String modulePath = "../../" + refProjectTechName + "/" + TalendJavaProjectConstants.DIR_POMS; //$NON-NLS-1$ //$NON-NLS-2$
modules.add(modulePath);
});
return modules;
}
public boolean needUpdateRefProjectModules() {
@@ -793,13 +771,7 @@ public class AggregatorPomsHelper {
monitor.beginTask("", size); //$NON-NLS-1$
// project pom
monitor.subTask("Synchronize project pom"); //$NON-NLS-1$
Model model = getCodeProjectTemplateModel();
if (PomIdsHelper.useProfileModule()) {
model.getProfiles().addAll(collectRefProjectProfiles(null));
} else {
model.getModules().addAll(collectRefProjectModules(null));
}
createRootPom(model, true, monitor);
createRootPom(null, true, monitor);
installRootPom(true);
monitor.worked(1);
if (monitor.isCanceled()) {
@@ -852,9 +824,8 @@ public class AggregatorPomsHelper {
}
// sync project pom again with all modules.
monitor.subTask("Synchronize project pom with modules"); //$NON-NLS-1$
collectCodeModules(modules);
model.getModules().addAll(modules);
createRootPom(model, true, monitor);
collectModules(modules);
createRootPom(modules, true, monitor);
installRootPom(true);
monitor.worked(1);
if (monitor.isCanceled()) {
@@ -863,21 +834,6 @@ public class AggregatorPomsHelper {
monitor.done();
}
private void collectCodeModules(List<String> modules) {
// collect codes modules
IRunProcessService service = getRunProcessService();
if (service != null) {
modules.add(getModulePath(service.getTalendCodeJavaProject(ERepositoryObjectType.ROUTINES).getProjectPom()));
if (ProcessUtils.isRequiredPigUDFs(null)) {
modules.add(getModulePath(service.getTalendCodeJavaProject(ERepositoryObjectType.PIG_UDF).getProjectPom()));
}
if (ProcessUtils.isRequiredBeans(null)) {
modules.add(getModulePath(service.getTalendCodeJavaProject(ERepositoryObjectType.valueOf("BEANS")) //$NON-NLS-1$
.getProjectPom()));
}
}
}
/**
* Check if is a esb data service job
*
@@ -906,18 +862,6 @@ public class AggregatorPomsHelper {
return null;
}
private Model getCodeProjectTemplateModel() {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put(MavenTemplateManager.KEY_PROJECT_NAME, projectTechName);
return MavenTemplateManager.getCodeProjectTemplateModel(parameters);
}
public static boolean matchModuleProfile(String profileId, String projectTechName) {
// FIXME get profile id from extension point.
List<String> otherProfiles = Arrays.asList("docker", "cloud-publisher", "nexus"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
return !otherProfiles.contains(profileId) && StringUtils.startsWithIgnoreCase(profileId, projectTechName + "_");
}
private static IRunProcessService getRunProcessService() {
if (GlobalServiceRegister.getDefault().isServiceRegistered(IRunProcessService.class)) {
IRunProcessService runProcessService =

View File

@@ -167,7 +167,6 @@ public class ProcessorDependenciesManager {
if (modulesNeeded.isEmpty()) {
modulesNeeded = processor.getNeededModules(TalendProcessOptionConstants.MODULES_WITH_JOBLET);
}
processor.updateModulesAfterSetLog4j(modulesNeeded);
neededLibraries.addAll(modulesNeeded);
// add testcase modules

View File

@@ -69,7 +69,13 @@ public class ProjectPomManager {
if (monitor == null) {
monitor = new NullProgressMonitor();
}
new AggregatorPomsHelper().createRootPom(monitor);
Model projectModel = MODEL_MANAGER.readMavenModel(projectPomFile);
Model templateModel = MavenTemplateManager.getCodeProjectTemplateModel();
for (String module : projectModel.getModules()) {
templateModel.addModule(module);
}
PomUtil.savePom(monitor, templateModel, projectPomFile);
}
/**

View File

@@ -45,7 +45,6 @@ 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.TalendProcessArgumentConstant;
import org.talend.core.runtime.projectsetting.IProjectSettingTemplateConstants;
import org.talend.core.runtime.repository.build.IMavenPomCreator;
import org.talend.core.ui.ITestContainerProviderService;
@@ -220,29 +219,6 @@ public abstract class AbstractMavenProcessorPom extends CreateMavenBundleTemplat
MavenArtifact mvnArtifact = MavenUrlHelper.parseMvnUrl(module.getMavenUri());
include.setValue(mvnArtifact.getGroupId() + ":" + mvnArtifact.getArtifactId()); //$NON-NLS-1$
}
//removing digital signatures from uber jar
Xpp3Dom filters = new Xpp3Dom("filters"); //$NON-NLS-1$
Xpp3Dom filter = new Xpp3Dom("filter"); //$NON-NLS-1$
Xpp3Dom artifact = new Xpp3Dom("artifact"); //$NON-NLS-1$
artifact.setValue("*:*");
Xpp3Dom filterExcludes = new Xpp3Dom("excludes"); //$NON-NLS-1$
Xpp3Dom excludeSF = new Xpp3Dom("exclude");
excludeSF.setValue("META-INF/*.SF");
Xpp3Dom excludeDSA = new Xpp3Dom("exclude");
excludeDSA.setValue("META-INF/*.DSA");
Xpp3Dom excludeRSA = new Xpp3Dom("exclude");
excludeRSA.setValue("META-INF/*.RSA");
filterExcludes.addChild(excludeSF);
filterExcludes.addChild(excludeDSA);
filterExcludes.addChild(excludeRSA);
filter.addChild(artifact);
filter.addChild(filterExcludes);
filters.addChild(filter);
configuration.addChild(filters);
plugins.add(shade);
}
}
@@ -293,7 +269,6 @@ public abstract class AbstractMavenProcessorPom extends CreateMavenBundleTemplat
protected void addChildrenDependencies(final List<Dependency> dependencies) {
String parentId = getJobProcessor().getProperty().getId();
final Set<JobInfo> clonedChildrenJobInfors = getJobProcessor().getBuildFirstChildrenJobs();
for (JobInfo jobInfo : clonedChildrenJobInfors) {
if (jobInfo.getFatherJobInfo() != null && jobInfo.getFatherJobInfo().getJobId().equals(parentId)) {
@@ -309,10 +284,6 @@ public abstract class AbstractMavenProcessorPom extends CreateMavenBundleTemplat
property = jobInfo.getProcessItem().getProperty();
groupId = PomIdsHelper.getJobGroupId(property);
artifactId = PomIdsHelper.getJobArtifactId(jobInfo);
if ("OSGI".equals(property.getAdditionalProperties().get(TalendProcessArgumentConstant.ARG_BUILD_TYPE))) {
artifactId = artifactId + "-bundle";
}
version = PomIdsHelper.getJobVersion(property);
// try to get the pom version of children job and load from the pom file.
String childPomFileName = PomUtil.getPomFileName(jobInfo.getJobName(), jobInfo.getJobVersion());

View File

@@ -33,10 +33,7 @@ import org.apache.maven.artifact.repository.ArtifactRepository;
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.PluginExecution;
import org.apache.maven.model.Profile;
import org.codehaus.plexus.util.xml.Xpp3Dom;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.runtime.CoreException;
@@ -901,40 +898,4 @@ public class CreateMavenJobPom extends AbstractMavenProcessorPom {
}
}
protected Plugin addSkipDockerMavenPlugin() {
Plugin plugin = new Plugin();
plugin.setGroupId("io.fabric8");
plugin.setArtifactId("fabric8-maven-plugin");
plugin.setVersion("4.0.0");
Xpp3Dom skip = new Xpp3Dom("skip");
// skip.setValue("${docker.skip}");
skip.setValue("true");
Xpp3Dom configuration = new Xpp3Dom("configuration");
configuration.addChild(skip);
List<PluginExecution> pluginExecutions = new ArrayList<PluginExecution>();
PluginExecution pluginExecutionStart = new PluginExecution();
pluginExecutionStart.setId("start");
pluginExecutionStart.setPhase("none");
pluginExecutionStart.setConfiguration(configuration);
pluginExecutions.add(pluginExecutionStart);
PluginExecution pluginExecutionPushImage = new PluginExecution();
pluginExecutionPushImage.setId("push-image");
pluginExecutionPushImage.setPhase("none");
pluginExecutionPushImage.setConfiguration(configuration);
pluginExecutions.add(pluginExecutionPushImage);
plugin.setExecutions(pluginExecutions);
plugin.setConfiguration(configuration);
return plugin;
}
}

View File

@@ -33,18 +33,11 @@ import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.runtime.IProgressMonitor;
import org.talend.commons.exception.ExceptionHandler;
import org.talend.commons.exception.PersistenceException;
import org.talend.core.GlobalServiceRegister;
import org.talend.core.IESBService;
import org.talend.core.PluginChecker;
import org.talend.core.model.process.JobInfo;
import org.talend.core.model.properties.ProcessItem;
import org.talend.core.model.properties.Property;
import org.talend.core.model.relationship.Relation;
import org.talend.core.model.relationship.RelationshipItemBuilder;
import org.talend.core.model.repository.ERepositoryObjectType;
import org.talend.core.model.repository.IRepositoryViewObject;
import org.talend.core.repository.model.ProxyRepositoryFactory;
import org.talend.core.runtime.maven.MavenConstants;
import org.talend.core.runtime.process.ITalendProcessJavaProject;
import org.talend.core.runtime.process.TalendProcessArgumentConstant;
@@ -57,7 +50,6 @@ import org.talend.designer.maven.tools.AggregatorPomsHelper;
import org.talend.designer.maven.utils.PomIdsHelper;
import org.talend.designer.maven.utils.PomUtil;
import org.talend.designer.runprocess.IProcessor;
import org.talend.repository.model.IProxyRepositoryFactory;
import org.talend.utils.io.FilesUtils;
import org.w3c.dom.Document;
@@ -116,9 +108,8 @@ public class CreateMavenStandardJobOSGiPom extends CreateMavenJobPom {
@Override
protected Model createModel() {
Model model = super.createModel();
boolean isServiceOperation = isServiceOperation(getJobProcessor().getProperty());
boolean isServiceOperation = isServiceOperation(getJobProcessor().getProperty());
List<Profile> profiles = model.getProfiles();
for (Profile profile : profiles) {
@@ -150,25 +141,12 @@ public class CreateMavenStandardJobOSGiPom extends CreateMavenJobPom {
}
model.setName(model.getName() + " Bundle");
model.addProperty("talend.job.finalName", "${talend.job.name}-bundle-${project.version}");
Build build = model.getBuild();
if (GlobalServiceRegister.getDefault().isServiceRegistered(IESBService.class)) {
IESBService service = (IESBService) GlobalServiceRegister.getDefault().getService(IESBService.class);
if (isServiceOperation || service.isRESTService((ProcessItem) getJobProcessor().getProperty().getItem())
|| isRouteOperation(getJobProcessor().getProperty())) {
build.addPlugin(addSkipDockerMavenPlugin());
}
}
if (isServiceOperation) {
model.addProperty("cloud.publisher.skip", "true");
build = model.getBuild();
Build build = model.getBuild();
List<Plugin> removePlugins = new ArrayList<Plugin>();
if (build != null) {
List<Plugin> plugins = build.getPlugins();
for (Plugin p : plugins) {
if (p.getArtifactId().equals("maven-deploy-plugin")) {
@@ -282,64 +260,14 @@ public class CreateMavenStandardJobOSGiPom extends CreateMavenJobPom {
* @return
*/
public boolean isServiceOperation(Property property) {
List<IRepositoryViewObject> serviceRepoList = null;
List<Relation> relations = RelationshipItemBuilder.getInstance().getItemsRelatedTo(property.getId(),
property.getVersion(), RelationshipItemBuilder.JOB_RELATION);
boolean isDataServiceOperation = false;
if (GlobalServiceRegister.getDefault().isServiceRegistered(IESBService.class)) {
IESBService service = (IESBService) GlobalServiceRegister.getDefault().getService(IESBService.class);
try {
IProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
serviceRepoList = factory.getAll(ERepositoryObjectType.valueOf(ERepositoryObjectType.class, "SERVICES"));
for (IRepositoryViewObject serviceItem : serviceRepoList) {
if (service != null) {
List<String> jobIds = service.getSerivceRelatedJobIds(serviceItem.getProperty().getItem());
if (jobIds.contains(property.getId())) {
isDataServiceOperation = true;
break;
}
}
}
} catch (PersistenceException e) {
ExceptionHandler.process(e);
for (Relation relation : relations) {
if (RelationshipItemBuilder.SERVICES_RELATION.equals(relation.getType())) {
return true;
}
}
return isDataServiceOperation;
}
public boolean isRouteOperation(Property property) {
List<IRepositoryViewObject> routeRepoList = null;
boolean isRouteOperation = false;
if (GlobalServiceRegister.getDefault().isServiceRegistered(IESBService.class)) {
IESBService service = (IESBService) GlobalServiceRegister.getDefault().getService(IESBService.class);
try {
IProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
routeRepoList = factory.getAll(ERepositoryObjectType.valueOf(ERepositoryObjectType.class, "ROUTE"));
for (IRepositoryViewObject routeItem : routeRepoList) {
if (service != null) {
List<Relation> relations = RelationshipItemBuilder.getInstance().getItemsRelatedTo(routeItem.getId(),
routeItem.getVersion(), RelationshipItemBuilder.JOB_RELATION);
for (Relation relation : relations) {
if (relation.getType() == RelationshipItemBuilder.JOB_RELATION) {
if (relation.getId().equals(property.getId())) {
isRouteOperation = true;
}
}
}
}
}
} catch (PersistenceException e) {
ExceptionHandler.process(e);
}
}
return isRouteOperation;
return false;
}
}

View File

@@ -260,12 +260,6 @@ public class PomIdsHelper {
return manager.getValue(MavenConstants.POM_FILTER);
}
public static boolean useProfileModule() {
String projectTechName = ProjectManager.getInstance().getCurrentProject().getTechnicalLabel();
ProjectPreferenceManager manager = getPreferenceManager(projectTechName);
return manager.getBoolean(MavenConstants.USE_PROFILE_MODULE);
}
private static String getGroupId(String projectTechName, String baseName, Property property) {
if (projectTechName == null) {
projectTechName = ProjectManager.getInstance().getCurrentProject().getTechnicalLabel();

View File

@@ -547,7 +547,7 @@ public class PomUtil {
File resolve = null;
try {
resolve = TalendMavenResolver.resolve(localMavenUri);
resolve = TalendMavenResolver.getMavenResolver().resolve(localMavenUri);
} catch (IOException | RuntimeException e) {
resolve = null;
}
@@ -1131,20 +1131,4 @@ public class PomUtil {
|| pathname.getName().equals("m2e-lastUpdated.properties"); //$NON-NLS-1$
}
};
public static boolean checkIfJobDependencyExist(IFile parentJobPom, Property property) throws Exception {
boolean found = false;
Model model = MavenPlugin.getMavenModelManager().readMavenModel(parentJobPom);
String groupId = PomIdsHelper.getJobGroupId(property);
String artifactId = PomIdsHelper.getJobArtifactId(property);
String version = PomIdsHelper.getJobVersion(property);
for (Dependency dependency : model.getDependencies()) {
if (dependency.getGroupId().equals(groupId) && dependency.getArtifactId().equals(artifactId)
&& dependency.getVersion().equals(version)) {
found = true;
break;
}
}
return found;
}
}

View File

@@ -6,7 +6,7 @@
context="plugin:org.talend.libraries.jdbc.as400"
language="java"
message="Needed for AS400 jdbc plugin"
name="jt400-9.8.jar" mvn_uri="mvn:net.sf.jt400/jt400/9.8/jar"
name="jt400_V5R3.jar" mvn_uri="mvn:org.talend.libraries/jt400_V5R3/6.0.0"
required="true">
</libraryNeeded>
</extension>

View File

@@ -45,9 +45,9 @@
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.talend.components.lib</groupId>
<groupId>org.talend.libraries</groupId>
<artifactId>talend-db-exasol</artifactId>
<version>2.1.4</version>
<version>2.1.2</version>
<type>jar</type>
<overWrite>true</overWrite>
<outputDirectory>${libs.dir}</outputDirectory>

View File

@@ -116,10 +116,6 @@ public class ConfigModuleDialog extends TitleAreaDialog implements IConfigModule
private String defaultURIValue = "";
private Set<String> jarsAvailable;
private boolean useCustom = false;
private String customURI = null;
/**
* DOC wchen InstallModuleDialog constructor comment.
@@ -557,13 +553,11 @@ public class ConfigModuleDialog extends TitleAreaDialog implements IConfigModule
layoutWarningComposite(false, defaultUriTxt.getText());
if (useCustomBtn.getSelection()) {
customUriText.setEnabled(true);
useCustom = true;
if ("".equals(customUriText.getText())) {
customUriText.setText(ModuleMavenURIUtils.MVNURI_TEMPLET);
}
} else {
customUriText.setEnabled(false);
useCustom = false;
}
checkFieldsError();
}
@@ -813,6 +807,7 @@ public class ConfigModuleDialog extends TitleAreaDialog implements IConfigModule
@Override
protected void okPressed() {
String originalURI = null;
String customURI = null;
originalURI = defaultUriTxt.getText().trim();
defaultURI = originalURI;
if (useCustomBtn.getSelection()) {
@@ -894,9 +889,6 @@ public class ConfigModuleDialog extends TitleAreaDialog implements IConfigModule
*/
@Override
public String getMavenURI() {
if (useCustom && customURI != null) {
return customURI;
}
return defaultURI;
}

View File

@@ -121,7 +121,7 @@ public class ShareMavenArtifactsOnStartup extends ShareLibrareisHelper {
MavenUrlHelper.MVN_PROTOCOL + MavenConstants.LOCAL_RESOLUTION_URL + MavenUrlHelper.REPO_SEPERATOR);
File file = null;
try {
file = TalendMavenResolver.resolve(localMvnUrl);
file = TalendMavenResolver.getMavenResolver().resolve(localMvnUrl);
} catch (IOException | RuntimeException e) {
ExceptionHandler.process(e);
}

View File

@@ -98,7 +98,23 @@ public class NexusDownloadHelperWithProgress extends DownloadHelperWithProgress
private File resolveJar(ArtifactRepositoryBean customNexusServer, String decryptedMvnUri) throws Exception {
ILibraryManagerService libManager = (ILibraryManagerService) GlobalServiceRegister.getDefault()
.getService(ILibraryManagerService.class);
return libManager.resolveJar(customNexusServer, decryptedMvnUri);
File resolved = null;
try {
resolved = libManager.resolveJar(customNexusServer, decryptedMvnUri);
} catch (Exception e) {
// hide the user/password in the error
String regex = "\\://(.+)\\:(.+)@";
String message = e.getMessage();
message = message.replaceAll(regex, "://");
Exception cause = null;
if (e.getCause() != null) {
String causeMessage = e.getCause().getMessage();
causeMessage = causeMessage.replaceAll(regex, "://");
cause = new Exception(causeMessage);
}
throw new Exception(message, cause);
}
return resolved;
}
/*

View File

@@ -5,8 +5,6 @@
// ============================================================================
package routines;
import routines.system.RandomUtils;
public class Mathematical {
/**
@@ -286,7 +284,7 @@ public class Mathematical {
*
*/
public static double LN(double a) {
return Math.log(a);
return Math.log(a) / Math.E;
}
/**
@@ -383,7 +381,7 @@ public class Mathematical {
*
*/
public static double RND(double a) {
return RandomUtils.random() * a;
return Math.random() * a;
}
/**

View File

@@ -6,13 +6,10 @@
package routines;
import java.math.BigDecimal;
import java.util.concurrent.ConcurrentHashMap;
import routines.system.RandomUtils;
public class Numeric {
private static final java.util.Map<String, Integer> seq_Hash = new ConcurrentHashMap<>();
private static final java.util.Map<String, Integer> seq_Hash = new java.util.HashMap<String, Integer>();
/**
* return an incremented numeric id
@@ -33,8 +30,13 @@ public class Numeric {
*
*/
public static Integer sequence(String seqName, int startValue, int step) {
return seq_Hash.compute(seqName,
(String k, Integer v) -> v == null ? startValue : v + step);
if (seq_Hash.containsKey(seqName)) {
seq_Hash.put(seqName, seq_Hash.get(seqName) + step);
return seq_Hash.get(seqName);
} else {
seq_Hash.put(seqName, startValue);
return startValue;
}
}
/**
@@ -66,7 +68,9 @@ public class Numeric {
*/
public static void removeSequence(String seqName) {
seq_Hash.remove(seqName);
if (seq_Hash.containsKey(seqName)) {
seq_Hash.remove(seqName);
}
}
/**
@@ -90,7 +94,7 @@ public class Numeric {
if (max < min) {
throw new RuntimeException("Max value should be bigger than min value");
}
return ((Long) Math.round(min - 0.5 + (RandomUtils.random() * (max - min + 1)))).intValue();
return ((Long) Math.round(min - 0.5 + (Math.random() * (max - min + 1)))).intValue();
}
/**

View File

@@ -5,8 +5,6 @@
// ============================================================================
package routines;
import routines.system.RandomUtils;
public class TalendDataGenerator {
/**
@@ -20,7 +18,7 @@ public class TalendDataGenerator {
String[] list = { "Abraham", "Andrew", "Benjamin", "Bill", "Calvin", "Chester", "Dwight", "Franklin", "George", "Gerald", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$
"Grover", "Harry", "Herbert", "James", "Jimmy", "John", "Lyndon", "Martin", "Millard", "Richard", "Ronald", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$ //$NON-NLS-11$
"Rutherford", "Theodore", "Thomas", "Ulysses", "Warren", "William", "Woodrow", "Zachary" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$
Integer random = 0 + ((Long) Math.round(RandomUtils.random() * (list.length - 1 - 0))).intValue();
Integer random = 0 + ((Long) Math.round(Math.random() * (list.length - 1 - 0))).intValue();
return list[random];
}
@@ -37,7 +35,7 @@ public class TalendDataGenerator {
"Madison", "Monroe", "Carter", "Adams", "Kennedy", "Quincy", "Adams", "Tyler", "Johnson", "Van Buren", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$
"Fillmore", "Nixon", "Reagan", "Hayes", "Roosevelt", "Jefferson", "Grant", "Harding", "Harrison", "Taft", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$
"McKinley", "Wilson", "Taylor" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
Integer random = 0 + ((Long) Math.round(RandomUtils.random() * (list.length - 1 - 0))).intValue();
Integer random = 0 + ((Long) Math.round(Math.random() * (list.length - 1 - 0))).intValue();
return list[random];
}
@@ -62,7 +60,7 @@ public class TalendDataGenerator {
"San Simeon", "San Ysidro Blvd", "Santa Ana Freeway", "Santa Monica Road", "Santa Rosa North", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
"Santa Rosa South", "South Highway", "South Roosevelt Drive", "Steele Lane", "Tanger Blvd", "Timberlane Drive", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
"Tully Road East", "Via Real", "W. Russell St.", "Westside Freeway", "Woodson Rd." }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
Integer random = 0 + ((Long) Math.round(RandomUtils.random() * (list.length - 1 - 0))).intValue();
Integer random = 0 + ((Long) Math.round(Math.random() * (list.length - 1 - 0))).intValue();
return list[random];
}
@@ -80,7 +78,7 @@ public class TalendDataGenerator {
"Saint Paul", "Jackson", "Jefferson City", "Helena", "Lincoln", "Carson City", "Concord", "Trenton", "Santa Fe", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$
"Albany", "Columbus", "Oklahoma City", "Salem", "Harrisburg", "Providence", "Nashville", "Austin", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$
"Salt Lake City", "Montpelier", "Richmond", "Charleston", "Olympia", "Madison", "Cheyenne" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
Integer random = 0 + ((Long) Math.round(RandomUtils.random() * (list.length - 1 - 0))).intValue();
Integer random = 0 + ((Long) Math.round(Math.random() * (list.length - 1 - 0))).intValue();
return list[random];
}
@@ -98,7 +96,7 @@ public class TalendDataGenerator {
"Michigan", "Minnesota", "Mississippi", "Missouri", "Montana", "Nebraska", "Nevada", "New Hampshire", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$
"New Jersey", "New Mexico", "New York", "Ohio", "Oklahoma", "Oregon", "Pennsylvania", "Rhode Island", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$
"Tennessee", "Texas", "Utah", "Vermont", "Virginia", "West Virginia", "Washington", "Wisconsin", "Wyoming" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$
Integer random = 0 + ((Long) Math.round(RandomUtils.random() * (list.length - 1 - 0))).intValue();
Integer random = 0 + ((Long) Math.round(Math.random() * (list.length - 1 - 0))).intValue();
return list[random];
}
@@ -113,7 +111,7 @@ public class TalendDataGenerator {
String[] list = { "AL", "AK", "AZ", "AR", "CA", "NC", "SC", "CO", "CT", "ND", "SD", "DE", "FL", "GA", "HI", "ID", "IL", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$ //$NON-NLS-11$ //$NON-NLS-12$ //$NON-NLS-13$ //$NON-NLS-14$ //$NON-NLS-15$ //$NON-NLS-16$ //$NON-NLS-17$
"IN", "IA", "KS", "KY", "LA", "ME", "MD", "MA", "MI", "MN", "MS", "MO", "MT", "NE", "NV", "NH", "NJ", "NM", "NY", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$ //$NON-NLS-11$ //$NON-NLS-12$ //$NON-NLS-13$ //$NON-NLS-14$ //$NON-NLS-15$ //$NON-NLS-16$ //$NON-NLS-17$ //$NON-NLS-18$ //$NON-NLS-19$
"OH", "OK", "OR", "PA", "RI", "TN", "TX", "UT", "VT", "VA", "WV", "WA", "WI", "WY" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$ //$NON-NLS-11$ //$NON-NLS-12$ //$NON-NLS-13$ //$NON-NLS-14$
Integer random = 0 + ((Long) Math.round(RandomUtils.random() * (list.length - 1 - 0))).intValue();
Integer random = 0 + ((Long) Math.round(Math.random() * (list.length - 1 - 0))).intValue();
return list[random];
}
}

View File

@@ -19,7 +19,6 @@ import java.util.TimeZone;
import routines.system.FastDateParser;
import routines.system.LocaleProvider;
import routines.system.RandomUtils;
import routines.system.TalendTimestampWithTZ;
public class TalendDate {
@@ -1148,7 +1147,7 @@ public class TalendDate {
maxCal.set(Calendar.DAY_OF_MONTH, maxDay);
long random = minCal.getTimeInMillis()
+ (long) ((maxCal.getTimeInMillis() - minCal.getTimeInMillis() + 1) * RandomUtils.random());
+ (long) ((maxCal.getTimeInMillis() - minCal.getTimeInMillis() + 1) * Math.random());
return new Date(random);
}

View File

@@ -14,23 +14,28 @@ package routines.system;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
public class GlobalResource {
// let it support the top level Object
public static Map<Object, Object> resourceMap = new HashMap<Object, Object>();
// let it support the top level Object
public static Map<Object, Object> resourceMap = new HashMap<Object, Object>();
// when there is multiple threads wants to insert stats&logs&meta into DB, it is
// used as a locker. bug:22677
public static TalendMultiThreadLockMap resourceLockMap = new TalendMultiThreadLockMap();
// when there is multiple threads wants to insert stats&logs&meta into DB, it is used as a locker. bug:22677
public static TalendMultiThreadLockMap resourceLockMap = new TalendMultiThreadLockMap();
public static class TalendMultiThreadLockMap {
public static class TalendMultiThreadLockMap {
private Map<Object, Object> tMultiTheadLockMap = new ConcurrentHashMap<>();
private Map<Object, Object> tMultiTheadLockMap = new HashMap<Object, Object>();
public Object get(Object key) {
return tMultiTheadLockMap.computeIfAbsent(key, k -> new Object());
}
}
public Object get(Object key) {
if (tMultiTheadLockMap.get(key) == null) {
synchronized (TalendMultiThreadLockMap.this) {
if (tMultiTheadLockMap.get(key) == null) {
tMultiTheadLockMap.put(key, new Object());
}
}
}
return tMultiTheadLockMap.get(key);
}
}
}

View File

@@ -129,7 +129,7 @@ public class JobStructureCatcherUtils {
this.job_version = jobVersion;
}
private void addMessage(String component_id, String component_name, Map<String, String> component_parameters,
public void addMessage(String component_id, String component_name, Map<String, String> component_parameters,
List<Map<String, String>> component_schema, String input_connectors, String output_connectors,
Map<String, String> connector_name_2_connector_schema, boolean current_connector_as_input,
String current_connector_type, String current_connector, String currrent_row_content, long row_count,
@@ -149,7 +149,7 @@ public class JobStructureCatcherUtils {
current_connector_type, current_connector, null, 0, total_row_number, start_time, end_time, null);
}
public void addCM(String component_id, String component_name) {
public void addComponentMessage(String component_id, String component_name) {
this.addMessage(component_id, component_name, null, null, null, null, null, false, null, null,
null, 0, 0, 0, 0, null);
}

View File

@@ -21,24 +21,21 @@ import org.talend.daikon.crypto.KeySources;
*/
public class PasswordEncryptUtil {
public static final String ENCRYPT_KEY = "Encrypt"; //$NON-NLS-1$
public static String ENCRYPT_KEY = "Encrypt"; //$NON-NLS-1$
private static final String ENCRYPTION_KEY = "Talend_TalendKey";
private static final String PREFIX_PASSWORD = "ENC:["; //$NON-NLS-1$
public static String PREFIX_PASSWORD = "ENC:["; //$NON-NLS-1$
private static final String POSTFIX_PASSWORD = "]"; //$NON-NLS-1$
public static String POSTFIX_PASSWORD = "]"; //$NON-NLS-1$
private static final Encryption ENCRYPTION = new Encryption(KeySources.fixedKey(ENCRYPTION_KEY), CipherSources.getDefault());
private PasswordEncryptUtil() {
}
private static Encryption defaultEncryption;
public static String encryptPassword(String input) throws Exception {
if (input == null) {
return input;
}
return PREFIX_PASSWORD + ENCRYPTION.encrypt(input) + POSTFIX_PASSWORD;
return PREFIX_PASSWORD + getEncryption().encrypt(input) + POSTFIX_PASSWORD;
}
public static String decryptPassword(String input) {
@@ -47,7 +44,7 @@ public class PasswordEncryptUtil {
}
if (input.startsWith(PREFIX_PASSWORD) && input.endsWith(POSTFIX_PASSWORD)) {
try {
return ENCRYPTION
return getEncryption()
.decrypt(input.substring(PREFIX_PASSWORD.length(), input.length() - POSTFIX_PASSWORD.length()));
} catch (Exception e) {
// do nothing
@@ -56,6 +53,13 @@ public class PasswordEncryptUtil {
return input;
}
private static Encryption getEncryption() {
if (defaultEncryption == null) {
defaultEncryption = new Encryption(KeySources.fixedKey(ENCRYPTION_KEY), CipherSources.aes());
}
return defaultEncryption;
}
public static final String PASSWORD_FOR_LOGS_VALUE = "...";
}

View File

@@ -1,15 +0,0 @@
package routines.system;
import java.security.SecureRandom;
public class RandomUtils {
//lazy init, but no meaning now as only one method
private static final class RandomNumberGeneratorHolder {
static final SecureRandom randomNumberGenerator = new SecureRandom();
}
public static double random() {
return RandomNumberGeneratorHolder.randomNumberGenerator.nextDouble();
}
}

View File

@@ -20,7 +20,6 @@ import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
public class RunStat implements Runnable {
@@ -52,7 +51,7 @@ public class RunStat implements Runnable {
public static String TYPE1_CONNECTION = "1";
private class StatBean {
public class StatBean {
private String itemId;
@@ -334,7 +333,7 @@ public class RunStat implements Runnable {
private List<String> keysList4Meter = new LinkedList<String>();
public synchronized StatBean log(String connectionId, int mode, int nbLine) {
public synchronized StatBean logStatOnConnection(String connectionId, int mode, int nbLine) {
StatBean bean;
String key = connectionId;
if (connectionId.contains(".")) {
@@ -387,185 +386,7 @@ public class RunStat implements Runnable {
return bean;
}
public synchronized boolean log(Map<String, Object> resourceMap, String iterateId, String connectionUniqueName, int mode, int nbLine,
JobStructureCatcherUtils jscu, String sourceNodeId, String sourceNodeComponent, String targetNodeId, String targetNodeComponent, String lineType) {
if(resourceMap.get("inIterateVComp") == null || !((Boolean)resourceMap.get("inIterateVComp"))) {
StatBean bean = log(connectionUniqueName, mode, nbLine);
jscu.addConnectionMessage(
sourceNodeId,
sourceNodeComponent,
false,
lineType,
connectionUniqueName+iterateId,
bean.getNbLine(),
bean.getStartTime(),
bean.getEndTime()
);
jscu.addConnectionMessage(
targetNodeId,
targetNodeComponent,
true,
"input",
connectionUniqueName+iterateId,
bean.getNbLine(),
bean.getStartTime(),
bean.getEndTime()
);
return true;
} else {
return false;
}
}
/**
* work for avoiding the 65535 issue
*/
public synchronized void updateStat(Map<String, Object> resourceMap, String iterateId, int mode, int nbLine, String... connectionUniqueNames) {
if(resourceMap.get("inIterateVComp") == null || !((Boolean)resourceMap.get("inIterateVComp"))){
for(String connectionUniqueName : connectionUniqueNames) {
updateStatOnConnection(connectionUniqueName+iterateId, mode, nbLine);
}
}
}
/**
* work for avoiding the 65535 issue
*/
public synchronized boolean updateStatAndLog(boolean execStat, boolean enableLogStash, Map<String, Object> resourceMap, String iterateId, String connectionUniqueName, int mode, int nbLine,
JobStructureCatcherUtils jscu, String sourceNodeId, String sourceNodeComponent, String targetNodeId, String targetNodeComponent, String lineType) {
if(execStat) {
updateStat(resourceMap, iterateId, mode, nbLine, connectionUniqueName);
}
if(enableLogStash) {
return log(resourceMap, iterateId, connectionUniqueName, mode, nbLine,
jscu, sourceNodeId, sourceNodeComponent, targetNodeId, targetNodeComponent, lineType);
}
return false;
}
/**
* work for avoiding the 65535 issue
*/
public synchronized void updateStatOnConnection(Map<String, Object> resourceMap, String iterateId, int mode, int nbLine, String... connectionUniqueNames) {
if(resourceMap.get("inIterateVComp") == null){
for(String connectionUniqueName : connectionUniqueNames) {
updateStatOnConnection(connectionUniqueName+iterateId, mode, nbLine);
}
}
}
/**
* work for avoiding the 65535 issue
*/
public synchronized void log(Map<String, Object> resourceMap, String iterateId, int mode, int nbLine, String... connectionUniqueNames) {
if(resourceMap.get("inIterateVComp") == null){
for(String connectionUniqueName : connectionUniqueNames) {
log(connectionUniqueName+iterateId, mode, nbLine);
}
}
}
/**
* work for avoiding the 65535 issue
*/
public synchronized void updateStatAndLog(boolean execStat, boolean enableLogStash, Map<String, Object> resourceMap, String iterateId, int mode, int nbLine, String... connectionUniqueNames) {
if(execStat) {
updateStatOnConnection(resourceMap, iterateId, mode, nbLine, connectionUniqueNames);
}
if(enableLogStash) {
log(resourceMap, iterateId, mode, nbLine, connectionUniqueNames);
}
}
/**
* work for avoiding the 65535 issue
*/
public synchronized void updateStatOnConnection(String iterateId, int mode, int nbLine, String... connectionUniqueNames) {
for(String connectionUniqueName : connectionUniqueNames) {
updateStatOnConnection(connectionUniqueName+iterateId, mode, nbLine);
}
}
/**
* work for avoiding the 65535 issue
*/
public synchronized void log(String iterateId, int mode, int nbLine, String... connectionUniqueNames) {
for(String connectionUniqueName : connectionUniqueNames) {
log(connectionUniqueName+iterateId, mode, nbLine);
}
}
/**
* TBD-9420 fix
*/
public synchronized void log(String iterateId, int mode, int nbLine, String connectionUniqueName) {
log(connectionUniqueName+iterateId, mode, nbLine);
}
/**
* work for avoiding the 65535 issue
*/
public synchronized void updateStatAndLog(boolean execStat, boolean enableLogStash, String iterateId, int mode, int nbLine, String... connectionUniqueNames) {
if(execStat) {
updateStatOnConnection(iterateId, mode, nbLine, connectionUniqueNames);
}
if(enableLogStash) {
log(iterateId, mode, nbLine, connectionUniqueNames);
}
}
/**
* work for avoiding the 65535 issue
*/
public synchronized void updateStatOnConnectionAndLog(Map<String, Object> globalMap, int iterateLoop, String iterateId, boolean execStat, boolean enableLogStash, int nbLine, String... connectionUniqueNames) {
for(String connectionUniqueName : connectionUniqueNames) {
ConcurrentHashMap<Object, Object> concurrentHashMap = (ConcurrentHashMap) globalMap.get("concurrentHashMap");
concurrentHashMap.putIfAbsent(connectionUniqueName + iterateLoop,new java.util.concurrent.atomic.AtomicInteger(0));
java.util.concurrent.atomic.AtomicInteger stats = (java.util.concurrent.atomic.AtomicInteger) concurrentHashMap.get(connectionUniqueName + iterateLoop);
int step = stats.incrementAndGet()<=1?0:1;
if(execStat) {
updateStatOnConnection(connectionUniqueName+iterateId, step, nbLine);
}
if(enableLogStash) {
log(connectionUniqueName+iterateId, step, nbLine);
}
}
}
/**
* work for avoiding the 65535 issue
*/
public synchronized void updateStatOnConnectionAndLog(Map<String, Object> resourceMap, Map<String, Object> globalMap, int iterateLoop, String iterateId, boolean execStat, boolean enableLogStash, int nbLine, String... connectionUniqueNames) {
for(String connectionUniqueName : connectionUniqueNames) {
if(resourceMap.get("inIterateVComp") == null) {
ConcurrentHashMap<Object, Object> concurrentHashMap = (ConcurrentHashMap) globalMap.get("concurrentHashMap");
concurrentHashMap.putIfAbsent(connectionUniqueName + iterateLoop,new java.util.concurrent.atomic.AtomicInteger(0));
java.util.concurrent.atomic.AtomicInteger stats = (java.util.concurrent.atomic.AtomicInteger) concurrentHashMap.get(connectionUniqueName + iterateLoop);
int step = stats.incrementAndGet()<=1?0:1;
if(execStat) {
updateStatOnConnection(connectionUniqueName+iterateId, step, nbLine);
}
if(enableLogStash) {
log(connectionUniqueName+iterateId, step, nbLine);
}
}
}
}
public synchronized void updateStatOnConnection(String connectionId, int mode, int nbLine) {
StatBean bean;
String key = connectionId;

View File

@@ -403,25 +403,8 @@ public class StringUtils {
return sb.toString();
}
/**
* check if string contains search string case-insensitivity
* the code is copied from apache commons-lang3 StringUtils and do some adjust to avoid the useless code
*/
public static boolean containsIgnoreCase(final String str, final String searchStr) {
if (str == null || searchStr == null) {
return false;
}
final int len = searchStr.length();
final int max = str.length() - len;
for (int i = 0; i <= max; i++) {
if (str.regionMatches(true, i, searchStr, 0, len)) {
return true;
}
}
return false;
}
/**
* return null value not "null" String when obj is null that is the only difference with String.valueOf(Object obj)
*

View File

@@ -1,41 +0,0 @@
<%
EXTRACT(__SCHEMA__);
String fieldsCreated = "";
boolean flagCreated=false;
for(int i=0; i < __SCHEMA__.length; i++){
if(flagCreated){
fieldsCreated += ",";
}else{
flagCreated=true;
}
if( __SCHEMA_DBTYPE__[i].equals("VARCHAR") || __SCHEMA_DBTYPE__[i].equals("VARCHAR2") || __SCHEMA_DBTYPE__[i].equals("CHAR") || __SCHEMA_DBTYPE__[i].equals("BYTE") || __SCHEMA_DBTYPE__[i].equals("VARBYTE")){
fieldsCreated += (__SCHEMA_NAME__[i] + " " + __SCHEMA_DBTYPE__[i] +" ("+ __SCHEMA_LENGTH__[i] +") ");
} else if(__SCHEMA_DBTYPE__[i].equals("NUMBER") || __SCHEMA_DBTYPE__[i].equals("DECIMAL")){
fieldsCreated += (__SCHEMA_NAME__[i] + " " + __SCHEMA_DBTYPE__[i] +" ("+ __SCHEMA_LENGTH__[i] +","+ __SCHEMA_PRECISION__[i] +") ");
} else {
fieldsCreated += (__SCHEMA_NAME__[i] + " " + __SCHEMA_DBTYPE__[i]);
}
if(__SCHEMA_NULLABLE__[i].equals("false")){
fieldsCreated += " NOT NULL";
}
}
String primary = "";
for(int j=0; j < __SCHEMA__.length; j++){
if(__SCHEMA_ISKEY__[j].equals("true") && __SCHEMA_NULLABLE__[j].equals("false")){
if(primary.startsWith(" , PRIMARY KEY")) {
primary += ","+__SCHEMA_NAME__[j];
} else {
primary += " , PRIMARY KEY ("+__SCHEMA_NAME__[j];
}
}
}
if(!primary.equals("")){
fieldsCreated += primary+")";
}
%>
CREATE TABLE <%= __TABLE_NAME__ %>
(
<%= fieldsCreated %>
);

View File

@@ -1,41 +0,0 @@
<%
EXTRACT(__SCHEMA_TARGET__);
String fieldsCreated = "";
boolean flagCreated=false;
for(int i=0; i < __SCHEMA_TARGET__.length; i++){
if(flagCreated){
fieldsCreated += ",";
}else{
flagCreated=true;
}
if( __SCHEMA_TARGET_DBTYPE__[i].equals("VARCHAR") || __SCHEMA_TARGET_DBTYPE__[i].equals("VARCHAR2") || __SCHEMA_TARGET_DBTYPE__[i].equals("CHAR") || __SCHEMA_TARGET_DBTYPE__[i].equals("BYTE") || __SCHEMA_TARGET_DBTYPE__[i].equals("VARBYTE")){
fieldsCreated += (__SCHEMA_TARGET_NAME__[i] + " " + __SCHEMA_TARGET_DBTYPE__[i] +" ("+ __SCHEMA_TARGET_LENGTH__[i] +") ");
} else if(__SCHEMA_TARGET_DBTYPE__[i].equals("NUMBER") || __SCHEMA_TARGET_DBTYPE__[i].equals("DECIMAL")){
fieldsCreated += (__SCHEMA_TARGET_NAME__[i] + " " + __SCHEMA_TARGET_DBTYPE__[i] +" ("+ __SCHEMA_TARGET_LENGTH__[i] +","+ __SCHEMA_TARGET_PRECISION__[i] +") ");
} else {
fieldsCreated += (__SCHEMA_TARGET_NAME__[i] + " " + __SCHEMA_TARGET_DBTYPE__[i]);
}
if(__SCHEMA_TARGET_NULLABLE__[i].equals("false")){
fieldsCreated += " NOT NULL";
}
}
String primary = "";
for(int j=0; j < __SCHEMA_TARGET__.length; j++){
if(__SCHEMA_TARGET_ISKEY__[j].equals("true") && __SCHEMA_TARGET_NULLABLE__[j].equals("false")){
if(primary.startsWith(" , PRIMARY KEY")) {
primary += ","+__SCHEMA_TARGET_NAME__[j];
} else {
primary += " , PRIMARY KEY ("+__SCHEMA_TARGET_NAME__[j];
}
}
}
if(!primary.equals("")){
fieldsCreated += primary+")";
}
%>
CREATE TABLE <%= __TABLE_NAME_TARGET__ %>
(
<%= fieldsCreated %>
);

View File

@@ -1,2 +0,0 @@
-- DROP SOURCE TABLE
DROP TABLE <%= __TABLE_NAME__ %>;

View File

@@ -1,2 +0,0 @@
-- DROP TARGET TABLE
DROP TABLE <%=__TABLE_NAME_TARGET__%>;

View File

@@ -1,101 +0,0 @@
-- This pattern generates a merge statement for Snowflake
--(c) 2019 Talend Inc.
<%
EXTRACT(__MERGE_ON__);
EXTRACT(__UPDATE_MAPPING__);
EXTRACT(__ADDITIONAL_UPDATE_COLUMNS__);
EXTRACT(__INSERT_MAPPING__);
EXTRACT(__ADDITIONAL_INSERT_COLUMNS__);
String dbType = "__DBTYPE__";
boolean hasUpdateClause = __USE_UPDATE__;
boolean hasAddtionalUpdateColumns = __SPECIFY_ADDITIONAL_UPDATE_COLUMNS__;
boolean hasUpdateWhereClause = __SPECIFY_UPDATE_WHERE_CLAUSE__;
boolean hasInsertClause = __USE_INSERT__;
boolean hasAdditionalInsertColumns = __SPECIFY_ADDITIONAL_INSERT_COLUMNS__;
boolean hasInsertWhereClause = __SPECIFY_INSERT_WHERE_CLAUSE__;
boolean flag = false;
String mergeOnStr = "";
for(int i=0; i < __MERGE_ON_SRC_COLUMN__.length; i++){
if (flag) {
mergeOnStr += " AND ";
} else {
flag = true;
}
mergeOnStr += (__TARGET_TABLE__ + "." + __MERGE_ON_TRG_COLUMN__[i] + " = " + __SOURCE_TABLE__ + "." + __MERGE_ON_SRC_COLUMN__[i]);
}
String updateStr = "";
String updateWhereStr = "";
flag = false;
if (hasUpdateClause) {
for(int i=0; i < __UPDATE_MAPPING_SRC_COLUMN__.length; i++) {
if (flag) {
updateStr += ",";
} else {
flag = true;
}
updateStr += (__TARGET_TABLE__ + "." + __UPDATE_MAPPING_TRG_COLUMN__[i] + " = " + __SOURCE_TABLE__ + "." + __UPDATE_MAPPING_SRC_COLUMN__[i]);
}
if (hasAddtionalUpdateColumns) {
for(int i=0; i < __ADDITIONAL_UPDATE_COLUMNS_TRG_COLUMN_VALUE__.length; i++) {
if (flag) {
updateStr += ",";
} else {
flag = true;
}
updateStr += (__TARGET_TABLE__ + "." + __ADDITIONAL_UPDATE_COLUMNS_TRG_COLUMN_NAME__[i] + " = " + __ADDITIONAL_UPDATE_COLUMNS_TRG_COLUMN_VALUE__[i]);
}
}
if (hasUpdateWhereClause) {
updateWhereStr = " " + __UPDATE_WHERE_CLAUSE__ + " ";
}
}
String insertColumnsStr = "";
String insertValuesStr = "";
String insertWhereStr = "";
String insertStr = "";
flag = false;
if (hasInsertClause) {
for(int i=0; i < __INSERT_MAPPING_TRG_COLUMN__.length; i++) {
if (flag) {
insertColumnsStr += ",";
insertValuesStr += ",";
} else {
flag = true;
}
insertColumnsStr += (__TARGET_TABLE__ + "." + __INSERT_MAPPING_TRG_COLUMN__[i]);
insertValuesStr += (__SOURCE_TABLE__ + "." + __INSERT_MAPPING_SRC_COLUMN__[i]);
}
if (hasAdditionalInsertColumns) {
for(int i=0; i < __ADDITIONAL_INSERT_COLUMNS_TRG_COLUMN_NAME__.length; i++) {
if (flag) {
insertColumnsStr += ",";
insertValuesStr += ",";
} else {
flag = true;
}
insertColumnsStr += (__TARGET_TABLE__ + "." + __ADDITIONAL_INSERT_COLUMNS_TRG_COLUMN_NAME__[i]);
insertValuesStr += (__ADDITIONAL_INSERT_COLUMNS_TRG_COLUMN_VALUE__[i]);
}
}
if (hasInsertWhereClause) {
insertWhereStr = " " + __INSERT_WHERE_CLAUSE__ + " ";
}
insertStr = "(" + insertColumnsStr + ") VALUES (" + insertValuesStr + ")";
}
String mergeString = "";
if (hasInsertClause || hasUpdateClause) {
mergeString = "MERGE INTO " + __TARGET_TABLE__ + " USING " + __SOURCE_TABLE__ +
" ON (" + mergeOnStr + ")" +
(hasUpdateClause ? (" WHEN MATCHED " + (hasUpdateWhereClause ? ("AND " + updateWhereStr) : "") + " THEN UPDATE SET " + updateStr) : "") +
(hasInsertClause ? (" WHEN NOT MATCHED " + (hasInsertWhereClause ? ("AND " + insertWhereStr) : "") + " THEN INSERT " + insertStr) : "");
} else {
mergeString = "DELETE FROM " + __TARGET_TABLE__ + " WHERE 1=0";
}
%>
<%=mergeString%>;

View File

@@ -706,13 +706,8 @@ public class ModulesNeededProvider {
ModuleNeeded toAdd = new ModuleNeeded(context, currentImport.getMODULE(), currentImport.getMESSAGE(),
isRequired);
toAdd.setMavenUri(currentImport.getMVN());
if (!isRequired) {
if ("BeanItem".equals(routine.eClass().getName())) {
toAdd.getExtraAttributes().put("IS_OSGI_EXCLUDED", Boolean.TRUE);
}
if ("RoutineItem".equals(routine.eClass().getName())) {
continue;
}
if (!isRequired && "BeanItem".equals(routine.eClass().getName())) {
toAdd.getExtraAttributes().put("IS_OSGI_EXCLUDED", Boolean.TRUE);
}
// toAdd.setStatus(ELibraryInstallStatus.INSTALLED);
importNeedsList.add(toAdd);

View File

@@ -46,6 +46,7 @@ import org.eclipse.core.runtime.preferences.ConfigurationScope;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.emf.common.util.EMap;
import org.ops4j.pax.url.mvn.MavenResolver;
import org.osgi.framework.BundleContext;
import org.osgi.framework.FrameworkUtil;
import org.osgi.framework.ServiceReference;
@@ -299,17 +300,6 @@ public class LocalLibraryManager implements ILibraryManagerService, IChangedLibr
return retrieve(testModule, pathToStore, popUp, refresh);
}
@Override
public boolean retrieve(String jarNeeded, String mavenUri, String pathToStore, IProgressMonitor... monitorWrap) {
ModuleNeeded testModule = new ModuleNeeded("", jarNeeded, "", true);
if(mavenUri != null) {
testModule.setMavenUri(mavenUri);
}
boolean refresh = true;
return retrieve(testModule, pathToStore, true, refresh);
}
private boolean retrieve(ModuleNeeded module, String pathToStore, boolean showDialog, boolean refresh) {
String jarNeeded = module.getModuleName();
String sourcePath = null;
@@ -981,7 +971,7 @@ public class LocalLibraryManager implements ILibraryManagerService, IChangedLibr
localMavenUri = mvnUriStatusKey.replace("mvn:", "mvn:" + MavenConstants.LOCAL_RESOLUTION_URL + "!"); //$NON-NLS-1$ //$NON-NLS-2$
}
try {
File resolvedJar = TalendMavenResolver.resolve(localMavenUri);
File resolvedJar = TalendMavenResolver.getMavenResolver().resolve(localMavenUri);
if (resolvedJar != null) {
try {
updatePomFileForJar(mvnUriStatusKey);
@@ -1003,6 +993,7 @@ public class LocalLibraryManager implements ILibraryManagerService, IChangedLibr
private void updatePomFileForJar(String mvnUri) throws Exception {
try {
MavenResolver mavenResolver = TalendMavenResolver.getMavenResolver();
MavenArtifact ma = MavenUrlHelper.parseMvnUrl(mvnUri);
if (ma != null) {
String repositoryUrl = ma.getRepositoryUrl();
@@ -1024,14 +1015,14 @@ public class LocalLibraryManager implements ILibraryManagerService, IChangedLibr
File pomFile = null;
Exception pomEx = null;
try {
pomFile = TalendMavenResolver.resolve(MavenUrlHelper.generateMvnUrl(pomMa));
pomFile = mavenResolver.resolve(MavenUrlHelper.generateMvnUrl(pomMa));
} catch (Exception e) {
pomEx = e;
}
if (pomFile == null && classifier != null && !classifier.trim().isEmpty()) {
pomMa.setClassifier(classifier);
try {
pomFile = TalendMavenResolver.resolve(MavenUrlHelper.generateMvnUrl(pomMa));
pomFile = mavenResolver.resolve(MavenUrlHelper.generateMvnUrl(pomMa));
} catch (Exception e) {
// ignore
}

View File

@@ -13,13 +13,9 @@
package org.talend.librariesmanager.nexus;
import java.io.File;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.Dictionary;
import java.util.Hashtable;
import org.apache.commons.lang.StringUtils;
import org.talend.core.nexus.ArtifactRepositoryBean;
import org.talend.core.nexus.IRepositoryArtifactHandler;
import org.talend.core.nexus.NexusConstants;
@@ -66,22 +62,10 @@ public abstract class AbstractArtifactRepositoryHandler implements IRepositoryAr
if (props == null) {
props = new Hashtable<String, String>();
}
String custom_user = serverBean.getUserName();
String custom_pass = serverBean.getPassword();
try {
if (StringUtils.isNotBlank(custom_user)) {
custom_user = URLEncoder.encode(custom_user, StandardCharsets.UTF_8.toString());
}
if (StringUtils.isNotBlank(custom_pass)) {
custom_pass = URLEncoder.encode(custom_pass, StandardCharsets.UTF_8.toString());
}
} catch (UnsupportedEncodingException e1) {
throw new RuntimeException(e1);
}
String repositories = null;
String custom_server = serverBean.getServer();
String custom_user = serverBean.getUserName();
String custom_pass = serverBean.getPassword();
String release_rep = serverBean.getRepositoryId();
String snapshot_rep = serverBean.getSnapshotRepId();
if (custom_server.endsWith(NexusConstants.SLASH)) {

Some files were not shown because too many files have changed in this diff Show More