Navigation Menu

Skip to content

Commit

Permalink
Renamed GraphSubjects to IsTranslator
Browse files Browse the repository at this point in the history
  • Loading branch information
ajs6f committed Oct 23, 2013
1 parent b225254 commit bc8cf50
Show file tree
Hide file tree
Showing 41 changed files with 108 additions and 108 deletions.
Expand Up @@ -44,7 +44,7 @@
import org.fcrepo.http.commons.api.rdf.UriAwareResourceModelFactory;
import org.fcrepo.jcr.FedoraJcrTypes;
import org.fcrepo.kernel.FedoraResource;
import org.fcrepo.kernel.rdf.GraphSubjects;
import org.fcrepo.kernel.rdf.IdTranslator;
import org.fcrepo.serialization.SerializerUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
Expand All @@ -63,7 +63,7 @@ public class HttpApiResources implements UriAwareResourceModelFactory {

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

final Model model = createDefaultModel();
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.IdTranslator;
import org.fcrepo.kernel.services.NodeService;
import org.junit.Before;
import org.junit.Test;
Expand Down Expand Up @@ -84,7 +84,7 @@ public void testFieldSearch() throws RepositoryException {
when(
mockNodeService
.searchRepository(
any(GraphSubjects.class),
any(IdTranslator.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(mockNodeService)
.searchRepository(
any(GraphSubjects.class),
any(IdTranslator.class),
eq(ResourceFactory
.createResource("http://localhost/fcrepo/fcr:search?q=ZZZ")),
eq(mockSession), eq("ZZZ"), eq(0), eq(0L));
Expand Down
Expand Up @@ -36,7 +36,7 @@
import javax.ws.rs.core.UriInfo;

import org.fcrepo.kernel.Datastream;
import org.fcrepo.kernel.rdf.GraphSubjects;
import org.fcrepo.kernel.rdf.IdTranslator;
import org.fcrepo.kernel.services.DatastreamService;
import org.junit.Before;
import org.junit.Test;
Expand Down Expand Up @@ -83,7 +83,7 @@ public void testGetDatastreamFixity() throws RepositoryException,
mockDs);
testObj.getDatastreamFixity(createPathList("objects", pid, "testDS"),
mockRequest, uriInfo);
verify(mockDatastreams).getFixityResultsModel(any(GraphSubjects.class),
verify(mockDatastreams).getFixityResultsModel(any(IdTranslator.class),
eq(mockDs));
}
}
Expand Up @@ -61,7 +61,7 @@
import org.fcrepo.kernel.exception.InvalidChecksumException;
import org.fcrepo.kernel.identifiers.PidMinter;
import org.fcrepo.kernel.rdf.GraphProperties;
import org.fcrepo.kernel.rdf.GraphSubjects;
import org.fcrepo.kernel.rdf.IdTranslator;
import org.fcrepo.kernel.services.DatastreamService;
import org.fcrepo.kernel.services.NodeService;
import org.fcrepo.kernel.services.ObjectService;
Expand Down Expand Up @@ -254,7 +254,7 @@ public void testDescribeObject() throws RepositoryException, IOException {

when(mockObject.getEtagValue()).thenReturn("");
when(
mockObject.getPropertiesDataset(any(GraphSubjects.class),
mockObject.getPropertiesDataset(any(IdTranslator.class),
anyLong(), anyInt())).thenReturn(mockDataset);
when(mockNodes.getObject(isA(Session.class), isA(String.class)))
.thenReturn(mockObject);
Expand All @@ -277,7 +277,7 @@ public void testDescribeObjectNoInlining() throws RepositoryException, IOExcepti

when(mockObject.getEtagValue()).thenReturn("");
when(
mockObject.getPropertiesDataset(any(GraphSubjects.class),
mockObject.getPropertiesDataset(any(IdTranslator.class),
anyLong(), eq(-2))).thenReturn(mockDataset);
when(mockNodes.getObject(isA(Session.class), isA(String.class)))
.thenReturn(mockObject);
Expand All @@ -296,7 +296,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(IdTranslator.class), any(String.class)))
.thenReturn(mockDataset);
when(mockObject.getEtagValue()).thenReturn("");

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

verify(mockObject).updatePropertiesDataset(any(GraphSubjects.class),
verify(mockObject).updatePropertiesDataset(any(IdTranslator.class),
eq("my-sparql-statement"));
verify(mockSession).save();
verify(mockSession).logout();
Expand All @@ -325,7 +325,7 @@ public void testReplaceRdf() throws RepositoryException, IOException, URISyntaxE
when(mockNodes.getObject(mockSession, path)).thenReturn(mockObject);

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

}
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.IdTranslator;
import org.fcrepo.kernel.services.NodeService;
import org.junit.Before;
import org.junit.Test;
Expand Down Expand Up @@ -70,11 +70,11 @@ public void testSparqlUpdate() throws RepositoryException, IOException {
final InputStream mockStream =
new ByteArrayInputStream("my-sparql-statement".getBytes());
when(mockNodes.getObject(mockSession, "/")).thenReturn(mockObject);
when(mockObject.updatePropertiesDataset(any(GraphSubjects.class), any(String.class)))
when(mockObject.updatePropertiesDataset(any(IdTranslator.class), any(String.class)))
.thenReturn(mockDataset);
testObj.updateSparql(mockStream);

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

private GraphSubjects mockSubjects;
private IdTranslator mockSubjects;

@Mock
private SerializerUtil mockSerializers;
Expand Down
Expand Up @@ -49,7 +49,7 @@
import org.fcrepo.kernel.FedoraResource;
import org.fcrepo.kernel.exception.InvalidChecksumException;
import org.fcrepo.kernel.identifiers.PidMinter;
import org.fcrepo.kernel.rdf.GraphSubjects;
import org.fcrepo.kernel.rdf.IdTranslator;
import org.fcrepo.kernel.services.DatastreamService;
import org.fcrepo.kernel.services.NodeService;
import org.fcrepo.kernel.services.ObjectService;
Expand Down Expand Up @@ -176,7 +176,7 @@ public static final String toPath(final List<PathSegment> paths) {

protected FedoraResource createObjectOrDatastreamFromRequestContent(
final Session session,
final String path, final String mixin, final GraphSubjects subjects,
final String path, final String mixin, final IdTranslator subjects,
final InputStream requestBodyStream,
final MediaType requestContentType,
final URI checksum) throws RepositoryException,
Expand Down Expand Up @@ -237,7 +237,7 @@ protected FedoraResource createObjectOrDatastreamFromRequestContent(

protected void addResponseInformationToDataset(
final FedoraResource resource, final Dataset dataset,
final UriInfo uriInfo, final GraphSubjects subjects)
final UriInfo uriInfo, final IdTranslator subjects)
throws RepositoryException {
if (httpTripleUtil != null) {
httpTripleUtil.addHttpComponentModelsForResource(dataset, resource,
Expand Down
Expand Up @@ -30,7 +30,7 @@
import javax.ws.rs.core.UriBuilder;
import javax.ws.rs.core.UriInfo;

import org.fcrepo.kernel.rdf.GraphSubjects;
import org.fcrepo.kernel.rdf.IdTranslator;
import org.fcrepo.kernel.services.TransactionService;
import org.fcrepo.jcr.FedoraJcrTypes;
import org.modeshape.jcr.api.JcrConstants;
Expand All @@ -44,7 +44,7 @@
/**
* Translate JCR paths to URLs to the given class
*/
public class HttpGraphSubjects implements GraphSubjects {
public class HttpGraphSubjects implements IdTranslator {

private static final Logger LOGGER = LoggerFactory
.getLogger(HttpGraphSubjects.class);
Expand Down
Expand Up @@ -24,7 +24,7 @@
import javax.ws.rs.core.UriInfo;

import org.fcrepo.kernel.FedoraResource;
import org.fcrepo.kernel.rdf.GraphSubjects;
import org.fcrepo.kernel.rdf.IdTranslator;
import org.slf4j.Logger;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
Expand Down Expand Up @@ -61,7 +61,7 @@ public void setApplicationContext(ApplicationContext applicationContext)
*/
public void addHttpComponentModelsForResource(Dataset dataset,
FedoraResource resource, UriInfo uriInfo,
GraphSubjects graphSubjects) throws RepositoryException {
IdTranslator graphSubjects) throws RepositoryException {

LOGGER.debug("Adding additional HTTP context triples to dataset");
for (final Map.Entry<String, UriAwareResourceModelFactory> e : getUriAwareTripleFactories()
Expand Down
Expand Up @@ -20,7 +20,7 @@
import javax.ws.rs.core.UriInfo;

import org.fcrepo.kernel.FedoraResource;
import org.fcrepo.kernel.rdf.GraphSubjects;
import org.fcrepo.kernel.rdf.IdTranslator;

import com.hp.hpl.jena.rdf.model.Model;

Expand All @@ -42,6 +42,6 @@ public interface UriAwareResourceModelFactory {
* @throws RepositoryException
*/
Model createModelForResource(final FedoraResource resource,
final UriInfo uriInfo, GraphSubjects graphSubjects)
final UriInfo uriInfo, IdTranslator graphSubjects)
throws RepositoryException;
}
Expand Up @@ -31,7 +31,7 @@
import org.fcrepo.http.commons.api.rdf.HttpTripleUtil;
import org.fcrepo.http.commons.api.rdf.UriAwareResourceModelFactory;
import org.fcrepo.kernel.FedoraResource;
import org.fcrepo.kernel.rdf.GraphSubjects;
import org.fcrepo.kernel.rdf.IdTranslator;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
Expand All @@ -51,7 +51,7 @@ public class HttpTripleUtilTest {
private UriInfo mockUriInfo;

@Mock
private GraphSubjects mockSubjects;
private IdTranslator mockSubjects;

@Mock
private UriAwareResourceModelFactory mockBean1;
Expand Down
Expand Up @@ -40,7 +40,7 @@

import org.fcrepo.jcr.FedoraJcrTypes;
import org.fcrepo.kernel.rdf.GraphProperties;
import org.fcrepo.kernel.rdf.GraphSubjects;
import org.fcrepo.kernel.rdf.IdTranslator;
import org.fcrepo.kernel.rdf.impl.JcrGraphProperties;
import org.fcrepo.kernel.utils.JcrRdfTools;
import org.modeshape.jcr.api.JcrTools;
Expand Down Expand Up @@ -214,7 +214,7 @@ public Collection<String> getModels() throws RepositoryException {
* @param sparqlUpdateStatement
* @throws RepositoryException
*/
public Dataset updatePropertiesDataset(final GraphSubjects subjects,
public Dataset updatePropertiesDataset(final IdTranslator subjects,
final String sparqlUpdateStatement) throws RepositoryException {
final Dataset dataset = getPropertiesDataset(subjects, 0, 0);
final UpdateRequest request =
Expand All @@ -235,7 +235,7 @@ public Dataset updatePropertiesDataset(final GraphSubjects subjects,
* @return
* @throws RepositoryException
*/
public Dataset getPropertiesDataset(final GraphSubjects subjects,
public Dataset getPropertiesDataset(final IdTranslator subjects,
final long offset, final int limit)
throws RepositoryException {

Expand All @@ -252,7 +252,7 @@ public Dataset getPropertiesDataset(final GraphSubjects subjects,
* @return
* @throws RepositoryException
*/
public Dataset getPropertiesDataset(final GraphSubjects subjects)
public Dataset getPropertiesDataset(final IdTranslator subjects)
throws RepositoryException {
return getPropertiesDataset(subjects, 0, -1);
}
Expand All @@ -263,7 +263,7 @@ public Dataset getPropertiesDataset(final GraphSubjects subjects)
* @return
* @throws RepositoryException
*/
public Dataset getVersionDataset(final GraphSubjects subjects)
public Dataset getVersionDataset(final IdTranslator subjects)
throws RepositoryException {
final Model model =
JcrRdfTools.withContext(subjects, node.getSession())
Expand Down Expand Up @@ -308,7 +308,7 @@ public boolean isNew() {
* @return
* @throws RepositoryException
*/
public Dataset replacePropertiesDataset(final GraphSubjects subjects,
public Dataset replacePropertiesDataset(final IdTranslator subjects,
final Model inputModel) throws RepositoryException {
final Dataset propertiesDataset = getPropertiesDataset(subjects, 0, -2);
final Model model = propertiesDataset.getDefaultModel();
Expand Down
Expand Up @@ -54,7 +54,7 @@ public interface GraphProperties {
* @return
* @throws RepositoryException
*/
Dataset getProperties(final Node node, final GraphSubjects subjects,
Dataset getProperties(final Node node, final IdTranslator subjects,
final long offset, final int limit) throws RepositoryException;

/**
Expand All @@ -65,6 +65,6 @@ Dataset getProperties(final Node node, final GraphSubjects subjects,
* @return
* @throws RepositoryException
*/
Dataset getProperties(final Node node, final GraphSubjects subjects)
Dataset getProperties(final Node node, final IdTranslator subjects)
throws RepositoryException;
}
Expand Up @@ -26,7 +26,7 @@
* @author barmintor
* @date May 15, 2013
*/
public interface GraphSubjects {
public interface IdTranslator {
/**
* Translate a JCR node into an RDF Resource
* @param node
Expand Down
Expand Up @@ -32,7 +32,7 @@ public abstract class NodeRdfContext extends RdfStream {

private final Node node;

private final GraphSubjects graphSubjects;
private final IdTranslator graphSubjects;

private final com.hp.hpl.jena.graph.Node subject;

Expand All @@ -45,7 +45,7 @@ public abstract class NodeRdfContext extends RdfStream {
* @param graphSubjects
* @throws RepositoryException
*/
public NodeRdfContext(final Node node, final GraphSubjects graphSubjects, final LowLevelStorageService lowLevelStorageService) throws RepositoryException {
public NodeRdfContext(final Node node, final IdTranslator graphSubjects, final LowLevelStorageService lowLevelStorageService) throws RepositoryException {
super();
this.node = node;
this.graphSubjects = graphSubjects;
Expand All @@ -72,9 +72,9 @@ public Node node() {
}

/**
* @return local {@link GraphSubjects}
* @return local {@link IdTranslator}
*/
public GraphSubjects graphSubjects() {
public IdTranslator graphSubjects() {
return graphSubjects;
}

Expand Down
Expand Up @@ -26,7 +26,7 @@
import javax.jcr.RepositoryException;
import javax.jcr.Session;

import org.fcrepo.kernel.rdf.GraphSubjects;
import org.fcrepo.kernel.rdf.IdTranslator;
import org.slf4j.Logger;

import com.hp.hpl.jena.rdf.model.Resource;
Expand All @@ -37,7 +37,7 @@
* @author barmintor
* @date May 15, 2013
*/
public class DefaultGraphSubjects implements GraphSubjects {
public class DefaultGraphSubjects implements IdTranslator {

private final Resource context;
private final Session session;
Expand Down

0 comments on commit bc8cf50

Please sign in to comment.