Repository: incubator-pirk Updated Branches: refs/heads/master ede19c797 -> 2d586b68f
http://git-wip-us.apache.org/repos/asf/incubator-pirk/blob/2d586b68/docs/test/general/package-tree.html ---------------------------------------------------------------------- diff --git a/docs/test/general/package-tree.html b/docs/test/general/package-tree.html index 2f00951..c796c9b 100644 --- a/docs/test/general/package-tree.html +++ b/docs/test/general/package-tree.html @@ -2,7 +2,7 @@ <!-- NewPage --> <html lang="en"> <head> -<!-- Generated by javadoc (version 1.7.0_80) on Sun Jul 24 09:08:59 EDT 2016 --> +<!-- Generated by javadoc (version 1.7.0_80) on Sun Jul 24 11:37:28 EDT 2016 --> <title>test.general Class Hierarchy</title> <meta name="date" content="2016-07-24"> <link rel="stylesheet" type="text/css" href="../../stylesheet.css" title="Style"> http://git-wip-us.apache.org/repos/asf/incubator-pirk/blob/2d586b68/docs/test/general/package-use.html ---------------------------------------------------------------------- diff --git a/docs/test/general/package-use.html b/docs/test/general/package-use.html index 315f8c9..b1ed8bd 100644 --- a/docs/test/general/package-use.html +++ b/docs/test/general/package-use.html @@ -2,7 +2,7 @@ <!-- NewPage --> <html lang="en"> <head> -<!-- Generated by javadoc (version 1.7.0_80) on Sun Jul 24 09:08:59 EDT 2016 --> +<!-- Generated by javadoc (version 1.7.0_80) on Sun Jul 24 11:37:28 EDT 2016 --> <title>Uses of Package test.general</title> <meta name="date" content="2016-07-24"> <link rel="stylesheet" type="text/css" href="../../stylesheet.css" title="Style"> http://git-wip-us.apache.org/repos/asf/incubator-pirk/blob/2d586b68/docs/test/schema/data/LoadDataSchemaTest.html ---------------------------------------------------------------------- diff --git a/docs/test/schema/data/LoadDataSchemaTest.html b/docs/test/schema/data/LoadDataSchemaTest.html index dcada1a..8fb0bd5 100644 --- a/docs/test/schema/data/LoadDataSchemaTest.html +++ b/docs/test/schema/data/LoadDataSchemaTest.html @@ -2,7 +2,7 @@ <!-- NewPage --> <html lang="en"> <head> -<!-- Generated by javadoc (version 1.7.0_80) on Sun Jul 24 09:08:57 EDT 2016 --> +<!-- Generated by javadoc (version 1.7.0_80) on Sun Jul 24 11:37:26 EDT 2016 --> <title>LoadDataSchemaTest</title> <meta name="date" content="2016-07-24"> <link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style"> http://git-wip-us.apache.org/repos/asf/incubator-pirk/blob/2d586b68/docs/test/schema/data/class-use/LoadDataSchemaTest.html ---------------------------------------------------------------------- diff --git a/docs/test/schema/data/class-use/LoadDataSchemaTest.html b/docs/test/schema/data/class-use/LoadDataSchemaTest.html index fbc58e7..2562414 100644 --- a/docs/test/schema/data/class-use/LoadDataSchemaTest.html +++ b/docs/test/schema/data/class-use/LoadDataSchemaTest.html @@ -2,7 +2,7 @@ <!-- NewPage --> <html lang="en"> <head> -<!-- Generated by javadoc (version 1.7.0_80) on Sun Jul 24 09:08:59 EDT 2016 --> +<!-- Generated by javadoc (version 1.7.0_80) on Sun Jul 24 11:37:28 EDT 2016 --> <title>Uses of Class test.schema.data.LoadDataSchemaTest</title> <meta name="date" content="2016-07-24"> <link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style"> http://git-wip-us.apache.org/repos/asf/incubator-pirk/blob/2d586b68/docs/test/schema/data/package-frame.html ---------------------------------------------------------------------- diff --git a/docs/test/schema/data/package-frame.html b/docs/test/schema/data/package-frame.html index f9255f6..e3babdc 100644 --- a/docs/test/schema/data/package-frame.html +++ b/docs/test/schema/data/package-frame.html @@ -2,7 +2,7 @@ <!-- NewPage --> <html lang="en"> <head> -<!-- Generated by javadoc (version 1.7.0_80) on Sun Jul 24 09:08:59 EDT 2016 --> +<!-- Generated by javadoc (version 1.7.0_80) on Sun Jul 24 11:37:28 EDT 2016 --> <title>test.schema.data</title> <meta name="date" content="2016-07-24"> <link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style"> http://git-wip-us.apache.org/repos/asf/incubator-pirk/blob/2d586b68/docs/test/schema/data/package-summary.html ---------------------------------------------------------------------- diff --git a/docs/test/schema/data/package-summary.html b/docs/test/schema/data/package-summary.html index 21fc6a9..dd0fbf2 100644 --- a/docs/test/schema/data/package-summary.html +++ b/docs/test/schema/data/package-summary.html @@ -2,7 +2,7 @@ <!-- NewPage --> <html lang="en"> <head> -<!-- Generated by javadoc (version 1.7.0_80) on Sun Jul 24 09:08:59 EDT 2016 --> +<!-- Generated by javadoc (version 1.7.0_80) on Sun Jul 24 11:37:28 EDT 2016 --> <title>test.schema.data</title> <meta name="date" content="2016-07-24"> <link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style"> http://git-wip-us.apache.org/repos/asf/incubator-pirk/blob/2d586b68/docs/test/schema/data/package-tree.html ---------------------------------------------------------------------- diff --git a/docs/test/schema/data/package-tree.html b/docs/test/schema/data/package-tree.html index d2a3928..6a2e2a6 100644 --- a/docs/test/schema/data/package-tree.html +++ b/docs/test/schema/data/package-tree.html @@ -2,7 +2,7 @@ <!-- NewPage --> <html lang="en"> <head> -<!-- Generated by javadoc (version 1.7.0_80) on Sun Jul 24 09:08:59 EDT 2016 --> +<!-- Generated by javadoc (version 1.7.0_80) on Sun Jul 24 11:37:28 EDT 2016 --> <title>test.schema.data Class Hierarchy</title> <meta name="date" content="2016-07-24"> <link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style"> http://git-wip-us.apache.org/repos/asf/incubator-pirk/blob/2d586b68/docs/test/schema/data/package-use.html ---------------------------------------------------------------------- diff --git a/docs/test/schema/data/package-use.html b/docs/test/schema/data/package-use.html index aefe4ad..7e6bca7 100644 --- a/docs/test/schema/data/package-use.html +++ b/docs/test/schema/data/package-use.html @@ -2,7 +2,7 @@ <!-- NewPage --> <html lang="en"> <head> -<!-- Generated by javadoc (version 1.7.0_80) on Sun Jul 24 09:08:59 EDT 2016 --> +<!-- Generated by javadoc (version 1.7.0_80) on Sun Jul 24 11:37:28 EDT 2016 --> <title>Uses of Package test.schema.data</title> <meta name="date" content="2016-07-24"> <link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style"> http://git-wip-us.apache.org/repos/asf/incubator-pirk/blob/2d586b68/docs/test/schema/query/LoadQuerySchemaTest.html ---------------------------------------------------------------------- diff --git a/docs/test/schema/query/LoadQuerySchemaTest.html b/docs/test/schema/query/LoadQuerySchemaTest.html index e8033b1..278ef00 100644 --- a/docs/test/schema/query/LoadQuerySchemaTest.html +++ b/docs/test/schema/query/LoadQuerySchemaTest.html @@ -2,7 +2,7 @@ <!-- NewPage --> <html lang="en"> <head> -<!-- Generated by javadoc (version 1.7.0_80) on Sun Jul 24 09:08:57 EDT 2016 --> +<!-- Generated by javadoc (version 1.7.0_80) on Sun Jul 24 11:37:26 EDT 2016 --> <title>LoadQuerySchemaTest</title> <meta name="date" content="2016-07-24"> <link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style"> http://git-wip-us.apache.org/repos/asf/incubator-pirk/blob/2d586b68/docs/test/schema/query/class-use/LoadQuerySchemaTest.html ---------------------------------------------------------------------- diff --git a/docs/test/schema/query/class-use/LoadQuerySchemaTest.html b/docs/test/schema/query/class-use/LoadQuerySchemaTest.html index 301e1ea..199e3dc 100644 --- a/docs/test/schema/query/class-use/LoadQuerySchemaTest.html +++ b/docs/test/schema/query/class-use/LoadQuerySchemaTest.html @@ -2,7 +2,7 @@ <!-- NewPage --> <html lang="en"> <head> -<!-- Generated by javadoc (version 1.7.0_80) on Sun Jul 24 09:08:59 EDT 2016 --> +<!-- Generated by javadoc (version 1.7.0_80) on Sun Jul 24 11:37:28 EDT 2016 --> <title>Uses of Class test.schema.query.LoadQuerySchemaTest</title> <meta name="date" content="2016-07-24"> <link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style"> http://git-wip-us.apache.org/repos/asf/incubator-pirk/blob/2d586b68/docs/test/schema/query/package-frame.html ---------------------------------------------------------------------- diff --git a/docs/test/schema/query/package-frame.html b/docs/test/schema/query/package-frame.html index 5242c63..8269a7f 100644 --- a/docs/test/schema/query/package-frame.html +++ b/docs/test/schema/query/package-frame.html @@ -2,7 +2,7 @@ <!-- NewPage --> <html lang="en"> <head> -<!-- Generated by javadoc (version 1.7.0_80) on Sun Jul 24 09:08:59 EDT 2016 --> +<!-- Generated by javadoc (version 1.7.0_80) on Sun Jul 24 11:37:28 EDT 2016 --> <title>test.schema.query</title> <meta name="date" content="2016-07-24"> <link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style"> http://git-wip-us.apache.org/repos/asf/incubator-pirk/blob/2d586b68/docs/test/schema/query/package-summary.html ---------------------------------------------------------------------- diff --git a/docs/test/schema/query/package-summary.html b/docs/test/schema/query/package-summary.html index 24aafe5..d57cd2f 100644 --- a/docs/test/schema/query/package-summary.html +++ b/docs/test/schema/query/package-summary.html @@ -2,7 +2,7 @@ <!-- NewPage --> <html lang="en"> <head> -<!-- Generated by javadoc (version 1.7.0_80) on Sun Jul 24 09:08:59 EDT 2016 --> +<!-- Generated by javadoc (version 1.7.0_80) on Sun Jul 24 11:37:28 EDT 2016 --> <title>test.schema.query</title> <meta name="date" content="2016-07-24"> <link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style"> http://git-wip-us.apache.org/repos/asf/incubator-pirk/blob/2d586b68/docs/test/schema/query/package-tree.html ---------------------------------------------------------------------- diff --git a/docs/test/schema/query/package-tree.html b/docs/test/schema/query/package-tree.html index 7925078..cf2e993 100644 --- a/docs/test/schema/query/package-tree.html +++ b/docs/test/schema/query/package-tree.html @@ -2,7 +2,7 @@ <!-- NewPage --> <html lang="en"> <head> -<!-- Generated by javadoc (version 1.7.0_80) on Sun Jul 24 09:08:59 EDT 2016 --> +<!-- Generated by javadoc (version 1.7.0_80) on Sun Jul 24 11:37:28 EDT 2016 --> <title>test.schema.query Class Hierarchy</title> <meta name="date" content="2016-07-24"> <link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style"> http://git-wip-us.apache.org/repos/asf/incubator-pirk/blob/2d586b68/docs/test/schema/query/package-use.html ---------------------------------------------------------------------- diff --git a/docs/test/schema/query/package-use.html b/docs/test/schema/query/package-use.html index d69e002..65b49f7 100644 --- a/docs/test/schema/query/package-use.html +++ b/docs/test/schema/query/package-use.html @@ -2,7 +2,7 @@ <!-- NewPage --> <html lang="en"> <head> -<!-- Generated by javadoc (version 1.7.0_80) on Sun Jul 24 09:08:59 EDT 2016 --> +<!-- Generated by javadoc (version 1.7.0_80) on Sun Jul 24 11:37:28 EDT 2016 --> <title>Uses of Package test.schema.query</title> <meta name="date" content="2016-07-24"> <link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style"> http://git-wip-us.apache.org/repos/asf/incubator-pirk/blob/2d586b68/docs/test/wideskies/standalone/StandaloneTest.html ---------------------------------------------------------------------- diff --git a/docs/test/wideskies/standalone/StandaloneTest.html b/docs/test/wideskies/standalone/StandaloneTest.html index 8d6b765..71b91e5 100644 --- a/docs/test/wideskies/standalone/StandaloneTest.html +++ b/docs/test/wideskies/standalone/StandaloneTest.html @@ -2,7 +2,7 @@ <!-- NewPage --> <html lang="en"> <head> -<!-- Generated by javadoc (version 1.7.0_80) on Sun Jul 24 09:08:57 EDT 2016 --> +<!-- Generated by javadoc (version 1.7.0_80) on Sun Jul 24 11:37:26 EDT 2016 --> <title>StandaloneTest</title> <meta name="date" content="2016-07-24"> <link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style"> http://git-wip-us.apache.org/repos/asf/incubator-pirk/blob/2d586b68/docs/test/wideskies/standalone/class-use/StandaloneTest.html ---------------------------------------------------------------------- diff --git a/docs/test/wideskies/standalone/class-use/StandaloneTest.html b/docs/test/wideskies/standalone/class-use/StandaloneTest.html index 2c252b9..6b1f7e5 100644 --- a/docs/test/wideskies/standalone/class-use/StandaloneTest.html +++ b/docs/test/wideskies/standalone/class-use/StandaloneTest.html @@ -2,7 +2,7 @@ <!-- NewPage --> <html lang="en"> <head> -<!-- Generated by javadoc (version 1.7.0_80) on Sun Jul 24 09:08:59 EDT 2016 --> +<!-- Generated by javadoc (version 1.7.0_80) on Sun Jul 24 11:37:28 EDT 2016 --> <title>Uses of Class test.wideskies.standalone.StandaloneTest</title> <meta name="date" content="2016-07-24"> <link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style"> http://git-wip-us.apache.org/repos/asf/incubator-pirk/blob/2d586b68/docs/test/wideskies/standalone/package-frame.html ---------------------------------------------------------------------- diff --git a/docs/test/wideskies/standalone/package-frame.html b/docs/test/wideskies/standalone/package-frame.html index 66e157b..9c38b32 100644 --- a/docs/test/wideskies/standalone/package-frame.html +++ b/docs/test/wideskies/standalone/package-frame.html @@ -2,7 +2,7 @@ <!-- NewPage --> <html lang="en"> <head> -<!-- Generated by javadoc (version 1.7.0_80) on Sun Jul 24 09:08:59 EDT 2016 --> +<!-- Generated by javadoc (version 1.7.0_80) on Sun Jul 24 11:37:28 EDT 2016 --> <title>test.wideskies.standalone</title> <meta name="date" content="2016-07-24"> <link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style"> http://git-wip-us.apache.org/repos/asf/incubator-pirk/blob/2d586b68/docs/test/wideskies/standalone/package-summary.html ---------------------------------------------------------------------- diff --git a/docs/test/wideskies/standalone/package-summary.html b/docs/test/wideskies/standalone/package-summary.html index 738a93e..26f300f 100644 --- a/docs/test/wideskies/standalone/package-summary.html +++ b/docs/test/wideskies/standalone/package-summary.html @@ -2,7 +2,7 @@ <!-- NewPage --> <html lang="en"> <head> -<!-- Generated by javadoc (version 1.7.0_80) on Sun Jul 24 09:08:59 EDT 2016 --> +<!-- Generated by javadoc (version 1.7.0_80) on Sun Jul 24 11:37:28 EDT 2016 --> <title>test.wideskies.standalone</title> <meta name="date" content="2016-07-24"> <link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style"> http://git-wip-us.apache.org/repos/asf/incubator-pirk/blob/2d586b68/docs/test/wideskies/standalone/package-tree.html ---------------------------------------------------------------------- diff --git a/docs/test/wideskies/standalone/package-tree.html b/docs/test/wideskies/standalone/package-tree.html index 861754c..3458651 100644 --- a/docs/test/wideskies/standalone/package-tree.html +++ b/docs/test/wideskies/standalone/package-tree.html @@ -2,7 +2,7 @@ <!-- NewPage --> <html lang="en"> <head> -<!-- Generated by javadoc (version 1.7.0_80) on Sun Jul 24 09:08:59 EDT 2016 --> +<!-- Generated by javadoc (version 1.7.0_80) on Sun Jul 24 11:37:28 EDT 2016 --> <title>test.wideskies.standalone Class Hierarchy</title> <meta name="date" content="2016-07-24"> <link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style"> http://git-wip-us.apache.org/repos/asf/incubator-pirk/blob/2d586b68/docs/test/wideskies/standalone/package-use.html ---------------------------------------------------------------------- diff --git a/docs/test/wideskies/standalone/package-use.html b/docs/test/wideskies/standalone/package-use.html index 7199028..55f55c5 100644 --- a/docs/test/wideskies/standalone/package-use.html +++ b/docs/test/wideskies/standalone/package-use.html @@ -2,7 +2,7 @@ <!-- NewPage --> <html lang="en"> <head> -<!-- Generated by javadoc (version 1.7.0_80) on Sun Jul 24 09:08:59 EDT 2016 --> +<!-- Generated by javadoc (version 1.7.0_80) on Sun Jul 24 11:37:28 EDT 2016 --> <title>Uses of Package test.wideskies.standalone</title> <meta name="date" content="2016-07-24"> <link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style"> http://git-wip-us.apache.org/repos/asf/incubator-pirk/blob/2d586b68/src/main/java/org/apache/pirk/serialization/HadoopFileSystemStore.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/pirk/serialization/HadoopFileSystemStore.java b/src/main/java/org/apache/pirk/serialization/HadoopFileSystemStore.java index 7e1e475..38239cc 100644 --- a/src/main/java/org/apache/pirk/serialization/HadoopFileSystemStore.java +++ b/src/main/java/org/apache/pirk/serialization/HadoopFileSystemStore.java @@ -45,50 +45,80 @@ public class HadoopFileSystemStore extends StorageService hadoopFileSystem = fs; } + /** + * Creates a new storage service on the given HDFS file system using the given serializer + */ public HadoopFileSystemStore(FileSystem fs, SerializationService serial) { super(serial); hadoopFileSystem = fs; } + /** + * Store the given object into the HDFS file system at the given path name. + * + * @param pathName + * The location to store the object. + * @param value + * The object to store. + * @throws IOException + * If a problem occurs storing the object. + */ public void store(String pathName, Storable value) throws IOException { store(new Path(pathName), value); } + /** + * Store the given object at into the HDFS file system at the given path. + * + * @param path + * The HDFS path descriptor. + * @param obj + * The object to store. + * @throws IOException + * If a problem occurs storing the object at the given path. + */ public void store(Path path, Storable obj) throws IOException { - OutputStream os = hadoopFileSystem.create(path); - try + try (OutputStream os = hadoopFileSystem.create(path)) { serializer.write(os, obj); - } finally - { - if (os != null) - { - os.close(); - } } } + /** + * Retrieves the object stored at the given path name in HDFS. + * + * @param pathName + * The path name where the object is stored. + * @param type + * The type of object being retrieved. + * @return The object stored at that path name. + * @throws IOException + * If a problem occurs retrieving the object. + */ public <T> T recall(String pathName, Class<T> type) throws IOException { return recall(new Path(pathName), type); } + /** + * Retrieves the object stored at the given path in HDFS. + * + * @param path + * The HDFS path descriptor to the object. + * @param type + * The type of object being retrieved. + * @return The object stored at that path. + * @throws IOException + * If a problem occurs retrieving the object. + */ public <T> T recall(Path path, Class<T> type) throws IOException { - InputStream is = hadoopFileSystem.open(path); - try + try (InputStream is = hadoopFileSystem.open(path)) { return serializer.read(is, type); - } finally - { - if (is != null) - { - is.close(); - } } } - } http://git-wip-us.apache.org/repos/asf/incubator-pirk/blob/2d586b68/src/main/java/org/apache/pirk/serialization/JavaSerializer.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/pirk/serialization/JavaSerializer.java b/src/main/java/org/apache/pirk/serialization/JavaSerializer.java index 4228c19..27c3537 100644 --- a/src/main/java/org/apache/pirk/serialization/JavaSerializer.java +++ b/src/main/java/org/apache/pirk/serialization/JavaSerializer.java @@ -27,12 +27,33 @@ import java.io.OutputStream; public class JavaSerializer extends SerializationService { + /** + * Stores the given object on the given stream using Java serialization. + * + * @param stream + * The stream on which to store the object. + * @param obj + * The object to be stored. + * @throws IOException + * If a problem occurs storing the object on the given stream. + */ + public void write(OutputStream stream, Storable obj) throws IOException { ObjectOutputStream oos = new ObjectOutputStream(stream); oos.writeObject(obj); } + /** + * Read an object from the given stream of the given type. + * + * @param stream + * The stream from which to read the object. + * @param type + * The type of object being retrieved. + * @throws IOException + * If a problem occurs reading the object from the stream. + */ @SuppressWarnings("unchecked") public <T> T read(InputStream stream, Class<T> type) throws IOException { @@ -45,5 +66,4 @@ public class JavaSerializer extends SerializationService throw new RuntimeException(e); } } - } http://git-wip-us.apache.org/repos/asf/incubator-pirk/blob/2d586b68/src/main/java/org/apache/pirk/serialization/LocalFileSystemStore.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/pirk/serialization/LocalFileSystemStore.java b/src/main/java/org/apache/pirk/serialization/LocalFileSystemStore.java index 50d11c3..cdc4d84 100644 --- a/src/main/java/org/apache/pirk/serialization/LocalFileSystemStore.java +++ b/src/main/java/org/apache/pirk/serialization/LocalFileSystemStore.java @@ -25,7 +25,6 @@ import java.io.IOException; public class LocalFileSystemStore extends StorageService { - /** * Creates a new storage service on the local file system using default Java serialization. */ @@ -34,49 +33,79 @@ public class LocalFileSystemStore extends StorageService super(); } + /** + * Creates a new storage service on the local file system using the given serializer. + */ public LocalFileSystemStore(SerializationService serial) { super(serial); } + /** + * Stores the given object at the given path. The object is serialized using the configured serializer. + * + * @param path + * The local file system path. + * @param obj + * The object to store. + * @throws IOException + * If a problem occurs storing the object. + */ public void store(String path, Storable obj) throws IOException { store(new File(path), obj); } + /** + * Stores the given object at the given file location. The object is serialized using the configured serializer. + * + * @param path + * The local file system location to store the object. + * @param obj + * The object to store. + * @throws IOException + * If a problem occurs storing the object. + */ public void store(File file, Storable obj) throws IOException { - FileOutputStream fos = new FileOutputStream(file); - try + try (FileOutputStream fos = new FileOutputStream(file)) { serializer.write(fos, obj); - } finally - { - if (fos != null) - { - fos.close(); - } } } + /** + * Returns the object stored in the local file system at the given path. + * + * @param path + * The local file system path. + * @param type + * The type of object being retrieved. + * @return The object retrieved from the store. + * @throws IOException + * If a problem occurs retrieving the object. + */ public <T> T recall(String path, Class<T> type) throws IOException { return recall(new File(path), type); } + /** + * Returns the object stored in the local file system at the given file location. + * + * @param file + * The local file system location. + * @param type + * The type of object being retrieved. + * @return The object retrieved from the store. + * @throws IOException + * If a problem occurs retrieving the object. + */ public <T> T recall(File file, Class<T> type) throws IOException { - FileInputStream fis = new FileInputStream(file); - try + try (FileInputStream fis = new FileInputStream(file)) { return serializer.read(fis, type); - } finally - { - if (fis != null) - { - fis.close(); - } } } - } http://git-wip-us.apache.org/repos/asf/incubator-pirk/blob/2d586b68/src/main/java/org/apache/pirk/serialization/Storable.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/pirk/serialization/Storable.java b/src/main/java/org/apache/pirk/serialization/Storable.java index d9e2fb3..e3b83ca 100644 --- a/src/main/java/org/apache/pirk/serialization/Storable.java +++ b/src/main/java/org/apache/pirk/serialization/Storable.java @@ -18,7 +18,9 @@ *******************************************************************************/ package org.apache.pirk.serialization; -// Marker interface +/** + * Marker interface for objects that can be stored in a storage service. + */ public interface Storable { http://git-wip-us.apache.org/repos/asf/incubator-pirk/blob/2d586b68/src/main/java/org/apache/pirk/serialization/StorageService.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/pirk/serialization/StorageService.java b/src/main/java/org/apache/pirk/serialization/StorageService.java index 775a313..a4910df 100644 --- a/src/main/java/org/apache/pirk/serialization/StorageService.java +++ b/src/main/java/org/apache/pirk/serialization/StorageService.java @@ -18,6 +18,9 @@ *******************************************************************************/ package org.apache.pirk.serialization; +/* + * Common supertype for types that can store objects using serialization. + */ abstract class StorageService { SerializationService serializer;
