Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
changed method to use a simple redirection to the describeRdf() method
  • Loading branch information
fasseg committed May 16, 2013
1 parent 54d98c5 commit 6b5c311
Showing 1 changed file with 2 additions and 34 deletions.
36 changes: 2 additions & 34 deletions fcrepo-http-api/src/main/java/org/fcrepo/api/FedoraRepository.java
Expand Up @@ -12,14 +12,14 @@
import static org.fcrepo.http.RDFMediaType.N3_ALT1;
import static org.fcrepo.http.RDFMediaType.N3_ALT2;
import static org.fcrepo.http.RDFMediaType.NTRIPLES;
import static org.fcrepo.http.RDFMediaType.POSSIBLE_RDF_VARIANTS;
import static org.fcrepo.http.RDFMediaType.RDF_JSON;
import static org.fcrepo.http.RDFMediaType.RDF_XML;
import static org.fcrepo.http.RDFMediaType.TURTLE;
import static org.fcrepo.services.RepositoryService.getRepositoryNamespaces;
import static org.slf4j.LoggerFactory.getLogger;

import java.io.IOException;
import java.net.URI;
import java.util.Map;

import javax.jcr.Repository;
Expand All @@ -33,12 +33,10 @@
import javax.ws.rs.core.Context;
import javax.ws.rs.core.Request;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Variant;

import org.fcrepo.AbstractResource;
import org.fcrepo.jaxb.responses.access.DescribeCluster;
import org.fcrepo.jaxb.responses.access.DescribeRepository;
import org.fcrepo.provider.GraphStreamingOutput;
import org.fcrepo.provider.VelocityViewer;
import org.fcrepo.services.ObjectService;
import org.fcrepo.services.functions.GetClusterConfiguration;
Expand All @@ -48,13 +46,6 @@

import com.codahale.metrics.annotation.Timed;
import com.google.common.collect.ImmutableMap.Builder;
import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.rdf.model.ModelFactory;
import com.hp.hpl.jena.rdf.model.Property;
import com.hp.hpl.jena.rdf.model.Resource;
import com.hp.hpl.jena.rdf.model.ResourceFactory;
import com.hp.hpl.jena.update.GraphStore;
import com.hp.hpl.jena.update.GraphStoreFactory;

@Component
@Path("/rest/fcr:describe")
Expand Down Expand Up @@ -131,30 +122,7 @@ public DescribeRepository describe() throws RepositoryException {
@Timed
@Produces({N3, N3_ALT1, N3_ALT2, TURTLE, RDF_XML, RDF_JSON, NTRIPLES})
public Response describeRdf(@Context Request request) throws RepositoryException {
final Session sess = getAuthenticatedSession();
try{
final Variant bestPossibleResponse = request.selectVariant(POSSIBLE_RDF_VARIANTS);
final Model model = ModelFactory.createDefaultModel();

/* TODO: this should be done using the class JcrRdfTools */
/* populate the model */
Resource res = ResourceFactory.createResource(uriInfo.getAbsolutePath().toASCIIString());
Property propBaseUrl = ResourceFactory.createProperty("http://fcrepo.org/repository#baseUrl");
Property propSampleOAIUrl = ResourceFactory.createProperty("http://fcrepo.org/repository#sampleOAIUrl");
Property propSize = ResourceFactory.createProperty("http://fcrepo.org/repository#size");
Property propNumObjects = ResourceFactory.createProperty("http://fcrepo.org/repository#numObjects");
Property propVersion = ResourceFactory.createProperty("http://fcrepo.org/repository#version");
model.add(res, propBaseUrl, uriInfo.getBaseUri().toASCIIString());
model.add(res, propSampleOAIUrl, uriInfo.getBaseUriBuilder().path("/123/oai_dc").build().toASCIIString());
model.add(res, propSize, String.valueOf(objectService.getRepositorySize()));
model.add(res, propNumObjects, String.valueOf(objectService.getRepositoryObjectCount(sess)));
model.add(res, propVersion, DescribeRepository.FEDORA_VERSION);

final GraphStore store = GraphStoreFactory.create(model);
return Response.ok(new GraphStreamingOutput(store, bestPossibleResponse.getMediaType())).build();
}finally{
sess.logout();
}
return Response.seeOther(URI.create(uriInfo.getBaseUri() + "/rest/")).build();
}

/**
Expand Down

0 comments on commit 6b5c311

Please sign in to comment.