Skip to content

Simple (Native Java) Service Container for Furnace

Notifications You must be signed in to change notification settings

forge/furnace-simple

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Furnace Container: Simple

Build Status License

This addon is a 'Furnace container' that provides lifecycle and service registry support for dependent addons. Addons may depend on this to provide service instances to dependencies.

Dependencies: None

Setup

This Addon requires the following installation steps.

Add configuration to pom.xml

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>

Add classes to the simple service registry.

In order for dependencies to use your services, you must add service types to the service registry.

Features

Provides simple service registration mechanism

Service types should never extend the org.jboss.forge.furnace.container.simple.Service interface.

public class ExampleService
{
   // ...
}

Service types may also receive the Furnace container 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
......
Tip
Services 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 name META-INF/services/org.jboss.forge.furnace.container.simple.EventListener, and each EventListener implementation 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.

About

Simple (Native Java) Service Container for Furnace

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages