SDN Controller Programming Guide

126
...
public class SwitchManager implements SwitchService {
@Override
public Switch add(Switch device) {
return device;
}
@Override
public void update(Switch device) {
}
@Override
public Switch get(Id<Switch, Long> id) {
return new Switch(id, MacAddress.valueOf("00:00:00:00:00:01"));
}
@Override
public List<Switch> find(SwitchFilter filter,
SortSpecification<SwitchSortKey> sortSpecification){
return Collections.emptyList();
}
@Override
public void delete(Id<Switch, Long> id) {
}
}
Providing Services with OSGi Declarative Services
The OSGi standard component framework, called Declarative Services [34], is used to create
component-oriented applications. It is called declarative because there is no need to write explicit
code to publish or consume services.
A component describes functional building blocks that are typically more coarse-grained than
what we normally associate with objects.
These building blocks are typically business logic; they provide functionality via interfaces.
Conversely, components may consume functionality provided by other components via their
interfaces. A component framework is used to execute components.
A component model describes what a component looks like, how it interacts with other
components, and what capabilities it has (such as lifecycle or configuration management). A
component framework implements the runtime needed to support a component model and execute
the components.
The general approach for creating an application from components is to compose it. This means
you grab the components implementing the functionality you need and compose them (match
required interfaces to provided interfaces) to form an application. Component compositions can