This Addon requires the following installation steps.
To use this Furnace container, you must add it as a dependency in the pom.xml of your forge-addon classified artifact:
<dependency> <groupId>org.jboss.forge.furnace.container</groupId> <artifactId>simple</artifactId> <classifier>forge-addon</classifier> <version>${version}</version> </dependency> - Provides simple service registration mechanism
-
Service types should never extend the
org.jboss.forge.furnace.container.simple.Serviceinterface.public class ExampleService { // ... }
Service types may also receive the
Furnacecontainer instance as a constructor parameter:public class ExampleService { public ExampleService(Furnace furnace) { // do something constructor-like } }
To register a type as a service, a file must be created with the name
META-INF/services/org.jboss.forge.furnace.container.simple.Service, and each service type name must be added to this file on a separate line:Example registration file:
META-INF/services/org.jboss.forge.furnace.container.simple.Service ...... org.example.ExampleService org.example.ExampleService2 org.my.custom.MyService ......TipServices registered in this way must exist in the same JAR file as the registry file. - Provides simple event listening mechanism
-
To register an
EventListener, a file must be created with the nameMETA-INF/services/org.jboss.forge.furnace.container.simple.EventListener, and eachEventListenerimplementation type name must be added on a separate line:public class ExampleEventListener implements EventListener { public void handleEvent(Object event, Annotation... qualifiers) { System.out.println("Handled event: " + event) } }
Example registration file:
META-INF/services/org.jboss.forge.furnace.container.simple.EventListener ...... org.example.ExampleEventListener org.example.ExampleEventListener2 org.my.custom.MyEventListener ......| Tip | Listeners registered in this way must exist in the same JAR file as the registry file. |