Getting started with the Flow Framework
Download
Download a Flow Framework distribution. NOTE: Flow is still in alpha and not production ready! The binary distribution contains a single OSGi bundle which can be used out of the box.
Deploy the framework
Eclipse users can add the bundle to the plugins/ folder of their eclipse distribution.
Ensure framework startup
Make sure the Flow Framework bundle is started at runtime. Eclipse users can use the Run Configurations... wizard:

Start developing services
In Flow (as in OSGi) a service is a Plain Old Java Object implementing an interface. The service is accessed through this interface by the rest of the application. For the Flow infrastructure to identify a service, the implementation class needs to be annotated with the @Service annotation.
Here is an example of an plain Java interface followed by an annotated implementation:
public interface IDateService { /** * Returns the current Date * * @return {@link Date} object representing the current date */ public Date getDate(); }
This is the service implementation, notice the @Service annotation:
@Service(serviceInterface = IDateService.class) public class DateService implements IDateService { public Date getDate() { return new Date(); } }
If you start your OSGi framework, Flow will discover the DateService class and add it to its registry of Resolved Services. If you want to use the DateService at runtime, you can deploy another service, depending on a IDateService:
public interface IDateFormatService { public String getDateFormatted(); }
And the implementation:
@Service(serviceInterface = IDateFormatService.class, autoStart = true) public class DateFormatService implements IDateFormatService, IServiceLifecycleAware { @Inject private IDateService dateService; private final DateFormat format = DateFormat.getDateInstance(); public String getDateFormatted() { return format.format(dateService.getDate()); } public void setDateService(IDateService dateService) { this.dateService = dateService; } public void onEnterState(int state) { switch (state) { case IServiceController.ACTIVE: System.out.println("The current date is: " + getDateFormatted()); break; } } }
Notice the @Inject annotation at the dateService field. This annotation tells the framework, that the DateFormatService depends on an instance of IDateService at runtime.