del[util]: remove util module

This commit is contained in:
godotg
2023-09-02 21:11:50 +08:00
parent 353d40d5fe
commit e4bcd22bc7
17 changed files with 13 additions and 253 deletions
+1 -1
View File
@@ -58,7 +58,7 @@
<dependencies>
<dependency>
<groupId>com.zfoo</groupId>
<artifactId>util</artifactId>
<artifactId>protocol</artifactId>
<version>${zfoo.version}</version>
</dependency>
-6
View File
@@ -56,12 +56,6 @@
</properties>
<dependencies>
<dependency>
<groupId>com.zfoo</groupId>
<artifactId>util</artifactId>
<version>${zfoo.version}</version>
</dependency>
<dependency>
<groupId>com.zfoo</groupId>
<artifactId>scheduler</artifactId>
@@ -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;
}
}
-5
View File
@@ -56,11 +56,6 @@
</properties>
<dependencies>
<dependency>
<groupId>com.zfoo</groupId>
<artifactId>util</artifactId>
<version>${zfoo.version}</version>
</dependency>
<dependency>
<groupId>com.zfoo</groupId>
<artifactId>event</artifactId>
@@ -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<NetworkInterface> getAllNetworkInterface() {
try {
Enumeration<NetworkInterface> networkInterfaces = NetworkInterface.getNetworkInterfaces();
return EnumUtils.enumerationToSet(networkInterfaces);
var set = new HashSet<NetworkInterface>();
while (networkInterfaces.hasMoreElements()) {
set.add(networkInterfaces.nextElement());
}
return set;
} catch (SocketException e) {
return Collections.emptySet();
}
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
-7
View File
@@ -56,13 +56,6 @@
</properties>
<dependencies>
<!-- 依赖的util类库 -->
<dependency>
<groupId>com.zfoo</groupId>
<artifactId>util</artifactId>
<version>${zfoo.version}</version>
</dependency>
<dependency>
<groupId>com.zfoo</groupId>
<artifactId>event</artifactId>
-1
View File
@@ -31,7 +31,6 @@
<module>storage</module>
<module>orm</module>
<module>protocol</module>
<module>util</module>
</modules>
<properties>
+1 -1
View File
@@ -58,7 +58,7 @@
<dependencies>
<dependency>
<groupId>com.zfoo</groupId>
<artifactId>util</artifactId>
<artifactId>protocol</artifactId>
<version>${zfoo.version}</version>
</dependency>
-6
View File
@@ -62,12 +62,6 @@
<version>${zfoo.version}</version>
</dependency>
<dependency>
<groupId>com.zfoo</groupId>
<artifactId>util</artifactId>
<version>${zfoo.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
-157
View File
@@ -1,157 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<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>com.zfoo</groupId>
<artifactId>util</artifactId>
<version>3.0</version>
<packaging>jar</packaging>
<properties>
<zfoo.version>3.0</zfoo.version>
<!-- spring and spring boot -->
<spring.version>6.0.11</spring.version>
<spring.boot.version>3.1.3</spring.boot.version>
<junit.version>4.12</junit.version>
<!-- bytecode enhancement(字节码增强) -->
<javassist.version>3.29.2-GA</javassist.version>
<bytebuddy.version>1.14.6</bytebuddy.version>
<!-- network framework -->
<netty.version>4.1.97.Final</netty.version>
<!-- zookeeper -->
<curator.version>5.5.0</curator.version>
<!-- hardware detection(硬件检测) -->
<oshi.version>6.4.5</oshi.version>
<!-- database and cache -->
<mongodb-driver-sync.version>4.10.2</mongodb-driver-sync.version>
<caffeine.version>3.1.8</caffeine.version>
<!-- Office document parsing(office文档解析包) -->
<poi.version>5.2.3</poi.version>
<csv.version>1.10.0</csv.version>
<java.version>17</java.version>
<file.encoding>UTF-8</file.encoding>
<!-- maven core plugin(maven核心插件) -->
<maven-clean-plugin.version>3.3.1</maven-clean-plugin.version>
<maven-resources-plugin.version>3.3.1</maven-resources-plugin.version>
<maven-compiler-plugin.version>3.11.0</maven-compiler-plugin.version>
<maven-surefire-plugin.version>3.1.2</maven-surefire-plugin.version>
<maven-jar-plugin.version>3.3.0</maven-jar-plugin.version>
<maven-shade-plugin.version>3.5.0</maven-shade-plugin.version>
<versions-maven-plugin.version>2.16.0</versions-maven-plugin.version>
<project.build.sourceEncoding>${file.encoding}</project.build.sourceEncoding>
<maven.compiler.encoding>${file.encoding}</maven.compiler.encoding>
</properties>
<dependencies>
<dependency>
<groupId>com.zfoo</groupId>
<artifactId>protocol</artifactId>
<version>${zfoo.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-expression</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
<version>${spring.boot.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<sourceDirectory>src/main/java</sourceDirectory>
<testSourceDirectory>src/test/java</testSourceDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>${maven-clean-plugin.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin.version}</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<encoding>${file.encoding}</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>${maven-resources-plugin.version}</version>
<executions>
<execution>
<id>copy-resources</id>
<phase>package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<encoding>${file.encoding}</encoding>
<outputDirectory>${project.build.directory}/resource</outputDirectory>
<resources>
<resource>
<directory>src/main/resources/</directory>
<filtering>false</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version>
<configuration>
<threadCount>8</threadCount>
<argLine>-Dfile.encoding=${file.encoding}</argLine>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>${maven-jar-plugin.version}</version>
</plugin>
</plugins>
</build>
</project>
@@ -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 <E extends Enum<E>> boolean isInEnums(String targetEnumName, E[] sourceEnums) {
AssertionUtils.notNull(targetEnumName, sourceEnums);
return Arrays.stream(sourceEnums).anyMatch(sourceEnum -> sourceEnum.name().equals(targetEnumName));
}
public static <E> Set<E> enumerationToSet(Enumeration<E> enumeration) {
var set = new HashSet<E>();
if (enumeration != null) {
while (enumeration.hasMoreElements()) {
set.add(enumeration.nextElement());
}
}
return set;
}
}