Skip to content

Commit

Permalink
Renaming types to match new functions
Browse files Browse the repository at this point in the history
  • Loading branch information
ajs6f committed Apr 2, 2014
1 parent 7f7a3f5 commit 6ea0d00
Show file tree
Hide file tree
Showing 82 changed files with 244 additions and 243 deletions.
Expand Up @@ -27,7 +27,7 @@
import org.fcrepo.jcr.FedoraJcrTypes;
import org.fcrepo.kernel.FedoraResource;
import org.fcrepo.kernel.RdfLexicon;
import org.fcrepo.kernel.rdf.GraphSubjects;
import org.fcrepo.kernel.rdf.IdentifierTranslator;
import org.springframework.stereotype.Component;

import com.hp.hpl.jena.rdf.model.Model;
Expand All @@ -46,11 +46,11 @@ public class AccessRolesResources implements UriAwareResourceModelFactory {
* (non-Javadoc)
* @see org.fcrepo.http.commons.api.rdf.UriAwareResourceModelFactory#
* createModelForResource( org.fcrepo.kernel.FedoraResourceImpl,
* javax.ws.rs.core.UriInfo, org.fcrepo.kernel.rdf.GraphSubjects)
* javax.ws.rs.core.UriInfo, org.fcrepo.kernel.rdf.IdentifierTranslator)
*/
@Override
public Model createModelForResource(final FedoraResource resource,
final UriInfo uriInfo, final GraphSubjects graphSubjects)
final UriInfo uriInfo, final IdentifierTranslator graphSubjects)
throws RepositoryException {
final Model model = ModelFactory.createDefaultModel();
final Resource s = graphSubjects.getGraphSubject(resource.getNode().getPath());
Expand Down
Expand Up @@ -31,7 +31,7 @@
import org.fcrepo.jcr.FedoraJcrTypes;
import org.fcrepo.kernel.FedoraResource;
import org.fcrepo.kernel.RdfLexicon;
import org.fcrepo.kernel.rdf.GraphSubjects;
import org.fcrepo.kernel.rdf.IdentifierTranslator;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Matchers;
Expand All @@ -49,7 +49,7 @@
public class AccessRolesResourcesTest {

@Mock
private GraphSubjects graphSubjects;
private IdentifierTranslator graphSubjects;

@Mock
private FedoraResource fedoraResource;
Expand Down
Expand Up @@ -48,7 +48,7 @@

import org.fcrepo.kernel.FedoraObject;
import org.fcrepo.kernel.FedoraResource;
import org.fcrepo.kernel.rdf.GraphSubjects;
import org.fcrepo.kernel.rdf.IdentifierTranslator;
import org.fcrepo.kernel.rdf.impl.DefaultGraphSubjects;
import org.fcrepo.kernel.services.DatastreamService;
import org.fcrepo.kernel.services.NodeService;
Expand Down Expand Up @@ -190,7 +190,7 @@ public void testRemoveProperty() throws RepositoryException {
"'some-property-to-remove' }";

// Write the properties
final GraphSubjects graphSubjects = new DefaultGraphSubjects();
final IdentifierTranslator graphSubjects = new DefaultGraphSubjects();
object.updatePropertiesDataset(graphSubjects, sparql);

// Verify property exists
Expand All @@ -206,7 +206,7 @@ public void testRemoveProperty() throws RepositoryException {
"}";

// Remove the properties
final GraphSubjects graphSubjectsRemove = new DefaultGraphSubjects();
final IdentifierTranslator graphSubjectsRemove = new DefaultGraphSubjects();
object.updatePropertiesDataset(graphSubjectsRemove, sparqlRemove);

// Persist the object (although the propery will be removed from memory without this.)
Expand Down
Expand Up @@ -52,7 +52,7 @@
import org.fcrepo.http.commons.AbstractResource;
import org.fcrepo.http.commons.api.rdf.HttpGraphSubjects;
import org.fcrepo.http.commons.session.InjectedSession;
import org.fcrepo.kernel.rdf.GraphSubjects;
import org.fcrepo.kernel.rdf.IdentifierTranslator;
import org.fcrepo.kernel.utils.iterators.RdfStream;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
Expand Down Expand Up @@ -128,7 +128,7 @@ public String apply(final String identifier) {
}

private static Function<String, Triple> identifier2triple(
final GraphSubjects subjects, final Node pidsResult) {
final IdentifierTranslator subjects, final Node pidsResult) {
return new Function<String, Triple>() {

@Override
Expand Down
Expand Up @@ -103,7 +103,7 @@
import org.fcrepo.kernel.Datastream;
import org.fcrepo.kernel.FedoraResource;
import org.fcrepo.kernel.exception.InvalidChecksumException;
import org.fcrepo.kernel.rdf.GraphSubjects;
import org.fcrepo.kernel.rdf.IdentifierTranslator;
import org.fcrepo.kernel.utils.iterators.RdfStream;
import org.slf4j.Logger;
import org.springframework.context.annotation.Scope;
Expand Down Expand Up @@ -612,7 +612,7 @@ public Response copyObject(@PathParam("path") final List<PathSegment> path,

try {

final GraphSubjects subjects =
final IdentifierTranslator subjects =
new HttpGraphSubjects(session, FedoraNodes.class, uriInfo);

if (!nodeService.exists(session, toPath(path))) {
Expand Down Expand Up @@ -681,7 +681,7 @@ public Response moveObject(@PathParam("path") final List<PathSegment> pathList,
throw new WebApplicationException(builder.build());
}

final GraphSubjects subjects =
final IdentifierTranslator subjects =
new HttpGraphSubjects(session, FedoraNodes.class, uriInfo);

final String destination =
Expand Down
Expand Up @@ -53,7 +53,7 @@
import org.fcrepo.http.commons.api.rdf.HttpGraphSubjects;
import org.fcrepo.http.commons.responses.HtmlTemplate;
import org.fcrepo.http.commons.session.InjectedSession;
import org.fcrepo.kernel.rdf.GraphSubjects;
import org.fcrepo.kernel.rdf.IdentifierTranslator;
import org.fcrepo.kernel.rdf.JcrRdfTools;
import org.fcrepo.kernel.utils.iterators.RdfStream;
import org.springframework.context.annotation.Scope;
Expand Down Expand Up @@ -84,7 +84,7 @@ public class FedoraRepositoryWorkspaces extends AbstractResource {
public RdfStream getWorkspaces()
throws RepositoryException {

final GraphSubjects subjects =
final IdentifierTranslator subjects =
new HttpGraphSubjects(session, FedoraNodes.class, uriInfo);

return JcrRdfTools.withContext(null, session).getWorkspaceTriples(subjects).session(session);
Expand Down Expand Up @@ -116,7 +116,7 @@ public Response createWorkspace(@PathParam("path") final String path,

workspace.createWorkspace(path);

final GraphSubjects subjects =
final IdentifierTranslator subjects =
new HttpGraphSubjects(session.getRepository().login(path), FedoraNodes.class, uriInfo);


Expand Down
Expand Up @@ -43,7 +43,7 @@
import org.fcrepo.http.api.repository.FedoraRepositoryWorkspaces;
import org.fcrepo.http.commons.api.rdf.UriAwareResourceModelFactory;
import org.fcrepo.kernel.FedoraResource;
import org.fcrepo.kernel.rdf.GraphSubjects;
import org.fcrepo.kernel.rdf.IdentifierTranslator;
import org.fcrepo.serialization.SerializerUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
Expand All @@ -64,7 +64,7 @@ public class HttpApiResources implements UriAwareResourceModelFactory {

@Override
public Model createModelForResource(final FedoraResource resource,
final UriInfo uriInfo, final GraphSubjects graphSubjects)
final UriInfo uriInfo, final IdentifierTranslator graphSubjects)
throws RepositoryException {

final Model model = createDefaultModel();
Expand Down
Expand Up @@ -64,7 +64,7 @@
import org.apache.commons.io.IOUtils;
import org.fcrepo.kernel.Datastream;
import org.fcrepo.kernel.FedoraResourceImpl;
import org.fcrepo.kernel.rdf.GraphSubjects;
import org.fcrepo.kernel.rdf.IdentifierTranslator;
import org.fcrepo.kernel.services.DatastreamService;
import org.fcrepo.kernel.services.NodeService;
import org.fcrepo.kernel.services.VersionService;
Expand Down Expand Up @@ -156,7 +156,7 @@ public void testBatchSparqlUpdate() throws Exception {
multipart.bodyPart(part);

testObj.batchModify(createPathList(pid), multipart);
verify(mockObject).updatePropertiesDataset(any(GraphSubjects.class), eq("xyz"));
verify(mockObject).updatePropertiesDataset(any(IdentifierTranslator.class), eq("xyz"));
verify(mockSession).save();
}

Expand Down Expand Up @@ -187,7 +187,7 @@ public void testBatchRdfPost() throws Exception {

testObj.batchModify(createPathList(pid), multipart);
final ArgumentCaptor<Model> captor = ArgumentCaptor.forClass(Model.class);
verify(mockObject).replaceProperties(any(GraphSubjects.class), captor.capture());
verify(mockObject).replaceProperties(any(IdentifierTranslator.class), captor.capture());
final Model capturedModel = captor.getValue();
assertTrue(capturedModel.contains(capturedModel.createResource("http://localhost/fcrepo/" + pid),
capturedModel.createProperty("info:a"),
Expand Down
Expand Up @@ -37,7 +37,7 @@
import javax.ws.rs.core.UriInfo;
import javax.ws.rs.core.Variant;

import org.fcrepo.kernel.rdf.GraphSubjects;
import org.fcrepo.kernel.rdf.IdentifierTranslator;
import org.fcrepo.kernel.services.RepositoryService;
import org.junit.Before;
import org.junit.Ignore;
Expand Down Expand Up @@ -84,7 +84,7 @@ public void testFieldSearch() throws RepositoryException {
when(
mockService
.searchRepository(
any(GraphSubjects.class),
any(IdentifierTranslator.class),
eq(createResource("http://localhost/fcrepo/fcr:search?q=ZZZ")),
eq(mockSession), eq("ZZZ"), eq(0), eq(0L)))
.thenReturn(createMem());
Expand All @@ -94,7 +94,7 @@ public void testFieldSearch() throws RepositoryException {

verify(mockService)
.searchRepository(
any(GraphSubjects.class),
any(IdentifierTranslator.class),
eq(createResource("http://localhost/fcrepo/fcr:search?q=ZZZ")),
eq(mockSession), eq("ZZZ"), eq(0), eq(0L));
}
Expand Down
Expand Up @@ -34,7 +34,7 @@
import javax.ws.rs.core.UriInfo;

import org.fcrepo.kernel.Datastream;
import org.fcrepo.kernel.rdf.GraphSubjects;
import org.fcrepo.kernel.rdf.IdentifierTranslator;
import org.fcrepo.kernel.services.DatastreamService;
import org.fcrepo.kernel.utils.iterators.RdfStream;
import org.junit.Before;
Expand Down Expand Up @@ -79,11 +79,11 @@ public void testGetDatastreamFixity() throws RepositoryException {
when(mockDs.getNode()).thenReturn(mockNode);
when(mockDatastreams.getDatastream(mockSession, path)).thenReturn(
mockDs);
when(mockDatastreams.getFixityResultsModel(any(GraphSubjects.class),
when(mockDatastreams.getFixityResultsModel(any(IdentifierTranslator.class),
eq(mockDs))).thenReturn(new RdfStream());
testObj.getDatastreamFixity(createPathList("objects", pid, "testDS"),
mockRequest, uriInfo);
verify(mockDatastreams).getFixityResultsModel(any(GraphSubjects.class),
verify(mockDatastreams).getFixityResultsModel(any(IdentifierTranslator.class),
eq(mockDs));
}
}
Expand Up @@ -72,7 +72,7 @@
import org.fcrepo.kernel.FedoraObject;
import org.fcrepo.kernel.FedoraResourceImpl;
import org.fcrepo.kernel.identifiers.PidMinter;
import org.fcrepo.kernel.rdf.GraphSubjects;
import org.fcrepo.kernel.rdf.IdentifierTranslator;
import org.fcrepo.kernel.services.DatastreamService;
import org.fcrepo.kernel.services.NodeService;
import org.fcrepo.kernel.services.ObjectService;
Expand Down Expand Up @@ -322,9 +322,9 @@ public void testDescribeObject() throws RepositoryException {
when(mockDataset.getContext()).thenReturn(mockContext);
when(mockObject.getLastModifiedDate()).thenReturn(mockDate);
when(mockObject.getEtagValue()).thenReturn("");
when(mockObject.getTriples(any(GraphSubjects.class))).thenReturn(
when(mockObject.getTriples(any(IdentifierTranslator.class))).thenReturn(
mockRdfStream);
when(mockObject.getHierarchyTriples(any(GraphSubjects.class))).thenReturn(
when(mockObject.getHierarchyTriples(any(IdentifierTranslator.class))).thenReturn(
mockRdfStream2);
when(mockNodes.getObject(isA(Session.class), isA(String.class)))
.thenReturn(mockObject);
Expand All @@ -349,9 +349,9 @@ public void testDescribeObjectNoInlining() throws RepositoryException {

when(mockObject.getEtagValue()).thenReturn("");
when(mockObject.getLastModifiedDate()).thenReturn(mockDate);
when(mockObject.getTriples(any(GraphSubjects.class))).thenReturn(
when(mockObject.getTriples(any(IdentifierTranslator.class))).thenReturn(
mockRdfStream);
when(mockObject.getHierarchyTriples(any(GraphSubjects.class))).thenReturn(
when(mockObject.getHierarchyTriples(any(IdentifierTranslator.class))).thenReturn(
mockRdfStream2);
when(mockNodes.getObject(isA(Session.class), isA(String.class)))
.thenReturn(mockObject);
Expand All @@ -371,7 +371,7 @@ public void testSparqlUpdate() throws RepositoryException, IOException {
final InputStream mockStream =
new ByteArrayInputStream("my-sparql-statement".getBytes());
when(mockNodes.getObject(mockSession, path)).thenReturn(mockObject);
when(mockObject.updatePropertiesDataset(any(GraphSubjects.class), any(String.class)))
when(mockObject.updatePropertiesDataset(any(IdentifierTranslator.class), any(String.class)))
.thenReturn(mockDataset);
when(mockObject.getEtagValue()).thenReturn("");

Expand All @@ -381,7 +381,7 @@ public void testSparqlUpdate() throws RepositoryException, IOException {
when(mockModel.isEmpty()).thenReturn(true);
testObj.updateSparql(createPathList(pid), getUriInfoImpl(), mockStream, mockRequest);

verify(mockObject).updatePropertiesDataset(any(GraphSubjects.class),
verify(mockObject).updatePropertiesDataset(any(IdentifierTranslator.class),
eq("my-sparql-statement"));
verify(mockSession).save();
verify(mockSession).logout();
Expand All @@ -402,7 +402,7 @@ public void testReplaceRdf() throws IllegalArgumentException, Exception {
when(mockNodes.getObject(mockSession, path)).thenReturn(mockObject);

testObj.createOrReplaceObjectRdf(createPathList(pid), getUriInfoImpl(), MediaType.valueOf("application/n3"), mockStream, mockRequest);
verify(mockObject).replaceProperties(any(GraphSubjects.class), any(Model.class));
verify(mockObject).replaceProperties(any(IdentifierTranslator.class), any(Model.class));
}

@Test
Expand All @@ -427,7 +427,7 @@ public void testCreateRdf() throws Exception {
assertNotNull(actual);
assertEquals(CREATED.getStatusCode(), actual.getStatus());
assertTrue(actual.getEntity().toString().endsWith(pid));
verify(mockObject).replaceProperties(any(GraphSubjects.class),
verify(mockObject).replaceProperties(any(IdentifierTranslator.class),
any(Model.class));
verify(mockObjects).createObject(mockSession, path);
verify(mockSession).save();
Expand Down
Expand Up @@ -32,7 +32,7 @@
import javax.jcr.Session;

import org.fcrepo.kernel.FedoraObject;
import org.fcrepo.kernel.rdf.GraphSubjects;
import org.fcrepo.kernel.rdf.IdentifierTranslator;
import org.fcrepo.kernel.services.NodeService;
import org.junit.Before;
import org.junit.Test;
Expand Down Expand Up @@ -71,11 +71,11 @@ public void testSparqlUpdate() throws RepositoryException, IOException {
new ByteArrayInputStream("my-sparql-statement".getBytes());
when(mockNodes.getObject(mockSession, "/")).thenReturn(mockObject);
when(
mockObject.updatePropertiesDataset(any(GraphSubjects.class),
mockObject.updatePropertiesDataset(any(IdentifierTranslator.class),
any(String.class))).thenReturn(mockDataset);
testObj.updateSparql(mockStream);

verify(mockObject).updatePropertiesDataset(any(GraphSubjects.class),
verify(mockObject).updatePropertiesDataset(any(IdentifierTranslator.class),
eq("my-sparql-statement"));
verify(mockSession).save();
verify(mockSession).logout();
Expand Down
Expand Up @@ -41,7 +41,7 @@
import org.fcrepo.http.api.FedoraNodes;
import org.fcrepo.http.commons.api.rdf.HttpGraphSubjects;
import org.fcrepo.kernel.FedoraResourceImpl;
import org.fcrepo.kernel.rdf.GraphSubjects;
import org.fcrepo.kernel.rdf.IdentifierTranslator;
import org.fcrepo.serialization.SerializerUtil;
import org.junit.Before;
import org.junit.Test;
Expand Down Expand Up @@ -70,7 +70,7 @@ public class HttpApiResourcesTest {
@Mock
private NodeType mockNodeType;

private GraphSubjects mockSubjects;
private IdentifierTranslator mockSubjects;

@Mock
private SerializerUtil mockSerializers;
Expand Down
Expand Up @@ -29,7 +29,7 @@
import org.fcrepo.http.commons.session.SessionFactory;
import org.fcrepo.kernel.FedoraResource;
import org.fcrepo.kernel.identifiers.PidMinter;
import org.fcrepo.kernel.rdf.GraphSubjects;
import org.fcrepo.kernel.rdf.IdentifierTranslator;
import org.fcrepo.kernel.services.DatastreamService;
import org.fcrepo.kernel.services.NodeService;
import org.fcrepo.kernel.services.ObjectService;
Expand Down Expand Up @@ -152,7 +152,7 @@ public static final String toPath(final List<PathSegment> paths) {

protected void addResponseInformationToStream(
final FedoraResource resource, final RdfStream dataset,
final UriInfo uriInfo, final GraphSubjects subjects)
final UriInfo uriInfo, final IdentifierTranslator subjects)
throws RepositoryException {
if (httpTripleUtil != null) {
httpTripleUtil.addHttpComponentModelsForResourceToStream(dataset, resource,
Expand Down
Expand Up @@ -20,7 +20,7 @@
import com.hp.hpl.jena.rdf.model.Resource;

import org.fcrepo.kernel.exception.RepositoryRuntimeException;
import org.fcrepo.kernel.rdf.GraphSubjects;
import org.fcrepo.kernel.rdf.IdentifierTranslator;
import org.fcrepo.kernel.services.functions.GetDefaultWorkspace;
import org.slf4j.Logger;

Expand Down Expand Up @@ -56,7 +56,7 @@
* </ul>
*
*/
public class HttpGraphSubjects implements GraphSubjects {
public class HttpGraphSubjects implements IdentifierTranslator {

private static final Logger LOGGER = getLogger(HttpGraphSubjects.class);
public static final String WORKSPACE_PREFIX = "workspace:";
Expand Down

0 comments on commit 6ea0d00

Please sign in to comment.