Compare commits

...

14 Commits

Author SHA1 Message Date
I.Melnik
a339116253 Revert "TESB-15339 [5.6.1] ctalendjob does not list the jobs in Mediation perspective."
This reverts commit 750a0e1574.
2015-07-31 06:33:54 -03:00
I.Melnik
750a0e1574 TESB-15339 [5.6.1] ctalendjob does not list the jobs in Mediation
perspective.
2015-06-02 13:00:02 +02:00
amarkevich
3f25d75a1c context variable at new line 2015-06-02 12:17:16 +03:00
amarkevich
07a98b105b TESB-15200 Config properies on ESB Conductor do not handle 2 byte
caracter context values
2015-06-02 12:16:48 +03:00
Wu Liu
7f14a4cf1b TDI-31393 : lookup in tMap will be executed the same times as
tPartitioner splits threads
2014-12-03 19:31:12 +08:00
nrousseau
04a7b6d2de TUP-2278: fix a problem of lost icon when the job was modified outside
of the process class.
2014-12-03 18:27:02 +08:00
rdubois
50fbbb6cb2 TBD-1329 fixed: Add the distribution in the virtual component 2014-12-03 18:20:26 +08:00
wchen-talend
a5a928e33f TUP-2452:ClassNotFoundException while using Product demo 2014-12-02 15:30:29 +08:00
hwang
2900b474e4 revert TDI-31258:Need some simple way to setup the jdbc needed for audit
in
2014-12-02 13:52:50 +08:00
hwang
d23810bab2 TDI-31361:Issues about URL for json wizard 2014-11-28 20:14:02 +08:00
hwang
77d0cf119d TDI-31361:Issues about URL for json wizard 2014-11-28 20:13:56 +08:00
wchen-talend
adfb6724cb TDI-31324:tSAPBapi doesn't support joblet 2014-11-28 20:08:06 +08:00
wchen-talend
f8f1aefc14 TDI-31324:tSAPBapi doesn't support joblet 2014-11-28 20:07:52 +08:00
Sebastien Gandon
f49fa77655 TDI-31358 : made TOS switch workspace work and persists the last cexecuted workspace 2014-11-28 12:21:35 +01:00
14 changed files with 261 additions and 144 deletions

View File

@@ -95,10 +95,10 @@
boolean isAllRows = "ALL_ROWS".equals(matchingModeStr); boolean isAllRows = "ALL_ROWS".equals(matchingModeStr);
boolean includeParallelComps = false; boolean includeParallelComps = false;
List<? extends INode> listPartitions= node.getProcess().getNodesOfType("tPartitioner"); INode collectorNode = validTarget.getDesignSubjobStartNode();
if (listPartitions!=null && listPartitions.size() > 0 ) { if ("tCollector".equals(collectorNode.getComponent().getName())) {
includeParallelComps = true; includeParallelComps = true;
} }
%> %>
org.talend.designer.components.lookup.common.ICommonLookup.MATCHING_MODE matchingModeEnum_<%=connectionName%> = org.talend.designer.components.lookup.common.ICommonLookup.MATCHING_MODE matchingModeEnum_<%=connectionName%> =
org.talend.designer.components.lookup.common.ICommonLookup.MATCHING_MODE.<%= matchingModeStr %>; org.talend.designer.components.lookup.common.ICommonLookup.MATCHING_MODE.<%= matchingModeStr %>;

View File

@@ -5,6 +5,7 @@
org.talend.designer.codegen.config.CodeGeneratorArgument org.talend.designer.codegen.config.CodeGeneratorArgument
org.talend.core.model.process.ElementParameterParser org.talend.core.model.process.ElementParameterParser
java.util.List java.util.List
org.talend.core.model.process.EConnectionType
org.talend.core.model.process.IHashableInputConnections org.talend.core.model.process.IHashableInputConnections
org.talend.core.model.process.IHashConfiguration org.talend.core.model.process.IHashConfiguration
org.talend.core.model.process.IDataConnection org.talend.core.model.process.IDataConnection
@@ -49,12 +50,12 @@
} }
} }
memoryStorage = !(hashConfiguration != null && hashConfiguration.isPersistent() || bSortOnDisk); memoryStorage = !(hashConfiguration != null && hashConfiguration.isPersistent() || bSortOnDisk);
}
boolean includeParallelComps = false; boolean includeParallelComps = false;
List<? extends INode> listPartitions= node.getProcess().getNodesOfType("tPartitioner"); INode partitionNode = validTarget.getDesignSubjobStartNode();
if (listPartitions!=null && listPartitions.size() > 0 ) { if ("tCollector".equals(partitionNode.getComponent().getName())) {
includeParallelComps = true; includeParallelComps = true;
partitionNode = partitionNode.getIncomingConnections(EConnectionType.STARTS).get(0).getSource();
} }
%> %>
tHash_Lookup_<%=connectionName%>.endPut(); tHash_Lookup_<%=connectionName%>.endPut();
@@ -62,7 +63,7 @@ tHash_Lookup_<%=connectionName%>.endPut();
if (includeParallelComps && memoryStorage && !isOneOfReloadLookupMode) { if (includeParallelComps && memoryStorage && !isOneOfReloadLookupMode) {
%> %>
java.util.List<java.util.concurrent.ConcurrentHashMap<String,Object>> mapsList_<%=cid%> = java.util.List<java.util.concurrent.ConcurrentHashMap<String,Object>> mapsList_<%=cid%> =
(java.util.List<java.util.concurrent.ConcurrentHashMap<String,Object>>)globalMap.get("THREAD_MAPS_"+jobName); (java.util.List<java.util.concurrent.ConcurrentHashMap<String,Object>>)globalMap.get("THREAD_MAPS_<%=partitionNode.getUniqueName()%>_"+jobName);
if (mapsList_<%=cid%> != null) { if (mapsList_<%=cid%> != null) {
@@ -101,6 +102,8 @@ java.util.List<java.util.concurrent.ConcurrentHashMap<String,Object>> mapsList_<
<% <%
} }
}
} }
} }
%> %>

