Move libs to top level
This commit is contained in:
parent
87ce108bd1
commit
57f46b2210
212 changed files with 16 additions and 29 deletions
9
gdxapp4d-lib-bassboonyd/pom.xml
Normal file
9
gdxapp4d-lib-bassboonyd/pom.xml
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>love.distributedrebirth.gdxapp4d</groupId>
|
||||
<artifactId>gdxapp4d</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>gdxapp4d-lib-bassboonyd</artifactId>
|
||||
</project>
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
package love.distributedrebirth.bassboonyd;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ElementType.TYPE})
|
||||
public @interface BãßBȍőnAnnotationInfoʸᴰ {
|
||||
|
||||
Class<? extends Annotation>[] required();
|
||||
|
||||
Class<? extends Annotation>[] optional() default {};
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
package love.distributedrebirth.bassboonyd;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* Moves copyright into runtime class info.
|
||||
*/
|
||||
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ElementType.TYPE})
|
||||
public @interface BãßBȍőnAuthorInfoʸᴰ {
|
||||
|
||||
String name();
|
||||
|
||||
String copyright();
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
package love.distributedrebirth.bassboonyd;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ElementType.TYPE})
|
||||
public @interface BãßBȍőnClassInfoʸᴰ {
|
||||
|
||||
String name();
|
||||
|
||||
String purpose();
|
||||
}
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
package love.distributedrebirth.bassboonyd;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
|
||||
public interface BãßBȍőnCoffinOpenʸᴰ<T extends BãßBȍőnCoffinStoreKeyʸᴰ> extends BãßBȍőnCoffinʸᴰ<T>, DefaultInitMethodʸᴰ {
|
||||
|
||||
void LOCK_COFFIN();
|
||||
|
||||
Object PUT_OBJ(T key, Object value);
|
||||
|
||||
default void PUT_MAP(T key) {
|
||||
PUT_OBJ(key, new HashMap<>());
|
||||
}
|
||||
|
||||
default void PUT_LIST(T key) {
|
||||
PUT_OBJ(key, new ArrayList<>());
|
||||
}
|
||||
|
||||
static <T extends DefaultEnumBaseʸᴰ<?> & BãßBȍőnCoffinStoreʸᴰ<?>> void lockCoffin(T store, Consumer<String> logHandler) {
|
||||
logHandler.accept("Lock: "+store.BãßClassNaam()+" since: "+store.BãßAuthorCopyright());
|
||||
for (Object o:store.BãßInstances()) {
|
||||
BãßBȍőnCoffinStoreʸᴰ<?> coffin = BãßBȍőnCoffinStoreʸᴰ.class.cast(o);
|
||||
BãßBȍőnCoffinOpenʸᴰ<?> coffinOpen = BãßBȍőnCoffinOpenʸᴰ.class.cast(coffin.GET_BBC());
|
||||
coffinOpen.LOCK_COFFIN();
|
||||
}
|
||||
}
|
||||
|
||||
static <Y extends BãßBȍőnCoffinStoreKeyʸᴰ> BãßBȍőnCoffinOpenʸᴰ<Y> newInstance() {
|
||||
return new BãßBȍőnCoffinOpenʸᴰ<Y>() {
|
||||
final Map<Y,Object> initMap = new HashMap<>();
|
||||
volatile boolean deathLock = false;
|
||||
|
||||
@Override
|
||||
public void LOCK_COFFIN() {
|
||||
deathLock = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object GET_OBJ(Y key) {
|
||||
return initMap.get(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object PUT_OBJ(Y key, Object value) {
|
||||
if (deathLock) {
|
||||
throw new IllegalStateException("Can't cheat death in closed coffin.");
|
||||
}
|
||||
return initMap.put(key, value);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
package love.distributedrebirth.bassboonyd;
|
||||
|
||||
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
|
||||
public interface BãßBȍőnCoffinStoreKeyʸᴰ {
|
||||
|
||||
String name();
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
package love.distributedrebirth.bassboonyd;
|
||||
|
||||
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
|
||||
public interface BãßBȍőnCoffinStoreʸᴰ<T extends BãßBȍőnCoffinStoreKeyʸᴰ> {
|
||||
|
||||
BãßBȍőnCoffinʸᴰ<T> GET_BBC();
|
||||
}
|
||||
|
|
@ -0,0 +1,77 @@
|
|||
package love.distributedrebirth.bassboonyd;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
|
||||
public interface BãßBȍőnCoffinʸᴰ<T extends BãßBȍőnCoffinStoreKeyʸᴰ> {
|
||||
|
||||
Object GET_OBJ(T key);
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
default <Y> Y GET_OBJ(T key, Class<Y> type) {
|
||||
return (Y) GET_OBJ(key);
|
||||
}
|
||||
|
||||
default String GET_STR(T key) {
|
||||
return String.class.cast(GET_OBJ(key));
|
||||
}
|
||||
|
||||
default Short GET_SHORT(T key) {
|
||||
return Short.class.cast(GET_OBJ(key));
|
||||
}
|
||||
|
||||
default Character GET_CHAR(T key) {
|
||||
return Character.class.cast(GET_OBJ(key));
|
||||
}
|
||||
|
||||
default Integer GET_INT(T key) {
|
||||
return Integer.class.cast(GET_OBJ(key));
|
||||
}
|
||||
|
||||
default Long GET_LONG(T key) {
|
||||
return Long.class.cast(GET_OBJ(key));
|
||||
}
|
||||
|
||||
default Boolean GET_BOOL(T key) {
|
||||
return Boolean.class.cast(GET_OBJ(key));
|
||||
}
|
||||
|
||||
default Float GET_FLOAT(T key) {
|
||||
return Float.class.cast(GET_OBJ(key));
|
||||
}
|
||||
|
||||
default Double GET_DOUBLE(T key) {
|
||||
return Double.class.cast(GET_OBJ(key));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
default Map<String,Object> GET_MAP_OBJ(T key) {
|
||||
return Map.class.cast(GET_OBJ(key));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
default Map<String,String> GET_MAP_STR(T key) {
|
||||
return Map.class.cast(GET_OBJ(key));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
default Map<String,Integer> GET_MAP_INT(T key) {
|
||||
return Map.class.cast(GET_OBJ(key));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
default List<Object> GET_LIST_OBJ(T key) {
|
||||
return List.class.cast(GET_OBJ(key));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
default List<String> GET_LIST_STR(T key) {
|
||||
return List.class.cast(GET_OBJ(key));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
default List<Integer> GET_LIST_INT(T key) {
|
||||
return List.class.cast(GET_OBJ(key));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
package love.distributedrebirth.bassboonyd;
|
||||
|
||||
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
|
||||
public class BãßBȍőnConstantsʸᴰ {
|
||||
|
||||
public static final String STR_VALUES = "values";
|
||||
|
||||
public static final String STR_NAME = "name";
|
||||
|
||||
public static final String STR_TYPE = "type";
|
||||
|
||||
public static final String STR_DOT = ".";
|
||||
|
||||
public static final String STR_EMPTY = "";
|
||||
|
||||
public static final String STR_SPACE = " ";
|
||||
|
||||
public static final String STR_COMMA = ",";
|
||||
|
||||
public static final String STR_COLON = ":";
|
||||
|
||||
public static final String STR_IS = "=";
|
||||
|
||||
public static final int INT_ZERO = 0;
|
||||
|
||||
public static final int INT_ONE = 1;
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
package love.distributedrebirth.bassboonyd;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ElementType.METHOD})
|
||||
public @interface BãßBȍőnInitMethodʸᴰ {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
package love.distributedrebirth.bassboonyd;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ElementType.TYPE})
|
||||
public @interface BãßBȍőnPackageInfoʸᴰ {
|
||||
|
||||
String name();
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
package love.distributedrebirth.bassboonyd;
|
||||
|
||||
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
|
||||
@BãßBȍőnAnnotationInfoʸᴰ(required = {BãßBȍőnAuthorInfoʸᴰ.class})
|
||||
public interface DefaultAuthorInfoʸᴰ {
|
||||
|
||||
default String BãßAuthorNaam() {
|
||||
return getClass().getAnnotation(BãßBȍőnAuthorInfoʸᴰ.class).name();
|
||||
}
|
||||
|
||||
default String BãßAuthorCopyright() {
|
||||
return getClass().getAnnotation(BãßBȍőnAuthorInfoʸᴰ.class).copyright();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
package love.distributedrebirth.bassboonyd;
|
||||
|
||||
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
|
||||
@BãßBȍőnAnnotationInfoʸᴰ(required = {BãßBȍőnClassInfoʸᴰ.class})
|
||||
public interface DefaultClassInfoʸᴰ {
|
||||
|
||||
default String BãßClassNaam() {
|
||||
return getClass().getAnnotation(BãßBȍőnClassInfoʸᴰ.class).name();
|
||||
}
|
||||
|
||||
default String BãßClassPurpose() {
|
||||
return getClass().getAnnotation(BãßBȍőnClassInfoʸᴰ.class).purpose();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
package love.distributedrebirth.bassboonyd;
|
||||
|
||||
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
|
||||
public interface DefaultEnumBaseʸᴰ<T> extends DefaultAuthorInfoʸᴰ,DefaultClassInfoʸᴰ,DefaultPackageInfoʸᴰ {
|
||||
|
||||
int ordinal();
|
||||
|
||||
String name();
|
||||
|
||||
// Bȍőn prefix is for set instance enum object (called DefaultEnumSetʸᴰ)
|
||||
// Bãß prefix is for single instance enum objects (called DefaultEnumInstanceʸᴰ)
|
||||
|
||||
default String BȍőnNaam() {
|
||||
return name();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
default T[] BãßInstances() {
|
||||
try {
|
||||
Object result = getClass().getMethod(BãßBȍőnConstantsʸᴰ.STR_VALUES).invoke(null);
|
||||
return (T[]) result;
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
default String BȍőnNaamI18N() {
|
||||
return BãßClassNaam() + BãßBȍőnConstantsʸᴰ.STR_DOT + name();
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
package love.distributedrebirth.bassboonyd;
|
||||
|
||||
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
|
||||
public interface DefaultEnumInstanceʸᴰ<T> extends DefaultEnumBaseʸᴰ<T> {
|
||||
|
||||
default T BãßInstance() {
|
||||
return BãßInstances()[BãßBȍőnConstantsʸᴰ.INT_ZERO];
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,64 @@
|
|||
package love.distributedrebirth.bassboonyd;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
|
||||
public interface DefaultEnumSetʸᴰ<T> extends DefaultEnumBaseʸᴰ<T> {
|
||||
|
||||
default int BȍőnRangTelNul() {
|
||||
return ordinal();
|
||||
}
|
||||
|
||||
default int BȍőnRangTelEen() {
|
||||
return ordinal() + 1;
|
||||
}
|
||||
|
||||
default List<T> BãßInstancesList() {
|
||||
return Arrays.asList(BãßInstances());
|
||||
}
|
||||
|
||||
default <K> Map<K,T> BãßInstancesToMap(Function<T,K> keyMapper) {
|
||||
return BãßInstancesList().stream().collect(Collectors.toMap(keyMapper, v -> v));
|
||||
}
|
||||
|
||||
default T BȍőnVolgende() {
|
||||
T[] values = BãßInstances();
|
||||
int resultIndex = 0;
|
||||
for (int i=0;i<values.length;i++) {
|
||||
if (this == values[i]) {
|
||||
resultIndex = i + 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (resultIndex == values.length) {
|
||||
resultIndex = 0;
|
||||
}
|
||||
return values[resultIndex];
|
||||
}
|
||||
|
||||
default T BȍőnVorige() {
|
||||
T[] values = BãßInstances();
|
||||
int resultIndex = 0;
|
||||
for (int i=0;i<values.length;i++) {
|
||||
if (this == values[i]) {
|
||||
resultIndex = i - 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (resultIndex < 0) {
|
||||
resultIndex = values.length - 1;
|
||||
}
|
||||
return values[resultIndex];
|
||||
}
|
||||
|
||||
default void BãßVoorElk(Consumer<T> consumer) {
|
||||
for (T value:BãßInstances()) {
|
||||
consumer.accept(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
package love.distributedrebirth.bassboonyd;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
|
||||
@BãßBȍőnAnnotationInfoʸᴰ(required = {})
|
||||
public interface DefaultInitMethodʸᴰ {
|
||||
|
||||
default void BOON_INIT(Object boon) {
|
||||
try {
|
||||
for (Method m:boon.getClass().getMethods()) {
|
||||
if (m.isAnnotationPresent(BãßBȍőnInitMethodʸᴰ.class)) {
|
||||
m.invoke(boon, this);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
package love.distributedrebirth.bassboonyd;
|
||||
|
||||
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
|
||||
@BãßBȍőnAnnotationInfoʸᴰ(required = {BãßBȍőnPackageInfoʸᴰ.class})
|
||||
public interface DefaultPackageInfoʸᴰ {
|
||||
|
||||
default String BãßPackageNaam() {
|
||||
return getClass().getAnnotation(BãßBȍőnPackageInfoʸᴰ.class).name();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
package love.distributedrebirth.bassboonyd.jmx;
|
||||
|
||||
import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ;
|
||||
|
||||
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
|
||||
abstract public class AbstractMBeanAttributeᴶᴹˣ implements MBeanAttributeᴶᴹˣ {
|
||||
private final String name;
|
||||
private final String description;
|
||||
|
||||
public AbstractMBeanAttributeᴶᴹˣ(String name, String description) {
|
||||
this.name = name;
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
package love.distributedrebirth.bassboonyd.jmx;
|
||||
|
||||
import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ;
|
||||
|
||||
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
|
||||
@MBeanAttributeTypeᴶᴹˣ(Boolean.class)
|
||||
public class BooleanAttributeᴶᴹˣ extends AbstractMBeanAttributeᴶᴹˣ {
|
||||
private Boolean value;
|
||||
|
||||
public BooleanAttributeᴶᴹˣ(String name, String description) {
|
||||
super(name, description);
|
||||
}
|
||||
|
||||
public void setValueBoolean(Boolean value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public Boolean getValueBoolean() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public Object getValue() {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
package love.distributedrebirth.bassboonyd.jmx;
|
||||
|
||||
import love.distributedrebirth.bassboonyd.BãßBȍőnAnnotationInfoʸᴰ;
|
||||
import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ;
|
||||
import love.distributedrebirth.bassboonyd.BãßBȍőnClassInfoʸᴰ;
|
||||
import love.distributedrebirth.bassboonyd.BãßBȍőnCoffinStoreKeyʸᴰ;
|
||||
import love.distributedrebirth.bassboonyd.BãßBȍőnCoffinStoreʸᴰ;
|
||||
import love.distributedrebirth.bassboonyd.BãßBȍőnConstantsʸᴰ;
|
||||
import love.distributedrebirth.bassboonyd.DefaultEnumBaseʸᴰ;
|
||||
|
||||
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
|
||||
@BãßBȍőnAnnotationInfoʸᴰ(required = {BãßBȍőnClassInfoʸᴰ.class, BãßBȍőnAuthorInfoʸᴰ.class})
|
||||
public interface DefaultEnumBaseᴶᴹˣ<T,K extends BãßBȍőnCoffinStoreKeyʸᴰ> extends DefaultEnumBaseʸᴰ<T>,BãßBȍőnCoffinStoreʸᴰ<K> {
|
||||
|
||||
void BȍőnJmxInit(K key);
|
||||
|
||||
default GuageCounterᴶᴹˣ BȍőnJmxInitGuageCounter(K key, String name) {
|
||||
return BȍőnJmxInitGuageCounter(key, name, BãßBȍőnConstantsʸᴰ.STR_EMPTY);
|
||||
}
|
||||
|
||||
default GuageCounterᴶᴹˣ BȍőnJmxInitGuageCounter(K key, String name, String description) {
|
||||
GuageCounterᴶᴹˣ result = new GuageCounterᴶᴹˣ(name, description);
|
||||
GET_BBC().GET_MAP_OBJ(key).put(name, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
default StringAttributeᴶᴹˣ BȍőnJmxInitStringAttribute(K key, String name) {
|
||||
return BȍőnJmxInitStringAttribute(key, name, BãßBȍőnConstantsʸᴰ.STR_EMPTY);
|
||||
}
|
||||
|
||||
default StringAttributeᴶᴹˣ BȍőnJmxInitStringAttribute(K key, String name, String description) {
|
||||
StringAttributeᴶᴹˣ result = new StringAttributeᴶᴹˣ(name, description);
|
||||
GET_BBC().GET_MAP_OBJ(key).put(name, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
default BooleanAttributeᴶᴹˣ BȍőnJmxInitBooleanAttribute(K key, String name) {
|
||||
return BȍőnJmxInitBooleanAttribute(key, name, BãßBȍőnConstantsʸᴰ.STR_EMPTY);
|
||||
}
|
||||
|
||||
default BooleanAttributeᴶᴹˣ BȍőnJmxInitBooleanAttribute(K key, String name, String description) {
|
||||
BooleanAttributeᴶᴹˣ result = new BooleanAttributeᴶᴹˣ(name, description);
|
||||
GET_BBC().GET_MAP_OBJ(key).put(name, result);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
package love.distributedrebirth.bassboonyd.jmx;
|
||||
|
||||
import java.lang.management.ManagementFactory;
|
||||
|
||||
import javax.management.MBeanServer;
|
||||
import javax.management.ObjectName;
|
||||
|
||||
import love.distributedrebirth.bassboonyd.BãßBȍőnAnnotationInfoʸᴰ;
|
||||
import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ;
|
||||
import love.distributedrebirth.bassboonyd.BãßBȍőnClassInfoʸᴰ;
|
||||
import love.distributedrebirth.bassboonyd.BãßBȍőnCoffinOpenʸᴰ;
|
||||
import love.distributedrebirth.bassboonyd.BãßBȍőnCoffinStoreKeyʸᴰ;
|
||||
import love.distributedrebirth.bassboonyd.BãßBȍőnConstantsʸᴰ;
|
||||
import love.distributedrebirth.bassboonyd.DefaultEnumInstanceʸᴰ;
|
||||
|
||||
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
|
||||
@BãßBȍőnAnnotationInfoʸᴰ(required = {BãßBȍőnClassInfoʸᴰ.class, BãßBȍőnAuthorInfoʸᴰ.class})
|
||||
public interface DefaultEnumInstanceᴶᴹˣ<T,K extends BãßBȍőnCoffinStoreKeyʸᴰ> extends DefaultEnumBaseᴶᴹˣ<T,K>,DefaultEnumInstanceʸᴰ<T> {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
default void BȍőnJmxInit(K key) {
|
||||
BãßBȍőnCoffinOpenʸᴰ<K> coffin = BãßBȍőnCoffinOpenʸᴰ.class.cast(GET_BBC());
|
||||
coffin.PUT_MAP(key);
|
||||
try {
|
||||
StringBuilder name = new StringBuilder();
|
||||
name.append(BãßPackageNaam());
|
||||
name.append(BãßBȍőnConstantsʸᴰ.STR_COLON);
|
||||
name.append(BãßBȍőnConstantsʸᴰ.STR_TYPE);
|
||||
name.append(BãßBȍőnConstantsʸᴰ.STR_IS);
|
||||
name.append(BãßClassNaam());
|
||||
|
||||
MBeanServer server = ManagementFactory.getPlatformMBeanServer();
|
||||
ObjectName objectName1 = new ObjectName(name.toString());
|
||||
server.registerMBean(new MBeanDynamicᴶᴹˣ(BãßClassPurpose(), GET_BBC().GET_MAP_OBJ(key)), objectName1);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
package love.distributedrebirth.bassboonyd.jmx;
|
||||
|
||||
import java.lang.management.ManagementFactory;
|
||||
|
||||
import javax.management.MBeanServer;
|
||||
import javax.management.ObjectName;
|
||||
|
||||
import love.distributedrebirth.bassboonyd.BãßBȍőnAnnotationInfoʸᴰ;
|
||||
import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ;
|
||||
import love.distributedrebirth.bassboonyd.BãßBȍőnClassInfoʸᴰ;
|
||||
import love.distributedrebirth.bassboonyd.BãßBȍőnCoffinOpenʸᴰ;
|
||||
import love.distributedrebirth.bassboonyd.BãßBȍőnCoffinStoreKeyʸᴰ;
|
||||
import love.distributedrebirth.bassboonyd.BãßBȍőnConstantsʸᴰ;
|
||||
import love.distributedrebirth.bassboonyd.DefaultEnumSetʸᴰ;
|
||||
|
||||
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
|
||||
@BãßBȍőnAnnotationInfoʸᴰ(required = {BãßBȍőnClassInfoʸᴰ.class, BãßBȍőnAuthorInfoʸᴰ.class})
|
||||
public interface DefaultEnumSetᴶᴹˣ<T,K extends BãßBȍőnCoffinStoreKeyʸᴰ> extends DefaultEnumBaseᴶᴹˣ<T,K>,DefaultEnumSetʸᴰ<T> {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
default void BȍőnJmxInit(K key) {
|
||||
BãßBȍőnCoffinOpenʸᴰ<K> coffin = BãßBȍőnCoffinOpenʸᴰ.class.cast(GET_BBC());
|
||||
coffin.PUT_MAP(key);
|
||||
try {
|
||||
StringBuilder name = new StringBuilder();
|
||||
name.append(BãßPackageNaam());
|
||||
name.append(BãßBȍőnConstantsʸᴰ.STR_COLON);
|
||||
name.append(BãßBȍőnConstantsʸᴰ.STR_TYPE);
|
||||
name.append(BãßBȍőnConstantsʸᴰ.STR_IS);
|
||||
name.append(BãßClassNaam());
|
||||
name.append(BãßBȍőnConstantsʸᴰ.STR_COMMA);
|
||||
name.append(BãßBȍőnConstantsʸᴰ.STR_NAME);
|
||||
name.append(BãßBȍőnConstantsʸᴰ.STR_IS);
|
||||
name.append(BȍőnNaam());
|
||||
|
||||
MBeanServer server = ManagementFactory.getPlatformMBeanServer();
|
||||
ObjectName objectName1 = new ObjectName(name.toString());
|
||||
server.registerMBean(new MBeanDynamicᴶᴹˣ(BãßClassPurpose(), GET_BBC().GET_MAP_OBJ(key)), objectName1);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
package love.distributedrebirth.bassboonyd.jmx;
|
||||
|
||||
import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ;
|
||||
|
||||
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
|
||||
@MBeanAttributeTypeᴶᴹˣ(Long.class)
|
||||
public class GuageCounterᴶᴹˣ extends AbstractMBeanAttributeᴶᴹˣ {
|
||||
private volatile long counter;
|
||||
|
||||
public GuageCounterᴶᴹˣ(String name, String description) {
|
||||
super(name, description);
|
||||
}
|
||||
|
||||
public void increment() {
|
||||
counter++;
|
||||
}
|
||||
|
||||
public void increment(long value) {
|
||||
counter = counter + value;
|
||||
}
|
||||
|
||||
public Object getValue() {
|
||||
return Long.valueOf(counter);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
package love.distributedrebirth.bassboonyd.jmx;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ;
|
||||
|
||||
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ElementType.TYPE})
|
||||
public @interface MBeanAttributeTypeᴶᴹˣ {
|
||||
|
||||
Class<?> value();
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
package love.distributedrebirth.bassboonyd.jmx;
|
||||
|
||||
import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ;
|
||||
|
||||
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
|
||||
public interface MBeanAttributeᴶᴹˣ {
|
||||
|
||||
default Class<?> BãßValueType() {
|
||||
return getClass().getAnnotation(MBeanAttributeTypeᴶᴹˣ.class).value();
|
||||
}
|
||||
|
||||
Object getValue();
|
||||
|
||||
String getName();
|
||||
|
||||
String getDescription();
|
||||
}
|
||||
|
|
@ -0,0 +1,70 @@
|
|||
package love.distributedrebirth.bassboonyd.jmx;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.management.Attribute;
|
||||
import javax.management.AttributeList;
|
||||
import javax.management.AttributeNotFoundException;
|
||||
import javax.management.DynamicMBean;
|
||||
import javax.management.InvalidAttributeValueException;
|
||||
import javax.management.MBeanAttributeInfo;
|
||||
import javax.management.MBeanException;
|
||||
import javax.management.MBeanInfo;
|
||||
import javax.management.MBeanNotificationInfo;
|
||||
import javax.management.ReflectionException;
|
||||
|
||||
import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ;
|
||||
|
||||
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
|
||||
public class MBeanDynamicᴶᴹˣ implements DynamicMBean {
|
||||
|
||||
private final String description;
|
||||
private final Map<String, Object> guages;
|
||||
|
||||
public MBeanDynamicᴶᴹˣ(String description, Map<String, Object> guages) {
|
||||
this.description = description;
|
||||
this.guages = guages;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MBeanInfo getMBeanInfo() {
|
||||
MBeanAttributeInfo[] dAttributes = new MBeanAttributeInfo[guages.keySet().size()];
|
||||
List<String> keySet = guages.keySet().stream().collect(Collectors.toList());
|
||||
for (int i = 0; i < dAttributes.length; i++) {
|
||||
String name = keySet.get(i);
|
||||
MBeanAttributeᴶᴹˣ gc = MBeanAttributeᴶᴹˣ.class.cast(guages.get(name));
|
||||
dAttributes[i] = new MBeanAttributeInfo(gc.getName(), gc.BãßValueType().getSimpleName(),
|
||||
gc.getDescription(), true, false, false);
|
||||
}
|
||||
return new MBeanInfo(this.getClass().getName(), description, dAttributes, null, null,
|
||||
new MBeanNotificationInfo[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getAttribute(String name) throws AttributeNotFoundException, MBeanException, ReflectionException {
|
||||
MBeanAttributeᴶᴹˣ gc = MBeanAttributeᴶᴹˣ.class.cast(guages.get(name));
|
||||
return gc.getValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AttributeList getAttributes(String[] arg0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object invoke(String arg0, Object[] arg1, String[] arg2) throws MBeanException, ReflectionException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAttribute(Attribute arg0)
|
||||
throws AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public AttributeList setAttributes(AttributeList arg0) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
package love.distributedrebirth.bassboonyd.jmx;
|
||||
|
||||
import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ;
|
||||
import love.distributedrebirth.bassboonyd.BãßBȍőnCoffinStoreKeyʸᴰ;
|
||||
|
||||
/**
|
||||
* Only use when no other coffin keys are needed on instance or enum.
|
||||
*/
|
||||
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
|
||||
public enum MBeanStoreKeyᴶᴹˣ implements BãßBȍőnCoffinStoreKeyʸᴰ {
|
||||
JMX,
|
||||
;
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
package love.distributedrebirth.bassboonyd.jmx;
|
||||
|
||||
import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ;
|
||||
|
||||
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
|
||||
@MBeanAttributeTypeᴶᴹˣ(String.class)
|
||||
public class StringAttributeᴶᴹˣ extends AbstractMBeanAttributeᴶᴹˣ {
|
||||
private String value;
|
||||
|
||||
public StringAttributeᴶᴹˣ(String name, String description) {
|
||||
super(name, description);
|
||||
}
|
||||
|
||||
public void setValueString(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getValueString() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public Object getValue() {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue