From 3e782452aa505b9fdf2b9d2b697662b6e72804da Mon Sep 17 00:00:00 2001 From: Willem Date: Thu, 3 Mar 2022 01:41:24 +0100 Subject: [PATCH] Do install after resolve of oceans. --- .../gdxapp4d/tos4/GDXAppTos4Activator.java | 58 +++++++++++++------ .../gdxapp4d/tos4/service/SystemWarpSea.java | 7 ++- .../vrgem4/GDXAppVrGem4Activator.java | 7 +-- 3 files changed, 49 insertions(+), 23 deletions(-) diff --git a/gdxapp4d-tos4/src/main/java/love/distributedrebirth/gdxapp4d/tos4/GDXAppTos4Activator.java b/gdxapp4d-tos4/src/main/java/love/distributedrebirth/gdxapp4d/tos4/GDXAppTos4Activator.java index f99c612f..90cc9833 100644 --- a/gdxapp4d-tos4/src/main/java/love/distributedrebirth/gdxapp4d/tos4/GDXAppTos4Activator.java +++ b/gdxapp4d-tos4/src/main/java/love/distributedrebirth/gdxapp4d/tos4/GDXAppTos4Activator.java @@ -13,7 +13,7 @@ import java.util.function.Consumer; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; -import org.osgi.framework.BundleException; +import org.osgi.framework.ServiceReference; import org.slf4j.LoggerFactory; import org.x4o.xml.io.X4OConnectionException; import org.xml.sax.SAXException; @@ -86,6 +86,7 @@ public class GDXAppTos4Activator implements BundleActivator { @Override public void stop(final BundleContext context) { + gdxFont.dispose(); } @Override @@ -99,7 +100,6 @@ public class GDXAppTos4Activator implements BundleActivator { File userHome = new File(System.getProperty(SYSTEM_USER_HOME)); hyperdriveHome = new File(userHome, HYPERDRIVE_HOME); - fireMessageEvent("hyper-home: "+hyperdriveHome); if (!hyperdriveHome.exists()) { fireMessageEvent("ERROR: No Hyperdrive home."); return; @@ -187,6 +187,28 @@ public class GDXAppTos4Activator implements BundleActivator { } else { fireMessageEvent("tos4: chains resolved."); } + try { + ServiceReference[] refs = context.getServiceReferences( SystemWarpSea.class.getName(), "(warp.sea.name=*)" ); + for (int i=0;i logger) - throws IOException, InterruptedException, X4OConnectionException, SAXException, BundleException { + throws IOException, InterruptedException, X4OConnectionException, SAXException { File waterHome; String override = localOverrides.getProperty(key); if (override == null) { @@ -285,20 +321,8 @@ public class GDXAppTos4Activator implements BundleActivator { Hashtable props = new Hashtable(); props.put(SystemWarpSea.NAME_PROPERTY, ocean.theWater().getName()); - props.put(SystemWarpSea.PROVIDER_PROPERTY, ocean.theWater().getProvider()); - context.registerService(SystemWarpSea.class.getName(), new SystemWarpSeaImpl(ocean), props); + context.registerService(SystemWarpSea.class.getName(), new SystemWarpSeaImpl(key, waterHome, ocean), props); - for (WaterSeaMagic magic:ocean.theWater().getSeaMagics()) { - if ("application/vnd.osgi.bundle".equals(magic.getMime())) { - String overrideBundleKey = key + "." + magic.getFile(); - String overrideBundle = localOverrides.getProperty(overrideBundleKey); - if (overrideBundle == null) { - GDXAppTos4BootFactory.installAndStartBundles(context, "reference:file:"+waterHome.getAbsolutePath()+"/"+magic.getFile()); - } else { - GDXAppTos4BootFactory.installAndStartBundles(context, "reference:file:"+overrideBundle); - } - } - } int result = 0; for (WaterSeaChain chain: ocean.theWater().getSeaChains()) { result += loadWaterOcean(context, chain.getKey(), logger); diff --git a/gdxapp4d-tos4/src/main/java/love/distributedrebirth/gdxapp4d/tos4/service/SystemWarpSea.java b/gdxapp4d-tos4/src/main/java/love/distributedrebirth/gdxapp4d/tos4/service/SystemWarpSea.java index f506c72e..9cbbe598 100644 --- a/gdxapp4d-tos4/src/main/java/love/distributedrebirth/gdxapp4d/tos4/service/SystemWarpSea.java +++ b/gdxapp4d-tos4/src/main/java/love/distributedrebirth/gdxapp4d/tos4/service/SystemWarpSea.java @@ -1,5 +1,7 @@ package love.distributedrebirth.gdxapp4d.tos4.service; +import java.io.File; + import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ; import love.distributedrebirth.warpme.sea.WaterOcean; @@ -7,7 +9,10 @@ import love.distributedrebirth.warpme.sea.WaterOcean; public interface SystemWarpSea { String NAME_PROPERTY = "warp.sea.name"; - String PROVIDER_PROPERTY = "warp.sea.provider"; + + String getWarpKey(); + + File getWarpHome(); WaterOcean getWarpSea(); } diff --git a/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/GDXAppVrGem4Activator.java b/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/GDXAppVrGem4Activator.java index 61d5dc63..c4cd7251 100644 --- a/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/GDXAppVrGem4Activator.java +++ b/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/GDXAppVrGem4Activator.java @@ -28,16 +28,12 @@ import love.distributedrebirth.warpme.ship.WaterShipOcean; public class GDXAppVrGem4Activator implements BundleActivator { -// private static final Logger LOG = LoggerFactory.getLogger(GDXAppVrGem4Activator.class); - @Override public void stop(final BundleContext context) { } @Override public void start(final BundleContext context) { -// LOG.info("GDXAppVrGem4Activator started"); - try { Thread.sleep(2000); } catch (InterruptedException ignored) { @@ -170,13 +166,14 @@ public class GDXAppVrGem4Activator implements BundleActivator { } else { bootScreen.bootLine("vrGEM4: chains resolved."); try { - Thread.sleep(6000); + Thread.sleep(2000); } catch (InterruptedException ignored) { } Gdx.app.postRunnable(new Runnable() { @Override public void run() { terminal.selectScreen(ScreenDesktop1.class); + terminal.disposeScreen(bootScreen); } }); }