View File

@@ -87,6 +87,9 @@
REPOSITORY_VALUE="SID" REQUIRED="true"> REPOSITORY_VALUE="SID" REQUIRED="true">
<DEFAULT>""</DEFAULT> <DEFAULT>""</DEFAULT>
</PARAMETER> </PARAMETER>
<PARAMETER NAME="DISTRIBUTION" FIELD="TEXT" NUM_ROW="14">
<DEFAULT>""</DEFAULT>
</PARAMETER>
</PARAMETERS> </PARAMETERS>
<ADVANCED_PARAMETERS> <ADVANCED_PARAMETERS>
@@ -125,35 +128,36 @@
<CODEGENERATION> <CODEGENERATION>
<IMPORTS> <IMPORTS>
<!-- MICROSOFT HD INSIGHT 3.1 --> <!-- MICROSOFT HD INSIGHT 3.1 -->
<IMPORT NAME="talend-webhcat-launcher-1.0.0" MODULE="talend-webhcat-launcher-1.0.0.jar" <IMPORT NAME="talend-webhcat-launcher-1.0.0" MODULE="talend-webhcat-launcher-1.0.0.jar"
REQUIRED_IF="USE_EXISTING_CONNECTION=='false'" /> REQUIRED_IF="(USE_EXISTING_CONNECTION=='false') AND (DISTRIBUTION=='MICROSOFT_HD_INSIGHT')" />
<IMPORT NAME="cxf-api-2.7.7" MODULE="cxf-api-2.7.7.jar" <IMPORT NAME="cxf-api-2.7.7" MODULE="cxf-api-2.7.7.jar"
UrlPath="platform:/plugin/org.talend.libraries.apache.cxf/lib/cxf-api-2.7.7.jar" UrlPath="platform:/plugin/org.talend.libraries.apache.cxf/lib/cxf-api-2.7.7.jar"
REQUIRED_IF="USE_EXISTING_CONNECTION=='false'" /> REQUIRED_IF="(USE_EXISTING_CONNECTION=='false') AND (DISTRIBUTION=='MICROSOFT_HD_INSIGHT')" />
<IMPORT NAME="cxf-rt-bindings-xml-2.7.7" MODULE="cxf-rt-bindings-xml-2.7.7.jar" <IMPORT NAME="cxf-rt-bindings-xml-2.7.7" MODULE="cxf-rt-bindings-xml-2.7.7.jar"
UrlPath="platform:/plugin/org.talend.libraries.apache.cxf/lib/cxf-rt-bindings-xml-2.7.7.jar" UrlPath="platform:/plugin/org.talend.libraries.apache.cxf/lib/cxf-rt-bindings-xml-2.7.7.jar"
REQUIRED_IF="USE_EXISTING_CONNECTION=='false'" /> REQUIRED_IF="(USE_EXISTING_CONNECTION=='false') AND (DISTRIBUTION=='MICROSOFT_HD_INSIGHT')" />
<IMPORT NAME="cxf-rt-core-2.7.7" MODULE="cxf-rt-core-2.7.7.jar" <IMPORT NAME="cxf-rt-core-2.7.7" MODULE="cxf-rt-core-2.7.7.jar"
UrlPath="platform:/plugin/org.talend.libraries.apache.cxf/lib/cxf-rt-core-2.7.7.jar" UrlPath="platform:/plugin/org.talend.libraries.apache.cxf/lib/cxf-rt-core-2.7.7.jar"
REQUIRED_IF="USE_EXISTING_CONNECTION=='false'" /> REQUIRED_IF="(USE_EXISTING_CONNECTION=='false') AND (DISTRIBUTION=='MICROSOFT_HD_INSIGHT')" />
<IMPORT NAME="cxf-rt-frontend-jaxrs-2.7.7" MODULE="cxf-rt-frontend-jaxrs-2.7.7.jar" <IMPORT NAME="cxf-rt-frontend-jaxrs-2.7.7" MODULE="cxf-rt-frontend-jaxrs-2.7.7.jar"
UrlPath="platform:/plugin/org.talend.libraries.apache.cxf/lib/cxf-rt-frontend-jaxrs-2.7.7.jar" UrlPath="platform:/plugin/org.talend.libraries.apache.cxf/lib/cxf-rt-frontend-jaxrs-2.7.7.jar"
REQUIRED_IF="USE_EXISTING_CONNECTION=='false'" /> REQUIRED_IF="(USE_EXISTING_CONNECTION=='false') AND (DISTRIBUTION=='MICROSOFT_HD_INSIGHT')" />
<IMPORT NAME="cxf-rt-transports-http-2.7.7" MODULE="cxf-rt-transports-http-2.7.7.jar" <IMPORT NAME="cxf-rt-transports-http-2.7.7" MODULE="cxf-rt-transports-http-2.7.7.jar"
UrlPath="platform:/plugin/org.talend.libraries.apache.cxf/lib/cxf-rt-transports-http-2.7.7.jar" UrlPath="platform:/plugin/org.talend.libraries.apache.cxf/lib/cxf-rt-transports-http-2.7.7.jar"
REQUIRED_IF="USE_EXISTING_CONNECTION=='false'" /> REQUIRED_IF="(USE_EXISTING_CONNECTION=='false') AND (DISTRIBUTION=='MICROSOFT_HD_INSIGHT')" />
<IMPORT NAME="json-simple" MODULE="json_simple-1.1.jar" <IMPORT NAME="json-simple" MODULE="json_simple-1.1.jar"
UrlPath="platform:/plugin/org.talend.libraries.jackson/lib/json_simple-1.1.jar" UrlPath="platform:/plugin/org.talend.libraries.jackson/lib/json_simple-1.1.jar"
REQUIRED_IF="USE_EXISTING_CONNECTION=='false'" /> REQUIRED_IF="(USE_EXISTING_CONNECTION=='false') AND (DISTRIBUTION=='MICROSOFT_HD_INSIGHT')" />
<IMPORT NAME="javax.ws.rs-api-2.0-m10" MODULE="javax.ws.rs-api-2.0-m10.jar" <IMPORT NAME="javax.ws.rs-api-2.0-m10" MODULE="javax.ws.rs-api-2.0-m10.jar"
REQUIRED_IF="USE_EXISTING_CONNECTION=='false'" /> REQUIRED_IF="(USE_EXISTING_CONNECTION=='false') AND (DISTRIBUTION=='MICROSOFT_HD_INSIGHT')" />
<IMPORT NAME="WSDL4J-1_6_2" MODULE="wsdl4j-1.6.2.jar" <IMPORT NAME="WSDL4J-1_6_2" MODULE="wsdl4j-1.6.2.jar"
BundleID="org.apache.servicemix.bundles.wsdl4j" REQUIRED="true" /> BundleID="org.apache.servicemix.bundles.wsdl4j" REQUIRED="false"
<IMPORT NAME="azure-storage-1.2.0" MODULE="azure-storage-1.2.0.jar" REQUIRED_IF="(USE_EXISTING_CONNECTION=='false') AND (DISTRIBUTION=='MICROSOFT_HD_INSIGHT')" />
REQUIRED_IF="USE_EXISTING_CONNECTION=='false'" /> <IMPORT NAME="azure-storage-1.2.0" MODULE="azure-storage-1.2.0.jar"
REQUIRED_IF="(USE_EXISTING_CONNECTION=='false') AND (DISTRIBUTION=='MICROSOFT_HD_INSIGHT')" />
<!-- #################### --> <!-- #################### -->
</IMPORTS> </IMPORTS>
</CODEGENERATION> </CODEGENERATION>
<RETURNS /> <RETURNS />
</COMPONENT> </COMPONENT>

