Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
globbing a node path to support hierarchy
- Loading branch information
Showing
26 changed files
with
504 additions
and
183 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
78 changes: 78 additions & 0 deletions
78
fcrepo-http-api/src/main/java/org/fcrepo/api/FedoraChildren.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
|
||
package org.fcrepo.api; | ||
|
||
import static javax.ws.rs.core.MediaType.APPLICATION_JSON; | ||
import static javax.ws.rs.core.MediaType.TEXT_HTML; | ||
import static javax.ws.rs.core.MediaType.TEXT_XML; | ||
import static javax.ws.rs.core.Response.created; | ||
import static javax.ws.rs.core.Response.noContent; | ||
import static javax.ws.rs.core.Response.ok; | ||
import static org.fcrepo.jaxb.responses.access.ObjectProfile.ObjectStates.A; | ||
import static org.slf4j.LoggerFactory.getLogger; | ||
|
||
import java.io.IOException; | ||
import java.util.Arrays; | ||
import java.util.List; | ||
|
||
import javax.jcr.Node; | ||
import javax.jcr.RepositoryException; | ||
import javax.jcr.Session; | ||
import javax.ws.rs.DELETE; | ||
import javax.ws.rs.DefaultValue; | ||
import javax.ws.rs.GET; | ||
import javax.ws.rs.POST; | ||
import javax.ws.rs.PUT; | ||
import javax.ws.rs.Path; | ||
import javax.ws.rs.PathParam; | ||
import javax.ws.rs.Produces; | ||
import javax.ws.rs.QueryParam; | ||
import javax.ws.rs.core.MultivaluedMap; | ||
import javax.ws.rs.core.PathSegment; | ||
import javax.ws.rs.core.Response; | ||
|
||
import org.fcrepo.AbstractResource; | ||
import org.fcrepo.FedoraObject; | ||
import org.fcrepo.jaxb.responses.access.ObjectProfile; | ||
import org.fcrepo.services.ObjectService; | ||
import org.slf4j.Logger; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.stereotype.Component; | ||
|
||
import com.google.common.collect.ImmutableList; | ||
|
||
@Component | ||
@Path("/rest/{path: .*(?!(fcr\\:))}/fcr:children") | ||
public class FedoraChildren extends AbstractResource { | ||
|
||
private static final Logger logger = getLogger(FedoraChildren.class); | ||
|
||
@Autowired | ||
private ObjectService objectService; | ||
|
||
/** | ||
* | ||
* Provides a serialized list of JCR names for all objects in the repo. | ||
* | ||
* @return 200 | ||
* @throws RepositoryException | ||
*/ | ||
@GET | ||
@Path("") | ||
public Response getObjects(@PathParam("path") | ||
final List<PathSegment> pathList) throws RepositoryException { | ||
|
||
logger.trace("children of {}", toPath(pathList)); | ||
return ok(objectService.getObjectNames(toPath(pathList.subList(0, pathList.size()-1))).toString()).build(); | ||
|
||
} | ||
|
||
public ObjectService getObjectService() { | ||
return objectService; | ||
} | ||
|
||
|
||
public void setObjectService(ObjectService objectService) { | ||
this.objectService = objectService; | ||
} | ||
|
||
} |
Oops, something went wrong.