Existing REST Modules

 

ProjectRead-only?Unit tests?DB specific?DSpace version?TechnologyNotes
https://github.com/hedtek/dspace-restYesYesYes, Postgres for testingYes, pegged at 1.8.2Sakai

Was developed by a consultancy for a client who ended up not using it.

The POM is pegged to DSpace 1.8.2, but I haven't had issues pegging it to 3.0

May not be Oracle-friendly.

https://github.com/wijiti/dspace-rest-apiNoNoNoNoSakai

Uses the Sakai Project's Entity Bus REST framework.

Still very rough around the edges (e.g., search provider comments out support for user supplied parameters).

https://github.com/DSpace/dspace-restNoNo  SakaiWas a Google summer of code project. Really just a proof of concept, not production ready.

Sakai

All of the existing DSpace REST API frameworks use the Sakai Entity-Bus. Sakai is an architecture that shields services from their implementation. 

Wiring an endpoint to SAKAI looks like:

this.entityProviders = new Vector<AbstractBaseProvider>();
this.entityProviders.add(new BitstreamProvider(entityProviderManager));
this.entityProviders.add(new CommunitiesProvider(entityProviderManager));
this.entityProviders.add(new CollectionsProvider(entityProviderManager));
this.entityProviders.add(new ItemsProvider(entityProviderManager));

For CollectionsProvider, it then sets its endpoint prefix:

public String getEntityPrefix() {
    return "collections";
}

And then you have to know that getEntity(...) is to get a single instance of this resource, and getEntities(...) is to get a list of this resource. For the most part it has entities/providers that shield you from the implementation, and then it also has to implement a bunch of business logic to fetch resources, get their relations, and other CRUD, that the API doesn't care about, but has no alternative, other than to do it itself.

JAX-RS 1

JAVA has a standard for building REST API's, with JSR-311, aka JAX-RS1, aka JAVA API for RESTful Web Services. The reference implementation of JAX-RS1 is JERSEY, there are other implementations that are probably more pleasant. If you use JAX-RS1, then you have a large amount of tools, guides, a community of users using this that you can build off of. JAX-RS2 has come out, and its approved, giving even more features for JAVA web services.

Below is some sample JERSEY code of how you wire up resources, choose to serialize to HTML, JSON, or XML. And between display single-entity vs display list-of-entities.

@Path("/collections")
public class CollectionsResource {
    @GET
@Path("/")
@Produces(MediaType.TEXT_HTML)
public String listHTML() {...}

 

    @GET
@Path("/")
@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
public org.dspace.rest.common.Collection[] list(@QueryParam("expand") String expand) {...}

 

    @GET
@Path("/{collection_id}")
@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
public org.dspace.rest.common.Collection getCollection(@PathParam("collection_id") Integer collection_id, @QueryParam("expand") String expand) {...}

 

There was no central ProviderRegistry that you have to declare your path. Your free to use @annotations to get your code to respond to requests, and there are helpful parameter helpers to extract parameters into Java variables.

Some analyses between wijiti and hedtek APIs