| Apache Abdera > Documentation > Server Implementation Guide > Collection Adapter Implementation Guide |
Collection Adapters provide the business logic that ties the Abdera server framework to specific backend data storage or application systems. Every Atompub server implementation must use at least one Collection Adapter.
Abdera ships with a number of simple Collection Adapter implementations that can be used out of the box. These include adapters for storing Atom entries in the File system, CouchDB, a JCR-repository or a database using JDBC and Ibatis. A Hibernate adapter is also available but is not built by default. The use of these stock Collection Adapters will be discussed later.
Every method on the CollectionAdapter interface takes a RequestContext as input. This object contains all of the information relevant to the request, including the Target, the request headers, the entity payload, etc. It is equivalent to the HttpServletRequest object but provides methods that are specific to the Abdera APIs.
The return value for each of the CollectionAdapter interface methods is a ResponseContext. This object provides all of the information the AbderaServlet needs to render the response. There are several ResponseContext implementations available within Abdera and your implementation can choose to implement more. The available ResponseContext implementations will be discussed later.
There are nine basic methods on the CollectionAdapter interface, each of which reflect a basic capability of an Atompub Collection.
The basic CollectionAdapter interface does not support Media Link Entries and Atompub collections that contain media resources. Collection Adapters can implement the MediaCollectionAdapter interface to add support for media link entries. The Provider will automatically detect when a CollectionAdapter supports the MediaCollectionAdapter interface and will dispatch methods accordingly.
Some Adapters are required to operate within a Transactional context. A Collection Adapter can implement the Transactional interface in order to have the Provider automatically manage the lifecycle of the transaction.
The ProviderHelper class (org.apache.abdera.protocol.server.ProviderHelper) provides a range of helpful utility methods intended to make life easier for Collection Adapter developers. Most of the methods are intended to make it easier to return commonly used response codes.
TODO: Discuss specific ResponseContext options
The AbstractCollectionAdapter and AbstractEntityCollectionAdapter base classes provide helpful base implementations of the CollectionAdapter interface designed to make it easier to implement CollectionAdapters. The AbstractEntityCollectionAdapter is specifically designed to make it easier to adapt sets of application specific entities - such as database rows, domain objects or files - to Collection entries.
The ManagedCollectionAdapter is an extension of AbstractCollectionAdapter that uses *.properties files deployed on the server to configure CollectionAdapter instances.
TODO: Expand this
TODO: Discuss the configuration file format
The BasicAdapter is a simplified extension of ManagedCollectionAdapter that provides interfaces for producing a minimally functional Atompub collection with a constrained set of features.
TODO: Expand this
The CouchDbAdapter is an extension of ManagedCollectionAdapter that uses CouchDB databases to store Collection entries.
TODO: Expand this
The FileSystemAdapter is an extension of ManagedCollectionAdapter that uses the Filesystem to store Collection entries.
TODO: Expand this
The JCRAdapter is an extension of AbstractEntityCollectionAdapter that uses a JCR Repository to store Collection entries.
TODO: Expand this
The IBastisAdapter is an extension of BasicAdapter that uses IBatis and JDBC to store Collection entries
TODO: Expand this
The HibernateAdapter is an extension of BasicAdapter that uses Hibernate and JDBC to store Collection entries
TODO: Expand this
TODO: Expand this discussion
TODO: things to discuss...
Handling custom HTTP Operations
Handling conditional requests
Serving Categories Documents
Serving Collection Feeds
Serving Member Entries
Serving Media Resources
Using the Slug header (slug sanitization)
Properly Handling Cache Control Options
Using the EntityTag class to generate Etags
Generating URLs/IRIs
Extra server stuff:
Returning digitally signed documents
Receiving digitally signed documents
Returning encrypted documents
Receiving encrypted documents