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
Creating Domain Service (Business Logic)
The following information defines a service to provide Open Flow Switches functionality (The
sample application’s business logic). This service basically provides operations to create, read,
update and delete open flow switches (CRUD operations).
Service API
Service API abstracts the business logic implementation by defining an API that clients or
consumers use in order to interact with Open Flow switches. This API will act as the Open Flow
Switch service contract. The following listing shows the Open Flow Switch service API which should
be created under hm-api module.
SwitchService.java (Sample Application Service API):
package com.hp.hm.api;
import java.util.Collection;
import java.util.UUID;
import com.hp.api.Id;
import com.hp.api.NotFoundException;
import com.hp.hm.model.Switch;
...
public interface SwitchService {
public Switch create(String name);
public Collection<Switch> getAll();
public Switch get(Id<Switch, UUID> id);
public void delete(Id<Switch, UUID> id);
}
Services expose methods that use transfer objects, primitive types, object value types and common
data structures in their signatures; thus, these entities become part of the API and they remain the
same no matter the implementation we choose for our services.
The Switch service depends on the hm-model module because model objects are defined there,
thus the hm-api POM file needs to resolve the dependencies. Open the hm-api/pom.xml file and
add the XML extract from the following listing to the <dependencies> node. After updating the
POM file update the Eclipse project dependencies (see Updating Project Dependencies on page
146).
Application Model Dependency:
<dependency>
<groupId>com.hp.hm</groupId>
<artifactId>hm-model</artifactId>
<version>${project.version}</version>
</dependency>
156