Skip to content

Commit

Permalink
change some routes around to make the test happy
Browse files Browse the repository at this point in the history
  • Loading branch information
cbeer committed Jan 31, 2013
1 parent 787f98a commit 458f8e1
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 26 deletions.
3 changes: 1 addition & 2 deletions src/main/java/org/fcrepo/modeshape/FedoraIdentifiers.java
Expand Up @@ -15,11 +15,10 @@

import freemarker.template.TemplateException;

@Path("/")
@Path("nextPID")
public class FedoraIdentifiers extends AbstractResource {

@POST
@Path("/nextPID")
@Produces("text/xml")
public Response getNextPid(
@QueryParam("numPids") @DefaultValue("1") Integer numPids)
Expand Down
25 changes: 19 additions & 6 deletions src/main/java/org/fcrepo/modeshape/FedoraObjects.java
Expand Up @@ -4,11 +4,7 @@
import java.io.InputStream;
import java.util.Calendar;

import javax.jcr.Node;
import javax.jcr.Property;
import javax.jcr.PropertyIterator;
import javax.jcr.RepositoryException;
import javax.jcr.Session;
import javax.jcr.*;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
Expand All @@ -34,7 +30,24 @@ public FedoraObjects() throws ConfigurationException, RepositoryException,
super();
}

@POST

@GET
public Response getObjects() throws RepositoryException {
final Session session = repo.login();
Node root = session.getRootNode();
StringBuffer nodes = new StringBuffer();

for (NodeIterator i = root.getNodes(); i.hasNext();) {
Node n = i.nextNode();
nodes.append("Name: " + n.getName() + ", Path:" + n.getPath()
+ "\n");
}
session.logout();
return Response.ok().entity(nodes.toString()).build();

}

@POST
@Path("/new")
public Response ingestAndMint() throws RepositoryException {
return ingest(pidMinter.mintPid());
Expand Down
19 changes: 1 addition & 18 deletions src/main/java/org/fcrepo/modeshape/FedoraRepository.java
Expand Up @@ -31,7 +31,7 @@
* @author ajs6f
*/

@Path("/")
@Path("")
public class FedoraRepository extends AbstractResource {

private final Logger logger = Logger.getLogger(FedoraRepository.class);
Expand Down Expand Up @@ -84,21 +84,4 @@ public Response describe() throws RepositoryException, IOException,
ImmutableMap.of("asdf", (Object) "asdf"))).build();
}

@GET
@Path("/objects")
public Response getObjects() throws RepositoryException {
final Session session = repo.login();
Node root = session.getRootNode();
StringBuffer nodes = new StringBuffer();

for (NodeIterator i = root.getNodes(); i.hasNext();) {
Node n = i.nextNode();
nodes.append("Name: " + n.getName() + ", Path:" + n.getPath()
+ "\n");
}
session.logout();
return Response.ok().entity(nodes.toString()).build();

}

}

0 comments on commit 458f8e1

Please sign in to comment.