diff --git a/src/main/java/org/dataone/indexer/storage/HashStorage.java b/src/main/java/org/dataone/indexer/storage/HashStorage.java index 2bf632f0..0aaf2771 100644 --- a/src/main/java/org/dataone/indexer/storage/HashStorage.java +++ b/src/main/java/org/dataone/indexer/storage/HashStorage.java @@ -73,14 +73,20 @@ public static HashStorage getInstance(String className) throws IOException { public InputStream retrieveObject(String pid) throws IllegalArgumentException, FileNotFoundException, IOException, NoSuchAlgorithmException { - return hashStorage.retrieveObject(pid); + return hashStore.retrieveObject(pid); } @Override public InputStream retrieveSystemMetadata(String pid) throws IllegalArgumentException, FileNotFoundException, IOException, NoSuchAlgorithmException { - return hashStorage.retrieveSystemMetadata(pid); + return hashStore.retrieveMetadata(pid); + } + + @Override + public void storeObject(InputStream object, String pid) throws NoSuchAlgorithmException, + IOException,RuntimeException, InterruptedException { + hashStore.storeObject(object, pid, null, null, null, -1); } } diff --git a/src/main/java/org/dataone/indexer/storage/Storage.java b/src/main/java/org/dataone/indexer/storage/Storage.java index e138d976..bfe5077b 100644 --- a/src/main/java/org/dataone/indexer/storage/Storage.java +++ b/src/main/java/org/dataone/indexer/storage/Storage.java @@ -5,6 +5,8 @@ import java.io.InputStream; import java.security.NoSuchAlgorithmException; +import org.dataone.hashstore.exceptions.PidRefsFileExistsException; + /** * The Storage represents the interface to access the objects and system metadata @@ -38,4 +40,16 @@ public InputStream retrieveObject(String pid) throws IllegalArgumentException, public InputStream retrieveSystemMetadata(String pid) throws IllegalArgumentException, FileNotFoundException, IOException, NoSuchAlgorithmException; + /** + * Store the input stream object into hash store. This method is only for the test classes. + * @param object the input stream of the object + * @param pid the pid which will be stored + * @throws NoSuchAlgorithmException + * @throws IOException + * @throws RuntimeException + * @throws InterruptedException + */ + public void storeObject(InputStream object, String pid) throws NoSuchAlgorithmException, + IOException,RuntimeException, InterruptedException; + }