Reference Guide
Table Of Contents
- 1 Introduction
- 2 Establishing Your Test and Development Environments
- 3 Developing Applications
- Introduction
- Authentication
- REST API
- Audit Logging
- Alert Logging
- Configuration
- High Availability
- OpenFlow
- Metrics Framework
- GUI
- SKI Framework - Overview
- SKI Framework - Navigation Tree
- SKI Framework - Hash Navigation
- SKI Framework - View Life-Cycle
- SKI Framework - Live Reference Application
- UI Extension
- Introduction
- Controller Teaming
- Distributed Coordination Service
- Persistence
- Backup and Restore
- Device Driver Framework
- 4 Application Security
- 5 Including Debian Packages with Applications
- 6 Sample Application
- Application Description
- Creating Application Development Workspace
- Application Generator (Automatic Workspace Creation)
- Creating Eclipse Projects
- Updating Project Dependencies
- Building the Application
- Installing the Application
- Application Code
- 7 Testing Applications
- 8 Built-In Applications
- Appendix A
- Appendix B
- Bibliography
private SwitchManager delegate;
@Activate
public void activate() {
// activate() is called after all mandatory dependencies
// are satisfied
delegate = new SwitchManager(systemInformationService);
delegate.setAlertService(alertService);
}
@Deactivate
public void deactivate() {
delegate = null;
}
protected void bindAlertService(AlertService service) {
alertService = service;
// TODO: Decorate the business logic with the optional service.
if (delegate != null) {
delegate.setAlertService(service);
}
}
protected void unbindAlertService(AlertService service) {
if (alertService == service) {
alertService = null;
if (delegate != null) {
delegate.setAlertService(null);
}
}
}
@Override
public Switch add(Switch device) {
return delegate.add(device);
}
...
// Follow the same pattern than “add(Switch)” for the
// remaining overridden methods.
}
Dependency services are annotated with @Reference to denote to OSGi to inject a reference into
the component. The OSGi’s dependency-injection framework calls bindAlertService(AlertService)
method when the service is available (activated) and unbindAlertService(AlertService) when the
component providing the implementation of AlertService is deactivated. If no bind/unbind
methods are provided (Like in the case of SystemInformationService) OSGi still injects a reference
directly into the variable annotated with @Reference. Defining methods to bind/unbind services
168