Compare commits
4 Commits
cmeng/chor
...
bhe/bugfix
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
56ce038b70 | ||
|
|
fb0ee1ba3f | ||
|
|
5b39231455 | ||
|
|
aae4ed766e |
@@ -11,6 +11,7 @@ imports="
|
||||
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
|
||||
INode node = (INode)codeGenArgument.getArgument();
|
||||
String cid = node.getUniqueName();
|
||||
String dieOnError = ElementParameterParser.getValue(node, "__DIE_ON_ERROR__");
|
||||
%>
|
||||
<%@ include file="../tS3Connection/S3Client.javajet" %>
|
||||
|
||||
@@ -37,21 +38,25 @@ imports="
|
||||
try{
|
||||
objects_<%=cid%> = conn_<%=cid%>.listObjects(currentBucketName_<%=cid%>,<%=objects_prefix!=null && objects_prefix.trim().length()>0 ?objects_prefix:null%>);
|
||||
}catch(com.amazonaws.AmazonClientException e_<%=cid%>){
|
||||
globalMap.put("<%=cid%>_ERROR_MESSAGE",e_<%=cid%>.getMessage());
|
||||
globalMap.put("<%=cid%>_ERROR_MESSAGE",e_<%=cid%>.getMessage());
|
||||
<%
|
||||
if(isLog4jEnabled){
|
||||
if (("true").equals(dieOnError)) {
|
||||
%>
|
||||
log.warn("<%=cid%> - Failed to list objects from bucket "+currentBucketName_<%=cid%>);
|
||||
log.warn("<%=cid%> - "+e_<%=cid%>.getMessage());
|
||||
throw(e_<%=cid%>);
|
||||
<%
|
||||
}else{
|
||||
%>
|
||||
System.err.println("WARNING: [<%=cid%>] failed to list objects from bucket "+currentBucketName_<%=cid%>);
|
||||
System.err.println("WARNING: [<%=cid%>] "+e_<%=cid%>.getMessage());
|
||||
<%
|
||||
}
|
||||
%>
|
||||
continue;
|
||||
} else {
|
||||
if(isLog4jEnabled){
|
||||
%>
|
||||
log.warn("<%=cid%> - Failed to list objects from bucket "+currentBucketName_<%=cid%>);
|
||||
log.warn("<%=cid%> - "+e_<%=cid%>.getMessage());
|
||||
<%
|
||||
}else{
|
||||
%>
|
||||
System.err.println("WARNING: [<%=cid%>] failed to list objects from bucket "+currentBucketName_<%=cid%>);
|
||||
System.err.println("WARNING: [<%=cid%>] "+e_<%=cid%>.getMessage());
|
||||
<%}%>
|
||||
continue;
|
||||
<%}%>
|
||||
}
|
||||
<%
|
||||
} else if(buckets.size()>0){
|
||||
@@ -94,21 +99,25 @@ globalMap.put("<%=cid%>_ERROR_MESSAGE",e_<%=cid%>.getMessage());
|
||||
%>
|
||||
objects_<%=cid%> = conn_<%=cid%>.listObjects(currentBucketName_<%=cid%>,currentPrefix_<%=cid%>);
|
||||
}catch(com.amazonaws.AmazonClientException e_<%=cid%>){
|
||||
globalMap.put("<%=cid%>_ERROR_MESSAGE",e_<%=cid%>.getMessage());
|
||||
globalMap.put("<%=cid%>_ERROR_MESSAGE",e_<%=cid%>.getMessage());
|
||||
<%
|
||||
if(isLog4jEnabled){
|
||||
if (("true").equals(dieOnError)) {
|
||||
%>
|
||||
log.warn("<%=cid%> - Failed to list objects from bucket "+currentBucketName_<%=cid%>);
|
||||
log.warn("<%=cid%> - "+e_<%=cid%>.getMessage());
|
||||
throw(e_<%=cid%>);
|
||||
<%
|
||||
}else{
|
||||
%>
|
||||
System.err.println("WARNING: [<%=cid%>] failed to list objects from bucket "+currentBucketName_<%=cid%>);
|
||||
System.err.println("WARNING: [<%=cid%>] "+e_<%=cid%>.getMessage());
|
||||
<%
|
||||
}
|
||||
%>
|
||||
continue;
|
||||
} else {
|
||||
if(isLog4jEnabled){
|
||||
%>
|
||||
log.warn("<%=cid%> - Failed to list objects from bucket "+currentBucketName_<%=cid%>);
|
||||
log.warn("<%=cid%> - "+e_<%=cid%>.getMessage());
|
||||
<%
|
||||
}else{
|
||||
%>
|
||||
System.err.println("WARNING: [<%=cid%>] failed to list objects from bucket "+currentBucketName_<%=cid%>);
|
||||
System.err.println("WARNING: [<%=cid%>] "+e_<%=cid%>.getMessage());
|
||||
<%}%>
|
||||
continue;
|
||||
<%}%>
|
||||
}
|
||||
<%
|
||||
}
|
||||
@@ -142,4 +151,4 @@ globalMap.put("<%=cid%>_ERROR_MESSAGE",e_<%=cid%>.getMessage());
|
||||
%>
|
||||
<%
|
||||
}
|
||||
%>
|
||||
%>
|
||||
|
||||
@@ -30,7 +30,7 @@ imports="
|
||||
}
|
||||
%>
|
||||
}catch(com.amazonaws.AmazonClientException e_<%=cid%>){
|
||||
globalMap.put("<%=cid%>_ERROR_MESSAGE",e_<%=cid%>.getMessage());
|
||||
globalMap.put("<%=cid%>_ERROR_MESSAGE",e_<%=cid%>.getMessage());
|
||||
<%
|
||||
if (("true").equals(dieOnError)) {
|
||||
%>
|
||||
@@ -65,4 +65,4 @@ globalMap.put("<%=cid%>_ERROR_MESSAGE",e_<%=cid%>.getMessage());
|
||||
log.info("<%=cid%> - Retrieved the objects count: " + nb_bucket_object_<%=cid%> + " .");
|
||||
<%
|
||||
}
|
||||
%>
|
||||
%>
|
||||
|
||||
@@ -137,7 +137,11 @@ imports="
|
||||
<%
|
||||
if (("PUBLICKEY").equals(authMethod)) {
|
||||
%>
|
||||
try {
|
||||
java.nio.file.Files.write(privateKey_<%=cid%>,lines_<%=cid%>);
|
||||
} catch (java.lang.Exception e) {
|
||||
//ignore
|
||||
}
|
||||
<%}%>
|
||||
if(14 == se_<%=cid%>.getDisconnectCode()){
|
||||
throw new IllegalArgumentException("Authentication failed.");
|
||||
|
||||
@@ -51,22 +51,29 @@ imports="
|
||||
log.debug("Execute command: "+ rmCmd_<%= cid %>);
|
||||
<%}%>
|
||||
org.apache.sshd.client.channel.ClientChannel channel_<%=cid %> = session_<%=cid %>.createExecChannel((command_<%=cid %>).toString());
|
||||
java.io.ByteArrayOutputStream stdout_<%=cid %> = new java.io.ByteArrayOutputStream();
|
||||
java.io.ByteArrayOutputStream stderr_<%=cid %> = new java.io.ByteArrayOutputStream();
|
||||
channel_<%=cid%>.setOut(stdout_<%=cid %>);
|
||||
channel_<%=cid%>.setErr(stderr_<%=cid %>);
|
||||
|
||||
|
||||
channel_<%=cid%>.open();
|
||||
java.util.Set<org.apache.sshd.client.channel.ClientChannelEvent> clientChannelEvents_<%=cid %> =
|
||||
channel_<%=cid%>.waitFor(java.util.EnumSet.of(
|
||||
org.apache.sshd.client.channel.ClientChannelEvent.CLOSED,org.apache.sshd.client.channel.ClientChannelEvent.EXIT_STATUS), 0L);
|
||||
exit_code_<%=cid%> = channel_<%=cid%>.getExitStatus();
|
||||
channel_<%=cid%>.close();
|
||||
|
||||
|
||||
<%if(isLog4jEnabled){%>
|
||||
log.debug("Channel Events: "+ java.util.Arrays.toString(clientChannelEvents_<%=cid %>.toArray()));
|
||||
<%}%>
|
||||
stringStdout_<%=cid%>.append(stdout_<%=cid%>.toString());
|
||||
stringStderr_<%=cid%>.append(stderr_<%=cid%>.toString());
|
||||
|
||||
final java.io.InputStream invertedOut_<%=cid%> = channel_<%=cid%>.getInvertedOut();
|
||||
final List<String> outLines_<%=cid%> = org.apache.sshd.common.util.io.IoUtils.readAllLines(invertedOut_<%=cid%>);
|
||||
|
||||
final java.io.InputStream invertedErr_<%=cid%> = channel_<%=cid%>.getInvertedErr();
|
||||
final List<String> errorLines_<%=cid%> = org.apache.sshd.common.util.io.IoUtils.readAllLines(invertedErr_<%=cid%>);
|
||||
|
||||
|
||||
stringStdout_<%=cid%>.append(outLines_<%=cid%>.stream().collect(java.util.stream.Collectors.joining("\n")));
|
||||
stringStderr_<%=cid%>.append(errorLines_<%=cid%>.stream().collect(java.util.stream.Collectors.joining("\n")));
|
||||
channel_<%=cid%>.close();
|
||||
|
||||
if(stringStdout_<%=cid%>.length() >0 && stringStdout_<%=cid%>.charAt(stringStdout_<%=cid%>.length()-1) == '\n'){
|
||||
stringStdout_<%=cid%>.deleteCharAt(stringStdout_<%=cid%>.length()-1);
|
||||
@@ -79,6 +86,7 @@ imports="
|
||||
|
||||
<% if(dieOnError){ %>
|
||||
StringBuilder errMsg_<%= cid %> = new StringBuilder("File(s) deleting failed.");
|
||||
|
||||
if(clientChannelEvents_<%=cid %>.contains(org.apache.sshd.client.channel.ClientChannelEvent.EXIT_STATUS)){
|
||||
if (exit_code_<%= cid %> != 0) {
|
||||
isCmdFailed_<%= cid %> = true;
|
||||
|
||||
@@ -167,7 +167,11 @@ imports="
|
||||
<%
|
||||
if (("PUBLICKEY").equals(authMethod)) {
|
||||
%>
|
||||
java.nio.file.Files.write(privateKey_<%=cid%>,lines_<%=cid%>);
|
||||
try {
|
||||
java.nio.file.Files.write(privateKey_<%=cid%>,lines_<%=cid%>);
|
||||
} catch (java.lang.Exception e) {
|
||||
//ignore
|
||||
}
|
||||
<%}%>
|
||||
if(14 == se_<%=cid%>.getDisconnectCode()){
|
||||
throw new IllegalArgumentException("Authentication failed.");
|
||||
|
||||
@@ -50,22 +50,27 @@ imports="
|
||||
<%}%>
|
||||
|
||||
org.apache.sshd.client.channel.ClientChannel channel_<%=cid %> = session_<%=cid %>.createExecChannel((command_<%=cid %>).toString());
|
||||
java.io.ByteArrayOutputStream stdout_<%=cid %> = new java.io.ByteArrayOutputStream();
|
||||
java.io.ByteArrayOutputStream stderr_<%=cid %> = new java.io.ByteArrayOutputStream();
|
||||
channel_<%=cid%>.setOut(stdout_<%=cid %>);
|
||||
channel_<%=cid%>.setErr(stderr_<%=cid %>);
|
||||
|
||||
channel_<%=cid%>.open();
|
||||
java.util.Set<org.apache.sshd.client.channel.ClientChannelEvent> clientChannelEvents_<%=cid %> =
|
||||
channel_<%=cid%>.waitFor(java.util.EnumSet.of(
|
||||
org.apache.sshd.client.channel.ClientChannelEvent.CLOSED,org.apache.sshd.client.channel.ClientChannelEvent.EXIT_STATUS), 0L);
|
||||
exit_code_<%=cid%> = channel_<%=cid%>.getExitStatus();
|
||||
channel_<%=cid%>.close();
|
||||
|
||||
|
||||
<%if(isLog4jEnabled){%>
|
||||
log.debug("Channel Events: "+ java.util.Arrays.toString(clientChannelEvents_<%=cid %>.toArray()));
|
||||
<%}%>
|
||||
stringStdout_<%=cid%>.append(stdout_<%=cid%>.toString());
|
||||
stringStderr_<%=cid%>.append(stderr_<%=cid%>.toString());
|
||||
|
||||
final java.io.InputStream invertedOut_<%=cid%> = channel_<%=cid%>.getInvertedOut();
|
||||
final List<String> outLines_<%=cid%> = org.apache.sshd.common.util.io.IoUtils.readAllLines(invertedOut_<%=cid%>);
|
||||
|
||||
final java.io.InputStream invertedErr_<%=cid%> = channel_<%=cid%>.getInvertedErr();
|
||||
final List<String> errorLines_<%=cid%> = org.apache.sshd.common.util.io.IoUtils.readAllLines(invertedErr_<%=cid%>);
|
||||
stringStdout_<%=cid%>.append(outLines_<%=cid%>.stream().collect(java.util.stream.Collectors.joining("\n")));
|
||||
stringStderr_<%=cid%>.append(errorLines_<%=cid%>.stream().collect(java.util.stream.Collectors.joining("\n")));
|
||||
|
||||
channel_<%=cid%>.close();
|
||||
|
||||
if(stringStdout_<%=cid%>.length() >0 && stringStdout_<%=cid%>.charAt(stringStdout_<%=cid%>.length()-1) == '\n'){
|
||||
stringStdout_<%=cid%>.deleteCharAt(stringStdout_<%=cid%>.length()-1);
|
||||
|
||||
@@ -162,7 +162,11 @@ imports="
|
||||
<%
|
||||
if (("PUBLICKEY").equals(authMethod)) {
|
||||
%>
|
||||
java.nio.file.Files.write(privateKey_<%=cid%>,lines_<%=cid%>);
|
||||
try {
|
||||
java.nio.file.Files.write(privateKey_<%=cid%>,lines_<%=cid%>);
|
||||
} catch (java.lang.Exception e) {
|
||||
//ignore
|
||||
}
|
||||
<%}%>
|
||||
if(14 == se_<%=cid%>.getDisconnectCode()){
|
||||
throw new IllegalArgumentException("Authentication failed.");
|
||||
@@ -191,22 +195,26 @@ imports="
|
||||
StringBuilder stringStdout_<%=cid%> =new StringBuilder();
|
||||
StringBuilder stringStderr_<%=cid%> =new StringBuilder();
|
||||
Integer exit_code_<%=cid%> = null;
|
||||
|
||||
java.io.ByteArrayOutputStream stdout_<%=cid %> = new java.io.ByteArrayOutputStream();
|
||||
java.io.ByteArrayOutputStream stderr_<%=cid %> = new java.io.ByteArrayOutputStream();
|
||||
channel_<%=cid%>.setOut(stdout_<%=cid %>);
|
||||
channel_<%=cid%>.setErr(stderr_<%=cid %>);
|
||||
channel_<%=cid%>.open();
|
||||
java.util.Set<org.apache.sshd.client.channel.ClientChannelEvent> clientChannelEvents_<%=cid %> =
|
||||
channel_<%=cid%>.waitFor(java.util.EnumSet.of(
|
||||
org.apache.sshd.client.channel.ClientChannelEvent.CLOSED,org.apache.sshd.client.channel.ClientChannelEvent.EXIT_STATUS), 0L);
|
||||
exit_code_<%=cid%> = channel_<%=cid%>.getExitStatus();
|
||||
channel_<%=cid%>.close();
|
||||
|
||||
<%if(isLog4jEnabled){%>
|
||||
log.debug("Channel Events: "+ java.util.Arrays.toString(clientChannelEvents_<%=cid %>.toArray()));
|
||||
<%}%>
|
||||
stringStdout_<%=cid%>.append(stdout_<%=cid%>.toString());
|
||||
stringStderr_<%=cid%>.append(stderr_<%=cid%>.toString());
|
||||
|
||||
final java.io.InputStream invertedOut_<%=cid%> = channel_<%=cid%>.getInvertedOut();
|
||||
final List<String> outLines_<%=cid%> = org.apache.sshd.common.util.io.IoUtils.readAllLines(invertedOut_<%=cid%>);
|
||||
|
||||
final java.io.InputStream invertedErr_<%=cid%> = channel_<%=cid%>.getInvertedErr();
|
||||
final List<String> errorLines_<%=cid%> = org.apache.sshd.common.util.io.IoUtils.readAllLines(invertedErr_<%=cid%>);
|
||||
|
||||
stringStdout_<%=cid%>.append(outLines_<%=cid%>.stream().collect(java.util.stream.Collectors.joining("\n")));
|
||||
stringStderr_<%=cid%>.append(errorLines_<%=cid%>.stream().collect(java.util.stream.Collectors.joining("\n")));
|
||||
|
||||
channel_<%=cid%>.close();
|
||||
|
||||
if(stringStdout_<%=cid%>.length() >0 && stringStdout_<%=cid%>.charAt(stringStdout_<%=cid%>.length()-1) == '\n'){
|
||||
stringStdout_<%=cid%>.deleteCharAt(stringStdout_<%=cid%>.length()-1);
|
||||
|
||||
@@ -31,22 +31,29 @@ imports="
|
||||
//execute the command
|
||||
|
||||
org.apache.sshd.client.channel.ClientChannel channel_<%=cid %> = session_<%=cid %>.createExecChannel((command_<%=cid %>).toString());
|
||||
java.io.ByteArrayOutputStream stdout_<%=cid %> = new java.io.ByteArrayOutputStream();
|
||||
java.io.ByteArrayOutputStream stderr_<%=cid %> = new java.io.ByteArrayOutputStream();
|
||||
channel_<%=cid%>.setOut(stdout_<%=cid %>);
|
||||
channel_<%=cid%>.setErr(stderr_<%=cid %>);
|
||||
|
||||
|
||||
channel_<%=cid%>.open();
|
||||
java.util.Set<org.apache.sshd.client.channel.ClientChannelEvent> clientChannelEvents_<%=cid %> =
|
||||
channel_<%=cid%>.waitFor(java.util.EnumSet.of(
|
||||
org.apache.sshd.client.channel.ClientChannelEvent.CLOSED,org.apache.sshd.client.channel.ClientChannelEvent.EXIT_STATUS), 0L);
|
||||
exit_code_<%=cid%> = channel_<%=cid%>.getExitStatus();
|
||||
channel_<%=cid%>.close();
|
||||
|
||||
|
||||
<%if(isLog4jEnabled){%>
|
||||
log.debug("Channel Events: "+ java.util.Arrays.toString(clientChannelEvents_<%=cid %>.toArray()));
|
||||
<%}%>
|
||||
stringStdout_<%=cid%>.append(stdout_<%=cid%>.toString());
|
||||
stringStderr_<%=cid%>.append(stderr_<%=cid%>.toString());
|
||||
|
||||
final java.io.InputStream invertedOut_<%=cid%> = channel_<%=cid%>.getInvertedOut();
|
||||
final List<String> outLines_<%=cid%> = org.apache.sshd.common.util.io.IoUtils.readAllLines(invertedOut_<%=cid%>);
|
||||
|
||||
final java.io.InputStream invertedErr_<%=cid%> = channel_<%=cid%>.getInvertedErr();
|
||||
final List<String> errorLines_<%=cid%> = org.apache.sshd.common.util.io.IoUtils.readAllLines(invertedErr_<%=cid%>);
|
||||
|
||||
stringStdout_<%=cid%>.append(outLines_<%=cid%>.stream().collect(java.util.stream.Collectors.joining("\n")));
|
||||
stringStderr_<%=cid%>.append(errorLines_<%=cid%>.stream().collect(java.util.stream.Collectors.joining("\n")));
|
||||
|
||||
channel_<%=cid%>.close();
|
||||
|
||||
if(stringStdout_<%=cid%>.length() >0 && stringStdout_<%=cid%>.charAt(stringStdout_<%=cid%>.length()-1) == '\n'){
|
||||
stringStdout_<%=cid%>.deleteCharAt(stringStdout_<%=cid%>.length()-1);
|
||||
|
||||
@@ -50,7 +50,11 @@ if ((metadatas!=null)&&(metadatas.size()>0)) {
|
||||
<%
|
||||
if (("PUBLICKEY").equals(authMethod)) {
|
||||
%>
|
||||
try {
|
||||
java.nio.file.Files.write(privateKey_<%=cid%>,lines_<%=cid%>);
|
||||
} catch (java.lang.Exception e) {
|
||||
//ignore
|
||||
}
|
||||
<%}%>
|
||||
if(14 == se_<%=cid%>.getDisconnectCode()){
|
||||
throw new IllegalArgumentException("Authentication failed.");
|
||||
@@ -78,7 +82,12 @@ if ((metadatas!=null)&&(metadatas.size()>0)) {
|
||||
}
|
||||
%>
|
||||
cmd_<%=cid%>.append("exit\n");
|
||||
channel_<%=cid%>.setIn(new java.io.ByteArrayInputStream(cmd_<%=cid%>.toString().getBytes()));
|
||||
channel_<%=cid%>.open().verify(<%=("true").equals(useTimeout)?timeout + " * 1000L":""%>);
|
||||
|
||||
final java.io.OutputStream invertedIn_<%=cid%> = channel_<%=cid%>.getInvertedIn();
|
||||
invertedIn_<%=cid%>.write(cmd_<%=cid%>.toString().getBytes());
|
||||
invertedIn_<%=cid%>.flush();
|
||||
invertedIn_<%=cid%>.close();
|
||||
<%
|
||||
}else{
|
||||
if(commands.size() > 0){
|
||||
@@ -97,6 +106,7 @@ if ((metadatas!=null)&&(metadatas.size()>0)) {
|
||||
}
|
||||
%>
|
||||
channel_<%=cid %> = session_<%=cid %>.createExecChannel((command_<%=cid %>).toString());
|
||||
channel_<%=cid%>.open();
|
||||
|
||||
|
||||
|
||||
@@ -110,29 +120,41 @@ if ((metadatas!=null)&&(metadatas.size()>0)) {
|
||||
<%
|
||||
}
|
||||
%>
|
||||
java.io.ByteArrayOutputStream stdout_<%=cid %> = new java.io.ByteArrayOutputStream();
|
||||
java.io.ByteArrayOutputStream stderr_<%=cid %> = new java.io.ByteArrayOutputStream();
|
||||
channel_<%=cid%>.setOut(stdout_<%=cid %>);
|
||||
channel_<%=cid%>.setErr(stderr_<%=cid %>);
|
||||
channel_<%=cid%>.open();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
java.util.Set<org.apache.sshd.client.channel.ClientChannelEvent> clientChannelEvents_<%=cid %> =
|
||||
channel_<%=cid%>.waitFor(java.util.EnumSet.of(
|
||||
org.apache.sshd.client.channel.ClientChannelEvent.CLOSED,org.apache.sshd.client.channel.ClientChannelEvent.EXIT_STATUS), 0L);
|
||||
exit_code_<%=cid%> = channel_<%=cid%>.getExitStatus();
|
||||
channel_<%=cid%>.close();
|
||||
session_<%=cid%>.close();
|
||||
|
||||
<%if(isLog4jEnabled){%>
|
||||
log.debug("Channel Events: "+ java.util.Arrays.toString(clientChannelEvents_<%=cid %>.toArray()));
|
||||
<%}%>
|
||||
stringStdout_<%=cid%>.append(stdout_<%=cid%>.toString());
|
||||
stringStderr_<%=cid%>.append(stderr_<%=cid%>.toString());
|
||||
|
||||
final java.io.InputStream invertedOut_<%=cid%> = channel_<%=cid%>.getInvertedOut();
|
||||
final List<String> outLines_<%=cid%> = org.apache.sshd.common.util.io.IoUtils.readAllLines(invertedOut_<%=cid%>);
|
||||
|
||||
final java.io.InputStream invertedErr_<%=cid%> = channel_<%=cid%>.getInvertedErr();
|
||||
final List<String> errorLines_<%=cid%> = org.apache.sshd.common.util.io.IoUtils.readAllLines(invertedErr_<%=cid%>);
|
||||
|
||||
|
||||
stringStdout_<%=cid%>.append(outLines_<%=cid%>.stream().collect(java.util.stream.Collectors.joining("\n")));
|
||||
stringStderr_<%=cid%>.append(errorLines_<%=cid%>.stream().collect(java.util.stream.Collectors.joining("\n")));
|
||||
|
||||
channel_<%=cid%>.close();
|
||||
session_<%=cid%>.close();
|
||||
|
||||
if(stringStdout_<%=cid%>.length() >0 && stringStdout_<%=cid%>.charAt(stringStdout_<%=cid%>.length()-1) == '\n'){
|
||||
stringStdout_<%=cid%>.deleteCharAt(stringStdout_<%=cid%>.length()-1);
|
||||
}
|
||||
out_content_<%=cid%> = stringStdout_<%=cid%>.toString();
|
||||
err_content_<%=cid%> = stringStderr_<%=cid%>.toString();
|
||||
|
||||
|
||||
|
||||
<%if(isLog4jEnabled){%>
|
||||
log.debug("<%=cid%> - Command line standard result: " + out_content_<%=cid%>);
|
||||
log.debug("<%=cid%> - Command line error result: " + err_content_<%=cid%>);
|
||||
|
||||
@@ -121,6 +121,7 @@ import org.eclipse.swt.graphics.Image;
|
||||
import org.eclipse.swt.widgets.Canvas;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Control;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
import org.eclipse.swt.widgets.Event;
|
||||
import org.eclipse.ui.IActionBars;
|
||||
import org.eclipse.ui.IEditorInput;
|
||||
@@ -1209,19 +1210,22 @@ public abstract class AbstractTalendEditor extends GraphicalEditorWithFlyoutPale
|
||||
|
||||
@Override
|
||||
public void commandStackChanged(final EventObject event) {
|
||||
if (isDirty()) {
|
||||
if (!this.savePreviouslyNeeded) {
|
||||
// remove all error status at any change of the job .
|
||||
removeErrorStatusIfDirty();
|
||||
this.savePreviouslyNeeded = true;
|
||||
Display.getDefault().syncExec(() -> {
|
||||
if (isDirty()) {
|
||||
if (!this.savePreviouslyNeeded) {
|
||||
// remove all error status at any change of the job .
|
||||
removeErrorStatusIfDirty();
|
||||
this.savePreviouslyNeeded = true;
|
||||
firePropertyChange(IEditorPart.PROP_DIRTY);
|
||||
}
|
||||
checkSaveAsEnabled();
|
||||
} else {
|
||||
savePreviouslyNeeded = false;
|
||||
firePropertyChange(IEditorPart.PROP_DIRTY);
|
||||
}
|
||||
checkSaveAsEnabled();
|
||||
} else {
|
||||
savePreviouslyNeeded = false;
|
||||
firePropertyChange(IEditorPart.PROP_DIRTY);
|
||||
}
|
||||
super.commandStackChanged(event);
|
||||
|
||||
super.commandStackChanged(event);
|
||||
});
|
||||
}
|
||||
|
||||
private void checkSaveAsEnabled() {
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
// ============================================================================
|
||||
package org.talend.designer.core.ui.editor;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.eclipse.draw2d.ColorConstants;
|
||||
import org.eclipse.draw2d.FreeformFigure;
|
||||
import org.eclipse.draw2d.Graphics;
|
||||
@@ -20,9 +19,9 @@ import org.eclipse.draw2d.IFigure;
|
||||
import org.eclipse.draw2d.geometry.Rectangle;
|
||||
import org.eclipse.gef.editparts.GridLayer;
|
||||
import org.eclipse.swt.graphics.Color;
|
||||
import org.talend.commons.exception.ExceptionHandler;
|
||||
import org.talend.commons.runtime.service.ITalendThemeService;
|
||||
import org.talend.commons.ui.gmf.draw2d.AnimatableZoomManager;
|
||||
import org.talend.commons.ui.runtime.image.EImage;
|
||||
import org.talend.commons.ui.runtime.image.ImageProvider;
|
||||
|
||||
/**
|
||||
* Grid that will be used for the designer. (modification of the default grid to have black points)
|
||||
@@ -34,64 +33,9 @@ public class TalendGridLayer extends GridLayer {
|
||||
|
||||
public static final Color GRID_COLOR = ColorConstants.black;
|
||||
|
||||
private static final Color GRID_COLOR_1 = new Color(131, 131, 131);
|
||||
|
||||
private static final Color GRID_COLOR_2 = new Color(255, 255, 255);
|
||||
|
||||
private static ITalendThemeService themeServ;
|
||||
|
||||
public TalendGridLayer() {
|
||||
super();
|
||||
setForegroundColor(ColorConstants.red);
|
||||
}
|
||||
|
||||
private static ITalendThemeService getTheme() {
|
||||
if (themeServ == null) {
|
||||
themeServ = ITalendThemeService.get();
|
||||
}
|
||||
return themeServ;
|
||||
}
|
||||
|
||||
private Color getThemeColor(String prop) {
|
||||
ITalendThemeService theme = getTheme();
|
||||
if (theme == null) {
|
||||
return null;
|
||||
}
|
||||
return (Color) theme.getGlobalThemeColor(prop);
|
||||
}
|
||||
|
||||
private Color getColor1() {
|
||||
Color themeColor = getThemeColor("DESIGNER_COLOR_A");
|
||||
if (themeColor == null) {
|
||||
themeColor = GRID_COLOR_1;
|
||||
}
|
||||
return themeColor;
|
||||
}
|
||||
|
||||
private Color getColor2() {
|
||||
Color themeColor = getThemeColor("DESIGNER_COLOR_B");
|
||||
if (themeColor == null) {
|
||||
themeColor = GRID_COLOR_2;
|
||||
}
|
||||
return themeColor;
|
||||
}
|
||||
|
||||
private int getColorAlpha() {
|
||||
final int defaultAlpha = 30;
|
||||
ITalendThemeService theme = getTheme();
|
||||
if (theme == null) {
|
||||
return defaultAlpha;
|
||||
}
|
||||
String alpha = theme.getGlobalThemeProp("DESIGNER_COLOR_ALPHA");
|
||||
if (StringUtils.isBlank(alpha)) {
|
||||
return defaultAlpha;
|
||||
}
|
||||
try {
|
||||
return Integer.valueOf(alpha);
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
return defaultAlpha;
|
||||
setForegroundColor(GRID_COLOR);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -127,18 +71,13 @@ public class TalendGridLayer extends GridLayer {
|
||||
origin.y += distanceY;
|
||||
}
|
||||
}
|
||||
g.setAlpha(getColorAlpha());
|
||||
for (int i = origin.x - distanceX; i < clip.x + clip.width; i += distanceX) {
|
||||
for (int j = origin.y - distanceY; j < clip.y + clip.height; j += distanceY) {
|
||||
// g.drawPoint(i, j);
|
||||
// g.drawPoint(i, j);
|
||||
int re = Math.abs(i - j);
|
||||
if (re / distanceY % 2 == 0) {
|
||||
g.setBackgroundColor(getColor1());
|
||||
// g.drawImage(ImageProvider.getImage(EImage.CHESS_GRAY), i, j);
|
||||
} else {
|
||||
g.setBackgroundColor(getColor2());
|
||||
g.drawImage(ImageProvider.getImage(EImage.CHESS_GRAY), i, j);
|
||||
}
|
||||
g.fillRectangle(i, j, 32, 32);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -107,8 +107,6 @@ public class TalendDrawerFigure extends DrawerFigure {
|
||||
drawerLabelField.setAccessible(true);
|
||||
talendDrawerLabel = new Label();
|
||||
talendDrawerLabel.setFont(JFaceResources.getFontRegistry().getBold("TalendDrawerFigureSymbolicName"));
|
||||
// TUP-35745
|
||||
talendDrawerLabel.setForegroundColor(cssStyleSetting.getMouseOverForgroundColor3());
|
||||
talendDrawerLabel.setLabelAlignment(Label.LEFT);
|
||||
drawerLabelField.set(this, talendDrawerLabel);
|
||||
|
||||
|
||||
@@ -80,8 +80,6 @@ public class TalendEntryEditPart extends ToolEntryEditPart {
|
||||
customLabelField = ToolEntryEditPart.class.getDeclaredField("customLabel"); //$NON-NLS-1$
|
||||
customLabelField.setAccessible(true);
|
||||
customLabelField.set(this, talendCustomLabel);
|
||||
// TUP-35745
|
||||
talendCustomLabel.setForegroundColor(cssStyleSetting.getMouseOverForgroundColor3());
|
||||
} catch (Exception e) {
|
||||
CommonExceptionHandler.process(e);
|
||||
}
|
||||
|
||||
@@ -83,6 +83,7 @@ import org.talend.signon.util.TMCRepositoryUtil;
|
||||
import org.talend.signon.util.TokenMode;
|
||||
import org.talend.signon.util.listener.LoginEventListener;
|
||||
import org.talend.utils.json.JSONObject;
|
||||
import org.talend.utils.string.DigestUtil;
|
||||
|
||||
public class LoginWithCloudPage extends AbstractLoginActionPage implements LoginEventListener {
|
||||
|
||||
@@ -402,6 +403,10 @@ public class LoginWithCloudPage extends AbstractLoginActionPage implements Login
|
||||
});
|
||||
try {
|
||||
TokenMode token = ICloudSignOnService.get().getToken(authCode, this.codeVerifier, dataCenter);
|
||||
if (CommonsPlugin.isDebugMode()) {
|
||||
LOGGER.info("Access token SHA256 is:"
|
||||
+ DigestUtil.sha256Hex(token.getAccessToken().getBytes()) + "\t Refresh token SHA256 is:" + DigestUtil.sha256Hex(token.getRefreshToken().getBytes()));
|
||||
}
|
||||
ConnectionBean conn = saveConnection(token, TMCRepositoryUtil.getCloudAdminURL(dataCenter),
|
||||
ICloudSignOnService.get().getTokenUser(TMCRepositoryUtil.getCloudAdminURL(dataCenter), token));
|
||||
if (isRefreshToken) {
|
||||
@@ -571,7 +576,7 @@ public class LoginWithCloudPage extends AbstractLoginActionPage implements Login
|
||||
|
||||
private void removeSSOConnection() {
|
||||
ConnectionUserPerReader reader = ConnectionUserPerReader.getInstance();
|
||||
List<ConnectionBean> list = reader.readConnections();
|
||||
List<ConnectionBean> list = reader.forceReadConnections();
|
||||
Iterator<ConnectionBean> connectionBeanIter = list.iterator();
|
||||
while (connectionBeanIter.hasNext()) {
|
||||
if (connectionBeanIter.next().isLoginViaCloud()) {
|
||||
@@ -584,18 +589,16 @@ public class LoginWithCloudPage extends AbstractLoginActionPage implements Login
|
||||
|
||||
private ConnectionBean saveConnection(TokenMode token, String adminURL, String user) {
|
||||
ConnectionUserPerReader reader = ConnectionUserPerReader.getInstance();
|
||||
List<ConnectionBean> list = reader.readConnections();
|
||||
ConnectionBean connection = null;
|
||||
for (ConnectionBean bean : list) {
|
||||
if (bean.isLoginViaCloud()) {
|
||||
connection = bean;
|
||||
break;
|
||||
List<ConnectionBean> list = reader.forceReadConnections();
|
||||
Iterator<ConnectionBean> connectionBeanIter = list.iterator();
|
||||
while (connectionBeanIter.hasNext()) {
|
||||
if (connectionBeanIter.next().isLoginViaCloud()) {
|
||||
connectionBeanIter.remove();
|
||||
}
|
||||
}
|
||||
if (connection == null) {
|
||||
connection = ConnectionBean.getDefaultCloudConnectionBean(token.getDataCenter());
|
||||
list.add(connection);
|
||||
}
|
||||
ConnectionBean connection = ConnectionBean.getDefaultCloudConnectionBean(token.getDataCenter());
|
||||
list.add(connection);
|
||||
|
||||
connection.setConnectionToken(token);
|
||||
connection.setUrl(adminURL);
|
||||
connection.setUser(user);
|
||||
|
||||
Reference in New Issue
Block a user