View File

@@ -642,13 +642,6 @@
uripath="platform:/plugin/org.talend.libraries.hadoop.hdp.2.0/lib/datanucleus-rdbms-3.2.1.jar"> uripath="platform:/plugin/org.talend.libraries.hadoop.hdp.2.0/lib/datanucleus-rdbms-3.2.1.jar">
</libraryNeeded> </libraryNeeded>
<libraryNeeded
context="plugin:org.talend.libraries.jdbc.h2"
id="h2-1.3.160.jar"
name="h2-1.3.160.jar"
uripath="platform:/plugin/org.talend.libraries.jdbc.h2/lib/h2-1.3.160.jar">
</libraryNeeded>
<libraryNeeded <libraryNeeded
context="plugin:org.talend.libraries.jdbc.derby" context="plugin:org.talend.libraries.jdbc.derby"
id="derby-10.4.2.0.jar" id="derby-10.4.2.0.jar"

View File

@@ -880,7 +880,9 @@ public class DataProcess implements IGeneratingProcess {
} }
// propagate metadataLists for output component. only apply to multi-input virtual component // propagate metadataLists for output component. only apply to multi-input virtual component
if (multipleComponentManager.isSetConnector() && multipleComponentManager.getOutputName().equals(curItem.getName())) { boolean isSAPBapi = graphicalNode.getComponent() != null && "tSAPBapi".equals(graphicalNode.getComponent().getName());//$NON-NLS-1$
if (multipleComponentManager.isSetConnector()
&& (multipleComponentManager.getOutputName().equals(curItem.getName()) || isSAPBapi)) {
// deactivate dummy component // deactivate dummy component
if (curNode.getComponentName().equals("tDummyRow")) {// or use //$NON-NLS-1$ if (curNode.getComponentName().equals("tDummyRow")) {// or use //$NON-NLS-1$
// "!multipleComponentManager.existsLinkTo()" // "!multipleComponentManager.existsLinkTo()"
@@ -2546,10 +2548,11 @@ public class DataProcess implements IGeneratingProcess {
} }
} }
for (IConnection connection : node.getOutgoingConnections()) { for (IConnection connection : node.getOutgoingConnections()) {
if(connection.getLineStyle() == EConnectionType.ON_SUBJOB_OK || connection.getLineStyle() == EConnectionType.ON_SUBJOB_ERROR) { if (connection.getLineStyle() == EConnectionType.ON_SUBJOB_OK
|| connection.getLineStyle() == EConnectionType.ON_SUBJOB_ERROR) {
continue; continue;
} }
if (connection.isActivate()) { if (connection.isActivate()) {
if (!hasSingleMergeComponent(connection.getTarget(), checkedNodes, mergeFound || merge)) { if (!hasSingleMergeComponent(connection.getTarget(), checkedNodes, mergeFound || merge)) {
return false; return false;

View File

@@ -182,6 +182,11 @@ import org.talend.repository.ui.utils.Log4jPrefsSettingManager;
*/ */
public class Process extends Element implements IProcess2, IGEFProcess, ILastVersionChecker { public class Process extends Element implements IProcess2, IGEFProcess, ILastVersionChecker {
/**
*
*/
private static final String PROCESS_SCREENSHOT_KEY = "process"; //$NON-NLS-1$
protected List<INode> nodes = new ArrayList<INode>(); protected List<INode> nodes = new ArrayList<INode>();
protected List<Element> elem = new ArrayList<Element>(); protected List<Element> elem = new ArrayList<Element>();
@@ -1364,7 +1369,22 @@ public class Process extends Element implements IProcess2, IGEFProcess, ILastVer
*/ */
processType.setDefaultContext(contextManager.getDefaultContext().getName()); processType.setDefaultContext(contextManager.getDefaultContext().getName());
if (getScreenshot() != null) { if (getScreenshot() != null) {
processType.getScreenshots().put("process", getScreenshot()); processType.getScreenshots().put(PROCESS_SCREENSHOT_KEY, getScreenshot());
// fix a bug (TUP-2278) of synch between inner process item and newly created process item during save, this
// is very dirty but inherent to the current archi.
// copy all the screenshot items appart from the "process" one that is already handled here.
if (property != null && (property.getItem() != null) && (property.getItem() instanceof ProcessItem)) {
ProcessItem pi = (ProcessItem) property.getItem();
ProcessType pt = pi.getProcess();
if (pt != null) {
EMap delegateScreenshots = pt.getScreenshots();
for (Object objkey : delegateScreenshots.keySet()) {
if (!PROCESS_SCREENSHOT_KEY.equals(objkey)) {
processType.getScreenshots().put(objkey, delegateScreenshots.get(objkey));
}// else keep looking
}
}// else no process available so ignor
}// else not a type we can handle so ignor
} }
setScreenshot(null); // once be saved, set the screenshot to null to free memory setScreenshot(null); // once be saved, set the screenshot to null to free memory
contextManager.saveToEmf(processType.getContext()); contextManager.saveToEmf(processType.getContext());

View File

@@ -319,6 +319,13 @@ public class ConnectionListController extends AbstractElementPropertySectionCont
return; return;
} }
} }
if (elem instanceof INode) {
INode node = (INode) elem;
if (node.getComponent() != null && "tSAPBapi".equals(node.getComponent().getName())) {
// not changed
return;
}
}
if (connectionName.equals(oldConnectionName)) { if (connectionName.equals(oldConnectionName)) {
curLine.put(param.getName(), newConnectionName); curLine.put(param.getName(), newConnectionName);
} }

View File

@@ -12,13 +12,22 @@
// ============================================================================ // ============================================================================
package org.talend.designer.publish.core.models; package org.talend.designer.publish.core.models;
import java.io.StringWriter;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.Map; import java.util.Map;
import org.apache.commons.lang.StringEscapeUtils; import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
public class FeaturesModel extends BaseModel { public class FeaturesModel extends BaseModel {
@@ -34,7 +43,7 @@ public class FeaturesModel extends BaseModel {
private String configName; private String configName;
private Collection<String> subFeatures = new HashSet<String>(); private Collection<FeatureModel> subFeatures = new HashSet<FeatureModel>();
private Collection<BundleModel> subBundles = new HashSet<BundleModel>(); private Collection<BundleModel> subBundles = new HashSet<BundleModel>();
@@ -51,13 +60,7 @@ public class FeaturesModel extends BaseModel {
} }
public void addFeature(FeatureModel feature) { public void addFeature(FeatureModel feature) {
StringBuilder sb = new StringBuilder(); subFeatures.add(feature);
sb.append("<feature version='");
sb.append(feature.getVersion());
sb.append("\'>");
sb.append(feature.getArtifactId());
sb.append("</feature>");
subFeatures.add(sb.toString());
} }
public boolean addBundle(BundleModel model) { public boolean addBundle(BundleModel model) {
@@ -90,87 +93,100 @@ public class FeaturesModel extends BaseModel {
} }
private static String toBundleString(BundleModel model) { private static String toBundleString(BundleModel model) {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder("mvn:");
sb.append("<bundle>mvn:");
sb.append(model.getGroupId()); sb.append(model.getGroupId());
sb.append('/'); sb.append('/');
sb.append(model.getArtifactId()); sb.append(model.getArtifactId());
sb.append('/'); sb.append('/');
sb.append(model.getVersion()); sb.append(model.getVersion());
sb.append("</bundle>");
return sb.toString(); return sb.toString();
} }
public String getContent() { public String getContent() {
StringBuilder sb = new StringBuilder("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"); try {
sb.append("<features name=\"").append(getArtifactId()).append("\" xmlns=\"http://karaf.apache.org/xmlns/features/v1.0.0\">\n"); return internalGetContent();
sb.append("\t<feature name=\""); } catch (Exception e) {
sb.append(getArtifactId()); throw new RuntimeException(e);
sb.append("\" version=\""); }
sb.append(getVersion()); }
sb.append("\">\n");
// add sub features
for (String s : subFeatures) {
sb.append("\t\t");
sb.append(s);
sb.append("\n");
}
// add sub bundles private String internalGetContent() throws Exception {
for (BundleModel s : subBundles) { Document document = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
sb.append("\t\t");
sb.append(toBundleString(s));
sb.append("\n");
}
if (null == contexts || contexts.isEmpty()) { Element features = document.createElement("features");
// add config features.setAttribute("xmlns", "http://karaf.apache.org/xmlns/features/v1.0.0");
sb.append("\t\t<config name=\""); features.setAttribute("name", getArtifactId());
sb.append(configName); document.appendChild(features);
sb.append("\">\n");
sb.append("\t\t\ttalendcontext=\"");
for (int i = 0; i < contextList.length; i++) {
if (i != 0) {
sb.append(',');
}
sb.append(StringEscapeUtils.escapeXml(contextList[i]));
}
sb.append("\"\n");
sb.append("\t\t</config>\n");
} else {
// add contexts config
for (Map.Entry<String, Map<String, String>> context : contexts.entrySet()) {
sb.append("\t\t<config name=\"");
sb.append(name).append(".talendcontext.").append(StringEscapeUtils.escapeXml(context.getKey()));
sb.append("\">\n");
for (Map.Entry<String, String> property : context.getValue().entrySet()) {
sb.append("\t\t\t");
sb.append(StringEscapeUtils.escapeXml(property.getKey()));
sb.append('=');
sb.append(StringEscapeUtils.escapeXml(property.getValue()));
sb.append("\n");
}
sb.append("\t\t</config>\n");
}
}
sb.append("\t</feature>\n");
sb.append("</features>");
return sb.toString(); Element feature = document.createElement("feature");
feature.setAttribute("name", getArtifactId());
feature.setAttribute("version", getVersion());
features.appendChild(feature);
// add sub features
for (FeatureModel fm : subFeatures) {
Element subFeature = document.createElement("feature");
if (null != fm.getVersion() && !fm.getVersion().isEmpty()) {
subFeature.setAttribute("version", fm.getVersion());
}
subFeature.appendChild(document.createTextNode(fm.getArtifactId()));
feature.appendChild(subFeature);
}
// add sub bundles
for (BundleModel bm : subBundles) {
Element bundle = document.createElement("bundle");
bundle.appendChild(document.createTextNode(toBundleString(bm)));
feature.appendChild(bundle);
}
if (null == contexts || contexts.isEmpty()) {
// add config
Element config = document.createElement("config");
config.setAttribute("name", configName);
StringBuilder sb = new StringBuilder("talendcontext=\"");
for (int i = 0; i < contextList.length; i++) {
if (i != 0) {
sb.append(',');
}
sb.append(contextList[i]);
}
sb.append('"');
config.appendChild(document.createTextNode(sb.toString()));
feature.appendChild(config);
} else {
// add contexts config
for (Map.Entry<String, Map<String, String>> context : contexts.entrySet()) {
Element config = document.createElement("config");
config.setAttribute("name", name +".talendcontext."+ context.getKey());
StringBuilder sb = new StringBuilder("\n");
for (Map.Entry<String, String> property : context.getValue().entrySet()) {
sb.append(property.getKey());
sb.append('=');
sb.append(property.getValue());
sb.append('\n');
}
config.appendChild(document.createTextNode(sb.toString()));
feature.appendChild(config);
}
}
Transformer transformer = TransformerFactory.newInstance().newTransformer();
DOMSource source = new DOMSource(document);
StringWriter writer = new StringWriter();
StreamResult result = new StreamResult(writer);
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
transformer.transform(source, result);
return writer.toString();
} }
// public static void main(String[] args) { // public static void main(String[] args) {
// FeaturesModel featureModel = new FeaturesModel("aaa", // FeaturesModel featureModel = new FeaturesModel("aaa", "CustomService", "1.0.0");
// "CustomService", "1.0.0"); // featureModel.addBundle(new BundleModel("talend", "job-control-bundle", "1.0"));
// featureModel.addBundle(new BundleModel("talend", "job-control-bundle", "1.0")); // featureModel.addBundle(new BundleModel("talend", "ProviderJob", "1.0"));
// featureModel.addBundle(new BundleModel("talend", "ProviderJob", "1.0")); // featureModel.addBundle(new BundleModel("talend", "ESBProvider2", "1.0"));
// featureModel.addBundle(new BundleModel("talend", "ESBProvider2", "1.0")); // featureModel.addFeature(new FeatureModel("custom-feature", "2.0"));
// featureModel.addFeature(new FeatureModel("custom-feature", "2.0")); // featureModel.setContexts(java.util.Collections.singletonMap("name", java.util.Collections.singletonMap("key", "開始")));
// featureModel.setConfigName("aa.bb"); // System.out.println(featureModel.getContent());
// featureModel // }
// .setContextList(new String[] { "Default", "Product", "Dev" });
// System.out.println(featureModel.getContent());
// }
} }

View File

@@ -87,7 +87,12 @@ public class JSONDragAndDropHandler extends AbstractDragAndDropServiceHandler {
return connection.getJSONFilePath(); return connection.getJSONFilePath();
} else { } else {
Path p = new Path(connection.getJSONFilePath()); Path p = new Path(connection.getJSONFilePath());
return TalendQuoteUtils.addQuotes(p.toPortableString()); if (p.toFile().isFile()) {
return TalendQuoteUtils.addQuotes(p.toPortableString());
} else {
return TalendQuoteUtils.addQuotes(p.toString());
}
} }
} }
if (value.equals("OUT_FILE_PATH")) { if (value.equals("OUT_FILE_PATH")) {
@@ -98,7 +103,12 @@ public class JSONDragAndDropHandler extends AbstractDragAndDropServiceHandler {
return connection.getOutputFilePath(); return connection.getOutputFilePath();
} else { } else {
Path p = new Path(connection.getOutputFilePath()); Path p = new Path(connection.getOutputFilePath());
return TalendQuoteUtils.addQuotes(p.toPortableString()); if (p.toFile().isFile()) {
return TalendQuoteUtils.addQuotes(p.toPortableString());
} else {
return TalendQuoteUtils.addQuotes(p.toString());
}
} }
} }
if (value.equals("LIMIT")) { //$NON-NLS-1$ if (value.equals("LIMIT")) { //$NON-NLS-1$

View File

@@ -358,7 +358,12 @@ public class JSONFileOutputStep1Form extends AbstractJSONFileStepForm {
} else { } else {
xsdPathChanged = false; xsdPathChanged = false;
} }
getConnection().setJSONFilePath(PathUtils.getPortablePath(jsonFilePath.getText())); if (Path.fromOSString(jsonFilePath.getText()).toFile().isFile()) {
getConnection().setJSONFilePath(PathUtils.getPortablePath(jsonFilePath.getText()));
} else {
getConnection().setJSONFilePath(jsonFilePath.getText());
}
// updateConnection(text); // updateConnection(text);
StringBuilder fileContent = new StringBuilder(); StringBuilder fileContent = new StringBuilder();

