https://github.com/forge/furnace-simple
Simple (Native Java) Service Container for Furnace
https://github.com/forge/furnace-simple
Last synced: 9 months ago
JSON representation
Simple (Native Java) Service Container for Furnace
- Host: GitHub
- URL: https://github.com/forge/furnace-simple
- Owner: forge
- Created: 2013-10-25T14:17:13.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2022-06-13T16:04:49.000Z (over 3 years ago)
- Last Synced: 2025-04-04T22:41:35.775Z (11 months ago)
- Language: Java
- Size: 342 KB
- Stars: 0
- Watchers: 5
- Forks: 9
- Open Issues: 3
-
Metadata Files:
- Readme: README.asciidoc
Awesome Lists containing this project
README
== Furnace Container: Simple
:idprefix: id_
image:https://forge.ci.cloudbees.com/job/furnace-simple/badge/icon["Build Status", link="https://forge.ci.cloudbees.com/job/furnace-simple/"]
image:http://img.shields.io/:license-EPL-blue.svg["License", link="https://www.eclipse.org/legal/epl-v10.html"]
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:
org.jboss.forge.furnace.container
simple
forge-addon
${version}
=== 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.
+
[source,java]
----
public class ExampleService
{
// ...
}
----
+
Service types may also receive the `Furnace` container instance as a constructor parameter:
+
[source,java]
----
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:
+
[source,text]
----
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:
+
[source,java]
----
public class ExampleEventListener implements EventListener
{
public void handleEvent(Object event, Annotation... qualifiers)
{
System.out.println("Handled event: " + event)
}
}
----
+
Example registration file:
[source,text]
----
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.