Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: cwilper/fcrepo-store
base: c30da8d741
...
head fork: cwilper/fcrepo-store
compare: 0bec622112
Checking mergeability… Don't worry, you can still create the pull request.
  • 2 commits
  • 23 files changed
  • 0 commit comments
  • 1 contributor
Showing with 101 additions and 26 deletions.
  1. +1 −1  fcrepo-store-core/src/main/java/com/github/cwilper/fcrepo/store/core/impl/package-info.java
  2. +1 −1  fcrepo-store-core/src/main/java/com/github/cwilper/fcrepo/store/core/package-info.java
  3. +42 −0 fcrepo-store-jcr/src/main/java/com/github/cwilper/fcrepo/store/jcr/JCRFedoraStore.java
  4. +3 −5 fcrepo-store-jcr/src/main/java/com/github/cwilper/fcrepo/store/jcr/JCRFedoraStoreSession.java
  5. +0 −4 fcrepo-store-jcr/src/main/java/com/github/cwilper/fcrepo/store/jcr/ObjectNodeIterator.java
  6. +1 −1  fcrepo-store-legacy/src/main/java/com/github/cwilper/fcrepo/store/legacy/package-info.java
  7. +3 −0  fcrepo-store-util/src/main/java/com/github/cwilper/fcrepo/store/util/commands/Command.java
  8. +1 −1  fcrepo-store-util/src/main/java/com/github/cwilper/fcrepo/store/util/commands/CopyCommand.java
  9. +4 −4 fcrepo-store-util/src/main/java/com/github/cwilper/fcrepo/store/util/commands/DeleteCommand.java
  10. +1 −1  fcrepo-store-util/src/main/java/com/github/cwilper/fcrepo/store/util/commands/ListCommand.java
  11. +4 −4 fcrepo-store-util/src/main/java/com/github/cwilper/fcrepo/store/util/commands/ModifyCommand.java
  12. +4 −0 fcrepo-store-util/src/main/java/com/github/cwilper/fcrepo/store/util/commands/package-info.java
  13. +3 −0  fcrepo-store-util/src/main/java/com/github/cwilper/fcrepo/store/util/filters/IfPidMatches.java
  14. +4 −1 fcrepo-store-util/src/main/java/com/github/cwilper/fcrepo/store/util/filters/ds/CanonicalizeManagedXML.java
  15. +4 −0 fcrepo-store-util/src/main/java/com/github/cwilper/fcrepo/store/util/filters/ds/CheckFixity.java
  16. +1 −1  fcrepo-store-util/src/main/java/com/github/cwilper/fcrepo/store/util/filters/ds/IfControlGroupMatches.java
  17. +1 −1  fcrepo-store-util/src/main/java/com/github/cwilper/fcrepo/store/util/filters/ds/IfIdMatches.java
  18. +5 −1 fcrepo-store-util/src/main/java/com/github/cwilper/fcrepo/store/util/filters/ds/InlineToManagedXML.java
  19. +3 −0  fcrepo-store-util/src/main/java/com/github/cwilper/fcrepo/store/util/filters/ds/ListDatastreams.java
  20. +3 −0  fcrepo-store-util/src/main/java/com/github/cwilper/fcrepo/store/util/filters/ds/RemoveOldVersions.java
  21. +4 −0 fcrepo-store-util/src/main/java/com/github/cwilper/fcrepo/store/util/filters/ds/SetFixity.java
  22. +4 −0 fcrepo-store-util/src/main/java/com/github/cwilper/fcrepo/store/util/filters/ds/package-info.java
  23. +4 −0 fcrepo-store-util/src/main/java/com/github/cwilper/fcrepo/store/util/filters/package-info.java
