Skip to content

Commit

Permalink
Starting to factor interfaces out of kernel into API
Browse files Browse the repository at this point in the history
  • Loading branch information
ajs6f committed Jan 16, 2014
1 parent 70537ff commit 6eb2e6e
Show file tree
Hide file tree
Showing 37 changed files with 476 additions and 210 deletions.
Expand Up @@ -45,7 +45,7 @@ public class AccessRolesResources implements UriAwareResourceModelFactory {
/*
* (non-Javadoc)
* @see org.fcrepo.http.commons.api.rdf.UriAwareResourceModelFactory#
* createModelForResource( org.fcrepo.kernel.FedoraResource,
* createModelForResource( org.fcrepo.kernel.FedoraResourceImpl,
* javax.ws.rs.core.UriInfo, org.fcrepo.kernel.rdf.GraphSubjects)
*/
@Override
Expand Down
Expand Up @@ -31,7 +31,7 @@
import javax.jcr.RepositoryException;
import javax.jcr.Session;

import org.fcrepo.kernel.FedoraResource;
import org.fcrepo.kernel.FedoraResourceImpl;
import org.fcrepo.generator.dublincore.DCGenerator;
import org.fcrepo.kernel.services.NodeService;
import org.junit.Before;
Expand Down Expand Up @@ -63,7 +63,7 @@ public void setUp() throws RepositoryException, NoSuchFieldException {
public void testGetObjectAsDublinCore() throws RepositoryException {
testObj.dcgenerators = asList(mockGenerator);
final InputStream mockIS = mock(InputStream.class);
final FedoraResource mockResource = mock(FedoraResource.class);
final FedoraResourceImpl mockResource = mock(FedoraResourceImpl.class);
when(mockResource.getNode()).thenReturn(mock(Node.class));
when(mockNodeService.getObject(mockSession, "/objects/foo"))
.thenReturn(mockResource);
Expand Down
Expand Up @@ -288,7 +288,7 @@ public Response batchModify(@PathParam("path") final List<PathSegment> pathList,

session.save();
versionService.nodeUpdated(session, path);
for (Node n : nodesChanged) {
for (final Node n : nodesChanged) {
versionService.nodeUpdated(n);
}

Expand Down
Expand Up @@ -95,6 +95,7 @@
import org.fcrepo.http.commons.domain.COPY;
import org.fcrepo.http.commons.session.InjectedSession;
import org.fcrepo.kernel.Datastream;
import org.fcrepo.kernel.FedoraResourceImpl;
import org.fcrepo.kernel.FedoraResource;
import org.fcrepo.kernel.exception.InvalidChecksumException;
import org.fcrepo.kernel.rdf.GraphSubjects;
Expand Down Expand Up @@ -446,7 +447,7 @@ public Response createObject(@PathParam("path")
}
}

final FedoraResource result;
final FedoraResourceImpl result;

switch (objectType) {
case FEDORA_OBJECT:
Expand Down
Expand Up @@ -127,7 +127,7 @@ public Response addVersion(@PathParam("path")
return addVersion(toPath(pathList), null);
}

private Response addVersion(String path, String label) throws RepositoryException {
private Response addVersion(final String path, final String label) throws RepositoryException {
try {
final FedoraResource resource =
nodeService.getObject(session, path);
Expand Down
Expand Up @@ -62,7 +62,7 @@
import com.hp.hpl.jena.rdf.model.Model;
import org.apache.commons.io.IOUtils;
import org.fcrepo.kernel.Datastream;
import org.fcrepo.kernel.FedoraResource;
import org.fcrepo.kernel.FedoraResourceImpl;
import org.fcrepo.kernel.rdf.GraphSubjects;
import org.fcrepo.kernel.services.DatastreamService;
import org.fcrepo.kernel.services.NodeService;
Expand Down Expand Up @@ -95,7 +95,7 @@ public class FedoraBatchTest {
private Node mockDsNode;

@Mock
private FedoraResource mockObject;
private FedoraResourceImpl mockObject;

@Mock
private NodeIterator mockIterator;
Expand Down
Expand Up @@ -68,7 +68,7 @@
import org.apache.commons.io.IOUtils;
import org.fcrepo.kernel.Datastream;
import org.fcrepo.kernel.FedoraObject;
import org.fcrepo.kernel.FedoraResource;
import org.fcrepo.kernel.FedoraResourceImpl;
import org.fcrepo.kernel.identifiers.PidMinter;
import org.fcrepo.kernel.rdf.GraphSubjects;
import org.fcrepo.kernel.services.DatastreamService;
Expand Down Expand Up @@ -109,7 +109,7 @@ public class FedoraNodesTest {
private Request mockRequest;

@Mock
private FedoraResource mockResource;
private FedoraResourceImpl mockResource;

Session mockSession;

Expand Down
Expand Up @@ -43,7 +43,7 @@

import org.fcrepo.http.commons.api.rdf.HttpGraphSubjects;
import org.fcrepo.http.commons.test.util.TestHelpers;
import org.fcrepo.kernel.FedoraResource;
import org.fcrepo.kernel.FedoraResourceImpl;
import org.fcrepo.kernel.rdf.GraphSubjects;
import org.fcrepo.kernel.services.NodeService;
import org.fcrepo.kernel.services.VersionService;
Expand Down Expand Up @@ -71,7 +71,7 @@ public class FedoraVersionsTest {
private Session mockSession;

@Mock
private FedoraResource mockResource;
private FedoraResourceImpl mockResource;

private RdfStream mockRdfStream = new RdfStream();

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.FedoraResourceImpl;
import org.fcrepo.kernel.rdf.GraphSubjects;
import org.fcrepo.serialization.SerializerUtil;
import org.junit.Before;
Expand All @@ -63,7 +63,7 @@ public class HttpApiResourcesTest {
@Mock
private Node mockNode;

private FedoraResource mockResource;
private FedoraResourceImpl mockResource;

private UriInfo uriInfo;

Expand All @@ -85,7 +85,7 @@ public class HttpApiResourcesTest {
public void setUp() throws NoSuchFieldException {
initMocks(this);
testObj = new HttpApiResources();
mockResource = new FedoraResource(mockNode);
mockResource = new FedoraResourceImpl(mockNode);
uriInfo = getUriInfoImpl();
when(mockSession.getRepository()).thenReturn(mockRepository);
mockSubjects =
Expand Down
1 change: 0 additions & 1 deletion fcrepo-http-commons/.gitignore
@@ -1,2 +1 @@
/target
/target
Expand Up @@ -23,6 +23,7 @@
import javax.jcr.RepositoryException;
import javax.ws.rs.core.UriInfo;

import org.fcrepo.kernel.FedoraResourceImpl;
import org.fcrepo.kernel.FedoraResource;
import org.fcrepo.kernel.rdf.GraphSubjects;
import org.fcrepo.kernel.utils.iterators.RdfStream;
Expand Down Expand Up @@ -53,13 +54,13 @@ public void setApplicationContext(final ApplicationContext applicationContext) {
* Add additional models to the RDF dataset for the given resource
*
* @param dataset the source dataset we'll add named models to
* @param resource the FedoraResource in question
* @param resource the FedoraResourceImpl in question
* @param uriInfo a JAX-RS UriInfo object to build URIs to resources
* @param graphSubjects
* @throws RepositoryException
*/
public void addHttpComponentModelsForResource(final Dataset dataset,
final FedoraResource resource, final UriInfo uriInfo,
final FedoraResourceImpl resource, final UriInfo uriInfo,
final GraphSubjects graphSubjects) throws RepositoryException {

LOGGER.debug("Adding additional HTTP context triples to dataset");
Expand All @@ -82,7 +83,7 @@ public void addHttpComponentModelsForResource(final Dataset dataset,
* Add additional models to the RDF dataset for the given resource
*
* @param rdfStream the source stream we'll add named models to
* @param resource the FedoraResource in question
* @param resource the FedoraResourceImpl in question
* @param uriInfo a JAX-RS UriInfo object to build URIs to resources
* @param graphSubjects
* @throws RepositoryException
Expand Down
Expand Up @@ -25,7 +25,7 @@
import com.hp.hpl.jena.rdf.model.Model;

/**
* Helper to generate an RDF model for a FedoraResource that (likely) creates
* Helper to generate an RDF model for a FedoraResourceImpl that (likely) creates
* relations from our resource to other HTTP components
*/
public interface UriAwareResourceModelFactory {
Expand All @@ -42,6 +42,6 @@ public interface UriAwareResourceModelFactory {
* @throws RepositoryException
*/
Model createModelForResource(final FedoraResource resource,
final UriInfo uriInfo, GraphSubjects graphSubjects)
final UriInfo uriInfo, final GraphSubjects graphSubjects)
throws RepositoryException;
}
Expand Up @@ -30,7 +30,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.FedoraResourceImpl;
import org.fcrepo.kernel.rdf.GraphSubjects;
import org.junit.Before;
import org.junit.Test;
Expand Down Expand Up @@ -63,7 +63,7 @@ public class HttpTripleUtilTest {
private ApplicationContext mockContext;

@Mock
private FedoraResource mockResource;
private FedoraResourceImpl mockResource;

@Before
public void setUp() {
Expand Down
15 changes: 15 additions & 0 deletions fcrepo-kernel-api/pom.xml
Expand Up @@ -41,6 +41,21 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.jena</groupId>
<artifactId>jena-arq</artifactId>
<version>${jena.version}</version>
<exclusions>
<exclusion>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</exclusion>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>javax.jcr</groupId>
<artifactId>jcr</artifactId>
Expand Down

0 comments on commit 6eb2e6e

Please sign in to comment.