Implemented first SCR component

This commit is contained in:
Willem Cazander 2022-03-02 19:18:47 +01:00
parent 00cb859cd9
commit c6bee21cee
16 changed files with 149 additions and 3 deletions

View file

@ -12,6 +12,7 @@
<groupId>love.distributedrebirth.gdxapp4d</groupId>
<artifactId>gdxapp4d-tos4</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
@ -21,11 +22,20 @@
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<exportScr>true</exportScr>
<instructions>
<_donotcopy>(.git)</_donotcopy>
<!-- Enable processing of OSGI DS component annotations -->
<_dsannotations>*</_dsannotations>
<!-- Enable processing of OSGI metatype annotations -->
<_metatypeannotations>*</_metatypeannotations>
<Import-Package>
love.distributedrebirth.gdxapp4d.tos4.service,
org.osgi.framework,
org.osgi.service.packageadmin,
org.osgi.service.url,
org.osgi.service.startlevel,
org.osgi.util.tracker,
love.distributedrebirth.gdxapp4d.tos4.service,
com.badlogic.gdx,
com.badlogic.gdx.assets,
com.badlogic.gdx.assets.loaders,

View file

@ -41,6 +41,11 @@ public class GDXAppVrGem4Activator implements BundleActivator {
public void start(final BundleContext context) {
// LOG.info("GDXAppVrGem4Activator started");
try {
Thread.sleep(2000);
} catch (InterruptedException ignored) {
}
ServiceReference<SystemWarpTerminal> termRef = context.getServiceReference(SystemWarpTerminal.class);
SystemWarpTerminal terminal = context.getService(termRef);
@ -162,7 +167,7 @@ public class GDXAppVrGem4Activator implements BundleActivator {
} else {
bootScreen.bootLine("vrGEM4: chains resolved.");
try {
Thread.sleep(5000);
Thread.sleep(2000);
} catch (InterruptedException ignored) {
}
Gdx.app.postRunnable(new Runnable() {

View file

@ -0,0 +1,28 @@
package love.distributedrebirth.gdxapp4d.vrgem4;
import org.osgi.service.component.annotations.Activate;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Deactivate;
import org.osgi.service.component.annotations.Reference;
import love.distributedrebirth.gdxapp4d.tos4.service.SystemWarpLogger;
import love.distributedrebirth.gdxapp4d.tos4.service.SystemWarpShip;
@Component
public class TestComponent {
@Reference
private SystemWarpLogger log;
@Reference
private SystemWarpShip warpShip;
@Activate
void open() {
log.info(this, "Activated warpEngine: {}", warpShip.getWarpShip().theShip().getEngine());
}
@Deactivate
void close() {
}
}