Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
create mixin fedora:checksum (mixed into our datastream jcr:content n…
…ode) that records a checksum and content size for the jcr:data
- Loading branch information
Showing
5 changed files
with
150 additions
and
3 deletions.
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
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
27 changes: 27 additions & 0 deletions
27
fcrepo-kernel/src/main/java/org/fcrepo/utils/ContentDigest.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,27 @@ | ||
package org.fcrepo.utils; | ||
|
||
import java.net.URI; | ||
import java.net.URISyntaxException; | ||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
public class ContentDigest { | ||
public final static Map<String, String> algorithmToScheme; | ||
|
||
static | ||
{ | ||
algorithmToScheme = new HashMap<String, String>(); | ||
algorithmToScheme.put("SHA-1", "urn:sha1"); | ||
} | ||
|
||
public static URI asURI(String algorithm, String value) { | ||
try { | ||
String scheme = algorithmToScheme.get(algorithm); | ||
|
||
return new URI(scheme, value, null); | ||
} catch (URISyntaxException e) { | ||
e.printStackTrace(); | ||
return null; | ||
} | ||
} | ||
} |
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
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