From 369f3e707a643a2efabeeab396beb7ad17bd609e Mon Sep 17 00:00:00 2001 From: Kevin Harrington Date: Tue, 16 Jul 2024 17:30:28 -0400 Subject: [PATCH 1/7] updating the groovy version for java 17 compat --- build.gradle | 7 +++++-- .../bowlerstudio/scripting/GroovyHelper.java | 5 +---- .../bowlerstudio/scripting/ScriptingEngine.java | 4 +++- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/build.gradle b/build.gradle index 3838a045..4f028540 100755 --- a/build.gradle +++ b/build.gradle @@ -176,9 +176,12 @@ api group: 'org.fxmisc.richtext', name: 'richtextfx', version: '0.6' api group: 'org.reactfx', name: 'reactfx', version: '2.0-SNAPSHOT' -api group: 'org.codehaus.groovy', name: 'groovy', version:'2.3.7'; +// https://mvnrepository.com/artifact/org.apache.groovy/groovy +api group: 'org.apache.groovy', name: 'groovy', version: '4.0.22' + +//api group: 'org.codehaus.groovy', name: 'groovy', version:'2.3.7'; //make grapes work -api group: 'org.apache.ivy', name:'ivy', version:'2.2.0' +//api group: 'org.apache.ivy', name:'ivy', version:'2.2.0' //compile group: 'org.controlsfx', name: 'controlsfx', version: '8.0.6' api group: 'commons-lang', name: 'commons-lang', version: '2.6' diff --git a/src/main/java/com/neuronrobotics/bowlerstudio/scripting/GroovyHelper.java b/src/main/java/com/neuronrobotics/bowlerstudio/scripting/GroovyHelper.java index 3dc2acd1..18fa67f6 100644 --- a/src/main/java/com/neuronrobotics/bowlerstudio/scripting/GroovyHelper.java +++ b/src/main/java/com/neuronrobotics/bowlerstudio/scripting/GroovyHelper.java @@ -23,10 +23,7 @@ private Object inline(Object code, ArrayList args) throws Exception { CompilerConfiguration cc = new CompilerConfiguration(); cc.addCompilationCustomizers(new ImportCustomizer() .addStarImports(ScriptingEngine.getImports()) - .addStaticStars( - "com.neuronrobotics.sdk.util.ThreadUtil", - "eu.mihosoft.vrl.v3d.Transform", - "com.neuronrobotics.bowlerstudio.vitamins.Vitamins") + ); Binding binding = new Binding(); diff --git a/src/main/java/com/neuronrobotics/bowlerstudio/scripting/ScriptingEngine.java b/src/main/java/com/neuronrobotics/bowlerstudio/scripting/ScriptingEngine.java index 782e6712..8465cfec 100644 --- a/src/main/java/com/neuronrobotics/bowlerstudio/scripting/ScriptingEngine.java +++ b/src/main/java/com/neuronrobotics/bowlerstudio/scripting/ScriptingEngine.java @@ -110,7 +110,9 @@ public class ScriptingEngine {// this subclasses boarder pane for the widgets "com.neuronrobotics.bowlerstudio.scripting", "com.neuronrobotics.bowlerstudio.tabs", "com.neuronrobotics.bowlerstudio.physics", "com.neuronrobotics.bowlerstudio.physics", "com.neuronrobotics.bowlerstudio.vitamins", "com.neuronrobotics.bowlerstudio.creature", - "com.neuronrobotics.bowlerstudio.threed" }; + "com.neuronrobotics.bowlerstudio.threed","com.neuronrobotics.sdk.util.ThreadUtil", + "eu.mihosoft.vrl.v3d.Transform", + "com.neuronrobotics.bowlerstudio.vitamins.Vitamins" }; private static HashMap filesRun = new HashMap<>(); From 4ab044913c92bef893ce9b7b3e54d36ebb550fac Mon Sep 17 00:00:00 2001 From: Kevin Harrington Date: Tue, 16 Jul 2024 18:11:26 -0400 Subject: [PATCH 2/7] javabowler --- java-bowler | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java-bowler b/java-bowler index 1379b93c..12d9d0e5 160000 --- a/java-bowler +++ b/java-bowler @@ -1 +1 @@ -Subproject commit 1379b93c00f79095c01d8d26f943f2ed0a9f1cc0 +Subproject commit 12d9d0e5883a6da53da867691e1676d6f08e6a94 From 3e32a551eef4ed4b3b6ebf6d826f85543826d434 Mon Sep 17 00:00:00 2001 From: Kevin Harrington Date: Tue, 16 Jul 2024 18:23:55 -0400 Subject: [PATCH 3/7] no jar in libs --- java-bowler | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java-bowler b/java-bowler index 12d9d0e5..86182bbc 160000 --- a/java-bowler +++ b/java-bowler @@ -1 +1 @@ -Subproject commit 12d9d0e5883a6da53da867691e1676d6f08e6a94 +Subproject commit 86182bbcb4e07f1005f2d03e0278c249625692b9 From c2e0acdf9f57b7f44082f99f29404e6a899eab25 Mon Sep 17 00:00:00 2001 From: Kevin Harrington Date: Tue, 16 Jul 2024 18:39:22 -0400 Subject: [PATCH 4/7] Adding Ivy update --- build.gradle | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/build.gradle b/build.gradle index 4f028540..c37148d2 100755 --- a/build.gradle +++ b/build.gradle @@ -178,10 +178,8 @@ api group: 'org.reactfx', name: 'reactfx', version: '2.0-SNAPSHOT' // https://mvnrepository.com/artifact/org.apache.groovy/groovy api group: 'org.apache.groovy', name: 'groovy', version: '4.0.22' - -//api group: 'org.codehaus.groovy', name: 'groovy', version:'2.3.7'; - //make grapes work -//api group: 'org.apache.ivy', name:'ivy', version:'2.2.0' +//make grapes work +api group: 'org.apache.ivy', name: 'ivy', version: '2.5.1' //compile group: 'org.controlsfx', name: 'controlsfx', version: '8.0.6' api group: 'commons-lang', name: 'commons-lang', version: '2.6' From a2c445a552e550eb5fcb283968a53c15074450ab Mon Sep 17 00:00:00 2001 From: Kevin Harrington Date: Tue, 16 Jul 2024 19:53:07 -0400 Subject: [PATCH 5/7] synchronizing the entire database system --- .../assets/ConfigurationDatabase.java | 109 ++++++++++++++---- .../gamepad/PersistantControllerMap.java | 16 +-- 2 files changed, 90 insertions(+), 35 deletions(-) diff --git a/src/main/java/com/neuronrobotics/bowlerstudio/assets/ConfigurationDatabase.java b/src/main/java/com/neuronrobotics/bowlerstudio/assets/ConfigurationDatabase.java index 57efc1f5..2c22875b 100644 --- a/src/main/java/com/neuronrobotics/bowlerstudio/assets/ConfigurationDatabase.java +++ b/src/main/java/com/neuronrobotics/bowlerstudio/assets/ConfigurationDatabase.java @@ -5,8 +5,10 @@ import java.io.IOException; import java.io.PrintWriter; import java.lang.reflect.Type; +import java.util.Collections; import java.util.HashMap; import java.util.Map; +import java.util.Set; import org.eclipse.jgit.api.errors.WrongRepositoryStateException; import org.kohsuke.github.GHMyself; @@ -30,50 +32,109 @@ public class ConfigurationDatabase { //private static String gitSource = null; // madhephaestus private static String dbFile = "database.json"; private static boolean checked; - private static HashMap> database = null; + private static Map> database = null; private static final Type TT_mapStringString = new TypeToken>>() { }.getType(); // chreat the gson object, this is the parsing factory private static Gson gson = new GsonBuilder().disableHtmlEscaping().setPrettyPrinting().create(); private static IssueReportingExceptionHandler reporter = new IssueReportingExceptionHandler(); //private static String loggedInAs = null; - static { + public static void clear(String key) { + getDatabase(); + synchronized(database){ + getParamMap(key).clear(); + } + } + public static Set keySet(String name) { + Set keySet ; + getDatabase(); + synchronized(database){ + keySet= ConfigurationDatabase.getParamMap(name).keySet(); + } + return keySet; + } + public static boolean containsKey(String paramsKey, String string) { + boolean containsKey = false; + synchronized(database){ + containsKey = ConfigurationDatabase.getParamMap(paramsKey).containsKey(string); + } + return containsKey; - public static synchronized Object getObject(String paramsKey, String objectKey, Object defaultValue) { - if (getParamMap(paramsKey).get(objectKey) == null) { - //System.err.println("Cant find: " + paramsKey + ":" + objectKey); - setObject(paramsKey, objectKey, defaultValue); + } + public static String getKeyFromValue(String controllerName, String mappedValue) { + String ret=null; + getDatabase(); + synchronized(database){ + HashMap paramMap = ConfigurationDatabase.getParamMap(controllerName); + for (String key : paramMap.keySet()) { + String string = (String) paramMap.get(key); + if (string.contentEquals(mappedValue)) { + ret= key; + break; + } + } + } + return ret; + } + public static Object get(String paramsKey, String objectKey) { + return getObject(paramsKey, objectKey, null); + } + public static Object get(String paramsKey, String objectKey, Object defaultValue) { + return getObject(paramsKey, objectKey, defaultValue); + } + public static Object getObject(String paramsKey, String objectKey, Object defaultValue) { + Object ret=null; + getDatabase(); + synchronized(database){ + if (getParamMap(paramsKey).get(objectKey) == null) { + //System.err.println("Cant find: " + paramsKey + ":" + objectKey); + setObject(paramsKey, objectKey, defaultValue); + } + ret= getParamMap(paramsKey).get(objectKey); } - return getParamMap(paramsKey).get(objectKey); + return ret; } public static HashMap getParamMap(String paramsKey) { - if (getDatabase().get(paramsKey) == null) { - getDatabase().put(paramsKey, new HashMap()); + if (database.get(paramsKey) == null) { + database.put(paramsKey, new HashMap()); } - return getDatabase().get(paramsKey); + return database.get(paramsKey); } - - public static synchronized Object setObject(String paramsKey, String objectKey, Object value) { - Object put = getParamMap(paramsKey).put(objectKey, value); + public static Object put(String paramsKey, String objectKey, Object value) { + return setObject(paramsKey, objectKey, value); + } + + public static Object setObject(String paramsKey, String objectKey, Object value) { + Object put =null; + getDatabase(); + synchronized(database){ + put=getParamMap(paramsKey).put(objectKey, value); + } save(); return put; } - - public static synchronized Object removeObject(String paramsKey, String objectKey) { - Object remove = getParamMap(paramsKey).remove(objectKey); + public static Object remove(String paramsKey, String objectKey) { + return removeObject(paramsKey, objectKey); + } + public static Object removeObject(String paramsKey, String objectKey) { + Object remove=null; + getDatabase(); + synchronized(database){ + remove= getParamMap(paramsKey).remove(objectKey); + } save(); return remove; } - public static synchronized void save() { + public static void save() { String writeOut = null; getDatabase(); - //synchronized(database){ + synchronized(database){ writeOut = gson.toJson(database, TT_mapStringString); - //} + } File f=loadFile(); @@ -88,14 +149,15 @@ public static synchronized void save() { } @SuppressWarnings("unchecked") - public static HashMap> getDatabase() { + public static void getDatabase() { if (database != null) { - return database; + return ; } File loadFile = loadFile(); if(loadFile.exists()) try { - database = (HashMap>) ScriptingEngine.inlineFileScriptRun(loadFile, null); + database = Collections.synchronizedMap((HashMap>) ScriptingEngine.inlineFileScriptRun(loadFile, null)); + } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); @@ -106,7 +168,7 @@ public static HashMap> getDatabase() { // new Exception().printStackTrace(); } - return database; + return ; } public static File loadFile() { @@ -140,4 +202,5 @@ public static File loadFile() { + } \ No newline at end of file diff --git a/src/main/java/com/neuronrobotics/sdk/addons/gamepad/PersistantControllerMap.java b/src/main/java/com/neuronrobotics/sdk/addons/gamepad/PersistantControllerMap.java index b506065c..5bf62f9b 100644 --- a/src/main/java/com/neuronrobotics/sdk/addons/gamepad/PersistantControllerMap.java +++ b/src/main/java/com/neuronrobotics/sdk/addons/gamepad/PersistantControllerMap.java @@ -25,11 +25,11 @@ public static boolean areAllAxisMapped(String controllerName) { return true; } public static void clearMapping(String controllerName) { - ConfigurationDatabase.getParamMap(controllerName).clear(); + ConfigurationDatabase.clear(controllerName); } public static String getMappedAxisName(String controllerName, String incomingName) { - Object object = ConfigurationDatabase.getParamMap(controllerName).get(incomingName); + Object object = ConfigurationDatabase.getObject(controllerName,incomingName,incomingName); if (object == null) return incomingName; return (String) object; @@ -41,14 +41,7 @@ public static boolean isMapedAxis(String controllerName, String mappedValue) { public static String getHardwareAxisFromMappedValue(String controllerName, String mappedValue) { - HashMap paramMap = ConfigurationDatabase.getParamMap(controllerName); - for (String key : paramMap.keySet()) { - String string = (String) paramMap.get(key); - if (string.contentEquals(mappedValue)) { - return key; - } - } - return null; + return ConfigurationDatabase.getKeyFromValue(controllerName, mappedValue); } public static void map(String name,String controllerVal, String persistantVal) { @@ -57,8 +50,7 @@ public static void map(String name,String controllerVal, String persistantVal) { } public static Set getMappedAxis(String name) { - // TODO Auto-generated method stub - return ConfigurationDatabase.getParamMap(name).keySet(); + return ConfigurationDatabase.keySet(name); } From d99eb87bb59741998cdb0f1792bacdf920ebe9d4 Mon Sep 17 00:00:00 2001 From: Kevin Harrington Date: Wed, 17 Jul 2024 11:05:28 -0400 Subject: [PATCH 6/7] Add a getter for the app name --- .../neuronrobotics/bowlerstudio/assets/StudioBuildInfo.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/neuronrobotics/bowlerstudio/assets/StudioBuildInfo.java b/src/main/java/com/neuronrobotics/bowlerstudio/assets/StudioBuildInfo.java index cff715d6..b5c58f6f 100644 --- a/src/main/java/com/neuronrobotics/bowlerstudio/assets/StudioBuildInfo.java +++ b/src/main/java/com/neuronrobotics/bowlerstudio/assets/StudioBuildInfo.java @@ -131,8 +131,12 @@ public static void setBaseBuildInfoClass(Class c) { } public static String getName() { - return "Bowler Studio " + return getAppName() + getProtocolVersion() + "." + getSDKVersion() + "(" + getBuildVersion() + ")"; } + +public static String getAppName() { + return getTag("app.name"); +} } From f1e7f5ec2d78b8218a42029ec14b72c2889bc38f Mon Sep 17 00:00:00 2001 From: Kevin harrington Date: Fri, 19 Jul 2024 13:48:26 -0400 Subject: [PATCH 7/7] vitamins location update --- java-bowler | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java-bowler b/java-bowler index 86182bbc..f0c79d20 160000 --- a/java-bowler +++ b/java-bowler @@ -1 +1 @@ -Subproject commit 86182bbcb4e07f1005f2d03e0278c249625692b9 +Subproject commit f0c79d2083d993f5721d608b295e813ab5098c3f