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
<supportedProjectType>bundle</supportedProjectType>
<supportedProjectType>war</supportedProjectType>
</supportedProjectTypes>
</configuration>
</plugin>
</plugins>
</build>
</project>
The component can then use Annotations to define the configuration properties as illustrated in the
following listing.
Configurable Property Key Definition Example:
package com.hp.hm.impl;
import org.apache.felix.scr.annotations.*;
...
@Component (metatype=true)
public class SwitchComponent implements SwitchService {
@Property(intValue = 100, description="Some Configuration")
protected static final String CONFIG_KEY = "cfg.key";
...
}
The component is provided the configuration data by the OSGi framework as a Java Dictionary
object, which can be referenced as a basic Map of key -> value pairs. The key will always be a
Java String object, and the value will be a Java Object. A component will be provided the
configuration data at component initialization via an annotated “activate” method. Live updates to
a components configuration will be provided via an annotated “modified” method. Both of these
annotated methods should define a Map<String, Object> as an input parameter. The following
listing shows an example.
Configurable Property Example:
...
import com.hp.sdn.misc.ConfigUtils;
@Component (metatype=true)
public class SwitchComponent implements SwitchService {
@Property(intValue = 100, description="Some Configuration")
protected static final String CONFIG_KEY = "cfg.key";
private int someCfgVariable;
@Activate
protected void activate(Map<String, Object> config) {
someIntVariable = ConfigUtils.readInt(config, CONFIG_KEY, null, 100);
}
@Modified
protected void modified(Map<String, Object> config) {
22