Browse Source

增加其他版本代码问题

master
VIVIMAN 3 years ago
parent
commit
ee8a1b3b9c
  1. 11
      src/main/java/com/insigma/service/Database.java
  2. 9
      src/main/java/com/insigma/service/Middleware.java
  3. 67
      src/main/java/com/insigma/service/impl/LinuxTongWebKingBase.java
  4. 15
      src/main/java/com/insigma/service/impl/WindowsTomcatMysql.java
  5. 1
      src/main/java/com/insigma/utils/LinuxCommandUtil.java
  6. 12
      src/main/java/com/insigma/utils/RegisterUtil.java
  7. 20
      src/main/java/com/insigma/utils/WinCommandUtil.java

11
src/main/java/com/insigma/service/Database.java

@ -35,10 +35,21 @@ public interface Database {
} }
/*** /***
* 清除 应用 缓存 * 清除 应用 缓存
* @param sql 需要执行脚本集合
* @param tabColObjs 索引对象列表
* @return * @return
*/ */
default boolean cleanDbCache(List<String> sql, List<TabColObj> tabColObjs) { default boolean cleanDbCache(List<String> sql, List<TabColObj> tabColObjs) {
System.out.println("进行缓存清除,但是未检测到实现应用调用此方法!"); System.out.println("进行缓存清除,但是未检测到实现应用调用此方法!");
return false; return false;
} }
/**
* 实现注册服务
* @return
*/
default boolean registrationDbService(){
System.out.println("进行数据库注册服务,但是未检测到实现应用调用此方法!");
return false;
}
} }

9
src/main/java/com/insigma/service/Middleware.java

@ -29,4 +29,13 @@ public interface Middleware {
System.out.printf("设置应用参数:%d,但是未检测到实现应用调用此方法!", size); System.out.printf("设置应用参数:%d,但是未检测到实现应用调用此方法!", size);
return false; return false;
} }
/**
* 实现注册服务
* @return
*/
default boolean registrationMwService(){
System.out.println("进行中间件注册服务,但是未检测到实现应用调用此方法!");
return false;
}
} }

67
src/main/java/com/insigma/service/impl/LinuxTongWebKingBase.java

@ -0,0 +1,67 @@
package com.insigma.service.impl;
import com.insigma.entry.IndexObj;
import com.insigma.entry.TabColObj;
import com.insigma.service.Computer;
import com.insigma.service.Database;
import com.insigma.service.Middleware;
import com.insigma.utils.LinuxCommandUtil;
import lombok.extern.slf4j.Slf4j;
import java.util.List;
/**
* (LinuxTongWebKingBase ) linux 东方通 + 金昌
*
* @author zhangxianwei
* @since 16:43 2022/4/19
*/
@Slf4j
public class LinuxTongWebKingBase extends Computer implements Database, Middleware {
@Override
public boolean runShell(String shell) {
try {
new LinuxCommandUtil(shell).run();
}catch (Exception e){
log.error("执行发生异常:{}", e.getMessage());
return false;
}
return true;
}
@Override
public boolean rebuildIndex(List<IndexObj> index) {
return Database.super.rebuildIndex(index);
}
@Override
public boolean setDbSize(int size) {
return Database.super.setDbSize(size);
}
@Override
public boolean cleanDbCache(List<String> sql, List<TabColObj> tabColObjs) {
return Database.super.cleanDbCache(sql, tabColObjs);
}
@Override
public boolean registrationDbService() {
return Database.super.registrationDbService();
}
@Override
public boolean cleanMwCache() {
return Middleware.super.cleanMwCache();
}
@Override
public boolean setMwSize(int size) {
return Middleware.super.setMwSize(size);
}
@Override
public boolean registrationMwService() {
return Middleware.super.registrationMwService();
}
}

15
src/main/java/com/insigma/service/impl/WindowsTomcatMysql.java

@ -17,7 +17,7 @@ import java.util.List;
/** /**
* (CuWindows ) windows + tomcat + mysql * (CuWindows ) windows 环境下 tomcat + mysql
* *
* @author zhangxianwei * @author zhangxianwei
* @since 23:30 2022/4/17 * @since 23:30 2022/4/17
@ -29,7 +29,8 @@ public class WindowsTomcatMysql extends Computer implements Database, Middleware
public boolean runShell(String shell) { public boolean runShell(String shell) {
try { try {
new WinCommandUtil(shell).run(); new WinCommandUtil(shell).run();
}catch (Exception ignored){ }catch (Exception e){
log.error("执行发生异常:{}", e.getMessage());
return false; return false;
} }
return true; return true;
@ -94,6 +95,11 @@ public class WindowsTomcatMysql extends Computer implements Database, Middleware
return true; return true;
} }
@Override
public boolean registrationDbService() {
return true;
}
@Override @Override
public boolean cleanMwCache() { public boolean cleanMwCache() {
log.info("停止 中间件 服务..."); log.info("停止 中间件 服务...");
@ -128,6 +134,11 @@ public class WindowsTomcatMysql extends Computer implements Database, Middleware
return true; return true;
} }
@Override
public boolean registrationMwService() {
return true;
}
public void openServer(){ public void openServer(){
runShell("SERVICES.MSC"); runShell("SERVICES.MSC");
log.info("打开本地服务完成!"); log.info("打开本地服务完成!");

1
src/main/java/com/insigma/utils/LinuxCommandUtil.java

@ -14,6 +14,7 @@ import java.io.InputStreamReader;
* @author admin * @author admin
*/ */
@Slf4j @Slf4j
@SuppressWarnings("DuplicatedCode")
public class LinuxCommandUtil implements Runnable { public class LinuxCommandUtil implements Runnable {
private String command; private String command;

12
src/main/java/com/insigma/utils/RegisterUtil.java

@ -1,12 +0,0 @@
package com.insigma.utils;
/**
* (RegisterUtil )
*
* @author zhangxianwei
* @since 18:02 2022/4/18
*/
public class RegisterUtil {
}

20
src/main/java/com/insigma/utils/WinCommandUtil.java

@ -4,6 +4,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import java.io.*; import java.io.*;
import java.util.prefs.Preferences;
/** /**
* CommandImpUtil * CommandImpUtil
@ -11,6 +12,7 @@ import java.io.*;
* @author admin * @author admin
*/ */
@Slf4j @Slf4j
@SuppressWarnings("DuplicatedCode")
public class WinCommandUtil implements Runnable { public class WinCommandUtil implements Runnable {
private String command; private String command;
@ -71,4 +73,22 @@ public class WinCommandUtil implements Runnable {
} }
} }
} }
public static class RegisterUtil {
String[] keys = {"version", "initial", "creator"};
String[] values = {"1.3", "ini.mp3", "caokai1818@sina.com"};
//把相应的值储存到变量中去
public void writeValue() {
// HKEY_LOCAL_MACHINE\Software\JavaSoft\prefs下写入注册表值.
Preferences pre = Preferences.systemRoot().node("/javaplayer");
for (int i = 0; i < keys.length; i++) {
pre.put(keys[i], values[i]);
}
}
public static void main(String[] args) {
RegisterUtil reg = new RegisterUtil();
reg.writeValue();
}
}
} }
Loading…
Cancel
Save