Implementing your Data Access Layer
As stated at Option 1: Full Data Access Implementation, an implementation of the data access API will wrap whatever data storage is configured to the RDAP server.
To create a custom implementation, the following classes must be provided:
- At least one DAO (Data-Access Object) class, whose methods will be used by the rdap-server to retrieve RDAP objects from whatever data storage is being used. The DAOs must be implemented for this to make sense to any business.
- One implementation hub class, which will point the server to the custom DAOs. It must implement the
mx.nic.rdap.db.spi.DataAccessImplementation
interface. - [Optional, but recommended] A service provider configuration file, in this case a file named
META-INF/services/mx.nic.rdap.db.spi.DataAccessImplementation
which contains the full name of the implementation hub class.
The point of this file is to provide the server with a “default” pointer to the implementation. In other words, if the implementation is the only one in the classpath, this file will allow the server to find it without forcing the user to configure it explicitly.
Every DAO will provide information regarding one specific object type. The available object types are autnums, domains, entities, IP networks, nameservers and users. Data access to each of these objects can be provided by implementing (respectively) the following interfaces:
mx.nic.rdap.db.spi.AutnumDAO
mx.nic.rdap.db.spi.DomainDAO
mx.nic.rdap.db.spi.EntityDAO
mx.nic.rdap.db.spi.IpNetworkDAO
mx.nic.rdap.db.spi.NameserverDAO
mx.nic.rdap.db.spi.RdapUserDAO
Example
Here is a simple implementation as an example, see comments inline for details:
- IP Network DAO:
mx.nic.rdap.sample.SampleIpNetworkDaoImpl.java
- Hub class:
mx.nic.rdap.sample.SampleHub.java
- Service provider configuration file:
mx.nic.rdap.db.spi.DataAccessImplementation
The full sample implementation (compiled into a jar file) can be downloaded here. Instructions on how to append the custom implementation to the server can be found at Deploying rdap-server.