Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move modeshape-specific code out of the kernel-api #882

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -15,7 +15,7 @@
*/
package org.fcrepo.auth.common;

import static org.fcrepo.kernel.api.FedoraJcrTypes.JCR_CONTENT;
import static org.modeshape.jcr.api.JcrConstants.JCR_CONTENT;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The initial intent of this work was to remove dependencies from other modules on the "fcrepo-kernel-modeshape" module. This particular refactoring seems to be moving in the opposite direction.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I disagree. The core issue is this: isolate all modeshape-related code in the fcrepo-kernel-modeshape module. And in order to achieve this, there are two primary issues to resolve.

First, this means removing all modeshape-specific code from fcrepo-kernel-api where it most certainly does not belong. That is the primary goal of this particular PR. And IMO it is the right place to begin.

The second part of the issue relates to removing specific dependencies on fcrepo-kernel-modeshape. The central issue here relates to how RdfStream::getTriples is used (See related issue at https://jira.duraspace.org/browse/FCREPO-1312). That is, a class that calls RdfStream::getTriples must pass in a class from the org.fcrepo.kernel.modeshape.rdf.impl package. See, for example here: http://git.io/v8DUq, where the fcrepo-http-api module is completely tied to the fcrepo-kernel-modeshape module. That sort of interdependence will need to change; but it should be a separate effort (separate from this PR).

In this particular case: fcrepo-auth-common is already entirely bound to modeshape, so using a JCR-related constant from org.modeshape.jcr.api instead of org.fcrepo.kernel.api makes perfect sense to me.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with @acoburn on this, and I ask him to please create a ticket for that refactoring to get dependence on org.fcrepo.kernel.modeshape.rdf.impl out of the kernel. That was a gross oversight for which I think I can mostly be blamed. @cbeer wrote that, but I convinced him that it was a good idea. It was a good idea, but not good enough. We need to completely rethink the RDF generation subsystem in light of these things:

  1. The new Java 8 Streams API
  2. Our desire to refactor JCR into invisibility.
  3. Our need to produce a specification that can be reimplemented in a practical way.

Let me further suggest. along the lines of @acoburn 's argument, that this module actually be renamed fcrepo-auth-common-modeshape.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The argument here makes sense. Can you also describe how this current PR moves us in the direction of the "parent" ticket:
https://jira.duraspace.org/browse/FCREPO-1694 : "Ensure that no non-deployable module compile-depends on fcrepo-kernel-modeshape"
...or maybe the intent/title of the above ticket is simply misleading.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is confused. I had forgotten about the relationship between authN and MODE. We can alter the title to be more precise and therefore accurate. Did I miss anything other than authN?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

find . -name 'pom.xml' -exec grep -H "fcrepo-kernel-modeshape" "{}" \;
results in:

./fcrepo-kernel-modeshape/pom.xml:  <artifactId>fcrepo-kernel-modeshape</artifactId>
./fcrepo-connector-file/pom.xml:      <artifactId>fcrepo-kernel-modeshape</artifactId>
./fcrepo-auth-common/pom.xml:      <artifactId>fcrepo-kernel-modeshape</artifactId>
./fcrepo-http-api/pom.xml:      <artifactId>fcrepo-kernel-modeshape</artifactId>
./fcrepo-http-api/pom.xml:      <artifactId>fcrepo-kernel-modeshape</artifactId>
./pom.xml:    <module>fcrepo-kernel-modeshape</module>
./fcrepo-webapp/pom.xml:      <artifactId>fcrepo-kernel-modeshape</artifactId>
./fcrepo-http-commons/pom.xml:      <artifactId>fcrepo-kernel-modeshape</artifactId>
./fcrepo-boms/fcrepo4-bom/pom.xml:        <artifactId>fcrepo-kernel-modeshape</artifactId>
./fcrepo-jms/pom.xml:      <artifactId>fcrepo-kernel-modeshape</artifactId>

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fcrepo-jms has a test-dependency, which doesn't matter. It would be expected that fcrepo-webapp depends on the modeshape impl. Both fcrepo-connector-file and fcrepo-auth-common have a special relationship to modeshape and should remain as they are. The only concerning dependencies are fcrepo-http-api and fcrepo-http-commons.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, I believe that fcrepo-audit depends on fcrepo-kernel-modeshape (in the same way fcrepo-http-api does).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is that a test dependency?


import java.security.Principal;

Expand Down
Expand Up @@ -15,14 +15,14 @@
*/
package org.fcrepo.auth.common;

import static org.fcrepo.kernel.api.FedoraJcrTypes.JCR_CONTENT;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import static org.modeshape.jcr.api.JcrConstants.JCR_CONTENT;

import java.security.Principal;

Expand Down
Expand Up @@ -16,15 +16,15 @@
package org.fcrepo.connector.file;

import static java.lang.System.currentTimeMillis;
import static org.fcrepo.kernel.api.FedoraJcrTypes.CONTENT_DIGEST;
import static org.fcrepo.kernel.api.FedoraJcrTypes.CONTENT_SIZE;
import static org.fcrepo.kernel.api.FedoraJcrTypes.FEDORA_BINARY;
import static org.fcrepo.kernel.api.FedoraJcrTypes.FEDORA_CONTAINER;
import static org.fcrepo.kernel.api.FedoraJcrTypes.FEDORA_NON_RDF_SOURCE_DESCRIPTION;
import static org.fcrepo.kernel.api.FedoraJcrTypes.FEDORA_RESOURCE;
import static org.fcrepo.kernel.api.FedoraJcrTypes.JCR_CREATED;
import static org.fcrepo.kernel.api.FedoraJcrTypes.JCR_LASTMODIFIED;
import static org.fcrepo.kernel.api.FedoraTypes.CONTENT_DIGEST;
import static org.fcrepo.kernel.api.FedoraTypes.CONTENT_SIZE;
import static org.fcrepo.kernel.api.FedoraTypes.FEDORA_BINARY;
import static org.fcrepo.kernel.api.FedoraTypes.FEDORA_CONTAINER;
import static org.fcrepo.kernel.api.FedoraTypes.FEDORA_NON_RDF_SOURCE_DESCRIPTION;
import static org.fcrepo.kernel.api.FedoraTypes.FEDORA_RESOURCE;
import static org.fcrepo.kernel.api.utils.ContentDigest.asURI;
import static org.fcrepo.kernel.modeshape.FedoraJcrConstants.JCR_CREATED;
import static org.fcrepo.kernel.modeshape.FedoraJcrConstants.JCR_LASTMODIFIED;
import static org.modeshape.jcr.api.JcrConstants.JCR_DATA;
import static org.modeshape.jcr.api.JcrConstants.NT_FILE;
import static org.modeshape.jcr.api.JcrConstants.NT_FOLDER;
Expand Down
Expand Up @@ -17,7 +17,7 @@

import static java.nio.file.Files.createTempDirectory;
import static java.nio.file.Files.createTempFile;
import static org.fcrepo.kernel.api.FedoraJcrTypes.CONTENT_DIGEST;
import static org.fcrepo.kernel.api.FedoraTypes.CONTENT_DIGEST;
import static org.fcrepo.kernel.api.RdfLexicon.REPOSITORY_NAMESPACE;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
Expand Down
Expand Up @@ -22,10 +22,10 @@
import static java.nio.file.Files.write;
import static java.util.Arrays.asList;
import static com.google.common.collect.Lists.transform;
import static org.fcrepo.kernel.api.FedoraJcrTypes.CONTENT_SIZE;
import static org.fcrepo.kernel.api.FedoraJcrTypes.FEDORA_BINARY;
import static org.fcrepo.kernel.api.FedoraJcrTypes.FEDORA_NON_RDF_SOURCE_DESCRIPTION;
import static org.fcrepo.kernel.api.FedoraJcrTypes.FEDORA_CONTAINER;
import static org.fcrepo.kernel.api.FedoraTypes.CONTENT_SIZE;
import static org.fcrepo.kernel.api.FedoraTypes.FEDORA_BINARY;
import static org.fcrepo.kernel.api.FedoraTypes.FEDORA_NON_RDF_SOURCE_DESCRIPTION;
import static org.fcrepo.kernel.api.FedoraTypes.FEDORA_CONTAINER;
import static org.fcrepo.kernel.api.RdfLexicon.HAS_MESSAGE_DIGEST;
import static org.fcrepo.kernel.api.utils.ContentDigest.asURI;
import static org.junit.Assert.assertEquals;
Expand Down
Expand Up @@ -31,9 +31,9 @@
import static org.apache.commons.lang3.StringUtils.isBlank;
import static org.apache.jena.riot.RDFLanguages.contentTypeToLang;

import static org.fcrepo.kernel.api.FedoraJcrTypes.LDP_BASIC_CONTAINER;
import static org.fcrepo.kernel.api.FedoraJcrTypes.LDP_DIRECT_CONTAINER;
import static org.fcrepo.kernel.api.FedoraJcrTypes.LDP_INDIRECT_CONTAINER;
import static org.fcrepo.kernel.api.FedoraTypes.LDP_BASIC_CONTAINER;
import static org.fcrepo.kernel.api.FedoraTypes.LDP_DIRECT_CONTAINER;
import static org.fcrepo.kernel.api.FedoraTypes.LDP_INDIRECT_CONTAINER;
import static org.fcrepo.kernel.api.RdfLexicon.BASIC_CONTAINER;
import static org.fcrepo.kernel.api.RdfLexicon.CONTAINER;
import static org.fcrepo.kernel.api.RdfLexicon.DIRECT_CONTAINER;
Expand Down
Expand Up @@ -38,9 +38,9 @@
import static org.fcrepo.http.commons.domain.RDFMediaType.RDF_XML;
import static org.fcrepo.http.commons.domain.RDFMediaType.TURTLE;
import static org.fcrepo.http.commons.domain.RDFMediaType.TURTLE_X;
import static org.fcrepo.kernel.api.FedoraJcrTypes.FEDORA_BINARY;
import static org.fcrepo.kernel.api.FedoraJcrTypes.FEDORA_CONTAINER;
import static org.fcrepo.kernel.api.FedoraJcrTypes.FEDORA_PAIRTREE;
import static org.fcrepo.kernel.api.FedoraTypes.FEDORA_BINARY;
import static org.fcrepo.kernel.api.FedoraTypes.FEDORA_CONTAINER;
import static org.fcrepo.kernel.api.FedoraTypes.FEDORA_PAIRTREE;
import static org.fcrepo.kernel.api.RdfLexicon.LDP_NAMESPACE;
import static org.fcrepo.kernel.modeshape.services.TransactionServiceImpl.getCurrentTransactionId;
import static org.slf4j.LoggerFactory.getLogger;
Expand Down
Expand Up @@ -28,7 +28,7 @@
import static org.fcrepo.http.commons.domain.RDFMediaType.RDF_XML;
import static org.fcrepo.http.commons.domain.RDFMediaType.TURTLE;
import static org.fcrepo.http.commons.domain.RDFMediaType.TURTLE_X;
import static org.fcrepo.kernel.api.FedoraJcrTypes.FCR_VERSIONS;
import static org.fcrepo.kernel.api.FedoraTypes.FCR_VERSIONS;
import static org.slf4j.LoggerFactory.getLogger;

import java.io.IOException;
Expand Down
Expand Up @@ -19,7 +19,6 @@
import static com.hp.hpl.jena.rdf.model.ResourceFactory.createResource;
import static com.hp.hpl.jena.rdf.model.ResourceFactory.createProperty;
import static java.util.Collections.singletonMap;
import static org.fcrepo.kernel.api.FedoraJcrTypes.ROOT;
import static org.fcrepo.kernel.api.RdfLexicon.HAS_FIXITY_SERVICE;
import static org.fcrepo.kernel.api.RdfLexicon.HAS_SERIALIZATION;
import static org.fcrepo.kernel.api.RdfLexicon.HAS_TRANSACTION_SERVICE;
Expand All @@ -28,6 +27,7 @@
import static org.fcrepo.kernel.api.RdfLexicon.REPOSITORY_NAMESPACE;
import static org.modeshape.jcr.api.JcrConstants.JCR_CONTENT;
import static org.fcrepo.kernel.api.RdfLexicon.DC_NAMESPACE;
import static org.fcrepo.kernel.modeshape.FedoraJcrConstants.ROOT;

import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.rdf.model.Property;
Expand Down
Expand Up @@ -33,9 +33,9 @@
import static org.fcrepo.http.commons.domain.RDFMediaType.NTRIPLES_TYPE;
import static org.fcrepo.http.commons.test.util.TestHelpers.getUriInfoImpl;
import static org.fcrepo.http.commons.test.util.TestHelpers.mockSession;
import static org.fcrepo.kernel.api.FedoraJcrTypes.LDP_BASIC_CONTAINER;
import static org.fcrepo.kernel.api.FedoraJcrTypes.LDP_DIRECT_CONTAINER;
import static org.fcrepo.kernel.api.FedoraJcrTypes.LDP_INDIRECT_CONTAINER;
import static org.fcrepo.kernel.api.FedoraTypes.LDP_BASIC_CONTAINER;
import static org.fcrepo.kernel.api.FedoraTypes.LDP_DIRECT_CONTAINER;
import static org.fcrepo.kernel.api.FedoraTypes.LDP_INDIRECT_CONTAINER;
import static org.fcrepo.kernel.api.RdfLexicon.BASIC_CONTAINER;
import static org.fcrepo.kernel.api.RdfLexicon.DIRECT_CONTAINER;
import static org.fcrepo.kernel.api.RdfLexicon.INBOUND_REFERENCES;
Expand Down
Expand Up @@ -17,11 +17,11 @@

import static com.google.common.collect.ImmutableSet.of;
import static org.fcrepo.http.commons.test.util.TestHelpers.getUriInfoImpl;
import static org.fcrepo.kernel.api.FedoraJcrTypes.ROOT;
import static org.fcrepo.kernel.api.RdfLexicon.HAS_FIXITY_SERVICE;
import static org.fcrepo.kernel.api.RdfLexicon.HAS_SERIALIZATION;
import static org.fcrepo.kernel.api.RdfLexicon.HAS_TRANSACTION_SERVICE;
import static org.fcrepo.kernel.api.RdfLexicon.HAS_VERSION_HISTORY;
import static org.fcrepo.kernel.modeshape.FedoraJcrConstants.ROOT;
import static org.jgroups.util.Util.assertFalse;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
Expand Down
Expand Up @@ -24,7 +24,7 @@
import static javax.ws.rs.core.Response.Status.NO_CONTENT;
import static javax.ws.rs.core.Response.Status.OK;
import static org.fcrepo.http.commons.test.util.TestHelpers.parseTriples;
import static org.fcrepo.kernel.api.FedoraJcrTypes.FCR_METADATA;
import static org.fcrepo.kernel.api.FedoraTypes.FCR_METADATA;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;
Expand Down
Expand Up @@ -56,7 +56,7 @@
import static org.apache.jena.riot.WebContent.contentTypeTurtle;
import static org.fcrepo.http.commons.domain.RDFMediaType.POSSIBLE_RDF_RESPONSE_VARIANTS_STRING;
import static org.fcrepo.http.commons.domain.RDFMediaType.POSSIBLE_RDF_VARIANTS;
import static org.fcrepo.kernel.api.FedoraJcrTypes.FCR_METADATA;
import static org.fcrepo.kernel.api.FedoraTypes.FCR_METADATA;
import static org.fcrepo.kernel.api.RdfLexicon.BASIC_CONTAINER;
import static org.fcrepo.kernel.api.RdfLexicon.CONSTRAINED_BY;
import static org.fcrepo.kernel.api.RdfLexicon.CONTAINS;
Expand Down
Expand Up @@ -20,13 +20,13 @@
import static java.util.Collections.singleton;
import static org.apache.commons.lang3.StringUtils.EMPTY;
import static org.apache.commons.lang3.StringUtils.replaceOnce;
import static org.fcrepo.kernel.api.FedoraJcrTypes.FCR_METADATA;
import static org.fcrepo.kernel.api.FedoraJcrTypes.FCR_VERSIONS;
import static org.fcrepo.kernel.api.utils.NamespaceTools.validatePath;
import static org.fcrepo.kernel.api.FedoraTypes.FCR_METADATA;
import static org.fcrepo.kernel.api.FedoraTypes.FCR_VERSIONS;
import static org.fcrepo.kernel.modeshape.identifiers.NodeResourceConverter.nodeConverter;
import static org.fcrepo.kernel.modeshape.services.TransactionServiceImpl.getCurrentTransactionId;
import static org.fcrepo.kernel.modeshape.utils.FedoraTypesUtils.getClosestExistingAncestor;
import static org.fcrepo.kernel.modeshape.utils.FedoraTypesUtils.isFrozenNode;
import static org.fcrepo.kernel.modeshape.utils.NamespaceTools.validatePath;
import static org.modeshape.jcr.api.JcrConstants.JCR_CONTENT;
import static org.slf4j.LoggerFactory.getLogger;
import static org.springframework.web.context.ContextLoader.getCurrentWebApplicationContext;
Expand Down
Expand Up @@ -25,8 +25,8 @@
import static java.util.Collections.emptyMap;
import static java.util.stream.Collectors.joining;
import static java.util.stream.Collectors.toMap;
import static org.fcrepo.kernel.api.FedoraTypes.FCR_METADATA;
import static org.fcrepo.kernel.api.RdfLexicon.CREATED_DATE;
import static org.fcrepo.kernel.api.FedoraJcrTypes.FCR_METADATA;
import static org.fcrepo.kernel.api.RdfLexicon.DC_TITLE;
import static org.fcrepo.kernel.api.RdfLexicon.HAS_PRIMARY_TYPE;
import static org.fcrepo.kernel.api.RdfLexicon.DCTERMS_TITLE;
Expand Down
Expand Up @@ -42,8 +42,8 @@
import javax.ws.rs.core.UriBuilder;

import static com.hp.hpl.jena.rdf.model.ResourceFactory.createResource;
import static org.fcrepo.kernel.api.FedoraJcrTypes.FEDORA_NON_RDF_SOURCE_DESCRIPTION;
import static org.fcrepo.kernel.api.FedoraJcrTypes.FROZEN_NODE;
import static org.fcrepo.kernel.api.FedoraTypes.FEDORA_NON_RDF_SOURCE_DESCRIPTION;
import static org.fcrepo.kernel.modeshape.FedoraJcrConstants.FROZEN_NODE;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.when;
Expand Down
3 changes: 1 addition & 2 deletions fcrepo-jms/pom.xml
Expand Up @@ -13,12 +13,11 @@
<properties>
<osgi.import.packages>
org.fcrepo.kernel.api.*,
org.fcrepo.kernel.modeshape,

javax.annotation,
javax.inject,
javax.jms,

com.fasterxml.jackson.*,
com.google.common.*,
org.apache.activemq,
Expand Down
5 changes: 0 additions & 5 deletions fcrepo-kernel-api/pom.xml
Expand Up @@ -17,7 +17,6 @@

com.google.common.*,
com.hp.hpl.jena.*,
org.modeshape.jcr.api,
org.apache.commons.codec.binary,

*
Expand Down Expand Up @@ -61,10 +60,6 @@
<groupId>org.apache.jena</groupId>
<artifactId>jena-arq</artifactId>
</dependency>
<dependency>
<groupId>javax.jcr</groupId>
<artifactId>jcr</artifactId>
</dependency>
<dependency>
<groupId>org.modeshape</groupId>
<artifactId>modeshape-jcr-api</artifactId>
Expand Down
Expand Up @@ -16,12 +16,12 @@
package org.fcrepo.kernel.api;

/**
* Convenience class with constants for commonly used JCR types.
* Convenience class with constants for commonly used Fedora types.
*
* @author ajs6f
* @since Apr 25, 2013
*/
public interface FedoraJcrTypes {
public interface FedoraTypes {

String FEDORA_RESOURCE = "fedora:Resource";

Expand All @@ -45,14 +45,6 @@ public interface FedoraJcrTypes {

String LDP_INSERTED_CONTENT_RELATION = "ldp:insertedContentRelation";

String JCR_LASTMODIFIED = "jcr:lastModified";

String JCR_CONTENT = "jcr:content";

String JCR_CREATED = "jcr:created";

String JCR_CREATEDBY = "jcr:createdBy";

String FILENAME = "ebucore:filename";

String HAS_MIME_TYPE = "ebucore:hasMimeType";
Expand All @@ -65,24 +57,10 @@ public interface FedoraJcrTypes {

String FCR_VERSIONS = "fcr:versions";

String ROOT = "mode:root";

String FROZEN_NODE = "nt:frozenNode";

String JCR_FROZEN_NODE = "jcr:frozenNode";

String FROZEN_MIXIN_TYPES = "jcr:frozenMixinTypes";

String FROZEN_PRIMARY_TYPE = "jcr:frozenPrimaryType";

String JCR_PRIMARY_TYPE = "jcr:primaryType";

String JCR_MIXIN_TYPES = "jcr:mixinTypes";

String VERSIONABLE = "mix:versionable";

String LDP_HAS_MEMBER_RELATION = "ldp:hasMemberRelation";

String LDP_IS_MEMBER_OF_RELATION = "ldp:isMemberOfRelation";

String LDP_MEMBER_RESOURCE = "ldp:membershipResource";

}