View
2  fcrepo-store-core/src/main/java/com/github/cwilper/fcrepo/store/core/impl/package-info.java
@@ -1,4 +1,4 @@
/**
- * Classes useful to implementations.
+ * Classes useful to <code>FedoraStore</code> implementations.
*/
package com.github.cwilper.fcrepo.store.core.impl;
View
2  fcrepo-store-core/src/main/java/com/github/cwilper/fcrepo/store/core/package-info.java
@@ -1,4 +1,4 @@
/**
- * Defines the core API.
+ * Defines the core <code>FedoraStore</code> API.
*/
package com.github.cwilper.fcrepo.store.core;
View
42 fcrepo-store-jcr/src/main/java/com/github/cwilper/fcrepo/store/jcr/JCRFedoraStore.java
@@ -12,6 +12,39 @@
/**
* JCR-based implementation of {@link FedoraStore}.
+ * <p>
+ * In order to scale effectively to millions of objects, this implementation
+ * stores serialized objects and managed datastream content within a
+ * multi-level directory (<code>nt:folder</code>) structure based on the pid
+ * of the object. The first four lowercase hex digits of the md5 digest of the
+ * pid are used to compose the top and mid-level folder paths, and the pid
+ * with an underscore instead of a colon is used as the final folder path
+ * element, as follows (for object <code>test:o1</code>):
+ * <ul>
+ * <li> <code>/08/cf/test_o1</code></li>
+ * </ul>
+ * <p>
+ * The serialized object is saved within an <code>nt:file</code> sub-node
+ * named <code>object</code>, which has an <code>nt:resource</code> sub-node
+ * named <code>jcr:content</code>, whose <code>jcr:data</code> property holds
+ * the binary value. So the serialized object <code>test:o1</code> would be
+ * found at:
+ * <ul>
+ * <li> <code>/08/cf/test_o1/object/jcr:content[jcr:data]</code></li>
+ * </ul>
+ * <p>
+ * In addition, managed datastream content resides beneath a sub-folder of the
+ * object named using the datastream id. Within that folder, the content is
+ * stored in an <code>nt:file</code> sub-node named using the datastream
+ * version id, which has an <code>nt:resource</code> sub-node named
+ * <code>jcr:content</code>, whose <code>jcr:data</code> property holds
+ * the binary value. So the content of <code>test:o1</code>'s managed
+ * datastream with id <code>DS1</code> and version id <code>DS1.0</code>
+ * would be found at:
+ * <p>
+ * <ul>
+ * <li> <code>/08/cf/test_o1/DS1/DS1.0/jcr:content[jcr:data]</code></li>
+ * </ul>
*/
public class JCRFedoraStore implements FedoraStore {
private final Repository repository;
@@ -19,6 +52,15 @@
private final DTOReader readerFactory;
private final DTOWriter writerFactory;
+ /**
+ * Creates an instance.
+ *
+ * @param repository the repository to use.
+ * @param credentials the credentials to use when opening sessions.
+ * @param readerFactory the factory to use when objects need to be read.
+ * @param writerFactory the factory to use when objects need to be written.
+ * @throws NullPointerException if any argument is null.
+ */
public JCRFedoraStore(Repository repository, Credentials credentials,
DTOReader readerFactory, DTOWriter writerFactory) {
if (repository == null || credentials == null || readerFactory == null
View
8 fcrepo-store-jcr/src/main/java/com/github/cwilper/fcrepo/store/jcr/JCRFedoraStoreSession.java
@@ -25,13 +25,12 @@
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
-import java.io.OutputStream;
import java.util.Iterator;
/**
- * JCR-based {@link com.github.cwilper.fcrepo.store.core.FedoraStoreSession} implementation.
+ * JCR-based {@link FedoraStoreSession} implementation.
*/
-public class JCRFedoraStoreSession implements FedoraStoreSession {
+class JCRFedoraStoreSession implements FedoraStoreSession {
private static final Logger logger =
LoggerFactory.getLogger(JCRFedoraStoreSession.class);
@@ -41,7 +40,7 @@
private boolean closed;
- public JCRFedoraStoreSession(Session session, DTOReader readerFactory,
+ JCRFedoraStoreSession(Session session, DTOReader readerFactory,
DTOWriter writerFactory) {
if (session == null || readerFactory == null || writerFactory == null)
throw new NullPointerException();
@@ -167,7 +166,6 @@ public void setContent(String pid, String datastreamId,
if (pid == null || datastreamId == null ||
datastreamVersionId == null || inputStream == null)
throw new NullPointerException();
- OutputStream outputStream = null;
boolean success = false;
try {
FedoraObject object = getObject(pid);
View
4 fcrepo-store-jcr/src/main/java/com/github/cwilper/fcrepo/store/jcr/ObjectNodeIterator.java
@@ -59,10 +59,6 @@ private static Node nextDirNode(NodeIterator iterator)
while (iterator.hasNext()) {
Node node = iterator.nextNode();
if (node.getName().length() == 2) {
- NodeIterator children = node.getNodes();
- while (children.hasNext()) {
- Node child = children.nextNode();
- }
return node;
}
}
View
2  fcrepo-store-legacy/src/main/java/com/github/cwilper/fcrepo/store/legacy/package-info.java
@@ -1,4 +1,4 @@
/**
- * Implements <code>LegacyFedoraStoreSession</code>.
+ * Implements <code>LegacyFedoraStore</code>.
*/
package com.github.cwilper.fcrepo.store.legacy;
View
3  fcrepo-store-util/src/main/java/com/github/cwilper/fcrepo/store/util/commands/Command.java
@@ -1,5 +1,8 @@
package com.github.cwilper.fcrepo.store.util.commands;
+/**
+ * An executable command.
+ */
public interface Command {
void execute();
void close();
View
2  fcrepo-store-util/src/main/java/com/github/cwilper/fcrepo/store/util/commands/CopyCommand.java
@@ -16,7 +16,7 @@
import java.io.InputStream;
/**
- * Copies {@link FedoraObject}s from one {@link com.github.cwilper.fcrepo.store.core.FedoraStoreSession} to another.
+ * Copies {@link FedoraObject}s from one {@link FedoraStore} to another.
*/
public class CopyCommand extends FilteringBatchObjectCommand {
private static final Logger logger =
View
8 fcrepo-store-util/src/main/java/com/github/cwilper/fcrepo/store/util/commands/DeleteCommand.java
@@ -1,22 +1,22 @@
package com.github.cwilper.fcrepo.store.util.commands;
import com.github.cwilper.fcrepo.dto.core.FedoraObject;
-import com.github.cwilper.fcrepo.store.core.FedoraStoreSession;
+import com.github.cwilper.fcrepo.store.core.FedoraStore;
import com.github.cwilper.fcrepo.store.util.IdSpec;
import com.github.cwilper.ttff.Filter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
- * Deletes {@link FedoraObject}s in a given {@link com.github.cwilper.fcrepo.store.core.FedoraStoreSession}.
+ * Deletes {@link FedoraObject}s in a given {@link FedoraStore}.
*/
public class DeleteCommand extends FilteringBatchObjectCommand {
private static final Logger logger =
LoggerFactory.getLogger(DeleteCommand.class);
- public DeleteCommand(FedoraStoreSession source, IdSpec pids,
+ public DeleteCommand(FedoraStore source, IdSpec pids,
Filter<FedoraObject> filter) {
- super(source, pids, filter);
+ super(source.getSession(), pids, filter);
}
@Override
View
2  fcrepo-store-util/src/main/java/com/github/cwilper/fcrepo/store/util/commands/ListCommand.java
@@ -8,7 +8,7 @@
import org.slf4j.LoggerFactory;
/**
- * Lists each {@link FedoraObject}s in the given {@link com.github.cwilper.fcrepo.store.core.FedoraStoreSession}.
+ * Lists each {@link FedoraObject}s in the given {@link FedoraStore}.
*/
public class ListCommand extends FilteringBatchObjectCommand {
private static final Logger logger =
View
8 fcrepo-store-util/src/main/java/com/github/cwilper/fcrepo/store/util/commands/ModifyCommand.java
@@ -1,22 +1,22 @@
package com.github.cwilper.fcrepo.store.util.commands;
import com.github.cwilper.fcrepo.dto.core.FedoraObject;
-import com.github.cwilper.fcrepo.store.core.FedoraStoreSession;
+import com.github.cwilper.fcrepo.store.core.FedoraStore;
import com.github.cwilper.fcrepo.store.util.IdSpec;
import com.github.cwilper.ttff.Filter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
- * Modifies {@link FedoraObject}s in a given {@link com.github.cwilper.fcrepo.store.core.FedoraStoreSession}.
+ * Modifies {@link FedoraObject}s in a given {@link FedoraStore}.
*/
public class ModifyCommand extends FilteringBatchObjectCommand {
private static final Logger logger =
LoggerFactory.getLogger(ModifyCommand.class);
- public ModifyCommand(FedoraStoreSession source, IdSpec pids,
+ public ModifyCommand(FedoraStore source, IdSpec pids,
Filter<FedoraObject> filter) {
- super(source, pids, filter);
+ super(source.getSession(), pids, filter);
}
@Override
View
4 fcrepo-store-util/src/main/java/com/github/cwilper/fcrepo/store/util/commands/package-info.java
@@ -0,0 +1,4 @@
+/**
+ * Defines the <code>Command</code> interface and built-in implementations.
+ */
+package com.github.cwilper.fcrepo.store.util.commands;
View
3  fcrepo-store-util/src/main/java/com/github/cwilper/fcrepo/store/util/filters/IfPidMatches.java
@@ -6,6 +6,9 @@
import java.io.IOException;
+/**
+ * Accepts objects whose pids match a given {@link IdSpec}.
+ */
public class IfPidMatches extends AbstractFilter<FedoraObject> {
private final IdSpec pids;
View
5 fcrepo-store-util/src/main/java/com/github/cwilper/fcrepo/store/util/filters/ds/CanonicalizeManagedXML.java
@@ -16,7 +16,10 @@
import java.io.IOException;
import java.io.InputStream;
-// also sets size attribute. digest will be re-set if one is already defined.
+/**
+ * Canonicalizes (using C14N11 rules) managed xml. Also sets the size
+ * and re-computes the digest if one is already defined.
+ */
public class CanonicalizeManagedXML extends MultiVersionFilter {
private static final Logger logger =
LoggerFactory.getLogger(CanonicalizeManagedXML.class);
View
4 fcrepo-store-util/src/main/java/com/github/cwilper/fcrepo/store/util/filters/ds/CheckFixity.java
@@ -10,6 +10,10 @@
import java.io.IOException;
import java.io.InputStream;
+/**
+ * Computes the fixity (size and/or digest) and compares it to the stored
+ * values, reporting on any differences.
+ */
public class CheckFixity extends MultiVersionFilter {
private static final Logger logger =
LoggerFactory.getLogger(CheckFixity.class);
View
2  fcrepo-store-util/src/main/java/com/github/cwilper/fcrepo/store/util/filters/ds/IfControlGroupMatches.java
@@ -5,7 +5,7 @@
import com.github.cwilper.ttff.AbstractFilter;
/**
- * Includes datastreams whose control groups match the given idspec.
+ * Accepts datastreams whose control group matches a given {@link IdSpec}.
*/
public class IfControlGroupMatches extends AbstractFilter<Datastream> {
private final IdSpec ids;
View
2  fcrepo-store-util/src/main/java/com/github/cwilper/fcrepo/store/util/filters/ds/IfIdMatches.java
@@ -5,7 +5,7 @@
import com.github.cwilper.ttff.AbstractFilter;
/**
- * Includes datastreams whose ids match the given idspec.
+ * Accepts datastreams whose ids match a given {@link IdSpec}.
*/
public class IfIdMatches extends AbstractFilter<Datastream> {
private final IdSpec ids;
View
6 fcrepo-store-util/src/main/java/com/github/cwilper/fcrepo/store/util/filters/ds/InlineToManagedXML.java
@@ -16,7 +16,11 @@
import java.io.IOException;
import java.net.URI;
-// also sets size attribute. digest will be re-set if one is already defined.
+/**
+ * Converts inline XML to managed content (which will be canonicalized using
+ * C14N11 rules). Also sets the size and re-computes the digest if one is
+ * already defined.
+ */
public class InlineToManagedXML extends AbstractFilter<Datastream> {
private final static Logger logger =
LoggerFactory.getLogger(InlineToManagedXML.class);
View
3  fcrepo-store-util/src/main/java/com/github/cwilper/fcrepo/store/util/filters/ds/ListDatastreams.java
@@ -9,6 +9,9 @@
import java.io.IOException;
+/**
+ * Lists each datastream.
+ */
public class ListDatastreams extends MultiVersionFilter {
private static final Logger logger =
LoggerFactory.getLogger(ListDatastreams.class);
View
3  fcrepo-store-util/src/main/java/com/github/cwilper/fcrepo/store/util/filters/ds/RemoveOldVersions.java
@@ -4,6 +4,9 @@
import com.github.cwilper.fcrepo.dto.core.DatastreamVersion;
import com.github.cwilper.ttff.AbstractFilter;
+/**
+ * Drops all versions of each datastream except the most recent.
+ */
public class RemoveOldVersions extends AbstractFilter<Datastream> {
@Override
public Datastream accept(Datastream datastream) {
View
4 fcrepo-store-util/src/main/java/com/github/cwilper/fcrepo/store/util/filters/ds/SetFixity.java
@@ -10,6 +10,10 @@
import java.io.IOException;
+/**
+ * Sets the fixity (size and digest) where undefined, or forcibly overwrites
+ * the previously stored fixity values.
+ */
public class SetFixity extends MultiVersionFilter {
private static final Logger logger =
LoggerFactory.getLogger(SetFixity.class);
View
4 fcrepo-store-util/src/main/java/com/github/cwilper/fcrepo/store/util/filters/ds/package-info.java
@@ -0,0 +1,4 @@
+/**
+ * Built-in <code>Filter&lt;Datastream&gt;</code> implementations.
+ */
+package com.github.cwilper.fcrepo.store.util.filters.ds;
View
4 fcrepo-store-util/src/main/java/com/github/cwilper/fcrepo/store/util/filters/package-info.java
@@ -0,0 +1,4 @@
+/**
+ * Built-in <code>Filter&lt;FedoraObject&gt;</code> implementations.
+ */
+package com.github.cwilper.fcrepo.store.util.filters;

No commit comments for this range

Something went wrong with that request. Please try again.