You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by ga...@apache.org on 2022/10/25 01:50:40 UTC
[incubator-seatunnel] branch dev updated: [Bug][Core] Fix Change SeaTunnel Logo Print Error in some jdk version (#3160)
This is an automated email from the ASF dual-hosted git repository.
gaojun2048 pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/incubator-seatunnel.git
The following commit(s) were added to refs/heads/dev by this push:
new dae1bdaa4 [Bug][Core] Fix Change SeaTunnel Logo Print Error in some jdk version (#3160)
dae1bdaa4 is described below
commit dae1bdaa456de49cde6f6d7f2d46a6cd70b44031
Author: john <we...@gmail.com>
AuthorDate: Tue Oct 25 09:50:34 2022 +0800
[Bug][Core] Fix Change SeaTunnel Logo Print Error in some jdk version (#3160)
* [Bug][Core] Fix Change SeaTunnel Logo Print Error in some jdk version
* [Improve][Core] remove unuse class
---
.../org/apache/seatunnel/common/Constants.java | 10 ++++
.../core/base/command/BaseTaskExecuteCommand.java | 5 +-
.../seatunnel/core/base/utils/AsciiArtUtils.java | 70 ----------------------
.../core/starter/utils/AsciiArtUtils.java | 70 ----------------------
.../engine/server/NodeExtensionCommon.java | 16 +----
5 files changed, 15 insertions(+), 156 deletions(-)
diff --git a/seatunnel-common/src/main/java/org/apache/seatunnel/common/Constants.java b/seatunnel-common/src/main/java/org/apache/seatunnel/common/Constants.java
index c5a24d228..883fe3ff5 100644
--- a/seatunnel-common/src/main/java/org/apache/seatunnel/common/Constants.java
+++ b/seatunnel-common/src/main/java/org/apache/seatunnel/common/Constants.java
@@ -43,6 +43,16 @@ public final class Constants {
public static final String NOW = "now";
+ public static final String ST_LOGO =
+ " \n" +
+ " _____ _____ _ \n" +
+ "/ ___| |_ _| | |\n" +
+ "\\ `--. ___ __ _ | | _ _ _ __ _ __ ___ | |\n" +
+ " `--. \\ / _ \\ / _` | | | | | | || '_ \\ | '_ \\ / _ \\| |\n" +
+ "/\\__/ /| __/| (_| | | | | |_| || | | || | | || __/| |\n" +
+ "\\____/ \\___| \\__,_| \\_/ \\__,_||_| |_||_| |_| \\___||_|\n" +
+ " \n";
+ public static final String COPYRIGHT_LINE = "Copyright © 2021-2022 The Apache Software Foundation. Apache SeaTunnel, SeaTunnel, and its feather logo are trademarks of The Apache Software Foundation.";
private Constants() {
}
}
diff --git a/seatunnel-core/seatunnel-core-base/src/main/java/org/apache/seatunnel/core/base/command/BaseTaskExecuteCommand.java b/seatunnel-core/seatunnel-core-base/src/main/java/org/apache/seatunnel/core/base/command/BaseTaskExecuteCommand.java
index 8cc825b2b..908931da5 100644
--- a/seatunnel-core/seatunnel-core-base/src/main/java/org/apache/seatunnel/core/base/command/BaseTaskExecuteCommand.java
+++ b/seatunnel-core/seatunnel-core-base/src/main/java/org/apache/seatunnel/core/base/command/BaseTaskExecuteCommand.java
@@ -24,7 +24,6 @@ import org.apache.seatunnel.common.Constants;
import org.apache.seatunnel.common.config.CheckResult;
import org.apache.seatunnel.common.config.Common;
import org.apache.seatunnel.common.config.DeployMode;
-import org.apache.seatunnel.core.base.utils.AsciiArtUtils;
import org.apache.seatunnel.core.base.utils.CompressionUtils;
import lombok.extern.slf4j.Slf4j;
@@ -96,7 +95,8 @@ public abstract class BaseTaskExecuteCommand<T extends AbstractCommandArgs, E ex
protected void showAsciiLogo() {
String printAsciiLogo = System.getenv("SEATUNNEL_PRINT_ASCII_LOGO");
if ("true".equalsIgnoreCase(printAsciiLogo)) {
- AsciiArtUtils.printAsciiArt(Constants.LOGO);
+ log.info('\n' + Constants.ST_LOGO);
+ log.info(Constants.COPYRIGHT_LINE);
}
}
@@ -145,5 +145,4 @@ public abstract class BaseTaskExecuteCommand<T extends AbstractCommandArgs, E ex
log.info("succeeded to decompress plugins.tar.gz");
}
}
-
}
diff --git a/seatunnel-core/seatunnel-core-base/src/main/java/org/apache/seatunnel/core/base/utils/AsciiArtUtils.java b/seatunnel-core/seatunnel-core-base/src/main/java/org/apache/seatunnel/core/base/utils/AsciiArtUtils.java
deleted file mode 100644
index fb9b75320..000000000
--- a/seatunnel-core/seatunnel-core-base/src/main/java/org/apache/seatunnel/core/base/utils/AsciiArtUtils.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.seatunnel.core.base.utils;
-
-import lombok.extern.slf4j.Slf4j;
-
-import java.awt.Font;
-import java.awt.Graphics;
-import java.awt.Graphics2D;
-import java.awt.RenderingHints;
-import java.awt.image.BufferedImage;
-
-@Slf4j
-public final class AsciiArtUtils {
-
- private static final int FONT_SIZE = 24;
- private static final int DRAW_X = 6;
- private static final int RGB = -16777216;
-
- private AsciiArtUtils() {
- }
-
- /**
- * Print ASCII art of string
- *
- * @param str str
- */
- public static void printAsciiArt(String str) {
-
- final int width = 144;
- final int height = 32;
- BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
- Graphics g = image.getGraphics();
- g.setFont(new Font("Dialog", Font.PLAIN, FONT_SIZE));
- Graphics2D graphics = (Graphics2D) g;
- graphics.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
- RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
- graphics.drawString(str, DRAW_X, FONT_SIZE);
-
- for (int y = 0; y < height; y++) {
- StringBuilder sb = new StringBuilder();
- for (int x = 0; x < width; x++) {
- if (image.getRGB(x, y) == RGB) {
- sb.append(" ");
- } else {
- sb.append(image.getRGB(x, y) == -1 ? "#" : "*");
- }
- }
- if (sb.toString().trim().isEmpty()) {
- continue;
- }
- log.info(String.valueOf(sb));
- }
- }
-}
diff --git a/seatunnel-core/seatunnel-core-starter/src/main/java/org/apache/seatunnel/core/starter/utils/AsciiArtUtils.java b/seatunnel-core/seatunnel-core-starter/src/main/java/org/apache/seatunnel/core/starter/utils/AsciiArtUtils.java
deleted file mode 100644
index 3c38b74d4..000000000
--- a/seatunnel-core/seatunnel-core-starter/src/main/java/org/apache/seatunnel/core/starter/utils/AsciiArtUtils.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.seatunnel.core.starter.utils;
-
-import lombok.extern.slf4j.Slf4j;
-
-import java.awt.Font;
-import java.awt.Graphics;
-import java.awt.Graphics2D;
-import java.awt.RenderingHints;
-import java.awt.image.BufferedImage;
-
-@Slf4j
-public final class AsciiArtUtils {
-
- private static final int FONT_SIZE = 24;
- private static final int DRAW_X = 6;
- private static final int RGB = -16777216;
-
- private AsciiArtUtils() {
- }
-
- /**
- * Print ASCII art of string
- *
- * @param str str
- */
- public static void printAsciiArt(String str) {
-
- final int width = 144;
- final int height = 32;
- BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
- Graphics g = image.getGraphics();
- g.setFont(new Font("Dialog", Font.PLAIN, FONT_SIZE));
- Graphics2D graphics = (Graphics2D) g;
- graphics.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
- RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
- graphics.drawString(str, DRAW_X, FONT_SIZE);
-
- for (int y = 0; y < height; y++) {
- StringBuilder sb = new StringBuilder();
- for (int x = 0; x < width; x++) {
- if (image.getRGB(x, y) == RGB) {
- sb.append(" ");
- } else {
- sb.append(image.getRGB(x, y) == -1 ? "#" : "*");
- }
- }
- if (sb.toString().trim().isEmpty()) {
- continue;
- }
- log.info(String.valueOf(sb));
- }
- }
-}
diff --git a/seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/NodeExtensionCommon.java b/seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/NodeExtensionCommon.java
index 45ecaa3a6..85000fa6d 100644
--- a/seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/NodeExtensionCommon.java
+++ b/seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/NodeExtensionCommon.java
@@ -19,6 +19,7 @@ package org.apache.seatunnel.engine.server;
import static com.hazelcast.cluster.ClusterState.PASSIVE;
+import org.apache.seatunnel.common.Constants;
import org.apache.seatunnel.engine.common.Constant;
import com.hazelcast.cluster.ClusterState;
@@ -30,17 +31,6 @@ import java.util.HashMap;
import java.util.Map;
class NodeExtensionCommon {
- private static final String ST_LOGO =
- " \n" +
- " _____ _____ _ \n" +
- "/ ___| |_ _| | |\n" +
- "\\ `--. ___ __ _ | | _ _ _ __ _ __ ___ | |\n" +
- " `--. \\ / _ \\ / _` | | | | | | || '_ \\ | '_ \\ / _ \\| |\n" +
- "/\\__/ /| __/| (_| | | | | |_| || | | || | | || __/| |\n" +
- "\\____/ \\___| \\__,_| \\_/ \\__,_||_| |_||_| |_| \\___||_|\n" +
- " \n";
- private static final String COPYRIGHT_LINE = "Copyright © 2021-2022 The Apache Software Foundation. Apache SeaTunnel, SeaTunnel, and its feather logo are trademarks of The Apache Software Foundation.";
-
private final Node node;
private final ILogger logger;
private final SeaTunnelServer server;
@@ -72,8 +62,8 @@ class NodeExtensionCommon {
log.info(imdgVersionMessage());
log.info(clusterNameMessage());
log.fine(serializationVersionMessage());
- log.info('\n' + ST_LOGO);
- log.info(COPYRIGHT_LINE);
+ log.info('\n' + Constants.ST_LOGO);
+ log.info(Constants.COPYRIGHT_LINE);
}
private String imdgVersionMessage() {