Compare commits

..

1 Commits

Author SHA1 Message Date
undx
19eb564e12 fix(TPS-4351): Make component-runtime class loader find classes in JobServer 2020-09-21 17:44:29 +02:00
45 changed files with 245 additions and 846 deletions

View File

@@ -45,8 +45,6 @@ public class VersionUtils {
public static final String STUDIO_VERSION_PROP = "studio.version"; //$NON-NLS-1$
public static final String TALEND_STUDIO_VERSION_PROP = "talend.studio.version"; //$NON-NLS-1$
public static final String TALEND_VERSION_PROP = "talend.version"; //$NON-NLS-1$
private static final String COMMONS_PLUGIN_ID = "org.talend.commons.runtime"; //$NON-NLS-1$
@@ -99,9 +97,7 @@ public class VersionUtils {
public static String getInternalVersion() {
if (Platform.inDevelopmentMode()) {
String version = getDisplayVersion();
updateTalendStudioVersionProp(version);
return version;
return getDisplayVersion();
}
if (productVersion == null) {
synchronized (VersionUtils.class) {
@@ -136,15 +132,10 @@ public class VersionUtils {
}
}
}
updateTalendStudioVersionProp(productVersion);
}
return productVersion;
}
private static void updateTalendStudioVersionProp(String version) {
System.setProperty(TALEND_STUDIO_VERSION_PROP, version == null ? "" : version);
}
/**
* DOC ycbai Comment method "getVersion".
*

View File

@@ -147,28 +147,6 @@ public class NetworkUtil {
@Override
protected PasswordAuthentication getPasswordAuthentication() {
String httpProxyHost = System.getProperty("http.proxyHost"); //$NON-NLS-1$
String httpProxyPort = System.getProperty("http.proxyPort"); //$NON-NLS-1$
String httpsProxyHost = System.getProperty("https.proxyHost"); //$NON-NLS-1$
String httpsProxyPort = System.getProperty("https.proxyPort"); //$NON-NLS-1$
String requestingHost = getRequestingHost();
int requestingPort = getRequestingPort();
String proxyHost = null;
String proxyPort = null;
boolean isHttp = false;
if ("http".equalsIgnoreCase(getRequestingScheme())) {
isHttp = true;
}
if (isHttp && StringUtils.isNotBlank(httpProxyHost)) {
proxyHost = httpProxyHost;
proxyPort = httpProxyPort;
} else {
proxyHost = httpsProxyHost;
proxyPort = httpsProxyPort;
}
if (!StringUtils.equals(proxyHost, requestingHost) || !StringUtils.equals(proxyPort, "" + requestingPort)) {
return null;
}
String httpProxyUser = System.getProperty("http.proxyUser"); //$NON-NLS-1$
String httpProxyPassword = System.getProperty("http.proxyPassword"); //$NON-NLS-1$
String httpsProxyUser = System.getProperty("https.proxyUser"); //$NON-NLS-1$
@@ -186,11 +164,7 @@ public class NetworkUtil {
proxyPassword = httpsProxyPassword.toCharArray();
}
}
if (StringUtils.isBlank(proxyUser)) {
return null;
} else {
return new PasswordAuthentication(proxyUser, proxyPassword);
}
return new PasswordAuthentication(proxyUser, proxyPassword);
}
});

View File

@@ -49,17 +49,11 @@ public class EclipseCommandLine {
*/
static public final String TALEND_PROJECT_TYPE_COMMAND = "-talendProjectType"; //$NON-NLS-1$
static public final String TALEND_LICENCE_PATH = "talend.licence.path"; //$NON-NLS-1$
static public final String ARG_TALEND_LICENCE_PATH = "-" + TALEND_LICENCE_PATH; //$NON-NLS-1$
/**
* for relaunch of the plugins when relaunching the Studio
*/
static public final String TALEND_RELOAD_COMMAND = "-talendReload"; //$NON-NLS-1$
static public final String LOGIN_ONLINE_UPDATE = "--loginOnlineUpdate";
static public final String ARG_TALEND_BUNDLES_CLEANED = "-talend.studio.bundles.cleaned"; //$NON-NLS-1$
static public final String PROP_TALEND_BUNDLES_DO_CLEAN = "-talend.studio.bundles.doclean"; //$NON-NLS-1$

View File

@@ -215,12 +215,8 @@ public class LockerByKey<KP> implements ILockerByKey<KP> {
checkKey(key);
blockOperationIfRequired();
incrementRunningOperations();
LockerValue<KP> lockerValue;
try {
lockerValue = prepareInternalLock(key);
} finally {
this.decrementRunningOperations();
}
LockerValue<KP> lockerValue = prepareInternalLock(key);
decrementRunningOperations();
lockerValue.getLock().lockInterruptibly();
traceStackForDebugging(lockerValue);
}
@@ -243,12 +239,8 @@ public class LockerByKey<KP> implements ILockerByKey<KP> {
checkKey(key);
blockOperationIfRequired();
incrementRunningOperations();
LockerValue<KP> lockerValue;
try {
lockerValue = this.prepareInternalLock(key);
} finally {
this.decrementRunningOperations();
}
LockerValue<KP> lockerValue = prepareInternalLock(key);
decrementRunningOperations();
boolean locked = lockerValue.getLock().tryLock();
if (locked) {
traceStackForDebugging(lockerValue);
@@ -291,12 +283,8 @@ public class LockerByKey<KP> implements ILockerByKey<KP> {
checkKey(key);
blockOperationIfRequired();
incrementRunningOperations();
LockerValue<KP> lockerValue;
try {
lockerValue = this.prepareInternalLock(key);
} finally {
this.decrementRunningOperations();
}
LockerValue<KP> lockerValue = prepareInternalLock(key);
decrementRunningOperations();
interruptIfStopping();
boolean locked = lockerValue.getLock().tryLock(timeout, unit);
if (locked) {
@@ -334,17 +322,13 @@ public class LockerByKey<KP> implements ILockerByKey<KP> {
checkKey(key);
blockOperationIfRequired();
incrementRunningOperations();
LockerValue<KP> lockerValue = this.getLockerValue(key);
boolean returnValue;
try {
returnValue = false;
if (lockerValue != null) {
lockerValue.getLock().unlock();
returnValue = true;
}
} finally {
this.decrementRunningOperations();
LockerValue<KP> lockerValue = getLockerValue(key);
boolean returnValue = false;
if (lockerValue != null) {
lockerValue.getLock().unlock();
returnValue = true;
}
decrementRunningOperations();
cleanAccordingOperations();
return returnValue;
}

View File

@@ -85,7 +85,6 @@ import org.talend.core.context.Context;
import org.talend.core.context.RepositoryContext;
import org.talend.core.exception.TalendInternalPersistenceException;
import org.talend.core.hadoop.BigDataBasicUtil;
import org.talend.core.model.general.ILibrariesService;
import org.talend.core.model.general.ModuleNeeded;
import org.talend.core.model.general.Project;
import org.talend.core.model.metadata.MetadataTalendType;
@@ -110,7 +109,6 @@ import org.talend.core.model.properties.SpagoBiServer;
import org.talend.core.model.properties.Status;
import org.talend.core.model.properties.User;
import org.talend.core.model.properties.impl.FolderItemImpl;
import org.talend.core.model.relationship.RelationshipItemBuilder;
import org.talend.core.model.repository.ERepositoryObjectType;
import org.talend.core.model.repository.Folder;
import org.talend.core.model.repository.IRepositoryContentHandler;
@@ -231,13 +229,6 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
return null;
}
private ILibrariesService getLibrariesService() {
if (GlobalServiceRegister.getDefault().isServiceRegistered(ILibrariesService.class)) {
return GlobalServiceRegister.getDefault().getService(ILibrariesService.class);
}
return null;
}
/*
* (non-Javadoc)
*
@@ -2060,7 +2051,6 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
SubMonitor subMonitor = SubMonitor.convert(monitor, MAX_TASKS);
SubMonitor currentMonitor = subMonitor.newChild(1, SubMonitor.SUPPRESS_NONE);
currentMonitor.beginTask(Messages.getString("ProxyRepositoryFactory.logonInProgress"), 1); //$NON-NLS-1$
project.setReferenceProjectProvider(null);
getRepositoryContext().setProject(null);
initEmfProjectContent();
@@ -2078,10 +2068,6 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
this.repositoryFactoryFromProvider.beforeLogon(project);
ProjectManager.getInstance().getBeforeLogonRecords().clear();
ProjectManager.getInstance().getUpdatedRemoteHandlerRecords().clear();
ILibrariesService librariesService = getLibrariesService();
if (librariesService != null) {
librariesService.setForceReloadCustomUri();
}
ProjectDataJsonProvider.checkAndRectifyRelationShipSetting(project.getEmfProject());
@@ -2254,11 +2240,6 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
} catch (Exception e) {
ExceptionHandler.process(e);
}
// regenerate relationship index
if (project.getEmfProject().getItemsRelations().isEmpty()) {
RelationshipItemBuilder.getInstance().buildAndSaveIndex();
}
fullLogonFinished = true;
this.repositoryFactoryFromProvider.afterLogon(monitor);
} finally {

View File

@@ -35,7 +35,6 @@ import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.talend.commons.exception.ExceptionHandler;
import org.talend.commons.exception.PersistenceException;
import org.talend.commons.utils.workbench.resources.ResourceUtils;
import org.talend.core.model.properties.ImplicitContextSettings;
@@ -83,12 +82,6 @@ public class ProjectDataJsonProvider {
return strBuilder.toString();
}
public static String getMigrationTaskIndexPath() {
StringBuilder strBuilder = new StringBuilder();
strBuilder.append(FileConstants.SETTINGS_FOLDER_NAME).append("/").append(FileConstants.MIGRATION_TASK_FILE_NAME); //$NON-NLS-1$
return strBuilder.toString();
}
public static void saveProjectData(Project project) throws PersistenceException {
saveProjectData(project, CONTENT_ALL);
}
@@ -199,10 +192,9 @@ public class ProjectDataJsonProvider {
ProjectDataJsonProvider.loadProjectSettings(project, input);
}
IPath relationShipPath = settingFolderPath.append(FileConstants.RELATIONSHIP_FILE_NAME);
try (InputStream is = inputStreamProvider.getStream(relationShipPath)) {
if (is != null) {
ProjectDataJsonProvider.loadRelationShips(project, is);
}
input = inputStreamProvider.getStream(relationShipPath);
if (input != null) {
ProjectDataJsonProvider.loadRelationShips(project, input);
}
IPath migrationTaskPath = settingFolderPath.append(FileConstants.MIGRATION_TASK_FILE_NAME);
input = inputStreamProvider.getStream(migrationTaskPath);
@@ -244,11 +236,10 @@ public class ProjectDataJsonProvider {
private static void loadRelationShips(Project project, IPath projectFolderPath) throws PersistenceException {
File file = getLoadingConfigurationFile(projectFolderPath, FileConstants.RELATIONSHIP_FILE_NAME);
if (file != null && file.exists()) {
try (FileInputStream fis = new FileInputStream(file)) {
loadRelationShips(project, fis);
} catch (Exception e) {
// ignore
ExceptionHandler.process(e);
try {
loadRelationShips(project, new FileInputStream(file));
} catch (FileNotFoundException e) {
throw new PersistenceException(e);
}
}
}
@@ -268,8 +259,9 @@ public class ProjectDataJsonProvider {
}
}
} catch (Exception e) {
// ignore
ExceptionHandler.process(e);
throw new PersistenceException(e);
} finally {
closeInputStream(input);
}
}

View File

@@ -383,8 +383,7 @@ public class JobContextManager implements IContextManager {
contextParam = new JobContextParameter();
contextParam.setContext(context);
contextParam.setName(contextParamType.getName());
contextParam.setPrompt(
contextParamType.getPrompt() == null ? (contextParamType.getName() + "?") : contextParamType.getPrompt());
contextParam.setPrompt(contextParamType.getPrompt());
originalParamerters.add(contextParam.getName());
boolean exists = true;
try {

View File

@@ -119,8 +119,6 @@ public interface ILibrariesService extends IService {
List<ModuleNeeded> getModuleNeeded(String id, boolean isGroup);
public void deployProjectLibrary(File source) throws IOException;
public void setForceReloadCustomUri();
/**
* Listener used to fire that libraries status has been changed (new lib or new check install).

View File

@@ -21,7 +21,6 @@ import java.util.List;
import java.util.Map;
import org.apache.commons.lang.StringUtils;
import org.eclipse.emf.common.util.EList;
import org.talend.commons.exception.ExceptionHandler;
import org.talend.commons.exception.PersistenceException;
import org.talend.commons.utils.VersionUtils;
@@ -54,7 +53,6 @@ import org.talend.core.utils.BitwiseOptionUtils;
import org.talend.designer.core.IDesignerCoreService;
import org.talend.designer.core.model.utils.emf.talendfile.ContextParameterType;
import org.talend.designer.core.model.utils.emf.talendfile.ContextType;
import org.talend.designer.core.model.utils.emf.talendfile.ElementParameterType;
import org.talend.designer.core.model.utils.emf.talendfile.MetadataType;
import org.talend.designer.core.model.utils.emf.talendfile.NodeType;
import org.talend.designer.core.model.utils.emf.talendfile.ProcessType;
@@ -1074,44 +1072,4 @@ public final class ProcessUtils {
}
return false;
}
public static boolean isChildRouteProcess(IProcess process) {
if (process != null) {
for (INode node : process.getGraphicalNodes()) {
if ((node.getComponent().getName() != null) &&
(node.getComponent().getName().compareTo("tRouteInput") == 0)) {
return true;
}
}
}
return false;
}
public static boolean hasJettyEndpoint(ProcessType process) {
EList<NodeType> nodesList = process.getNode();
boolean hasJettyEndpoint = hasJettyEndpoint(nodesList);
return hasJettyEndpoint;
}
private static boolean hasJettyEndpoint(EList<NodeType> nodesList) {
for (NodeType node : nodesList) {
if ("cMessagingEndpoint".equals(node.getComponentName())) {
for (Object elementParameter : node.getElementParameter()) {
ElementParameterType elementParameterType = (ElementParameterType)elementParameter;
String name = elementParameterType.getName();
String value = elementParameterType.getValue();
if ("URI".equals(name) && (value != null && StringUtils.startsWith(value.trim(), "\"jetty:"))) {
return true;
}
}
}
}
return false;
}
}

View File

@@ -956,26 +956,18 @@ public class RelationshipItemBuilder {
private void buildIndex(Map<Relation, Set<Relation>> itemRelations, Project project, IProgressMonitor monitor) {
modified = true;
if (!project.getEmfProject().getItemsRelations().isEmpty()) {
loadRelations(itemRelations, project);
if (loaded) { // check if already loaded successfully
return;
}
}
generateIndex(project, getTypes(), true, monitor);
if (modified) {
autoSaveRelations();
}
monitor.done();
loaded = true;
}
private void generateIndex(Project project, List<ERepositoryObjectType> supportedTypes, boolean fromMigration,
IProgressMonitor monitor) {
IProxyRepositoryFactory factory = getProxyRepositoryFactory();
List<IRepositoryViewObject> list = new ArrayList<IRepositoryViewObject>();
try {
for (ERepositoryObjectType curTyp : supportedTypes) {
for (ERepositoryObjectType curTyp : getTypes()) {
if (curTyp != null) {
list.addAll(factory.getAll(project, curTyp, true, true));
}
@@ -989,44 +981,21 @@ public class RelationshipItemBuilder {
for (IRepositoryViewObject object : list) {
Item item = object.getProperty().getItem();
monitor.subTask(Messages.getString("RelationshipItemBuilder.forItem") + item.getProperty().getLabel()); //$NON-NLS-1$
findRelationItems(item, fromMigration);
addOrUpdateItem(item, true);
monitor.worked(1);
if (monitor.isCanceled()) {
return;
}
}
autoSaveRelations();
monitor.done();
loaded = true;
} catch (PersistenceException e) {
ExceptionHandler.process(e);
}
}
public void buildAndSaveIndex() {
log.info("relationship.index generating");
currentProjectItemsRelations = new ConcurrentHashMap<Relation, Set<Relation>>();
referencesItemsRelations = new ConcurrentHashMap<Relation, Set<Relation>>();
generateIndex(this.aimProject, allSupportedTypes(), false, new NullProgressMonitor());
try {
// sync to project
synchronizeItemRelationToProject(this.aimProject);
// persist index
getProxyRepositoryFactory().saveProject(this.aimProject);
log.info("relationship.index generated");
} catch (PersistenceException e) {
log.error("relationship.index generating error", e);
ExceptionHandler.process(e);
}
}
private List<ERepositoryObjectType> allSupportedTypes() {
List<ERepositoryObjectType> toReturn = new ArrayList<ERepositoryObjectType>();
toReturn.addAll(ERepositoryObjectType.getAllTypesOfProcess());
toReturn.addAll(ERepositoryObjectType.getAllTypesOfProcess2());
toReturn.addAll(ERepositoryObjectType.getAllTypesOfTestContainer());
toReturn.addAll(ERepositoryObjectType.getAllTypesOfCodes());
toReturn.addAll(ERepositoryObjectType.getAllTypesOfJoblet());
return toReturn;
}
private List<ERepositoryObjectType> getTypes() {
List<ERepositoryObjectType> toReturn = new ArrayList<ERepositoryObjectType>();
toReturn.add(ERepositoryObjectType.PROCESS);
@@ -1148,24 +1117,14 @@ public class RelationshipItemBuilder {
}
public void addOrUpdateItem(Item item, boolean fromMigration) {
if (!supportRelation(item)) {
return;
}
if (!loaded) {
loadRelations();
}
boolean relationsModified = findRelationItems(item, fromMigration);
if (relationsModified && !modified) {
modified = true;
}
if (!fromMigration && modified) {
autoSaveRelations();
}
}
private boolean findRelationItems(Item item, boolean fromMigration) {
if (!supportRelation(item)) {
return false;
}
if (item == null) {
return false;
return;
}
boolean relationsModified = true;
@@ -1209,7 +1168,12 @@ public class RelationshipItemBuilder {
currentProjectItemsRelations.get(relation).addAll(oldProjectRelations);
}
}
return relationsModified;
if (relationsModified && !modified) {
modified = true;
}
if (!fromMigration && modified) {
autoSaveRelations();
}
}
public Set<Relation> getItemRelations(Item item) {

View File

@@ -25,7 +25,6 @@ import org.talend.core.model.general.Project;
import org.talend.core.model.process.IContext;
import org.talend.core.model.process.IProcess;
import org.talend.core.model.process.IProcess2;
import org.talend.core.model.process.JobInfo;
import org.talend.core.model.process.ProcessUtils;
import org.talend.core.model.properties.Item;
import org.talend.core.model.properties.Property;
@@ -33,7 +32,6 @@ import org.talend.core.model.relationship.RelationshipItemBuilder;
import org.talend.core.model.repository.IRepositoryViewObject;
import org.talend.core.runtime.CoreRuntimePlugin;
import org.talend.core.runtime.process.ITalendProcessJavaProject;
import org.talend.core.runtime.process.TalendProcessArgumentConstant;
import org.talend.designer.runprocess.IRunProcessService;
import org.talend.repository.ProjectManager;
import org.talend.repository.model.RepositoryNode;
@@ -90,17 +88,6 @@ public class JavaResourcesHelper {
return newJobName;
}
public static String getJobFolderName(String jobName, boolean isBundle, String version) {
String newJobName = escapeFileName(jobName).toLowerCase();
if (isBundle) {
newJobName += "_bundle";
}
if (version != null) {
newJobName += '_' + version.replace('.', '_');
}
return newJobName;
}
/**
*
* get the jar name like maven "artifactId.version"
@@ -110,39 +97,6 @@ public class JavaResourcesHelper {
return newJobName;
}
public static String getJobJarName(String jobName, String version, Property property) {
boolean isBundle = false;
if (property.getAdditionalProperties() != null && "OSGI".equals(property.getAdditionalProperties().get(TalendProcessArgumentConstant.ARG_BUILD_TYPE))) {
isBundle = true;
}
String newJobName = getJobFolderName(jobName, isBundle, version);
return newJobName;
}
public static String getJobJarName(JobInfo jobInfo) {
String newJobName = null;
if (jobInfo.getProcessItem() == null) {
newJobName = getJobJarName(jobInfo.getJobName(), jobInfo.getJobVersion());
} else {
newJobName = getJobJarName(jobInfo.getJobName(), jobInfo.getJobVersion(), jobInfo.getProcessItem().getProperty());
}
return newJobName;
}
public static String getJobJarName(Property property) {
String newJobName = getJobJarName(property.getLabel(), property.getVersion(), property);
return newJobName;
}
public static String getJobFolderName(JobInfo jobInfo) {
String newJobName = getJobJarName(jobInfo);
return newJobName;
}
public static String escapeFileName(final String fileName) {
return fileName != null ? fileName.replace(' ', '_') : ""; //$NON-NLS-1$
}

View File

@@ -19,9 +19,7 @@ import java.io.InputStream;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.apache.commons.lang.StringUtils;
import org.apache.http.HttpEntity;
@@ -54,14 +52,6 @@ public class NexusServerUtils {
// the max search result is 200 by defult from nexus
private static final int MAX_SEARCH_COUNT = 200;
public static final Set<String> IGNORED_TYPES = new HashSet<String>();
static {
IGNORED_TYPES.add("pom");
IGNORED_TYPES.add("sha1");
IGNORED_TYPES.add("md5");
}
/**
*
* DOC check if the repository exist or not
@@ -202,36 +192,36 @@ public class NexusServerUtils {
private static int readDocument(Document document, List<MavenArtifact> artifacts) throws Exception {
List<Node> list = document.selectNodes("/searchNGResponse/data/artifact");//$NON-NLS-1$
for (Node arNode : list) {
MavenArtifact artifact = new MavenArtifact();
artifacts.add(artifact);
artifact.setGroupId(arNode.selectSingleNode("groupId").getText());//$NON-NLS-1$
artifact.setArtifactId(arNode.selectSingleNode("artifactId").getText());//$NON-NLS-1$
artifact.setVersion(arNode.selectSingleNode("version").getText());//$NON-NLS-1$
Node descNode = arNode.selectSingleNode("description");//$NON-NLS-1$
if (descNode != null) {
artifact.setDescription(descNode.getText());
}
Node urlNode = arNode.selectSingleNode("url");//$NON-NLS-1$
if (urlNode != null) {
artifact.setUrl(urlNode.getText());
}
Node licenseNode = arNode.selectSingleNode("license");//$NON-NLS-1$
if (licenseNode != null) {
artifact.setLicense(licenseNode.getText());
}
Node licenseUrlNode = arNode.selectSingleNode("licenseUrl");//$NON-NLS-1$
if (licenseUrlNode != null) {
artifact.setLicenseUrl(licenseUrlNode.getText());
}
List<Node> artLinks = arNode.selectNodes("artifactHits/artifactHit/artifactLinks/artifactLink");//$NON-NLS-1$
for (Node link : artLinks) {
MavenArtifact artifact = new MavenArtifact();
artifact.setGroupId(arNode.selectSingleNode("groupId").getText());//$NON-NLS-1$
artifact.setArtifactId(arNode.selectSingleNode("artifactId").getText());//$NON-NLS-1$
artifact.setVersion(arNode.selectSingleNode("version").getText());//$NON-NLS-1$
Node descNode = arNode.selectSingleNode("description");//$NON-NLS-1$
if (descNode != null) {
artifact.setDescription(descNode.getText());
}
Node urlNode = arNode.selectSingleNode("url");//$NON-NLS-1$
if (urlNode != null) {
artifact.setUrl(urlNode.getText());
}
Node licenseNode = arNode.selectSingleNode("license");//$NON-NLS-1$
if (licenseNode != null) {
artifact.setLicense(licenseNode.getText());
}
Node licenseUrlNode = arNode.selectSingleNode("licenseUrl");//$NON-NLS-1$
if (licenseUrlNode != null) {
artifact.setLicenseUrl(licenseUrlNode.getText());
}
Node extensionElement = link.selectSingleNode("extension");//$NON-NLS-1$
String extension = null;
String classifier = null;
if (extensionElement != null) {
if (IGNORED_TYPES.contains(extensionElement.getText())) {// $NON-NLS-1$
if ("pom".equals(extensionElement.getText())) {//$NON-NLS-1$
continue;
}
extension = extensionElement.getText();
@@ -242,7 +232,6 @@ public class NexusServerUtils {
}
artifact.setType(extension);
artifact.setClassifier(classifier);
artifacts.add(artifact);
}
}
return list.size();

View File

@@ -194,10 +194,6 @@ public interface ITalendCorePrefConstants {
public static final String NEXUS_REFRESH_FREQUENCY = "NEXUS_REFRESH_FREQUENCY"; //$NON-NLS-1$
public static final String NEXUS_SHARE_LIBS = "NEXUS_SHARE_LIBS";
public static final boolean NEXUS_SHARE_LIBS_DEFAULT = true;
/**
* AutoMap algorithm weight
*/

View File

@@ -52,8 +52,6 @@ public interface TalendProcessArgumentConstant {
static final String ARG_NEED_RULES = "NEED_RULES";
static final String ARG_NEED_JETTY_SERVER = "NEED_JETTY_SERVER";
static final String ARG_ENABLE_WATCH = "ENABLE_WATCH";
static final String ARG_NEED_PIGUDFS = "NEED_PIGUDFS";

View File

@@ -12,8 +12,6 @@
// ============================================================================
package org.talend.repository;
import java.util.Set;
import org.talend.commons.exception.LoginException;
import org.talend.commons.exception.PersistenceException;
import org.talend.core.model.general.Project;
@@ -47,8 +45,6 @@ public abstract class RepositoryWorkUnit<T> {
private boolean refreshRepository = true; // added for TDI-27085
private Set<String> specifiedCommitFiles;
/**
* Usefull for some save only actions, where we're sure everything is up to date.
*/
@@ -198,13 +194,6 @@ public abstract class RepositoryWorkUnit<T> {
this.refreshRepository = refreshRepository;
}
public Set<String> getSpecifiedCommitFiles() {
return specifiedCommitFiles;
}
public void setSpecifiedCommitFiles(Set<String> specifiedCommitFiles) {
this.specifiedCommitFiles = specifiedCommitFiles;
}
/**
* Getter for avoidUpdateLocks.

View File

@@ -40,7 +40,6 @@ import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
import org.eclipse.ui.PlatformUI;
import org.talend.commons.ui.runtime.exception.ExceptionHandler;
import org.talend.commons.ui.runtime.update.PreferenceKeys;
import org.talend.commons.ui.runtime.utils.ZipFileUtils;
import org.talend.commons.ui.swt.advanced.dataeditor.LabelFieldEditor;
import org.talend.commons.ui.utils.workbench.preferences.OneLineComboFieldEditor;
@@ -529,7 +528,6 @@ public abstract class I18nPreferencePage extends FieldEditorPreferencePage imple
boolean ok = super.performOk();
saveLanguageType();
CorePlugin.getDefault().savePluginPreferences();
PlatformUI.getPreferenceStore().setValue(PreferenceKeys.NEED_OSGI_CLEAN, true);
if (isBabiliButtonClicked) {
refreshAll();
}
@@ -547,13 +545,6 @@ public abstract class I18nPreferencePage extends FieldEditorPreferencePage imple
protected void performApply() {
saveLanguageType();
CorePlugin.getDefault().savePluginPreferences();
PlatformUI.getPreferenceStore().setValue(PreferenceKeys.NEED_OSGI_CLEAN, true);
}
@Override
protected void performDefaults() {
super.performDefaults();
PlatformUI.getPreferenceStore().setValue(PreferenceKeys.NEED_OSGI_CLEAN, true);
}
/**

View File

@@ -20,14 +20,11 @@ import org.eclipse.emf.common.util.URI;
import org.osgi.service.prefs.BackingStoreException;
import org.talend.commons.exception.PersistenceException;
import org.talend.commons.exception.SystemException;
import org.talend.core.GlobalServiceRegister;
import org.talend.core.IService;
import org.talend.core.model.general.Project;
import org.talend.core.model.process.INode;
import org.talend.core.model.properties.Property;
import org.talend.core.updatesite.IUpdateSiteBean;
/**
* wchen class global comment. Detailled comment
*/
@@ -69,19 +66,4 @@ public interface ICoreTisService extends IService {
public void updateConfiguratorBundles(File configFile, File tempConfigFile) throws IOException;
public void afterImport(Property property) throws PersistenceException;
boolean hasNewPatchInPatchesFolder();
boolean isDefaultLicenseAndProjectType();
void refreshPatchesFolderCache();
static ICoreTisService get() {
if (GlobalServiceRegister.getDefault().isServiceRegistered(ICoreTisService.class)) {
return GlobalServiceRegister.getDefault().getService(ICoreTisService.class);
}
return null;
}
}

View File

@@ -11,8 +11,6 @@
<packaging>pom</packaging>
<properties>
<components.version>0.27.3</components.version>
<marketo_release_proxy>https://artifacts-oss.talend.com/nexus/content/repositories/marklogic</marketo_release_proxy>
<jcenter_bintray>https://jcenter.bintray.com</jcenter_bintray>
</properties>
<repositories>
<repository>
@@ -35,15 +33,6 @@
</snapshots>
<url>https://artifacts-oss.talend.com/nexus/content/repositories/TalendOpenSourceSnapshot/</url>
</repository>
<repository>
<id>MarkLogic-releases</id>
<name>MarkLogic Releases</name>
<url>${marketo_release_proxy}</url>
</repository>
<repository>
<id>jcenter</id>
<url>${jcenter_bintray}</url>
</repository>
</repositories>
<dependencyManagement>

View File

@@ -71,12 +71,6 @@
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.talend.sdk.component</groupId>
<artifactId>component-runtime</artifactId>
<version>${tcomp.version}</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.talend.sdk.component</groupId>
<artifactId>component-server</artifactId>

View File

@@ -532,12 +532,6 @@ public class AggregatorPomsHelper {
* Use Function to get the relativePath from property at realtime, since the property may be changed
*/
public static IFolder getItemPomFolder(Property property, String realVersion, Function<Property, IPath> getItemRelativePath) {
return getItemPomFolder(property, ProjectManager.getInstance().getProject(property).getTechnicalLabel(), realVersion,
getItemRelativePath);
}
public static IFolder getItemPomFolder(Property property, String projectTechName, String realVersion,
Function<Property, IPath> getItemRelativePath) {
if (GlobalServiceRegister.getDefault().isServiceRegistered(ITestContainerProviderService.class)) {
ITestContainerProviderService testContainerService =
(ITestContainerProviderService) GlobalServiceRegister.getDefault().getService(
@@ -554,6 +548,7 @@ public class AggregatorPomsHelper {
}
}
String projectTechName = ProjectManager.getInstance().getProject(property).getTechnicalLabel();
AggregatorPomsHelper helper = new AggregatorPomsHelper(projectTechName);
IPath itemRelativePath = getItemRelativePath.apply(property);
String version = realVersion == null ? property.getVersion() : realVersion;

View File

@@ -12,7 +12,6 @@
// ============================================================================
package org.talend.designer.maven.tools.creator;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -46,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.LastGenerationInfo;
import org.talend.core.runtime.process.TalendProcessArgumentConstant;
import org.talend.core.runtime.projectsetting.IProjectSettingTemplateConstants;
import org.talend.core.runtime.repository.build.IMavenPomCreator;
@@ -54,7 +52,6 @@ import org.talend.core.ui.ITestContainerProviderService;
import org.talend.designer.maven.model.TalendMavenConstants;
import org.talend.designer.maven.template.ETalendMavenVariables;
import org.talend.designer.maven.tools.ProcessorDependenciesManager;
import org.talend.designer.maven.utils.JobUtils;
import org.talend.designer.maven.utils.PomIdsHelper;
import org.talend.designer.maven.utils.PomUtil;
import org.talend.designer.runprocess.IBigDataProcessor;
@@ -137,15 +134,9 @@ public abstract class AbstractMavenProcessorPom extends CreateMavenBundleTemplat
Map<ETalendMavenVariables, String> variablesValuesMap = new HashMap<ETalendMavenVariables, String>();
// no need check property is null or not, because if null, will get default ids.
JobInfo lastMainJob = LastGenerationInfo.getInstance().getLastMainJob();
if (JobUtils.isJob(property) && ProcessUtils.isChildRouteProcess(process) && lastMainJob != null) {
variablesValuesMap.put(ETalendMavenVariables.JobGroupId, PomIdsHelper.getJobGroupId(lastMainJob.getProcessor().getProperty()));
variablesValuesMap.put(ETalendMavenVariables.JobVersion, PomIdsHelper.getJobVersion(lastMainJob.getProcessor().getProperty()));
}else {
variablesValuesMap.put(ETalendMavenVariables.JobGroupId, PomIdsHelper.getJobGroupId(property));
variablesValuesMap.put(ETalendMavenVariables.JobVersion, PomIdsHelper.getJobVersion(property));
}
variablesValuesMap.put(ETalendMavenVariables.JobArtifactId, PomIdsHelper.getJobArtifactId(property));
variablesValuesMap.put(ETalendMavenVariables.JobGroupId, PomIdsHelper.getJobGroupId(property));
variablesValuesMap.put(ETalendMavenVariables.JobArtifactId, PomIdsHelper.getJobArtifactId(property));
variablesValuesMap.put(ETalendMavenVariables.JobVersion, PomIdsHelper.getJobVersion(property));
variablesValuesMap.put(ETalendMavenVariables.TalendJobVersion, property.getVersion());
final String jobName = JavaResourcesHelper.escapeFileName(process.getName());
variablesValuesMap.put(ETalendMavenVariables.JobName, jobName);
@@ -316,20 +307,13 @@ public abstract class AbstractMavenProcessorPom extends CreateMavenBundleTemplat
String type = null;
if (!jobInfo.isJoblet()) {
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";
}
JobInfo lastMainJob = LastGenerationInfo.getInstance().getLastMainJob();
if (lastMainJob != null && JobUtils.isJob(jobInfo) && JobUtils.isRoute(getJobProcessor().getProperty())) {
groupId = PomIdsHelper.getJobGroupId(lastMainJob.getProcessor().getProperty());
version = PomIdsHelper.getJobVersion(lastMainJob.getProcessor().getProperty());
} else {
groupId = PomIdsHelper.getJobGroupId(property);
version = PomIdsHelper.getJobVersion(property);
}
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());
IProject codeProject = getJobProcessor().getCodeProject();

View File

@@ -294,7 +294,7 @@ public class CreateMavenJobPom extends AbstractMavenProcessorPom {
jobInfoProp.getProperty(JobInfoProperties.APPLY_CONTEXY_CHILDREN, Boolean.FALSE.toString()));
checkPomProperty(properties, "talend.product.version", ETalendMavenVariables.ProductVersion,
jobInfoProp.getProperty(JobInfoProperties.COMMANDLINE_VERSION, VersionUtils.getVersion()));
String finalNameStr = JavaResourcesHelper.getJobJarName(property);
String finalNameStr = JavaResourcesHelper.getJobJarName(property.getLabel(), property.getVersion());
checkPomProperty(properties, "talend.job.finalName", ETalendMavenVariables.JobFinalName, finalNameStr);
if (getJobProcessor() != null) {
@@ -662,7 +662,7 @@ public class CreateMavenJobPom extends AbstractMavenProcessorPom {
Set<JobInfo> childrenJobInfo = processor.getBuildChildrenJobs().stream().filter(j -> !j.isTestContainer())
.collect(Collectors.toSet());
if (!hasLoopDependency()) {
childrenJobInfo.forEach(j -> jobCoordinate.add(getChildrenJobCoordinate(j.getProcessItem().getProperty())));
childrenJobInfo.forEach(j -> jobCoordinate.add(getJobCoordinate(j.getProcessItem().getProperty())));
}
// talend libraries and codes
@@ -670,15 +670,12 @@ public class CreateMavenJobPom extends AbstractMavenProcessorPom {
.getProjectGroupId(ProjectManager.getInstance().getProject(currentJobProperty).getTechnicalLabel());
List<Dependency> dependencies = new ArrayList<>();
List<Dependency> codeDependencies = new ArrayList<>();
// codes dependencies (optional)
// codes
addCodesDependencies(codeDependencies);
addCodesDependencies(dependencies);
ERepositoryObjectType.getAllTypesOfCodes().forEach(t -> codeDependencies.addAll(PomUtil.getCodesDependencies(t)));
// codes dependencies (optional)
ERepositoryObjectType.getAllTypesOfCodes().forEach(t -> dependencies.addAll(PomUtil.getCodesDependencies(t)));
dependencies.addAll(codeDependencies);
// libraries of talend/3rd party
dependencies.addAll(processor.getNeededModules(TalendProcessOptionConstants.MODULES_EXCLUDE_SHADED).stream()
.filter(m -> !m.isExcluded()).map(m -> createDenpendency(m, false)).collect(Collectors.toSet()));
@@ -823,20 +820,7 @@ public class CreateMavenJobPom extends AbstractMavenProcessorPom {
}
protected String getJobCoordinate(Property property) {
String bundle = "";
if ("OSGI".equals(property.getAdditionalProperties().get(TalendProcessArgumentConstant.ARG_BUILD_TYPE))) {
bundle = "-bundle";
}
return getCoordinate(PomIdsHelper.getJobGroupId(property), PomIdsHelper.getJobArtifactId(property) + bundle,
MavenConstants.PACKAGING_JAR, PomIdsHelper.getJobVersion(property), null);
}
protected String getChildrenJobCoordinate(Property property) {
return getCoordinate(PomIdsHelper.getJobGroupId(property),
"OSGI".equals(property.getAdditionalProperties().get(TalendProcessArgumentConstant.ARG_BUILD_TYPE))?
PomIdsHelper.getJobArtifactId(property) + "-bundle" : PomIdsHelper.getJobArtifactId(property),
return getCoordinate(PomIdsHelper.getJobGroupId(property), PomIdsHelper.getJobArtifactId(property),
MavenConstants.PACKAGING_JAR, PomIdsHelper.getJobVersion(property), null);
}

View File

@@ -44,7 +44,6 @@ 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.model.utils.JavaResourcesHelper;
import org.talend.core.repository.model.ProxyRepositoryFactory;
import org.talend.core.runtime.maven.MavenConstants;
import org.talend.core.runtime.process.ITalendProcessJavaProject;
@@ -150,9 +149,7 @@ public class CreateMavenStandardJobOSGiPom extends CreateMavenJobPom {
}
}
model.setName(model.getName() + " Bundle");
Property property = getJobProcessor().getProperty();
String finalNameStr = JavaResourcesHelper.getJobJarName(property);
model.addProperty("talend.job.finalName", finalNameStr);
model.addProperty("talend.job.finalName", "${talend.job.name}-bundle-${project.version}");
Build build = model.getBuild();
if (GlobalServiceRegister.getDefault().isServiceRegistered(IESBService.class)) {

View File

@@ -24,8 +24,6 @@ import org.talend.core.model.process.JobInfo;
import org.talend.core.model.process.ProcessUtils;
import org.talend.core.model.properties.Item;
import org.talend.core.model.properties.ProcessItem;
import org.talend.core.model.properties.Property;
import org.talend.core.model.repository.ERepositoryObjectType;
import org.talend.core.model.repository.IRepositoryViewObject;
import org.talend.core.model.utils.JavaResourcesHelper;
import org.talend.core.runtime.CoreRuntimePlugin;
@@ -99,29 +97,5 @@ public class JobUtils {
}
return clonedJobInfos;
}
public static boolean isRoute(Property p) {
if (p != null) {
return ERepositoryObjectType.getType(p).equals(ERepositoryObjectType.PROCESS_ROUTE);
}
return false;
}
public static boolean isJob(JobInfo job) {
if (job != null && job.getProcessItem() != null) {
Property p = job.getProcessItem().getProperty();
if (p != null) {
return isJob(p);
}
}
return false;
}
public static boolean isJob(Property p) {
if (p != null) {
return ERepositoryObjectType.getType(p).equals(ERepositoryObjectType.PROCESS);
}
return false;
}
}

View File

@@ -14,17 +14,12 @@ package org.talend.librariesmanager.ui.startup;
import org.eclipse.ui.IStartup;
import java.util.logging.Logger;
import org.talend.librariesmanager.prefs.LibrariesManagerUtils;
/**
* created by wchen on 2015-6-15 Detailled comment
*
*/
public class ShareLibsSynchronizer implements IStartup {
private static final Logger LOGGER = Logger.getLogger(ShareLibsSynchronizer.class.getCanonicalName());
/*
* (non-Javadoc)
*
@@ -32,11 +27,8 @@ public class ShareLibsSynchronizer implements IStartup {
*/
@Override
public void earlyStartup() {
if (LibrariesManagerUtils.shareLibsAtStartup()) {
ShareLibsJob job = new ShareLibsJob();
job.schedule();
} else {
LOGGER.info("Skip sharing libraries");
}
ShareLibsJob job = new ShareLibsJob();
job.schedule();
}
}

View File

@@ -40,7 +40,6 @@ import org.talend.core.GlobalServiceRegister;
import org.talend.core.ILibraryManagerService;
import org.talend.core.model.general.ModuleNeeded;
import org.talend.librariesmanager.model.ModulesNeededProvider;
import org.talend.librariesmanager.model.service.CustomUriManager;
import org.talend.librariesmanager.ui.dialogs.CustomURITextCellEditor;
import org.talend.librariesmanager.ui.dialogs.InstallModuleDialog;
import org.talend.librariesmanager.ui.i18n.Messages;
@@ -299,7 +298,6 @@ public class ModulesViewComposite extends Composite {
* @see org.talend.designer.codegen.perlmodule.ui.views.IModulesViewComposite#refresh()
*/
public void refresh() {
CustomUriManager.getInstance().setForeceReloadCustomUri();
List<ModuleNeeded> modulesNeeded = new ArrayList<ModuleNeeded>();
modulesNeeded.addAll(ModulesNeededProvider.getAllManagedModules());
ModulesViewComposite.getTableViewerCreator().init(modulesNeeded);

View File

@@ -8,4 +8,5 @@ bin.includes = META-INF/,\
plugin.properties,\
model/,\
templates/,\
distribution/license.json
distribution/license.json,\
lib/crypto-utils.jar

View File

@@ -31,16 +31,6 @@
type="librariesindex"
class="org.talend.librariesmanager.emf.librariesindex.util.LibrariesindexResourceFactoryImpl"/>
</extension>
<extension
point="org.talend.core.runtime.librariesNeeded">
<libraryNeeded
context="plugin:org.talend.librariesmanager"
id="crypto-utils-1.4.0_Studio.jar"
mvn_uri="mvn:org.talend.daikon/crypto-utils/1.4.0_Studio"
name="crypto-utils-1.4.0_Studio.jar"
required="true">
</libraryNeeded>
</extension>
<extension
point="org.talend.core.systemRoutineLibrary">
<systemRoutine
@@ -55,7 +45,7 @@
<systemRoutine
name="PasswordEncryptUtil">
<library
name="crypto-utils-1.4.0_Studio.jar">
name="crypto-utils.jar">
</library>
</systemRoutine>
</extension>

View File

@@ -72,6 +72,9 @@ public class ResumeUtil {
if (sharedWriter == null) {
this.csvWriter = new SimpleCsvWriter(new FileWriter(logFileName, createNewFile));
// shared
sharedWriterMap.put(this.root_pid, this.csvWriter);
// output the header part
if (file.length() == 0) {
if (genDynamicPart) {
@@ -97,13 +100,7 @@ public class ResumeUtil {
csvWriter.write("dynamicData");// dynamicData
csvWriter.endRecord();
csvWriter.flush();
csvWriter.close();
// To avoid use File.delete() as it cannot make sure file being deleted.
this.csvWriter = new SimpleCsvWriter(new FileWriter(logFileName, true));
}
// shared
sharedWriterMap.put(this.root_pid, this.csvWriter);
} else {
csvWriter = sharedWriter;
}

View File

@@ -67,9 +67,7 @@ import org.talend.core.model.general.LibraryInfo;
import org.talend.core.model.general.ModuleNeeded;
import org.talend.core.model.general.ModuleNeeded.ELibraryInstallStatus;
import org.talend.core.model.general.Project;
import org.talend.core.model.process.INode;
import org.talend.core.model.process.IProcess;
import org.talend.core.model.process.ProcessUtils;
import org.talend.core.model.properties.Item;
import org.talend.core.model.properties.ProcessItem;
import org.talend.core.model.properties.Property;
@@ -506,7 +504,8 @@ public class ModulesNeededProvider {
modulesNeeded.addAll(modulesNeededForPigudf);
if (ComponentCategory.CATEGORY_4_CAMEL.getName().equals(process.getComponentsType())) {
// route do not save any relateionship with beans , so add all for now
Set<ModuleNeeded> modulesNeededForBean = ModulesNeededProvider.getCodesModuleNeededs(ERepositoryObjectType.getType("BEANS"), false);
Set<ModuleNeeded> modulesNeededForBean = ModulesNeededProvider
.getCodesModuleNeededs(ERepositoryObjectType.getType("BEANS"), false);
modulesNeeded.addAll(modulesNeededForBean);
modulesNeeded.addAll(getModulesNeededForRoutes());
}

View File

@@ -318,8 +318,4 @@ public abstract class AbstractLibrariesService implements ILibrariesService {
}
}
}
@Override
public void setForceReloadCustomUri() {
}
}

View File

@@ -46,8 +46,6 @@ public class CustomUriManager {
private static final String CUSTOM_URI_MAP = "custom_uri_mapping.json";
private static long lastModified = 0;
private static boolean isNeedReload = false;
private CustomUriManager() {
try {
@@ -161,19 +159,15 @@ public class CustomUriManager {
try {
File file = new File(getResourcePath(), CUSTOM_URI_MAP);
long modifyDate = file.lastModified();
if (isNeedReload || modifyDate > lastModified) {
if (modifyDate > lastModified) {
customURIObject.clear();
JSONObject loadResources = loadResources(getResourcePath(), CUSTOM_URI_MAP);
customURIObject.putAll(loadResources);
lastModified = modifyDate;
isNeedReload = false;
}
} catch (IOException e) {
ExceptionHandler.process(e);
}
}
public void setForeceReloadCustomUri() {
isNeedReload = true;
}
}

View File

@@ -267,9 +267,5 @@ public class LibrariesService implements ILibrariesService {
public void deployLibrary(URL source, String mavenUri, boolean refresh, boolean updateNexusJar) throws IOException {
getLibrariesService().deployLibrary(source, mavenUri, refresh, updateNexusJar);
}
public void setForceReloadCustomUri() {
CustomUriManager.getInstance().setForeceReloadCustomUri();
}
}

View File

@@ -32,9 +32,7 @@ import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Stream;
import javax.xml.bind.DatatypeConverter;
@@ -175,7 +173,7 @@ public class LocalLibraryManager implements ILibraryManagerService, IChangedLibr
if (file == null || !file.exists()) {
return;
}
install(file, mavenUri, updateNexusJar, false, monitorWrap);
install(file, mavenUri, updateNexusJar, monitorWrap);
}
/**
@@ -186,8 +184,7 @@ public class LocalLibraryManager implements ILibraryManagerService, IChangedLibr
* @param mavenUri snaopshot mvn uri
* @param monitorWrap
*/
private void install(File file, String mavenRUI, boolean updateRemoteJar, boolean useReleaseVersion,
IProgressMonitor... monitorWrap) {
private void install(File file, String mavenRUI, boolean updateRemoteJar, IProgressMonitor... monitorWrap) {
try {
if (file.isDirectory()) {
List<File> jarFiles = FilesUtils.getJarFilesFromFolder(file, null);
@@ -195,7 +192,7 @@ public class LocalLibraryManager implements ILibraryManagerService, IChangedLibr
if (!jarFiles.isEmpty()) {
for (File jarFile : jarFiles) {
if (mavenRUI == null) {
guessMavenRUIFromIndex(jarFile, useReleaseVersion, sourceAndMavenUri);
guessMavenRUIFromIndex(jarFile, sourceAndMavenUri);
} else {
sourceAndMavenUri.put(mavenRUI, jarFile.getAbsolutePath());
}
@@ -216,7 +213,7 @@ public class LocalLibraryManager implements ILibraryManagerService, IChangedLibr
} else {
Map<String, String> sourceAndMavenUri = new HashMap<>();
if (mavenRUI == null) {
guessMavenRUIFromIndex(file, useReleaseVersion, sourceAndMavenUri);
guessMavenRUIFromIndex(file, sourceAndMavenUri);
} else {
sourceAndMavenUri.put(mavenRUI, file.getAbsolutePath());
}
@@ -242,11 +239,6 @@ public class LocalLibraryManager implements ILibraryManagerService, IChangedLibr
}
public void guessMavenRUIFromIndex(File jarFile, Map<String, String> sourceAndMavenUri) {
guessMavenRUIFromIndex(jarFile, false, sourceAndMavenUri);
}
public void guessMavenRUIFromIndex(File jarFile, boolean useReleaseVersion, Map<String, String> sourceAndMavenUri) {
// TODO????? should deploy with all versions
String urisFromIndex = LibrariesIndexManager.getInstance().getMavenLibIndex().getJarsToRelativePath()
.get(jarFile.getName());
@@ -271,7 +263,7 @@ public class LocalLibraryManager implements ILibraryManagerService, IChangedLibr
// deploy as defaultMavenUri in case jar name is diffrent from artifactId in mvnuri from
// index
if (deployAsDefault) {
String defaultMavenUri = MavenUrlHelper.generateMvnUrlForJarName(jarFile.getName(), true, !useReleaseVersion);
String defaultMavenUri = MavenUrlHelper.generateMvnUrlForJarName(jarFile.getName());
String customMavenURI = getCustomMavenURI(defaultMavenUri);
if (customMavenURI != null) {
defaultMavenUri = customMavenURI;
@@ -897,7 +889,7 @@ public class LocalLibraryManager implements ILibraryManagerService, IChangedLibr
ExceptionHandler.log("missing jar:" + module.getModuleName());
}
if (fileToDeploy != null) {
install(fileToDeploy, mavenUri, false, false, monitorWrap);
install(fileToDeploy, mavenUri, false, monitorWrap);
}
}
}
@@ -1257,9 +1249,9 @@ public class LocalLibraryManager implements ILibraryManagerService, IChangedLibr
warnDuplicated(modules, duplicateMavenUri, "Maven Uri:");
}
}
if (service != null) {
calculateModulesIndexFromComponentFolder(service, platformURLMap);
deployLibsFromComponentFolder(service, platformURLMap);
}
saveMavenIndex(mavenURIMap, monitorWrap);
@@ -1271,75 +1263,82 @@ public class LocalLibraryManager implements ILibraryManagerService, IChangedLibr
}
/**
*
* The old components might use some jars in component folder and theres jars are not configured with platfrom URL
*
* @param service
* @param libsWithoutUri
* @param platformURLMap
*/
private void calculateModulesIndexFromComponentFolder(IComponentsService service, Map<String, String> platformURLMap) {
List<ComponentProviderInfo> componentsFolders = service.getComponentsFactory().getComponentsProvidersInfo();
for (ComponentProviderInfo providerInfo : componentsFolders) {
String contributeID = providerInfo.getContributer();
String id = providerInfo.getId();
try {
if (!isExtComponentProvider(id)) {
File file = new File(providerInfo.getLocation());
List<File> jarFiles = FilesUtils.getJarFilesFromFolder(file, null, "ext");
if (jarFiles.size() > 0) {
for (File jarFile : jarFiles) {
String name = jarFile.getName();
String path = platformURLMap.get(name);
int lengthBasePath = new Path(file.getParentFile().getAbsolutePath()).toPortableString().length();
String relativePath = new Path(jarFile.getAbsolutePath()).toPortableString()
.substring(lengthBasePath);
String moduleLocation = "platform:/plugin/" + contributeID + relativePath;
if (path != null) {
if (path.equals(moduleLocation)) {
continue;
} else {
if (CommonsPlugin.isDebugMode()) {
CommonExceptionHandler
.warn(name + " is duplicated, locations:" + path + " and:" + moduleLocation);
}
continue;
}
}
platformURLMap.put(name, moduleLocation);
}
}
}
} catch (Exception e) {
ExceptionHandler.process(e);
continue;
}
}
}
private boolean isExtComponentProvider(String id) {
if ("org.talend.designer.components.model.UserComponentsProvider".equals(id)
|| "org.talend.designer.codegen.components.model.SharedStudioUserComponentProvider".equals(id)
|| "org.talend.designer.components.exchange.ExchangeComponentsProvider".equals(id)
|| "org.talend.designer.components.exchange.SharedStudioExchangeComponentsProvider".equals(id)) {
return true;
}
return false;
}
*
* The old components might use some jars in component folder and theres jars are not configured with platfrom URL
*
* @param service
* @param libsWithoutUri
* @param platformURLMap
*/
private void deployLibsFromComponentFolder(IComponentsService service, Map<String, String> platformURLMap) {
Set<File> needToDeploy = new HashSet<>();
List<ComponentProviderInfo> componentsFolders = service.getComponentsFactory().getComponentsProvidersInfo();
for (ComponentProviderInfo providerInfo : componentsFolders) {
String contributeID = providerInfo.getContributer();
String id = providerInfo.getId();
try {
File file = new File(providerInfo.getLocation());
if ("org.talend.designer.components.model.UserComponentsProvider".equals(id)
|| "org.talend.designer.components.exchange.ExchangeComponentsProvider".equals(id)) {
if (file.isDirectory()) {
List<File> jarFiles = FilesUtils.getJarFilesFromFolder(file, null);
if (jarFiles.size() > 0) {
for (File jarFile : jarFiles) {
String name = jarFile.getName();
if (platformURLMap.get(name) != null) {
continue;
}
needToDeploy.add(jarFile);
}
}
} else {
if (platformURLMap.get(file.getName()) != null) {
continue;
}
needToDeploy.add(file);
}
} else {
// for other component provider ,add jars to the platform url index
List<File> jarFiles = FilesUtils.getJarFilesFromFolder(file, null, "ext");
if (jarFiles.size() > 0) {
for (File jarFile : jarFiles) {
String name = jarFile.getName();
String path = platformURLMap.get(name);
int lengthBasePath = new Path(file.getParentFile().getAbsolutePath()).toPortableString().length();
String relativePath = new Path(jarFile.getAbsolutePath()).toPortableString()
.substring(lengthBasePath);
String moduleLocation = "platform:/plugin/" + contributeID + relativePath;
if (path != null) {
if (path.equals(moduleLocation)) {
continue;
} else {
if (CommonsPlugin.isDebugMode()) {
CommonExceptionHandler
.warn(name + " is duplicated, locations:" + path + " and:" + moduleLocation);
}
continue;
}
}
platformURLMap.put(name, moduleLocation);
}
}
}
} catch (Exception e) {
ExceptionHandler.process(e);
continue;
}
}
}
private void deployLibsFromCustomComponents(IComponentsService service, Map<String, String> platformURLMap) {
boolean deployToRemote = true;
if (!LibrariesManagerUtils.shareLibsAtStartup()) {
log.info("Skip deploying libs from custom components");
deployToRemote = false;
}
Set<File> needToDeploy = new HashSet<>();
List<ComponentProviderInfo> componentsFolders = service.getComponentsFactory().getComponentsProvidersInfo();
for (ComponentProviderInfo providerInfo : componentsFolders) {
String id = providerInfo.getId();
try {
File file = new File(providerInfo.getLocation());
if (isExtComponentProvider(id)) {
if ("org.talend.designer.components.model.UserComponentsProvider".equals(id)
|| "org.talend.designer.components.exchange.ExchangeComponentsProvider".equals(id)) {
if (file.isDirectory()) {
List<File> jarFiles = FilesUtils.getJarFilesFromFolder(file, null);
if (jarFiles.size() > 0) {
@@ -1365,19 +1364,6 @@ public class LocalLibraryManager implements ILibraryManagerService, IChangedLibr
}
}
if (!deployToRemote) {
needToDeploy.forEach(libFile -> {
try {
// install as release version if can't find mvn url from index
install(libFile, null, false, true);
} catch (Exception e) {
ExceptionHandler.process(e);
}
});
return;
}
// deploy needed jars for User and Exchange component providers
Map<String, List<MavenArtifact>> snapshotArtifactMap = new HashMap<String, List<MavenArtifact>>();
Map<String, List<MavenArtifact>> releaseArtifactMap = new HashMap<String, List<MavenArtifact>>();
@@ -1457,7 +1443,7 @@ public class LocalLibraryManager implements ILibraryManagerService, IChangedLibr
}
for (File file : needToDeploy) {
try {
install(file, null, true, true);
deploy(file.toURI());
} catch (Exception e) {
ExceptionHandler.process(e);
}

View File

@@ -29,7 +29,6 @@ import org.apache.http.message.BasicHeader;
import org.apache.http.params.CoreConnectionPNames;
import org.apache.http.util.EntityUtils;
import org.eclipse.m2e.core.MavenPlugin;
import org.talend.commons.CommonsPlugin;
import org.talend.commons.exception.ExceptionHandler;
import org.talend.commons.utils.network.TalendProxySelector.IProxySelectorProvider;
import org.talend.core.nexus.HttpClientTransport;
@@ -39,9 +38,6 @@ import org.talend.core.nexus.NexusServerUtils;
import org.talend.core.runtime.maven.MavenArtifact;
import org.talend.core.runtime.maven.MavenUrlHelper;
import org.talend.designer.maven.aether.RepositorySystemFactory;
import org.talend.librariesmanager.i18n.Messages;
import org.talend.librariesmanager.nexus.utils.ShareLibrariesUtil;
import org.talend.utils.sugars.TypedReturnCode;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
@@ -122,11 +118,6 @@ public class ArtifacoryRepositoryHandler extends AbstractArtifactRepositoryHandl
@Override
public List<MavenArtifact> search(String groupIdToSearch, String artifactId, String versionToSearch, boolean fromRelease,
boolean fromSnapshot) throws Exception {
return requestSearch(groupIdToSearch, artifactId, versionToSearch, fromRelease, fromSnapshot, false);
}
protected List<MavenArtifact> requestSearch(String groupIdToSearch, String artifactId, String versionToSearch,
boolean fromRelease, boolean fromSnapshot, boolean useSnapshotVersion) throws Exception {
String serverUrl = serverBean.getServer();
if (!serverUrl.endsWith("/")) { //$NON-NLS-1$
serverUrl = serverUrl + "/"; //$NON-NLS-1$
@@ -206,21 +197,9 @@ public class ArtifacoryRepositoryHandler extends AbstractArtifactRepositoryHandl
}
if (type != null) {
MavenArtifact artifact = new MavenArtifact();
String g = ""; //$NON-NLS-1$
String a = split[split.length - 3];
String v = split[split.length - 2];
if (fromSnapshot && useSnapshotVersion) {
String jarName = split[split.length - 1];
if (jarName.contains("-")) {
v = jarName.substring(jarName.indexOf("-") + 1);
v = v.substring(0, v.lastIndexOf("."));
} else {
if (CommonsPlugin.isDebugMode()) {
ExceptionHandler
.process(new Exception("the jar name is not the usual style: " + jarName));
}
}
}
String a = split[split.length - 3];
String g = ""; //$NON-NLS-1$
for (int j = 1; j < split.length - 3; j++) {
if ("".equals(g)) { //$NON-NLS-1$
g = split[j];
@@ -233,9 +212,6 @@ public class ArtifacoryRepositoryHandler extends AbstractArtifactRepositoryHandl
artifact.setVersion(v);
artifact.setType(type);
artifact.setLastUpdated(lastUpdated);
String regex = a + "-" + v;
String classifier = ShareLibrariesUtil.getMavenClassifier(artifactPath, regex, type);
artifact.setClassifier(classifier);
fillChecksumData(jsonObject, artifact);
resultList.add(artifact);
}

View File

@@ -30,18 +30,13 @@ import org.apache.log4j.Logger;
import org.eclipse.core.runtime.IProgressMonitor;
import org.talend.core.nexus.ArtifactRepositoryBean;
import org.talend.core.nexus.HttpClientTransport;
import org.talend.core.nexus.NexusServerUtils;
import org.talend.core.runtime.maven.MavenArtifact;
import org.talend.librariesmanager.nexus.utils.ShareLibrariesUtil;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
public abstract class AbsNexus3SearchHandler implements INexus3SearchHandler {
private static Logger log = Logger.getLogger(AbsNexus3SearchHandler.class);
protected ArtifactRepositoryBean serverBean;
/**
@@ -131,57 +126,41 @@ public abstract class AbsNexus3SearchHandler implements INexus3SearchHandler {
if (resultArray != null) {
for (int i = 0; i < resultArray.size(); i++) {
JSONObject jsonObject = resultArray.getJSONObject(i);
String repository = jsonObject.getString("repository");//$NON-NLS-1$
String group = jsonObject.getString("group");//$NON-NLS-1$
String name = jsonObject.getString("name");//$NON-NLS-1$
String version = jsonObject.getString("version");//$NON-NLS-1$
JSONArray assertsArray = jsonObject.getJSONArray("assets");//$NON-NLS-1$
if (assertsArray != null) {
for (int j = 0; j < assertsArray.size(); j++) {
JSONObject assertsObject = assertsArray.getJSONObject(j);
String packageType = getPackageType(assertsObject);
if (packageType != null) {
MavenArtifact artifact = new MavenArtifact();
String path = assertsObject.getString("path"); //$NON-NLS-1$
String regex = name + "-" + version;
String classifier = ShareLibrariesUtil.getMavenClassifier(path, regex, packageType);
artifact.setGroupId(group);
artifact.setArtifactId(name);
artifact.setVersion(version);
artifact.setType(packageType);
artifact.setClassifier(classifier);
if (artifact.getType() != null) {
fillCheckSumData(assertsArray, artifact);
resultList.add(artifact);
}
}
}
}
MavenArtifact artifact = new MavenArtifact();
artifact.setGroupId(jsonObject.getString("group")); //$NON-NLS-1$
artifact.setArtifactId(jsonObject.getString("name")); //$NON-NLS-1$
artifact.setVersion(jsonObject.getString("version")); //$NON-NLS-1$
JSONArray assertsArray = jsonObject.getJSONArray("assets"); //$NON-NLS-1$
artifact.setType(getPackageType(assertsArray));
fillCheckSumData(assertsArray, artifact);
resultList.add(artifact);
}
}
return continuationToken;
}
protected String getPackageType(JSONObject jsonObject) {
protected String getPackageType(JSONArray assertsArray) {
String type = null;
String path = jsonObject.getString("path"); //$NON-NLS-1$
int idx = path.lastIndexOf('.');
if (idx > -1) {
type = path.substring(idx + 1);
if (assertsArray != null) {
for (int i = 0; i < assertsArray.size(); i++) {
JSONObject jsonObject = assertsArray.getJSONObject(i);
String path = jsonObject.getString("path"); //$NON-NLS-1$
if (path != null && path.endsWith(".exe")) { //$NON-NLS-1$
return "exe"; //$NON-NLS-1$
}
if (path != null && path.endsWith(".zip")) { //$NON-NLS-1$
return "zip"; //$NON-NLS-1$
}
if (path != null && path.endsWith(".jar")) { //$NON-NLS-1$
return "jar"; //$NON-NLS-1$
}
if (path != null && path.endsWith(".pom")) { //$NON-NLS-1$
type = "pom"; //$NON-NLS-1$
}
}
}
if (!NexusServerUtils.IGNORED_TYPES.contains(type)) {
return type;
}
return null;
return type;
}
private void fillCheckSumData(JSONArray assertsArray, MavenArtifact artifact) {

View File

@@ -123,17 +123,4 @@ public class ShareLibrariesUtil {
}
return sb.toString();
}
public static String getMavenClassifier(String path, String regex, String packageType) {
String classifier = null;
// javax/xml/bind/acxb-test/2.2.6/acxb-test-2.2.6-jdk10.dll
path = StringUtils.removeEnd(path, "." + packageType);
// javax/xml/bind/acxb-test/2.2.6/acxb-test-2.2.6-jdk10
path = StringUtils.substringAfter(path, regex);// -jdk10
path = StringUtils.stripStart(path, "-");// jdk10
if (StringUtils.isNotBlank(path)) {
classifier = path;
}
return classifier;
}
}

View File

@@ -18,16 +18,11 @@ import java.util.List;
import java.util.Set;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.InstanceScope;
import org.talend.commons.exception.ExceptionHandler;
import org.talend.commons.utils.network.NetworkUtil;
import org.talend.core.GlobalServiceRegister;
import org.talend.core.language.ECodeLanguage;
import org.talend.core.model.general.ModuleNeeded;
import org.talend.core.model.general.ModuleNeeded.ELibraryInstallStatus;
import org.talend.core.model.process.INode;
import org.talend.core.prefs.ITalendCorePrefConstants;
import org.talend.designer.core.IDesignerCoreService;
import org.talend.librariesmanager.model.ModulesNeededProvider;
@@ -113,15 +108,4 @@ public class LibrariesManagerUtils {
}
return updatedModules;
}
public static boolean shareLibsAtStartup() {
boolean ret = ITalendCorePrefConstants.NEXUS_SHARE_LIBS_DEFAULT;
try {
IEclipsePreferences node = InstanceScope.INSTANCE.getNode(NetworkUtil.ORG_TALEND_DESIGNER_CORE);
ret = node.getBoolean(ITalendCorePrefConstants.NEXUS_SHARE_LIBS, ITalendCorePrefConstants.NEXUS_SHARE_LIBS_DEFAULT);
} catch (Throwable e) {
ExceptionHandler.process(e);
}
return ret;
}
}

View File

@@ -15,8 +15,7 @@ Require-Bundle: org.eclipse.core.runtime,
org.talend.commons.runtime,
org.apache.commons.lang,
org.talend.core.repository,
org.talend.utils,
org.talend.core
org.talend.utils
Eclipse-LazyStart: true
Export-Package: org.talend.migrationtool.model
Eclipse-RegisterBuddy: org.talend.testutils

View File

@@ -64,7 +64,6 @@ import org.talend.core.repository.model.ProxyRepositoryFactory;
import org.talend.core.repository.utils.ProjectDataJsonProvider;
import org.talend.core.repository.utils.RoutineUtils;
import org.talend.core.repository.utils.URIHelper;
import org.talend.core.services.ICoreTisService;
import org.talend.designer.codegen.ICodeGeneratorService;
import org.talend.designer.codegen.ITalendSynchronizer;
import org.talend.migration.IMigrationTask;
@@ -418,19 +417,7 @@ public class MigrationToolService implements IMigrationToolService {
}
}
}
if (GlobalServiceRegister.getDefault().isServiceRegistered(ICoreTisService.class)) {
if (object.getProperty().eResource() == null) { // In case some
// migration task has
// unloaded.
object = repFactory.getSpecificVersion(object.getProperty().getId(),
object.getProperty().getVersion(), true);
}
if (object != null) {
ICoreTisService service = GlobalServiceRegister.getDefault()
.getService(ICoreTisService.class);
service.afterImport(object.getProperty());
}
}
if (object instanceof RepositoryObject) {
((RepositoryObject) object).unload();
}

View File

@@ -41,7 +41,6 @@ import org.osgi.service.prefs.BackingStoreException;
import org.osgi.service.prefs.Preferences;
import org.talend.commons.exception.BusinessException;
import org.talend.commons.runtime.helper.LocalComponentInstallHelper;
import org.talend.commons.exception.ExceptionHandler;
import org.talend.commons.runtime.helper.PatchComponentHelper;
import org.talend.commons.runtime.service.ComponentsInstallComponent;
import org.talend.commons.runtime.service.PatchComponent;
@@ -52,7 +51,6 @@ import org.talend.commons.utils.network.TalendProxySelector;
import org.talend.commons.utils.system.EclipseCommandLine;
import org.talend.core.BrandingChecker;
import org.talend.core.GlobalServiceRegister;
import org.talend.core.PluginChecker;
import org.talend.core.model.migration.IMigrationToolService;
import org.talend.core.model.utils.TalendPropertiesUtil;
import org.talend.core.repository.CoreRepositoryPlugin;
@@ -159,7 +157,49 @@ public class Application implements IApplication {
service.executeWorspaceTasks();
// saveConnectionBean(email);
boolean needRelaunch = installLocalPatches();
boolean needRelaunch = false;
final PatchComponent patchComponent = PatchComponentHelper.getPatchComponent();
if (patchComponent != null) {
final boolean installed = patchComponent.install();
if (installed) {
final String installedMessages = patchComponent.getInstalledMessages();
if (installedMessages != null) {
log.log(Level.INFO, installedMessages);
MessageDialog.openInformation(Display.getDefault().getActiveShell(), "Installing Patches",
installedMessages);
}
if (patchComponent.needRelaunch()) {
needRelaunch = true;
}
}
if (StringUtils.isNotEmpty(patchComponent.getFailureMessage())) {
log.log(Level.ERROR, patchComponent.getFailureMessage());
}
}
final ComponentsInstallComponent installComponent = LocalComponentInstallHelper.getComponent();
if (installComponent != null) {
try {
// install component silently
installComponent.setLogin(true);
if (installComponent.install()) {
final String installedMessages = installComponent.getInstalledMessages();
if (installedMessages != null) {
log.log(Level.INFO, installedMessages);
MessageDialog.openInformation(Display.getDefault().getActiveShell(), "Installing Components",
installedMessages);
}
if (installComponent.needRelaunch()) {
needRelaunch = true;
}
}
if (StringUtils.isNotEmpty(installComponent.getFailureMessage())) {
log.log(Level.ERROR, installComponent.getFailureMessage());
}
} finally {
installComponent.setLogin(false);
}
}
if (needRelaunch) {
setRelaunchData();
return IApplication.EXIT_RELAUNCH;
@@ -168,9 +208,6 @@ public class Application implements IApplication {
boolean logUserOnProject = logUserOnProject(display.getActiveShell());
if (LoginHelper.isRestart && LoginHelper.isAutoLogonFailed) {
setRelaunchData();
EclipseCommandLine.updateOrCreateExitDataPropertyWithCommand(EclipseCommandLine.CLEAN, null, true, true);
EclipseCommandLine.updateOrCreateExitDataPropertyWithCommand(EclipseCommandLine.TALEND_RELOAD_COMMAND,
Boolean.TRUE.toString(), true);
EclipseCommandLine.updateOrCreateExitDataPropertyWithCommand(
EclipseCommandLine.TALEND_PROJECT_TYPE_COMMAND, null, true);
return IApplication.EXIT_RELAUNCH;
@@ -268,99 +305,14 @@ public class Application implements IApplication {
}
private boolean installLocalPatches() {
try {
final boolean forceCheck = Boolean.getBoolean("talend.studio.localpatch.forcecheck");
if (!forceCheck) {
ICoreTisService tisService = ICoreTisService.get();
if (tisService != null) {
if (tisService.hasNewPatchInPatchesFolder()) {
if (!tisService.isDefaultLicenseAndProjectType()) {
EclipseCommandLine.updateOrCreateExitDataPropertyWithCommand(
EclipseCommandLine.TALEND_PROJECT_TYPE_COMMAND, "", true);
EclipseCommandLine.updateOrCreateExitDataPropertyWithCommand(
EclipseCommandLine.ARG_TALEND_LICENCE_PATH, "", true);
return true;
}
} else {
return false;
}
} else if (PluginChecker.isTIS()) {
ExceptionHandler.process(new Exception("Can't check patch in patches folder due to missing CoreTisService"));
return false;
} else {
// it's TOS here, just force to check it everytime.
}
}
} catch (Throwable e) {
log.error(e.getLocalizedMessage(), e);
}
boolean needRelaunch = false;
final PatchComponent patchComponent = PatchComponentHelper.getPatchComponent();
if (patchComponent != null) {
final boolean installed = patchComponent.install();
if (installed) {
final String installedMessages = patchComponent.getInstalledMessages();
if (installedMessages != null) {
log.log(Level.INFO, installedMessages);
MessageDialog.openInformation(Display.getDefault().getActiveShell(), "Installing Patches", installedMessages);
}
if (patchComponent.needRelaunch()) {
needRelaunch = true;
}
}
if (StringUtils.isNotEmpty(patchComponent.getFailureMessage())) {
log.log(Level.ERROR, patchComponent.getFailureMessage());
}
}
final ComponentsInstallComponent installComponent = LocalComponentInstallHelper.getComponent();
if (installComponent != null) {
try {
// install component silently
installComponent.setLogin(true);
if (installComponent.install()) {
final String installedMessages = installComponent.getInstalledMessages();
if (installedMessages != null) {
log.log(Level.INFO, installedMessages);
MessageDialog.openInformation(Display.getDefault().getActiveShell(), "Installing Components",
installedMessages);
}
if (installComponent.needRelaunch()) {
needRelaunch = true;
}
}
if (StringUtils.isNotEmpty(installComponent.getFailureMessage())) {
log.log(Level.ERROR, installComponent.getFailureMessage());
}
} finally {
installComponent.setLogin(false);
}
}
try {
ICoreTisService tisService = ICoreTisService.get();
if (tisService != null) {
tisService.refreshPatchesFolderCache();
}
} catch (Throwable e) {
log.error(e.getLocalizedMessage(), e);
}
return needRelaunch;
}
private void setRelaunchData() {
EclipseCommandLine.updateOrCreateExitDataPropertyWithCommand(EclipseCommandLine.CLEAN, null, false, true);
EclipseCommandLine.updateOrCreateExitDataPropertyWithCommand(EclipseCommandLine.TALEND_RELOAD_COMMAND,
Boolean.TRUE.toString(), false);
EclipseCommandLine.updateOrCreateExitDataPropertyWithCommand(EclipseCommandLine.ARG_TALEND_BUNDLES_CLEANED,
Boolean.FALSE.toString(), false);
EclipseCommandLine.updateOrCreateExitDataPropertyWithCommand(EclipseCommandLine.ARG_TALEND_BUNDLES_CLEANED,
Boolean.FALSE.toString(), true);
// if relaunch, should delete the "disableLoginDialog" argument in eclipse data for bug TDI-19214
EclipseCommandLine.updateOrCreateExitDataPropertyWithCommand(
EclipseCommandLine.TALEND_DISABLE_LOGINDIALOG_COMMAND, null, true, true);
EclipseCommandLine.TALEND_DISABLE_LOGINDIALOG_COMMAND, null, true);
}
/**

View File

@@ -10,9 +10,7 @@ Require-Bundle: org.eclipse.core.runtime,
org.talend.model,
org.talend.commons.runtime,
org.talend.core.runtime,
org.talend.core.repository,
org.talend.designer.maven,
org.talend.core
org.talend.core.repository
Bundle-Localization: plugin
Bundle-ActivationPolicy: lazy
Eclipse-RegisterBuddy: org.talend.testutils

View File

@@ -92,7 +92,6 @@ import org.talend.core.repository.utils.ProjectDataJsonProvider;
import org.talend.core.runtime.CoreRuntimePlugin;
import org.talend.core.runtime.services.IGenericDBService;
import org.talend.core.runtime.services.IGenericWizardService;
import org.talend.core.services.ICoreTisService;
import org.talend.core.utils.WorkspaceUtils;
import org.talend.designer.business.model.business.BusinessPackage;
import org.talend.designer.business.model.business.BusinessProcess;
@@ -1315,14 +1314,10 @@ public class ImportBasicHandler extends AbstractImportExecutableHandler {
IRepositoryViewObject object;
try {
Property property = importItem.getProperty();
if (property == null || property.eResource() == null) {
if (property == null) {
object = factory.getSpecificVersion(importItem.getItemId(), importItem.getItemVersion(), true);
property = object.getProperty();
}
if (GlobalServiceRegister.getDefault().isServiceRegistered(ICoreTisService.class)) {
ICoreTisService service = GlobalServiceRegister.getDefault().getService(ICoreTisService.class);
service.afterImport(property);
}
RelationshipItemBuilder.getInstance().addOrUpdateItem(property.getItem(), true);
// importItem.setProperty(null);
// factory.unloadResources(property);
@@ -1331,7 +1326,6 @@ public class ImportBasicHandler extends AbstractImportExecutableHandler {
}
}
protected IPath getReferenceItemPath(IPath importItemPath, ReferenceFileItem rfItem) {
return HandlerUtil.getReferenceItemPath(importItemPath, rfItem.getExtension());

View File

@@ -186,29 +186,4 @@ public class RelationshipItemBuilderTest {
assert (ProjectManager.getInstance().getCurrentProject() == RelationshipItemBuilder.getInstance().getAimProject());
}
/**
* For TUP-26138
*/
@Test
public void testBuildAndSaveIndex() {
Project currentProject = ProjectManager.getInstance().getCurrentProject();
int shouldBeSize = RelationshipItemBuilder.getInstance().getCurrentProjectItemsRelations().size();
currentProject = RelationshipItemBuilder.getInstance().getAimProject();
assert (shouldBeSize > 0);
System.out.println("testBuildAndSaveIndex, shouldBeSize: " + shouldBeSize);
// remove all of relations from index
RelationshipItemBuilder.getInstance().clearAllItemsRelations();
RelationshipItemBuilder.getInstance().saveRelations();
assert (currentProject.getEmfProject().getItemsRelations().size() == 0);
// regenerate index
RelationshipItemBuilder.getInstance().buildAndSaveIndex();
int currentSize = currentProject.getEmfProject().getItemsRelations().size();
assert (shouldBeSize == currentSize);
}
}

View File

@@ -1,32 +0,0 @@
package org.talend.librariesmanager.nexus.utils;
import org.junit.Assert;
import org.junit.Test;
public class ShareLibrariesUtilTest {
@Test
public void testGetMavenClassifier() {
String path = "javax/xml/bind/acxb-test/2.2.6/acxb-test-2.2.6-jdk10.dll";
String classifier = ShareLibrariesUtil.getMavenClassifier(path, "acxb-test-2.2.6", "dll");
Assert.assertEquals(classifier, "jdk10");
//
String path1 = "org/talend/libraries/aa/6.0.0-SNAPSHOT/aa-6.0.0-20201027.064528-1.dll";
String classifier1 = ShareLibrariesUtil.getMavenClassifier(path1, "aa-6.0.0-SNAPSHOT", "dll");
Assert.assertNull(classifier1);
String path2 = "org/talend/libraries/ldapjdk/6.0.0/ldapjdk-6.0.0-jdk9.dll";
String classifier2 = ShareLibrariesUtil.getMavenClassifier(path2, "ldapjdk-6.0.0", "dll");
Assert.assertEquals(classifier2, "jdk9");
//
String path3 = "org/talend/libraries/acxb-test-2.2.6-jdk8/6.0.0-SNAPSHOT/acxb-test-2.2.6-jdk8-6.0.0-20201103.062422-1.dll";
String classifier3 = ShareLibrariesUtil.getMavenClassifier(path3, "acxb-test-2.2.6-jdk8-6.0.0-SNAPSHOT", "dll");
Assert.assertNull(classifier3);
String path4 = "org/talend/libraries/acxb-test-2.2.6-jdk8/6.0.0-SNAPSHOT/acxb-test-2.2.6-jdk8-6.0.0-SNAPSHOT-jdk8.dll";
String classifier4 = ShareLibrariesUtil.getMavenClassifier(path4, "acxb-test-2.2.6-jdk8-6.0.0-SNAPSHOT", "dll");
Assert.assertEquals(classifier4, "jdk8");
}
}