-
Notifications
You must be signed in to change notification settings - Fork 129
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* added apis * added travis config -- no deploy * noop change because travis messed up Co-authored-by: Peter Winckles <peter.winckles@wisc.edu> Resolves: https://jira.lyrasis.org/browse/FCREPO-3392
- Loading branch information
Showing
9 changed files
with
799 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
target/ | ||
.classpath | ||
.settings/ | ||
.project | ||
.metadata | ||
*/.cache | ||
.cache | ||
.DS_Store | ||
*~ | ||
*.iml | ||
.idea/ | ||
.checkstyle | ||
.idea/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
jobs: | ||
include: | ||
- os: linux | ||
language: java | ||
dist: trusty | ||
sudo: true | ||
jdk: openjdk11 | ||
- os: windows | ||
language: shell | ||
|
||
env: | ||
- MAVEN_VERSION=3.6.3 | ||
|
||
before_install: | ||
- if [ "$TRAVIS_OS_NAME" = "windows" ]; then | ||
choco install openjdk11 --version 11.0.5.10; | ||
export JAVA_HOME='/c/Program Files/OpenJDK/openjdk-11.0.5_10' | ||
export PATH="${PATH}:${JAVA_HOME}/bin"; | ||
choco install maven --version ${MAVEN_VERSION}; | ||
export PATH="${PATH}:/c/ProgramData/chocolatey/lib/maven/apache-maven-3.6.3/bin"; | ||
fi; | ||
- "echo $PATH" | ||
- "export JAVA_OPTS=-Xmx512m" | ||
- "mvn -N io.takari:maven:0.7.7:wrapper -Dmaven=${MAVEN_VERSION}" | ||
|
||
# Default installation command is | ||
# mvn install -DskipTests=true -Dmaven.javadoc.skip=true -B -V | ||
# this is what we test as our build phase so skip it here. | ||
install: | ||
- true | ||
|
||
script: | ||
- mvn install -B -V |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
# fcrepo-storage-ocfl | ||
OCFL storage layer for Fedora 6 | ||
|
||
OCFL storage layer for Fedora |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>org.fcrepo</groupId> | ||
<artifactId>fcrepo-parent</artifactId> | ||
<version>6.0.0-SNAPSHOT</version> | ||
</parent> | ||
|
||
<groupId>org.fcrepo.ocfl</groupId> | ||
<artifactId>fcrepo-storage-ocfl</artifactId> | ||
<version>6.0.0-SNAPSHOT</version> | ||
<packaging>jar</packaging> | ||
|
||
<name>fcrepo-storage-ocfl</name> | ||
|
||
<properties> | ||
<jackson.version>2.11.1</jackson.version> | ||
</properties> | ||
|
||
<scm> | ||
<connection>scm:git:git://github.com/fcrepo4-labs/${project_name}.git</connection> | ||
<developerConnection>scm:git:git@github.com:fcrepo4-exts/${project_name}.git</developerConnection> | ||
<url>https://github.com/fcrepo4-exts/${project_name}</url> | ||
<tag>HEAD</tag> | ||
</scm> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-checkstyle-plugin</artifactId> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>edu.wisc.library.ocfl</groupId> | ||
<artifactId>ocfl-java-core</artifactId> | ||
<version>0.0.4-SNAPSHOT</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>com.fasterxml.jackson.core</groupId> | ||
<artifactId>jackson-core</artifactId> | ||
<version>${jackson.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.fasterxml.jackson.core</groupId> | ||
<artifactId>jackson-annotations</artifactId> | ||
<version>${jackson.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.fasterxml.jackson.core</groupId> | ||
<artifactId>jackson-databind</artifactId> | ||
<version>${jackson.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.fasterxml.jackson.datatype</groupId> | ||
<artifactId>jackson-datatype-jsr310</artifactId> | ||
<version>${jackson.version}</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>commons-io</groupId> | ||
<artifactId>commons-io</artifactId> | ||
<version>2.7</version> | ||
</dependency> | ||
|
||
<!-- Test --> | ||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
<version>4.13</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.mockito</groupId> | ||
<artifactId>mockito-core</artifactId> | ||
<version>2.22.0</version> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<repositories> | ||
<repository> | ||
<id>sonatype-nexus-snapshots</id> | ||
<name>Sonatype Nexus Snapshots</name> | ||
<url>https://oss.sonatype.org/content/repositories/snapshots</url> | ||
<releases> | ||
<enabled>false</enabled> | ||
</releases> | ||
<snapshots> | ||
<enabled>true</enabled> | ||
</snapshots> | ||
</repository> | ||
</repositories> | ||
|
||
<pluginRepositories> | ||
<pluginRepository> | ||
<id>sonatype-nexus-snapshots</id> | ||
<name>Sonatype Nexus Snapshots</name> | ||
<url>https://oss.sonatype.org/content/repositories/snapshots</url> | ||
<releases> | ||
<enabled>false</enabled> | ||
</releases> | ||
<snapshots> | ||
<enabled>true</enabled> | ||
</snapshots> | ||
</pluginRepository> | ||
</pluginRepositories> | ||
|
||
</project> |
43 changes: 43 additions & 0 deletions
43
src/main/java/org/fcrepo/storage/ocfl/NotFoundException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* Licensed to DuraSpace under one or more contributor license agreements. | ||
* See the NOTICE file distributed with this work for additional information | ||
* regarding copyright ownership. | ||
* | ||
* DuraSpace licenses this file to you under the Apache License, | ||
* Version 2.0 (the "License"); you may not use this file except in | ||
* compliance with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.fcrepo.storage.ocfl; | ||
|
||
/** | ||
* Indicates that a resource could not be found in the underlying storage | ||
* | ||
* @author pwinckles | ||
*/ | ||
public class NotFoundException extends RuntimeException { | ||
|
||
public NotFoundException() { | ||
} | ||
|
||
public NotFoundException(final String message) { | ||
super(message); | ||
} | ||
|
||
public NotFoundException(final String message, final Throwable cause) { | ||
super(message, cause); | ||
} | ||
|
||
public NotFoundException(final Throwable cause) { | ||
super(cause); | ||
} | ||
|
||
} |
144 changes: 144 additions & 0 deletions
144
src/main/java/org/fcrepo/storage/ocfl/OcflObjectSession.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,144 @@ | ||
/* | ||
* Licensed to DuraSpace under one or more contributor license agreements. | ||
* See the NOTICE file distributed with this work for additional information | ||
* regarding copyright ownership. | ||
* | ||
* DuraSpace licenses this file to you under the Apache License, | ||
* Version 2.0 (the "License"); you may not use this file except in | ||
* compliance with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.fcrepo.storage.ocfl; | ||
|
||
import java.time.OffsetDateTime; | ||
|
||
/** | ||
* Session interface over an OCFL object. Changes to the object are accumulated in a staging directory until the | ||
* session is committed, at which point all of the changes are written to a new OCFL object version. | ||
* | ||
* @author pwinckles | ||
*/ | ||
public interface OcflObjectSession { | ||
|
||
/** | ||
* @return the id of the session | ||
*/ | ||
String sessionId(); | ||
|
||
/** | ||
* @return the OCFL object id of the object the session is on | ||
*/ | ||
String ocflObjectId(); | ||
|
||
/** | ||
* Writes a RDF resource to the session. | ||
* | ||
* @param resourceId the Fedora resource id of the resource to write | ||
* @param content the content to write | ||
*/ | ||
void writeRdfResource(final String resourceId, final ResourceContent content); | ||
|
||
/** | ||
* Writes a non-RDF resource to the session. | ||
* | ||
* @param resourceId the Fedora resource id of the resource to write | ||
* @param content the content to write | ||
*/ | ||
void writeNonRdfResource(final String resourceId, final ResourceContent content); | ||
|
||
/** | ||
* Writes an ACL for a RDF resource to the session. | ||
* | ||
* @param resourceId the Fedora resource id of the resource to write, this should end in "/fcr:acl" | ||
* @param content the content to write | ||
*/ | ||
void writeAclRdfResource(final String resourceId, final ResourceContent content); | ||
|
||
/** | ||
* Writes an ACL for a non-RDF resource to the session. | ||
* | ||
* @param resourceId the Fedora resource id of the resource to write, this should end in "/fcr:acl" | ||
* @param content the content to write | ||
*/ | ||
void writeAclNonRdfResource(final String resourceId, final ResourceContent content); | ||
|
||
/** | ||
* Deletes a content file from the session, and updates the associated headers. | ||
* | ||
* @param resourceId the Fedora resource id of the resource that's associated content file should be delete | ||
* @param headers the updated resource headers | ||
*/ | ||
void deleteContentFile(final String resourceId, final ResourceHeaders headers); | ||
|
||
/** | ||
* Deletes a resource's header file. This should only be called if its content file has already been deleted. | ||
* | ||
* @param resourceId the Fedora resource id of the resource that's associated header file should be deleted | ||
*/ | ||
void deleteHeaderFile(final String resourceId); | ||
|
||
/** | ||
* Reads a resource's header file. | ||
* | ||
* @param resourceId the Fedora resource id to read | ||
* @return the resource's headers | ||
* @throws NotFoundException if the resource cannot be found | ||
*/ | ||
ResourceHeaders readResourceHeaders(final String resourceId); | ||
|
||
/** | ||
* Reads a resource's content. | ||
* | ||
* @param resourceId the Fedora resource id to read | ||
* @return the resource's content | ||
* @throws NotFoundException if the resource cannot be found | ||
*/ | ||
ResourceContent readContent(final String resourceId); | ||
|
||
/** | ||
* Sets the timestamp that's stamped on the OCFL version. If this value is not set, the current system time | ||
* at the time the version is created is used. | ||
* | ||
* @param timestamp version creation timestamp | ||
*/ | ||
void versionCreationTimestamp(final OffsetDateTime timestamp); | ||
|
||
/** | ||
* Sets the author the OCFL version is attributed to. | ||
* | ||
* @param name the author's name | ||
* @param address the author's address | ||
*/ | ||
void versionAuthor(final String name, final String address); | ||
|
||
/** | ||
* Sets the OCFL version message. | ||
* | ||
* @param message the OCFL version message | ||
*/ | ||
void versionMessage(final String message); | ||
|
||
/** | ||
* Commits the session, persisting all changes to a new OCFL version. | ||
*/ | ||
void commit(); | ||
|
||
/** | ||
* Aborts the session, abandoning all changes. | ||
*/ | ||
void abort(); | ||
|
||
/** | ||
* @return true if the session is still open | ||
*/ | ||
boolean isOpen(); | ||
|
||
} |
Oops, something went wrong.