Compare commits

..

3 Commits

10 changed files with 23 additions and 180 deletions

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

@@ -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

@@ -14,9 +14,11 @@ package org.talend.repository.ui.login.connections;
import java.util.Properties;
import org.talend.commons.ui.runtime.exception.ExceptionHandler;
import org.talend.daikon.crypto.EncodingUtils;
import org.talend.daikon.crypto.KeySources;
import org.talend.daikon.security.CryptoHelper;
/**
* DOC hwang class global comment. Detailled comment
*/
@@ -25,7 +27,16 @@ public class EncryptedProperties extends Properties {
private CryptoHelper crypto;
public EncryptedProperties() {
crypto = new CryptoHelper("Il faudrait trouver une passphrase plus originale que celle-ci!");
String key = System.getProperty("properties.encryption.key");
if (key == null) {
try {
byte[] byteKey = KeySources.file("properties.encryption.key").getKey();
key = new String(byteKey, EncodingUtils.ENCODING);
} catch (Exception ex) {
ExceptionHandler.process(ex);
}
}
crypto = new CryptoHelper(key);
}
public String getProperty(String key) {

View File

@@ -2589,21 +2589,7 @@ public class ProcessorUtilities {
}
public static boolean isEsbJob(String processId, String version) {
ProcessItem processItem = ItemCacheManager.getProcessItem(processId, version);
if (processItem != null && processItem.getProperty() != null && processItem.getProperty().getItem() != null) {
Set<JobInfo> infos = ProcessorUtilities.getChildrenJobInfo(processItem.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;
return esbJobs.contains(esbJobKey(processId, version));
}
private static void addEsbJob(JobInfo jobInfo) {
@@ -2642,4 +2628,5 @@ public class ProcessorUtilities {
public static boolean isNeedProjectProcessId(String componentName) {
return "tRunJob".equalsIgnoreCase(componentName) || "cTalendJob".equalsIgnoreCase(componentName);
}
}

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;
@@ -270,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)) {
@@ -286,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;
@@ -904,40 +901,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,23 +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();
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")) {
@@ -280,63 +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;
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;
}
}
for (Relation relation : relations) {
if (RelationshipItemBuilder.SERVICES_RELATION.equals(relation.getType())) {
return true;
}
} catch (PersistenceException e) {
ExceptionHandler.process(e);
}
return isDataServiceOperation;
}
public boolean isRouteOperation(Property property) {
List<IRepositoryViewObject> routeRepoList = null;
boolean isRouteOperation = false;
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

@@ -1042,9 +1042,6 @@ public class ExtractMetaDataUtils {
}
}else{
String jarName = librairesManagerService.getJarNameFromMavenuri(driverJarPathArg);
if (jarName == null) {
jarName = driverJarPathArg.split("/")[1] + ".jar";
}
if (!new File(getJavaLibPath() + jarName).exists()) {
librairesManagerService.retrieve(jarName, getJavaLibPath(), new NullProgressMonitor());
}

View File

@@ -454,18 +454,7 @@ public class ImportExportHandlersManager {
return 0;
}
});
Collections.sort(checkedItemRecords, new Comparator<ImportItem>() {
@Override
public int compare(ImportItem o1, ImportItem o2) {
if (o1.getRepositoryType().getType().equals("SERVICES")) {
return -1;
} else if (o2.getRepositoryType().getType().equals("SERVICES")) {
return 1;
}
return 0;
}
});
ImportCacheHelper importCacheHelper = ImportCacheHelper.getInstance();
try {
// cache