From e4bcd22bc762374063ef197928ab8cc9da5f79a8 Mon Sep 17 00:00:00 2001 From: godotg Date: Sat, 2 Sep 2023 21:11:50 +0800 Subject: [PATCH] del[util]: remove util module --- event/pom.xml | 2 +- hotswap/pom.xml | 6 - .../com/zfoo/hotswap/model/ClassFileDef.java | 11 -- net/pom.xml | 5 - .../main/java/com/zfoo/net/util/NetUtils.java | 7 +- .../com/zfoo/net}/util/security/AesUtils.java | 3 +- .../com/zfoo/net}/util/security/MD5Utils.java | 3 +- .../com/zfoo/net}/util/security/ZipUtils.java | 3 +- .../zfoo/net}/util/security/AesUtilsTest.java | 2 +- .../zfoo/net}/util/security/MD5UtilsTest.java | 3 +- .../com/zfoo/net}/util/security/ZipTest.java | 3 +- orm/pom.xml | 7 - pom.xml | 1 - scheduler/pom.xml | 2 +- storage/pom.xml | 6 - util/pom.xml | 157 ------------------ .../main/java/com/zfoo/util/EnumUtils.java | 45 ----- 17 files changed, 13 insertions(+), 253 deletions(-) rename {util/src/main/java/com/zfoo => net/src/main/java/com/zfoo/net}/util/security/AesUtils.java (99%) rename {util/src/main/java/com/zfoo => net/src/main/java/com/zfoo/net}/util/security/MD5Utils.java (99%) rename {util/src/main/java/com/zfoo => net/src/main/java/com/zfoo/net}/util/security/ZipUtils.java (98%) rename {util/src/test/java/com/zfoo => net/src/test/java/com/zfoo/net}/util/security/AesUtilsTest.java (96%) rename {util/src/test/java/com/zfoo => net/src/test/java/com/zfoo/net}/util/security/MD5UtilsTest.java (96%) rename {util/src/test/java/com/zfoo => net/src/test/java/com/zfoo/net}/util/security/ZipTest.java (98%) delete mode 100644 util/pom.xml delete mode 100644 util/src/main/java/com/zfoo/util/EnumUtils.java diff --git a/event/pom.xml b/event/pom.xml index a07b1f47..63dc934a 100644 --- a/event/pom.xml +++ b/event/pom.xml @@ -58,7 +58,7 @@ com.zfoo - util + protocol ${zfoo.version} diff --git a/hotswap/pom.xml b/hotswap/pom.xml index c1b9f91c..477c4274 100644 --- a/hotswap/pom.xml +++ b/hotswap/pom.xml @@ -56,12 +56,6 @@ - - com.zfoo - util - ${zfoo.version} - - com.zfoo scheduler diff --git a/hotswap/src/main/java/com/zfoo/hotswap/model/ClassFileDef.java b/hotswap/src/main/java/com/zfoo/hotswap/model/ClassFileDef.java index 9ddcf833..d7a2a264 100644 --- a/hotswap/src/main/java/com/zfoo/hotswap/model/ClassFileDef.java +++ b/hotswap/src/main/java/com/zfoo/hotswap/model/ClassFileDef.java @@ -1,7 +1,5 @@ package com.zfoo.hotswap.model; -import com.zfoo.util.security.MD5Utils; - /** * @author godotg * @version 3.0 @@ -12,14 +10,12 @@ public class ClassFileDef { private String className; private byte[] data; private long lastModifyTime; - private String md5; public ClassFileDef(String className, String path, long lastModifyTime, byte[] data) { this.className = className; this.path = path; this.lastModifyTime = lastModifyTime; this.data = data; - this.md5 = MD5Utils.bytesToMD5(data); } public String getPath() { @@ -54,11 +50,4 @@ public class ClassFileDef { this.lastModifyTime = lastModifyTime; } - public String getMd5() { - return md5; - } - - public void setMd5(String md5) { - this.md5 = md5; - } } diff --git a/net/pom.xml b/net/pom.xml index df6a9e26..1c6ba005 100644 --- a/net/pom.xml +++ b/net/pom.xml @@ -56,11 +56,6 @@ - - com.zfoo - util - ${zfoo.version} - com.zfoo event diff --git a/net/src/main/java/com/zfoo/net/util/NetUtils.java b/net/src/main/java/com/zfoo/net/util/NetUtils.java index 115029d5..8d99f42d 100644 --- a/net/src/main/java/com/zfoo/net/util/NetUtils.java +++ b/net/src/main/java/com/zfoo/net/util/NetUtils.java @@ -16,7 +16,6 @@ import com.zfoo.protocol.collection.ArrayUtils; import com.zfoo.protocol.util.AssertionUtils; import com.zfoo.protocol.util.IOUtils; import com.zfoo.protocol.util.StringUtils; -import com.zfoo.util.EnumUtils; import org.springframework.lang.Nullable; import java.io.IOException; @@ -290,7 +289,11 @@ public class NetUtils { public static Set getAllNetworkInterface() { try { Enumeration networkInterfaces = NetworkInterface.getNetworkInterfaces(); - return EnumUtils.enumerationToSet(networkInterfaces); + var set = new HashSet(); + while (networkInterfaces.hasMoreElements()) { + set.add(networkInterfaces.nextElement()); + } + return set; } catch (SocketException e) { return Collections.emptySet(); } diff --git a/util/src/main/java/com/zfoo/util/security/AesUtils.java b/net/src/main/java/com/zfoo/net/util/security/AesUtils.java similarity index 99% rename from util/src/main/java/com/zfoo/util/security/AesUtils.java rename to net/src/main/java/com/zfoo/net/util/security/AesUtils.java index c1e68242..68bfbb98 100644 --- a/util/src/main/java/com/zfoo/util/security/AesUtils.java +++ b/net/src/main/java/com/zfoo/net/util/security/AesUtils.java @@ -1,6 +1,5 @@ /* * Copyright (C) 2020 The zfoo Authors - * * Licensed 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 * @@ -11,7 +10,7 @@ * See the License for the specific language governing permissions and limitations under the License. */ -package com.zfoo.util.security; +package com.zfoo.net.util.security; import com.zfoo.protocol.util.StringUtils; diff --git a/util/src/main/java/com/zfoo/util/security/MD5Utils.java b/net/src/main/java/com/zfoo/net/util/security/MD5Utils.java similarity index 99% rename from util/src/main/java/com/zfoo/util/security/MD5Utils.java rename to net/src/main/java/com/zfoo/net/util/security/MD5Utils.java index 77630ece..702c96ee 100644 --- a/util/src/main/java/com/zfoo/util/security/MD5Utils.java +++ b/net/src/main/java/com/zfoo/net/util/security/MD5Utils.java @@ -1,6 +1,5 @@ /* * Copyright (C) 2020 The zfoo Authors - * * Licensed 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 * @@ -11,7 +10,7 @@ * See the License for the specific language governing permissions and limitations under the License. */ -package com.zfoo.util.security; +package com.zfoo.net.util.security; import com.zfoo.protocol.util.StringUtils; diff --git a/util/src/main/java/com/zfoo/util/security/ZipUtils.java b/net/src/main/java/com/zfoo/net/util/security/ZipUtils.java similarity index 98% rename from util/src/main/java/com/zfoo/util/security/ZipUtils.java rename to net/src/main/java/com/zfoo/net/util/security/ZipUtils.java index 702bb6cb..7b0ac7c8 100644 --- a/util/src/main/java/com/zfoo/util/security/ZipUtils.java +++ b/net/src/main/java/com/zfoo/net/util/security/ZipUtils.java @@ -1,6 +1,5 @@ /* * Copyright (C) 2020 The zfoo Authors - * * Licensed 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 * @@ -11,7 +10,7 @@ * See the License for the specific language governing permissions and limitations under the License. */ -package com.zfoo.util.security; +package com.zfoo.net.util.security; import com.zfoo.protocol.util.IOUtils; diff --git a/util/src/test/java/com/zfoo/util/security/AesUtilsTest.java b/net/src/test/java/com/zfoo/net/util/security/AesUtilsTest.java similarity index 96% rename from util/src/test/java/com/zfoo/util/security/AesUtilsTest.java rename to net/src/test/java/com/zfoo/net/util/security/AesUtilsTest.java index 80d5c074..8e3fa7d5 100644 --- a/util/src/test/java/com/zfoo/util/security/AesUtilsTest.java +++ b/net/src/test/java/com/zfoo/net/util/security/AesUtilsTest.java @@ -10,7 +10,7 @@ * See the License for the specific language governing permissions and limitations under the License. */ -package com.zfoo.util.security; +package com.zfoo.net.util.security; import org.junit.Assert; import org.junit.Test; diff --git a/util/src/test/java/com/zfoo/util/security/MD5UtilsTest.java b/net/src/test/java/com/zfoo/net/util/security/MD5UtilsTest.java similarity index 96% rename from util/src/test/java/com/zfoo/util/security/MD5UtilsTest.java rename to net/src/test/java/com/zfoo/net/util/security/MD5UtilsTest.java index 5cdb97f5..7324f4b2 100644 --- a/util/src/test/java/com/zfoo/util/security/MD5UtilsTest.java +++ b/net/src/test/java/com/zfoo/net/util/security/MD5UtilsTest.java @@ -1,6 +1,5 @@ /* * Copyright (C) 2020 The zfoo Authors - * * Licensed 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 * @@ -11,7 +10,7 @@ * See the License for the specific language governing permissions and limitations under the License. */ -package com.zfoo.util.security; +package com.zfoo.net.util.security; import org.junit.Assert; import org.junit.Test; diff --git a/util/src/test/java/com/zfoo/util/security/ZipTest.java b/net/src/test/java/com/zfoo/net/util/security/ZipTest.java similarity index 98% rename from util/src/test/java/com/zfoo/util/security/ZipTest.java rename to net/src/test/java/com/zfoo/net/util/security/ZipTest.java index 0d98b58b..1d93f914 100644 --- a/util/src/test/java/com/zfoo/util/security/ZipTest.java +++ b/net/src/test/java/com/zfoo/net/util/security/ZipTest.java @@ -1,6 +1,5 @@ /* * Copyright (C) 2020 The zfoo Authors - * * Licensed 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 * @@ -11,7 +10,7 @@ * See the License for the specific language governing permissions and limitations under the License. */ -package com.zfoo.util.security; +package com.zfoo.net.util.security; import org.junit.Assert; import org.junit.Test; diff --git a/orm/pom.xml b/orm/pom.xml index f58fde4e..5e0b97d1 100644 --- a/orm/pom.xml +++ b/orm/pom.xml @@ -56,13 +56,6 @@ - - - com.zfoo - util - ${zfoo.version} - - com.zfoo event diff --git a/pom.xml b/pom.xml index 4e77d5c3..a418aefd 100644 --- a/pom.xml +++ b/pom.xml @@ -31,7 +31,6 @@ storage orm protocol - util diff --git a/scheduler/pom.xml b/scheduler/pom.xml index 01f4a492..915b2552 100644 --- a/scheduler/pom.xml +++ b/scheduler/pom.xml @@ -58,7 +58,7 @@ com.zfoo - util + protocol ${zfoo.version} diff --git a/storage/pom.xml b/storage/pom.xml index bb8b21cc..9964bc07 100644 --- a/storage/pom.xml +++ b/storage/pom.xml @@ -62,12 +62,6 @@ ${zfoo.version} - - com.zfoo - util - ${zfoo.version} - - org.springframework spring-context diff --git a/util/pom.xml b/util/pom.xml deleted file mode 100644 index 81249318..00000000 --- a/util/pom.xml +++ /dev/null @@ -1,157 +0,0 @@ - - - 4.0.0 - - com.zfoo - util - 3.0 - - jar - - - 3.0 - - - 6.0.11 - 3.1.3 - 4.12 - - - 3.29.2-GA - 1.14.6 - - - 4.1.97.Final - - - 5.5.0 - - - 6.4.5 - - - 4.10.2 - 3.1.8 - - - 5.2.3 - 1.10.0 - - 17 - UTF-8 - - - 3.3.1 - 3.3.1 - 3.11.0 - 3.1.2 - 3.3.0 - 3.5.0 - 2.16.0 - - ${file.encoding} - ${file.encoding} - - - - - com.zfoo - protocol - ${zfoo.version} - - - - org.springframework - spring-context - ${spring.version} - - - - org.springframework - spring-expression - ${spring.version} - - - - org.springframework.boot - spring-boot-starter-logging - ${spring.boot.version} - provided - - - - junit - junit - ${junit.version} - test - - - - - src/main/java - src/test/java - - - - org.apache.maven.plugins - maven-clean-plugin - ${maven-clean-plugin.version} - - - - org.apache.maven.plugins - maven-compiler-plugin - ${maven-compiler-plugin.version} - - ${java.version} - ${java.version} - ${file.encoding} - - - - - org.apache.maven.plugins - maven-resources-plugin - ${maven-resources-plugin.version} - - - copy-resources - package - - copy-resources - - - ${file.encoding} - ${project.build.directory}/resource - - - src/main/resources/ - false - - - - - - - - - org.apache.maven.plugins - maven-surefire-plugin - ${maven-surefire-plugin.version} - - 8 - -Dfile.encoding=${file.encoding} - - - - - org.apache.maven.plugins - maven-jar-plugin - ${maven-jar-plugin.version} - - - - - diff --git a/util/src/main/java/com/zfoo/util/EnumUtils.java b/util/src/main/java/com/zfoo/util/EnumUtils.java deleted file mode 100644 index e12476bf..00000000 --- a/util/src/main/java/com/zfoo/util/EnumUtils.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (C) 2020 The zfoo Authors - * - * Licensed 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 com.zfoo.util; - -import com.zfoo.protocol.util.AssertionUtils; - -import java.util.Arrays; -import java.util.Enumeration; -import java.util.HashSet; -import java.util.Set; - -/** - * @author godotg - * @version 3.0 - */ -public abstract class EnumUtils { - - public static > boolean isInEnums(String targetEnumName, E[] sourceEnums) { - AssertionUtils.notNull(targetEnumName, sourceEnums); - return Arrays.stream(sourceEnums).anyMatch(sourceEnum -> sourceEnum.name().equals(targetEnumName)); - } - - - public static Set enumerationToSet(Enumeration enumeration) { - var set = new HashSet(); - if (enumeration != null) { - while (enumeration.hasMoreElements()) { - set.add(enumeration.nextElement()); - } - } - return set; - } - -}