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
}
}
The two methods shown read from the database in different ways. The first one issues a find query
using a filter object. The filter specifies the pivot around which the query results are read. The
second method reads a page of alerts and is used when there is a need to paginate results. This is
mostly used by a GUI where pages of Alerts are displayed instead of a single long list of Alerts.
The following is an example of filter object as defined in the demo application.
CassandraAlertFilter.java:
package com.hp.hm.model;
import com.hp.util.filter.EqualityCondition;
import com.hp.util.filter.SetCondition;
import com.hp.util.filter.StringCondition;
...
public class CasssandraAlertFilter {
private SetCondition<Severity> severityCondition;
private EqualityCondition<Boolean> stateCondition;
private StringCondition topicCondition;
private StringCondition originCondition;
...
// Implement setters and getters for all conditions.
// Good practice to override toString()
}
Every application needs to define its filter parameters as in the above code. In the demo
application, there is severity filter to “find Alerts where Severity = CRITICAL, WARNING” for
example. So, Severity is a Set condition. The find method returns the row if one of the values in a
set condition match. The other conditions in the demo follow similar principles.
They cater to various conditional queries that can be issued as a read query to the database. The
caller who wants to read from the database needs to create a filter object and fill it with
appropriate values before issuing a find query.
Data Access Object - DAO
In the previous information, the business logic called the DataStoreService API to perform any
persistence operation. The API performs the operation using a DAO. The DAO is a layer that acts
as a single point of communication between the business logic and the database. The
infrastructure provides generic abstractions of the DAO. However, each table needs to have a
table or a Column family specific DAO defined. For this Alerts Demo application there is a
CassandraAlertDao. The example code is illustrated in the following listing.
CassandraAlertDao.java:
package com.hp.demo.cassandra.dao.impl;
...
public class CassandraAlertDao extends
CassAbstractDao<String, String, CassandraAlert,
CassandraStorable<String, String>, CassandraAlertFilter,
94