View File

@@ -33,6 +33,7 @@ import org.apache.oro.text.regex.Perl5Compiler;
import org.apache.oro.text.regex.Perl5Matcher; import org.apache.oro.text.regex.Perl5Matcher;
import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
import org.eclipse.swt.SWT; import org.eclipse.swt.SWT;
import org.eclipse.swt.events.FocusEvent; import org.eclipse.swt.events.FocusEvent;
import org.eclipse.swt.events.FocusListener; import org.eclipse.swt.events.FocusListener;
@@ -171,8 +172,8 @@ public class JSONFileStep1Form extends AbstractJSONFileStepForm {
jsonFilePath = TalendQuoteUtils.removeQuotes(ConnectionContextHelper.getOriginalValue(contextType, jsonFilePath = TalendQuoteUtils.removeQuotes(ConnectionContextHelper.getOriginalValue(contextType,
fileFieldJSON.getText())); fileFieldJSON.getText()));
} }
if (!new File(jsonFilePath).exists() && getConnection().getFileContent() != null File file = new File(jsonFilePath);
&& getConnection().getFileContent().length > 0) { if (!file.exists() && getConnection().getFileContent() != null && getConnection().getFileContent().length > 0) {
initFileContent(); initFileContent();
jsonFilePath = tempJSONXsdPath; jsonFilePath = tempJSONXsdPath;
} }
@@ -447,6 +448,11 @@ public class JSONFileStep1Form extends AbstractJSONFileStepForm {
} }
// getConnection().setJSONFilePath(PathUtils.getPortablePath(JSONXsdFilePath.getText())); // getConnection().setJSONFilePath(PathUtils.getPortablePath(JSONXsdFilePath.getText()));
File file = new File(text); File file = new File(text);
if (file.isDirectory()) {
valid = false;
checkFieldsValue();
return;
}
// if (file.exists()) { // if (file.exists()) {
// if (file.exists()) { // if (file.exists()) {
String tempxml = JSONUtil.changeJsonToXml(text); String tempxml = JSONUtil.changeJsonToXml(text);
@@ -472,7 +478,11 @@ public class JSONFileStep1Form extends AbstractJSONFileStepForm {
} else { } else {
xsdPathChanged = false; xsdPathChanged = false;
} }
getConnection().setJSONFilePath(PathUtils.getPortablePath(jsonPath)); if (Path.fromOSString(jsonPath).toFile().isFile()) {
getConnection().setJSONFilePath(PathUtils.getPortablePath(jsonPath));
} else {
getConnection().setJSONFilePath(jsonPath);
}
JSONWizard wizard = ((JSONWizard) getPage().getWizard()); JSONWizard wizard = ((JSONWizard) getPage().getWizard());
wizard.setTreeRootNode(treeNode); wizard.setTreeRootNode(treeNode);
@@ -604,6 +614,12 @@ public class JSONFileStep1Form extends AbstractJSONFileStepForm {
updateStatus(IStatus.ERROR, ""); //$NON-NLS-1$ updateStatus(IStatus.ERROR, ""); //$NON-NLS-1$
return false; return false;
} }
File file = new File(jsonFilePathText);
if (file.isFile() && !file.exists()) {
valid = false;
} else if (file.isDirectory()) {
valid = false;
}
if (!valid) { if (!valid) {
if (isContextMode()) { if (isContextMode()) {
ContextType contextType = ConnectionContextHelper.getContextTypeForContextMode(connectionItem.getConnection()); ContextType contextType = ConnectionContextHelper.getContextTypeForContextMode(connectionItem.getConnection());

View File

@@ -19,6 +19,7 @@ import java.io.FileNotFoundException;
import java.io.FileWriter; import java.io.FileWriter;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL; import java.net.URL;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
@@ -133,18 +134,37 @@ public class JSONUtil {
java.io.ByteArrayOutputStream outStream = new java.io.ByteArrayOutputStream(); java.io.ByteArrayOutputStream outStream = new java.io.ByteArrayOutputStream();
InputStream inStream = null; InputStream inStream = null;
File file = new File(jsonPath); File file = new File(jsonPath);
// String filename = file.getName().replaceAll("\\.", "_"); // String filename = file.getName().replaceAll("\\.", "_");
// filename = "tempTest"; // filename = "tempTest";
boolean isFromUrl = false; boolean isFromUrl = false;
try { boolean illegalURL = false;
InputStream input = null; InputStream input = null;
if (file.exists()) {
input = new FileInputStream(file);
} else { if (file.exists()) {
isFromUrl = true; if (file.isDirectory()) {
input = new URL(jsonPath).openStream(); return "";
} }
try {
input = new FileInputStream(file);
} catch (FileNotFoundException e) {
ExceptionHandler.process(e);
}
} else {
isFromUrl = true;
try {
input = new URL(jsonPath).openStream();
} catch (MalformedURLException e) {
illegalURL = true;
} catch (IOException e) {
illegalURL = true;
}
if (illegalURL) {
return "";
}
}
try {
String jsonStr = IOUtils.toString(input); String jsonStr = IOUtils.toString(input);
convertJSON.setJsonString(jsonStr); convertJSON.setJsonString(jsonStr);
@@ -172,10 +192,6 @@ public class JSONUtil {
if (isFromUrl) { if (isFromUrl) {
tempJSONXsdPath = temPath; tempJSONXsdPath = temPath;
} }
} catch (FileNotFoundException e1) {
ExceptionHandler.process(e1);
} catch (IOException e1) {
ExceptionHandler.process(e1);
} catch (java.lang.Exception e) { } catch (java.lang.Exception e) {
ExceptionHandler.process(e); ExceptionHandler.process(e);
} finally { } finally {

View File

@@ -60,6 +60,7 @@ import org.talend.commons.exception.BusinessException;
import org.talend.commons.exception.PersistenceException; import org.talend.commons.exception.PersistenceException;
import org.talend.commons.ui.runtime.exception.ExceptionHandler; import org.talend.commons.ui.runtime.exception.ExceptionHandler;
import org.talend.commons.ui.runtime.image.ImageProvider; import org.talend.commons.ui.runtime.image.ImageProvider;
import org.talend.commons.utils.system.EclipseCommandLine;
import org.talend.commons.utils.system.EnvironmentUtils; import org.talend.commons.utils.system.EnvironmentUtils;
import org.talend.core.CorePlugin; import org.talend.core.CorePlugin;
import org.talend.core.GlobalServiceRegister; import org.talend.core.GlobalServiceRegister;
@@ -67,6 +68,7 @@ import org.talend.core.model.general.ConnectionBean;
import org.talend.core.model.general.Project; import org.talend.core.model.general.Project;
import org.talend.core.repository.model.ProxyRepositoryFactory; import org.talend.core.repository.model.ProxyRepositoryFactory;
import org.talend.core.ui.branding.IBrandingService; import org.talend.core.ui.branding.IBrandingService;
import org.talend.core.ui.workspace.ChooseWorkspaceData;
import org.talend.repository.i18n.Messages; import org.talend.repository.i18n.Messages;
import org.talend.repository.ui.ERepositoryImages; import org.talend.repository.ui.ERepositoryImages;
import org.talend.repository.ui.actions.importproject.ImportDemoProjectAction; import org.talend.repository.ui.actions.importproject.ImportDemoProjectAction;
@@ -690,7 +692,15 @@ public class TOSLoginComposite extends Composite {
@Override @Override
public void widgetSelected(SelectionEvent e) { public void widgetSelected(SelectionEvent e) {
LoginComposite.isRestart = true; LoginComposite.isRestart = true;
perReader.saveLastConnectionBean(loginComposite.getConnection()); ConnectionBean connection = loginComposite.getConnection();
perReader.saveLastConnectionBean(connection);
// update the restart command line to specify the workspace to launch
// if relaunch, should delete the "disableLoginDialog" argument in eclipse data for bug TDI-19214
EclipseCommandLine.updateOrCreateExitDataPropertyWithCommand("-data", connection.getWorkSpace(), false); //$NON-NLS-1$
// store the workspace in the eclipse history so that it is rememebered on next studio launch
ChooseWorkspaceData workspaceData = new ChooseWorkspaceData(""); //$NON-NLS-1$
workspaceData.workspaceSelected(connection.getWorkSpace());
workspaceData.writePersistedData();
dialog.okPressed(); dialog.okPressed();
} }
}); });

View File

@@ -201,6 +201,7 @@ public class JavaJobExportReArchieveCreator {
if (libFolder != null) { if (libFolder != null) {
File[] files = libFolder.listFiles(new FilenameFilter() { File[] files = libFolder.listFiles(new FilenameFilter() {
@Override
public boolean accept(File dir, String name) { public boolean accept(File dir, String name) {
return name.toLowerCase().endsWith(FileConstants.JAR_FILE_SUFFIX) return name.toLowerCase().endsWith(FileConstants.JAR_FILE_SUFFIX)
|| name.toLowerCase().endsWith(FileConstants.ZIP_FILE_SUFFIX) ? true : false; || name.toLowerCase().endsWith(FileConstants.ZIP_FILE_SUFFIX) ? true : false;
@@ -221,6 +222,7 @@ public class JavaJobExportReArchieveCreator {
if (drlFolder != null) { if (drlFolder != null) {
File[] files = drlFolder.listFiles(new FilenameFilter() { File[] files = drlFolder.listFiles(new FilenameFilter() {
@Override
public boolean accept(File dir, String name) { public boolean accept(File dir, String name) {
return name.toLowerCase().endsWith(".drl") //$NON-NLS-1$ return name.toLowerCase().endsWith(".drl") //$NON-NLS-1$
? true ? true
@@ -240,6 +242,7 @@ public class JavaJobExportReArchieveCreator {
if (xlsFolder != null) { if (xlsFolder != null) {
File[] files = xlsFolder.listFiles(new FilenameFilter() { File[] files = xlsFolder.listFiles(new FilenameFilter() {
@Override
public boolean accept(File dir, String name) { public boolean accept(File dir, String name) {
return name.toLowerCase().endsWith(".xls") //$NON-NLS-1$ return name.toLowerCase().endsWith(".xls") //$NON-NLS-1$
? true ? true
@@ -257,6 +260,7 @@ public class JavaJobExportReArchieveCreator {
private String[] getJobFolderJarFilenames() { private String[] getJobFolderJarFilenames() {
File[] files = jobFolder.listFiles(new FilenameFilter() { File[] files = jobFolder.listFiles(new FilenameFilter() {
@Override
public boolean accept(File dir, String name) { public boolean accept(File dir, String name) {
return name.toLowerCase().endsWith(FileConstants.JAR_FILE_SUFFIX) return name.toLowerCase().endsWith(FileConstants.JAR_FILE_SUFFIX)
|| name.toLowerCase().endsWith(FileConstants.ZIP_FILE_SUFFIX) ? true : false; || name.toLowerCase().endsWith(FileConstants.ZIP_FILE_SUFFIX) ? true : false;
@@ -316,7 +320,17 @@ public class JavaJobExportReArchieveCreator {
if (needjars != null) { if (needjars != null) {
for (String needjar : needjars) { for (String needjar : needjars) {
if (".".equals(needjar)) { if (".".equals(needjar)) {
break; continue;
}
boolean found = false;
for (String jobJar : fs) {
if (jobJar != null && jobJar.equals(needjar)) {
found = true;
break;
}
}
if (found) {
continue;
} }
sb.append(needjar + " "); sb.append(needjar + " ");
} }