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
throw new NullPointerException("id cannot be null");
}
synchronized (devices) {
Switch s = devices.remove(id);
if (s == null) {
throw new NotFoundException("Switch with id "id + "not
found"):
}
}
}
SwitchResource.java Delegating to Business Logic:
package com.hp.hm.rs;
...
@Path("health")
public class SwitchResource extends ControllerResource {
@GET
@Produces(MediaType.APPLICATION_JSON)
public Response getAll() {
SwitchService service = get(SwitchService.class);
ObjectMapper mapper = new ObjectMapper();
ObjectNode root = mapper.createObjectNode();
List<Switch> switches = service.getAll();
for (Switch s: switches) {
nodes.add(json(s, mapper));
ArrayNode rowNode = root.putArray("health");
rowNode.addAll(nodes);
}
return ok(root.toString()).build();
}
@GET
@Path("{uid}")
@Produces(MediaType.APPLICATION_JSON)
public Response get(@PathParam("uid") long uid) {
Id<Switch, UUID> deviceId = Id.valueOf(UUID.fromString(uid));
SwitchService service = get(SwitchService.class);
Switch device = service.get(deviceId);
returnresponse(device, new ObjectMapper()).build();
}
210