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
- [Optional, but recommended] A service provider configuration file, in this case a file named
META-INF/services/mx.nic.rdap.db.spi.DataAccessImplementationwhich 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:
Here is a simple implementation as an example, see comments inline for details:
- IP Network DAO:
- Hub class:
- Service provider configuration file:
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.