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
import com.hp.util.dcord.CoordinationService;
import com.hp.sdn.demo.example.SampleMessage;
@Component
public class PubSubExample {
private CoordinationService coordinationService;
private PublishSubscribeService pubSubService;
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY, policy =
ReferencePolicy.DYNAMIC)
protected volatile TeamingService teamingSvc;
@Activate
protected void activate() {
coordinationService = teamingSvc.getCoordinationService();
pubSubService = coordinationService.getPublishSubscriberService();
}
public void subscribe() {
SampleMessageListener<SampleMessage> listener = new
SampleMessageListener<SampleMessage>();
pubSubService.subscribe(listener, SampleMessage.class);
}
public void publish(SampleMessage message) {
pubSubService.publish(message);
}
}
Message Listener Example:
SampleMessageListener.java
import com.hp.util.dcord.MessageEvent;
import com.hp.util.dcord.Subscriber;
import com.hp.sdn.demo.example.SampleMessage;
public class SampleMessageListener<M extends SampleMessage> implements
Subscriber<M> {
@Override
public void onMessage(MessageEvent<M> messageEvent) {
// Any action to be taken on receipt of a message notification.
// In this example, there is a simple print
System.out.println(“Message notification received”);
}
70