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
public void setAlertService(AlertService alertService) {
// Mutators are used for optional dependencies.
this.alertService = alertService;
}
...
}
SystemInformationService Module Dependency:
<dependency>
<groupId>com.hp.sdn</groupId>
<artifactId>sdn-adm-api</artifactId>
<version>${sdn.version}</version>
</dependency>
As previously mentioned, SwitchManager is not tied to OSGi so it expects a non-null instance of
SystemInformationService (It doesn’t care how the instance is obtained) and code does not need to
be included to handle the case when the implementation of SystemInformationService is no longer
available. SwitchManager focuses on implementing the business logic. Note how
SystemInformationService is an interface, so its implementation may be changed without affecting
the business logic.
SwitchComponent will be updated to obtain a reference of SystemInformationService and
AlertService via OSGi declarative services. SwitchComponent must deal with the fact that
components may come and go, thus the injected references need to be bound and unbound. The
following listing shows SwitchComponent consuming the services.
Dependent SwitchComponent.java:
package com.hp.hm.impl;
import org.apache.felix.scr.annotations.Reference;
import org.apache.felix.scr.annotations.ReferenceCardinality;
import org.apache.felix.scr.annotations.ReferencePolicy;
import org.apache.felix.scr.annotations.Service;
...
@Component
@Service
public class SwitchComponent implements SwitchService {
@Reference(policy = ReferencePolicy.DYNAMIC,
cardinality = ReferenceCardinality.MANDATORY_UNARY)
private volatile SystemInformationService systemInformationService;
@Reference(policy = ReferencePolicy.DYNAMIC,
cardinality = ReferenceCardinality.OPTIONAL_UNARY)
private volatile AlertService alertService;
// Note: A better design would use the decorator pattern to decorate
// business logic with optional services. That would allow us to use
// SwitchService instead of SwitchManager as the delegate type.
167