mirror of
https://gitee.com/BDWare/front-base
synced 2025-01-25 01:04:01 +00:00
Configure plug-in
This commit is contained in:
parent
3c6b30e044
commit
80e9ee5624
@ -3,12 +3,15 @@ package org.bdware.server.action;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.io.Console;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.RandomAccessFile;
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
@ -23,6 +26,7 @@ public class ActionExecutor<T, U> {
|
||||
public long permission;
|
||||
Map<String, AtomicInteger> staticData;
|
||||
private Map<String, Pair<Method, Object>> handlers;
|
||||
private Object Constructor;
|
||||
|
||||
public ActionExecutor(ExecutorService executor, Object... classes) {
|
||||
this.executor = executor;
|
||||
@ -57,8 +61,24 @@ public class ActionExecutor<T, U> {
|
||||
handlers = new HashMap<>();
|
||||
if (objects.length > 0) {
|
||||
for (Object obj : objects) {
|
||||
if (obj == null) continue;
|
||||
appendHandler(obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean checkPermission(Action a, final U args, long permission) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public Map<String, Pair<Method, Object>> getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public void appendHandler(Object obj) {
|
||||
try {
|
||||
if (obj == null) return;
|
||||
Method[] methods = obj.getClass().getDeclaredMethods();
|
||||
System.out.println("zzz2"+obj.getClass());
|
||||
for (Method method : methods) {
|
||||
if (method.getAnnotation(Action.class) != null) {
|
||||
if (method.getAnnotation(Action.class).alias().length == 0) {
|
||||
@ -90,18 +110,10 @@ public class ActionExecutor<T, U> {
|
||||
}
|
||||
}
|
||||
}
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean checkPermission(Action a, final U args, long permission) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public Map<String, Pair<Method, Object>> getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public void handle(String action, final U args, final T callback)
|
||||
throws IllegalAccessException, IllegalArgumentException, InvocationTargetException {
|
||||
// logger.info("[ActionExecutor] handle : "+action);
|
||||
|
Loading…
Reference in New Issue
Block a user