
org.appdapter.gui.browse.AssemblerCacheGrabber Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of org.appdapter.lib.gui Show documentation
Show all versions of org.appdapter.lib.gui Show documentation
Appdapter Maven project including Java and Scala, produces jar, not bundle. Excludes concrete SLF4J binding.
package org.appdapter.gui.browse;
import java.util.Collection;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import org.appdapter.api.trigger.AnyOper;
import org.appdapter.core.debug.UIAnnotations.UISalient;
import org.appdapter.bind.rdf.jena.assembly.AssemblerUtils;
import org.appdapter.core.component.ComponentCache;
import org.appdapter.core.convert.ReflectUtils;
import org.appdapter.core.log.BasicDebugger;
import org.appdapter.core.log.Debuggable;
import org.appdapter.core.name.Ident;
import org.appdapter.gui.api.BT;
import org.appdapter.gui.api.NamedObjectCollection;
import org.appdapter.gui.swing.CantankerousJob;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class AssemblerCacheGrabber extends BasicDebugger implements AnyOper.Singleton, AnyOper.Autoload {
static Logger theLogger = LoggerFactory.getLogger(AssemblerCacheGrabber.class);
static int instances = 0;
public AssemblerCacheGrabber() {
instances++;
theLogger.warn("Made this " + instances);
}
@UISalient(ResultIsSingleton = true)//
public Map getCacheMap() {
return AssemblerUtils.getComponentCacheMap(AssemblerUtils.getDefaultSession());
}
public static String anyToString(Object any) {
return "" + any;
}
@UISalient public void loadAssemblerClasses() {
setLongRunner("loadAssemblerClasses", new Runnable() {
@Override public void run() {
final NamedObjectCollection bp = Utility.getTreeBoxCollection();
Map map = getCacheMap();
final Object[] clzes;
synchronized (map) {
clzes = map.keySet().toArray();
}
for (Object c : clzes) {
bp.findOrCreateBox(c);
}
}
});
}
@UISalient() public void loadAssemblerInstances() {
setLongRunner("loadAssemblerInstances", new Runnable() {
@Override public void run() {
final NamedObjectCollection bp = Utility.getTreeBoxCollection();
Map cmap = getCacheMap();
final Object[] clzes;
synchronized (cmap) {
clzes = cmap.values().toArray();
}
for (Object c : clzes) {
if (c == null) continue;
Map map = (Map) ((ComponentCache) c).getCompCache();
synchronized (map) {
for (Map.Entry me : map.entrySet()) {
Utility.recordCreated(bp, me.getKey(), me.getValue());
}
}
}
}
});
}
@UISalient() public void loadAddedBoxes() {
setLongRunner("loadAddedBoxes", new Runnable() {
@Override public void run() {
final NamedObjectCollection bp = Utility.getTreeBoxCollection();
Map cmap = getCacheMap();
final Object[] clzes;
synchronized (cmap) {
clzes = cmap.values().toArray();
}
for (Object c : clzes) {
Map
© 2015 - 2025 Weber Informatics LLC | Privacy Policy