Compare commits
133 Commits
wwang-tale
...
release/7.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1dfe60285a | ||
|
|
7bae6b958c | ||
|
|
4b6155564b | ||
|
|
71e0c0da5f | ||
|
|
fefd0c1b47 | ||
|
|
cbc822c3a8 | ||
|
|
b7210746e3 | ||
|
|
c489fd8da7 | ||
|
|
901963c1fc | ||
|
|
6b7fde47d0 | ||
|
|
9642d20f56 | ||
|
|
d2c1b3d9ee | ||
|
|
1c56a4d797 | ||
|
|
75664ab5b6 | ||
|
|
83f862a29f | ||
|
|
a9227785c4 | ||
|
|
a61f2c6797 | ||
|
|
d5df42537d | ||
|
|
cd6b711595 | ||
|
|
4502ff4ae3 | ||
|
|
625aeaebf9 | ||
|
|
838d016f41 | ||
|
|
d2a1041993 | ||
|
|
cfbec28162 | ||
|
|
38c60c194f | ||
|
|
02d660edd5 | ||
|
|
e7cf31a2a1 | ||
|
|
6204d78546 | ||
|
|
f5d40d7898 | ||
|
|
5c3b8f54cb | ||
|
|
3943cfb8d1 | ||
|
|
87679ad3b1 | ||
|
|
a3b64152be | ||
|
|
2e8c6f3188 | ||
|
|
38e20f74fa | ||
|
|
93c6383ef7 | ||
|
|
4af633af53 | ||
|
|
e8bdf16525 | ||
|
|
a0d3dc47fb | ||
|
|
2d24b5d5fd | ||
|
|
946402c192 | ||
|
|
0e0749cfdf | ||
|
|
6265144309 | ||
|
|
f15a3e3e7c | ||
|
|
7d46024e9d | ||
|
|
4543d6a129 | ||
|
|
a61882573f | ||
|
|
748e0d218f | ||
|
|
0752bfd4fa | ||
|
|
503e187f96 | ||
|
|
09bdc7e42d | ||
|
|
885fe944f5 | ||
|
|
2087cdfe68 | ||
|
|
81345dd1b0 | ||
|
|
d2982b93e7 | ||
|
|
b2ce9e2ee2 | ||
|
|
25d0a3c978 | ||
|
|
1d4e07ebd0 | ||
|
|
2a591f79ce | ||
|
|
30d42547e5 | ||
|
|
fe468cbf15 | ||
|
|
ce2b399fe4 | ||
|
|
55aba706f6 | ||
|
|
4ee53f979e | ||
|
|
51142f7983 | ||
|
|
e2697a8226 | ||
|
|
86eb6ab2fe | ||
|
|
1690847460 | ||
|
|
461258adc9 | ||
|
|
3e4d33ab73 | ||
|
|
962e6b754b | ||
|
|
302b9a4921 | ||
|
|
02f5d99a23 | ||
|
|
a34a1fb6dc | ||
|
|
5c2049fb1b | ||
|
|
ddafd9607d | ||
|
|
12339ad3ab | ||
|
|
76c8733bad | ||
|
|
50a9456491 | ||
|
|
bbb82ade0d | ||
|
|
b5e8c7d605 | ||
|
|
97bc429216 | ||
|
|
0d0d0bc9db | ||
|
|
ecd65bd27d | ||
|
|
95614a456c | ||
|
|
45fd8866a1 | ||
|
|
662cb3ce5d | ||
|
|
15d8e5966f | ||
|
|
092cd497a7 | ||
|
|
b8adbf0321 | ||
|
|
2510f3ad4f | ||
|
|
00c50f158a | ||
|
|
f2d9ef95dc | ||
|
|
1a627ac736 | ||
|
|
cd0646d89c | ||
|
|
544eecb22d | ||
|
|
d2717e757e | ||
|
|
e2ef1e4028 | ||
|
|
074579381d | ||
|
|
b7bea1900e | ||
|
|
3859b1e957 | ||
|
|
74d2a8410e | ||
|
|
1f7a4875ef | ||
|
|
637aa45e61 | ||
|
|
75be28c5b1 | ||
|
|
00cc76bb3c | ||
|
|
35d710ca54 | ||
|
|
c78507196c | ||
|
|
7a60d7fdbb | ||
|
|
e05ae031de | ||
|
|
3028e357b1 | ||
|
|
7dab8ce963 | ||
|
|
35b20bb39e | ||
|
|
25d58e1fd2 | ||
|
|
ea023892f0 | ||
|
|
d6fd1cbe18 | ||
|
|
ce1fd92c74 | ||
|
|
bc4b7a489a | ||
|
|
e51292ea35 | ||
|
|
c2b7b58302 | ||
|
|
893b214fcf | ||
|
|
c0d3e099dd | ||
|
|
3970eb25af | ||
|
|
79361417eb | ||
|
|
1240c228c1 | ||
|
|
47953ea772 | ||
|
|
8bf40999cb | ||
|
|
d8824c7d80 | ||
|
|
c89e5a35db | ||
|
|
22b2899392 | ||
|
|
5c5e4a561f | ||
|
|
a972cbe1ec | ||
|
|
79599d9db9 |
@@ -514,17 +514,35 @@
|
||||
}
|
||||
org.apache.logging.log4j.core.config.Configurator.setLevel(org.apache.logging.log4j.LogManager.getRootLogger().getName(), log.getLevel());
|
||||
<%}%>
|
||||
}
|
||||
log.info("TalendJob: '<%=codeGenArgument.getJobName()%>' - Start.");
|
||||
<%}%>
|
||||
|
||||
<%
|
||||
INode jobCatcherNode = null;
|
||||
}
|
||||
log.info("TalendJob: '<%=codeGenArgument.getJobName()%>' - Start.");
|
||||
<%}%>
|
||||
|
||||
<%
|
||||
INode jobCatcherNode = null;
|
||||
|
||||
int threadPoolSize = 0;
|
||||
boolean tRESTRequestLoopExists = false;
|
||||
for (INode nodeInProcess : process.getGeneratingNodes()) {
|
||||
String componentName = nodeInProcess.getComponent().getName();
|
||||
if("tJobStructureCatcher".equals(componentName)) {
|
||||
|
||||
if(jobCatcherNode==null && "tJobStructureCatcher".equals(componentName)) {
|
||||
jobCatcherNode = nodeInProcess;
|
||||
break;
|
||||
continue;
|
||||
}
|
||||
|
||||
if(!nodeInProcess.isActivate()) continue;
|
||||
|
||||
if("tRESTRequestLoop".equals(componentName)) {
|
||||
tRESTRequestLoopExists = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
if("tWriteXMLFieldOut".equals(componentName)) {
|
||||
IConnection nextMergeConn = NodeUtil.getNextMergeConnection(nodeInProcess);
|
||||
if(nextMergeConn == null || nextMergeConn.getInputId()==1){
|
||||
threadPoolSize++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -652,15 +670,15 @@
|
||||
|
||||
boolean inOSGi = routines.system.BundleUtils.inOSGi();
|
||||
|
||||
if (inOSGi) {
|
||||
java.util.Dictionary<String, Object> jobProperties = routines.system.BundleUtils.getJobProperties(jobName);
|
||||
|
||||
if (jobProperties != null && jobProperties.get("context") != null) {
|
||||
contextStr = (String)jobProperties.get("context");
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
java.util.Dictionary<String, Object> jobProperties = null;
|
||||
if (inOSGi) {
|
||||
jobProperties = routines.system.BundleUtils.getJobProperties(jobName);
|
||||
|
||||
if (jobProperties != null && jobProperties.get("context") != null) {
|
||||
contextStr = (String)jobProperties.get("context");
|
||||
}
|
||||
}
|
||||
//call job/subjob with an existing context, like: --context=production. if without this parameter, there will use the default context instead.
|
||||
java.io.InputStream inContext = <%=className%>.class.getClassLoader().getResourceAsStream("<%=jobClassPackageFolder%>/contexts/" + contextStr + ".properties");
|
||||
if (inContext == null) {
|
||||
@@ -670,8 +688,17 @@
|
||||
try {
|
||||
//defaultProps is in order to keep the original context value
|
||||
if(context != null && context.isEmpty()) {
|
||||
defaultProps.load(inContext);
|
||||
context = new ContextProperties(defaultProps);
|
||||
defaultProps.load(inContext);
|
||||
if (inOSGi && jobProperties != null) {
|
||||
java.util.Enumeration<String> keys = jobProperties.keys();
|
||||
while (keys.hasMoreElements()) {
|
||||
String propKey = keys.nextElement();
|
||||
if (defaultProps.containsKey(propKey)) {
|
||||
defaultProps.put(propKey, (String) jobProperties.get(propKey));
|
||||
}
|
||||
}
|
||||
}
|
||||
context = new ContextProperties(defaultProps);
|
||||
}
|
||||
} finally {
|
||||
inContext.close();
|
||||
@@ -857,7 +884,7 @@
|
||||
}
|
||||
%>
|
||||
//Resume: jobStart
|
||||
resumeUtil.addLog("JOB_STARTED", "JOB:" + jobName, parent_part_launcher, Thread.currentThread().getId() + "", "","","","",resumeUtil.convertToJsonText(context,parametersToEncrypt));
|
||||
resumeUtil.addLog("JOB_STARTED", "JOB:" + jobName, parent_part_launcher, Thread.currentThread().getId() + "", "","","","",resumeUtil.convertToJsonText(context,ContextProperties.class,parametersToEncrypt));
|
||||
|
||||
<%
|
||||
if (stats) {
|
||||
@@ -1130,9 +1157,15 @@ this.globalResumeTicket = false;//to run others jobs
|
||||
if (!componentName.equals("tJobStructureCatcher") && !componentName.equals("tLogCatcher") && !componentName.equals("tFlowMeterCatcher") && !componentName.equals("tAssertCatcher") && !componentName.equals("tStatCatcher") && !componentName.equals("tAsyncIn")) {
|
||||
%>
|
||||
<%=createCallProcess(rootNode, className, false) %>
|
||||
<% }
|
||||
}
|
||||
}// end if(isRunInMultiThread)
|
||||
<%
|
||||
if (process.getNodesOfType("tStatCatcher").size() > 0) {
|
||||
%>
|
||||
<%=statsErrorHandlingAfterMainCall(rootNode, process.getNodesOfType("tStatCatcher"))%>
|
||||
<%
|
||||
}
|
||||
}
|
||||
}
|
||||
}// end if(isRunInMultiThread)
|
||||
%>
|
||||
|
||||
this.globalResumeTicket = true;//to run tPostJob
|
||||
@@ -1190,6 +1223,26 @@ this.globalResumeTicket = true;//to run tPostJob
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
<%
|
||||
}
|
||||
|
||||
//tRESTRequest may appear in microservice, the code may be called before call submit(task) method, so can't shutdown it here
|
||||
if(!tRESTRequestLoopExists && threadPoolSize>0) {
|
||||
%>
|
||||
es.shutdown();
|
||||
<%//shutdownNow should never be executed, only for safe%>
|
||||
try {
|
||||
if(!es.awaitTermination(60, java.util.concurrent.TimeUnit.SECONDS)) {
|
||||
es.shutdownNow();
|
||||
if(!es.awaitTermination(60, java.util.concurrent.TimeUnit.SECONDS)) {
|
||||
|
||||
}
|
||||
}
|
||||
} catch (java.lang.InterruptedException ie) {
|
||||
es.shutdownNow();
|
||||
} catch (java.lang.Exception e) {
|
||||
|
||||
}
|
||||
<%
|
||||
}
|
||||
%>
|
||||
@@ -1246,7 +1299,7 @@ if (execStat) {
|
||||
returnCode = errorCode.intValue();
|
||||
}
|
||||
resumeUtil.addLog("JOB_ENDED", "JOB:" + jobName, parent_part_launcher, Thread.currentThread().getId() + "", "","" + returnCode,"","","");
|
||||
|
||||
resumeUtil.flush();
|
||||
return returnCode;
|
||||
|
||||
}
|
||||
|
||||
@@ -42,10 +42,10 @@ public class CLASS
|
||||
|
||||
//List< ? extends IConnection> onSubJobErrorConns = rootNode.getOutgoingConnections(EConnectionType.ON_SUBJOB_ERROR);
|
||||
//if(onSubJobErrorConns!=null){
|
||||
// for(IConnection conn : onSubJobErrorConns) {
|
||||
// for(IConnection conn : onSubJobErrorConns) {
|
||||
// toReturn += createCallProcess(conn.getTarget(), className, isMultiThread);
|
||||
// }
|
||||
//}
|
||||
//}
|
||||
if(isMultiThread){
|
||||
toReturn += "\n}catch (java.lang.Error e_" + rootNode.getUniqueName() + ") {\n";
|
||||
toReturn += "globalMap.put(\""+rootNode.getUniqueName()+ "_SUBPROCESS_STATE\", -1);\n";
|
||||
@@ -55,7 +55,20 @@ public class CLASS
|
||||
toReturn += "\n}";
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
|
||||
public String statsErrorHandlingAfterMainCall(INode rootNode, List<? extends INode> statsNodes) {
|
||||
String catchErrorReturn = "catch (Error error_" + rootNode.getUniqueName() + " ) {\n";
|
||||
catchErrorReturn+="end = System.currentTimeMillis();\n";
|
||||
for (INode statCatcherNode : statsNodes) {
|
||||
catchErrorReturn += statCatcherNode.getUniqueName() + ".addMessage(\"failure\", (end-startTime));\n";
|
||||
catchErrorReturn += "try {\n " + statCatcherNode.getDesignSubjobStartNode().getUniqueName() + "Process(globalMap);\n";
|
||||
catchErrorReturn += "} catch (Exception e_" + statCatcherNode.getUniqueName() + ") {\n";
|
||||
catchErrorReturn += "e_" + statCatcherNode.getUniqueName() + ".printStackTrace();\n}\n";
|
||||
}
|
||||
catchErrorReturn+= "throw error_" + rootNode.getUniqueName() + ";\n}\n";
|
||||
return catchErrorReturn;
|
||||
}
|
||||
|
||||
public String generate(Object argument) {
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -170,16 +170,8 @@ class IndexedRecordToRowStructGenerator {
|
||||
if (columnName.equals(dynamicColName)) {
|
||||
%>
|
||||
java.util.Map<String, Object> dynamicValue_<%=cid%> = (java.util.Map<String, Object>) <%=codeVarSchemaEnforcer%>.get(<%=i%>);
|
||||
org.apache.avro.Schema dynSchema_<%=cid%> = ((org.talend.codegen.enforcer.OutgoingDynamicSchemaEnforcer) <%=codeVarSchemaEnforcer%>).getDynamicFieldsSchema();
|
||||
for (org.apache.avro.Schema.Field dynamicField_<%=cid%> : dynSchema_<%=cid%>.getFields()){
|
||||
String name = dynamicField_<%=cid%>.name();
|
||||
if("true".equals(dynamicField_<%=cid%>.getProp("ENABLE_SPECIAL_TABLENAME"))){
|
||||
dynamicValue_<%=cid%>.put(dynamicField_<%=cid%>.getProp("talend.field.dbColumnName"), dynamicValue_<%=cid%>.get(name));
|
||||
dynamicValue_<%=cid%>.remove(name);
|
||||
}
|
||||
}
|
||||
for (java.util.Map.Entry<String, Object> dynamicValueEntry_<%=cid%> : dynamicValue_<%=cid%>.entrySet()) {
|
||||
<%=codeVarDynamic%>.setColumnValue(<%=codeVarDynamic%>.getIndex(dynamicValueEntry_<%=cid%>.getKey()), dynamicValueEntry_<%=cid%>.getValue());
|
||||
<%=codeVarDynamic%>.addColumnValue(dynamicValueEntry_<%=cid%>.getValue());
|
||||
}
|
||||
<%=codeVarRowStruct%>.<%=dynamicColName%> = <%=codeVarDynamic%>;
|
||||
<%
|
||||
|
||||
@@ -385,11 +385,101 @@ public <%=JavaTypesManager.getTypeToGenerate(ctxParam.getType(),true)%> get<%=Ch
|
||||
|
||||
<%
|
||||
INode jobCatcherNode = null;
|
||||
|
||||
//one matched component or part, one thread
|
||||
//why not computed by cpu or resource : please image this case :
|
||||
//loop==>(input==>(twritexmlfield A)==>(twritexmlfield B)==>(twritexmlfield C)==>output), dead lock as cycle dependency and only one thead in thread pool
|
||||
//maybe newCachedThreadPool is a better idea, but that have risk for creating more threads, then more memory for TDI-47230
|
||||
//why not generate thread pool object in subprocess scope :
|
||||
// 1: major reason : difficult to control the var scope, somewhere can't access it, then compiler issue
|
||||
// 2: we may need this thread pool for bigger scope, not only for twritexmlfield/twritejsonfield in future
|
||||
// 3: we don't suppose this thread pool cost big resource after all tasks done, so we can shutdown it more later,
|
||||
// for example, most time, user will use less than 3 twritexmlfield in one job, then 3 threads thread pool, we can close them in job finish code part,
|
||||
// not a big cost to keep that. And of course, we best to start&clean it in subprocess finish, but that's risk of 1 above.
|
||||
int threadPoolSize = 0;
|
||||
boolean tHMapExists = false;
|
||||
boolean tHMapOutExists = false;
|
||||
boolean tRESTRequestLoopExists = false;
|
||||
for (INode nodeInProcess : processNodes) {
|
||||
String componentName = nodeInProcess.getComponent().getName();
|
||||
if("tJobStructureCatcher".equals(componentName)) {
|
||||
|
||||
if(jobCatcherNode==null && "tJobStructureCatcher".equals(componentName)) {
|
||||
jobCatcherNode = nodeInProcess;
|
||||
break;
|
||||
continue;
|
||||
}
|
||||
|
||||
if(!nodeInProcess.isActivate()) continue;
|
||||
|
||||
if("tHMap".equals(componentName)) {
|
||||
tHMapExists = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
if("tHMapOut".equals(componentName)) {
|
||||
tHMapOutExists = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
if("tRESTRequestLoop".equals(componentName)) {
|
||||
tRESTRequestLoopExists = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
if("tWriteXMLFieldOut".equals(componentName)) {
|
||||
IConnection nextMergeConn = NodeUtil.getNextMergeConnection(nodeInProcess);
|
||||
if(nextMergeConn == null || nextMergeConn.getInputId()==1){
|
||||
threadPoolSize++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(threadPoolSize>0) {
|
||||
if(tRESTRequestLoopExists) {//miscroservice
|
||||
%>
|
||||
private class DaemonThreadFactory implements java.util.concurrent.ThreadFactory {
|
||||
java.util.concurrent.ThreadFactory factory = java.util.concurrent.Executors.defaultThreadFactory();
|
||||
|
||||
public java.lang.Thread newThread(java.lang.Runnable r) {
|
||||
java.lang.Thread t = factory.newThread(r);
|
||||
t.setDaemon(true);
|
||||
return t;
|
||||
}
|
||||
}
|
||||
<%
|
||||
}
|
||||
|
||||
if(tHMapExists || tHMapOutExists) {
|
||||
%>
|
||||
private final java.util.concurrent.ExecutorService es = java.util.concurrent.Executors.newFixedThreadPool(<%=threadPoolSize%> <%if(tRESTRequestLoopExists) {%>,new DaemonThreadFactory()<%}%>);
|
||||
<%
|
||||
} else {
|
||||
%>
|
||||
private final java.util.concurrent.ExecutorService es = java.util.concurrent.Executors.newCachedThreadPool(<%if(tRESTRequestLoopExists) {%>new DaemonThreadFactory()<%}%>);
|
||||
<%
|
||||
}
|
||||
|
||||
if(tRESTRequestLoopExists) {//miscroservice
|
||||
%>
|
||||
{
|
||||
java.lang.Runtime.getRuntime().addShutdownHook(new java.lang.Thread() {
|
||||
public void run() {
|
||||
es.shutdown();
|
||||
try {
|
||||
if(!es.awaitTermination(60, java.util.concurrent.TimeUnit.SECONDS)) {
|
||||
es.shutdownNow();
|
||||
if(!es.awaitTermination(60, java.util.concurrent.TimeUnit.SECONDS)) {
|
||||
|
||||
}
|
||||
}
|
||||
} catch (java.lang.InterruptedException ie) {
|
||||
es.shutdownNow();
|
||||
} catch (java.lang.Exception e) {
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
<%
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
org.talend.core.model.process.IHashConfiguration
|
||||
org.talend.core.model.process.IHashableColumn
|
||||
org.talend.core.model.utils.NodeUtil
|
||||
org.talend.core.model.utils.TalendTextUtils
|
||||
"
|
||||
class="SubProcessHeader"
|
||||
skeleton="subprocess_header_java.skeleton"
|
||||
@@ -183,6 +184,48 @@ public static class <%=conn.getName() %>Struct<%=templateOrigin %> implements ro
|
||||
public <%= typeToGenerate %> get<%=column.getLabel().substring(0, 1).toUpperCase()%><%=column.getLabel().substring(1)%> () {
|
||||
return this.<%=column.getLabel()%>;
|
||||
}
|
||||
|
||||
public Boolean <%=column.getLabel()%>IsNullable(){
|
||||
return <%=column.isNullable()%>;
|
||||
}
|
||||
public Boolean <%=column.getLabel()%>IsKey(){
|
||||
return <%=column.isKey()%>;
|
||||
}
|
||||
public Integer <%=column.getLabel()%>Length(){
|
||||
return <%=column.getLength()%>;
|
||||
}
|
||||
public Integer <%=column.getLabel()%>Precision(){
|
||||
return <%=column.getPrecision()%>;
|
||||
}
|
||||
public String <%=column.getLabel()%>Default(){
|
||||
<% if (column.getDefault() == null) { %>
|
||||
return null;
|
||||
<% } else { %>
|
||||
return "<%=TalendTextUtils.escapeJavaText(TalendTextUtils.removeQuotes(column.getDefault()))%>";
|
||||
<% } %>
|
||||
}
|
||||
public String <%=column.getLabel()%>Comment(){
|
||||
<% if (column.getComment() == null) { %>
|
||||
return null;
|
||||
<% } else { %>
|
||||
return "<%=TalendTextUtils.escapeJavaText(TalendTextUtils.removeQuotes(column.getComment()))%>";
|
||||
<% } %>
|
||||
}
|
||||
public String <%=column.getLabel()%>Pattern(){
|
||||
<% if (column.getPattern() == null) { %>
|
||||
return null;
|
||||
<% } else { %>
|
||||
return "<%=TalendTextUtils.escapeJavaText(TalendTextUtils.removeQuotes(column.getPattern()))%>";
|
||||
<% } %>
|
||||
}
|
||||
public String <%=column.getLabel()%>OriginalDbColumnName(){
|
||||
<% if (column.getOriginalDbColumnName() == null) { %>
|
||||
return null;
|
||||
<% } else { %>
|
||||
return "<%=TalendTextUtils.escapeJavaText(TalendTextUtils.removeQuotes(column.getOriginalDbColumnName()))%>";
|
||||
<% } %>
|
||||
}
|
||||
|
||||
<%
|
||||
if((conn.getLineStyle() == EConnectionType.FLOW_REF) && conn.getTarget().getUniqueName().startsWith("tXMLMap") && "id_Document".equals(javaType.getId())) {
|
||||
%>
|
||||
|
||||
@@ -10,6 +10,7 @@ CodeGenerator.getGraphicalNode2=------process.getGeneratingNodes()------
|
||||
CodeGenerator.JET.TimeOut=JET initialisation Time Out
|
||||
CodeGenerator.newLine=\n\n\n\n
|
||||
CodeGenerator.Node.NotFound=Node not found in current process
|
||||
CodeGenerator.Components.NotFound={0}: Component is missing: {1}; use -D{2}=false in your studio or commandline to skip this check, and a warning message will be logged.
|
||||
JavaRoutineSynchronizer.UnsupportedOperation.Exception1=method not implemented: org.talend.designer.codegen.JavaRoutineSynchronizer line:49
|
||||
JavaRoutineSynchronizer.UnsupportedOperation.Exception2=method not implemented: org.talend.designer.codegen.JavaRoutineSynchronizer line:58
|
||||
JetSkeletonManager.unableLoad=unable to load skeleton update cache file
|
||||
|
||||
@@ -66,6 +66,7 @@ import org.talend.designer.codegen.model.CodeGeneratorEmittersPoolFactory;
|
||||
import org.talend.designer.codegen.model.CodeGeneratorInternalTemplatesFactoryProvider;
|
||||
import org.talend.designer.codegen.proxy.JetProxy;
|
||||
import org.talend.designer.core.generic.model.Component;
|
||||
import org.talend.designer.core.model.components.DummyComponent;
|
||||
import org.talend.designer.runprocess.ProcessorUtilities;
|
||||
|
||||
/**
|
||||
@@ -845,6 +846,25 @@ public class CodeGenerator implements ICodeGenerator {
|
||||
IComponentFileNaming componentFileNaming = ComponentsFactoryProvider.getFileNamingInstance();
|
||||
|
||||
IComponent component = node.getComponent();
|
||||
if (component instanceof DummyComponent) {
|
||||
if (((DummyComponent) component).isMissingComponent()) {
|
||||
String processName = "";
|
||||
try {
|
||||
IProcess proc = node.getProcess();
|
||||
processName = proc.getName() + " " + proc.getVersion();
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
if (IProcess.ERR_ON_COMPONENT_MISSING) {
|
||||
throw new CodeGeneratorException(Messages.getString("CodeGenerator.Components.NotFound", processName,
|
||||
component.getName(), IProcess.PROP_ERR_ON_COMPONENT_MISSING));
|
||||
}
|
||||
if (ECodePart.BEGIN.equals(part)) {
|
||||
log.warn(Messages.getString("CodeGenerator.Components.NotFound", processName, component.getName(),
|
||||
IProcess.PROP_ERR_ON_COMPONENT_MISSING));
|
||||
}
|
||||
}
|
||||
}
|
||||
// some code unification to handle all component types the same way.
|
||||
String templateURI = component.getTemplateFolder() + TemplateUtil.DIR_SEP
|
||||
+ componentFileNaming.getJetFileName(component.getTemplateNamePrefix(), language.getExtension(), part);
|
||||
|
||||
@@ -100,7 +100,7 @@
|
||||
<dependency>
|
||||
<groupId>com.google.code.gson</groupId>
|
||||
<artifactId>gson</artifactId>
|
||||
<version>2.2.4</version>
|
||||
<version>2.8.9</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
|
||||
@@ -42,7 +42,18 @@
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-log4j12</artifactId>
|
||||
<version>1.7.25</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ch.qos.reload4j</groupId>
|
||||
<artifactId>reload4j</artifactId>
|
||||
<version>1.2.19</version>
|
||||
</dependency>
|
||||
<!-- Spring 3 dependencies -->
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
|
||||
@@ -1,69 +0,0 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.talend.components</groupId>
|
||||
<artifactId>checkArchive</artifactId>
|
||||
<version>1.2-20210901</version>
|
||||
<name>checkArchive</name>
|
||||
<description>Dependence for tFileArchive and tFileUnAchive</description>
|
||||
<url>http://maven.apache.org</url>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<talend.nexus.url>https://artifacts-oss.talend.com</talend.nexus.url>
|
||||
<java.source.version>1.8</java.source.version>
|
||||
</properties>
|
||||
|
||||
<distributionManagement>
|
||||
<snapshotRepository>
|
||||
<id>talend_nexus_deployment</id>
|
||||
<url>${talend.nexus.url}/nexus/content/repositories/TalendOpenSourceSnapshot/</url>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
<releases>
|
||||
<enabled>false</enabled>
|
||||
</releases>
|
||||
</snapshotRepository>
|
||||
<repository>
|
||||
<id>talend_nexus_deployment</id>
|
||||
<url>${talend.nexus.url}/nexus/content/repositories/TalendOpenSourceRelease/</url>
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
<releases>
|
||||
<enabled>true</enabled>
|
||||
</releases>
|
||||
</repository>
|
||||
</distributionManagement>
|
||||
|
||||
<dependencies>
|
||||
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-compress -->
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-compress</artifactId>
|
||||
<version>1.21</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/java</directory>
|
||||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>2.3.2</version>
|
||||
<configuration>
|
||||
<source>${java.source.version}</source>
|
||||
<target>${java.source.version}</target>
|
||||
<showDeprecation>true</showDeprecation>
|
||||
<showWarnings>true</showWarnings>
|
||||
<compilerArgument>-XDignore.symbol.file</compilerArgument>
|
||||
<fork>true</fork>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
@@ -230,9 +230,9 @@
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>1.2.14</version>
|
||||
<groupId>ch.qos.reload4j</groupId>
|
||||
<artifactId>reload4j</artifactId>
|
||||
<version>1.2.19</version>
|
||||
<scope>runtime</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<cxf.version>3.3.10</cxf.version>
|
||||
<cxf.version>3.4.7</cxf.version>
|
||||
</properties>
|
||||
|
||||
<build>
|
||||
@@ -77,8 +77,8 @@
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>2.5.1</version>
|
||||
<configuration>
|
||||
<source>1.7</source>
|
||||
<target>1.7</target>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
<encoding>UTF-8</encoding>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.talend</groupId>
|
||||
<artifactId>talendMQRFH2</artifactId>
|
||||
<version>1.0.1-20190206</version>
|
||||
<version>1.1.0-20220307</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<properties>
|
||||
@@ -36,20 +36,10 @@
|
||||
</distributionManagement>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.ibm.mq</groupId>
|
||||
<artifactId>com.ibm.mq</artifactId>
|
||||
<version>8.0.0.9</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.ibm.mq</groupId>
|
||||
<artifactId>com.ibm.mqjms</artifactId>
|
||||
<version>8.0.0.9</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.ibm.mq</groupId>
|
||||
<artifactId>com.ibm.mq.allclient</artifactId>
|
||||
<version>8.0.0.9</version>
|
||||
<version>9.2.4.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.talend.libraries</groupId>
|
||||
@@ -67,9 +57,9 @@
|
||||
<version>6.0.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>1.2.17</version>
|
||||
<groupId>ch.qos.reload4j</groupId>
|
||||
<artifactId>reload4j</artifactId>
|
||||
<version>1.2.19</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<!-- #################################################### -->
|
||||
|
||||
<!-- modification 1: config -->
|
||||
<property name="jar.name" value="MsmqTalend-1.0.0.jar" />
|
||||
<property name="jar.name" value="MsmqTalend-1.0.5.jar" />
|
||||
<property name="component.name" value="tMicrosoftMQInput" />
|
||||
<property name="author.name" value="ytao" />
|
||||
|
||||
|
||||
@@ -113,9 +113,9 @@
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>1.2.17</version>
|
||||
<groupId>ch.qos.reload4j</groupId>
|
||||
<artifactId>reload4j</artifactId>
|
||||
<version>1.2.19</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<!-- JUnit -->
|
||||
|
||||
@@ -63,9 +63,9 @@
|
||||
<version>4.1.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>1.2.17</version>
|
||||
<groupId>ch.qos.reload4j</groupId>
|
||||
<artifactId>reload4j</artifactId>
|
||||
<version>1.2.19</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
@@ -90,4 +90,4 @@
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
</project>
|
||||
@@ -108,4 +108,4 @@ public class DefaultTalendSheetContentsHandler implements TalendXSSFSheetXMLHand
|
||||
}
|
||||
return columnIndex;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -45,9 +45,9 @@
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>1.2.17</version>
|
||||
<groupId>ch.qos.reload4j</groupId>
|
||||
<artifactId>reload4j</artifactId>
|
||||
<version>1.2.19</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
||||
@@ -69,13 +69,13 @@
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-api</artifactId>
|
||||
<version>2.16.0</version>
|
||||
<version>2.17.1</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-core</artifactId>
|
||||
<version>2.16.0</version>
|
||||
<version>2.17.1</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
@@ -1,71 +1,110 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.talend.libraries</groupId>
|
||||
<artifactId>talend-mscrm</artifactId>
|
||||
<version>3.4-20191012</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>talend-mscrm</name>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<odata.version>4.3.0</odata.version>
|
||||
<slf4j.version>1.7.12</slf4j.version>
|
||||
<talend.nexus.url>https://artifacts-oss.talend.com</talend.nexus.url>
|
||||
</properties>
|
||||
|
||||
<distributionManagement>
|
||||
<snapshotRepository>
|
||||
<id>talend_nexus_deployment</id>
|
||||
<url>${talend.nexus.url}/nexus/content/repositories/TalendOpenSourceSnapshot/</url>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
<releases>
|
||||
<enabled>false</enabled>
|
||||
</releases>
|
||||
</snapshotRepository>
|
||||
<repository>
|
||||
<id>talend_nexus_deployment</id>
|
||||
<url>${talend.nexus.url}/nexus/content/repositories/TalendOpenSourceRelease/</url>
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
<releases>
|
||||
<enabled>true</enabled>
|
||||
</releases>
|
||||
</repository>
|
||||
</distributionManagement>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.axis2</groupId>
|
||||
<artifactId>axis2-xmlbeans</artifactId>
|
||||
<version>1.7.4</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>1.2.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpclient</artifactId>
|
||||
<version>4.5.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpcore</artifactId>
|
||||
<version>4.4.9</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.axis2</groupId>
|
||||
<artifactId>axis2-transport-http</artifactId>
|
||||
<version>1.7.4</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.talend.components</groupId>
|
||||
<artifactId>talend-mscrm</artifactId>
|
||||
<version>3.10.2-20220831</version>
|
||||
<packaging>jar</packaging>
|
||||
<description>A forked Talend-MSCRM library, developed to use in Studio 7.3.1 only. It's main intention is to contain CVE fixes.</description>
|
||||
|
||||
<name>talend-mscrm</name>
|
||||
|
||||
<licenses>
|
||||
<license>
|
||||
<name>Apache License, Version 2.0</name>
|
||||
<url>https://www.talendforge.org/modules/licenses/APACHE_v2.txt</url>
|
||||
<distribution>may be downloaded from the Maven repository</distribution>
|
||||
</license>
|
||||
</licenses>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<talend.nexus.url>https://artifacts-oss.talend.com</talend.nexus.url>
|
||||
|
||||
<odata.version>4.7.1</odata.version>
|
||||
<slf4j.version>1.7.28</slf4j.version>
|
||||
<axis2.version>1.7.9</axis2.version>
|
||||
<httpclient.version>4.5.13</httpclient.version>
|
||||
<httpcore.version>4.4.13</httpcore.version>
|
||||
<junit.version>4.13.2</junit.version>
|
||||
<adal4j.version>1.6.5-20220701</adal4j.version>
|
||||
<jackson.version>2.13.2</jackson.version>
|
||||
<jackson-databind.version>2.13.2.2</jackson-databind.version>
|
||||
|
||||
<!-- plugin's versions -->
|
||||
<maven-jar-plugin.version>3.2.0</maven-jar-plugin.version>
|
||||
<maven-compiler-plugin.version>3.8.1</maven-compiler-plugin.version>
|
||||
</properties>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>talend_nexus_deployment</id>
|
||||
<url>${talend.nexus.url}/nexus/content/repositories/TalendOpenSourceRelease/</url>
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
<releases>
|
||||
<enabled>true</enabled>
|
||||
</releases>
|
||||
</repository>
|
||||
</repositories>
|
||||
<distributionManagement>
|
||||
<snapshotRepository>
|
||||
<id>talend_nexus_deployment</id>
|
||||
<url>${talend.nexus.url}/nexus/content/repositories/TalendOpenSourceSnapshot/</url>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
<releases>
|
||||
<enabled>false</enabled>
|
||||
</releases>
|
||||
</snapshotRepository>
|
||||
<repository>
|
||||
<id>talend_nexus_deployment</id>
|
||||
<url>${talend.nexus.url}/nexus/content/repositories/TalendOpenSourceRelease/</url>
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
<releases>
|
||||
<enabled>true</enabled>
|
||||
</releases>
|
||||
</repository>
|
||||
</distributionManagement>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.axis2</groupId>
|
||||
<artifactId>axis2-xmlbeans</artifactId>
|
||||
<version>${axis2.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ch.qos.reload4j</groupId>
|
||||
<artifactId>reload4j</artifactId>
|
||||
<version>1.2.19</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpclient</artifactId>
|
||||
<version>${httpclient.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpcore</artifactId>
|
||||
<version>${httpcore.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.axis2</groupId>
|
||||
<artifactId>axis2-transport-http</artifactId>
|
||||
<version>${axis2.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>commons-httpclient</groupId>
|
||||
<artifactId>commons-httpclient</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.olingo</groupId>
|
||||
<artifactId>odata-client-core</artifactId>
|
||||
<version>${odata.version}</version>
|
||||
@@ -97,53 +136,55 @@
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<version>1.7.11</version>
|
||||
<version>${slf4j.version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.12</version>
|
||||
<version>${junit.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.microsoft.azure</groupId>
|
||||
<groupId>com.microsoft.azure</groupId>
|
||||
<artifactId>adal4j</artifactId>
|
||||
<version>1.1.1-20191012</version>
|
||||
<version>${adal4j.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/java</directory>
|
||||
</resource>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>default-jar</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>../../../org.talend.libraries.crm/lib</outputDirectory>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-core</artifactId>
|
||||
<version>${jackson.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
<version>${jackson-databind.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-annotations</artifactId>
|
||||
<version>${jackson.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/java</directory>
|
||||
</resource>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>${maven-compiler-plugin.version}</version>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</build>
|
||||
</project>
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
package org.talend.ms.crm;
|
||||
|
||||
import java.rmi.RemoteException;
|
||||
import java.util.Iterator;
|
||||
import java.util.UUID;
|
||||
|
||||
import javax.naming.AuthenticationException;
|
||||
import javax.naming.ServiceUnavailableException;
|
||||
import javax.xml.stream.XMLStreamException;
|
||||
|
||||
import org.apache.axiom.om.OMAbstractFactory;
|
||||
@@ -19,33 +22,37 @@ import org.apache.axis2.client.ServiceClient;
|
||||
import org.apache.axis2.context.ConfigurationContext;
|
||||
import org.apache.axis2.context.ConfigurationContextFactory;
|
||||
import org.apache.axis2.transport.http.HTTPConstants;
|
||||
import org.apache.axis2.transport.http.HTTPTransportConstants;
|
||||
import org.apache.axis2.transport.http.HttpTransportProperties;
|
||||
import org.apache.axis2.transport.http.HttpTransportProperties.ProxyProperties;
|
||||
import org.apache.http.HttpEntity;
|
||||
import org.apache.http.HttpStatus;
|
||||
import org.apache.http.client.methods.CloseableHttpResponse;
|
||||
import org.apache.http.client.methods.HttpGet;
|
||||
import org.apache.http.impl.client.CloseableHttpClient;
|
||||
import org.apache.http.impl.client.HttpClients;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
import org.apache.olingo.client.api.http.HttpClientException;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.datacontract.schemas._2004._07.system_collections_generic.KeyValuePairOfEndpointTypestringztYlk6OT;
|
||||
import org.talend.ms.crm.odata.ClientConfiguration;
|
||||
import org.talend.ms.crm.odata.authentication.AuthStrategyFactory;
|
||||
import org.talend.ms.crm.odata.authentication.IAuthStrategy;
|
||||
import org.talend.ms.crm.sdk.Instance;
|
||||
import org.talend.ms.crm.sdk.OnlineAuthenticationPolicy;
|
||||
import org.talend.ms.crm.sdk.OrganizationServiceStubWrapper;
|
||||
import org.talend.ms.crm.sdk.RequestDateTimeData;
|
||||
import org.talend.ms.crm.sdk.SecurityData;
|
||||
import org.talend.ms.crm.sdk.WsdlTokenManager;
|
||||
|
||||
import com.microsoft.schemas.xrm._2011.contracts.DiscoveryServiceStub;
|
||||
import com.microsoft.schemas.xrm._2011.contracts.IDiscoveryService_Execute_DiscoveryServiceFaultFault_FaultMessage;
|
||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.MapperFeature;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.microsoft.schemas.xrm._2011.contracts.OrganizationServiceStub;
|
||||
import com.microsoft.schemas.xrm._2011.contracts.discovery.EndpointType;
|
||||
import com.microsoft.schemas.xrm._2011.contracts.discovery.ExecuteDocument;
|
||||
import com.microsoft.schemas.xrm._2011.contracts.discovery.ExecuteDocument.Execute;
|
||||
import com.microsoft.schemas.xrm._2011.contracts.discovery.ExecuteResponseDocument;
|
||||
import com.microsoft.schemas.xrm._2011.contracts.discovery.ExecuteResponseDocument.ExecuteResponse;
|
||||
import com.microsoft.schemas.xrm._2011.contracts.discovery.OrganizationDetail;
|
||||
import com.microsoft.schemas.xrm._2011.contracts.discovery.RetrieveOrganizationRequest;
|
||||
import com.microsoft.schemas.xrm._2011.contracts.discovery.RetrieveOrganizationResponse;
|
||||
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2019 Talend Inc. - www.talend.com
|
||||
// Copyright (C) 2006-2022 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
@@ -64,21 +71,15 @@ public class MSCRMClient {
|
||||
|
||||
static Logger logger = LoggerFactory.getLogger(MSCRMClient.class.getName());
|
||||
|
||||
/**
|
||||
* Microsoft account (e.g. youremail@live.com) or Microsoft Office 365 (Org ID e.g.
|
||||
* youremail@yourorg.onmicrosoft.com) User Name.
|
||||
*/
|
||||
private String username;
|
||||
|
||||
/**
|
||||
* Microsoft account or Microsoft Office 365 (Org ID) Password.
|
||||
*/
|
||||
private String password;
|
||||
|
||||
/**
|
||||
* Unique Name of the organization
|
||||
*/
|
||||
private String orgName;
|
||||
|
||||
/**
|
||||
* Unique Name of the organization
|
||||
*/
|
||||
private ClientConfiguration clientConfiguration;
|
||||
|
||||
/**
|
||||
* Suffix for the Flat WSDL
|
||||
@@ -87,88 +88,84 @@ public class MSCRMClient {
|
||||
|
||||
private OrganizationServiceStub serviceStub;
|
||||
|
||||
private Integer timeout;
|
||||
private String discoveryServiceURL = "https://globaldisco.crm.dynamics.com/api/discovery/v2.0/Instances";
|
||||
|
||||
/**
|
||||
* This sample application registration values are available for all online instances
|
||||
* This is suggested to use for development and prototyping purposes.For production use, you should create an AppId or ClientId that is specific
|
||||
* to your tenant in the Azure Management portal.
|
||||
*
|
||||
*/
|
||||
private static final String DEFAULT_CLIENT_ID = "51f81489-12ee-4a9e-aaae-a2591f45987d";
|
||||
|
||||
private IAuthStrategy authStrategy;
|
||||
|
||||
private Boolean reuseHttpClient;
|
||||
public MSCRMClient(ClientConfiguration clientConfiguration, String orgName, String discoveryServiceURL) throws AuthenticationException {
|
||||
this.clientConfiguration = clientConfiguration;
|
||||
this.orgName = orgName;
|
||||
this.discoveryServiceURL = discoveryServiceURL;
|
||||
init();
|
||||
|
||||
private int maxConnectionRetries = 5;
|
||||
}
|
||||
|
||||
private void init() throws AuthenticationException {
|
||||
if (clientConfiguration != null && discoveryServiceURL != null && discoveryServiceURL.indexOf("/api/discovery/") > 0) {
|
||||
clientConfiguration.setResource(discoveryServiceURL.substring(0, discoveryServiceURL.indexOf("/api/discovery/")));
|
||||
}
|
||||
|
||||
if(clientConfiguration != null) {
|
||||
if (discoveryServiceURL != null && discoveryServiceURL.indexOf("/api/discovery/") > 0) {
|
||||
clientConfiguration.setResource(discoveryServiceURL.substring(0, discoveryServiceURL.indexOf("/api/discovery/")));
|
||||
}
|
||||
if (clientConfiguration.getClientId()==null || clientConfiguration.getClientId().isEmpty()) {
|
||||
clientConfiguration.setClientId(DEFAULT_CLIENT_ID);
|
||||
}
|
||||
}
|
||||
|
||||
private int attemptsInterval = 1000;
|
||||
|
||||
public MSCRMClient(String username, String password, String orgName) {
|
||||
this.username = username;
|
||||
this.password = password;
|
||||
this.orgName = orgName;
|
||||
authStrategy = AuthStrategyFactory.createAuthStrategy(this.clientConfiguration);
|
||||
authStrategy.init();
|
||||
|
||||
}
|
||||
|
||||
public void setTimeout(Integer timeout) {
|
||||
this.timeout = timeout;
|
||||
}
|
||||
|
||||
public void setReuseHttpClient(Boolean reuseHttpClient) {
|
||||
this.reuseHttpClient = reuseHttpClient;
|
||||
}
|
||||
|
||||
public void setMaxConnectionRetries(int maxConnectionRetries) {
|
||||
this.maxConnectionRetries = maxConnectionRetries;
|
||||
}
|
||||
|
||||
public void setAttemptsInterval(int attemptsInterval) {
|
||||
this.attemptsInterval = attemptsInterval;
|
||||
}
|
||||
|
||||
public OrganizationServiceStub getOnlineConnection(String discoveryServiceURL) throws Exception {
|
||||
return new OrganizationServiceStubWrapper(doGetOnlineConnection(discoveryServiceURL), this, discoveryServiceURL,
|
||||
maxConnectionRetries, attemptsInterval);
|
||||
public OrganizationServiceStub getOnlineConnection() throws Exception {
|
||||
return new OrganizationServiceStubWrapper(doGetOnlineConnection(), this, discoveryServiceURL,
|
||||
clientConfiguration.getMaxRetryTimes(), clientConfiguration.getIntervalTime());
|
||||
}
|
||||
|
||||
/**
|
||||
* URL for the Discovery Service For North America Microsoft account, discovery service url is
|
||||
* https://dev.crm.dynamics.com/XRMServices/2011/Discovery.svc Microsoft office 365, discovery service url is
|
||||
* https://disco.crm.dynamics.com/XRMServices/2011/Discovery.svc To use appropriate discovery service url for other
|
||||
* Organization information is stored in the Instance table of the Discovery Service. To see the kind of information contained in that table,
|
||||
* send an HTTP GET request to the service for one of your instances.
|
||||
* environments refer http://technet.microsoft.com/en-us/library/gg309401.aspx
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public OrganizationServiceStub doGetOnlineConnection(String discoveryServiceURL) throws Exception {
|
||||
public OrganizationServiceStub doGetOnlineConnection() throws Exception {
|
||||
|
||||
try {
|
||||
// Retrieve the authentication policy for the discovery service.
|
||||
OnlineAuthenticationPolicy discoveryPolicy = new OnlineAuthenticationPolicy(discoveryServiceURL + FlatWSDLSuffix);
|
||||
WsdlTokenManager discoeryTokenManager = new WsdlTokenManager();
|
||||
// Authenticate the user using the discovery authentication policy.
|
||||
SecurityData discoverySecurityData = discoeryTokenManager.authenticate(discoveryServiceURL, username, password,
|
||||
discoveryPolicy.getAppliesTo(), discoveryPolicy.getPolicy(), discoveryPolicy.getIssuerUri());
|
||||
// Retrieve discovery stub using organization URL with the security data.
|
||||
DiscoveryServiceStub discoveryServiceStub = createDiscoveryServiceStub(discoveryServiceURL, discoverySecurityData);
|
||||
// Retrieve organization service url using discovery stub.
|
||||
String orgUrl = discoverOrganizationUrl(discoveryServiceStub, orgName);
|
||||
// The discovery service stub cannot be reused against the organization service
|
||||
// as the Issuer and AppliesTo may differ between the discovery and organization services.
|
||||
// Retrieve the authentication policy for the organization service.
|
||||
OnlineAuthenticationPolicy organizationPolicy = new OnlineAuthenticationPolicy(orgUrl + FlatWSDLSuffix);
|
||||
WsdlTokenManager orgTokenManager = new WsdlTokenManager();
|
||||
// Authenticate the user using the organization authentication policy.
|
||||
SecurityData securityData = orgTokenManager.authenticate(orgUrl, username, password,
|
||||
organizationPolicy.getAppliesTo(), organizationPolicy.getPolicy(), organizationPolicy.getIssuerUri());
|
||||
String serviceURL = discoveryServiceURL;
|
||||
if(!discoveryServiceURL.contains("(")) {
|
||||
serviceURL = discoveryServiceURL+"(UniqueName='"+orgName+"')";
|
||||
}
|
||||
|
||||
String orgUrl = getOrgURL( serviceURL);
|
||||
// The discovery service stub cannot be reused against the organization service
|
||||
// as the Issuer and AppliesTo may differ between the discovery and organization services.
|
||||
// Retrieve the authentication policy for the organization service.
|
||||
OnlineAuthenticationPolicy organizationPolicy = new OnlineAuthenticationPolicy(orgUrl + FlatWSDLSuffix);
|
||||
WsdlTokenManager orgTokenManager = new WsdlTokenManager();
|
||||
// Authenticate the user using the organization authentication policy.
|
||||
SecurityData securityData = orgTokenManager.authenticate(orgUrl, clientConfiguration.getUserName(), clientConfiguration.getPassword(),
|
||||
organizationPolicy.getAppliesTo(), organizationPolicy.getPolicy(), organizationPolicy.getIssuerUri());
|
||||
|
||||
// Retrieve organization stub using organization URL with the security data.
|
||||
serviceStub = createOrganizationServiceStub(orgUrl, securityData);
|
||||
// Retrieve organization stub using organization URL with the security data.
|
||||
serviceStub = createOrganizationServiceStub(orgUrl, securityData);
|
||||
|
||||
Options options = serviceStub._getServiceClient().getOptions();
|
||||
if (reuseHttpClient != null) {
|
||||
options.setProperty(org.apache.axis2.transport.http.HTTPConstants.REUSE_HTTP_CLIENT, reuseHttpClient);
|
||||
}
|
||||
if (timeout != null) {
|
||||
options.setTimeOutInMilliSeconds(Long.valueOf(timeout));
|
||||
options.setProperty(org.apache.axis2.transport.http.HTTPConstants.SO_TIMEOUT, timeout);
|
||||
options.setProperty(org.apache.axis2.transport.http.HTTPConstants.CONNECTION_TIMEOUT, timeout);
|
||||
}
|
||||
|
||||
} catch (IDiscoveryService_Execute_DiscoveryServiceFaultFault_FaultMessage e) {
|
||||
throw new Exception(e.getFaultMessage().getDiscoveryServiceFault().getMessage());
|
||||
}
|
||||
Options options = serviceStub._getServiceClient().getOptions();
|
||||
|
||||
options.setProperty(org.apache.axis2.transport.http.HTTPConstants.REUSE_HTTP_CLIENT, clientConfiguration.isReuseHttpClient());
|
||||
options.setTimeOutInMilliSeconds(Long.valueOf(clientConfiguration.getTimeout()));
|
||||
options.setProperty(org.apache.axis2.transport.http.HTTPConstants.SO_TIMEOUT, clientConfiguration.getTimeout());
|
||||
options.setProperty(org.apache.axis2.transport.http.HTTPConstants.CONNECTION_TIMEOUT, clientConfiguration.getTimeout());
|
||||
return serviceStub;
|
||||
|
||||
}
|
||||
@@ -185,18 +182,6 @@ public class MSCRMClient {
|
||||
}
|
||||
}
|
||||
|
||||
private static DiscoveryServiceStub createDiscoveryServiceStub(String discoveryServiceURL, SecurityData securityData)
|
||||
throws RemoteException, XMLStreamException {
|
||||
try {
|
||||
DiscoveryServiceStub stub = new DiscoveryServiceStub(getConfigurationContext(), discoveryServiceURL);
|
||||
setServiceClientOptions(stub._getServiceClient(), securityData);
|
||||
return stub;
|
||||
} catch (RemoteException e) {
|
||||
logger.error(e.getMessage());
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
private static void setServiceClientOptions(ServiceClient sc, SecurityData securityData) throws AxisFault, XMLStreamException {
|
||||
Options options = sc.getOptions();
|
||||
|
||||
@@ -306,45 +291,6 @@ public class MSCRMClient {
|
||||
return ctx;
|
||||
}
|
||||
|
||||
private static String discoverOrganizationUrl(DiscoveryServiceStub serviceStub, String organizationUniqueName)
|
||||
throws RemoteException, IDiscoveryService_Execute_DiscoveryServiceFaultFault_FaultMessage {
|
||||
try {
|
||||
RetrieveOrganizationRequest request = RetrieveOrganizationRequest.Factory.newInstance();
|
||||
|
||||
request.setUniqueName(organizationUniqueName);
|
||||
|
||||
Execute exe = Execute.Factory.newInstance();
|
||||
exe.setRequest(request);
|
||||
|
||||
ExecuteDocument exeDoc = ExecuteDocument.Factory.newInstance();
|
||||
exeDoc.setExecute(exe);
|
||||
|
||||
ExecuteResponseDocument executeRespDoc = serviceStub.execute(exeDoc);
|
||||
ExecuteResponse executeResp = executeRespDoc.getExecuteResponse();
|
||||
|
||||
RetrieveOrganizationResponse result = (RetrieveOrganizationResponse) executeResp.getExecuteResult();
|
||||
|
||||
OrganizationDetail orgDetail = result.getDetail();
|
||||
|
||||
KeyValuePairOfEndpointTypestringztYlk6OT[] keyValuePairs = orgDetail.getEndpoints()
|
||||
.getKeyValuePairOfEndpointTypestringztYlk6OTArray();
|
||||
|
||||
for (KeyValuePairOfEndpointTypestringztYlk6OT keyValuePair : keyValuePairs) {
|
||||
|
||||
if (keyValuePair.getKey() == EndpointType.ORGANIZATION_SERVICE) {
|
||||
return keyValuePair.getValue();
|
||||
}
|
||||
}
|
||||
} catch (RemoteException e) {
|
||||
logger.error(e.getMessage());
|
||||
throw e;
|
||||
} catch (IDiscoveryService_Execute_DiscoveryServiceFaultFault_FaultMessage e) {
|
||||
logger.error(e.getMessage());
|
||||
throw e;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static HttpTransportProperties.ProxyProperties getProxyProperties() {
|
||||
String proxyHost = null;
|
||||
String proxyPort = null;
|
||||
@@ -370,5 +316,55 @@ public class MSCRMClient {
|
||||
}
|
||||
return proxyProps;
|
||||
}
|
||||
|
||||
private String getOrgURL(String discoveryServiceURL) throws ServiceUnavailableException {
|
||||
try {
|
||||
HttpGet request = new HttpGet(discoveryServiceURL);
|
||||
|
||||
// https://docs.microsoft.com/en-us/powerapps/developer/data-platform/webapi/discover-url-organization-web-api#authentication
|
||||
authStrategy.configureRequest(request);
|
||||
|
||||
try (CloseableHttpClient httpClient = HttpClients.createDefault();
|
||||
CloseableHttpResponse response = httpClient.execute(request)) {
|
||||
|
||||
int statusCode = response.getStatusLine().getStatusCode();
|
||||
if(statusCode != HttpStatus.SC_NO_CONTENT && statusCode != HttpStatus.SC_CREATED && statusCode != HttpStatus.SC_OK) {
|
||||
String message = null;
|
||||
if (statusCode == HttpStatus.SC_NOT_FOUND ) {
|
||||
message = "The organization '"+orgName+"' does not exist.";
|
||||
} else {
|
||||
message = response.getStatusLine().getReasonPhrase();
|
||||
}
|
||||
throw new HttpClientException(message);
|
||||
}
|
||||
|
||||
HttpEntity entity = response.getEntity();
|
||||
String orgUrl = null;
|
||||
if (entity != null) {
|
||||
String result = EntityUtils.toString(entity);
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
mapper.configure(MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES, true);
|
||||
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||
JsonNode tree = mapper.readTree(result);
|
||||
Iterator<JsonNode> iter = tree.path("value").elements();
|
||||
while (iter.hasNext()){
|
||||
JsonNode node = iter.next();
|
||||
Instance instance = mapper.readValue(node.toString(), Instance.class);
|
||||
// Should only return one instance.
|
||||
if(orgName.equals(instance.getUniqueName())) {
|
||||
orgUrl = instance.getApiUrl() + "/XRMServices/2011/Organization.svc";
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(orgUrl == null) {
|
||||
throw new HttpClientException("No organization available.");
|
||||
}
|
||||
return orgUrl;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new ServiceUnavailableException(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2019 Talend Inc. - www.talend.com
|
||||
// Copyright (C) 2006-2022 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
@@ -12,12 +12,14 @@
|
||||
// ============================================================================
|
||||
package org.talend.ms.crm.odata;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public final class ClientConfiguration {
|
||||
|
||||
/*
|
||||
* Implemented authentication strategies for OData/MS CRM.
|
||||
*/
|
||||
public static enum AuthStrategyEnum {NTLM, OAUTH};
|
||||
public static enum AuthStrategyEnum {NTLM, OAUTH, OAUTH_PREMISE};
|
||||
|
||||
/*
|
||||
* Kind of registered app on azure
|
||||
@@ -69,6 +71,16 @@ public final class ClientConfiguration {
|
||||
*/
|
||||
private String authoryEndpoint;
|
||||
|
||||
/*
|
||||
* The redirect URL
|
||||
*/
|
||||
private String redirectURL;
|
||||
|
||||
/*
|
||||
* The service API to retrieve the resource we ask for with oauth on-premise
|
||||
*/
|
||||
private String serviceAPI;
|
||||
|
||||
private int maxRetryTimes = 5;
|
||||
|
||||
/*
|
||||
@@ -87,6 +99,14 @@ public final class ClientConfiguration {
|
||||
private AppRegisteredType appRegisteredType = AppRegisteredType.NATIVE_APP;
|
||||
private WebAppPermission webAppPermission = WebAppPermission.DELEGATED;
|
||||
|
||||
/**
|
||||
* The oauth resource is deduced from the "Service root URL" if this value is null.
|
||||
*/
|
||||
private String forceResource;
|
||||
|
||||
private Map<String, String> headers;
|
||||
private boolean returnRepresentation = false;
|
||||
|
||||
|
||||
ClientConfiguration(AuthStrategyEnum authStrategy) {
|
||||
this.authStrategy = authStrategy;
|
||||
@@ -217,4 +237,44 @@ public final class ClientConfiguration {
|
||||
this.domain = domain;
|
||||
}
|
||||
|
||||
}
|
||||
public String getRedirectURL() {
|
||||
return redirectURL;
|
||||
}
|
||||
|
||||
public void setRedirectURL(String redirectURL) {
|
||||
this.redirectURL = redirectURL;
|
||||
}
|
||||
|
||||
public String getServiceAPI() {
|
||||
return serviceAPI;
|
||||
}
|
||||
|
||||
public void setServiceAPI(String serviceAPI) {
|
||||
this.serviceAPI = serviceAPI;
|
||||
}
|
||||
|
||||
public String getForceResource() {
|
||||
return forceResource;
|
||||
}
|
||||
|
||||
public void setForceResource(String forceResource) {
|
||||
this.forceResource = forceResource;
|
||||
}
|
||||
|
||||
public void setCustomHeaders(Map<String, String> headers){
|
||||
this.headers = headers;
|
||||
}
|
||||
|
||||
public Map<String, String> getCustomHeaders(){
|
||||
return this.headers;
|
||||
}
|
||||
|
||||
public boolean isReturnRepresentation() {
|
||||
return returnRepresentation;
|
||||
}
|
||||
|
||||
public void setReturnRepresentation(boolean returnRepresentation) {
|
||||
this.returnRepresentation = returnRepresentation;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2019 Talend Inc. - www.talend.com
|
||||
// Copyright (C) 2006-2022 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
@@ -16,13 +16,13 @@ import org.talend.ms.crm.odata.ClientConfiguration.AuthStrategyEnum;
|
||||
|
||||
/**
|
||||
* Generate the ClientConfiguration according to wanted authentication.
|
||||
*
|
||||
* <p>
|
||||
* Different authentications need different information.
|
||||
*/
|
||||
public class ClientConfigurationFactory {
|
||||
|
||||
public final static ClientConfiguration buildOAuthNativeClientConfiguration(String clientId, String userName, String password,
|
||||
String authoryEndpoint) {
|
||||
String authoryEndpoint) {
|
||||
ClientConfiguration clientConfiguration = new ClientConfiguration(AuthStrategyEnum.OAUTH);
|
||||
clientConfiguration.setAppRegisteredType(ClientConfiguration.AppRegisteredType.NATIVE_APP);
|
||||
clientConfiguration.setClientId(clientId);
|
||||
@@ -34,7 +34,7 @@ public class ClientConfigurationFactory {
|
||||
}
|
||||
|
||||
public final static ClientConfiguration buildOAuthWebClientConfiguration(String clientId, String clientSecret, String userName, String password,
|
||||
String authoryEndpoint, ClientConfiguration.WebAppPermission permission) {
|
||||
String authoryEndpoint, ClientConfiguration.WebAppPermission permission) {
|
||||
ClientConfiguration clientConfiguration = new ClientConfiguration(AuthStrategyEnum.OAUTH);
|
||||
clientConfiguration.setAppRegisteredType(ClientConfiguration.AppRegisteredType.WEB_APP);
|
||||
clientConfiguration.setWebAppPermission(permission);
|
||||
@@ -49,7 +49,7 @@ public class ClientConfigurationFactory {
|
||||
}
|
||||
|
||||
public final static ClientConfiguration buildNtlmClientConfiguration(String userName, String password, String workstation,
|
||||
String domain) {
|
||||
String domain) {
|
||||
ClientConfiguration clientConfiguration = new ClientConfiguration(AuthStrategyEnum.NTLM);
|
||||
clientConfiguration.setUserName(userName);
|
||||
clientConfiguration.setPassword(password);
|
||||
@@ -59,4 +59,19 @@ public class ClientConfigurationFactory {
|
||||
return clientConfiguration;
|
||||
}
|
||||
|
||||
public final static ClientConfiguration buildOAuthPremiseClientConfiguration(String userName, String password, String authoryEndpoint,
|
||||
String serviceAPI, String clientId, String clientSecret, String redirectUrl, String forcedResource) {
|
||||
ClientConfiguration clientConfiguration = new ClientConfiguration(AuthStrategyEnum.OAUTH_PREMISE);
|
||||
clientConfiguration.setUserName(userName);
|
||||
clientConfiguration.setPassword(password);
|
||||
clientConfiguration.setAuthoryEndpoint(authoryEndpoint);
|
||||
clientConfiguration.setClientId(clientId);
|
||||
clientConfiguration.setClientSecret(clientSecret);
|
||||
clientConfiguration.setRedirectURL(redirectUrl);
|
||||
clientConfiguration.setServiceAPI(serviceAPI);
|
||||
clientConfiguration.setForceResource(forcedResource);
|
||||
|
||||
return clientConfiguration;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2019 Talend Inc. - www.talend.com
|
||||
// Copyright (C) 2006-2022 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2019 Talend Inc. - www.talend.com
|
||||
// Copyright (C) 2006-2022 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
@@ -12,21 +12,9 @@
|
||||
// ============================================================================
|
||||
package org.talend.ms.crm.odata;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.Proxy;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import javax.naming.AuthenticationException;
|
||||
import javax.naming.ServiceUnavailableException;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.http.Header;
|
||||
import org.apache.http.HttpEntity;
|
||||
import org.apache.http.HttpHost;
|
||||
import org.apache.http.HttpResponse;
|
||||
@@ -44,6 +32,7 @@ import org.apache.http.params.HttpConnectionParams;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
import org.apache.olingo.client.api.ODataClient;
|
||||
import org.apache.olingo.client.api.communication.ODataClientErrorException;
|
||||
import org.apache.olingo.client.api.communication.request.retrieve.EdmMetadataRequest;
|
||||
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetIteratorRequest;
|
||||
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetRequest;
|
||||
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
|
||||
@@ -69,16 +58,33 @@ import org.talend.ms.crm.odata.httpclientfactory.DefaultHttpClientState;
|
||||
import org.talend.ms.crm.odata.httpclientfactory.IHttpClientFactoryObserver;
|
||||
import org.talend.ms.crm.odata.httpclientfactory.IHttpclientFactoryObservable;
|
||||
|
||||
import javax.naming.AuthenticationException;
|
||||
import javax.naming.ServiceUnavailableException;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.Proxy;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* Client for accessing Dynamics CRM Online using the Web API
|
||||
*
|
||||
*/
|
||||
public class DynamicsCRMClient implements IHttpClientFactoryObserver {
|
||||
|
||||
private static final String NAMESPAVE = "Microsoft.Dynamics.CRM";
|
||||
private static final String LOOKUP_NAME_PREFIX = "_";
|
||||
private static final String LOOKUP_NAME_SUFFIX = "_value";
|
||||
private static final int LOOKUP_NAME_MINSIZE = LOOKUP_NAME_PREFIX.length()+LOOKUP_NAME_SUFFIX.length();
|
||||
private static final String LOOKUP_NAME_PREFIX = "_";
|
||||
private static final String LOOKUP_NAME_SUFFIX = "_value";
|
||||
private static final int LOOKUP_NAME_MINSIZE = LOOKUP_NAME_PREFIX.length() + LOOKUP_NAME_SUFFIX.length();
|
||||
|
||||
private ClientConfiguration clientConfiguration;
|
||||
|
||||
@@ -101,7 +107,7 @@ public class DynamicsCRMClient implements IHttpClientFactoryObserver {
|
||||
|
||||
/**
|
||||
* A list which contains all navigation links to set to null.
|
||||
*
|
||||
* <p>
|
||||
* A distinct delete command must be sent to set a navigation property to null. It can't be done in the same
|
||||
* time that the entity update.
|
||||
*/
|
||||
@@ -152,10 +158,26 @@ public class DynamicsCRMClient implements IHttpClientFactoryObserver {
|
||||
return odataClient;
|
||||
}
|
||||
|
||||
private void addCustomHeaders(ODataEntitySetRequest<ClientEntitySet> request) {
|
||||
if (this.clientConfiguration.getCustomHeaders() == null) {
|
||||
return;
|
||||
}
|
||||
this.clientConfiguration.getCustomHeaders().entrySet().stream().forEach(e -> request.addCustomHeader(e.getKey(), e.getValue()));
|
||||
}
|
||||
|
||||
private void addCustomHeader(HttpRequestBase request) {
|
||||
if (this.clientConfiguration.getCustomHeaders() != null) {
|
||||
this.clientConfiguration.getCustomHeaders().entrySet().stream().forEach(e -> request.addHeader(e.getKey(), e.getValue()));
|
||||
}
|
||||
|
||||
if (this.clientConfiguration.isReturnRepresentation()) {
|
||||
request.addHeader("Prefer", "return=representation");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create EntitySet Iterator request
|
||||
*
|
||||
* @param entirySet entirySet the EntitySet name which you want to retrieve records
|
||||
* @param queryOption
|
||||
* @return EntitySet iterator request
|
||||
*/
|
||||
@@ -164,6 +186,7 @@ public class DynamicsCRMClient implements IHttpClientFactoryObserver {
|
||||
if (queryOption.getReturnEntityProperties() != null) {
|
||||
uriBuilder.select(queryOption.getReturnEntityProperties());
|
||||
}
|
||||
|
||||
if (queryOption.getTop() > 0) {
|
||||
uriBuilder.top(queryOption.getTop());
|
||||
}
|
||||
@@ -173,21 +196,68 @@ public class DynamicsCRMClient implements IHttpClientFactoryObserver {
|
||||
if (!StringUtils.isEmpty(queryOption.getFilter())) {
|
||||
uriBuilder.filter(queryOption.getFilter());
|
||||
}
|
||||
final List<String> expands = queryOption.getExpands();
|
||||
if (expands.size() > 0) {
|
||||
String[] expandArray = new String[expands.size()];
|
||||
uriBuilder.expand(expands.toArray(expandArray));
|
||||
}
|
||||
|
||||
ODataEntitySetRequest<ClientEntitySet> request = odataClient.getRetrieveRequestFactory()
|
||||
.getEntitySetRequest(uriBuilder.build());
|
||||
|
||||
this.authStrategy.configureRequest(request);
|
||||
|
||||
if (expands.size() > 0) {
|
||||
// odata-metadata=full set by olingo generates issue when expand entities
|
||||
request.addCustomHeader("Accept", "application/json;odata-metadata=minimal");
|
||||
}
|
||||
|
||||
addCustomHeaders(request);
|
||||
|
||||
return request;
|
||||
}
|
||||
|
||||
public EdmMetadataRequest createMetadataRetrieveRequest() {
|
||||
EdmMetadataRequest request = odataClient.getRetrieveRequestFactory()
|
||||
.getMetadataRequest(serviceRootURL);
|
||||
this.authStrategy.configureRequest(request);
|
||||
return request;
|
||||
}
|
||||
|
||||
public ODataEntitySetRequest<ClientEntitySet> createEntitySetRetrieveRequest() {
|
||||
URIBuilder uriBuilder = odataClient.newURIBuilder(serviceRootURL).appendEntitySetSegment("EntityDefinitions").select("EntitySetName,LogicalName");
|
||||
ODataEntitySetRequest<ClientEntitySet> entitySetRequest = odataClient.getRetrieveRequestFactory().getEntitySetRequest(uriBuilder.build());
|
||||
this.authStrategy.configureRequest(entitySetRequest);
|
||||
|
||||
addCustomHeaders(entitySetRequest);
|
||||
|
||||
return entitySetRequest;
|
||||
}
|
||||
|
||||
public ODataEntitySetRequest<ClientEntitySet> createEndpointsNamesRequest() {
|
||||
URIBuilder uriBuilder = odataClient.newURIBuilder(serviceRootURL);
|
||||
ODataEntitySetRequest<ClientEntitySet> entitySetRequest = odataClient.getRetrieveRequestFactory().getEntitySetRequest(uriBuilder.build());
|
||||
this.authStrategy.configureRequest(entitySetRequest);
|
||||
|
||||
addCustomHeaders(entitySetRequest);
|
||||
|
||||
return entitySetRequest;
|
||||
}
|
||||
|
||||
public ODataEntitySetRequest<ClientEntitySet> createRequest(URIBuilder uriBuilder) {
|
||||
ODataEntitySetRequest<ClientEntitySet> entitySetRequest = odataClient.getRetrieveRequestFactory().getEntitySetRequest(uriBuilder.build());
|
||||
this.authStrategy.configureRequest(entitySetRequest);
|
||||
|
||||
addCustomHeaders(entitySetRequest);
|
||||
|
||||
return entitySetRequest;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve records from EntitySet
|
||||
*
|
||||
* @param entitySet the EntitySet name which you want to retrieve records
|
||||
* @param queryOption
|
||||
* @return the entity set iterator object
|
||||
*
|
||||
* @throws ServiceUnavailableException
|
||||
*/
|
||||
public ClientEntitySet retrieveEntities(QueryOptionConfig queryOption) throws AuthenticationException {
|
||||
@@ -218,12 +288,10 @@ public class DynamicsCRMClient implements IHttpClientFactoryObserver {
|
||||
/**
|
||||
* Create entity
|
||||
*
|
||||
* @param entitySet entitySet the EntitySet name which you want to create record
|
||||
* @param entity provided content for create
|
||||
*
|
||||
* @throws ServiceUnavailableException
|
||||
*/
|
||||
public HttpResponse insertEntity(ClientEntity entity) throws ServiceUnavailableException {
|
||||
public CreateUpdateResult insertEntity(ClientEntity entity) throws ServiceUnavailableException {
|
||||
URIBuilder insertURIBuilder = odataClient.newURIBuilder(serviceRootURL).appendEntitySetSegment(entitySet);
|
||||
HttpEntity httpEntity = convertToHttpEntity(entity);
|
||||
return createAndExecuteRequest(insertURIBuilder.build(), httpEntity, HttpMethod.POST);
|
||||
@@ -233,27 +301,49 @@ public class DynamicsCRMClient implements IHttpClientFactoryObserver {
|
||||
* Update entity with provided content.
|
||||
* The PATCH method is used, so only given properties are updated.
|
||||
* Navigation link properties that must be set to null are updated by another DELETE calls.
|
||||
* Navigation link properties are saved during {@link #addEntityNavigationLink(ClientEntity, String, String, String, boolean, boolean)}
|
||||
* method call
|
||||
*
|
||||
* @param entity The payload containing properties to update
|
||||
* @param entity The payload containing properties to update
|
||||
* @param keySegment The id of the entity to update
|
||||
* @throws ServiceUnavailableException
|
||||
* @deprecated use {@link #updateEntity(ClientEntity, String, List)} instead with a list of navigation links list instead;
|
||||
*/
|
||||
@Deprecated
|
||||
public CreateUpdateResult updateEntity(ClientEntity entity, String keySegment) throws ServiceUnavailableException {
|
||||
CreateUpdateResult result = updateEntity(entity, keySegment, this.navigationLinksToNull);
|
||||
this.navigationLinksToNull.clear();
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update entity with provided content.
|
||||
* The PATCH method is used, so only given properties are updated.
|
||||
* Navigation link properties that must be set to null are updated by another DELETE calls.
|
||||
*
|
||||
* @param entity The payload containing properties to update
|
||||
* @param keySegment The id of the entity to update
|
||||
* @param navigationLinksToDelete list of navigation link names to delete
|
||||
* @throws ServiceUnavailableException
|
||||
*/
|
||||
public HttpResponse updateEntity(ClientEntity entity, String keySegment) throws ServiceUnavailableException {
|
||||
public CreateUpdateResult updateEntity(ClientEntity entity, String keySegment, List<String> navigationLinksToDelete) throws ServiceUnavailableException {
|
||||
URIBuilder updateURIBuilder = odataClient.newURIBuilder(serviceRootURL).appendEntitySetSegment(entitySet)
|
||||
.appendKeySegment(UUID.fromString(keySegment));
|
||||
HttpEntity httpEntity = convertToHttpEntity(entity);
|
||||
HttpResponse updateHttpResponse = createAndExecuteRequest(updateURIBuilder.build(), httpEntity, HttpMethod.PATCH);
|
||||
CreateUpdateResult result = createAndExecuteRequest(updateURIBuilder.build(), httpEntity, HttpMethod.PATCH);
|
||||
|
||||
// No need to test the updateHttpResponse code since it is returned only if it's a success.
|
||||
// The deletion of navigation links will be done only if the previous update doesn't throw an exception.
|
||||
this.deleteNavigationLinksToNull(keySegment);
|
||||
this.deleteNavigationLinksToNull(keySegment, navigationLinksToDelete);
|
||||
|
||||
return updateHttpResponse;
|
||||
return result;
|
||||
}
|
||||
|
||||
protected void deleteNavigationLinksToNull(String keySegment) throws ServiceUnavailableException {
|
||||
for(String navigationLinkName : this.navigationLinksToNull){
|
||||
protected void deleteNavigationLinksToNull(String keySegment, List<String> navigationLinksToNull) throws ServiceUnavailableException {
|
||||
if (navigationLinksToNull == null || navigationLinksToNull.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
for (String navigationLinkName : navigationLinksToNull) {
|
||||
this.deleteNavigationLink(navigationLinkName, keySegment);
|
||||
}
|
||||
}
|
||||
@@ -261,16 +351,14 @@ public class DynamicsCRMClient implements IHttpClientFactoryObserver {
|
||||
/**
|
||||
* Deleted entity by key
|
||||
*
|
||||
* @param entitySet entitySet the EntitySet name which you want to delete records
|
||||
* @param keySegment Entity key segment
|
||||
*
|
||||
* @throws ServiceUnavailableException
|
||||
*/
|
||||
public HttpResponse deleteEntity(String keySegment) throws ServiceUnavailableException {
|
||||
URIBuilder deleteURIBuilder = odataClient.newURIBuilder(serviceRootURL).appendEntitySetSegment(entitySet)
|
||||
.appendKeySegment(UUID.fromString(keySegment));
|
||||
|
||||
return createAndExecuteRequest(deleteURIBuilder.build(), null, HttpMethod.DELETE);
|
||||
return createAndExecuteRequest(deleteURIBuilder.build(), null, HttpMethod.DELETE).getResponse();
|
||||
}
|
||||
|
||||
|
||||
@@ -279,17 +367,17 @@ public class DynamicsCRMClient implements IHttpClientFactoryObserver {
|
||||
* Jira : TDI-39571
|
||||
*
|
||||
* @param navigationLinkName The navigation link name (not the _name_value generated lookup property)
|
||||
* @param keySegment The keysegment(id) of the main property
|
||||
* @param keySegment The keysegment(id) of the main property
|
||||
* @return The Http response.
|
||||
* @throws ServiceUnavailableException
|
||||
*/
|
||||
public HttpResponse deleteNavigationLink(String navigationLinkName, String keySegment) throws ServiceUnavailableException {
|
||||
URIBuilder deleteNavLinkURIBuilder = odataClient.newURIBuilder(serviceRootURL)
|
||||
.appendEntitySetSegment(entitySet)
|
||||
.appendKeySegment(UUID.fromString(keySegment))
|
||||
.appendNavigationSegment(navigationLinkName).appendRefSegment();
|
||||
.appendEntitySetSegment(entitySet)
|
||||
.appendKeySegment(UUID.fromString(keySegment))
|
||||
.appendNavigationSegment(navigationLinkName).appendRefSegment();
|
||||
|
||||
return createAndExecuteRequest(deleteNavLinkURIBuilder.build(), null, HttpMethod.DELETE);
|
||||
return createAndExecuteRequest(deleteNavLinkURIBuilder.build(), null, HttpMethod.DELETE).getResponse();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -349,24 +437,24 @@ public class DynamicsCRMClient implements IHttpClientFactoryObserver {
|
||||
*
|
||||
* @param entityType
|
||||
*/
|
||||
public void setEntityType(String entityType){
|
||||
public void setEntityType(String entityType) {
|
||||
this.entityType = entityType;
|
||||
}
|
||||
|
||||
public void addEntityNavigationLink(ClientEntity entity, String lookupEntitySet, String lookupName,
|
||||
String linkedEntityId, boolean emptyLookupIntoNull, boolean ignoreNull) {
|
||||
String linkedEntityId, boolean emptyLookupIntoNull, boolean ignoreNull) {
|
||||
|
||||
// To help the final user since lookup names '_name_value' are available in the schema
|
||||
// But it's the navigation link that can be updated.
|
||||
String navigationLinkName = this.extractNavigationLinkName(lookupName);
|
||||
|
||||
// If value is empty and emptyLookupIntoNull, then set the value to null to unlink the navigation (set to null)
|
||||
if(emptyLookupIntoNull && linkedEntityId != null && linkedEntityId.isEmpty()){
|
||||
if (emptyLookupIntoNull && linkedEntityId != null && linkedEntityId.isEmpty()) {
|
||||
linkedEntityId = null;
|
||||
}
|
||||
|
||||
// If ignore null is set and the value is null, then don't update/delete this navigation link
|
||||
if(ignoreNull && linkedEntityId == null){
|
||||
if (ignoreNull && linkedEntityId == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -377,14 +465,50 @@ public class DynamicsCRMClient implements IHttpClientFactoryObserver {
|
||||
} catch (URISyntaxException e) {
|
||||
throw new HttpClientException(e);
|
||||
}
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
// Retains all navigation links to delete (set to null)
|
||||
navigationLinksToNull.add(navigationLinkName);
|
||||
}
|
||||
}
|
||||
|
||||
public int getNbNavigationLinkToRemove(){
|
||||
/**
|
||||
* Try to add navigation link to entity.
|
||||
*
|
||||
* @param navigationLinkName extracted navigation link(see {@link #extractNavigationLinkName(String)})
|
||||
* @param entity to be updated
|
||||
* @param lookupEntitySet entity set referred by navigation link
|
||||
* @param linkedEntityId id of the referred entity
|
||||
* @param emptyLookupIntoNull if empty lookup values should be converted to null values
|
||||
* @param ignoreNull if null values should be skipped
|
||||
* @return true if the link was added or skipped, false if it should be deleted with a separate call.
|
||||
*/
|
||||
public boolean addOrSkipEntityNavigationLink(ClientEntity entity, String lookupEntitySet, String navigationLinkName,
|
||||
String linkedEntityId, boolean emptyLookupIntoNull, boolean ignoreNull) {
|
||||
// If value is empty and emptyLookupIntoNull, then set the value to null to unlink the navigation (set to null)
|
||||
if (emptyLookupIntoNull && linkedEntityId != null && linkedEntityId.isEmpty()) {
|
||||
linkedEntityId = null;
|
||||
}
|
||||
|
||||
// If ignore null is set and the value is null, then don't update/delete this navigation link
|
||||
if (ignoreNull && linkedEntityId == null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (linkedEntityId != null) {
|
||||
try {
|
||||
entity.getNavigationLinks().add(odataClient.getObjectFactory().newEntityNavigationLink(navigationLinkName,
|
||||
new URI(lookupEntitySet + "(" + linkedEntityId + ")")));
|
||||
} catch (URISyntaxException e) {
|
||||
throw new HttpClientException(e);
|
||||
}
|
||||
} else {
|
||||
// Retains all navigation links to delete (set to null)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public int getNbNavigationLinkToRemove() {
|
||||
return navigationLinksToNull.size();
|
||||
}
|
||||
|
||||
@@ -397,20 +521,20 @@ public class DynamicsCRMClient implements IHttpClientFactoryObserver {
|
||||
* @param lookupName The auto-generated lookup name
|
||||
* @return The extracted navigation link name or the lookup name if it can't be extracted.
|
||||
*/
|
||||
public String extractNavigationLinkName(String lookupName){
|
||||
public String extractNavigationLinkName(String lookupName) {
|
||||
final int nameSize = lookupName.length();
|
||||
if(nameSize <= LOOKUP_NAME_MINSIZE){
|
||||
if (nameSize <= LOOKUP_NAME_MINSIZE) {
|
||||
return lookupName;
|
||||
}
|
||||
|
||||
String pref = lookupName.substring(0, LOOKUP_NAME_PREFIX.length());
|
||||
if(!pref.equals(LOOKUP_NAME_PREFIX)){
|
||||
if (!pref.equals(LOOKUP_NAME_PREFIX)) {
|
||||
return lookupName;
|
||||
}
|
||||
|
||||
final int endName = nameSize - LOOKUP_NAME_SUFFIX.length();
|
||||
String suff = lookupName.substring(endName, nameSize);
|
||||
if(!suff.equals(LOOKUP_NAME_SUFFIX)){
|
||||
if (!suff.equals(LOOKUP_NAME_SUFFIX)) {
|
||||
return lookupName;
|
||||
}
|
||||
|
||||
@@ -421,7 +545,6 @@ public class DynamicsCRMClient implements IHttpClientFactoryObserver {
|
||||
* Convert OData entity to HttpEntity type
|
||||
*
|
||||
* @param entity OData entity.
|
||||
*
|
||||
* @return An entity that can be sent or received with an HTTP message.
|
||||
* @throws
|
||||
*/
|
||||
@@ -446,15 +569,14 @@ public class DynamicsCRMClient implements IHttpClientFactoryObserver {
|
||||
/**
|
||||
* Created and executes a request
|
||||
*
|
||||
* @param uri the request URI
|
||||
* @param uri the request URI
|
||||
* @param httpEntity the entity to send.
|
||||
* @param method HTTP method
|
||||
*
|
||||
* @param method HTTP method
|
||||
* @return the response to the request.
|
||||
* @throws ServiceUnavailableException
|
||||
*/
|
||||
|
||||
protected HttpResponse createAndExecuteRequest(URI uri, HttpEntity httpEntity, HttpMethod method)
|
||||
protected CreateUpdateResult createAndExecuteRequest(URI uri, HttpEntity httpEntity, HttpMethod method)
|
||||
throws ServiceUnavailableException {
|
||||
|
||||
boolean hasRetried = false;
|
||||
@@ -476,11 +598,31 @@ public class DynamicsCRMClient implements IHttpClientFactoryObserver {
|
||||
if (request instanceof HttpEntityEnclosingRequestBase) {
|
||||
((HttpEntityEnclosingRequestBase) request).setEntity(httpEntity);
|
||||
}
|
||||
|
||||
addCustomHeader(request);
|
||||
|
||||
CreateUpdateResult result = new CreateUpdateResult();
|
||||
HttpResponse response = httpClientState.getHttpClient().execute(request);
|
||||
result.setResponse(response);
|
||||
|
||||
if (isResponseSuccess(response.getStatusLine().getStatusCode())) {
|
||||
if (this.clientConfiguration.isReturnRepresentation()) {
|
||||
final HttpEntity entity = response.getEntity();
|
||||
if (entity != null && entity.isStreaming()) {
|
||||
try(InputStream instream = entity.getContent()) {
|
||||
String e = new BufferedReader(new InputStreamReader(instream))
|
||||
.lines().collect(Collectors.joining("\n"));
|
||||
result.setEntity(e);
|
||||
if (instream != null) {
|
||||
instream.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
EntityUtils.consume(response.getEntity());
|
||||
}
|
||||
request.releaseConnection();
|
||||
EntityUtils.consume(response.getEntity());
|
||||
return response;
|
||||
return result;
|
||||
} else {
|
||||
if (response.getStatusLine().getStatusCode() == HttpStatus.SC_UNAUTHORIZED && !hasRetried) {
|
||||
this.authStrategy.refreshAuth();
|
||||
@@ -509,7 +651,6 @@ public class DynamicsCRMClient implements IHttpClientFactoryObserver {
|
||||
* 201 create/update/delete entity success with return (not used in our component at present)
|
||||
*
|
||||
* @param statusCode HTTP status code
|
||||
*
|
||||
* @return success or not(true or false)
|
||||
*/
|
||||
public boolean isResponseSuccess(int statusCode) {
|
||||
@@ -542,4 +683,30 @@ public class DynamicsCRMClient implements IHttpClientFactoryObserver {
|
||||
|
||||
}
|
||||
|
||||
public final static class CreateUpdateResult {
|
||||
|
||||
private HttpResponse response;
|
||||
private String entity;
|
||||
|
||||
public HttpResponse getResponse() {
|
||||
return response;
|
||||
}
|
||||
|
||||
public void setResponse(HttpResponse response) {
|
||||
this.response = response;
|
||||
}
|
||||
|
||||
public String getEntity() {
|
||||
return entity;
|
||||
}
|
||||
|
||||
public void setEntity(String entity) {
|
||||
this.entity = entity;
|
||||
}
|
||||
|
||||
public boolean hasEntity() {
|
||||
return this.entity != null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2019 Talend Inc. - www.talend.com
|
||||
// Copyright (C) 2006-2022 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2019 Talend Inc. - www.talend.com
|
||||
// Copyright (C) 2006-2022 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
package org.talend.ms.crm.odata;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class QueryExpandUtil {
|
||||
|
||||
public static List<String> getExpandConfig(List<String> fields, List<String> params) {
|
||||
if (fields == null || params == null || fields.size() != params.size()) {
|
||||
throw new IllegalArgumentException(
|
||||
"Please make sure list of expands fields and params are not null and their size are same.");
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(fields.size() <= 0){
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
List<String> expands = new ArrayList<>();
|
||||
for(int i=0; i< fields.size(); i++){
|
||||
String name = fields.get(i);
|
||||
if("".equals(name.trim())){
|
||||
continue;
|
||||
}
|
||||
|
||||
name = getSanitizedName(name);
|
||||
StringBuilder sb = new StringBuilder(name);
|
||||
final String param = params.get(i);
|
||||
if(!"".equals(param.trim())){
|
||||
sb.append('(');
|
||||
sb.append(param);
|
||||
sb.append(')');
|
||||
}
|
||||
expands.add(sb.toString());
|
||||
}
|
||||
|
||||
return expands;
|
||||
}
|
||||
|
||||
/**
|
||||
* expandable attrribute name are _entityid_value, should be transformed to entityid.
|
||||
* @param name
|
||||
* @return
|
||||
*/
|
||||
public static String getSanitizedName(final String name){
|
||||
String sanitized = ('_' == name.charAt(0)) ? name.substring(1) : name;
|
||||
sanitized = (sanitized.endsWith("_value")) ? sanitized.substring(0, sanitized.length() - 6): sanitized;
|
||||
|
||||
return sanitized;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2019 Talend Inc. - www.talend.com
|
||||
// Copyright (C) 2006-2022 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
@@ -12,6 +12,9 @@
|
||||
// ============================================================================
|
||||
package org.talend.ms.crm.odata;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class QueryOptionConfig {
|
||||
|
||||
private int top = -1;
|
||||
@@ -24,6 +27,9 @@ public class QueryOptionConfig {
|
||||
|
||||
private String filter;
|
||||
|
||||
private List<String> expand = new ArrayList<>();
|
||||
|
||||
|
||||
public int getTop() {
|
||||
return top;
|
||||
}
|
||||
@@ -64,4 +70,8 @@ public class QueryOptionConfig {
|
||||
this.filter = filter;
|
||||
}
|
||||
|
||||
public void setExpands(List<String> expand) { this.expand = expand;}
|
||||
|
||||
public List<String> getExpands() { return this.expand; }
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2019 Talend Inc. - www.talend.com
|
||||
// Copyright (C) 2006-2022 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
@@ -12,13 +12,11 @@
|
||||
// ============================================================================
|
||||
package org.talend.ms.crm.odata.authentication;
|
||||
|
||||
import javax.naming.AuthenticationException;
|
||||
|
||||
import org.talend.ms.crm.odata.ClientConfiguration;
|
||||
|
||||
/**
|
||||
* Factory for OData authentication strategies.
|
||||
*
|
||||
* <p>
|
||||
* No need to use singleton pattern since no implementation/extends, static is enough.
|
||||
*/
|
||||
public final class AuthStrategyFactory {
|
||||
@@ -26,15 +24,18 @@ public final class AuthStrategyFactory {
|
||||
private AuthStrategyFactory() {
|
||||
}
|
||||
|
||||
public final static IAuthStrategy createAuthStrategy(ClientConfiguration conf) {
|
||||
public static IAuthStrategy createAuthStrategy(ClientConfiguration conf) {
|
||||
IAuthStrategy authStrategy = null;
|
||||
switch (conf.getAuthStrategy()) {
|
||||
case OAUTH:
|
||||
authStrategy = new OAuthStrategyImpl(conf);
|
||||
break;
|
||||
case NTLM:
|
||||
authStrategy = new NTLMStrategyImpl(conf);
|
||||
break;
|
||||
case OAUTH:
|
||||
authStrategy = new OAuthStrategyImpl(conf);
|
||||
break;
|
||||
case NTLM:
|
||||
authStrategy = new NTLMStrategyImpl(conf);
|
||||
break;
|
||||
case OAUTH_PREMISE:
|
||||
authStrategy = new OAuthPremiseStrategyImpl(conf);
|
||||
break;
|
||||
}
|
||||
|
||||
return authStrategy;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2019 Talend Inc. - www.talend.com
|
||||
// Copyright (C) 2006-2022 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
@@ -31,7 +31,7 @@ public interface IAuthStrategy {
|
||||
* Called when DynamicsCRMClient is instanciated.
|
||||
*
|
||||
*/
|
||||
public void init() throws AuthenticationException;
|
||||
void init() throws AuthenticationException;
|
||||
|
||||
/**
|
||||
* Retrieve the HttpClientFactory.
|
||||
@@ -41,21 +41,21 @@ public interface IAuthStrategy {
|
||||
* Called when DynamicsCRMClient is instanciated.
|
||||
*
|
||||
*/
|
||||
public IHttpclientFactoryObservable getHttpClientFactory() throws AuthenticationException;
|
||||
IHttpclientFactoryObservable getHttpClientFactory() throws AuthenticationException;
|
||||
|
||||
/**
|
||||
* Refresh Authentication if needed.
|
||||
*/
|
||||
public void refreshAuth() throws AuthenticationException;
|
||||
void refreshAuth() throws AuthenticationException;
|
||||
|
||||
/**
|
||||
* Configure request generated by odataClient.getRetrieveRequestFactory().
|
||||
*/
|
||||
public void configureRequest(ODataRequest request);
|
||||
void configureRequest(ODataRequest request);
|
||||
|
||||
/**
|
||||
* Configure request HttpRequestBase with POST/PATCH/DELETE method.
|
||||
*/
|
||||
public void configureRequest(HttpRequestBase request);
|
||||
void configureRequest(HttpRequestBase request);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2019 Talend Inc. - www.talend.com
|
||||
// Copyright (C) 2006-2022 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
|
||||
@@ -0,0 +1,208 @@
|
||||
package org.talend.ms.crm.odata.authentication;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonIOException;
|
||||
import com.google.gson.JsonSyntaxException;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import org.apache.http.client.methods.HttpRequestBase;
|
||||
import org.apache.olingo.client.api.communication.request.ODataRequest;
|
||||
import org.apache.olingo.commons.api.http.HttpHeader;
|
||||
import org.talend.ms.crm.odata.ClientConfiguration;
|
||||
import org.talend.ms.crm.odata.authentication.httpclienthelper.HttpClient;
|
||||
import org.talend.ms.crm.odata.authentication.httpclienthelper.HttpResponse;
|
||||
import org.talend.ms.crm.odata.authentication.httpclienthelper.RequestHttpContext;
|
||||
import org.talend.ms.crm.odata.authentication.httpclienthelper.Token;
|
||||
import org.talend.ms.crm.odata.httpclientfactory.IHttpclientFactoryObservable;
|
||||
import org.talend.ms.crm.odata.httpclientfactory.OAuthHttpClientFactory;
|
||||
|
||||
import javax.naming.AuthenticationException;
|
||||
import java.io.IOException;
|
||||
import java.io.StringReader;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
public class OAuthPremiseStrategyImpl implements IAuthStrategy {
|
||||
|
||||
private final static int MAX_REDIRECT_AUTH_CODE = 3;
|
||||
|
||||
private final ClientConfiguration conf;
|
||||
|
||||
private Token token;
|
||||
private OAuthHttpClientFactory httpClientFactory;
|
||||
|
||||
|
||||
OAuthPremiseStrategyImpl(ClientConfiguration conf) {
|
||||
this.conf = conf;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() throws AuthenticationException {
|
||||
oauthFlow();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IHttpclientFactoryObservable getHttpClientFactory() throws AuthenticationException {
|
||||
oauthFlow();
|
||||
|
||||
if (httpClientFactory == null) {
|
||||
httpClientFactory = new OAuthHttpClientFactory(this.conf);
|
||||
}
|
||||
|
||||
return httpClientFactory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void refreshAuth() throws AuthenticationException {
|
||||
oauthFlow();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void configureRequest(ODataRequest request) {
|
||||
request.addCustomHeader(HttpHeader.AUTHORIZATION, "Bearer " + token.getAccess_token());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void configureRequest(HttpRequestBase request) {
|
||||
request.addHeader(HttpHeader.AUTHORIZATION, "Bearer " + token.getAccess_token());
|
||||
}
|
||||
|
||||
private void oauthFlow() throws AuthenticationException {
|
||||
int retry = 0;
|
||||
|
||||
while (true) {
|
||||
retry++;
|
||||
try {
|
||||
|
||||
final Optional<String> code = retrieveAuthorizationCode();
|
||||
if (code.isPresent()) {
|
||||
final String sCode = code.get();
|
||||
final Optional<Token> token = retrieveToken(sCode);
|
||||
if (token.isPresent()) {
|
||||
this.token = token.get();
|
||||
break;
|
||||
} else {
|
||||
throw new IllegalArgumentException("Can't retrieve oauth token, but no exception has been raised.");
|
||||
}
|
||||
} else {
|
||||
throw new IllegalArgumentException("Can't retrieve authorization code, but no exception has been raised.");
|
||||
}
|
||||
|
||||
} catch (IOException | InterruptedException | IllegalArgumentException e) {
|
||||
if (retry < conf.getMaxRetryTimes()) {
|
||||
try {
|
||||
Thread.sleep(conf.getIntervalTime());
|
||||
} catch (InterruptedException e1) {
|
||||
// ignore
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
throw new AuthenticationException("Can't retrieve ms crm oauth token after '" + retry + "' retries : " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Token json2Token(String json) throws JsonIOException, JsonSyntaxException {
|
||||
Gson gson = new Gson();
|
||||
JsonReader jsr = new JsonReader(new StringReader(json));
|
||||
return gson.fromJson(jsr, Token.class);
|
||||
}
|
||||
|
||||
private String getResource() throws MalformedURLException {
|
||||
if(conf.getForceResource() != null && !"".equals(conf.getForceResource().trim())){
|
||||
return conf.getForceResource();
|
||||
}
|
||||
|
||||
URL url = new URL(conf.getServiceAPI());
|
||||
final int port = url.getPort();
|
||||
StringBuilder sp = new StringBuilder();
|
||||
if (port > -1) {
|
||||
sp.append(":").append(port);
|
||||
}
|
||||
return url.getProtocol() + "://" + url.getHost() + sp.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* To compute token url, change last segment by token.
|
||||
* @return
|
||||
*/
|
||||
private String computeTokenUrl(String url){
|
||||
while(url.endsWith("/")) {
|
||||
url = url.substring(0, url.length() - 1);
|
||||
}
|
||||
String token = url.substring(0, url.lastIndexOf('/')) + "/token";
|
||||
return token;
|
||||
}
|
||||
|
||||
private Optional<Token> retrieveToken(String code) throws IOException, InterruptedException, IllegalArgumentException {
|
||||
Map<String, String> body = new HashMap<>();
|
||||
body.put("grant_type", "authorization_code");
|
||||
body.put("code", code);
|
||||
body.put("redirect_uri", conf.getRedirectURL());
|
||||
body.put("client_id", conf.getClientId());
|
||||
|
||||
if(conf.getClientSecret() != null && !"".equals(conf.getClientSecret().trim())){
|
||||
body.put("client_secret", conf.getClientSecret());
|
||||
}
|
||||
|
||||
RequestHttpContext queryContext = new RequestHttpContext("POST",
|
||||
computeTokenUrl(conf.getAuthoryEndpoint()),
|
||||
Collections.emptyMap(),
|
||||
new HashMap<>(),
|
||||
true,
|
||||
conf.getTimeout() * 1000,
|
||||
conf.getTimeout() * 1000);
|
||||
|
||||
queryContext.setBodyContent(body);
|
||||
|
||||
HttpClient client = new HttpClient(queryContext);
|
||||
|
||||
// Redirect are followed by the java http client
|
||||
final HttpResponse call = client.call(new AtomicInteger(-1), e -> true);
|
||||
|
||||
Token token = null;
|
||||
try {
|
||||
token = json2Token(call.getBody());
|
||||
}
|
||||
catch (JsonIOException | JsonSyntaxException e){
|
||||
throw new IllegalArgumentException("Can't parse retrieve ms crm oauth token : " + e.getMessage(), e);
|
||||
}
|
||||
return Optional.ofNullable(token);
|
||||
}
|
||||
|
||||
private Optional<String> retrieveAuthorizationCode() throws IOException, InterruptedException {
|
||||
Map<String, String> params = new HashMap();
|
||||
params.put("resource", getResource());
|
||||
params.put("response_type", "code");
|
||||
params.put("state", "");
|
||||
params.put("client_id", conf.getClientId());
|
||||
params.put("scope", "");
|
||||
params.put("redirect_uri", conf.getRedirectURL());
|
||||
|
||||
Map<String, String> form = new HashMap<>();
|
||||
form.put("UserName", conf.getUserName());
|
||||
form.put("Password", conf.getPassword());
|
||||
form.put("AuthMethod", "FormsAuthentication");
|
||||
|
||||
RequestHttpContext queryContext = new RequestHttpContext("POST",
|
||||
conf.getAuthoryEndpoint(),
|
||||
params,
|
||||
new HashMap<>(),
|
||||
false,
|
||||
conf.getTimeout() * 1000,
|
||||
conf.getTimeout() * 1000);
|
||||
|
||||
queryContext.setBodyContent(form);
|
||||
HttpClient client = new HttpClient(queryContext);
|
||||
|
||||
// We stop to follow redirect url once we have the code
|
||||
final HttpResponse call = client.call(new AtomicInteger(MAX_REDIRECT_AUTH_CODE), e -> !e.extractCode().isPresent());
|
||||
|
||||
return call.extractCode();
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2019 Talend Inc. - www.talend.com
|
||||
// Copyright (C) 2006-2022 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
|
||||
@@ -0,0 +1,127 @@
|
||||
package org.talend.ms.crm.odata.authentication.httpclienthelper;
|
||||
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public final class HttpClient {
|
||||
|
||||
private final static int TEMPORARY_REDIRECT = 307;
|
||||
private final static int PERMANENT_REDIRECT = 308;
|
||||
|
||||
private final RequestHttpContext requestHttpContext;
|
||||
|
||||
public HttpClient(RequestHttpContext requestHttpContext) {
|
||||
this.requestHttpContext = requestHttpContext;
|
||||
}
|
||||
|
||||
public static String encodeValue(String value) throws UnsupportedEncodingException {
|
||||
return URLEncoder.encode(value, StandardCharsets.UTF_8.toString());
|
||||
}
|
||||
|
||||
public HttpResponse call(AtomicInteger atomicInteger, Function<HttpResponse, Boolean> acceptRedirect) throws IOException, InterruptedException {
|
||||
final HttpURLConnection conn = buildUrl(requestHttpContext);
|
||||
|
||||
if ("POST".equals(conn.getRequestMethod())) {
|
||||
conn.setDoOutput(true);
|
||||
try (DataOutputStream dos = new DataOutputStream(conn.getOutputStream())) {
|
||||
final byte[] form = requestHttpContext.getBodyContent().getBytes(StandardCharsets.UTF_8);
|
||||
dos.write(form);
|
||||
dos.flush();
|
||||
}
|
||||
} else {
|
||||
conn.connect();
|
||||
}
|
||||
|
||||
final HttpResponse respContext = HttpResponse.fromHttpUrlConnection(conn);
|
||||
return followRedirect(requestHttpContext, respContext, atomicInteger, acceptRedirect);
|
||||
}
|
||||
|
||||
private HttpResponse followRedirect(RequestHttpContext queryContext, HttpResponse response, AtomicInteger nbRedirect, Function<HttpResponse, Boolean> acceptRedirect) throws IOException, InterruptedException {
|
||||
final int nbR = nbRedirect.decrementAndGet();
|
||||
final int status = response.getStatus();
|
||||
|
||||
boolean redirect = false;
|
||||
if (status != HttpURLConnection.HTTP_OK && ((status == HttpURLConnection.HTTP_MOVED_TEMP
|
||||
|| status == HttpURLConnection.HTTP_MOVED_PERM || status == HttpURLConnection.HTTP_SEE_OTHER
|
||||
|| status == TEMPORARY_REDIRECT || status == PERMANENT_REDIRECT))) {
|
||||
redirect = true;
|
||||
}
|
||||
|
||||
final Optional<String> location = response.getFirstValueHeader("location");
|
||||
|
||||
if (!redirect || !location.isPresent() || nbR <= 0) {
|
||||
return response;
|
||||
}
|
||||
|
||||
queryContext.setBase(location.get());
|
||||
queryContext.setParams(Collections.emptyMap());
|
||||
|
||||
final List<String> cookie = response.getAllValuesHeader("Set-Cookie").orElse(Collections.emptyList());
|
||||
if (cookie.size() > 0) {
|
||||
final String collect = String.join("; ", cookie); //cookie.stream().collect(Collectors.joining("; "));
|
||||
queryContext.getHeaders().put("Cookie", collect);
|
||||
}
|
||||
|
||||
Boolean continueRedirect = acceptRedirect.apply(response);
|
||||
if (!continueRedirect) {
|
||||
return response;
|
||||
}
|
||||
|
||||
HttpClient manager = new HttpClient(queryContext);
|
||||
final HttpResponse redirectResponseContext = manager.call(nbRedirect, acceptRedirect);
|
||||
|
||||
|
||||
return redirectResponseContext;
|
||||
}
|
||||
|
||||
private HttpURLConnection buildUrl(RequestHttpContext context) throws IOException {
|
||||
StringBuilder sb = new StringBuilder(context.getBase());
|
||||
|
||||
if (context.getParams().size() > 0) {
|
||||
sb.append("?");
|
||||
|
||||
boolean first = true;
|
||||
for (Map.Entry<String, String> e : context.getParams().entrySet()) {
|
||||
if (!first) {
|
||||
sb.append("&");
|
||||
}
|
||||
first = false;
|
||||
sb.append(e.getKey());
|
||||
sb.append("=");
|
||||
sb.append(encodeValue(e.getValue()));
|
||||
}
|
||||
}
|
||||
|
||||
URL url = new URL(sb.toString());
|
||||
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
|
||||
|
||||
if (context.getHeaders().size() > 0) {
|
||||
for (Map.Entry<String, String> e : context.getHeaders().entrySet()) {
|
||||
conn.setRequestProperty(e.getKey(), e.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
conn.setRequestMethod(context.getMethod());
|
||||
conn.setInstanceFollowRedirects(context.isFollowRedirects());
|
||||
conn.setConnectTimeout(context.getConnectionTimeout());
|
||||
conn.setReadTimeout(context.getReadTimeout());
|
||||
|
||||
return conn;
|
||||
}
|
||||
|
||||
public RequestHttpContext getRequestHttpContext() {
|
||||
return requestHttpContext;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
package org.talend.ms.crm.odata.authentication.httpclienthelper;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public final class HttpResponse {
|
||||
private int status;
|
||||
private Map<String, List<String>> headers;
|
||||
private String body;
|
||||
|
||||
private Optional<String> code = null;
|
||||
|
||||
public static HttpResponse fromHttpUrlConnection(HttpURLConnection conn) throws IOException {
|
||||
final int status = conn.getResponseCode();
|
||||
final Map<String, List<String>> respHeaders = conn.getHeaderFields();
|
||||
|
||||
HttpResponse context = new HttpResponse(status);
|
||||
context.setHeaders(respHeaders);
|
||||
|
||||
try(BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream(), "UTF-8"))){
|
||||
final String body = in.lines().collect(Collectors.joining("\n"));
|
||||
context.setBody(body);
|
||||
}
|
||||
|
||||
return context;
|
||||
}
|
||||
|
||||
private HttpResponse(int status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public int getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(int status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public Map<String, List<String>> getHeaders() {
|
||||
return headers;
|
||||
}
|
||||
|
||||
public void setHeaders(Map<String, List<String>> headers) {
|
||||
this.headers = headers;
|
||||
}
|
||||
|
||||
private Optional<List<String>> _getAllValuesHeader(String key) {
|
||||
if (this.getHeaders() == null || this.getHeaders().size() <= 0) {
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
if (!this.getHeaders().containsKey(key)) {
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
return Optional.ofNullable(this.getHeaders().get(key));
|
||||
}
|
||||
|
||||
public Optional<List<String>> getAllValuesHeader(String key) {
|
||||
String keyUpper = ("" + key.charAt(0)).toUpperCase() + key.substring(1);
|
||||
String keyLower = ("" + key.charAt(0)).toLowerCase() + key.substring(1);
|
||||
|
||||
Optional<List<String>> values = _getAllValuesHeader(keyUpper);
|
||||
if(!values.isPresent()){
|
||||
values = _getAllValuesHeader(keyLower);
|
||||
}
|
||||
|
||||
return values;
|
||||
}
|
||||
|
||||
public Optional<String> getFirstValueHeader(String key) {
|
||||
final Optional<List<String>> values = getAllValuesHeader(key);
|
||||
if(!values.isPresent()){
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
final List<String> ss = values.get();
|
||||
if(ss.size() <= 0){
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
return Optional.ofNullable(ss.get(0));
|
||||
}
|
||||
|
||||
public String getBody() {
|
||||
return body;
|
||||
}
|
||||
|
||||
public void setBody(String body) {
|
||||
this.body = body;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract 'Code' parameter from the redirect url if exist.
|
||||
* @return An Optional with the code if any.
|
||||
*/
|
||||
private Optional<String> _extractCode(){
|
||||
final Optional<String> optLocation = this.getFirstValueHeader("Location");
|
||||
if (!optLocation.isPresent()) {
|
||||
return Optional.empty();
|
||||
}
|
||||
final String optLocationValue = optLocation.get();
|
||||
final String[] split = optLocationValue.split("&|\\?");
|
||||
|
||||
final Optional<String> optCode = Arrays.stream(split).filter(e -> e.startsWith("code=")).findFirst();
|
||||
if (optCode.isPresent()) {
|
||||
final String optCodeValue = optCode.get();
|
||||
String code = optCodeValue.substring(5);
|
||||
return Optional.ofNullable(code);
|
||||
}
|
||||
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
public Optional<String> extractCode(){
|
||||
if(code != null){
|
||||
return code;
|
||||
}
|
||||
|
||||
code = _extractCode();
|
||||
return code;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
package org.talend.ms.crm.odata.authentication.httpclienthelper;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.Map;
|
||||
|
||||
public final class RequestHttpContext {
|
||||
|
||||
private String method;
|
||||
private String base;
|
||||
private Map<String, String> params;
|
||||
private Map<String, String> headers;
|
||||
private boolean followRedirects;
|
||||
private int connectionTimeout;
|
||||
private int readTimeout;
|
||||
private String bodyContent = "";
|
||||
|
||||
public RequestHttpContext(String method, String base, Map<String, String> params, Map<String, String> headers, boolean followRedirects, int connectionTimeout, int readTimeout) {
|
||||
this.method = method;
|
||||
this.base = base;
|
||||
this.params = params;
|
||||
this.headers = headers;
|
||||
this.followRedirects = followRedirects;
|
||||
this.connectionTimeout = connectionTimeout;
|
||||
this.readTimeout = readTimeout;
|
||||
}
|
||||
|
||||
public String getBodyContent() {
|
||||
return bodyContent;
|
||||
}
|
||||
|
||||
public void setBodyContent(Map<String, String> form) throws UnsupportedEncodingException {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
boolean first = true;
|
||||
for (Map.Entry<String, String> e : form.entrySet()) {
|
||||
if(!first){
|
||||
sb.append("&");
|
||||
}
|
||||
first = false;
|
||||
|
||||
sb.append(e.getKey()).append("=").append(HttpClient.encodeValue(e.getValue()));
|
||||
}
|
||||
|
||||
this.setBodyContent(sb.toString());
|
||||
}
|
||||
|
||||
public void setBodyContent(String bodyContent) {
|
||||
this.bodyContent = bodyContent;
|
||||
}
|
||||
|
||||
public String getMethod() {
|
||||
return method;
|
||||
}
|
||||
|
||||
public void setMethod(String method) {
|
||||
this.method = method;
|
||||
}
|
||||
|
||||
public String getBase() {
|
||||
return base;
|
||||
}
|
||||
|
||||
public void setBase(String base) {
|
||||
this.base = base;
|
||||
}
|
||||
|
||||
public Map<String, String> getParams() {
|
||||
return params;
|
||||
}
|
||||
|
||||
public void setParams(Map<String, String> params) {
|
||||
this.params = params;
|
||||
}
|
||||
|
||||
public Map<String, String> getHeaders() {
|
||||
return headers;
|
||||
}
|
||||
|
||||
public void setHeaders(Map<String, String> headers) {
|
||||
this.headers = headers;
|
||||
}
|
||||
|
||||
public boolean isFollowRedirects() {
|
||||
return followRedirects;
|
||||
}
|
||||
|
||||
public void setFollowRedirects(boolean followRedirects) {
|
||||
this.followRedirects = followRedirects;
|
||||
}
|
||||
|
||||
public int getConnectionTimeout() {
|
||||
return connectionTimeout;
|
||||
}
|
||||
|
||||
public void setConnectionTimeout(int connectionTimeout) {
|
||||
this.connectionTimeout = connectionTimeout;
|
||||
}
|
||||
|
||||
public int getReadTimeout() {
|
||||
return readTimeout;
|
||||
}
|
||||
|
||||
public void setReadTimeout(int readTimeout) {
|
||||
this.readTimeout = readTimeout;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package org.talend.ms.crm.odata.authentication.httpclienthelper;
|
||||
|
||||
public final class Token {
|
||||
// Time to be sure to refresh the token at time
|
||||
private final static int EXPIRATION_SECURITY_GAP_SECOND = 60;
|
||||
|
||||
private String access_token;
|
||||
private String token_type;
|
||||
private Long expires_in;
|
||||
|
||||
public Token(){
|
||||
}
|
||||
|
||||
public String getAccess_token() {
|
||||
return access_token;
|
||||
}
|
||||
|
||||
public void setAccess_token(String access_token) {
|
||||
this.access_token = access_token;
|
||||
}
|
||||
|
||||
public String getToken_type() {
|
||||
return token_type;
|
||||
}
|
||||
|
||||
public void setToken_type(String token_type) {
|
||||
this.token_type = token_type;
|
||||
}
|
||||
|
||||
public Long getExpires_in() {
|
||||
return expires_in;
|
||||
}
|
||||
|
||||
public void setExpires_in(Long expires_in) {
|
||||
this.expires_in = expires_in;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2019 Talend Inc. - www.talend.com
|
||||
// Copyright (C) 2006-2022 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2019 Talend Inc. - www.talend.com
|
||||
// Copyright (C) 2006-2022 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2019 Talend Inc. - www.talend.com
|
||||
// Copyright (C) 2006-2022 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2019 Talend Inc. - www.talend.com
|
||||
// Copyright (C) 2006-2022 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2019 Talend Inc. - www.talend.com
|
||||
// Copyright (C) 2006-2022 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
package org.talend.ms.crm.sdk;
|
||||
|
||||
public class Instance {
|
||||
|
||||
public String id;
|
||||
|
||||
public String uniqueName;
|
||||
|
||||
public String urlName;
|
||||
|
||||
public String friendlyName;
|
||||
|
||||
public String state;
|
||||
|
||||
public String version;
|
||||
|
||||
public String url;
|
||||
|
||||
public String apiUrl;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getUniqueName() {
|
||||
return uniqueName;
|
||||
}
|
||||
|
||||
public void setUniqueName(String uniqueName) {
|
||||
this.uniqueName = uniqueName;
|
||||
}
|
||||
|
||||
public String getUrlName() {
|
||||
return urlName;
|
||||
}
|
||||
|
||||
public void setUrlName(String urlName) {
|
||||
this.urlName = urlName;
|
||||
}
|
||||
|
||||
public String getFriendlyName() {
|
||||
return friendlyName;
|
||||
}
|
||||
|
||||
public void setFriendlyName(String friendlyName) {
|
||||
this.friendlyName = friendlyName;
|
||||
}
|
||||
|
||||
public String getState() {
|
||||
return state;
|
||||
}
|
||||
|
||||
public void setState(String state) {
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
public String getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
public void setVersion(String version) {
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
public String getApiUrl() {
|
||||
return apiUrl;
|
||||
}
|
||||
|
||||
public void setApiUrl(String apiUrl) {
|
||||
this.apiUrl = apiUrl;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -11,7 +11,7 @@ import java.util.Locale;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import javax.activity.InvalidActivityException;
|
||||
import java.security.InvalidParameterException;
|
||||
import javax.wsdl.WSDLException;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
import javax.xml.xpath.XPathExpressionException;
|
||||
@@ -107,7 +107,7 @@ public final class OnlineAuthenticationPolicy {
|
||||
this.initialize(flatWsdlUrl, targetDocument);
|
||||
}
|
||||
|
||||
private void initialize(String url, String wsdl) throws URISyntaxException, InvalidActivityException {
|
||||
private void initialize(String url, String wsdl) throws URISyntaxException, InvalidParameterException {
|
||||
final String PolicyNodeContentRegexPatern = "(?i)(<wsp:All.*?>)(.+?)(</wsp:All>)";
|
||||
final String LiveIdentityProviderTrustRegexPatern = "(?i)(<ms-xrm:LiveTrust.*?>)(.+?)(</ms-xrm:LiveTrust>)";
|
||||
final String OrgIdentityProviderTrustRegexPatern = "(?i)(<ms-xrm:OrgTrust.*?>)(.+?)(</ms-xrm:OrgTrust>)";
|
||||
@@ -166,7 +166,7 @@ public final class OnlineAuthenticationPolicy {
|
||||
}
|
||||
}
|
||||
|
||||
throw new InvalidActivityException(
|
||||
throw new InvalidParameterException(
|
||||
String.format(Locale.getDefault(), "Unable to parse the authentication policy from the WSDL \"%s\".", url));
|
||||
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ public class OrganizationServiceStubWrapper extends OrganizationServiceStub {
|
||||
}
|
||||
|
||||
private void renewToken() throws Exception {
|
||||
orgStub = client.doGetOnlineConnection(discoveryServiceUrl);
|
||||
orgStub = client.doGetOnlineConnection();
|
||||
}
|
||||
|
||||
private void sleep() {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2019 Talend Inc. - www.talend.com
|
||||
// Copyright (C) 2006-2022 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
|
||||
@@ -6,12 +6,12 @@
|
||||
|
||||
<groupId>org.talend.components</groupId>
|
||||
<artifactId>talend-scp-helper</artifactId>
|
||||
<version>1.0</version>
|
||||
<version>1.1</version>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
<ssd.version>2.5.1</ssd.version>
|
||||
<ssd.version>2.8.0</ssd.version>
|
||||
<talend.nexus.url>https://artifacts-oss.talend.com</talend.nexus.url>
|
||||
</properties>
|
||||
|
||||
|
||||
@@ -1,31 +1,32 @@
|
||||
package org.talend.components.talendscp;
|
||||
|
||||
import org.apache.sshd.client.channel.ChannelExec;
|
||||
import org.apache.sshd.scp.client.AbstractScpClient;
|
||||
import org.apache.sshd.scp.client.DefaultScpClient;
|
||||
import org.apache.sshd.scp.client.DefaultScpStreamResolver;
|
||||
import org.apache.sshd.scp.client.ScpClient;
|
||||
import org.apache.sshd.client.session.ClientSession;
|
||||
import org.apache.sshd.common.FactoryManager;
|
||||
import org.apache.sshd.common.file.FileSystemFactory;
|
||||
import org.apache.sshd.common.file.util.MockFileSystem;
|
||||
import org.apache.sshd.common.file.util.MockPath;
|
||||
import org.apache.sshd.scp.common.ScpFileOpener;
|
||||
import org.apache.sshd.scp.common.ScpHelper;
|
||||
import org.apache.sshd.common.util.ValidateUtils;
|
||||
import org.apache.sshd.scp.common.ScpTransferEventListener;
|
||||
import org.apache.sshd.scp.common.helpers.ScpTimestampCommandDetails;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.nio.file.FileSystem;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.attribute.FileTime;
|
||||
import java.nio.file.attribute.PosixFilePermission;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.EnumSet;
|
||||
|
||||
import org.apache.sshd.client.channel.ChannelExec;
|
||||
import org.apache.sshd.client.scp.AbstractScpClient;
|
||||
import org.apache.sshd.client.scp.DefaultScpClient;
|
||||
import org.apache.sshd.client.scp.DefaultScpStreamResolver;
|
||||
import org.apache.sshd.client.scp.ScpClient;
|
||||
import org.apache.sshd.client.session.ClientSession;
|
||||
import org.apache.sshd.common.FactoryManager;
|
||||
import org.apache.sshd.common.file.FileSystemFactory;
|
||||
import org.apache.sshd.common.file.util.MockFileSystem;
|
||||
import org.apache.sshd.common.file.util.MockPath;
|
||||
import org.apache.sshd.common.scp.ScpFileOpener;
|
||||
import org.apache.sshd.common.scp.ScpHelper;
|
||||
import org.apache.sshd.common.scp.ScpTimestamp;
|
||||
import org.apache.sshd.common.scp.ScpTransferEventListener;
|
||||
import org.apache.sshd.common.util.ValidateUtils;
|
||||
|
||||
|
||||
/*
|
||||
What we do here is just overwrite the ScpHelper to throw Exception when scp return status 1
|
||||
@@ -40,7 +41,8 @@ public class TalendScpClient extends DefaultScpClient {
|
||||
}
|
||||
|
||||
@Override public void upload(InputStream local, String remote, long size, Collection<PosixFilePermission> perms,
|
||||
ScpTimestamp time) throws IOException {
|
||||
ScpTimestampCommandDetails time) throws IOException {
|
||||
|
||||
int namePos = ValidateUtils.checkNotNullAndNotEmpty(remote, "No remote location specified").lastIndexOf('/');
|
||||
String name = (namePos < 0) ?
|
||||
remote :
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package org.talend.components.talendscp;
|
||||
|
||||
import org.apache.sshd.client.scp.AbstractScpClientCreator;
|
||||
import org.apache.sshd.client.scp.ScpClient;
|
||||
import org.apache.sshd.client.scp.ScpClientCreator;
|
||||
import org.apache.sshd.scp.client.AbstractScpClientCreator;
|
||||
import org.apache.sshd.scp.client.ScpClient;
|
||||
import org.apache.sshd.scp.client.ScpClientCreator;
|
||||
import org.apache.sshd.client.session.ClientSession;
|
||||
import org.apache.sshd.common.scp.ScpFileOpener;
|
||||
import org.apache.sshd.common.scp.ScpTransferEventListener;
|
||||
import org.apache.sshd.scp.common.ScpFileOpener;
|
||||
import org.apache.sshd.scp.common.ScpTransferEventListener;
|
||||
|
||||
public class TalendScpClientCreator extends AbstractScpClientCreator implements ScpClientCreator {
|
||||
public static final TalendScpClientCreator INSTANCE = new TalendScpClientCreator();
|
||||
|
||||
@@ -6,11 +6,12 @@ import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.nio.file.FileSystem;
|
||||
|
||||
import org.apache.sshd.common.scp.ScpException;
|
||||
import org.apache.sshd.common.scp.ScpFileOpener;
|
||||
import org.apache.sshd.common.scp.ScpHelper;
|
||||
import org.apache.sshd.common.scp.ScpTransferEventListener;
|
||||
import org.apache.sshd.scp.common.ScpException;
|
||||
import org.apache.sshd.scp.common.ScpFileOpener;
|
||||
import org.apache.sshd.scp.common.ScpHelper;
|
||||
import org.apache.sshd.scp.common.ScpTransferEventListener;
|
||||
import org.apache.sshd.common.session.Session;
|
||||
import org.apache.sshd.scp.common.helpers.ScpAckInfo;
|
||||
|
||||
public class TalendScpHelper extends ScpHelper {
|
||||
|
||||
@@ -20,8 +21,9 @@ public class TalendScpHelper extends ScpHelper {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int readAck(boolean canEof) throws IOException {
|
||||
int c = in.read();
|
||||
public ScpAckInfo readAck(boolean canEof) throws IOException {
|
||||
final ScpAckInfo scpAckInfo = ScpAckInfo.readAck(this.in, this.csIn, canEof);
|
||||
int c = scpAckInfo == null ? -1 : scpAckInfo.getStatusCode();
|
||||
switch (c) {
|
||||
case -1:
|
||||
if (log.isDebugEnabled()) {
|
||||
@@ -31,12 +33,12 @@ public class TalendScpHelper extends ScpHelper {
|
||||
throw new EOFException("readAck - EOF before ACK");
|
||||
}
|
||||
break;
|
||||
case OK:
|
||||
case ScpAckInfo.OK:
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("readAck({})[EOF={}] read OK", this, canEof);
|
||||
}
|
||||
break;
|
||||
case WARNING: {
|
||||
case ScpAckInfo.WARNING: {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("readAck({})[EOF={}] read warning message", this, canEof);
|
||||
}
|
||||
@@ -45,7 +47,7 @@ public class TalendScpHelper extends ScpHelper {
|
||||
log.warn("readAck({})[EOF={}] - Received warning: {}", this, canEof, line);
|
||||
throw new ScpException("received error: " + line, c);
|
||||
}
|
||||
case ERROR: {
|
||||
case ScpAckInfo.ERROR: {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("readAck({})[EOF={}] read error message", this, canEof);
|
||||
}
|
||||
@@ -58,6 +60,6 @@ public class TalendScpHelper extends ScpHelper {
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return c;
|
||||
return scpAckInfo;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,9 +60,9 @@
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>1.2.17</version>
|
||||
<groupId>ch.qos.reload4j</groupId>
|
||||
<artifactId>reload4j</artifactId>
|
||||
<version>1.2.19</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
@@ -2,17 +2,28 @@
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.talend.libraries</groupId>
|
||||
<groupId>org.talend.components</groupId>
|
||||
<artifactId>talend-ws</artifactId>
|
||||
<version>1.0.1-20191112</version>
|
||||
<version>1.0.7-20220526</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<licenses>
|
||||
<license>
|
||||
<name>Apache License, Version 2.0</name>
|
||||
<url>https://www.talendforge.org/modules/licenses/APACHE_v2.txt</url>
|
||||
<distribution>may be downloaded from the Maven repository</distribution>
|
||||
</license>
|
||||
</licenses>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<cxf.version>3.3.4</cxf.version>
|
||||
|
||||
<talend.nexus.url>https://artifacts-oss.talend.com</talend.nexus.url>
|
||||
|
||||
<cxf.version>3.4.7</cxf.version>
|
||||
<odata.version>4.3.0</odata.version>
|
||||
<slf4j.version>1.7.12</slf4j.version>
|
||||
<talend.nexus.url>https://artifacts-oss.talend.com</talend.nexus.url>
|
||||
<httpclient.version>4.5.13</httpclient.version>
|
||||
</properties>
|
||||
|
||||
<distributionManagement>
|
||||
@@ -43,13 +54,19 @@
|
||||
<dependency>
|
||||
<groupId>commons-codec</groupId>
|
||||
<artifactId>commons-codec</artifactId>
|
||||
<version>1.10</version>
|
||||
<version>1.14</version>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/commons-httpclient/commons-httpclient -->
|
||||
<!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpclient -->
|
||||
<dependency>
|
||||
<groupId>commons-httpclient</groupId>
|
||||
<artifactId>commons-httpclient</artifactId>
|
||||
<version>3.1</version>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpclient</artifactId>
|
||||
<version>${httpclient.version}</version>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpcore -->
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpcore</artifactId>
|
||||
<version>4.4.13</version>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/org.codehaus.woodstox/stax2-api -->
|
||||
<dependency>
|
||||
@@ -91,6 +108,12 @@
|
||||
<groupId>org.apache.cxf</groupId>
|
||||
<artifactId>cxf-core</artifactId>
|
||||
<version>${cxf.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.glassfish.jaxb</groupId>
|
||||
<artifactId>jaxb-runtime</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.cxf</groupId>
|
||||
@@ -101,6 +124,16 @@
|
||||
<groupId>org.apache.cxf</groupId>
|
||||
<artifactId>cxf-tools-common</artifactId>
|
||||
<version>${cxf.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.glassfish.jaxb</groupId>
|
||||
<artifactId>jaxb-xjc</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.glassfish.jaxb</groupId>
|
||||
<artifactId>jaxb-runtime</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.cxf</groupId>
|
||||
@@ -127,6 +160,16 @@
|
||||
<artifactId>cxf-rt-transports-http</artifactId>
|
||||
<version>${cxf.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.xml.bind</groupId>
|
||||
<artifactId>jaxb-api</artifactId>
|
||||
<version>2.2.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.talend.libraries</groupId>
|
||||
<artifactId>jaxb-impl-2.2.6-modified</artifactId>
|
||||
<version>6.0.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.talend.libraries</groupId>
|
||||
<artifactId>jaxb-xjc-2.2.6-modified</artifactId>
|
||||
@@ -244,6 +287,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
@@ -251,4 +295,4 @@
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
</project>
|
||||
|
||||
@@ -48,4 +48,6 @@ please @see org\talend\ws\helper\ServiceDiscoveryHelper.java
|
||||
please @see org\talend\ws\helper\ServiceInvokerHelper.java
|
||||
org\talend\ws\mapper\MapperFactory.java
|
||||
|
||||
10.(2019-01-18 modified by dchmyga) fixed TDI-41647
|
||||
10.(2019-01-18 modified by dchmyga) fixed TDI-41647
|
||||
|
||||
11.(2020-08-24 modified by ozhelezniak) updated commons-codec to 1.14 in scope of TDI-44145
|
||||
@@ -1,6 +1,6 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2019 Talend Inc. - www.talend.com
|
||||
// Copyright (C) 2006-2021 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
|
||||
@@ -3,29 +3,22 @@
|
||||
*/
|
||||
package org.talend.webservice.helper;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.Vector;
|
||||
import com.ibm.wsdl.Constants;
|
||||
import com.ibm.wsdl.extensions.schema.SchemaConstants;
|
||||
import com.ibm.wsdl.util.xml.DOMUtils;
|
||||
import com.ibm.wsdl.util.xml.QNameUtils;
|
||||
import org.apache.ws.commons.schema.XmlSchema;
|
||||
import org.apache.ws.commons.schema.XmlSchemaCollection;
|
||||
import org.talend.webservice.helper.conf.ServiceHelperConfiguration;
|
||||
import org.talend.webservice.helper.conf.WSDLLocatorImpl;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
import javax.wsdl.Definition;
|
||||
import javax.wsdl.Import;
|
||||
import javax.wsdl.Types;
|
||||
import javax.wsdl.WSDLException;
|
||||
import javax.wsdl.extensions.ExtensibilityElement;
|
||||
import javax.wsdl.extensions.UnknownExtensibilityElement;
|
||||
import javax.wsdl.extensions.schema.Schema;
|
||||
import javax.wsdl.extensions.schema.SchemaImport;
|
||||
import javax.wsdl.extensions.schema.SchemaReference;
|
||||
@@ -37,16 +30,15 @@ import javax.xml.transform.TransformerException;
|
||||
import javax.xml.transform.TransformerFactory;
|
||||
import javax.xml.transform.dom.DOMSource;
|
||||
import javax.xml.transform.stream.StreamResult;
|
||||
|
||||
import org.apache.ws.commons.schema.XmlSchemaCollection;
|
||||
import org.talend.webservice.helper.conf.ServiceHelperConfiguration;
|
||||
import org.talend.webservice.helper.conf.WSDLLocatorImpl;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
import com.ibm.wsdl.Constants;
|
||||
import com.ibm.wsdl.extensions.schema.SchemaConstants;
|
||||
import com.ibm.wsdl.util.xml.DOMUtils;
|
||||
import com.ibm.wsdl.util.xml.QNameUtils;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* This helper allow easy discovery of services and types
|
||||
@@ -70,26 +62,36 @@ public class ServiceDiscoveryHelper {
|
||||
private Set<String> namespaces;
|
||||
|
||||
private final String LOCAL_WSDL_NAME = "mainWSDL.wsdl";
|
||||
|
||||
|
||||
private boolean createTempFiles = true;
|
||||
|
||||
public ServiceDiscoveryHelper(String wsdlUri) throws WSDLException, IOException, TransformerException, URISyntaxException {
|
||||
this(wsdlUri, null, null);
|
||||
this(wsdlUri, null, null, true);
|
||||
}
|
||||
|
||||
public ServiceDiscoveryHelper(String wsdlUri, String tempPath) throws WSDLException, IOException, TransformerException,
|
||||
URISyntaxException {
|
||||
this(wsdlUri, null, tempPath);
|
||||
this(wsdlUri, null, tempPath, true);
|
||||
}
|
||||
|
||||
public ServiceDiscoveryHelper(String wsdlUri, ServiceHelperConfiguration configuration) throws WSDLException, IOException,
|
||||
TransformerException, URISyntaxException {
|
||||
this(wsdlUri, configuration, null);
|
||||
this(wsdlUri, configuration, null, true);
|
||||
}
|
||||
|
||||
public ServiceDiscoveryHelper(String wsdlUri, ServiceHelperConfiguration configuration, String tempPath)
|
||||
throws WSDLException, IOException, TransformerException, URISyntaxException {
|
||||
this(wsdlUri, configuration, tempPath, true);
|
||||
}
|
||||
|
||||
public ServiceDiscoveryHelper(String wsdlUri, ServiceHelperConfiguration configuration, String tempPath, boolean createTempFiles)
|
||||
throws WSDLException, IOException, TransformerException, URISyntaxException {
|
||||
this.wsdlUri = wsdlUri;
|
||||
this.configuration = configuration;
|
||||
this.wsdlTmpDir = createTempWsdlDir(tempPath);
|
||||
this.createTempFiles = createTempFiles;
|
||||
if(createTempFiles) {
|
||||
this.wsdlTmpDir = createTempWsdlDir(tempPath);
|
||||
}
|
||||
init();
|
||||
}
|
||||
|
||||
@@ -139,7 +141,9 @@ public class ServiceDiscoveryHelper {
|
||||
|
||||
namespaces = collectNamespaces();
|
||||
|
||||
generateTempWsdlFile();
|
||||
if(this.createTempFiles) {
|
||||
generateTempWsdlFile();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -436,6 +440,10 @@ public class ServiceDiscoveryHelper {
|
||||
return definitions.get(this.LOCAL_WSDL_NAME);
|
||||
}
|
||||
|
||||
Collection<Definition> getDefinitions() {
|
||||
return definitions.values();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the xml schema collection
|
||||
*
|
||||
@@ -450,7 +458,11 @@ public class ServiceDiscoveryHelper {
|
||||
}
|
||||
|
||||
public String getLocalWsdlUri() {
|
||||
return new File(wsdlTmpDir, this.LOCAL_WSDL_NAME).toURI().toString();
|
||||
if(createTempFiles) {
|
||||
return new File(wsdlTmpDir, this.LOCAL_WSDL_NAME).toURI().toString();
|
||||
} else {
|
||||
return this.wsdlUri;
|
||||
}
|
||||
}
|
||||
|
||||
public Set<String> getNamespaces() {
|
||||
@@ -464,4 +476,33 @@ public class ServiceDiscoveryHelper {
|
||||
return "NOLOCATION";
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
System.setProperty("javax.xml.transform.TransformerFactory", "org.apache.xalan.processor.TransformerFactoryImpl");
|
||||
System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.NoOpLog");
|
||||
|
||||
System.setProperty("javax.xml.accessExternalSchema", "all");
|
||||
|
||||
//shade the log level for DynamicClientFactory.class
|
||||
java.util.logging.Logger LOG = org.apache.cxf.common.logging.LogUtils.getL7dLogger(org.apache.cxf.endpoint.dynamic.DynamicClientFactory.class);
|
||||
LOG.setLevel(java.util.logging.Level.WARNING);
|
||||
|
||||
ServiceDiscoveryHelper helper = new ServiceDiscoveryHelper("http://gcomputer.net/webservices/knowledge.asmx?WSDL", null, null, false);
|
||||
//ServiceDiscoveryHelper helper = new ServiceDiscoveryHelper("/Users/wangwei/Downloads/knowledge.wsdl", null, null, false);
|
||||
/*
|
||||
WSDLMetadataUtils utils = new WSDLMetadataUtils();
|
||||
//WSDLMetadataUtils.OperationInfo info = utils.parseOperationInfo(helper, "KnowledgeLeakSoap12", "Knowledge");
|
||||
WSDLMetadataUtils.OperationInfo info = utils.parseOperationInfo(helper, null, "Knowledge");
|
||||
System.out.println(info.operationName);
|
||||
System.out.println(info.port);
|
||||
System.out.println(info.service);
|
||||
System.out.println(info.inputParameters);
|
||||
System.out.println(info.outputParameter);
|
||||
System.out.println("done");
|
||||
*/
|
||||
|
||||
org.talend.webservice.helper.ServiceInvokerHelper serviceInvokerHelper = new org.talend.webservice.helper.ServiceInvokerHelper(helper, null);
|
||||
Map<String, Object> result = serviceInvokerHelper.invokeDynamic("Knowledge", Arrays.asList(1));
|
||||
System.out.println(result);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,30 +3,6 @@
|
||||
*/
|
||||
package org.talend.webservice.helper;
|
||||
|
||||
import java.beans.PropertyDescriptor;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.wsdl.Input;
|
||||
import javax.wsdl.Message;
|
||||
import javax.wsdl.Operation;
|
||||
import javax.wsdl.Output;
|
||||
import javax.wsdl.Port;
|
||||
import javax.wsdl.Service;
|
||||
import javax.wsdl.WSDLException;
|
||||
import javax.xml.bind.annotation.XmlSchema;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
import javax.xml.namespace.QName;
|
||||
import javax.xml.transform.TransformerException;
|
||||
|
||||
import org.apache.commons.beanutils.PropertyUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.cxf.endpoint.Client;
|
||||
@@ -39,11 +15,18 @@ import org.talend.webservice.helper.conf.ServiceHelperConfiguration;
|
||||
import org.talend.webservice.helper.map.MapConverter;
|
||||
import org.talend.webservice.jaxb.JAXBUtils;
|
||||
import org.talend.webservice.jaxb.JAXBUtils.IdentifierType;
|
||||
import org.talend.webservice.mapper.AnyPropertyMapper;
|
||||
import org.talend.webservice.mapper.ClassMapper;
|
||||
import org.talend.webservice.mapper.EmptyMessageMapper;
|
||||
import org.talend.webservice.mapper.MapperFactory;
|
||||
import org.talend.webservice.mapper.MessageMapper;
|
||||
import org.talend.webservice.mapper.*;
|
||||
|
||||
import javax.wsdl.*;
|
||||
import javax.xml.bind.annotation.XmlSchema;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
import javax.xml.namespace.QName;
|
||||
import javax.xml.transform.TransformerException;
|
||||
import java.beans.PropertyDescriptor;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -261,6 +244,61 @@ public class ServiceInvokerHelper implements ClassMapper {
|
||||
return MapConverter.deepMapToMap(result);
|
||||
}
|
||||
|
||||
//auto decide the service, port, and operation name and params are necessary
|
||||
public Map<String, Object> invokeDynamic(String operationNameAndPortName, List<Object> param_values)
|
||||
throws Exception, LocalizedException {
|
||||
String portName = null;
|
||||
String operationName = operationNameAndPortName;
|
||||
try {
|
||||
portName = operationName.substring(operationName.indexOf("(") + 1, operationName.indexOf(")"));
|
||||
operationName = operationName.substring(0, operationName.indexOf("("));
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
|
||||
WSDLMetadataUtils utils = new WSDLMetadataUtils();
|
||||
WSDLMetadataUtils.OperationInfo info = utils.parseOperationInfo(this.serviceDiscoveryHelper, portName, operationName);
|
||||
|
||||
Map<String, Object> paramsMap = null;
|
||||
if(param_values!=null && !param_values.isEmpty()) {
|
||||
List<String> paths = new ArrayList<>();
|
||||
flat(paths, info.inputParameters, null);
|
||||
|
||||
int size = Math.min(paths.size(), param_values.size());
|
||||
|
||||
paramsMap = new HashMap<>();
|
||||
|
||||
for(int i=0;i<size;i++) {
|
||||
paramsMap.put(paths.get(i), param_values.get(i));
|
||||
}
|
||||
|
||||
if (!paramsMap.isEmpty()) {
|
||||
paramsMap = MapConverter.mapToDeepMap(paramsMap);
|
||||
}
|
||||
|
||||
if (paramsMap.isEmpty()) {
|
||||
paramsMap = null;
|
||||
}
|
||||
}
|
||||
Map<String, Object> result = invoke(info.service, info.port, info.operationName, paramsMap);
|
||||
|
||||
if(result==null || result.isEmpty()) return null;
|
||||
|
||||
return MapConverter.deepMapToMap(result, true);
|
||||
}
|
||||
|
||||
private void flat(List<String> paths, List<WSDLMetadataUtils.ParameterInfo> inputParameters, String path) {
|
||||
if(inputParameters==null || inputParameters.isEmpty()) {
|
||||
if(path!=null) {
|
||||
paths.add(path);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
for(WSDLMetadataUtils.ParameterInfo info : inputParameters) {
|
||||
flat(paths, info.childParameters, path!=null? path + "." + info.name : info.name);
|
||||
}
|
||||
}
|
||||
|
||||
protected String getClassNameForType(QName xmlSchemaTypeMapperQname) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(getPackageForNamespaceURI(xmlSchemaTypeMapperQname.getNamespaceURI()));
|
||||
|
||||
@@ -0,0 +1,640 @@
|
||||
package org.talend.webservice.helper;
|
||||
|
||||
import org.apache.ws.commons.schema.*;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
import javax.wsdl.*;
|
||||
import javax.wsdl.extensions.ExtensibilityElement;
|
||||
import javax.wsdl.extensions.UnknownExtensibilityElement;
|
||||
import javax.wsdl.extensions.soap.SOAPBinding;
|
||||
import javax.wsdl.extensions.soap.SOAPBody;
|
||||
import javax.wsdl.extensions.soap.SOAPOperation;
|
||||
import javax.wsdl.extensions.soap12.SOAP12Binding;
|
||||
import javax.wsdl.extensions.soap12.SOAP12Body;
|
||||
import javax.wsdl.extensions.soap12.SOAP12Operation;
|
||||
import javax.wsdl.factory.WSDLFactory;
|
||||
import javax.xml.namespace.QName;
|
||||
import java.io.File;
|
||||
import java.net.URL;
|
||||
import java.util.*;
|
||||
|
||||
public class WSDLMetadataUtils {
|
||||
|
||||
WSDLFactory wsdlFactory = null;
|
||||
|
||||
private Vector<XmlSchema> wsdlTypes = new Vector<XmlSchema>();
|
||||
|
||||
private List<String> parametersName = new ArrayList<String>();
|
||||
|
||||
private List<String> schemaNames = new ArrayList<String>();
|
||||
|
||||
private List<String> documentBaseList = new ArrayList<String>();
|
||||
|
||||
private List<XmlSchemaElement> allXmlSchemaElement = new ArrayList<XmlSchemaElement>();
|
||||
|
||||
private List<XmlSchemaType> allXmlSchemaType = new ArrayList<XmlSchemaType>();
|
||||
|
||||
public final static String DEFAULT_SOAP_ENCODING_STYLE = "http://schemas.xmlsoap.org/soap/encoding/";
|
||||
|
||||
public WSDLMetadataUtils() throws WSDLException {
|
||||
wsdlFactory = WSDLFactory.newInstance();
|
||||
}
|
||||
|
||||
public static class OperationInfo {
|
||||
QName port;
|
||||
QName service;
|
||||
|
||||
String operationName;
|
||||
|
||||
List<ParameterInfo> inputParameters = new ArrayList<ParameterInfo>();
|
||||
List<ParameterInfo> outputParameter = new ArrayList<ParameterInfo>();
|
||||
}
|
||||
|
||||
public class ParameterInfo {
|
||||
String name;
|
||||
|
||||
/* list of parameters, only filled if complex type */
|
||||
List<ParameterInfo> childParameters = new ArrayList<ParameterInfo>();
|
||||
}
|
||||
|
||||
//not thread safe
|
||||
private List<OperationInfo> operations;
|
||||
|
||||
private String targetOperationName;
|
||||
private String currentPort;
|
||||
private QName currentService;
|
||||
|
||||
public OperationInfo parseOperationInfo(ServiceDiscoveryHelper sdh, String port, String operationName) throws Exception {
|
||||
this.targetOperationName = operationName;
|
||||
|
||||
Collection<Definition> defs = sdh.getDefinitions();
|
||||
|
||||
wsdlTypes = createSchemaFromTypes(defs);
|
||||
|
||||
collectAllXmlSchemaElement();
|
||||
|
||||
collectAllXmlSchemaType();
|
||||
|
||||
//only fetch services from main wsdl/definition, others for elements and type definition
|
||||
Map services = defs.iterator().next().getServices();
|
||||
if (services != null) {
|
||||
Iterator iter = services.values().iterator();
|
||||
while (iter.hasNext()) {
|
||||
List<OperationInfo> operations = getOperations((Service) iter.next());
|
||||
for(OperationInfo info : operations) {
|
||||
if(port==null) {
|
||||
return info;
|
||||
}
|
||||
if(port.equals(info.port.getLocalPart())) {
|
||||
return info;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
throw new RuntimeException("can't find the operation : " + operationName + " with port : " + port);
|
||||
}
|
||||
|
||||
private void collectAllXmlSchemaElement() {
|
||||
for (int i = 0; i < wsdlTypes.size(); i++) {
|
||||
XmlSchema xmlSchema = (wsdlTypes.elementAt(i));
|
||||
if (xmlSchema == null) {
|
||||
continue;
|
||||
}
|
||||
Map<QName, XmlSchemaElement> elements = xmlSchema.getElements();
|
||||
Iterator elementsItr = elements.values().iterator();
|
||||
while (elementsItr.hasNext()) {
|
||||
XmlSchemaElement xmlSchemaElement = (XmlSchemaElement) elementsItr.next();
|
||||
|
||||
allXmlSchemaElement.add(xmlSchemaElement);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void collectAllXmlSchemaType() {
|
||||
for (int i = 0; i < wsdlTypes.size(); i++) {
|
||||
XmlSchema xmlSchema = (wsdlTypes.elementAt(i));
|
||||
if (xmlSchema == null) {
|
||||
continue;
|
||||
}
|
||||
Map<QName, XmlSchemaType> xmlSchemaObjectTable = xmlSchema.getSchemaTypes();
|
||||
Iterator typesItr = xmlSchemaObjectTable.values().iterator();
|
||||
while (typesItr.hasNext()) {
|
||||
XmlSchemaType xmlSchemaType = (XmlSchemaType) typesItr.next();
|
||||
allXmlSchemaType.add(xmlSchemaType);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected Vector<XmlSchema> createSchemaFromTypes(Collection<Definition> wsdlDefinitions) throws WSDLException {
|
||||
Vector<XmlSchema> schemas = new Vector<XmlSchema>();
|
||||
Set<String> imports = new HashSet<String>();
|
||||
Element schemaElementt = null;
|
||||
Map importElement = null;
|
||||
List includeElement = null;
|
||||
for (Definition def : wsdlDefinitions) {
|
||||
if (def.getTypes() != null) {
|
||||
List schemaExtElem = findExtensibilityElement(def.getTypes().getExtensibilityElements(), "schema");
|
||||
for (int i = 0; i < schemaExtElem.size(); i++) {
|
||||
ExtensibilityElement schemaElement = (ExtensibilityElement) schemaExtElem.get(i);
|
||||
if (schemaElement != null && schemaElement instanceof UnknownExtensibilityElement) {
|
||||
schemaElementt = ((UnknownExtensibilityElement) schemaElement).getElement();
|
||||
|
||||
String documentBase = ((javax.wsdl.extensions.schema.Schema) schemaElement).getDocumentBaseURI();
|
||||
XmlSchema schema = createschemafromtype(schemaElementt, def, documentBase);
|
||||
if (schema != null) {
|
||||
schemas.add(schema);
|
||||
if (schema.getTargetNamespace() != null) {
|
||||
schemaNames.add(schema.getTargetNamespace());
|
||||
}
|
||||
}
|
||||
importElement = ((javax.wsdl.extensions.schema.Schema) schemaElement).getImports();
|
||||
if (importElement != null && importElement.size() > 0) {
|
||||
findImportSchema(def, schemas, importElement, imports);
|
||||
}
|
||||
}
|
||||
|
||||
if (schemaElement != null && schemaElement instanceof javax.wsdl.extensions.schema.Schema) {
|
||||
schemaElementt = ((javax.wsdl.extensions.schema.Schema) schemaElement).getElement();
|
||||
String documentBase = ((javax.wsdl.extensions.schema.Schema) schemaElement).getDocumentBaseURI();
|
||||
Boolean isHaveImport = false;
|
||||
importElement = ((javax.wsdl.extensions.schema.Schema) schemaElement).getImports();
|
||||
if (importElement != null && importElement.size() > 0) {
|
||||
Iterator keyIterator = importElement.keySet().iterator();
|
||||
if (importElement.size() > 0) {
|
||||
isHaveImport = true;
|
||||
}
|
||||
}
|
||||
|
||||
XmlSchema schema = createschemafromtype(schemaElementt, def, documentBase);
|
||||
if (schema != null) {
|
||||
schemas.add(schema);
|
||||
if (schema.getTargetNamespace() != null) {
|
||||
schemaNames.add(schema.getTargetNamespace());
|
||||
}
|
||||
}
|
||||
|
||||
if (isHaveImport) {
|
||||
findImportSchema(def, schemas, importElement, imports);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return schemas;
|
||||
}
|
||||
|
||||
private void findIncludesSchema(Definition wsdlDefinition, Vector schemas, List includeElement) throws WSDLException {
|
||||
Element schemaElementt;
|
||||
for (int i = 0; i < includeElement.size(); i++) {
|
||||
|
||||
schemaElementt = ((com.ibm.wsdl.extensions.schema.SchemaReferenceImpl) includeElement.get(i)).getReferencedSchema()
|
||||
.getElement();
|
||||
String documentBase = ((com.ibm.wsdl.extensions.schema.SchemaReferenceImpl) includeElement.get(i))
|
||||
.getReferencedSchema().getDocumentBaseURI();
|
||||
XmlSchema schemaInclude = createschemafromtype(schemaElementt, wsdlDefinition, documentBase);
|
||||
if (schemaInclude != null) {
|
||||
schemas.add(schemaInclude);
|
||||
if (schemaInclude.getTargetNamespace() != null) {
|
||||
schemaNames.add(schemaInclude.getTargetNamespace());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void findImportSchema(Definition wsdlDefinition, Vector schemas, Map importElement, Set<String> imports)
|
||||
throws WSDLException {
|
||||
Element schemaElementt;
|
||||
List includeElement = null;
|
||||
Iterator keyIterator = importElement.keySet().iterator();
|
||||
Boolean isHaveImport = false;
|
||||
while (keyIterator.hasNext()) {
|
||||
Object object = keyIterator.next();
|
||||
if (object != null) {
|
||||
String key = object.toString();
|
||||
Vector importEle = (Vector) importElement.get(key);
|
||||
|
||||
for (int i = 0; i < importEle.size(); i++) {
|
||||
Map importChildElement = null;
|
||||
com.ibm.wsdl.extensions.schema.SchemaImportImpl importImpl = (com.ibm.wsdl.extensions.schema.SchemaImportImpl) importEle
|
||||
.elementAt(i);
|
||||
// to avoid import cycle
|
||||
String importLocation = importImpl.getSchemaLocationURI() + ":" + importImpl.getNamespaceURI();
|
||||
if (imports.contains(importLocation)) {
|
||||
continue;
|
||||
} else {
|
||||
imports.add(importLocation);
|
||||
}
|
||||
if (importImpl.getReferencedSchema() != null) {
|
||||
|
||||
schemaElementt = importImpl.getReferencedSchema().getElement();
|
||||
String documentBase = importImpl.getReferencedSchema().getDocumentBaseURI();
|
||||
|
||||
if ((com.ibm.wsdl.extensions.schema.SchemaImportImpl) importEle.elementAt(i) != null) {
|
||||
if (((com.ibm.wsdl.extensions.schema.SchemaImportImpl) importEle.elementAt(i)).getReferencedSchema() != null) {
|
||||
importChildElement = ((com.ibm.wsdl.extensions.schema.SchemaImportImpl) importEle.elementAt(i))
|
||||
.getReferencedSchema().getImports();
|
||||
if (importChildElement != null && importChildElement.size() > 0 && !isIncludeSchema(documentBase)) {
|
||||
isHaveImport = true;
|
||||
documentBaseList.add(documentBase);
|
||||
// validateImportUrlPath(importElement);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
XmlSchema schemaImport = createschemafromtype(schemaElementt, wsdlDefinition, documentBase);
|
||||
if (schemaImport != null) {
|
||||
schemas.add(schemaImport);
|
||||
if (schemaImport.getTargetNamespace() != null) {
|
||||
schemaNames.add(schemaImport.getTargetNamespace());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isHaveImport) {
|
||||
findImportSchema(wsdlDefinition, schemas, importChildElement, imports);
|
||||
}
|
||||
|
||||
if ((com.ibm.wsdl.extensions.schema.SchemaImportImpl) importEle.elementAt(i) != null) {
|
||||
if (((com.ibm.wsdl.extensions.schema.SchemaImportImpl) importEle.elementAt(i)).getReferencedSchema() != null) {
|
||||
includeElement = ((com.ibm.wsdl.extensions.schema.SchemaImportImpl) importEle.elementAt(i))
|
||||
.getReferencedSchema().getIncludes();
|
||||
if (includeElement != null && includeElement.size() > 0) {
|
||||
|
||||
findIncludesSchema(wsdlDefinition, schemas, includeElement);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private List findExtensibilityElement(List extensibilityElements, String elementType) {
|
||||
List elements = new ArrayList();
|
||||
if (extensibilityElements != null) {
|
||||
Iterator iter = extensibilityElements.iterator();
|
||||
while (iter.hasNext()) {
|
||||
ExtensibilityElement element = (ExtensibilityElement) iter.next();
|
||||
if (element.getElementType().getLocalPart().equalsIgnoreCase(elementType)) {
|
||||
elements.add(element);
|
||||
}
|
||||
}
|
||||
}
|
||||
return elements;
|
||||
}
|
||||
|
||||
private XmlSchema createschemafromtype(Element schemaElement, Definition wsdlDefinition, String documentBase)
|
||||
throws WSDLException {
|
||||
if (schemaElement == null) {
|
||||
throw new WSDLException(WSDLException.INVALID_WSDL, "Unable to find schema extensibility element in WSDL");
|
||||
}
|
||||
|
||||
XmlSchema xmlSchema = null;
|
||||
XmlSchemaCollection xmlSchemaCollection = new XmlSchemaCollection();
|
||||
xmlSchemaCollection.setBaseUri(fixDocumentBase(documentBase));
|
||||
|
||||
xmlSchema = xmlSchemaCollection.read(schemaElement);
|
||||
|
||||
return xmlSchema;
|
||||
}
|
||||
|
||||
private String fixDocumentBase(String documentBase) {
|
||||
String fixedPath = documentBase;
|
||||
try {
|
||||
URL url = new URL(documentBase);
|
||||
File file = new File(url.getFile());
|
||||
fixedPath = file.toURI().toString();
|
||||
} catch (Exception e) {
|
||||
fixedPath = documentBase;
|
||||
}
|
||||
return fixedPath;
|
||||
}
|
||||
|
||||
private Boolean isIncludeSchema(String documentBase) {
|
||||
Boolean isHaveSchema = false;
|
||||
for (int i = 0; i < documentBaseList.size(); i++) {
|
||||
String documentBaseTem = documentBaseList.get(i);
|
||||
if (documentBaseTem.equals(documentBase)) {
|
||||
isHaveSchema = true;
|
||||
}
|
||||
}
|
||||
return isHaveSchema;
|
||||
}
|
||||
|
||||
private List<OperationInfo> getOperations(Service service) {
|
||||
currentService = service.getQName();
|
||||
List<OperationInfo> result = new ArrayList<>();
|
||||
|
||||
Map ports = service.getPorts();
|
||||
Iterator portIter = ports.values().iterator();
|
||||
while (portIter.hasNext()) {
|
||||
Port port = (Port) portIter.next();
|
||||
Binding binding = port.getBinding();
|
||||
|
||||
currentPort = port.getName();
|
||||
|
||||
result.addAll(buildOperations(binding));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private List<OperationInfo> buildOperations(Binding binding) {
|
||||
List<OperationInfo> result = new ArrayList<>();
|
||||
|
||||
List operations = binding.getBindingOperations();
|
||||
|
||||
if (operations != null && !operations.isEmpty()) {
|
||||
List soapBindingElems = findExtensibilityElement(binding.getExtensibilityElements(), "binding");
|
||||
String style = "document"; // default
|
||||
|
||||
ExtensibilityElement soapBindingElem = (ExtensibilityElement) soapBindingElems.get(0);
|
||||
if (soapBindingElem != null && soapBindingElem instanceof SOAPBinding) {
|
||||
SOAPBinding soapBinding = (SOAPBinding) soapBindingElem;
|
||||
style = soapBinding.getStyle();
|
||||
} else if (soapBindingElem != null && soapBindingElem instanceof SOAP12Binding) {
|
||||
SOAP12Binding soapBinding = (SOAP12Binding) soapBindingElem;
|
||||
style = soapBinding.getStyle();
|
||||
}
|
||||
|
||||
Iterator opIter = operations.iterator();
|
||||
|
||||
while (opIter.hasNext()) {
|
||||
BindingOperation oper = (BindingOperation) opIter.next();
|
||||
List operElems = findExtensibilityElement(oper.getExtensibilityElements(), "operation");
|
||||
ExtensibilityElement operElem = (ExtensibilityElement) operElems.get(0);
|
||||
|
||||
if(!targetOperationName.equals(oper.getName())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
OperationInfo operationInfo = new OperationInfo();
|
||||
operationInfo.service = currentService;
|
||||
operationInfo.port = new QName(currentService.getNamespaceURI(), currentPort);
|
||||
operationInfo.operationName = oper.getName();
|
||||
|
||||
//TODO do different?
|
||||
if (operElem != null && operElem instanceof SOAPOperation) {
|
||||
buildOperation(operationInfo, oper);
|
||||
} else if (operElem != null && operElem instanceof SOAP12Operation) {
|
||||
buildOperation(operationInfo, oper);
|
||||
}
|
||||
|
||||
result.add(operationInfo);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private void buildOperation(OperationInfo operationInfo, BindingOperation bindingOper) {
|
||||
Operation oper = bindingOper.getOperation();
|
||||
|
||||
List operElems = findExtensibilityElement(bindingOper.getExtensibilityElements(), "operation");
|
||||
ExtensibilityElement operElem = (ExtensibilityElement) operElems.get(0);
|
||||
if (operElem != null && operElem instanceof SOAPOperation) {//TODO do different?
|
||||
SOAPOperation soapOperation = (SOAPOperation) operElem;
|
||||
} else if (operElem != null && operElem instanceof SOAP12Operation) {
|
||||
SOAP12Operation soapOperation = (SOAP12Operation) operElem;
|
||||
}
|
||||
BindingInput bindingInput = bindingOper.getBindingInput();
|
||||
BindingOutput bindingOutput = bindingOper.getBindingOutput();
|
||||
List bodyElems = findExtensibilityElement(bindingInput.getExtensibilityElements(), "body");
|
||||
ExtensibilityElement bodyElem = (ExtensibilityElement) bodyElems.get(0);
|
||||
|
||||
if (bodyElem != null && bodyElem instanceof SOAPBody) {
|
||||
SOAPBody soapBody = (SOAPBody) bodyElem;
|
||||
List styles = soapBody.getEncodingStyles();
|
||||
String encodingStyle = null;
|
||||
if (styles != null) {
|
||||
encodingStyle = styles.get(0).toString();
|
||||
}
|
||||
if (encodingStyle == null) {
|
||||
encodingStyle = DEFAULT_SOAP_ENCODING_STYLE;
|
||||
}
|
||||
//TODO get namespace uri here?
|
||||
//soapBody.getNamespaceURI();
|
||||
} else if (bodyElem != null && bodyElem instanceof SOAP12Body) {
|
||||
SOAP12Body soapBody = (SOAP12Body) bodyElem;
|
||||
String encodingStyle = null;
|
||||
if (soapBody.getEncodingStyle() != null) {
|
||||
encodingStyle = soapBody.getEncodingStyle().toString();
|
||||
}
|
||||
if (encodingStyle == null) {
|
||||
encodingStyle = DEFAULT_SOAP_ENCODING_STYLE;
|
||||
}
|
||||
//TODO get namespace uri here?
|
||||
//soapBody.getNamespaceURI();
|
||||
}
|
||||
|
||||
Input inDef = oper.getInput();
|
||||
if (inDef != null) {
|
||||
Message inMsg = inDef.getMessage();
|
||||
if (inMsg != null) {
|
||||
getParameterFromMessage(operationInfo, inMsg, 1);
|
||||
}
|
||||
}
|
||||
|
||||
//don't need output parameter struct now
|
||||
/*
|
||||
Output outDef = oper.getOutput();
|
||||
if (outDef != null) {
|
||||
Message outMsg = outDef.getMessage();
|
||||
if (outMsg != null) {
|
||||
getParameterFromMessage(operationInfo, outMsg, 2);
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
private void getParameterFromMessage(OperationInfo operationInfo, Message msg, int manner) {
|
||||
List msgParts = msg.getOrderedParts(null);
|
||||
Iterator iter = msgParts.iterator();
|
||||
while (iter.hasNext()) {
|
||||
Part part = (Part) iter.next();
|
||||
String partName = part.getName();
|
||||
String partElement = null;
|
||||
String namespace = null;
|
||||
if (part.getElementName() != null) {
|
||||
partElement = part.getElementName().getLocalPart();
|
||||
namespace = part.getElementName().getNamespaceURI();
|
||||
} else if (part.getTypeName() != null) {
|
||||
partElement = part.getTypeName().getLocalPart();
|
||||
namespace = part.getTypeName().getNamespaceURI();
|
||||
}
|
||||
// add root parameter from message.
|
||||
ParameterInfo parameterRoot = new ParameterInfo();
|
||||
parameterRoot.name = partName;
|
||||
if (manner == 1) {
|
||||
operationInfo.inputParameters.add(parameterRoot);
|
||||
} else {
|
||||
operationInfo.outputParameter.add(parameterRoot);
|
||||
}
|
||||
if (allXmlSchemaElement.size() > 0) {
|
||||
buildParameterFromElements(partElement, parameterRoot, manner);
|
||||
} else if (allXmlSchemaType.size() > 0) {
|
||||
buileParameterFromTypes(namespace, partElement, parameterRoot, manner);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void buildParameterFromElements(String partElement, ParameterInfo parameterRoot, int ioOrRecursion) {
|
||||
if (ioOrRecursion < 3) {
|
||||
parametersName.clear();
|
||||
parametersName.add(parameterRoot.name);
|
||||
} else if (ioOrRecursion == 3) {
|
||||
parametersName.add(parameterRoot.name);
|
||||
}
|
||||
Iterator elementsItr = allXmlSchemaElement.iterator();
|
||||
if (partElement != null) {
|
||||
while (elementsItr.hasNext()) {
|
||||
XmlSchemaElement xmlSchemaElement = (XmlSchemaElement) elementsItr.next();
|
||||
if (partElement.equals(xmlSchemaElement.getName())) {
|
||||
if (xmlSchemaElement.getSchemaType() != null) {
|
||||
if (xmlSchemaElement.getSchemaType() instanceof XmlSchemaComplexType) {
|
||||
XmlSchemaComplexType xmlElementComplexType = (XmlSchemaComplexType) xmlSchemaElement.getSchemaType();
|
||||
XmlSchemaParticle xmlSchemaParticle = xmlElementComplexType.getParticle();
|
||||
if (xmlSchemaParticle instanceof XmlSchemaGroupParticle) {
|
||||
XmlSchemaGroupParticle xmlSchemaGroupBase = (XmlSchemaGroupParticle) xmlSchemaParticle;
|
||||
if (xmlSchemaGroupBase != null) {
|
||||
buildParameterFromCollection(xmlSchemaGroupBase, parameterRoot, ioOrRecursion);
|
||||
}
|
||||
} else if (xmlSchemaElement.getSchemaTypeName() != null) {
|
||||
String paraTypeName = xmlSchemaElement.getSchemaTypeName().getLocalPart();
|
||||
String paraTypeNamespace = xmlSchemaElement.getSchemaTypeName().getNamespaceURI();
|
||||
if (paraTypeName != null) {
|
||||
buileParameterFromTypes(paraTypeNamespace, paraTypeName, parameterRoot, ioOrRecursion);
|
||||
}
|
||||
}
|
||||
} else if (xmlSchemaElement.getSchemaType() instanceof XmlSchemaSimpleType) {
|
||||
XmlSchemaSimpleType xmlSchemaSimpleType = (XmlSchemaSimpleType) xmlSchemaElement.getSchemaType();
|
||||
String typeName = xmlSchemaSimpleType.getName();
|
||||
if (typeName != null && typeName.equals("anyType")) {
|
||||
ParameterInfo parameterSon = new ParameterInfo();
|
||||
parameterSon.name = "anyType";
|
||||
parameterRoot.childParameters.add(parameterSon);
|
||||
}
|
||||
}
|
||||
} else if (xmlSchemaElement.getSchemaTypeName() != null) {
|
||||
String paraTypeName = xmlSchemaElement.getSchemaTypeName().getLocalPart();
|
||||
String paraTypeNamespace = xmlSchemaElement.getSchemaTypeName().getNamespaceURI();
|
||||
if (paraTypeName != null) {
|
||||
buileParameterFromTypes(paraTypeNamespace, paraTypeName, parameterRoot, ioOrRecursion);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void buileParameterFromTypes(String paraNamespace, String paraType, ParameterInfo parameter, int ioOrRecursion) {
|
||||
if (ioOrRecursion < 3) {
|
||||
parametersName.clear();
|
||||
parametersName.add(parameter.name);
|
||||
} else if (ioOrRecursion == 3) {
|
||||
parametersName.add(parameter.name);
|
||||
}
|
||||
|
||||
//twebserviceinput need auto metadata fetch for input parameters, but it only support very easy, not support custom defined type usage like this:
|
||||
//<element type="tns="s:anyCustomDefinedSimpleOrComplexType"">
|
||||
//so nothing to do here, TODO make sure it
|
||||
}
|
||||
|
||||
private void buildParameterFromCollection(XmlSchemaGroupParticle xmlSchemaGroupParticle, ParameterInfo parameter,
|
||||
int ioOrRecursion) {
|
||||
if (!(xmlSchemaGroupParticle instanceof XmlSchemaSequence)) {
|
||||
throw new RuntimeException("don't support that complex parameter type, only support xsd:sequence");
|
||||
}
|
||||
|
||||
XmlSchemaSequence xmlSchemaSequence = (XmlSchemaSequence) xmlSchemaGroupParticle;
|
||||
List<XmlSchemaSequenceMember> sequences = xmlSchemaSequence.getItems();
|
||||
|
||||
for (XmlSchemaSequenceMember sequence : sequences) {
|
||||
if (sequence instanceof XmlSchemaAny) {//TODO remove it as not support too
|
||||
ParameterInfo parameterSon = new ParameterInfo();
|
||||
parameterSon.name = "_content_";
|
||||
parameter.childParameters.add(parameterSon);
|
||||
} else if (sequence instanceof XmlSchemaElement) {//this is the major part we support
|
||||
XmlSchemaElement xmlSchemaElement = (XmlSchemaElement) sequence;
|
||||
String elementName = xmlSchemaElement.getName();
|
||||
ParameterInfo parameterSon = new ParameterInfo();
|
||||
parameterSon.name= elementName;
|
||||
|
||||
parameter.childParameters.add(parameterSon);
|
||||
|
||||
Boolean isHave = false;
|
||||
if (!parametersName.isEmpty() && parameterSon.name != null) {
|
||||
for (int p = 0; p < parametersName.size(); p++) {
|
||||
if (parameterSon.name.equals(parametersName.get(p))) {
|
||||
isHave = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (xmlSchemaElement.getSchemaTypeName() != null) {
|
||||
String elementTypeName = xmlSchemaElement.getSchemaTypeName().getLocalPart();
|
||||
String elementTypeNamespace = xmlSchemaElement.getSchemaTypeName().getNamespaceURI();
|
||||
if (elementTypeName != null && elementTypeName.equals("anyType")) {//TODO remove it
|
||||
parameterSon.name = xmlSchemaElement.getName() + ":anyType";
|
||||
}
|
||||
if (!isHave && !WsdlTypeUtil.isJavaBasicType(elementTypeName)) {
|
||||
buileParameterFromTypes(elementTypeNamespace, elementTypeName, parameterSon, ioOrRecursion);
|
||||
}
|
||||
} else if (xmlSchemaElement.getSchemaType() != null) {
|
||||
if (xmlSchemaElement.getSchemaType() instanceof XmlSchemaComplexType) {
|
||||
throw new RuntimeException("don't support nested or ref complex type in xsd:sequence");
|
||||
} else if (xmlSchemaElement.getSchemaType() instanceof XmlSchemaSimpleType) {
|
||||
XmlSchemaSimpleType xmlSchemaSimpleType = (XmlSchemaSimpleType) xmlSchemaElement.getSchemaType();
|
||||
String typeName = xmlSchemaSimpleType.getName();
|
||||
if (typeName != null && typeName.equals("anyType")) {
|
||||
ParameterInfo pSon = new ParameterInfo();
|
||||
pSon.name = "anyType";
|
||||
parameter.childParameters.add(pSon);
|
||||
}
|
||||
}
|
||||
} else if (xmlSchemaElement.getRef() != null) {//TODO twebserviceinput support it before?
|
||||
String elementTypeName = xmlSchemaElement.getRef().getTargetQName().getLocalPart();
|
||||
if (!isHave && !WsdlTypeUtil.isJavaBasicType(elementTypeName)) {
|
||||
buildParameterFromElements(elementTypeName, parameterSon, ioOrRecursion);
|
||||
}
|
||||
}
|
||||
} else if (sequence instanceof XmlSchemaAttribute) {
|
||||
XmlSchemaAttribute xmlSchemaAttribute = (XmlSchemaAttribute) sequence;
|
||||
String elementName = xmlSchemaAttribute.getName();
|
||||
ParameterInfo parameterSon = new ParameterInfo();
|
||||
parameterSon.name = elementName;
|
||||
|
||||
parameter.childParameters.add(parameterSon);
|
||||
Boolean isHave = false;
|
||||
if (!parametersName.isEmpty() && parameterSon.name != null) {
|
||||
for (int p = 0; p < parametersName.size(); p++) {
|
||||
if (parameterSon.name.equals(parametersName.get(p))) {
|
||||
isHave = true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if (xmlSchemaAttribute.getSchemaTypeName() != null) {
|
||||
String elementTypeName = xmlSchemaAttribute.getSchemaTypeName().getLocalPart();
|
||||
String elementTypeNamespace = xmlSchemaAttribute.getSchemaTypeName().getNamespaceURI();
|
||||
if (!isHave && !WsdlTypeUtil.isJavaBasicType(elementTypeName)) {
|
||||
buileParameterFromTypes(elementTypeNamespace, elementTypeName, parameterSon, ioOrRecursion);
|
||||
}
|
||||
} else if (xmlSchemaAttribute.getRef() != null) {//TODO twebserviceinput support it before?
|
||||
String refName = xmlSchemaAttribute.getRef().getTargetQName().getLocalPart();
|
||||
if (!isHave) {
|
||||
buildParameterFromElements(refName, parameterSon, ioOrRecursion);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
throw new RuntimeException("don't support the nest type in xsd:sequence");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2021 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.webservice.helper;
|
||||
|
||||
public class WsdlTypeUtil {
|
||||
|
||||
public static Boolean isJavaBasicType(String typeName) {
|
||||
Boolean isJavaBasicType = false;
|
||||
if (typeName == null) {
|
||||
return false;
|
||||
}
|
||||
if ("String".equalsIgnoreCase(typeName)) {
|
||||
isJavaBasicType = true;
|
||||
} else if ("int".equalsIgnoreCase(typeName)) {
|
||||
isJavaBasicType = true;
|
||||
} else if ("long".equalsIgnoreCase(typeName)) {
|
||||
isJavaBasicType = true;
|
||||
} else if ("double".equalsIgnoreCase(typeName)) {
|
||||
isJavaBasicType = true;
|
||||
} else if ("float".equalsIgnoreCase(typeName)) {
|
||||
isJavaBasicType = true;
|
||||
} else if ("char".equalsIgnoreCase(typeName)) {
|
||||
isJavaBasicType = true;
|
||||
}
|
||||
|
||||
return isJavaBasicType;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -15,12 +15,17 @@ import java.util.logging.Logger;
|
||||
|
||||
import javax.wsdl.xml.WSDLLocator;
|
||||
|
||||
import org.apache.commons.httpclient.Credentials;
|
||||
import org.apache.commons.httpclient.HostConfiguration;
|
||||
import org.apache.commons.httpclient.HttpClient;
|
||||
import org.apache.commons.httpclient.UsernamePasswordCredentials;
|
||||
import org.apache.commons.httpclient.auth.AuthScope;
|
||||
import org.apache.commons.httpclient.methods.GetMethod;
|
||||
import org.apache.http.HttpHost;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.auth.AuthScope;
|
||||
import org.apache.http.auth.UsernamePasswordCredentials;
|
||||
import org.apache.http.client.CredentialsProvider;
|
||||
import org.apache.http.client.HttpClient;
|
||||
import org.apache.http.client.methods.HttpGet;
|
||||
import org.apache.http.client.methods.HttpRequestBase;
|
||||
import org.apache.http.impl.client.BasicCredentialsProvider;
|
||||
import org.apache.http.impl.client.HttpClientBuilder;
|
||||
import org.apache.http.impl.client.HttpClients;
|
||||
import org.xml.sax.InputSource;
|
||||
|
||||
/**
|
||||
@@ -49,10 +54,10 @@ public class WSDLLocatorImpl implements WSDLLocator {
|
||||
}
|
||||
|
||||
public InputSource getBaseInputSource() {
|
||||
GetMethod get = createGetMethod(wsdlUri);
|
||||
HttpRequestBase get = createGetMethod(wsdlUri);
|
||||
try {
|
||||
httpClient.executeMethod(get);
|
||||
InputStream is = get.getResponseBodyAsStream();
|
||||
HttpResponse response = httpClient.execute(get);
|
||||
InputStream is = response.getEntity().getContent();
|
||||
inputStreams.add(is);
|
||||
return new InputSource(is);
|
||||
} catch (IOException ex) {
|
||||
@@ -64,9 +69,9 @@ public class WSDLLocatorImpl implements WSDLLocator {
|
||||
try {
|
||||
URL url = getURL(parentLocation, importLocation);
|
||||
latestImportUri = url.toExternalForm();
|
||||
GetMethod get = createGetMethod(latestImportUri);
|
||||
httpClient.executeMethod(get);
|
||||
InputStream is = get.getResponseBodyAsStream();
|
||||
HttpRequestBase get = createGetMethod(latestImportUri);
|
||||
HttpResponse response = httpClient.execute(get);
|
||||
InputStream is = response.getEntity().getContent();
|
||||
inputStreams.add(is);
|
||||
return new InputSource(is);
|
||||
} catch (MalformedURLException ex) {
|
||||
@@ -110,36 +115,44 @@ public class WSDLLocatorImpl implements WSDLLocator {
|
||||
inputStreams.clear();
|
||||
}
|
||||
|
||||
private GetMethod createGetMethod(String uri) {
|
||||
GetMethod get = new GetMethod(uri);
|
||||
private HttpRequestBase createGetMethod(String uri) {
|
||||
HttpGet get = new HttpGet(uri);
|
||||
if (configuration.getCookie() != null) {
|
||||
get.setRequestHeader(HTTP_HEADER_COOKIE, configuration.getCookie());
|
||||
get.setHeader(HTTP_HEADER_COOKIE, configuration.getCookie());
|
||||
}
|
||||
|
||||
return get;
|
||||
}
|
||||
|
||||
private HttpClient createHttpClient() {
|
||||
HttpClient httpClient = new HttpClient();
|
||||
HttpClientBuilder builder = HttpClients.custom();
|
||||
CredentialsProvider credentialsProvider = null;
|
||||
if (configuration.getProxyServer() != null) {
|
||||
HostConfiguration hostConfiguration = new HostConfiguration();
|
||||
hostConfiguration.setProxy(configuration.getProxyServer(), configuration.getProxyPort());
|
||||
httpClient.setHostConfiguration(hostConfiguration);
|
||||
builder.setProxy(new HttpHost(configuration.getProxyServer(), configuration.getProxyPort()));
|
||||
}
|
||||
|
||||
if (configuration.getUsername() != null) {
|
||||
Credentials credentials = new UsernamePasswordCredentials(configuration.getUsername(), configuration.getPassword());
|
||||
|
||||
httpClient.getState().setCredentials(AuthScope.ANY, credentials);
|
||||
if (credentialsProvider == null) {
|
||||
credentialsProvider = new BasicCredentialsProvider();
|
||||
}
|
||||
credentialsProvider
|
||||
.setCredentials(AuthScope.ANY,
|
||||
new UsernamePasswordCredentials(configuration.getUsername(), configuration.getPassword()));
|
||||
}
|
||||
|
||||
if (configuration.getProxyUsername() != null) {
|
||||
Credentials credentials = new UsernamePasswordCredentials(configuration.getProxyUsername(),
|
||||
configuration.getProxyPassword());
|
||||
|
||||
httpClient.getState().setProxyCredentials(AuthScope.ANY, credentials);
|
||||
httpClient.getHostConfiguration().setProxy(configuration.getProxyServer(), configuration.getProxyPort());
|
||||
if (credentialsProvider == null) {
|
||||
credentialsProvider = new BasicCredentialsProvider();
|
||||
}
|
||||
credentialsProvider
|
||||
.setCredentials(new AuthScope(configuration.getProxyServer(), configuration.getProxyPort()),
|
||||
new UsernamePasswordCredentials(configuration.getProxyUsername(),
|
||||
configuration.getProxyPassword()));
|
||||
builder.setProxy(new HttpHost(configuration.getProxyServer(), configuration.getProxyPort()));
|
||||
}
|
||||
return httpClient;
|
||||
if (credentialsProvider != null) {
|
||||
builder.setDefaultCredentialsProvider(credentialsProvider);
|
||||
}
|
||||
return builder.build();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,15 +4,13 @@
|
||||
*/
|
||||
package org.talend.webservice.helper.map;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
import javax.xml.namespace.QName;
|
||||
|
||||
import org.talend.webservice.helper.PathUtil;
|
||||
import org.talend.webservice.mapper.AnyTypeMapper;
|
||||
import sun.awt.image.ImageWatched;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -24,35 +22,44 @@ public class MapConverter {
|
||||
public static final String LEFT_SQUARE_BRACKET = "[";
|
||||
public static final String RIGHT_SQUARE_BRACKET = "]";
|
||||
|
||||
private static Map<String, Object> newMap(boolean keepOrder) {
|
||||
if(keepOrder) return new LinkedHashMap<>();
|
||||
return new HashMap<>();
|
||||
}
|
||||
|
||||
public static Map<String, Object> deepMapToMap(Map<String, Object> map) {
|
||||
return deepMapToMap(map, null, SEPARATOR);
|
||||
return deepMapToMap(map, null, SEPARATOR, false);
|
||||
}
|
||||
|
||||
public static Map<String, Object> deepMapToMap(Map<String, Object> map, boolean keepOrder) {
|
||||
return deepMapToMap(map, null, SEPARATOR, keepOrder);
|
||||
}
|
||||
|
||||
public static Map<String, Object> mapToDeepMap(Map<String, Object> map) {
|
||||
return mapToDeepMap(map, SEPARATOR);
|
||||
}
|
||||
|
||||
private static Map<String, Object> deepMapToMap(Object value, String k, String sep) {
|
||||
private static Map<String, Object> deepMapToMap(Object value, String k, String sep, boolean keepOrder) {
|
||||
if (value instanceof Map) {
|
||||
Map<String, Object> map = (Map<String, Object>) value;
|
||||
Map<String, Object> out = new HashMap<String, Object>();
|
||||
Map<String, Object> out = newMap(keepOrder);
|
||||
for (Map.Entry<String, Object> entry : map.entrySet()) {
|
||||
if (k == null) {
|
||||
out.putAll(deepMapToMap(entry.getValue(), entry.getKey(), sep));
|
||||
out.putAll(deepMapToMap(entry.getValue(), entry.getKey(), sep, keepOrder));
|
||||
} else {
|
||||
out.putAll(deepMapToMap(entry.getValue(), k + sep + entry.
|
||||
getKey(), sep));
|
||||
getKey(), sep, keepOrder));
|
||||
}
|
||||
}
|
||||
return out;
|
||||
} else if (value instanceof List) {
|
||||
List<Object> list = (List<Object>) value;
|
||||
Map<String, Object> out = new HashMap<String, Object>();
|
||||
Map<String, Object> out = newMap(keepOrder);
|
||||
int i = 0;
|
||||
for (Object val : list) {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append(k).append(LEFT_SQUARE_BRACKET).append(i).append(RIGHT_SQUARE_BRACKET);
|
||||
out.putAll(deepMapToMap(val, sb.toString(), sep));
|
||||
out.putAll(deepMapToMap(val, sb.toString(), sep, keepOrder));
|
||||
i++;
|
||||
}
|
||||
out.put(k + ".size", list.size());
|
||||
|
||||
@@ -42,14 +42,18 @@ import javax.xml.transform.Result;
|
||||
import javax.xml.transform.dom.DOMResult;
|
||||
import javax.xml.transform.stream.StreamResult;
|
||||
|
||||
import org.apache.cxf.Bus;
|
||||
import org.apache.cxf.BusFactory;
|
||||
import org.apache.cxf.common.jaxb.JAXBBeanInfo;
|
||||
import org.apache.cxf.common.jaxb.JAXBContextProxy;
|
||||
import org.apache.cxf.common.logging.LogUtils;
|
||||
import org.apache.cxf.common.spi.ClassGeneratorClassLoader;
|
||||
import org.apache.cxf.common.util.ASMHelper;
|
||||
import org.apache.cxf.common.util.ASMHelper.ClassWriter;
|
||||
import org.apache.cxf.common.util.ASMHelper.FieldVisitor;
|
||||
import org.apache.cxf.common.util.ASMHelper.Label;
|
||||
import org.apache.cxf.common.util.ASMHelper.MethodVisitor;
|
||||
import org.apache.cxf.common.util.ASMHelperImpl;
|
||||
import org.apache.cxf.common.util.CachedClass;
|
||||
import org.apache.cxf.common.util.PackageUtils;
|
||||
import org.apache.cxf.common.util.ReflectionInvokationHandler;
|
||||
@@ -578,7 +582,7 @@ public final class JAXBUtils {
|
||||
public static void setNamespaceWrapper(final Map<String, String> nspref, Marshaller marshaller) throws PropertyException {
|
||||
Object mapper = null;
|
||||
if (marshaller.getClass().getName().contains(".internal.")) {
|
||||
mapper = createNamespaceWrapper(nspref);
|
||||
mapper = createNamespaceWrapper(null, nspref);
|
||||
if (mapper == null) {
|
||||
LOG.log(Level.INFO, "Could not create namespace mapper for JDK internal" + " JAXB implementation.");
|
||||
} else {
|
||||
@@ -595,6 +599,31 @@ public final class JAXBUtils {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* To avoid possible runtime collision.
|
||||
*/
|
||||
public static Object setNamespaceMapper(Bus bus, final Map<String, String> nspref,
|
||||
Marshaller marshaller) throws PropertyException {
|
||||
Object mapper = null;
|
||||
if (marshaller.getClass().getName().contains(".internal.")) {
|
||||
mapper = createNamespaceWrapper(bus, nspref);
|
||||
if (mapper == null) {
|
||||
LOG.log(Level.INFO, "Could not create namespace mapper for JDK internal" + " JAXB implementation.");
|
||||
} else {
|
||||
marshaller.setProperty("com.sun.xml.internal.bind.namespacePrefixMapper", mapper);
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
Class<?> cls = Class.forName("org.apache.cxf.common.jaxb.NamespaceMapper");
|
||||
mapper = cls.getConstructor(Map.class).newInstance(nspref);
|
||||
} catch (Exception ex) {
|
||||
LOG.log(Level.INFO, "Could not create NamespaceMapper", ex);
|
||||
}
|
||||
marshaller.setProperty("com.sun.xml.bind.namespacePrefixMapper", mapper);
|
||||
}
|
||||
return mapper;
|
||||
}
|
||||
|
||||
public static BridgeWrapper createBridge(Set<Class<?>> ctxClasses, QName qname, Class<?> refcls, Annotation anns[])
|
||||
throws JAXBException {
|
||||
try {
|
||||
@@ -1018,16 +1047,17 @@ public final class JAXBUtils {
|
||||
return false;
|
||||
}
|
||||
|
||||
private static synchronized Object createNamespaceWrapper(Map<String, String> map) {
|
||||
ASMHelper helper = new ASMHelper();
|
||||
private static synchronized Object createNamespaceWrapper(Bus bus, Map<String, String> map) {
|
||||
ASMHelper helper = new ASMHelperImpl();
|
||||
String className = "org.apache.cxf.jaxb.NamespaceMapperInternal";
|
||||
Class<?> cls = helper.findClass(className, JAXBUtils.class);
|
||||
NamespaceMapperClassGenerator nmcg = new NamespaceMapperClassGenerator(bus);
|
||||
Class<?> cls = nmcg.findClass(className, JAXBUtils.class);
|
||||
if (cls == null) {
|
||||
ClassWriter cw = helper.createClassWriter();
|
||||
if (cw == null) {
|
||||
return null;
|
||||
}
|
||||
cls = createNamespaceWrapperInternal(helper, cw);
|
||||
cls = createNamespaceWrapperInternal(helper, cw, nmcg);
|
||||
}
|
||||
try {
|
||||
return cls.getConstructor(Map.class).newInstance(map);
|
||||
@@ -1036,7 +1066,7 @@ public final class JAXBUtils {
|
||||
}
|
||||
}
|
||||
|
||||
private static Class<?> createNamespaceWrapperInternal(ASMHelper helper, ClassWriter cw) {
|
||||
private static Class<?> createNamespaceWrapperInternal(ASMHelper helper, ClassWriter cw, NamespaceMapperClassGenerator nmcg) {
|
||||
String className = "org.apache.cxf.jaxb.NamespaceMapperInternal";
|
||||
FieldVisitor fv;
|
||||
MethodVisitor mv;
|
||||
@@ -1127,7 +1157,7 @@ public final class JAXBUtils {
|
||||
}
|
||||
}
|
||||
|
||||
return helper.loadClass(className, cls, bts);
|
||||
return nmcg.loadClass(className, cls, bts);
|
||||
}
|
||||
|
||||
public static JAXBBeanInfo getBeanInfo(JAXBContextProxy context, Class<?> cls) {
|
||||
@@ -1138,4 +1168,20 @@ public final class JAXBUtils {
|
||||
return ReflectionInvokationHandler.createProxyWrapper(o, JAXBBeanInfo.class);
|
||||
}
|
||||
|
||||
private static class NamespaceMapperClassGenerator extends ClassGeneratorClassLoader {
|
||||
|
||||
private NamespaceMapperClassGenerator(Bus bus) {
|
||||
super(bus == null ? BusFactory.getDefaultBus() : bus);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Class<?> findClass(String className, Class<?> cls) {
|
||||
return super.findClass(className, cls);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Class<?> loadClass(String className, Class<?> cls, byte[] bytes) {
|
||||
return super.loadClass(className, cls, bytes);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,13 +3,12 @@
|
||||
*/
|
||||
package org.talend.webservice.mapper;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.talend.webservice.exception.LocalizedException;
|
||||
|
||||
import javax.xml.namespace.QName;
|
||||
|
||||
import org.talend.webservice.exception.LocalizedException;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -151,7 +150,7 @@ public class ComplexTypeMapper implements TypeMapper {
|
||||
if (!clazz.getName().equals(beanName)) {
|
||||
ComplexTypeMapper instanceComplexTypeMapper = findInstanceByClassName(beanName);
|
||||
if (instanceComplexTypeMapper != null) {
|
||||
Map<String, Object> values = new HashMap<String, Object>();
|
||||
Map<String, Object> values = new LinkedHashMap<String, Object>();
|
||||
values.put(ABSTRACT_TYPE_NAME, instanceComplexTypeMapper.typeName);
|
||||
values.put(instanceComplexTypeMapper.typeName.getLocalPart(), instanceComplexTypeMapper.typeToValue(bean));
|
||||
return values;
|
||||
@@ -167,7 +166,7 @@ public class ComplexTypeMapper implements TypeMapper {
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
Map<String, Object> values = new HashMap<String, Object>(mappers.size());
|
||||
Map<String, Object> values = new LinkedHashMap<String, Object>(mappers.size());
|
||||
for (Map.Entry<String, PropertyMapper> entry : mappers.entrySet()) {
|
||||
Object value = entry.getValue().getValueFrom(bean);
|
||||
if (value != null) {
|
||||
@@ -198,7 +197,7 @@ public class ComplexTypeMapper implements TypeMapper {
|
||||
if (params == null) {
|
||||
return null;
|
||||
}
|
||||
Map<String, Object> values = new HashMap<String, Object>(mappers.size());
|
||||
Map<String, Object> values = new LinkedHashMap<String, Object>(mappers.size());
|
||||
|
||||
int i = 0;
|
||||
for (Object param : params) {
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
package org.talend.webservice.mapper;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -336,7 +337,8 @@ public class MapperFactory {
|
||||
Class<?> clazz = classMapper.getClassForType(xmlSchemaComplexType.getQName(), orderedMap.keyList(), 1);
|
||||
|
||||
// 3.create propertyMapper (propertyName,class,schemaTypeMap,typeMapperQname)
|
||||
Map<String, PropertyMapper> mappers = new HashMap<String, PropertyMapper>();
|
||||
//need to use the order map as the order is important for response auto parser by index
|
||||
Map<String, PropertyMapper> mappers = new LinkedHashMap<>();
|
||||
for (String key : properties.keySet()) {
|
||||
Object xmlSchemaObject = properties.get(key);
|
||||
if (xmlSchemaObject == null) {
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
package org.talend.webservice.mapper;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.wsdl.Message;
|
||||
@@ -152,7 +153,7 @@ public class MessageMapperImpl implements MessageMapper {
|
||||
return wrappedValue;
|
||||
} else {
|
||||
List<Part> orderedParts = message.getOrderedParts(null);
|
||||
Map<String, Object> values = new HashMap<String, Object>(params.length);
|
||||
Map<String, Object> values = new LinkedHashMap<String, Object>(params.length);
|
||||
int i = 0;
|
||||
for (Object param : params) {
|
||||
Part part = orderedParts.get(i);
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
org.talend.ws.exception.IllegalPropertyAccessException=\u0391\u03B4\u03C5\u03BD\u03B1\u03BC\u03AF\u03B1 \u03C0\u03C1\u03CC\u03C3\u03B2\u03B1\u03C3\u03B7\u03C2 \u03C3\u03C4\u03B7\u03BD \u03B9\u03B4\u03B9\u03CC\u03C4\u03B7\u03C4\u03B1 {0} \u03C0\u03BF\u03C5 \u03B4\u03B5\u03BD \u03B5\u03AF\u03BD\u03B1\u03B9 \u03C0\u03C1\u03BF\u03C3\u03B2\u03AC\u03C3\u03B9\u03BC\u03B7 \u03B3\u03B9\u03B1 \u03C4\u03CD\u03C0\u03BF {1}
|
||||
org.talend.ws.exception.NoSuchPropertyException=\u0397 \u03B9\u03B4\u03B9\u03CC\u03C4\u03B7\u03C4\u03B1 {0} \u03B4\u03B5\u03BD \u03C5\u03C0\u03AC\u03C1\u03C7\u03B5\u03B9 \u03B3\u03B9\u03B1 \u03C4\u03BF\u03BD \u03C4\u03CD\u03C0\u03BF {1}
|
||||
org.talend.ws.exception.Instantiation=\u0391\u03B4\u03C5\u03BD\u03B1\u03BC\u03AF\u03B1 \u03BD\u03B1 \u03B4\u03BF\u03B8\u03B5\u03AF \u03C5\u03C0\u03CC\u03C3\u03C4\u03B1\u03C3\u03B7 \u03C3\u03B5 \u03BA\u03BB\u03AC\u03C3\u03B7 \u03C4\u03CD\u03C0\u03BF\u03C5 {0}
|
||||
org.talend.ws.exception.illegalAccessValueOf=\u0391\u03B4\u03C5\u03BD\u03B1\u03BC\u03AF\u03B1 \u03BA\u03BB\u03AE\u03C3\u03B7\u03C2 \u03BC\u03B5\u03B8\u03CC\u03B4\u03BF\u03C5 valueOf \u03B3\u03B9\u03B1 \u03C4\u03CD\u03C0\u03BF enum {0}
|
||||
org.talend.ws.exception.Unknown=\u039C\u03B9\u03B1 \u03AC\u03B3\u03BD\u03C9\u03C3\u03C4\u03B7 \u03B5\u03BE\u03B1\u03AF\u03C1\u03B5\u03C3\u03B7 \u03C0\u03C1\u03BF\u03AD\u03BA\u03C5\u03C8\u03B5
|
||||
org.talend.ws.exception.InvalidEnumValueException=\u0397 \u03C4\u03B9\u03BC\u03AE {0} \u03B4\u03B5\u03BD \u03B5\u03AF\u03BD\u03B1\u03B9 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B3\u03B9\u03B1 enum {1}
|
||||
org.talend.ws.exception.InvalidParameterAnyType=\u03A0\u03C1\u03AD\u03C0\u03B5\u03B9 \u03BD\u03B1 \u03C0\u03C1\u03BF\u03C3\u03B4\u03B9\u03BF\u03C1\u03AF\u03C3\u03B5\u03C4\u03B5 \u03AD\u03BD\u03B1\u03BD \u03C7\u03AC\u03C1\u03C4\u03B7 \u03C3\u03B1\u03BD \u03B1\u03C5\u03C4\u03CC\u03BD \u03B3\u03B9\u03B1 anyTypes : {anyType: value, anyType_type: qname}
|
||||
@@ -1,8 +0,0 @@
|
||||
org.talend.ws.exception.IllegalPropertyAccessException=Unable to access property {0} which is not accessible for type {1}
|
||||
org.talend.ws.exception.NoSuchPropertyException=Property {0} does not exist for type {1}
|
||||
org.talend.ws.exception.Instantiation=Unable to instantiate class of type {0}
|
||||
org.talend.ws.exception.InvocationTargetPropertyAccessor=A property accessor has thrown an exception : property {0} of class {1}
|
||||
org.talend.ws.exception.illegalAccessValueOf=Unable to call method valueOf for enum type {0}
|
||||
org.talend.ws.exception.Unknown=An unknown exception has been thrown
|
||||
org.talend.ws.exception.InvalidEnumValueException=Value {0} is not valid for enum {1}
|
||||
org.talend.ws.exception.InvalidParameterAnyType=You must specify a map like this for anyTypes : {anyType: value, anyType_type: qname} pour les anyType
|
||||
@@ -1,6 +1,8 @@
|
||||
org.talend.ws.exception.IllegalPropertyAccessException=Impossible d'acc\u00e9der \u00e0 la propri\u00e9t\u00e9 {0} qui est inaccessible pour le type {1}
|
||||
org.talend.ws.exception.NoSuchPropertyException=La propri\u00e9t\u00e9 {0} n'existe pas pour le type {1}
|
||||
org.talend.ws.exception.Instantiation=Impossible d'instancier la classe de type {0}
|
||||
org.talend.ws.exception.illegalAccessValueOf=Impossible d'appeler une m\u00e9thode valueOf pour le type enum {0}
|
||||
org.talend.ws.exception.Unknown=Une exception inconnue a \u00e9t\u00e9 rencontr\u00e9e
|
||||
org.talend.ws.exception.IllegalPropertyAccessException=Impossible d'acc\u00E9der \u00E0 la propri\u00E9t\u00E9 {0} qui est inaccessible pour le type {1}
|
||||
org.talend.ws.exception.NoSuchPropertyException=La propri\u00E9t\u00E9 {0} n'existe pas pour le type {1}
|
||||
org.talend.ws.exception.Instantiation=Impossible d'instancier le type de classe {0}
|
||||
org.talend.ws.exception.InvocationTargetPropertyAccessor=Un accesseur de propri\u00E9t\u00E9 a retourner une exception : propri\u00E9t\u00E9 {0} de classe {1}
|
||||
org.talend.ws.exception.illegalAccessValueOf=Impossible d'appeler une m\u00E9thode valueOf pour le type enum {0}
|
||||
org.talend.ws.exception.Unknown=Une exception inconnue a \u00E9t\u00E9 d\u00E9clench\u00E9e
|
||||
org.talend.ws.exception.InvalidEnumValueException=La valeur {0} n'est pas valide pour enum {1}
|
||||
org.talend.ws.exception.InvalidParameterAnyType=Vous devez sp\u00E9cifier une Map comme celle-ci pour anyTypes : {anyType: value, anyType_type: qname} pour les anyType
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
org.talend.ws.exception.IllegalPropertyAccessException=\u30BF\u30A4\u30D7{1}\u306B\u30A2\u30AF\u30BB\u30B9\u3067\u304D\u306A\u3044\u30D7\u30ED\u30D1\u30C6\u30A3{0}\u306B\u30A2\u30AF\u30BB\u30B9\u3059\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093
|
||||
org.talend.ws.exception.IllegalPropertyAccessException={0} \u30D7\u30ED\u30D1\u30C6\u30A3\u306B\u30A2\u30AF\u30BB\u30B9\u3067\u304D\u307E\u305B\u3093\u3002\u3053\u308C\u306F {1} \u578B\u306E\u305F\u3081\u30A2\u30AF\u30BB\u30B9\u3067\u304D\u307E\u305B\u3093\u3002
|
||||
org.talend.ws.exception.NoSuchPropertyException=\u30BF\u30A4\u30D7{1}\u306E\u30D7\u30ED\u30D1\u30C6\u30A3{0}\u306F\u5B58\u5728\u3057\u307E\u305B\u3093
|
||||
org.talend.ws.exception.Instantiation=\u30BF\u30A4\u30D7{0}\u306E\u30AF\u30E9\u30B9\u3092\u30A4\u30F3\u30B9\u30BF\u30F3\u30B9\u5316\u3059\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093
|
||||
org.talend.ws.exception.InvocationTargetPropertyAccessor=\u30D7\u30ED\u30D1\u30C6\u30A3\u30A2\u30AF\u30BB\u30C3\u30B5\u306F\u4F8B\u5916\u3092\u767A\u751F\u3055\u305B\u307E\u3057\u305F: \u30AF\u30E9\u30B9{1}\u306E\u30D7\u30ED\u30D1\u30C6\u30A3{0}
|
||||
org.talend.ws.exception.illegalAccessValueOf=enum\u578B{0}\u306E\u30E1\u30BD\u30C3\u30C9valueOf\u3092\u547C\u3073\u51FA\u3059\u3053\u3068\u304C\u3067\u304D\u307E\u305B\u3093
|
||||
org.talend.ws.exception.Unknown=\u4E0D\u660E\u306A\u4F8B\u5916\u304C\u767A\u751F\u3057\u307E\u3057\u305F
|
||||
org.talend.ws.exception.InvalidEnumValueException=\u5024{0}\u306F\u5217\u6319\u578B{1}\u3068\u3057\u3066\u6709\u52B9\u3067\u306F\u3042\u308A\u307E\u305B\u3093
|
||||
org.talend.ws.exception.InvalidParameterAnyType=\u3053\u306E\u3088\u3046\u306AanyTypes\u306E\u30DE\u30C3\u30D7\u3092\u6307\u5B9A\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059: {anyType: value, anyType_type: qname}
|
||||
org.talend.ws.exception.Instantiation={0} \u578B\u306E\u30AF\u30E9\u30B9\u306E\u30A4\u30F3\u30B9\u30BF\u30F3\u30B9\u3092\u4F5C\u6210\u3067\u304D\u307E\u305B\u3093\u3002
|
||||
org.talend.ws.exception.InvocationTargetPropertyAccessor=\u30D7\u30ED\u30D1\u30C6\u30A3\u30A2\u30AF\u30BB\u30B9\u306B\u3088\u308A\u3001\u4F8B\u5916\u304C\u30B9\u30ED\u30FC\u3055\u308C\u307E\u3057\u305F\uFF1A\u30AF\u30E9\u30B9 {1} \u306E\u30D7\u30ED\u30D1\u30C6\u30A3 {0}
|
||||
org.talend.ws.exception.illegalAccessValueOf=\u5217\u6319\u578B {0} \u306EvalueOf\u30E1\u30BD\u30C3\u30C9\u3092\u547C\u3073\u51FA\u3059\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093
|
||||
org.talend.ws.exception.Unknown=\u4E0D\u660E\u306A\u4F8B\u5916\u304C\u30B9\u30ED\u30FC\u3055\u308C\u307E\u3057\u305F
|
||||
org.talend.ws.exception.InvalidEnumValueException=\u5024 {0} \u306Fenum\u578B {1} \u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002
|
||||
org.talend.ws.exception.InvalidParameterAnyType=\u30DE\u30C3\u30D7\u306F\u3069\u306E\u30BF\u30A4\u30D7\u306B\u3064\u3044\u3066\u3082\u4EE5\u4E0B\u306E\u3088\u3046\u306B\u6307\u5B9A\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059: {anyType: value, anyType_type: qname}
|
||||
|
||||
@@ -3,6 +3,6 @@ org.talend.ws.exception.NoSuchPropertyException=\u5C5E\u6027 {0} \u5BF9\u4E8E\u7
|
||||
org.talend.ws.exception.Instantiation=\u65E0\u6CD5\u5B9E\u4F8B\u5316\u7C7B\u578B {0} \u7684\u7C7B
|
||||
org.talend.ws.exception.InvocationTargetPropertyAccessor=\u5C5E\u6027\u8BBF\u95EE\u5668\u629B\u51FA\u4E86\u4E00\u4E2A\u5F02\u5E38\uFF1A\u7C7B {1} \u7684\u5C5E\u6027 {0}
|
||||
org.talend.ws.exception.illegalAccessValueOf=\u65E0\u6CD5\u4E3A\u679A\u4E3E\u7C7B\u578B {0} \u8C03\u7528\u65B9\u6CD5 valueOf
|
||||
org.talend.ws.exception.Unknown=\u629B\u51FA\u4E86\u4E00\u4E2A\u672A\u77E5\u7684\u5F02\u5E38
|
||||
org.talend.ws.exception.Unknown=\u53D1\u751F\u4E00\u4E2A\u672A\u77E5\u5F02\u5E38
|
||||
org.talend.ws.exception.InvalidEnumValueException=\u503C {0} \u5BF9\u4E8E\u679A\u4E3E {1} \u65E0\u6548
|
||||
org.talend.ws.exception.InvalidParameterAnyType=\u60A8\u5FC5\u987B\u6309\u5982\u4E0B\u6240\u793A\u4E3A anyType \u6307\u5B9A\u6620\u5C04\uFF1A{anyType: value, anyType_type: qname}
|
||||
|
||||
@@ -63,9 +63,9 @@
|
||||
<version>4.1.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>1.2.17</version>
|
||||
<groupId>ch.qos.reload4j</groupId>
|
||||
<artifactId>reload4j</artifactId>
|
||||
<version>1.2.19</version>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 -->
|
||||
<dependency>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
<groupId>org.talend</groupId>
|
||||
<artifactId>talendMQConnectionUtil</artifactId>
|
||||
<version>1.0.1-20190215</version>
|
||||
<version>1.1.0-20220307</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>talendMQConnectionUtil</name>
|
||||
@@ -55,13 +55,8 @@
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.ibm.mq</groupId>
|
||||
<artifactId>com.ibm.mq</artifactId>
|
||||
<version>8.0.0.9</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.ibm.mq</groupId>
|
||||
<artifactId>com.ibm.mqjms</artifactId>
|
||||
<version>8.0.0.9</version>
|
||||
<artifactId>com.ibm.mq.allclient</artifactId>
|
||||
<version>9.2.4.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.resource</groupId>
|
||||
@@ -71,7 +66,7 @@
|
||||
<dependency>
|
||||
<groupId>org.talend</groupId>
|
||||
<artifactId>talendMQRFH2</artifactId>
|
||||
<version>1.0.1-20190206</version>
|
||||
<version>1.1.0-20220307</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mockito</groupId>
|
||||
|
||||
@@ -53,9 +53,9 @@
|
||||
<version>4.1.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>1.2.17</version>
|
||||
<groupId>ch.qos.reload4j</groupId>
|
||||
<artifactId>reload4j</artifactId>
|
||||
<version>1.2.19</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.talend.libraries</groupId>
|
||||
<groupId>org.talend.components</groupId>
|
||||
<artifactId>talendssl</artifactId>
|
||||
<version>1.0-20190118</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
@@ -4,7 +4,16 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.talend.components</groupId>
|
||||
<artifactId>talendzip</artifactId>
|
||||
<version>1.2-20210901</version>
|
||||
<version>1.3</version>
|
||||
|
||||
<licenses>
|
||||
<license>
|
||||
<name>Apache License, Version 2.0</name>
|
||||
<url>https://www.talendforge.org/modules/licenses/APACHE_v2.txt</url>
|
||||
<distribution>may be downloaded from the Maven repository</distribution>
|
||||
</license>
|
||||
</licenses>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
@@ -52,7 +61,7 @@
|
||||
<dependency>
|
||||
<groupId>net.lingala.zip4j</groupId>
|
||||
<artifactId>zip4j</artifactId>
|
||||
<version>1.3.3</version>
|
||||
<version>2.10.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -61,10 +70,5 @@
|
||||
<version>1.21</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.talend.components</groupId>
|
||||
<artifactId>checkArchive</artifactId>
|
||||
<version>1.2-20210901</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
||||
@@ -1,184 +1,183 @@
|
||||
package org.talend.archive;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
|
||||
import javax.crypto.Cipher;
|
||||
import javax.crypto.CipherInputStream;
|
||||
import javax.crypto.SecretKey;
|
||||
import javax.crypto.SecretKeyFactory;
|
||||
import javax.crypto.spec.PBEKeySpec;
|
||||
import javax.crypto.spec.PBEParameterSpec;
|
||||
|
||||
import org.apache.commons.compress.archivers.ArchiveEntry;
|
||||
import org.apache.commons.compress.archivers.tar.TarArchiveInputStream;
|
||||
import org.apache.commons.compress.archivers.zip.ZipArchiveInputStream;
|
||||
import org.apache.commons.compress.archivers.zip.ZipFile;
|
||||
|
||||
// import javax.crypto.Cipher;
|
||||
|
||||
public class IntegrityUtil {
|
||||
|
||||
/**
|
||||
* Is used to check if the zip file is corrupted/destroyed
|
||||
*
|
||||
* @param file
|
||||
* @return
|
||||
*/
|
||||
public static boolean isZipValid(final File file) {
|
||||
ZipFile zipFile = null;
|
||||
|
||||
try {
|
||||
zipFile = new ZipFile(file);
|
||||
|
||||
return true;
|
||||
} catch (IOException e) {
|
||||
return false;
|
||||
} finally {
|
||||
try {
|
||||
if (zipFile != null) {
|
||||
zipFile.close();
|
||||
zipFile = null;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void validate(final File file) {
|
||||
ZipFile zipFile = null;
|
||||
|
||||
try {
|
||||
zipFile = new ZipFile(file);
|
||||
|
||||
} catch (IOException e) {
|
||||
} finally {
|
||||
try {
|
||||
if (zipFile != null) {
|
||||
zipFile.close();
|
||||
zipFile = null;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* To check if the encrpted zip file is corrupted or not
|
||||
*
|
||||
* @param file
|
||||
* @param password
|
||||
* @return
|
||||
*/
|
||||
public static boolean isEncryptedZipValid(final File file, String password) {
|
||||
ZipArchiveInputStream input = null;
|
||||
InputStream target = null;
|
||||
try {
|
||||
target = new FileInputStream(file);
|
||||
target = new CipherInputStream(target, createCipher(Cipher.DECRYPT_MODE, password));
|
||||
input = new ZipArchiveInputStream(target);
|
||||
ArchiveEntry entry = input.getNextEntry();
|
||||
return true;
|
||||
|
||||
} catch (IOException e) {
|
||||
return false;
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
} finally {
|
||||
try {
|
||||
if (input != null) {
|
||||
input.close();
|
||||
input = null;
|
||||
}
|
||||
if (target != null) {
|
||||
target.close();
|
||||
target = null;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to check tar.gz/.tgz/.gz file is corrupted/destroyed
|
||||
*
|
||||
* @param fileName
|
||||
* @return
|
||||
*/
|
||||
public static boolean isGZIPValid(final String fileName) {
|
||||
GZIPInputStream inputStream = null;
|
||||
InputStream is = null;
|
||||
try {
|
||||
is = new FileInputStream(new File(fileName));
|
||||
inputStream = new GZIPInputStream(is);
|
||||
return true;
|
||||
} catch (IOException e) {
|
||||
return false;
|
||||
}finally {
|
||||
try {
|
||||
if (inputStream != null) {
|
||||
inputStream.close();
|
||||
inputStream = null;
|
||||
} else if(is != null) {
|
||||
is.close();
|
||||
is = null;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to check tar.tar file is corrupted/destroyed
|
||||
*
|
||||
* @param fileName
|
||||
* @return
|
||||
*/
|
||||
public static boolean isTarValid(final String fileName) {
|
||||
TarArchiveInputStream inputStream = null;
|
||||
InputStream is = null;
|
||||
try {
|
||||
is = new FileInputStream(new File(fileName));
|
||||
inputStream = new TarArchiveInputStream(is);
|
||||
return inputStream.canReadEntryData(inputStream.getNextEntry());
|
||||
|
||||
} catch (IOException e) {
|
||||
return false;
|
||||
}finally {
|
||||
try {
|
||||
if (inputStream != null) {
|
||||
inputStream.close();
|
||||
inputStream = null;
|
||||
} else if(is != null) {
|
||||
is.close();
|
||||
is = null;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param mode
|
||||
* @param password
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public static Cipher createCipher(int mode, String password) throws Exception {
|
||||
String alg = "PBEWithSHA1AndDESede"; // BouncyCastle has better algorithms
|
||||
PBEKeySpec keySpec = new PBEKeySpec(password.toCharArray());
|
||||
SecretKeyFactory keyFactory = SecretKeyFactory.getInstance(alg);
|
||||
SecretKey secretKey = keyFactory.generateSecret(keySpec);
|
||||
|
||||
Cipher cipher = Cipher.getInstance("PBEWithSHA1AndDESede");
|
||||
cipher.init(mode, secretKey, new PBEParameterSpec("saltsalt".getBytes(), 2000));
|
||||
|
||||
return cipher;
|
||||
}
|
||||
}
|
||||
package com.talend.compress.zip;
|
||||
|
||||
import org.apache.commons.compress.archivers.ArchiveEntry;
|
||||
import org.apache.commons.compress.archivers.tar.TarArchiveInputStream;
|
||||
import org.apache.commons.compress.archivers.zip.ZipArchiveInputStream;
|
||||
import org.apache.commons.compress.archivers.zip.ZipFile;
|
||||
|
||||
import javax.crypto.Cipher;
|
||||
import javax.crypto.CipherInputStream;
|
||||
import javax.crypto.SecretKey;
|
||||
import javax.crypto.SecretKeyFactory;
|
||||
import javax.crypto.spec.PBEKeySpec;
|
||||
import javax.crypto.spec.PBEParameterSpec;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
|
||||
// import javax.crypto.Cipher;
|
||||
|
||||
public class IntegrityUtil {
|
||||
|
||||
/**
|
||||
* Is used to check if the zip file is corrupted/destroyed
|
||||
*
|
||||
* @param file
|
||||
* @return
|
||||
*/
|
||||
public static boolean isZipValid(final File file) {
|
||||
ZipFile zipFile = null;
|
||||
|
||||
try {
|
||||
zipFile = new ZipFile(file);
|
||||
|
||||
return true;
|
||||
} catch (IOException e) {
|
||||
return false;
|
||||
} finally {
|
||||
try {
|
||||
if (zipFile != null) {
|
||||
zipFile.close();
|
||||
zipFile = null;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void validate(final File file) {
|
||||
ZipFile zipFile = null;
|
||||
|
||||
try {
|
||||
zipFile = new ZipFile(file);
|
||||
|
||||
} catch (IOException e) {
|
||||
} finally {
|
||||
try {
|
||||
if (zipFile != null) {
|
||||
zipFile.close();
|
||||
zipFile = null;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* To check if the encrpted zip file is corrupted or not
|
||||
*
|
||||
* @param file
|
||||
* @param password
|
||||
* @return
|
||||
*/
|
||||
public static boolean isEncryptedZipValid(final File file, String password) {
|
||||
ZipArchiveInputStream input = null;
|
||||
InputStream target = null;
|
||||
try {
|
||||
target = new FileInputStream(file);
|
||||
target = new CipherInputStream(target, createCipher(Cipher.DECRYPT_MODE, password));
|
||||
input = new ZipArchiveInputStream(target);
|
||||
ArchiveEntry entry = input.getNextEntry();
|
||||
return true;
|
||||
|
||||
} catch (IOException e) {
|
||||
return false;
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
} finally {
|
||||
try {
|
||||
if (input != null) {
|
||||
input.close();
|
||||
input = null;
|
||||
}
|
||||
if (target != null) {
|
||||
target.close();
|
||||
target = null;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to check tar.gz/.tgz/.gz file is corrupted/destroyed
|
||||
*
|
||||
* @param fileName
|
||||
* @return
|
||||
*/
|
||||
public static boolean isGZIPValid(final String fileName) {
|
||||
GZIPInputStream inputStream = null;
|
||||
InputStream is = null;
|
||||
try {
|
||||
is = new FileInputStream(new File(fileName));
|
||||
inputStream = new GZIPInputStream(is);
|
||||
return true;
|
||||
} catch (IOException e) {
|
||||
return false;
|
||||
}finally {
|
||||
try {
|
||||
if (inputStream != null) {
|
||||
inputStream.close();
|
||||
inputStream = null;
|
||||
} else if(is != null) {
|
||||
is.close();
|
||||
is = null;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to check tar.tar file is corrupted/destroyed
|
||||
*
|
||||
* @param fileName
|
||||
* @return
|
||||
*/
|
||||
public static boolean isTarValid(final String fileName) {
|
||||
TarArchiveInputStream inputStream = null;
|
||||
InputStream is = null;
|
||||
try {
|
||||
is = new FileInputStream(new File(fileName));
|
||||
inputStream = new TarArchiveInputStream(is);
|
||||
return inputStream.canReadEntryData(inputStream.getNextEntry());
|
||||
|
||||
} catch (IOException e) {
|
||||
return false;
|
||||
}finally {
|
||||
try {
|
||||
if (inputStream != null) {
|
||||
inputStream.close();
|
||||
inputStream = null;
|
||||
} else if(is != null) {
|
||||
is.close();
|
||||
is = null;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param mode
|
||||
* @param password
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public static Cipher createCipher(int mode, String password) throws Exception {
|
||||
String alg = "PBEWithSHA1AndDESede"; // BouncyCastle has better algorithms
|
||||
PBEKeySpec keySpec = new PBEKeySpec(password.toCharArray());
|
||||
SecretKeyFactory keyFactory = SecretKeyFactory.getInstance(alg);
|
||||
SecretKey secretKey = keyFactory.generateSecret(keySpec);
|
||||
|
||||
Cipher cipher = Cipher.getInstance("PBEWithSHA1AndDESede");
|
||||
cipher.init(mode, secretKey, new PBEParameterSpec("saltsalt".getBytes(), 2000));
|
||||
|
||||
return cipher;
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,11 @@
|
||||
package com.talend.compress.zip;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import net.lingala.zip4j.core.ZipFile;
|
||||
import net.lingala.zip4j.ZipFile;
|
||||
import net.lingala.zip4j.model.FileHeader;
|
||||
|
||||
public class Unzip {
|
||||
@@ -96,9 +97,10 @@ public class Unzip {
|
||||
"Please enter the password and try again..");
|
||||
}
|
||||
|
||||
ZipFile zipFile = new ZipFile(sourceZip);
|
||||
ZipFile zipFile = new ZipFile(sourceZip,password.toCharArray());
|
||||
|
||||
if(encording != null){
|
||||
zipFile.setFileNameCharset(encording);
|
||||
zipFile.setCharset(Charset.forName(encording));
|
||||
}
|
||||
|
||||
if (checkArchive) {
|
||||
@@ -108,10 +110,6 @@ public class Unzip {
|
||||
}
|
||||
}
|
||||
|
||||
if (zipFile.isEncrypted()) {
|
||||
zipFile.setPassword(password);
|
||||
}
|
||||
|
||||
List fileHeaderList = zipFile.getFileHeaders();
|
||||
|
||||
if (fileHeaderList == null) {
|
||||
@@ -130,7 +128,7 @@ public class Unzip {
|
||||
filename = filename.substring(filename.lastIndexOf('/') + 1);
|
||||
}
|
||||
|
||||
zipFile.extractFile(fileHeader, targetDir, null, filename);
|
||||
zipFile.extractFile(fileHeader, targetDir, filename);
|
||||
util.addUnzippedFiles(targetDir, filename);
|
||||
}
|
||||
}
|
||||
@@ -147,7 +145,7 @@ public class Unzip {
|
||||
}
|
||||
|
||||
if (checkArchive) {
|
||||
if (!org.talend.archive.IntegrityUtil.isEncryptedZipValid(file,
|
||||
if (!IntegrityUtil.isEncryptedZipValid(file,
|
||||
password)) {
|
||||
throw new RuntimeException("The file " + sourceZip
|
||||
+ " is corrupted, process terminated...");
|
||||
@@ -158,7 +156,7 @@ public class Unzip {
|
||||
try {
|
||||
is = new java.io.FileInputStream(sourceZip);
|
||||
is = new javax.crypto.CipherInputStream(is,
|
||||
org.talend.archive.IntegrityUtil.createCipher(
|
||||
IntegrityUtil.createCipher(
|
||||
javax.crypto.Cipher.DECRYPT_MODE, password));
|
||||
org.apache.commons.compress.archivers.zip.ZipArchiveInputStream input = new org.apache.commons.compress.archivers.zip.ZipArchiveInputStream(
|
||||
new java.io.BufferedInputStream(is),Optional.ofNullable(encording).orElse("UTF8"));
|
||||
@@ -184,7 +182,7 @@ public class Unzip {
|
||||
// apache common compress impl
|
||||
public void doUnzipWithoutDecryption() throws Exception {
|
||||
if (checkArchive
|
||||
&& !org.talend.archive.IntegrityUtil
|
||||
&& !IntegrityUtil
|
||||
.isZipValid(new java.io.File(sourceZip))) {
|
||||
Thread.sleep(1000); // To make the process terminated after the
|
||||
// System.out.println
|
||||
|
||||
@@ -5,16 +5,20 @@ import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.zip.GZIPOutputStream;
|
||||
|
||||
import net.lingala.zip4j.core.ZipFile;
|
||||
import net.lingala.zip4j.ZipFile;
|
||||
import net.lingala.zip4j.model.ZipParameters;
|
||||
import net.lingala.zip4j.util.Zip4jConstants;
|
||||
|
||||
import net.lingala.zip4j.model.enums.AesKeyStrength;
|
||||
import net.lingala.zip4j.model.enums.CompressionLevel;
|
||||
import net.lingala.zip4j.model.enums.CompressionMethod;
|
||||
import net.lingala.zip4j.model.enums.EncryptionMethod;
|
||||
import org.apache.commons.compress.archivers.tar.TarArchiveEntry;
|
||||
import org.apache.commons.compress.archivers.tar.TarArchiveOutputStream;
|
||||
import org.apache.commons.compress.compressors.gzip.GzipUtils;
|
||||
@@ -26,7 +30,7 @@ public class Zip {
|
||||
private String targetZip;
|
||||
private boolean overwriteExistTargetZip = true;
|
||||
private boolean makeTargetDir = false;
|
||||
private int compressLevel = 4;
|
||||
private CompressionLevel compressLevel = CompressionLevel.MEDIUM_FAST;
|
||||
private String encoding = "ISO-8859-15";
|
||||
|
||||
private boolean allFiles = true;
|
||||
@@ -40,8 +44,8 @@ public class Zip {
|
||||
|
||||
private boolean useZip4jEncryption = false;
|
||||
|
||||
private int encryptionMethod = Zip4jConstants.ENC_METHOD_AES;
|
||||
private int aesKeyStrength = Zip4jConstants.AES_STRENGTH_256;
|
||||
private EncryptionMethod encryptionMethod = EncryptionMethod.AES;
|
||||
private AesKeyStrength aesKeyStrength = AesKeyStrength.KEY_STRENGTH_256;
|
||||
|
||||
private String archiveFormat = "zip";
|
||||
private boolean syncFlush;
|
||||
@@ -79,19 +83,29 @@ public class Zip {
|
||||
}
|
||||
|
||||
public void setCompressLevel(int compressLevel) {
|
||||
this.compressLevel = compressLevel;
|
||||
switch (compressLevel){
|
||||
case 0:
|
||||
this.compressLevel = CompressionLevel.NO_COMPRESSION;
|
||||
break;
|
||||
case 4:
|
||||
this.compressLevel = CompressionLevel.MEDIUM_FAST;
|
||||
break;
|
||||
case 9:
|
||||
this.compressLevel = CompressionLevel.ULTRA;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void setMakeTargetDir(boolean makeTargetDir) {
|
||||
this.makeTargetDir = makeTargetDir;
|
||||
}
|
||||
|
||||
public void setEncryptionMethod(int encryptionMethod) {
|
||||
this.encryptionMethod = encryptionMethod;
|
||||
public void setEncryptionMethod(String encryptionMethod) {
|
||||
this.encryptionMethod = EncryptionMethod.valueOf(encryptionMethod);
|
||||
}
|
||||
|
||||
public void setAesKeyStrength(int aesKeyStrength) {
|
||||
this.aesKeyStrength = aesKeyStrength;
|
||||
this.aesKeyStrength = AesKeyStrength.getAesKeyStrengthFromRawCode(aesKeyStrength);
|
||||
}
|
||||
|
||||
public String getArchiveFormat() {
|
||||
@@ -185,7 +199,7 @@ public class Zip {
|
||||
targetFile.setLastModified(System.currentTimeMillis());
|
||||
FileOutputStream fos = new FileOutputStream(targetFile);
|
||||
final boolean syncFlush = this.syncFlush;
|
||||
final int compressLevel = this.compressLevel;
|
||||
final int compressLevel = this.compressLevel.getLevel();
|
||||
TarArchiveOutputStream taos = new TarArchiveOutputStream(new GZIPOutputStream(fos, syncFlush) {
|
||||
{
|
||||
this.def.setLevel(compressLevel);
|
||||
@@ -222,7 +236,7 @@ public class Zip {
|
||||
OutputStream out = new FileOutputStream(tarFile);
|
||||
try {
|
||||
final boolean syncFlush = this.syncFlush;
|
||||
final int compressLevel = this.compressLevel;
|
||||
final int compressLevel = this.compressLevel.getLevel();
|
||||
GZIPOutputStream gcos = new GZIPOutputStream(out, syncFlush) {
|
||||
{
|
||||
this.def.setLevel(compressLevel);
|
||||
@@ -247,7 +261,7 @@ public class Zip {
|
||||
try {
|
||||
output_stream = new java.io.FileOutputStream(targetZip);
|
||||
if (isEncrypted && !"".equals(password)) {
|
||||
output_stream = new javax.crypto.CipherOutputStream(output_stream, org.talend.archive.IntegrityUtil.createCipher(
|
||||
output_stream = new javax.crypto.CipherOutputStream(output_stream, IntegrityUtil.createCipher(
|
||||
javax.crypto.Cipher.ENCRYPT_MODE, password));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
@@ -260,7 +274,7 @@ public class Zip {
|
||||
org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream out = null;
|
||||
out = new org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream(
|
||||
new java.io.BufferedOutputStream(output_stream));
|
||||
out.setLevel(compressLevel);
|
||||
out.setLevel(compressLevel.getLevel());
|
||||
// set filename & comment encoding
|
||||
out.setEncoding(encoding);
|
||||
if ("ALWAYS".equals(zip64Mode)) {
|
||||
@@ -302,26 +316,26 @@ public class Zip {
|
||||
// zip4j impl
|
||||
private void doZip2(final File source, final List<File> list) throws Exception {
|
||||
|
||||
ZipFile zipFile = new ZipFile(targetZip);
|
||||
ZipFile zipFile = new ZipFile(targetZip,password.toCharArray());
|
||||
if ("UTF-8".equalsIgnoreCase(encoding)) {
|
||||
encoding = "UTF8";
|
||||
}
|
||||
zipFile.setFileNameCharset(encoding);
|
||||
zipFile.setCharset(Charset.forName(encoding));
|
||||
|
||||
ZipParameters params = new ZipParameters();
|
||||
params.setCompressionMethod(Zip4jConstants.COMP_DEFLATE);
|
||||
params.setCompressionMethod(CompressionMethod.DEFLATE);
|
||||
params.setCompressionLevel(compressLevel);
|
||||
|
||||
if (isEncrypted && !"".equals(password)) {
|
||||
params.setEncryptFiles(true);
|
||||
params.setEncryptionMethod(encryptionMethod);
|
||||
if (Zip4jConstants.ENC_METHOD_AES == encryptionMethod) {
|
||||
if (encryptionMethod == EncryptionMethod.AES) {
|
||||
|
||||
params.setAesKeyStrength(aesKeyStrength);
|
||||
}
|
||||
params.setPassword(password);
|
||||
}
|
||||
|
||||
params.setDefaultFolderPath(source.getAbsoluteFile().getPath());
|
||||
zipFile.addFiles((ArrayList) list, params);
|
||||
zipFile.addFiles(list, params);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,8 +19,6 @@ bin.excludes = components/tAlfrescoOutput/wstx-lgpl-3.2.7.jar,\
|
||||
components/tRSSInput/nekohtml.jar,\
|
||||
components/tAlfrescoOutput/wstx-lgpl-3.2.7.jar,\
|
||||
components/tAdvancedXMLMapHash/trove.jar,\
|
||||
components/tCloudStart/logback-core-1.0.9.jar,\
|
||||
components/tCloudStart/logback-classic-1.0.9.jar,\
|
||||
components/tLineChart/jcommon-1.0.6.jar,\
|
||||
components/tMomInput/jnp-client.jar,\
|
||||
components/tMomInput/javassist.jar,\
|
||||
|
||||
@@ -388,9 +388,12 @@ class GenerateToolByDom4j{
|
||||
for(XMLNode attri:node.attributes){
|
||||
addAttribute(currEleName,attri);
|
||||
}
|
||||
if(node.name.indexOf(":")>0){
|
||||
int idx = node.name.indexOf(":");
|
||||
if(idx > 0){
|
||||
String prefix = node.name.substring(0, idx);
|
||||
String localName = node.name.substring(idx + 1);
|
||||
%>
|
||||
<%touchXMLNode.getXMLNode(currEleName);%>.setName("<%=node.name%>");
|
||||
<%touchXMLNode.getXMLElement(currEleName);%>.setQName(org.dom4j.DocumentHelper.createQName("<%=localName%>",<%touchXMLNode.getXMLElement(currEleName);%>.getNamespaceForPrefix("<%=prefix%>")));
|
||||
<%
|
||||
}
|
||||
int index = 0;
|
||||
|
||||
@@ -174,7 +174,7 @@ globalMap.put("<%=cid%>_ERROR_MESSAGE",e.getMessage());
|
||||
if (nestRoot != null) {
|
||||
boolean isDefaultNameSpaceAtRoot = "".equals(nestRoot.getQName().getNamespace().getPrefix());
|
||||
for (org.dom4j.Element tmp: (java.util.List<org.dom4j.Element>) nestRoot.elements()) {
|
||||
if (("").equals(tmp.getQName().getNamespace().getURI()) && ("").equals(tmp.getQName().getNamespace().getPrefix()) && isDefaultNameSpaceAtRoot) {
|
||||
if (isDefaultNameSpaceAtRoot && ("").equals(tmp.getQName().getNamespace().getURI()) && ("").equals(tmp.getQName().getNamespace().getPrefix())) {
|
||||
tmp.setQName(org.dom4j.DocumentHelper.createQName(tmp.getName(), nestRoot.getQName().getNamespace()));
|
||||
}
|
||||
replaceDefaultNameSpace(tmp);
|
||||
|
||||
@@ -69,8 +69,8 @@
|
||||
REQUIRED="true"
|
||||
/>
|
||||
<IMPORT
|
||||
NAME="Log4j"
|
||||
MODULE="log4j-1.2.17.jar" MVN="mvn:log4j/log4j/1.2.17" UrlPath="platform:/plugin/org.talend.libraries.apache/lib/log4j-1.2.17.jar"
|
||||
NAME="reload4j-1.2.19"
|
||||
MODULE="reload4j-1.2.19.jar" MVN="mvn:ch.qos.reload4j/reload4j/1.2.19"
|
||||
REQUIRED="true"
|
||||
BundleID=""
|
||||
/>
|
||||
|
||||
@@ -68,8 +68,8 @@
|
||||
REQUIRED="true"
|
||||
/>
|
||||
<IMPORT
|
||||
NAME="Log4j"
|
||||
MODULE="log4j-1.2.17.jar" MVN="mvn:log4j/log4j/1.2.17" UrlPath="platform:/plugin/org.talend.libraries.apache/lib/log4j-1.2.17.jar"
|
||||
NAME="reload4j-1.2.19"
|
||||
MODULE="reload4j-1.2.19.jar" MVN="mvn:ch.qos.reload4j/reload4j/1.2.19"
|
||||
REQUIRED="true"
|
||||
BundleID=""
|
||||
/>
|
||||
|
||||
@@ -231,14 +231,14 @@
|
||||
<IMPORT NAME="aws-java-sdk-1.11.848.jar" MODULE="aws-java-sdk-1.11.848.jar"
|
||||
MVN="mvn:com.amazonaws/aws-java-sdk/1.11.848"
|
||||
REQUIRED="true" />
|
||||
<IMPORT NAME="jackson-core-2.11.4.jar" MODULE="jackson-core-2.11.4.jar"
|
||||
MVN="mvn:com.fasterxml.jackson.core/jackson-core/2.11.4"
|
||||
<IMPORT NAME="jackson-core-2.13.2.jar" MODULE="jackson-core-2.13.2.jar"
|
||||
MVN="mvn:com.fasterxml.jackson.core/jackson-core/2.13.2"
|
||||
REQUIRED="true" />
|
||||
<IMPORT NAME="jackson-databind-2.11.4.jar" MODULE="jackson-databind-2.11.4.jar"
|
||||
MVN="mvn:com.fasterxml.jackson.core/jackson-databind/2.11.4"
|
||||
<IMPORT NAME="jackson-databind-2.13.2.2.jar" MODULE="jackson-databind-2.13.2.2.jar"
|
||||
MVN="mvn:com.fasterxml.jackson.core/jackson-databind/2.13.2.2"
|
||||
REQUIRED="true" />
|
||||
<IMPORT NAME="jackson-annotations-2.11.4.jar" MODULE="jackson-annotations-2.11.4.jar"
|
||||
MVN="mvn:com.fasterxml.jackson.core/jackson-annotations/2.11.4"
|
||||
<IMPORT NAME="jackson-annotations-2.13.2.jar" MODULE="jackson-annotations-2.13.2.jar"
|
||||
MVN="mvn:com.fasterxml.jackson.core/jackson-annotations/2.13.2"
|
||||
REQUIRED="true" />
|
||||
<IMPORT NAME="httpcore-4.4.13.jar" MODULE="httpcore-4.4.13.jar"
|
||||
MVN="mvn:org.apache.httpcomponents/httpcore/4.4.13"
|
||||
|
||||
@@ -558,14 +558,14 @@
|
||||
<IMPORT NAME="aws-java-sdk-1.11.848.jar" MODULE="aws-java-sdk-1.11.848.jar"
|
||||
MVN="mvn:com.amazonaws/aws-java-sdk/1.11.848"
|
||||
REQUIRED="true" />
|
||||
<IMPORT NAME="jackson-core-2.11.4.jar" MODULE="jackson-core-2.11.4.jar"
|
||||
MVN="mvn:com.fasterxml.jackson.core/jackson-core/2.11.4"
|
||||
<IMPORT NAME="jackson-core-2.13.2.jar" MODULE="jackson-core-2.13.2.jar"
|
||||
MVN="mvn:com.fasterxml.jackson.core/jackson-core/2.13.2"
|
||||
REQUIRED="true" />
|
||||
<IMPORT NAME="jackson-databind-2.11.4.jar" MODULE="jackson-databind-2.11.4.jar"
|
||||
MVN="mvn:com.fasterxml.jackson.core/jackson-databind/2.11.4"
|
||||
<IMPORT NAME="jackson-databind-2.13.2.2.jar" MODULE="jackson-databind-2.13.2.2.jar"
|
||||
MVN="mvn:com.fasterxml.jackson.core/jackson-databind/2.13.2.2"
|
||||
REQUIRED="true" />
|
||||
<IMPORT NAME="jackson-annotations-2.11.4.jar" MODULE="jackson-annotations-2.11.4.jar"
|
||||
MVN="mvn:com.fasterxml.jackson.core/jackson-annotations/2.11.4"
|
||||
<IMPORT NAME="jackson-annotations-2.13.2.jar" MODULE="jackson-annotations-2.13.2.jar"
|
||||
MVN="mvn:com.fasterxml.jackson.core/jackson-annotations/2.13.2"
|
||||
REQUIRED="true" />
|
||||
<IMPORT NAME="httpcore-4.4.13.jar" MODULE="httpcore-4.4.13.jar"
|
||||
MVN="mvn:org.apache.httpcomponents/httpcore/4.4.13"
|
||||
|
||||
@@ -288,14 +288,14 @@
|
||||
<IMPORT NAME="aws-java-sdk-1.11.848.jar" MODULE="aws-java-sdk-1.11.848.jar"
|
||||
MVN="mvn:com.amazonaws/aws-java-sdk/1.11.848"
|
||||
REQUIRED="true" />
|
||||
<IMPORT NAME="jackson-core-2.11.4.jar" MODULE="jackson-core-2.11.4.jar"
|
||||
MVN="mvn:com.fasterxml.jackson.core/jackson-core/2.11.4"
|
||||
<IMPORT NAME="jackson-core-2.13.2.jar" MODULE="jackson-core-2.13.2.jar"
|
||||
MVN="mvn:com.fasterxml.jackson.core/jackson-core/2.13.2"
|
||||
REQUIRED="true" />
|
||||
<IMPORT NAME="jackson-databind-2.11.4.jar" MODULE="jackson-databind-2.11.4.jar"
|
||||
MVN="mvn:com.fasterxml.jackson.core/jackson-databind/2.11.4"
|
||||
<IMPORT NAME="jackson-databind-2.13.2.2.jar" MODULE="jackson-databind-2.13.2.2.jar"
|
||||
MVN="mvn:com.fasterxml.jackson.core/jackson-databind/2.13.2.2"
|
||||
REQUIRED="true" />
|
||||
<IMPORT NAME="jackson-annotations-2.11.4.jar" MODULE="jackson-annotations-2.11.4.jar"
|
||||
MVN="mvn:com.fasterxml.jackson.core/jackson-annotations/2.11.4"
|
||||
<IMPORT NAME="jackson-annotations-2.13.2.jar" MODULE="jackson-annotations-2.13.2.jar"
|
||||
MVN="mvn:com.fasterxml.jackson.core/jackson-annotations/2.13.2"
|
||||
REQUIRED="true" />
|
||||
<IMPORT NAME="httpcore-4.4.13.jar" MODULE="httpcore-4.4.13.jar"
|
||||
MVN="mvn:org.apache.httpcomponents/httpcore/4.4.13"
|
||||
|
||||
@@ -348,14 +348,14 @@
|
||||
<IMPORT NAME="aws-java-sdk-1.11.848.jar" MODULE="aws-java-sdk-1.11.848.jar"
|
||||
MVN="mvn:com.amazonaws/aws-java-sdk/1.11.848"
|
||||
REQUIRED="true" />
|
||||
<IMPORT NAME="jackson-core-2.11.4.jar" MODULE="jackson-core-2.11.4.jar"
|
||||
MVN="mvn:com.fasterxml.jackson.core/jackson-core/2.11.4"
|
||||
<IMPORT NAME="jackson-core-2.13.2.jar" MODULE="jackson-core-2.13.2.jar"
|
||||
MVN="mvn:com.fasterxml.jackson.core/jackson-core/2.13.2"
|
||||
REQUIRED="true" />
|
||||
<IMPORT NAME="jackson-databind-2.11.4.jar" MODULE="jackson-databind-2.11.4.jar"
|
||||
MVN="mvn:com.fasterxml.jackson.core/jackson-databind/2.11.4"
|
||||
<IMPORT NAME="jackson-databind-2.13.2.2.jar" MODULE="jackson-databind-2.13.2.2.jar"
|
||||
MVN="mvn:com.fasterxml.jackson.core/jackson-databind/2.13.2.2"
|
||||
REQUIRED="true" />
|
||||
<IMPORT NAME="jackson-annotations-2.11.4.jar" MODULE="jackson-annotations-2.11.4.jar"
|
||||
MVN="mvn:com.fasterxml.jackson.core/jackson-annotations/2.11.4"
|
||||
<IMPORT NAME="jackson-annotations-2.13.2.jar" MODULE="jackson-annotations-2.13.2.jar"
|
||||
MVN="mvn:com.fasterxml.jackson.core/jackson-annotations/2.13.2"
|
||||
REQUIRED="true" />
|
||||
<IMPORT NAME="httpcore-4.4.13.jar" MODULE="httpcore-4.4.13.jar"
|
||||
MVN="mvn:org.apache.httpcomponents/httpcore/4.4.13"
|
||||
|
||||
@@ -384,11 +384,11 @@
|
||||
<IMPORT NAME="adal4j" MODULE="adal4j-1.6.7.jar" MVN="mvn:com.microsoft.azure/adal4j/1.6.7" REQUIRED_IF="(ACTIVE_DIR_AUTH == 'true') AND (USE_EXISTING_CONNECTION == 'false')" />
|
||||
<IMPORT NAME="commons-lang3" MODULE="commons-lang3-3.10.jar" MVN="mvn:org.apache.commons/commons-lang3/3.10" REQUIRED_IF="(ACTIVE_DIR_AUTH == 'true') AND (USE_EXISTING_CONNECTION == 'false')" />
|
||||
<IMPORT NAME="commons-codec" MODULE="commons-codec-1.14.jar" MVN="mvn:commons-codec/commons-codec/1.14" REQUIRED_IF="(ACTIVE_DIR_AUTH == 'true') AND (USE_EXISTING_CONNECTION == 'false')" />
|
||||
<IMPORT NAME="gson" MODULE="gson-2.8.6.jar" MVN="mvn:com.google.code.gson/gson/2.8.6" REQUIRED_IF="(ACTIVE_DIR_AUTH == 'true') AND (USE_EXISTING_CONNECTION == 'false')" />
|
||||
<IMPORT NAME="gson" MODULE="gson-2.8.9.jar" MVN="mvn:com.google.code.gson/gson/2.8.9" REQUIRED_IF="(ACTIVE_DIR_AUTH == 'true') AND (USE_EXISTING_CONNECTION == 'false')" />
|
||||
<IMPORT NAME="oauth2-oidc-sdk" MODULE="oauth2-oidc-sdk-9.7.jar" MVN="mvn:com.nimbusds/oauth2-oidc-sdk/9.7" REQUIRED_IF="(ACTIVE_DIR_AUTH == 'true') AND (USE_EXISTING_CONNECTION == 'false')" />
|
||||
<IMPORT NAME="content-type" MODULE="content-type-2.1.jar" MVN="mvn:com.nimbusds/content-type/2.1" REQUIRED_IF="(ACTIVE_DIR_AUTH == 'true') AND (USE_EXISTING_CONNECTION == 'false')" />
|
||||
<IMPORT NAME="json-smart" MODULE="json-smart-2.4.7.jar" MVN="mvn:net.minidev/json-smart/2.4.7" REQUIRED_IF="(ACTIVE_DIR_AUTH == 'true') AND (USE_EXISTING_CONNECTION == 'false')" />
|
||||
<IMPORT NAME="nimbus-jose-jwt" MODULE="nimbus-jose-jwt-8.11.jar" MVN="mvn:com.nimbusds/nimbus-jose-jwt/8.11" REQUIRED_IF="(ACTIVE_DIR_AUTH == 'true') AND (USE_EXISTING_CONNECTION == 'false')" />
|
||||
<IMPORT NAME="nimbus-jose-jwt" MODULE="nimbus-jose-jwt-9.22.jar" MVN="mvn:com.nimbusds/nimbus-jose-jwt/9.22" REQUIRED_IF="(ACTIVE_DIR_AUTH == 'true') AND (USE_EXISTING_CONNECTION == 'false')" />
|
||||
<IMPORT NAME="javax.mail" MODULE="javax.mail-1.6.2.jar" MVN="mvn:com.sun.mail/javax.mail/1.6.2" REQUIRED_IF="(ACTIVE_DIR_AUTH == 'true') AND (USE_EXISTING_CONNECTION == 'false')" />
|
||||
</IMPORTS>
|
||||
</CODEGENERATION>
|
||||
|
||||
@@ -207,11 +207,11 @@
|
||||
<IMPORT NAME="adal4j" MODULE="adal4j-1.6.7.jar" MVN="mvn:com.microsoft.azure/adal4j/1.6.7" REQUIRED_IF="(ACTIVE_DIR_AUTH == 'true')" />
|
||||
<IMPORT NAME="commons-lang3" MODULE="commons-lang3-3.10.jar" MVN="mvn:org.apache.commons/commons-lang3/3.10" REQUIRED_IF="(ACTIVE_DIR_AUTH == 'true')" />
|
||||
<IMPORT NAME="commons-codec" MODULE="commons-codec-1.14.jar" MVN="mvn:commons-codec/commons-codec/1.14" REQUIRED_IF="(ACTIVE_DIR_AUTH == 'true')" />
|
||||
<IMPORT NAME="gson" MODULE="gson-2.8.6.jar" MVN="mvn:com.google.code.gson/gson/2.8.6" REQUIRED_IF="(ACTIVE_DIR_AUTH == 'true')" />
|
||||
<IMPORT NAME="gson" MODULE="gson-2.8.9.jar" MVN="mvn:com.google.code.gson/gson/2.8.9" REQUIRED_IF="(ACTIVE_DIR_AUTH == 'true')" />
|
||||
<IMPORT NAME="oauth2-oidc-sdk" MODULE="oauth2-oidc-sdk-9.7.jar" MVN="mvn:com.nimbusds/oauth2-oidc-sdk/9.7" REQUIRED_IF="(ACTIVE_DIR_AUTH == 'true')" />
|
||||
<IMPORT NAME="content-type" MODULE="content-type-2.1.jar" MVN="mvn:com.nimbusds/content-type/2.1" REQUIRED_IF="(ACTIVE_DIR_AUTH == 'true')" />
|
||||
<IMPORT NAME="json-smart" MODULE="json-smart-2.4.7.jar" MVN="mvn:net.minidev/json-smart/2.4.7" REQUIRED_IF="(ACTIVE_DIR_AUTH == 'true')" />
|
||||
<IMPORT NAME="nimbus-jose-jwt" MODULE="nimbus-jose-jwt-8.11.jar" MVN="mvn:com.nimbusds/nimbus-jose-jwt/8.11" REQUIRED_IF="(ACTIVE_DIR_AUTH == 'true')" />
|
||||
<IMPORT NAME="nimbus-jose-jwt" MODULE="nimbus-jose-jwt-9.22.jar" MVN="mvn:com.nimbusds/nimbus-jose-jwt/9.22" REQUIRED_IF="(ACTIVE_DIR_AUTH == 'true')" />
|
||||
<IMPORT NAME="javax.mail" MODULE="javax.mail-1.6.2.jar" MVN="mvn:com.sun.mail/javax.mail/1.6.2" REQUIRED_IF="(ACTIVE_DIR_AUTH == 'true')" />
|
||||
</IMPORTS>
|
||||
</CODEGENERATION>
|
||||
|
||||
@@ -267,11 +267,11 @@
|
||||
<IMPORT NAME="adal4j" MODULE="adal4j-1.6.7.jar" MVN="mvn:com.microsoft.azure/adal4j/1.6.7" REQUIRED_IF="(ACTIVE_DIR_AUTH == 'true') AND (USE_EXISTING_CONNECTION == 'false')" />
|
||||
<IMPORT NAME="commons-lang3" MODULE="commons-lang3-3.10.jar" MVN="mvn:org.apache.commons/commons-lang3/3.10" REQUIRED_IF="(ACTIVE_DIR_AUTH == 'true') AND (USE_EXISTING_CONNECTION == 'false')" />
|
||||
<IMPORT NAME="commons-codec" MODULE="commons-codec-1.14.jar" MVN="mvn:commons-codec/commons-codec/1.14" REQUIRED_IF="(ACTIVE_DIR_AUTH == 'true') AND (USE_EXISTING_CONNECTION == 'false')" />
|
||||
<IMPORT NAME="gson" MODULE="gson-2.8.6.jar" MVN="mvn:com.google.code.gson/gson/2.8.6" REQUIRED_IF="(ACTIVE_DIR_AUTH == 'true') AND (USE_EXISTING_CONNECTION == 'false')" />
|
||||
<IMPORT NAME="gson" MODULE="gson-2.8.9.jar" MVN="mvn:com.google.code.gson/gson/2.8.9" REQUIRED_IF="(ACTIVE_DIR_AUTH == 'true') AND (USE_EXISTING_CONNECTION == 'false')" />
|
||||
<IMPORT NAME="oauth2-oidc-sdk" MODULE="oauth2-oidc-sdk-9.7.jar" MVN="mvn:com.nimbusds/oauth2-oidc-sdk/9.7" REQUIRED_IF="(ACTIVE_DIR_AUTH == 'true') AND (USE_EXISTING_CONNECTION == 'false')" />
|
||||
<IMPORT NAME="content-type" MODULE="content-type-2.1.jar" MVN="mvn:com.nimbusds/content-type/2.1" REQUIRED_IF="(ACTIVE_DIR_AUTH == 'true') AND (USE_EXISTING_CONNECTION == 'false')" />
|
||||
<IMPORT NAME="json-smart" MODULE="json-smart-2.4.7.jar" MVN="mvn:net.minidev/json-smart/2.4.7" REQUIRED_IF="(ACTIVE_DIR_AUTH == 'true') AND (USE_EXISTING_CONNECTION == 'false')" />
|
||||
<IMPORT NAME="nimbus-jose-jwt" MODULE="nimbus-jose-jwt-8.11.jar" MVN="mvn:com.nimbusds/nimbus-jose-jwt/8.11" REQUIRED_IF="(ACTIVE_DIR_AUTH == 'true') AND (USE_EXISTING_CONNECTION == 'false')" />
|
||||
<IMPORT NAME="nimbus-jose-jwt" MODULE="nimbus-jose-jwt-9.22.jar" MVN="mvn:com.nimbusds/nimbus-jose-jwt/9.22" REQUIRED_IF="(ACTIVE_DIR_AUTH == 'true') AND (USE_EXISTING_CONNECTION == 'false')" />
|
||||
<IMPORT NAME="javax.mail" MODULE="javax.mail-1.6.2.jar" MVN="mvn:com.sun.mail/javax.mail/1.6.2" REQUIRED_IF="(ACTIVE_DIR_AUTH == 'true') AND (USE_EXISTING_CONNECTION == 'false')" />
|
||||
</IMPORTS>
|
||||
</CODEGENERATION>
|
||||
|
||||
@@ -338,11 +338,11 @@
|
||||
<IMPORT NAME="adal4j" MODULE="adal4j-1.6.7.jar" MVN="mvn:com.microsoft.azure/adal4j/1.6.7" REQUIRED_IF="(ACTIVE_DIR_AUTH == 'true') AND (USE_EXISTING_CONNECTION == 'false')" />
|
||||
<IMPORT NAME="commons-lang3" MODULE="commons-lang3-3.10.jar" MVN="mvn:org.apache.commons/commons-lang3/3.10" REQUIRED_IF="(ACTIVE_DIR_AUTH == 'true') AND (USE_EXISTING_CONNECTION == 'false')" />
|
||||
<IMPORT NAME="commons-codec" MODULE="commons-codec-1.14.jar" MVN="mvn:commons-codec/commons-codec/1.14" REQUIRED_IF="(ACTIVE_DIR_AUTH == 'true') AND (USE_EXISTING_CONNECTION == 'false')" />
|
||||
<IMPORT NAME="gson" MODULE="gson-2.8.6.jar" MVN="mvn:com.google.code.gson/gson/2.8.6" REQUIRED_IF="(ACTIVE_DIR_AUTH == 'true') AND (USE_EXISTING_CONNECTION == 'false')" />
|
||||
<IMPORT NAME="gson" MODULE="gson-2.8.9.jar" MVN="mvn:com.google.code.gson/gson/2.8.9" REQUIRED_IF="(ACTIVE_DIR_AUTH == 'true') AND (USE_EXISTING_CONNECTION == 'false')" />
|
||||
<IMPORT NAME="oauth2-oidc-sdk" MODULE="oauth2-oidc-sdk-9.7.jar" MVN="mvn:com.nimbusds/oauth2-oidc-sdk/9.7" REQUIRED_IF="(ACTIVE_DIR_AUTH == 'true') AND (USE_EXISTING_CONNECTION == 'false')" />
|
||||
<IMPORT NAME="content-type" MODULE="content-type-2.1.jar" MVN="mvn:com.nimbusds/content-type/2.1" REQUIRED_IF="(ACTIVE_DIR_AUTH == 'true') AND (USE_EXISTING_CONNECTION == 'false')" />
|
||||
<IMPORT NAME="json-smart" MODULE="json-smart-2.4.7.jar" MVN="mvn:net.minidev/json-smart/2.4.7" REQUIRED_IF="(ACTIVE_DIR_AUTH == 'true') AND (USE_EXISTING_CONNECTION == 'false')" />
|
||||
<IMPORT NAME="nimbus-jose-jwt" MODULE="nimbus-jose-jwt-8.11.jar" MVN="mvn:com.nimbusds/nimbus-jose-jwt/8.11" REQUIRED_IF="(ACTIVE_DIR_AUTH == 'true') AND (USE_EXISTING_CONNECTION == 'false')" />
|
||||
<IMPORT NAME="nimbus-jose-jwt" MODULE="nimbus-jose-jwt-9.22.jar" MVN="mvn:com.nimbusds/nimbus-jose-jwt/9.22" REQUIRED_IF="(ACTIVE_DIR_AUTH == 'true') AND (USE_EXISTING_CONNECTION == 'false')" />
|
||||
<IMPORT NAME="javax.mail" MODULE="javax.mail-1.6.2.jar" MVN="mvn:com.sun.mail/javax.mail/1.6.2" REQUIRED_IF="(ACTIVE_DIR_AUTH == 'true') AND (USE_EXISTING_CONNECTION == 'false')" />
|
||||
</IMPORTS>
|
||||
</CODEGENERATION>
|
||||
|
||||
@@ -323,11 +323,11 @@
|
||||
<IMPORT NAME="adal4j" MODULE="adal4j-1.6.7.jar" MVN="mvn:com.microsoft.azure/adal4j/1.6.7" REQUIRED_IF="(ACTIVE_DIR_AUTH == 'true') AND (USE_EXISTING_CONNECTION == 'false')" />
|
||||
<IMPORT NAME="commons-lang3" MODULE="commons-lang3-3.10.jar" MVN="mvn:org.apache.commons/commons-lang3/3.10" REQUIRED_IF="(ACTIVE_DIR_AUTH == 'true') AND (USE_EXISTING_CONNECTION == 'false')" />
|
||||
<IMPORT NAME="commons-codec" MODULE="commons-codec-1.14.jar" MVN="mvn:commons-codec/commons-codec/1.14" REQUIRED_IF="(ACTIVE_DIR_AUTH == 'true') AND (USE_EXISTING_CONNECTION == 'false')" />
|
||||
<IMPORT NAME="gson" MODULE="gson-2.8.6.jar" MVN="mvn:com.google.code.gson/gson/2.8.6" REQUIRED_IF="(ACTIVE_DIR_AUTH == 'true') AND (USE_EXISTING_CONNECTION == 'false')" />
|
||||
<IMPORT NAME="gson" MODULE="gson-2.8.9.jar" MVN="mvn:com.google.code.gson/gson/2.8.9" REQUIRED_IF="(ACTIVE_DIR_AUTH == 'true') AND (USE_EXISTING_CONNECTION == 'false')" />
|
||||
<IMPORT NAME="oauth2-oidc-sdk" MODULE="oauth2-oidc-sdk-9.7.jar" MVN="mvn:com.nimbusds/oauth2-oidc-sdk/9.7" REQUIRED_IF="(ACTIVE_DIR_AUTH == 'true') AND (USE_EXISTING_CONNECTION == 'false')" />
|
||||
<IMPORT NAME="content-type" MODULE="content-type-2.1.jar" MVN="mvn:com.nimbusds/content-type/2.1" REQUIRED_IF="(ACTIVE_DIR_AUTH == 'true') AND (USE_EXISTING_CONNECTION == 'false')" />
|
||||
<IMPORT NAME="json-smart" MODULE="json-smart-2.4.7.jar" MVN="mvn:net.minidev/json-smart/2.4.7" REQUIRED_IF="(ACTIVE_DIR_AUTH == 'true') AND (USE_EXISTING_CONNECTION == 'false')" />
|
||||
<IMPORT NAME="nimbus-jose-jwt" MODULE="nimbus-jose-jwt-8.11.jar" MVN="mvn:com.nimbusds/nimbus-jose-jwt/8.11" REQUIRED_IF="(ACTIVE_DIR_AUTH == 'true') AND (USE_EXISTING_CONNECTION == 'false')" />
|
||||
<IMPORT NAME="nimbus-jose-jwt" MODULE="nimbus-jose-jwt-9.22.jar" MVN="mvn:com.nimbusds/nimbus-jose-jwt/9.22" REQUIRED_IF="(ACTIVE_DIR_AUTH == 'true') AND (USE_EXISTING_CONNECTION == 'false')" />
|
||||
<IMPORT NAME="javax.mail" MODULE="javax.mail-1.6.2.jar" MVN="mvn:com.sun.mail/javax.mail/1.6.2" REQUIRED_IF="(ACTIVE_DIR_AUTH == 'true') AND (USE_EXISTING_CONNECTION == 'false')" />
|
||||
</IMPORTS>
|
||||
</CODEGENERATION>
|
||||
|
||||
@@ -283,10 +283,10 @@
|
||||
<IMPORT NAME="google-api-services-oauth2-v2-rev20200213-1.31.0.jar" MODULE="google-api-services-oauth2-v2-rev20200213-1.31.0.jar" MVN="mvn:com.google.apis/google-api-services-oauth2/v2-rev20200213-1.31.0" REQUIRED="true" />
|
||||
<IMPORT NAME="google-api-services-bigquery-v2-rev20201030-1.31.0.jar" MODULE="google-api-services-bigquery-v2-rev20201030-1.31.0.jar" MVN="mvn:com.google.apis/google-api-services-bigquery/v2-rev20201030-1.31.0" REQUIRED="true" />
|
||||
<IMPORT NAME="google-http-client-1.38.0.jar" MODULE="google-http-client-1.38.0.jar" MVN="mvn:com.google.http-client/google-http-client/1.38.0" REQUIRED="true" />
|
||||
<IMPORT NAME="google-oauth-client-1.31.0.jar" MODULE="google-oauth-client-1.31.0.jar" MVN="mvn:com.google.oauth-client/google-oauth-client/1.31.0" REQUIRED="true" />
|
||||
<IMPORT NAME="google-oauth-client-1.33.3.jar" MODULE="google-oauth-client-1.33.3.jar" MVN="mvn:com.google.oauth-client/google-oauth-client/1.33.3" REQUIRED="true" />
|
||||
<IMPORT NAME="google-http-client-jackson2-1.38.0.jar" MODULE="google-http-client-jackson2-1.38.0.jar" MVN="mvn:com.google.http-client/google-http-client-jackson2/1.38.0" REQUIRED="true" />
|
||||
<IMPORT NAME="guava-20.0.jar" MODULE="guava-20.0.jar" MVN="mvn:com.google.guava/guava/20.0" REQUIRED="true" />
|
||||
<IMPORT NAME="jackson-core-2.11.4.jar" MODULE="jackson-core-2.11.4.jar" MVN="mvn:com.fasterxml.jackson.core/jackson-core/2.11.4" REQUIRED="true" />
|
||||
<IMPORT NAME="jackson-core-2.13.2.jar" MODULE="jackson-core-2.13.2.jar" MVN="mvn:com.fasterxml.jackson.core/jackson-core/2.13.2" REQUIRED="true" />
|
||||
<!-- REQUIRED FOR GOOGLE STORAGE -->
|
||||
<IMPORT NAME="jets3t-0.9.1" MODULE="jets3t-0.9.1.jar" MVN="mvn:org.talend.libraries/jets3t-0.9.1/6.0.0" REQUIRED="true" />
|
||||
<IMPORT NAME="commons-logging-1.2" MODULE="commons-logging-1.2.jar" MVN="mvn:commons-logging/commons-logging/1.2" REQUIRED="true" />
|
||||
@@ -312,7 +312,7 @@
|
||||
<IMPORT NAME="google-cloud-storage-1.104.0" MODULE="google-cloud-storage-1.104.0.jar" MVN="mvn:com.google.cloud/google-cloud-storage/1.104.0" REQUIRED_IF="(AUTH_TYPE == 'GS_SERVICE_ACCOUNT') OR (AUTH_TYPE == 'TOKEN')" />
|
||||
<!-- Transitive dependencies of google-cloud-storage -->
|
||||
<IMPORT NAME="google-api-services-storage-v1-rev20201112-1.31.0" MODULE="google-api-services-storage-v1-rev20201112-1.31.0.jar" MVN="mvn:com.google.apis/google-api-services-storage/v1-rev20201112-1.31.0" REQUIRED_IF="(AUTH_TYPE == 'GS_SERVICE_ACCOUNT') OR (AUTH_TYPE == 'TOKEN')" />
|
||||
<IMPORT NAME="gson-2.8.6" MODULE="gson-2.8.6.jar" MVN="mvn:com.google.code.gson/gson/2.8.6" REQUIRED="true" />
|
||||
<IMPORT NAME="gson-2.8.9" MODULE="gson-2.8.9.jar" MVN="mvn:com.google.code.gson/gson/2.8.9" REQUIRED="true" />
|
||||
<IMPORT NAME="javax.annotation-api" MODULE="javax.annotation-api-1.3.jar" MVN="mvn:javax.annotation/javax.annotation-api/1.3" REQUIRED_IF="(AUTH_TYPE == 'GS_SERVICE_ACCOUNT') OR (AUTH_TYPE == 'TOKEN')" />
|
||||
<IMPORT NAME="protobuf-java-3.4.0" MODULE="protobuf-java-3.4.0.jar" MVN="mvn:com.google.protobuf/protobuf-java/3.4.0" REQUIRED_IF="(AUTH_TYPE == 'GS_SERVICE_ACCOUNT') OR (AUTH_TYPE == 'TOKEN')" />
|
||||
<IMPORT NAME="error_prone_annotation-2.1.3" MODULE="error_prone_annotation-2.1.3.jar" MVN="mvn:com.google.errorprone/error_prone_annotations/2.1.3" REQUIRED_IF="(AUTH_TYPE == 'GS_SERVICE_ACCOUNT') OR (AUTH_TYPE == 'TOKEN')" />
|
||||
|
||||
@@ -205,10 +205,10 @@
|
||||
<IMPORT NAME="google-api-services-oauth2-v2-rev20200213-1.31.0.jar" MODULE="google-api-services-oauth2-v2-rev20200213-1.31.0.jar" MVN="mvn:com.google.apis/google-api-services-oauth2/v2-rev20200213-1.31.0" REQUIRED="true" />
|
||||
<IMPORT NAME="google-api-services-bigquery-v2-rev20201030-1.31.0.jar" MODULE="google-api-services-bigquery-v2-rev20201030-1.31.0.jar" MVN="mvn:com.google.apis/google-api-services-bigquery/v2-rev20201030-1.31.0" REQUIRED="true" />
|
||||
<IMPORT NAME="google-http-client-1.38.0.jar" MODULE="google-http-client-1.38.0.jar" MVN="mvn:com.google.http-client/google-http-client/1.38.0" REQUIRED="true" />
|
||||
<IMPORT NAME="google-oauth-client-1.31.0.jar" MODULE="google-oauth-client-1.31.0.jar" MVN="mvn:com.google.oauth-client/google-oauth-client/1.31.0" REQUIRED="true" />
|
||||
<IMPORT NAME="google-oauth-client-1.33.3.jar" MODULE="google-oauth-client-1.33.3.jar" MVN="mvn:com.google.oauth-client/google-oauth-client/1.33.3" REQUIRED="true" />
|
||||
<IMPORT NAME="google-http-client-jackson2-1.38.0.jar" MODULE="google-http-client-jackson2-1.38.0.jar" MVN="mvn:com.google.http-client/google-http-client-jackson2/1.38.0" REQUIRED="true" />
|
||||
<IMPORT NAME="guava-20.0.jar" MODULE="guava-20.0.jar" MVN="mvn:com.google.guava/guava/20.0" REQUIRED="true" />
|
||||
<IMPORT NAME="jackson-core-2.11.4.jar" MODULE="jackson-core-2.11.4.jar" MVN="mvn:com.fasterxml.jackson.core/jackson-core/2.11.4" REQUIRED="true" />
|
||||
<IMPORT NAME="jackson-core-2.13.2.jar" MODULE="jackson-core-2.13.2.jar" MVN="mvn:com.fasterxml.jackson.core/jackson-core/2.13.2" REQUIRED="true" />
|
||||
<IMPORT NAME="google-cloud-bigquery-1.126.3.jar" MODULE="google-cloud-bigquery-1.126.3.jar" MVN="mvn:com.google.cloud/google-cloud-bigquery/1.126.3" REQUIRED_IF="AUTH_MODE == 'SERVICEACCOUNT'" />
|
||||
|
||||
<!-- TODO remove it -->
|
||||
@@ -227,7 +227,7 @@
|
||||
<IMPORT NAME="opencensus-api-0.24.0" MODULE="opencensus-api-0.24.0.jar" MVN="mvn:io.opencensus/opencensus-api/0.24.0" REQUIRED="true" />
|
||||
<IMPORT NAME="opencensus-contrib-http-util-0.24.0" MODULE="opencensus-contrib-http-util-0.24.0.jar" MVN="mvn:io.opencensus/opencensus-contrib-http-util/0.24.0" REQUIRED="true" />
|
||||
<IMPORT NAME="grpc-context-1.22.1" MODULE="grpc-context-1.22.1.jar" MVN="mvn:io.grpc/grpc-context/1.22.1" REQUIRED="true" />
|
||||
<IMPORT NAME="gson-2.8.6" MODULE="gson-2.8.6.jar" MVN="mvn:com.google.code.gson/gson/2.8.6" REQUIRED_IF="AUTH_MODE == 'SERVICEACCOUNT'" />
|
||||
<IMPORT NAME="gson-2.8.9" MODULE="gson-2.8.9.jar" MVN="mvn:com.google.code.gson/gson/2.8.9" REQUIRED_IF="AUTH_MODE == 'SERVICEACCOUNT'" />
|
||||
</IMPORTS>
|
||||
</CODEGENERATION>
|
||||
<RETURNS>
|
||||
|
||||
@@ -191,11 +191,11 @@
|
||||
<IMPORT NAME="google-api-services-oauth2-v2-rev20200213-1.31.0.jar" MODULE="google-api-services-oauth2-v2-rev20200213-1.31.0.jar" MVN="mvn:com.google.apis/google-api-services-oauth2/v2-rev20200213-1.31.0" REQUIRED="true" />
|
||||
<IMPORT NAME="google-api-services-bigquery-v2-rev20201030-1.31.0.jar" MODULE="google-api-services-bigquery-v2-rev20201030-1.31.0.jar" MVN="mvn:com.google.apis/google-api-services-bigquery/v2-rev20201030-1.31.0" REQUIRED="true" />
|
||||
<IMPORT NAME="google-http-client-1.38.0.jar" MODULE="google-http-client-1.38.0.jar" MVN="mvn:com.google.http-client/google-http-client/1.38.0" REQUIRED="true" />
|
||||
<IMPORT NAME="google-oauth-client-1.31.0.jar" MODULE="google-oauth-client-1.31.0.jar" MVN="mvn:com.google.oauth-client/google-oauth-client/1.31.0" REQUIRED="true" />
|
||||
<IMPORT NAME="google-oauth-client-1.33.3.jar" MODULE="google-oauth-client-1.33.3.jar" MVN="mvn:com.google.oauth-client/google-oauth-client/1.33.3" REQUIRED="true" />
|
||||
<IMPORT NAME="google-http-client-jackson2-1.38.0.jar" MODULE="google-http-client-jackson2-1.38.0.jar" MVN="mvn:com.google.http-client/google-http-client-jackson2/1.38.0" REQUIRED="true" />
|
||||
<IMPORT NAME="guava-20.0.jar" MODULE="guava-20.0.jar" MVN="mvn:com.google.guava/guava/20.0" REQUIRED="true"/>
|
||||
<IMPORT NAME="jackson-core-2.11.4.jar" MODULE="jackson-core-2.11.4.jar"
|
||||
MVN="mvn:com.fasterxml.jackson.core/jackson-core/2.11.4" REQUIRED="true"/>
|
||||
<IMPORT NAME="jackson-core-2.13.2.jar" MODULE="jackson-core-2.13.2.jar"
|
||||
MVN="mvn:com.fasterxml.jackson.core/jackson-core/2.13.2" REQUIRED="true"/>
|
||||
<IMPORT NAME="google-cloud-bigquery-1.126.3.jar" MODULE="google-cloud-bigquery-1.126.3.jar"
|
||||
MVN="mvn:com.google.cloud/google-cloud-bigquery/1.126.3"
|
||||
REQUIRED_IF="AUTH_MODE == 'SERVICEACCOUNT'"/>
|
||||
@@ -232,7 +232,7 @@
|
||||
<IMPORT NAME="opencensus-api-0.24.0" MODULE="opencensus-api-0.24.0.jar" MVN="mvn:io.opencensus/opencensus-api/0.24.0" REQUIRED="true" />
|
||||
<IMPORT NAME="opencensus-contrib-http-util-0.24.0" MODULE="opencensus-contrib-http-util-0.24.0.jar" MVN="mvn:io.opencensus/opencensus-contrib-http-util/0.24.0" REQUIRED="true" />
|
||||
<IMPORT NAME="grpc-context-1.22.1" MODULE="grpc-context-1.22.1.jar" MVN="mvn:io.grpc/grpc-context/1.22.1" REQUIRED="true" />
|
||||
<IMPORT NAME="gson-2.8.6" MODULE="gson-2.8.6.jar" MVN="mvn:com.google.code.gson/gson/2.8.6" REQUIRED_IF="AUTH_MODE == 'SERVICEACCOUNT'" />
|
||||
<IMPORT NAME="gson-2.8.9" MODULE="gson-2.8.9.jar" MVN="mvn:com.google.code.gson/gson/2.8.9" REQUIRED_IF="AUTH_MODE == 'SERVICEACCOUNT'" />
|
||||
</IMPORTS>
|
||||
</CODEGENERATION>
|
||||
<RETURNS>
|
||||
|
||||
@@ -72,13 +72,13 @@
|
||||
MODULE="boxjavalibv2-v3.0.10.jar" MVN="mvn:net.box/boxjavalibv2/v3.0.10"
|
||||
REQUIRED="true" />
|
||||
<IMPORT NAME="jackson-core"
|
||||
MODULE="jackson-core-2.11.4.jar" MVN="mvn:com.fasterxml.jackson.core/jackson-core/2.11.4"
|
||||
MODULE="jackson-core-2.13.2.jar" MVN="mvn:com.fasterxml.jackson.core/jackson-core/2.13.2"
|
||||
REQUIRED="true" />
|
||||
<IMPORT NAME="jackson-databind"
|
||||
MODULE="jackson-databind-2.11.4.jar" MVN="mvn:com.fasterxml.jackson.core/jackson-databind/2.11.4"
|
||||
MODULE="jackson-databind-2.13.2.2.jar" MVN="mvn:com.fasterxml.jackson.core/jackson-databind/2.13.2.2"
|
||||
REQUIRED="true" />
|
||||
<IMPORT NAME="jackson-annotations"
|
||||
MODULE="jackson-annotations-2.11.4.jar" MVN="mvn:com.fasterxml.jackson.core/jackson-annotations/2.11.4"
|
||||
MODULE="jackson-annotations-2.13.2.jar" MVN="mvn:com.fasterxml.jackson.core/jackson-annotations/2.13.2"
|
||||
REQUIRED="true" />
|
||||
<IMPORT NAME="apache-http-client"
|
||||
MODULE="httpclient-4.5.13.jar" MVN="mvn:org.apache.httpcomponents/httpclient/4.5.13"
|
||||
|
||||
@@ -127,13 +127,13 @@
|
||||
MODULE="boxjavalibv2-v3.0.10.jar" MVN="mvn:net.box/boxjavalibv2/v3.0.10"
|
||||
REQUIRED_IF="USE_EXISTING_CONNECTION == 'false'" />
|
||||
<IMPORT NAME="jackson-core"
|
||||
MODULE="jackson-core-2.11.4.jar" MVN="mvn:com.fasterxml.jackson.core/jackson-core/2.11.4"
|
||||
MODULE="jackson-core-2.13.2.jar" MVN="mvn:com.fasterxml.jackson.core/jackson-core/2.13.2"
|
||||
REQUIRED_IF="USE_EXISTING_CONNECTION == 'false'" />
|
||||
<IMPORT NAME="jackson-databind"
|
||||
MODULE="jackson-databind-2.11.4.jar" MVN="mvn:com.fasterxml.jackson.core/jackson-databind/2.11.4"
|
||||
MODULE="jackson-databind-2.13.2.2.jar" MVN="mvn:com.fasterxml.jackson.core/jackson-databind/2.13.2.2"
|
||||
REQUIRED_IF="USE_EXISTING_CONNECTION == 'false'" />
|
||||
<IMPORT NAME="jackson-annotations"
|
||||
MODULE="jackson-annotations-2.11.4.jar" MVN="mvn:com.fasterxml.jackson.core/jackson-annotations/2.11.4"
|
||||
MODULE="jackson-annotations-2.13.2.jar" MVN="mvn:com.fasterxml.jackson.core/jackson-annotations/2.13.2"
|
||||
REQUIRED_IF="USE_EXISTING_CONNECTION == 'false'" />
|
||||
<IMPORT NAME="apache-http-client"
|
||||
MODULE="httpclient-4.5.13.jar" MVN="mvn:org.apache.httpcomponents/httpclient/4.5.13"
|
||||
|
||||
@@ -88,13 +88,13 @@
|
||||
MODULE="boxjavalibv2-v3.0.10.jar" MVN="mvn:net.box/boxjavalibv2/v3.0.10"
|
||||
REQUIRED_IF="USE_EXISTING_CONNECTION == 'false'" />
|
||||
<IMPORT NAME="jackson-core"
|
||||
MODULE="jackson-core-2.11.4.jar" MVN="mvn:com.fasterxml.jackson.core/jackson-core/2.11.4"
|
||||
MODULE="jackson-core-2.13.2.jar" MVN="mvn:com.fasterxml.jackson.core/jackson-core/2.13.2"
|
||||
REQUIRED_IF="USE_EXISTING_CONNECTION == 'false'" />
|
||||
<IMPORT NAME="jackson-databind"
|
||||
MODULE="jackson-databind-2.11.4.jar" MVN="mvn:com.fasterxml.jackson.core/jackson-databind/2.11.4"
|
||||
MODULE="jackson-databind-2.13.2.2.jar" MVN="mvn:com.fasterxml.jackson.core/jackson-databind/2.13.2.2"
|
||||
REQUIRED_IF="USE_EXISTING_CONNECTION == 'false'" />
|
||||
<IMPORT NAME="jackson-annotations"
|
||||
MODULE="jackson-annotations-2.11.4.jar" MVN="mvn:com.fasterxml.jackson.core/jackson-annotations/2.11.4"
|
||||
MODULE="jackson-annotations-2.13.2.jar" MVN="mvn:com.fasterxml.jackson.core/jackson-annotations/2.13.2"
|
||||
REQUIRED_IF="USE_EXISTING_CONNECTION == 'false'" />
|
||||
<IMPORT NAME="apache-http-client"
|
||||
MODULE="httpclient-4.5.13.jar" MVN="mvn:org.apache.httpcomponents/httpclient/4.5.13"
|
||||
|
||||
@@ -98,13 +98,13 @@
|
||||
MODULE="boxjavalibv2-v3.0.10.jar" MVN="mvn:net.box/boxjavalibv2/v3.0.10"
|
||||
REQUIRED_IF="USE_EXISTING_CONNECTION == 'false'" />
|
||||
<IMPORT NAME="jackson-core"
|
||||
MODULE="jackson-core-2.11.4.jar" MVN="mvn:com.fasterxml.jackson.core/jackson-core/2.11.4"
|
||||
MODULE="jackson-core-2.13.2.jar" MVN="mvn:com.fasterxml.jackson.core/jackson-core/2.13.2"
|
||||
REQUIRED_IF="USE_EXISTING_CONNECTION == 'false'" />
|
||||
<IMPORT NAME="jackson-databind"
|
||||
MODULE="jackson-databind-2.11.4.jar" MVN="mvn:com.fasterxml.jackson.core/jackson-databind/2.11.4"
|
||||
MODULE="jackson-databind-2.13.2.2.jar" MVN="mvn:com.fasterxml.jackson.core/jackson-databind/2.13.2.2"
|
||||
REQUIRED_IF="USE_EXISTING_CONNECTION == 'false'" />
|
||||
<IMPORT NAME="jackson-annotations"
|
||||
MODULE="jackson-annotations-2.11.4.jar" MVN="mvn:com.fasterxml.jackson.core/jackson-annotations/2.11.4"
|
||||
MODULE="jackson-annotations-2.13.2.jar" MVN="mvn:com.fasterxml.jackson.core/jackson-annotations/2.13.2"
|
||||
REQUIRED_IF="USE_EXISTING_CONNECTION == 'false'" />
|
||||
<IMPORT NAME="apache-http-client"
|
||||
MODULE="httpclient-4.5.13.jar" MVN="mvn:org.apache.httpcomponents/httpclient/4.5.13"
|
||||
|
||||
@@ -106,13 +106,13 @@
|
||||
MODULE="boxjavalibv2-v3.0.10.jar" MVN="mvn:net.box/boxjavalibv2/v3.0.10"
|
||||
REQUIRED_IF="USE_EXISTING_CONNECTION == 'false'" />
|
||||
<IMPORT NAME="jackson-core"
|
||||
MODULE="jackson-core-2.11.4.jar" MVN="mvn:com.fasterxml.jackson.core/jackson-core/2.11.4"
|
||||
MODULE="jackson-core-2.13.2.jar" MVN="mvn:com.fasterxml.jackson.core/jackson-core/2.13.2"
|
||||
REQUIRED_IF="USE_EXISTING_CONNECTION == 'false'" />
|
||||
<IMPORT NAME="jackson-databind"
|
||||
MODULE="jackson-databind-2.11.4.jar" MVN="mvn:com.fasterxml.jackson.core/jackson-databind/2.11.4"
|
||||
MODULE="jackson-databind-2.13.2.2.jar" MVN="mvn:com.fasterxml.jackson.core/jackson-databind/2.13.2.2"
|
||||
REQUIRED_IF="USE_EXISTING_CONNECTION == 'false'" />
|
||||
<IMPORT NAME="jackson-annotations"
|
||||
MODULE="jackson-annotations-2.11.4.jar" MVN="mvn:com.fasterxml.jackson.core/jackson-annotations/2.11.4"
|
||||
MODULE="jackson-annotations-2.13.2.jar" MVN="mvn:com.fasterxml.jackson.core/jackson-annotations/2.13.2"
|
||||
REQUIRED_IF="USE_EXISTING_CONNECTION == 'false'" />
|
||||
<IMPORT NAME="apache-http-client"
|
||||
MODULE="httpclient-4.5.13.jar" MVN="mvn:org.apache.httpcomponents/httpclient/4.5.13"
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user